本文整理汇总了PHP中Term::getQueueCount方法的典型用法代码示例。如果您正苦于以下问题:PHP Term::getQueueCount方法的具体用法?PHP Term::getQueueCount怎么用?PHP Term::getQueueCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Term
的用法示例。
在下文中一共展示了Term::getQueueCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
public function show()
{
if (!UserStatus::isAdmin() || !Current_User::allow('hms', 'edit_terms')) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException('You do not have permission to edit terms.');
}
$printable = Term::getPrintableSelectedTerm();
$tpl = array();
$tpl['TITLE'] = dgettext('hms', 'Term settings for ') . $printable;
$newTermCmd = CommandFactory::getCommand('ShowCreateTerm');
$tpl['NEW_TERM_URI'] = $newTermCmd->getURI();
// Is this the Current Term?
if (Term::isCurrentTermSelected()) {
$tpl['CURRENT_TERM_TEXT'] = dgettext('hms', 'This term is the <strong>active term</strong>. To make another term active, please select it from the list at the top-left.');
} else {
$tpl['CURRENT_TERM_TEXT'] = dgettext('hms', 'This term is <strong>not</strong> the active term.');
if (Current_User::allow('hms', 'activate_term')) {
$cmd = CommandFactory::getCommand('SetCurrentTerm');
$cmd->setTerm(Term::getSelectedTerm());
$tpl['SET_TERM_URI'] = $cmd->getURI();
$tpl['SET_TERM_TEXT'] = "Make <strong>{$printable}</strong> the Current Term";
}
}
// What's with the Banner Queue?
$term = new Term(Term::getSelectedTerm());
if ($term->getBannerQueue()) {
$tpl['QUEUE_ENABLED'] = '';
$count = $term->getQueueCount();
$tpl['BANNER_QUEUE_COUNT'] = $count;
if ($count > 0) {
$cmd = CommandFactory::getCommand('ProcessBannerQueue');
$cmd->setTerm(Term::getSelectedTerm());
$tpl['BANNER_QUEUE_PROCESS_URI'] = $cmd->getURI();
} else {
$cmd = CommandFactory::getCommand('DisableBannerQueue');
$cmd->setTerm(Term::getSelectedTerm());
$tpl['BANNER_QUEUE_LINK'] = $cmd->getLink('Disable');
}
} else {
$tpl['QUEUE_DISABLED'] = '';
$cmd = CommandFactory::getCommand('EnableBannerQueue');
$cmd->setTerm(Term::getSelectedTerm());
$tpl['BANNER_QUEUE_LINK'] = $cmd->getLink('Enable');
}
// Terms and Conditions
PHPWS_Core::initModClass('hms', 'TermsConditionsAdminView.php');
$tcav = new TermsConditionsAdminView($this->term);
$tpl['TERMS_CONDITIONS_CONTENT'] = $tcav->show();
// Features and Deadlines
PHPWS_Core::initModClass('hms', 'ApplicationFeatureListView.php');
$aflv = new ApplicationFeatureListView(Term::getSelectedTerm());
$tpl['FEATURES_DEADLINES_CONTENT'] = $aflv->show();
Layout::addPageTitle("Term Settings");
return PHPWS_Template::process($tpl, 'hms', 'admin/TermEditView.tpl');
}
示例2: execute
public function execute(CommandContext $context)
{
if (!UserStatus::isAdmin() || !Current_User::allow('hms', 'banner_queue')) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException('You do not have permission to enable/disable the Banner queue.');
}
if (is_null($this->term)) {
$this->term = $context->get('term');
}
$term = $this->term;
if (is_null($term)) {
throw new InvalidArgumentException('No term was specified to DisableBannerQueue');
}
$term = new Term($term);
if (!$term->getBannerQueue()) {
NQ::Simple('hms', hms\NotificationView::ERROR, 'The Banner Queue is not enabled for ' . Term::toString($term->term) . '.');
} else {
if ($term->getQueueCount() < 1) {
NQ::Simple('hms', hms\NotificationView::WARNING, 'The Banner Queue was already empty for ' . Term::toString($term->term) . '.');
$term->setBannerQueue(FALSE);
$term->save();
NQ::Simple('hms', hms\NotificationView::SUCCESS, 'Banner Queue has been disabled for ' . Term::toString($term->term) . '.');
} else {
PHPWS_Core::initModClass('hms', 'BannerQueue.php');
$result = BannerQueue::processAll($term->term);
if ($result === TRUE) {
NQ::Simple('hms', hms\NotificationView::SUCCESS, 'Banner Queue has been processed for ' . Term::toString($term->term) . '.');
$term->setBannerQueue(FALSE);
$term->save();
NQ::Simple('hms', hms\NotificationView::SUCCESS, 'Banner Queue has been disabled for ' . Term::toString($term->term) . '.');
} else {
// TODO: This is just awful.
$text = 'The following failures occurred reporting to Banner:<br /><br /><ul>';
foreach ($result as $error) {
$text .= "<li>{$error['username']}: ({$error['code']}) - {$error['message']}</li>";
}
$text .= '</ul>The queue was not disabled.';
NQ::Simple('hms', hms\NotificationView::ERROR, $text);
}
}
}
$cmd = CommandFactory::getCommand('ShowEditTerm');
$cmd->redirect();
}
示例3: execute
public function execute(CommandContext $context)
{
if (!UserStatus::isAdmin() || !Current_User::allow('hms', 'banner_queue')) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException('You do not have permission to enable/disable the Banner queue.');
}
if (is_null($this->term)) {
$this->term = $context->get('term');
}
$term = $this->term;
if (is_null($term)) {
throw new InvalidArgumentException('No term was specified to DisableBannerQueue');
}
$term = new Term($term);
if ($term->getQueueCount() > 0) {
NQ::Simple('hms', hms\NotificationView::ERROR, 'You must process the Banner Queue before it can be disabled.');
} else {
$term->setBannerQueue(FALSE);
$term->save();
NQ::Simple('hms', hms\NotificationView::SUCCESS, 'Banner Queue has been disabled for ' . Term::toString($term->term) . '.');
}
CommandContext::goBack();
}