19declare(strict_types=1);
44 protected \ILIAS\DI\UIServices
$ui;
69 $this->
ctrl = $DIC->ctrl();
70 $this->
lng = $DIC->language();
71 $this->
lng->loadLanguageModule(
'dateplaner');
73 $this->
renderer = $DIC->ui()->renderer();
74 $this->ui_factory =
$DIC->ui()->factory();
76 $this->
http = $DIC->http();
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(
95 $this->repository_mode = $a_ref_id > 0;
96 if ($this->repository_mode && $this->category_id === 0) {
99 $this->category_id = is_null($category) ? 0 : $category->getCategoryID();
101 $this->
ctrl->setParameter($this,
'category_id', $this->category_id);
105 $this->
ctrl->saveParameter($this,
'backpd');
110 if ($this->category_id > 0 && $this->ref_id <= 0) {
113 $vis->forceVisibility($this->category_id);
116 } elseif ($a_ref_id > 0) {
135 if ($this->
http->wrapper()->query()->has(
'app_id')) {
136 return $this->
http->wrapper()->query()->retrieve(
146 if ($this->
http->wrapper()->query()->has(
'category_id')) {
147 return $this->
http->wrapper()->query()->retrieve(
162 if ($this->
http->wrapper()->query()->has(
'ch_user_id')) {
163 $ch_user_id = $this->
http->wrapper()->query()->retrieve(
169 foreach ($this->cats->getCategoriesInfo() as
$info) {
172 $info[
"obj_id"] == $ch_user_id
174 $v = $visibility->getVisible();
175 if (!in_array(
$info[
"cat_id"], $v)) {
176 $v[] =
$info[
"cat_id"];
178 $visibility->showSelected($v);
180 $this->
ctrl->setParameterByClass(ilCalendarMonthGUI::class,
'category_id',
$info[
'cat_id']);
184 $this->
ctrl->redirectToURL(
185 $this->
ctrl->getLinkTargetByClass(\ilCalendarMonthGUI::class,
'')
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(
205 $cmd = $this->
ctrl->getCmd();
208 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
213 if (!$this->
ctrl->isAsynch()) {
217 $this->
help->setScreenIdComponent(
"cal");
219 case 'selectCHCalendarOfUser':
227 switch ($next_class) {
228 case 'ilcalendarinboxgui':
229 $this->tabs_gui->activateTab(
'cal_agenda');
234 $inbox_gui->addToolbarFileDownload();
239 case 'ilconsultationhoursgui':
240 $this->tabs_gui->activateTab(
'app_consultation_hours');
241 $this->tabs_gui->clearTargets();
244 $this->tabs_gui->setBackTarget(
245 $this->
lng->txt(
'cal_back_to_cal'),
246 $this->ctrl->getLinkTargetByClass($this->readLastClass())
254 case 'ilcalendarmonthgui':
255 $this->tabs_gui->activateTab(
'cal_agenda');
261 $month_gui->addToolbarFileDownload();
265 case 'ilcalendarweekgui':
266 $this->tabs_gui->activateTab(
'cal_agenda');
271 $week_gui->addToolbarFileDownload();
276 case 'ilcalendardaygui':
277 $this->tabs_gui->activateTab(
'cal_agenda');
282 $day_gui->addToolbarFileDownload();
286 case 'ilcalendarusersettingsgui':
287 $this->
ctrl->setReturn($this,
'');
288 $this->tabs_gui->activateTab(
'settings');
292 $this->
ctrl->forwardCommand($user_settings);
296 case 'ilcalendarappointmentgui':
297 $this->
ctrl->setReturn($this,
'');
298 $this->tabs_gui->activateTab((
string)
ilSession::get(
'cal_last_tab'));
301 $this->
ctrl->forwardCommand($app);
304 case 'ilcalendarsubscriptiongui':
305 $this->
ctrl->setReturn($this,
'');
306 $this->tabs_gui->activateTab(
"cal_agenda");
309 if ($this->
http->wrapper()->query()->has(
'ref_id')) {
310 $ref_id = $this->
http->wrapper()->query()->retrieve(
316 $this->
ctrl->forwardCommand($sub);
322 case 'ilcalendarcategorygui':
323 $this->
ctrl->setReturn($this,
'');
324 $this->tabs_gui->activateTab(
"cal_manage");
326 if ($this->
ctrl->forwardCommand($category)) {
334 case 'ilcalendarblockgui':
337 $side_cal->setForceMonthView(
true);
338 $this->
ctrl->forwardCommand($side_cal);
342 case 'ilpdcalendarblockgui':
345 $side_cal->setForceMonthView(
true);
346 $this->
ctrl->forwardCommand($side_cal);
350 case strtolower(PublicProfileGUI::class):
352 if ($this->
http->wrapper()->query()->has(
'user_id')) {
359 $html = $this->
ctrl->forwardCommand($user_profile);
360 $this->tpl->setContent($html);
364 $cmd = $this->
ctrl->getCmd(
"show");
388 $view_control =
$f->viewControl()->mode(
$actions,
"cal_change_calendar_view")->withActive($this->
lng->txt($a_active));
395 $extra_button_added =
false;
397 if ($this->category_id == 0 || $this->actions->checkAddEvent($this->category_id)) {
399 $extra_button_added =
true;
404 $add_button =
$f->button()->standard(
405 $this->
lng->txt(
"cal_add_appointment"),
414 if ($this->category_id > 0 && $this->actions->checkAddEvent($this->category_id)) {
415 if (!$extra_button_added) {
418 $add_button =
$f->button()->standard(
419 $this->
lng->txt(
"cal_import_appointments"),
428 if (strlen($next_class = $this->
ctrl->getNextClass())) {
432 strcasecmp($this->
ctrl->getCmdClass(), ilCalendarPresentationGUI::class) === 0 ||
433 $this->ctrl->getCmdClass() ==
''
448 switch ($this->cal_view) {
450 $class =
"ilcalendardaygui";
453 $class =
"ilcalendarweekgui";
456 $class =
"ilcalendarmonthgui";
460 $class =
"ilcalendarinboxgui";
466 $user_pref = $this->
user->getPref(
'cal_last_class');
467 $use_pref = $user_pref && ($user_pref !==
"") && !$this->
http->wrapper()->query()->has(
'cal_view');
469 return $use_pref ? $user_pref : $class;
476 if ($this->
ctrl->getCmdClass() == strtolower(get_class($this))) {
483 $this->
ctrl->saveParameter($this,
'seed');
484 $this->
ctrl->redirectByClass($class);
491 case 'ilcalendarmonthgui':
492 $this->
user->writePref(
'cal_last_class', $a_class);
496 $this->
ctrl->forwardCommand($month_gui);
499 case 'ilcalendarweekgui':
500 $this->
user->writePref(
'cal_last_class', $a_class);
504 $this->
ctrl->forwardCommand($week_gui);
507 case 'ilcalendardaygui':
508 $this->
user->writePref(
'cal_last_class', $a_class);
512 $this->
ctrl->forwardCommand($day_gui);
515 case 'ilcalendarinboxgui':
516 $this->
user->writePref(
'cal_last_class', $a_class);
520 $this->
ctrl->forwardCommand($inbox_gui);
528 $tpl =
new ilTemplate(
'tpl.cal_side_block.html',
true,
true,
'components/ILIAS/Calendar');
534 $side_cal->setParentGUI(
"ilCalendarPresentationGUI");
535 $side_cal->setForceMonthView(
true);
542 $this->tpl->setRightContent(
$tpl->
get());
552 $this->tabs_gui->clearTargets();
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')
562 $this->tabs_gui->setBackTarget(
564 $this->
ctrl->getParentReturn($this)
566 } elseif ($this->
http->wrapper()->query()->has(
'backvm')) {
568 $this->tabs_gui->setBackTarget(
569 $this->
lng->txt(
"back"),
574 $this->tabs_gui->setBackTarget(
575 $this->
lng->txt(
"back"),
581 $this->tabs_gui->addTab(
583 $this->
lng->txt(
"cal_agenda"),
587 if ($this->actions->checkShareCal($this->category_id)) {
588 $this->tabs_gui->addTab(
590 $this->
lng->txt(
"cal_share"),
594 if ($this->actions->checkSettingsCal($this->category_id)) {
596 $this->tabs_gui->addTab(
598 $this->
lng->txt(
"settings"),
603 $this->tabs_gui->activateTab(
'cal_agenda');
614 $this->tabs_gui->clearTargets();
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')
623 $this->tabs_gui->setBackTarget(
625 $this->
ctrl->getParentReturn($this)
633 $this->tabs_gui->addTab(
635 $this->
lng->txt(
'cal_agenda'),
636 $this->ctrl->getLinkTarget($this,
'')
641 $this->
ctrl->setParameterByClass(ilCalendarCategoryGUI::class,
'category_id',
$category_id);
642 $this->tabs_gui->addTab(
644 $this->
lng->txt(
'settings'),
645 $this->ctrl->getLinkTargetByClass(ilCalendarCategoryGUI::class,
'edit')
647 $this->
ctrl->clearParameterByClass(ilCalendarCategoryGUI::class,
'category_id');
650 $this->tabs_gui->addTab(
652 $this->
lng->txt(
"cal_agenda"),
653 $this->ctrl->getLinkTarget($this,
'')
657 $this->rbacsystem->checkAccess(
658 'add_consultation_hours',
663 $this->tabs_gui->addTab(
664 'app_consultation_hours',
665 $this->
lng->txt(
'app_consultation_hours'),
666 $this->ctrl->getLinkTargetByClass(ilConsultationHoursGUI::class,
'')
669 $this->tabs_gui->addTarget(
671 $this->
ctrl->getLinkTargetByClass(
'ilCalendarCategoryGUI',
'manage')
673 $this->tabs_gui->addTarget(
'settings', $this->
ctrl->getLinkTargetByClass(
'ilCalendarUserSettingsGUI',
''));
679 if ($this->category_id) {
689 if ($this->category_id > 0) {
699 switch ($category->getType()) {
701 $header = $this->
lng->txt(
'cal_type_personal') .
": " . $category->getTitle();
705 $header = $this->
lng->txt(
'cal_type_system') .
": " . $category->getTitle();
709 $header = $this->
lng->txt(
'cal_type_' . $category->getObjType()) .
": " . $category->getTitle();
713 $header = str_replace(
716 $this->lng->txt(
"cal_consultation_hours_for_user")
721 $header = $category->getTitle();
727 $dropDownItems = array();
731 $dropDownItems[] = $this->ui_factory->button()->shy(
732 $this->
lng->txt(
"cal_ical_url"),
737 if ($this->actions->checkDeleteCal($this->category_id)) {
739 $dropDownItems[] = $this->ui_factory->button()->shy(
740 $this->
lng->txt(
"cal_delete_cal"),
744 $dropDown = $this->ui_factory->dropdown()->standard($dropDownItems)
745 ->withAriaLabel($this->
lng->txt(
'actions'));
753 if ($this->
http->wrapper()->query()->has(
'seed')) {
754 $seed = $this->
http->wrapper()->query()->retrieve(
756 $this->
refinery->kindlyTo()->string()
780 $this->
ctrl->setParameter($this,
'seed', $this->seed->get(
IL_CAL_DATE));
790 $this->
ctrl->getCmdClass() ==
"ilcalendarappointmentgui" ||
791 $this->
ctrl->getCmdClass() ==
'ilconsultationhoursgui'
Builds a Color from either hex- or rgb values.
GUI class for public user profile presentation.
Checks if certain actions can be performed.
static getInstance()
Get instance.
Administrate calendar appointments.
Calendar blocks, displayed in different contexts, e.g.
class for calendar categories
const MODE_PERSONAL_DESKTOP_MEMBERSHIP
const MODE_PERSONAL_DESKTOP_ITEMS
initialize(int $a_mode, int $a_source_ref_id=0, bool $a_use_cache=false, int $a_cat_id=0)
initialize visible categories
const MODE_SINGLE_CALENDAR
static _getInstance($a_usr_id=0)
get singleton instance
Administration, Side-Block presentation of calendar categories.
Stores calendar categories.
static _getInstanceByObjId(int $a_obj_id)
get instance by obj_id
redirectWithParameters(string $class)
ilCalendarSettings $cal_settings
initAppointmentIdFromQuery()
RefineryFactory $refinery
addCategoryTabs()
Add tabs for ilCategoryGUI context This cannot be done there since many views (Day Week Agenda) are i...
ilGlobalTemplateInterface $tpl
initCategoryIdFromQuery()
ilCalendarActions $actions
showViewSelection(string $a_active="cal_list")
initSeed()
init the seed date for presentations (month view, minicalendar)
getRequestedSeedAsString()
ilCalendarCategories $cats
forwardToClass(string $a_class)
initCalendarView()
Initialises calendar view according to given settings.
addStandardTabs()
add standard tabs
readLastClass()
Read last class from history.
initAndRedirectToConsultationHours()
Init and redirect to consultation hours.
Stores all calendar relevant settings.
Show calendar subscription info.
const CAL_SELECTION_MEMBERSHIP
static _getInstanceByUserId(int $a_user_id, int $a_ref_id=0)
Consultation hours editor.
@classDescription Date and time handling
static _lookupFullname(int $a_user_id)
static _lookupType(int $id, bool $reference=false)
static _lookupObjId(int $ref_id)
Calendar blocks, displayed on personal desktop.
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
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static redirect(string $a_script)
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.
setTitleIcon(string $a_icon_path, string $a_icon_desc="")
set title icon
setHeaderActionMenu(string $a_header)
Set header action menu.
An entity that renders components to a string output.
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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.
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.