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"];
137 $user_id = $ilUser->getId();
140 include_once(
'Services/Calendar/classes/class.ilCalendarSchedule.php');
142 $this->scheduler->addSubitemCalendars(
true);
143 $this->scheduler->calculate();
144 $daily_apps = $this->scheduler->getByDay($this->seed,$this->timezone);
146 $this->user_settings->getDayStart(),
147 $this->user_settings->getDayEnd()
153 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
156 include_once(
'Services/Calendar/classes/class.ilCalendarSettings.php');
161 if ($settings->getEnableGroupMilestones())
163 $this->tpl->setCurrentBlock(
"new_ms");
165 $this->tpl->setVariable(
'H_NEW_MS_ALT',$this->lng->txt(
'cal_new_ms'));
166 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
167 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'idate', $this->seed->get(
IL_CAL_DATE));
168 $this->tpl->setVariable(
'NEW_MS_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'addMilestone'));
169 $this->tpl->parseCurrentBlock();
172 $this->tpl->setCurrentBlock(
"new_app1");
174 $this->tpl->setVariable(
'H_NEW_APP_ALT',$this->lng->txt(
'cal_new_app'));
175 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
176 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'idate', $this->seed->get(
IL_CAL_DATE));
177 $this->tpl->setVariable(
'NEW_APP_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'add'));
178 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
179 $this->tpl->parseCurrentBlock();
182 $this->tpl->setVariable(
'NAVIGATION',$navigation->getHTML());
186 $this->tpl->setVariable(
'HCOLSPAN',$colspan - 1);
188 $this->tpl->setVariable(
'TXT_TIME', $lng->txt(
"time"));
191 foreach($daily_apps as $event)
193 if($event[
'fullday'])
198 $this->tpl->setCurrentBlock(
'fullday_apps');
199 $this->tpl->setVariable(
'TXT_F_DAY', $lng->txt(
"cal_all_day"));
200 $this->tpl->setVariable(
'COLSPAN',$colspan - 1);
201 $this->tpl->parseCurrentBlock();
205 foreach($hours as $numeric => $hour)
209 $this->tpl->setCurrentBlock(
"new_app2");
210 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
211 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
212 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'idate',$this->seed->get(
IL_CAL_DATE));
213 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'hour',$numeric);
214 $this->tpl->setVariable(
'NEW_APP_HOUR_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'add'));
216 $this->tpl->setVariable(
'NEW_APP_ALT',$this->lng->txt(
'cal_new_app'));
217 $this->tpl->parseCurrentBlock();
220 foreach($hour[
'apps_start'] as $app)
225 if ($ilUser->prefs[
"screen_reader_optimization"])
227 $this->tpl->touchBlock(
'scrd_app_cell');
230 for($i = ($colspan - 1);$i > $hour[
'apps_num'];$i--)
232 $this->tpl->setCurrentBlock(
'empty_cell');
233 $this->tpl->setVariable(
'EMPTY_WIDTH',(100 / (
int) ($colspan - 1)).
'%');
234 $this->tpl->parseCurrentBlock();
236 $this->tpl->setCurrentBlock(
'time_row');
237 $this->tpl->setVariable(
'TIME',$hour[
'txt']);
238 $this->tpl->parseCurrentBlock();
252 $this->tpl->setCurrentBlock(
'panel_code');
253 $this->tpl->setVariable(
'NUM',$this->num_appointments);
254 $this->tpl->parseCurrentBlock();
257 if ($a_app[
'event']->isMilestone())
259 $this->tpl->setCurrentBlock(
'fullday_ms_icon');
260 $this->tpl->setVariable(
'ALT_FD_MS', $this->lng->txt(
"cal_milestone"));
262 $this->tpl->parseCurrentBlock();
265 $this->tpl->setCurrentBlock(
'fullday_app');
266 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentPanelGUI.php');
268 $this->tpl->setVariable(
'F_DAY_ID',$this->num_appointments);
270 $compl = ($a_app[
'event']->isMilestone() && $a_app[
'event']->getCompletion() > 0)
271 ?
" (".$a_app[
'event']->getCompletion().
"%)"
273 $this->tpl->setVariable(
'F_APP_TITLE',$a_app[
'event']->getPresentationTitle().$compl);
274 $color = $this->app_colors->getColorByAppointment($a_app[
'event']->getEntryId());
275 $this->tpl->setVariable(
'F_APP_BGCOLOR',$color);
278 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
279 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
280 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id',$a_app[
'event']->getEntryId());
281 $this->tpl->setVariable(
'F_APP_EDIT_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'edit'));
283 $this->tpl->parseCurrentBlock();
286 $this->num_appointments++;
299 $this->tpl->setCurrentBlock(
'panel_code');
300 $this->tpl->setVariable(
'NUM',$this->num_appointments);
301 $this->tpl->parseCurrentBlock();
303 if (!$ilUser->prefs[
"screen_reader_optimization"])
305 $this->tpl->setCurrentBlock(
'app');
309 $this->tpl->setCurrentBlock(
'scrd_app');
312 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentPanelGUI.php');
314 $this->tpl->setVariable(
'PANEL_NUM',$this->num_appointments);
316 $this->tpl->setVariable(
'APP_ROWSPAN',$a_app[
'rowspan']);
317 $this->tpl->setVariable(
'APP_TITLE',$a_app[
'event']->getPresentationTitle());
319 switch($this->user_settings->getTimeFormat())
331 if ($ilUser->prefs[
"screen_reader_optimization"])
333 switch($this->user_settings->getTimeFormat())
349 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
353 $title .=
' '.$a_app[
'event']->getTitle();
354 if($entry->isOwner())
356 $max = (int)$entry->getNumberOfBookings();
357 $current = (int)$entry->getCurrentNumberOfBookings($a_app[
'event']->getEntryId());
360 $title .=
' ('.$current.
'/'.$max.
')';
362 else if($current == $max)
364 $title .=
' ('.$this->lng->txt(
'cal_booked_out').
')';
368 $title .=
' ('.$this->lng->txt(
'cal_book_free').
')';
371 else if($entry->hasBooked($a_app[
'event']->getEntryId()))
373 $title .=
' ('.$this->lng->txt(
'cal_date_booked').
')';
379 $title .= (
' '.$a_app[
'event']->getPresentationTitle());
382 $this->tpl->setVariable(
'APP_TITLE',
$title);
384 $color = $this->app_colors->getColorByAppointment($a_app[
'event']->getEntryId());
385 $this->tpl->setVariable(
'APP_BGCOLOR',$color);
388 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
389 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
390 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id',$a_app[
'event']->getEntryId());
391 $this->tpl->setVariable(
'APP_EDIT_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'edit'));
393 $this->tpl->parseCurrentBlock();
395 $this->num_appointments++;
404 protected function parseHourInfo($daily_apps, $morning_aggr = 7,$evening_aggr = 20)
406 for($i = $morning_aggr;$i <= $evening_aggr;$i++)
408 $hours[$i][
'apps_start'] = array();
409 $hours[$i][
'apps_num'] = 0;
411 switch($this->user_settings->getTimeFormat())
414 if ($morning_aggr > 0 && $i == $morning_aggr)
416 $hours[$i][
'txt'] = sprintf(
'%02d:00',0).
"-";
418 $hours[$i][
'txt'].= sprintf(
'%02d:00',$i);
419 if ($evening_aggr < 23 && $i == $evening_aggr)
421 $hours[$i][
'txt'].=
"-".sprintf(
'%02d:00',23);
426 if ($morning_aggr > 0 && $i == $morning_aggr)
428 $hours[$i][
'txt'] = date(
'h a',mktime(0,0,0,1,1,2000)).
"-";
430 $hours[$i][
'txt'] = date(
'h a',mktime($i,0,0,1,1,2000));
431 if ($evening_aggr < 23 && $i == $evening_aggr)
433 $hours[$i][
'txt'].=
"-".date(
'h a',mktime(23,0,0,1,1,2000));
440 foreach($daily_apps as $app)
450 if($app[
'start_info'][
'mday'] != $this->seed_info[
'mday'])
456 $start = $app[
'start_info'][
'hours'];
459 if($app[
'end_info'][
'mday'] != $this->seed_info[
'mday'])
463 elseif($app[
'start_info'][
'hours'] == $app[
'end_info'][
'hours'])
469 $end = $app[
'end_info'][
'hours'];
473 if ($ilUser->prefs[
"screen_reader_optimization"])
478 if ($start < $morning_aggr)
480 $start = $morning_aggr;
482 if ($end <= $morning_aggr)
484 $end = $morning_aggr+1;
486 if ($start > $evening_aggr)
488 $start = $evening_aggr;
490 if ($end > $evening_aggr+1)
492 $end = $evening_aggr+1;
500 for($i = $start;$i < $end;$i++)
504 if (!$ilUser->prefs[
"screen_reader_optimization"])
506 $app[
'rowspan'] = $end - $start;
512 $hours[$i][
'apps_start'][] = $app;
515 $hours[$i][
'apps_num']++;
533 foreach($hours as $hour)
535 $colspan = max($colspan,$hour[
'apps_num'] + 1);
539 if ($ilUser->prefs[
"screen_reader_optimization"])
544 return max($colspan,2);