/**
  * create recurring sessions
  *
  * @access protected
  * @param
  * @return
  */
 protected function createRecurringSessions()
 {
     global $tree;
     if (!$this->rec->getFrequenceType()) {
         return true;
     }
     include_once './Services/Calendar/classes/class.ilCalendarRecurrenceCalculator.php';
     $calc = new ilCalendarRecurrenceCalculator($this->object->getFirstAppointment(), $this->rec);
     $period_start = clone $this->object->getFirstAppointment()->getStart();
     $period_end = clone $this->object->getFirstAppointment()->getStart();
     $period_end->increment(IL_CAL_YEAR, 5);
     $date_list = $calc->calculateDateList($period_start, $period_end);
     $period_diff = $this->object->getFirstAppointment()->getEnd()->get(IL_CAL_UNIX) - $this->object->getFirstAppointment()->getStart()->get(IL_CAL_UNIX);
     $parent_id = $tree->getParentId($this->object->getRefId());
     include_once './Modules/Session/classes/class.ilEventItems.php';
     $evi = new ilEventItems($this->object->getId());
     $eitems = $evi->getItems();
     $counter = 0;
     foreach ($date_list->get() as $date) {
         if (!$counter++) {
             continue;
         }
         $new_obj = $this->object->cloneObject($parent_id);
         $new_obj->read();
         $new_obj->getFirstAppointment()->setStartingTime($date->get(IL_CAL_UNIX));
         $new_obj->getFirstAppointment()->setEndingTime($date->get(IL_CAL_UNIX) + $period_diff);
         $new_obj->getFirstAppointment()->update();
         $new_obj->update();
         $new_evi = new ilEventItems($new_obj->getId());
         $new_evi->setItems($eitems);
         $new_evi->update();
     }
 }
Exemplo n.º 2
0
 /**
  * Get session material / event items
  * 
  * @param int $a_event_id (object id)
  * @return array 
  */
 public static function getItemsByEvent($a_event_id)
 {
     include_once 'Modules/Session/classes/class.ilEventItems.php';
     $event_items = new ilEventItems($a_event_id);
     return self::processListItems($event_items->getItems());
 }