public function executeDoSetChainedPayments(sfWebRequest $request) { global $CFG; $this->authorizeUser(); $flag = false; $form = $request->getPostParameters(); $institution = GcrInstitutionTable::getInstitution($form['chained_payments_institution_id']); $user = $institution->getUserById($form['chained_payments_user_id']); if ($form['use_chained_payments'] == 'on') { $flag = true; } $user->getAccountManager()->setChainedPaymentsAllowed($flag); $_SESSION['chainedPaymentsSettingsSaved'] = 'Saved'; $this->redirect($CFG->current_app->getUrl() . '/homeadmin/setChainedPayments?eschool=' . $form['chained_payments_institution_id'] . '&user='******'chained_payments_user_id']); }
public function executeUpdateMhrConfig(sfWebRequest $request) { global $CFG; $this->checkAuthorization(); $this->forward404Unless($request->isMethod(sfRequest::POST)); $form = $request->getPostParameters(); if ($form['institution'] == '1') { $institutions = Doctrine::getTable('GcrInstitution')->findAll(); } else { if ($institution = GcrInstitutionTable::getInstitution($form['institution'])) { $institutions = array($institution); } } $admin_operation = new GcrAdminOperation($institutions); $admin_operation->updateMhrConfig($form['config'], $form['newConfigValue']); $_SESSION['adminEschoolActionMessage'] = $admin_operation->getMessage(); $this->redirect($CFG->current_app->getUrl() . '/admin/eschool'); }
protected function authorizeAccountAccess() { global $CFG; $CFG->current_app->requireLogin(); $this->current_user = $CFG->current_app->getCurrentUser(); $this->gc_admin = false; if (!isset($this->owner)) { $this->owner = $CFG->current_app->hasPrivilege('Owner'); } // Check for homeadmin access to accounting where the schema can be set as // a parameter if ($CFG->current_app->isHome() && $CFG->current_app->isMoodle()) { if (!$CFG->current_app->hasPrivilege('GCUser')) { $CFG->current_app->gcError('Non-privileged attempted access to startadmin accounting page', 'gcpageaccessdenied'); } $this->gc_admin = true; $short_name = $this->request->getParameter('eschool'); if ($short_name) { $this->app = GcrInstitutionTable::getInstitution($short_name, true); } } else { $CFG->current_app->requireMahara(); } // Only allow access to current_app for normal access to accounting (not startadmin) if (!isset($this->app) || !$this->app) { $this->app = $CFG->current_app->getInstitution(); } // Check for owner privilege level. If so, we allow a user parameter to see // other users' accounts on the platform if ($this->owner) { $user_id = $this->request->getParameter('user'); if ($user_id) { $this->user = $this->app->getUserById($user_id); } else { // We set the owner as $this->user for gcUsers who // are administering the platform. $this->user = $this->app->getOwnerUser(); } } // Default to showing current user's account. if (!$this->user) { $this->user = $this->current_user; } }
<?php require_once '../config.php'; global $CFG; $url = $CFG->current_app->getUrl(); if (isset($_GET['eschool']) && isset($_GET['course'])) { if (isset($_COOKIE['gc_platform'])) { $institution = GcrInstitutionTable::getInstitution($_COOKIE['gc_platform']); } else { $institution = $CFG->current_app; } $eschool = GcrEschoolTable::getEschool($_GET['eschool']); $course = $eschool->getCourse($_GET['course']); if ($course) { $url = $eschool->getAppUrl() . '/course/view.php?id=' . $course->getObject()->id . '&transfer=' . $institution->getShortName(); } } redirect($url);
public function getInstitution() { return GcrInstitutionTable::getInstitution($this->user_institution_id); }
<?php global $CFG; $institution = GcrInstitutionTable::getInstitution($eschool_name); $mhr_user_obj = $institution->getOwnerUser()->getObject(); ?> <form enctype="multipart/form-data" id="eschoolManualForm" name="eschoolManualForm" action="/homeadmin/doManualEschool" method="POST"> <table id="eschool_manual_form" cellpadding="5"> <?php echo $eschoolManualForm->renderHiddenFields(); ?> <input name="user_institution_id" id="user_institution_id" type="hidden" value="<?php print $eschool_name; ?> " /> <tr> <td> eSchool Name: </td> <td> <?php print $institution->getFullName() . ' (' . $eschool_name . ')'; ?> </td> <td>  </td> </tr> <tr> <td> eSchool Owner: </td> <td>
public function getUserInstitution() { return GcrInstitutionTable::getInstitution($this->user_eschool_id); }