protected function initialize() { $this->apps = array(); $job_data = $this->process->getJobData(); $short_names = explode(';', $job_data); foreach ($short_names as $short_name) { $app = GcrInstitutionTable::getApp($short_name); if ($app) { $this->apps[] = $app; } } }
public static function refreshUrl($mdl_mediaelementjs) { $url = $mdl_mediaelementjs->externalurl; if (strpos($url, 'institution/getUserStorageFile?')) { $file_param = self::FILE_GET_PARAMETER . '='; $str_start = strpos($url, $file_param); if ($str_start) { $short_name = GcrEschoolTable::parseShortNameFromUrl($url); $app = GcrInstitutionTable::getApp($short_name); $institution = $app->getInstitution(); $short_name = $institution->getShortName(); $str_start += strlen($file_param); $str_end = strpos($url, '&', $str_start); $filename = substr($url, $str_start, $str_end - $str_start); $filename = urldecode($filename); $str_start = strpos($url, '&app='); if ($str_start) { $str_start += strlen('&app='); $str_end = strpos($url, '&', $str_start); $short_name_user_app = substr($url, $str_start, $str_end - $str_start); $user_app = GcrInstitutionTable::getApp($short_name_user_app); if ($user_app) { $short_name = $short_name_user_app; } } $params = array(self::FILE_GET_PARAMETER => $filename, 'course_id' => $mdl_mediaelementjs->course, 'app' => $short_name); $mdl_mediaelementjs->externalurl = GcrStorageAccessS3::generateStaticUrl($filename, $params, $app); } } return $mdl_mediaelementjs; }
public function executeExecuteSqlStatement(sfWebRequest $request) { global $CFG; $this->checkAuthorization(); $this->forward404Unless($request->isMethod(sfRequest::POST)); $form = $request->getPostParameters(); if ($form['schema'] == '1' || $form['schema'] == '2') { if ($form['schema'] == '1') { $schemaList = Doctrine::getTable('GcrEschool')->findAll(); } else { $schemaList = Doctrine::getTable('GcrInstitution')->findAll(); } } else { if ($app = GcrInstitutionTable::getApp($form['schema'])) { $schemaList = array($app); } } $admin_operation = new GcrAdminOperation($schemaList); $admin_operation->executeSqlStatement($form['sqlStatementStart'], $form['sqlStatementEnd']); $_SESSION['adminEschoolActionMessage'] = $admin_operation->getMessage(); $this->redirect($CFG->current_app->getUrl() . '/admin/eschool'); }
public function getPurchaseTypeApp() { return GcrInstitutionTable::getApp($this->purchase_type_eschool_id); }
protected function validateEschoolShortName($shortName) { global $CFG; $shortNameValid = true; if (!GcrEschoolTable::isShortNameValid($shortName)) { $this->formErrors['short_nameSize'] = 'eClassroom URL must be 2-32 alphanumeric characters (1st character must be a letter).'; $shortNameValid = false; } if (GcrEschoolTable::isShortNameUsed($shortName)) { $app = GcrInstitutionTable::getApp($shortName); if (!$CFG->current_app->hasPrivilege('GCUser') || $app->isMahara()) { $this->formErrors['short_nameUsed'] = 'eClassroom URL is already in use.'; $shortNameValid = false; } } if (GcrEschoolTable::isShortNameReserved($shortName)) { $this->formErrors['short_nameReserved'] = 'eClassroom URL is a reserved word.'; $shortNameValid = false; } return $shortNameValid; }
$url = false; // Check Authentication if (!$CFG->current_app->isMahara() && !$CFG->current_app->isHome()) { $CFG->current_app->gcError('Attempt to access go-to-platform from outside start schema', 'gcdatabaseerror'); } $current_user = $CFG->current_app->getCurrentUser(); $role_manager = $current_user->getRoleManager(); if (!$role_manager->hasPrivilege('GCStaff')) { $CFG->current_app->gcError('Unprivileged attempt to access go-to-platform', 'gcdatabaseerror'); } if (isset($_POST['platform_selector'])) { $id = $_POST['platform_selector']; } else { $id = $_GET['id']; } $app = GcrInstitutionTable::getApp($id); if (!$app) { $CFG->current_app->gcError('Schema with shortname ' . $id . ' does not exist,', 'gcdatabaseerror'); } if ($app->isMoodle()) { $institution = $app->getInstitution(); } else { $institution = $app; } $current_user_obj = $current_user->getObject(); $mhr_user_obj = $institution->getMhrUserByUsername($current_user_obj->username); // if the user's account doesn't exist on the institution (check for email address) if (!$mhr_user_obj) { $admin = 0; if ($role_manager->hasPrivilege('GCUser')) { // we only give site admin privilege to those on home who are
protected function verifyPurchaseTypeEschoolId($short_name) { global $CFG; if ($app = GcrInstitutionTable::getApp($short_name)) { $institution = $app->getInstitution(); $current_institution = $CFG->current_app->getInstitution(); if ($institution->getShortName() == $current_institution->getShortName()) { return true; } } $CFG->current_app->gcError('Purchase type ' . $form['purchase_type'] . ': ID ' . $form['purchase_type_id'] . ': Purchase Type Eschool Not Found.', 'purchasetypeeschoolnotfound'); }
public function executeAdminAccess(sfWebRequest $request) { $this->authorizeUser(); if ($this->authorizeHomeAdmin()) { if ($short_name = $request->getParameter('eschoolList')) { $app = GcrInstitutionTable::getApp($short_name); $this->redirect($app->setupAdminAutoLogin()); } } global $CFG; $this->redirect($CFG->current_app->getUrl() . '/homeadmin/eschool'); }
public function getApp() { return GcrInstitutionTable::getApp($this->app_id); }