ILIAS  release_7 Revision v7.30-3-g800a261c036
ilCalendarWeekGUI Class Reference
+ Inheritance diagram for ilCalendarWeekGUI:
+ Collaboration diagram for ilCalendarWeekGUI:

Public Member Functions

 __construct (ilDate $seed_date)
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 show ()
 fill data section More...
 
- Public Member Functions inherited from ilCalendarViewGUI
 __construct (ilDate $seed, $presentation_type)
 
 setConsulationHoursUserId ($a_user_id)
 
 getConsultationHoursUserId ()
 
 initialize ($a_calendar_presentation_type)
 View initialization. More...
 
 getCurrentApp ()
 Get app for id. More...
 
 getEvents ()
 Get events. More...
 
 getDatesForItem ($item)
 Get start/end date for item. More...
 
 getModalForApp ()
 Get modal for appointment (see similar code in ilCalendarBlockGUI) More...
 
 getAppointmentShyButton ($a_calendar_entry, $a_dstart, $a_title_forced="")
 
 getActivePlugins ($a_slot_id)
 
 getModalTitleByPlugins ($a_current_title)
 
 getContentByPlugins ($a_cal_entry, $a_start_date, $a_content, $a_tpl)
 
 addToolbarActions ()
 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 ($a_app)
 show fullday appointment More...
 
 showAppointment ($a_app)
 show appointment More...
 
 parseHourInfo ($daily_apps, $date, $num_day, $hours=null, $morning_aggr, $evening_aggr)
 calculate overlapping hours More...
 
 calculateColspans ($hours)
 calculate colspan More...
 
 getMorningAggr ()
 
 addAppointmentLink ($date)
 Add the links to create an appointment or milestone. More...
 
 setUpCalendar ()
 Set values for: user_id, disable_empty, no_add. More...
 
 addHeaderDate ($date, $num_apps)
 
 addFullDayEvents ($all_fullday)
 
 addTimedEvents ($hours, $morning_aggr, $evening_aggr)
 
 getAppointmentTimeString (ilCalendarEntry $a_event)
 

Protected Attributes

 $num_appointments = 1
 
 $user_settings = null
 
 $weekdays = array()
 
 $lng
 
 $ctrl
 
 $tabs_gui
 
 $tpl
 
 $timezone = 'UTC'
 
 $user
 
 $cal_settings
 
 $colspans
 
 $raster = 15
 
 $user_id
 
 $disable_empty
 
 $no_add
 
- Protected Attributes inherited from ilCalendarViewGUI
 $ui_factory
 
 $ui_renderer
 
 $ctrl
 
 $presentation_type
 
 $toolbar
 
 $logger
 
 $ui
 
 $view_with_appointments
 
 $lng
 
 $user
 
 $seed
 
 $ch_user_id = 0
 

Additional Inherited Members

- Data Fields inherited from ilCalendarViewGUI
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)

Constructor.

@access public

Parameters

xrefitem todo 136.

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

46 {
48
49 $this->seed_info = $this->seed->get(IL_CAL_FKT_GETDATE, '', 'UTC');
50
51 $this->user_settings = ilCalendarUserSettings::_getInstanceByUserId($this->user->getId());
52 $this->app_colors = new ilCalendarAppointmentColors($this->user->getId());
53
54 $this->timezone = $this->user->getTimeZone();
55 }
user()
Definition: user.php:4
const IL_CAL_FKT_GETDATE
static _getInstanceByUserId($a_user_id)
get singleton instance
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\GlobalScreen\Provider\__construct(), ilCalendarUserSettings\_getInstanceByUserId(), ilCalendarViewGUI\CAL_PRESENTATION_WEEK, IL_CAL_FKT_GETDATE, and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ addAppointmentLink()

ilCalendarWeekGUI::addAppointmentLink (   $date)
protected

Add the links to create an appointment or milestone.

Parameters
$date

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

