本文整理汇总了PHP中CommandFactory::GetCommand方法的典型用法代码示例。如果您正苦于以下问题:PHP CommandFactory::GetCommand方法的具体用法?PHP CommandFactory::GetCommand怎么用?PHP CommandFactory::GetCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommandFactory
的用法示例。
在下文中一共展示了CommandFactory::GetCommand方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
public function show()
{
$tpl = array();
PHPWS_Core::initModClass('hms', 'HMS_Roommate.php');
PHPWS_Core::initModClass('hms', 'HMS_Util.php');
$roommate = HMS_Roommate::get_confirmed_roommate(UserStatus::getUsername(), $this->term);
$requests = HMS_Roommate::countPendingRequests(UserStatus::getUsername(), $this->term);
$tpl['DATES'] = HMS_Util::getPrettyDateRange($this->startDate, $this->endDate);
$tpl['STATUS'] = "";
// Roommate has been selected and confirmed
if (!is_null($roommate)) {
$name = $roommate->getFullName();
$tpl['ROOMMATE_MSG'] = "<b>{$name}</b> has confirmed your roommate request. Roommate requests are subject to space availability.";
$tpl['ICON'] = FEATURE_COMPLETED_ICON;
if (time() < $this->editDate) {
$cmd = CommandFactory::GetCommand('ShowRoommateBreak');
$rm = HMS_Roommate::getByUsernames(UserStatus::getUsername(), $roommate->getUsername(), $this->term);
$cmd->setRoommateId($rm->id);
$tpl['ROOMMATE_BREAK'] = $cmd->getLink('Remove roommate request');
}
} else {
if (time() < $this->startDate) {
$tpl['ROOMMATE_MSG'] = '<b>It is too early to choose a roommate.</b> You can choose a roommate on ' . HMS_Util::getFriendlyDate($this->startDate) . '.';
$tpl['ICON'] = FEATURE_NOTYET_ICON;
} else {
if (time() > $this->endDate) {
$tpl['ROOMMATE_MSG'] = '<b>It is too late to choose a roommate.</b> The deadline passed on ' . HMS_Util::getFriendlyDate($this->endDate) . '.';
// fade out header
$tpl['STATUS'] = "locked";
$tpl['ICON'] = FEATURE_LOCKED_ICON;
} else {
if ($requests > 0) {
$tpl['ROOMMATE_REQUESTS'] = HMS_Roommate::display_requests(UserStatus::getUsername(), $this->term);
if ($requests == 1) {
$tpl['ROOMMATE_REQUESTS_MSG'] = "<b style='color: #F00'>You have a roommate request.</b> Please click the name below to confirm or reject the request.";
} else {
$tpl['ROOMMATE_REQUESTS_MSG'] = "<b style='color: #F00'>You have roommate requests.</b> Please click a name below to confirm or reject a request.";
}
} else {
if (HMS_Roommate::has_roommate_request(UserStatus::getUsername(), $this->term)) {
$tpl['ICON'] = FEATURE_COMPLETED_ICON;
$tpl['ROOMMATE_MSG'] = "<b>You have selected a roommate</b> and are awaiting their approval.";
$requestee = HMS_Roommate::get_unconfirmed_roommate(UserStatus::getUsername(), $this->term);
if (time() < $this->editDate) {
$rm = HMS_Roommate::getByUsernames(UserStatus::getUsername(), $requestee, $this->term);
$cmd = CommandFactory::getCommand('RoommateRequestCancel');
$cmd->setRoommateId($rm->id);
$tpl['ROOMMATE_BREAK'] = $cmd->getLink('Cancel Request');
}
} else {
$tpl['ICON'] = FEATURE_OPEN_ICON;
$tpl['ROOMMATE_MSG'] = 'If you know who you want your roommate to be, <b>you may select your roommate now</b>. You will need to know your roommate\'s ASU user name (their e-mail address). You have until ' . HMS_Util::getFriendlyDate($this->endDate) . ' to choose a roommate. Click the link below to select your roommate.';
$cmd = CommandFactory::getCommand('ShowRequestRoommate');
$cmd->setTerm($this->term);
$tpl['ROOMMATE_LINK'] = $cmd->getLink('Select Your Roommate');
}
}
}
}
}
Layout::addPageTitle("Roommate Selection");
return PHPWS_Template::process($tpl, 'hms', 'student/menuBlocks/roommateMenuBlock.tpl');
}