ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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

Presentation day view.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

@ilCtrl_Calls ilCalendarDayGUI: ilCalendarAppointmentGUI @ilCtrl_Calls ilCalendarDayGUI: ilCalendarAppointmentPresentationGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilCalendarDayGUI::__construct ( ilDate  $seed_date)

Constructor.

@access public

Parameters

xrefitem todo 200.

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

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 }
user()
Definition: user.php:4
const IL_CAL_FKT_GETDATE
static _getInstanceByUserId($a_user_id)
get singleton instance

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

+ Here is the call graph for this function:

Member Function Documentation

◆ calculateColspan()

ilCalendarDayGUI::calculateColspan (   $hours)
protected

calculate colspan

@access protected

Parameters

return

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

562 {
564
565
566 $colspan = 1;
567 foreach ($hours as $hour) {
568 $colspan = max($colspan, $hour['apps_num'] + 1);
569 }
570
571 // screen reader: always two cols (time and event col)
572 if ($ilUser->prefs["screen_reader_optimization"]) {
573 $colspan = 2;
574 }
575
576 return max($colspan, 2);
577 }
$ilUser
Definition: imgupload.php:18

References $ilUser, and $user.

◆ executeCommand()

ilCalendarDayGUI::executeCommand ( )

Execute command.

@access public

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

93 {
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 }
$_GET["client_id"]
$_SESSION["AccountId"]
const IL_CAL_DATE
Administrate calendar appointments.
static _getInstance(ilDate $seed, $a_app)
get singleton instance
getCurrentApp()
Get app for id.
Class for single dates.
global $ilCtrl
Definition: ilias.php:18

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

+ Here is the call graph for this function:

◆ parseInfoIntoRaster()

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

calculate overlapping hours

@access protected

Returns
array hours

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

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', 23);
469 }
470 break;
471
473 if ($morning_aggr > 0 && $i == $morning_aggr) {
474 $hours[$i]['txt'] = date('h a', mktime(0, 0, 0, 1, 1, 2000)) . "-";
475 }
476 $hours[$i]['txt'] = date('h a', mktime(floor($i/60), $i%60, 0, 1, 1, 2000));
477 if ($evening_aggr < 23*60 && $i == $evening_aggr) {
478 $hours[$i]['txt'].= "-" . date('h a', mktime(23, 0, 0, 1, 1, 2000));
479 }
480 break;
481 }
482 }
483
484
485 foreach ($daily_apps as $app) {
486 // fullday appointment are not relavant
487 if ($app['fullday']) {
488 continue;
489 }
490 // start hour for this day
491 #21132 #21636
492 if ($app['start_info']['mday'] != $this->seed_info['mday']) {
493 $start = 0;
494 } else {
495 $start = $app['start_info']['hours']*60+$app['start_info']['minutes'];
496 }
497 #21636
498 //$start = $app['start_info']['hours']*60+$app['start_info']['minutes'];
499
500 // end hour for this day
501 #21132
502 if ($app['end_info']['mday'] != $this->seed_info['mday']) {
503 $end = 23*60;
504 } elseif ($app['start_info']['hours'] == $app['end_info']['hours']) {
505 $end = $start+$raster;
506 } else {
507 $end = $app['end_info']['hours']*60+$app['end_info']['minutes'];
508 }
509 //$end = $app['end_info']['hours']*60+$app['end_info']['minutes'];
510
511 // set end to next hour for screen readers
512 if ($ilUser->prefs["screen_reader_optimization"]) {
513 $end = $start+$raster;
514 }
515
516 if ($start < $morning_aggr) {
517 $start = $morning_aggr;
518 }
519 if ($end <= $morning_aggr) {
520 $end = $morning_aggr+$raster;
521 }
522 if ($start > $evening_aggr) {
523 $start = $evening_aggr;
524 }
525 if ($end > $evening_aggr+$raster) {
526 $end = $evening_aggr+$raster;
527 }
528 if ($end <= $start) {
529 $end = $start+$raster;
530 }
531
532 // map start and end to raster
533 $start = floor($start/$raster)*$raster;
534 $end = ceil($end/$raster)*$raster;
535
536 $first = true;
537 for ($i = $start;$i < $end;$i+=$raster) {
538 if ($first) {
539 if (!$ilUser->prefs["screen_reader_optimization"]) {
540 $app['rowspan'] = ceil(($end - $start)/$raster);
541 } else { // screen readers get always a rowspan of 1
542 $app['rowspan'] = 1;
543 }
544 $hours[$i]['apps_start'][] = $app;
545 $first = false;
546 }
547 $hours[$i]['apps_num']++;
548 }
549 }
550
551 return $hours;
552 }
sprintf('%.4f', $callTime)
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
$i
Definition: disco.tpl.php:19
$end
Definition: saml1-acs.php:18

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

◆ showAppointment()

ilCalendarDayGUI::showAppointment (   $a_app)
protected

show appointment

@access protected

Parameters
arrayappointment

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

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 }
const IL_CAL_FKT_DATE
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)
special template class to simplify handling of ITX/PEAR
$time
Definition: cron.php:21

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.

+ Here is the call graph for this function:

◆ showFulldayAppointment()

ilCalendarDayGUI::showFulldayAppointment (   $a_app)
protected

show fullday appointment

@access protected

Parameters
arrayappointment
Returns

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

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 }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$r
Definition: example_031.php:79

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

+ Here is the call 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.

◆ $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: