ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ilCalendarWeekGUI Class Reference
+ Inheritance diagram for ilCalendarWeekGUI:
+ Collaboration diagram for ilCalendarWeekGUI:

Public Member Functions

 __construct (ilDate $seed_date)
 
 initialize (int $a_calendar_presentation_type)
 
 executeCommand ()
 
 show ()
 
- Public Member Functions inherited from ilCalendarViewGUI
 __construct (ilDate $seed, int $presentation_type)
 
 setConsulationHoursUserId (int $a_user_id)
 
 getConsultationHoursUserId ()
 
 initialize (int $a_calendar_presentation_type)
 
 getCurrentApp ()
 
 getEvents ()
 
 getDatesForItem ($item)
 
 getModalForApp ()
 Get modal for appointment (see similar code in ilCalendarBlockGUI) More...
 
 getAppointmentShyButton (ilCalendarEntry $a_calendar_entry, string $a_dstart, string $a_title_forced="")
 
 getActivePlugins (string $a_slot_id)
 
 getModalTitleByPlugins (string $a_current_title)
 
 getContentByPlugins (ilCalendarEntry $a_cal_entry, int $a_start_date, string $a_content, ilTemplate $a_tpl)
 
 addToolbarFileDownload ()
 Add download link to toolbar. More...
 
 downloadFiles ()
 Download files related to the appointments showed in the current calendar view (day,week,month,list). More...
 
 getBucketTitle ()
 get proper label to add in the background task popover More...
 
 countEventsInView ()
 get the events starting between 2 dates based in seed + view options. More...
 

Protected Member Functions

 showFulldayAppointment (array $a_app)
 
 showAppointment (array $a_app)
 
 parseHourInfo (array $daily_apps, ilDateTime $date, int $num_day, ?array $hours=null, int $morning_aggr=0, int $evening_aggr=0)
 calculate overlapping hours @access protected More...
 
 calculateColspans (array $hours)
 
 getMorningAggr ()
 
 addAppointmentLink (ilDateTime $date)
 
 setUpCalendar ()
 
 addHeaderDate ($date, $num_apps)
 
 addFullDayEvents ($all_fullday)
 
 addTimedEvents (array $hours, int $morning_aggr, int $evening_aggr)
 
 getAppointmentTimeString (ilCalendarEntry $a_event)
 
- Protected Member Functions inherited from ilCalendarViewGUI
 initAppointmentIdFromQuery ()
 
 initInitialDateFromQuery ()
 
 initInitialDateTimeFromQuery ()
 
 initBookingUserFromQuery ()
 

Protected Attributes

int $num_appointments = 1
 
ilCalendarUserSettings $user_settings
 
array $weekdays = array()
 
ilCalendarAppointmentColors $app_colors
 
array $seed_info = []
 
string $timezone = 'UTC'
 
ilCalendarSettings $cal_settings = null
 
array $colspans = []
 
int $raster = 15
 
int $user_id = 0
 
bool $disable_empty
 
bool $no_add
 
- Protected Attributes inherited from ilCalendarViewGUI
int $presentation_type = self::CAL_PRESENTATION_UNDEFINED
 
bool $view_with_appointments = false
 
ilDate $seed
 
int $ch_user_id = 0
 
string $period_end_day = null
 
Factory $ui_factory
 
Renderer $ui_renderer
 
ilCtrlInterface $ctrl
 
ilToolbarGUI $toolbar
 
ilLogger $logger
 
ILIAS DI UIServices $ui
 
ilLanguage $lng
 
ilObjUser $user
 
ilTemplate $tpl
 
ilGlobalTemplateInterface $main_tpl
 
ilComponentFactory $component_factory
 
ilTabsGUI $tabs_gui
 
RefineryFactory $refinery
 
HttpServices $http
 

Additional Inherited Members

- Data Fields inherited from ilCalendarViewGUI
const CAL_PRESENTATION_UNDEFINED = 0
 
const CAL_PRESENTATION_DAY = 1
 
const CAL_PRESENTATION_WEEK = 2
 
const CAL_PRESENTATION_MONTH = 3
 
const CAL_PRESENTATION_AGENDA_LIST = 9
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCalendarWeekGUI::__construct ( ilDate  $seed_date)

