本文整理汇总了PHP中CommandContext::getParams方法的典型用法代码示例。如果您正苦于以下问题:PHP CommandContext::getParams方法的具体用法?PHP CommandContext::getParams怎么用?PHP CommandContext::getParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommandContext
的用法示例。
在下文中一共展示了CommandContext::getParams方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute(CommandContext $context)
{
$term = $context->get('term');
// If we're coming from the special needs page, save any special needs flags the student selected
if (array_key_exists('special_needs', $context->getParams())) {
$this->saveSpecialNeeds($context);
}
// If they haven't agreed, redirect to the agreement
// TODO: actually check via docusign API
$event = $context->get('event');
if (is_null($event) || !isset($event) || $event != 'signing_complete' && $event != 'viewing_complete') {
$returnCmd = CommandFactory::getCommand('ShowFreshmenApplicationReview');
$returnCmd->setTerm($term);
$agreementCmd = CommandFactory::getCommand('ShowTermsAgreement');
$agreementCmd->setTerm($term);
$agreementCmd->setAgreedCommand($returnCmd);
$agreementCmd->redirect();
}
$student = StudentFactory::getStudentByUsername(UserStatus::getUsername(), $term);
$errorCmd = CommandFactory::getCommand('ShowHousingApplicationForm');
$errorCmd->setTerm($term);
// Determine the application type, based on the term
$sem = Term::getTermSem($term);
switch ($sem) {
case TERM_FALL:
$appType = 'fall';
break;
case TERM_SPRING:
$appType = 'spring';
break;
case TERM_SUMMER1:
case TERM_SUMMER2:
$appType = 'summer';
break;
}
try {
$application = HousingApplicationFactory::getApplicationFromSession($_SESSION['application_data'], $term, $student, $appType);
} catch (Exception $e) {
NQ::simple('hms', hms\NotificationView::ERROR, $e->getMessage());
$errorCmd->redirect();
}
PHPWS_Core::initModClass('hms', 'FreshmenApplicationReview.php');
$view = new FreshmenApplicationReview($student, $term, $application);
$context->setContent($view->show());
}
示例2: execute
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.');
}
PHPWS_Core::initModClass('hms', 'ReportFactory.php');
$reportClass = $context->get('reportClass');
if (!isset($reportClass) || is_null($reportClass)) {
throw new InvalidArgumentException('Missing report class name.');
}
$reportCtrl = ReportFactory::getcontrollerInstance($reportClass);
$runNow = $context->get('runNow');
if (isset($runNow) && $runNow == "true") {
$time = time();
} else {
$timePicker = $context->get('timePicker');
$timeParts = explode(" ", $timePicker);
$meridian = $timeParts[1];
$timeParts = explode(":", $timeParts[0]);
$hour = $timeParts[0];
if ($meridian == "PM") {
$hour += 12;
}
$min = $timeParts[1];
$datePicker = $context->get('datePicker');
$dateParts = explode("/", $datePicker);
$month = $dateParts[0];
$day = $dateParts[1];
$year = $dateParts[2];
$time = mktime($hour, $min, 0, $month, $day, $year);
}
// Set the exec time
$reportCtrl->newReport($time);
// Save the report
$reportCtrl->saveReport();
// Grab the report's settings from the context
$reportCtrl->setParams($context->getParams());
// Save those params
$reportCtrl->saveParams();
HMS::quit();
}
示例3: execute
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.');
}
PHPWS_Core::initModClass('hms', 'ReportFactory.php');
// Determine which report we're running
$reportClass = $context->get('reportClass');
if (!isset($reportClass) || is_null($reportClass)) {
throw new InvalidArgumentException('Missing report class.');
}
// Get the proper report controller
$reportCtrl = ReportFactory::getControllerInstance($reportClass);
// Initalize a new report
$reportCtrl->newReport(time());
// Get the params from the context
/*
* The below is a bit of hack. The term should really be taken care of
* by a setup view, and passed in as part of the context proper. We tack
* it onto the context here, just to make sure it's available.
*/
$params = $context->getParams();
$params['term'] = Term::getSelectedTerm();
//test(Term::getSelectedTerm());
//test($params,1);
$reportCtrl->setParams($params);
// Save this report so it'll have an ID
$reportCtrl->saveReport();
// Generate the report
$reportCtrl->generateReport();
// Get the default view command
$viewCmd = $reportCtrl->getDefaultOutputViewCmd();
// Rediect to the view command
$viewCmd->redirect();
}