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

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

46 {
47 parent::__construct($seed_date, ilCalendarViewGUI::CAL_PRESENTATION_WEEK);
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

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

466 {
467 $new_app_url = $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'add');
468
469 if ($this->cal_settings->getEnableGroupMilestones()) {
470 $new_ms_url = $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'addMilestone');
471
472 $this->tpl->setCurrentBlock("new_ms");
473 $this->tpl->setVariable('DD_ID', $date->get(IL_CAL_UNIX));
474 $this->tpl->setVariable('DD_TRIGGER', $this->ui_renderer->render($this->ui_factory->glyph()->add()));
475 $this->tpl->setVariable('URL_DD_NEW_APP', $new_app_url);
476 $this->tpl->setVariable('TXT_DD_NEW_APP', $this->lng->txt('cal_new_app'));
477 $this->tpl->setVariable('URL_DD_NEW_MS', $new_ms_url);
478 $this->tpl->setVariable('TXT_DD_NEW_MS', $this->lng->txt('cal_new_ms'));
479 $this->tpl->parseCurrentBlock();
480 } else {
481 $this->tpl->setCurrentBlock("new_app");
482 //$this->tpl->setVariable('NEW_APP_LINK',$new_app_url);
483 $this->tpl->setVariable('NEW_APP_GLYPH', $this->ui_renderer->render(
484 $this->ui_factory->glyph()->add($new_app_url)
485 ));
486 // $this->tpl->setVariable('NEW_APP_ALT',$this->lng->txt('cal_new_app'));
487 $this->tpl->parseCurrentBlock();
488 }
489
490 $this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
491 }
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 541 of file class.ilCalendarWeekGUI.php.

542 {
543 $counter = 0;
544 foreach ($all_fullday as $daily_apps) {
545 foreach ($daily_apps as $event) {
546 if ($event['fullday']) {
547 $this->showFulldayAppointment($event);
548 }
549 }
550 $this->tpl->setCurrentBlock('f_day_row');
551 $this->tpl->setVariable('COLSPAN', max($this->colspans[$counter], 1));
552 $this->tpl->parseCurrentBlock();
553 $counter++;
554 }
555 $this->tpl->setCurrentBlock('fullday_apps');
556 $this->tpl->setVariable('TXT_F_DAY', $this->lng->txt("cal_all_day"));
557 $this->tpl->parseCurrentBlock();
558 }
showFulldayAppointment($a_app)
show fullday appointment
$counter

References $counter, and 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 517 of file class.ilCalendarWeekGUI.php.

518 {
519 $date_info = $date->get(IL_CAL_FKT_GETDATE, '', 'UTC');
520 $dayname = ilCalendarUtil::_numericDayToString($date->get(IL_CAL_FKT_DATE, 'w'), false);
521 $daydate = $dayname . ' ' . $date_info['mday'] . '.';
522
523 if (!$this->disable_empty || $num_apps[$date->get(IL_CAL_DATE)] > 0) {
524 $link = $this->ctrl->getLinkTargetByClass('ilcalendardaygui', '');
525 $this->ctrl->clearParametersByClass('ilcalendardaygui');
526
527 $this->tpl->setCurrentBlock("day_view_link");
528 $this->tpl->setVariable('HEADER_DATE', $daydate);
529 $this->tpl->setVariable('DAY_VIEW_LINK', $link);
530 $this->tpl->parseCurrentBlock();
531 } else {
532 $this->tpl->setCurrentBlock("day_view_no_link");
533 $this->tpl->setVariable('HEADER_DATE', $daydate);
534 $this->tpl->parseCurrentBlock();
535 }
536 }
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 565 of file class.ilCalendarWeekGUI.php.

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

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

431 {
432 global $ilUser;
433
434 foreach ($hours as $hour_num => $hours_per_day) {
435 foreach ($hours_per_day as $num_day => $hour) {
436 $this->colspans[$num_day] = max($this->colspans[$num_day], $hour['apps_num']);
437
438 // screen reader: always one col
439 if ($ilUser->prefs["screen_reader_optimization"]) {
440 $this->colspans[$num_day] = 1;
441 }
442 }
443 }
444 }
$ilUser
Definition: imgupload.php:18

