Ejemplo n.º 1
0
 /**
  * A textual description of the current rule.
  *
  * @param bool short Show only short info without overview of assigned
  *                   courses and institutes.
  * @return String
  */
 public function toString($short = false)
 {
     $tpl = $GLOBALS['template_factory']->open('admission/courseset/info');
     $tpl->set_attribute('courseset', $this);
     $institutes = array();
     if (!$short) {
         $institutes = Institute::findAndMapMany(function ($i) {
             return $i->name;
         }, array_keys($this->institutes), 'ORDER BY Name');
         $tpl->set_attribute('institutes', $institutes);
     }
     if (!$short || $this->hasAdmissionRule('LimitedAdmission')) {
         $courses = Course::findAndMapMany(function ($c) {
             return array('id' => $c->id, 'name' => $c->getFullname('number-name-semester'));
         }, array_keys($this->courses), 'ORDER BY start_time,VeranstaltungsNummer,Name');
         $tpl->set_attribute('is_limited', $this->hasAdmissionRule('LimitedAdmission'));
         $tpl->set_attribute('courses', $courses);
     }
     $tpl->set_attribute('short', $short);
     return $tpl->render();
 }