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');
181 if ($settings->getEnableGroupMilestones())
183 $this->tpl->setCurrentBlock(
"new_ms");
185 $this->tpl->setVariable(
'H_NEW_MS_ALT',$this->lng->txt(
'cal_new_ms'));
186 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
187 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'idate', $this->seed->get(
IL_CAL_DATE));
188 $this->tpl->setVariable(
'NEW_MS_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'addMilestone'));
189 $this->tpl->parseCurrentBlock();
192 $this->tpl->setCurrentBlock(
"new_app1");
194 $this->tpl->setVariable(
'H_NEW_APP_ALT',$this->lng->txt(
'cal_new_app'));
195 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
196 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'idate', $this->seed->get(
IL_CAL_DATE));
197 $this->tpl->setVariable(
'NEW_APP_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'add'));
198 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
199 $this->tpl->parseCurrentBlock();
202 $this->tpl->setVariable(
'NAVIGATION',$navigation->getHTML());
206 $this->tpl->setVariable(
'HCOLSPAN',$colspan - 1);
208 $this->tpl->setVariable(
'TXT_TIME', $lng->txt(
"time"));
211 foreach($daily_apps as $event)
213 if($event[
'fullday'])
218 $this->tpl->setCurrentBlock(
'fullday_apps');
219 $this->tpl->setVariable(
'TXT_F_DAY', $lng->txt(
"cal_all_day"));
220 $this->tpl->setVariable(
'COLSPAN',$colspan - 1);
221 $this->tpl->parseCurrentBlock();
224 foreach($hours as $numeric => $hour)
226 if(!($numeric%60) || ($numeric == $morning_aggr && $morning_aggr) ||
227 ($numeric == $evening_aggr && $evening_aggr))
231 $this->tpl->setCurrentBlock(
"new_app2");
232 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
233 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
234 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'idate',$this->seed->get(
IL_CAL_DATE));
235 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'hour',floor($numeric/60));
236 $this->tpl->setVariable(
'NEW_APP_HOUR_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'add'));
238 $this->tpl->setVariable(
'NEW_APP_ALT',$this->lng->txt(
'cal_new_app'));
239 $this->tpl->parseCurrentBlock();
243 if(($numeric == $morning_aggr && $morning_aggr) ||
244 ($numeric == $evening_aggr && $evening_aggr))
246 $this->tpl->setVariable(
'TIME_ROWSPAN', 1);
251 $this->tpl->setVariable(
'TIME_ROWSPAN', 60/$raster);
254 $this->tpl->setCurrentBlock(
'time_txt');
256 $this->tpl->setVariable(
'TIME',$hour[
'txt']);
257 $this->tpl->parseCurrentBlock();
260 foreach($hour[
'apps_start'] as $app)
265 if ($ilUser->prefs[
"screen_reader_optimization"])
267 $this->tpl->touchBlock(
'scrd_app_cell');
270 for($i = ($colspan - 1);$i > $hour[
'apps_num'];$i--)
272 $this->tpl->setCurrentBlock(
'empty_cell');
273 $this->tpl->setVariable(
'EMPTY_WIDTH',(100 / (
int) ($colspan - 1)).
'%');
276 if($numeric%60 == 60-$raster ||
277 ($numeric == $morning_aggr && $morning_aggr) ||
278 ($numeric == $evening_aggr && $evening_aggr))
280 $this->tpl->setVariable(
'EMPTY_STYLE',
' calempty_border');
283 $this->tpl->parseCurrentBlock();
286 $this->tpl->touchBlock(
'time_row');
299 $this->tpl->setCurrentBlock(
'panel_code');
300 $this->tpl->setVariable(
'NUM',$this->num_appointments);
301 $this->tpl->parseCurrentBlock();
304 if ($a_app[
'event']->isMilestone())
306 $this->tpl->setCurrentBlock(
'fullday_ms_icon');
307 $this->tpl->setVariable(
'ALT_FD_MS', $this->lng->txt(
"cal_milestone"));
309 $this->tpl->parseCurrentBlock();
312 $this->tpl->setCurrentBlock(
'fullday_app');
313 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentPanelGUI.php');
315 $this->tpl->setVariable(
'F_DAY_ID',$this->num_appointments);
317 $compl = ($a_app[
'event']->isMilestone() && $a_app[
'event']->getCompletion() > 0)
318 ?
" (".$a_app[
'event']->getCompletion().
"%)"
320 $this->tpl->setVariable(
'F_APP_TITLE',$a_app[
'event']->getPresentationTitle(
false).$compl);
321 $color = $this->app_colors->getColorByAppointment($a_app[
'event']->getEntryId());
322 $this->tpl->setVariable(
'F_APP_BGCOLOR',$color);
325 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
326 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
327 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id',$a_app[
'event']->getEntryId());
328 $this->tpl->setVariable(
'F_APP_EDIT_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'edit'));
330 $this->tpl->parseCurrentBlock();
333 $this->num_appointments++;
346 $this->tpl->setCurrentBlock(
'panel_code');
347 $this->tpl->setVariable(
'NUM',$this->num_appointments);
348 $this->tpl->parseCurrentBlock();
350 if (!$ilUser->prefs[
"screen_reader_optimization"])
352 $this->tpl->setCurrentBlock(
'app');
356 $this->tpl->setCurrentBlock(
'scrd_app');
359 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentPanelGUI.php');
361 $this->tpl->setVariable(
'PANEL_NUM',$this->num_appointments);
363 $this->tpl->setVariable(
'APP_ROWSPAN',$a_app[
'rowspan']);
364 $this->tpl->setVariable(
'APP_TITLE',$a_app[
'event']->getPresentationTitle(
false));
366 switch($this->user_settings->getTimeFormat())
369 $title = $a_app[
'event']->getStart()->get(
IL_CAL_FKT_DATE,
'H:i',$this->timezone);
373 $title = $a_app[
'event']->getStart()->get(
IL_CAL_FKT_DATE,
'h:ia',$this->timezone);
378 if ($ilUser->prefs[
"screen_reader_optimization"])
380 switch($this->user_settings->getTimeFormat())
383 $title.=
"-".$a_app[
'event']->getEnd()->get(
IL_CAL_FKT_DATE,
'H:i',$this->timezone);
387 $title.=
"-".$a_app[
'event']->getEnd()->get(
IL_CAL_FKT_DATE,
'h:ia',$this->timezone);
392 $title .= (
' '.$a_app[
'event']->getPresentationTitle(
false));
394 $this->tpl->setVariable(
'APP_TITLE',$title);
396 $color = $this->app_colors->getColorByAppointment($a_app[
'event']->getEntryId());
397 $this->tpl->setVariable(
'APP_BGCOLOR',$color);
399 $this->tpl->setVariable(
'APP_ADD_STYLES',$a_app[
'event']->getPresentationStyle());
402 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
403 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
404 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id',$a_app[
'event']->getEntryId());
405 $this->tpl->setVariable(
'APP_EDIT_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'edit'));
407 $this->tpl->parseCurrentBlock();
409 $this->num_appointments++;
421 for($i = $morning_aggr;$i <= $evening_aggr;$i+=$raster)
423 $hours[$i][
'apps_start'] = array();
424 $hours[$i][
'apps_num'] = 0;
426 switch($this->user_settings->getTimeFormat())
429 if ($morning_aggr > 0 && $i == $morning_aggr)
431 $hours[$i][
'txt'] = sprintf(
'%02d:00',0).
"-".
432 sprintf(
'%02d:00',ceil(($i+1)/60));
436 $hours[$i][
'txt'].= sprintf(
'%02d:%02d',floor($i/60),$i%60);
438 if ($evening_aggr < 23*60 && $i == $evening_aggr)
440 $hours[$i][
'txt'].=
"-".sprintf(
'%02d:00',23);
445 if ($morning_aggr > 0 && $i == $morning_aggr)
447 $hours[$i][
'txt'] = date(
'h a',mktime(0,0,0,1,1,2000)).
"-";
449 $hours[$i][
'txt'] = date(
'h a',mktime(floor($i/60),$i%60,0,1,1,2000));
450 if ($evening_aggr < 23*60 && $i == $evening_aggr)
452 $hours[$i][
'txt'].=
"-".date(
'h a',mktime(23,0,0,1,1,2000));
459 foreach($daily_apps as $app)
469 if($app[
'start_info'][
'mday'] != $this->seed_info[
'mday'])
475 $start = $app[
'start_info'][
'hours']*60+$app[
'start_info'][
'minutes'];
478 if($app[
'end_info'][
'mday'] != $this->seed_info[
'mday'])
482 elseif($app[
'start_info'][
'hours'] == $app[
'end_info'][
'hours'])
484 $end = $start+$raster;
488 $end = $app[
'end_info'][
'hours']*60+$app[
'end_info'][
'minutes'];
492 if ($ilUser->prefs[
"screen_reader_optimization"])
494 $end = $start+$raster;
497 if ($start < $morning_aggr)
499 $start = $morning_aggr;
501 if ($end <= $morning_aggr)
503 $end = $morning_aggr+$raster;
505 if ($start > $evening_aggr)
507 $start = $evening_aggr;
509 if ($end > $evening_aggr+$raster)
511 $end = $evening_aggr+$raster;
515 $end = $start+$raster;
519 $start = floor($start/$raster)*$raster;
520 $end = ceil($end/$raster)*$raster;
523 for($i = $start;$i < $end;$i+=$raster)
527 if (!$ilUser->prefs[
"screen_reader_optimization"])
529 $app[
'rowspan'] = ceil(($end - $start)/$raster);
535 $hours[$i][
'apps_start'][] = $app;
538 $hours[$i][
'apps_num']++;
557 foreach($hours as $hour)
559 $colspan = max($colspan,$hour[
'apps_num'] + 1);
563 if ($ilUser->prefs[
"screen_reader_optimization"])
568 return max($colspan,2);