References $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 $ilCtrl,$tpl;
66
67 $this->ctrl->saveParameter($this, 'seed');
68
69 $next_class = $ilCtrl->getNextClass();
70 switch ($next_class) {
71 case "ilcalendarappointmentpresentationgui":
72 $this->ctrl->setReturn($this, "");
73 include_once("./Services/Calendar/classes/class.ilCalendarAppointmentPresentationGUI.php");
75 $this->ctrl->forwardCommand($gui);
76 break;
77 case 'ilcalendarappointmentgui':
78 $this->ctrl->setReturn($this, '');
79 $this->tabs_gui->setSubTabActive($_SESSION['cal_last_tab']);
80
81 // initial date for new calendar appointments
82 $idate = new ilDate($_REQUEST['idate'], IL_CAL_DATE);
83
84 include_once('./Services/Calendar/classes/class.ilCalendarAppointmentGUI.php');
85 $app = new ilCalendarAppointmentGUI($this->seed, $idate, (int) $_GET['app_id']);
86 $this->ctrl->forwardCommand($app);
87 break;
88
89 default:
90 $time = microtime(true);
91 $cmd = $this->ctrl->getCmd("show");
92 $this->$cmd();
93 $tpl->setContent($this->tpl->get());
94 #echo "Zeit: ".(microtime(true) - $time);
95 break;
96 }
97
98 return true;
99 }
$_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.
global $ilCtrl
Definition: ilias.php:18
$time
Definition: cron.php:21

References $_GET, $_SESSION, $ilCtrl, $time, $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 667 of file class.ilCalendarWeekGUI.php.

668 {
669 $time = "";
670 switch ($this->user_settings->getTimeFormat()) {
672 $time = $a_event->getStart()->get(IL_CAL_FKT_DATE, 'H:i', $this->timezone);
673 break;
674
676 $time = $a_event->getStart()->get(IL_CAL_FKT_DATE, 'h:ia', $this->timezone);
677 break;
678 }
679 // add end time for screen readers
680 if ($this->user->prefs["screen_reader_optimization"]) {
681 switch ($this->user_settings->getTimeFormat()) {
683 $time.= "-" . $a_event->getEnd()->get(IL_CAL_FKT_DATE, 'H:i', $this->timezone);
684 break;
685
687 $time.= "-" . $a_event->getEnd()->get(IL_CAL_FKT_DATE, 'h:ia', $this->timezone);
688 break;
689 }
690 }
691
692 return $time;
693 }
getEnd()
get end @access public

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

450 {
451 if ($this->user_settings->getDayStart()) {
452 // push starting point to last "slot" of hour BEFORE morning aggregation
453 $morning_aggr = ($this->user_settings->getDayStart()-1)*60+(60-$this->raster);
454 } else {
455 $morning_aggr = 0;
456 }
457
458 return $morning_aggr;
459 }

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

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

References $end, $i, $ilUser, $raster, date, IL_CAL_FKT_GETDATE, sprintf, 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 496 of file class.ilCalendarWeekGUI.php.

497 {
498 if (isset($_GET["bkid"])) {
499 $this->user_id = $_GET["bkid"];
500 $this->disable_empty = true;
501 $this->no_add = true;
502 } elseif ($this->user->getId() == ANONYMOUS_USER_ID) {
503 //$this->user_id = $ilUser->getId();
504 $this->disable_empty = false;
505 $this->no_add = true;
506 } else {
507 //$this->user_id = $ilUser->getId();
508 $this->disable_empty = false;
509 $this->no_add = false;
510 }
511 }

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

