本文整理匯總了PHP中Contest::getChallenges方法的典型用法代碼示例。如果您正苦於以下問題:PHP Contest::getChallenges方法的具體用法?PHP Contest::getChallenges怎麽用?PHP Contest::getChallenges使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Contest
的用法示例。
在下文中一共展示了Contest::getChallenges方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: showFilterControl
/**
* Create the filter control and add it to the output.
*
* @since 0.2
*
* @param Contest $contest
*/
protected function showFilterControl(Contest $contest)
{
$challenges = array();
foreach ($contest->getChallenges() as $challenge) {
$challenges[$challenge->getField('title')] = $challenge->getField('title');
}
$yesNo = array('yes' => wfMsg('contest-contest-yes'), 'no' => wfMsg('contest-contest-no'));
$noneSome = array('none' => wfMsg('contest-contest-none'), 'some' => wfMsg('contest-contest-some'));
$title = $this->getTitle($this->subPage)->getFullText();
$this->getOutput()->addHTML('<fieldset>' . '<legend>' . wfMsgHtml('contest-contest-showonly') . '</legend>' . '<form method="post" action="' . htmlspecialchars(wfAppendQuery($GLOBALS['wgScript'], array('title' => $title))) . '">' . Html::hidden('title', $title) . $this->getDropdownHTML('challenge', $challenges) . $this->getDropdownHTML('volunteer', $yesNo) . $this->getDropdownHTML('wmf', $yesNo) . $this->getDropdownHTML('comments', $noneSome) . $this->getDropdownHTML('rating_count', $noneSome) . $this->getDropdownHTML('submission', $noneSome) . '<input type="submit" value="' . wfMsgHtml('contest-contest-go') . '">' . ' <button class="contest-pager-clear">' . wfMsgHtml('contest-contest-clear') . '</button>' . '</form>' . '</fieldset>');
}
示例2: getChallengesList
/**
* Gets a list of contests that can be fed directly to the options field of
* an HTMLForm radio input.
* challenge title => challenge id
*
* @since 0.1
*
* @param Contest $contest
*
* @return array
*/
protected function getChallengesList(Contest $contest)
{
$list = array();
foreach ($contest->getChallenges() as $challenge) {
$list[$challenge->getField('title')] = $challenge->getId();
}
return $list;
}
示例3: addContestJS
/**
* Output the needed JS data.
*
* @since 0.1
*
* @param Contest $contest
*/
protected function addContestJS(Contest $contest)
{
$challenges = array();
$output = $this->getOutput();
/**
* @var $challenge ContestChallenge
*/
foreach ($contest->getChallenges() as $challenge) {
$data = $challenge->toArray();
$data['target'] = $this->getSignupLink($contest->getField('name'), $challenge->getId());
$data['text'] = $output->parse($data['text']);
$challenges[] = $data;
}
$output->addScript(Skin::makeVariablesScript(array('ContestChallenges' => $challenges, 'ContestConfig' => array())));
}