本文整理匯總了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;
}