Exemplo n.º 1
0
 /**
  * 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;
 }
Exemplo n.º 2
0
 /**
  * (non-PHPdoc)
  * @see EPPager::getFormattedValue()
  */
 public function getFormattedValue($name, $value)
 {
     switch ($name) {
         case 'name':
             $value = EPOrg::getLinkFor($value);
             break;
         case 'country':
             $countries = array_flip(EPUtils::getCountryOptions($this->getLanguage()->getCode()));
             $value = htmlspecialchars($countries[$value]);
             break;
         case 'courses':
         case 'students':
             $rawValue = $value;
             $value = htmlspecialchars($this->getLanguage()->formatNum($value));
             if ($rawValue > 0 && $name === 'courses') {
                 $value = Linker::linkKnown(SpecialPage::getTitleFor($this->getLanguage()->ucfirst($name)), $value, array(), array('org_id' => $this->currentObject->getId()));
             }
             break;
         case 'active':
             $value = wfMsgHtml('eporgpager-' . ($value == '1' ? 'yes' : 'no'));
             break;
     }
     return $value;
 }