3 declare(strict_types=1);
    51     public function initialize(
int $a_calendar_presentation_type): void
    53         parent::initialize($a_calendar_presentation_type); 
    57         if ($this->
user->getTimeZone()) {
    58             $this->timezone = $this->
user->getTimeZone();
    64         $this->
ctrl->saveParameter($this, 
'seed');
    65         $next_class = $this->
ctrl->getNextClass();
    66         switch ($next_class) {
    67             case "ilcalendarappointmentpresentationgui":
    68                 $this->
ctrl->setReturn($this, 
"");
    70                 $this->
ctrl->forwardCommand($gui);
    72             case 'ilcalendarappointmentgui':
    73                 $this->
ctrl->setReturn($this, 
'');
    74                 $this->tabs_gui->setSubTabActive((
string) 
ilSession::get(
'cal_last_tab'));
    79                 $this->
ctrl->forwardCommand($app);
    83                 $time = microtime(
true);
    84                 $cmd = $this->
ctrl->getCmd(
"show");
    86                 $this->main_tpl->setContent($this->tpl->get());
    91     public function show(): void
    95         $evening_aggr = $this->user_settings->getDayEnd() * 60;
    97         $this->tpl = 
new ilTemplate(
'tpl.week_view.html', 
true, 
true, 
'components/ILIAS/Calendar');
   102         $this->tpl->setVariable(
'NAVIGATION', $navigation->getHTML());
   108             $this->
user->getId(),
   112         $scheduler->calculate();
   116         $all_fullday = array();
   118             $daily_apps = $scheduler->getByDay($date, $this->timezone);
   119             if (!$this->view_with_appointments && count($daily_apps)) {
   120                 $this->view_with_appointments = 
true;
   130             $this->weekdays[] = $date;
   132             $num_apps[$date->get(
IL_CAL_DATE)] = count($daily_apps);
   134             $all_fullday[] = $daily_apps;
   145             $this->
ctrl->setParameterByClass(
'ilcalendarappointmentgui', 
'seed', $date->get(
IL_CAL_DATE));
   146             $this->
ctrl->setParameterByClass(
'ilcalendarappointmentgui', 
'idate', $date->get(
IL_CAL_DATE));
   147             $this->
ctrl->setParameterByClass(
'ilcalendardaygui', 
'seed', $date->get(
IL_CAL_DATE));
   149             if (!$this->no_add) {
   155             $this->tpl->setCurrentBlock(
'day_header_row');
   156             $this->tpl->setVariable(
'DAY_COLSPAN', max($this->colspans[$counter], 1));
   157             $this->tpl->parseCurrentBlock();
   168         $this->tpl->setVariable(
"TXT_TIME", $this->
lng->txt(
"time"));
   173         $event_tpl = 
new ilTemplate(
'tpl.day_event_view.html', 
true, 
true, 
'components/ILIAS/Calendar');
   174         $event_tpl->setCurrentBlock(
'fullday_app');
   178         $event_tpl->setVariable(
'EVENT_CONTENT', $title);
   180         $color = $this->app_colors->getColorByAppointment($a_app[
'event']->getEntryId());
   183         $event_tpl->setVariable(
'F_APP_BGCOLOR', $color);
   184         $event_tpl->setVariable(
'F_APP_FONTCOLOR', $font_color);
   186         $this->
ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
   187         $this->
ctrl->setParameterByClass(
'ilcalendarappointmentgui', 
'app_id', $a_app[
'event']->getEntryId());
   188         $event_tpl->setVariable(
   190             $this->
ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui', 
'edit')
   193         if ($event_html_by_plugin = $this->
getContentByPlugins($a_app[
'event'], $a_app[
'dstart'], $title, $event_tpl)) {
   194             $event_html = $event_html_by_plugin;
   196             $event_tpl->parseCurrentBlock();
   197             $event_html = $event_tpl->get();
   200         $this->tpl->setCurrentBlock(
"content_fd");
   201         $this->tpl->setVariable(
"CONTENT_EVENT_FD", $event_html);
   202         $this->tpl->parseCurrentBlock();
   204         $this->num_appointments++;
   210         $event_tpl = 
new ilTemplate(
'tpl.week_event_view.html', 
true, 
true, 
'components/ILIAS/Calendar');
   214         $this->tpl->setCurrentBlock(
'not_empty');
   216         $this->
ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
   217         $this->
ctrl->setParameterByClass(
'ilcalendarappointmentgui', 
'app_id', $a_app[
'event']->getEntryId());
   219         $color = $this->app_colors->getColorByAppointment($a_app[
'event']->getEntryId());
   220         $style = 
'background-color: ' . $color . 
';';
   224         if (!$a_app[
'event']->isFullDay()) {
   227             $td_style .= $a_app[
'event']->getPresentationStyle();
   232         $title = ($time != 
"") ? $time . 
" " . $shy : $shy;
   234         $event_tpl->setCurrentBlock(
'event_cell_content');
   235         $event_tpl->setVariable(
"STYLE", $style);
   236         $event_tpl->setVariable(
'EVENT_CONTENT', $title);
   238         if ($event_html_by_plugin = $this->
getContentByPlugins($a_app[
'event'], $a_app[
'dstart'], $title, $event_tpl)) {
   239             $event_html = $event_html_by_plugin;
   241             $event_tpl->parseCurrentBlock();
   242             $event_html = $event_tpl->get();
   245         $this->tpl->setVariable(
'GRID_CONTENT', $event_html);
   248         $this->tpl->parseCurrentBlock();
   250         $this->tpl->setCurrentBlock(
'day_cell');
   252         $this->tpl->setVariable(
'DAY_ID', 
'a' . $this->num_appointments);
   253         $this->tpl->setVariable(
'TD_ROWSPAN', $a_app[
'rowspan']);
   254         $this->tpl->setVariable(
'TD_STYLE', $a_app[
'event']->getPresentationStyle());
   255         $this->tpl->setVariable(
'TD_CLASS', 
'calevent il_calevent');
   257         $this->tpl->parseCurrentBlock();
   259         $this->num_appointments++;
   272         int $morning_aggr = 0,
   273         int $evening_aggr = 0
   275         for ($i = $morning_aggr; $i <= $evening_aggr; $i += 
$this->raster) {
   276             $hours[$i][$num_day][
'apps_start'] = array();
   277             $hours[$i][$num_day][
'apps_num'] = 0;
   278             switch ($this->user_settings->getTimeFormat()) {
   280                     if ($morning_aggr > 0 && $i == $morning_aggr) {
   281                         $hours[$i][$num_day][
'txt'] = sprintf(
'%02d:00', 0) . 
' - ' .
   282                             sprintf(
'%02d:00', ceil(($i + 1) / 60));
   284                         if (!isset($hours[$i][$num_day][
'txt'])) {
   285                             $hours[$i][$num_day][
'txt'] = sprintf(
'%02d:%02d', floor($i / 60), $i % 60);
   287                             $hours[$i][$num_day][
'txt'] .= sprintf(
'%02d:%02d', floor($i / 60), $i % 60);
   290                     if ($evening_aggr < 23 * 60 && $i == $evening_aggr) {
   291                         if (!isset($hours[$i][$num_day][
'txt'])) {
   292                             $hours[$i][$num_day][
'txt'] = 
' - ' . sprintf(
'%02d:00', 0);
   294                             $hours[$i][$num_day][
'txt'] .= 
' - ' . sprintf(
'%02d:00', 0);
   300                     if ($morning_aggr > 0 && $i == $morning_aggr) {
   301                         $hours[$i][$num_day][
'txt'] =
   302                             date(
'h a', mktime(0, 0, 0, 1, 1, 2000)) . 
' - ' .
   303                             date(
'h a', mktime($this->user_settings->getDayStart(), 0, 0, 1, 1, 2000));
   305                         if (!isset($hours[$i][$num_day][
'txt'])) {
   306                             $hours[$i][$num_day][
'txt'] = date(
'h a', mktime((
int) floor($i / 60), $i % 60, 0, 1, 1, 2000));
   308                             $hours[$i][$num_day][
'txt'] .= date(
'h a', mktime((
int) floor($i / 60), $i % 60, 0, 1, 1, 2000));
   311                     if ($evening_aggr < 23 * 60 && $i == $evening_aggr) {
   312                         $hours[$i][$num_day][
'txt'] =
   313                             date(
'h a', mktime($this->user_settings->getDayEnd(), 0, 0, 1, 1, 2000)) . 
' - ' .
   314                             date(
'h a', mktime(0, 0, 0, 1, 1, 2000));
   322         foreach ($daily_apps as $app) {
   324             if ($app[
'fullday']) {
   329             if ($app[
'start_info'][
'mday'] != $date_info[
'mday']) {
   332                 $start = $app[
'start_info'][
'hours'] * 60 + $app[
'start_info'][
'minutes'];
   338             if ($app[
'end_info'][
'mday'] != $date_info[
'mday']) {
   340             } elseif ($app[
'start_info'][
'hours'] == $app[
'end_info'][
'hours']) {
   343                 $end = $app[
'end_info'][
'hours'] * 60 + $app[
'end_info'][
'minutes'];
   348             if ($start < $morning_aggr) {
   349                 $start = $morning_aggr;
   351             if ($end <= $morning_aggr) {
   354             if ($start > $evening_aggr) {
   355                 $start = $evening_aggr;
   357             if ($end > $evening_aggr + $this->raster) {
   360             if ($end <= $start) {
   371                     $app[
'rowspan'] = ceil(($end - $start) / $this->raster);
   372                     $hours[$i][$num_day][
'apps_start'][] = $app;
   375                 $hours[$i][$num_day][
'apps_num']++;
   383         foreach ($hours as $hour_num => $hours_per_day) {
   384             foreach ($hours_per_day as $num_day => $hour) {
   385                 $this->colspans[$num_day] = max($this->colspans[$num_day] ?? 0, $hour[
'apps_num'] ?? 0);
   392         if ($this->user_settings->getDayStart()) {
   394             $morning_aggr = ($this->user_settings->getDayStart() - 1) * 60 + (60 - $this->raster);
   399         return $morning_aggr;
   404         $new_app_url = $this->
ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui', 
'add');
   406         $this->tpl->setCurrentBlock(
"new_app");
   408         $this->tpl->setVariable(
'NEW_APP_GLYPH', $this->ui_renderer->render(
   409             $this->ui_factory->symbol()->glyph()->add($new_app_url)
   412         $this->tpl->parseCurrentBlock();
   416         $this->
ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
   423             $this->user_id = $bkid;
   424             $this->disable_empty = 
true;
   425             $this->no_add = 
true;
   427             $this->disable_empty = 
false;
   428             $this->no_add = 
true;
   430             $this->disable_empty = 
false;
   431             $this->no_add = 
false;
   439         $daydate = $dayname . 
' ' . $date_info[
'mday'] . 
'.';
   441         if (!$this->disable_empty || $num_apps[$date->get(
IL_CAL_DATE)] > 0) {
   442             $link = $this->
ctrl->getLinkTargetByClass(
'ilcalendardaygui', 
'');
   443             $this->
ctrl->clearParametersByClass(
'ilcalendardaygui');
   445             $this->tpl->setCurrentBlock(
"day_view_link");
   446             $this->tpl->setVariable(
'HEADER_DATE', $daydate);
   447             $this->tpl->setVariable(
'DAY_VIEW_LINK', $link);
   448             $this->tpl->parseCurrentBlock();
   450             $this->tpl->setCurrentBlock(
"day_view_no_link");
   451             $this->tpl->setVariable(
'HEADER_DATE', $daydate);
   452             $this->tpl->parseCurrentBlock();
   459         foreach ($all_fullday as $daily_apps) {
   460             foreach ($daily_apps as $event) {
   461                 if ($event[
'fullday']) {
   465             $this->tpl->setCurrentBlock(
'f_day_row');
   466             $this->tpl->setVariable(
'COLSPAN', max($this->colspans[$counter], 1));
   467             $this->tpl->parseCurrentBlock();
   470         $this->tpl->setCurrentBlock(
'fullday_apps');
   471         $this->tpl->setVariable(
'TXT_F_DAY', $this->
lng->txt(
"cal_all_day"));
   472         $this->tpl->parseCurrentBlock();
   475     protected function addTimedEvents(array $hours, 
int $morning_aggr, 
int $evening_aggr): void
   477         $new_link_counter = 0;
   479         foreach ($hours as $num_hour => $hours_per_day) {
   481             foreach ($hours_per_day as $num_day => $hour) {
   482                 #ADD the hours in the left side of the grid.   484                     if (!($num_hour % 60) || ($num_hour == $morning_aggr && $morning_aggr) ||
   485                         ($num_hour == $evening_aggr && $evening_aggr)) {
   489                         if (($num_hour == $morning_aggr && $morning_aggr) ||
   490                             ($num_hour == $evening_aggr && $evening_aggr)) {
   491                             $this->tpl->setVariable(
'TIME_ROWSPAN', 1);
   494                             $this->tpl->setVariable(
'TIME_ROWSPAN', 60 / $this->raster);
   497                         $this->tpl->setCurrentBlock(
'time_txt');
   499                         $this->tpl->setVariable(
'TIME', $hour[
'txt']);
   500                         $this->tpl->parseCurrentBlock();
   504                 foreach ($hour[
'apps_start'] as $app) {
   507                 $num_apps = $hour[
'apps_num'];
   508                 $colspan = max($this->colspans[$num_day], 1);
   511                 if (!$hour[
'apps_num'] && !$this->no_add) {
   512                     $this->tpl->setCurrentBlock(
'new_app_link');
   514                     $this->
ctrl->clearParameterByClass(
'ilcalendarappointmentgui', 
'app_id');
   516                     $this->
ctrl->setParameterByClass(
   517                         'ilcalendarappointmentgui',
   521                     $this->
ctrl->setParameterByClass(
'ilcalendarappointmentgui', 
'seed', $this->seed->get(
IL_CAL_DATE));
   522                     $this->
ctrl->setParameterByClass(
'ilcalendarappointmentgui', 
'hour', floor($num_hour / 60));
   525                     $new_app_url = $this->
ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui', 
'add');
   526                     $this->tpl->setVariable(
   528                         $this->ui_renderer->render($this->ui_factory->symbol()->glyph()->add($new_app_url))
   530                     $this->tpl->setVariable(
'DAY_NEW_ID', ++$new_link_counter);
   531                     $this->tpl->parseCurrentBlock();
   534                 for ($i = $colspan; $i > $hour[
'apps_num']; $i--) {
   535                     $this->tpl->setCurrentBlock(
'day_cell');
   539                     if ($num_hour % 60 == 60 - $this->raster ||
   540                         ($num_hour == $morning_aggr && $morning_aggr) ||
   541                         ($num_hour == $evening_aggr && $evening_aggr)) {
   542                         $empty_border = 
' calempty_border';
   545                     $this->tpl->setVariable(
'TD_CLASS', 
'calempty createhover' . $empty_border);
   547                     $this->tpl->setVariable(
'DAY_ID', ++$day_id_counter);
   548                     $this->tpl->setVariable(
'TD_ROWSPAN', 1);
   549                     $this->tpl->parseCurrentBlock();
   552             $this->tpl->touchBlock(
'time_row');
   563         switch ($this->user_settings->getTimeFormat()) {
 static _getInstance(ilDate $seed, array $a_app)
get singleton instance 
 
get(int $a_format, string $a_format_str='', string $a_tz='')
get formatted date 
 
ilCalendarSettings $cal_settings
 
static get(string $a_var)
 
addAppointmentLink(ilDateTime $date)
 
calculateColspans(array $hours)
 
getContentByPlugins(ilCalendarEntry $a_cal_entry, int $a_start_date, string $a_content, ilTemplate $a_tpl)
 
showFulldayAppointment(array $a_app)
 
static _buildWeekDayList(ilDate $a_day, int $a_weekstart)
build week day list  public 
 
initAppointmentIdFromQuery()
 
static _getInstanceByUserId(int $a_user_id)
 
addFullDayEvents($all_fullday)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
initBookingUserFromQuery()
 
ilCalendarUserSettings $user_settings
 
getAppointmentTimeString(ilCalendarEntry $a_event)
 
static initDragDrop(?ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI Drag and Drop used in Modules/Survey, Services/Calendar, Services/COPage, Services/Form (Jan 2022) 
 
initInitialDateFromQuery()
 
initialize(int $a_calendar_presentation_type)
 
getStart()
Get start of date period. 
 
showAppointment(array $a_app)
 
static _numericDayToString(int $a_day, bool $a_long=true, ilLanguage $lng=null)
 
ilCalendarAppointmentColors $app_colors
 
Administrate calendar appointments. 
 
__construct(Container $dic, ilPlugin $plugin)
 
static calculateFontColor(string $a_html_color_code)
Calculate best font color from html hex color code. 
 
getAppointmentShyButton(ilCalendarEntry $a_calendar_entry, string $a_dstart, string $a_title_forced="")
 
const CAL_PRESENTATION_WEEK
 
__construct(ilDate $seed_date)
 
parseHourInfo(array $daily_apps, ilDateTime $date, int $num_day, array $hours=null, int $morning_aggr=0, int $evening_aggr=0)
calculate overlapping hours  protected 
 
addSubitemCalendars(bool $a_status)
 
addTimedEvents(array $hours, int $morning_aggr, int $evening_aggr)
 
addHeaderDate($date, $num_apps)
 
Represents a list of calendar appointments (including recurring events) for a specific user in a give...