本文整理汇总了PHP中NQ类的典型用法代码示例。如果您正苦于以下问题:PHP NQ类的具体用法?PHP NQ怎么用?PHP NQ使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NQ类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: show
public function show()
{
$submitCmd = CommandFactory::getCommand('SaveTermSettings');
$form = new PHPWS_Form('docusign');
$submitCmd->initForm($form);
// Over 18 template
$existingTemplate = '';
try {
$existingTemplate = $this->term->getDocusignTemplate();
} catch (InvalidConfigurationException $e) {
NQ::simple('hms', hms\NotificationView::WARNING, 'No DocuSign template id has been set for students over 18.');
}
$form->addText('template', $existingTemplate);
$form->addCssClass('template', 'form-control');
// Under 18 template
$under18Template = '';
try {
$under18Template = $this->term->getDocusignUnder18Template();
} catch (InvalidConfigurationException $e) {
NQ::simple('hms', hms\NotificationView::WARNING, 'No DocuSign template id has been set for students under 18.');
}
$form->addText('under18_template', $under18Template);
$form->addCssClass('under18_template', 'form-control');
$tpl = $form->getTemplate();
return PHPWS_Template::process($tpl, 'hms', 'admin/TermsConditionsAdminView.tpl');
}
开发者ID:jlbooker,项目名称:homestead,代码行数:26,代码来源:TermsConditionsAdminView.php
示例2: execute
public function execute(CommandContext $context)
{
PHPWS_Core::initModClass('hms', 'StudentDataProvider.php');
$provider = StudentDataProvider::getInstance();
$provider->clearCache();
NQ::simple('hms', hms\NotificationView::SUCCESS, 'Cache cleared.');
}
开发者ID:jlbooker,项目名称:homestead,代码行数:7,代码来源:ClearCacheCommand.php
示例3: execute
/**
* (non-PHPdoc)
* @see Command::execute()
*/
public function execute(CommandContext $context)
{
PHPWS_Core::initModClass('hms', 'StudentFactory.php');
PHPWS_Core::initModClass('hms', 'HousingApplicationFactory.php');
$term = $context->get('term');
if (!isset($term)) {
throw new InvalidArgumentException('Missing term.');
}
$user = UserStatus::getUsername();
$student = StudentFactory::getStudentByUsername($user, $term);
// Load the student's application. Should be a lottery application.
$application = HousingApplicationFactory::getAppByStudent($student, $term);
// If there isn't a valid application in the DB, then we have a problem.
if (!isset($application) || !$application instanceof LotteryApplication) {
throw new InvalidArgumentException('Null application object.');
}
// Check to make sure the date isn't already set
$time = $application->getWaitingListDate();
if (isset($time)) {
NQ::simple('hms', hms\NotificationView::ERROR, 'You have already applied for the waiting list.');
$cmd = CommandFactory::getCommand('ShowStudentMenu');
$cmd->redirect();
}
// Set the date
$application->setWaitingListDate(time());
// Save the application again
$application->save();
// Log it to the activity log
HMS_Activity_Log::log_activity($student->getUsername(), ACTIVITY_REAPP_WAITINGLIST_APPLY, UserStatus::getUsername());
// Success command
$cmd = CommandFactory::getCommand('ShowStudentMenu');
$cmd->redirect();
}
开发者ID:jlbooker,项目名称:homestead,代码行数:37,代码来源:WaitingListSignupCommand.php
示例4: execute
/**
* Shows the requested report's HTML output.
*
* @param CommandContext $context
* @throws InvalidArgumentExection
*/
public function execute(CommandContext $context)
{
if (!Current_User::allow('hms', 'reports')) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException('You do no have permission to run reports.');
}
$reportId = $context->get('reportId');
if (!isset($reportId) || is_null($reportId)) {
throw new InvalidArgumentExection('Missing report id.');
}
// Instantiate the report controller with the requested report id
PHPWS_Core::initModClass('hms', 'ReportFactory.php');
$report = ReportFactory::getReportById($reportId);
Layout::addPageTitle($report->getFriendlyName());
$detailCmd = CommandFactory::getCommand('ShowReportDetail');
$detailCmd->setReportClass($report->getClass());
$content = '<div> ' . $detailCmd->getLink('« back') . ' </div>';
$content .= file_get_contents($report->getHtmlOutputFilename());
if ($content === FALSE) {
NQ::simple('hms', hms\NotificationView::ERROR, 'Could not open report file.');
PHPWS_Error::log('Could not open report file ' . $report->getCsvOutputFilename(), 'hms');
$reportCmd = CommandFactory::getCommand('ShowReportDetail');
$reportCmd->setReportClass($report->getClass());
$reportCmd->redirect();
}
$context->setContent($content);
}
开发者ID:jlbooker,项目名称:homestead,代码行数:33,代码来源:ShowReportHtmlCommand.php
示例5: execute
public function execute(CommandContext $context)
{
$id = $context->get('roommateId');
if (is_null($id)) {
throw new InvalidArgumentException('Must set roommateId');
}
PHPWS_Core::initModClass('hms', 'HMS_Roommate.php');
$roommate = new HMS_Roommate($id);
if ($roommate->id == 0) {
throw new InvalidArgumentException('Invalid roommateId ' . $id);
}
if (UserStatus::getUsername() != $roommate->requestee) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException("{$username} tried to reject roommate pairing {$roommate->id}");
}
$requestor = StudentFactory::getStudentByUsername($roommate->requestor, $roommate->term);
$name = $requestor->getFullName();
$username = $requestor->getUsername();
$roommate->delete();
HMS_Activity_Log::log_activity($roommate->requestor, ACTIVITY_REJECTED_AS_ROOMMATE, $roommate->requestee, "{$roommate->requestee} rejected {$roommate->requestor}'s request");
HMS_Activity_Log::log_activity($roommate->requestee, ACTIVITY_REJECTED_AS_ROOMMATE, $roommate->requestor, "{$roommate->requestee} rejected {$roommate->requestor}'s request");
// Email both parties
PHPWS_Core::initModClass('hms', 'HMS_Email.php');
HMS_Email::send_reject_emails($roommate);
NQ::Simple('hms', hms\NotificationView::SUCCESS, "<b>You rejected the roommate request from {$name}.</b> If this was an error, you may re-request using their username, <b>{$username}</b>.");
$cmd = CommandFactory::getCommand('ShowStudentMenu');
$cmd->redirect();
}
开发者ID:jlbooker,项目名称:homestead,代码行数:28,代码来源:RoommateRejectCommand.php
示例6: execute
public function execute(CommandContext $context)
{
// Check for report ID
$reportId = $context->get('reportId');
if (!isset($reportId) || is_null($reportId)) {
throw new InvalidArgumentException('Missing report id.');
}
PHPWS_Core::initModClass('hms', 'ReportFactory.php');
// Load the report to get its class
try {
$report = ReportFactory::getReportById($reportId);
} catch (InvalidArgumentException $e) {
NQ::simple('hms', hms\NotificationView::SUCCESS, 'Report canceled.');
$context->goBack();
}
$db = new PHPWS_DB('hms_report');
$db->addWhere('id', $reportId);
$result = $db->delete();
if (PHPWS_Error::logIfError($result)) {
throw new DatabaseException($result->toString());
}
NQ::simple('hms', hms\NotificationView::SUCCESS, 'Report canceled.');
$cmd = CommandFactory::getCommand('ShowReportDetail');
$cmd->setReportClass($report->getClass());
$cmd->redirect();
}
开发者ID:jlbooker,项目名称:homestead,代码行数:26,代码来源:CancelReportCommand.php
示例7: rawToRead
/**
* Converts the database entry of Term into human
* If $super is true then <sup> tags will be used in 1st and 2nd.
* readable form. (Ex: 20111 => 'Spring 2011')
*/
public static function rawToRead($t, $super = false)
{
$semester = substr($t, strlen($t) - 1, 1);
$year = substr($t, 0, strlen($t) - 1);
switch ($semester) {
case '1':
return "Spring {$year}";
case '2':
if ($super) {
return "1<sup>st</sup> Summer {$year}";
} else {
return "1st Summer {$year}";
}
case '3':
if ($super) {
return "2<sup>nd</sup> Summer {$year}";
} else {
return "2nd Summer {$year}";
}
case '4':
return "Fall {$year}";
default:
// Whaattt??
\NQ::simple('intern', \Intern\UI\NotifyUI::WARNING, 'Term error: ' . $t);
return "{$year}";
}
}
开发者ID:jlbooker,项目名称:InternshipInventory,代码行数:32,代码来源:Term.php
示例8: execute
public function execute(CommandContext $context)
{
if (!UserStatus::isAdmin() || !Current_User::allow('hms', 'bed_structure')) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException('You do not have permission to remove a bed.');
}
PHPWS_Core::initModClass('hms', 'HMS_Bed.php');
$viewCmd = CommandFactory::getCommand('EditRoomView');
$viewCmd->setRoomId($context->get('roomId'));
$bedId = $context->get('bedId');
$roomId = $context->get('roomId');
if (!isset($roomId)) {
NQ::simple('hms', hms\NotificationView::ERROR, 'Missing room ID.');
$viewCmd->redirect();
}
if (!isset($bedId)) {
NQ::simple('hms', hms\NotificationView::ERROR, 'Missing bed ID.');
$viewCmd->redirect();
}
# Try to delete the bed
try {
HMS_Bed::deleteBed($bedId);
} catch (Exception $e) {
NQ::simple('hms', hms\NotificationView::ERROR, 'There was an error deleting the bed: ' . $e->getMessage());
$viewCmd->redirect();
}
NQ::simple('hms', hms\NotificationView::SUCCESS, 'Bed successfully deleted.');
$viewCmd->redirect();
}
开发者ID:jlbooker,项目名称:homestead,代码行数:29,代码来源:DeleteBedCommand.php
示例9: execute
public function execute(CommandContext $context)
{
/*
if(!Current_User::allow('hms', 'email_hall') && !Current_User::allow('hms', 'email_all')){
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException('You do not have permission to send messages.');
}
*/
if (is_null($context->get('hall')) && is_null($context->get('floor'))) {
NQ::simple('hms', hms\NotificationView::ERROR, 'You must select a hall to continue!');
$cmd = CommandFactory::getCommand('ShowHallNotificationSelect');
$cmd->redirect();
}
$subject = $context->get('subject');
$body = $context->get('body');
$anonymous = !is_null($context->get('anonymous')) ? $context->get('anonymous') : false;
$halls = $context->get('hall');
$floors = $context->get('floor');
$cmd = CommandFactory::getCommand('ShowHallNotificationEdit');
if (empty($subject)) {
NQ::simple('hms', hms\NotificationView::ERROR, 'You must fill in the subject line of the email.');
$cmd->loadContext($context);
$cmd->redirect();
} else {
if (empty($body)) {
NQ::simple('hms', hms\NotificationView::ERROR, 'You must fill in the message to be sent.');
$cmd->loadContext($context);
$cmd->redirect();
}
}
$view = new ReviewHallNotificationMessageView($subject, $body, $anonymous, $halls, $floors);
$context->setContent($view->show());
}
开发者ID:jlbooker,项目名称:homestead,代码行数:33,代码来源:ReviewHallNotificationMessageCommand.php
示例10: execute
public function execute(CommandContext $context)
{
if (!Current_User::allow('hms', 'approve_rlc_applications')) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException('You do not have permission to approve RLC applications.');
}
PHPWS_Core::initModClass('hms', 'HMS_RLC_Application.php');
PHPWS_Core::initModClass('hms', 'HMS_RLC_Assignment.php');
PHPWS_Core::initModClass('hms', 'StudentFactory.php');
# Foreach rlc assignment made
# $app_id is the 'id' column in the 'learning_community_applications' table, tells which student we're assigning
# $rlc_id is the 'id' column in the 'learning_communitites' table, and refers to the RLC selected for the student
foreach ($_REQUEST['final_rlc'] as $app_id => $rlc_id) {
if ($rlc_id <= 0) {
continue;
}
$app = HMS_RLC_Application::getApplicationById($app_id);
$student = StudentFactory::getStudentByUsername($app->username, $app->term);
# Insert a new assignment in the 'learning_community_assignment' table
$assign = new HMS_RLC_Assignment();
$assign->rlc_id = $rlc_id;
$assign->gender = $student->getGender();
$assign->assigned_by = UserStatus::getUsername();
$assign->application_id = $app->id;
$assign->state = 'new';
$assign->save();
# Log the assignment
PHPWS_Core::initModClass('hms', 'HMS_Activity_Log.php');
HMS_Activity_Log::log_activity($app->username, ACTIVITY_ASSIGN_TO_RLC, UserStatus::getUsername(), "New Assignment");
}
// Show a success message
NQ::simple('hms', hms\NotificationView::SUCCESS, 'Successfully assigned RLC applicant(s).');
$context->goBack();
}
开发者ID:jlbooker,项目名称:homestead,代码行数:34,代码来源:AssignRlcApplicantsCommand.php
示例11: execute
public function execute(CommandContext $context)
{
PHPWS_Core::initModClass('hms', 'RoomDamageFactory.php');
PHPWS_Core::initModClass('hms', 'StudentFactory.php');
PHPWS_Core::initModClass('hms', 'HMS_Email.php');
PHPWS_Core::initModClass('hms', 'CheckinFactory.php');
PHPWS_Core::initModClass('hms', 'HMS_Bed.php');
$term = Term::getSelectedTerm();
// Get the total damages assessed for each student
$damages = RoomDamageFactory::getAssessedDamagesStudentTotals($term);
foreach ($damages as $dmg) {
$student = StudentFactory::getStudentByBannerId($dmg['banner_id'], $term);
// Get the student's last checkout
// (NB: the damages may be for multiple check-outs,
// but we'll just take the last one)
$checkout = CheckinFactory::getLastCheckoutForStudent($student);
$bed = new HMS_Bed($checkout->getBedId());
$room = $bed->get_parent();
$floor = $room->get_parent();
$hall = $floor->get_parent();
$coordinators = $hall->getCoordinators();
if ($coordinators != null) {
$coordinatorName = $coordinators[0]->getDisplayName();
$coordinatorEmail = $coordinators[0]->getEmail();
} else {
$coordinatorName = '(No coordinator set for this hall.)';
$coordinatorEmail = '(No coordinator set for this hall.)';
}
HMS_Email::sendDamageNotification($student, $term, $dmg['sum'], $coordinatorName, $coordinatorEmail);
}
// Show a success message and redirect back to the main admin menu
NQ::simple('hms', hms\NotificationView::SUCCESS, 'Room damage noties sent.');
$cmd = CommandFactory::getCommand('ShowAdminMaintenanceMenu');
$cmd->redirect();
}
开发者ID:jlbooker,项目名称:homestead,代码行数:35,代码来源:SendRoomDamageNotificationsCommand.php
示例12: execute
public function execute(CommandContext $context)
{
NQ::close();
header('HTTP/1.1 303 See Other');
header("Location: {$_SERVER['SCRIPT_NAME']}?module=controlpanel");
HMS::quit();
}
开发者ID:jlbooker,项目名称:homestead,代码行数:7,代码来源:ShowControlPanelCommand.php
示例13: getPagerTags
/**
* Generates the activity log table
*/
public function getPagerTags()
{
PHPWS_Core::initModClass('hms', 'StudentFactory.php');
$tpl = array();
try {
$student = StudentFactory::getStudentByUsername($this->get_user_id(), Term::getSelectedTerm());
} catch (StudentNotFoundException $e) {
NQ::simple('hms', hms\NotificationView::WARNING, "Could not find data for student: {$this->get_user_id()}");
$student = null;
}
if (is_null($student)) {
$tpl['ACTEE'] = 'UNKNOWN';
} else {
$tpl['ACTEE'] = $student->getProfileLink();
}
if (strcmp($this->get_user_id(), $this->get_actor()) == 0) {
$tpl['ACTOR'] = NULL;
} else {
$tpl['ACTOR'] = $this->get_actor();
}
$time = $this->get_timestamp();
$tpl['DATE'] = date('j M Y', $time);
$tpl['TIME'] = date('g:i a', $time);
$tpl['ACTIVITY'] = $this->get_text_activity();
$notes = $this->get_notes();
if (!is_null($notes)) {
$tpl['NOTES'] = $notes;
}
return $tpl;
}
开发者ID:jlbooker,项目名称:homestead,代码行数:33,代码来源:HMS_Activity_Log.php
示例14: execute
/**
* Exec
*
* @param CommandContext $context
* @throws InvalidArgumentExection
*/
public function execute(CommandContext $context)
{
if (!Current_User::allow('hms', 'reports')) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException('You do no have permission to run reports.');
}
$reportId = $context->get('reportId');
if (!isset($reportId) || is_null($reportId)) {
throw new InvalidArgumentExection('Missing report id.');
}
// Instantiate the report controller with the requested report id
PHPWS_Core::initModClass('hms', 'ReportFactory.php');
$report = ReportFactory::getReportById($reportId);
// Check to make sure the file exists
if (!file_exists($report->getCsvOutputFilename())) {
NQ::simple('hms', hms\NotificationView::ERROR, 'Could not open report file.');
PHPWS_Error::log('Could not open report file ' . $report->getCsvOutputFilename(), 'hms');
$reportCmd = CommandFactory::getCommand('ShowReportDetail');
$reportCmd->setReportClass($report->getClass());
$reportCmd->redirect();
}
$pdf = file_get_contents($report->getCsvOutputFilename());
// Hoepfully force the browser to open a 'save as' dialogue
header('Content-Type: text/csv');
header('Cache-Control: public, must-revalidate, max-age=0');
// HTTP/1.1
header('Pragma: public');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
// Date in the past
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Content-Length: ' . strlen($pdf));
header('Content-Disposition: attachment; filename="' . basename($report->getCsvOutputFilename()) . '";');
echo $pdf;
exit;
}
开发者ID:jlbooker,项目名称:homestead,代码行数:41,代码来源:ShowReportCsvCommand.php
示例15: execute
public function execute(CommandContext $context)
{
// Check permissions
if (!Current_User::allow('hms', 'checkin')) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException('You do not have permission to checkin students.');
}
PHPWS_Core::initModClass('hms', 'StudentFactory.php');
PHPWS_Core::initModClass('hms', 'HMS_Assignment.php');
$bannerId = $context->get('banner_id');
$hallId = $context->get('residence_hall_hidden');
$errorCmd = CommandFactory::getCommand('ShowCheckoutStart');
// TODO
if (!isset($bannerId) || is_null($bannerId) || $bannerId == '') {
NQ::simple('hms', hms\NotificationView::ERROR, 'Missing Banner ID.');
$errorCmd->redirect();
}
if (!isset($hallId)) {
NQ::simple('hms', hms\NotificationView::ERROR, 'Missing residence hall ID.');
$errorCmd->redirect();
}
// Everything checks out, so redirect to the form
$cmd = CommandFactory::getCommand('ShowCheckoutForm');
// TODO
$cmd->setBannerId($bannerId);
$cmd->setHallId($hallId);
$cmd->redirect();
}
开发者ID:jlbooker,项目名称:homestead,代码行数:28,代码来源:StartCheckoutSubmitCommand.php
示例16: execute
public function execute(CommandContext $context)
{
if (!UserStatus::isAdmin() || !Current_User::allow('hms', 'view_activity_log')) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException('You do not have permission to view the activity log.');
}
PHPWS_Core::initModClass('hms', 'HMS_Activity_Log.php');
PHPWS_Core::initModClass('hms', 'ActivityLogView.php');
$actee = $context->get('actee');
$actor = $context->get('actor');
$notes = $context->get('notes');
$exact = $context->get('exact');
$begin = $context->get('begin');
$end = $context->get('end');
if (!is_null($begin) && !is_null($end) && $end <= $begin) {
unset($_REQUEST['begin_year'], $_REQUEST['begin_month'], $_REQUEST['begin_day'], $_REQUEST['end_year'], $_REQUEST['end_month'], $_REQUEST['end_day']);
$begin = null;
$end = null;
NQ::simple('hms', hms\NotificationView::WARNING, 'Invalid date range. The search results will not be filtered by date.');
}
$activityMap = HMS_Activity_Log::getActivityMapping();
$activities = array();
foreach ($activityMap as $i => $t) {
$act = $context->get("a{$i}");
if (!is_null($act)) {
$activities[] = $i;
}
}
$activityLogView = new ActivityLogView($actee, $actor, $notes, $exact, $begin, $end, $activities);
$context->setContent($activityLogView->show());
}
开发者ID:jlbooker,项目名称:homestead,代码行数:31,代码来源:ShowActivityLogCommand.php
示例17: display
public function display()
{
// permissions...
if (!\Current_User::isDeity()) {
\NQ::simple('intern', NotifyUI::ERROR, 'You cannot edit administrators.');
return false;
}
// set up some stuff for the page template
$tpl = array();
// create the list of admins
$adminList = Admin::getAdminPager();
// get the list of departments
$depts = Department::getDepartmentsAssoc();
// make the form for adding a new admin
$form = new \PHPWS_Form('add_admin');
$form->addSelect('department_id', $depts);
$form->setLabel('department_id', 'Department');
$form->addText('username');
$form->setLabel('username', 'Username');
$form->addCheck('all');
$form->setLabel('all', 'All Departments');
$form->addSubmit('submit', 'Create Admin');
$form->setAction('index.php?module=intern&action=edit_admins');
$form->addHidden('add', 1);
// TODO: Add Javascript autocomplete for usernames.
javascript('jquery');
javascript('jquery_ui');
javascriptMod('intern', 'admin');
$tpl['PAGER'] = $adminList;
$form->mergeTemplate($tpl);
return \PHPWS_Template::process($form->getTemplate(), 'intern', 'edit_admin.tpl');
}
开发者ID:jlbooker,项目名称:InternshipInventory,代码行数:32,代码来源:AdminUI.php
示例18: execute
public function execute(CommandContext $context)
{
$resultCmd = CommandFactory::getCommand('ShowSendRlcInvites');
$respondByDate = $context->get('respond_by_date');
$respondByTime = $context->get('time');
if (!isset($respondByDate) || $respondByDate == '') {
NQ::simple('hms', hms\NotificationView::ERROR, 'Please choose a \'respond by\' date.');
$resultCmd->redirect();
}
$dateParts = explode('/', $respondByDate);
$respondByTimestamp = mktime($respondByTime, null, null, $dateParts[0], $dateParts[1], $dateParts[2]);
$term = Term::getSelectedTerm();
$studentType = $context->get('type');
if (!isset($studentType)) {
NQ::simple('hms', hms\NotificationView::ERROR, 'Please choose a student type.');
$resultCmd->redirect();
}
PHPWS_Core::initModClass('hms', 'RlcAssignmentFactory.php');
PHPWS_Core::initModClass('hms', 'RlcAssignmentInvitedState.php');
$assignments = RlcAssignmentFactory::getAssignmentsByTermStateType($term, 'new', $studentType);
if (sizeof($assignments) == 0) {
NQ::simple('hms', hms\NotificationView::WARNING, 'No invites needed to be sent.');
$resultCmd->redirect();
}
foreach ($assignments as $assign) {
$assign->changeState(new RlcAssignmentInvitedState($assign, $respondByTimestamp));
}
NQ::simple('hms', hms\NotificationView::SUCCESS, 'Learning community invites sent.');
$resultCmd->redirect();
}
开发者ID:jlbooker,项目名称:homestead,代码行数:30,代码来源:SendRlcInvitesCommand.php
示例19: execute
/**
* (non-PHPdoc)
* @see Command::execute()
*/
public function execute(CommandContext $context)
{
PHPWS_Core::initModClass('hms', 'HousingApplication.php');
PHPWS_Core::initModClass('hms', 'StudentFactory.php');
$term = $context->get('term');
// Check if the student has already applied. If so, redirect to the student menu
$app = HousingApplication::getApplicationByUser(UserStatus::getUsername(), $term);
if (isset($result) && $result->getApplicationType == 'offcampus_waiting_list') {
NQ::simple('hms', hms\NotificationView::ERROR, 'You have already enrolled on the on-campus housing Open Waiting List for this term.');
$menuCmd = CommandFactory::getCommand('ShowStudentMenu');
$menuCmd->redirect();
}
// Make sure the student agreed to the terms, if not, send them back to the terms & agreement command
$event = $context->get('event');
$_SESSION['application_data'] = array();
// If they haven't agreed, redirect to the agreement
if (is_null($event) || !isset($event) || $event != 'signing_complete' && $event != 'viewing_complete') {
$onAgree = CommandFactory::getCommand('ShowOffCampusWaitListApplication');
$onAgree->setTerm($term);
$agreementCmd = CommandFactory::getCommand('ShowTermsAgreement');
$agreementCmd->setTerm($term);
$agreementCmd->setAgreedCommand($onAgree);
$agreementCmd->redirect();
}
$student = StudentFactory::getStudentByUsername(UserStatus::getUsername(), $term);
PHPWS_Core::initModClass('hms', 'ReApplicationOffCampusFormView.php');
$view = new ReApplicationOffCampusFormView($student, $term);
$context->setContent($view->show());
}
开发者ID:jlbooker,项目名称:homestead,代码行数:33,代码来源:ShowOffCampusWaitListApplicationCommand.php
示例20: execute
public function execute(CommandContext $context)
{
$term = $context->get('term');
if (!isset($term) || is_null($term) || empty($term)) {
throw new InvalidArgumentException('Missing term.');
}
$cmd = CommandFactory::getCommand('ShowStudentMenu');
$feature = ApplicationFeature::getInstanceByNameAndTerm('RlcApplication', $term);
// Make sure the RLC application feature is enabled
if (is_null($feature) || !$feature->isEnabled()) {
NQ::simple('hms', hms\NotificationView::ERROR, "Sorry, RLC applications are not avaialable for this term.");
$cmd->redirect();
}
// Check feature's deadlines
if ($feature->getStartDate() > time()) {
NQ::simple('hms', hms\NotificationView::ERROR, "Sorry, it is too soon to fill out an RLC application.");
$cmd->redirect();
} else {
if ($feature->getEndDate() < time()) {
NQ::simple('hms', hms\NotificationView::ERROR, "Sorry, the RLC application deadline has already passed. Please contact University Housing if you are interested in applying for a RLC.");
$cmd->redirect();
}
}
// Get the Student object
$student = StudentFactory::getStudentByUsername(UserStatus::getUsername(), Term::getCurrentTerm());
$view = new RlcApplicationPage1View($context, $student);
$context->setContent($view->show());
}
开发者ID:jlbooker,项目名称:homestead,代码行数:28,代码来源:ShowRlcApplicationViewCommand.php
注:本文中的NQ类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论