67 $this->ctrl->saveParameter($this,
'seed');
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);
77 case 'ilcalendarappointmentgui':
78 $this->ctrl->setReturn($this,
'');
79 $this->tabs_gui->setSubTabActive(
$_SESSION[
'cal_last_tab']);
84 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentGUI.php');
86 $this->ctrl->forwardCommand($app);
90 $time = microtime(
true);
91 $cmd = $this->ctrl->getCmd(
"show");
93 $tpl->setContent($this->tpl->get());
94 #echo "Zeit: ".(microtime(true) - $time); 110 $evening_aggr = $this->user_settings->getDayEnd()*60;
112 $this->tpl =
new ilTemplate(
'tpl.week_view.html',
true,
true,
'Services/Calendar');
114 include_once(
'./Services/YUI/classes/class.ilYuiUtil.php');
118 $this->tpl->setVariable(
'NAVIGATION', $navigation->getHTML());
122 include_once(
'Services/Calendar/classes/class.ilCalendarSchedule.php');
124 $this->scheduler->addSubitemCalendars(
true);
125 $this->scheduler->calculate();
129 $all_fullday =
array();
131 $daily_apps = $this->scheduler->getByDay($date, $this->
timezone);
132 if (!$this->view_with_appointments && count($daily_apps)) {
133 $this->view_with_appointments =
true;
144 $this->weekdays[] = $date;
146 $num_apps[$date->get(
IL_CAL_DATE)] = count($daily_apps);
148 $all_fullday[] = $daily_apps;
154 include_once(
'Services/Calendar/classes/class.ilCalendarSettings.php');
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));
164 if (!$this->no_add) {
170 $this->tpl->setCurrentBlock(
'day_header_row');
171 $this->tpl->setVariable(
'DAY_COLSPAN', max($this->colspans[
$counter], 1));
172 $this->tpl->parseCurrentBlock();
183 $this->tpl->setVariable(
"TXT_TIME", $this->lng->txt(
"time"));
195 $event_tpl =
new ilTemplate(
'tpl.day_event_view.html',
true,
true,
'Services/Calendar');
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"));
202 $event_tpl->parseCurrentBlock();
205 $event_tpl->setCurrentBlock(
'fullday_app');
207 $compl = ($a_app[
'event']->isMilestone() && $a_app[
'event']->getCompletion() > 0)
208 ?
" (" . $a_app[
'event']->getCompletion() .
"%)" 215 $event_tpl->setVariable(
'EVENT_CONTENT',
$title);
217 $color = $this->app_colors->getColorByAppointment($a_app[
'event']->getEntryId());
220 $event_tpl->setVariable(
'F_APP_BGCOLOR', $color);
221 $event_tpl->setVariable(
'F_APP_FONTCOLOR', $font_color);
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'));
228 $event_html = $event_html_by_plugin;
230 $event_tpl->parseCurrentBlock();
231 $event_html = $event_tpl->get();
234 $this->tpl->setCurrentBlock(
"content_fd");
235 $this->tpl->setVariable(
"CONTENT_EVENT_FD", $event_html);
236 $this->tpl->parseCurrentBlock();
238 $this->num_appointments++;
249 $event_tpl =
new ilTemplate(
'tpl.week_event_view.html',
true,
true,
'Services/Calendar');
253 if (!
$ilUser->prefs[
"screen_reader_optimization"]) {
254 $this->tpl->setCurrentBlock(
'not_empty');
256 $this->tpl->setCurrentBlock(
'scrd_not_empty');
259 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
260 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id', $a_app[
'event']->getEntryId());
262 $color = $this->app_colors->getColorByAppointment($a_app[
'event']->getEntryId());
263 $style =
'background-color: ' . $color .
';';
268 if (!$a_app[
'event']->isFullDay()) {
271 $td_style .= $a_app[
'event']->getPresentationStyle();
278 $event_tpl->setCurrentBlock(
'event_cell_content');
279 if (!
$ilUser->prefs[
"screen_reader_optimization"]) {
280 $event_tpl->setVariable(
"STYLE",
$style);
282 $event_tpl->setVariable(
'EVENT_CONTENT',
$title);
285 $event_html = $event_html_by_plugin;
287 $event_tpl->parseCurrentBlock();
288 $event_html = $event_tpl->get();
291 $this->tpl->setVariable(
'GRID_CONTENT', $event_html);
293 if (!
$ilUser->prefs[
"screen_reader_optimization"]) {
295 $this->tpl->parseCurrentBlock();
297 $this->tpl->setCurrentBlock(
'day_cell');
299 $this->tpl->setVariable(
'DAY_CELL_NUM', $this->num_appointments);
300 $this->tpl->setVariable(
'TD_ROWSPAN', $a_app[
'rowspan']);
302 $this->tpl->setVariable(
'TD_CLASS',
'calevent il_calevent');
304 $this->tpl->parseCurrentBlock();
307 $this->tpl->setVariable(
'DIV_STYLE',
$style);
308 $this->tpl->parseCurrentBlock();
311 $this->num_appointments++;
320 protected function parseHourInfo($daily_apps, $date, $num_day, $hours = null, $morning_aggr, $evening_aggr)
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));
333 $hours[
$i][$num_day][
'txt'].= sprintf(
'%02d:%02d', floor(
$i/60),
$i%60);
335 if ($evening_aggr < 23*60 &&
$i == $evening_aggr) {
336 $hours[
$i][$num_day][
'txt'].=
"-" . sprintf(
'%02d:00', 23);
341 if ($morning_aggr > 0 &&
$i == $morning_aggr) {
342 $hours[
$i][$num_day][
'txt'] =
date(
'h a', mktime(0, 0, 0, 1, 1, 2000)) .
"-";
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));
355 foreach ($daily_apps as $app) {
357 if ($app[
'fullday']) {
362 if ($app[
'start_info'][
'mday'] != $date_info[
'mday']) {
365 $start = $app[
'start_info'][
'hours']*60+$app[
'start_info'][
'minutes'];
371 if ($app[
'end_info'][
'mday'] != $date_info[
'mday']) {
373 } elseif ($app[
'start_info'][
'hours'] == $app[
'end_info'][
'hours']) {
376 $end = $app[
'end_info'][
'hours']*60+$app[
'end_info'][
'minutes'];
382 if ($ilUser->prefs[
"screen_reader_optimization"]) {
386 if ($start < $morning_aggr) {
387 $start = $morning_aggr;
389 if (
$end <= $morning_aggr) {
392 if ($start > $evening_aggr) {
393 $start = $evening_aggr;
395 if (
$end > $evening_aggr+$this->raster) {
398 if (
$end <= $start) {
409 if (!$ilUser->prefs[
"screen_reader_optimization"]) {
410 $app[
'rowspan'] = ceil(($end - $start)/$this->raster);
414 $hours[
$i][$num_day][
'apps_start'][] = $app;
417 $hours[
$i][$num_day][
'apps_num']++;
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']);
439 if ($ilUser->prefs[
"screen_reader_optimization"]) {
440 $this->colspans[$num_day] = 1;
451 if ($this->user_settings->getDayStart()) {
453 $morning_aggr = ($this->user_settings->getDayStart()-1)*60+(60-$this->raster);
458 return $morning_aggr;
467 $new_app_url = $this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'add');
469 if ($this->cal_settings->getEnableGroupMilestones()) {
470 $new_ms_url = $this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'addMilestone');
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();
481 $this->tpl->setCurrentBlock(
"new_app");
483 $this->tpl->setVariable(
'NEW_APP_GLYPH', $this->ui_renderer->render(
484 $this->ui_factory->glyph()->add($new_app_url)
487 $this->tpl->parseCurrentBlock();
490 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
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) {
504 $this->disable_empty =
false;
505 $this->no_add =
true;
508 $this->disable_empty =
false;
509 $this->no_add =
false;
521 $daydate = $dayname .
' ' . $date_info[
'mday'] .
'.';
523 if (!$this->disable_empty || $num_apps[$date->get(
IL_CAL_DATE)] > 0) {
524 $link = $this->ctrl->getLinkTargetByClass(
'ilcalendardaygui',
'');
525 $this->ctrl->clearParametersByClass(
'ilcalendardaygui');
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();
532 $this->tpl->setCurrentBlock(
"day_view_no_link");
533 $this->tpl->setVariable(
'HEADER_DATE', $daydate);
534 $this->tpl->parseCurrentBlock();
544 foreach ($all_fullday as $daily_apps) {
545 foreach ($daily_apps as $event) {
546 if ($event[
'fullday']) {
550 $this->tpl->setCurrentBlock(
'f_day_row');
551 $this->tpl->setVariable(
'COLSPAN', max($this->colspans[
$counter], 1));
552 $this->tpl->parseCurrentBlock();
555 $this->tpl->setCurrentBlock(
'fullday_apps');
556 $this->tpl->setVariable(
'TXT_F_DAY', $this->lng->txt(
"cal_all_day"));
557 $this->tpl->parseCurrentBlock();
570 $renderer = $DIC->ui()->renderer();
572 $new_link_counter = 0;
573 foreach ($hours as $num_hour => $hours_per_day) {
575 foreach ($hours_per_day as $num_day => $hour) {
577 #ADD the hours in the left side of the grid. 579 if (!($num_hour%60) || ($num_hour == $morning_aggr && $morning_aggr) ||
580 ($num_hour == $evening_aggr && $evening_aggr)) {
584 if (($num_hour == $morning_aggr && $morning_aggr) ||
585 ($num_hour == $evening_aggr && $evening_aggr)) {
586 $this->tpl->setVariable(
'TIME_ROWSPAN', 1);
590 $this->tpl->setVariable(
'TIME_ROWSPAN', 60/$this->raster);
593 $this->tpl->setCurrentBlock(
'time_txt');
595 $this->tpl->setVariable(
'TIME', $hour[
'txt']);
596 $this->tpl->parseCurrentBlock();
600 foreach ($hour[
'apps_start'] as $app) {
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();
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);
617 if (!$hour[
'apps_num'] && !$this->
user->prefs[
"screen_reader_optimization"] && !$this->no_add) {
618 $this->tpl->setCurrentBlock(
'new_app_link');
620 $this->ctrl->clearParameterByClass(
'ilcalendarappointmentgui',
'app_id');
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));
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)));
631 $this->tpl->setVariable(
'DAY_NEW_ID', ++$new_link_counter);
632 $this->tpl->parseCurrentBlock();
635 for (
$i = $colspan;
$i > $hour[
'apps_num'];
$i--) {
636 if ($this->
user->prefs[
"screen_reader_optimization"]) {
639 $this->tpl->setCurrentBlock(
'day_cell');
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';
649 $this->tpl->setVariable(
'TD_CLASS',
'calempty createhover' . $empty_border);
651 if (!$hour[
'apps_num']) {
652 $this->tpl->setVariable(
'DAY_ID', $new_link_counter);
654 $this->tpl->setVariable(
'TD_ROWSPAN', 1);
655 $this->tpl->parseCurrentBlock();
659 $this->tpl->touchBlock(
'time_row');
670 switch ($this->user_settings->getTimeFormat()) {
680 if ($this->
user->prefs[
"screen_reader_optimization"]) {
681 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)
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
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.
Create styles array
The data for the language used.
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