478 {
479 $new_app_url = $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'add');
480
481 if ($this->cal_settings->getEnableGroupMilestones()) {
482 $new_ms_url = $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'addMilestone');
483
484 $this->tpl->setCurrentBlock("new_ms");
485 $this->tpl->setVariable('DD_ID', $date->get(IL_CAL_UNIX));
486 $this->tpl->setVariable('DD_TRIGGER', $this->ui_renderer->render($this->ui_factory->symbol()->glyph()->add()));
487 $this->tpl->setVariable('URL_DD_NEW_APP', $new_app_url);
488 $this->tpl->setVariable('TXT_DD_NEW_APP', $this->lng->txt('cal_new_app'));
489 $this->tpl->setVariable('URL_DD_NEW_MS', $new_ms_url);
490 $this->tpl->setVariable('TXT_DD_NEW_MS', $this->lng->txt('cal_new_ms'));
491 $this->tpl->parseCurrentBlock();
492 } else {
493 $this->tpl->setCurrentBlock("new_app");
494 //$this->tpl->setVariable('NEW_APP_LINK',$new_app_url);
495 $this->tpl->setVariable('NEW_APP_GLYPH', $this->ui_renderer->render(
496 $this->ui_factory->symbol()->glyph()->add($new_app_url)
497 ));
498 // $this->tpl->setVariable('NEW_APP_ALT',$this->lng->txt('cal_new_app'));
499 $this->tpl->parseCurrentBlock();
500 }
501
502 $this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
503 }
const IL_CAL_UNIX

References IL_CAL_UNIX.

Referenced by show().

+ Here is the caller graph for this function:

◆ addFullDayEvents()

ilCalendarWeekGUI::addFullDayEvents (   $all_fullday)
protected
Parameters
array$all_fulldayarray with all full day events

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

554 {
555 $counter = 0;
556 foreach ($all_fullday as $daily_apps) {
557 foreach ($daily_apps as $event) {
558 if ($event['fullday']) {
559 $this->showFulldayAppointment($event);
560 }
561 }
562 $this->tpl->setCurrentBlock('f_day_row');
563 $this->tpl->setVariable('COLSPAN', max($this->colspans[$counter], 1));
564 $this->tpl->parseCurrentBlock();
565 $counter++;
566 }
567 $this->tpl->setCurrentBlock('fullday_apps');
568 $this->tpl->setVariable('TXT_F_DAY', $this->lng->txt("cal_all_day"));
569 $this->tpl->parseCurrentBlock();
570 }
showFulldayAppointment($a_app)
show fullday appointment

References showFulldayAppointment().

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
Parameters
$date
$num_apps

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

530 {
531 $date_info = $date->get(IL_CAL_FKT_GETDATE, '', 'UTC');
532 $dayname = ilCalendarUtil::_numericDayToString($date->get(IL_CAL_FKT_DATE, 'w'), false);
533 $daydate = $dayname . ' ' . $date_info['mday'] . '.';
534
535 if (!$this->disable_empty || $num_apps[$date->get(IL_CAL_DATE)] > 0) {
536 $link = $this->ctrl->getLinkTargetByClass('ilcalendardaygui', '');
537 $this->ctrl->clearParametersByClass('ilcalendardaygui');
538
539 $this->tpl->setCurrentBlock("day_view_link");
540 $this->tpl->setVariable('HEADER_DATE', $daydate);
541 $this->tpl->setVariable('DAY_VIEW_LINK', $link);
542 $this->tpl->parseCurrentBlock();
543 } else {
544 $this->tpl->setCurrentBlock("day_view_no_link");
545 $this->tpl->setVariable('HEADER_DATE', $daydate);
546 $this->tpl->parseCurrentBlock();
547 }
548 }
const IL_CAL_DATE
const IL_CAL_FKT_DATE
static _numericDayToString($a_day, $a_long=true)
get

References ilCalendarUtil\_numericDayToString(), 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 (   $hours,
  $morning_aggr,
  $evening_aggr 
)
protected
Parameters
$hours
$morning_aggr
$evening_aggr

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

578 {
579 global $DIC;
580
581 $ui_factory = $DIC->ui()->factory();
582 $renderer = $DIC->ui()->renderer();
583
584 $new_link_counter = 0;
585 $day_id_counter = 0;
586 foreach ($hours as $num_hour => $hours_per_day) {
587 $first = true;
588 foreach ($hours_per_day as $num_day => $hour) {
589
590 #ADD the hours in the left side of the grid.
591 if ($first) {
592 if (!($num_hour % 60) || ($num_hour == $morning_aggr && $morning_aggr) ||
593 ($num_hour == $evening_aggr && $evening_aggr)) {
594 $first = false;
595
596 // aggregation rows
597 if (($num_hour == $morning_aggr && $morning_aggr) ||
598 ($num_hour == $evening_aggr && $evening_aggr)) {
599 $this->tpl->setVariable('TIME_ROWSPAN', 1);
600 }
601 // rastered hour
602 else {
603 $this->tpl->setVariable('TIME_ROWSPAN', 60 / $this->raster);
604 }
605
606 $this->tpl->setCurrentBlock('time_txt');
607
608 $this->tpl->setVariable('TIME', $hour['txt']);
609 $this->tpl->parseCurrentBlock();
610 }
611 }
612
613 foreach ($hour['apps_start'] as $app) {
614 $this->showAppointment($app);
615 }
616
617 // screen reader: appointments are divs, now output cell
618 if ($this->user->prefs["screen_reader_optimization"]) {
619 $this->tpl->setCurrentBlock('scrd_day_cell');
620 $this->tpl->setVariable('TD_CLASS', 'calstd');
621 $this->tpl->parseCurrentBlock();
622 }
623
624 #echo "NUMDAY: ".$num_day;
625 #echo "COLAPANS: ".max($colspans[$num_day],1).'<br />';
626 $num_apps = $hour['apps_num'];
627 $colspan = max($this->colspans[$num_day], 1);
628
629 // Show new apointment link
630 if (!$hour['apps_num'] && !$this->user->prefs["screen_reader_optimization"] && !$this->no_add) {
631 $this->tpl->setCurrentBlock('new_app_link');
632
633 $this->ctrl->clearParameterByClass('ilcalendarappointmentgui', 'app_id');
634
635 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'idate', $this->weekdays[$num_day]->get(IL_CAL_DATE));
636 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->seed->get(IL_CAL_DATE));
637 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'hour', floor($num_hour / 60));
638
639 //todo:it could be nice use also ranges of 15 min to create events.
640 $new_app_url = $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'add');
641 $this->tpl->setVariable("DAY_NEW_APP_LINK", $renderer->render($ui_factory->symbol()->glyph()->add($new_app_url)));
642
643
644 $this->tpl->setVariable('DAY_NEW_ID', ++$new_link_counter);
645 $this->tpl->parseCurrentBlock();
646 }
647
648 for ($i = $colspan;$i > $hour['apps_num'];$i--) {
649 if ($this->user->prefs["screen_reader_optimization"]) {
650 continue;
651 }
652 $this->tpl->setCurrentBlock('day_cell');
653
654 // last "slot" of hour needs border
655 $empty_border = '';
656 if ($num_hour % 60 == 60 - $this->raster ||
657 ($num_hour == $morning_aggr && $morning_aggr) ||
658 ($num_hour == $evening_aggr && $evening_aggr)) {
659 $empty_border = ' calempty_border';
660 }
661
662 $this->tpl->setVariable('TD_CLASS', 'calempty createhover' . $empty_border);
663
664 $this->tpl->setVariable('DAY_ID', ++$day_id_counter);
665 $this->tpl->setVariable('TD_ROWSPAN', 1);
666 $this->tpl->parseCurrentBlock();
667 }
668 }
669
670 $this->tpl->touchBlock('time_row');
671 }
672 }
showAppointment($a_app)
show appointment
$app
Definition: cli.php:38
global $DIC
Definition: goto.php:24
$i
Definition: metadata.php:24

References $app, $DIC, $i, ilCalendarViewGUI\$ui_factory, IL_CAL_DATE, showAppointment(), and user().

Referenced by show().

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

◆ calculateColspans()

ilCalendarWeekGUI::calculateColspans (   $hours)
protected

calculate colspan

@access protected

Parameters

return

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

441 {
442 global $DIC;
443
444 $ilUser = $DIC['ilUser'];
445
446 foreach ($hours as $hour_num => $hours_per_day) {
447 foreach ($hours_per_day as $num_day => $hour) {
448 $this->colspans[$num_day] = max($this->colspans[$num_day], $hour['apps_num']);
449
450 // screen reader: always one col
451 if ($ilUser->prefs["screen_reader_optimization"]) {
452 $this->colspans[$num_day] = 1;
453 }
454 }
455 }
456 }
$ilUser
Definition: imgupload.php:18

References $DIC, and $ilUser.

Referenced by show().

+ Here is the caller graph for this function:

◆ executeCommand()

ilCalendarWeekGUI::executeCommand ( )

Execute command.

@access public

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

64 {
65 global $DIC;
66
67 $ilCtrl = $DIC['ilCtrl'];
68 $tpl = $DIC['tpl'];
69
70 $this->ctrl->saveParameter($this, 'seed');
71
72 $next_class = $ilCtrl->getNextClass();
73 switch ($next_class) {
74 case "ilcalendarappointmentpresentationgui":
75 $this->ctrl->setReturn($this, "");
76 include_once("./Services/Calendar/classes/class.ilCalendarAppointmentPresentationGUI.php");
78 $this->ctrl->forwardCommand($gui);
79 break;
80 case 'ilcalendarappointmentgui':
81 $this->ctrl->setReturn($this, '');
82 $this->tabs_gui->setSubTabActive($_SESSION['cal_last_tab']);
83
84 // initial date for new calendar appointments
85 $idate = new ilDate($_REQUEST['idate'], IL_CAL_DATE);
86
87 include_once('./Services/Calendar/classes/class.ilCalendarAppointmentGUI.php');
88 $app = new ilCalendarAppointmentGUI($this->seed, $idate, (int) $_GET['app_id']);
89 $this->ctrl->forwardCommand($app);
90 break;
91
92 default:
93 $time = microtime(true);
94 $cmd = $this->ctrl->getCmd("show");
95 $this->$cmd();
96 $tpl->setContent($this->tpl->get());
97 #echo "Zeit: ".(microtime(true) - $time);
98 break;
99 }
100
101 return true;
102 }
$_GET["client_id"]
$_SESSION["AccountId"]
Administrate calendar appointments.
static _getInstance(ilDate $seed, $a_app)
get singleton instance
getCurrentApp()
Get app for id.
Class for single dates.

References $_GET, $_SESSION, $app, $DIC, $tpl, ilCalendarAppointmentPresentationGUI\_getInstance(), ilCalendarViewGUI\getCurrentApp(), and IL_CAL_DATE.

+ Here is the call graph for this function:

◆ getAppointmentTimeString()

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

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

679 {
680 $time = "";
681 switch ($this->user_settings->getTimeFormat()) {
683 $time = $a_event->getStart()->get(IL_CAL_FKT_DATE, 'H:i', $this->timezone);
684 break;
685
687 $time = $a_event->getStart()->get(IL_CAL_FKT_DATE, 'h:ia', $this->timezone);
688 break;
689 }
690 // add end time for screen readers
691 if ($this->user->prefs["screen_reader_optimization"]) {
692 switch ($this->user_settings->getTimeFormat()) {
694 $time .= "-" . $a_event->getEnd()->get(IL_CAL_FKT_DATE, 'H:i', $this->timezone);
695 break;
696
698 $time .= "-" . $a_event->getEnd()->get(IL_CAL_FKT_DATE, 'h:ia', $this->timezone);
699 break;
700 }
701 }
702
703 return $time;
704 }
getEnd()
get end @access public

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

Referenced by showAppointment().

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

◆ getMorningAggr()

ilCalendarWeekGUI::getMorningAggr ( )
protected
Returns
int morning aggregated hours.

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

462 {
463 if ($this->user_settings->getDayStart()) {
464 // push starting point to last "slot" of hour BEFORE morning aggregation
465 $morning_aggr = ($this->user_settings->getDayStart() - 1) * 60 + (60 - $this->raster);
466 } else {
467 $morning_aggr = 0;
468 }
469
470 return $morning_aggr;
471 }

Referenced by show().

+ Here is the caller graph for this function:

◆ parseHourInfo()

ilCalendarWeekGUI::parseHourInfo (   $daily_apps,
  $date,
  $num_day,
  $hours = null,
  $morning_aggr,
  $evening_aggr 
)
protected

calculate overlapping hours

@access protected

Returns
array hours

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

324 {
325 global $DIC;
326
327 $ilUser = $DIC['ilUser'];
328
329 for ($i = $morning_aggr;$i <= $evening_aggr;$i += $this->raster) {
330 $hours[$i][$num_day]['apps_start'] = array();
331 $hours[$i][$num_day]['apps_num'] = 0;
332 switch ($this->user_settings->getTimeFormat()) {
334 if ($morning_aggr > 0 && $i == $morning_aggr) {
335 $hours[$i][$num_day]['txt'] = sprintf('%02d:00', 0) . ' - ' .
336 sprintf('%02d:00', ceil(($i + 1) / 60));
337 } else {
338 $hours[$i][$num_day]['txt'] .= sprintf('%02d:%02d', floor($i / 60), $i % 60);
339 }
340 if ($evening_aggr < 23 * 60 && $i == $evening_aggr) {
341 $hours[$i][$num_day]['txt'] .= ' - ' . sprintf('%02d:00', 0);
342 }
343 break;
344
346 if ($morning_aggr > 0 && $i == $morning_aggr) {
347 $hours[$i][$num_day]['txt'] =
348 date('h a', mktime(0, 0, 0, 1, 1, 2000)) . ' - ' .
349 date('h a', mktime($this->user_settings->getDayStart(), 0, 0, 1, 1, 2000));
350 } else {
351 $hours[$i][$num_day]['txt'] .= date('h a', mktime(floor($i / 60), $i % 60, 0, 1, 1, 2000));
352 }
353 if ($evening_aggr < 23 * 60 && $i == $evening_aggr) {
354 $hours[$i][$num_day]['txt'] =
355 date('h a', mktime($this->user_settings->getDayEnd(), 0, 0, 1, 1, '2000')) . ' - ' .
356 date('h a', mktime(0, 0, 0, 1, 1, 2000));
357 }
358 break;
359 }
360 }
361
362 $date_info = $date->get(IL_CAL_FKT_GETDATE, '', 'UTC');
363
364
365 foreach ($daily_apps as $app) {
366 // fullday appointment are not relavant
367 if ($app['fullday']) {
368 continue;
369 }
370 // start hour for this day
371 #21636
372 if ($app['start_info']['mday'] != $date_info['mday']) {
373 $start = 0;
374 } else {
375 $start = $app['start_info']['hours'] * 60 + $app['start_info']['minutes'];
376 }
377 #21132 #21636
378 //$start = $app['start_info']['hours']*60+$app['start_info']['minutes'];
379
380 // end hour for this day
381 if ($app['end_info']['mday'] != $date_info['mday']) {
382 $end = 23 * 60;
383 } elseif ($app['start_info']['hours'] == $app['end_info']['hours']) {
384 $end = $start + $raster;
385 } else {
386 $end = $app['end_info']['hours'] * 60 + $app['end_info']['minutes'];
387 }
388 #21132 #21636
389 //$end = $app['end_info']['hours']*60+$app['end_info']['minutes'];
390
391 // set end to next hour for screen readers
392 if ($ilUser->prefs["screen_reader_optimization"]) {
393 $end = $start + $this->raster;
394 }
395
396 if ($start < $morning_aggr) {
397 $start = $morning_aggr;
398 }
399 if ($end <= $morning_aggr) {
400 $end = $morning_aggr + $this->raster;
401 }
402 if ($start > $evening_aggr) {
403 $start = $evening_aggr;
404 }
405 if ($end > $evening_aggr + $this->raster) {
406 $end = $evening_aggr + $this->raster;
407 }
408 if ($end <= $start) {
409 $end = $start + $this->raster;
410 }
411
412 // map start and end to raster
413 $start = floor($start / $this->raster) * $this->raster;
414 $end = ceil($end / $this->raster) * $this->raster;
415
416 $first = true;
417 for ($i = $start;$i < $end;$i += $this->raster) {
418 if ($first) {
419 if (!$ilUser->prefs["screen_reader_optimization"]) {
420 $app['rowspan'] = ceil(($end - $start) / $this->raster);
421 } else { // screen readers get always a rowspan of 1
422 $app['rowspan'] = 1;
423 }
424 $hours[$i][$num_day]['apps_start'][] = $app;
425 $first = false;
426 }
427 $hours[$i][$num_day]['apps_num']++;
428 }
429 }
430 return $hours;
431 }

