3 declare(strict_types=1);
52 protected \ILIAS\DI\UIServices
$ui;
70 $this->ch_user_id = $a_user_id;
78 public function initialize(
int $a_calendar_presentation_type): void
82 $this->component_factory = $DIC[
'component.factory'];
83 $this->ui_factory = $DIC->ui()->factory();
84 $this->ui_renderer = $DIC->ui()->renderer();
85 $this->
ui = $DIC->ui();
86 $this->
ctrl = $DIC->ctrl();
87 $this->
lng = $DIC->language();
88 $this->
user = $DIC->user();
89 $this->tabs_gui = $DIC->tabs();
90 $this->
toolbar = $DIC->toolbar();
91 $this->presentation_type = $a_calendar_presentation_type;
92 $this->
logger = $DIC->logger()->cal();
93 $this->view_with_appointments =
false;
94 $this->main_tpl = $DIC->ui()->mainTemplate();
95 if ($this->presentation_type == self::CAL_PRESENTATION_DAY ||
96 $this->presentation_type == self::CAL_PRESENTATION_WEEK) {
98 $this->main_tpl->addJavaScript(
'./Services/Calendar/js/calendar_appointment.js');
100 $this->
http = $DIC->http();
106 if ($this->
http->wrapper()->query()->has(
'app_id')) {
107 return $this->
http->wrapper()->query()->retrieve(
117 if ($this->
http->wrapper()->query()->has(
'idate')) {
118 return $this->
http->wrapper()->query()->retrieve(
120 $this->
refinery->kindlyTo()->string()
128 if ($this->
http->wrapper()->query()->has(
'dt')) {
129 return $this->
http->wrapper()->query()->retrieve(
139 if ($this->
http->wrapper()->query()->has(
'bkid')) {
140 return $this->
http->wrapper()->query()->retrieve(
152 foreach ($events as $item) {
162 $user = $this->
user->getId();
164 switch ($this->presentation_type) {
165 case self::CAL_PRESENTATION_AGENDA_LIST:
198 $this->period_end_day = $end_date->get(
IL_CAL_DATE);
199 $schedule->setPeriod($this->seed, $end_date);
208 case self::CAL_PRESENTATION_DAY:
211 case self::CAL_PRESENTATION_WEEK:
214 case self::CAL_PRESENTATION_MONTH:
221 $schedule->addSubitemCalendars(
true);
222 $schedule->calculate();
223 return $schedule->getScheduledEvents();
233 $start = $item[
"dstart"];
234 $end = $item[
"dend"];
235 if ($item[
"fullday"]) {
242 return array(
"start" => $start,
"end" => $end);
252 $this->
ctrl->setReturn($this,
'');
258 foreach ($events as $item) {
263 $content = $this->
ctrl->getHTML($next_gui);
268 $modal = $this->ui_factory->modal()->roundtrip(
270 $this->ui_factory->legacy($content)
271 )->withCancelButtonLabel($this->
lng->txt(
"close"));
272 echo $this->ui_renderer->renderAsync($modal);
287 string $a_title_forced =
"" 289 $this->
ctrl->setParameter($this,
"app_id", $a_calendar_entry->
getEntryId());
294 $this->
ctrl->setParameter($this,
'dt', $a_dstart);
295 $this->
ctrl->setParameter($this,
'seed', $this->seed->get(
IL_CAL_DATE));
296 $url = $this->
ctrl->getLinkTarget($this,
"getModalForApp",
"",
true,
false);
299 $this->
ctrl->setParameter($this,
'seed', $this->seed->get(
IL_CAL_DATE));
301 $modal = $this->ui_factory->modal()->roundtrip(
'', [])->withAsyncRenderUrl(
$url);
304 if ($this->presentation_type == self::CAL_PRESENTATION_DAY) {
305 $title = ($a_title_forced ==
"") ? $a_calendar_entry->
getPresentationTitle(
false) : $a_title_forced;
312 switch ($this->user_settings->getTimeFormat()) {
321 $aria_label = $start_time .
' - ' . $title;
323 $comps = [$this->ui_factory->button()->shy($title,
"#")->withAriaLabel($aria_label)->withOnClick($modal->getShowSignal()), $modal];
324 return $this->ui_renderer->render($comps);
333 return $this->component_factory->getActivePluginsInSlot($a_slot_id);
338 $modal_title = $a_current_title;
342 $modal_title = ($new_title = $plugin->editModalTitle($a_current_title)) ? $new_title : $a_current_title;
360 $content = $a_content;
366 if ($new_title = $plugin->editShyButtonTitle()) {
373 if ($glyph = $plugin->addGlyph()) {
374 $a_tpl->
setVariable(
'EXTRA_GLYPH_BY_PLUGIN', $glyph);
377 if ($more_content = $plugin->addExtraContent()) {
378 $a_tpl->
setVariable(
'EXTRA_CONTENT_BY_PLUGIN', $more_content);
382 $html_content = $a_tpl->
get();
384 if ($new_content = $plugin->replaceContent($html_content)) {
385 $content = $new_content;
388 if ($content == $a_content) {
401 if (
$settings->isBatchFileDownloadsEnabled()) {
403 if ($this->presentation_type == self::CAL_PRESENTATION_AGENDA_LIST) {
406 if ($this->view_with_appointments || $num_events) {
413 $add_button =
$f->button()->standard(
414 $this->
lng->txt(
"cal_download_files"),
430 $download_job->setEvents($this->
getEvents());
431 if ($download_job->run()) {
432 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'cal_download_files_started'),
true);
434 $this->
ctrl->redirect($this);
444 $bucket_title = $this->
lng->txt(
"cal_calendar_download");
446 switch ($this->presentation_type) {
447 case self::CAL_PRESENTATION_DAY:
448 $bucket_title .=
" " . $this->seed->get(
IL_CAL_DATE);
450 case self::CAL_PRESENTATION_WEEK:
452 $start = current($weekday_list);
453 $char = strtolower(mb_substr($this->
lng->txt(
"week"), 0, 1));
454 $bucket_title .=
" " . $start->get(
IL_CAL_DATE) .
" 1$char";
456 case self::CAL_PRESENTATION_MONTH:
458 $char = strtolower(mb_substr($this->
lng->txt(
"month"), 0, 1));
459 $bucket_title .=
" " . $year_month .
" 1" . $char;
461 case self::CAL_PRESENTATION_AGENDA_LIST:
462 $bucket_title .=
" " . $this->seed->get(
IL_CAL_DATE);
463 $get_list_option = intval($this->
user->getPref(
'cal_list_view'));
464 switch ($get_list_option) {
468 $char = strtolower(mb_substr($this->
lng->txt(
"month"), 0, 1));
469 $bucket_title .=
" 1$char";
472 $char = strtolower(mb_substr($this->
lng->txt(
"month"), 0, 1));
473 $bucket_title .=
" 6$char";
477 $char = strtolower(mb_substr($this->
lng->txt(
"week"), 0, 1));
478 $bucket_title .=
" 1$char";
482 return $bucket_title;
494 switch ($get_list_option) {
510 foreach ($events as $event) {
511 $event_start = $event[
'event']->getStart()->get(
IL_CAL_DATE);
addToolbarFileDownload()
Add download link to toolbar.
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
static _getInstance(ilDate $seed, array $a_app)
get singleton instance
An entity that renders components to a string output.
getLinkTarget(object $a_gui_obj, 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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getModalForApp()
Get modal for appointment (see similar code in ilCalendarBlockGUI)
getActivePlugins(string $a_slot_id)
get(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(ilDate $seed, int $presentation_type)
getBucketTitle()
get proper label to add in the background task popover
getContentByPlugins(ilCalendarEntry $a_cal_entry, int $a_start_date, string $a_content, ilTemplate $a_tpl)
const CAL_PRESENTATION_UNDEFINED
static _buildWeekDayList(ilDate $a_day, int $a_weekstart)
build week day list public
const CAL_PRESENTATION_MONTH
setConsulationHoursUserId(int $a_user_id)
initAppointmentIdFromQuery()
setBucketTitle(string $a_title)
Description of class class.
countEventsInView()
get the events starting between 2 dates based in seed + view options.
static _getInstanceByUserId(int $a_user_id)
getPresentationTitle(bool $a_shorten=true)
const CAL_PRESENTATION_AGENDA_LIST
static getPeriod()
needed in CalendarInboxGUI to get events using a proper period.
static http()
Fetches the global http state from ILIAS.
setVariable($variable, $value='')
Sets a variable value.
downloadFiles()
Download files related to the appointments showed in the current calendar view (day,week,month,list).
ilGlobalTemplateInterface $main_tpl
initBookingUserFromQuery()
RefineryFactory $refinery
initInitialDateTimeFromQuery()
const CAL_PRESENTATION_DAY
getModalTitleByPlugins(string $a_current_title)
initInitialDateFromQuery()
ilComponentFactory $component_factory
getStart()
Get start of date period.
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false)
Format a period of two dates Shows: 14.
static initjQuery(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
bool $view_with_appointments
initialize(int $a_calendar_presentation_type)
getAppointmentShyButton(ilCalendarEntry $a_calendar_entry, string $a_dstart, string $a_title_forced="")
const CAL_PRESENTATION_WEEK
getConsultationHoursUserId()
Represents a list of calendar appointments (including recurring events) for a specific user in a give...