public function setObject() { $arr = explode('_', $this->id); $this->object = GcrEschoolTable::getEschool($arr[0]); $this->mdl_course = $this->object->selectFromMdlTable('course', 'id', $arr[1], true); $course = new GcrMdlCourse($this->mdl_course, $this->object); if ($course->isRepresented()) { $this->mdl_course = $course->getCourseCollection()->getRepresentativeCourse()->getObject(); } }
public function getEschools($refresh = false) { if (!$this->eschools || $refresh) { $mhr_gcr_institution_catalogs = $this->getMhrGcrInstitutionCatalogs(); if ($mhr_gcr_institution_catalogs) { foreach ($mhr_gcr_institution_catalogs as $mhr_gcr_institution_catalog) { $eschool = GcrEschoolTable::getEschool($mhr_gcr_institution_catalog->eschool_id, true); if ($eschool) { $this->eschools[] = $eschool; } } } } return $this->eschools; }
function potentialcatalogs_submit(Pieform $form, $values) { global $CFG; foreach ($values['potentialcatalogs'] as $eschool_short_name) { if ($eschool_short_name != '0') { $eschool = GcrEschoolTable::getEschool($eschool_short_name); if ($eschool->getOrganizationId() != $CFG->current_app->getId()) { if ($eschool->getIsPublic() || $CFG->current_app->hasPrivilege('GCUser')) { $CFG->current_app->createMnetConnection($eschool); $eschool->setMnetConnection($CFG->current_app); } } } } redirect("/artefact/courses/catalogs.php"); }
public function executeAutoUpdates(sfWebRequest $request) { global $CFG; $this->checkAuthorization(); $this->forward404Unless($request->isMethod(sfRequest::POST)); $form = $request->getPostParameters(); if ($form['eschool'] == '1') { $eschools = Doctrine::getTable('GcrEschool')->findAll(); } else { if ($eschool = GcrEschoolTable::getEschool($form['eschool'])) { $eschools = array($eschool); } } $count = GcrBackgroundProcessTypeMoodleUpdates::createProcess($eschools); $_SESSION['adminEschoolActionMessage'] = 'Moodle Updates started, ' . $count . ' processes were created. (check debug/error.log for updates)'; $this->redirect($CFG->current_app->getUrl() . '/admin/eschool'); }
public function executeTranscript(sfWebRequest $request) { global $CFG; $this->authorizeHistory(); $form = $request->getPostParameters(); $enrolments = array(); foreach ($form as $key => $value) { $key_data = explode('&', $key); $eschool = GcrEschoolTable::getEschool($key_data[0]); $mdl_user_enrolment = $eschool->selectFromMdlTable('user_enrolments', 'id', $key_data[1], true); $enrolment = new GcrMdlUserEnrolment($mdl_user_enrolment, $eschool); if ($this->is_user) { $mhr_user = $enrolment->getUser(); if ($this->user->getObject()->id == $mhr_user->getObject()->id) { $enrolments[] = $enrolment; } } else { $enrolments[] = $enrolment; } } $this->course_history_table = new GcrCourseHistoryTable($enrolments, $this->user, 0, false, $this->gc_admin, $this->owner, false); $this->course_history_table->printTableAsPdf(); die; }
public function executeDoManualClassroom(sfWebRequest $request) { $this->authorizeUser(); global $CFG; $form = $request->getPostParameters(); if ($form['id'] != '') { // Edit of existing purchase $purchase = $this->getManualPurchase($form['id'], 'classroom'); $institution = $this->eschool->getInstitution(); if (!($mhr_user = $institution->selectFromMhrTable('usr', 'id', $form['purchase_user_field'], true))) { $CFG->current_app->gcError('Invalid user ID ' . $form['purchase_user_field'], 'gcdatabaseerror'); } $manual_purchase_form = new GcrPurchaseClassroomManualForm($purchase, array('eschool' => $institution)); $form['user_id'] = $mhr_user->id; $form['amount'] = $form['amount_field']; $form['gc_fee'] = $this->eschool->getGcFeeClassroom(); $form['bill_cycle'] = GcrPurchaseTable::convertDatetoTimestamp($form['bill_cycle']); $form['trans_time'] = GcrPurchaseTable::convertDatetoTimestamp($form['trans_time']); $manual_purchase_form->bind($form); if ($manual_purchase_form->isValid()) { $purchase = $manual_purchase_form->save(); $purchase->updateRelatedAccounting(); $this->redirect($CFG->current_app->getUrl() . '/account/view?eschool=' . $institution->getShortName()); } } else { // New purchase if ($short_name = $form['purchase_type_eschool_field']) { $this->eschool = GcrEschoolTable::getEschool($short_name); } else { $CFG->current_app->gcError('eSchool Parameter Missing', 'gcdatabaseerror'); } $institution = $this->eschool->getInstitution(); $manual_purchase_form = new GcrPurchaseClassroomManualForm(array(), array('eschool' => $institution)); $form['purchase_type'] = 'classroom_manual'; $form['purchase_type_description'] = 'Manual eClassroom Transaction'; $form['purchase_type_quantity'] = 1; $form['purchase_type_id'] = $this->eschool->getShortName(); $form['user_id'] = $form['purchase_user_field']; $form['purchase_type_eschool_id'] = $form['purchase_type_eschool_field']; $form['user_institution_id'] = $institution->getShortName(); $form['amount'] = $form['amount_field']; $form['gc_fee'] = $this->eschool->getGcFeeClassroom(); $form['owner_fee'] = 0; $form['seller_id'] = 0; $form['bill_cycle'] = GcrPurchaseTable::convertDatetoTimestamp($form['bill_cycle']); $form['trans_time'] = GcrPurchaseTable::convertDatetoTimestamp($form['trans_time']); $manual_purchase_form->bind($form); if ($manual_purchase_form->isValid()) { if (!($mhr_user = $institution->selectFromMhrTable('usr', 'id', $form['purchase_user_field'], true))) { $CFG->current_app->gcError('Invalid user ID ' . $form['purchase_user_field'], 'gcdatabaseerror'); } $mhr_user = new GcrMhrUser($mhr_user, $institution); $purchase = $manual_purchase_form->save(); $purchase->assignSeller(); if (!$mhr_user->hasEclassroom($this->eschool)) { $institution->createEclassroom($mhr_user, $this->eschool); } $purchase->updateRelatedAccounting(); $this->redirect($CFG->current_app->getUrl() . '/account/view?eschool=' . $institution->getShortName()); } } $this->classroom_form = $manual_purchase_form; $this->setTemplate('manualClassroom'); }
function remove_submit(Pieform $form, $values) { global $CFG; $mhr_institution_obj = $CFG->current_app->selectFromMhrTable('institution', 'name', $values['institution_name'], true); if (!$mhr_institution_obj) { $CFG->current_app->gcError('MhrInstitution does not exist with name ' . $values['institution_name'], 'gcdatabaseerror'); } $mhr_institution = new GcrMhrInstitution($mhr_institution_obj, $CFG->current_app); foreach ($values['eschools'] as $eschool) { $eschool = GcrEschoolTable::getEschool($eschool); $mhr_institution->removeEschool($eschool); } redirect("/artefact/eschooladmin/institutioncatalogs.php?institution=" . $values['institution_name']); }
<?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 checkForJumpRequest() { if (strpos($_SERVER['REQUEST_URI'], '/auth/xmlrpc/jump.php')) { if (!isset($_GET['wr']) && isset($_GET['hostwwwroot'])) { // Ron Stewart: 06/14/2012 // This is a bug fix for moodle generated urls which only provide // a hostwwwroot parameter to feed to the remote mnet host's jump // page. IMO, this should be corrected on the mahara side, since // connected network nodes cannot be expected to provide an // instance id (ins param) for their host record on the mahara side. // For the time being, correcting the params here is the most lightweight // way of dealing with the issue (no overwrites required). $remotewwwroot = $_GET['hostwwwroot']; $short_name = GcrEschoolTable::parseShortNameFromUrl($remotewwwroot); $eschool = GcrEschoolTable::getEschool($short_name); $mhr_auth_instance = $this->getAuthInstance($eschool); if ($mhr_auth_instance) { $_GET['wr'] = $remotewwwroot; $_GET['ins'] = $mhr_auth_instance->id; } } else { $remotewwwroot = param_variable('wr'); $short_name = GcrEschoolTable::parseShortNameFromUrl($remotewwwroot); } if (isset($_COOKIE['gc_eschools'])) { if (strpos($_COOKIE['gc_eschools'], ';' . $short_name . ';') === false) { setcookie('gc_eschools', $_COOKIE['gc_eschools'] . $short_name . ';', false, '/'); } } else { setcookie('gc_eschools', ';' . $short_name . ';', false, '/'); } } }
public function setObject() { $this->object = GcrEschoolTable::getEschool($this->id); }