19 declare(strict_types=1);
    70         $this->
logger = $DIC->logger()->cal();
    71         $this->
tabs = $DIC->tabs();
    72         $this->obj_data_cache = $DIC[
"ilObjDataCache"];
    73         $this->
ui = $DIC->ui();
    74         $this->
help = $DIC->help();
    75         $this->
http = $DIC->http();
    78         $this->
lng->loadLanguageModule(
"dateplaner");
    79         $this->
help->addHelpSection(
"cal_block");
    81         $this->
ctrl->saveParameter($this, 
'bkid');
    87         $this->allow_moving = 
false;
    89         $params = $DIC->http()->request()->getQueryParams();
    90         $this->requested_cal_agenda_per = (
int) (
$params[
'cal_agenda_per'] ?? null);
    95         } elseif (strlen($seed_str)) {
    98             $seed_str = date(
'Y-m-d', time());
   104         $mode = $this->
user->getPref(
"il_pd_cal_mode");
   105         $this->display_mode = $mode ?: 
"mmon";
   107         if ($this->display_mode !== 
"mmon") {
   114         if ($this->
http->wrapper()->query()->has(
'bkid')) {
   115             return $this->
http->wrapper()->query()->retrieve(
   125         if ($this->
http->wrapper()->query()->has(
'seed')) {
   126             return $this->
http->wrapper()->query()->retrieve(
   128                 $this->
refinery->kindlyTo()->string()
   136         if ($this->
http->wrapper()->query()->has(
'app_id')) {
   137             return $this->
http->wrapper()->query()->retrieve(
   147         if ($this->
http->wrapper()->query()->has(
'dt')) {
   148             return $this->
http->wrapper()->query()->retrieve(
   161         return ($this->
settings->getShowWeeks() && $this->user_settings->getShowWeeks());
   169         return self::$block_type;
   182         $this->parent_gui = $a_val;
   192         $this->force_month_view = $a_val;
   194             $this->display_mode = 
"mmon";
   211         $ilCtrl = $DIC->ctrl();
   212         $cmd_class = $ilCtrl->getCmdClass();
   214         $cmd = $ilCtrl->getCmd();
   216         if ($cmd_class == 
"ilcalendarappointmentgui" ||
   217             $cmd_class == 
"ilconsultationhoursgui" ||
   218             $cmd == 
'showCalendarSubscription') {
   226         $next_class = $this->
ctrl->getNextClass();
   227         $cmd = $this->
ctrl->getCmd(
"getHTML");
   231         switch ($next_class) {
   232             case "ilcalendarappointmentgui":
   235                 $this->
ctrl->forwardCommand($app_gui);
   238             case "ilconsultationhoursgui":
   240                 $this->
ctrl->forwardCommand($hours);
   243             case "ilcalendarappointmentpresentationgui":
   249                         'Invalid appointment ID for ref_id: ' .
   251                         (
string) $this->requested_ref_id
   259             case "ilcalendarmonthgui":
   260                 $this->
tabs->setSubTabActive(
'app_month');
   262                 $this->
ctrl->forwardCommand($month_gui);
   266                 return $this->$cmd();
   273         $target_class = array();
   275             $target_class = array(
"ildashboardgui", 
"ilcalendarpresentationgui");
   279                     $target_class = array(
"ilobjcoursegui", 
"ilcalendarpresentationgui");
   283                     $target_class = array(
"ilobjgroupgui", 
"ilcalendarpresentationgui");
   287         return $target_class;
   311             $a_tpl->
setVariable(
'TXT_WEEKDAY', $this->
lng->txt(
"cal_week_abbrev"));
   314         for ($i = $this->user_settings->getWeekStart(); $i < (7 + $this->user_settings->getWeekStart()); $i++) {
   323             $disable_empty = 
true;
   326             $disable_empty = 
false;
   329         $this->scheduler->addSubitemCalendars(
true);
   330         $this->scheduler->calculate();
   336             $this->user_settings->getWeekStart()
   340             $events = $this->scheduler->getByDay($date, $this->
user->getTimeZone());
   341             $has_events = (bool) count($events);
   342             if ($has_events || !$disable_empty) {
   348             if ($disable_empty) {
   350                     $a_tpl->
setVariable(
'DAY_CLASS', 
'calminiinactive');
   352                     $week_has_events = 
true;
   353                     foreach ($events as $event) {
   355                         if ($booking->hasBooked($event[
'event']->getEntryId())) {
   361             } elseif ($has_events) {
   362                 $week_has_events = 
true;
   372             $last_gui = end(
$path);
   373             $this->
ctrl->setParameterByClass($last_gui, 
'seed', $date->get(
IL_CAL_DATE));
   374             if ($agenda_view_type = $this->requested_cal_agenda_per) {
   375                 $this->
ctrl->setParameterByClass($last_gui, 
"cal_agenda_per", $agenda_view_type);
   377             $a_tpl->
setVariable(
'OPEN_DAY_VIEW', $this->
ctrl->getLinkTargetByClass($this->getTargetGUIClassPath(), 
''));
   397             if ($counter and !($counter % 7)) {
   410                 $week_has_events = 
false;
   414         if ($a_include_view_ctrl) {
   426         $first_of_month = substr($this->seed->get(
IL_CAL_DATE), 0, 7) . 
"-01";
   432         $prev_link = $this->
ctrl->getLinkTarget($this, 
"setSeed", 
"", 
true);
   436         $next_link = $this->
ctrl->getLinkTarget($this, 
"setSeed", 
"", 
true);
   438         $this->
ctrl->setParameter($this, 
'seed', 
"");
   444         $b1 = 
$ui->factory()->button()->standard($this->
lng->txt(
"previous"), 
"#")->
withOnLoadCode(
function (
$id) use (
   449                 "$('#" . 
$id . 
"').click(function() { ilBlockJSHandler('block_" . $blockgui->getBlockType() .
   450                 "_" . $blockgui->getBlockId() . 
"','" . $prev_link . 
"'); return false;});";
   454         $this->
ctrl->clearParameterByClass(
"ilcalendarblockgui", 
'seed');
   455         $month_link = $this->
ctrl->getLinkTarget($this, 
"setSeed", 
"", 
true, 
false);
   456         $seed_parts = explode(
"-", $this->seed->get(
IL_CAL_DATE));
   457         $b2 = 
$ui->factory()->button()->month($seed_parts[1] . 
"-" . $seed_parts[0])->withOnLoadCode(
function (
$id) use (
   461             return "$('#" . 
$id . 
"').on('il.ui.button.month.changed', function(el, id, month) { var m = month.split('-'); ilBlockJSHandler('block_" . $blockgui->getBlockType() .
   462                 "_" . $blockgui->getBlockId() . 
"','" . $month_link . 
"' + '&seed=' + m[1] + '-' + m[0] + '-01'); return false;});";
   470                 "$('#" . 
$id . 
"').click(function() { ilBlockJSHandler('block_" . $blockgui->getBlockType() .
   471                 "_" . $blockgui->getBlockId() . 
"','" . $next_link . 
"'); return false;});";
   474         return $ui->factory()->viewControl()->section($b1, $b2, $b3);
   490                 $obj_id = $ilObjDataCache->lookupObjId((
int) $this->requested_ref_id);
   492                 $users = array_unique(array_merge($participants->getTutors(), $participants->getAdmins()));
   500                     $next_app = end($appointments);
   501                     reset($appointments);
   503                     foreach ($appointments as $entry) {
   509                         if (!in_array($obj_id, $booking_entry->getTargetObjIds())) {
   513                         if (!$booking_entry->isAppointmentBookableForUser($entry->getEntryId(), 
$user->
getId())) {
   521                     $this->
ctrl->setParameterByClass(end(
$path), 
"ch_user_id", $user_id);
   524                         $this->cal_footer[] = array(
   525                             'link' => $this->
ctrl->getLinkTargetByClass(
   526                                 $this->getTargetGUIClassPath(),
   527                                 'selectCHCalendarOfUser'   529                             'txt' => str_replace(
   532                                 $this->
lng->txt(
"cal_consultation_hours_for_user")
   537                     $last_gui = end(
$path);
   538                     $this->
ctrl->setParameterByClass($last_gui, 
"ch_user_id", 
"");
   539                     $this->
ctrl->setParameterByClass($last_gui, 
"bkid", $bkid);
   540                     $this->
ctrl->setParameterByClass($last_gui, 
"seed", $this->seed->get(
IL_CAL_DATE));
   542                 $this->
ctrl->setParameter($this, 
"bkid", 
"");
   543                 $this->
ctrl->setParameter($this, 
'seed', 
'');
   545                 $this->
ctrl->setParameter($this, 
"bkid", 
"");
   547                     $this->
ctrl->getLinkTarget($this),
   548                     $this->
lng->txt(
"back")
   556                 $this->
ctrl->getLinkTarget($this, 
"editSettings"),
   557                 $this->
lng->txt(
"settings")
   562         $ret = parent::getHTML();
   566         if ($this->
ctrl->isAsynch()) {
   567             $f = $this->
ui->factory()->legacy(
"");
   568             $ret .= $this->
ui->renderer()->renderAsync(
$f);
   570         if (count($this->modals) > 0) {
   571             if ($this->
ctrl->isAsynch()) {
   572                 $ret .= $this->
ui->renderer()->renderAsync($this->modals);
   574                 $ret .= $this->
ui->renderer()->render($this->modals);
   585         $events = $schedule->getChangedEvents(
true);
   587         $this->
ctrl->setParameterByClass(
'ilcalendarinboxgui', 
'changed', 1);
   588         $link = 
'<a href=' . $this->
ctrl->getLinkTargetByClass(
'ilcalendarinboxgui', 
'') . 
'>';
   589         $this->
ctrl->setParameterByClass(
'ilcalendarinboxgui', 
'changed', 
'');
   590         $text = 
'<div class="small">' . (count($events)) . 
" " . $this->
lng->txt(
"cal_changed_events_header") . 
"</div>";
   593         return $link . 
$text . $end_link;
   602         } elseif (!$cats->getMode()) {
   605                 (
int) $this->requested_ref_id,
   613         $this->
tabs->clearSubTabs();
   622         if ($this->
ctrl->isAsynch()) {
   632         $this->
ctrl->returnToParent($this);
   642                 $this->
ctrl->getLinkTarget($this, 
"setPdModeEvents"),
   643                 $this->
lng->txt(
"cal_upcoming_events_header"),
   650                 $this->
ctrl->getLinkTarget($this, 
"setPdModeMonth"),
   651                 $this->
lng->txt(
"app_month"),
   652                 $this->
ctrl->getLinkTarget($this, 
"setPdModeMonth", 
"", 
true)
   657                 $this->
ctrl->setParameterByClass(
'ilcalendarpresentationgui', 
'seed', 
'');
   659                     $this->
ctrl->getLinkTargetByClass($this->getTargetGUIClassPath(), 
""),
   660                     $this->
lng->txt(
"cal_open_calendar")
   663                 if ($this->
access->checkAccess(
'edit_event', 
'', (
int) $this->requested_ref_id)) {
   664                     $this->
ctrl->setParameter($this, 
"add_mode", 
"");
   666                         $this->
ctrl->getLinkTargetByClass(
"ilCalendarAppointmentGUI", 
"add"),
   667                         $this->
lng->txt(
"add_appointment")
   669                     $this->
ctrl->setParameter($this, 
"add_mode", 
"");
   679         $this->
user->writePref(
"il_pd_cal_mode", 
"evt");
   680         $this->display_mode = 
"evt";
   682         if ($this->
ctrl->isAsynch()) {
   686             $this->
ctrl->returnToParent($this);
   694         $this->
user->writePref(
"il_pd_cal_mode", 
"mmon");
   695         $this->display_mode = 
"mmon";
   697         if ($this->
ctrl->isAsynch()) {
   701             $this->
ctrl->redirectByClass(
"ildashboardgui", 
"show");
   709                 array_key_exists(
'event', $event) &&
   711                 $event[
'event']->getEntryId() === $a_appointment_id
   724         $schedule->addSubitemCalendars(
true); 
   725         $schedule->setEventsLimit(20);
   726         $schedule->calculate();
   728         return $schedule->getScheduledEvents();
   741         if (
sizeof($events)) {
   742             foreach ($events as $item) {
   743                 $this->
ctrl->setParameter($this, 
"app_id", $item[
"event"]->getEntryId());
   744                 $this->
ctrl->setParameter($this, 
'dt', $item[
'dstart']);
   745                 $url = $this->
ctrl->getLinkTarget($this, 
"getModalForApp", 
"", 
true, 
false);
   748                 $modal = 
$f->modal()->roundtrip(
'', [])->withAsyncRenderUrl(
$url);
   752                 $shy = 
$f->button()->shy(
   753                     $item[
"event"]->getPresentationTitle(),
   755                 )->withOnClick($modal->getShowSignal());
   759                     "title" => $item[
"event"]->getPresentationTitle(),
   761                     "shy_button" => $shy,
   787         $start = $item[
"dstart"];
   788         $end = $item[
"dend"];
   789         if ($item[
"fullday"]) {
   796         return array(
"start" => $start, 
"end" => $end);
   809         $r = 
$ui->renderer();
   813         foreach ($events as $item) {
   819                 $content = $this->
ctrl->getHTML($next_gui);
   821                 $modal = 
$f->modal()->roundtrip(
   825                 echo 
$r->renderAsync($modal);
   836         return parent::getViewControlsForPanel();
   845             "tpl.calendar_block.html",
   848             "components/ILIAS/Calendar"   853         $panel_tpl = new \ilTemplate(
   854             'tpl.cal_block_panel.html',
   857             'components/ILIAS/Calendar'   862         return $tpl->
get() . $panel_tpl->get();
   871         if (isset($data[
"modal"])) {
   872             $this->modals[] = $data[
"modal"];
   874         if (isset($data[
"shy_button"])) {
   875             return $factory->item()->standard($data[
"shy_button"])->withDescription($data[
"date"]);
   877             return $factory->item()->standard($data[
"date"]);
   887         return $this->
lng->txt(
"cal_no_events_block");
   897         $ui_factory = $DIC->ui()->factory();
   898         $ui_renderer = $DIC->ui()->renderer();
   901         $gui_path[] = strtolower(\ilCalendarSubscriptionGUI::class);
   902         $url = $this->
ctrl->getLinkTargetByClass($gui_path, 
'getModalForSubscription', 
"", 
true, 
false);
   904         $roundtrip_modal = $ui_factory->modal()->roundtrip(
'', [])->withAsyncRenderUrl(
$url);
   906         $standard_button = $ui_factory->button()->standard($this->
lng->txt(
'btn_ical'), 
'')->withOnClick(
   907             $roundtrip_modal->getShowSignal()
 
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
 
static _getInstance(ilDate $seed, array $a_app)
get singleton instance 
 
initBookingUserFromQuery()
 
static get(string $a_var)
 
ilCalendarUserSettings $user_settings
 
ilCalendarSettings $settings
 
getDatesForItem(array $item)
Get start/end date for item. 
 
static _buildMonthDayList(int $a_month, int $a_year, int $weekstart)
Build a month day list. 
 
get(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
getShowWeeksColumn()
Show weeks column. 
 
static _before(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets. 
 
static _lookupFullname(int $a_user_id)
 
static getScreenMode()
Get Screen Mode for current command. 
 
setBlockId(string $a_block_id="0")
 
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
 
Interface Observer  Contains several chained tasks and infos about them. 
 
setEnableNumInfo(bool $a_enablenuminfo)
 
initAppointmentIdFromQuery()
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
__construct()
Constructor. 
 
static string $block_type
 
getNoItemFoundContent()
No item entry. 
 
const MODE_REPOSITORY_CONTAINER_ONLY
 
setParentGUI(string $a_val)
 
static _numericMonthToString(int $a_month, bool $a_long=true, ilLanguage $lng=null)
numeric month to string 
 
getEventByAppointmentId(int $a_appointment_id)
 
getModalForApp()
Get modal for appointment (see similar code in ilCalendarAgendaListGUI) todo use all this methods fro...
 
getHTML()
Get bloch HTML code. 
 
static _getInstanceByUserId(int $a_user_id)
 
withOnLoadCode(Closure $binder)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
ilObjectDataCache $obj_data_cache
 
static http()
Fetches the global http state from ILIAS. 
 
RefineryFactory $refinery
 
setVariable($variable, $value='')
Sets a variable value. 
 
static _getInstanceByObjId(int $a_obj_id)
 
addMiniMonth(ilTemplate $a_tpl, bool $a_include_view_ctrl=false)
Add mini version of monthly overview (Maybe extracted to another class, if used in pd calendar tab...
 
getViewControlsForPanel()
 
ilCalendarSchedule $scheduler
 
addBlockCommand(string $a_href, string $a_text, string $a_onclick="", RoundTrip $modal=null)
 
static _getInstance($a_usr_id=0)
get singleton instance 
 
static getAppointments(int $a_user_id)
Get all appointments. 
 
addSubscriptionButton(ilTemplate $panel_template)
Add subscription button. 
 
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
 
setForceMonthView(bool $a_val)
 
static _numericDayToString(int $a_day, bool $a_long=true, ilLanguage $lng=null)
 
This describes a Section Control. 
 
Administrate calendar appointments. 
 
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false, ilObjUser $user=null)
Format a period of two dates Shows: 14. 
 
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins 
 
Calendar blocks, displayed in different contexts, e.g. 
 
__construct(Container $dic, ilPlugin $plugin)
 
static lookupBookableUsersForObject(array $a_obj_id, array $a_user_ids)
Consultation hours are offered if 1) consultation hour owner is admin or tutor and no object assignme...
 
setTitle(string $a_title)
 
static _equals(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
Check if two date are equal. 
 
getListItemForData(array $data)
 
This class represents a block method of a block. 
 
static _lookupType(int $id, bool $reference=false)
 
getProperty(string $a_property)
 
setPresentation(int $type)
 
static set(string $a_var, $a_val)
Set a value. 
 
static _isToday(ilDateTime $date)
 
Represents a list of calendar appointments (including recurring events) for a specific user in a give...
 
int $requested_cal_agenda_per