本文整理汇总了PHP中Contest::getStatusMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP Contest::getStatusMessage方法的具体用法?PHP Contest::getStatusMessage怎么用?PHP Contest::getStatusMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contest
的用法示例。
在下文中一共展示了Contest::getStatusMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayContestsTable
/**
* Displays a list of all contests.
*
* @since 0.1
*
* @param array $contests
*/
protected function displayContestsTable(array $contests)
{
$user = $this->getUser();
$out = $this->getOutput();
$out->addHTML(Html::element('h2', array('class' => 'contests-title'), wfMsg('contest-special-existing')));
$out->addHTML(Xml::openElement('table', array('class' => 'wikitable sortable contests-table')));
$headers = array(Html::element('th', array(), wfMsg('contest-special-name')), Html::element('th', array(), wfMsg('contest-special-status')), Html::element('th', array(), wfMsg('contest-special-submissioncount')));
$headers[] = Html::element('th', array('class' => 'unsortable'));
$out->addHTML('<thead><tr>' . implode('', $headers) . '</tr></thead>');
$out->addHTML('<tbody>');
foreach ($contests as $contest) {
/**
* @var $contest Contest
*/
$fields = array();
if ($user->isAllowed('contestant')) {
$name = Html::element('a', array('href' => SpecialPage::getTitleFor('ContestWelcome', $contest->getField('name'))->getLocalURL()), $contest->getField('name'));
} else {
$name = $contest->getField('name');
}
$fields[] = Html::rawElement('td', array('data-sort-value' => $contest->getField('name')), $name);
$fields[] = Html::element('td', array('data-sort-value' => $contest->getStatus()), Contest::getStatusMessage($contest->getStatus()));
$fields[] = Html::element('td', array(), $this->getLanguage()->formatNum($contest->getField('submission_count')));
$links = array();
if ($user->isAllowed('contestjudge')) {
$links[] = Html::element('a', array('href' => SpecialPage::getTitleFor('Contest', $contest->getField('name'))->getLocalURL()), wfMsg('contest-nav-contest'));
}
if ($user->isAllowed('contestadmin')) {
$links[] = Html::element('a', array('href' => SpecialPage::getTitleFor('EditContest', $contest->getField('name'))->getLocalURL()), wfMsg('contest-special-edit'));
if (ContestSettings::get('contestDeletionEnabled')) {
$links[] = Html::element('a', array('href' => '#', 'class' => 'contest-delete', 'data-contest-id' => $contest->getId(), 'data-contest-token' => $this->getUser()->editToken('deletecontest' . $contest->getId())), wfMsg('contest-special-delete'));
}
}
$links[] = Html::element('a', array('href' => SpecialPage::getTitleFor('ContestWelcome', $contest->getField('name'))->getLocalURL()), wfMsg('contest-nav-contestwelcome'));
if ($user->isAllowed('contestant')) {
$links[] = Html::element('a', array('href' => SpecialPage::getTitleFor('ContestSignup', $contest->getField('name'))->getLocalURL()), wfMsg('contest-nav-contestsignup'));
}
$fields[] = Html::rawElement('td', array(), $this->getLanguage()->pipeList($links));
$out->addHTML('<tr>' . implode('', $fields) . '</tr>');
}
$out->addHTML('</tbody>');
$out->addHTML('</table>');
$out->addModules('contest.special.contests');
}
示例2: getSummaryData
/**
* Gets the summary data.
*
* @since 0.1
*
* @param Contest $contest
*
* @return array
*/
protected function getSummaryData(Contest $contest)
{
$stats = array();
$stats['name'] = $contest->getField('name');
$stats['status'] = Contest::getStatusMessage($contest->getStatus());
$stats['submissioncount'] = $this->getLanguage()->formatNum($contest->getField('submission_count'));
$stats['end'] = wfMsgExt($contest->getDaysLeft() < 0 ? 'contest-contest-days-ago' : 'contest-contest-days-left', 'parsemag', $this->getLanguage()->timeanddate($contest->getField('end'), true), $this->getLanguage()->formatNum(abs($contest->getDaysLeft())));
return $stats;
}