19declare(strict_types=1);
51 protected \ILIAS\DI\UIServices
$ui;
69 $this->ch_user_id = $a_user_id;
77 public function initialize(
int $a_calendar_presentation_type): void
81 $this->component_factory =
$DIC[
'component.factory'];
82 $this->ui_factory =
$DIC->ui()->factory();
83 $this->ui_renderer =
$DIC->ui()->renderer();
84 $this->
ui = $DIC->ui();
85 $this->
ctrl = $DIC->ctrl();
86 $this->
lng = $DIC->language();
87 $this->
user = $DIC->user();
88 $this->tabs_gui =
$DIC->tabs();
89 $this->
toolbar = $DIC->toolbar();
90 $this->presentation_type = $a_calendar_presentation_type;
91 $this->
logger = $DIC->logger()->cal();
92 $this->view_with_appointments =
false;
93 $this->main_tpl =
$DIC->ui()->mainTemplate();
94 if ($this->presentation_type == self::CAL_PRESENTATION_DAY ||
95 $this->presentation_type == self::CAL_PRESENTATION_WEEK) {
97 $this->main_tpl->addJavaScript(
'assets/js/calendar_appointment.js');
99 $this->
http = $DIC->http();
105 if ($this->
http->wrapper()->query()->has(
'app_id')) {
106 return $this->
http->wrapper()->query()->retrieve(
116 if ($this->
http->wrapper()->query()->has(
'idate')) {
117 return $this->
http->wrapper()->query()->retrieve(
119 $this->
refinery->kindlyTo()->string()
127 if ($this->
http->wrapper()->query()->has(
'dt')) {
128 return $this->
http->wrapper()->query()->retrieve(
138 if ($this->
http->wrapper()->query()->has(
'bkid')) {
139 return $this->
http->wrapper()->query()->retrieve(
151 foreach ($events as $item) {
163 switch ($this->presentation_type) {
197 $this->period_end_day = $end_date->get(
IL_CAL_DATE);
198 $schedule->setPeriod($this->seed, $end_date);
220 $schedule->addSubitemCalendars(
true);
221 $schedule->calculate();
222 return $schedule->getScheduledEvents();
232 $start = $item[
"dstart"];
233 $end = $item[
"dend"];
234 if ($item[
"fullday"]) {
241 return array(
"start" => $start,
"end" => $end);
251 $this->
ctrl->setReturn($this,
'');
257 foreach ($events as $item) {
262 $content = $this->
ctrl->getHTML($next_gui);
267 $modal = $this->ui_factory->modal()->roundtrip(
269 $this->ui_factory->legacy()->content($content)
270 )->withCancelButtonLabel($this->
lng->txt(
"close"));
271 echo $this->ui_renderer->renderAsync($modal);
286 string $a_title_forced =
""
288 $this->
ctrl->setParameter($this,
"app_id", $a_calendar_entry->getEntryId());
293 $this->
ctrl->setParameter($this,
'dt', $a_dstart);
294 $this->
ctrl->setParameter($this,
'seed', $this->seed->get(
IL_CAL_DATE));
295 $url = $this->
ctrl->getLinkTarget($this,
"getModalForApp",
"",
true,
false);
298 $this->
ctrl->setParameter($this,
'seed', $this->seed->get(
IL_CAL_DATE));
300 $modal = $this->ui_factory->modal()->roundtrip(
'', [])->withAsyncRenderUrl(
$url);
303 if ($this->presentation_type == self::CAL_PRESENTATION_DAY) {
304 $title = ($a_title_forced ==
"") ? $a_calendar_entry->
getPresentationTitle(
false) : $a_title_forced;
311 switch ($this->user_settings->getTimeFormat()) {
320 $aria_label = $start_time .
' - ' . $title;
322 $comps = [$this->ui_factory->button()->shy($title,
"#")->withAriaLabel($aria_label)->withOnClick($modal->getShowSignal()), $modal];
323 return $this->ui_renderer->render($comps);
332 return $this->component_factory->getActivePluginsInSlot($a_slot_id);
337 $modal_title = $a_current_title;
340 foreach ($this->getActivePlugins(
"capm") as
$plugin) {
341 $modal_title = ($new_title =
$plugin->editModalTitle($a_current_title)) ? $new_title : $a_current_title;
359 $content = $a_content;
362 foreach ($this->getActivePlugins(
"capg") as
$plugin) {
365 if ($new_title =
$plugin->editShyButtonTitle()) {
368 $this->getAppointmentShyButton($a_cal_entry, (
string) $a_start_date, $new_title)
372 if ($glyph =
$plugin->addGlyph()) {
373 $a_tpl->
setVariable(
'EXTRA_GLYPH_BY_PLUGIN', $glyph);
376 if ($more_content =
$plugin->addExtraContent()) {
377 $a_tpl->
setVariable(
'EXTRA_CONTENT_BY_PLUGIN', $more_content);
381 $html_content = $a_tpl->
get();
383 if ($new_content =
$plugin->replaceContent($html_content)) {
384 $content = $new_content;
387 if ($content == $a_content) {
400 if ($settings->isBatchFileDownloadsEnabled()) {
402 if ($this->presentation_type == self::CAL_PRESENTATION_AGENDA_LIST) {
403 $num_events = $this->countEventsInView();
405 if ($this->view_with_appointments || $num_events) {
406 $toolbar = $this->toolbar;
407 $f = $this->ui_factory;
412 $add_button =
$f->button()->standard(
413 $this->
lng->txt(
"cal_download_files"),
428 $download_job->setBucketTitle($this->getBucketTitle());
429 $download_job->setEvents($this->getEvents());
430 if ($download_job->run()) {
431 $this->main_tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'cal_download_files_started'),
true);
433 $this->
ctrl->redirect($this);
443 $bucket_title = $this->
lng->txt(
"cal_calendar_download");
445 switch ($this->presentation_type) {
446 case self::CAL_PRESENTATION_DAY:
447 $bucket_title .=
" " . $this->seed->get(
IL_CAL_DATE);
449 case self::CAL_PRESENTATION_WEEK:
451 $start = current($weekday_list);
452 $char = strtolower(mb_substr($this->
lng->txt(
"week"), 0, 1));
453 $bucket_title .=
" " . $start->get(
IL_CAL_DATE) .
" 1$char";
455 case self::CAL_PRESENTATION_MONTH:
457 $char = strtolower(mb_substr($this->
lng->txt(
"month"), 0, 1));
458 $bucket_title .=
" " . $year_month .
" 1" . $char;
460 case self::CAL_PRESENTATION_AGENDA_LIST:
461 $bucket_title .=
" " . $this->seed->get(
IL_CAL_DATE);
462 $get_list_option = intval($this->
user->getPref(
'cal_list_view'));
463 switch ($get_list_option) {
467 $char = strtolower(mb_substr($this->
lng->txt(
"month"), 0, 1));
468 $bucket_title .=
" 1$char";
471 $char = strtolower(mb_substr($this->
lng->txt(
"month"), 0, 1));
472 $bucket_title .=
" 6$char";
476 $char = strtolower(mb_substr($this->
lng->txt(
"week"), 0, 1));
477 $bucket_title .=
" 1$char";
481 return $bucket_title;
490 $start = $this->seed;
493 switch ($get_list_option) {
507 $events = $this->getEvents();
509 foreach ($events as $event) {
510 $event_start = $event[
'event']->getStart()->get(
IL_CAL_DATE);
setVariable($variable, $value='')
Sets a variable value.
Provides fluid interface to RBAC services.
Builds a Color from either hex- or rgb values.
static getPeriod()
needed in CalendarInboxGUI to get events using a proper period.
static _getInstance(ilDate $seed, array $a_app)
get singleton instance
Model for a calendar entry.
getStart()
Get start of date period.
getPresentationTitle(bool $a_shorten=true)
Represents a list of calendar appointments (including recurring events) for a specific user in a give...
static _getInstanceByUserId(int $a_user_id)
static _buildWeekDayList(ilDate $a_day, int $a_weekstart)
build week day list @access public
ilComponentFactory $component_factory
getBucketTitle()
get proper label to add in the background task popover
countEventsInView()
get the events starting between 2 dates based in seed + view options.
setConsulationHoursUserId(int $a_user_id)
initInitialDateTimeFromQuery()
getAppointmentShyButton(ilCalendarEntry $a_calendar_entry, string $a_dstart, string $a_title_forced="")
const CAL_PRESENTATION_UNDEFINED
addToolbarFileDownload()
Add download link to toolbar.
const CAL_PRESENTATION_AGENDA_LIST
getModalTitleByPlugins(string $a_current_title)
initialize(int $a_calendar_presentation_type)
const CAL_PRESENTATION_WEEK
bool $view_with_appointments
initInitialDateFromQuery()
initAppointmentIdFromQuery()
getActivePlugins(string $a_slot_id)
getModalForApp()
Get modal for appointment (see similar code in ilCalendarBlockGUI)
initBookingUserFromQuery()
ilGlobalTemplateInterface $main_tpl
__construct(ilDate $seed, int $presentation_type)
const CAL_PRESENTATION_MONTH
RefineryFactory $refinery
downloadFiles()
Download files related to the appointments showed in the current calendar view (day,...
getConsultationHoursUserId()
const CAL_PRESENTATION_DAY
getContentByPlugins(ilCalendarEntry $a_cal_entry, int $a_start_date, string $a_content, ilTemplate $a_tpl)
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false, ?ilObjUser $user=null)
Format a period of two dates Shows: 14.
@classDescription Date and time handling
Description of class class.
Component logger with individual log levels by component id.
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
get(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
Returns a block with all replacements done.
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
static initjQuery(?ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
This is how the factory for UI elements looks.
An entity that renders components to a string output.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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.
static http()
Fetches the global http state from ILIAS.