コード例 #1
0
ファイル: SpecialSurveys.php プロジェクト: Tjorriemorrie/app
 /**
  * Main method.
  * 
  * @since 0.1
  * 
  * @param string $arg
  */
 public function execute($subPage)
 {
     if (!parent::execute($subPage)) {
         return;
     }
     $req = $this->getRequest();
     if ($req->wasPosted() && $this->getUser()->matchEditToken($req->getVal('wpEditToken')) && $req->getCheck('newsurvey')) {
         $this->getOutput()->redirect(SpecialPage::getTitleFor('EditSurvey', $req->getVal('newsurvey'))->getLocalURL());
     } else {
         $this->displaySurveys();
     }
 }
コード例 #2
0
 /**
  * Main method.
  *
  * @since 0.1
  *
  * @param string $arg
  */
 public function execute($subPage)
 {
     if (!parent::execute($subPage)) {
         return;
     }
     $survey = Survey::selectRow(array('enabled'), array('name' => $subPage));
     if ($survey === false) {
         $this->showError('surveys-takesurvey-nosuchsurvey');
     } elseif ($survey->getField('enabled')) {
         $this->displaySurvey($subPage);
     } elseif ($GLOBALS['wgUser']->isAllowed('surveyadmin')) {
         $this->showWarning('surveys-takesurvey-warn-notenabled');
         $this->getOutput()->addHTML('<br /><br /><br /><br />');
         $this->displaySurvey($subPage);
     } else {
         $this->showError('surveys-takesurvey-surveynotenabled');
     }
 }
コード例 #3
0
 /**
  * Main method.
  * 
  * @since 0.1
  * 
  * @param string $arg
  */
 public function execute($subPage)
 {
     if (!parent::execute($subPage)) {
         return;
     }
     if (is_null($subPage) || trim($subPage) === '') {
         $this->getOutput()->redirect(SpecialPage::getTitleFor('Surveys')->getLocalURL());
     } else {
         $subPage = trim($subPage);
         if (Survey::has(array('name' => $subPage))) {
             $survey = Survey::newFromName($subPage);
             $this->displayNavigation(array(wfMsgExt('survey-navigation-edit', 'parseinline', $survey->getField('name')), wfMsgExt('survey-navigation-take', 'parseinline', $survey->getField('name')), wfMsgExt('survey-navigation-list', 'parseinline')));
             $this->displayStats($survey);
         } else {
             $this->showError('surveys-surveystats-nosuchsurvey');
         }
     }
 }
コード例 #4
0
ファイル: SpecialSurvey.php プロジェクト: Tjorriemorrie/app
 /**
  * Main method.
  * 
  * @since 0.1
  * 
  * @param string $arg
  */
 public function execute($subPage)
 {
     if (!parent::execute($subPage)) {
         return;
     }
     if ($this->getRequest()->wasPosted() && $this->getUser()->matchEditToken($this->getRequest()->getVal('wpEditToken'))) {
         $this->handleSubmission();
     } else {
         if (is_null($subPage) || trim($subPage) === '') {
             $this->getOutput()->redirect(SpecialPage::getTitleFor('Surveys')->getLocalURL());
         } else {
             $subPage = trim($subPage);
             $survey = Survey::newFromName($subPage, null, true);
             if ($survey === false) {
                 $survey = new Survey(array('name' => $subPage), true);
             } else {
                 $this->displayNavigation(array(wfMsgExt('survey-navigation-take', 'parseinline', $subPage), wfMsgExt('survey-navigation-stats', 'parseinline', $subPage), wfMsgExt('survey-navigation-list', 'parseinline')));
             }
             $this->showSurvey($survey);
             $this->addModules('ext.survey.special.survey');
         }
     }
 }