/**
  * Main method.
  *
  * @since 0.1
  *
  * @param string $subPage
  */
 public function execute($subPage)
 {
     parent::execute($subPage);
     $out = $this->getOutput();
     if (trim($subPage) === '') {
         $this->getOutput()->redirect(SpecialPage::getTitleFor('Courses')->getLocalURL());
     } else {
         $out->setPageTitle(wfMsgExt('ep-course-title', 'parsemag', $this->subPage));
         $course = EPCourse::selectRow(null, array('name' => $this->subPage));
         if ($course === false) {
             $this->displayNavigation();
             if ($this->getUser()->isAllowed('ep-course')) {
                 $out->addWikiMsg('ep-course-create', $this->subPage);
                 EPCourse::displayAddNewRegion($this->getContext(), array('name' => $this->subPage));
             } else {
                 $out->addWikiMsg('ep-course-none', $this->subPage);
             }
         } else {
             $links = array();
             if ($this->getUser()->isAllowed('ep-course')) {
                 $links[wfMsg('ep-course-nav-edit')] = SpecialPage::getTitleFor('EditCourse', $this->subPage);
             }
             $this->displayNavigation($links);
             $this->displaySummary($course);
             $out->addHTML(Html::element('h2', array(), wfMsg('ep-course-description')));
             $out->addHTML($this->getOutput()->parse($course->getField('description')));
             $out->addHTML(Html::element('h2', array(), wfMsg('ep-course-terms')));
             EPTerm::displayPager($this->getContext(), array('course_id' => $course->getId()));
             if ($this->getUser()->isAllowed('ep-course')) {
                 $out->addHTML(Html::element('h2', array(), wfMsg('ep-course-add-term')));
                 EPTerm::displayAddNewControl($this->getContext(), array('course' => $course->getId()));
             }
         }
     }
 }
 /**
  * Main method.
  *
  * @since 0.1
  *
  * @param string|null $arg
  */
 public function execute($subPage)
 {
     parent::execute($subPage);
     if ($this->subPage === '') {
         $this->displayNavigation();
         EPCourse::displayAddNewRegion($this->getContext());
         EPCourse::displayPager($this->getContext());
     } else {
         $this->getOutput()->redirect(SpecialPage::getTitleFor('Course', $this->subPage)->getLocalURL());
     }
 }
Example #3
0
 /**
  * Main method.
  *
  * @since 0.1
  *
  * @param string|null $subPage
  */
 public function execute($subPage)
 {
     parent::execute($subPage);
     if ($this->subPage === '') {
         $this->displayNavigation();
         EPCourse::displayAddNewRegion($this->getContext());
         EPCourse::displayPager($this->getContext());
     } else {
         $this->getOutput()->redirect(Title::newFromText($this->subPage, EP_NS_COURSE)->getLocalURL());
     }
 }
Example #4
0
 /**
  * (non-PHPdoc)
  * @see EPEditAction::onView()
  */
 public function onView()
 {
     $this->getOutput()->addModules(array('ep.datepicker', 'ep.combobox'));
     $c = $this->getItemClass();
     // Yeah, this is needed in PHP 5.3 >_>
     if (!$this->isNewPost() && !$c::hasIdentifier($this->getTitle()->getText())) {
         $name = $this->getTitle()->getText();
         $bracketPos = strpos($name, '(');
         if ($bracketPos !== false) {
             if ($bracketPos > 0 && in_array($name[$bracketPos - 1], array(' ', '_'))) {
                 $bracketPos -= 1;
             }
             $name = substr($name, 0, $bracketPos);
         }
         EPCourse::displayAddNewRegion($this->getContext(), array('name' => $this->getRequest()->getText('newname', $name), 'term' => $this->getRequest()->getText('newterm', '')));
         $this->isNew = true;
         $this->getOutput()->setSubtitle($this->getDescription());
         return '';
     } else {
         return parent::onView();
     }
 }