Exemple #1
0
 /**
  * Show links to signup.
  *
  * @since 0.1
  */
 protected function showSignupLink()
 {
     $out = $this->getOutput();
     $out->addWikiMsg('ep-enroll-login-first');
     $out->addHTML('<ul><li>');
     $subPage = $this->course->getField('name');
     if ($this->token !== false) {
         $subPage .= '/' . $this->token;
     }
     $out->addHTML(Linker::linkKnown(SpecialPage::getTitleFor('Userlogin'), wfMsgHtml('ep-enroll-login-and-enroll'), array(), array('returnto' => $this->getTitle($subPage)->getFullText())));
     $out->addHTML('</li><li>');
     $out->addHTML(Linker::linkKnown(SpecialPage::getTitleFor('Userlogin'), wfMsgHtml('ep-enroll-signup-and-enroll'), array(), array('returnto' => $this->getTitle($subPage)->getFullText(), 'type' => 'signup')));
     $out->addHTML('</li></ul>');
 }
 /**
  * Returns role a controls for the course if the
  * current user has the right permissions.
  *
  * @since 0.1
  *
  * @param EPCourse $course
  * @param string $roleName
  *
  * @return string
  */
 protected function getRoleControls(EPCourse $course, $roleName)
 {
     $user = $this->getUser();
     $links = array();
     $field = $roleName === 'instructor' ? 'instructors' : $roleName . '_ambs';
     if (($user->isAllowed('ep-' . $roleName) || $user->isAllowed('ep-be' . $roleName)) && !in_array($user->getId(), $course->getField($field))) {
         $links[] = Html::element('a', array('href' => '#', 'class' => 'ep-add-role', 'data-role' => $roleName, 'data-courseid' => $course->getId(), 'data-coursename' => $course->getField('name'), 'data-mode' => 'self'), wfMsg('ep-course-become-' . $roleName));
     }
     if ($user->isAllowed('ep-' . $roleName)) {
         $links[] = Html::element('a', array('href' => '#', 'class' => 'ep-add-role', 'data-role' => $roleName, 'data-courseid' => $course->getId(), 'data-coursename' => $course->getField('name')), wfMsg('ep-course-add-' . $roleName));
     }
     if (count($links) > 0) {
         $this->getOutput()->addModules('ep.enlist');
         return '<br />' . $this->getLanguage()->pipeList($links);
     } else {
         return '';
     }
 }
 /**
  * Display the summary for a course.
  *
  * @since 0.1
  *
  * @param EPCourse $course
  * @param array $terms
  */
 protected function displayCourseSummary(EPCourse $course, array $terms)
 {
     $info = array();
     $info['name'] = $course->getField('name');
     $info['org'] = EPOrg::selectFieldsRow('name', array('id' => $course->getField('org_id')));
     foreach ($info as &$inf) {
         $inf = htmlspecialchars($inf);
     }
     $this->displaySummary($course, false, $info);
 }
 protected function displayCourse(EPCourse $course)
 {
     $out = $this->getOutput();
     $out->addElement('h2', array(), wfMsg('ep-mycourses-course-enrollment'));
     $out->addHTML('You are currently enrolled in ' . $course->getField('name'));
     // TODO
 }
 protected function getInstructorControls(EPCourse $course)
 {
     $user = $this->getUser();
     $links = array();
     if (($user->isAllowed('ep-instructor') || $user->isAllowed('ep-beinstructor')) && !in_array($user->getId(), $course->getField('instructors'))) {
         $links[] = Html::element('a', array('href' => '#', 'class' => 'ep-add-instructor', 'data-courseid' => $course->getId(), 'data-coursename' => $course->getField('name'), 'data-mode' => 'self'), wfMsg('ep-course-become-instructor'));
     }
     if ($user->isAllowed('ep-instructor')) {
         $links[] = Html::element('a', array('href' => '#', 'class' => 'ep-add-instructor', 'data-courseid' => $course->getId(), 'data-coursename' => $course->getField('name')), wfMsg('ep-course-add-instructor'));
     }
     if (count($links) > 0) {
         $this->getOutput()->addModules('ep.instructor');
         return '<br />' . $this->getLanguage()->pipeList($links);
     } else {
         return '';
     }
 }