108 {
109 $morning_aggr = $this->getMorningAggr();
110 $evening_aggr = $this->user_settings->getDayEnd()*60;
111
112 $this->tpl = new ilTemplate('tpl.week_view.html', true, true, 'Services/Calendar');
113
114 include_once('./Services/YUI/classes/class.ilYuiUtil.php');
116
117 $navigation = new ilCalendarHeaderNavigationGUI($this, $this->seed, ilDateTime::WEEK);
118 $this->tpl->setVariable('NAVIGATION', $navigation->getHTML());
119
120 $this->setUpCalendar();
121
122 include_once('Services/Calendar/classes/class.ilCalendarSchedule.php');
123 $this->scheduler = new ilCalendarSchedule($this->seed, ilCalendarSchedule::TYPE_WEEK, $this->user_id, $this->disable_empty);
124 $this->scheduler->addSubitemCalendars(true);
125 $this->scheduler->calculate();
126
127 $counter = 0;
128 $hours = null;
129 $all_fullday = array();
130 foreach (ilCalendarUtil::_buildWeekDayList($this->seed, $this->user_settings->getWeekStart())->get() as $date) {
131 $daily_apps = $this->scheduler->getByDay($date, $this->timezone);
132 if (!$this->view_with_appointments && count($daily_apps)) {
133 $this->view_with_appointments = true;
134 }
135 $hours = $this->parseHourInfo(
136 $daily_apps,
137 $date,
138 $counter,
139 $hours,
140 $morning_aggr,
141 $evening_aggr,
142 $this->raster
143 );
144 $this->weekdays[] = $date;
145
146 $num_apps[$date->get(IL_CAL_DATE)] = count($daily_apps);
147
148 $all_fullday[] = $daily_apps;
149 $counter++;
150 }
151
152 $this->calculateColspans($hours);
153
154 include_once('Services/Calendar/classes/class.ilCalendarSettings.php');
155 $this->cal_settings = ilCalendarSettings::_getInstance();
156
157 // Table header
158 $counter = 0;
159 foreach (ilCalendarUtil::_buildWeekDayList($this->seed, $this->user_settings->getWeekStart())->get() as $date) {
160 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $date->get(IL_CAL_DATE));
161 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'idate', $date->get(IL_CAL_DATE));
162 $this->ctrl->setParameterByClass('ilcalendardaygui', 'seed', $date->get(IL_CAL_DATE));
163
164 if (!$this->no_add) {
165 $this->addAppointmentLink($date);
166 }
167
168 $this->addHeaderDate($date, $num_apps);
169
170 $this->tpl->setCurrentBlock('day_header_row');
171 $this->tpl->setVariable('DAY_COLSPAN', max($this->colspans[$counter], 1));
172 $this->tpl->parseCurrentBlock();
173
174 $counter++;
175 }
176
177 // show fullday events
178 $this->addFullDayEvents($all_fullday);
179
180 //show timed events
181 $this->addTimedEvents($hours, $morning_aggr, $evening_aggr);
182
183 $this->tpl->setVariable("TXT_TIME", $this->lng->txt("time"));
184 }
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()
Init YUI Drag and Drop.

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

248 {
249 $event_tpl = new ilTemplate('tpl.week_event_view.html', true, true, 'Services/Calendar');
250
252
253 if (!$ilUser->prefs["screen_reader_optimization"]) {
254 $this->tpl->setCurrentBlock('not_empty');
255 } else {
256 $this->tpl->setCurrentBlock('scrd_not_empty');
257 }
258
259 $this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
260 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId());
261
262 $color = $this->app_colors->getColorByAppointment($a_app['event']->getEntryId());
263 $style = 'background-color: ' . $color . ';';
264 $style .= ('color:' . ilCalendarUtil::calculateFontColor($color));
265 $td_style = $style;
266
267
268 if (!$a_app['event']->isFullDay()) {
269 $time = $this->getAppointmentTimeString($a_app['event']);
270
271 $td_style .= $a_app['event']->getPresentationStyle();
272 }
273
274 $shy = $this->getAppointmentShyButton($a_app['event'], $a_app['dstart'], "");
275
276 $title = ($time != "")? $time . " " . $shy : $shy;
277
278 $event_tpl->setCurrentBlock('event_cell_content');
279 if (!$ilUser->prefs["screen_reader_optimization"]) {
280 $event_tpl->setVariable("STYLE", $style);
281 }
282 $event_tpl->setVariable('EVENT_CONTENT', $title);
283
284 if ($event_html_by_plugin = $this->getContentByPlugins($a_app['event'], $a_app['dstart'], $title, $event_tpl)) {
285 $event_html = $event_html_by_plugin;
286 } else {
287 $event_tpl->parseCurrentBlock();
288 $event_html = $event_tpl->get();
289 }
290
291 $this->tpl->setVariable('GRID_CONTENT', $event_html);
292
293 if (!$ilUser->prefs["screen_reader_optimization"]) {
294 // provide table cell attributes
295 $this->tpl->parseCurrentBlock();
296
297 $this->tpl->setCurrentBlock('day_cell');
298
299 $this->tpl->setVariable('DAY_CELL_NUM', $this->num_appointments);
300 $this->tpl->setVariable('TD_ROWSPAN', $a_app['rowspan']);
301 //$event_tpl->setVariable('TD_STYLE',$td_style);
302 $this->tpl->setVariable('TD_CLASS', 'calevent il_calevent');
303
304 $this->tpl->parseCurrentBlock();
305 } else {
306 // screen reader: work on div attributes
307 $this->tpl->setVariable('DIV_STYLE', $style);
308 $this->tpl->parseCurrentBlock();
309 }
310
311 $this->num_appointments++;
312 }
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)
$style
Definition: example_012.php:70

References $ilUser, $style, $time, $title, $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 193 of file class.ilCalendarWeekGUI.php.

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

References $title, 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: