ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilCalendarPresentationGUI Class Reference
+ Collaboration diagram for ilCalendarPresentationGUI:

Public Member Functions

 __construct ($a_ref_id=0)
 
 getRepositoryMode ()
 
 executeCommand ()
 
 showViewSelection (string $a_active="cal_list")
 
 getNextClass ()
 
 readLastClass ()
 Read last class from history. More...
 
 setCmdClass ($a_class)
 
 initSeed ()
 init the seed date for presentations (month view, minicalendar) More...
 
 showToolbarAndSidebar ()
 

Protected Member Functions

 initAppointmentIdFromQuery ()
 
 initCategoryIdFromQuery ()
 
 initAndRedirectToConsultationHours ()
 Init and redirect to consultation hours. More...
 
 initCalendarView ()
 Initialises calendar view according to given settings. More...
 
 redirectWithParameters (string $class)
 
 forwardToClass (string $a_class)
 
 showSideBlocks ()
 
 addCategoryTabs ()
 Add tabs for ilCategoryGUI context This cannot be done there since many views (Day Week Agenda) are initiated from these view. More...
 
 addStandardTabs ()
 add standard tabs More...
 
 prepareOutput ()
 
 getRequestedSeedAsString ()
 

Protected Attributes

ilCtrlInterface $ctrl
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ilTabsGUI $tabs_gui
 
ilObjUser $user
 
ilHelpGUI $help
 
ilRbacSystem $rbacsystem
 
ILIAS DI UIServices $ui
 
ilToolbarGUI $toolbar
 
ilAccessHandler $access
 
HttpServices $http
 
RefineryFactory $refinery
 
ilCalendarSettings $cal_settings
 
ilCalendarActions $actions
 
ilCalendarCategories $cats
 
bool $repository_mode = false
 
int $ref_id = 0
 
int $category_id = 0
 
ilDate $seed = null
 
int $cal_view = 0
 
int $cal_period = 0
 

Private Attributes

UIRenderer $renderer
 
UIFactory $ui_factory
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCalendarPresentationGUI::__construct (   $a_ref_id = 0)

Definition at line 65 of file class.ilCalendarPresentationGUI.php.

66 {
67 global $DIC;
68
69 $this->ctrl = $DIC->ctrl();
70 $this->lng = $DIC->language();
71 $this->lng->loadLanguageModule('dateplaner');
72
73 $this->renderer = $DIC->ui()->renderer();
74 $this->ui_factory = $DIC->ui()->factory();
75
76 $this->http = $DIC->http();
77 $this->refinery = $DIC->refinery();
78 $this->tpl = $DIC->ui()->mainTemplate();
79 $this->tabs_gui = $DIC->tabs();
80 $this->user = $DIC->user();
81 $this->rbacsystem = $DIC->rbac()->system();
82 $this->access = $DIC->access();
83 $this->help = $DIC["ilHelp"];
84 $this->ui = $DIC->ui();
85 $this->toolbar = $DIC->toolbar();
86 $this->ref_id = $a_ref_id;
87 $this->category_id = 0;
88 if ($this->http->wrapper()->query()->has('category_id')) {
89 $this->category_id = $this->http->wrapper()->query()->retrieve(
90 'category_id',
91 $this->refinery->kindlyTo()->int()
92 );
93 }
94
95 $this->repository_mode = $a_ref_id > 0;
96 if ($this->repository_mode && $this->category_id === 0) {
97 $obj_id = ilObject::_lookupObjId($this->ref_id);
98 $category = ilCalendarCategory::_getInstanceByObjId($obj_id);
99 $this->category_id = is_null($category) ? 0 : $category->getCategoryID();
100 }
101 $this->ctrl->setParameter($this, 'category_id', $this->category_id);
102 $this->cal_settings = ilCalendarSettings::_getInstance();
103
104 // show back to pd
105 $this->ctrl->saveParameter($this, 'backpd');
106
107 $this->initCalendarView();
109
110 if ($this->category_id > 0 && $this->ref_id <= 0) { // single calendar view
111 // ensure activation of this category
112 $vis = ilCalendarVisibility::_getInstanceByUserId($this->user->getId(), $a_ref_id);
113 $vis->forceVisibility($this->category_id);
114
115 $cats->initialize(ilCalendarCategories::MODE_SINGLE_CALENDAR, 0, false, $this->category_id);
116 } elseif ($a_ref_id > 0) {
120 } else {
122 }
123
124 $this->actions = ilCalendarActions::getInstance();
125 $this->cats = $cats;
126 }
renderer()
static getInstance()
Get instance.
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
static _getInstanceByObjId(int $a_obj_id)
get instance by obj_id
initCalendarView()
Initialises calendar view according to given settings.
static _getInstanceByUserId(int $a_user_id, int $a_ref_id=0)
static _lookupObjId(int $ref_id)
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26

References $cats, $DIC, ilCalendarCategories\_getInstance(), ilCalendarSettings\_getInstance(), ilCalendarUserSettings\_getInstance(), ilCalendarCategory\_getInstanceByObjId(), ilCalendarVisibility\_getInstanceByUserId(), ilObject\_lookupObjId(), ILIAS\Repository\access(), ilCalendarUserSettings\CAL_SELECTION_MEMBERSHIP, ILIAS\Repository\ctrl(), ilCalendarActions\getInstance(), ILIAS\Repository\help(), ILIAS\FileDelivery\http(), initCalendarView(), ilCalendarCategories\initialize(), ILIAS\Repository\lng(), ilCalendarCategories\MODE_PERSONAL_DESKTOP_ITEMS, ilCalendarCategories\MODE_PERSONAL_DESKTOP_MEMBERSHIP, ilCalendarCategories\MODE_REPOSITORY, ilCalendarCategories\MODE_SINGLE_CALENDAR, ILIAS\Repository\refinery(), renderer(), ILIAS\Repository\toolbar(), ILIAS\Repository\ui(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ addCategoryTabs()

ilCalendarPresentationGUI::addCategoryTabs ( )
protected

Add tabs for ilCategoryGUI context This cannot be done there since many views (Day Week Agenda) are initiated from these view.

Definition at line 549 of file class.ilCalendarPresentationGUI.php.

549 : void
550 {
552 $this->tabs_gui->clearTargets();
553 $ctrl->setParameterByClass(ilCalendarCategoryGUI::class, "category_id", $this->initCategoryIdFromQuery());
554 if ($this->getRepositoryMode()) {
555 if ($this->http->wrapper()->query()->has('backpd')) {
556 $this->tabs_gui->setBack2Target(
557 $this->lng->txt('back_to_pd'),
558 $this->ctrl->getLinkTargetByClass(ilDashboardGUI::class, 'jumpToCalendar')
559 );
560 }
561 $label = $this->lng->txt('back_to_' . ilObject::_lookupType($this->ref_id, true));
562 $this->tabs_gui->setBackTarget(
563 $label,
564 $this->ctrl->getParentReturn($this)
565 );
566 } elseif ($this->http->wrapper()->query()->has('backvm')) {
567 // no object calendar => back is back to manage view
568 $this->tabs_gui->setBackTarget(
569 $this->lng->txt("back"),
570 $ctrl->getLinkTargetByClass(ilCalendarCategoryGUI::class, 'manage')
571 );
572 } else {
573 $ctrl->clearParameterByClass(ilCalendarPresentationGUI::class, 'category_id');
574 $this->tabs_gui->setBackTarget(
575 $this->lng->txt("back"),
576 $ctrl->getLinkTargetByClass('ilcalendarpresentationgui', '')
577 );
578 $ctrl->setParameterByClass(ilCalendarPresentationGUI::class, "category_id", $this->initCategoryIdFromQuery());
579 }
580
581 $this->tabs_gui->addTab(
582 "cal_agenda",
583 $this->lng->txt("cal_agenda"),
584 $ctrl->getLinkTargetByClass(ilCalendarPresentationGUI::class, "")
585 );
586
587 if ($this->actions->checkShareCal($this->category_id)) {
588 $this->tabs_gui->addTab(
589 "share",
590 $this->lng->txt("cal_share"),
591 $ctrl->getLinkTargetByClass(ilCalendarCategoryGUI::class, "shareSearch")
592 );
593 }
594 if ($this->actions->checkSettingsCal($this->category_id)) {
595 $ctrl->setParameterByClass(ilCalendarCategoryGUI::class, 'category_id', $this->category_id);
596 $this->tabs_gui->addTab(
597 "edit",
598 $this->lng->txt("settings"),
599 $ctrl->getLinkTargetByClass(ilCalendarCategoryGUI::class, "edit")
600 );
601 $ctrl->clearParameterByClass(ilCalendarCategoryGUI::class, 'category_id');
602 }
603 $this->tabs_gui->activateTab('cal_agenda');
604 }
static _lookupType(int $id, bool $reference=false)
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.
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.

References $ctrl, ilObject\_lookupType(), ilCtrlInterface\clearParameterByClass(), ILIAS\Repository\ctrl(), ilCtrlInterface\getLinkTargetByClass(), getRepositoryMode(), ILIAS\FileDelivery\http(), initCategoryIdFromQuery(), ILIAS\Repository\lng(), and ilCtrlInterface\setParameterByClass().

Referenced by prepareOutput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addStandardTabs()

ilCalendarPresentationGUI::addStandardTabs ( )
protected

add standard tabs

Definition at line 609 of file class.ilCalendarPresentationGUI.php.

609 : void
610 {
613
614 $this->tabs_gui->clearTargets();
615 if ($this->getRepositoryMode()) {
616 if ($this->http->wrapper()->query()->has('backpd')) {
617 $this->tabs_gui->setBack2Target(
618 $this->lng->txt('back_to_pd'),
619 $this->ctrl->getLinkTargetByClass(ilDashboardGUI::class, 'jumpToCalendar')
620 );
621 }
622 $label = $this->lng->txt('back_to_' . ilObject::_lookupType($this->ref_id, true));
623 $this->tabs_gui->setBackTarget(
624 $label,
625 $this->ctrl->getParentReturn($this)
626 );
627
628 $obj_id = ilObject::_lookupObjId($this->ref_id);
629 $category = ilCalendarCategory::_getInstanceByObjId($obj_id);
630 $category_id = $category->getCategoryID();
631
632 // agenda tab
633 $this->tabs_gui->addTab(
634 'cal_agenda',
635 $this->lng->txt('cal_agenda'),
636 $this->ctrl->getLinkTarget($this, '')
637 );
638
639 // settings tab
640 if ($access->checkAccess('edit_event', '', $this->ref_id)) {
641 $this->ctrl->setParameterByClass(ilCalendarCategoryGUI::class, 'category_id', $category_id);
642 $this->tabs_gui->addTab(
643 'cal_manage',
644 $this->lng->txt('settings'),
645 $this->ctrl->getLinkTargetByClass(ilCalendarCategoryGUI::class, 'edit')
646 );
647 $this->ctrl->clearParameterByClass(ilCalendarCategoryGUI::class, 'category_id');
648 }
649 } else {
650 $this->tabs_gui->addTab(
651 'cal_agenda',
652 $this->lng->txt("cal_agenda"),
653 $this->ctrl->getLinkTarget($this, '')
654 );
655
656 if (
657 $this->rbacsystem->checkAccess(
658 'add_consultation_hours',
659 ilCalendarSettings::_getInstance()->getCalendarSettingsId()
660 ) &&
661 ilCalendarSettings::_getInstance()->areConsultationHoursEnabled()
662 ) {
663 $this->tabs_gui->addTab(
664 'app_consultation_hours',
665 $this->lng->txt('app_consultation_hours'),
666 $this->ctrl->getLinkTargetByClass(ilConsultationHoursGUI::class, '')
667 );
668 }
669 $this->tabs_gui->addTarget(
670 'cal_manage',
671 $this->ctrl->getLinkTargetByClass('ilCalendarCategoryGUI', 'manage')
672 );
673 $this->tabs_gui->addTarget('settings', $this->ctrl->getLinkTargetByClass('ilCalendarUserSettingsGUI', ''));
674 }
675 }
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)

References $access, $category_id, $rbacsystem, ilCalendarSettings\_getInstance(), ilCalendarCategory\_getInstanceByObjId(), ilObject\_lookupObjId(), ilObject\_lookupType(), ilRBACAccessHandler\checkAccess(), ILIAS\Repository\ctrl(), getRepositoryMode(), ILIAS\FileDelivery\http(), and ILIAS\Repository\lng().

Referenced by prepareOutput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilCalendarPresentationGUI::executeCommand ( )

Definition at line 203 of file class.ilCalendarPresentationGUI.php.

203 : void
204 {
205 $cmd = $this->ctrl->getCmd();
206
207 if (!ilCalendarSettings::_getInstance()->isEnabled()) {
208 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
209 ilUtil::redirect('ilias.php?baseClass=ilDashboardGUI');
210 }
211
212 $this->initSeed();
213 if (!$this->ctrl->isAsynch()) {
214 $this->prepareOutput();
215 }
216
217 $this->help->setScreenIdComponent("cal");
218 switch ($cmd) {
219 case 'selectCHCalendarOfUser':
221 break;
222 }
223
224 // now next class is not empty, which breaks old consultation hour implementation
225 $next_class = $this->getNextClass();
226
227 switch ($next_class) {
228 case 'ilcalendarinboxgui':
229 $this->tabs_gui->activateTab('cal_agenda');
230 $inbox_gui = $this->forwardToClass('ilcalendarinboxgui');
231 if ($this->showToolbarAndSidebar()) {
232 $this->showViewSelection("cal_list");
233 $this->showSideBlocks();
234 $inbox_gui->addToolbarFileDownload();
235 }
236
237 break;
238
239 case 'ilconsultationhoursgui':
240 $this->tabs_gui->activateTab('app_consultation_hours');
241 $this->tabs_gui->clearTargets();
242
243 // No side blocks
244 $this->tabs_gui->setBackTarget(
245 $this->lng->txt('cal_back_to_cal'),
246 $this->ctrl->getLinkTargetByClass($this->readLastClass())
247 );
248 $this->ctrl->forwardCommand(new ilConsultationHoursGUI());
249 if ($this->showToolbarAndSidebar()) {
250 $this->showSideBlocks();
251 }
252 return;
253
254 case 'ilcalendarmonthgui':
255 $this->tabs_gui->activateTab('cal_agenda');
256 $month_gui = $this->forwardToClass('ilcalendarmonthgui');
257
258 if ($this->showToolbarAndSidebar()) {
259 $this->showViewSelection("app_month");
260 $this->showSideBlocks();
261 $month_gui->addToolbarFileDownload();
262 }
263 break;
264
265 case 'ilcalendarweekgui':
266 $this->tabs_gui->activateTab('cal_agenda');
267 $week_gui = $this->forwardToClass('ilcalendarweekgui');
268 if ($this->showToolbarAndSidebar()) {
269 $this->showViewSelection("app_week");
270 $this->showSideBlocks();
271 $week_gui->addToolbarFileDownload();
272 }
273
274 break;
275
276 case 'ilcalendardaygui':
277 $this->tabs_gui->activateTab('cal_agenda');
278 $day_gui = $this->forwardToClass('ilcalendardaygui');
279 if ($this->showToolbarAndSidebar()) {
280 $this->showViewSelection("app_day");
281 $this->showSideBlocks();
282 $day_gui->addToolbarFileDownload();
283 }
284 break;
285
286 case 'ilcalendarusersettingsgui':
287 $this->ctrl->setReturn($this, '');
288 $this->tabs_gui->activateTab('settings');
289 $this->setCmdClass('ilcalendarusersettingsgui');
290
291 $user_settings = new ilCalendarUserSettingsGUI();
292 $this->ctrl->forwardCommand($user_settings);
293 // No side blocks
294 return;
295
296 case 'ilcalendarappointmentgui':
297 $this->ctrl->setReturn($this, '');
298 $this->tabs_gui->activateTab((string) ilSession::get('cal_last_tab'));
299
300 $app = new ilCalendarAppointmentGUI($this->seed, $this->seed, $this->initAppointmentIdFromQuery());
301 $this->ctrl->forwardCommand($app);
302 break;
303
304 case 'ilcalendarsubscriptiongui':
305 $this->ctrl->setReturn($this, '');
306 $this->tabs_gui->activateTab("cal_agenda");
307
308 $ref_id = 0;
309 if ($this->http->wrapper()->query()->has('ref_id')) {
310 $ref_id = $this->http->wrapper()->query()->retrieve(
311 'ref_id',
312 $this->refinery->kindlyTo()->int()
313 );
314 }
315 $sub = new ilCalendarSubscriptionGUI($this->category_id, $ref_id);
316 $this->ctrl->forwardCommand($sub);
317 if ($this->showToolbarAndSidebar()) {
318 $this->showSideBlocks();
319 }
320 break;
321
322 case 'ilcalendarcategorygui':
323 $this->ctrl->setReturn($this, '');
324 $this->tabs_gui->activateTab("cal_manage");
325 $category = new ilCalendarCategoryGUI($this->user->getId(), $this->seed, $this->ref_id);
326 if ($this->ctrl->forwardCommand($category)) {
327 return;
328 } else {
329 $this->showSideBlocks();
330 break;
331 }
332
333 // no break
334 case 'ilcalendarblockgui':
335 $side_cal = new ilCalendarBlockGUI();
336 $side_cal->setRepositoryMode($this->getRepositoryMode());
337 $side_cal->setForceMonthView(true);
338 $this->ctrl->forwardCommand($side_cal);
339 $this->showSideBlocks();
340 break;
341
342 case 'ilpdcalendarblockgui':
343 $side_cal = new ilPDCalendarBlockGUI();
344 $side_cal->setRepositoryMode($this->getRepositoryMode());
345 $side_cal->setForceMonthView(true);
346 $this->ctrl->forwardCommand($side_cal);
347 $this->showSideBlocks();
348 break;
349
350 case strtolower(PublicProfileGUI::class):
351 $user_id = $this->user->getId();
352 if ($this->http->wrapper()->query()->has('user_id')) {
353 $user_id = $this->http->wrapper()->query()->retrieve(
354 'user_id',
355 $this->refinery->kindlyTo()->int()
356 );
357 }
358 $user_profile = new PublicProfileGUI($user_id);
359 $html = $this->ctrl->forwardCommand($user_profile);
360 $this->tpl->setContent($html);
361 break;
362
363 default:
364 $cmd = $this->ctrl->getCmd("show");
365 $this->$cmd();
366 $this->showSideBlocks();
367 break;
368 }
369 }
GUI class for public user profile presentation.
Administrate calendar appointments.
Calendar blocks, displayed in different contexts, e.g.
Administration, Side-Block presentation of calendar categories.
showViewSelection(string $a_active="cal_list")
initSeed()
init the seed date for presentations (month view, minicalendar)
initAndRedirectToConsultationHours()
Init and redirect to consultation hours.
Show calendar subscription info.
Consultation hours editor.
Calendar blocks, displayed on personal desktop.
static get(string $a_var)
static redirect(string $a_script)

