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