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());
121 $this->tpl =
new ilTemplate(
'tpl.day_view.html',
true,
true,
'Services/Calendar');
123 include_once(
'./Services/YUI/classes/class.ilYuiUtil.php');
127 include_once(
'Services/Calendar/classes/class.ilCalendarSchedule.php');
129 $this->scheduler->addSubitemCalendars(
true);
130 $this->scheduler->calculate();
131 $daily_apps = $this->scheduler->getByDay($this->seed,$this->timezone);
133 $this->user_settings->getDayStart(),
134 $this->user_settings->getDayEnd()
140 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
143 include_once(
'Services/Calendar/classes/class.ilCalendarSettings.php');
146 if ($settings->getEnableGroupMilestones())
148 $this->tpl->setCurrentBlock(
"new_ms");
150 $this->tpl->setVariable(
'H_NEW_MS_ALT',$this->lng->txt(
'cal_new_ms'));
151 $this->tpl->setVariable(
'NEW_MS_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'addMilestone'));
152 $this->tpl->parseCurrentBlock();
155 $this->tpl->setVariable(
'NAVIGATION',$navigation->getHTML());
159 $this->tpl->setVariable(
'HCOLSPAN',$colspan - 1);
162 $this->tpl->setVariable(
'H_NEW_APP_ALT',$this->lng->txt(
'cal_new_app'));
164 $this->tpl->setVariable(
'NEW_APP_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'add'));
165 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
168 $this->tpl->setVariable(
'TXT_TIME', $lng->txt(
"time"));
171 foreach($daily_apps as $event)
173 if($event[
'fullday'])
178 $this->tpl->setCurrentBlock(
'fullday_apps');
179 $this->tpl->setVariable(
'TXT_F_DAY', $lng->txt(
"cal_all_day"));
180 $this->tpl->setVariable(
'COLSPAN',$colspan - 1);
181 $this->tpl->parseCurrentBlock();
185 foreach($hours as $numeric => $hour)
187 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
188 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
189 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'hour',$numeric);
190 $this->tpl->setVariable(
'NEW_APP_HOUR_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'add'));
193 $this->tpl->setVariable(
'NEW_APP_ALT',$this->lng->txt(
'cal_new_app'));
196 foreach($hour[
'apps_start'] as $app)
201 if ($ilUser->prefs[
"screen_reader_optimization"])
203 $this->tpl->touchBlock(
'scrd_app_cell');
206 for($i = ($colspan - 1);$i > $hour[
'apps_num'];$i--)
208 $this->tpl->setCurrentBlock(
'empty_cell');
209 $this->tpl->setVariable(
'EMPTY_WIDTH',(100 / (
int) ($colspan - 1)).
'%');
210 $this->tpl->parseCurrentBlock();
212 $this->tpl->setCurrentBlock(
'time_row');
213 $this->tpl->setVariable(
'TIME',$hour[
'txt']);
214 $this->tpl->parseCurrentBlock();
228 $this->tpl->setCurrentBlock(
'panel_code');
229 $this->tpl->setVariable(
'NUM',$this->num_appointments);
230 $this->tpl->parseCurrentBlock();
233 if ($a_app[
'event']->isMilestone())
235 $this->tpl->setCurrentBlock(
'fullday_ms_icon');
236 $this->tpl->setVariable(
'ALT_FD_MS', $this->lng->txt(
"cal_milestone"));
238 $this->tpl->parseCurrentBlock();
241 $this->tpl->setCurrentBlock(
'fullday_app');
242 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentPanelGUI.php');
244 $this->tpl->setVariable(
'F_DAY_ID',$this->num_appointments);
246 $compl = ($a_app[
'event']->isMilestone() && $a_app[
'event']->getCompletion() > 0)
247 ?
" (".$a_app[
'event']->getCompletion().
"%)"
249 $this->tpl->setVariable(
'F_APP_TITLE',$a_app[
'event']->getPresentationTitle().$compl);
250 $color = $this->app_colors->getColorByAppointment($a_app[
'event']->getEntryId());
251 $this->tpl->setVariable(
'F_APP_BGCOLOR',$color);
254 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
255 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
256 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id',$a_app[
'event']->getEntryId());
257 $this->tpl->setVariable(
'F_APP_EDIT_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'edit'));
259 $this->tpl->parseCurrentBlock();
262 $this->num_appointments++;
275 $this->tpl->setCurrentBlock(
'panel_code');
276 $this->tpl->setVariable(
'NUM',$this->num_appointments);
277 $this->tpl->parseCurrentBlock();
279 if (!$ilUser->prefs[
"screen_reader_optimization"])
281 $this->tpl->setCurrentBlock(
'app');
285 $this->tpl->setCurrentBlock(
'scrd_app');
288 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentPanelGUI.php');
290 $this->tpl->setVariable(
'PANEL_NUM',$this->num_appointments);
292 $this->tpl->setVariable(
'APP_ROWSPAN',$a_app[
'rowspan']);
293 $this->tpl->setVariable(
'APP_TITLE',$a_app[
'event']->getPresentationTitle());
295 switch($this->user_settings->getTimeFormat())
307 if ($ilUser->prefs[
"screen_reader_optimization"])
309 switch($this->user_settings->getTimeFormat())
320 $title .= (
' '.$a_app[
'event']->getPresentationTitle());
322 $this->tpl->setVariable(
'APP_TITLE',
$title);
324 $color = $this->app_colors->getColorByAppointment($a_app[
'event']->getEntryId());
325 $this->tpl->setVariable(
'APP_BGCOLOR',$color);
328 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
329 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
330 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id',$a_app[
'event']->getEntryId());
331 $this->tpl->setVariable(
'APP_EDIT_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'edit'));
333 $this->tpl->parseCurrentBlock();
335 $this->num_appointments++;
347 for($i = $morning_aggr;$i <= $evening_aggr;$i++)
349 $hours[$i][
'apps_start'] = array();
350 $hours[$i][
'apps_num'] = 0;
352 switch($this->user_settings->getTimeFormat())
355 if ($morning_aggr > 0 && $i == $morning_aggr)
357 $hours[$i][
'txt'] = sprintf(
'%02d:00',0).
"-";
359 $hours[$i][
'txt'].= sprintf(
'%02d:00',$i);
360 if ($evening_aggr < 23 && $i == $evening_aggr)
362 $hours[$i][
'txt'].=
"-".sprintf(
'%02d:00',23);
367 if ($morning_aggr > 0 && $i == $morning_aggr)
369 $hours[$i][
'txt'] = date(
'h a',mktime(0,0,0,1,1,2000)).
"-";
371 $hours[$i][
'txt'] = date(
'h a',mktime($i,0,0,1,1,2000));
372 if ($evening_aggr < 23 && $i == $evening_aggr)
374 $hours[$i][
'txt'].=
"-".date(
'h a',mktime(23,0,0,1,1,2000));
381 foreach($daily_apps as $app)
391 if($app[
'start_info'][
'mday'] != $this->seed_info[
'mday'])
397 $start = $app[
'start_info'][
'hours'];
400 if($app[
'end_info'][
'mday'] != $this->seed_info[
'mday'])
404 elseif($app[
'start_info'][
'hours'] == $app[
'end_info'][
'hours'])
410 $end = $app[
'end_info'][
'hours'];
414 if ($ilUser->prefs[
"screen_reader_optimization"])
419 if (
$start < $morning_aggr)
423 if ($end <= $morning_aggr)
425 $end = $morning_aggr+1;
427 if (
$start > $evening_aggr)
431 if ($end > $evening_aggr+1)
433 $end = $evening_aggr+1;
441 for($i =
$start;$i < $end;$i++)
445 if (!$ilUser->prefs[
"screen_reader_optimization"])
447 $app[
'rowspan'] = $end -
$start;
453 $hours[$i][
'apps_start'][] = $app;
456 $hours[$i][
'apps_num']++;
474 foreach($hours as $hour)
476 $colspan = max($colspan,$hour[
'apps_num'] + 1);
480 if ($ilUser->prefs[
"screen_reader_optimization"])
485 return max($colspan,2);