54 $this->timezone = $this->
user->getTimeZone();
70 $this->ctrl->saveParameter($this,
'seed');
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);
80 case 'ilcalendarappointmentgui':
81 $this->ctrl->setReturn($this,
'');
82 $this->tabs_gui->setSubTabActive(
$_SESSION[
'cal_last_tab']);
87 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentGUI.php');
89 $this->ctrl->forwardCommand($app);
93 $time = microtime(
true);
94 $cmd = $this->ctrl->getCmd(
"show");
96 $tpl->setContent($this->tpl->get());
97 #echo "Zeit: ".(microtime(true) - $time); 113 $evening_aggr = $this->user_settings->getDayEnd() * 60;
115 $this->tpl =
new ilTemplate(
'tpl.week_view.html',
true,
true,
'Services/Calendar');
117 include_once(
'./Services/YUI/classes/class.ilYuiUtil.php');
121 $this->tpl->setVariable(
'NAVIGATION', $navigation->getHTML());
125 include_once(
'Services/Calendar/classes/class.ilCalendarSchedule.php');
127 $this->scheduler->addSubitemCalendars(
true);
128 $this->scheduler->calculate();
132 $all_fullday = array();
134 $daily_apps = $this->scheduler->getByDay($date, $this->timezone);
135 if (!$this->view_with_appointments && count($daily_apps)) {
136 $this->view_with_appointments =
true;
147 $this->weekdays[] = $date;
149 $num_apps[$date->get(
IL_CAL_DATE)] = count($daily_apps);
151 $all_fullday[] = $daily_apps;
157 include_once(
'Services/Calendar/classes/class.ilCalendarSettings.php');
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));
167 if (!$this->no_add) {
173 $this->tpl->setCurrentBlock(
'day_header_row');
174 $this->tpl->setVariable(
'DAY_COLSPAN', max($this->colspans[$counter], 1));
175 $this->tpl->parseCurrentBlock();
186 $this->tpl->setVariable(
"TXT_TIME", $this->lng->txt(
"time"));
198 $event_tpl =
new ilTemplate(
'tpl.day_event_view.html',
true,
true,
'Services/Calendar');
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"));
205 $event_tpl->parseCurrentBlock();
208 $event_tpl->setCurrentBlock(
'fullday_app');
210 $compl = ($a_app[
'event']->isMilestone() && $a_app[
'event']->getCompletion() > 0)
211 ?
" (" . $a_app[
'event']->getCompletion() .
"%)" 218 $event_tpl->setVariable(
'EVENT_CONTENT',
$title);
220 $color = $this->app_colors->getColorByAppointment($a_app[
'event']->getEntryId());
223 $event_tpl->setVariable(
'F_APP_BGCOLOR', $color);
224 $event_tpl->setVariable(
'F_APP_FONTCOLOR', $font_color);
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'));
231 $event_html = $event_html_by_plugin;
233 $event_tpl->parseCurrentBlock();
234 $event_html = $event_tpl->get();
237 $this->tpl->setCurrentBlock(
"content_fd");
238 $this->tpl->setVariable(
"CONTENT_EVENT_FD", $event_html);
239 $this->tpl->parseCurrentBlock();
241 $this->num_appointments++;
252 $event_tpl =
new ilTemplate(
'tpl.week_event_view.html',
true,
true,
'Services/Calendar');
256 if (!
$ilUser->prefs[
"screen_reader_optimization"]) {
257 $this->tpl->setCurrentBlock(
'not_empty');
259 $this->tpl->setCurrentBlock(
'scrd_not_empty');
262 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
263 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id', $a_app[
'event']->getEntryId());
265 $color = $this->app_colors->getColorByAppointment($a_app[
'event']->getEntryId());
266 $style =
'background-color: ' . $color .
';';
271 if (!$a_app[
'event']->isFullDay()) {
274 $td_style .= $a_app[
'event']->getPresentationStyle();
281 $event_tpl->setCurrentBlock(
'event_cell_content');
282 if (!
$ilUser->prefs[
"screen_reader_optimization"]) {
283 $event_tpl->setVariable(
"STYLE",
$style);
285 $event_tpl->setVariable(
'EVENT_CONTENT',
$title);
288 $event_html = $event_html_by_plugin;
290 $event_tpl->parseCurrentBlock();
291 $event_html = $event_tpl->get();
294 $this->tpl->setVariable(
'GRID_CONTENT', $event_html);
296 if (!
$ilUser->prefs[
"screen_reader_optimization"]) {
298 $this->tpl->parseCurrentBlock();
300 $this->tpl->setCurrentBlock(
'day_cell');
302 $this->tpl->setVariable(
'DAY_CELL_NUM', $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');
307 $this->tpl->parseCurrentBlock();
310 $this->tpl->setVariable(
'DIV_STYLE',
$style);
311 $this->tpl->parseCurrentBlock();
314 $this->num_appointments++;
323 protected function parseHourInfo($daily_apps, $date, $num_day, $hours = null, $morning_aggr, $evening_aggr)
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));
338 $hours[
$i][$num_day][
'txt'] .= sprintf(
'%02d:%02d', floor(
$i / 60),
$i % 60);
340 if ($evening_aggr < 23 * 60 &&
$i == $evening_aggr) {
341 $hours[
$i][$num_day][
'txt'] .=
' - ' . sprintf(
'%02d:00', 0);
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));
351 $hours[
$i][$num_day][
'txt'] .= date(
'h a', mktime(floor(
$i / 60),
$i % 60, 0, 1, 1, 2000));
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));
365 foreach ($daily_apps as $app) {
367 if ($app[
'fullday']) {
372 if ($app[
'start_info'][
'mday'] != $date_info[
'mday']) {
375 $start = $app[
'start_info'][
'hours'] * 60 + $app[
'start_info'][
'minutes'];
381 if ($app[
'end_info'][
'mday'] != $date_info[
'mday']) {
383 } elseif ($app[
'start_info'][
'hours'] == $app[
'end_info'][
'hours']) {
386 $end = $app[
'end_info'][
'hours'] * 60 + $app[
'end_info'][
'minutes'];
392 if (
$ilUser->prefs[
"screen_reader_optimization"]) {
396 if (
$start < $morning_aggr) {
399 if (
$end <= $morning_aggr) {
402 if (
$start > $evening_aggr) {
405 if (
$end > $evening_aggr + $this->raster) {
419 if (!
$ilUser->prefs[
"screen_reader_optimization"]) {
420 $app[
'rowspan'] = ceil(($end -
$start) / $this->raster);
424 $hours[
$i][$num_day][
'apps_start'][] = $app;
427 $hours[
$i][$num_day][
'apps_num']++;
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']);
451 if (
$ilUser->prefs[
"screen_reader_optimization"]) {
452 $this->colspans[$num_day] = 1;
463 if ($this->user_settings->getDayStart()) {
465 $morning_aggr = ($this->user_settings->getDayStart() - 1) * 60 + (60 - $this->raster);
470 return $morning_aggr;
479 $new_app_url = $this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'add');
481 if ($this->cal_settings->getEnableGroupMilestones()) {
482 $new_ms_url = $this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'addMilestone');
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->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();
493 $this->tpl->setCurrentBlock(
"new_app");
495 $this->tpl->setVariable(
'NEW_APP_GLYPH', $this->ui_renderer->render(
496 $this->ui_factory->glyph()->add($new_app_url)
499 $this->tpl->parseCurrentBlock();
502 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
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) {
516 $this->disable_empty =
false;
517 $this->no_add =
true;
520 $this->disable_empty =
false;
521 $this->no_add =
false;
533 $daydate = $dayname .
' ' . $date_info[
'mday'] .
'.';
535 if (!$this->disable_empty || $num_apps[$date->get(
IL_CAL_DATE)] > 0) {
536 $link = $this->ctrl->getLinkTargetByClass(
'ilcalendardaygui',
'');
537 $this->ctrl->clearParametersByClass(
'ilcalendardaygui');
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();
544 $this->tpl->setCurrentBlock(
"day_view_no_link");
545 $this->tpl->setVariable(
'HEADER_DATE', $daydate);
546 $this->tpl->parseCurrentBlock();
556 foreach ($all_fullday as $daily_apps) {
557 foreach ($daily_apps as $event) {
558 if ($event[
'fullday']) {
562 $this->tpl->setCurrentBlock(
'f_day_row');
563 $this->tpl->setVariable(
'COLSPAN', max($this->colspans[$counter], 1));
564 $this->tpl->parseCurrentBlock();
567 $this->tpl->setCurrentBlock(
'fullday_apps');
568 $this->tpl->setVariable(
'TXT_F_DAY', $this->lng->txt(
"cal_all_day"));
569 $this->tpl->parseCurrentBlock();
582 $renderer = $DIC->ui()->renderer();
584 $new_link_counter = 0;
585 foreach ($hours as $num_hour => $hours_per_day) {
587 foreach ($hours_per_day as $num_day => $hour) {
589 #ADD the hours in the left side of the grid. 591 if (!($num_hour % 60) || ($num_hour == $morning_aggr && $morning_aggr) ||
592 ($num_hour == $evening_aggr && $evening_aggr)) {
596 if (($num_hour == $morning_aggr && $morning_aggr) ||
597 ($num_hour == $evening_aggr && $evening_aggr)) {
598 $this->tpl->setVariable(
'TIME_ROWSPAN', 1);
602 $this->tpl->setVariable(
'TIME_ROWSPAN', 60 / $this->raster);
605 $this->tpl->setCurrentBlock(
'time_txt');
607 $this->tpl->setVariable(
'TIME', $hour[
'txt']);
608 $this->tpl->parseCurrentBlock();
612 foreach ($hour[
'apps_start'] as $app) {
617 if ($this->
user->prefs[
"screen_reader_optimization"]) {
618 $this->tpl->setCurrentBlock(
'scrd_day_cell');
619 $this->tpl->setVariable(
'TD_CLASS',
'calstd');
620 $this->tpl->parseCurrentBlock();
623 #echo "NUMDAY: ".$num_day; 624 #echo "COLAPANS: ".max($colspans[$num_day],1).'<br />'; 625 $num_apps = $hour[
'apps_num'];
626 $colspan = max($this->colspans[$num_day], 1);
629 if (!$hour[
'apps_num'] && !$this->
user->prefs[
"screen_reader_optimization"] && !$this->no_add) {
630 $this->tpl->setCurrentBlock(
'new_app_link');
632 $this->ctrl->clearParameterByClass(
'ilcalendarappointmentgui',
'app_id');
634 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'idate', $this->weekdays[$num_day]->
get(
IL_CAL_DATE));
635 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed', $this->seed->get(
IL_CAL_DATE));
636 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'hour', floor($num_hour / 60));
639 $new_app_url = $this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'add');
640 $this->tpl->setVariable(
"DAY_NEW_APP_LINK", $renderer->render(
$ui_factory->glyph()->add($new_app_url)));
643 $this->tpl->setVariable(
'DAY_NEW_ID', ++$new_link_counter);
644 $this->tpl->parseCurrentBlock();
647 for (
$i = $colspan;
$i > $hour[
'apps_num'];
$i--) {
648 if ($this->
user->prefs[
"screen_reader_optimization"]) {
651 $this->tpl->setCurrentBlock(
'day_cell');
655 if ($num_hour % 60 == 60 - $this->raster ||
656 ($num_hour == $morning_aggr && $morning_aggr) ||
657 ($num_hour == $evening_aggr && $evening_aggr)) {
658 $empty_border =
' calempty_border';
661 $this->tpl->setVariable(
'TD_CLASS',
'calempty createhover' . $empty_border);
663 if (!$hour[
'apps_num']) {
664 $this->tpl->setVariable(
'DAY_ID', $new_link_counter);
666 $this->tpl->setVariable(
'TD_ROWSPAN', 1);
667 $this->tpl->parseCurrentBlock();
671 $this->tpl->touchBlock(
'time_row');
682 switch ($this->user_settings->getTimeFormat()) {
692 if ($this->
user->prefs[
"screen_reader_optimization"]) {
693 switch ($this->user_settings->getTimeFormat()) {
addAppointmentLink($date)
Add the links to create an appointment or milestone.
showAppointment($a_app)
show appointment
Model for a calendar entry.
static _getInstance()
get singleton instance
getAppointmentShyButton($a_calendar_entry, $a_dstart, $a_title_forced="")
showFulldayAppointment($a_app)
show fullday appointment
static _numericDayToString($a_day, $a_long=true)
get
static _getInstanceByUserId($a_user_id)
get singleton instance
addTimedEvents($hours, $morning_aggr, $evening_aggr)
static _getInstance(ilDate $seed, $a_app)
get singleton instance
getCurrentApp()
Get app for id.
static _buildWeekDayList($a_day, $a_weekstart)
build week day list
addFullDayEvents($all_fullday)
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
getAppointmentTimeString(ilCalendarEntry $a_event)
setUpCalendar()
Set values for: user_id, disable_empty, no_add.
executeCommand()
Execute command.
calculateColspans($hours)
calculate colspan
static calculateFontColor($a_html_color_code)
Calculate best font color from html hex color code.
Administrate calendar appointments.
static initDragDrop()
Init YUI Drag and Drop.
const CAL_PRESENTATION_WEEK
__construct(ilDate $seed_date)
Constructor.
getContentByPlugins($a_cal_entry, $a_start_date, $a_content, $a_tpl)
addHeaderDate($date, $num_apps)
Represents a list of calendar appointments (including recurring events) for a specific user in a give...
parseHourInfo($daily_apps, $date, $num_day, $hours=null, $morning_aggr, $evening_aggr)
calculate overlapping hours