ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
class.ilCalendarBlockGUI.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2008 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
24include_once("Services/Block/classes/class.ilBlockGUI.php");
25include_once './Services/Calendar/classes/class.ilCalendarCategories.php';
26
41{
42 public $ctrl = null;
43 protected $mode;
44 protected $display_mode;
45
46 static $block_type = "cal";
47 static $st_data;
48
54 function ilCalendarBlockGUI($a_skip_init = false)
55 {
56 global $ilCtrl, $lng, $ilUser, $tpl, $ilHelp;
57
58 parent::ilBlockGUI();
59
60 $this->ctrl = $ilCtrl;
61
62 $lng->loadLanguageModule("dateplaner");
63 $ilHelp->addHelpSection("cal_block");
64
65 include_once("./Services/News/classes/class.ilNewsItem.php");
66
67 $ilCtrl->saveParameter($this, 'bkid');
68
69 if (!$a_skip_init)
70 {
71 $this->initCategories();
72 $this->setBlockId($ilCtrl->getContextObjId());
73 }
74
75 $this->setLimit(5); // @todo: needed?
76
77 // alex: original detail level 1 did not work anymore
79 $this->setEnableNumInfo(false);
80
81 if(!isset($_GET["bkid"]))
82 {
83 $title = $lng->txt("calendar");
84 }
85 else
86 {
87 $title = $lng->txt("cal_consultation_hours_for")." ".ilObjUser::_lookupFullname($_GET["bkid"]);
88 }
89
90 $this->setTitle($title);
91 //$this->setData($data);
92 $this->allow_moving = false;
93 //$this->handleView();
94
95 include_once('Services/Calendar/classes/class.ilDate.php');
96 include_once('Services/Calendar/classes/class.ilCalendarUserSettings.php');
97
98 $seed_str = "";
99 if ((!isset($_GET["seed"]) || $_GET["seed"] == "") &&
100 isset($_SESSION["il_cal_block_".$this->getBlockType()."_".$this->getBlockId()."_seed"]))
101 {
102 $seed_str = $_SESSION["il_cal_block_".$this->getBlockType()."_".$this->getBlockId()."_seed"];
103 }
104 else if (isset($_GET["seed"]))
105 {
106 $seed_str = $_GET["seed"];
107 }
108
109 if (isset($_GET["seed"]) && $_GET["seed"] != "")
110 {
111 $_SESSION["il_cal_block_".$this->getBlockType()."_".$this->getBlockId()."_seed"]
112 = $_GET["seed"];
113 }
114
115 if ($seed_str == "")
116 {
117 $this->seed = new ilDate(time(),IL_CAL_UNIX); // @todo: check this
118 }
119 else
120 {
121 $this->seed = new ilDate($seed_str,IL_CAL_DATE); // @todo: check this
122 }
123 $this->user_settings = ilCalendarUserSettings::_getInstanceByUserId($ilUser->getId());
124
125 $tpl->addCSS("./Services/Calendar/css/calendar.css");
126 // @todo: this must work differently...
127 $tpl->addCSS("./Services/Calendar/templates/default/delos.css");
128
129 $mode = $ilUser->getPref("il_pd_cal_mode");
130 $this->display_mode = $mode ? $mode : "mmon";
131 }
132
138 static function getBlockType()
139 {
140 return self::$block_type;
141 }
142
148 static function isRepositoryObject()
149 {
150 return false;
151 }
152
156 static function getScreenMode()
157 {
158 global $ilCtrl;
159
160 $cmd_class = $ilCtrl->getCmdClass();
161
162 if ($cmd_class == "ilcalendarappointmentgui" ||
163 $cmd_class == "ilcalendardaygui" ||
164 $cmd_class == "ilcalendarweekgui" ||
165 $cmd_class == "ilcalendarmonthgui" ||
166 $cmd_class == "ilcalendarinboxgui" ||
167 $cmd_class == "ilconsultationhoursgui" ||
168 $_GET['cmd'] == 'showCalendarSubscription')
169 {
170 return IL_SCREEN_CENTER;
171 }
172
173 switch($ilCtrl->getCmd())
174 {
175 case "kkk":
176 // return IL_SCREEN_CENTER;
177 // return IL_SCREEN_FULL;
178
179 default:
180 //return IL_SCREEN_SIDE;
181 break;
182 }
183 }
184
188 function &executeCommand()
189 {
190 global $ilCtrl,$ilTabs,$ilUser;
191
192 $next_class = $ilCtrl->getNextClass();
193 $cmd = $ilCtrl->getCmd("getHTML");
194
195 $this->setSubTabs();
196
197 switch ($next_class)
198 {
199 case "ilcalendarappointmentgui":
200 include_once('./Services/Calendar/classes/class.ilCalendarAppointmentGUI.php');
201 $app_gui = new ilCalendarAppointmentGUI($this->seed,$this->seed);
202 $ilCtrl->forwardCommand($app_gui);
203 break;
204
205 case "ilcalendardaygui":
206 $ilTabs->setSubTabActive('app_day');
207 include_once('./Services/Calendar/classes/class.ilCalendarDayGUI.php');
208 $day_gui = new ilCalendarDayGUI($this->seed);
209 $ilCtrl->forwardCommand($day_gui);
210 break;
211
212 case "ilcalendarweekgui":
213 $ilTabs->setSubTabActive('app_week');
214 include_once('./Services/Calendar/classes/class.ilCalendarWeekGUI.php');
215 $week_gui = new ilCalendarWeekGUI($this->seed);
216 $ilCtrl->forwardCommand($week_gui);
217 break;
218
219 case "ilcalendarmonthgui":
220 $ilTabs->setSubTabActive('app_month');
221 include_once('./Services/Calendar/classes/class.ilCalendarMonthGUI.php');
222 $month_gui = new ilCalendarMonthGUI($this->seed);
223 $ilCtrl->forwardCommand($month_gui);
224 break;
225
226 case "ilcalendarinboxgui":
227 include_once('./Services/Calendar/classes/class.ilCalendarInboxGUI.php');
228 $inbox = new ilCalendarInboxGUI($this->seed);
229 $ilCtrl->forwardCommand($inbox);
230 break;
231
232 case "ilconsultationhoursgui":
233 include_once('./Services/Calendar/classes/ConsultationHours/class.ilConsultationHoursGUI.php');
234 $hours = new ilConsultationHoursGUI($this->seed);
235 $ilCtrl->forwardCommand($hours);
236 break;
237
238 default:
239 return $this->$cmd();
240 }
241 }
242
248 public function setEnableEdit($a_enable_edit = 0)
249 {
250 $this->enable_edit = $a_enable_edit;
251 }
252
258 public function getEnableEdit()
259 {
260 return $this->enable_edit;
261 }
262
267 {
268 // alex: changed from > 1 to > 0 - original detail level 1 did not work anymore
269 if ($this->getCurrentDetailLevel() > 0 && $this->display_mode != "mmon")
270 {
271 $this->setColSpan(1);
272 $this->tpl->addBlockFile("BLOCK_ROW", "block_row","tpl.pd_event_list.html", "Services/Calendar");
273
275 }
276 else
277 {
278 // alex: changed from > 1 to > 0 - original detail level 1 did not work anymore
279 if ($this->getCurrentDetailLevel() > 0)
280 {
281 $tpl = new ilTemplate("tpl.calendar_block.html", true, true,
282 "Services/Calendar");
283
284 $this->addMiniMonth($tpl);
285 $this->setDataSection($tpl->get());
286 }
287 else
288 {
289 $this->setDataSection($this->getOverview());
290 }
291 }
292 }
293
298 function addMiniMonth($a_tpl)
299 {
300 global $ilCtrl, $lng,$ilUser;
301
302 // weekdays
303 include_once('Services/Calendar/classes/class.ilCalendarUtil.php');
304 $a_tpl->setCurrentBlock('month_header_col');
305 $a_tpl->setVariable('TXT_WEEKDAY', $lng->txt("cal_week_abbrev"));
306 $a_tpl->parseCurrentBlock();
307 for($i = (int) $this->user_settings->getWeekStart();$i < (7 + (int) $this->user_settings->getWeekStart());$i++)
308 {
309 $a_tpl->setCurrentBlock('month_header_col');
310 $a_tpl->setVariable('TXT_WEEKDAY',ilCalendarUtil::_numericDayToString($i,false));
311 $a_tpl->parseCurrentBlock();
312 }
313
314 if(isset($_GET["bkid"]))
315 {
316 $user_id = $_GET["bkid"];
317 $disable_empty = true;
318 }
319 else
320 {
321 $user_id = $ilUser->getId();
322 $disable_empty = false;
323 }
324 include_once('Services/Calendar/classes/class.ilCalendarSchedule.php');
325 $this->scheduler = new ilCalendarSchedule($this->seed,ilCalendarSchedule::TYPE_MONTH,$user_id);
326 $this->scheduler->addSubitemCalendars(true);
327 $this->scheduler->calculate();
328
329 $counter = 0;
330 foreach(ilCalendarUtil::_buildMonthDayList($this->seed->get(IL_CAL_FKT_DATE,'m'),
331 $this->seed->get(IL_CAL_FKT_DATE,'Y'),
332 $this->user_settings->getWeekStart())->get() as $date)
333 {
334 $counter++;
335
336 $events = $this->scheduler->getByDay($date,$ilUser->getTimeZone());
337 $has_events = (bool)count($events);
338 if($has_events || !$disable_empty)
339 {
340 $a_tpl->setCurrentBlock('month_col_link');
341 }
342 else
343 {
344 $a_tpl->setCurrentBlock('month_col_no_link');
345 }
346
347 if($disable_empty)
348 {
349 if(!$has_events)
350 {
351 $a_tpl->setVariable('DAY_CLASS','calminiinactive');
352 }
353 else
354 {
355 $week_has_events = true;
356 include_once 'Services/Booking/classes/class.ilBookingEntry.php';
357 foreach($events as $event)
358 {
359 $booking = new ilBookingEntry($event['event']->getContextId());
360 if($booking->hasBooked($event['event']->getEntryId()))
361 {
362 $a_tpl->setVariable('DAY_CLASS','calminiapp');
363 break;
364 }
365 }
366 }
367 }
368 elseif($has_events)
369 {
370 $week_has_events = true;
371 $a_tpl->setVariable('DAY_CLASS','calminiapp');
372 }
373
374
375 $day = $date->get(IL_CAL_FKT_DATE,'j');
376 $month = $date->get(IL_CAL_FKT_DATE,'n');
377
378 $month_day = $day;
379
380 $ilCtrl->clearParametersByClass('ilcalendardaygui');
381 $ilCtrl->setParameterByClass('ilcalendardaygui','seed',$date->get(IL_CAL_DATE));
382 $a_tpl->setVariable('OPEN_DAY_VIEW', $ilCtrl->getLinkTargetByClass('ilcalendardaygui',''));
383 $ilCtrl->clearParametersByClass('ilcalendardaygui');
384
385 $a_tpl->setVariable('MONTH_DAY',$month_day);
386
387 $a_tpl->parseCurrentBlock();
388
389
390 $a_tpl->setCurrentBlock('month_col');
391
392 include_once('./Services/Calendar/classes/class.ilCalendarUtil.php');
393 if(ilCalendarUtil::_isToday($date))
394 {
395 $a_tpl->setVariable('TD_CLASS','calminitoday');
396 }
397 #elseif(ilDateTime::_equals($date,$this->seed,IL_CAL_DAY))
398 #{
399 # $a_tpl->setVariable('TD_CLASS','calmininow');
400 #}
401 elseif(ilDateTime::_equals($date,$this->seed,IL_CAL_MONTH))
402 {
403 $a_tpl->setVariable('TD_CLASS','calministd');
404 }
405 elseif(ilDateTime::_before($date,$this->seed,IL_CAL_MONTH))
406 {
407 $a_tpl->setVariable('TD_CLASS','calminiprev');
408 }
409 else
410 {
411 $a_tpl->setVariable('TD_CLASS','calmininext');
412 }
413
414 $a_tpl->parseCurrentBlock();
415
416
417 if($counter and !($counter % 7))
418 {
419 if(!$disable_empty || $week_has_events)
420 {
421 $a_tpl->setCurrentBlock('month_row_link');
422 $ilCtrl->clearParametersByClass('ilcalendarweekgui');
423 $ilCtrl->setParameterByClass('ilcalendarweekgui','seed',$date->get(IL_CAL_DATE));
424 $a_tpl->setVariable('OPEN_WEEK_VIEW', $ilCtrl->getLinkTargetByClass('ilcalendarweekgui',''));
425 $ilCtrl->clearParametersByClass('ilcalendarweekgui');
426 }
427 else
428 {
429 $a_tpl->setCurrentBlock('month_row_no_link');
430 $a_tpl->setVariable('WEEK_CLASS', 'calminiinactive');
431 }
432 $a_tpl->setVariable('WEEK',
433 $date->get(IL_CAL_FKT_DATE,'W'));
434 $a_tpl->parseCurrentBlock();
435
436 $a_tpl->setCurrentBlock('month_row');
437 $a_tpl->setVariable('TD_CLASS','calminiweek');
438 $a_tpl->parseCurrentBlock();
439
440 $week_has_events = false;
441 }
442 }
443 $a_tpl->setCurrentBlock('mini_month');
444 $a_tpl->setVariable('TXT_MONTH_OVERVIEW', $lng->txt("cal_month_overview"));
445 $a_tpl->setVariable('TXT_MONTH',
446 $lng->txt('month_'.$this->seed->get(IL_CAL_FKT_DATE,'m').'_long').
447 ' '.$this->seed->get(IL_CAL_FKT_DATE,'Y'));
448 $myseed = clone($this->seed);
449 $ilCtrl->setParameterByClass('ilcalendarmonthgui','seed',$myseed->get(IL_CAL_DATE));
450 $a_tpl->setVariable('OPEN_MONTH_VIEW',$ilCtrl->getLinkTargetByClass('ilcalendarmonthgui',''));
451
452 $myseed->increment(ilDateTime::MONTH, -1);
453 $ilCtrl->setParameter($this,'seed',$myseed->get(IL_CAL_DATE));
454
455 $a_tpl->setVariable('BL_TYPE', $this->getBlockType());
456 $a_tpl->setVariable('BL_ID', $this->getBlockId());
457
458 $a_tpl->setVariable('PREV_MONTH',
459 $ilCtrl->getLinkTarget($this, "setSeed"));
460 $a_tpl->setVariable('PREV_MONTH_ASYNC',
461 $ilCtrl->getLinkTarget($this, "setSeed", "", true));
462
463 $myseed->increment(ilDateTime::MONTH, 2);
464 $ilCtrl->setParameter($this,'seed',$myseed->get(IL_CAL_DATE));
465 $a_tpl->setVariable('NEXT_MONTH',
466 $ilCtrl->getLinkTarget($this, "setSeed"));
467 $a_tpl->setVariable('NEXT_MONTH_ASYNC',
468 $ilCtrl->getLinkTarget($this, "setSeed", "", true));
469
470 $ilCtrl->setParameter($this, 'seed', "");
471 $a_tpl->parseCurrentBlock();
472 }
473
477 function getHTML()
478 {
479 global $ilCtrl, $lng, $ilUser,$ilAccess;
480
481 if ($this->getCurrentDetailLevel() == 0)
482 {
483 return "";
484 }
485
486 // add edit commands
487 #if ($this->getEnableEdit())
488
491 {
492 include_once("./Services/News/classes/class.ilRSSButtonGUI.php");
493 $this->addBlockCommand(
494 $this->ctrl->getLinkTarget($this,'showCalendarSubscription'),
495 $lng->txt('ical_export'),
497 );
498 }
499
500
502 {
503 if(!isset($_GET["bkid"]))
504 {
505 if($ilAccess->checkAccess('edit_event','',(int) $_GET['ref_id']))
506 {
507 $ilCtrl->setParameter($this, "add_mode", "block");
508 $this->addBlockCommand(
509 $ilCtrl->getLinkTargetByClass("ilCalendarAppointmentGUI",
510 "add"),
511 $lng->txt("add_appointment"));
512 $ilCtrl->setParameter($this, "add_mode", "");
513 }
514
515 global $ilObjDataCache;
516
517 include_once "Modules/Course/classes/class.ilCourseParticipants.php";
518 $obj_id = $ilObjDataCache->lookupObjId((int) $_GET['ref_id']);
519 $participants = ilCourseParticipants::_getInstanceByObjId($obj_id);
520 $users = array_unique(array_merge($participants->getTutors(), $participants->getAdmins()));
521 //$users = $participants->getParticipants();
522 include_once 'Services/Booking/classes/class.ilBookingEntry.php';
523 $users = ilBookingEntry::lookupBookableUsersForObject($obj_id,$users);
524 foreach($users as $user_id)
525 {
526 if(!isset($_GET["bkid"]))
527 {
528 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
529 $now = new ilDateTime(time(), IL_CAL_UNIX);
530
531 // default to last booking entry
532 $appointments = ilConsultationHourAppointments::getAppointments($user_id);
533 $next_app = end($appointments);
534 reset($appointments);
535
536 foreach($appointments as $entry)
537 {
538 // find next entry
539 if(ilDateTime::_before($entry->getStart(), $now, IL_CAL_DAY))
540 {
541 continue;
542 }
543 include_once 'Services/Booking/classes/class.ilBookingEntry.php';
544 $booking_entry = new ilBookingEntry($entry->getContextId());
545 if(!$booking_entry->isAppointmentBookableForUser($entry->getEntryId(), $GLOBALS['ilUser']->getId()))
546 {
547 continue;
548 }
549 $next_app = $entry;
550 break;
551 }
552
553 $ilCtrl->setParameter($this, "bkid", $user_id);
554 if($next_app)
555 {
556 $ilCtrl->setParameter(
557 $this,
558 'seed',
559 (string) $next_app->getStart()->get(IL_CAL_DATE)
560 );
561 }
562
563 $this->addBlockCommand(
564 $ilCtrl->getLinkTargetByClass(
565 "ilCalendarMonthGUI",
566 ""),
567 $lng->txt("cal_consultation_hours_for").' '. ilObjUser::_lookupFullname($user_id)
568 );
569
570 $this->cal_footer[] = array(
571 'link' => $ilCtrl->getLinkTargetByClass('ilCalendarMonthGUI',''),
572 'txt' => $lng->txt("cal_consultation_hours_for").' '.ilObjUser::_lookupFullname($user_id)
573 );
574
575 }
576 }
577 $ilCtrl->setParameter($this, "bkid", "");
578 $ilCtrl->setParameter($this, 'seed', '');
579 }
580 else
581 {
582 $ilCtrl->setParameter($this, "bkid", "");
583 $this->addBlockCommand(
584 $ilCtrl->getLinkTarget($this),
585 $lng->txt("back"));
586 $ilCtrl->setParameter($this, "bkid", (int)$_GET["bkid"]);
587 }
588 }
589
590 if ($this->getProperty("settings") == true)
591 {
592 $this->addBlockCommand(
593 $ilCtrl->getLinkTarget($this, "editSettings"),
594 $lng->txt("settings"));
595 }
596
597 $ilCtrl->setParameterByClass("ilcolumngui", "seed", isset($_GET["seed"]) ? $_GET["seed"] : "");
598 $ret = parent::getHTML();
599 $ilCtrl->setParameterByClass("ilcolumngui", "seed", "");
600
601 return $ret;
602 }
603
607 function getOverview()
608 {
609 global $ilUser, $lng, $ilCtrl;
610
611 include_once('./Services/Calendar/classes/class.ilCalendarSchedule.php');
612 $schedule = new ilCalendarSchedule($this->seed,ilCalendarSchedule::TYPE_INBOX);
613 $events = $schedule->getChangedEvents(true);
614
615 $ilCtrl->setParameterByClass('ilcalendarinboxgui', 'changed', 1);
616 $link = '<a href='.$ilCtrl->getLinkTargetByClass('ilcalendarinboxgui','').'>';
617 $ilCtrl->setParameterByClass('ilcalendarinboxgui', 'changed', '');
618 $text = '<div class="small">'.((int) count($events))." ".$lng->txt("cal_changed_events_header")."</div>";
619 $end_link = '</a>';
620
621 return $link.$text.$end_link;
622 }
623
624 function addCloseCommand($a_content_block)
625 {
626 global $lng, $ilCtrl;
627
628 $a_content_block->addHeaderCommand($ilCtrl->getParentReturn($this),
629 $lng->txt("close"), true);
630 }
631
639 protected function initCategories()
640 {
642
643 include_once('./Services/Calendar/classes/class.ilCalendarCategories.php');
644
645 if(!isset($_GET['bkid']))
646 {
648 }
649 else
650 {
651 // display consultation hours only (in course/group)
652 ilCalendarCategories::_getInstance()->setCHUserId((int) $_GET['bkid']);
654 }
655 }
656
662 protected function setSubTabs()
663 {
664 global $ilTabs;
665
666 $ilTabs->clearSubTabs();
667 return true;
668
669 // TODO: needs another switch
670 if($_GET['ref_id'])
671 {
672
673 $ilTabs->addSubTabTarget('app_day',$this->ctrl->getLinkTargetByClass('ilCalendarDayGUI',''));
674 $ilTabs->addSubTabTarget('app_week',$this->ctrl->getLinkTargetByClass('ilCalendarWeekGUI',''));
675 $ilTabs->addSubTabTarget('app_month',$this->ctrl->getLinkTargetByClass('ilCalendarMonthGUI',''));
676 }
677 return true;
678 }
679
683 function setSeed()
684 {
685 global $ilCtrl, $ilUser;
686
687 //$ilUser->writePref("il_pd_bkm_mode", 'flat');
688 $_SESSION["il_cal_block_".$this->getBlockType()."_".$this->getBlockId()."_seed"] =
689 $_GET["seed"];
690 if ($ilCtrl->isAsynch())
691 {
692 echo $this->getHTML();
693 exit;
694 }
695 else
696 {
697 $this->returnToUpperContext();
698 }
699 }
700
705 {
706 global $ilCtrl;
707
708 $ilCtrl->returnToParent($this);
709 }
710
711
712 public function showCalendarSubscription()
713 {
714 global $lng, $ilUser;
715
716 $tpl = new ilTemplate('tpl.show_calendar_subscription.html',true,true,'Services/Calendar');
717
718 $tpl->setVariable('TXT_TITLE',$lng->txt('cal_subscription_header'));
719 $tpl->setVariable('TXT_INFO',$lng->txt('cal_subscription_info'));
720 $tpl->setVariable('TXT_CAL_URL',$lng->txt('cal_subscription_url'));
721
722 include_once './Services/Calendar/classes/class.ilCalendarAuthenticationToken.php';
723
724 switch($this->mode)
725 {
729 $calendar = 0;
730 break;
731
732 default:
734 // TODO: calendar id
735 $calendar = ilObject::_lookupObjId((int) $_GET['ref_id']);
736 break;
737 }
738 if($hash = ilCalendarAuthenticationToken::lookupAuthToken($ilUser->getId(), $selection, $calendar))
739 {
740
741 }
742 else
743 {
744 $token = new ilCalendarAuthenticationToken($ilUser->getId());
745 $token->setSelectionType($selection);
746 $token->setCalendar($calendar);
747 $hash = $token->add();
748 }
749 $url = ILIAS_HTTP_PATH.'/calendar.php?client_id='.CLIENT_ID.'&token='.$hash;
750
751 $tpl->setVariable('VAL_CAL_URL',$url);
752 $tpl->setVariable('VAL_CAL_URL_TXT',$url);
753
754 include_once("./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
755 $content_block = new ilPDContentBlockGUI();
756 $content_block->setContent($tpl->get());
757 $content_block->setTitle($lng->txt("calendar"));
758 $content_block->addHeaderCommand($this->ctrl->getParentReturn($this),
759 $lng->txt("selected_items_back"));
760
761 return $content_block->getHTML();
762
763 }
764
765 function fillFooter()
766 {
767 global $ilCtrl, $lng, $ilUser;
768
769 // begin-patch ch
770 foreach((array) $this->cal_footer as $link_info)
771 {
772 $this->tpl->setCurrentBlock('data_section');
773 $this->tpl->setVariable('DATA',
774 sprintf('<a href="%s">%s</a>',$link_info['link'],$link_info['txt'])
775
776 );
777 $this->tpl->parseCurrentBlock();
778 }
779 // end-patch ch
780
781 $this->setFooterLinks();
782 $this->fillFooterLinks();
783 $this->tpl->setVariable("FCOLSPAN", $this->getColSpan());
784 if ($this->tpl->blockExists("block_footer"))
785 {
786 $this->tpl->setCurrentBlock("block_footer");
787 $this->tpl->parseCurrentBlock();
788 }
789
790 }
791
792 function setFooterLinks()
793 {
794 global $ilCtrl, $lng;
795
796 // alex: changed from < 2 to < 1 - original detail level 1 did not work anymore
797 if ($this->getCurrentDetailLevel() < 1)
798 {
799 return;
800 }
801
802// if ($this->display_mode == 'mmon')
803// {
804// $this->addFooterLink($lng->txt("month"));
805
806 $this->addFooterLink($lng->txt("cal_upcoming_events_header"),
807 $ilCtrl->getLinkTarget($this, "setPdModeEvents"),
808 $ilCtrl->getLinkTarget($this, "setPdModeEvents", "", true),
809 "block_".$this->getBlockType()."_".$this->block_id,
810 false, false, ($this->display_mode != 'mmon'));
811
812// }
813// else
814// {
815 $this->addFooterLink( $lng->txt("app_month"),
816 $ilCtrl->getLinkTarget($this, "setPdModeMonth"),
817 $ilCtrl->getLinkTarget($this, "setPdModeMonth", "", true),
818 "block_".$this->getBlockType()."_".$this->block_id,
819 false, false, ($this->display_mode == 'mmon'));
820
821// $this->addFooterLink($lng->txt("cal_upcoming_events_header"));
822// }
823 }
824
826 {
827 global $ilUser, $ilCtrl;
828
829 $ilUser->writePref("il_pd_cal_mode", "evt");
830 $this->display_mode = "evt";
831 if ($ilCtrl->isAsynch())
832 {
833 echo $this->getHTML();
834 exit;
835 }
836 else
837 {
838 $ilCtrl->redirectByClass("ilpersonaldesktopgui", "show");
839 }
840 }
841
842 function setPdModeMonth()
843 {
844 global $ilUser, $ilCtrl;
845
846 $ilUser->writePref("il_pd_cal_mode", "mmon");
847 $this->display_mode = "mmon";
848 if ($ilCtrl->isAsynch())
849 {
850 echo $this->getHTML();
851 exit;
852 }
853 else
854 {
855 $ilCtrl->redirectByClass("ilpersonaldesktopgui", "show");
856 }
857 }
858
859 function getData()
860 {
861 global $ilCtrl, $lng;
862
863 $seed = new ilDate(date('Y-m-d',time()),IL_CAL_DATE);
864
865 include_once('./Services/Calendar/classes/class.ilCalendarSchedule.php');
867 $schedule->addSubitemCalendars(true); // #12007
868 $schedule->setEventsLimit(20);
869 $schedule->calculate();
870 $events = $schedule->getScheduledEvents(); // #13809
871
872 $data = array();
873 if(sizeof($events))
874 {
875 foreach($events as $item)
876 {
877 $start = $item["dstart"];
878 $end = $item["dend"];
879 if($item["fullday"])
880 {
881 $start = new ilDate($start, IL_CAL_UNIX);
882 $end = new ilDate($end, IL_CAL_UNIX);
883 }
884 else
885 {
886 $start = new ilDateTime($start, IL_CAL_UNIX);
887 $end = new ilDateTime($end, IL_CAL_UNIX);
888 }
889
890 $ilCtrl->clearParametersByClass('ilcalendardaygui');
891 $ilCtrl->setParameterByClass('ilcalendardaygui','seed',$start->get(IL_CAL_DATE));
892 $link = $ilCtrl->getLinkTargetByClass('ilcalendardaygui','');
893 $ilCtrl->clearParametersByClass('ilcalendardaygui');
894
895 $data[] = array(
896 "date" => ilDatePresentation::formatPeriod($start, $end),
897 "title" => $item["event"]->getPresentationTitle(),
898 "url" => $link
899 );
900 }
901
902 $this->setEnableNumInfo(true);
903 }
904 else
905 {
906 $data[] = array(
907 "date" => $lng->txt("msg_no_search_result"),
908 "title" => "",
909 "url" => ""
910 );
911
912 $this->setEnableNumInfo(false);
913 }
914
915 return $data;
916 }
917}
918
919?>
global $tpl
Definition: ilias.php:8
$_GET["client_id"]
const IL_SCREEN_CENTER
const IL_CAL_DATE
const IL_CAL_UNIX
const IL_CAL_MONTH
const IL_CAL_FKT_DATE
const IL_CAL_DAY
This class represents a block method of a block.
setLimit($a_limit)
Set Limit.
getCurrentDetailLevel()
Get Current Detail Level.
getBlockId()
Get Block Id.
setAvailableDetailLevels($a_max, $a_min=0)
Set Available Detail Levels.
fillFooterLinks($a_top=false, $a_numinfo="")
Fill footer links.
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
addBlockCommand($a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
Add Block Command.
fillDataSection()
Standard implementation for row based data.
addFooterLink($a_text, $a_href="", $a_onclick="", $a_block_id="", $a_top=false, $a_omit_separator=false, $a_checked=false)
Add a footer text/link.
getProperty($a_property)
setColSpan($a_colspan)
Set Columns Span.
setTitle($a_title)
Set Title.
setBlockId($a_block_id=0)
Set Block Id.
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
getColSpan()
Get Columns Span.
Booking definition.
static lookupBookableUsersForObject($a_obj_id, $a_user_ids)
Consultation hours are offered if 1) consultation hour owner is admin or tutor and no object assignme...
Administrate calendar appointments.
Handles calendar authentication tokens for external calendar subscriptions.
static lookupAuthToken($a_user_id, $a_selection, $a_calendar=0)
Calendar blocks, displayed in different contexts, e.g.
setEnableEdit($a_enable_edit=0)
Set EnableEdit.
static getBlockType()
Get block type.
addMiniMonth($a_tpl)
Add mini version of monthly overview (Maybe extracted to another class, if used in pd calendar tab.
addCloseCommand($a_content_block)
fillDataSection()
Fill data section.
getHTML()
Get bloch HTML code.
ilCalendarBlockGUI($a_skip_init=false)
Constructor.
static getScreenMode()
Get Screen Mode for current command.
returnToUpperContext()
Return to upper context.
& executeCommand()
execute command
static isRepositoryObject()
Is this a repository object.
static _getInstance($a_usr_id=0)
get singleton instance
Presentation day view.
Represents a list of calendar appointments (including recurring events) for a specific user in a give...
static _getInstanceByUserId($a_user_id)
get singleton instance
static _isToday($date)
check if a date is today
static _numericDayToString($a_day, $a_long=true)
get
static _buildMonthDayList($a_month, $a_year, $weekstart)
Build a month day list.
static getAppointments($a_user_id)
Get all appointments.
Consultation hours editor.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static formatPeriod(ilDateTime $start, ilDateTime $end)
Format a period of two date Shows: 14.
@classDescription Date and time handling
static _equals(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
Check if two date are equal.
static _before(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets.
Class for single dates.
_lookupFullname($a_user_id)
Lookup Full Name.
static _lookupObjId($a_id)
BlockGUI class for (centered) Content on Personal Desktop.
static get($a_type, $a_href="")
Get icon html.
special template class to simplify handling of ITX/PEAR
$GLOBALS['ct_recipient']
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
global $ilCtrl
Definition: ilias.php:18
exit
Definition: login.php:54
global $lng
Definition: privfeed.php:40
$cmd
Definition: sahs_server.php:35
global $ilUser
Definition: imgupload.php:15