/**
  * Main method.
  *
  * @since 0.1
  *
  * @param string $subPage
  */
 public function execute($subPage)
 {
     $subPage = str_replace('_', ' ', $subPage);
     $subPage = explode('/', $subPage, 2);
     $challengeTitle = count($subPage) > 1 ? $subPage[1] : false;
     $subPage = $subPage[0];
     if (!parent::execute($subPage)) {
         return;
     }
     $out = $this->getOutput();
     /**
      * @var $contest Contest
      */
     $contest = Contest::s()->selectRow(null, array('name' => $subPage));
     if ($contest === false) {
         $out->redirect(SpecialPage::getTitleFor('Contests')->getLocalURL());
     } else {
         $out->setPageTitle(wfMsgExt('contest-contest-title', 'parseinline', $contest->getField('name')));
         $this->displayNavigation();
         $this->showGeneralInfo($contest);
         if ($this->getUser()->isAllowed('contestadmin')) {
             $this->showMailFunctionality($contest);
         }
         $out->addHTML(Html::element('h3', array(), wfMsg('contest-contest-contestants')));
         $this->addFilterOptionsToSession();
         $this->showFilterControl($contest, $challengeTitle);
         $this->showContestants($contest, $challengeTitle);
         $out->addModules('contest.special.contest');
     }
 }
 /**
  * Main method.
  *
  * @since 0.1
  *
  * @param string $subPage
  */
 public function execute($subPage)
 {
     $subPage = str_replace('_', ' ', $subPage);
     if (!parent::execute($subPage)) {
         return;
     }
     if ($this->getRequest()->wasPosted() && $this->getUser()->matchEditToken($this->getRequest()->getVal('wpEditToken'))) {
         $this->showSignupForm(Contest::s()->selectRow(null, array('id' => $this->getRequest()->getInt('wpcontest-id'))));
     } else {
         $this->showPage($subPage);
     }
 }
 /**
  * Main method.
  *
  * @since 0.1
  *
  * @param string $subPage
  */
 public function execute($subPage)
 {
     $subPage = str_replace('_', ' ', $subPage);
     if (!parent::execute($subPage)) {
         return;
     }
     $user = $this->getUser();
     if (!$this->userCanAccess()) {
         $this->displayRestrictionError();
     }
     if ($user->isAllowed('contestadmin')) {
         $this->displayAddNewControl();
     }
     $this->displayContests();
 }
 /**
  * Main method.
  *
  * @since 0.1
  *
  * @param string $subPage
  */
 public function execute($subPage)
 {
     $subPage = str_replace('_', ' ', $subPage);
     if (!parent::execute($subPage)) {
         return;
     }
     if ($this->getRequest()->wasPosted()) {
         $contestant = ContestContestant::s()->selectRow(null, array('id' => $this->getRequest()->getInt('wpcontestant-id')));
         $this->showSubmissionPage($contestant);
     } else {
         if ($subPage == '') {
             $this->displayContestsOverview();
         } else {
             $this->handleSubmissionView($subPage);
         }
     }
 }
 /**
  * Main method.
  *
  * @since 0.1
  *
  * @param string $subPage
  */
 public function execute($subPage)
 {
     if (!parent::execute($subPage)) {
         return;
     }
     /**
      * @var $contestant ContestContestant
      */
     $contestant = ContestContestant::s()->selectRow('id', array('id' => (int) $subPage));
     if ($contestant === false) {
         $this->getOutput()->redirect(SpecialPage::getTitleFor('Contests')->getLocalURL());
     } else {
         if ($this->getRequest()->wasPosted() && $this->getUser()->matchEditToken($this->getRequest()->getVal('wpEditToken'))) {
             $this->handleSubmission($contestant->getId());
         }
         if ($this->getRequest()->wasPosted()) {
             ContestContestant::s()->setReadDb(DB_MASTER);
         }
         $contestant->loadFields();
         ContestContestant::s()->setReadDb(DB_SLAVE);
         $this->showPage($contestant);
     }
 }
 /**
  * Main method.
  *
  * @since 0.1
  *
  * @param string $subPage
  */
 public function execute($subPage)
 {
     $subPage = str_replace('_', ' ', $subPage);
     if (!parent::execute($subPage)) {
         return;
     }
     $out = $this->getOutput();
     /**
      * @var $contest Contest
      */
     $contest = Contest::s()->selectRow(null, array('name' => $subPage));
     if ($contest === false) {
         $this->showNoSuchContest($subPage);
     } elseif ($contest->getStatus() == Contest::STATUS_FINISHED || $contest->getStatus() == Contest::STATUS_EXPIRED) {
         $this->showWarning('contest-signup-finished');
         $out->returnToMain();
     } elseif ($contest->getStatus() == Contest::STATUS_DRAFT) {
         $this->showWarning('contest-signup-draft');
         $out->returnToMain();
     } else {
         $this->showEnabledPage($contest);
     }
 }
 /**
  * Attempt to get the contest to be edited or create the one to be added.
  * If this works, show the form, if not, redirect to special:contests.
  *
  * @since 0.1
  *
  * @param string $subPage
  */
 protected function showContent($subPage)
 {
     $isNew = $this->getRequest()->wasPosted() && $this->getUser()->matchEditToken($this->getRequest()->getVal('newEditToken'));
     $this->getOutput()->addScript(Skin::makeVariablesScript(array('ContestDeletionEnabled' => ContestSettings::get('contestDeletionEnabled'))));
     if ($isNew) {
         $data = array('name' => $this->getRequest()->getVal('newcontest'));
         $contest = Contest::s()->selectRow(null, $data);
         if ($contest === false) {
             $contest = new Contest($data, true);
         } else {
             $this->showWarning('contest-edit-exists-already');
         }
     } else {
         $contest = Contest::s()->selectRow(null, array('name' => $subPage));
     }
     if ($contest === false) {
         $this->getOutput()->redirect(SpecialPage::getTitleFor('Contests')->getLocalURL());
     } else {
         if (!$isNew) {
             $this->getOutput()->addHTML(SpecialContestPage::getNavigation($contest->getField('name'), $this->getUser(), $this->getLanguage(), $this->getName()));
         }
         $this->contest = $contest;
         $this->showForm();
         $this->getOutput()->addModules('contest.special.editcontest');
     }
 }
 /**
  * @return Title
  */
 function getTitle()
 {
     return $this->page->getFullTitle();
 }