References $app, $DIC, $i, $ilUser, $raster, IL_CAL_FKT_GETDATE, ilCalendarSettings\TIME_FORMAT_12, and ilCalendarSettings\TIME_FORMAT_24.

Referenced by show().

+ Here is the caller graph for this function:

◆ setUpCalendar()

ilCalendarWeekGUI::setUpCalendar ( )
protected

Set values for: user_id, disable_empty, no_add.

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

509 {
510 if (isset($_GET["bkid"])) {
511 $this->user_id = $_GET["bkid"];
512 $this->disable_empty = true;
513 $this->no_add = true;
514 } elseif ($this->user->getId() == ANONYMOUS_USER_ID) {
515 //$this->user_id = $ilUser->getId();
516 $this->disable_empty = false;
517 $this->no_add = true;
518 } else {
519 //$this->user_id = $ilUser->getId();
520 $this->disable_empty = false;
521 $this->no_add = false;
522 }
523 }
const ANONYMOUS_USER_ID
Definition: constants.php:25

References $_GET, ANONYMOUS_USER_ID, and user().

Referenced by show().

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

◆ show()

ilCalendarWeekGUI::show ( )

fill data section

@access public

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

111 {
112 $morning_aggr = $this->getMorningAggr();
113 $evening_aggr = $this->user_settings->getDayEnd() * 60;
114
115 $this->tpl = new ilTemplate('tpl.week_view.html', true, true, 'Services/Calendar');
116
117 include_once('./Services/YUI/classes/class.ilYuiUtil.php');
119
120 $navigation = new ilCalendarHeaderNavigationGUI($this, $this->seed, ilDateTime::WEEK);
121 $this->tpl->setVariable('NAVIGATION', $navigation->getHTML());
122
123 $this->setUpCalendar();
124
125 include_once('Services/Calendar/classes/class.ilCalendarSchedule.php');
126 $this->scheduler = new ilCalendarSchedule($this->seed, ilCalendarSchedule::TYPE_WEEK, $this->user_id, $this->disable_empty);
127 $this->scheduler->addSubitemCalendars(true);
128 $this->scheduler->calculate();
129
130 $counter = 0;
131 $hours = null;
132 $all_fullday = array();
133 foreach (ilCalendarUtil::_buildWeekDayList($this->seed, $this->user_settings->getWeekStart())->get() as $date) {
134 $daily_apps = $this->scheduler->getByDay($date, $this->timezone);
135 if (!$this->view_with_appointments && count($daily_apps)) {
136 $this->view_with_appointments = true;
137 }
138 $hours = $this->parseHourInfo(
139 $daily_apps,
140 $date,
141 $counter,
142 $hours,
143 $morning_aggr,
144 $evening_aggr,
145 $this->raster
146 );
147 $this->weekdays[] = $date;
148
149 $num_apps[$date->get(IL_CAL_DATE)] = count($daily_apps);
150
151 $all_fullday[] = $daily_apps;
152 $counter++;
153 }
154
155 $this->calculateColspans($hours);
156
157 include_once('Services/Calendar/classes/class.ilCalendarSettings.php');
158 $this->cal_settings = ilCalendarSettings::_getInstance();
159
160 // Table header
161 $counter = 0;
162 foreach (ilCalendarUtil::_buildWeekDayList($this->seed, $this->user_settings->getWeekStart())->get() as $date) {
163 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $date->get(IL_CAL_DATE));
164 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'idate', $date->get(IL_CAL_DATE));
165 $this->ctrl->setParameterByClass('ilcalendardaygui', 'seed', $date->get(IL_CAL_DATE));
166
167 if (!$this->no_add) {
168 $this->addAppointmentLink($date);
169 }
170
171 $this->addHeaderDate($date, $num_apps);
172
173 $this->tpl->setCurrentBlock('day_header_row');
174 $this->tpl->setVariable('DAY_COLSPAN', max($this->colspans[$counter], 1));
175 $this->tpl->parseCurrentBlock();
176
177 $counter++;
178 }
179
180 // show fullday events
181 $this->addFullDayEvents($all_fullday);
182
183 //show timed events
184 $this->addTimedEvents($hours, $morning_aggr, $evening_aggr);
185
186 $this->tpl->setVariable("TXT_TIME", $this->lng->txt("time"));
187 }
Represents a list of calendar appointments (including recurring events) for a specific user in a give...
static _getInstance()
get singleton instance
static _buildWeekDayList($a_day, $a_weekstart)
build week day list
setUpCalendar()
Set values for: user_id, disable_empty, no_add.
addTimedEvents($hours, $morning_aggr, $evening_aggr)
addHeaderDate($date, $num_apps)
calculateColspans($hours)
calculate colspan
addAppointmentLink($date)
Add the links to create an appointment or milestone.
parseHourInfo($daily_apps, $date, $num_day, $hours=null, $morning_aggr, $evening_aggr)
calculate overlapping hours
special template class to simplify handling of ITX/PEAR
static initDragDrop(ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI Drag and Drop.

References ilCalendarUtil\_buildWeekDayList(), ilCalendarSettings\_getInstance(), addAppointmentLink(), addFullDayEvents(), addHeaderDate(), addTimedEvents(), calculateColspans(), getMorningAggr(), IL_CAL_DATE, ilYuiUtil\initDragDrop(), parseHourInfo(), setUpCalendar(), ilCalendarSchedule\TYPE_WEEK, and ilDateTime\WEEK.

+ Here is the call graph for this function:

◆ showAppointment()

ilCalendarWeekGUI::showAppointment (   $a_app)
protected

show appointment

@access protected

Parameters
arrayappointment

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

251 {
252 $event_tpl = new ilTemplate('tpl.week_event_view.html', true, true, 'Services/Calendar');
253
255
256 if (!$ilUser->prefs["screen_reader_optimization"]) {
257 $this->tpl->setCurrentBlock('not_empty');
258 } else {
259 $this->tpl->setCurrentBlock('scrd_not_empty');
260 }
261
262 $this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
263 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId());
264
265 $color = $this->app_colors->getColorByAppointment($a_app['event']->getEntryId());
266 $style = 'background-color: ' . $color . ';';
267 $style .= ('color:' . ilCalendarUtil::calculateFontColor($color));
268 $td_style = $style;
269
270
271 if (!$a_app['event']->isFullDay()) {
272 $time = $this->getAppointmentTimeString($a_app['event']);
273
274 $td_style .= $a_app['event']->getPresentationStyle();
275 }
276
277 $shy = $this->getAppointmentShyButton($a_app['event'], $a_app['dstart'], "");
278
279 $title = ($time != "")? $time . " " . $shy : $shy;
280
281 $event_tpl->setCurrentBlock('event_cell_content');
282 if (!$ilUser->prefs["screen_reader_optimization"]) {
283 $event_tpl->setVariable("STYLE", $style);
284 }
285 $event_tpl->setVariable('EVENT_CONTENT', $title);
286
287 if ($event_html_by_plugin = $this->getContentByPlugins($a_app['event'], $a_app['dstart'], $title, $event_tpl)) {
288 $event_html = $event_html_by_plugin;
289 } else {
290 $event_tpl->parseCurrentBlock();
291 $event_html = $event_tpl->get();
292 }
293
294 $this->tpl->setVariable('GRID_CONTENT', $event_html);
295
296 if (!$ilUser->prefs["screen_reader_optimization"]) {
297 // provide table cell attributes
298 $this->tpl->parseCurrentBlock();
299
300 $this->tpl->setCurrentBlock('day_cell');
301
302 $this->tpl->setVariable('DAY_ID', 'a'.$this->num_appointments);
303 $this->tpl->setVariable('TD_ROWSPAN', $a_app['rowspan']);
304 $this->tpl->setVariable('TD_STYLE',$a_app['event']->getPresentationStyle());
305 $this->tpl->setVariable('TD_CLASS', 'calevent il_calevent');
306
307 $this->tpl->parseCurrentBlock();
308 } else {
309 // screen reader: work on div attributes
310 $this->tpl->setVariable('DIV_STYLE', $style);
311 $this->tpl->parseCurrentBlock();
312 }
313
314 $this->num_appointments++;
315 }
static calculateFontColor($a_html_color_code)
Calculate best font color from html hex color code.
getAppointmentShyButton($a_calendar_entry, $a_dstart, $a_title_forced="")
getContentByPlugins($a_cal_entry, $a_start_date, $a_content, $a_tpl)
getAppointmentTimeString(ilCalendarEntry $a_event)

References $ilUser, $user, ilCalendarUtil\calculateFontColor(), ilCalendarViewGUI\getAppointmentShyButton(), getAppointmentTimeString(), and ilCalendarViewGUI\getContentByPlugins().

Referenced by addTimedEvents().

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

◆ showFulldayAppointment()

ilCalendarWeekGUI::showFulldayAppointment (   $a_app)
protected

show fullday appointment

@access protected

Parameters
arrayappointment
Returns

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

197 {
198 $event_tpl = new ilTemplate('tpl.day_event_view.html', true, true, 'Services/Calendar');
199
200 // milestone icon
201 if ($a_app['event']->isMilestone()) {
202 $event_tpl->setCurrentBlock('fullday_ms_icon');
203 $event_tpl->setVariable('ALT_FD_MS', $this->lng->txt("cal_milestone"));
204 $event_tpl->setVariable('SRC_FD_MS', ilUtil::getImagePath("icon_ms.svg"));
205 $event_tpl->parseCurrentBlock();
206 }
207
208 $event_tpl->setCurrentBlock('fullday_app');
209
210 $compl = ($a_app['event']->isMilestone() && $a_app['event']->getCompletion() > 0)
211 ? " (" . $a_app['event']->getCompletion() . "%)"
212 : "";
213
214 $shy = $this->getAppointmentShyButton($a_app['event'], $a_app['dstart'], "");
215
216 $title = $shy . $compl;
217
218 $event_tpl->setVariable('EVENT_CONTENT', $title);
219
220 $color = $this->app_colors->getColorByAppointment($a_app['event']->getEntryId());
221 $font_color = ilCalendarUtil::calculateFontColor($color);
222
223 $event_tpl->setVariable('F_APP_BGCOLOR', $color);
224 $event_tpl->setVariable('F_APP_FONTCOLOR', $font_color);
225
226 $this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
227 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId());
228 $event_tpl->setVariable('F_APP_EDIT_LINK', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'edit'));
229
230 if ($event_html_by_plugin = $this->getContentByPlugins($a_app['event'], $a_app['dstart'], $title, $event_tpl)) {
231 $event_html = $event_html_by_plugin;
232 } else {
233 $event_tpl->parseCurrentBlock();
234 $event_html = $event_tpl->get();
235 }
236
237 $this->tpl->setCurrentBlock("content_fd");
238 $this->tpl->setVariable("CONTENT_EVENT_FD", $event_html);
239 $this->tpl->parseCurrentBlock();
240
241 $this->num_appointments++;
242 }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)