Definition at line 46 of file class.ilCalendarWeekGUI.php.

47 {
49 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\GlobalScreen\Provider\__construct(), and ilCalendarViewGUI\CAL_PRESENTATION_WEEK.

+ Here is the call graph for this function:

Member Function Documentation

◆ addAppointmentLink()

ilCalendarWeekGUI::addAppointmentLink ( ilDateTime  $date)
protected

Definition at line 400 of file class.ilCalendarWeekGUI.php.

400 : void
401 {
402 $new_app_url = $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'add');
403
404 $this->tpl->setCurrentBlock("new_app");
405 //$this->tpl->setVariable('NEW_APP_LINK',$new_app_url);
406 $this->tpl->setVariable('NEW_APP_GLYPH', $this->ui_renderer->render(
407 $this->ui_factory->symbol()->glyph()->add($new_app_url)
408 ));
409 // $this->tpl->setVariable('NEW_APP_ALT',$this->lng->txt('cal_new_app'));
410 $this->tpl->parseCurrentBlock();
411
412 // }
413
414 $this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
415 }

References ILIAS\Repository\ctrl().

Referenced by show().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addFullDayEvents()

ilCalendarWeekGUI::addFullDayEvents (   $all_fullday)
protected

Definition at line 454 of file class.ilCalendarWeekGUI.php.

454 : void
455 {
456 $counter = 0;
457 foreach ($all_fullday as $daily_apps) {
458 foreach ($daily_apps as $event) {
459 if ($event['fullday']) {
460 $this->showFulldayAppointment($event);
461 }
462 }
463 $this->tpl->setCurrentBlock('f_day_row');
464 $this->tpl->setVariable('COLSPAN', max($this->colspans[$counter], 1));
465 $this->tpl->parseCurrentBlock();
466 $counter++;
467 }
468 $this->tpl->setCurrentBlock('fullday_apps');
469 $this->tpl->setVariable('TXT_F_DAY', $this->lng->txt("cal_all_day"));
470 $this->tpl->parseCurrentBlock();
471 }
showFulldayAppointment(array $a_app)
$counter

References $counter, and ILIAS\Repository\lng().

Referenced by show().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addHeaderDate()

ilCalendarWeekGUI::addHeaderDate (   $date,
  $num_apps 
)
protected

Definition at line 433 of file class.ilCalendarWeekGUI.php.

433 : void
434 {
435 $date_info = $date->get(IL_CAL_FKT_GETDATE, '', 'UTC');
436 $dayname = ilCalendarUtil::_numericDayToString((int) $date->get(IL_CAL_FKT_DATE, 'w'), false);
437 $daydate = $dayname . ' ' . $date_info['mday'] . '.';
438
439 if (!$this->disable_empty || $num_apps[$date->get(IL_CAL_DATE)] > 0) {
440 $link = $this->ctrl->getLinkTargetByClass('ilcalendardaygui', '');
441 $this->ctrl->clearParametersByClass('ilcalendardaygui');
442
443 $this->tpl->setCurrentBlock("day_view_link");
444 $this->tpl->setVariable('HEADER_DATE', $daydate);
445 $this->tpl->setVariable('DAY_VIEW_LINK', $link);
446 $this->tpl->parseCurrentBlock();
447 } else {
448 $this->tpl->setCurrentBlock("day_view_no_link");
449 $this->tpl->setVariable('HEADER_DATE', $daydate);
450 $this->tpl->parseCurrentBlock();
451 }
452 }
const IL_CAL_FKT_GETDATE
const IL_CAL_DATE
const IL_CAL_FKT_DATE
static _numericDayToString(int $a_day, bool $a_long=true, ?ilLanguage $lng=null)

References ilCalendarUtil\_numericDayToString(), ILIAS\Repository\ctrl(), ilDateTime\get(), IL_CAL_DATE, IL_CAL_FKT_DATE, and IL_CAL_FKT_GETDATE.

Referenced by show().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addTimedEvents()

ilCalendarWeekGUI::addTimedEvents ( array  $hours,
int  $morning_aggr,
int  $evening_aggr 
)
protected

Definition at line 473 of file class.ilCalendarWeekGUI.php.

473 : void
474 {
475 $new_link_counter = 0;
476 $day_id_counter = 0;
477 foreach ($hours as $num_hour => $hours_per_day) {
478 $first = true;
479 foreach ($hours_per_day as $num_day => $hour) {
480 #ADD the hours in the left side of the grid.
481 if ($first) {
482 if (!($num_hour % 60) || ($num_hour == $morning_aggr && $morning_aggr) ||
483 ($num_hour == $evening_aggr && $evening_aggr)) {
484 $first = false;
485
486 // aggregation rows
487 if (($num_hour == $morning_aggr && $morning_aggr) ||
488 ($num_hour == $evening_aggr && $evening_aggr)) {
489 $this->tpl->setVariable('TIME_ROWSPAN', 1);
490 } // rastered hour
491 else {
492 $this->tpl->setVariable('TIME_ROWSPAN', 60 / $this->raster);
493 }
494
495 $this->tpl->setCurrentBlock('time_txt');
496
497 $this->tpl->setVariable('TIME', $hour['txt']);
498 $this->tpl->parseCurrentBlock();
499 }
500 }
501
502 foreach ($hour['apps_start'] as $app) {
503 $this->showAppointment($app);
504 }
505 $num_apps = $hour['apps_num'];
506 $colspan = max($this->colspans[$num_day], 1);
507
508 // Show new apointment link
509 if (!$hour['apps_num'] && !$this->no_add) {
510 $this->tpl->setCurrentBlock('new_app_link');
511
512 $this->ctrl->clearParameterByClass('ilcalendarappointmentgui', 'app_id');
513
514 $this->ctrl->setParameterByClass(
515 'ilcalendarappointmentgui',
516 'idate',
517 $this->weekdays[$num_day]->get(IL_CAL_DATE)
518 );
519 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->seed->get(IL_CAL_DATE));
520 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'hour', floor($num_hour / 60));
521
522 //todo:it could be nice use also ranges of 15 min to create events.
523 $new_app_url = $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'add');
524 $this->tpl->setVariable(
525 "DAY_NEW_APP_LINK",
526 $this->ui_renderer->render($this->ui_factory->symbol()->glyph()->add($new_app_url))
527 );
528 $this->tpl->setVariable('DAY_NEW_ID', ++$new_link_counter);
529 $this->tpl->parseCurrentBlock();
530 }
531
532 for ($i = $colspan; $i > $hour['apps_num']; $i--) {
533 $this->tpl->setCurrentBlock('day_cell');
534
535 // last "slot" of hour needs border
536 $empty_border = '';
537 if ($num_hour % 60 == 60 - $this->raster ||
538 ($num_hour == $morning_aggr && $morning_aggr) ||
539 ($num_hour == $evening_aggr && $evening_aggr)) {
540 $empty_border = ' calempty_border';
541 }
542
543 $this->tpl->setVariable('TD_CLASS', 'calempty createhover' . $empty_border);
544
545 $this->tpl->setVariable('DAY_ID', ++$day_id_counter);
546 $this->tpl->setVariable('TD_ROWSPAN', 1);
547 $this->tpl->parseCurrentBlock();
548 }
549 }
550 $this->tpl->touchBlock('time_row');
551 }
552 }

References ILIAS\Repository\ctrl(), and IL_CAL_DATE.

Referenced by show().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateColspans()

ilCalendarWeekGUI::calculateColspans ( array  $hours)
protected

Definition at line 379 of file class.ilCalendarWeekGUI.php.

379 : void
380 {
381 foreach ($hours as $hour_num => $hours_per_day) {
382 foreach ($hours_per_day as $num_day => $hour) {
383 $this->colspans[$num_day] = max($this->colspans[$num_day] ?? 0, $hour['apps_num'] ?? 0);
384 }
385 }
386 }

Referenced by show().

+ Here is the caller graph for this function:

◆ executeCommand()

ilCalendarWeekGUI::executeCommand ( )

Definition at line 62 of file class.ilCalendarWeekGUI.php.

62 : void
63 {
64 $this->ctrl->saveParameter($this, 'seed');
65 $next_class = $this->ctrl->getNextClass();
66 switch ($next_class) {
67 case "ilcalendarappointmentpresentationgui":
68 $this->ctrl->setReturn($this, "");
69 $gui = ilCalendarAppointmentPresentationGUI::_getInstance($this->seed, (array) $this->getCurrentApp());
70 $this->ctrl->forwardCommand($gui);
71 break;
72 case 'ilcalendarappointmentgui':
73 $this->ctrl->setReturn($this, '');
74 $this->tabs_gui->setSubTabActive((string) ilSession::get('cal_last_tab'));
75
76 // initial date for new calendar appointments
77 $idate = new ilDate($this->initInitialDateFromQuery(), IL_CAL_DATE);
78 $app = new ilCalendarAppointmentGUI($this->seed, $idate, $this->initAppointmentIdFromQuery());
79 $this->ctrl->forwardCommand($app);
80 break;
81
82 default:
83 $time = microtime(true);
84 $cmd = $this->ctrl->getCmd("show");
85 $this->$cmd();
86 $this->main_tpl->setContent($this->tpl->get());
87 break;
88 }
89 }
Administrate calendar appointments.
static _getInstance(ilDate $seed, array $a_app)
get singleton instance
Class for single dates.
static get(string $a_var)

References ilCalendarAppointmentPresentationGUI\_getInstance(), ILIAS\Repository\ctrl(), ilSession\get(), ilCalendarViewGUI\getCurrentApp(), IL_CAL_DATE, ilCalendarViewGUI\initAppointmentIdFromQuery(), and ilCalendarViewGUI\initInitialDateFromQuery().

+ Here is the call graph for this function:

◆ getAppointmentTimeString()

ilCalendarWeekGUI::getAppointmentTimeString ( ilCalendarEntry  $a_event)
protected
Parameters
ilCalendarEntry$a_event
Returns
string

Definition at line 558 of file class.ilCalendarWeekGUI.php.

558 : string
559 {
560 $time = "";
561 switch ($this->user_settings->getTimeFormat()) {
563 $time = $a_event->getStart()->get(IL_CAL_FKT_DATE, 'H:i', $this->timezone);
564 break;
565
567 $time = $a_event->getStart()->get(IL_CAL_FKT_DATE, 'h:ia', $this->timezone);
568 break;
569 }
570
571 return $time;
572 }
getStart()
Get start of date period.

References ilCalendarEntry\getStart(), IL_CAL_FKT_DATE, ilCalendarSettings\TIME_FORMAT_12, and ilCalendarSettings\TIME_FORMAT_24.

Referenced by showAppointment().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMorningAggr()

ilCalendarWeekGUI::getMorningAggr ( )
protected

Definition at line 388 of file class.ilCalendarWeekGUI.php.

388 : int
389 {
390 if ($this->user_settings->getDayStart()) {
391 // push starting point to last "slot" of hour BEFORE morning aggregation
392 $morning_aggr = ($this->user_settings->getDayStart() - 1) * 60 + (60 - $this->raster);
393 } else {
394 $morning_aggr = 0;
395 }
396
397 return $morning_aggr;
398 }

Referenced by show().

+ Here is the caller graph for this function:

◆ initialize()

ilCalendarWeekGUI::initialize ( int  $a_calendar_presentation_type)

Reimplemented from ilCalendarViewGUI.

Definition at line 51 of file class.ilCalendarWeekGUI.php.

51 : void
52 {
53 parent::initialize($a_calendar_presentation_type); // TODO: Change the autogenerated stub
54 $this->seed_info = (array) $this->seed->get(IL_CAL_FKT_GETDATE, '', 'UTC');
55 $this->user_settings = ilCalendarUserSettings::_getInstanceByUserId($this->user->getId());
56 $this->app_colors = new ilCalendarAppointmentColors($this->user->getId());
57 if ($this->user->getTimeZone()) {
58 $this->timezone = $this->user->getTimeZone();
59 }
60 }
static _getInstanceByUserId(int $a_user_id)

References ilCalendarUserSettings\_getInstanceByUserId(), IL_CAL_FKT_GETDATE, and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ parseHourInfo()

ilCalendarWeekGUI::parseHourInfo ( array  $daily_apps,
ilDateTime  $date,
int  $num_day,
?array  $hours = null,
int  $morning_aggr = 0,
int  $evening_aggr = 0 
)
protected

calculate overlapping hours @access protected

Returns
array hours

Definition at line 265 of file class.ilCalendarWeekGUI.php.

272 : array {
273 for ($i = $morning_aggr; $i <= $evening_aggr; $i += $this->raster) {
274 $hours[$i][$num_day]['apps_start'] = array();
275 $hours[$i][$num_day]['apps_num'] = 0;
276 switch ($this->user_settings->getTimeFormat()) {
278 if ($morning_aggr > 0 && $i == $morning_aggr) {
279 $hours[$i][$num_day]['txt'] = sprintf('%02d:00', 0) . ' - ' .
280 sprintf('%02d:00', ceil(($i + 1) / 60));
281 } else {
282 if (!isset($hours[$i][$num_day]['txt'])) {
283 $hours[$i][$num_day]['txt'] = sprintf('%02d:%02d', floor($i / 60), $i % 60);
284 } else {
285 $hours[$i][$num_day]['txt'] .= sprintf('%02d:%02d', floor($i / 60), $i % 60);
286 }
287 }
288 if ($evening_aggr < 23 * 60 && $i == $evening_aggr) {
289 if (!isset($hours[$i][$num_day]['txt'])) {
290 $hours[$i][$num_day]['txt'] = ' - ' . sprintf('%02d:00', 0);
291 } else {
292 $hours[$i][$num_day]['txt'] .= ' - ' . sprintf('%02d:00', 0);
293 }
294 }
295 break;
296
298 if ($morning_aggr > 0 && $i == $morning_aggr) {
299 $hours[$i][$num_day]['txt'] =
300 date('h a', mktime(0, 0, 0, 1, 1, 2000)) . ' - ' .
301 date('h a', mktime($this->user_settings->getDayStart(), 0, 0, 1, 1, 2000));
302 } else {
303 if (!isset($hours[$i][$num_day]['txt'])) {
304 $hours[$i][$num_day]['txt'] = date('h a', mktime((int) floor($i / 60), $i % 60, 0, 1, 1, 2000));
305 } else {
306 $hours[$i][$num_day]['txt'] .= date('h a', mktime((int) floor($i / 60), $i % 60, 0, 1, 1, 2000));
307 }
308 }
309 if ($evening_aggr < 23 * 60 && $i == $evening_aggr) {
310 $hours[$i][$num_day]['txt'] =
311 date('h a', mktime($this->user_settings->getDayEnd(), 0, 0, 1, 1, 2000)) . ' - ' .
312 date('h a', mktime(0, 0, 0, 1, 1, 2000));
313 }
314 break;
315 }
316 }
317
318 $date_info = $date->get(IL_CAL_FKT_GETDATE, '', 'UTC');
319
320 foreach ($daily_apps as $app) {
321 // fullday appointment are not relavant
322 if ($app['fullday']) {
323 continue;
324 }
325 // start hour for this day
326 #21636
327 if ($app['start_info']['mday'] != $date_info['mday']) {
328 $start = 0;
329 } else {
330 $start = $app['start_info']['hours'] * 60 + $app['start_info']['minutes'];
331 }
332 #21132 #21636
333 //$start = $app['start_info']['hours']*60+$app['start_info']['minutes'];
334
335 // end hour for this day
336 if ($app['end_info']['mday'] != $date_info['mday']) {
337 $end = 23 * 60;
338 } elseif ($app['start_info']['hours'] == $app['end_info']['hours']) {
339 $end = $start + $this->raster;
340 } else {
341 $end = $app['end_info']['hours'] * 60 + $app['end_info']['minutes'];
342 }
343 #21132 #21636
344 //$end = $app['end_info']['hours']*60+$app['end_info']['minutes'];
345
346 if ($start < $morning_aggr) {
347 $start = $morning_aggr;
348 }
349 if ($end <= $morning_aggr) {
350 $end = $morning_aggr + $this->raster;
351 }
352 if ($start > $evening_aggr) {
353 $start = $evening_aggr;
354 }
355 if ($end > $evening_aggr + $this->raster) {
356 $end = $evening_aggr + $this->raster;
357 }
358 if ($end <= $start) {
359 $end = $start + $this->raster;
360 }
361
362 // map start and end to raster
363 $start = floor($start / $this->raster) * $this->raster;
364 $end = ceil($end / $this->raster) * $this->raster;
365
366 $first = true;
367 for ($i = $start; $i < $end; $i += $this->raster) {
368 if ($first) {
369 $app['rowspan'] = ceil(($end - $start) / $this->raster);
370 $hours[$i][$num_day]['apps_start'][] = $app;
371 $first = false;
372 }
373 $hours[$i][$num_day]['apps_num']++;
374 }
375 }
376 return $hours;
377 }
get(int $a_format, string $a_format_str='', string $a_tz='')
get formatted date

References ilCalendarSettings\TIME_FORMAT_12, and ilCalendarSettings\TIME_FORMAT_24.

Referenced by show().

+ Here is the caller graph for this function:

◆ setUpCalendar()

ilCalendarWeekGUI::setUpCalendar ( )
protected

Definition at line 417 of file class.ilCalendarWeekGUI.php.

417 : void
418 {
419 $bkid = $this->initBookingUserFromQuery();
420 if ($bkid) {
421 $this->user_id = $bkid;
422 $this->disable_empty = true;
423 $this->no_add = true;
424 } elseif ($this->user->getId() == ANONYMOUS_USER_ID) {
425 $this->disable_empty = false;
426 $this->no_add = true;
427 } else {
428 $this->disable_empty = false;
429 $this->no_add = false;
430 }
431 }
const ANONYMOUS_USER_ID
Definition: constants.php:27

References ANONYMOUS_USER_ID, and ILIAS\Repository\user().

Referenced by show().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ show()

ilCalendarWeekGUI::show ( )

Definition at line 91 of file class.ilCalendarWeekGUI.php.

91 : void
92 {
93 $num_apps = [];
94 $morning_aggr = $this->getMorningAggr();
95 $evening_aggr = $this->user_settings->getDayEnd() * 60;
96
97 $this->tpl = new ilTemplate('tpl.week_view.html', true, true, 'components/ILIAS/Calendar');
98
99 $navigation = new ilCalendarHeaderNavigationGUI($this, $this->seed, ilDateTime::WEEK);
100 $this->tpl->setVariable('NAVIGATION', $navigation->getHTML());
101 $this->setUpCalendar();
102
103 $scheduler = new ilCalendarSchedule(
104 $this->seed,
106 $this->user->getId(),
107 $this->disable_empty
108 );
109 $scheduler->addSubitemCalendars(true);
110 $scheduler->calculate();
111
112 $counter = 0;
113 $hours = null;
114 $all_fullday = array();
115 foreach (ilCalendarUtil::_buildWeekDayList($this->seed, $this->user_settings->getWeekStart())->get() as $date) {
116 $daily_apps = $scheduler->getByDay($date, $this->timezone);
117 if (!$this->view_with_appointments && count($daily_apps)) {
118 $this->view_with_appointments = true;
119 }
120 $hours = $this->parseHourInfo(
121 $daily_apps,
122 $date,
123 $counter,
124 $hours,
125 $morning_aggr,
126 $evening_aggr
127 );
128 $this->weekdays[] = $date;
129
130 $num_apps[$date->get(IL_CAL_DATE)] = count($daily_apps);
131
132 $all_fullday[] = $daily_apps;
133 $counter++;
134 }
135
136 $this->calculateColspans($hours);
137
138 $this->cal_settings = ilCalendarSettings::_getInstance();
139
140 // Table header
141 $counter = 0;
142 foreach (ilCalendarUtil::_buildWeekDayList($this->seed, $this->user_settings->getWeekStart())->get() as $date) {
143 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $date->get(IL_CAL_DATE));
144 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'idate', $date->get(IL_CAL_DATE));
145 $this->ctrl->setParameterByClass('ilcalendardaygui', 'seed', $date->get(IL_CAL_DATE));
146
147 if (!$this->no_add) {
148 $this->addAppointmentLink($date);
149 }
150
151 $this->addHeaderDate($date, $num_apps);
152
153 $this->tpl->setCurrentBlock('day_header_row');
154 $this->tpl->setVariable('DAY_COLSPAN', max($this->colspans[$counter], 1));
155 $this->tpl->parseCurrentBlock();
156
157 $counter++;
158 }
159
160 // show fullday events
161 $this->addFullDayEvents($all_fullday);
162
163 //show timed events
164 $this->addTimedEvents($hours, $morning_aggr, $evening_aggr);
165
166 $this->tpl->setVariable("TXT_TIME", $this->lng->txt("time"));
167 }
Represents a list of calendar appointments (including recurring events) for a specific user in a give...
static _buildWeekDayList(ilDate $a_day, int $a_weekstart)
build week day list @access public
addAppointmentLink(ilDateTime $date)
addTimedEvents(array $hours, int $morning_aggr, int $evening_aggr)
parseHourInfo(array $daily_apps, ilDateTime $date, int $num_day, ?array $hours=null, int $morning_aggr=0, int $evening_aggr=0)
calculate overlapping hours @access protected
addHeaderDate($date, $num_apps)
special template class to simplify handling of ITX/PEAR

References $counter, ilCalendarUtil\_buildWeekDayList(), ilCalendarSettings\_getInstance(), addAppointmentLink(), addFullDayEvents(), addHeaderDate(), addTimedEvents(), calculateColspans(), ILIAS\Repository\ctrl(), getMorningAggr(), IL_CAL_DATE, ILIAS\Repository\lng(), parseHourInfo(), setUpCalendar(), ilCalendarSchedule\TYPE_WEEK, ILIAS\Repository\user(), and ilDateTime\WEEK.

+ Here is the call graph for this function:

◆ showAppointment()

ilCalendarWeekGUI::showAppointment ( array  $a_app)
protected

Definition at line 205 of file class.ilCalendarWeekGUI.php.

205 : void
206 {
207 $time = '';
208 $event_tpl = new ilTemplate('tpl.week_event_view.html', true, true, 'components/ILIAS/Calendar');
209
210 $ilUser = $this->user;
211
212 $this->tpl->setCurrentBlock('not_empty');
213
214 $this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
215 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId());
216
217 $color = $this->app_colors->getColorByAppointment($a_app['event']->getEntryId());
218 $style = 'background-color: ' . $color . ';';
219 $style .= ('color:' . ilCalendarUtil::calculateFontColor($color));
220 $td_style = $style;
221
222 if (!$a_app['event']->isFullDay()) {
223 $time = $this->getAppointmentTimeString($a_app['event']);
224
225 $td_style .= $a_app['event']->getPresentationStyle();
226 }
227
228 $shy = $this->getAppointmentShyButton($a_app['event'], (string) $a_app['dstart'], "");
229
230 $title = ($time != "") ? $time . " " . $shy : $shy;
231
232 $event_tpl->setCurrentBlock('event_cell_content');
233 $event_tpl->setVariable("STYLE", $style);
234 $event_tpl->setVariable('EVENT_CONTENT', $title);
235
236 if ($event_html_by_plugin = $this->getContentByPlugins($a_app['event'], $a_app['dstart'], $title, $event_tpl)) {
237 $event_html = $event_html_by_plugin;
238 } else {
239 $event_tpl->parseCurrentBlock();
240 $event_html = $event_tpl->get();
241 }
242
243 $this->tpl->setVariable('GRID_CONTENT', $event_html);
244
245 // provide table cell attributes
246 $this->tpl->parseCurrentBlock();
247
248 $this->tpl->setCurrentBlock('day_cell');
249
250 $this->tpl->setVariable('DAY_ID', 'a' . $this->num_appointments);
251 $this->tpl->setVariable('TD_ROWSPAN', $a_app['rowspan']);
252 $this->tpl->setVariable('TD_STYLE', $a_app['event']->getPresentationStyle());
253 $this->tpl->setVariable('TD_CLASS', 'calevent il_calevent');
254
255 $this->tpl->parseCurrentBlock();
256
257 $this->num_appointments++;
258 }
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="")
getContentByPlugins(ilCalendarEntry $a_cal_entry, int $a_start_date, string $a_content, ilTemplate $a_tpl)
getAppointmentTimeString(ilCalendarEntry $a_event)

References ilCalendarViewGUI\$user, ilCalendarUtil\calculateFontColor(), ILIAS\Repository\ctrl(), ilCalendarViewGUI\getAppointmentShyButton(), getAppointmentTimeString(), and ilCalendarViewGUI\getContentByPlugins().

+ Here is the call graph for this function:

◆ showFulldayAppointment()

ilCalendarWeekGUI::showFulldayAppointment ( array  $a_app)
protected

Definition at line 169 of file class.ilCalendarWeekGUI.php.

169 : void
170 {
171 $event_tpl = new ilTemplate('tpl.day_event_view.html', true, true, 'components/ILIAS/Calendar');
172 $event_tpl->setCurrentBlock('fullday_app');
173
174 $title = $this->getAppointmentShyButton($a_app['event'], (string) $a_app['dstart'], "");
175
176 $event_tpl->setVariable('EVENT_CONTENT', $title);
177
178 $color = $this->app_colors->getColorByAppointment($a_app['event']->getEntryId());
179 $font_color = ilCalendarUtil::calculateFontColor($color);
180
181 $event_tpl->setVariable('F_APP_BGCOLOR', $color);
182 $event_tpl->setVariable('F_APP_FONTCOLOR', $font_color);
183
184 $this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
185 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId());
186 $event_tpl->setVariable(
187 'F_APP_EDIT_LINK',
188 $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'edit')
189 );
190
191 if ($event_html_by_plugin = $this->getContentByPlugins($a_app['event'], $a_app['dstart'], $title, $event_tpl)) {
192 $event_html = $event_html_by_plugin;
193 } else {
194 $event_tpl->parseCurrentBlock();
195 $event_html = $event_tpl->get();
196 }
197
198 $this->tpl->setCurrentBlock("content_fd");
199 $this->tpl->setVariable("CONTENT_EVENT_FD", $event_html);
200 $this->tpl->parseCurrentBlock();
201
202 $this->num_appointments++;
203 }

References ilCalendarUtil\calculateFontColor(), ILIAS\Repository\ctrl(), ilCalendarViewGUI\getAppointmentShyButton(), and ilCalendarViewGUI\getContentByPlugins().

+ Here is the call graph for this function:

Field Documentation

◆ $app_colors

ilCalendarAppointmentColors ilCalendarWeekGUI::$app_colors
protected

Definition at line 33 of file class.ilCalendarWeekGUI.php.

◆ $cal_settings

ilCalendarSettings ilCalendarWeekGUI::$cal_settings = null
protected

Definition at line 36 of file class.ilCalendarWeekGUI.php.

◆ $colspans

array ilCalendarWeekGUI::$colspans = []
protected

Definition at line 37 of file class.ilCalendarWeekGUI.php.

◆ $disable_empty

bool ilCalendarWeekGUI::$disable_empty
protected

Definition at line 43 of file class.ilCalendarWeekGUI.php.

◆ $no_add

bool ilCalendarWeekGUI::$no_add
protected

Definition at line 44 of file class.ilCalendarWeekGUI.php.

◆ $num_appointments

int ilCalendarWeekGUI::$num_appointments = 1
protected

Definition at line 29 of file class.ilCalendarWeekGUI.php.

◆ $raster

int ilCalendarWeekGUI::$raster = 15
protected

Definition at line 40 of file class.ilCalendarWeekGUI.php.

◆ $seed_info

array ilCalendarWeekGUI::$seed_info = []
protected

Definition at line 34 of file class.ilCalendarWeekGUI.php.

◆ $timezone

string ilCalendarWeekGUI::$timezone = 'UTC'
protected

Definition at line 35 of file class.ilCalendarWeekGUI.php.

◆ $user_id

int ilCalendarWeekGUI::$user_id = 0
protected

Definition at line 42 of file class.ilCalendarWeekGUI.php.

◆ $user_settings

ilCalendarUserSettings ilCalendarWeekGUI::$user_settings
protected

Definition at line 30 of file class.ilCalendarWeekGUI.php.

◆ $weekdays

array ilCalendarWeekGUI::$weekdays = array()
protected

Definition at line 31 of file class.ilCalendarWeekGUI.php.


The documentation for this class was generated from the following file: