ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilCalendarDayGUI Class Reference

Presentation day view. More...

+ Inheritance diagram for ilCalendarDayGUI:
+ Collaboration diagram for ilCalendarDayGUI:

Public Member Functions

 __construct (ilDate $seed_date)
 Constructor. More...
 
 executeCommand ()
 Execute command. 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...
 
 parseInfoIntoRaster ($daily_apps, $morning_aggr, $evening_aggr, $raster)
 calculate overlapping hours More...
 
 calculateColspan ($hours)
 calculate colspan More...
 

Protected Attributes

 $seed_info = array()
 
 $user_settings = null
 
 $lng
 
 $ctrl
 
 $tabs_gui
 
 $tpl
 
 $num_appointments = 1
 
 $timezone = 'UTC'
 
 $user
 
 $ui
 
 $toolbar
 
- 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()

ilCalendarDayGUI::__construct ( ilDate  $seed_date)

Constructor.

public

Parameters

Definition at line 74 of file class.ilCalendarDayGUI.php.

References ilCalendarUserSettings\_getInstanceByUserId(), ilCalendarViewGUI\CAL_PRESENTATION_DAY, IL_CAL_FKT_GETDATE, and user().

75  {
76  parent::__construct($seed_date, ilCalendarViewGUI::CAL_PRESENTATION_DAY);
77 
78  $this->seed_info = $this->seed->get(IL_CAL_FKT_GETDATE);
79 
80  $this->user_settings = ilCalendarUserSettings::_getInstanceByUserId($this->user->getId());
81  $this->app_colors = new ilCalendarAppointmentColors($this->user->getId());
82 
83  $this->timezone = $this->user->getTimeZone();
84  }
static _getInstanceByUserId($a_user_id)
get singleton instance
user()
Definition: user.php:4
const IL_CAL_FKT_GETDATE
+ Here is the call graph for this function:

Member Function Documentation

◆ calculateColspan()

ilCalendarDayGUI::calculateColspan (   $hours)
protected

calculate colspan

protected

Parameters

Definition at line 567 of file class.ilCalendarDayGUI.php.

References $ilUser, and $user.

Referenced by executeCommand().

568  {
570 
571 
572  $colspan = 1;
573  foreach ($hours as $hour) {
574  $colspan = max($colspan, $hour['apps_num'] + 1);
575  }
576 
577  // screen reader: always two cols (time and event col)
578  if ($ilUser->prefs["screen_reader_optimization"]) {
579  $colspan = 2;
580  }
581 
582  return max($colspan, 2);
583  }
$ilUser
Definition: imgupload.php:18
+ Here is the caller graph for this function:

◆ executeCommand()

ilCalendarDayGUI::executeCommand ( )

Execute command.

public

Definition at line 92 of file class.ilCalendarDayGUI.php.

References $_GET, $_SESSION, $ctrl, $DIC, $i, $ilCtrl, $ilUser, $lng, $tpl, ilCalendarViewGUI\$ui_factory, $user, ilCalendarAppointmentPresentationGUI\_getInstance(), ilCalendarSettings\_getInstance(), ilCalendarUtil\_numericDayToString(), ilCalendarUtil\_numericMonthToString(), calculateColspan(), ilDateTime\DAY, ilCalendarViewGUI\getCurrentApp(), IL_CAL_DATE, IL_CAL_UNIX, ilYuiUtil\initDragDrop(), parseInfoIntoRaster(), showAppointment(), showFulldayAppointment(), and ilCalendarSchedule\TYPE_DAY.

93  {
95  $tpl = $this->tpl;
96 
97  $next_class = $ilCtrl->getNextClass();
98  switch ($next_class) {
99  case "ilcalendarappointmentpresentationgui":
100  $this->ctrl->setReturn($this, "");
101  include_once("./Services/Calendar/classes/class.ilCalendarAppointmentPresentationGUI.php");
102  $this->logger->debug("-ExecCommand - representation of ilDate: this->seed->get(IL_CAL_DATE) = " . $this->seed->get(IL_CAL_DATE));
104  $this->ctrl->forwardCommand($gui);
105  break;
106  case 'ilcalendarappointmentgui':
107  $this->ctrl->setReturn($this, '');
108  $this->tabs_gui->setSubTabActive($_SESSION['cal_last_tab']);
109 
110  // initial date for new calendar appointments
111  $idate = new ilDate($_REQUEST['idate'], IL_CAL_DATE);
112 
113  include_once('./Services/Calendar/classes/class.ilCalendarAppointmentGUI.php');
114  $app = new ilCalendarAppointmentGUI($this->seed, $idate, (int) $_GET['app_id']);
115  $this->ctrl->forwardCommand($app);
116  break;
117 
118  default:
119  $cmd = $this->ctrl->getCmd("show");
120  $this->$cmd();
121  $tpl->setContent($this->tpl->get());
122  break;
123  }
124  return true;
125  }
$_SESSION["AccountId"]
$_GET["client_id"]
static _getInstance(ilDate $seed, $a_app)
get singleton instance
getCurrentApp()
Get app for id.
global $ilCtrl
Definition: ilias.php:18
Class for single dates.
const IL_CAL_DATE
Administrate calendar appointments.
+ Here is the call graph for this function:

◆ parseInfoIntoRaster()

ilCalendarDayGUI::parseInfoIntoRaster (   $daily_apps,
  $morning_aggr,
  $evening_aggr,
  $raster 
)
protected

calculate overlapping hours

protected

Returns
array hours

Definition at line 450 of file class.ilCalendarDayGUI.php.

References $end, $i, $ilUser, $start, $user, ilCalendarSettings\TIME_FORMAT_12, and ilCalendarSettings\TIME_FORMAT_24.

Referenced by executeCommand().

451  {
453 
454  $hours = array();
455  for ($i = $morning_aggr;$i <= $evening_aggr;$i += $raster) {
456  $hours[$i]['apps_start'] = array();
457  $hours[$i]['apps_num'] = 0;
458 
459  switch ($this->user_settings->getTimeFormat()) {
461  if ($morning_aggr > 0 && $i == $morning_aggr) {
462  $hours[$i]['txt'] = sprintf('%02d:00', 0) . ' - ' .
463  sprintf('%02d:00', ceil(($i + 1) / 60));
464  } else {
465  $hours[$i]['txt'] .= sprintf('%02d:%02d', floor($i / 60), $i % 60);
466  }
467  if ($evening_aggr < 23 * 60 && $i == $evening_aggr) {
468  $hours[$i]['txt'] .= ' - ' . sprintf('%02d:00', 0);
469  }
470  break;
471 
473 
474  $this->logger->notice('Morning: ' . $morning_aggr . ' and $i:' . $i);
475 
476  if ($morning_aggr > 0 && $i == $morning_aggr) {
477  $hours[$i]['txt'] =
478  date('h a', mktime(0, 0, 0, 1, 1, 2000)) . ' - ' .
479  date('h a', mktime($this->user_settings->getDayStart(), 0, 0, 1, 1, 2000));
480  } else {
481  $hours[$i]['txt'] = date('h a', mktime(floor($i / 60), $i % 60, 0, 1, 1, 2000));
482  }
483  if ($evening_aggr < 23 * 60 && $i == $evening_aggr) {
484  $hours[$i]['txt'] .= ' - ' . date('h a', mktime(0, 0, 0, 1, 1, 2000));
485  }
486  break;
487  }
488  }
489 
490 
491  foreach ($daily_apps as $app) {
492  // fullday appointment are not relavant
493  if ($app['fullday']) {
494  continue;
495  }
496  // start hour for this day
497  #21132 #21636
498  if ($app['start_info']['mday'] != $this->seed_info['mday']) {
499  $start = 0;
500  } else {
501  $start = $app['start_info']['hours'] * 60 + $app['start_info']['minutes'];
502  }
503  #21636
504  //$start = $app['start_info']['hours']*60+$app['start_info']['minutes'];
505 
506  // end hour for this day
507  #21132
508  if ($app['end_info']['mday'] != $this->seed_info['mday']) {
509  $end = 23 * 60;
510  } elseif ($app['start_info']['hours'] == $app['end_info']['hours']) {
511  $end = $start + $raster;
512  } else {
513  $end = $app['end_info']['hours'] * 60 + $app['end_info']['minutes'];
514  }
515  //$end = $app['end_info']['hours']*60+$app['end_info']['minutes'];
516 
517  // set end to next hour for screen readers
518  if ($ilUser->prefs["screen_reader_optimization"]) {
519  $end = $start + $raster;
520  }
521 
522  if ($start < $morning_aggr) {
523  $start = $morning_aggr;
524  }
525  if ($end <= $morning_aggr) {
526  $end = $morning_aggr + $raster;
527  }
528  if ($start > $evening_aggr) {
529  $start = $evening_aggr;
530  }
531  if ($end > $evening_aggr + $raster) {
532  $end = $evening_aggr + $raster;
533  }
534  if ($end <= $start) {
535  $end = $start + $raster;
536  }
537 
538  // map start and end to raster
539  $start = floor($start / $raster) * $raster;
540  $end = ceil($end / $raster) * $raster;
541 
542  $first = true;
543  for ($i = $start;$i < $end;$i += $raster) {
544  if ($first) {
545  if (!$ilUser->prefs["screen_reader_optimization"]) {
546  $app['rowspan'] = ceil(($end - $start) / $raster);
547  } else { // screen readers get always a rowspan of 1
548  $app['rowspan'] = 1;
549  }
550  $hours[$i]['apps_start'][] = $app;
551  $first = false;
552  }
553  $hours[$i]['apps_num']++;
554  }
555  }
556 
557  return $hours;
558  }
$start
Definition: bench.php:8
$ilUser
Definition: imgupload.php:18
$i
Definition: disco.tpl.php:19
+ Here is the caller graph for this function:

◆ showAppointment()

ilCalendarDayGUI::showAppointment (   $a_app)
protected

show appointment

protected

Parameters
arrayappointment

Definition at line 372 of file class.ilCalendarDayGUI.php.

References $ilUser, $time, $title, $user, ilCalendarUtil\calculateFontColor(), ilCalendarViewGUI\getAppointmentShyButton(), ilCalendarViewGUI\getContentByPlugins(), IL_CAL_DATE, IL_CAL_FKT_DATE, ilCalendarSettings\TIME_FORMAT_12, and ilCalendarSettings\TIME_FORMAT_24.

Referenced by executeCommand().

373  {
375 
376  $event_tpl = new ilTemplate('tpl.day_event_view.html', true, true, 'Services/Calendar');
377 
378  if (!$ilUser->prefs["screen_reader_optimization"]) {
379  $event_tpl->setCurrentBlock('app');
380  } else {
381  $event_tpl->setCurrentBlock('scrd_app');
382  }
383 
384  $this->tpl->setVariable('APP_ROWSPAN', $a_app['rowspan']);
385  //$event_tpl->setVariable('APP_TITLE',$a_app['event']->getPresentationTitle(false));
386 
387  switch ($this->user_settings->getTimeFormat()) {
389  $time = $a_app['event']->getStart()->get(IL_CAL_FKT_DATE, 'H:i', $this->timezone);
390  break;
391 
393  $time = $a_app['event']->getStart()->get(IL_CAL_FKT_DATE, 'h:ia', $this->timezone);
394  break;
395  }
396 
397  // add end time for screen readers
398  if ($ilUser->prefs["screen_reader_optimization"]) {
399  switch ($this->user_settings->getTimeFormat()) {
401  $time .= "-" . $a_app['event']->getEnd()->get(IL_CAL_FKT_DATE, 'H:i', $this->timezone);
402  break;
403 
405  $time .= "-" . $a_app['event']->getEnd()->get(IL_CAL_FKT_DATE, 'h:ia', $this->timezone);
406  break;
407  }
408  }
409 
410  $shy = $this->getAppointmentShyButton($a_app['event'], $a_app['dstart'], "");
411 
412  $title = $shy;
413  $content = ($time != "")? $time . " " . $title : $title;
414 
415  $event_tpl->setVariable('EVENT_CONTENT', $content);
416 
417  $color = $this->app_colors->getColorByAppointment($a_app['event']->getEntryId());
418  $event_tpl->setVariable('APP_BGCOLOR', $color);
419  //$this->tpl->setVariable('APP_BGCOLOR',$color);
420  $event_tpl->setVariable('APP_COLOR', ilCalendarUtil::calculateFontColor($color));
421  //$this->tpl->setVariable('APP_COLOR',ilCalendarUtil::calculateFontColor($color));
422  $event_tpl->setVariable('APP_ADD_STYLES', $a_app['event']->getPresentationStyle());
423  //$this->tpl->setVariable('APP_ADD_STYLES',$a_app['event']->getPresentationStyle());
424 
425  $this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
426  $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->seed->get(IL_CAL_DATE));
427  $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId());
428  $event_tpl->setVariable('APP_EDIT_LINK', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'edit'));
429 
430  if ($event_html_by_plugin = $this->getContentByPlugins($a_app['event'], $a_app['dstart'], $content, $event_tpl)) {
431  $event_html = $event_html_by_plugin;
432  } else {
433  $event_tpl->parseCurrentBlock();
434  $event_html = $event_tpl->get();
435  }
436 
437  $this->tpl->setCurrentBlock("event_nfd");
438  $this->tpl->setVariable("CONTENT_EVENT_NFD", $event_html);
439  $this->tpl->parseCurrentBlock();
440 
441  $this->num_appointments++;
442  }
getAppointmentShyButton($a_calendar_entry, $a_dstart, $a_title_forced="")
$time
Definition: cron.php:21
special template class to simplify handling of ITX/PEAR
const IL_CAL_FKT_DATE
$ilUser
Definition: imgupload.php:18
static calculateFontColor($a_html_color_code)
Calculate best font color from html hex color code.
const IL_CAL_DATE
getContentByPlugins($a_cal_entry, $a_start_date, $a_content, $a_tpl)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showFulldayAppointment()

ilCalendarDayGUI::showFulldayAppointment (   $a_app)
protected

show fullday appointment

protected

Parameters
arrayappointment
Returns

Definition at line 314 of file class.ilCalendarDayGUI.php.

References $f, $r, ilCalendarViewGUI\$ui_factory, ilCalendarViewGUI\$ui_renderer, ilCalendarUtil\calculateFontColor(), ilCalendarViewGUI\getAppointmentShyButton(), ilCalendarViewGUI\getContentByPlugins(), ilUtil\getImagePath(), and IL_CAL_DATE.

Referenced by executeCommand().

315  {
318 
319  $event_tpl = new ilTemplate('tpl.day_event_view.html', true, true, 'Services/Calendar');
320 
321  // milestone icon
322  if ($a_app['event']->isMilestone()) {
323  $event_tpl->setCurrentBlock('fullday_ms_icon');
324  $event_tpl->setVariable('ALT_FD_MS', $this->lng->txt("cal_milestone"));
325  $event_tpl->setVariable('SRC_FD_MS', ilUtil::getImagePath("icon_ms.svg"));
326  $event_tpl->parseCurrentBlock();
327  }
328 
329  $event_tpl->setCurrentBlock('fullday_app');
330 
331  $compl = ($a_app['event']->isMilestone() && $a_app['event']->getCompletion() > 0)
332  ? " (" . $a_app['event']->getCompletion() . "%)"
333  : "";
334 
335  $shy = $this->getAppointmentShyButton($a_app['event'], $a_app['dstart'], "");
336 
337  //$title = ($new_title = $this->getContentByPlugins($a_app['event'], $a_app['dstart'], $shy))? $new_title : $shy;
338 
339  $content = $shy . $compl;
340 
341  $event_tpl->setVariable('EVENT_CONTENT', $content);
342 
343  $color = $this->app_colors->getColorByAppointment($a_app['event']->getEntryId());
344  $event_tpl->setVariable('F_APP_BGCOLOR', $color);
345  $event_tpl->setVariable('F_APP_FONTCOLOR', ilCalendarUtil::calculateFontColor($color));
346 
347  $this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
348  $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->seed->get(IL_CAL_DATE));
349  $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId());
350  $event_tpl->setVariable('F_APP_EDIT_LINK', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'edit'));
351 
352  if ($event_html_by_plugin = $this->getContentByPlugins($a_app['event'], $a_app['dstart'], $content, $event_tpl)) {
353  $body_html = $event_html_by_plugin;
354  } else {
355  $event_tpl->parseCurrentBlock();
356  $body_html = $event_tpl->get();
357  }
358 
359  $this->tpl->setCurrentBlock("content_fd");
360  $this->tpl->setVariable("CONTENT_EVENT", $body_html);
361  $this->tpl->parseCurrentBlock();
362 
363  $this->num_appointments++;
364  }
getAppointmentShyButton($a_calendar_entry, $a_dstart, $a_title_forced="")
$r
Definition: example_031.php:79
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
special template class to simplify handling of ITX/PEAR
static calculateFontColor($a_html_color_code)
Calculate best font color from html hex color code.
const IL_CAL_DATE
getContentByPlugins($a_cal_entry, $a_start_date, $a_content, $a_tpl)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilCalendarDayGUI::$ctrl
protected

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

Referenced by executeCommand().

◆ $lng

ilCalendarDayGUI::$lng
protected

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

Referenced by executeCommand().

◆ $num_appointments

ilCalendarDayGUI::$num_appointments = 1
protected

Definition at line 47 of file class.ilCalendarDayGUI.php.

◆ $seed_info

ilCalendarDayGUI::$seed_info = array()
protected

Definition at line 24 of file class.ilCalendarDayGUI.php.

◆ $tabs_gui

ilCalendarDayGUI::$tabs_gui
protected

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

◆ $timezone

ilCalendarDayGUI::$timezone = 'UTC'
protected

Definition at line 49 of file class.ilCalendarDayGUI.php.

◆ $toolbar

ilCalendarDayGUI::$toolbar
protected

Definition at line 64 of file class.ilCalendarDayGUI.php.

◆ $tpl

ilCalendarDayGUI::$tpl
protected

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

Referenced by executeCommand().

◆ $ui

ilCalendarDayGUI::$ui
protected

Definition at line 59 of file class.ilCalendarDayGUI.php.

◆ $user

ilCalendarDayGUI::$user
protected

◆ $user_settings

ilCalendarDayGUI::$user_settings = null
protected

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


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