19 declare(strict_types=1);
43 protected \ILIAS\DI\UIServices
$ui;
68 $this->
ctrl = $DIC->ctrl();
69 $this->
lng = $DIC->language();
70 $this->
lng->loadLanguageModule(
'dateplaner');
72 $this->renderer = $DIC->ui()->renderer();
73 $this->uiFactory = $DIC->ui()->factory();
75 $this->
http = $DIC->http();
77 $this->tpl = $DIC->ui()->mainTemplate();
78 $this->tabs_gui = $DIC->tabs();
79 $this->
user = $DIC->user();
80 $this->rbacsystem = $DIC->rbac()->system();
81 $this->
access = $DIC->access();
82 $this->
help = $DIC[
"ilHelp"];
83 $this->
ui = $DIC->ui();
84 $this->
toolbar = $DIC->toolbar();
85 $this->ref_id = $a_ref_id;
86 $this->category_id = 0;
87 if ($this->
http->wrapper()->query()->has(
'category_id')) {
88 $this->category_id = $this->
http->wrapper()->query()->retrieve(
94 $this->repository_mode = $a_ref_id > 0;
95 if ($this->repository_mode && $this->category_id === 0) {
98 $this->category_id = is_null($category) ? 0 : $category->getCategoryID();
100 $this->
ctrl->setParameter($this,
'category_id', $this->category_id);
104 $this->
ctrl->saveParameter($this,
'backpd');
109 if ($this->category_id > 0 && $this->ref_id <= 0) {
112 $vis->forceVisibility($this->category_id);
115 } elseif ($a_ref_id > 0) {
134 if ($this->
http->wrapper()->query()->has(
'app_id')) {
135 return $this->
http->wrapper()->query()->retrieve(
145 if ($this->
http->wrapper()->query()->has(
'category_id')) {
146 return $this->
http->wrapper()->query()->retrieve(
161 if ($this->
http->wrapper()->query()->has(
'ch_user_id')) {
162 $ch_user_id = $this->
http->wrapper()->query()->retrieve(
168 foreach ($this->cats->getCategoriesInfo() as $info) {
171 $info[
"obj_id"] == $ch_user_id
173 $v = $visibility->getVisible();
174 if (!in_array($info[
"cat_id"], $v)) {
175 $v[] = $info[
"cat_id"];
177 $visibility->showSelected($v);
179 $this->
ctrl->setParameterByClass(ilCalendarMonthGUI::class,
'category_id', $info[
'cat_id']);
183 $this->
ctrl->redirectToURL(
184 $this->
ctrl->getLinkTargetByClass(\ilCalendarMonthGUI::class,
'')
193 $this->cal_view = $this->cal_settings->getDefaultCal();
194 if ($this->
http->wrapper()->query()->has(
'cal_view')) {
195 $this->cal_view = $this->
http->wrapper()->query()->retrieve(
204 $cmd = $this->
ctrl->getCmd();
209 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
216 $this->
help->setScreenIdComponent(
"cal");
218 case 'selectCHCalendarOfUser':
222 switch ($next_class) {
223 case 'ilcalendarinboxgui':
224 $this->tabs_gui->activateTab(
'cal_agenda');
229 $inbox_gui->addToolbarFileDownload();
234 case 'ilconsultationhoursgui':
235 $this->tabs_gui->activateTab(
'app_consultation_hours');
236 $this->tabs_gui->clearTargets();
239 $this->tabs_gui->setBackTarget(
240 $this->
lng->txt(
'cal_back_to_cal'),
249 case 'ilcalendarmonthgui':
250 $this->tabs_gui->activateTab(
'cal_agenda');
256 $month_gui->addToolbarFileDownload();
260 case 'ilcalendarweekgui':
261 $this->tabs_gui->activateTab(
'cal_agenda');
266 $week_gui->addToolbarFileDownload();
271 case 'ilcalendardaygui':
272 $this->tabs_gui->activateTab(
'cal_agenda');
277 $day_gui->addToolbarFileDownload();
281 case 'ilcalendarusersettingsgui':
282 $this->
ctrl->setReturn($this,
'');
283 $this->tabs_gui->activateTab(
'settings');
287 $this->
ctrl->forwardCommand($user_settings);
291 case 'ilcalendarappointmentgui':
292 $this->
ctrl->setReturn($this,
'');
293 $this->tabs_gui->activateTab((
string)
ilSession::get(
'cal_last_tab'));
299 case 'ilcalendarsubscriptiongui':
300 $this->
ctrl->setReturn($this,
'');
301 $this->tabs_gui->activateTab(
"cal_agenda");
304 if ($this->
http->wrapper()->query()->has(
'ref_id')) {
305 $ref_id = $this->
http->wrapper()->query()->retrieve(
311 $this->
ctrl->forwardCommand($sub);
317 case 'ilcalendarcategorygui':
318 $this->
ctrl->setReturn($this,
'');
319 $this->tabs_gui->activateTab(
"cal_manage");
321 if ($this->
ctrl->forwardCommand($category)) {
329 case 'ilcalendarblockgui':
332 $side_cal->setForceMonthView(
true);
333 $this->
ctrl->forwardCommand($side_cal);
337 case 'ilpdcalendarblockgui':
340 $side_cal->setForceMonthView(
true);
341 $this->
ctrl->forwardCommand($side_cal);
345 case 'ilpublicuserprofilegui':
346 $user_id = $this->
user->getId();
347 if ($this->
http->wrapper()->query()->has(
'user_id')) {
348 $user_id = $this->
http->wrapper()->query()->retrieve(
354 $html = $this->
ctrl->forwardCommand($user_profile);
355 $this->tpl->setContent($html);
359 $cmd = $this->
ctrl->getCmd(
"show");
383 $view_control =
$f->viewControl()->mode($actions,
"cal_change_calendar_view")->withActive($this->
lng->txt($a_active));
390 $extra_button_added =
false;
392 if ($this->category_id == 0 || $this->actions->checkAddEvent($this->category_id)) {
394 $extra_button_added =
true;
395 $add_button =
$f->button()->standard(
396 $this->
lng->txt(
"cal_add_appointment"),
403 if ($this->category_id > 0 && $this->actions->checkAddEvent($this->category_id)) {
404 if (!$extra_button_added) {
407 $add_button =
$f->button()->standard(
408 $this->
lng->txt(
"cal_import_appointments"),
417 if (strlen($next_class = $this->
ctrl->getNextClass())) {
421 strcasecmp($this->
ctrl->getCmdClass(), ilCalendarPresentationGUI::class) === 0 ||
422 $this->
ctrl->getCmdClass() ==
'' 425 $this->
ctrl->setCmdClass($cmd_class);
437 switch ($this->cal_view) {
439 $class =
"ilcalendardaygui";
442 $class =
"ilcalendarweekgui";
445 $class =
"ilcalendarmonthgui";
449 $class =
"ilcalendarinboxgui";
455 $user_pref = $this->
user->getPref(
'cal_last_class');
456 $use_pref = $user_pref && ($user_pref !==
"") && !$this->
http->wrapper()->query()->has(
'cal_view');
458 return $use_pref ? $user_pref : $class;
465 if ($this->
ctrl->getCmdClass() == strtolower(get_class($this))) {
466 $this->
ctrl->setCmdClass(strtolower($a_class));
474 case 'ilcalendarmonthgui':
475 $this->
user->writePref(
'cal_last_class', $a_class);
479 $this->
ctrl->forwardCommand($month_gui);
482 case 'ilcalendarweekgui':
483 $this->
user->writePref(
'cal_last_class', $a_class);
487 $this->
ctrl->forwardCommand($week_gui);
490 case 'ilcalendardaygui':
491 $this->
user->writePref(
'cal_last_class', $a_class);
495 $this->
ctrl->forwardCommand($day_gui);
498 case 'ilcalendarinboxgui':
499 $this->
user->writePref(
'cal_last_class', $a_class);
503 $this->
ctrl->forwardCommand($inbox_gui);
511 $tpl =
new ilTemplate(
'tpl.cal_side_block.html',
true,
true,
'Services/Calendar');
517 $side_cal->setParentGUI(
"ilCalendarPresentationGUI");
518 $side_cal->setForceMonthView(
true);
525 $this->tpl->setRightContent($tpl->
get());
535 $this->tabs_gui->clearTargets();
538 if ($this->
http->wrapper()->query()->has(
'backpd')) {
539 $this->tabs_gui->setBack2Target(
540 $this->
lng->txt(
'back_to_pd'),
541 $this->
ctrl->getLinkTargetByClass(ilDashboardGUI::class,
'jumpToCalendar')
545 $this->tabs_gui->setBackTarget(
547 $this->
ctrl->getParentReturn($this)
549 } elseif ($this->
http->wrapper()->query()->has(
'backvm')) {
551 $this->tabs_gui->setBackTarget(
552 $this->
lng->txt(
"back"),
557 $this->tabs_gui->setBackTarget(
558 $this->
lng->txt(
"back"),
564 $this->tabs_gui->addTab(
566 $this->
lng->txt(
"cal_agenda"),
570 if ($this->actions->checkShareCal($this->category_id)) {
571 $this->tabs_gui->addTab(
573 $this->
lng->txt(
"cal_share"),
577 if ($this->actions->checkSettingsCal($this->category_id)) {
578 $ctrl->
setParameterByClass(ilCalendarCategoryGUI::class,
'category_id', $this->category_id);
579 $this->tabs_gui->addTab(
581 $this->
lng->txt(
"settings"),
586 $this->tabs_gui->activateTab(
'cal_agenda');
597 $this->tabs_gui->clearTargets();
599 if ($this->
http->wrapper()->query()->has(
'backpd')) {
600 $this->tabs_gui->setBack2Target(
601 $this->
lng->txt(
'back_to_pd'),
602 $this->
ctrl->getLinkTargetByClass(ilDashboardGUI::class,
'jumpToCalendar')
606 $this->tabs_gui->setBackTarget(
608 $this->
ctrl->getParentReturn($this)
613 $category_id = $category->getCategoryID();
616 $this->tabs_gui->addTab(
618 $this->
lng->txt(
'cal_agenda'),
619 $this->
ctrl->getLinkTarget($this,
'')
623 if ($access->
checkAccess(
'edit_event',
'', $this->ref_id)) {
624 $this->
ctrl->setParameterByClass(ilCalendarCategoryGUI::class,
'category_id', $category_id);
625 $this->tabs_gui->addTab(
627 $this->
lng->txt(
'settings'),
628 $this->
ctrl->getLinkTargetByClass(ilCalendarCategoryGUI::class,
'edit')
630 $this->
ctrl->clearParameterByClass(ilCalendarCategoryGUI::class,
'category_id');
633 $this->tabs_gui->addTab(
635 $this->
lng->txt(
"cal_agenda"),
636 $this->
ctrl->getLinkTarget($this,
'')
640 $this->rbacsystem->checkAccess(
641 'add_consultation_hours',
646 $this->tabs_gui->addTab(
647 'app_consultation_hours',
648 $this->
lng->txt(
'app_consultation_hours'),
649 $this->
ctrl->getLinkTargetByClass(ilConsultationHoursGUI::class,
'')
652 $this->tabs_gui->addTarget(
654 $this->
ctrl->getLinkTargetByClass(
'ilCalendarCategoryGUI',
'manage')
656 $this->tabs_gui->addTarget(
'settings', $this->
ctrl->getLinkTargetByClass(
'ilCalendarUserSettingsGUI',
''));
662 if ($this->category_id) {
672 if ($this->category_id > 0) {
682 switch ($category->getType()) {
684 $header = $this->
lng->txt(
'cal_type_personal') .
": " . $category->getTitle();
688 $header = $this->
lng->txt(
'cal_type_system') .
": " . $category->getTitle();
692 $header = $this->
lng->txt(
'cal_type_' . $category->getObjType()) .
": " . $category->getTitle();
696 $header = str_replace(
699 $this->
lng->txt(
"cal_consultation_hours_for_user")
704 $header = $category->getTitle();
710 $dropDownItems = array();
713 $ctrl->
setParameterByClass(
"ilcalendarsubscriptiongui",
"category_id", $this->category_id);
714 $dropDownItems[] = $this->uiFactory->button()->shy(
715 $this->
lng->txt(
"cal_ical_url"),
720 if ($this->actions->checkDeleteCal($this->category_id)) {
722 $dropDownItems[] = $this->uiFactory->button()->shy(
723 $this->
lng->txt(
"cal_delete_cal"),
727 $dropDown = $this->uiFactory->dropdown()->standard($dropDownItems)
728 ->withAriaLabel($this->
lng->txt(
'actions'));
736 if ($this->
http->wrapper()->query()->has(
'seed')) {
737 $seed = $this->
http->wrapper()->query()->retrieve(
739 $this->
refinery->kindlyTo()->string()
763 $this->
ctrl->setParameter($this,
'seed', $this->seed->get(
IL_CAL_DATE));
773 $this->
ctrl->getCmdClass() ==
"ilcalendarappointmentgui" ||
774 $this->
ctrl->getCmdClass() ==
'ilconsultationhoursgui'
class for calendar categories
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
initialize(int $a_mode, int $a_source_ref_id=0, bool $a_use_cache=false, int $a_cat_id=0)
initialize visible categories
static get(string $a_var)
initCategoryIdFromQuery()
setParameterByClass(string $a_class, string $a_parameter, $a_value)
Sets a parameter for the given GUI class and appends the given value as well.
ilCalendarActions $actions
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
readLastClass()
Read last class from history.
initCalendarView()
Initialises calendar view according to given settings.
static _lookupFullname(int $a_user_id)
const MODE_PERSONAL_DESKTOP_MEMBERSHIP
UIImplementationFactory $uiFactory
getRequestedSeedAsString()
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 getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
initSeed()
init the seed date for presentations (month view, minicalendar)
static getInstance()
Get instance.
clearParameterByClass(string $a_class, string $a_parameter)
Removes a specific parameter of a specific class that is currently set or saved.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
const CAL_SELECTION_MEMBERSHIP
Stores calendar categories.
const MODE_SINGLE_CALENDAR
static _getInstanceByObjId(int $a_obj_id)
get instance by obj_id
setVariable(string $variable, $value='')
Sets the given variable to the given value.
ilCalendarSettings $cal_settings
setTitleIcon(string $a_icon_path, string $a_icon_desc="")
set title icon
static _lookupObjId(int $ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Show calendar subscription info.
Calendar blocks, displayed on personal desktop.
setHeaderActionMenu(string $a_header)
Set header action menu.
GUI class for public user profile presentation.
static http()
Fetches the global http state from ILIAS.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
initAndRedirectToConsultationHours()
Init and redirect to consultation hours.
ilGlobalTemplateInterface $tpl
addStandardTabs()
add standard tabs
setTitle(string $a_title, bool $hidden=false)
Sets title in standard template.
static _getInstance($a_usr_id=0)
get singleton instance
showViewSelection(string $a_active="cal_list")
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.
static redirect(string $a_script)
initAppointmentIdFromQuery()
Administrate calendar appointments.
RefineryFactory $refinery
Calendar blocks, displayed in different contexts, e.g.
ilCalendarCategories $cats
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...
static _lookupType(int $id, bool $reference=false)
static _getInstanceByUserId(int $a_user_id, int $a_ref_id=0)
forwardToClass(string $a_class)
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...
Administration, Side-Block presentation of calendar categories.
const MODE_PERSONAL_DESKTOP_ITEMS