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())
378 if ($ilUser->prefs[
"screen_reader_optimization"])
380 switch($this->user_settings->getTimeFormat())
396 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
400 $title .=
' '.$a_app[
'event']->getTitle();
401 if($entry->isOwner())
403 $max = (int)$entry->getNumberOfBookings();
404 $current = (int)$entry->getCurrentNumberOfBookings($a_app[
'event']->getEntryId());
407 $title .=
' ('.$current.
'/'.$max.
')';
409 else if($current == $max)
411 $title .=
' ('.$this->lng->txt(
'cal_booked_out').
')';
415 $title .=
' ('.$this->lng->txt(
'cal_book_free').
')';
418 else if($entry->hasBooked($a_app[
'event']->getEntryId()))
420 $title .=
' ('.$this->lng->txt(
'cal_date_booked').
')';
426 $title .= (
' '.$a_app[
'event']->getPresentationTitle(
false));
429 $this->tpl->setVariable(
'APP_TITLE',
$title);
431 $color = $this->app_colors->getColorByAppointment($a_app[
'event']->getEntryId());
432 $this->tpl->setVariable(
'APP_BGCOLOR',$color);
435 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
436 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
437 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id',$a_app[
'event']->getEntryId());
438 $this->tpl->setVariable(
'APP_EDIT_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'edit'));
440 $this->tpl->parseCurrentBlock();
442 $this->num_appointments++;
454 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())
462 if ($morning_aggr > 0 && $i == $morning_aggr)
464 $hours[$i][
'txt'] = sprintf(
'%02d:00',0).
"-".
465 sprintf(
'%02d:00',ceil(($i+1)/60));
469 $hours[$i][
'txt'].= sprintf(
'%02d:%02d',floor($i/60),$i%60);
471 if ($evening_aggr < 23*60 && $i == $evening_aggr)
473 $hours[$i][
'txt'].=
"-".sprintf(
'%02d:00',23);
478 if ($morning_aggr > 0 && $i == $morning_aggr)
480 $hours[$i][
'txt'] = date(
'h a',mktime(0,0,0,1,1,2000)).
"-";
482 $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)
485 $hours[$i][
'txt'].=
"-".date(
'h a',mktime(23,0,0,1,1,2000));
492 foreach($daily_apps as $app)
502 if($app[
'start_info'][
'mday'] != $this->seed_info[
'mday'])
508 $start = $app[
'start_info'][
'hours']*60+$app[
'start_info'][
'minutes'];
511 if($app[
'end_info'][
'mday'] != $this->seed_info[
'mday'])
515 elseif($app[
'start_info'][
'hours'] == $app[
'end_info'][
'hours'])
517 $end = $start+$raster;
521 $end = $app[
'end_info'][
'hours']*60+$app[
'end_info'][
'minutes'];
525 if ($ilUser->prefs[
"screen_reader_optimization"])
527 $end = $start+$raster;
530 if ($start < $morning_aggr)
532 $start = $morning_aggr;
534 if ($end <= $morning_aggr)
536 $end = $morning_aggr+$raster;
538 if ($start > $evening_aggr)
540 $start = $evening_aggr;
542 if ($end > $evening_aggr+$raster)
544 $end = $evening_aggr+$raster;
548 $end = $start+$raster;
552 $start = floor($start/$raster)*$raster;
553 $end = ceil($end/$raster)*$raster;
556 for($i = $start;$i < $end;$i+=$raster)
560 if (!$ilUser->prefs[
"screen_reader_optimization"])
562 $app[
'rowspan'] = ceil(($end - $start)/$raster);
568 $hours[$i][
'apps_start'][] = $app;
571 $hours[$i][
'apps_num']++;
590 foreach($hours as $hour)
592 $colspan = max($colspan,$hour[
'apps_num'] + 1);
596 if ($ilUser->prefs[
"screen_reader_optimization"])
601 return max($colspan,2);