References $ref_id, $user_id, ilCalendarSettings\_getInstance(), ILIAS\Repository\ctrl(), forwardToClass(), ilSession\get(), getNextClass(), getRepositoryMode(), ILIAS\Repository\help(), ILIAS\FileDelivery\http(), initAndRedirectToConsultationHours(), initAppointmentIdFromQuery(), initSeed(), ILIAS\Repository\lng(), prepareOutput(), ilUtil\redirect(), ILIAS\Repository\refinery(), setCmdClass(), showSideBlocks(), showToolbarAndSidebar(), showViewSelection(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ forwardToClass()

ilCalendarPresentationGUI::forwardToClass ( string  $a_class)
protected

Definition at line 487 of file class.ilCalendarPresentationGUI.php.

488 {
489 $ilUser = $this->user;
490 switch ($a_class) {
491 case 'ilcalendarmonthgui':
492 $this->user->writePref('cal_last_class', $a_class);
493 ilSession::set('cal_last_tab', 'app_month');
494 $this->setCmdClass('ilcalendarmonthgui');
495 $month_gui = new ilCalendarMonthGUI($this->seed);
496 $this->ctrl->forwardCommand($month_gui);
497 return $month_gui;
498
499 case 'ilcalendarweekgui':
500 $this->user->writePref('cal_last_class', $a_class);
501 ilSession::set('cal_last_tab', 'app_week');
502 $this->setCmdClass('ilcalendarweekgui');
503 $week_gui = new ilCalendarWeekGUI($this->seed);
504 $this->ctrl->forwardCommand($week_gui);
505 return $week_gui;
506
507 case 'ilcalendardaygui':
508 $this->user->writePref('cal_last_class', $a_class);
509 ilSession::set('cal_last_tab', 'app_day');
510 $this->setCmdClass('ilcalendardaygui');
511 $day_gui = new ilCalendarDayGUI($this->seed);
512 $this->ctrl->forwardCommand($day_gui);
513 return $day_gui;
514
515 case 'ilcalendarinboxgui':
516 $this->user->writePref('cal_last_class', $a_class);
517 ilSession::set('cal_last_tab', 'cal_upcoming_events_header');
518 $this->setCmdClass('ilcalendarinboxgui');
519 $inbox_gui = new ilCalendarInboxGUI($this->seed);
520 $this->ctrl->forwardCommand($inbox_gui);
521 return $inbox_gui;
522 }
523 return null;
524 }
Presentation day view.
static set(string $a_var, $a_val)
Set a value.

References $user, ILIAS\Repository\ctrl(), ilSession\set(), setCmdClass(), and ILIAS\Repository\user().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNextClass()

ilCalendarPresentationGUI::getNextClass ( )

Definition at line 426 of file class.ilCalendarPresentationGUI.php.

426 : string
427 {
428 if (strlen($next_class = $this->ctrl->getNextClass())) {
429 return $next_class;
430 }
431 if (
432 strcasecmp($this->ctrl->getCmdClass(), ilCalendarPresentationGUI::class) === 0 ||
433 $this->ctrl->getCmdClass() == ''
434 ) {
435 $cmd_class = $this->readLastClass();
436 $this->redirectWithParameters($cmd_class);
437 return $cmd_class;
438 }
439 return '';
440 }
readLastClass()
Read last class from history.

References ILIAS\Repository\ctrl(), readLastClass(), and redirectWithParameters().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRepositoryMode()

ilCalendarPresentationGUI::getRepositoryMode ( )

Definition at line 128 of file class.ilCalendarPresentationGUI.php.

128 : bool
129 {
131 }

References $repository_mode.

Referenced by addCategoryTabs(), addStandardTabs(), executeCommand(), initSeed(), and showSideBlocks().

+ Here is the caller graph for this function:

◆ getRequestedSeedAsString()

ilCalendarPresentationGUI::getRequestedSeedAsString ( )
protected

Definition at line 750 of file class.ilCalendarPresentationGUI.php.

750 : string
751 {
752 $seed = '';
753 if ($this->http->wrapper()->query()->has('seed')) {
754 $seed = $this->http->wrapper()->query()->retrieve(
755 'seed',
756 $this->refinery->kindlyTo()->string()
757 );
758 }
759 return $seed;
760 }

References $seed, ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by initAndRedirectToConsultationHours(), and initSeed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initAndRedirectToConsultationHours()

ilCalendarPresentationGUI::initAndRedirectToConsultationHours ( )
protected

Init and redirect to consultation hours.

Definition at line 159 of file class.ilCalendarPresentationGUI.php.

159 : void
160 {
161 $ch_user_id = 0;
162 if ($this->http->wrapper()->query()->has('ch_user_id')) {
163 $ch_user_id = $this->http->wrapper()->query()->retrieve(
164 'ch_user_id',
165 $this->refinery->kindlyTo()->int()
166 );
167 }
168 $visibility = ilCalendarVisibility::_getInstanceByUserId($this->user->getId(), $this->ref_id);
169 foreach ($this->cats->getCategoriesInfo() as $info) {
170 if (
172 $info["obj_id"] == $ch_user_id
173 ) {
174 $v = $visibility->getVisible();
175 if (!in_array($info["cat_id"], $v)) {
176 $v[] = $info["cat_id"];
177 }
178 $visibility->showSelected($v);
179 $visibility->save();
180 $this->ctrl->setParameterByClass(ilCalendarMonthGUI::class, 'category_id', $info['cat_id']);
181 $this->ctrl->setParameterByClass(\ilCalendarMonthGUI::class, 'seed', $this->getRequestedSeedAsString());
182 }
183 }
184 $this->ctrl->redirectToURL(
185 $this->ctrl->getLinkTargetByClass(\ilCalendarMonthGUI::class, '')
186 );
187 }
$info
Definition: entry_point.php:21

References $info, ilCalendarVisibility\_getInstanceByUserId(), ILIAS\Repository\ctrl(), getRequestedSeedAsString(), ILIAS\FileDelivery\http(), ILIAS\Repository\refinery(), ilCalendarCategory\TYPE_CH, and ILIAS\Repository\user().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initAppointmentIdFromQuery()

ilCalendarPresentationGUI::initAppointmentIdFromQuery ( )
protected

Definition at line 133 of file class.ilCalendarPresentationGUI.php.

133 : int
134 {
135 if ($this->http->wrapper()->query()->has('app_id')) {
136 return $this->http->wrapper()->query()->retrieve(
137 'app_id',
138 $this->refinery->kindlyTo()->int()
139 );
140 }
141 return 0;
142 }

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initCalendarView()

ilCalendarPresentationGUI::initCalendarView ( )
protected

Initialises calendar view according to given settings.

Definition at line 192 of file class.ilCalendarPresentationGUI.php.

192 : void
193 {
194 $this->cal_view = $this->cal_settings->getDefaultCal();
195 if ($this->http->wrapper()->query()->has('cal_view')) {
196 $this->cal_view = $this->http->wrapper()->query()->retrieve(
197 'cal_view',
198 $this->refinery->kindlyTo()->int()
199 );
200 }
201 }

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initCategoryIdFromQuery()

ilCalendarPresentationGUI::initCategoryIdFromQuery ( )
protected

Definition at line 144 of file class.ilCalendarPresentationGUI.php.

144 : int
145 {
146 if ($this->http->wrapper()->query()->has('category_id')) {
147 return $this->http->wrapper()->query()->retrieve(
148 'category_id',
149 $this->refinery->kindlyTo()->int()
150 );
151 }
152 return 0;
153 }

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by addCategoryTabs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initSeed()

ilCalendarPresentationGUI::initSeed ( )

init the seed date for presentations (month view, minicalendar)

Definition at line 765 of file class.ilCalendarPresentationGUI.php.

765 : void
766 {
768
769 // default to today
770 $now = new \ilDate(time(), IL_CAL_UNIX);
771 $this->seed = new \ilDate($now->get(IL_CAL_DATE), IL_CAL_DATE);
772 if ($seed) {
773 $this->seed = new ilDate($seed, IL_CAL_DATE);
774 } elseif (!$this->getRepositoryMode()) {
775 $session_seed = ilSession::get('cal_seed');
776 if ($session_seed) {
777 $this->seed = new ilDate($session_seed, IL_CAL_DATE);
778 }
779 }
780 $this->ctrl->setParameter($this, 'seed', $this->seed->get(IL_CAL_DATE));
781 ilSession::set('cal_seed', $this->seed->get(IL_CAL_DATE));
782 }
const IL_CAL_DATE
const IL_CAL_UNIX
Class for single dates.

References $seed, ILIAS\Repository\ctrl(), ilSession\get(), getRepositoryMode(), getRequestedSeedAsString(), IL_CAL_DATE, IL_CAL_UNIX, and ilSession\set().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareOutput()

ilCalendarPresentationGUI::prepareOutput ( )
protected

Definition at line 677 of file class.ilCalendarPresentationGUI.php.

677 : void
678 {
679 if ($this->category_id) {
680 $this->addCategoryTabs();
681 } else {
682 $this->addStandardTabs();
683 }
684
685 // #0035566
686 $this->tpl->setTitleIcon(ilUtil::getImagePath("standard/icon_cal.svg"));
687
688 // if we are in single calendar view
689 if ($this->category_id > 0) {
690 $tabs = $this->tabs_gui;
694
695 $category = new ilCalendarCategory($this->category_id);
696
697 // Set header
698 $header = "";
699 switch ($category->getType()) {
701 $header = $this->lng->txt('cal_type_personal') . ": " . $category->getTitle();
702 break;
703
705 $header = $this->lng->txt('cal_type_system') . ": " . $category->getTitle();
706 break;
707
709 $header = $this->lng->txt('cal_type_' . $category->getObjType()) . ": " . $category->getTitle();
710 break;
711
713 $header = str_replace(
714 "%1",
715 ilObjUser::_lookupFullname($category->getObjId()),
716 $this->lng->txt("cal_consultation_hours_for_user")
717 );
718 break;
719
721 $header = $category->getTitle();
722 break;
723 }
724 $tpl->setTitleIcon(ilUtil::getImagePath("standard/icon_cal.svg"));
725 $tpl->setTitle($header);
726
727 $dropDownItems = array();
728
729 // iCal-Url
730 $ctrl->setParameterByClass("ilcalendarsubscriptiongui", "category_id", $this->category_id);
731 $dropDownItems[] = $this->ui_factory->button()->shy(
732 $this->lng->txt("cal_ical_url"),
733 $ctrl->getLinkTargetByClass("ilcalendarsubscriptiongui", "")
734 );
735
736 // delete action
737 if ($this->actions->checkDeleteCal($this->category_id)) {
738 $ctrl->setParameterByClass("ilcalendarcategorygui", "category_id", $this->category_id);
739 $dropDownItems[] = $this->ui_factory->button()->shy(
740 $this->lng->txt("cal_delete_cal"),
741 $ctrl->getLinkTargetByClass("ilcalendarcategorygui", "confirmDelete")
742 );
743 }
744 $dropDown = $this->ui_factory->dropdown()->standard($dropDownItems)
745 ->withAriaLabel($this->lng->txt('actions'));
746 $tpl->setHeaderActionMenu($this->renderer->render($dropDown));
747 }
748 }
Stores calendar categories.
addCategoryTabs()
Add tabs for ilCategoryGUI context This cannot be done there since many views (Day Week Agenda) are i...
static _lookupFullname(int $a_user_id)
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
setTitle(string $a_title, bool $hidden=false)
Sets title in standard template.
setTitleIcon(string $a_icon_path, string $a_icon_desc="")
set title icon
setHeaderActionMenu(string $a_header)
Set header action menu.

References $ctrl, $lng, $tabs_gui, $tpl, ilObjUser\_lookupFullname(), addCategoryTabs(), addStandardTabs(), ilUtil\getImagePath(), ilCtrlInterface\getLinkTargetByClass(), ILIAS\Repository\lng(), renderer(), ILIAS\UICore\GlobalTemplate\setHeaderActionMenu(), ilCtrlInterface\setParameterByClass(), ILIAS\UICore\GlobalTemplate\setTitle(), ILIAS\UICore\GlobalTemplate\setTitleIcon(), ilCalendarCategory\TYPE_BOOK, ilCalendarCategory\TYPE_CH, ilCalendarCategory\TYPE_GLOBAL, ilCalendarCategory\TYPE_OBJ, and ilCalendarCategory\TYPE_USR.

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readLastClass()

ilCalendarPresentationGUI::readLastClass ( )

Read last class from history.

Definition at line 445 of file class.ilCalendarPresentationGUI.php.

445 : string
446 {
447 $ilUser = $this->user;
448 switch ($this->cal_view) {
450 $class = "ilcalendardaygui";
451 break;
453 $class = "ilcalendarweekgui";
454 break;
456 $class = "ilcalendarmonthgui";
457 break;
459 default:
460 $class = "ilcalendarinboxgui";
461 break;
462 }
463
464 // see #34998, if cal_view is requested (e.g. through starting point)
465 // it must get high prio than history entry
466 $user_pref = $this->user->getPref('cal_last_class');
467 $use_pref = $user_pref && ($user_pref !== "") && !$this->http->wrapper()->query()->has('cal_view');
468
469 return $use_pref ? $user_pref : $class;
470 }

References $user, ilCalendarSettings\DEFAULT_CAL_DAY, ilCalendarSettings\DEFAULT_CAL_LIST, ilCalendarSettings\DEFAULT_CAL_MONTH, ilCalendarSettings\DEFAULT_CAL_WEEK, ILIAS\FileDelivery\http(), and ILIAS\Repository\user().

Referenced by getNextClass().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redirectWithParameters()

ilCalendarPresentationGUI::redirectWithParameters ( string  $class)
protected

Definition at line 481 of file class.ilCalendarPresentationGUI.php.

481 : void
482 {
483 $this->ctrl->saveParameter($this, 'seed');
484 $this->ctrl->redirectByClass($class);
485 }

References ILIAS\Repository\ctrl().

Referenced by getNextClass(), and setCmdClass().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCmdClass()

ilCalendarPresentationGUI::setCmdClass (   $a_class)

Definition at line 472 of file class.ilCalendarPresentationGUI.php.

472 : void
473 {
474 // If cmd class == 'ilcalendarpresentationgui' the cmd class is set to the the new forwarded class
475 // otherwise e.g ilcalendarmonthgui tries to forward (back) to ilcalendargui.
476 if ($this->ctrl->getCmdClass() == strtolower(get_class($this))) {
477 $this->redirectWithParameters($a_class);
478 }
479 }

References ILIAS\Repository\ctrl(), and redirectWithParameters().

Referenced by executeCommand(), and forwardToClass().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showSideBlocks()

ilCalendarPresentationGUI::showSideBlocks ( )
protected

Definition at line 526 of file class.ilCalendarPresentationGUI.php.

526 : void
527 {
528 $tpl = new ilTemplate('tpl.cal_side_block.html', true, true, 'components/ILIAS/Calendar');
529 if ($this->getRepositoryMode()) {
530 $side_cal = new ilCalendarBlockGUI();
531 } else {
532 $side_cal = new ilPDCalendarBlockGUI();
533 }
534 $side_cal->setParentGUI("ilCalendarPresentationGUI");
535 $side_cal->setForceMonthView(true);
536 $side_cal->setRepositoryMode($this->getRepositoryMode());
537 $tpl->setVariable('MINICAL', $this->ctrl->getHTML($side_cal));
538
539 $cat = new ilCalendarCategoryGUI($this->user->getId(), $this->seed, $this->ref_id);
540 $tpl->setVariable('CATEGORIES', $this->ctrl->getHTML($cat));
541
542 $this->tpl->setRightContent($tpl->get());
543 }
special template class to simplify handling of ITX/PEAR
setVariable(string $variable, $value='')
Sets the given variable to the given value.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.

References $tpl, ILIAS\Repository\ctrl(), ILIAS\UICore\GlobalTemplate\get(), getRepositoryMode(), ILIAS\UICore\GlobalTemplate\setVariable(), and ILIAS\Repository\user().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showToolbarAndSidebar()

ilCalendarPresentationGUI::showToolbarAndSidebar ( )

Definition at line 786 of file class.ilCalendarPresentationGUI.php.

786 : bool
787 {
788 #21783
789 return !(
790 $this->ctrl->getCmdClass() == "ilcalendarappointmentgui" ||
791 $this->ctrl->getCmdClass() == 'ilconsultationhoursgui'
792 );
793 }

References ILIAS\Repository\ctrl().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showViewSelection()

ilCalendarPresentationGUI::showViewSelection ( string  $a_active = "cal_list")

Definition at line 371 of file class.ilCalendarPresentationGUI.php.

371 : void
372 {
373 $ui = $this->ui;
377
378 $f = $ui->factory();
379
380 $actions = array(
381 $this->lng->txt("app_day") => $ctrl->getLinkTargetByClass('ilCalendarDayGUI', ''),
382 $this->lng->txt("app_week") => $ctrl->getLinkTargetByClass('ilCalendarWeekGUI', ''),
383 $this->lng->txt("app_month") => $ctrl->getLinkTargetByClass('ilCalendarMonthGUI', ''),
384 $this->lng->txt("cal_list") => $ctrl->getLinkTargetByClass('ilCalendarInboxGUI', '')
385 );
386
387
388 $view_control = $f->viewControl()->mode($actions, "cal_change_calendar_view")->withActive($this->lng->txt($a_active));
389 $toolbar->addComponent($view_control);
390 $ctrl->setParameterByClass("ilcalendarappointmentgui", "seed", $this->seed->get(IL_CAL_DATE, ''));
391 $ctrl->setParameterByClass("ilcalendarappointmentgui", "app_id", "");
392 $ctrl->setParameterByClass("ilcalendarappointmentgui", "dt", "");
393 $ctrl->setParameterByClass("ilcalendarappointmentgui", "idate", (new ilDate(time(), IL_CAL_UNIX))->get(IL_CAL_DATE));
394
395 $extra_button_added = false;
396 // add appointment
397 if ($this->category_id == 0 || $this->actions->checkAddEvent($this->category_id)) {
399 $extra_button_added = true;
400
401 // create appointment should default to current hour
402 $current_hour = (new ilDateTime(time(), IL_CAL_UNIX))->get(IL_CAL_FKT_DATE, 'G', $this->user->getTimeZone());
403 $ctrl->setParameterByClass("ilcalendarappointmentgui", "hour", $current_hour);
404 $add_button = $f->button()->standard(
405 $this->lng->txt("cal_add_appointment"),
406 $ctrl->getLinkTargetByClass("ilcalendarappointmentgui", "add")
407 );
408 $ctrl->clearParameterByClass("ilcalendarappointmentgui", "hour");
409
410 $toolbar->addComponent($add_button);
411 }
412
413 // import appointments
414 if ($this->category_id > 0 && $this->actions->checkAddEvent($this->category_id)) {
415 if (!$extra_button_added) {
417 }
418 $add_button = $f->button()->standard(
419 $this->lng->txt("cal_import_appointments"),
420 $ctrl->getLinkTargetByClass("ilcalendarcategorygui", "importAppointments")
421 );
422 $toolbar->addComponent($add_button);
423 }
424 }
const IL_CAL_FKT_DATE
@classDescription Date and time handling
addComponent(\ILIAS\UI\Component\Component $a_comp)

References $actions, $ctrl, Vendor\Package\$f, $lng, $toolbar, $ui, ilToolbarGUI\addComponent(), ilToolbarGUI\addSeparator(), ilCtrlInterface\clearParameterByClass(), ilCtrlInterface\getLinkTargetByClass(), IL_CAL_DATE, IL_CAL_FKT_DATE, IL_CAL_UNIX, ILIAS\Repository\lng(), ilCtrlInterface\setParameterByClass(), and ILIAS\Repository\user().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilCalendarPresentationGUI::$access
protected

Definition at line 46 of file class.ilCalendarPresentationGUI.php.

Referenced by addStandardTabs().

◆ $actions

ilCalendarActions ilCalendarPresentationGUI::$actions
protected

Definition at line 52 of file class.ilCalendarPresentationGUI.php.

Referenced by showViewSelection().

◆ $cal_period

int ilCalendarPresentationGUI::$cal_period = 0
protected

Definition at line 60 of file class.ilCalendarPresentationGUI.php.

◆ $cal_settings

ilCalendarSettings ilCalendarPresentationGUI::$cal_settings
protected

Definition at line 51 of file class.ilCalendarPresentationGUI.php.

◆ $cal_view

int ilCalendarPresentationGUI::$cal_view = 0
protected

Definition at line 59 of file class.ilCalendarPresentationGUI.php.

◆ $category_id

int ilCalendarPresentationGUI::$category_id = 0
protected

Definition at line 56 of file class.ilCalendarPresentationGUI.php.

Referenced by addStandardTabs().

◆ $cats

ilCalendarCategories ilCalendarPresentationGUI::$cats
protected

Definition at line 53 of file class.ilCalendarPresentationGUI.php.

Referenced by __construct().

◆ $ctrl

ilCtrlInterface ilCalendarPresentationGUI::$ctrl
protected

◆ $help

ilHelpGUI ilCalendarPresentationGUI::$help
protected

Definition at line 42 of file class.ilCalendarPresentationGUI.php.

◆ $http

HttpServices ilCalendarPresentationGUI::$http
protected

Definition at line 47 of file class.ilCalendarPresentationGUI.php.

◆ $lng

ilLanguage ilCalendarPresentationGUI::$lng
protected

Definition at line 38 of file class.ilCalendarPresentationGUI.php.

Referenced by prepareOutput(), and showViewSelection().

◆ $rbacsystem

ilRbacSystem ilCalendarPresentationGUI::$rbacsystem
protected

Definition at line 43 of file class.ilCalendarPresentationGUI.php.

Referenced by addStandardTabs().

◆ $ref_id

int ilCalendarPresentationGUI::$ref_id = 0
protected

Definition at line 55 of file class.ilCalendarPresentationGUI.php.

Referenced by executeCommand().

◆ $refinery

RefineryFactory ilCalendarPresentationGUI::$refinery
protected

Definition at line 48 of file class.ilCalendarPresentationGUI.php.

◆ $renderer

UIRenderer ilCalendarPresentationGUI::$renderer
private

Definition at line 62 of file class.ilCalendarPresentationGUI.php.

◆ $repository_mode

bool ilCalendarPresentationGUI::$repository_mode = false
protected

Definition at line 54 of file class.ilCalendarPresentationGUI.php.

Referenced by getRepositoryMode().

◆ $seed

ilDate ilCalendarPresentationGUI::$seed = null
protected

Definition at line 57 of file class.ilCalendarPresentationGUI.php.

Referenced by getRequestedSeedAsString(), and initSeed().

◆ $tabs_gui

ilTabsGUI ilCalendarPresentationGUI::$tabs_gui
protected

Definition at line 40 of file class.ilCalendarPresentationGUI.php.

Referenced by prepareOutput().

◆ $toolbar

ilToolbarGUI ilCalendarPresentationGUI::$toolbar
protected

Definition at line 45 of file class.ilCalendarPresentationGUI.php.

Referenced by showViewSelection().

◆ $tpl

ilGlobalTemplateInterface ilCalendarPresentationGUI::$tpl
protected

Definition at line 39 of file class.ilCalendarPresentationGUI.php.

Referenced by prepareOutput(), and showSideBlocks().

◆ $ui

ILIAS DI UIServices ilCalendarPresentationGUI::$ui
protected

Definition at line 44 of file class.ilCalendarPresentationGUI.php.

Referenced by showViewSelection().

◆ $ui_factory

UIFactory ilCalendarPresentationGUI::$ui_factory
private

Definition at line 63 of file class.ilCalendarPresentationGUI.php.

◆ $user

ilObjUser ilCalendarPresentationGUI::$user
protected

Definition at line 41 of file class.ilCalendarPresentationGUI.php.

Referenced by forwardToClass(), and readLastClass().


The documentation for this class was generated from the following file: