14 include_once(
'./Services/Calendar/classes/class.ilDate.php');
15 include_once(
'./Services/Calendar/classes/class.ilCalendarUtil.php');
16 include_once(
'./Services/Calendar/classes/class.ilCalendarHeaderNavigationGUI.php');
17 include_once(
'./Services/Calendar/classes/class.ilCalendarUserSettings.php');
18 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentColors.php');
19 include_once
'./Services/Calendar/classes/class.ilCalendarViewGUI.php';
83 $this->timezone = $this->
user->getTimeZone();
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);
106 case 'ilcalendarappointmentgui':
107 $this->ctrl->setReturn($this,
'');
108 $this->tabs_gui->setSubTabActive(
$_SESSION[
'cal_last_tab']);
113 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentGUI.php');
115 $this->ctrl->forwardCommand($app);
119 $cmd = $this->ctrl->getCmd(
"show");
121 $tpl->setContent($this->tpl->get());
133 protected function show()
141 $renderer = $DIC->ui()->renderer();
149 if ($this->user_settings->getDayStart()) {
151 $morning_aggr = ($this->user_settings->getDayStart() - 1) * 60 + (60 - $raster);
155 $evening_aggr = $this->user_settings->getDayEnd() * 60;
158 $this->tpl =
new ilTemplate(
'tpl.day_view.html',
true,
true,
'Services/Calendar');
160 include_once(
'./Services/YUI/classes/class.ilYuiUtil.php');
163 if (isset(
$_GET[
"bkid"])) {
164 $user_id =
$_GET[
"bkid"];
166 } elseif (
$ilUser->getId() == ANONYMOUS_USER_ID) {
173 include_once(
'Services/Calendar/classes/class.ilCalendarSchedule.php');
175 $this->scheduler->addSubitemCalendars(
true);
176 $this->scheduler->calculate();
177 $daily_apps = $this->scheduler->getByDay($this->seed, $this->timezone);
180 if (count($daily_apps)) {
181 $this->view_with_appointments =
true;
194 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed', $this->seed->get(
IL_CAL_DATE));
197 include_once(
'Services/Calendar/classes/class.ilCalendarSettings.php');
201 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed', $this->seed->get(
IL_CAL_DATE));
202 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'idate', $this->seed->get(
IL_CAL_DATE));
203 $new_app_url = $this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'add');
205 if ($settings->getEnableGroupMilestones()) {
206 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed', $this->seed->get(
IL_CAL_DATE));
207 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'idate', $this->seed->get(
IL_CAL_DATE));
208 $new_ms_url = $this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'addMilestone');
210 $this->tpl->setCurrentBlock(
"new_ms");
211 $this->tpl->setVariable(
'DD_ID', $this->seed->get(
IL_CAL_UNIX));
212 $this->tpl->setVariable(
'DD_TRIGGER', $renderer->render(
$ui_factory->glyph()->add()));
213 $this->tpl->setVariable(
'URL_DD_NEW_APP', $new_app_url);
214 $this->tpl->setVariable(
'TXT_DD_NEW_APP', $this->lng->txt(
'cal_new_app'));
215 $this->tpl->setVariable(
'URL_DD_NEW_MS', $new_ms_url);
216 $this->tpl->setVariable(
'TXT_DD_NEW_MS', $this->lng->txt(
'cal_new_ms'));
217 $this->tpl->parseCurrentBlock();
219 $this->tpl->setCurrentBlock(
"new_app1");
220 $this->tpl->setVariable(
'H_NEW_APP_GLYPH', $renderer->render(
$ui_factory->glyph()->add($new_app_url)));
221 $this->tpl->parseCurrentBlock();
224 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
227 $this->tpl->setVariable(
'NAVIGATION', $navigation->getHTML());
231 $this->tpl->setVariable(
'HCOLSPAN', $colspan - 1);
233 $this->tpl->setVariable(
'TXT_TIME',
$lng->txt(
"time"));
236 foreach ($daily_apps as $event) {
237 if ($event[
'fullday']) {
241 $this->tpl->setCurrentBlock(
'fullday_apps');
242 $this->tpl->setVariable(
'TXT_F_DAY',
$lng->txt(
"cal_all_day"));
243 $this->tpl->setVariable(
'COLSPAN', $colspan - 1);
244 $this->tpl->parseCurrentBlock();
247 foreach ($hours as $numeric => $hour) {
248 if (!($numeric % 60) || ($numeric == $morning_aggr && $morning_aggr) ||
249 ($numeric == $evening_aggr && $evening_aggr)) {
251 $this->tpl->setCurrentBlock(
"new_app2");
252 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
253 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed', $this->seed->get(
IL_CAL_DATE));
254 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'idate', $this->seed->get(
IL_CAL_DATE));
255 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'hour', floor($numeric / 60));
256 $this->tpl->setVariable(
'NEW_APP_GLYPH', $renderer->render(
258 $this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'add')
261 $this->tpl->parseCurrentBlock();
265 if (($numeric == $morning_aggr && $morning_aggr) ||
266 ($numeric == $evening_aggr && $evening_aggr)) {
267 $this->tpl->setVariable(
'TIME_ROWSPAN', 1);
271 $this->tpl->setVariable(
'TIME_ROWSPAN', 60 / $raster);
274 $this->tpl->setCurrentBlock(
'time_txt');
276 $this->tpl->setVariable(
'TIME', $hour[
'txt']);
277 $this->tpl->parseCurrentBlock();
280 foreach ($hour[
'apps_start'] as $app) {
284 if (
$ilUser->prefs[
"screen_reader_optimization"]) {
289 for (
$i = ($colspan - 1);
$i > $hour[
'apps_num'];
$i--) {
290 $this->tpl->setCurrentBlock(
'empty_cell');
291 $this->tpl->setVariable(
'EMPTY_WIDTH', (100 / (
int) ($colspan - 1)) .
'%');
294 if ($numeric % 60 == 60 - $raster ||
295 ($numeric == $morning_aggr && $morning_aggr) ||
296 ($numeric == $evening_aggr && $evening_aggr)) {
297 $this->tpl->setVariable(
'EMPTY_STYLE',
' calempty_border');
300 $this->tpl->parseCurrentBlock();
303 $this->tpl->touchBlock(
'time_row');
319 $event_tpl =
new ilTemplate(
'tpl.day_event_view.html',
true,
true,
'Services/Calendar');
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"));
326 $event_tpl->parseCurrentBlock();
329 $event_tpl->setCurrentBlock(
'fullday_app');
331 $compl = ($a_app[
'event']->isMilestone() && $a_app[
'event']->getCompletion() > 0)
332 ?
" (" . $a_app[
'event']->getCompletion() .
"%)" 339 $content = $shy . $compl;
341 $event_tpl->setVariable(
'EVENT_CONTENT', $content);
343 $color = $this->app_colors->getColorByAppointment($a_app[
'event']->getEntryId());
344 $event_tpl->setVariable(
'F_APP_BGCOLOR', $color);
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'));
352 if ($event_html_by_plugin = $this->
getContentByPlugins($a_app[
'event'], $a_app[
'dstart'], $content, $event_tpl)) {
353 $body_html = $event_html_by_plugin;
355 $event_tpl->parseCurrentBlock();
356 $body_html = $event_tpl->get();
359 $this->tpl->setCurrentBlock(
"content_fd");
360 $this->tpl->setVariable(
"CONTENT_EVENT", $body_html);
361 $this->tpl->parseCurrentBlock();
363 $this->num_appointments++;
376 $event_tpl =
new ilTemplate(
'tpl.day_event_view.html',
true,
true,
'Services/Calendar');
378 if (!
$ilUser->prefs[
"screen_reader_optimization"]) {
379 $event_tpl->setCurrentBlock(
'app');
381 $event_tpl->setCurrentBlock(
'scrd_app');
384 $this->tpl->setVariable(
'APP_ROWSPAN', $a_app[
'rowspan']);
387 switch ($this->user_settings->getTimeFormat()) {
398 if (
$ilUser->prefs[
"screen_reader_optimization"]) {
399 switch ($this->user_settings->getTimeFormat()) {
415 $event_tpl->setVariable(
'EVENT_CONTENT', $content);
417 $color = $this->app_colors->getColorByAppointment($a_app[
'event']->getEntryId());
418 $event_tpl->setVariable(
'APP_BGCOLOR', $color);
422 $event_tpl->setVariable(
'APP_ADD_STYLES', $a_app[
'event']->getPresentationStyle());
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'));
430 if ($event_html_by_plugin = $this->
getContentByPlugins($a_app[
'event'], $a_app[
'dstart'], $content, $event_tpl)) {
431 $event_html = $event_html_by_plugin;
433 $event_tpl->parseCurrentBlock();
434 $event_html = $event_tpl->get();
437 $this->tpl->setCurrentBlock(
"event_nfd");
438 $this->tpl->setVariable(
"CONTENT_EVENT_NFD", $event_html);
439 $this->tpl->parseCurrentBlock();
441 $this->num_appointments++;
455 for (
$i = $morning_aggr;
$i <= $evening_aggr;
$i += $raster) {
456 $hours[
$i][
'apps_start'] = array();
457 $hours[
$i][
'apps_num'] = 0;
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));
465 $hours[
$i][
'txt'] .= sprintf(
'%02d:%02d', floor(
$i / 60),
$i % 60);
467 if ($evening_aggr < 23 * 60 &&
$i == $evening_aggr) {
468 $hours[
$i][
'txt'] .=
' - ' . sprintf(
'%02d:00', 0);
474 $this->logger->notice(
'Morning: ' . $morning_aggr .
' and $i:' .
$i);
476 if ($morning_aggr > 0 && $i == $morning_aggr) {
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));
481 $hours[
$i][
'txt'] = date(
'h a', mktime(floor($i / 60), $i % 60, 0, 1, 1, 2000));
483 if ($evening_aggr < 23 * 60 && $i == $evening_aggr) {
484 $hours[
$i][
'txt'] .=
' - ' . date(
'h a', mktime(0, 0, 0, 1, 1, 2000));
491 foreach ($daily_apps as $app) {
493 if ($app[
'fullday']) {
498 if ($app[
'start_info'][
'mday'] != $this->seed_info[
'mday']) {
501 $start = $app[
'start_info'][
'hours'] * 60 + $app[
'start_info'][
'minutes'];
508 if ($app[
'end_info'][
'mday'] != $this->seed_info[
'mday']) {
510 } elseif ($app[
'start_info'][
'hours'] == $app[
'end_info'][
'hours']) {
513 $end = $app[
'end_info'][
'hours'] * 60 + $app[
'end_info'][
'minutes'];
518 if (
$ilUser->prefs[
"screen_reader_optimization"]) {
522 if (
$start < $morning_aggr) {
525 if (
$end <= $morning_aggr) {
526 $end = $morning_aggr + $raster;
528 if (
$start > $evening_aggr) {
531 if (
$end > $evening_aggr + $raster) {
532 $end = $evening_aggr + $raster;
540 $end = ceil(
$end / $raster) * $raster;
545 if (!
$ilUser->prefs[
"screen_reader_optimization"]) {
546 $app[
'rowspan'] = ceil(($end -
$start) / $raster);
550 $hours[
$i][
'apps_start'][] = $app;
553 $hours[
$i][
'apps_num']++;
573 foreach ($hours as $hour) {
574 $colspan = max($colspan, $hour[
'apps_num'] + 1);
578 if (
$ilUser->prefs[
"screen_reader_optimization"]) {
582 return max($colspan, 2);
static _getInstance()
get singleton instance
getAppointmentShyButton($a_calendar_entry, $a_dstart, $a_title_forced="")
static _numericDayToString($a_day, $a_long=true)
get
executeCommand()
Execute command.
static _getInstanceByUserId($a_user_id)
get singleton instance
static _getInstance(ilDate $seed, $a_app)
get singleton instance
getCurrentApp()
Get app for id.
showAppointment($a_app)
show appointment
__construct(ilDate $seed_date)
Constructor.
static _numericMonthToString($a_month, $a_long=true)
numeric month to string
parseInfoIntoRaster($daily_apps, $morning_aggr, $evening_aggr, $raster)
calculate overlapping hours
calculateColspan($hours)
calculate colspan
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
const CAL_PRESENTATION_DAY
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.
showFulldayAppointment($a_app)
show fullday appointment
getContentByPlugins($a_cal_entry, $a_start_date, $a_content, $a_tpl)
Represents a list of calendar appointments (including recurring events) for a specific user in a give...