References ilCalendarUtil\calculateFontColor(), ilCalendarViewGUI\getAppointmentShyButton(), ilCalendarViewGUI\getContentByPlugins(), and ilUtil\getImagePath().

Referenced by addFullDayEvents().

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

Field Documentation

◆ $cal_settings

ilCalendarWeekGUI::$cal_settings
protected

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

◆ $colspans

ilCalendarWeekGUI::$colspans
protected

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

◆ $ctrl

ilCalendarWeekGUI::$ctrl
protected

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

◆ $disable_empty

ilCalendarWeekGUI::$disable_empty
protected

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

◆ $lng

ilCalendarWeekGUI::$lng
protected

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

◆ $no_add

ilCalendarWeekGUI::$no_add
protected

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

◆ $num_appointments

ilCalendarWeekGUI::$num_appointments = 1
protected

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

◆ $raster

ilCalendarWeekGUI::$raster = 15
protected

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

Referenced by parseHourInfo().

◆ $tabs_gui

ilCalendarWeekGUI::$tabs_gui
protected

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

◆ $timezone

ilCalendarWeekGUI::$timezone = 'UTC'
protected

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

◆ $tpl

ilCalendarWeekGUI::$tpl
protected

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

Referenced by executeCommand().

◆ $user

ilCalendarWeekGUI::$user
protected

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

Referenced by showAppointment().

◆ $user_id

ilCalendarWeekGUI::$user_id
protected

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

◆ $user_settings

ilCalendarWeekGUI::$user_settings = null
protected

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

◆ $weekdays

ilCalendarWeekGUI::$weekdays = array()
protected

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


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