function GetCurrentMP($mp, $date, $error = true) { global $_openSIS; switch ($mp) { case 'FY': $table = 'school_years'; break; case 'SEM': $table = 'school_semesters'; break; case 'QTR': $table = 'school_quarters'; break; case 'PRO': $table = 'school_progress_periods'; break; } if (!$_openSIS['GetCurrentMP'][$date][$mp]) { $_openSIS['GetCurrentMP'][$date][$mp] = DBGet(DBQuery('SELECT MARKING_PERIOD_ID FROM ' . $table . ' WHERE \'' . $date . '\' BETWEEN START_DATE AND END_DATE AND SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\'')); } if ($_openSIS['GetCurrentMP'][$date][$mp][1]['MARKING_PERIOD_ID']) { return $_openSIS['GetCurrentMP'][$date][$mp][1]['MARKING_PERIOD_ID']; } elseif (strpos($_SERVER['PHP_SELF'], 'Side.php') === false && $error == true) { ErrorMessage(array('' . _("You are not currently in a marking period") . '')); } //ShowErr("You are not currently in a marking period"); }
public function Add($ActivityUserID, $ActivityType, $Story = '', $RegardingUserID = '', $CommentActivityID = '', $Route = '') { // Make sure the user is authenticated // Get the ActivityTypeID & see if this is a notification $ActivityType = $this->SQL->Select('ActivityTypeID, Notify')->From('ActivityType')->Where('Name', $ActivityType)->Get()->FirstRow(); if ($ActivityType !== FALSE) { $ActivityTypeID = $ActivityType->ActivityTypeID; $Notify = $ActivityType->Notify == '1'; } else { trigger_error(ErrorMessage(sprintf('Activity type could not be found: %s', $ActivityType), 'ActivityModel', 'Add'), E_USER_ERROR); } // If this is a notification, increment the regardinguserid's count if ($Notify) { $this->SQL->Update('User')->Set('CountNotifications', 'CountNotifications + 1', FALSE)->Where('UserID', $RegardingUserID)->Put(); } $Fields = array('ActivityTypeID' => $ActivityTypeID, 'ActivityUserID' => $ActivityUserID); if ($Story != '') { $Fields['Story'] = $Story; } if ($Route != '') { $Fields['Route'] = $Route; } if (is_numeric($RegardingUserID)) { $Fields['RegardingUserID'] = $RegardingUserID; } if (is_numeric($CommentActivityID)) { $Fields['CommentActivityID'] = $CommentActivityID; } $this->AddInsertFields($Fields); $this->DefineSchema(); return $this->Insert($Fields); // NOTICE! This will silently fail if there are errors. Developers can figure out what's wrong by dumping the results of $this->ValidationResults(); }
function GetCurrentMP($mp, $date, $error = true) { global $_openSIS; switch ($mp) { case 'FY': $table = 'SCHOOL_YEARS'; break; case 'SEM': $table = 'SCHOOL_SEMESTERS'; break; case 'QTR': $table = 'SCHOOL_QUARTERS'; break; case 'PRO': $table = 'SCHOOL_PROGRESS_PERIODS'; break; } if (!$_openSIS['GetCurrentMP'][$date][$mp]) { $_openSIS['GetCurrentMP'][$date][$mp] = DBGet(DBQuery("SELECT MARKING_PERIOD_ID FROM {$table} WHERE '{$date}' BETWEEN START_DATE AND END_DATE AND SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'")); } if ($_openSIS['GetCurrentMP'][$date][$mp][1]['MARKING_PERIOD_ID']) { return $_openSIS['GetCurrentMP'][$date][$mp][1]['MARKING_PERIOD_ID']; } elseif (strpos($_SERVER['PHP_SELF'], 'Side.php') === false && $error == true) { ErrorMessage(array("You are not currently in a marking period")); } //ShowErr("You are not currently in a marking period"); }
function RegisterGlobalState() { /* Deal with user specified session handlers */ if (session_module_name() == "user") { $phperrorcsession = gettext("PHP ERROR: A custom (user) PHP session have been detected. However, BASE has not been set to explicitly use this custom handler. Set <CODE>use_user_session=1</CODE> in <CODE>base_conf.php</CODE>"); $phperrorcsessioncode = gettext("PHP ERROR: A custom (user) PHP session hander has been configured, but the supplied hander code specified in <CODE>user_session_path</CODE> is invalid."); $phperrorcsessionvar = gettext("PHP ERROR: A custom (user) PHP session handler has been configured, but the implementation of this handler has not been specified in BASE. If a custom session handler is desired, set the <CODE>user_session_path</CODE> variable in <CODE>base_conf.php</CODE>."); if ($GLOBALS['use_user_session'] != 1) { ErrorMessage($phperrorcsession); die; } else { if ($GLOBALS['user_session_path'] != "") { if (is_file($GLOBALS['user_session_path'])) { ErrorMessage(_("Custom User PHP session handlers are deprecated in this version of SIEM Events Console")); die; //include_once ($GLOBALS['user_session_path']); //if ($GLOBALS['user_session_function'] != "") $GLOBALS['user_session_function'](); } else { ErrorMessage($phperrorcsessioncode); die; } } else { ErrorMessage($phperrorcsessionvar); die; } } } //session_start(); //if ($GLOBALS['debug_mode'] > 0) echo '<FONT COLOR="#FF0000">' . gettext("Session Registered") . '</FONT><BR>'; }
function ReverseStatus() { TutupScript(); $AplikanID = $_REQUEST['id']; $StatusMundur = GetaField('aplikan', 'AplikanID', $AplikanID, "StatusMundur"); if ($StatusMundur == 'Y') { $s = "update `aplikan` set StatusMundur = 'N',\r\n\t\t\t\t\t\t\t\t\t\tLoginMundur = '{$_SESSION['_Login']}',\r\n\t\t\t\t\t\t\t\t\t\tTanggalMundur = now()\r\n\t\t\t\t\t\t\t\t\twhere AplikanID='{$AplikanID}'"; $r = _query($s); /*$StatusAplikanMhswUpdate = GetaField('statusaplikanmhsw sam left outer join statusaplikan sa', "sa.Urutan=(select max(Urutan) from statusaplikanmhsw sam2 where sam2.AplikanID='$AplikanID') and sam.AplikanID='$AplikanID' and sam.KodeID", KodeID, 'StatusAplikanMhswID'); $s = "update statusaplikanmhsw setStatusMundur='N' where StatusAplikanMhswID='$StatusAplikanMhswUpdate'"; */ echo "<script>ttutup('{$_SESSION['mnux']}');</script>"; } else { if ($StatusMundur == 'N') { $s = "update `aplikan` set StatusMundur = 'Y' where AplikanID='{$AplikanID}'"; $r = _query($s); echo "<script>ttutup('{$_SESSION['mnux']}');</script>"; } else { echo ErrorMessage("Error", "Status Mundur tidka dikenali. Harap hubungi administrator"); } } }
function RegisterGlobalState() { /* Deal with user specified session handlers */ if (session_module_name() == "user") { if ($GLOBALS['use_user_session'] != 1) { ErrorMessage("PHP ERROR: A custom (user) PHP session have been detected. However, ACID has not been " . "set to explicitly use this custom handler. Set <CODE>use_user_session=1</CODE> in " . "<CODE>acid_conf.php</CODE>"); die; } else { if ($GLOBALS['user_session_path'] != "") { if (is_file($GLOBALS['user_session_path'])) { include_once $GLOBALS['user_session_path']; if ($GLOBALS['user_session_function'] != "") { $GLOBALS['user_session_function'](); } } else { ErrorMessage("PHP ERROR: A custom (user) PHP session hander has been configured, but the supplied " . "hander code specified in <CODE>user_session_path</CODE> is invalid."); die; } } else { ErrorMessage("PHP ERROR: A custom (user) PHP session handler has been configured, but the implementation " . "of this handler has not been specified in ACID. If a custom session handler is desired, " . "set the <CODE>user_session_path</CODE> variable in <CODE>acid_conf.php</CODE>."); die; } } } session_start(); if ($GLOBALS['debug_mode'] > 0) { echo '<FONT COLOR="#FF0000">Session Registered</FONT><BR>'; } }
function get_xmlrpc_error($resp) { if (is_array($resp) && xmlrpc_is_fault($resp)) { $message = 'Moodle Integrator - ' . $resp['faultCode'] . ' - ' . $resp['faultString']; return ErrorMessage(array($message), 'error'); } return null; }
public function Add($ActivityUserID, $ActivityType, $Story = '', $RegardingUserID = '', $CommentActivityID = '', $Route = '', $SendEmail = '') { // Make sure the user is authenticated // Get the ActivityTypeID & see if this is a notification $ActivityTypeRow = $this->SQL->Select('ActivityTypeID, Name, Notify')->From('ActivityType')->Where('Name', $ActivityType)->Get()->FirstRow(); if ($ActivityTypeRow !== FALSE) { $ActivityTypeID = $ActivityTypeRow->ActivityTypeID; $Notify = $ActivityTypeRow->Notify == '1'; } else { trigger_error(ErrorMessage(sprintf('Activity type could not be found: %s', $ActivityType), 'ActivityModel', 'Add'), E_USER_ERROR); } if ($ActivityTypeRow->Name == 'ActivityComment' && $Story == '') { $this->Validation->AddValidationResult('Body', 'You must provide a comment.'); return FALSE; } // Massage $SendEmail to allow for only sending an email. $SendEmail = TRUE; // TODO: Allow just emails. if ($SendEmail == 'Only') { $SendEmail = ''; $AddActivity = FALSE; } else { $AddActivity = TRUE; } // If this is a notification, increment the regardinguserid's count if ($AddActivity && $Notify) { $this->SQL->Update('User')->Set('CountNotifications', 'coalesce(CountNotifications) + 1', FALSE)->Where('UserID', $RegardingUserID)->Put(); } $Fields = array('ActivityTypeID' => $ActivityTypeID, 'ActivityUserID' => $ActivityUserID); if ($Story != '') { $Fields['Story'] = $Story; } if ($Route != '') { $Fields['Route'] = $Route; } if (is_numeric($RegardingUserID)) { $Fields['RegardingUserID'] = $RegardingUserID; } if (is_numeric($CommentActivityID)) { $Fields['CommentActivityID'] = $CommentActivityID; } // if ($AddActivity) { $this->AddInsertFields($Fields); $this->DefineSchema(); $ActivityID = $this->Insert($Fields); // NOTICE! This will silently fail if there are errors. Developers can figure out what's wrong by dumping the results of $this->ValidationResults(); // } // If $SendEmail was FALSE or TRUE, let it override the $Notify setting. if ($SendEmail === FALSE || $SendEmail === TRUE) { $Notify = $SendEmail; } // Otherwise let the decision to email lie with the $Notify setting. // Send a notification to the user. if ($Notify) { $this->SendNotification($ActivityID); } return $ActivityID; }
/** * Checks to see if the user is spamming. Returns TRUE if the user is spamming. */ public function CheckForSpam($Type) { $Spam = FALSE; if (!in_array($Type, array('Comment', 'Discussion'))) { trigger_error(ErrorMessage(sprintf('Spam check type unknown: %s', $Type), 'VanillaModel', 'CheckForSpam'), E_USER_ERROR); } $Session = Gdn::Session(); $CountSpamCheck = $Session->GetAttribute('Count' . $Type . 'SpamCheck', 0); $DateSpamCheck = $Session->GetAttribute('Date' . $Type . 'SpamCheck', 0); $SecondsSinceSpamCheck = time() - Format::ToTimestamp($DateSpamCheck); $SpamCount = Gdn::Config('Vanilla.' . $Type . '.SpamCount'); if (!is_numeric($SpamCount) || $SpamCount < 2) { $SpamCount = 2; } // 2 spam minimum $SpamTime = Gdn::Config('Vanilla.' . $Type . '.SpamTime'); if (!is_numeric($SpamTime) || $SpamTime < 0) { $SpamTime = 30; } // 30 second minimum spam span $SpamLock = Gdn::Config('Vanilla.' . $Type . '.SpamLock'); if (!is_numeric($SpamLock) || $SpamLock < 30) { $SpamLock = 30; } // 30 second minimum lockout // Definition: // Users cannot post more than $SpamCount comments within $SpamTime // seconds or their account will be locked for $SpamLock seconds. // Apply a spam lock if necessary $Attributes = array(); if ($SecondsSinceSpamCheck < $SpamLock && $CountSpamCheck >= $SpamCount && $DateSpamCheck !== FALSE) { // TODO: REMOVE DEBUGGING INFO AFTER THIS IS WORKING PROPERLY /* echo '<div>SecondsSinceSpamCheck: '.$SecondsSinceSpamCheck.'</div>'; echo '<div>SpamLock: '.$SpamLock.'</div>'; echo '<div>CountSpamCheck: '.$CountSpamCheck.'</div>'; echo '<div>SpamCount: '.$SpamCount.'</div>'; echo '<div>DateSpamCheck: '.$DateSpamCheck.'</div>'; echo '<div>SpamTime: '.$SpamTime.'</div>'; */ $Spam = TRUE; $this->Validation->AddValidationResult('Body', sprintf(T('You have posted %1$s times within %2$s seconds. A spam block is now in effect on your account. You must wait at least %3$s seconds before attempting to post again.'), $SpamCount, $SpamTime, $SpamLock)); // Update the 'waiting period' every time they try to post again $Attributes['Date' . $Type . 'SpamCheck'] = Format::ToDateTime(); } else { if ($SecondsSinceSpamCheck > $SpamTime) { $Attributes['Count' . $Type . 'SpamCheck'] = 1; $Attributes['Date' . $Type . 'SpamCheck'] = Format::ToDateTime(); } else { $Attributes['Count' . $Type . 'SpamCheck'] = $CountSpamCheck + 1; } } // Update the user profile after every comment $UserModel = Gdn::UserModel(); $UserModel->SaveAttribute($Session->UserID, $Attributes); return $Spam; }
function createDBIndex($db, $table, $field, $index_name) { $sql = 'CREATE INDEX ' . $index_name . ' ON ' . $table . ' (' . $field . ')'; $db->baseExecute($sql, -1, -1, false); if ($db->baseErrorMessage() != "") { ErrorMessage(gettext("Unable to CREATE INDEX for") . " '" . $field . "' : " . $db->baseErrorMessage()); } else { ErrorMessage(gettext("Successfully created INDEX for") . " '" . $field . "'"); } }
function PrintPortscanEvents($db, $ip) { global $portscan_file; if (!$portscan_file) { ErrorMessage(gettext("PORTSCAN EVENT ERROR: ") . gettext("No file was specified in the {$portscan_file} variable.")); return; } $fp = fopen($portscan_file, "r"); if (!$fp) { ErrorMessage(gettext("PORTSCAN EVENT ERROR: ") . gettext("Unable to open Portscan event file") . " '" . $portscan_file . "'"); return; } echo '<TABLE border="0" width="100%" cellspacing="0" cellpadding="5" class="table_list"> <TR> <TD CLASS="headerbasestat">' . gettext("Date/Time") . '</TD> <TD CLASS="headerbasestat">' . gettext("Source IP") . '</TD> <TD CLASS="headerbasestat">' . gettext("Source Port") . '</TD> <TD CLASS="headerbasestat">' . gettext("Destination IP") . '</TD> <TD CLASS="headerbasestat">' . gettext("Destination Port") . '</TD> <TD CLASS="headerbasestat">' . gettext("TCP Flags") . '</TD> </TR>'; $total = 0; // Patch regex DoS possible vuln $ip = Util::regex($ip); while (!feof($fp)) { $contents = fgets($fp, 255); if (preg_match($ip, $contents)) { $total++; if ($i % 2 == 0) { $color = "DDDDDD"; } else { $color = "FFFFFF"; } $contents = preg_replace("/\\s\\s/", " ", $contents); $elements = explode(" ", $contents); echo '<tr bgcolor="' . $color . '"><td align="center">' . $elements[0] . ' ' . $elements[1] . ' ' . $elements[2] . '</td>'; preg_match("/([0-9]*\\.[0-9]*\\.[0-9]*\\.[0-9]*):([0-9]*)/", $elements[3], $store); echo '<td align="center">' . $store[1] . '</td>'; echo '<td align="center">' . $store[2] . '</td>'; preg_match("/([0-9]*\\.[0-9]*\\.[0-9]*\\.[0-9]*):([0-9]*)/", $elements[5], $store); echo '<td align="center">' . $store[1] . '</td>'; echo '<td align="center">' . $store[2] . '</td>'; echo '<td align="center">' . $elements[7] . '</td></tr>'; } } fclose($fp); echo '<TR> <TD CLASS="headerbasestat" align="left">' . gettext("Total Hosts Scanned") . '</TD> <TD CLASS="headerbasestat">' . $total . '</TD> <TD CLASS="headerbasestat" colspan="4"> </TD> </TR> </TABLE>'; }
function GetCurrentMP($mp, $date, $error = true) { global $_ROSARIO; if (!$_ROSARIO['GetCurrentMP'][$date][$mp]) { $_ROSARIO['GetCurrentMP'][$date][$mp] = DBGet(DBQuery("SELECT MARKING_PERIOD_ID FROM SCHOOL_MARKING_PERIODS WHERE MP='{$mp}' AND '{$date}' BETWEEN START_DATE AND END_DATE AND SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "'")); } if ($_ROSARIO['GetCurrentMP'][$date][$mp][1]['MARKING_PERIOD_ID']) { return $_ROSARIO['GetCurrentMP'][$date][$mp][1]['MARKING_PERIOD_ID']; } elseif ($error) { ErrorMessage(array(_('You are not currently in a marking period')), 'fatal'); } }
function core_calendar_create_calendar_events_response($response) { //first, gather the necessary variables global $calendar_event_id, $_REQUEST; //then, save the ID in the moodlexrosario cross-reference table if no error: /* object { events list of ( //event object { id int //event id name string //event name description string Optional //Description format int //description format (1 = HTML, 0 = MOODLE, 2 = PLAIN or 4 = MARKDOWN) courseid int //course id groupid int //group id userid int //user id repeatid int Optional //repeat id modulename string Optional //module name instance int //instance id eventtype string //Event type timestart int //timestart timeduration int //time duration visible int //visible uuid string Optional //unique id of ical events sequence int //sequence timemodified int //time modified subscriptionid int Optional //Subscription id } )warnings Optional //list of warnings list of ( //warning object { item string Optional //item itemid int Optional //item id warningcode string //the warning code can be used by the client app to implement specific behaviour message string //untranslated english message to explain the warning } )} */ if (is_array($response['warnings'][0])) { return ErrorMessage(array('Code: ' . $response['warnings'][0]['warningcode'] . ' - ' . $response['warnings'][0]['message']), 'error'); } if (empty($calendar_event_id)) { //case: update event $calendar_event_id = $_REQUEST['event_id']; } DBQuery("INSERT INTO MOODLEXROSARIO (\"column\", rosario_id, moodle_id) VALUES ('calendar_event_id', '" . $calendar_event_id . "', " . $response['events'][0]['id'] . ")"); return null; }
function VerifyAGID($ag_id, $db) { $sql = "SELECT ag_id FROM acid_ag WHERE ag_id='" . $ag_id . "'"; $result = $db->baseExecute($sql); if ($db->baseErrorMessage() != "") { ErrorMessage(gettext("Error looking up an AG ID")); return 0; } else { if ($result->baseRecordCount() < 1) { return 0; } else { $result->baseFreeRows(); return 1; } } }
/** * The summary of all settings available. The menu items displayed here are * collected from each application's application controller and all plugin's * definitions. */ public function Index() { $this->ApplicationFolder = 'dashboard'; $this->MasterView = 'setup'; // Fatal error if Garden has already been installed. $Config = Gdn::Factory(Gdn::AliasConfig); $Installed = Gdn::Config('Garden.Installed') ? TRUE : FALSE; if ($Installed) { trigger_error(ErrorMessage('Vanilla has already been installed.', 'SetupController', 'Index')); } if (!$this->_CheckPrerequisites()) { $this->View = 'prerequisites'; } else { $this->View = 'configure'; $ApplicationManager = new Gdn_ApplicationManager(); $AvailableApplications = $ApplicationManager->AvailableApplications(); // Need to go through all of the setups for each application. Garden, if ($this->Configure() && $this->Form->IsPostBack()) { // Step through the available applications, enabling each of them $AppNames = array_keys($AvailableApplications); try { foreach ($AvailableApplications as $AppName => $AppInfo) { if (strtolower($AppName) != 'dashboard') { $Validation = new Gdn_Validation(); $ApplicationManager->RegisterPermissions($AppName, $Validation); $ApplicationManager->EnableApplication($AppName, $Validation); } } } catch (Exception $ex) { $this->Form->AddError(strip_tags($ex->getMessage())); } if ($this->Form->ErrorCount() == 0) { // Save a variable so that the application knows it has been installed. // Now that the application is installed, select a more user friendly error page. SaveToConfig(array('Garden.Installed' => TRUE, 'Garden.Errors.MasterView' => 'error.master.php')); // Go to the dashboard Redirect('/settings'); } } } $this->Render(); }
function save() { $aSource = fopen($this->_myFilename, "r"); if ($aSource == NULL) { $aError = sprintf("Error: can't open file: %s\n", $this->_myFilename); ErrorMessage($aError, __LINE__, __FILE__, '$Revision: 1.6 $'); return FALSE; } $aDestination = fopen($this->_myTempFilename, "w"); if ($aDestination == NULL) { $aError = sprintf("Error: can't open file: %s\n", $this->_myTempFilename); ErrorMessage($aError, __LINE__, __FILE__, '$Revision: 1.6 $'); return FALSE; } while (!feof($aSource)) { $aLine = fgets($aSource); $aTemplatePattern = "/[ \t]*\\([ \t]*setq[ \t]+%s[ \t]+\"[^\"]*\"[ \t]*\\)[ \t]*/"; $aTemplateReplacement = "(setq %s \"%s\")"; $aPattern[0] = sprintf($aTemplatePattern, "user-mail-address"); $aReplacement[0] = sprintf($aTemplateReplacement, "user-mail-address", $this->_myMailConfig->getValue("email")); $aPattern[1] = sprintf($aTemplatePattern, "user-full-name"); $aReplacement[1] = sprintf($aTemplateReplacement, "user-full-name", $this->_myMailConfig->getValue("name")); $aPattern[2] = sprintf($aTemplatePattern, "smtpmail-default-smtp-server"); $aReplacement[2] = sprintf($aTemplateReplacement, "smtpmail-default-smtp-server", $this->_myMailConfig->getValue("smtp")); $aResult = preg_replace($aPattern, $aReplacement, $aLine); fprintf($aDestination, $aResult); } if ($aSource == NULL) { $aError = sprintf("Error: can't open file: %s\n", $this->_myFilename); ErrorMessage($aError, __LINE__, __FILE__, '$Revision: 1.6 $'); return FALSE; } fclose($aDestination); fclose($aSource); if (chown($this->_myTempFilename, $this->_myMailConfig->getUser()) == FALSE || chgrp($this->_myTempFilename, $this->_myMailConfig->getUser()) == FALSE || chmod($this->_myTempFilename, 0600) == FALSE || rename($this->_myTempFilename, $this->_myFilename) == FALSE || chmod($this->_myFilename, 0600) == FALSE || chown($this->_myFilename, $this->_myMailConfig->getUser()) == FALSE || chgrp($this->_myFilename, $this->_myMailConfig->getUser()) == FALSE) { $aError = sprintf("Error concerning file: %s\n", $this->_myTempFilename); ErrorMessage($aError, __LINE__, __FILE__, '$Revision: 1.6 $'); return FALSE; } return TRUE; }
} echo '</TD></TR>'; echo '<TR><TD width=100% valign=top>'; $items_RET = DBGet(DBQuery("SELECT fsi.SHORT_NAME,fsi.DESCRIPTION,fsi.PRICE_STAFF,fsi.ICON FROM FOOD_SERVICE_ITEMS fsi,FOOD_SERVICE_MENU_ITEMS fsmi WHERE fsmi.MENU_ID='" . $_REQUEST['menu_id'] . "' AND fsi.ITEM_ID=fsmi.ITEM_ID AND fsmi.CATEGORY_ID IS NOT NULL AND fsi.SCHOOL_ID='" . UserSchool() . "' ORDER BY fsi.SORT_ORDER"), array('ICON' => 'makeIcon'), array('SHORT_NAME')); $items = array(); foreach ($items_RET as $sn => $item) { $items += array($sn => $item[1]['DESCRIPTION']); } $LO_ret = array(array()); foreach ($_SESSION['FSA_sale'] as $id => $item_sn) { $price = $items_RET[$item_sn][1]['PRICE_STAFF']; $LO_ret[] = array('SALE_ID' => $id, 'PRICE' => $price, 'DESCRIPTION' => $items_RET[$item_sn][1]['DESCRIPTION'], 'ICON' => $items_RET[$item_sn][1]['ICON']); } unset($LO_ret[0]); $link['remove'] = array('link' => "Modules.php?modname={$_REQUEST['modname']}&modfunc=remove&menu_id={$_REQUEST['menu_id']}", 'variables' => array('id' => 'SALE_ID')); $link['add']['html'] = array('DESCRIPTION' => '<TABLE border=0 cellpadding=0 cellspacing=0><TR><TD>' . SelectInput('', 'item_sn', '', $items) . '</TD></TR></TABLE>', 'ICON' => '<TABLE border=0 cellpadding=0 cellspacing=0><TR><TD><INPUT type=submit value=' . _('Add') . '></TD></TR></TABLE>', 'remove' => button('add')); $columns = array('DESCRIPTION' => _('Item'), 'ICON' => _('Icon'), 'PRICE' => _('Price')); $tabs = array(); foreach ($menus_RET as $id => $menu) { $tabs[] = array('title' => $menu[1]['TITLE'], 'link' => "Modules.php?modname={$_REQUEST['modname']}&menu_id={$id}"); } $extra = array('save' => false, 'search' => false, 'header' => WrapTabs($tabs, "Modules.php?modname={$_REQUEST['modname']}&menu_id={$_REQUEST['menu_id']}")); echo '<BR>'; echo "<FORM action=Modules.php?modname={$_REQUEST['modname']}&modfunc=add&menu_id={$_REQUEST['menu_id']} method=POST>"; ListOutput($LO_ret, $columns, _('Item'), _('Items'), $link, array(), $extra); echo '</FORM>'; echo '</TD></TR></TABLE>'; } else { ErrorMessage(array(_('This user does not have a Food Service Account.')), 'fatal'); } }
/** * This is a convenience method so that you don't have to code this every time * you want to save a simple model's data. * * It uses the assigned model to save the sent form fields. * If saving fails, it populates $this->_ValidationResults with validation errors & related fields. * * @return unknown */ public function Save() { $SaveResult = FALSE; if ($this->ErrorCount() == 0) { if (!isset($this->_Model)) { trigger_error(ErrorMessage("You cannot call the form's save method if a model has not been defined.", "Form", "Save"), E_USER_ERROR); } $Data = $this->FormValues(); if (method_exists($this->_Model, 'FilterForm')) { $Data = $this->_Model->FilterForm($this->FormValues()); } $Args = array_merge(func_get_args(), array(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)); $SaveResult = $this->_Model->Save($Data, $Args[0], $Args[1], $Args[2], $Args[3], $Args[4], $Args[5], $Args[6], $Args[7], $Args[8], $Args[9]); if ($SaveResult === FALSE) { // NOTE: THE VALIDATION FUNCTION NAMES ARE ALSO THE LANGUAGE // TRANSLATIONS OF THE ERROR MESSAGES. CHECK THEM OUT IN THE LOCALE // FILE. $this->SetValidationResults($this->_Model->ValidationResults()); } } return $SaveResult; }
DBQuery($sql); $note[] = 'That Pre-Defined Fee has been added'; unset($_REQUEST[modfunc]); } if ($_REQUEST[modfunc] == 'delete') { if (DeletePrompt('pre-defined fee')) { DBQuery("DELETE FROM STU_BILLING_DEFINED_FEES WHERE ID='{$_REQUEST['id']}'"); $note[] = "That Pre-Defined Fee has been Deleted"; unset($_REQUEST[modfunc]); } } if (!$_REQUEST[modfunc]) { // LIST if ($note) { echo '<TABLE width=100%><TR><TD bgcolor=#E8E8E9><font size=-1>'; ErrorMessage($note, 'note'); echo '</font></TD></TR></TABLE>'; } echo "<FORM action=Modules.php?modname={$_REQUEST['modname']}&modfunc=update METHOD=POST>"; $functions = array('AMOUNT' => 'Currency', 'ACCOUNT_ID' => 'getAccount', 'DUE_DATE' => 'ProperDate', 'SYEAR' => 'DispYear', 'SCHOOL' => 'GetSchool', 'GRADE' => 'GetGrade'); $RET = DBGet(DBQuery('SELECT DISTINCT sb.ID,sb.TITLE,sb.AMOUNT, to_char(sb.DUE_DATE,\'dd-MON-yy\') as DUE_DATE,sb.SYEAR,sb.SCHOOL,sb.GRADE,sb.ACCOUNT_ID FROM STU_BILLING_DEFINED_FEES sb ORDER BY sb.TITLE'), $functions); $columns = array('TITLE' => 'Title', 'AMOUNT' => 'Amount', 'ACCOUNT_ID' => 'Account', 'DUE_DATE' => 'Due Date', 'SYEAR' => 'School Year', 'SCHOOL' => 'School', 'GRADE' => 'Grade'); $link[add][html] = array('TITLE' => makeTitleInput(), 'AMOUNT' => makeAmountInput(), 'ACCOUNT_ID' => makeAccountInput(), 'DUE_DATE' => makeDateInput(), 'SYEAR' => makeSyearInput(), 'SCHOOL' => makeSchoolInput(), 'GRADE' => makeGradeInput(), 'remove' => button('add')); $link[remove] = array('link' => "Modules.php?modname={$_REQUEST['modname']}&modfunc=delete", 'variables' => array('id' => 'ID')); $_REQUEST[modfunc] = 'list'; unset($_REQUEST[modfunc]); ListOutput($RET, $columns, 'Pre-Defined Fee', 'Pre-Defined Fees', $link); echo '<center><input type=submit class=btn_medium value=Save></center>'; }
/** * Sets the character encoding for this database engine. */ public function SetEncoding($Encoding) { trigger_error(ErrorMessage('The selected database engine does not perform the requested task.', $this->ClassName, 'SetEncoding'), E_USER_ERROR); }
} ListOutput($grades_RET, $columns, '.', '.', $link); } else { $error[] = _('No Students were found.'); unset($_SESSION['_REQUEST_vars']['modfunc']); unset($_REQUEST['modfunc']); } } else { $error[] = _('You must choose at least one student and one marking period.'); unset($_SESSION['_REQUEST_vars']['modfunc']); unset($_REQUEST['modfunc']); } } if (empty($_REQUEST['modfunc'])) { if (isset($error)) { echo ErrorMessage($error); } if ($_REQUEST['search_modfunc'] == 'list') { $_ROSARIO['allow_edit'] = true; echo '<FORM action="Modules.php?modname=' . $_REQUEST['modname'] . '&modfunc=save&include_inactive=' . $_REQUEST['include_inactive'] . '" method="POST">'; $extra['header_right'] = SubmitButton(_('Create Grade Lists for Selected Students')); //modif Francois: get the title istead of the attendance code short name $attendance_codes = DBGet(DBQuery("SELECT SHORT_NAME,ID,TITLE FROM ATTENDANCE_CODES WHERE SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "' AND (DEFAULT_CODE!='Y' OR DEFAULT_CODE IS NULL) AND TABLE_NAME='0'")); $extra['extra_header_left'] = '<TABLE>'; $extra['extra_header_left'] .= '<TR><TD colspan="2"><b>' . Localize('colon', _('Include on Grade List')) . '</b></TD></TR>'; $extra['extra_header_left'] .= '<TR><TD></TD><TD><TABLE>'; $extra['extra_header_left'] .= '<TR>'; //modif Francois: add <label> on checkbox $extra['extra_header_left'] .= '<TD><label><INPUT type="checkbox" name="elements[teacher]" value="Y" checked /> ' . _('Teacher') . '</label></TD>'; $extra['extra_header_left'] .= '<TD></TD>'; $extra['extra_header_left'] .= '</TR><TR>';
/** * Registers a plugin override method. * @param string $OverrideClassName The name of the plugin class that will override the existing method. * @param string $OverrideMethodName The name of the plugin method being registered to override the existing method. * @param string $EventClassName The name of the class that will fire the event. * @param string $EventName The name of the event that will fire. */ public function RegisterOverride($OverrideClassName, $OverrideMethodName, $EventClassName = '', $EventName = '') { $OverrideKey = $OverrideClassName . '.' . $OverrideMethodName; $EventKey = strtolower($EventClassName == '' ? $OverrideMethodName : $EventClassName . '_' . $EventName . '_Override'); // Throw an error if this method has already been overridden. if (array_key_exists($EventKey, $this->_MethodOverrideCollection) === TRUE) { trigger_error(ErrorMessage('Any object method can only be overridden by a single plugin. The "' . $EventKey . '" override has already been assigned by the "' . $this->_MethodOverrideCollection[$EventKey] . '" plugin. It cannot also be overridden by the "' . $OverrideClassName . '" plugin.', 'PluginManager', 'RegisterOverride'), E_USER_ERROR); } // Otherwise, specify this class as the source for the override. $this->_MethodOverrideCollection[$EventKey] = $OverrideKey; }
/** * Used to extend any method * * There are two types of extended method calls: * 1. Declared: The method was declared with the lowercase "x" prefix and called without it. * ie. Declaration: public function xMethodName() {} * Call: $Object->MethodName(); * * 2. Called: The method was declared without the lowercase "x" prefix and called with it. * ie. Declaration: public function MethodName() {} * Call: $Object->xMethodName(); * * Note: Plugins will always refer to the method name without the "x" * regardless of the type. So, $ReferenceMethodName is declared below without * the "x". * * * @param string $MethodName * @param array $Arguments * @return mixed * */ public function __call($MethodName, $Arguments) { // Define a return variable. $Return = FALSE; // Was this method declared, or called? if (substr($MethodName, 0, 1) == 'x') { // Declared $ActualMethodName = substr($MethodName, 1); // Remove the x prefix $ReferenceMethodName = $ActualMethodName; // No x prefix } else { // Called $ActualMethodName = 'x' . $MethodName; // Add the x prefix $ReferenceMethodName = $MethodName; // No x prefix } // Make sure that $ActualMethodName exists before continuing: if (!method_exists($this, $ActualMethodName)) { // Make sure that a plugin is not handling the call if (!Gdn::PluginManager()->HasNewMethod($this->ClassName, $ReferenceMethodName)) { trigger_error(ErrorMessage('The "' . $this->ClassName . '" object does not have a "' . $ActualMethodName . '" method.', $this->ClassName, $ActualMethodName), E_USER_ERROR); } } // Make sure the arguments get passed in the same way whether firing a custom event or a magic one. $this->EventArguments = $Arguments; // Call the "Before" event handlers Gdn::PluginManager()->CallEventHandlers($this, $this->ClassName, $ReferenceMethodName, 'Before'); // Call this object's method if (Gdn::PluginManager()->HasMethodOverride($this->ClassName, $ReferenceMethodName)) { // The method has been overridden $this->HandlerType = HANDLER_TYPE_OVERRIDE; $Return = Gdn::PluginManager()->CallMethodOverride($this, $this->ClassName, $ReferenceMethodName); } else { if (Gdn::PluginManager()->HasNewMethod($this->ClassName, $ReferenceMethodName)) { $this->HandlerType = HANDLER_TYPE_NEW; $Return = Gdn::PluginManager()->CallNewMethod($this, $this->ClassName, $ReferenceMethodName); } else { // The method has not been overridden $Count = count($Arguments); if ($Count == 0) { $Return = $this->{$ActualMethodName}(); } else { if ($Count == 1) { $Return = $this->{$ActualMethodName}($Arguments[0]); } else { if ($Count == 2) { $Return = $this->{$ActualMethodName}($Arguments[0], $Arguments[1]); } else { if ($Count == 3) { $Return = $this->{$ActualMethodName}($Arguments[0], $Arguments[1], $Arguments[2]); } else { if ($Count == 4) { $Return = $this->{$ActualMethodName}($Arguments[0], $Arguments[1], $Arguments[2], $Arguments[3]); } else { $Return = $this->{$ActualMethodName}($Arguments[0], $Arguments[1], $Arguments[2], $Arguments[3], $Arguments[4]); } } } } } } } // Call the "After" event handlers Gdn::PluginManager()->CallEventHandlers($this, $this->ClassName, $MethodName, 'After'); return $Return; }
/** * Adds to the "To" recipient collection. * * @param mixed $RecipientEmail An email (or array of emails) to add to the "To" recipient collection. * @param string $RecipientName The recipient name associated with $RecipientEmail. If $RecipientEmail is * an array of email addresses, this value will be ignored. */ public function To($RecipientEmail, $RecipientName = '') { if (is_string($RecipientEmail)) { if (strpos($RecipientEmail, ',') > 0) { $RecipientEmail = explode(',', $RecipientEmail); // trim no need, PhpMailer::AddAnAddress() will do it return $this->To($RecipientEmail, $RecipientName); } if ($this->PhpMailer->SingleTo) { return $this->AddTo($RecipientEmail, $RecipientName); } if (!$this->_IsToSet) { $this->_IsToSet = TRUE; $this->AddTo($RecipientEmail, $RecipientName); } else { $this->Cc($RecipientEmail, $RecipientName); } return $this; } elseif ($RecipientEmail instanceof stdClass) { $RecipientName = GetValue('Name', $RecipientEmail); $RecipientEmail = GetValue('Email', $RecipientEmail); return $this->To($RecipientEmail, $RecipientName); } elseif ($RecipientEmail instanceof Gdn_DataSet) { foreach ($RecipientEmail->ResultObject() as $Object) { $this->To($Object); } return $this; } elseif (is_array($RecipientEmail)) { $Count = count($RecipientEmail); if (!is_array($RecipientName)) { $RecipientName = array_fill(0, $Count, ''); } if ($Count == count($RecipientName)) { $RecipientEmail = array_combine($RecipientEmail, $RecipientName); foreach ($RecipientEmail as $Email => $Name) { $this->To($Email, $Name); } } else { trigger_error(ErrorMessage('Size of arrays do not match', 'Email', 'To'), E_USER_ERROR); } return $this; } trigger_error(ErrorMessage('Incorrect first parameter (' . GetType($RecipientEmail) . ') passed to function.', 'Email', 'To'), E_USER_ERROR); }
} if ($mp_RET[1]['MP'] == 'QTR') { $pros = GetChildrenMP('PRO', UserMP()); } // if the UserMP has been changed, the REQUESTed MP may not work if (!$_REQUEST['mp'] || strpos($str = "'" . UserMP() . "','" . $sem . "','" . $fy . "'," . $pros, "'" . ltrim($_REQUEST['mp'], 'E') . "'") === false) { $_REQUEST['mp'] = UserMP(); } $course_period_id = UserCoursePeriod(); if ($course_period_id) { $course_RET = DBGet(DBQuery('SELECT cp.COURSE_ID,c.TITLE as COURSE_NAME, cp.TITLE, cp.GRADE_SCALE_ID,cp.STANDARD_SCALE_ID,CREDIT(cp.COURSE_PERIOD_ID,\'' . $_REQUEST['mp'] . '\') AS CREDITS,cp.COURSE_WEIGHT,cp.USE_STANDARDS FROM course_periods cp, courses c WHERE cp.COURSE_ID = c.COURSE_ID AND cp.COURSE_PERIOD_ID=\'' . $course_period_id . '\'')); } //sg //if(!$course_RET[1]['GRADE_SCALE_ID']) if (!$course_RET[1]['GRADE_SCALE_ID'] && !$_REQUEST['include_inactive']) { echo ErrorMessage(array('You cannot enter grades for this course.'), 'error'); $not_graded = true; $_REQUEST['use_percents'] = true; } $course_title = $course_RET[1]['TITLE']; $grade_scale_id = $course_RET[1]['GRADE_SCALE_ID']; $course_id = $course_RET[1]['COURSE_ID']; if ($_REQUEST['mp']) { $current_RET = DBGet(DBQuery('SELECT g.STUDENT_ID,g.REPORT_CARD_GRADE_ID,g.GRADE_PERCENT,g.REPORT_CARD_COMMENT_ID,g.COMMENT FROM student_report_card_grades g,course_periods cp WHERE cp.COURSE_PERIOD_ID=g.COURSE_PERIOD_ID AND cp.COURSE_PERIOD_ID=\'' . $course_period_id . '\' AND g.MARKING_PERIOD_ID=\'' . $_REQUEST['mp'] . '\''), array(), array('STUDENT_ID')); $current_commentsA_RET = DBGet(DBQuery('SELECT g.STUDENT_ID,g.REPORT_CARD_COMMENT_ID,g.COMMENT FROM student_report_card_comments g,course_periods cp WHERE cp.COURSE_PERIOD_ID=g.COURSE_PERIOD_ID AND cp.COURSE_PERIOD_ID=\'' . $course_period_id . '\' AND g.MARKING_PERIOD_ID=\'' . $_REQUEST['mp'] . '\' AND g.REPORT_CARD_COMMENT_ID IN (SELECT ID FROM report_card_comments WHERE COURSE_ID IS NOT NULL)'), array(), array('STUDENT_ID', 'REPORT_CARD_COMMENT_ID')); $current_commentsB_RET = DBGet(DBQuery('SELECT g.STUDENT_ID,g.REPORT_CARD_COMMENT_ID FROM student_report_card_comments g,course_periods cp WHERE cp.COURSE_PERIOD_ID=g.COURSE_PERIOD_ID AND cp.COURSE_PERIOD_ID=\'' . $course_period_id . '\' AND g.MARKING_PERIOD_ID=\'' . $_REQUEST['mp'] . '\' AND g.REPORT_CARD_COMMENT_ID IN (SELECT ID FROM report_card_comments WHERE COURSE_ID IS NULL)'), array(), array('STUDENT_ID')); $max_current_commentsB = 0; foreach ($current_commentsB_RET as $comments) { if (count($comments) > $max_current_commentsB) { $max_current_commentsB = count($comments); }
/** * Undocumented method. * * @todo Method RenderMaster() needs a description. */ public function RenderMaster() { // Build the master view if necessary if (in_array($this->_DeliveryType, array(DELIVERY_TYPE_ALL))) { $this->MasterView = $this->MasterView(); // Only get css & ui components if this is NOT a syndication request if ($this->SyndicationMethod == SYNDICATION_NONE && is_object($this->Head)) { if (ArrayHasValue($this->_CssFiles, 'style.css')) { $this->AddCssFile('custom.css'); } if (ArrayHasValue($this->_CssFiles, 'admin.css')) { $this->AddCssFile('customadmin.css'); } $this->EventArguments['CssFiles'] =& $this->_CssFiles; $this->FireEvent('BeforeAddCss'); // And now search for/add all css files foreach ($this->_CssFiles as $CssInfo) { $CssFile = $CssInfo['FileName']; if (strpos($CssFile, '/') !== FALSE) { // A direct path to the file was given. $CssPaths = array(CombinePaths(array(PATH_ROOT, str_replace('/', DS, $CssFile)))); } else { $CssGlob = preg_replace('/(.*)(\\.css)/', '\\1*\\2', $CssFile); $AppFolder = $CssInfo['AppFolder']; if ($AppFolder == '') { $AppFolder = $this->ApplicationFolder; } // CSS comes from one of four places: $CssPaths = array(); if ($this->Theme) { // 1. Application-specific css. eg. root/themes/theme_name/app_name/design/ // $CssPaths[] = PATH_THEMES . DS . $this->Theme . DS . $AppFolder . DS . 'design' . DS . $CssGlob; // 2. Theme-wide theme view. eg. root/themes/theme_name/design/ // a) Check to see if a customized version of the css is there. if ($this->ThemeOptions) { $Filenames = GetValueR('Styles.Value', $this->ThemeOptions); if (is_string($Filenames) && $Filenames != '%s') { $CssPaths[] = PATH_THEMES . DS . $this->Theme . DS . 'design' . DS . ChangeBasename($CssFile, $Filenames); } } // b) Use the default filename. $CssPaths[] = PATH_THEMES . DS . $this->Theme . DS . 'design' . DS . $CssFile; } // 3. Application or plugin. if (StringBeginsWith($AppFolder, 'plugins/')) { // The css is coming from a plugin. $AppFolder = substr($AppFolder, strlen('plugins/')); $CssPaths[] = PATH_PLUGINS . "/{$AppFolder}/design/{$CssFile}"; $CssPaths[] = PATH_PLUGINS . "/{$AppFolder}/{$CssFile}"; } else { // Application default. eg. root/applications/app_name/design/ $CssPaths[] = PATH_APPLICATIONS . DS . $AppFolder . DS . 'design' . DS . $CssFile; } // 4. Garden default. eg. root/applications/dashboard/design/ $CssPaths[] = PATH_APPLICATIONS . DS . 'dashboard' . DS . 'design' . DS . $CssFile; } // Find the first file that matches the path. $CssPath = FALSE; foreach ($CssPaths as $Glob) { $Paths = SafeGlob($Glob); if (is_array($Paths) && count($Paths) > 0) { $CssPath = $Paths[0]; break; } } // Check to see if there is a CSS cacher. $CssCacher = Gdn::Factory('CssCacher'); if (!is_null($CssCacher)) { $CssPath = $CssCacher->Get($CssPath, $AppFolder); } if ($CssPath !== FALSE) { $CssPath = substr($CssPath, strlen(PATH_ROOT)); $CssPath = str_replace(DS, '/', $CssPath); $this->Head->AddCss($CssPath, 'all', TRUE, $CssInfo['Options']); } } // Add a custom js file. if (ArrayHasValue($this->_CssFiles, 'style.css')) { $this->AddJsFile('custom.js'); } // only to non-admin pages. // And now search for/add all JS files foreach ($this->_JsFiles as $Index => $JsInfo) { $JsFile = $JsInfo['FileName']; if (strpos($JsFile, '//') !== FALSE) { // This is a link to an external file. $this->Head->AddScript($JsFile); continue; } if (strpos($JsFile, '/') !== FALSE) { // A direct path to the file was given. $JsPaths = array(CombinePaths(array(PATH_ROOT, str_replace('/', DS, $JsFile)), DS)); } else { $AppFolder = $JsInfo['AppFolder']; if ($AppFolder == '') { $AppFolder = $this->ApplicationFolder; } // JS can come from a theme, an any of the application folder, or it can come from the global js folder: $JsPaths = array(); if ($this->Theme) { // 1. Application-specific js. eg. root/themes/theme_name/app_name/design/ $JsPaths[] = PATH_THEMES . DS . $this->Theme . DS . $AppFolder . DS . 'js' . DS . $JsFile; // 2. Garden-wide theme view. eg. root/themes/theme_name/design/ $JsPaths[] = PATH_THEMES . DS . $this->Theme . DS . 'js' . DS . $JsFile; } // 3. The application or plugin folder. if (StringBeginsWith(trim($AppFolder, '/'), 'plugins/')) { $JsPaths[] = PATH_PLUGINS . strstr($AppFolder, '/') . "/js/{$JsFile}"; $JsPaths[] = PATH_PLUGINS . strstr($AppFolder, '/') . "/{$JsFile}"; } else { $JsPaths[] = PATH_APPLICATIONS . "/{$AppFolder}/js/{$JsFile}"; } // 4. Global JS folder. eg. root/js/ $JsPaths[] = PATH_ROOT . DS . 'js' . DS . $JsFile; // 5. Global JS library folder. eg. root/js/library/ $JsPaths[] = PATH_ROOT . DS . 'js' . DS . 'library' . DS . $JsFile; } // Find the first file that matches the path. $JsPath = FALSE; foreach ($JsPaths as $Glob) { $Paths = SafeGlob($Glob); if (is_array($Paths) && count($Paths) > 0) { $JsPath = $Paths[0]; break; } } if ($JsPath !== FALSE) { $JsSrc = str_replace(array(PATH_ROOT, DS), array('', '/'), $JsPath); $Options = (array) $JsInfo['Options']; $Options['path'] = $JsPath; $Version = GetValue('Version', $JsInfo); if ($Version) { TouchValue('version', $Options, $Version); } $this->Head->AddScript($JsSrc, 'text/javascript', $Options); } } } // Add the favicon $this->Head->SetFavIcon(C('Garden.FavIcon', Asset('themes/' . $this->Theme . '/design/favicon.png'))); // Make sure the head module gets passed into the assets collection. $this->AddModule('Head'); } // Master views come from one of four places: $MasterViewPaths = array(); if (strpos($this->MasterView, '/') !== FALSE) { $MasterViewPaths[] = CombinePaths(array(PATH_ROOT, str_replace('/', DS, $this->MasterView) . '.master*')); } else { if ($this->Theme) { // 1. Application-specific theme view. eg. root/themes/theme_name/app_name/views/ $MasterViewPaths[] = CombinePaths(array(PATH_THEMES, $this->Theme, $this->ApplicationFolder, 'views', $this->MasterView . '.master*')); // 2. Garden-wide theme view. eg. /path/to/application/themes/theme_name/views/ $MasterViewPaths[] = CombinePaths(array(PATH_THEMES, $this->Theme, 'views', $this->MasterView . '.master*')); } // 3. Application default. eg. root/app_name/views/ $MasterViewPaths[] = CombinePaths(array(PATH_APPLICATIONS, $this->ApplicationFolder, 'views', $this->MasterView . '.master*')); // 4. Garden default. eg. root/dashboard/views/ $MasterViewPaths[] = CombinePaths(array(PATH_APPLICATIONS, 'dashboard', 'views', $this->MasterView . '.master*')); } // Find the first file that matches the path. $MasterViewPath = FALSE; foreach ($MasterViewPaths as $Glob) { $Paths = SafeGlob($Glob); if (is_array($Paths) && count($Paths) > 0) { $MasterViewPath = $Paths[0]; break; } } $this->EventArguments['MasterViewPath'] =& $MasterViewPath; $this->FireEvent('BeforeFetchMaster'); if ($MasterViewPath === FALSE) { trigger_error(ErrorMessage("Could not find master view: {$this->MasterView}.master*", $this->ClassName, '_FetchController'), E_USER_ERROR); } /// A unique identifier that can be used in the body tag of the master view if needed. $ControllerName = $this->ClassName; // Strip "Controller" from the body identifier. if (substr($ControllerName, -10) == 'Controller') { $ControllerName = substr($ControllerName, 0, -10); } // Strip "Gdn_" from the body identifier. if (substr($ControllerName, 0, 4) == 'Gdn_') { $ControllerName = substr($ControllerName, 4); } $this->SetData('CssClass', $this->Application . ' ' . $ControllerName . ' ' . $this->RequestMethod . ' ' . $this->CssClass, TRUE); // Check to see if there is a handler for this particular extension. $ViewHandler = Gdn::Factory('ViewHandler' . strtolower(strrchr($MasterViewPath, '.'))); if (is_null($ViewHandler)) { $BodyIdentifier = strtolower($this->ApplicationFolder . '_' . $ControllerName . '_' . Gdn_Format::AlphaNumeric(strtolower($this->RequestMethod))); include $MasterViewPath; } else { $ViewHandler->Render($MasterViewPath, $this); } }
DBQuery($sql); } $RET = DBGet(DBQuery("SELECT 'completed' AS COMPLETED FROM ELIGIBILITY_COMPLETED WHERE STAFF_ID='" . User('STAFF_ID') . "' AND SCHOOL_DATE BETWEEN '{$start_date}' AND '{$end_date}' AND PERIOD_ID='" . UserPeriod() . "'")); if (!count($RET)) { DBQuery("INSERT INTO ELIGIBILITY_COMPLETED (STAFF_ID,SCHOOL_DATE,PERIOD_ID) values('" . User('STAFF_ID') . "','" . DBDate() . "','" . UserPeriod() . "')"); } $current_RET = DBGet(DBQuery("SELECT ELIGIBILITY_CODE,STUDENT_ID FROM ELIGIBILITY WHERE SCHOOL_DATE BETWEEN '{$start_date}' AND '{$end_date}' AND PERIOD_ID='" . UserPeriod() . "'"), array(), array('STUDENT_ID')); } $extra['SELECT'] .= ",'' AS PASSING,'' AS BORDERLINE,'' AS FAILING,'' AS INCOMPLETE"; $extra['functions'] = array('PASSING' => 'makeRadio', 'BORDERLINE' => 'makeRadio', 'FAILING' => 'makeRadio', 'INCOMPLETE' => 'makeRadio'); $columns = array('PASSING' => _('Passing'), 'BORDERLINE' => _('Borderline'), 'FAILING' => _('Failing'), 'INCOMPLETE' => _('Incomplete')); $stu_RET = GetStuList($extra); echo "<FORM ACTION=Modules.php?modname={$_REQUEST['modname']} method=POST>"; DrawHeader(ProgramTitle()); if ($today > $END_DAY || $today < $START_DAY || $today == $START_DAY && date('Gi') < $START_HOUR . $START_MINUTE || $today == $END_DAY && date('Gi') > $END_HOUR . $END_MINUTE) { echo ErrorMessage(array(sprintf(_('You can only enter eligibility from %s %s to %s %s.'), $days[$START_DAY], Localize('time', array('hour' => $START_HOUR, 'minute' => $START_MINUTE)), $days[$END_DAY], Localize('time', array('hour' => $END_HOUR, 'minute' => $END_MINUTE)))), 'error'); } else { DrawHeader("<A HREF=Modules.php?modname={$_REQUEST['modname']}&modfunc=gradebook>" . _('Use Gradebook Grades') . "</A>", '<INPUT type=submit value="' . _('Save') . '">'); $LO_columns = array('FULL_NAME' => _('Student'), 'STUDENT_ID' => _('Centre ID'), 'GRADE_ID' => _('Grade')) + $columns; ListOutput($stu_RET, $LO_columns, _('Student'), _('Students')); echo '<CENTER><INPUT type=submit value="' . _('Save') . '"></CENTER>'; } echo "</FORM>"; function makeRadio($value, $title) { global $THIS_RET, $current_RET; if (isset($current_RET[$THIS_RET['STUDENT_ID']][1]['ELIGIBILITY_CODE']) && $current_RET[$THIS_RET['STUDENT_ID']][1]['ELIGIBILITY_CODE'] == $title || $title == 'PASSING' && !$current_RET[$THIS_RET['STUDENT_ID']][1]['ELIGIBILITY_CODE']) { return "<INPUT type=radio name=values[" . $THIS_RET['STUDENT_ID'] . "] value='{$title}' CHECKED>"; } else { return "<INPUT type=radio name=values[" . $THIS_RET['STUDENT_ID'] . "] value='{$title}'>"; }
echo "<FORM ACTION=Modules.php?modname={$_REQUEST['modname']} method=POST>"; DrawHeaderHome(ProgramTitle()); if ($today > $END_DAY || $today < $START_DAY || $today == $START_DAY && date('Gi') < $START_HOUR . $START_MINUTE || $today == $END_DAY && date('Gi') > $END_HOUR . $END_MINUTE) { if ($START_HOUR > 12) { $START_HOUR -= 12; $START_M = 'PM'; } else { $START_M = 'AM'; } if ($END_HOUR > 12) { $END_HOUR -= 12; $END_M = 'PM'; } else { $END_M = 'AM'; } echo ErrorMessage(array('' . _('You can only enter eligibility from') . '' . $days[$START_DAY] . ' ' . $START_HOUR . ':' . $START_MINUTE . ' ' . $START_M . ' ' . _('to') . ' ' . $days[$END_DAY] . ' ' . $END_HOUR . ':' . $END_MINUTE . ' ' . $END_M), 'error'); } else { if (count($stu_RET) != 0) { DrawHeader("<A HREF=Modules.php?modname={$_REQUEST['modname']}&modfunc=gradebook>" . _('Use Gradebook Grades') . "</A>", '<INPUT type=submit class=btn_medium value=' . _("Save") . '>'); } $LO_columns = array('FULL_NAME' => '' . _('Student') . '', 'STUDENT_ID' => '' . _('Student ID') . '', 'GRADE_ID' => '' . _('Grade') . '') + $columns; ListOutput($stu_RET, $LO_columns, _('Student'), _('Students')); if (count($stu_RET) != 0) { echo '<br><CENTER><INPUT type=submit class=btn_medium value=' . _('Save') . '></CENTER>'; } } echo "</FORM>"; function makeRadio($value, $title) { $colors = array('PASSING' => '#00FF00', 'BORDERLINE' => '#FF0000', 'FAILING' => '#FFCC00', 'INCOMPLETE' => '#0000FF'); global $THIS_RET, $current_RET;
} // if(!$weight) // { // $error[] = "No weight was selectd for ".$courses_RET[$course][1]['TITLE']; // continue; // } // if(!$weights_RET[$course][$weight]) // { // $error[] = $courses_RET[$course][1]['TITLE'].' does not have a weight of '.$weight; // unset($courses[$i]); // continue; // } $sql = "INSERT INTO SCHEDULE_REQUESTS (SYEAR,SCHOOL_ID,STUDENT_ID,SUBJECT_ID,COURSE_ID,MARKING_PERIOD_ID,WITH_TEACHER_ID,NOT_TEACHER_ID,WITH_PERIOD_ID,NOT_PERIOD_ID)\r\n\t\t\t\t\t\tvalues('" . UserSyear() . "','" . UserSchool() . "','" . UserStudentID() . "','" . $courses_RET[$course][1]['SUBJECT_ID'] . "','" . $course . "',NULL,'" . $_REQUEST['with_teacher'][$subject][$i] . "','" . $_REQUEST['without_teacher'][$subject][$i] . "','" . $_REQUEST['with_period'][$subject][$i] . "','" . $_REQUEST['without_period'][$subject][$i] . "')"; DBQuery($sql); } } echo ErrorMessage($error, 'Error'); $_SCHEDULER['student_id'] = UserStudentID(); $_SCHEDULER['dont_run'] = true; include 'modules/Scheduling/Scheduler.php'; $_REQUEST['modfunc'] = 'choose'; } if ($_REQUEST['modfunc'] == 'choose') { $functions = array('WITH_PERIOD_ID' => '_makeWithSelects', 'NOT_PERIOD_ID' => '_makeWithoutSelects'); $requests_RET = DBGet(DBQuery("SELECT sr.COURSE_ID,c.COURSE_TITLE,sr.WITH_PERIOD_ID,sr.NOT_PERIOD_ID,sr.WITH_TEACHER_ID,\r\n\t\t\t\t\t\t\t\t\t\tsr.NOT_TEACHER_ID FROM SCHEDULE_REQUESTS sr,COURSES c\r\n\t\t\t\t\t\t\t\t\tWHERE sr.SYEAR='" . UserSyear() . "' AND sr.STUDENT_ID='" . UserStudentID() . "' AND sr.COURSE_ID=c.COURSE_ID"), $functions); echo "<FORM name=vary id=vary action=Modules.php?modname={$_REQUEST['modname']}&modfunc=verify method=POST>"; DrawHeader('', SubmitButton('Save', '', 'class=btn_medium onclick=\'formload_ajax("vary");\'')); $columns = array(''); ListOutput($requests_RET, $columns, 'Request', 'Requests'); echo '<CENTER>' . SubmitButton('Save', '', 'class=btn_medium onclick=\'formload_ajax("vary");\'') . '</CENTER></FORM>'; }
/** * Returns the location of the view for this module in the filesystem. * * @param string $View * @param string $ApplicationFolder * @return array */ public function fetchViewLocation($View = '', $ApplicationFolder = '') { if ($View == '') { $View = strtolower($this->name()); } if (substr($View, -6) == 'module') { $View = substr($View, 0, -6); } if (substr($View, 0, 4) == 'gdn_') { $View = substr($View, 4); } if ($ApplicationFolder == '') { $ApplicationFolder = strpos($this->_ApplicationFolder, '/') ? $this->_ApplicationFolder : strtolower($this->_ApplicationFolder); } $ThemeFolder = $this->_ThemeFolder; $ViewPath = null; // Try to use Gdn_Controller's FetchViewLocation if (Gdn::controller() instanceof Gdn_Controller) { try { $ViewPath = Gdn::controller()->fetchViewLocation($View, 'modules', $ApplicationFolder); } catch (Exception $Ex) { } } if (!$ViewPath) { $ViewPaths = array(); // 1. An explicitly defined path to a view if (strpos($View, '/') !== false) { $ViewPaths[] = $View; } // 2. A theme if ($ThemeFolder != '') { // a. Application-specific theme view. eg. /path/to/application/themes/theme_name/app_name/views/modules/ $ViewPaths[] = CombinePaths(array(PATH_THEMES, $ThemeFolder, $ApplicationFolder, 'views', 'modules', $View . '.php')); // b. Garden-wide theme view. eg. /path/to/application/themes/theme_name/views/modules/ $ViewPaths[] = CombinePaths(array(PATH_THEMES, $ThemeFolder, 'views', 'modules', $View . '.php')); } // 3. Application default. eg. /path/to/application/app_name/views/controller_name/ if ($this->_ApplicationFolder) { $ViewPaths[] = CombinePaths(array(PATH_APPLICATIONS, $ApplicationFolder, 'views', 'modules', $View . '.php')); } else { $ViewPaths[] = dirname($this->path()) . "/../views/modules/{$View}.php"; } // 4. Garden default. eg. /path/to/application/dashboard/views/modules/ $ViewPaths[] = CombinePaths(array(PATH_APPLICATIONS, 'dashboard', 'views', 'modules', $View . '.php')); $ViewPath = Gdn_FileSystem::exists($ViewPaths); } if ($ViewPath === false) { throw new Exception(ErrorMessage('Could not find a `' . $View . '` view for the `' . $this->Name() . '` module in the `' . $ApplicationFolder . '` application.', get_class($this), 'FetchView'), E_USER_ERROR); } return $ViewPath; }