ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 402 of file class.ilCalendarWeekGUI.php.

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

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 456 of file class.ilCalendarWeekGUI.php.

456 : void
457 {
458 $counter = 0;
459 foreach ($all_fullday as $daily_apps) {
460 foreach ($daily_apps as $event) {
461 if ($event['fullday']) {
462 $this->showFulldayAppointment($event);
463 }
464 }
465 $this->tpl->setCurrentBlock('f_day_row');
466 $this->tpl->setVariable('COLSPAN', max($this->colspans[$counter], 1));
467 $this->tpl->parseCurrentBlock();
468 $counter++;
469 }
470 $this->tpl->setCurrentBlock('fullday_apps');
471 $this->tpl->setVariable('TXT_F_DAY', $this->lng->txt("cal_all_day"));
472 $this->tpl->parseCurrentBlock();
473 }
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 435 of file class.ilCalendarWeekGUI.php.

435 : void
436 {
437 $date_info = $date->get(IL_CAL_FKT_GETDATE, '', 'UTC');
438 $dayname = ilCalendarUtil::_numericDayToString((int) $date->get(IL_CAL_FKT_DATE, 'w'), false);
439 $daydate = $dayname . ' ' . $date_info['mday'] . '.';
440
441 if (!$this->disable_empty || $num_apps[$date->get(IL_CAL_DATE)] > 0) {
442 $link = $this->ctrl->getLinkTargetByClass('ilcalendardaygui', '');
443 $this->ctrl->clearParametersByClass('ilcalendardaygui');
444
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();
449 } else {
450 $this->tpl->setCurrentBlock("day_view_no_link");
451 $this->tpl->setVariable('HEADER_DATE', $daydate);
452 $this->tpl->parseCurrentBlock();
453 }
454 }
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 475 of file class.ilCalendarWeekGUI.php.

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

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 381 of file class.ilCalendarWeekGUI.php.

381 : void
382 {
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);
386 }
387 }
388 }

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 560 of file class.ilCalendarWeekGUI.php.

560 : string
561 {
562 $time = "";
563 switch ($this->user_settings->getTimeFormat()) {
565 $time = $a_event->getStart()->get(IL_CAL_FKT_DATE, 'H:i', $this->timezone);
566 break;
567
569 $time = $a_event->getStart()->get(IL_CAL_FKT_DATE, 'h:ia', $this->timezone);
570 break;
571 }
572
573 return $time;
574 }
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 390 of file class.ilCalendarWeekGUI.php.

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

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 267 of file class.ilCalendarWeekGUI.php.

274 : array {
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));
283 } else {
284 if (!isset($hours[$i][$num_day]['txt'])) {
285 $hours[$i][$num_day]['txt'] = sprintf('%02d:%02d', floor($i / 60), $i % 60);
286 } else {
287 $hours[$i][$num_day]['txt'] .= sprintf('%02d:%02d', floor($i / 60), $i % 60);
288 }
289 }
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);
293 } else {
294 $hours[$i][$num_day]['txt'] .= ' - ' . sprintf('%02d:00', 0);
295 }
296 }
297 break;
298
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));
304 } else {
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));
307 } else {
308 $hours[$i][$num_day]['txt'] .= date('h a', mktime((int) floor($i / 60), $i % 60, 0, 1, 1, 2000));
309 }
310 }
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));
315 }
316 break;
317 }
318 }
319
320 $date_info = $date->get(IL_CAL_FKT_GETDATE, '', 'UTC');
321
322 foreach ($daily_apps as $app) {
323 // fullday appointment are not relavant
324 if ($app['fullday']) {
325 continue;
326 }
327 // start hour for this day
328 #21636
329 if ($app['start_info']['mday'] != $date_info['mday']) {
330 $start = 0;
331 } else {
332 $start = $app['start_info']['hours'] * 60 + $app['start_info']['minutes'];
333 }
334 #21132 #21636
335 //$start = $app['start_info']['hours']*60+$app['start_info']['minutes'];
336
337 // end hour for this day
338 if ($app['end_info']['mday'] != $date_info['mday']) {
339 $end = 23 * 60;
340 } elseif ($app['start_info']['hours'] == $app['end_info']['hours']) {
341 $end = $start + $this->raster;
342 } else {
343 $end = $app['end_info']['hours'] * 60 + $app['end_info']['minutes'];
344 }
345 #21132 #21636
346 //$end = $app['end_info']['hours']*60+$app['end_info']['minutes'];
347
348 if ($start < $morning_aggr) {
349 $start = $morning_aggr;
350 }
351 if ($end <= $morning_aggr) {
352 $end = $morning_aggr + $this->raster;
353 }
354 if ($start > $evening_aggr) {
355 $start = $evening_aggr;
356 }
357 if ($end > $evening_aggr + $this->raster) {
358 $end = $evening_aggr + $this->raster;
359 }
360 if ($end <= $start) {
361 $end = $start + $this->raster;
362 }
363
364 // map start and end to raster
365 $start = floor($start / $this->raster) * $this->raster;
366 $end = ceil($end / $this->raster) * $this->raster;
367
368 $first = true;
369 for ($i = $start; $i < $end; $i += $this->raster) {
370 if ($first) {
371 $app['rowspan'] = ceil(($end - $start) / $this->raster);
372 $hours[$i][$num_day]['apps_start'][] = $app;
373 $first = false;
374 }
375 $hours[$i][$num_day]['apps_num']++;
376 }
377 }
378 return $hours;
379 }
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 419 of file class.ilCalendarWeekGUI.php.

419 : void
420 {
421 $bkid = $this->initBookingUserFromQuery();
422 if ($bkid) {
423 $this->user_id = $bkid;
424 $this->disable_empty = true;
425 $this->no_add = true;
426 } elseif ($this->user->getId() == ANONYMOUS_USER_ID) {
427 $this->disable_empty = false;
428 $this->no_add = true;
429 } else {
430 $this->disable_empty = false;
431 $this->no_add = false;
432 }
433 }
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
100
101 $navigation = new ilCalendarHeaderNavigationGUI($this, $this->seed, ilDateTime::WEEK);
102 $this->tpl->setVariable('NAVIGATION', $navigation->getHTML());
103 $this->setUpCalendar();
104
105 $scheduler = new ilCalendarSchedule(
106 $this->seed,
108 $this->user->getId(),
109 $this->disable_empty
110 );
111 $scheduler->addSubitemCalendars(true);
112 $scheduler->calculate();
113
114 $counter = 0;
115 $hours = null;
116 $all_fullday = array();
117 foreach (ilCalendarUtil::_buildWeekDayList($this->seed, $this->user_settings->getWeekStart())->get() as $date) {
118 $daily_apps = $scheduler->getByDay($date, $this->timezone);
119 if (!$this->view_with_appointments && count($daily_apps)) {
120 $this->view_with_appointments = true;
121 }
122 $hours = $this->parseHourInfo(
123 $daily_apps,
124 $date,
125 $counter,
126 $hours,
127 $morning_aggr,
128 $evening_aggr
129 );
130 $this->weekdays[] = $date;
131
132 $num_apps[$date->get(IL_CAL_DATE)] = count($daily_apps);
133
134 $all_fullday[] = $daily_apps;
135 $counter++;
136 }
137
138 $this->calculateColspans($hours);
139
140 $this->cal_settings = ilCalendarSettings::_getInstance();
141
142 // Table header
143 $counter = 0;
144 foreach (ilCalendarUtil::_buildWeekDayList($this->seed, $this->user_settings->getWeekStart())->get() as $date) {
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));
148
149 if (!$this->no_add) {
150 $this->addAppointmentLink($date);
151 }
152
153 $this->addHeaderDate($date, $num_apps);
154
155 $this->tpl->setCurrentBlock('day_header_row');
156 $this->tpl->setVariable('DAY_COLSPAN', max($this->colspans[$counter], 1));
157 $this->tpl->parseCurrentBlock();
158
159 $counter++;
160 }
161
162 // show fullday events
163 $this->addFullDayEvents($all_fullday);
164
165 //show timed events
166 $this->addTimedEvents($hours, $morning_aggr, $evening_aggr);
167
168 $this->tpl->setVariable("TXT_TIME", $this->lng->txt("time"));
169 }
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
static initDragDrop(?ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI Drag and Drop used in Modules/Survey, Services/Calendar, Services/COPage,...

References $counter, ilCalendarUtil\_buildWeekDayList(), ilCalendarSettings\_getInstance(), addAppointmentLink(), addFullDayEvents(), addHeaderDate(), addTimedEvents(), calculateColspans(), ILIAS\Repository\ctrl(), getMorningAggr(), IL_CAL_DATE, ilYuiUtil\initDragDrop(), 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 207 of file class.ilCalendarWeekGUI.php.

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

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

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: