Example #1
0
 /**
  * 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();
     }
 }
Example #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');
     }
 }
Example #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');
         }
     }
 }
Example #4
0
 /**
  * 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');
         }
     }
 }