ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilCalendarAppointmentGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use Psr\Http\Message\RequestInterface;
22use Psr\Http\Message\ServerRequestInterface;
23use ILIAS\HTTP\Services as HTTPServices;
24use ILIAS\Refinery\Factory as RefineryFactory;
25use ILIAS\UI\Factory as UIFactory;
26use ILIAS\UI\Renderer as UIRenderer;
28use ILIAS\Calendar\Recurrence\Input\FactoryImpl as RecurrenceInputFactory;
29
36{
37 private Form $form;
39 protected bool $requested_rexl;
40
41 protected ilDate $seed;
43 protected bool $default_fulltime = true;
46 protected string $timezone;
47
49 protected ilLanguage $lng;
51 protected ilObjUser $user;
52 protected ilTabsGUI $tabs;
54 protected ilHelpGUI $help;
57 protected HTTPServices $http;
58 protected RefineryFactory $refinery;
59 protected RequestInterface $request;
60 protected UIFactory $ui_factory;
61 protected UIRenderer $ui_renderer;
62
66 public function __construct(ilDate $seed, ilDate $initialDate, int $a_appointment_id = 0)
67 {
68 global $DIC;
69
70 $this->lng = $DIC->language();
71 $this->lng->loadLanguageModule('dateplaner');
72 $this->ctrl = $DIC->ctrl();
73 $this->tpl = $DIC->ui()->mainTemplate();
74 $this->logger = $DIC->logger()->cal();
75 $this->user = $DIC->user();
76 $this->settings = $DIC->settings();
77 $this->tabs = $DIC->tabs();
78 $this->help = $DIC->help();
79 $this->error = $DIC['ilErr'];
80 $this->ui_factory = $DIC->ui()->factory();
81 $this->ui_renderer = $DIC->ui()->renderer();
82 $this->http = $DIC->http();
83 $this->refinery = $DIC->refinery();
84 $this->request = $DIC->http()->request();
85
86 $this->initTimeZone();
87 $this->initSeed($seed);
88 $this->initInitialDate($initialDate);
89 $this->initAppointment($a_appointment_id);
90 $this->requested_rexl = (bool) $this->getRecurrenceExclusionFromQuery();
91 }
92
93 protected function getAppointmentIdFromQuery(): int
94 {
95 if ($this->http->wrapper()->query()->has('app_id')) {
96 return $this->http->wrapper()->query()->retrieve(
97 'app_id',
98 $this->refinery->kindlyTo()->int()
99 );
100 }
101 return 0;
102 }
103
105 {
106 $val = 0;
107 if ($this->http->wrapper()->post()->has('rexl')) {
108 $val = $this->http->wrapper()->post()->retrieve(
109 'rexl',
110 $this->refinery->kindlyTo()->int()
111 );
112 }
113 if ($val === 0 && $this->http->wrapper()->query()->has('rexl')) {
114 $val = $this->http->wrapper()->query()->retrieve(
115 'rexl',
116 $this->refinery->kindlyTo()->int()
117 );
118 }
119 return $val;
120 }
121
122 protected function getRecurrenceDateFromQuery(): int
123 {
124 if ($this->http->wrapper()->query()->has('dt')) {
125 return $this->http->wrapper()->query()->retrieve(
126 'dt',
127 $this->refinery->kindlyTo()->int()
128 );
129 }
130 return 0;
131 }
132
133 public function executeCommand(): void
134 {
135 // Clear tabs and set back target
136 $this->tabs->clearTargets();
137 if ($this->http->wrapper()->query()->has('app_id')) {
138 $this->ctrl->saveParameter($this, 'app_id');
139 }
140 $this->tabs->setBackTarget(
141 $this->lng->txt('cal_back_to_cal'),
142 $this->ctrl->getLinkTarget($this, 'cancel')
143 );
144
145 $next_class = $this->ctrl->getNextClass($this);
146 switch ($next_class) {
147 default:
148 $cmd = $this->ctrl->getCmd("add");
149 $this->$cmd();
150 break;
151 }
152 }
153
155 {
156 return $this->app;
157 }
158
159 protected function cancel(): void
160 {
161 $this->ctrl->returnToParent($this);
162 }
163
164 protected function initForm(string $a_mode, bool $a_edit_single_app = false): Form
165 {
166 $sections = [];
167
168 // title and description
169
170 $description_input = $this->ui_factory->input()->field()->textarea($this->lng->txt('description'))
171 ->withValue($this->app->getDescription());
172
173 $title_input = $this->ui_factory->input()->field()->text($this->lng->txt('title'))
174 ->withRequired(true)
175 ->withValue($this->app->getTitle())
176 ->withAdditionalTransformation($this->refinery->string()->hasMaxLength(128));
177
178 // time and date
179
180 $start_time = new DateTimeImmutable('@' . $this->app->getStart()->getUnixTime());
181 $end_time = new DateTimeImmutable('@' . $this->app->getEnd()->getUnixTime());
182
183 $duration_datetime_input = $this->ui_factory->input()->field()->duration(
184 $this->lng->txt('cal_duration')
185 )->withTimezone($this->user->getTimeZone())
186 ->withLabels($this->lng->txt('cal_duration_start'), $this->lng->txt('cal_duration_end'))
187 ->withUseTime(true)
188 ->withRequired(true)
189 ->withValue([
190 $start_time->setTimezone(new DateTimeZone($this->user->getTimeZone())),
191 $end_time->setTimezone(new DateTimeZone($this->user->getTimeZone()))
192 ]);
193 $datetime_group = $this->ui_factory->input()->field()->group(
194 [$duration_datetime_input],
195 $this->lng->txt('cal_date_time_title')
196 );
197
198 $duration_date_input = $this->ui_factory->input()->field()->duration(
199 $this->lng->txt('cal_duration')
200 )->withTimezone('UTC')
201 ->withLabels($this->lng->txt('cal_duration_start'), $this->lng->txt('cal_duration_end'))
202 ->withUseTime(false)
203 ->withRequired(true)
204 ->withValue([$start_time, $end_time]);
205 $date_group = $this->ui_factory->input()->field()->group(
206 [$duration_date_input],
207 $this->lng->txt('cal_fullday_title')
208 );
209
210 $event_input = $this->ui_factory->input()->field()->switchableGroup(
211 ['with_time' => $datetime_group, 'full_day' => $date_group],
212 $this->lng->txt('appointment')
213 )->withValue($this->app->isFullday() ? 'full_day' : 'with_time')
214 ->withRequired(true);
215
216 $rec_factory = new RecurrenceInputFactory(
217 $this->ui_factory,
218 $this->refinery,
219 $this->lng,
221 );
222 $recurrence_input = $rec_factory->build($this->rec)->get();
223
224 $location_input = $this->ui_factory->input()->field()->text($this->lng->txt('cal_where'))
225 ->withValue($this->app->getLocation())
226 ->withAdditionalTransformation($this->refinery->string()->hasMaxLength(128));
227
228 // calendar selection
229
230 $selected_calendar = $this->readAndPrepareCalendarSelection($a_mode);
231 $cats = ilCalendarCategories::_getInstance($this->user->getId());
232 $calendar_input = $this->ui_factory->input()->field()->select(
233 $this->lng->txt('cal_category_selection'),
234 $cats->prepareCategoriesOfUserForSelection()
235 )->withRequired(true)
236 ->withValue($selected_calendar);
237
238 // notifications
239
240 $notif_inputs = [];
241
242 if (ilCalendarSettings::_getInstance()->isUserNotificationEnabled()) {
243 $values = [];
244 foreach ($this->notification->getRecipients() as $rcp) {
245 switch ($rcp['type']) {
247 $values[] = ilObjUser::_lookupLogin($rcp['usr_id']);
248 break;
249
251 $values[] = $rcp['email'];
252 break;
253 }
254 }
255
260 $notif_inputs['notu'] = $this->ui_factory->input()->field()->tag(
261 $this->lng->txt('cal_user_notification'),
262 [],
263 $this->lng->txt('cal_user_notification_info')
264 )->withValue($values);
265 }
266
267 if (ilCalendarSettings::_getInstance()->isNotificationEnabled() && count($cats->getNotificationCalendars())) {
268 $selected_cal = new ilCalendarCategory($selected_calendar);
269 $disabled = true;
270 if ($selected_cal->getType() == ilCalendarCategory::TYPE_OBJ) {
271 if (ilObject::_lookupType($selected_cal->getObjId()) == 'crs' or ilObject::_lookupType($selected_cal->getObjId()) == 'grp') {
272 $disabled = false;
273 }
274 }
275
276 $this->tpl->addJavaScript('assets/js/toggle_notification.js');
277
278 $notif_inputs['not'] = $this->ui_factory->input()->field()->checkbox(
279 $this->lng->txt('cal_cg_notification'),
280 $this->lng->txt('cal_notification_info')
281 )->withValue($this->app->isNotificationEnabled())
282 ->withDisabled($disabled)
283 ->withDedicatedName('cal_cg_notif_checkbox');
284
285 $notification_cals = $cats->getNotificationCalendars();
286 $notification_cals = count($notification_cals) ? implode(',', $notification_cals) : '';
287 $calendar_input = $calendar_input->withAdditionalOnLoadCode(function ($id) use ($notification_cals) {
288 return 'il.CalendarAppointmentNotificationToggler.init(' .
289 '"' . $id . '", ' .
290 '[' . $notification_cals . '], ' .
291 '"cal_cg_notif_checkbox"' .
292 ')';
293 });
294 }
295
296 // put everything together
297
298 $section_title = match ($a_mode) {
299 'create' => $this->lng->txt('cal_new_app'),
300 'edit' => $this->lng->txt('cal_edit_appointment'),
301 };
302 $sections[] = $this->ui_factory->input()->field()->section(
303 ['title' => $title_input, 'description' => $description_input],
304 $section_title,
305 );
306 $sections[] = $this->ui_factory->input()->field()->section(
307 ['event' => $event_input, 'recurrence' => $recurrence_input, 'location' => $location_input],
308 $this->lng->txt('cal_date_and_time'),
309 );
310 $sections[] = $this->ui_factory->input()->field()->section(
311 ['calendar' => $calendar_input],
312 $this->lng->txt('cal_belongs_to'),
313 );
314 if (!empty($notif_inputs)) {
315 $sections[] = $this->ui_factory->input()->field()->section(
316 $notif_inputs,
317 $this->lng->txt('cal_appointment_notifications'),
318 );
319 }
320
321 switch ($a_mode) {
322 case 'create':
323 $this->ctrl->saveParameter($this, ['seed', 'idate']);
324 $action = $this->ctrl->getLinkTarget($this, 'save');
325 $submit_label = $this->lng->txt('cal_add_appointment');
326 break;
327 case 'edit':
328 $this->ctrl->saveParameter($this, ['seed', 'app_id', 'idate']);
329 $action = $this->ctrl->getLinkTarget($this, 'update');
330 $submit_label = $this->lng->txt('save');
331 break;
332 }
333
335 $form = $this->ui_factory->input()->container()->form()->standard(
336 $action,
337 $sections
338 )->withSubmitLabel($submit_label)
339 ->withAdditionalTransformation($this->refinery->custom()->transformation(function ($vs) {
340 // flatten output so we don't need to worry about section post vars
341 $res = [];
342 foreach ($vs as $v) {
343 $res = array_merge($res, $v);
344 }
345 return $res;
346 }));
347 return $this->form = $form;
348 }
349
350 protected function readAndPrepareCalendarSelection(string $mode): int
351 {
352 $category_id = 0;
353 if ($this->http->wrapper()->query()->has('category_id')) {
354 $category_id = $this->http->wrapper()->query()->retrieve(
355 'category_id',
356 $this->refinery->kindlyTo()->int()
357 );
358 }
359 $ref_id = 0;
360 if ($this->http->wrapper()->query()->has('ref_id')) {
361 $ref_id = $this->http->wrapper()->query()->retrieve(
362 'ref_id',
363 $this->refinery->kindlyTo()->int()
364 );
365 }
366 $selected_calendar = 0;
367 if ($this->http->wrapper()->post()->has('calendar')) {
368 $selected_calendar = $this->http->wrapper()->post()->retrieve(
369 'calendar',
370 $this->refinery->kindlyTo()->int()
371 );
372 }
373
374 if ($selected_calendar > 0) {
375 return $selected_calendar;
376 }
377
378 if ($category_id) {
379 return (int) $category_id;
380 }
381
382 if ($mode == 'edit') {
383 $ass = new ilCalendarCategoryAssignments($this->app->getEntryId());
384 return $ass->getFirstAssignment();
385 }
386
387 if ($ref_id) {
389 $selected_calendar = ilCalendarCategories::_lookupCategoryIdByObjId($obj_cal);
390 $cats = ilCalendarCategories::_getInstance($this->user->getId());
391 $cats->readSingleCalendar($selected_calendar);
392 return $selected_calendar;
393 }
394
395 $cats = ilCalendarCategories::_getInstance($this->user->getId());
396 $categories = $cats->prepareCategoriesOfUserForSelection();
397 return key($categories);
398 }
399
404 protected function doUserAutoComplete(): ?string
405 {
406 // hide anonymout request
407 if ($this->user->getId() == ANONYMOUS_USER_ID) {
408 return json_encode(new stdClass(), JSON_THROW_ON_ERROR);
409 }
410 if (!$this->http->wrapper()->query()->has('autoCompleteField')) {
411 $a_fields = [
412 'login',
413 'firstname',
414 'lastname',
415 'email'
416 ];
417 $result_field = 'login';
418 } else {
419 $auto_complete_field = $this->http->wrapper()->query()->retrieve(
420 'autoCompleteField',
421 $this->refinery->kindlyTo()->string()
422 );
423 $a_fields = [$auto_complete_field];
424 $result_field = $auto_complete_field;
425 }
426 $auto = new ilUserAutoComplete();
428
429 if ($this->http->wrapper()->query()->has('fetchall')) {
430 $auto->setLimit(ilUserAutoComplete::MAX_ENTRIES);
431 }
432
433 $auto->setMoreLinkAvailable(true);
434 $auto->setSearchFields($a_fields);
435 $auto->setResultField($result_field);
436 $auto->enableFieldSearchableCheck(true);
437 $query = '';
438 if ($this->http->wrapper()->post()->has('term')) {
439 $query = $this->http->wrapper()->post()->retrieve(
440 'term',
441 $this->refinery->kindlyTo()->string()
442 );
443 }
444 if ($query === '') {
445 if ($this->http->wrapper()->query()->has('term')) {
446 $query = $this->http->wrapper()->query()->retrieve(
447 'term',
448 $this->refinery->kindlyTo()->string()
449 );
450 }
451 }
452 echo $auto->getList($query);
453 exit;
454 }
455
459 protected function add(?Form $form = null): void
460 {
461 $this->help->setScreenIdComponent("cal");
462 $this->help->setScreenId("app");
463 $this->help->setSubScreenId("create");
464
465 if (!$form) {
466 $form = $this->initForm('create');
467 }
468 $this->tpl->setContent($this->ui_renderer->render($form));
469 }
470
471 protected function save(): void
472 {
473 $data = $this->load('create');
474
475 if ($data && $this->app->validate() && $this->notification->validate()) {
476 if ((int) $data['calendar'] === 0) {
477 $cat_id = $this->createDefaultCalendar();
478 } else {
479 $cat_id = (int) $data['calendar'];
480 }
481
482 $this->app->save();
483 $this->notification->setEntryId($this->app->getEntryId());
484 $this->notification->save();
485 $this->rec->setEntryId($this->app->getEntryId());
486 $this->saveRecurrenceSettings();
487
488 $ass = new ilCalendarCategoryAssignments($this->app->getEntryId());
489 $ass->addAssignment($cat_id);
490
491 // Send notifications
492 if (
493 ilCalendarSettings::_getInstance()->isNotificationEnabled() &&
494 ($data['not'] ?? false)
495 ) {
496 $this->distributeNotifications($cat_id, $this->app->getEntryId(), true);
497 }
498 if (ilCalendarSettings::_getInstance()->isUserNotificationEnabled()) {
500 }
501
502 $this->tpl->setOnScreenMessage('success', $this->lng->txt('cal_created_appointment'), true);
503 $this->ctrl->returnToParent($this);
504 } else {
505 if ($data && $this->error->getMessage() !== '') {
506 $this->tpl->setOnScreenMessage('failure', $this->error->getMessage());
507 } else {
508 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
509 }
510 $this->add($this->form);
511 return;
512 }
513 $this->add();
514 }
515
519 protected function distributeUserNotifications(): void
520 {
522 $notification->setAppointmentId($this->app->getEntryId());
523
524 foreach ($this->notification->getRecipients() as $rcp) {
525 switch ($rcp['type']) {
528 $notification->setRecipients(array($rcp['usr_id']));
530 break;
531
534 $notification->setRecipients(array($rcp['email']));
536 break;
537 }
538 $notification->send();
539 }
540 }
541
542 protected function distributeNotifications(int $a_cat_id, int $app_id, bool $a_new_appointment = true): void
543 {
544 $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($a_cat_id);
545
547 $notification->setAppointmentId($app_id);
548
549 switch ($cat_info['type']) {
551
552 switch ($cat_info['obj_type']) {
553 case 'crs':
554 $ref_ids = ilObject::_getAllReferences($cat_info['obj_id']);
555 $ref_id = current($ref_ids);
556 $notification->setRefId($ref_id);
557 $notification->setType(
558 $a_new_appointment ?
561 );
562 break;
563
564 case 'grp':
565 $ref_ids = ilObject::_getAllReferences($cat_info['obj_id']);
566 $ref_id = current($ref_ids);
567 $notification->setRefId($ref_id);
568 $notification->setType(
569 $a_new_appointment ?
572 );
573 break;
574 }
575 break;
576 }
577 $notification->send();
578 }
579
583 protected function askEdit(): void
584 {
585 // check for recurring entries
587 if (!$rec) {
588 $this->edit(true);
589 return;
590 }
591 // Show edit single/all appointments
592 $this->ctrl->saveParameter($this, array('seed', 'app_id', 'dt', 'idate'));
593
594 $confirm = new ilConfirmationGUI();
595 $confirm->setHeaderText($this->lng->txt('cal_edit_single_or_all_info'));
596 $confirm->setFormAction($this->ctrl->getFormAction($this));
597 $confirm->setCancel($this->lng->txt('cancel'), 'cancel');
598 $confirm->addItem('appointments[]', (string) $this->app->getEntryId(), $this->app->getTitle());
599 $confirm->addButton($this->lng->txt('cal_edit_single'), 'editSingle');
600 $confirm->setConfirm($this->lng->txt('cal_edit_recurrences'), 'edit');
601
602 $this->tpl->setContent($confirm->getHTML());
603 }
604
608 protected function editSingle(): void
609 {
610 $this->ctrl->setParameter($this, 'rexl', "1");
611 $this->requested_rexl = true;
612 $this->edit(true);
613 }
614
618 protected function edit(bool $a_edit_single_app = false, ?Form $form = null): void
619 {
620 $this->help->setScreenIdComponent("cal");
621 $this->help->setScreenId("app");
622 $this->help->setSubScreenId("edit");
623
624 $this->ctrl->saveParameter($this, array('seed', 'app_id', 'dt', 'idate'));
625 if ($this->requested_rexl) {
626 $this->ctrl->setParameter($this, 'rexl', 1);
627 // Calculate new appointment time
628 $duration = $this->getAppointment()->getEnd()->get(IL_CAL_UNIX) - $this->getAppointment()->getStart()->get(IL_CAL_UNIX);
629 $calc = new ilCalendarRecurrenceCalculator($this->getAppointment(), $this->rec);
630
631 $current_date = new ilDateTime($this->getRecurrenceDateFromQuery(), IL_CAL_UNIX);
632
633 $yesterday = clone $current_date;
634 $yesterday->increment(IL_CAL_DAY, -1);
635 $tomorrow = clone $current_date;
636 $tomorrow->increment(IL_CAL_DAY, 1);
637
638 foreach ($calc->calculateDateList($current_date, $tomorrow, 1) as $date_entry) {
639 if (ilDateTime::_equals($current_date, $date_entry, IL_CAL_DAY)) {
640 $this->getAppointment()->setStart(new ilDateTime($date_entry->get(IL_CAL_UNIX), IL_CAL_UNIX));
641 $this->getAppointment()->setEnd(new ilDateTime(
642 $date_entry->get(IL_CAL_UNIX) + $duration,
644 ));
645 break;
646 }
647 }
648 // Finally reset recurrence
649 $this->rec = new ilCalendarRecurrence();
650 }
651
652 $cat_id = ilCalendarCategoryAssignments::_lookupCategory($this->app->getEntryId());
653 $cats = ilCalendarCategories::_getInstance($this->user->getId());
654
655 if (!$cats->isVisible($cat_id)) {
656 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->WARNING);
657 return;
658 }
659 if (!$cats->isEditable($cat_id) or $this->app->isAutoGenerated()) {
660 $this->showInfoScreen();
661 return;
662 }
663 if (!$form) {
664 $form = $this->initForm('edit', $a_edit_single_app);
665 }
666 $this->tpl->setContent($this->ui_renderer->render($form));
667 }
668
669 protected function showInfoScreen(): void
670 {
671 $info = new ilInfoScreenGUI($this);
672 $info->setFormAction($this->ctrl->getFormAction($this));
673 $info->addSection($this->lng->txt('cal_details'));
674
675 // Appointment
676 $info->addProperty(
677 $this->lng->txt('appointment'),
679 $this->app->getStart(),
680 $this->app->getEnd()
681 )
682 );
683 $info->addProperty($this->lng->txt('title'), $this->app->getPresentationTitle());
684
685 // Description
686 if (strlen($desc = $this->app->getDescription())) {
687 $info->addProperty($this->lng->txt('description'), $desc);
688 }
689
690 // Location
691 if (strlen($loc = $this->app->getLocation())) {
692 $info->addProperty($this->lng->txt('cal_where'), $loc);
693 }
694
695 $cat_id = ilCalendarCategoryAssignments::_lookupCategory($this->app->getEntryId());
696 $category = new ilCalendarCategory($cat_id);
697
698 if ($category->getType() == ilCalendarCategory::TYPE_OBJ) {
699 $info->addSection($this->lng->txt('additional_info'));
700
701 $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
702 $refs = ilObject::_getAllReferences($cat_info['obj_id']);
703
704 $href = ilLink::_getStaticLink(current($refs), ilObject::_lookupType($cat_info['obj_id']), true);
705 $info->addProperty(
706 $this->lng->txt('perma_link'),
707 '<a class="small" href="' . $href . '" target="_top">' . $href . '</a>'
708 );
709 }
710 $this->tpl->setContent($info->getHTML());
711 }
712
713 protected function update(): void
714 {
715 $single_editing = $this->requested_rexl;
716 $data = $this->load('edit');
717
718 if ($data && $this->app->validate() && $this->notification->validate()) {
719 if (!(int) $data['calendar']) {
720 $cat_id = $this->createDefaultCalendar();
721 } else {
722 $cat_id = (int) $data['calendar'];
723 }
724
725 if ($single_editing) {
726 $original_id = $this->getAppointment()->getEntryId();
727 $this->getAppointment()->save();
728 $selected_ut = $this->getRecurrenceDateFromQuery();
729 if ($selected_ut > 0) {
730 $exclusion = new ilCalendarRecurrenceExclusion();
731 $exclusion->setEntryId($original_id);
732 $exclusion->setDate(new ilDate($selected_ut, IL_CAL_UNIX));
733 $this->logger->dump($this->getAppointment()->getEntryId());
734 $this->logger->dump(ilDatePresentation::formatDate(new ilDate($selected_ut, IL_CAL_UNIX)));
735 $exclusion->save();
736 }
737 $this->rec = new ilCalendarRecurrence();
738 $this->rec->setEntryId($this->getAppointment()->getEntryId());
739 } else {
740 $this->getAppointment()->update();
741 }
742 $this->notification->save();
743 $this->saveRecurrenceSettings();
744 $ass = new ilCalendarCategoryAssignments($this->app->getEntryId());
745 $ass->deleteAssignments();
746 $ass->addAssignment($cat_id);
747
748 // Send notifications
749 $notification = (bool) ($data['not'] ?? false);
750 if (
751 ilCalendarSettings::_getInstance()->isNotificationEnabled() &&
753 ) {
754 $this->distributeNotifications($cat_id, $this->app->getEntryId(), false);
755 }
756 if (ilCalendarSettings::_getInstance()->isUserNotificationEnabled()) {
758 }
759
760 $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
761 $this->ctrl->returnToParent($this);
762 } elseif ($data && $this->error->getMessage() !== '') {
763 $this->tpl->setOnScreenMessage('failure', $this->error->getMessage());
764 } else {
765 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
766 }
767 $this->edit(false, $this->form);
768 }
769
770 protected function askDelete(): void
771 {
772 $this->ctrl->saveParameter(
773 $this,
774 [
775 'seed',
776 'app_id',
777 'dt',
778 'idate'
779 ]
780 );
781
782 $app_id = (int) ($this->request->getQueryParams()['app_id'] ?? 0);
783 if (!$app_id) {
784 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
785 $this->ctrl->returnToParent($this);
786 }
787
789 if (!count($recs)) {
790 $confirm = new ilConfirmationGUI();
791 $confirm->setFormAction($this->ctrl->getFormAction($this));
792 $confirm->setHeaderText($this->lng->txt('cal_delete_app_sure'));
793 $confirm->setCancel($this->lng->txt('cancel'), 'cancel');
794 $confirm->addItem('appointments[]', (string) $this->app->getEntryId(), $this->app->getTitle());
795 $confirm->setConfirm($this->lng->txt('delete'), 'delete');
796 $this->tpl->setContent($confirm->getHTML());
797 } else {
798 $table = new ilCalendarRecurrenceTableGUI(
799 $this->app,
800 $this,
801 'askDelete'
802 );
803 $table->init();
804 $table->parse();
805 $this->tpl->setContent($table->getHTML());
806 $this->tpl->setOnScreenMessage('question', $this->lng->txt('cal_delete_app_sure'));
807 $this->tpl->setOnScreenMessage('info', $this->lng->txt('cal_recurrence_confirm_deletion'));
808 }
809 }
810
811 protected function delete(): void
812 {
813 $app_ids = (array) ($this->request->getParsedBody()['appointment_ids'] ?? []);
814 if (!$app_ids) {
815 $this->logger->dump($app_ids);
816 $app_ids = (array) ($this->request->getQueryParams()['app_id'] ?? []);
817 }
818 if (!$app_ids) {
819 $this->ctrl->returnToParent($this);
820 }
821 foreach ($app_ids as $app_id) {
822 $app_id = (int) $app_id;
823 $app = new ilCalendarEntry($app_id);
824 $app->delete();
827 }
828 $this->tpl->setOnScreenMessage('success', $this->lng->txt('cal_deleted_app'), true);
829 $this->ctrl->returnToParent($this);
830 }
831
832 protected function deleteExclude(bool $a_return = true): void
833 {
834 $recurrence_ids = (array) ($this->request->getParsedBody()['recurrence_ids'] ?? []);
835 $app_id = (int) ($this->request->getQueryParams()['app_id'] ?? 0);
836 if (!count($recurrence_ids)) {
837 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
838 $this->ctrl->redirect($this, 'askDelete');
839 }
840 if (!$app_id) {
841 $this->ctrl->returnToParent($this);
842 }
843 foreach ($recurrence_ids as $rdate) {
844 $exclusion = new ilCalendarRecurrenceExclusion();
845 $exclusion->setEntryId($app_id);
846 $exclusion->setDate(new ilDate($rdate, IL_CAL_UNIX));
847 $exclusion->save();
848 }
849 if ($a_return) {
850 $this->tpl->setOnScreenMessage('success', $this->lng->txt('cal_deleted_app'), true);
851 $this->ctrl->returnToParent($this);
852 }
853 }
854
855 protected function initTimeZone(): void
856 {
857 $this->timezone = $this->user->getTimeZone();
858 }
859
860 protected function initInitialDate(ilDate $initialDate): void
861 {
862 $hour = 0;
863 if ($this->http->wrapper()->query()->has('hour')) {
864 $hour = $this->http->wrapper()->query()->retrieve(
865 'hour',
866 $this->refinery->kindlyTo()->int()
867 );
868 }
869
870 if (!$hour) {
871 $this->initialDate = clone $initialDate;
872 $this->default_fulltime = true;
873 } else {
874 if ($hour < 10) {
875 $time = '0' . $hour . ':00:00';
876 } else {
877 $time = (int) $hour . ':00:00';
878 }
879 $this->initialDate = new ilDateTime(
880 $initialDate->get(IL_CAL_DATE) . ' ' . $time,
882 $this->timezone
883 );
884 $this->default_fulltime = false;
885 }
886 }
887
888 protected function initSeed(ilDate $seed): void
889 {
890 $this->seed = clone $seed;
891 $this->default_fulltime = true;
892 }
893
894 protected function initAppointment(int $a_app_id = 0): void
895 {
896 $this->app = new ilCalendarEntry($a_app_id);
897 $this->notification = new ilCalendarUserNotification($this->app->getEntryId());
898
899 if (!$a_app_id) {
900 $start = clone $this->initialDate;
901 $this->app->setStart($start);
902
903 $seed_end = clone $this->initialDate;
904 if ($this->default_fulltime) {
905 #$seed_end->increment(IL_CAL_DAY,1);
906 } else {
907 $seed_end->increment(IL_CAL_HOUR, 1);
908 }
909 $this->app->setEnd($seed_end);
910 $this->app->setFullday($this->default_fulltime);
911
912 $this->rec = new ilCalendarRecurrence();
913 } else {
914 $this->rec = ilCalendarRecurrences::_getFirstRecurrence($this->app->getEntryId());
915 }
916 }
917
918 protected function load($a_mode): ?array
919 {
920 // needed for date handling
921 $this->form = $this->initForm($a_mode)->withRequest($this->request);
922 $data = $this->form->getData();
923 if (!$data) {
924 return null;
925 }
926
927 $this->app->setTitle($data['title']);
928 $this->app->setLocation($data['location']);
929 $this->app->setDescription($data['description']);
930 if (ilCalendarSettings::_getInstance()->isNotificationEnabled()) {
931 $this->app->enableNotification((bool) ($data['not'] ?? false));
932 }
933
935 $start_datetime = $data['event'][1][0]['start'];
937 $end_datetime = $data['event'][1][0]['end'];
938 $full_day = $data['event'][0] === 'full_day';
939 if ($full_day) {
940 $start = new ilDate($start_datetime->getTimestamp(), IL_CAL_UNIX);
941 $end = new ilDate($end_datetime->getTimestamp(), IL_CAL_UNIX);
942 } else {
943 $start = new ilDateTime($start_datetime->getTimestamp(), IL_CAL_UNIX);
944 $end = new ilDateTime($end_datetime->getTimestamp(), IL_CAL_UNIX);
945 }
946
947 $this->app->setFullday($full_day);
948 $this->app->setStart($start);
949 $this->app->setEnd($end);
950
951 if (ilCalendarSettings::_getInstance()->isUserNotificationEnabled()) {
952 $this->loadNotificationRecipients((array) $data['notu']);
953 }
954 $this->loadRecurrenceSettings($data['recurrence'] ?? null);
955 return $data;
956 }
957
961 protected function loadNotificationRecipients(array $recipients): void
962 {
963 $this->notification->setRecipients([]);
964 $map = [];
965 foreach ($recipients as $rcp) {
966 $rcp = trim($rcp);
967 $usr_id = (int) ilObjUser::_loginExists($rcp);
968 if ($rcp === '') {
969 continue;
970 }
971 if (in_array($rcp, $map)) {
972 continue;
973 }
974 $map[] = $rcp;
975 if ($usr_id) {
976 $this->notification->addRecipient(
978 $usr_id
979 );
980 } else {
981 $this->notification->addRecipient(
983 0,
984 $rcp
985 );
986 }
987 }
988 }
989
990 protected function loadRecurrenceSettings(?ilCalendarRecurrence $recurrence): void
991 {
992 if ($recurrence) {
993 $this->rec = $recurrence;
994 } else {
995 $this->rec = new ilCalendarRecurrence();
996 }
997 }
998
999 protected function saveRecurrenceSettings(): void
1000 {
1001 switch ($this->rec->getFrequenceType()) {
1002 case '':
1004 // No recurrence => delete if there is an recurrence rule
1005 if ($this->rec->getRecurrenceId()) {
1006 $this->rec->delete();
1007 }
1008 break;
1009
1010 default:
1011 if ($this->rec->getRecurrenceId()) {
1012 $this->rec->update();
1013 } else {
1014 $this->rec->save();
1015 }
1016 break;
1017 }
1018 }
1019
1020 protected function createDefaultCalendar(): int
1021 {
1022 $cat = new ilCalendarCategory();
1023 $cat->setColor(ilCalendarCategory::DEFAULT_COLOR);
1024 $cat->setType(ilCalendarCategory::TYPE_USR);
1025 $cat->setTitle($this->lng->txt('cal_default_calendar'));
1026 $cat->setObjId($this->user->getId());
1027
1028 // delete calendar cache
1029 ilCalendarCache::getInstance()->deleteUserEntries($this->user->getId());
1030
1031 return $cat->add();
1032 }
1033
1037 protected function confirmRegister(): void
1038 {
1039 $dstart = 0;
1040 if ($this->http->wrapper()->query()->has('dstart')) {
1041 $dstart = $this->http->wrapper()->query()->retrieve(
1042 'dstart',
1043 $this->refinery->kindlyTo()->int()
1044 );
1045 }
1046 $dend = 0;
1047 if ($this->http->wrapper()->query()->has('dend')) {
1048 $dend = $this->http->wrapper()->query()->retrieve(
1049 'dend',
1050 $this->refinery->kindlyTo()->int()
1051 );
1052 }
1053
1054 $app_id = $this->getAppointmentIdFromQuery();
1055 $entry = new ilCalendarEntry($app_id);
1057 new ilDateTime($dstart, IL_CAL_UNIX),
1058 new ilDateTime($dend, IL_CAL_UNIX)
1059 );
1060
1061 $conf = new ilConfirmationGUI();
1062 $this->ctrl->setParameter($this, 'dstart', $dstart);
1063 $this->ctrl->setParameter($this, 'dend', $dend);
1064
1065 $conf->setFormAction($this->ctrl->getFormAction($this));
1066 $conf->setHeaderText($this->lng->txt('cal_confirm_reg_info'));
1067 $conf->setConfirm($this->lng->txt('cal_reg_register'), 'register');
1068 $conf->setCancel($this->lng->txt('cancel'), 'cancel');
1069 $conf->addItem('app_id', (string) $entry->getEntryId(), $entry->getTitle() . ' (' . $start . ')');
1070 $this->tpl->setContent($conf->getHTML());
1071 }
1072
1073 protected function register(): void
1074 {
1075 $dstart = 0;
1076 if ($this->http->wrapper()->query()->has('dstart')) {
1077 $dstart = $this->http->wrapper()->query()->retrieve(
1078 'dstart',
1079 $this->refinery->kindlyTo()->int()
1080 );
1081 }
1082 $dend = 0;
1083 if ($this->http->wrapper()->query()->has('dend')) {
1084 $dend = $this->http->wrapper()->query()->retrieve(
1085 'dend',
1086 $this->refinery->kindlyTo()->int()
1087 );
1088 }
1089 $app_id = 0;
1090 if ($this->http->wrapper()->post()->has('app_id')) {
1091 $app_id = $this->http->wrapper()->post()->retrieve(
1092 'app_id',
1093 $this->refinery->kindlyTo()->int()
1094 );
1095 }
1096 $reg = new ilCalendarRegistration($app_id);
1097 $reg->register(
1098 $this->user->getId(),
1099 new ilDateTime($dstart, IL_CAL_UNIX),
1100 new ilDateTime((int) $dend, IL_CAL_UNIX)
1101 );
1102
1103 $this->tpl->setOnScreenMessage('success', $this->lng->txt('cal_reg_registered'), true);
1104 $this->ctrl->returnToParent($this);
1105 }
1106
1107 public function confirmUnregister(): void
1108 {
1109 $dstart = 0;
1110 if ($this->http->wrapper()->query()->has('dstart')) {
1111 $dstart = $this->http->wrapper()->query()->retrieve(
1112 'dstart',
1113 $this->refinery->kindlyTo()->int()
1114 );
1115 }
1116 $dend = 0;
1117 if ($this->http->wrapper()->query()->has('dend')) {
1118 $dend = $this->http->wrapper()->query()->retrieve(
1119 'dend',
1120 $this->refinery->kindlyTo()->int()
1121 );
1122 }
1123
1124 $app_id = $this->getAppointmentIdFromQuery();
1125 $entry = new ilCalendarEntry($app_id);
1127 new ilDateTime($dstart, IL_CAL_UNIX),
1128 new ilDateTime($dend, IL_CAL_UNIX)
1129 );
1130
1131 $this->ctrl->setParameter($this, 'dstart', (int) $dstart);
1132 $this->ctrl->setParameter($this, 'dend', (int) $dend);
1133
1134 $conf = new ilConfirmationGUI();
1135 $conf->setFormAction($this->ctrl->getFormAction($this));
1136 $conf->setHeaderText($this->lng->txt('cal_confirm_unreg_info'));
1137 $conf->setConfirm($this->lng->txt('cal_reg_unregister'), 'unregister');
1138 $conf->setCancel($this->lng->txt('cancel'), 'cancel');
1139 $conf->addItem('app_id', (string) $entry->getEntryId(), $entry->getTitle() . ' (' . $start . ')');
1140
1141 $this->tpl->setContent($conf->getHTML());
1142 }
1143
1147 protected function unregister(): void
1148 {
1149 $dstart = 0;
1150 if ($this->http->wrapper()->query()->has('dstart')) {
1151 $dstart = $this->http->wrapper()->query()->retrieve(
1152 'dstart',
1153 $this->refinery->kindlyTo()->int()
1154 );
1155 }
1156 $dend = 0;
1157 if ($this->http->wrapper()->query()->has('dend')) {
1158 $dend = $this->http->wrapper()->query()->retrieve(
1159 'dend',
1160 $this->refinery->kindlyTo()->int()
1161 );
1162 }
1163 $app_id = 0;
1164 if ($this->http->wrapper()->post()->has('app_id')) {
1165 $app_id = $this->http->wrapper()->post()->retrieve(
1166 'app_id',
1167 $this->refinery->kindlyTo()->int()
1168 );
1169 }
1170 $reg = new ilCalendarRegistration($app_id);
1171 $reg->unregister(
1172 $this->user->getId(),
1173 new ilDateTime((int) $dstart, IL_CAL_UNIX),
1174 new ilDateTime((int) $dend, IL_CAL_UNIX)
1175 );
1176
1177 $this->tpl->setOnScreenMessage('success', $this->lng->txt('cal_reg_unregistered'), true);
1178 $this->ctrl->returnToParent($this);
1179 }
1180
1184 public function book(): void
1185 {
1186 $entry_id = $this->getAppointmentIdFromQuery();
1187 $this->ctrl->saveParameter($this, 'app_id');
1188
1189 $entry = new ilCalendarEntry($entry_id);
1190 $booking = new \ilBookingEntry($entry->getContextId());
1191 $user = $booking->getObjId();
1192
1193 $form = $this->initFormConfirmBooking();
1194 $form->getItemByPostVar('date')->setValue(ilDatePresentation::formatPeriod(
1195 $entry->getStart(),
1196 $entry->getEnd()
1197 ));
1198 $form->getItemByPostVar('title')->setValue($entry->getTitle() . " (" . ilObjUser::_lookupFullname($user) . ')');
1199
1200 $this->tpl->setContent($form->getHTML());
1201 }
1202
1204 {
1205 $form = new ilPropertyFormGUI();
1206 $form->setFormAction($this->ctrl->getFormAction($this));
1207 $form->addCommandButton('bookconfirmed', $this->lng->txt('cal_confirm_booking'));
1208 $form->addCommandButton('cancel', $this->lng->txt('cancel'));
1209
1210 $date = new ilNonEditableValueGUI($this->lng->txt('appointment'), 'date');
1211 $form->addItem($date);
1212
1213 $title = new ilNonEditableValueGUI($this->lng->txt('title'), 'title');
1214 $form->addItem($title);
1215
1216 $message = new ilTextAreaInputGUI($this->lng->txt('cal_ch_booking_message_tbl'), 'comment');
1217 $message->setRows(5);
1218 $form->addItem($message);
1219
1220 return $form;
1221 }
1222
1226 public function bookconfirmed()
1227 {
1228 $entry = $this->getAppointmentIdFromQuery();
1229 $form = $this->initFormConfirmBooking();
1230 if ($form->checkInput()) {
1231 // check if appointment is bookable
1232 $cal_entry = new ilCalendarEntry($entry);
1233
1234 $booking = new ilBookingEntry($cal_entry->getContextId());
1235
1236 if (!$booking->isAppointmentBookableForUser($entry, $GLOBALS['DIC']['ilUser']->getId())) {
1237 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('cal_booking_failed_info'), true);
1238 $this->ctrl->returnToParent($this);
1239 }
1240
1241 ilConsultationHourUtils::bookAppointment($this->user->getId(), $entry, $form->getInput('comment'));
1242 }
1243 $this->tpl->setOnScreenMessage('success', $this->lng->txt('cal_booking_confirmed'), true);
1244 $this->ctrl->returnToParent($this);
1245 }
1246
1247 protected function deleteBooking(): void
1248 {
1249 $this->cancelBooking(false);
1250 }
1251
1256 public function cancelBooking(bool $send_mail = true): void
1257 {
1258 $entry = $this->getAppointmentIdFromQuery();
1259 $entry = new ilCalendarEntry($entry);
1260
1261 $category = $this->calendarEntryToCategory($entry);
1262 if ($category->getType() == ilCalendarCategory::TYPE_CH) {
1263 $booking = new ilBookingEntry($entry->getContextId());
1264 if (!$booking->hasBooked($entry->getEntryId()) && !$booking->isOwner()) {
1265 $this->ctrl->returnToParent($this);
1266 return;
1267 }
1268 $entry_title = ' ' . $entry->getTitle() . " (" . ilObjUser::_lookupFullname($booking->getObjId()) . ')';
1269 } elseif ($category->getType() == ilCalendarCategory::TYPE_BOOK) {
1270 $entry_title = ' ' . $entry->getTitle();
1271 } else {
1272 $this->ctrl->returnToParent($this);
1273 return;
1274 }
1275 $title = ilDatePresentation::formatPeriod($entry->getStart(), $entry->getEnd());
1276 $conf = new ilConfirmationGUI();
1277 $conf->setFormAction($this->ctrl->getFormAction($this));
1278 $conf->setHeaderText(
1279 $send_mail ?
1280 $this->lng->txt('cal_cancel_booking_info') :
1281 $this->lng->txt('cal_delete_booking_info')
1282 );
1283 $conf->setConfirm(
1284 $send_mail ?
1285 $this->lng->txt('cal_cancel_booking') :
1286 $this->lng->txt('delete'),
1287 $send_mail ?
1288 'cancelConfirmed' :
1289 'deleteConfirmed'
1290 );
1291 $conf->setCancel($this->lng->txt('cancel'), 'cancel');
1292 $conf->addItem('app_id', (string) $entry->getEntryId(), $title . ' - ' . $entry_title);
1293 $this->tpl->setContent($conf->getHTML());
1294 }
1295
1296 protected function deleteConfirmed(): void
1297 {
1298 $this->cancelConfirmed(false);
1299 }
1300
1305 public function cancelConfirmed(bool $send_mail = true): void
1306 {
1307 $app_id = 0;
1308 if ($this->http->wrapper()->post()->has('app_id')) {
1309 $app_id = $this->http->wrapper()->post()->retrieve(
1310 'app_id',
1311 $this->refinery->kindlyTo()->int()
1312 );
1313 }
1314 $entry = new ilCalendarEntry($app_id);
1315 $category = $this->calendarEntryToCategory($entry);
1316 $booking = new ilBookingEntry($entry->getContextId());
1317 if ($category->getType() == ilCalendarCategory::TYPE_CH && $booking->isOwner()) {
1318 foreach ($booking->getCurrentBookings($entry->getEntryId()) as $bookuser) {
1320 $bookuser,
1321 (int) $app_id,
1322 $send_mail
1323 );
1324 }
1325 } elseif ($category->getType() == ilCalendarCategory::TYPE_CH) {
1326 // find cloned calendar entry in user calendar
1328 $this->user->getId(),
1329 $entry->getContextId(),
1330 $entry->getStart(),
1332 false
1333 );
1334
1335 // Fix for wrong, old entries
1336 foreach ($apps as $own_app) {
1337 $ref_entry = new ilCalendarEntry($own_app);
1338 $ref_entry->delete();
1339 }
1340
1341 $booking = new ilBookingEntry($entry->getContextId());
1342 $booking->cancelBooking($entry->getEntryId());
1343
1344 // do NOT delete original entry
1345 } elseif ($category->getType() == ilCalendarCategory::TYPE_BOOK) {
1346 $booking = new ilBookingReservation($entry->getContextId());
1347 $booking->setStatus(ilBookingReservation::STATUS_CANCELLED);
1348 $booking->update();
1349
1350 $entry->delete();
1351 }
1352
1353 $this->tpl->setOnScreenMessage('success', $this->lng->txt('cal_cancel_booking_confirmed'), true);
1354 $this->ctrl->returnToParent($this);
1355 }
1356
1361 {
1362 $assignment = new ilCalendarCategoryAssignments($entry->getEntryId());
1363 $assignment = $assignment->getFirstAssignment();
1364 return new ilCalendarCategory($assignment);
1365 }
1366}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$duration
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
Builds data types.
Definition: Factory.php:36
Class Services.
Definition: Services.php:38
const IL_CAL_DATE
const IL_CAL_UNIX
const IL_CAL_DATETIME
const IL_CAL_HOUR
const IL_CAL_DAY
error(string $a_errmsg)
Booking definition.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Administrate calendar appointments.
edit(bool $a_edit_single_app=false, ?Form $form=null)
edit appointment
askEdit()
Check edit single apppointment / edit all appointments for recurring appointments.
add(?Form $form=null)
add new appointment
loadRecurrenceSettings(?ilCalendarRecurrence $recurrence)
calendarEntryToCategory(ilCalendarEntry $entry)
Get category object of given calendar entry.
editSingle()
Edit one single appointment ^.
bookconfirmed()
Book consultation appointment, was confirmed.
distributeUserNotifications()
Send mail to selected users.
__construct(ilDate $seed, ilDate $initialDate, int $a_appointment_id=0)
ilCalendarUserNotification $notification
distributeNotifications(int $a_cat_id, int $app_id, bool $a_new_appointment=true)
cancelConfirmed(bool $send_mail=true)
Cancel consultation appointment or ressource booking, was confirmed This will delete the calendar ent...
confirmRegister()
Register to an appointment.
doUserAutoComplete()
Currently not in use, but will be as soon as tag inputs support autocomplete, see ilCalendarAppointme...
cancelBooking(bool $send_mail=true)
Confirmation screen to cancel consultation appointment or ressource booking depends on calendar categ...
book()
Confirmation screen for booking of consultation appointment.
unregister()
Unregister calendar, was confirmed.
static _lookupCategoryIdByObjId(int $a_obj_id)
lookup category by obj_id
static _getInstance($a_usr_id=0)
get singleton instance
static _deleteByAppointmentId(int $a_app_id)
Delete appointment assignment.
Stores calendar categories.
Model for a calendar entry.
Distributes calendar mail notifications.
Calculates an ilDateList for a given calendar entry and recurrence rule.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilCalendarRecurrenceTableGUI.
Model of calendar entry recurrcences based on iCalendar-RFC-5545.
static _getRecurrences(int $a_cal_id)
get all recurrences of an appointment
registration for calendar appointments
static _getInstanceByUserId(int $a_user_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getAppointmentIds(int $a_user_id, ?int $a_context_id=null, ?ilDateTime $a_start=null, ?int $a_type=null, bool $a_check_owner=true)
static cancelBooking(int $a_usr_id, int $a_app_id, bool $a_send_notification=true)
Cancel a booking.
static bookAppointment(int $a_usr_id, int $a_app_id, string $comment='')
Book an appointment.
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false, ?ilObjUser $user=null)
Format a period of two dates Shows: 14.
@classDescription Date and time handling
static _equals(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
Check if two date are equal.
get(int $a_format, string $a_format_str='', string $a_tz='')
get formatted date
increment(string $a_type, int $a_count=1)
Class for single dates.
Error Handling & global info handling.
Help GUI class.
Class ilInfoScreenGUI.
language handling
Component logger with individual log levels by component id.
This class represents a non editable value in a property form.
User class.
static _lookupFullname(int $a_user_id)
static _lookupLogin(int $a_user_id)
static _loginExists(string $a_login, int $a_user_id=0)
static _lookupType(int $id, bool $reference=false)
static _getAllReferences(int $id)
get all reference ids for object ID
static _lookupObjId(int $ref_id)
This class represents a property form user interface.
ILIAS Setting Class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text area property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const ANONYMOUS_USER_ID
Definition: constants.php:27
exit
$info
Definition: entry_point.php:21
This describes a standard form.
Definition: Standard.php:29
An entity that renders components to a string output.
Definition: Renderer.php:31
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:66
$res
Definition: ltiservices.php:69
static http()
Fetches the global http state from ILIAS.
form( $class_path, string $cmd, string $submit_caption="")
global $DIC
Definition: shib_login.php:26
$GLOBALS["DIC"]
Definition: wac.php:54
$message
Definition: xapiexit.php:31