예제 #1
0
 /**
  * Returns a schedule entry for a course
  *
  * @param string  $seminar_id  the ID of the course
  * @param string  $user_id     the ID of the user
  * @param string  $cycle_id    optional; if given, specifies the ID of the entry
  * @return array  an array containing the properties of the entry
  */
 static function getSeminarEntry($seminar_id, $user_id, $cycle_id = false)
 {
     $ret = array();
     $sem = new Seminar($seminar_id);
     foreach ($sem->getCycles() as $cycle) {
         if (!$cycle_id || $cycle->getMetaDateID() == $cycle_id) {
             $entry = array();
             $entry['id'] = $seminar_id;
             $entry['cycle_id'] = $cycle->getMetaDateId();
             $entry['start_formatted'] = sprintf("%02d", $cycle->getStartStunde()) . ':' . sprintf("%02d", $cycle->getStartMinute());
             $entry['end_formatted'] = sprintf("%02d", $cycle->getEndStunde()) . ':' . sprintf("%02d", $cycle->getEndMinute());
             $entry['start'] = (int) $cycle->getStartStunde() * 100 + $cycle->getStartMinute();
             $entry['end'] = (int) $cycle->getEndStunde() * 100 + $cycle->getEndMinute();
             $entry['day'] = $cycle->getDay();
             $entry['content'] = $sem->getNumber() . ' ' . $sem->getName();
             $entry['url'] = URLHelper::getLink('dispatch.php/calendar/instschedule/entry/' . $seminar_id . '/' . $cycle->getMetaDateId());
             $entry['onClick'] = "function(id) { STUDIP.Instschedule.showSeminarDetails('{$seminar_id}', '" . $cycle->getMetaDateId() . "'); }";
             $entry['title'] = '';
             $ret[] = $entry;
         }
     }
     return $ret;
 }
예제 #2
0
파일: schedule.php 프로젝트: ratbird/hope
 /**
  * Returns the ID of the cycle of a course specified by start and end.
  *
  * @param  Seminar $seminar  an instance of a Seminar
  * @param  string  $start  the start of the cycle
  * @param  string  $end  the end of the cycle
  * @return string  $day  numeric day
  */
 static function getSeminarCycleId(Seminar $seminar, $start, $end, $day)
 {
     $ret = array();
     $day = ($day + 1) % 7;
     foreach ($seminar->getCycles() as $cycle) {
         if (leadingZero($cycle->getStartStunde()) . leadingZero($cycle->getStartMinute()) == $start && leadingZero($cycle->getEndStunde()) . leadingZero($cycle->getEndMinute()) == $end && $cycle->getDay() == $day) {
             $ret[] = $cycle;
         }
     }
     return $ret;
 }