本文整理汇总了PHP中CommandFactory::getCommand方法的典型用法代码示例。如果您正苦于以下问题:PHP CommandFactory::getCommand方法的具体用法?PHP CommandFactory::getCommand怎么用?PHP CommandFactory::getCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommandFactory
的用法示例。
在下文中一共展示了CommandFactory::getCommand方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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());
}
示例2: show
public function show()
{
$username = UserStatus::getUsername();
$currentTerm = Term::getCurrentTerm();
$student = StudentFactory::getStudentByUsername($username, $currentTerm);
$applicationTerm = $student->getApplicationTerm();
$tpl = array();
$tpl['TITLE'] = 'Contact Form';
$form = new PHPWS_Form();
$form->addText('name');
$form->setLabel('name', 'Name');
$form->addText('email');
$form->setLabel('email', 'Email Address');
$form->addText('phone');
$form->setLabel('phone', 'Phone number');
$form->addDropBox('stype', array('F' => 'New Freshmen', 'T' => 'Transfer', 'C' => 'Returning'));
$form->setLabel('stype', 'Classification');
$form->addTextArea('comments');
$form->setLabel('comments', 'Question, Comments, or Description of the Problem');
$form->addSubmit('Submit');
$form->mergeTemplate($tpl);
$cmd = CommandFactory::getCommand('SubmitContactForm');
$cmd->setUsername($username);
$cmd->setApplicationTerm($applicationTerm);
$cmd->setStudentType($student->getType());
$cmd->initForm($form);
$tpl = $form->getTemplate();
//var_dump($tpl);exit;
return PHPWS_Template::process($tpl, 'hms', 'student/contact_page.tpl');
}
示例3: 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());
}
示例4: show
public function show()
{
PHPWS_Core::initModClass('hms', 'HMS_Util.php');
$tpl = array();
$tpl['DATES'] = HMS_Util::getPrettyDateRange($this->startDate, $this->endDate);
$tpl['STATUS'] = "";
if (!is_null($this->application) && $this->application->getApplicationType() == 'offcampus_waiting_list') {
$tpl['ICON'] = FEATURE_COMPLETED_ICON;
$tpl['ALREADY_APPLIED'] = "";
} else {
if (time() < $this->startDate) {
$tpl['ICON'] = FEATURE_NOTYET_ICON;
$tpl['BEGIN_DEADLINE'] = HMS_Util::getFriendlyDate($this->startDate);
} else {
if (time() > $this->endDate) {
$tpl['ICON'] = FEATURE_LOCKED_ICON;
// fade out header
$tpl['STATUS'] = "locked";
$tpl['END_DEADLINE'] = HMS_Util::getFriendlyDate($this->endDate);
} else {
//TODO
$tpl['ICON'] = FEATURE_OPEN_ICON;
$waitListCommand = CommandFactory::getCommand('ShowOffCampusWaitListApplication');
$waitListCommand->setTerm($this->term);
$tpl['WAIT_LIST_LINK'] = $waitListCommand->getLink('Apply to the waiting list');
}
}
}
return PHPWS_Template::process($tpl, 'hms', 'student/menuBlocks/OffCampusWaitingListMenuBlock.tpl');
}
示例5: show
public function show()
{
PHPWS_Core::initModClass('hms', 'HMS_Lottery.php');
PHPWS_Core::initModClass('hms', 'LotteryApplication.php');
$this->setTitle('Special Interest Group');
javascript('jquery');
$tpl = array();
$groups = HMS_Lottery::getSpecialInterestGroupsMap();
// If a group was selected
if (!is_null($this->group) && $this->group != 'none') {
$tpl['GROUP_PAGER'] = LotteryApplication::specialInterestPager($this->group, PHPWS_Settings::get('hms', 'lottery_term'));
$tpl['GROUP'] = $groups[$this->group];
}
// Show the drop down box of groups
$form = new PHPWS_Form('special_interest');
$form->setMethod('get');
$form->addDropBox('group', $groups);
$form->setClass('group', 'form-control');
$form->setMatch('group', $this->group);
$cmd = CommandFactory::getCommand('ShowSpecialInterestGroupApproval');
$cmd->initForm($form);
$form->mergeTemplate($tpl);
$tpl = $form->getTemplate();
return PHPWS_Template::process($tpl, 'hms', 'admin/special_interest_approval.tpl');
}
示例6: execute
public function execute(CommandContext $context)
{
$reminders = $context->get('send_reminders');
$sendReminders = isset($reminders) ? true : false;
$magic = $context->get('magic_flag');
$sendMagic = isset($magic) ? true : false;
$srMale = $context->get('sr_male');
$srFemale = $context->get('sr_female');
$jrMale = $context->get('jr_male');
$jrFemale = $context->get('jr_female');
$sophMale = $context->get('soph_male');
$sophFemale = $context->get('soph_female');
PHPWS_Core::initModClass('hms', 'LotteryProcess.php');
$inviteCounts = array();
$inviteCounts[CLASS_SENIOR][MALE] = $srMale;
$inviteCounts[CLASS_SENIOR][FEMALE] = $srFemale;
$inviteCounts[CLASS_JUNIOR][MALE] = $jrMale;
$inviteCounts[CLASS_JUNIOR][FEMALE] = $jrFemale;
$inviteCounts[CLASS_SOPHOMORE][MALE] = $sophMale;
$inviteCounts[CLASS_SOPHOMORE][FEMALE] = $sophFemale;
$lottery = new LotteryProcess($sendMagic, $sendReminders, $inviteCounts);
$lottery->sendInvites();
$_SESSION['LOTTERY_OUTPUT'] = $lottery->getOutput();
$viewCmd = CommandFactory::getCommand('ShowLotteryInviteResults');
$viewCmd->redirect();
}
示例7: execute
public function execute(CommandContext $context)
{
if (!UserStatus::isAdmin() || !Current_User::allow('hms', 'roommate_maintenance')) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException('You do not have permission to create/edit roommate groups.');
}
PHPWS_Core::initModClass('hms', 'HMS_Roommate.php');
$id = $context->get('id');
if (is_null($id)) {
throw new InvalidArgumentException('Missing roommate group id.');
}
$viewCmd = CommandFactory::getCommand('EditRoommateGroupsView');
try {
$roommate = new HMS_Roommate($id);
$roommate->delete();
} catch (Exception $e) {
NQ::simple('hms', hms\NotificationView::SUCCESS, 'Error deleting roommate group: ' . $e->getMessage());
$viewCmd->redirect();
}
// Log the success
$notes = "{$roommate->getRequestor()} requested {$roommate->getRequestee()}";
HMS_Activity_Log::log_activity($roommate->getRequestor(), ACTIVITY_ADMIN_REMOVED_ROOMMATE, UserStatus::getUsername(), $notes);
HMS_Activity_Log::log_activity($roommate->getRequestee(), ACTIVITY_ADMIN_REMOVED_ROOMMATE, UserStatus::getUsername(), $notes);
NQ::simple('hms', hms\NotificationView::SUCCESS, 'Roommate group successfully deleted.');
$viewCmd->redirect();
}
示例8: 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());
}
示例9: execute
public function execute(CommandContext $context)
{
// Get input
$requestId = $context->get('requestId');
$participantId = $context->get('participantId');
// Command for showing the request, redirected to on success/error
$cmd = CommandFactory::getCommand('ShowManageRoomChange');
$cmd->setRequestId($requestId);
// Load the request
$request = RoomChangeRequestFactory::getRequestById($requestId);
// Load the participant
$participant = RoomChangeParticipantFactory::getParticipantById($participantId);
// Check permissions. Must be an RD for current bed, or an admin
$rds = $participant->getFutureRdList();
if (!in_array(UserStatus::getUsername(), $rds) && !Current_User::allow('hms', 'admin_approve_room_change')) {
throw new PermissionException('You do not have permission to approve this room change.');
}
// Transition to CurrRdApproved
$participant->transitionTo(new ParticipantStateFutureRdApproved($participant, time(), null, UserStatus::getUsername()));
//TODO If all participants are approved, send notification to Housing
if ($request->isApprovedByAllFutureRDs()) {
HMS_Email::sendRoomChangeAdministratorNotice($request);
}
// Redirect to the manage request page
$cmd->redirect();
}
示例10: show
public function show()
{
$tpl = array();
$tpl['DATES'] = HMS_Util::getPrettyDateRange($this->startDate, $this->endDate);
$tpl['STATUS'] = "";
if (isset($this->profile) && !is_null($this->profile)) {
$tpl['ICON'] = FEATURE_COMPLETED_ICON;
$editCmd = CommandFactory::getCommand('ShowRoommateProfileForm');
$editCmd->setTerm($this->term);
$tpl['EDIT_PROFILE'] = $editCmd->getLink('view and edit your profile');
} else {
if (time() < $this->startDate) {
$tpl['ICON'] = FEATURE_LOCKED_ICON;
$tpl['BEGIN_DEADLINE'] = HMS_Util::getFriendlyDate($this->startDate);
} else {
if (time() > $this->endDate) {
$tpl['END_DEADLINE'] = HMS_Util::getFriendlyDate($this->endDate);
// fade out header
$tpl['STATUS'] = "locked";
$tpl['ICON'] = FEATURE_LOCKED_ICON;
} else {
$tpl['ICON'] = FEATURE_OPEN_ICON;
$createCmd = CommandFactory::getCommand('ShowRoommateProfileForm');
$createCmd->setTerm($this->term);
$tpl['CREATE_PROFILE'] = $createCmd->getLink('Create your profile');
}
}
}
return PHPWS_Template::process($tpl, 'hms', 'student/menuBlocks/StudentProfileMenuBlock.tpl');
}
示例11: show
public function show()
{
Layout::addPageTitle("Hall Notification Edit");
$tpl = array();
$submitCmd = CommandFactory::getCommand('ReviewHallNotificationMessage');
$form = new PHPWS_Form('email_content');
$submitCmd->initForm($form);
if (Current_User::allow('hms', 'anonymous_notifications')) {
$form->addCheck('anonymous');
$form->setMatch('anonymous', $this->anonymous);
$form->setLabel('anonymous', 'Send Anonymously');
}
$form->addText('subject', !is_null($this->subject) ? $this->subject : '');
$form->setLabel('subject', 'Subject');
$form->addCssClass('subject', 'form-control');
$form->setSize('subject', 35);
$form->setExtra('subject', 'autofocus');
$form->addTextarea('body', !is_null($this->body) ? $this->body : '');
$form->addCssClass('body', 'form-control');
$form->setLabel('body', 'Message:');
if (!empty($this->halls)) {
$form->addHidden('hall', $this->halls);
}
if (!empty($this->floors)) {
$form->addHidden('floor', $this->floors);
}
return PHPWS_Template::process($form->getTemplate(), 'hms', 'admin/hall_notification_email_page.tpl');
}
示例12: show
public function show()
{
PHPWS_Core::initCoreClass('Form.php');
javascript('jquery');
javascript('modules/hms/assign_student');
$unassignCmd = CommandFactory::getCommand('UnassignStudent');
$form = new PHPWS_Form();
$unassignCmd->initForm($form);
$form->addText('username');
if (!is_null($this->student)) {
$form->setValue('username', $this->student->getUsername());
}
$form->addCssClass('username', 'form-control');
$form->setExtra('username', 'autofocus');
// Addition of "Unassignment Type"
$form->addDropBox('unassignment_type', array('-1' => 'Choose a reason...', UNASSIGN_ADMIN => 'Administrative', UNASSIGN_REASSIGN => 'Re-assign', UNASSIGN_CANCEL => 'Contract Cancellation', UNASSIGN_PRE_SPRING => 'Pre-spring room change', UNASSIGN_RELEASE => 'Contract Release'));
//$form->setMatch('unassignment_type', UNASSIGN_ADMIN);
$form->setLabel('unassignment_type', 'Unassignment Type: ');
$form->addCssClass('unassignment_type', 'form-control');
$form->addText('refund');
$form->setLabel('refund', 'Refund Percentage');
$form->setSize('refund', 4);
$form->setMaxSize('refund', 3);
$form->addCssClass('refund', 'form-control');
$form->addTextarea('note');
$form->setLabel('note', 'Note: ');
$form->addCssClass('note', 'form-control');
$tpl = $form->getTemplate();
$tpl['TERM'] = Term::getPrintableSelectedTerm();
Layout::addPageTitle("Unassign Student");
return PHPWS_Template::process($tpl, 'hms', 'admin/unassignStudent.tpl');
}
示例13: 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);
}
示例14: show
public function show()
{
$tpl = array();
PHPWS_Core::initModClass('hms', 'HMS_Util.php');
$tpl['DATES'] = HMS_Util::getPrettyDateRange($this->startDate, $this->endDate);
if (is_null($this->application)) {
// No application
$tpl['ICON'] = FEATURE_NOTYET_ICON;
$tpl['NOT_APP'] = "";
// this needs to be here to trigger the line in the template
} else {
if (time() < $this->startDate) {
// too early
$tpl['BEGIN_DEADLINE'] = HMS_Util::getFriendlyDate($this->startDate);
$tpl['ICON'] = FEATURE_NOTYET_ICON;
} else {
if (time() > $this->endDate) {
// too late
$tpl['ICON'] = FEATURE_LOCKED_ICON;
$tpl['END_DEADLINE'] = HMS_Util::getFriendlyDate($this->endDate);
} else {
$tpl['ICON'] = FEATURE_OPEN_ICON;
$cmd = CommandFactory::getCommand('ShowEmergencyContactForm');
$cmd->setTerm($this->application->getTerm());
$tpl['UPDATE_CONTACT'] = $cmd->getLink('update your emergency contact info');
}
}
}
return PHPWS_Template::process($tpl, 'hms', 'student/menuBlocks/updateEmergencyContactMenuBlock.tpl');
}
示例15: execute
public function execute(CommandContext $context)
{
if (!UserStatus::isAdmin() || !Current_User::allow('hms', 'floor_view')) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException('You do not have permission to edit floors.');
}
// Check for a hall ID
$floorId = $context->get('floor');
if (!isset($floorId)) {
throw new InvalidArgumentException('Missing floor ID.');
}
PHPWS_Core::initModClass('hms', 'HMS_Residence_Hall.php');
PHPWS_Core::initModClass('hms', 'HMS_Floor.php');
PHPWS_Core::initModClass('hms', 'FloorView.php');
$floor = new HMS_Floor($floorId);
if ($floor->term != Term::getSelectedTerm()) {
$floorCmd = CommandFactory::getCommand('SelectFloor');
$floorCmd->setTitle('Edit a Floor');
$floorCmd->setOnSelectCmd(CommandFactory::getCommand('EditFloorView'));
$floorCmd->redirect();
}
$hall = $floor->get_parent();
$floorView = new FloorView($hall, $floor);
$context->setContent($floorView->show());
}