public function checkForReplaceMnet() { if (isset($_GET['replace_mnet'])) { $home = GcrEschoolTable::getHome(); if (!($var = $home->getConfigVar('gc_replace_mnet_token' . $_GET['replace_mnet']))) { global $CFG; $CFG->current_app->gcError('No Token Stored in gchome.config table for mnet replacement', 'gcpageaccessdenied'); } else { if ($var != $_GET['replace_mnet']) { global $CFG; GcrEschoolTable::getHome()->deleteFromMdlTable('config', 'name', 'gc_replace_mnet_token' . $_GET['replace_mnet']); $CFG->current_app->gcError('Mnet replacement token ' . $_GET['replace_mnet'] . ' does not match record ' . $var, 'gcpageaccessdenied'); } } $this->replaceMnetKeys(); print '<div id="mnet_replacement"></div>'; die; } }
print GcrEschoolTable::getHome()->getUrl() . '/homeadmin/createCommission'; ?> " method="POST"> <fieldset> <label for="institution">Platform: </label> <select id="institution" name="institution" style="width:95%"> <?php foreach (GcrInstitutionTable::getInstitutions() as $institution) { print "<option value={$institution->getShortName()}>{$institution->getFullName()} ({$institution->getShortName()})</option>"; } ?> </select> <label for="institution">Catalog: </label> <select id="eschool" name="eschool" style="width:95%"> <?php foreach (GcrEschoolTable::getEschools() as $eschool) { print "<option value={$eschool->getShortName()}>{$eschool->getFullName()} ({$eschool->getShortName()})</option>"; } ?> </select> <label for="commission_rate">Commission Rate %: </label> <input type="text" name="commission_rate" id="commission_rate" value="" /> </fieldset> </form> </div> <form id="deleteCommissionForm" name="deleteCommissionForm" value="-1" action="<?php print GcrEschoolTable::getHome()->getUrl(); ?> /homeadmin/deleteCommission" method="POST"> <input id="del_commission_id" name="del_commission_id" type="hidden" /> </form>
public function setMdlCacheSettings() { $dataroot = gcr::moodledataDir; $home = GcrEschoolTable::getHome(); $home_short_name = $home->getShortName(); $home_config_file = $dataroot . $home_short_name . '/muc/config.php'; $home_site_indentifier = md5((string) $home->getConfigVar('siteidentifier')); $site_identifier = md5((string) $this->getConfigVar('siteidentifier')); $memcached_prefix = $this->id; $config_file = $dataroot . $this->short_name . '/muc/config.php'; exec('cp ' . $home_config_file . ' ' . $config_file); exec("sed 's/{$home_short_name}/{$memcached_prefix}/g' {$config_file} > {$config_file}_tmp"); exec("sed 's/{$home_site_indentifier}/{$site_identifier}/g' {$config_file}_tmp > {$config_file}"); exec('rm ' . $config_file . '_tmp'); $this->deleteCacheDirectories(); }
print GcrPurchaseTable::gc_format_money($amount); ?> </td> <?php if ($payoff->isPending()) { ?> <td> <form action="<?php print GcrEschoolTable::getHome()->getUrl() . '/homeadmin/approvePayoff?id=' . $payoff->getId(); ?> " method="POST"> <button type="submit" class="approvePayoffButton form_button button">Approve</button> </form> </td> <?php } else { print '<td> </td>'; } ?> <td> <input type="button" class="form_button button" value="Delete" onclick="return confirmClick('Are you sure you want to delete this transaction?', '<?php print GcrEschoolTable::getHome()->getUrl() . '/homeadmin/deletePayoff?id=' . $payoff->getId(); ?> ')" /> </td> </tr> <?php } ?> </tbody> </table>
public function executeDoEschoolSettings(sfWebRequest $request) { global $CFG; $this->authorizeUser(); if (!($eschool_short_name = $request->getParameter('eschool_short_name'))) { $this->redirect(GcrEschoolTable::getHome()->getUrl() . '/homeadmin/eschool'); } $this->eschool = GcrEschoolTable::getEschool($eschool_short_name); if ($this->eschool->isTemplate() && !$CFG->current_app->hasPrivilege('GCHomeAdmin')) { $CFG->current_app->gcError('Unauthorized attempt to access template settings', 'gcpageaccessdenied'); } $this->eschoolSettingsForm = new GcrEschoolSettingsForm(); $form = $request->getPostParameters(); $this->eschoolSettingsForm->bind($form); if ($this->eschoolSettingsForm->isValid()) { $config_settings = array('gc_course_fee_percent' => $form['course_gc_fee'], 'owner_course_fee_percent' => $form['course_owner_fee'], 'gc_classroom_trial_length' => $form['classroom_trial_length'], 'gc_classroom_cost_month' => $form['classroom_cost_month'], 'gc_classroom_cost_year' => $form['classroom_cost_year'], 'gc_classroom_fee_percent' => $form['classroom_gc_fee'], 'gc_auto_creates_users' => $form['gc_auto_creates_users']); foreach ($config_settings as $config_setting => $form_value) { if ($form_value == '') { $this->eschool->deleteFromMdlTable('config', 'name', $config_setting); } else { $this->eschool->setConfigVar($config_setting, $form_value); } } $is_public = $form['is_public'] == 'on'; $visible = $form['is_visible'] == 'on'; $this->eschool->setIsPublic($is_public); $this->eschool->setVisible($visible); $this->eschool->save(); $_SESSION['eschoolSettingsSaved'] = 'Settings Saved'; $this->redirect('homeadmin/configEschool?eschoolList=' . $this->eschool->getShortName()); } else { $this->setTemplate('eschoolConfig'); } }
public function executeDoManualPayoff(sfWebRequest $request) { global $CFG; $CFG->current_app->requireLogin(); $this->current_user = $CFG->current_app->getCurrentUser(); if (!$this->current_user->getRoleManager()->hasPrivilege('GCUser')) { $CFG->current_app->gcError('Non-privileged attempted access to ' . $form['user_eschool_id'] . ' createWithdrawal with user ID ' . $form['user_id'], 'gcpageaccessdenied'); } $form = $request->getPostParameters(); if ($form['payoff_id'] != '') { if (!($this->payoff = Doctrine::getTable('GcrPayoff')->find($form['payoff_id']))) { $CFG->current_app->gcError('Payoff ID: ' . $form['id'] . ' does not exist', 'gcdatabaseerror'); } if (!$this->payoff->isManual()) { $CFG->current_app->gcError('Payoff ID ' . $this->payoff->getId() . ' is not of type manual', 'gcdatabaseerror'); } $this->institution = GcrInstitutionTable::getInstitution($this->payoff->getEschoolId()); $user_institution = GcrInstitutionTable::getInstitution($this->payoff->getUserEschoolId()); if (!($this->user = $user_institution->getUserById($this->payoff->getUserId()))) { $CFG->current_app->gcError('Local User with ID ' . $this->payoff->getUserId() . ' on eschool ' . $user_institution->getShortName() . ' does not exist', 'gcdatabaseerror'); } if (!($this->credentials = $this->payoff->getCredentials())) { $CFG->current_app - gcError('Payoff ID ' . $this->payoff->getId() . ' has no credentials', 'gcdatabaserror'); } if (!($purchase = $this->payoff->getPurchase())) { $CFG->current_app->gcError('Payoff ID ' . $this->payoff->getId() . ' purchase ID ' . $this->payoff->getPurchaseId() . ' does not exist.', 'gcdatabaseerror'); } } else { $this->institution = GcrInstitutionTable::getInstitution($form['eschool_id']); $user_institution = GcrInstitutionTable::getInstitution($form['user_eschool_id']); if (!($this->user = $user_institution->getUserById($form['user_id']))) { $CFG->current_app->gcError('Local User with ID ' . $form['user_id'] . ' on eschool ' . $user_institution->getShortName() . ' does not exist', 'gcdatabaseerror'); } if (!($this->credentials = $this->user->getAccountManager()->getPayoffCredentials())) { $CFG->current_app->gcError('No payoff credentials found for ' . $form['user_eschool_id'] . ' createWithdrawal with user ID ' . $form['user_id'], 'gcpageaccessdenied'); } $this->payoff = new GcrPayoff(); $this->payoff->setUserId($this->user->getObject()->id); $this->payoff->setUserEschoolId($form['user_eschool_id']); $this->payoff->setEschoolId($form['eschool_id']); $this->payoff->setPayoffStatus('completed'); $this->payoff->setCredentialsId($this->credentials->getId()); } unset($form['payoff_id']); $manual_payoff_form = new GcrPayoffManualForm(); $manual_payoff_form->bind($form); if ($manual_payoff_form->isValid()) { $this->payoff->setAmount($form['amount']); $form['transtime'] = GcrPurchaseTable::convertDatetoTimestamp($form['transtime']); $this->payoff->setTransTime($form['transtime']); $this->payoff->setPayoffType($this->user->getAccountManager()->getPayoffType() . '_manual'); $url = GcrEschoolTable::getHome()->getUrl() . '/account/view?eschool=' . $this->institution->getShortName() . '&user='******'type'] == 'check') { if ($this->payoff->isManualCheckPayment()) { if (!($address = $this->payoff->getAddressObject())) { $CFG->current_app->gcError('Payoff ID ' . $this->payoff->getId() . ' has non-existant address value'); } } else { $address = new GcrAddress(); } $address->setStreet1($form['street1']); $address->setStreet2($form['street2']); $address->setCity($form['city']); $address->setZipcode($form['zipcode']); $address->setState($form['state']); $address->setCountry($form['country']); $address->save(); $this->payoff->setAddress($address->getId()); } if ($form['description'] == '') { $description = 'Manual Account Withdrawal'; } else { $description = $form['description']; } if ($purchase) { $purchase->setPurchaseTypeDescription($description); $purchase->setAmount($this->payoff->getAmount()); $purchase->setTransTime($form['transtime']); $purchase->setProfileId($form['reference_id']); $purchase->save(); } else { $purchase = $this->payoff->createPurchaseRecord($description, $form['transtime'], $form['reference_id']); } $this->payoff->save(); $purchase->updateRelatedAccounting(); $this->redirect($url); } $this->payoff_id = $this->payoff->getId(); $this->payoff_form = $manual_payoff_form; $this->setTemplate('manualPayoff'); }
public function mnetReplacement() { $this->start_time = time(); $this->operation_description = 'MNET Connection Replacement'; $this->max_failures_allowed = 10; $home = GcrEschoolTable::getHome(); $token = GcrEschoolTable::generateRandomString(); $home->setConfigVar('gc_replace_mnet_token' . $token, $token); foreach ($this->app_array as $institution) { if ($this->kill_operation) { exit; } $this->replaceMnetInstitution($institution, $token); } $home->deleteFromMdlTable('config', 'name', 'gc_replace_mnet_token' . $token); $this->close(); }
?> </td> <td> <?php echo $settingsForm['eclassroom_create_institution']->render(); ?> </td> <td> <?php echo $settingsForm['eclassroom_create_institution']->renderError(); ?> </td> </tr> <tr> <td colspan="3" class="gcFieldDescription"> When this setting is turned on, eClassroom owners are provided with an institution and are assigned as an administrator on that institution. This allows them to create and manage new users as members of their institution. </td> </tr> <tr> <td colspan="2"> <input type="submit" class="button" value="Save Changes" style="margin-top: 15px;" /> <input type="button" class="button" value="Exit" onclick="window.location.href='<?php print GcrEschoolTable::getHome()->getUrl() . '/homeadmin/eschool'; ?> '" /> </td> </tr> </table> </form>
<?php $app = gcr::getApp(); if ($app->isMoodle()) { $app = $app->getInstitution(); } $home = GcrEschoolTable::getHome(); ?> <div id="sb-configuresite" class="sideblock sideblock-1"> <h3>Configure Site</h3> <div class="sideblock-content"> <ul> <li id="sb-siteoptions"> <a href="<?php echo $app->getAppUrl(); ?> admin/site/options.php">Site options</a> </li> <li id="sb-editsitepages"> <a href="<?php echo $app->getAppUrl(); ?> admin/site/pages.php">Edit site pages</a> </li> <li id="sb-menus"> <a href="<?php echo $app->getAppUrl(); ?> admin/site/menu.php">Menus</a> </li> <li id="sb-networking">