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());
122 global
$lng, $ilUser;
124 $this->tpl =
new ilTemplate(
'tpl.day_view.html',
true,
true,
'Services/Calendar');
126 include_once(
'./Services/YUI/classes/class.ilYuiUtil.php');
130 if(isset(
$_GET[
"bkid"]))
132 $user_id =
$_GET[
"bkid"];
135 elseif($ilUser->getId() == ANONYMOUS_USER_ID)
137 $user_id = $ilUser->getId();
142 $user_id = $ilUser->getId();
145 include_once(
'Services/Calendar/classes/class.ilCalendarSchedule.php');
147 $this->scheduler->addSubitemCalendars(
true);
148 $this->scheduler->calculate();
149 $daily_apps = $this->scheduler->getByDay($this->seed,$this->timezone);
151 $this->user_settings->getDayStart(),
152 $this->user_settings->getDayEnd()
158 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
161 include_once(
'Services/Calendar/classes/class.ilCalendarSettings.php');
166 if ($settings->getEnableGroupMilestones())
168 $this->tpl->setCurrentBlock(
"new_ms");
170 $this->tpl->setVariable(
'H_NEW_MS_ALT',$this->lng->txt(
'cal_new_ms'));
171 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
172 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'idate', $this->seed->get(
IL_CAL_DATE));
173 $this->tpl->setVariable(
'NEW_MS_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'addMilestone'));
174 $this->tpl->parseCurrentBlock();
177 $this->tpl->setCurrentBlock(
"new_app1");
179 $this->tpl->setVariable(
'H_NEW_APP_ALT',$this->lng->txt(
'cal_new_app'));
180 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
181 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'idate', $this->seed->get(
IL_CAL_DATE));
182 $this->tpl->setVariable(
'NEW_APP_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'add'));
183 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
184 $this->tpl->parseCurrentBlock();
187 $this->tpl->setVariable(
'NAVIGATION',$navigation->getHTML());
191 $this->tpl->setVariable(
'HCOLSPAN',$colspan - 1);
193 $this->tpl->setVariable(
'TXT_TIME', $lng->txt(
"time"));
196 foreach($daily_apps as $event)
198 if($event[
'fullday'])
203 $this->tpl->setCurrentBlock(
'fullday_apps');
204 $this->tpl->setVariable(
'TXT_F_DAY', $lng->txt(
"cal_all_day"));
205 $this->tpl->setVariable(
'COLSPAN',$colspan - 1);
206 $this->tpl->parseCurrentBlock();
210 foreach($hours as $numeric => $hour)
214 $this->tpl->setCurrentBlock(
"new_app2");
215 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
216 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
217 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'idate',$this->seed->get(
IL_CAL_DATE));
218 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'hour',$numeric);
219 $this->tpl->setVariable(
'NEW_APP_HOUR_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'add'));
221 $this->tpl->setVariable(
'NEW_APP_ALT',$this->lng->txt(
'cal_new_app'));
222 $this->tpl->parseCurrentBlock();
225 foreach($hour[
'apps_start'] as $app)
230 if ($ilUser->prefs[
"screen_reader_optimization"])
232 $this->tpl->touchBlock(
'scrd_app_cell');
235 for($i = ($colspan - 1);$i > $hour[
'apps_num'];$i--)
237 $this->tpl->setCurrentBlock(
'empty_cell');
238 $this->tpl->setVariable(
'EMPTY_WIDTH',(100 / (
int) ($colspan - 1)).
'%');
239 $this->tpl->parseCurrentBlock();
241 $this->tpl->setCurrentBlock(
'time_row');
242 $this->tpl->setVariable(
'TIME',$hour[
'txt']);
243 $this->tpl->parseCurrentBlock();
257 $this->tpl->setCurrentBlock(
'panel_code');
258 $this->tpl->setVariable(
'NUM',$this->num_appointments);
259 $this->tpl->parseCurrentBlock();
262 if ($a_app[
'event']->isMilestone())
264 $this->tpl->setCurrentBlock(
'fullday_ms_icon');
265 $this->tpl->setVariable(
'ALT_FD_MS', $this->lng->txt(
"cal_milestone"));
267 $this->tpl->parseCurrentBlock();
270 $this->tpl->setCurrentBlock(
'fullday_app');
271 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentPanelGUI.php');
273 $this->tpl->setVariable(
'F_DAY_ID',$this->num_appointments);
275 $compl = ($a_app[
'event']->isMilestone() && $a_app[
'event']->getCompletion() > 0)
276 ?
" (".$a_app[
'event']->getCompletion().
"%)"
278 $this->tpl->setVariable(
'F_APP_TITLE',$a_app[
'event']->getPresentationTitle(
false).$compl);
279 $color = $this->app_colors->getColorByAppointment($a_app[
'event']->getEntryId());
280 $this->tpl->setVariable(
'F_APP_BGCOLOR',$color);
283 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
284 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
285 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id',$a_app[
'event']->getEntryId());
286 $this->tpl->setVariable(
'F_APP_EDIT_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'edit'));
288 $this->tpl->parseCurrentBlock();
291 $this->num_appointments++;
304 $this->tpl->setCurrentBlock(
'panel_code');
305 $this->tpl->setVariable(
'NUM',$this->num_appointments);
306 $this->tpl->parseCurrentBlock();
308 if (!$ilUser->prefs[
"screen_reader_optimization"])
310 $this->tpl->setCurrentBlock(
'app');
314 $this->tpl->setCurrentBlock(
'scrd_app');
317 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentPanelGUI.php');
319 $this->tpl->setVariable(
'PANEL_NUM',$this->num_appointments);
321 $this->tpl->setVariable(
'APP_ROWSPAN',$a_app[
'rowspan']);
322 $this->tpl->setVariable(
'APP_TITLE',$a_app[
'event']->getPresentationTitle(
false));
324 switch($this->user_settings->getTimeFormat())
336 if ($ilUser->prefs[
"screen_reader_optimization"])
338 switch($this->user_settings->getTimeFormat())
354 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
358 $title .=
' '.$a_app[
'event']->getTitle();
359 if($entry->isOwner())
361 $max = (int)$entry->getNumberOfBookings();
362 $current = (int)$entry->getCurrentNumberOfBookings($a_app[
'event']->getEntryId());
365 $title .=
' ('.$current.
'/'.$max.
')';
367 else if($current == $max)
369 $title .=
' ('.$this->lng->txt(
'cal_booked_out').
')';
373 $title .=
' ('.$this->lng->txt(
'cal_book_free').
')';
376 else if($entry->hasBooked($a_app[
'event']->getEntryId()))
378 $title .=
' ('.$this->lng->txt(
'cal_date_booked').
')';
384 $title .= (
' '.$a_app[
'event']->getPresentationTitle(
false));
387 $this->tpl->setVariable(
'APP_TITLE',
$title);
389 $color = $this->app_colors->getColorByAppointment($a_app[
'event']->getEntryId());
390 $this->tpl->setVariable(
'APP_BGCOLOR',$color);
393 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
394 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
395 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id',$a_app[
'event']->getEntryId());
396 $this->tpl->setVariable(
'APP_EDIT_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'edit'));
398 $this->tpl->parseCurrentBlock();
400 $this->num_appointments++;
409 protected function parseHourInfo($daily_apps, $morning_aggr = 7,$evening_aggr = 20)
411 for($i = $morning_aggr;$i <= $evening_aggr;$i++)
413 $hours[$i][
'apps_start'] = array();
414 $hours[$i][
'apps_num'] = 0;
416 switch($this->user_settings->getTimeFormat())
419 if ($morning_aggr > 0 && $i == $morning_aggr)
421 $hours[$i][
'txt'] = sprintf(
'%02d:00',0).
"-";
423 $hours[$i][
'txt'].= sprintf(
'%02d:00',$i);
424 if ($evening_aggr < 23 && $i == $evening_aggr)
426 $hours[$i][
'txt'].=
"-".sprintf(
'%02d:00',23);
431 if ($morning_aggr > 0 && $i == $morning_aggr)
433 $hours[$i][
'txt'] = date(
'h a',mktime(0,0,0,1,1,2000)).
"-";
435 $hours[$i][
'txt'] = date(
'h a',mktime($i,0,0,1,1,2000));
436 if ($evening_aggr < 23 && $i == $evening_aggr)
438 $hours[$i][
'txt'].=
"-".date(
'h a',mktime(23,0,0,1,1,2000));
445 foreach($daily_apps as $app)
455 if($app[
'start_info'][
'mday'] != $this->seed_info[
'mday'])
461 $start = $app[
'start_info'][
'hours'];
464 if($app[
'end_info'][
'mday'] != $this->seed_info[
'mday'])
468 elseif($app[
'start_info'][
'hours'] == $app[
'end_info'][
'hours'])
474 $end = $app[
'end_info'][
'hours'];
478 if ($ilUser->prefs[
"screen_reader_optimization"])
483 if ($start < $morning_aggr)
485 $start = $morning_aggr;
487 if ($end <= $morning_aggr)
489 $end = $morning_aggr+1;
491 if ($start > $evening_aggr)
493 $start = $evening_aggr;
495 if ($end > $evening_aggr+1)
497 $end = $evening_aggr+1;
505 for($i = $start;$i < $end;$i++)
509 if (!$ilUser->prefs[
"screen_reader_optimization"])
511 $app[
'rowspan'] = $end - $start;
517 $hours[$i][
'apps_start'][] = $app;
520 $hours[$i][
'apps_num']++;
538 foreach($hours as $hour)
540 $colspan = max($colspan,$hour[
'apps_num'] + 1);
544 if ($ilUser->prefs[
"screen_reader_optimization"])
549 return max($colspan,2);