示例#1
0
        $decline_message = Request::get('decline_message');
        if ($semObj->seminar_number) {
            $message = sprintf(_("ABGELEHNTE RAUMANFRAGE: Ihre Raumanfrage zur Veranstaltung %s (%s) wurde abgelehnt.") . "\n\n" .
                _("Nachricht des Raumadministrators:") . "\n" . $decline_message, $semObj->getName(), $semObj->seminar_number);
        } else {
            $message = sprintf(_("ABGELEHNTE RAUMANFRAGE: Ihre Raumanfrage zur Veranstaltung %s wurde abgelehnt.") . "\n\n" .
                _("Nachricht des Raumadministrators:") . "\n" . $decline_message, $semObj->getName());
        }

        if ($reqObj->getTerminId()) {
            $termin = new SingleDate($reqObj->getTerminId());
            $message .= "\n\n". _("Betroffener Termin:") . "\n" . $termin->toString();
        }

        if ($reqObj->getMetadateId()) {
            $cycle = SeminarCycleDate::find($reqObj->getMetadateId());
            $message .= "\n\n". _("Betroffene Zeit:") . "\n" . $cycle->toString('full');
        }
        // fetch the names of the lecutrers to display them in the message
        foreach($semObj->getMembers('dozent') as $dozenten){
            $title[] = $dozenten['Nachname'];
        }
        if($semObj->seminar_number) $title[] = $semObj->seminar_number;
        $title[] = mila($semObj->getName(),30);

        $reqObj->setReplyComment($decline_message);
        $reqObj->store();
        foreach ($users as $userid) {
            setTempLanguage($userid);
            $messaging->insert_message($message, get_username($userid), $user->id, FALSE, FALSE, FALSE, FALSE,
                _("Raumanfrage abgelehnt:") .' '. implode(', ', $title), TRUE, 'high');
示例#2
0
 /**
  * Deletes a cycle
  *
  * @param String $cycle_id Id of the cycle to be deleted
  */
 public function deleteCycle_action($cycle_id)
 {
     CSRFProtection::verifyRequest();
     $cycle = SeminarCycleDate::find($cycle_id);
     if ($cycle !== null && $cycle->delete()) {
         $this->course->createMessage(sprintf(_('Der regelmäßige Eintrag "%s" wurde gelöscht.'), '<b>' . $cycle->toString() . '</b>'));
     }
     $this->displayMessages();
     $this->redirect('course/timesrooms/index');
 }
示例#3
0
 public function getTypeExplained()
 {
     $ret = '';
     if ($this->termin_id) {
         $ret = _("Einzeltermin der Veranstaltung");
         if (get_object_type($this->termin_id, array('date'))) {
             $termin = new SingleDate($this->termin_id);
             $ret .= chr(10) . '(' . $termin->toString() . ')';
         }
     } elseif ($this->metadate_id) {
         $ret = _("alle Termine einer regelmäßigen Zeit");
         if ($cycle = SeminarCycleDate::find($this->metadate_id)) {
             $ret .= chr(10) . ' (' . $cycle->toString('full') . ')';
         }
     } elseif ($this->seminar_id) {
         $ret = _("alle regelmäßigen und unregelmäßigen Termine der Veranstaltung");
         if (get_object_type($this->seminar_id, array('sem'))) {
             $course = new Seminar($this->seminar_id);
             $ret .= chr(10) . ' (' . $course->getDatesExport(array('short' => true, 'shrink' => true)) . ')';
         }
     } else {
         $ret = _("Kein Typ zugewiesen");
     }
     return $ret;
 }
示例#4
0
 /**
  * Stores this cycle.
  * @return int number of changed rows
  */
 public function store()
 {
     $cycle = parent::findByMetadate_id($this->metadate_id);
     //create new entry in seminare_cycle_date
     if (!$cycle) {
         $result = parent::store();
         if ($result) {
             $new_dates = $this->createTerminSlots();
             foreach ($new_dates as $semester_dates) {
                 foreach ($semester_dates['dates'] as $date) {
                     $result += $date->store();
                 }
             }
             StudipLog::log('SEM_ADD_CYCLE', $this->seminar_id, NULL, $this->toString());
             return $result;
         }
         return 0;
     }
     //change existing cycledate, changes also corresponding single dates
     $old_cycle = SeminarCycleDate::find($this->metadate_id);
     if (!parent::store()) {
         return false;
     }
     if (mktime($this->start_time) >= mktime($old_cycle->start_time) && mktime($this->end_time) <= mktime($old_cycle->end_time) && $this->weekday == $old_cycle->weekday && $this->end_offset == $old_cycle->end_offset) {
         $update_count = 0;
         foreach ($this->getAllDates() as $date) {
             $tos = $date->date;
             $toe = $date->end_time;
             //Update future dates
             if ($toe > time()) {
                 $date->date = mktime(date('G', strtotime($this->start_time)), date('i', strtotime($this->start_time)), 0, date('m', $tos), date('d', $tos), date('Y', $tos));
                 $date->end_time = mktime(date('G', strtotime($this->end_time)), date('i', strtotime($this->end_time)), 0, date('m', $toe), date('d', $toe), date('Y', $toe));
             }
             if ($date->isDirty()) {
                 $date->store();
                 $update_count++;
             }
         }
         StudipLog::log('SEM_CHANGE_CYCLE', $this->seminar_id, NULL, $old_cycle->toString() . ' -> ' . $this->toString());
         return $update_count;
     }
     //collect topics for existing future dates (CourseDate)
     $topics = array();
     foreach ($this->getAllDates() as $date) {
         if ($date->end_time >= time()) {
             $topics_tmp = CourseTopic::findByTermin_id($date->termin_id);
             if (!empty($topics_tmp)) {
                 $topics[] = $topics_tmp;
             }
             //uncomment below
             $date->delete();
         }
     }
     $new_dates = $this->createTerminSlots(time());
     $topic_count = 0;
     $update_count = 0;
     foreach ($new_dates as $semester_dates) {
         foreach ($semester_dates['dates'] as $date) {
             if ($date instanceof CourseDate) {
                 if (isset($topics[$topic_count])) {
                     $date->topics = $topics[$topic_count];
                     $topic_count++;
                 }
             }
             $date->store();
             $update_count++;
         }
     }
     StudipLog::log('SEM_CHANGE_CYCLE', $this->seminar_id, NULL, $old_cycle->toString() . ' -> ' . $this->toString());
     return $update_count;
 }