Esempio n. 1
0
 /**
  * Saves a cycle
  */
 public function saveCycle_action()
 {
     CSRFProtection::verifyRequest();
     $start = strtotime(Request::get('start_time'));
     $end = strtotime(Request::get('end_time'));
     if (date('H', $start) > date('H', $end)) {
         $this->storeRequest();
         PageLayout::postMessage(MessageBox::error(_('Die Zeitangaben sind nicht korrekt. Bitte überprüfen Sie diese!')));
         $this->redirect('course/timesrooms/createCycle');
         return;
     }
     $cycle = new SeminarCycleDate();
     $cycle->seminar_id = $this->course->id;
     $cycle->weekday = Request::int('day');
     $cycle->description = Request::get('description');
     $cycle->sws = round(Request::float('teacher_sws'), 1);
     $cycle->cycle = Request::int('cycle');
     $cycle->week_offset = Request::int('startWeek');
     $cycle->end_offset = Request::int('endWeek') ?: null;
     $cycle->start_time = date('H:i:00', $start);
     $cycle->end_time = date('H:i:00', $end);
     if ($cycle->store()) {
         $cycle_info = $cycle->toString();
         NotificationCenter::postNotification('CourseDidChangeSchedule', $this);
         $this->course->createMessage(sprintf(_('Die regelmäßige Veranstaltungszeit %s wurde hinzugefügt!'), $cycle_info));
         $this->displayMessages();
         if (Request::get('fromDialog') == 'true') {
             $this->redirect('course/timesrooms/index');
         } else {
             $this->relocate('course/timesrooms/index');
         }
     } else {
         $this->storeRequest();
         $this->course->createError(_('Die regelmäßige Veranstaltungszeit konnte nicht hinzugefügt werden! Bitte überprüfen Sie Ihre Eingabe.'));
         $this->displayMessages();
         $this->redirect('course/timesrooms/createCycle');
     }
 }
Esempio n. 2
0
 /**
  * stores only the cycledate data
  *
  * @return boolean
  */
 function storeCycleDate()
 {
     if (!$this->description) $this->description = '';
     return $this->cycle_date->store();
 }