本文整理汇总了PHP中NQ::simple方法的典型用法代码示例。如果您正苦于以下问题:PHP NQ::simple方法的具体用法?PHP NQ::simple怎么用?PHP NQ::simple使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NQ
的用法示例。
在下文中一共展示了NQ::simple方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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());
}
示例2: 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}";
}
}
示例3: 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.');
}
示例4: 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/deny RLC applications.');
}
PHPWS_Core::initModClass('hms', 'HMS_RLC_Assignment.php');
PHPWS_Core::initModClass('hms', 'HMS_RLC_Application.php');
// Remove assignment
$assignment = HMS_RLC_Assignment::getAssignmentById($context->get('assignId'));
$rlcName = $assignment->getRlcName();
$rlcApp = $assignment->getApplication();
if (!is_null($assignment)) {
$assignment->delete();
} else {
NQ::simple('hms', hms\NotificationView::ERROR, 'Could not find an RLC assignment with that id.');
}
HMS_Activity_Log::log_activity($rlcApp->getUsername(), ACTIVITY_RLC_UNASSIGN, Current_User::getUsername(), "Removed from {$rlcName}");
NQ::simple('hms', hms\NotificationView::SUCCESS, 'Removed from RLC');
// Deny application
$rlcApp->denied = 1;
$rlcApp->save();
NQ::simple('hms', hms\NotificationView::SUCCESS, 'RLC Application denied');
HMS_Activity_Log::log_activity($rlcApp->getUsername(), ACTIVITY_DENIED_RLC_APPLICATION, Current_User::getUsername(), 'RLC Application Denied');
$context->goBack();
}
示例5: 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();
}
示例6: 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());
}
示例7: 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');
}
示例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();
}
示例9: 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);
}
示例10: 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.');
}
$term = Term::getSelectedTerm();
$bannerId = $context->get('bannerId');
$hallId = $context->get('hallId');
$errorCmd = CommandFactory::getCommand('ShowCheckinStart');
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();
}
// Check the Banner ID
if (preg_match("/[\\d]{9}/", $bannerId) == false) {
NQ::simple('hms', hms\NotificationView::ERROR, 'Imporperly formatted Banner ID.');
$errorCmd->redirect();
}
// Try to lookup the student in Banner
try {
$student = StudentFactory::getStudentByBannerId($bannerId, $term);
} catch (StudentNotFoundException $e) {
NQ::simple('hms', hms\NotificationView::ERROR, 'Could not locate a student with that Banner ID.');
$errorCmd->redirect();
}
// Make sure the student is assigned in the current term
$assignment = HMS_Assignment::getAssignmentByBannerId($bannerId, $term);
if (!isset($assignment) || is_null($assignment)) {
NQ::simple('hms', hms\NotificationView::ERROR, $student->getName() . ' is not assigned for ' . Term::toString($term) . '. Please contact the University Housing Assignments Office at 828-262-6111.');
$errorCmd->redirect();
}
// Make sure the student's assignment matches the hall the user selected
$bed = $assignment->get_parent();
$room = $bed->get_parent();
$floor = $room->get_parent();
$hall = $floor->get_parent();
if ($hallId != $hall->getId()) {
NQ::simple('hms', hms\NotificationView::ERROR, 'Wrong hall! ' . $student->getName() . ' is assigned to ' . $assignment->where_am_i());
$errorCmd->redirect();
}
// Load any existing check-in
$checkin = CheckinFactory::getLastCheckinByBannerId($bannerId, $term);
// If there is a checkin for the same bed, and the difference between the current time and the checkin time is
// greater than 48 hours, then show an error.
if (!is_null($checkin)) {
$checkoutDate = $checkin->getCheckoutDate();
if ($checkin->getBedId() == $bed->getId() && !isset($checkoutDate) && time() - $checkin->getCheckinDate() > Checkin::CHECKIN_TIMEOUT) {
NQ::simple('hms', hms\NotificationView::ERROR, $student->getName() . ' has already checked in to ' . $assignment->where_am_i());
$errorCmd->redirect();
}
}
$view = new CheckinFormView($student, $assignment, $hall, $floor, $room, $checkin);
$context->setContent($view->show());
}
示例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();
}
示例12: 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());
}
示例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;
}
示例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;
}
示例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();
}