/**
  * 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('Institutions')->getLocalURL());
     } else {
         $out->setPageTitle(wfMsgExt('ep-institution-title', 'parsemag', $this->subPage));
         $org = EPOrg::selectRow(null, array('name' => $this->subPage));
         if ($org === false) {
             $this->displayNavigation();
             if ($this->getUser()->isAllowed('ep-org')) {
                 $out->addWikiMsg('ep-institution-create', $this->subPage);
                 EPOrg::displayAddNewControl($this->getContext(), array('name' => $this->subPage));
             } else {
                 $out->addWikiMsg('ep-institution-none', $this->subPage);
             }
         } else {
             $links = array();
             if ($this->getUser()->isAllowed('ep-org')) {
                 $links[wfMsg('ep-institution-nav-edit')] = SpecialPage::getTitleFor('EditInstitution', $this->subPage);
             }
             $this->displayNavigation($links);
             $this->displaySummary($org);
             $out->addHTML(Html::element('h2', array(), wfMsg('ep-institution-courses')));
             EPCourse::displayPager($this->getContext(), array('org_id' => $org->getId()));
             if ($this->getUser()->isAllowed('ep-course')) {
                 $out->addHTML(Html::element('h2', array(), wfMsg('ep-institution-add-course')));
                 EPCourse::displayAddNewControl($this->getContext(), array('org' => $org->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
 protected function displayPage(EPDBObject $org)
 {
     parent::displayPage($org);
     $out = $this->getOutput();
     $out->addElement('h2', array(), wfMsg('ep-institution-courses'));
     EPCourse::displayPager($this->getContext(), array('org_id' => $org->getId()));
     if ($this->getUser()->isAllowed('ep-course')) {
         $out->addElement('h2', array(), wfMsg('ep-institution-add-course'));
         EPCourse::displayAddNewControl($this->getContext(), array('org' => $org->getId()));
     }
 }
Example #4
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 #5
0
 /**
  * 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->addElement('h2', array(), wfMsg('ep-student-courses'));
             $courseIds = array_map(function (EPCourse $course) {
                 return $course->getId();
             }, $student->getCourses('id'));
             EPCourse::displayPager($this->getContext(), array('id' => $courseIds));
         }
     }
 }
Example #6
0
 protected function displayMentorship($class)
 {
     $ambassador = $class::newFromUser($this->getUser());
     $courseIds = array_map(function (EPCourse $course) {
         return $course->getId();
     }, $ambassador->getCourses('id'));
     if (count($courseIds) > 0) {
         $this->getOutput()->addElement('h2', array(), wfMsg('ep-mycourses-ambcourses-' . strtolower($class)));
         EPCourse::displayPager($this->getContext(), array('id' => $courseIds), true, $class);
     } else {
         $this->getOutput()->addWikiMsg('ep-mycourses-noambcourses-' . strtolower($class));
     }
 }