ILIAS  release_8 Revision v8.24
class.ilCalendarPresentationGUI.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
22use ILIAS\Refinery\Factory as RefineryFactory;
23use ILIAS\HTTP\Services as HttpServices;
24
34{
36 protected ilLanguage $lng;
39 protected ilObjUser $user;
40 protected ilHelpGUI $help;
42 protected \ILIAS\DI\UIServices $ui;
45 protected HttpServices $http;
46 protected RefineryFactory $refinery;
47
48
52 protected bool $repository_mode = false;
53 protected int $ref_id = 0;
54 protected int $category_id = 0;
55 protected ?ilDate $seed = null;
56
57 protected int $cal_view = 0;
58 protected int $cal_period = 0;
59
60 public function __construct($a_ref_id = 0)
61 {
62 global $DIC;
63
64 $this->ctrl = $DIC->ctrl();
65 $this->lng = $DIC->language();
66 $this->lng->loadLanguageModule('dateplaner');
67
68 $this->http = $DIC->http();
69 $this->refinery = $DIC->refinery();
70 $this->tpl = $DIC->ui()->mainTemplate();
71 $this->tabs_gui = $DIC->tabs();
72 $this->user = $DIC->user();
73 $this->rbacsystem = $DIC->rbac()->system();
74 $this->access = $DIC->access();
75 $this->help = $DIC["ilHelp"];
76 $this->ui = $DIC->ui();
77 $this->toolbar = $DIC->toolbar();
78 $this->ref_id = $a_ref_id;
79 $this->category_id = 0;
80 if ($this->http->wrapper()->query()->has('category_id')) {
81 $this->category_id = $this->http->wrapper()->query()->retrieve(
82 'category_id',
83 $this->refinery->kindlyTo()->int()
84 );
85 }
86
87 $this->repository_mode = $a_ref_id > 0;
88 if ($this->repository_mode && $this->category_id === 0) {
89 $obj_id = ilObject::_lookupObjId($this->ref_id);
90 $category = ilCalendarCategory::_getInstanceByObjId($obj_id);
91 $this->category_id = is_null($category) ? 0 : $category->getCategoryID();
92 }
93 $this->ctrl->setParameter($this, 'category_id', $this->category_id);
94 $this->cal_settings = ilCalendarSettings::_getInstance();
95
96 // show back to pd
97 $this->ctrl->saveParameter($this, 'backpd');
98
99 $this->initCalendarView();
100 $cats = ilCalendarCategories::_getInstance($this->user->getId());
101
102 if ($this->category_id > 0 && $this->ref_id <= 0) { // single calendar view
103 // ensure activation of this category
104 $vis = ilCalendarVisibility::_getInstanceByUserId($this->user->getId(), $a_ref_id);
105 $vis->forceVisibility($this->category_id);
106
107 $cats->initialize(ilCalendarCategories::MODE_SINGLE_CALENDAR, 0, false, $this->category_id);
108 } elseif ($a_ref_id > 0) {
112 } else {
114 }
115
116 $this->actions = ilCalendarActions::getInstance();
117 $this->cats = $cats;
118 }
119
120 public function getRepositoryMode(): bool
121 {
123 }
124
125 protected function initAppointmentIdFromQuery(): int
126 {
127 if ($this->http->wrapper()->query()->has('app_id')) {
128 return $this->http->wrapper()->query()->retrieve(
129 'app_id',
130 $this->refinery->kindlyTo()->int()
131 );
132 }
133 return 0;
134 }
135
136 protected function initCategoryIdFromQuery(): int
137 {
138 if ($this->http->wrapper()->query()->has('category_id')) {
139 return $this->http->wrapper()->query()->retrieve(
140 'category_id',
141 $this->refinery->kindlyTo()->int()
142 );
143 }
144 return 0;
145 }
146
147
151 protected function initAndRedirectToConsultationHours(): void
152 {
153 $ch_user_id = 0;
154 if ($this->http->wrapper()->query()->has('ch_user_id')) {
155 $ch_user_id = $this->http->wrapper()->query()->retrieve(
156 'ch_user_id',
157 $this->refinery->kindlyTo()->int()
158 );
159 }
160 $visibility = ilCalendarVisibility::_getInstanceByUserId($this->user->getId(), $this->ref_id);
161 foreach ($this->cats->getCategoriesInfo() as $info) {
162 if (
163 $info["type"] == ilCalendarCategory::TYPE_CH &&
164 $info["obj_id"] == $ch_user_id
165 ) {
166 $v = $visibility->getVisible();
167 if (!in_array($info["cat_id"], $v)) {
168 $v[] = $info["cat_id"];
169 }
170 $visibility->showSelected($v);
171 $visibility->save();
172 $this->ctrl->setParameterByClass(ilCalendarMonthGUI::class, 'category_id', $info['cat_id']);
173 $this->ctrl->setParameterByClass(\ilCalendarMonthGUI::class, 'seed', $this->getRequestedSeedAsString());
174 }
175 }
176 $this->ctrl->redirectToURL(
177 $this->ctrl->getLinkTargetByClass(\ilCalendarMonthGUI::class, '')
178 );
179 }
180
184 protected function initCalendarView(): void
185 {
186 $this->cal_view = $this->cal_settings->getDefaultCal();
187 if ($this->http->wrapper()->query()->has('cal_view')) {
188 $this->cal_view = $this->http->wrapper()->query()->retrieve(
189 'cal_view',
190 $this->refinery->kindlyTo()->int()
191 );
192 }
193 }
194
195 public function executeCommand(): void
196 {
197 $cmd = $this->ctrl->getCmd();
198 // now next class is not empty, which breaks old consultation hour implementation
199 $next_class = $this->getNextClass();
200
201 if (!ilCalendarSettings::_getInstance()->isEnabled()) {
202 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
203 ilUtil::redirect('ilias.php?baseClass=ilDashboardGUI');
204 }
205
206 $this->initSeed();
207 $this->prepareOutput();
208
209 $this->help->setScreenIdComponent("cal");
210 switch ($cmd) {
211 case 'selectCHCalendarOfUser':
213 break;
214 }
215 switch ($next_class) {
216 case 'ilcalendarinboxgui':
217 $this->tabs_gui->activateTab('cal_agenda');
218 $inbox_gui = $this->forwardToClass('ilcalendarinboxgui');
219 if ($this->showToolbarAndSidebar()) {
220 $this->showViewSelection("cal_list");
221 $this->showSideBlocks();
222 $inbox_gui->addToolbarFileDownload();
223 }
224
225 break;
226
227 case 'ilconsultationhoursgui':
228 $this->tabs_gui->activateTab('app_consultation_hours');
229 $this->tabs_gui->clearTargets();
230
231 // No side blocks
232 $this->tabs_gui->setBackTarget(
233 $this->lng->txt('cal_back_to_cal'),
234 $this->ctrl->getLinkTargetByClass($this->readLastClass())
235 );
236 $this->ctrl->forwardCommand(new ilConsultationHoursGUI());
237 if ($this->showToolbarAndSidebar()) {
238 $this->showSideBlocks();
239 }
240 return;
241
242 case 'ilcalendarmonthgui':
243 $this->tabs_gui->activateTab('cal_agenda');
244 $month_gui = $this->forwardToClass('ilcalendarmonthgui');
245
246 if ($this->showToolbarAndSidebar()) {
247 $this->showViewSelection("app_month");
248 $this->showSideBlocks();
249 $month_gui->addToolbarFileDownload();
250 }
251 break;
252
253 case 'ilcalendarweekgui':
254 $this->tabs_gui->activateTab('cal_agenda');
255 $week_gui = $this->forwardToClass('ilcalendarweekgui');
256 if ($this->showToolbarAndSidebar()) {
257 $this->showViewSelection("app_week");
258 $this->showSideBlocks();
259 $week_gui->addToolbarFileDownload();
260 }
261
262 break;
263
264 case 'ilcalendardaygui':
265 $this->tabs_gui->activateTab('cal_agenda');
266 $day_gui = $this->forwardToClass('ilcalendardaygui');
267 if ($this->showToolbarAndSidebar()) {
268 $this->showViewSelection("app_day");
269 $this->showSideBlocks();
270 $day_gui->addToolbarFileDownload();
271 }
272 break;
273
274 case 'ilcalendarusersettingsgui':
275 $this->ctrl->setReturn($this, '');
276 $this->tabs_gui->activateTab('settings');
277 $this->setCmdClass('ilcalendarusersettingsgui');
278
279 $user_settings = new ilCalendarUserSettingsGUI();
280 $this->ctrl->forwardCommand($user_settings);
281 // No side blocks
282 return;
283
284 case 'ilcalendarappointmentgui':
285 $this->ctrl->setReturn($this, '');
286 $this->tabs_gui->activateTab((string) ilSession::get('cal_last_tab'));
287
288 $app = new ilCalendarAppointmentGUI($this->seed, $this->seed, $this->initAppointmentIdFromQuery());
289 $this->ctrl->forwardCommand($app);
290 break;
291
292 case 'ilcalendarsubscriptiongui':
293 $this->ctrl->setReturn($this, '');
294 $this->tabs_gui->activateTab("cal_agenda");
295
296 $ref_id = 0;
297 if ($this->http->wrapper()->query()->has('ref_id')) {
298 $ref_id = $this->http->wrapper()->query()->retrieve(
299 'ref_id',
300 $this->refinery->kindlyTo()->int()
301 );
302 }
303 $sub = new ilCalendarSubscriptionGUI($this->category_id, $ref_id);
304 $this->ctrl->forwardCommand($sub);
305 if ($this->showToolbarAndSidebar()) {
306 $this->showSideBlocks();
307 }
308 break;
309
310 case 'ilcalendarcategorygui':
311 $this->ctrl->setReturn($this, '');
312 $this->tabs_gui->activateTab("cal_manage");
313 $category = new ilCalendarCategoryGUI($this->user->getId(), $this->seed, $this->ref_id);
314 if ($this->ctrl->forwardCommand($category)) {
315 return;
316 } else {
317 $this->showSideBlocks();
318 break;
319 }
320
321 // no break
322 case 'ilcalendarblockgui':
323 $side_cal = new ilCalendarBlockGUI();
324 $side_cal->setRepositoryMode($this->getRepositoryMode());
325 $side_cal->setForceMonthView(true);
326 $this->ctrl->forwardCommand($side_cal);
327 $this->showSideBlocks();
328 break;
329
330 case 'ilpdcalendarblockgui':
331 $side_cal = new ilPDCalendarBlockGUI();
332 $side_cal->setRepositoryMode($this->getRepositoryMode());
333 $side_cal->setForceMonthView(true);
334 $this->ctrl->forwardCommand($side_cal);
335 $this->showSideBlocks();
336 break;
337
338 case 'ilpublicuserprofilegui':
339 $user_id = $this->user->getId();
340 if ($this->http->wrapper()->query()->has('user_id')) {
341 $user_id = $this->http->wrapper()->query()->retrieve(
342 'user_id',
343 $this->refinery->kindlyTo()->int()
344 );
345 }
346 $user_profile = new ilPublicUserProfileGUI($user_id);
347 $html = $this->ctrl->forwardCommand($user_profile);
348 $this->tpl->setContent($html);
349 break;
350
351 default:
352 $cmd = $this->ctrl->getCmd("show");
353 $this->$cmd();
354 $this->showSideBlocks();
355 break;
356 }
357 }
358
359 public function showViewSelection(string $a_active = "cal_list"): void
360 {
361 $ui = $this->ui;
365
366 $f = $ui->factory();
367
368 $actions = array(
369 $this->lng->txt("app_day") => $ctrl->getLinkTargetByClass('ilCalendarDayGUI', ''),
370 $this->lng->txt("app_week") => $ctrl->getLinkTargetByClass('ilCalendarWeekGUI', ''),
371 $this->lng->txt("app_month") => $ctrl->getLinkTargetByClass('ilCalendarMonthGUI', ''),
372 $this->lng->txt("cal_list") => $ctrl->getLinkTargetByClass('ilCalendarInboxGUI', '')
373 );
374
375
376 $view_control = $f->viewControl()->mode($actions, "cal_change_calendar_view")->withActive($this->lng->txt($a_active));
377 $toolbar->addComponent($view_control);
378 $ctrl->setParameterByClass("ilcalendarappointmentgui", "seed", $this->seed->get(IL_CAL_DATE, ''));
379 $ctrl->setParameterByClass("ilcalendarappointmentgui", "app_id", "");
380 $ctrl->setParameterByClass("ilcalendarappointmentgui", "dt", "");
381 $ctrl->setParameterByClass("ilcalendarappointmentgui", "idate", (new ilDate(time(), IL_CAL_UNIX))->get(IL_CAL_DATE));
382
383 $extra_button_added = false;
384 // add appointment
385 if ($this->category_id == 0 || $this->actions->checkAddEvent($this->category_id)) {
387 $extra_button_added = true;
388 $add_button = $f->button()->standard(
389 $this->lng->txt("cal_add_appointment"),
390 $ctrl->getLinkTargetByClass("ilcalendarappointmentgui", "add")
391 );
392 $toolbar->addComponent($add_button);
393 }
394
395 // import appointments
396 if ($this->category_id > 0 && $this->actions->checkAddEvent($this->category_id)) {
397 if (!$extra_button_added) {
399 }
400 $add_button = $f->button()->standard(
401 $this->lng->txt("cal_import_appointments"),
402 $ctrl->getLinkTargetByClass("ilcalendarcategorygui", "importAppointments")
403 );
404 $toolbar->addComponent($add_button);
405 }
406 }
407
408 public function getNextClass(): string
409 {
410 if (strlen($next_class = $this->ctrl->getNextClass())) {
411 return $next_class;
412 }
413 if (
414 strcasecmp($this->ctrl->getCmdClass(), ilCalendarPresentationGUI::class) === 0 ||
415 $this->ctrl->getCmdClass() == ''
416 ) {
417 $cmd_class = $this->readLastClass();
418 $this->ctrl->setCmdClass($cmd_class);
419 return $cmd_class;
420 }
421 return '';
422 }
423
427 public function readLastClass(): string
428 {
430 switch ($this->cal_view) {
432 $class = "ilcalendardaygui";
433 break;
435 $class = "ilcalendarweekgui";
436 break;
438 $class = "ilcalendarmonthgui";
439 break;
441 default:
442 $class = "ilcalendarinboxgui";
443 break;
444 }
445
446 // see #34998, if cal_view is requested (e.g. through starting point)
447 // it must get high prio than history entry
448 $user_pref = $this->user->getPref('cal_last_class');
449 $use_pref = $user_pref && ($user_pref !== "") && !$this->http->wrapper()->query()->has('cal_view');
450
451 return $use_pref ? $user_pref : $class;
452 }
453
454 public function setCmdClass($a_class): void
455 {
456 // If cmd class == 'ilcalendarpresentationgui' the cmd class is set to the the new forwarded class
457 // otherwise e.g ilcalendarmonthgui tries to forward (back) to ilcalendargui.
458 if ($this->ctrl->getCmdClass() == strtolower(get_class($this))) {
459 $this->ctrl->setCmdClass(strtolower($a_class));
460 }
461 }
462
463 protected function forwardToClass(string $a_class): ?ilCalendarViewGUI
464 {
466 switch ($a_class) {
467 case 'ilcalendarmonthgui':
468 $this->user->writePref('cal_last_class', $a_class);
469 ilSession::set('cal_last_tab', 'app_month');
470 $this->setCmdClass('ilcalendarmonthgui');
471 $month_gui = new ilCalendarMonthGUI($this->seed);
472 $this->ctrl->forwardCommand($month_gui);
473 return $month_gui;
474
475 case 'ilcalendarweekgui':
476 $this->user->writePref('cal_last_class', $a_class);
477 ilSession::set('cal_last_tab', 'app_week');
478 $this->setCmdClass('ilcalendarweekgui');
479 $week_gui = new ilCalendarWeekGUI($this->seed);
480 $this->ctrl->forwardCommand($week_gui);
481 return $week_gui;
482
483 case 'ilcalendardaygui':
484 $this->user->writePref('cal_last_class', $a_class);
485 ilSession::set('cal_last_tab', 'app_day');
486 $this->setCmdClass('ilcalendardaygui');
487 $day_gui = new ilCalendarDayGUI($this->seed);
488 $this->ctrl->forwardCommand($day_gui);
489 return $day_gui;
490
491 case 'ilcalendarinboxgui':
492 $this->user->writePref('cal_last_class', $a_class);
493 ilSession::set('cal_last_tab', 'cal_upcoming_events_header');
494 $this->setCmdClass('ilcalendarinboxgui');
495 $inbox_gui = new ilCalendarInboxGUI($this->seed);
496 $this->ctrl->forwardCommand($inbox_gui);
497 return $inbox_gui;
498 }
499 return null;
500 }
501
502 protected function showSideBlocks(): void
503 {
504 $tpl = new ilTemplate('tpl.cal_side_block.html', true, true, 'Services/Calendar');
505 if ($this->getRepositoryMode()) {
506 $side_cal = new ilCalendarBlockGUI();
507 } else {
508 $side_cal = new ilPDCalendarBlockGUI();
509 }
510 $side_cal->setParentGUI("ilCalendarPresentationGUI");
511 $side_cal->setForceMonthView(true);
512 $side_cal->setRepositoryMode($this->getRepositoryMode());
513 $tpl->setVariable('MINICAL', $this->ctrl->getHTML($side_cal));
514
515 $cat = new ilCalendarCategoryGUI($this->user->getId(), $this->seed, $this->ref_id);
516 $tpl->setVariable('CATEGORIES', $this->ctrl->getHTML($cat));
517
518 $this->tpl->setRightContent($tpl->get());
519 }
520
525 protected function addCategoryTabs(): void
526 {
528 $this->tabs_gui->clearTargets();
529 $ctrl->setParameterByClass(ilCalendarCategoryGUI::class, "category_id", $this->initCategoryIdFromQuery());
530 if ($this->getRepositoryMode()) {
531 if ($this->http->wrapper()->query()->has('backpd')) {
532 $this->tabs_gui->setBack2Target(
533 $this->lng->txt('back_to_pd'),
534 $this->ctrl->getLinkTargetByClass(ilDashboardGUI::class, 'jumpToCalendar')
535 );
536 }
537 $label = $this->lng->txt('back_to_' . ilObject::_lookupType($this->ref_id, true));
538 $this->tabs_gui->setBackTarget(
539 $label,
540 $this->ctrl->getParentReturn($this)
541 );
542 } elseif ($this->http->wrapper()->query()->has('backvm')) {
543
544 // no object calendar => back is back to manage view
545 $this->tabs_gui->setBackTarget(
546 $this->lng->txt("back"),
547 $ctrl->getLinkTargetByClass(ilCalendarCategoryGUI::class, 'manage')
548 );
549 } else {
550 $ctrl->clearParameterByClass(ilCalendarPresentationGUI::class, 'category_id');
551 $this->tabs_gui->setBackTarget(
552 $this->lng->txt("back"),
553 $ctrl->getLinkTargetByClass('ilcalendarpresentationgui', '')
554 );
555 $ctrl->setParameterByClass(ilCalendarPresentationGUI::class, "category_id", $this->initCategoryIdFromQuery());
556 }
557
558 $this->tabs_gui->addTab(
559 "cal_agenda",
560 $this->lng->txt("cal_agenda"),
561 $ctrl->getLinkTargetByClass(ilCalendarPresentationGUI::class, "")
562 );
563
564 if ($this->actions->checkShareCal($this->category_id)) {
565 $this->tabs_gui->addTab(
566 "share",
567 $this->lng->txt("cal_share"),
568 $ctrl->getLinkTargetByClass(ilCalendarCategoryGUI::class, "shareSearch")
569 );
570 }
571 if ($this->actions->checkSettingsCal($this->category_id)) {
572 $ctrl->setParameterByClass(ilCalendarCategoryGUI::class, 'category_id', $this->category_id);
573 $this->tabs_gui->addTab(
574 "edit",
575 $this->lng->txt("settings"),
576 $ctrl->getLinkTargetByClass(ilCalendarCategoryGUI::class, "edit")
577 );
578 $ctrl->clearParameterByClass(ilCalendarCategoryGUI::class, 'category_id');
579 }
580 $this->tabs_gui->activateTab('cal_agenda');
581 }
582
586 protected function addStandardTabs(): void
587 {
590
591 $this->tabs_gui->clearTargets();
592 if ($this->getRepositoryMode()) {
593 if ($this->http->wrapper()->query()->has('backpd')) {
594 $this->tabs_gui->setBack2Target(
595 $this->lng->txt('back_to_pd'),
596 $this->ctrl->getLinkTargetByClass(ilDashboardGUI::class, 'jumpToCalendar')
597 );
598 }
599 $label = $this->lng->txt('back_to_' . ilObject::_lookupType($this->ref_id, true));
600 $this->tabs_gui->setBackTarget(
601 $label,
602 $this->ctrl->getParentReturn($this)
603 );
604
605 $obj_id = ilObject::_lookupObjId($this->ref_id);
606 $category = ilCalendarCategory::_getInstanceByObjId($obj_id);
607 $category_id = $category->getCategoryID();
608
609 // agenda tab
610 $this->tabs_gui->addTab(
611 'cal_agenda',
612 $this->lng->txt('cal_agenda'),
613 $this->ctrl->getLinkTarget($this, '')
614 );
615
616 // settings tab
617 if ($access->checkAccess('edit_event', '', $this->ref_id)) {
618 $this->ctrl->setParameterByClass(ilCalendarCategoryGUI::class, 'category_id', $category_id);
619 $this->tabs_gui->addTab(
620 'cal_manage',
621 $this->lng->txt('settings'),
622 $this->ctrl->getLinkTargetByClass(ilCalendarCategoryGUI::class, 'edit')
623 );
624 $this->ctrl->clearParameterByClass(ilCalendarCategoryGUI::class, 'category_id');
625 }
626 } else {
627 $this->tabs_gui->addTab(
628 'cal_agenda',
629 $this->lng->txt("cal_agenda"),
630 $this->ctrl->getLinkTarget($this, '')
631 );
632
633 if (
634 $this->rbacsystem->checkAccess(
635 'add_consultation_hours',
636 ilCalendarSettings::_getInstance()->getCalendarSettingsId()
637 ) &&
638 ilCalendarSettings::_getInstance()->areConsultationHoursEnabled()
639 ) {
640 $this->tabs_gui->addTab(
641 'app_consultation_hours',
642 $this->lng->txt('app_consultation_hours'),
643 $this->ctrl->getLinkTargetByClass(ilConsultationHoursGUI::class, '')
644 );
645 }
646 $this->tabs_gui->addTarget(
647 'cal_manage',
648 $this->ctrl->getLinkTargetByClass('ilCalendarCategoryGUI', 'manage')
649 );
650 $this->tabs_gui->addTarget('settings', $this->ctrl->getLinkTargetByClass('ilCalendarUserSettingsGUI', ''));
651 }
652 }
653
654 protected function prepareOutput(): void
655 {
656 if ($this->category_id) {
657 $this->addCategoryTabs();
658 } else {
659 $this->addStandardTabs();
660 }
661
662 // if we are in single calendar view
663 if ($this->category_id > 0) {
664 $tabs = $this->tabs_gui;
668
669 $category = new ilCalendarCategory($this->category_id);
670
671 // Set header
672 $header = "";
673 switch ($category->getType()) {
675 $header = $this->lng->txt('cal_type_personal') . ": " . $category->getTitle();
676 break;
677
679 $header = $this->lng->txt('cal_type_system') . ": " . $category->getTitle();
680 break;
681
683 $header = $this->lng->txt('cal_type_' . $category->getObjType()) . ": " . $category->getTitle();
684 break;
685
687 $header = str_replace(
688 "%1",
689 ilObjUser::_lookupFullname($category->getObjId()),
690 $this->lng->txt("cal_consultation_hours_for_user")
691 );
692 break;
693
695 $header = $category->getTitle();
696 break;
697 }
698 $tpl->setTitleIcon(ilUtil::getImagePath("icon_cal.svg"));
699 $tpl->setTitle($header);
700
701 $action_menu = new ilAdvancedSelectionListGUI();
702 $action_menu->setAsynch(false);
703 $action_menu->setAsynchUrl('');
704 $action_menu->setListTitle($this->lng->txt('actions'));
705 $action_menu->setId('act_cal');
706 $action_menu->setSelectionHeaderClass('small');
707 $action_menu->setItemLinkClass('xsmall');
708 $action_menu->setLinksMode('il_ContainerItemCommand2');
709 $action_menu->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_DARK);
710 $action_menu->setUseImages(false);
711
712 // iCal-Url
713 $ctrl->setParameterByClass("ilcalendarsubscriptiongui", "category_id", $this->category_id);
714 $action_menu->addItem(
715 $this->lng->txt("cal_ical_url"),
716 "",
717 $ctrl->getLinkTargetByClass("ilcalendarsubscriptiongui", "")
718 );
719
720 // delete action
721 if ($this->actions->checkDeleteCal($this->category_id)) {
722 $ctrl->setParameterByClass("ilcalendarcategorygui", "category_id", $this->category_id);
723 $action_menu->addItem(
724 $this->lng->txt("cal_delete_cal"),
725 "",
726 $ctrl->getLinkTargetByClass("ilcalendarcategorygui", "confirmDelete")
727 );
728 }
729 $tpl->setHeaderActionMenu($action_menu->getHTML());
730 }
731 }
732
733 protected function getRequestedSeedAsString(): string
734 {
735 $seed = '';
736 if ($this->http->wrapper()->query()->has('seed')) {
737 $seed = $this->http->wrapper()->query()->retrieve(
738 'seed',
739 $this->refinery->kindlyTo()->string()
740 );
741 }
742 return $seed;
743 }
744
748 public function initSeed(): void
749 {
751
752 // default to today
753 $now = new \ilDate(time(), IL_CAL_UNIX);
754 $this->seed = new \ilDate($now->get(IL_CAL_DATE), IL_CAL_DATE);
755 if ($seed) {
756 $this->seed = new ilDate($seed, IL_CAL_DATE);
757 } elseif (!$this->getRepositoryMode()) {
758 $session_seed = ilSession::get('cal_seed');
759 if ($session_seed) {
760 $this->seed = new ilDate($session_seed, IL_CAL_DATE);
761 }
762 }
763 $this->ctrl->setParameter($this, 'seed', $this->seed->get(IL_CAL_DATE));
764 ilSession::set('cal_seed', $this->seed->get(IL_CAL_DATE));
765 }
766
767
768 #21613
769 public function showToolbarAndSidebar(): bool
770 {
771 #21783
772 return !(
773 $this->ctrl->getCmdClass() == "ilcalendarappointmentgui" ||
774 $this->ctrl->getCmdClass() == 'ilconsultationhoursgui'
775 );
776 }
777}
Builds data types.
Definition: Factory.php:21
Class Services.
Definition: Services.php:38
const IL_CAL_DATE
const IL_CAL_UNIX
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance()
Get instance.
Administrate calendar appointments.
Calendar blocks, displayed in different contexts, e.g.
class for calendar categories
initialize(int $a_mode, int $a_source_ref_id=0, bool $a_use_cache=false, int $a_cat_id=0)
initialize visible categories
static _getInstance($a_usr_id=0)
get singleton instance
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Stores calendar categories.
static _getInstanceByObjId(int $a_obj_id)
get instance by obj_id
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addCategoryTabs()
Add tabs for ilCategoryGUI context This cannot be done there since many views (Day Week Agenda) are i...
showViewSelection(string $a_active="cal_list")
initSeed()
init the seed date for presentations (month view, minicalendar)
initCalendarView()
Initialises calendar view according to given settings.
readLastClass()
Read last class from history.
initAndRedirectToConsultationHours()
Init and redirect to consultation hours.
Stores all calendar relevant settings.
Show calendar subscription info.
static _getInstanceByUserId(int $a_user_id, int $a_ref_id=0)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class for single dates.
Help GUI class.
language handling
User class.
static _lookupFullname(int $a_user_id)
static _lookupType(int $id, bool $reference=false)
static _lookupObjId(int $ref_id)
Calendar blocks, displayed on personal desktop.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
static get(string $a_var)
static set(string $a_var, $a_val)
Set a value.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
special template class to simplify handling of ITX/PEAR
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addComponent(\ILIAS\UI\Component\Component $a_comp)
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static redirect(string $a_script)
$app
Definition: cli.php:39
global $DIC
Definition: feed.php:28
$ilUser
Definition: imgupload.php:34
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getLinkTargetByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
Returns a link target for the given information.
clearParameterByClass(string $a_class, string $a_parameter)
Removes a specific parameter of a specific class that is currently set or saved.
setParameterByClass(string $a_class, string $a_parameter, $a_value)
Sets a parameter for the given GUI class and appends the given value as well.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTitleIcon(string $a_icon_path, string $a_icon_desc="")
set title icon
setHeaderActionMenu(string $a_header)
Set header action menu.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
setTitle(string $a_title, bool $hidden=false)
Sets title in standard template.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
checkAccess(string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=null, ?int $a_tree_id=null)
check access for an object (provide $a_type and $a_obj_id if available for better performance)
static http()
Fetches the global http state from ILIAS.