/**
  * 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();
         EPTerm::displayAddNewRegion($this->getContext());
         EPTerm::displayPager($this->getContext());
     } else {
         $this->getOutput()->redirect(SpecialPage::getTitleFor('Term', $this->subPage)->getLocalURL());
     }
 }
 /**
  * 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('Students')->getLocalURL());
     } else {
         $this->displayNavigation();
         $student = EPStudent::selectRow(null, array('id' => $this->subPage));
         if ($student === false) {
             $out->addWikiMsg('ep-student-none', $this->subPage);
         } else {
             $out->setPageTitle(wfMsgExt('ep-student-title', 'parsemag', $student->getName()));
             $this->displaySummary($student);
             $out->addHTML(Html::element('h2', array(), wfMsg('ep-student-terms')));
             $termIds = array_map(function (EPTerm $term) {
                 return $term->getId();
             }, $student->getTerms('id'));
             EPTerm::displayPager($this->getContext(), array('id' => $termIds));
         }
     }
 }