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:
172 switch ($this->period) {
203 $this->period_end_day = $end_date->get(
IL_CAL_DATE);
204 $schedule->setPeriod($this->seed, $end_date);
213 case self::CAL_PRESENTATION_DAY:
216 case self::CAL_PRESENTATION_WEEK:
219 case self::CAL_PRESENTATION_MONTH:
226 $schedule->addSubitemCalendars(
true);
227 $schedule->calculate();
228 return $schedule->getScheduledEvents();
238 $start = $item[
"dstart"];
239 $end = $item[
"dend"];
240 if ($item[
"fullday"]) {
247 return array(
"start" => $start,
"end" => $end);
257 $this->
ctrl->setReturn($this,
'');
263 foreach ($events as $item) {
268 $content = $this->
ctrl->getHTML($next_gui);
273 $modal = $this->ui_factory->modal()->roundtrip(
275 $this->ui_factory->legacy($content)
276 )->withCancelButtonLabel(
"close");
277 echo $this->ui_renderer->renderAsync($modal);
292 string $a_title_forced =
"" 294 $this->
ctrl->setParameter($this,
"app_id", $a_calendar_entry->
getEntryId());
299 $this->
ctrl->setParameter($this,
'dt', $a_dstart);
300 $this->
ctrl->setParameter($this,
'seed', $this->seed->get(
IL_CAL_DATE));
301 $url = $this->
ctrl->getLinkTarget($this,
"getModalForApp",
"",
true,
false);
304 $this->
ctrl->setParameter($this,
'seed', $this->seed->get(
IL_CAL_DATE));
306 $modal = $this->ui_factory->modal()->roundtrip(
'', [])->withAsyncRenderUrl(
$url);
309 if ($this->presentation_type == self::CAL_PRESENTATION_DAY) {
310 $title = ($a_title_forced ==
"") ? $a_calendar_entry->
getPresentationTitle(
false) : $a_title_forced;
314 $comps = [$this->ui_factory->button()->shy($title,
"#")->withOnClick($modal->getShowSignal()), $modal];
315 return $this->ui_renderer->render($comps);
324 return $this->component_factory->getActivePluginsInSlot($a_slot_id);
329 $modal_title = $a_current_title;
333 $modal_title = ($new_title = $plugin->editModalTitle($a_current_title)) ? $new_title : $a_current_title;
351 $content = $a_content;
357 if ($new_title = $plugin->editShyButtonTitle()) {
364 if ($glyph = $plugin->addGlyph()) {
365 $a_tpl->
setVariable(
'EXTRA_GLYPH_BY_PLUGIN', $glyph);
368 if ($more_content = $plugin->addExtraContent()) {
369 $a_tpl->
setVariable(
'EXTRA_CONTENT_BY_PLUGIN', $more_content);
373 $html_content = $a_tpl->
get();
375 if ($new_content = $plugin->replaceContent($html_content)) {
376 $content = $new_content;
379 if ($content == $a_content) {
392 if (
$settings->isBatchFileDownloadsEnabled()) {
394 if ($this->presentation_type == self::CAL_PRESENTATION_AGENDA_LIST) {
397 if ($this->view_with_appointments || $num_events) {
404 $add_button =
$f->button()->standard(
405 $this->
lng->txt(
"cal_download_files"),
421 $download_job->setEvents($this->
getEvents());
422 if ($download_job->run()) {
423 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'cal_download_files_started'),
true);
425 $this->
ctrl->redirect($this);
435 $bucket_title = $this->
lng->txt(
"cal_calendar_download");
437 switch ($this->presentation_type) {
438 case self::CAL_PRESENTATION_DAY:
439 $bucket_title .=
" " . $this->seed->get(
IL_CAL_DATE);
441 case self::CAL_PRESENTATION_WEEK:
443 $start = current($weekday_list);
444 $char = strtolower(mb_substr($this->
lng->txt(
"week"), 0, 1));
445 $bucket_title .=
" " . $start->get(
IL_CAL_DATE) .
" 1$char";
447 case self::CAL_PRESENTATION_MONTH:
449 $char = strtolower(mb_substr($this->
lng->txt(
"month"), 0, 1));
450 $bucket_title .=
" " . $year_month .
" 1" . $char;
452 case self::CAL_PRESENTATION_AGENDA_LIST:
453 $bucket_title .=
" " . $this->seed->get(
IL_CAL_DATE);
454 $get_list_option = intval($this->
user->getPref(
'cal_list_view'));
455 switch ($get_list_option) {
459 $char = strtolower(mb_substr($this->
lng->txt(
"month"), 0, 1));
460 $bucket_title .=
" 1$char";
463 $char = strtolower(mb_substr($this->
lng->txt(
"month"), 0, 1));
464 $bucket_title .=
" 6$char";
468 $char = strtolower(mb_substr($this->
lng->txt(
"week"), 0, 1));
469 $bucket_title .=
" 1$char";
473 return $bucket_title;
485 switch ($get_list_option) {
501 foreach ($events as $event) {
502 $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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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
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...