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']);
97 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentGUI.php');
99 $this->ctrl->forwardCommand($app);
103 $cmd = $this->ctrl->getCmd(
"show");
105 $tpl->setContent($this->tpl->get());
119 $this->tpl =
new ilTemplate(
'tpl.day_view.html',
true,
true,
'Services/Calendar');
121 include_once(
'./Services/YUI/classes/class.ilYuiUtil.php');
127 $this->tpl->setVariable(
'NAVIGATION',$navigation->getHTML());
133 $this->tpl->setVariable(
'H_NEW_APP_ALT',$this->lng->txt(
'cal_new_app'));
136 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
137 $this->tpl->setVariable(
'NEW_APP_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'add'));
138 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
140 include_once(
'Services/Calendar/classes/class.ilCalendarSchedule.php');
142 $this->scheduler->addSubitemCalendars(
true);
143 $this->scheduler->calculate();
145 $daily_apps = $this->scheduler->getByDay($this->seed,$this->timezone);
150 $this->tpl->setVariable(
'COLSPAN',$colspan);
153 foreach($daily_apps as $event)
155 if($event[
'fullday'])
162 foreach($hours as $numeric => $hour)
164 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
165 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
166 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'hour',$numeric);
167 $this->tpl->setVariable(
'NEW_APP_HOUR_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'add'));
170 $this->tpl->setVariable(
'NEW_APP_ALT',$this->lng->txt(
'cal_new_app'));
173 foreach($hour[
'apps_start'] as $app)
177 for($i = ($colspan - 1);$i > $hour[
'apps_num'];$i--)
179 $this->tpl->touchBlock(
'empty_cell');
181 $this->tpl->setCurrentBlock(
'time_row');
182 $this->tpl->setVariable(
'TIME',$hour[
'txt']);
183 $this->tpl->parseCurrentBlock();
197 $this->tpl->setCurrentBlock(
'panel_code');
198 $this->tpl->setVariable(
'NUM',$this->num_appointments);
199 $this->tpl->parseCurrentBlock();
202 $this->tpl->setCurrentBlock(
'fullday_app');
204 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentPanelGUI.php');
206 $this->tpl->setVariable(
'F_DAY_ID',$this->num_appointments);
208 $this->tpl->setVariable(
'F_APP_TITLE',$a_app[
'event']->getPresentationTitle());
209 $color = $this->app_colors->getColorByAppointment($a_app[
'event']->getEntryId());
210 $this->tpl->setVariable(
'F_APP_BGCOLOR',$color);
213 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
214 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
215 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id',$a_app[
'event']->getEntryId());
216 $this->tpl->setVariable(
'F_APP_EDIT_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'edit'));
218 $this->tpl->parseCurrentBlock();
221 $this->num_appointments++;
232 $this->tpl->setCurrentBlock(
'panel_code');
233 $this->tpl->setVariable(
'NUM',$this->num_appointments);
234 $this->tpl->parseCurrentBlock();
238 $this->tpl->setCurrentBlock(
'app');
240 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentPanelGUI.php');
242 $this->tpl->setVariable(
'PANEL_NUM',$this->num_appointments);
244 $this->tpl->setVariable(
'APP_ROWSPAN',$a_app[
'rowspan']);
245 $this->tpl->setVariable(
'APP_TITLE',$a_app[
'event']->getPresentationTitle());
247 switch($this->user_settings->getTimeFormat())
257 $title .= (
' '.$a_app[
'event']->getPresentationTitle());
259 $this->tpl->setVariable(
'APP_TITLE',
$title);
261 $color = $this->app_colors->getColorByAppointment($a_app[
'event']->getEntryId());
262 $this->tpl->setVariable(
'APP_BGCOLOR',$color);
265 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
266 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
267 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id',$a_app[
'event']->getEntryId());
268 $this->tpl->setVariable(
'APP_EDIT_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'edit'));
270 $this->tpl->parseCurrentBlock();
272 $this->num_appointments++;
284 for($i = $morning_aggr;$i <= $evening_aggr;$i++)
286 $hours[$i][
'apps_start'] = array();
287 $hours[$i][
'apps_num'] = 0;
289 switch($this->user_settings->getTimeFormat())
292 if ($morning_aggr > 0 && $i == $morning_aggr)
294 $hours[$i][
'txt'] = sprintf(
'%02d:00',0).
"-";
296 $hours[$i][
'txt'].= sprintf(
'%02d:00',$i);
297 if ($evening_aggr < 23 && $i == $evening_aggr)
299 $hours[$i][
'txt'].=
"-".sprintf(
'%02d:00',23);
304 if ($morning_aggr > 0 && $i == $morning_aggr)
306 $hours[$i][
'txt'] = date(
'h a',mktime(0,0,0,1,1,2000)).
"-";
308 $hours[$i][
'txt'] = date(
'h a',mktime($i,0,0,1,1,2000));
309 if ($evening_aggr < 23 && $i == $evening_aggr)
311 $hours[$i][
'txt'].=
"-".date(
'h a',mktime(23,0,0,1,1,2000));
318 foreach($daily_apps as $app)
326 if($app[
'start_info'][
'mday'] != $this->seed_info[
'mday'])
332 $start = $app[
'start_info'][
'hours'];
335 if($app[
'end_info'][
'mday'] != $this->seed_info[
'mday'])
339 elseif($app[
'start_info'][
'hours'] == $app[
'end_info'][
'hours'])
345 $end = $app[
'end_info'][
'hours'];
347 if ($start < $morning_aggr)
349 $start = $morning_aggr;
351 if ($end <= $morning_aggr)
353 $end = $morning_aggr+1;
355 if ($start > $evening_aggr)
357 $start = $evening_aggr;
359 if ($end > $evening_aggr+1)
361 $end = $evening_aggr+1;
369 for($i = $start;$i < $end;$i++)
373 $app[
'rowspan'] = $end - $start;
374 $hours[$i][
'apps_start'][] = $app;
377 $hours[$i][
'apps_num']++;
393 foreach($hours as $hour)
395 $colspan = max($colspan,$hour[
'apps_num'] + 1);
397 return max($colspan,2);