/**
  * Gets the summary data.
  *
  * @since 0.1
  *
  * @param EPCourse $course
  *
  * @return array
  */
 protected function getSummaryData(EPDBObject $course)
 {
     $stats = array();
     $orgName = EPOrg::selectFieldsRow('name', array('id' => $course->getField('org_id')));
     $stats['org'] = EPOrg::getLinkFor($orgName);
     $lang = $this->getLanguage();
     $stats['term'] = htmlspecialchars($course->getField('term'));
     $stats['start'] = htmlspecialchars($lang->timeanddate($course->getField('start'), true));
     $stats['end'] = htmlspecialchars($lang->timeanddate($course->getField('end'), true));
     $stats['students'] = htmlspecialchars($lang->formatNum($course->getField('students')));
     $stats['status'] = htmlspecialchars(EPCourse::getStatusMessage($course->getStatus()));
     if ($this->getUser()->isAllowed('ep-token')) {
         $stats['token'] = Linker::linkKnown(SpecialPage::getTitleFor('Enroll', $course->getId() . '/' . $course->getField('token')), htmlspecialchars($course->getField('token')));
     }
     $stats['instructors'] = $this->getRoleList($course, 'instructor') . $this->getRoleControls($course, 'instructor');
     $stats['online'] = $this->getRoleList($course, 'online') . $this->getRoleControls($course, 'online');
     $stats['campus'] = $this->getRoleList($course, 'campus') . $this->getRoleControls($course, 'campus');
     return $stats;
 }
Exemple #2
0
 /**
  * (non-PHPdoc)
  * @see EPPager::getFormattedValue()
  */
 public function getFormattedValue($name, $value)
 {
     switch ($name) {
         case 'name':
             $value = EPCourse::getLinkFor($value);
             break;
         case 'org_id':
             $value = EPOrg::selectRow('name', array('id' => $value))->getLink();
             break;
         case 'term':
             $value = htmlspecialchars($value);
             break;
         case 'lang':
             $langs = LanguageNames::getNames($this->getLanguage()->getCode());
             if (array_key_exists($value, $langs)) {
                 $value = htmlspecialchars($langs[$value]);
             } else {
                 $value = '<i>' . htmlspecialchars($this->getMsg('invalid-lang')) . '</i>';
             }
             break;
         case 'start':
         case 'end':
             $value = htmlspecialchars($this->getLanguage()->date($value));
             break;
         case '_status':
             $value = htmlspecialchars(EPCourse::getStatusMessage($this->currentObject->getStatus()));
         case 'students':
             $value = htmlspecialchars($this->getLanguage()->formatNum($value));
             break;
     }
     return $value;
 }