ILIAS  release_8 Revision v8.25-1-g13de6a5eca6
ilCalendarWeekGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ 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

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e @ilCtrl_Calls ilCalendarWeekGUI: ilCalendarAppointmentGUI @ilCtrl_Calls ilCalendarWeekGUI: ilCalendarAppointmentPresentationGUI

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

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

417 : void
418 {
419 $new_app_url = $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'add');
420
421 if ($this->cal_settings->getEnableGroupMilestones()) {
422 $new_ms_url = $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'addMilestone');
423
424 $this->tpl->setCurrentBlock("new_ms");
425 $this->tpl->setVariable('DD_ID', $date->get(IL_CAL_UNIX));
426 $this->tpl->setVariable(
427 'DD_TRIGGER',
428 $this->ui_renderer->render($this->ui_factory->symbol()->glyph()->add())
429 );
430 $this->tpl->setVariable('URL_DD_NEW_APP', $new_app_url);
431 $this->tpl->setVariable('TXT_DD_NEW_APP', $this->lng->txt('cal_new_app'));
432 $this->tpl->setVariable('URL_DD_NEW_MS', $new_ms_url);
433 $this->tpl->setVariable('TXT_DD_NEW_MS', $this->lng->txt('cal_new_ms'));
434 $this->tpl->parseCurrentBlock();
435 } else {
436 $this->tpl->setCurrentBlock("new_app");
437 //$this->tpl->setVariable('NEW_APP_LINK',$new_app_url);
438 $this->tpl->setVariable('NEW_APP_GLYPH', $this->ui_renderer->render(
439 $this->ui_factory->symbol()->glyph()->add($new_app_url)
440 ));
441 // $this->tpl->setVariable('NEW_APP_ALT',$this->lng->txt('cal_new_app'));
442 $this->tpl->parseCurrentBlock();
443 }
444
445 $this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
446 }
const IL_CAL_UNIX
get(int $a_format, string $a_format_str='', string $a_tz='')
get formatted date

References ILIAS\Repository\ctrl(), ilDateTime\get(), IL_CAL_UNIX, and ILIAS\Repository\lng().

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

485 : void
486 {
487 $counter = 0;
488 foreach ($all_fullday as $daily_apps) {
489 foreach ($daily_apps as $event) {
490 if ($event['fullday']) {
491 $this->showFulldayAppointment($event);
492 }
493 }
494 $this->tpl->setCurrentBlock('f_day_row');
495 $this->tpl->setVariable('COLSPAN', max($this->colspans[$counter], 1));
496 $this->tpl->parseCurrentBlock();
497 $counter++;
498 }
499 $this->tpl->setCurrentBlock('fullday_apps');
500 $this->tpl->setVariable('TXT_F_DAY', $this->lng->txt("cal_all_day"));
501 $this->tpl->parseCurrentBlock();
502 }
showFulldayAppointment(array $a_app)

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

464 : void
465 {
466 $date_info = $date->get(IL_CAL_FKT_GETDATE, '', 'UTC');
467 $dayname = ilCalendarUtil::_numericDayToString((int) $date->get(IL_CAL_FKT_DATE, 'w'), false);
468 $daydate = $dayname . ' ' . $date_info['mday'] . '.';
469
470 if (!$this->disable_empty || $num_apps[$date->get(IL_CAL_DATE)] > 0) {
471 $link = $this->ctrl->getLinkTargetByClass('ilcalendardaygui', '');
472 $this->ctrl->clearParametersByClass('ilcalendardaygui');
473
474 $this->tpl->setCurrentBlock("day_view_link");
475 $this->tpl->setVariable('HEADER_DATE', $daydate);
476 $this->tpl->setVariable('DAY_VIEW_LINK', $link);
477 $this->tpl->parseCurrentBlock();
478 } else {
479 $this->tpl->setCurrentBlock("day_view_no_link");
480 $this->tpl->setVariable('HEADER_DATE', $daydate);
481 $this->tpl->parseCurrentBlock();
482 }
483 }
const IL_CAL_FKT_GETDATE
const IL_CAL_DATE
const IL_CAL_FKT_DATE
static _numericDayToString(int $a_day, bool $a_long=true)

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

504 : void
505 {
506 $new_link_counter = 0;
507 $day_id_counter = 0;
508 foreach ($hours as $num_hour => $hours_per_day) {
509 $first = true;
510 foreach ($hours_per_day as $num_day => $hour) {
511
512 #ADD the hours in the left side of the grid.
513 if ($first) {
514 if (!($num_hour % 60) || ($num_hour == $morning_aggr && $morning_aggr) ||
515 ($num_hour == $evening_aggr && $evening_aggr)) {
516 $first = false;
517
518 // aggregation rows
519 if (($num_hour == $morning_aggr && $morning_aggr) ||
520 ($num_hour == $evening_aggr && $evening_aggr)) {
521 $this->tpl->setVariable('TIME_ROWSPAN', 1);
522 } // rastered hour
523 else {
524 $this->tpl->setVariable('TIME_ROWSPAN', 60 / $this->raster);
525 }
526
527 $this->tpl->setCurrentBlock('time_txt');
528
529 $this->tpl->setVariable('TIME', $hour['txt']);
530 $this->tpl->parseCurrentBlock();
531 }
532 }
533
534 foreach ($hour['apps_start'] as $app) {
535 $this->showAppointment($app);
536 }
537 $num_apps = $hour['apps_num'];
538 $colspan = max($this->colspans[$num_day], 1);
539
540 // Show new apointment link
541 if (!$hour['apps_num'] && !$this->no_add) {
542 $this->tpl->setCurrentBlock('new_app_link');
543
544 $this->ctrl->clearParameterByClass('ilcalendarappointmentgui', 'app_id');
545
546 $this->ctrl->setParameterByClass(
547 'ilcalendarappointmentgui',
548 'idate',
549 $this->weekdays[$num_day]->get(IL_CAL_DATE)
550 );
551 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->seed->get(IL_CAL_DATE));
552 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'hour', floor($num_hour / 60));
553
554 //todo:it could be nice use also ranges of 15 min to create events.
555 $new_app_url = $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'add');
556 $this->tpl->setVariable(
557 "DAY_NEW_APP_LINK",
558 $this->ui_renderer->render($this->ui_factory->symbol()->glyph()->add($new_app_url))
559 );
560 $this->tpl->setVariable('DAY_NEW_ID', ++$new_link_counter);
561 $this->tpl->parseCurrentBlock();
562 }
563
564 for ($i = $colspan; $i > $hour['apps_num']; $i--) {
565 $this->tpl->setCurrentBlock('day_cell');
566
567 // last "slot" of hour needs border
568 $empty_border = '';
569 if ($num_hour % 60 == 60 - $this->raster ||
570 ($num_hour == $morning_aggr && $morning_aggr) ||
571 ($num_hour == $evening_aggr && $evening_aggr)) {
572 $empty_border = ' calempty_border';
573 }
574
575 $this->tpl->setVariable('TD_CLASS', 'calempty createhover' . $empty_border);
576
577 $this->tpl->setVariable('DAY_ID', ++$day_id_counter);
578 $this->tpl->setVariable('TD_ROWSPAN', 1);
579 $this->tpl->parseCurrentBlock();
580 }
581 }
582 $this->tpl->touchBlock('time_row');
583 }
584 }
$app
Definition: cli.php:39
$i
Definition: metadata.php:41

References $app, $i, 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 396 of file class.ilCalendarWeekGUI.php.

396 : void
397 {
398 foreach ($hours as $hour_num => $hours_per_day) {
399 foreach ($hours_per_day as $num_day => $hour) {
400 $this->colspans[$num_day] = max($this->colspans[$num_day] ?? 0, $hour['apps_num'] ?? 0);
401 }
402 }
403 }

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 $app, 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 590 of file class.ilCalendarWeekGUI.php.

590 : string
591 {
592 $time = "";
593 switch ($this->user_settings->getTimeFormat()) {
595 $time = $a_event->getStart()->get(IL_CAL_FKT_DATE, 'H:i', $this->timezone);
596 break;
597
599 $time = $a_event->getStart()->get(IL_CAL_FKT_DATE, 'h:ia', $this->timezone);
600 break;
601 }
602
603 return $time;
604 }
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 405 of file class.ilCalendarWeekGUI.php.

405 : int
406 {
407 if ($this->user_settings->getDayStart()) {
408 // push starting point to last "slot" of hour BEFORE morning aggregation
409 $morning_aggr = ($this->user_settings->getDayStart() - 1) * 60 + (60 - $this->raster);
410 } else {
411 $morning_aggr = 0;
412 }
413
414 return $morning_aggr;
415 }

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

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

References $i, 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 448 of file class.ilCalendarWeekGUI.php.

448 : void
449 {
450 $bkid = $this->initBookingUserFromQuery();
451 if ($bkid) {
452 $this->user_id = $bkid;
453 $this->disable_empty = true;
454 $this->no_add = true;
455 } elseif ($this->user->getId() == ANONYMOUS_USER_ID) {
456 $this->disable_empty = false;
457 $this->no_add = true;
458 } else {
459 $this->disable_empty = false;
460 $this->no_add = false;
461 }
462 }
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, 'Services/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 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 222 of file class.ilCalendarWeekGUI.php.

222 : void
223 {
224 $time = '';
225 $event_tpl = new ilTemplate('tpl.week_event_view.html', true, true, 'Services/Calendar');
226
228
229 $this->tpl->setCurrentBlock('not_empty');
230
231 $this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
232 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId());
233
234 $color = $this->app_colors->getColorByAppointment($a_app['event']->getEntryId());
235 $style = 'background-color: ' . $color . ';';
236 $style .= ('color:' . ilCalendarUtil::calculateFontColor($color));
237 $td_style = $style;
238
239 if (!$a_app['event']->isFullDay()) {
240 $time = $this->getAppointmentTimeString($a_app['event']);
241
242 $td_style .= $a_app['event']->getPresentationStyle();
243 }
244
245 $shy = $this->getAppointmentShyButton($a_app['event'], (string) $a_app['dstart'], "");
246
247 $title = ($time != "") ? $time . " " . $shy : $shy;
248
249 $event_tpl->setCurrentBlock('event_cell_content');
250 $event_tpl->setVariable("STYLE", $style);
251 $event_tpl->setVariable('EVENT_CONTENT', $title);
252
253 if ($event_html_by_plugin = $this->getContentByPlugins($a_app['event'], $a_app['dstart'], $title, $event_tpl)) {
254 $event_html = $event_html_by_plugin;
255 } else {
256 $event_tpl->parseCurrentBlock();
257 $event_html = $event_tpl->get();
258 }
259
260 $this->tpl->setVariable('GRID_CONTENT', $event_html);
261
262 // provide table cell attributes
263 $this->tpl->parseCurrentBlock();
264
265 $this->tpl->setCurrentBlock('day_cell');
266
267 $this->tpl->setVariable('DAY_ID', 'a' . $this->num_appointments);
268 $this->tpl->setVariable('TD_ROWSPAN', $a_app['rowspan']);
269 $this->tpl->setVariable('TD_STYLE', $a_app['event']->getPresentationStyle());
270 $this->tpl->setVariable('TD_CLASS', 'calevent il_calevent');
271
272 $this->tpl->parseCurrentBlock();
273
274 $this->num_appointments++;
275 }
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)
$ilUser
Definition: imgupload.php:34

References $ilUser, 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, 'Services/Calendar');
174
175 // milestone icon
176 if ($a_app['event']->isMilestone()) {
177 $event_tpl->setCurrentBlock('fullday_ms_icon');
178 $event_tpl->setVariable('ALT_FD_MS', $this->lng->txt("cal_milestone"));
179 $event_tpl->setVariable('SRC_FD_MS', ilUtil::getImagePath("icon_ms.svg"));
180 $event_tpl->parseCurrentBlock();
181 }
182
183 $event_tpl->setCurrentBlock('fullday_app');
184
185 $compl = ($a_app['event']->isMilestone() && $a_app['event']->getCompletion() > 0)
186 ? " (" . $a_app['event']->getCompletion() . "%)"
187 : "";
188
189 $shy = $this->getAppointmentShyButton($a_app['event'], (string) $a_app['dstart'], "");
190
191 $title = $shy . $compl;
192
193 $event_tpl->setVariable('EVENT_CONTENT', $title);
194
195 $color = $this->app_colors->getColorByAppointment($a_app['event']->getEntryId());
196 $font_color = ilCalendarUtil::calculateFontColor($color);
197
198 $event_tpl->setVariable('F_APP_BGCOLOR', $color);
199 $event_tpl->setVariable('F_APP_FONTCOLOR', $font_color);
200
201 $this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
202 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId());
203 $event_tpl->setVariable(
204 'F_APP_EDIT_LINK',
205 $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'edit')
206 );
207
208 if ($event_html_by_plugin = $this->getContentByPlugins($a_app['event'], $a_app['dstart'], $title, $event_tpl)) {
209 $event_html = $event_html_by_plugin;
210 } else {
211 $event_tpl->parseCurrentBlock();
212 $event_html = $event_tpl->get();
213 }
214
215 $this->tpl->setCurrentBlock("content_fd");
216 $this->tpl->setVariable("CONTENT_EVENT_FD", $event_html);
217 $this->tpl->parseCurrentBlock();
218
219 $this->num_appointments++;
220 }
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)

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

+ 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: