127 {
129
130
131
132 $raster = 15;
133 if($this->user_settings->getDayStart())
134 {
135
136 $morning_aggr = ($this->user_settings->getDayStart()-1)*60+(60-$raster);
137 }
138 else
139 {
140 $morning_aggr = 0;
141 }
142 $evening_aggr = $this->user_settings->getDayEnd()*60;
143
144
145 $this->tpl =
new ilTemplate(
'tpl.week_view.html',
true,
true,
'Services/Calendar');
146
147 include_once('./Services/YUI/classes/class.ilYuiUtil.php');
150
151
153 $this->tpl->setVariable('NAVIGATION',$navigation->getHTML());
154
155 if(isset(
$_GET[
"bkid"]))
156 {
157 $user_id =
$_GET[
"bkid"];
158 $disable_empty = true;
159 $no_add = true;
160 }
161 elseif(
$ilUser->getId() == ANONYMOUS_USER_ID)
162 {
164 $disable_empty = false;
165 $no_add = true;
166 }
167 else
168 {
170 $disable_empty = false;
171 $no_add = false;
172 }
173 include_once('Services/Calendar/classes/class.ilCalendarSchedule.php');
175 $this->scheduler->addSubitemCalendars(true);
176 $this->scheduler->calculate();
177
178 $counter = 0;
179 $hours = null;
180 $all_fullday = array();
182 {
183 $daily_apps = $this->scheduler->getByDay($date,$this->timezone);
184 $hours = $this->
parseHourInfo($daily_apps,$date,$counter,$hours,
185 $morning_aggr,
186 $evening_aggr,
187 $raster
188 );
189 $this->weekdays[] = $date;
190
191 $num_apps[$date->get(
IL_CAL_DATE)] = count($daily_apps);
192
193 $all_fullday[] = $daily_apps;
194 $counter++;
195 }
196
198
199 include_once('Services/Calendar/classes/class.ilCalendarSettings.php');
201
202 include_once "Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php";
203
204
205 $counter = 0;
207 {
209 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$date->get(
IL_CAL_DATE));
210 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'idate',$date->get(
IL_CAL_DATE));
211 $this->ctrl->setParameterByClass(
'ilcalendardaygui',
'seed',$date->get(
IL_CAL_DATE));
212
213 if(!$no_add)
214 {
215 $new_app_url = $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui','add');
216
217 if ($settings->getEnableGroupMilestones())
218 {
219 $new_ms_url = $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui','addMilestone');
220
221 $this->tpl->setCurrentBlock("new_ms");
222 $this->tpl->setVariable(
'DD_ID', $date->get(
IL_CAL_UNIX));
224 $this->tpl->setVariable('URL_DD_NEW_APP', $new_app_url);
225 $this->tpl->setVariable('TXT_DD_NEW_APP', $this->lng->txt('cal_new_app'));
226 $this->tpl->setVariable('URL_DD_NEW_MS', $new_ms_url);
227 $this->tpl->setVariable('TXT_DD_NEW_MS', $this->lng->txt('cal_new_ms'));
228 $this->tpl->parseCurrentBlock();
229 }
230 else
231 {
232 $this->tpl->setCurrentBlock("new_app");
233 $this->tpl->setVariable('NEW_APP_LINK',$new_app_url);
235
236 $this->tpl->parseCurrentBlock();
237 }
238
239 $this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
240 }
241
244
245 if(!$disable_empty || $num_apps[$date->get(
IL_CAL_DATE)] > 0)
246 {
247 $link = $this->ctrl->getLinkTargetByClass('ilcalendardaygui','');
248 $this->ctrl->clearParametersByClass('ilcalendardaygui');
249
250 $this->tpl->setCurrentBlock("day_view1_link");
251 $this->tpl->setVariable('HEADER_DATE',$daydate);
252 $this->tpl->setVariable('DAY_VIEW_LINK',$link);
253 $this->tpl->parseCurrentBlock();
254
255 $this->tpl->setCurrentBlock("day_view2_link");
256 $this->tpl->setVariable('DAYNAME',$dayname);
257 $this->tpl->setVariable('DAY_VIEW_LINK',$link);
258 $this->tpl->parseCurrentBlock();
259 }
260 else
261 {
262 $this->tpl->setCurrentBlock("day_view1_no_link");
263 $this->tpl->setVariable('HEADER_DATE',$daydate);
264 $this->tpl->parseCurrentBlock();
265
266 $this->tpl->setCurrentBlock("day_view2_no_link");
267 $this->tpl->setVariable('DAYNAME',$dayname);
268 $this->tpl->parseCurrentBlock();
269 }
270
271 $this->tpl->setCurrentBlock('day_header_row');
272 $this->tpl->setVariable('DAY_COLSPAN',max($colspans[$counter],1));
273 $this->tpl->parseCurrentBlock();
274
275 $counter++;
276 }
277
278
279 $counter = 0;
280 foreach($all_fullday as $daily_apps)
281 {
282 foreach($daily_apps as $event)
283 {
284 if($event['fullday'])
285 {
287 }
288 }
289 $this->tpl->setCurrentBlock('f_day_row');
290 $this->tpl->setVariable('COLSPAN',max($colspans[$counter],1));
291 $this->tpl->parseCurrentBlock();
292 $counter++;
293 }
294 $this->tpl->setCurrentBlock('fullday_apps');
295 $this->tpl->setVariable(
'TXT_F_DAY',
$lng->txt(
"cal_all_day"));
296 $this->tpl->parseCurrentBlock();
297
298 $new_link_counter = 0;
299 foreach($hours as $num_hour => $hours_per_day)
300 {
301 $first = true;
302 foreach($hours_per_day as $num_day => $hour)
303 {
304 if($first)
305 {
306 if(!($num_hour%60) || ($num_hour == $morning_aggr && $morning_aggr) ||
307 ($num_hour == $evening_aggr && $evening_aggr))
308 {
309 $first = false;
310
311
312 if(($num_hour == $morning_aggr && $morning_aggr) ||
313 ($num_hour == $evening_aggr && $evening_aggr))
314 {
315 $this->tpl->setVariable('TIME_ROWSPAN', 1);
316 }
317
318 else
319 {
320 $this->tpl->setVariable('TIME_ROWSPAN', 60/$raster);
321 }
322
323 $this->tpl->setCurrentBlock('time_txt');
324
325 $this->tpl->setVariable('TIME',$hour['txt']);
326 $this->tpl->parseCurrentBlock();
327 }
328 }
329
330 foreach($hour['apps_start'] as $app)
331 {
333 }
334
335
336 if (
$ilUser->prefs[
"screen_reader_optimization"])
337 {
338 $this->tpl->setCurrentBlock('scrd_day_cell');
339 $this->tpl->setVariable('TD_CLASS','calstd');
340 $this->tpl->parseCurrentBlock();
341 }
342
343
344 #echo "NUMDAY: ".$num_day;
345 #echo "COLAPANS: ".max($colspans[$num_day],1).'<br />';
346 $num_apps = $hour['apps_num'];
347 $colspan = max($colspans[$num_day],1);
348
349
350
351 if(!$hour[
'apps_num'] && !
$ilUser->prefs[
"screen_reader_optimization"] && !$no_add)
352 {
353 $this->tpl->setCurrentBlock('new_app_link');
354 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'idate',$this->weekdays[$num_day]->
get(
IL_CAL_DATE));
355 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed',$this->seed->get(
IL_CAL_DATE));
356 $this->ctrl->setParameterByClass('ilcalendarappointmentgui','hour',floor($num_hour/60));
357 $this->tpl->setVariable('DAY_NEW_APP_LINK',$this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui','add'));
358 $this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
359
361 $this->tpl->setVariable('DAY_NEW_APP_ALT',$this->lng->txt('cal_new_app'));
362 $this->tpl->setVariable('DAY_NEW_ID',++$new_link_counter);
363 $this->tpl->parseCurrentBlock();
364 }
365
366 for($i = $colspan;$i > $hour['apps_num'];$i--)
367 {
368 if (
$ilUser->prefs[
"screen_reader_optimization"])
369 {
370 continue;
371 }
372 $this->tpl->setCurrentBlock('day_cell');
373
374
375 $empty_border = '';
376 if($num_hour%60 == 60-$raster ||
377 ($num_hour == $morning_aggr && $morning_aggr) ||
378 ($num_hour == $evening_aggr && $evening_aggr))
379 {
380 $empty_border = ' calempty_border';
381 }
382
383 if($i == ($hour['apps_num'] + 1))
384 {
385 $this->tpl->setVariable('TD_CLASS','calempty calrightborder'.$empty_border);
386 #$this->tpl->setVariable('TD_STYLE',$add_style);
387 }
388 else
389 {
390 $this->tpl->setVariable('TD_CLASS','calempty'.$empty_border);
391 #$this->tpl->setVariable('TD_STYLE',$add_style);
392 }
393
394 if(!$hour['apps_num'])
395 {
396 $this->tpl->setVariable('DAY_ID',$new_link_counter);
397 }
398 $this->tpl->setVariable('TD_ROWSPAN',1);
399 $this->tpl->parseCurrentBlock();
400 }
401 }
402
403 $this->tpl->touchBlock('time_row');
404 }
405
406 $this->tpl->setVariable(
"TXT_TIME",
$lng->txt(
"time"));
407 }
Represents a list of calendar appointments (including recurring events) for a specific user in a give...
static _getInstance()
get singleton instance
static _numericDayToString($a_day, $a_long=true)
get
static _buildWeekDayList($a_day, $a_weekstart)
build week day list
static _numericMonthToString($a_month, $a_long=true)
numeric month to string
showFulldayAppointment($a_app)
show fullday appointment
calculateColspans($hours)
calculate colspan
showAppointment($a_app)
show appointment
parseHourInfo($daily_apps, $date, $num_day, $hours=null, $morning_aggr, $evening_aggr, $raster)
calculate overlapping hours
static get($a_glyph, $a_text="")
Get glyph html.
special template class to simplify handling of ITX/PEAR
static initDragDrop()
Init YUI Drag and Drop.
static initPanel($a_resize=false)
Init yui panel.