34 include_once(
'Services/Calendar/classes/class.ilDate.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 $time = microtime(
true);
104 $cmd = $this->ctrl->getCmd(
"show");
106 $tpl->setContent($this->tpl->get());
107 #echo "Zeit: ".(microtime(true) - $time);
122 global $ilUser,
$lng;
124 $this->tpl =
new ilTemplate(
'tpl.week_view.html',
true,
true,
'Services/Calendar');
126 include_once(
'./Services/YUI/classes/class.ilYuiUtil.php');
132 $this->tpl->setVariable(
'NAVIGATION',$navigation->getHTML());
134 include_once(
'Services/Calendar/classes/class.ilCalendarSchedule.php');
136 $this->scheduler->addSubitemCalendars(
true);
137 $this->scheduler->calculate();
141 $all_fullday = array();
144 $daily_apps = $this->scheduler->getByDay($date,$this->timezone);
145 $hours = $this->
parseHourInfo($daily_apps,$date,$counter,$hours,
146 $this->user_settings->getDayStart(),
147 $this->user_settings->getDayEnd()
149 $this->weekdays[] = $date;
151 $all_fullday[] = $daily_apps;
157 include_once(
'Services/Calendar/classes/class.ilCalendarSettings.php');
165 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$date->get(
IL_CAL_DATE));
166 $this->ctrl->setParameterByClass(
'ilcalendardaygui',
'seed',$date->get(
IL_CAL_DATE));
168 if ($settings->getEnableGroupMilestones())
170 $this->tpl->setCurrentBlock(
"new_ms");
172 $this->tpl->setVariable(
'H_NEW_MS_ALT', $this->lng->txt(
'cal_new_ms'));
173 $this->tpl->setVariable(
'NEW_MS_LINK', $this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'addMilestone'));
174 $this->tpl->parseCurrentBlock();
177 $this->tpl->setCurrentBlock(
'day_header_row');
178 $this->tpl->setVariable(
'NEW_APP_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'add'));
179 $this->tpl->setVariable(
'DAY_VIEW_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendardaygui',
''));
180 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
181 $this->ctrl->clearParametersByClass(
'ilcalendardaygui');
184 $this->tpl->setVariable(
'NEW_APP_ALT',$this->lng->txt(
'cal_new_app'));
186 $this->tpl->setVariable(
'DAY_COLSPAN',max($colspans[$counter],1));
190 $this->tpl->parseCurrentBlock();
196 foreach($all_fullday as $daily_apps)
198 foreach($daily_apps as $event)
200 if($event[
'fullday'])
205 $this->tpl->setCurrentBlock(
'f_day_row');
206 $this->tpl->setVariable(
'COLSPAN',max($colspans[$counter],1));
207 $this->tpl->parseCurrentBlock();
210 $this->tpl->setCurrentBlock(
'fullday_apps');
211 $this->tpl->setVariable(
'TXT_F_DAY', $lng->txt(
"cal_all_day"));
212 $this->tpl->parseCurrentBlock();
214 $new_link_counter = 0;
215 foreach($hours as $num_hour => $hours_per_day)
217 foreach($hours_per_day as $num_day => $hour)
219 foreach($hour[
'apps_start'] as $app)
225 if ($ilUser->prefs[
"screen_reader_optimization"])
227 $this->tpl->setCurrentBlock(
'scrd_day_cell');
228 $this->tpl->setVariable(
'TD_CLASS',
'calstd');
229 $this->tpl->parseCurrentBlock();
233 #echo "NUMDAY: ".$num_day;
234 #echo "COLAPANS: ".max($colspans[$num_day],1).'<br />';
235 $num_apps = $hour[
'apps_num'];
236 $colspan = max($colspans[$num_day],1);
240 if(!$hour[
'apps_num'] && !$ilUser->prefs[
"screen_reader_optimization"])
242 $this->tpl->setCurrentBlock(
'new_app_link');
243 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->weekdays[$num_day]->
get(
IL_CAL_DATE));
244 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'hour',$num_hour);
245 $this->tpl->setVariable(
'DAY_NEW_APP_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'add'));
246 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
249 $this->tpl->setVariable(
'DAY_NEW_APP_ALT',$this->lng->txt(
'cal_new_app'));
250 $this->tpl->setVariable(
'DAY_NEW_ID',++$new_link_counter);
251 $this->tpl->parseCurrentBlock();
254 for($i = $colspan;$i > $hour[
'apps_num'];$i--)
256 if ($ilUser->prefs[
"screen_reader_optimization"])
260 $this->tpl->setCurrentBlock(
'day_cell');
262 if($i == ($hour[
'apps_num'] + 1))
264 $this->tpl->setVariable(
'TD_CLASS',
'calempty calrightborder');
265 #$this->tpl->setVariable('TD_STYLE',$add_style);
269 $this->tpl->setVariable(
'TD_CLASS',
'calempty');
270 #$this->tpl->setVariable('TD_STYLE',$add_style);
273 if(!$hour[
'apps_num'])
275 $this->tpl->setVariable(
'DAY_ID',$new_link_counter);
277 $this->tpl->setVariable(
'TD_ROWSPAN',1);
278 $this->tpl->parseCurrentBlock();
282 $this->tpl->setCurrentBlock(
'time_row');
283 $this->tpl->setVariable(
'TIME',$hour[
'txt']);
284 $this->tpl->parseCurrentBlock();
287 $this->tpl->setVariable(
"TXT_TIME", $lng->txt(
"time"));
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');
314 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentPanelGUI.php');
316 $this->tpl->setVariable(
'F_DAY_ID',$this->num_appointments);
318 $compl = ($a_app[
'event']->isMilestone() && $a_app[
'event']->getCompletion() > 0)
319 ?
" (".$a_app[
'event']->getCompletion().
"%)"
322 $this->tpl->setVariable(
'F_APP_TITLE',$a_app[
'event']->getPresentationTitle().$compl);
324 $color = $this->app_colors->getColorByAppointment($a_app[
'event']->getEntryId());
325 $this->tpl->setVariable(
'F_APP_BGCOLOR',$color);
328 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
329 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id',$a_app[
'event']->getEntryId());
330 $this->tpl->setVariable(
'F_APP_EDIT_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'edit'));
332 $this->tpl->parseCurrentBlock();
334 $this->num_appointments++;
347 $this->tpl->setCurrentBlock(
'panel_code');
348 $this->tpl->setVariable(
'NUM',$this->num_appointments);
349 $this->tpl->parseCurrentBlock();
351 if (!$ilUser->prefs[
"screen_reader_optimization"])
353 $this->tpl->setCurrentBLock(
'not_empty');
357 $this->tpl->setCurrentBLock(
'scrd_not_empty');
360 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentPanelGUI.php');
363 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
364 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id',$a_app[
'event']->getEntryId());
365 $this->tpl->setVariable(
'APP_EDIT_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'edit'));
367 if($a_app[
'event']->isFullDay())
369 $title = $a_app[
'event']->getPresentationTitle();
373 switch($this->user_settings->getTimeFormat())
384 if ($ilUser->prefs[
"screen_reader_optimization"])
386 switch($this->user_settings->getTimeFormat())
399 $title .= (
' '.$a_app[
'event']->getPresentationTitle());
402 $this->tpl->setVariable(
'APP_TITLE',
$title);
404 $this->tpl->setVariable(
'LINK_NUM',$this->num_appointments);
406 $color = $this->app_colors->getColorByAppointment($a_app[
'event']->getEntryId());
407 $style =
'background-color: '.$color.
';';
408 $style .= (
'color:'.ilCalendarUtil::calculateFontColor($color));
410 if (!$ilUser->prefs[
"screen_reader_optimization"])
413 $this->tpl->parseCurrentBlock();
415 $this->tpl->setCurrentBlock(
'day_cell');
417 if (!$ilUser->prefs[
"screen_reader_optimization"])
419 $this->tpl->setVariable(
'DAY_CELL_NUM',$this->num_appointments);
420 $this->tpl->setVariable(
'TD_ROWSPAN',$a_app[
'rowspan']);
421 $this->tpl->setVariable(
'TD_STYLE',$style);
422 $this->tpl->setVariable(
'TD_CLASS',
'calevent');
425 $this->tpl->parseCurrentBlock();
430 $this->tpl->setVariable(
'DIV_STYLE',$style);
431 $this->tpl->parseCurrentBlock();
434 $this->num_appointments++;
447 $morning_aggr = 7, $evening_aggr = 20)
451 for($i = $morning_aggr;$i <= $evening_aggr;$i++)
453 $hours[$i][$num_day][
'apps_start'] = array();
454 $hours[$i][$num_day][
'apps_num'] = 0;
455 switch($this->user_settings->getTimeFormat())
458 if ($morning_aggr > 0 && $i == $morning_aggr)
460 $hours[$i][$num_day][
'txt'] = sprintf(
'%02d:00',0).
"-";
462 $hours[$i][$num_day][
'txt'].= sprintf(
'%02d:00',$i);
463 if ($evening_aggr < 23 && $i == $evening_aggr)
465 $hours[$i][$num_day][
'txt'].=
"-".sprintf(
'%02d:00',23);
470 if ($morning_aggr > 0 && $i == $morning_aggr)
472 $hours[$i][$num_day][
'txt'] = date(
'h a',mktime(0,0,0,1,1,2000)).
"-";
474 $hours[$i][$num_day][
'txt'].= date(
'h a',mktime($i,0,0,1,1,2000));
475 if ($evening_aggr < 23 && $i == $evening_aggr)
477 $hours[$i][$num_day][
'txt'].=
"-".date(
'h a',mktime(23,0,0,1,1,2000));
486 foreach($daily_apps as $app)
494 if($app[
'start_info'][
'mday'] != $date_info[
'mday'])
500 $start = $app[
'start_info'][
'hours'];
503 if($app[
'end_info'][
'mday'] != $date_info[
'mday'])
507 elseif($app[
'start_info'][
'hours'] == $app[
'end_info'][
'hours'])
514 $end = $app[
'end_info'][
'hours'];
518 if ($ilUser->prefs[
"screen_reader_optimization"])
523 if (
$start < $morning_aggr)
527 if ($end <= $morning_aggr)
529 $end = $morning_aggr+1;
531 if (
$start > $evening_aggr)
535 if ($end > $evening_aggr+1)
537 $end = $evening_aggr+1;
545 for($i =
$start;$i < $end;$i++)
549 if (!$ilUser->prefs[
"screen_reader_optimization"])
551 $app[
'rowspan'] = $end -
$start;
557 $hours[$i][$num_day][
'apps_start'][] = $app;
560 $hours[$i][$num_day][
'apps_num']++;
577 foreach($hours as $hour_num => $hours_per_day)
579 foreach($hours_per_day as $num_day => $hour)
581 $colspans[$num_day] = max($colspans[$num_day],$hour[
'apps_num']);
584 if ($ilUser->prefs[
"screen_reader_optimization"])
586 $colspans[$num_day] = 1;