/** * ask delete * * @access protected * @return */ protected function askDelete() { global $tpl; include_once './Services/Utilities/classes/class.ilConfirmationGUI.php'; $this->ctrl->saveParameter($this, array('seed', 'app_id', 'dt', 'idate')); $confirm = new ilConfirmationGUI(); $confirm->setFormAction($this->ctrl->getFormAction($this)); $confirm->setHeaderText($this->lng->txt('cal_delete_app_sure')); $confirm->setCancel($this->lng->txt('cancel'), 'cancel'); $confirm->addItem('appointments[]', $this->app->getEntryId(), $this->app->getTitle()); include_once './Services/Calendar/classes/class.ilCalendarRecurrences.php'; if (sizeof(ilCalendarRecurrences::_getRecurrences($_GET['app_id'])) && !$this->app->isMilestone()) { $confirm->addButton($this->lng->txt('cal_delete_single'), 'deleteexclude'); $confirm->setConfirm($this->lng->txt('cal_delete_recurrences'), 'delete'); } else { $confirm->setConfirm($this->lng->txt('delete'), 'delete'); } $tpl->setContent($confirm->getHTML()); }
protected function createRecurrences($app) { global $ilUser; include_once './Services/Calendar/classes/class.ilCalendarRecurrences.php'; foreach (ilCalendarRecurrences::_getRecurrences($app->getEntryId()) as $rec) { foreach (ilCalendarRecurrenceExclusions::getExclusionDates($app->getEntryId()) as $excl) { $this->writer->addLine($excl->toICal()); } $this->writer->addLine($rec->toICal($ilUser->getId())); } }
/** * calculate * * @access protected */ public function calculate() { global $ilDB; $events = $this->getEvents(); // we need category type for booking handling $ids = array(); foreach ($events as $event) { $ids[] = $event->getEntryId(); } include_once 'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php'; $cat_map = ilCalendarCategoryAssignments::_getAppointmentCalendars($ids); include_once 'Services/Calendar/classes/class.ilCalendarCategory.php'; $cat_types = array(); foreach (array_unique($cat_map) as $cat_id) { $cat = new ilCalendarCategory($cat_id); $cat_types[$cat_id] = $cat->getType(); } $counter = 0; foreach ($events as $event) { // Calculdate recurring events include_once 'Services/Calendar/classes/class.ilCalendarRecurrences.php'; if ($recs = ilCalendarRecurrences::_getRecurrences($event->getEntryId())) { $duration = $event->getEnd()->get(IL_CAL_UNIX) - $event->getStart()->get(IL_CAL_UNIX); foreach ($recs as $rec) { $calc = new ilCalendarRecurrenceCalculator($event, $rec); foreach ($calc->calculateDateList($this->start, $this->end)->get() as $rec_date) { $this->schedule[$counter]['event'] = $event; $this->schedule[$counter]['dstart'] = $rec_date->get(IL_CAL_UNIX); $this->schedule[$counter]['dend'] = $this->schedule[$counter]['dstart'] + $duration; $this->schedule[$counter]['fullday'] = $event->isFullday(); $this->schedule[$counter]['category_id'] = $cat_map[$event->getEntryId()]; $this->schedule[$counter]['category_type'] = $cat_types[$cat_map[$event->getEntryId()]]; switch ($this->type) { case self::TYPE_DAY: case self::TYPE_WEEK: // store date info (used for calculation of overlapping events) $tmp_date = new ilDateTime($this->schedule[$counter]['dstart'], IL_CAL_UNIX, $this->timezone); $this->schedule[$counter]['start_info'] = $tmp_date->get(IL_CAL_FKT_GETDATE, '', $this->timezone); $tmp_date = new ilDateTime($this->schedule[$counter]['dend'], IL_CAL_UNIX, $this->timezone); $this->schedule[$counter]['end_info'] = $tmp_date->get(IL_CAL_FKT_GETDATE, '', $this->timezone); break; default: break; } $counter++; if ($this->areEventsLimited() && $counter >= $this->getEventsLimit()) { break; } } } } else { $this->schedule[$counter]['event'] = $event; $this->schedule[$counter]['dstart'] = $event->getStart()->get(IL_CAL_UNIX); $this->schedule[$counter]['dend'] = $event->getEnd()->get(IL_CAL_UNIX); $this->schedule[$counter]['fullday'] = $event->isFullday(); $this->schedule[$counter]['category_id'] = $cat_map[$event->getEntryId()]; $this->schedule[$counter]['category_type'] = $cat_types[$cat_map[$event->getEntryId()]]; if (!$event->isFullday()) { switch ($this->type) { case self::TYPE_DAY: case self::TYPE_WEEK: // store date info (used for calculation of overlapping events) $tmp_date = new ilDateTime($this->schedule[$counter]['dstart'], IL_CAL_UNIX, $this->timezone); $this->schedule[$counter]['start_info'] = $tmp_date->get(IL_CAL_FKT_GETDATE, '', $this->timezone); $tmp_date = new ilDateTime($this->schedule[$counter]['dend'], IL_CAL_UNIX, $this->timezone); $this->schedule[$counter]['end_info'] = $tmp_date->get(IL_CAL_FKT_GETDATE, '', $this->timezone); break; default: break; } } $counter++; if ($this->areEventsLimited() && $counter >= $this->getEventsLimit()) { break; } } } }