33 include_once(
'./Services/Calendar/classes/class.ilDate.php');
34 include_once(
'./Services/Calendar/classes/class.ilCalendarUtil.php');
35 include_once(
'./Services/Calendar/classes/class.ilCalendarHeaderNavigationGUI.php');
36 include_once(
'./Services/Calendar/classes/class.ilCalendarUserSettings.php');
37 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentColors.php');
66 $this->seed = $seed_date;
72 $this->tabs_gui = $ilTabs;
77 $this->timezone = $ilUser->getTimeZone();
90 $next_class = $ilCtrl->getNextClass();
93 case 'ilcalendarappointmentgui':
94 $this->ctrl->setReturn($this,
'');
95 $this->tabs_gui->setSubTabActive(
$_SESSION[
'cal_last_tab']);
100 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentGUI.php');
102 $this->ctrl->forwardCommand($app);
106 $cmd = $this->ctrl->getCmd(
"show");
108 $tpl->setContent($this->tpl->get());
126 if($this->user_settings->getDayStart())
129 $morning_aggr = ($this->user_settings->getDayStart()-1)*60+(60-$raster);
135 $evening_aggr = $this->user_settings->getDayEnd()*60;
138 $this->tpl =
new ilTemplate(
'tpl.day_view.html',
true,
true,
'Services/Calendar');
140 include_once(
'./Services/YUI/classes/class.ilYuiUtil.php');
144 if(isset(
$_GET[
"bkid"]))
146 $user_id =
$_GET[
"bkid"];
149 elseif($ilUser->getId() == ANONYMOUS_USER_ID)
151 $user_id = $ilUser->getId();
156 $user_id = $ilUser->getId();
159 include_once(
'Services/Calendar/classes/class.ilCalendarSchedule.php');
161 $this->scheduler->addSubitemCalendars(
true);
162 $this->scheduler->calculate();
163 $daily_apps = $this->scheduler->getByDay($this->seed,$this->timezone);
173 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
176 include_once(
'Services/Calendar/classes/class.ilCalendarSettings.php');
179 include_once
"Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php";
183 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
184 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'idate', $this->seed->get(
IL_CAL_DATE));
185 $new_app_url = $this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'add');
187 if ($settings->getEnableGroupMilestones())
189 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
190 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'idate', $this->seed->get(
IL_CAL_DATE));
191 $new_ms_url = $this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'addMilestone');
193 $this->tpl->setCurrentBlock(
"new_ms");
194 $this->tpl->setVariable(
'DD_ID', $this->seed->get(
IL_CAL_UNIX));
196 $this->tpl->setVariable(
'URL_DD_NEW_APP', $new_app_url);
197 $this->tpl->setVariable(
'TXT_DD_NEW_APP', $this->lng->txt(
'cal_new_app'));
198 $this->tpl->setVariable(
'URL_DD_NEW_MS', $new_ms_url);
199 $this->tpl->setVariable(
'TXT_DD_NEW_MS', $this->lng->txt(
'cal_new_ms'));
200 $this->tpl->parseCurrentBlock();
204 $this->tpl->setCurrentBlock(
"new_app1");
206 $this->tpl->setVariable(
'NEW_APP_LINK', $new_app_url);
207 $this->tpl->parseCurrentBlock();
210 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
213 $this->tpl->setVariable(
'NAVIGATION',$navigation->getHTML());
217 $this->tpl->setVariable(
'HCOLSPAN',$colspan - 1);
219 $this->tpl->setVariable(
'TXT_TIME', $lng->txt(
"time"));
222 foreach($daily_apps as $event)
224 if($event[
'fullday'])
229 $this->tpl->setCurrentBlock(
'fullday_apps');
230 $this->tpl->setVariable(
'TXT_F_DAY', $lng->txt(
"cal_all_day"));
231 $this->tpl->setVariable(
'COLSPAN',$colspan - 1);
232 $this->tpl->parseCurrentBlock();
235 foreach($hours as $numeric => $hour)
237 if(!($numeric%60) || ($numeric == $morning_aggr && $morning_aggr) ||
238 ($numeric == $evening_aggr && $evening_aggr))
242 $this->tpl->setCurrentBlock(
"new_app2");
243 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
244 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
245 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'idate',$this->seed->get(
IL_CAL_DATE));
246 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'hour',floor($numeric/60));
247 $this->tpl->setVariable(
'NEW_APP_HOUR_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'add'));
249 $this->tpl->parseCurrentBlock();
253 if(($numeric == $morning_aggr && $morning_aggr) ||
254 ($numeric == $evening_aggr && $evening_aggr))
256 $this->tpl->setVariable(
'TIME_ROWSPAN', 1);
261 $this->tpl->setVariable(
'TIME_ROWSPAN', 60/$raster);
264 $this->tpl->setCurrentBlock(
'time_txt');
266 $this->tpl->setVariable(
'TIME',$hour[
'txt']);
267 $this->tpl->parseCurrentBlock();
270 foreach($hour[
'apps_start'] as $app)
275 if ($ilUser->prefs[
"screen_reader_optimization"])
277 $this->tpl->touchBlock(
'scrd_app_cell');
280 for($i = ($colspan - 1);$i > $hour[
'apps_num'];$i--)
282 $this->tpl->setCurrentBlock(
'empty_cell');
283 $this->tpl->setVariable(
'EMPTY_WIDTH',(100 / (
int) ($colspan - 1)).
'%');
286 if($numeric%60 == 60-$raster ||
287 ($numeric == $morning_aggr && $morning_aggr) ||
288 ($numeric == $evening_aggr && $evening_aggr))
290 $this->tpl->setVariable(
'EMPTY_STYLE',
' calempty_border');
293 $this->tpl->parseCurrentBlock();
296 $this->tpl->touchBlock(
'time_row');
309 $this->tpl->setCurrentBlock(
'panel_code');
310 $this->tpl->setVariable(
'NUM',$this->num_appointments);
311 $this->tpl->parseCurrentBlock();
314 if ($a_app[
'event']->isMilestone())
316 $this->tpl->setCurrentBlock(
'fullday_ms_icon');
317 $this->tpl->setVariable(
'ALT_FD_MS', $this->lng->txt(
"cal_milestone"));
319 $this->tpl->parseCurrentBlock();
322 $this->tpl->setCurrentBlock(
'fullday_app');
323 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentPanelGUI.php');
325 $this->tpl->setVariable(
'F_DAY_ID',$this->num_appointments);
327 $compl = ($a_app[
'event']->isMilestone() && $a_app[
'event']->getCompletion() > 0)
328 ?
" (".$a_app[
'event']->getCompletion().
"%)"
330 $this->tpl->setVariable(
'F_APP_TITLE',$a_app[
'event']->getPresentationTitle(
false).$compl);
331 $color = $this->app_colors->getColorByAppointment($a_app[
'event']->getEntryId());
332 $this->tpl->setVariable(
'F_APP_BGCOLOR',$color);
335 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
336 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
337 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id',$a_app[
'event']->getEntryId());
338 $this->tpl->setVariable(
'F_APP_EDIT_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'edit'));
340 $this->tpl->parseCurrentBlock();
343 $this->num_appointments++;
356 $this->tpl->setCurrentBlock(
'panel_code');
357 $this->tpl->setVariable(
'NUM',$this->num_appointments);
358 $this->tpl->parseCurrentBlock();
360 if (!$ilUser->prefs[
"screen_reader_optimization"])
362 $this->tpl->setCurrentBlock(
'app');
366 $this->tpl->setCurrentBlock(
'scrd_app');
369 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentPanelGUI.php');
371 $this->tpl->setVariable(
'PANEL_NUM',$this->num_appointments);
373 $this->tpl->setVariable(
'APP_ROWSPAN',$a_app[
'rowspan']);
374 $this->tpl->setVariable(
'APP_TITLE',$a_app[
'event']->getPresentationTitle(
false));
376 switch($this->user_settings->getTimeFormat())
379 $title = $a_app[
'event']->getStart()->get(
IL_CAL_FKT_DATE,
'H:i',$this->timezone);
383 $title = $a_app[
'event']->getStart()->get(
IL_CAL_FKT_DATE,
'h:ia',$this->timezone);
388 if ($ilUser->prefs[
"screen_reader_optimization"])
390 switch($this->user_settings->getTimeFormat())
393 $title.=
"-".$a_app[
'event']->getEnd()->get(
IL_CAL_FKT_DATE,
'H:i',$this->timezone);
397 $title.=
"-".$a_app[
'event']->getEnd()->get(
IL_CAL_FKT_DATE,
'h:ia',$this->timezone);
402 $title .= (
' '.$a_app[
'event']->getPresentationTitle(
false));
404 $this->tpl->setVariable(
'APP_TITLE',$title);
406 $color = $this->app_colors->getColorByAppointment($a_app[
'event']->getEntryId());
407 $this->tpl->setVariable(
'APP_BGCOLOR',$color);
409 $this->tpl->setVariable(
'APP_ADD_STYLES',$a_app[
'event']->getPresentationStyle());
412 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
413 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
414 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id',$a_app[
'event']->getEntryId());
415 $this->tpl->setVariable(
'APP_EDIT_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'edit'));
417 $this->tpl->parseCurrentBlock();
419 $this->num_appointments++;
431 for($i = $morning_aggr;$i <= $evening_aggr;$i+=$raster)
433 $hours[$i][
'apps_start'] = array();
434 $hours[$i][
'apps_num'] = 0;
436 switch($this->user_settings->getTimeFormat())
439 if ($morning_aggr > 0 && $i == $morning_aggr)
441 $hours[$i][
'txt'] = sprintf(
'%02d:00',0).
"-".
442 sprintf(
'%02d:00',ceil(($i+1)/60));
446 $hours[$i][
'txt'].= sprintf(
'%02d:%02d',floor($i/60),$i%60);
448 if ($evening_aggr < 23*60 && $i == $evening_aggr)
450 $hours[$i][
'txt'].=
"-".sprintf(
'%02d:00',23);
455 if ($morning_aggr > 0 && $i == $morning_aggr)
457 $hours[$i][
'txt'] = date(
'h a',mktime(0,0,0,1,1,2000)).
"-";
459 $hours[$i][
'txt'] = date(
'h a',mktime(floor($i/60),$i%60,0,1,1,2000));
460 if ($evening_aggr < 23*60 && $i == $evening_aggr)
462 $hours[$i][
'txt'].=
"-".date(
'h a',mktime(23,0,0,1,1,2000));
469 foreach($daily_apps as $app)
479 if($app[
'start_info'][
'mday'] != $this->seed_info[
'mday'])
485 $start = $app[
'start_info'][
'hours']*60+$app[
'start_info'][
'minutes'];
488 if($app[
'end_info'][
'mday'] != $this->seed_info[
'mday'])
492 elseif($app[
'start_info'][
'hours'] == $app[
'end_info'][
'hours'])
494 $end = $start+$raster;
498 $end = $app[
'end_info'][
'hours']*60+$app[
'end_info'][
'minutes'];
502 if ($ilUser->prefs[
"screen_reader_optimization"])
504 $end = $start+$raster;
507 if ($start < $morning_aggr)
509 $start = $morning_aggr;
511 if ($end <= $morning_aggr)
513 $end = $morning_aggr+$raster;
515 if ($start > $evening_aggr)
517 $start = $evening_aggr;
519 if ($end > $evening_aggr+$raster)
521 $end = $evening_aggr+$raster;
525 $end = $start+$raster;
529 $start = floor($start/$raster)*$raster;
530 $end = ceil($end/$raster)*$raster;
533 for($i = $start;$i < $end;$i+=$raster)
537 if (!$ilUser->prefs[
"screen_reader_optimization"])
539 $app[
'rowspan'] = ceil(($end - $start)/$raster);
545 $hours[$i][
'apps_start'][] = $app;
548 $hours[$i][
'apps_num']++;
567 foreach($hours as $hour)
569 $colspan = max($colspan,$hour[
'apps_num'] + 1);
573 if ($ilUser->prefs[
"screen_reader_optimization"])
578 return max($colspan,2);