/** * create recurring sessions * * @access protected * @param bool $a_activate_lp * @return */ protected function createRecurringSessions($a_activate_lp = true) { 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(); // #14547 - active is default if (!$a_activate_lp) { include_once "Services/Tracking/classes/class.ilLPObjSettings.php"; $lp_obj_settings = new ilLPObjSettings($new_obj->getId()); $lp_obj_settings->setMode(ilLPObjSettings::LP_MODE_DEACTIVATED); $lp_obj_settings->update(false); } $new_evi = new ilEventItems($new_obj->getId()); $new_evi->setItems($eitems); $new_evi->update(); } }