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 $this->tpl =
new ilTemplate(
'tpl.week_view.html',
true,
true,
'Services/Calendar');
124 include_once(
'./Services/YUI/classes/class.ilYuiUtil.php');
130 $this->tpl->setVariable(
'NAVIGATION',$navigation->getHTML());
132 include_once(
'Services/Calendar/classes/class.ilCalendarSchedule.php');
134 $this->scheduler->addSubitemCalendars(
true);
135 $this->scheduler->calculate();
139 $all_fullday = array();
142 $daily_apps = $this->scheduler->getByDay($date,$this->timezone);
143 $hours = $this->
parseHourInfo($daily_apps,$date,$counter,$hours);
144 $this->weekdays[] = $date;
146 $all_fullday[] = $daily_apps;
157 $this->tpl->setCurrentBlock(
'day_header_row');
159 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$date->get(
IL_CAL_DATE));
160 $this->ctrl->setParameterByClass(
'ilcalendardaygui',
'seed',$date->get(
IL_CAL_DATE));
161 $this->tpl->setVariable(
'NEW_APP_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'add'));
162 $this->tpl->setVariable(
'DAY_VIEW_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendardaygui',
''));
163 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
164 $this->ctrl->clearParametersByClass(
'ilcalendardaygui');
167 $this->tpl->setVariable(
'NEW_APP_ALT',$this->lng->txt(
'cal_new_app'));
169 $this->tpl->setVariable(
'DAY_COLSPAN',max($colspans[$counter],1));
173 $this->tpl->parseCurrentBlock();
179 foreach($all_fullday as $daily_apps)
181 foreach($daily_apps as $event)
183 if($event[
'fullday'])
188 $this->tpl->setCurrentBlock(
'f_day_row');
189 $this->tpl->setVariable(
'COLSPAN',max($colspans[$counter],1));
190 $this->tpl->parseCurrentBlock();
194 $new_link_counter = 0;
195 foreach($hours as $num_hour => $hours_per_day)
197 foreach($hours_per_day as $num_day => $hour)
199 foreach($hour[
'apps_start'] as $app)
203 #echo "NUMDAY: ".$num_day;
204 #echo "COLAPANS: ".max($colspans[$num_day],1).'<br />';
205 $num_apps = $hour[
'apps_num'];
206 $colspan = max($colspans[$num_day],1);
210 if(!$hour[
'apps_num'])
212 $this->tpl->setCurrentBlock(
'new_app_link');
213 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->weekdays[$num_day]->
get(
IL_CAL_DATE));
214 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'hour',$num_hour);
215 $this->tpl->setVariable(
'DAY_NEW_APP_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'add'));
216 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
219 $this->tpl->setVariable(
'DAY_NEW_APP_ALT',$this->lng->txt(
'cal_new_app'));
220 $this->tpl->setVariable(
'DAY_NEW_ID',++$new_link_counter);
221 $this->tpl->parseCurrentBlock();
224 for($i = $colspan;$i > $hour[
'apps_num'];$i--)
226 $this->tpl->setCurrentBlock(
'day_cell');
227 if($i == ($hour[
'apps_num'] + 1))
229 $this->tpl->setVariable(
'TD_CLASS',
'calempty calrightborder');
230 #$this->tpl->setVariable('TD_STYLE',$add_style);
234 $this->tpl->setVariable(
'TD_CLASS',
'calempty');
235 #$this->tpl->setVariable('TD_STYLE',$add_style);
238 if(!$hour[
'apps_num'])
240 $this->tpl->setVariable(
'DAY_ID',$new_link_counter);
242 $this->tpl->setVariable(
'TD_ROWSPAN',1);
243 $this->tpl->parseCurrentBlock();
247 $this->tpl->setCurrentBlock(
'time_row');
248 $this->tpl->setVariable(
'TIME',$hour[
'txt']);
249 $this->tpl->parseCurrentBlock();
262 $this->tpl->setCurrentBlock(
'panel_code');
263 $this->tpl->setVariable(
'NUM',$this->num_appointments);
264 $this->tpl->parseCurrentBlock();
267 $this->tpl->setCurrentBlock(
'fullday_app');
269 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentPanelGUI.php');
271 $this->tpl->setVariable(
'F_DAY_ID',$this->num_appointments);
273 $this->tpl->setVariable(
'F_APP_TITLE',$a_app[
'event']->getPresentationTitle());
275 $color = $this->app_colors->getColorByAppointment($a_app[
'event']->getEntryId());
276 $this->tpl->setVariable(
'F_APP_BGCOLOR',$color);
279 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
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();
285 $this->num_appointments++;
296 $this->tpl->setCurrentBlock(
'panel_code');
297 $this->tpl->setVariable(
'NUM',$this->num_appointments);
298 $this->tpl->parseCurrentBlock();
301 $this->tpl->setCurrentBLock(
'not_empty');
303 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentPanelGUI.php');
306 $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
307 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id',$a_app[
'event']->getEntryId());
308 $this->tpl->setVariable(
'APP_EDIT_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'edit'));
310 if($a_app[
'event']->isFullDay())
312 $title = $a_app[
'event']->getPresentationTitle();
316 switch($this->user_settings->getTimeFormat())
328 $title .= (
' '.$a_app[
'event']->getPresentationTitle());
331 $this->tpl->setVariable(
'APP_TITLE',
$title);
333 $this->tpl->setVariable(
'LINK_NUM',$this->num_appointments);
334 $this->tpl->parseCurrentBlock();
336 $this->tpl->setCurrentBlock(
'day_cell');
337 $this->tpl->setVariable(
'DAY_CELL_NUM',$this->num_appointments);
338 $this->tpl->setVariable(
'TD_ROWSPAN',$a_app[
'rowspan']);
340 $color = $this->app_colors->getColorByAppointment($a_app[
'event']->getEntryId());
341 $style =
'background-color: '.$color.
';';
342 $style .= (
'color:'.ilCalendarUtil::calculateFontColor($color));
343 $this->tpl->setVariable(
'TD_STYLE',$style);
344 $this->tpl->setVariable(
'TD_CLASS',
'calevent');
345 $this->tpl->parseCurrentBlock();
347 $this->num_appointments++;
360 $morning_aggr = 7, $evening_aggr = 20)
362 for($i = $morning_aggr;$i <= $evening_aggr;$i++)
364 $hours[$i][$num_day][
'apps_start'] = array();
365 $hours[$i][$num_day][
'apps_num'] = 0;
366 switch($this->user_settings->getTimeFormat())
369 if ($morning_aggr > 0 && $i == $morning_aggr)
371 $hours[$i][$num_day][
'txt'] = sprintf(
'%02d:00',0).
"-";
373 $hours[$i][$num_day][
'txt'].= sprintf(
'%02d:00',$i);
374 if ($evening_aggr < 23 && $i == $evening_aggr)
376 $hours[$i][$num_day][
'txt'].=
"-".sprintf(
'%02d:00',23);
381 if ($morning_aggr > 0 && $i == $morning_aggr)
383 $hours[$i][$num_day][
'txt'] = date(
'h a',mktime(0,0,0,1,1,2000)).
"-";
385 $hours[$i][$num_day][
'txt'].= date(
'h a',mktime($i,0,0,1,1,2000));
386 if ($evening_aggr < 23 && $i == $evening_aggr)
388 $hours[$i][$num_day][
'txt'].=
"-".date(
'h a',mktime(23,0,0,1,1,2000));
397 foreach($daily_apps as $app)
405 if($app[
'start_info'][
'mday'] != $date_info[
'mday'])
411 $start = $app[
'start_info'][
'hours'];
414 if($app[
'end_info'][
'mday'] != $date_info[
'mday'])
418 elseif($app[
'start_info'][
'hours'] == $app[
'end_info'][
'hours'])
425 $end = $app[
'end_info'][
'hours'];
428 if ($start < $morning_aggr)
430 $start = $morning_aggr;
432 if ($end <= $morning_aggr)
434 $end = $morning_aggr+1;
436 if ($start > $evening_aggr)
438 $start = $evening_aggr;
440 if ($end > $evening_aggr+1)
442 $end = $evening_aggr+1;
450 for($i = $start;$i < $end;$i++)
454 $app[
'rowspan'] = $end - $start;
455 $hours[$i][$num_day][
'apps_start'][] = $app;
458 $hours[$i][$num_day][
'apps_num']++;
473 foreach($hours as $hour_num => $hours_per_day)
475 foreach($hours_per_day as $num_day => $hour)
477 $colspans[$num_day] = max($colspans[$num_day],$hour[
'apps_num']);