/** * 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('Terms')->getLocalURL()); } else { $out->setPageTitle(wfMsgExt('ep-term-title', 'parsemag', $this->subPage)); $term = EPTerm::selectRow(null, array('id' => $this->subPage)); if ($term === false) { $this->displayNavigation(); if ($this->getUser()->isAllowed('ep-term')) { $out->addWikiMsg('ep-term-create', $this->subPage); EPTerm::displayAddNewRegion($this->getContext(), array('id' => $this->subPage)); } else { $out->addWikiMsg('ep-term-none', $this->subPage); } } else { $links = array(); if ($this->getUser()->isAllowed('ep-term')) { $links[wfMsg('ep-term-nav-edit')] = SpecialPage::getTitleFor('EditTerm', $this->subPage); } $this->displayNavigation($links); $this->displaySummary($term); $out->addHTML(Html::element('h2', array(), wfMsg('ep-term-description'))); $out->addHTML($this->getOutput()->parse($term->getField('description'))); $studentIds = array_map(function (EPStudent $student) { return $student->getId(); }, $term->getStudents('id')); if (count($studentIds) > 0) { $out->addHTML(Html::element('h2', array(), wfMsg('ep-term-students'))); EPStudent::displayPager($this->getContext(), array('id' => $studentIds)); } else { // TODO } } } }