24 include_once(
"Services/Block/classes/class.ilBlockGUI.php");
25 include_once
'./Services/Calendar/classes/class.ilCalendarCategories.php';
62 $lng->loadLanguageModule(
"dateplaner");
63 $ilHelp->addHelpSection(
"cal_block");
65 include_once(
"./Services/News/classes/class.ilNewsItem.php");
67 $ilCtrl->saveParameter($this,
'bkid');
81 if(!isset(
$_GET[
"bkid"]))
83 $title = $lng->txt(
"calendar");
92 $this->allow_moving =
false;
95 include_once(
'Services/Calendar/classes/class.ilDate.php');
96 include_once(
'Services/Calendar/classes/class.ilCalendarUserSettings.php');
99 if ((!isset(
$_GET[
"seed"]) ||
$_GET[
"seed"] ==
"") &&
102 $seed_str =
$_SESSION[
"il_cal_block_".$this->getBlockType().
"_".$this->
getBlockId().
"_seed"];
104 else if (isset(
$_GET[
"seed"]))
106 $seed_str =
$_GET[
"seed"];
109 if (isset(
$_GET[
"seed"]) &&
$_GET[
"seed"] !=
"")
125 $tpl->addCSS(
"./Services/Calendar/css/calendar.css");
127 $tpl->addCSS(
"./Services/Calendar/templates/default/delos.css");
129 $mode = $ilUser->getPref(
"il_pd_cal_mode");
160 $cmd_class = $ilCtrl->getCmdClass();
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')
173 switch($ilCtrl->getCmd())
192 $next_class = $ilCtrl->getNextClass();
193 $cmd = $ilCtrl->getCmd(
"getHTML");
199 case "ilcalendarappointmentgui":
200 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentGUI.php');
202 $ilCtrl->forwardCommand($app_gui);
205 case "ilcalendardaygui":
206 $ilTabs->setSubTabActive(
'app_day');
207 include_once(
'./Services/Calendar/classes/class.ilCalendarDayGUI.php');
209 $ilCtrl->forwardCommand($day_gui);
212 case "ilcalendarweekgui":
213 $ilTabs->setSubTabActive(
'app_week');
214 include_once(
'./Services/Calendar/classes/class.ilCalendarWeekGUI.php');
216 $ilCtrl->forwardCommand($week_gui);
219 case "ilcalendarmonthgui":
220 $ilTabs->setSubTabActive(
'app_month');
221 include_once(
'./Services/Calendar/classes/class.ilCalendarMonthGUI.php');
223 $ilCtrl->forwardCommand($month_gui);
226 case "ilcalendarinboxgui":
227 include_once(
'./Services/Calendar/classes/class.ilCalendarInboxGUI.php');
229 $ilCtrl->forwardCommand($inbox);
232 case "ilconsultationhoursgui":
233 include_once(
'./Services/Calendar/classes/ConsultationHours/class.ilConsultationHoursGUI.php');
235 $ilCtrl->forwardCommand($hours);
239 return $this->
$cmd();
250 $this->enable_edit = $a_enable_edit;
260 return $this->enable_edit;
272 $this->tpl->addBlockFile(
"BLOCK_ROW",
"block_row",
"tpl.pd_event_list.html",
"Services/Calendar");
282 "Services/Calendar");
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++)
309 $a_tpl->setCurrentBlock(
'month_header_col');
311 $a_tpl->parseCurrentBlock();
314 if(isset(
$_GET[
"bkid"]))
316 $user_id =
$_GET[
"bkid"];
317 $disable_empty =
true;
321 $user_id = $ilUser->getId();
322 $disable_empty =
false;
324 include_once(
'Services/Calendar/classes/class.ilCalendarSchedule.php');
326 $this->scheduler->addSubitemCalendars(
true);
327 $this->scheduler->calculate();
332 $this->user_settings->getWeekStart())->
get() as $date)
336 $events = $this->scheduler->getByDay($date,$ilUser->getTimeZone());
337 $has_events = (bool)count($events);
338 if($has_events || !$disable_empty)
340 $a_tpl->setCurrentBlock(
'month_col_link');
344 $a_tpl->setCurrentBlock(
'month_col_no_link');
351 $a_tpl->setVariable(
'DAY_CLASS',
'calminiinactive');
355 $week_has_events =
true;
356 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
357 foreach($events as $event)
360 if($booking->hasBooked($event[
'event']->getEntryId()))
362 $a_tpl->setVariable(
'DAY_CLASS',
'calminiapp');
370 $week_has_events =
true;
371 $a_tpl->setVariable(
'DAY_CLASS',
'calminiapp');
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');
385 $a_tpl->setVariable(
'MONTH_DAY',$month_day);
387 $a_tpl->parseCurrentBlock();
390 $a_tpl->setCurrentBlock(
'month_col');
392 include_once(
'./Services/Calendar/classes/class.ilCalendarUtil.php');
395 $a_tpl->setVariable(
'TD_CLASS',
'calminitoday');
397 #elseif(ilDateTime::_equals($date,$this->seed,IL_CAL_DAY))
399 # $a_tpl->setVariable('TD_CLASS','calmininow');
403 $a_tpl->setVariable(
'TD_CLASS',
'calministd');
407 $a_tpl->setVariable(
'TD_CLASS',
'calminiprev');
411 $a_tpl->setVariable(
'TD_CLASS',
'calmininext');
414 $a_tpl->parseCurrentBlock();
417 if($counter and !($counter % 7))
419 if(!$disable_empty || $week_has_events)
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');
429 $a_tpl->setCurrentBlock(
'month_row_no_link');
430 $a_tpl->setVariable(
'WEEK_CLASS',
'calminiinactive');
432 $a_tpl->setVariable(
'WEEK',
434 $a_tpl->parseCurrentBlock();
436 $a_tpl->setCurrentBlock(
'month_row');
437 $a_tpl->setVariable(
'TD_CLASS',
'calminiweek');
438 $a_tpl->parseCurrentBlock();
440 $week_has_events =
false;
443 $a_tpl->setCurrentBlock(
'mini_month');
444 $a_tpl->setVariable(
'TXT_MONTH_OVERVIEW', $lng->txt(
"cal_month_overview"));
445 $a_tpl->setVariable(
'TXT_MONTH',
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',
''));
453 $ilCtrl->setParameter($this,
'seed',$myseed->get(
IL_CAL_DATE));
456 $a_tpl->setVariable(
'BL_ID', $this->
getBlockId());
458 $a_tpl->setVariable(
'PREV_MONTH',
459 $ilCtrl->getLinkTarget($this,
"setSeed"));
460 $a_tpl->setVariable(
'PREV_MONTH_ASYNC',
461 $ilCtrl->getLinkTarget($this,
"setSeed",
"",
true));
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));
470 $ilCtrl->setParameter($this,
'seed',
"");
471 $a_tpl->parseCurrentBlock();
487 #if ($this->getEnableEdit())
492 include_once(
"./Services/News/classes/class.ilRSSButtonGUI.php");
494 $this->ctrl->getLinkTarget($this,
'showCalendarSubscription'),
495 $lng->txt(
'ical_export'),
503 if(!isset(
$_GET[
"bkid"]))
505 if($ilAccess->checkAccess(
'edit_event',
'',(
int)
$_GET[
'ref_id']))
507 $ilCtrl->setParameter($this,
"add_mode",
"block");
509 $ilCtrl->getLinkTargetByClass(
"ilCalendarAppointmentGUI",
511 $lng->txt(
"add_appointment"));
512 $ilCtrl->setParameter($this,
"add_mode",
"");
515 global $ilObjDataCache;
517 include_once
"Modules/Course/classes/class.ilCourseParticipants.php";
518 $obj_id = $ilObjDataCache->lookupObjId((
int) $_GET[
'ref_id']);
520 $users = array_unique(array_merge($participants->getTutors(), $participants->getAdmins()));
522 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
527 foreach($users as $user_id)
529 if(!isset($_GET[
"bkid"]))
531 $ilCtrl->setParameter($this,
"bkid", $user_id);
533 $ilCtrl->getLinkTargetByClass(
"ilCalendarMonthGUI",
537 $this->cal_footer[] = array(
538 'link' => $ilCtrl->getLinkTargetByClass(
'ilCalendarMonthGUI',
''),
544 $ilCtrl->setParameter($this,
"bkid",
"");
549 $ilCtrl->setParameter($this,
"bkid",
"");
551 $ilCtrl->getLinkTarget($this),
553 $ilCtrl->setParameter($this,
"bkid", (
int)
$_GET[
"bkid"]);
560 $ilCtrl->getLinkTarget($this,
"editSettings"),
561 $lng->txt(
"settings"));
564 $ilCtrl->setParameterByClass(
"ilcolumngui",
"seed", isset(
$_GET[
"seed"]) ?
$_GET[
"seed"] :
"");
566 $ilCtrl->setParameterByClass(
"ilcolumngui",
"seed",
"");
578 include_once(
'./Services/Calendar/classes/class.ilCalendarSchedule.php');
580 $events = $schedule->getChangedEvents(
true);
582 $ilCtrl->setParameterByClass(
'ilcalendarinboxgui',
'changed', 1);
583 $link =
'<a href='.$ilCtrl->getLinkTargetByClass(
'ilcalendarinboxgui',
'').
'>';
584 $ilCtrl->setParameterByClass(
'ilcalendarinboxgui',
'changed',
'');
585 $text =
'<div class="small">'.((int) count($events)).
" ".$lng->txt(
"cal_changed_events_header").
"</div>";
588 return $link.$text.$end_link;
595 $a_content_block->addHeaderCommand($ilCtrl->getParentReturn($this),
596 $lng->txt(
"close"),
true);
610 include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
612 if(!isset(
$_GET[
'bkid']))
633 $ilTabs->clearSubTabs();
640 $ilTabs->addSubTabTarget(
'app_day',$this->ctrl->getLinkTargetByClass(
'ilCalendarDayGUI',
''));
641 $ilTabs->addSubTabTarget(
'app_week',$this->ctrl->getLinkTargetByClass(
'ilCalendarWeekGUI',
''));
642 $ilTabs->addSubTabTarget(
'app_month',$this->ctrl->getLinkTargetByClass(
'ilCalendarMonthGUI',
''));
657 if ($ilCtrl->isAsynch())
675 $ilCtrl->returnToParent($this);
683 $tpl =
new ilTemplate(
'tpl.show_calendar_subscription.html',
true,
true,
'Services/Calendar');
685 $tpl->setVariable(
'TXT_TITLE',$lng->txt(
'cal_subscription_header'));
686 $tpl->setVariable(
'TXT_INFO',$lng->txt(
'cal_subscription_info'));
687 $tpl->setVariable(
'TXT_CAL_URL',$lng->txt(
'cal_subscription_url'));
689 include_once
'./Services/Calendar/classes/class.ilCalendarAuthenticationToken.php';
713 $token->setCalendar($calendar);
714 $hash = $token->add();
716 $url = ILIAS_HTTP_PATH.
'/calendar.php?client_id='.CLIENT_ID.
'&token='.$hash;
718 $tpl->setVariable(
'VAL_CAL_URL',$url);
719 $tpl->setVariable(
'VAL_CAL_URL_TXT',$url);
721 include_once(
"./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
723 $content_block->setContent(
$tpl->get());
724 $content_block->setTitle($lng->txt(
"calendar"));
725 $content_block->addHeaderCommand($this->ctrl->getParentReturn($this),
726 $lng->txt(
"selected_items_back"));
728 return $content_block->getHTML();
737 foreach((array) $this->cal_footer as $link_info)
739 $this->tpl->setCurrentBlock(
'data_section');
740 $this->tpl->setVariable(
'DATA',
741 sprintf(
'<a href="%s">%s</a>',$link_info[
'link'],$link_info[
'txt'])
744 $this->tpl->parseCurrentBlock();
750 $this->tpl->setVariable(
"FCOLSPAN", $this->
getColSpan());
751 if ($this->tpl->blockExists(
"block_footer"))
753 $this->tpl->setCurrentBlock(
"block_footer");
754 $this->tpl->parseCurrentBlock();
773 $this->
addFooterLink($lng->txt(
"cal_upcoming_events_header"),
774 $ilCtrl->getLinkTarget($this,
"setPdModeEvents"),
775 $ilCtrl->getLinkTarget($this,
"setPdModeEvents",
"",
true),
777 false,
false, ($this->display_mode !=
'mmon'));
783 $ilCtrl->getLinkTarget($this,
"setPdModeMonth"),
784 $ilCtrl->getLinkTarget($this,
"setPdModeMonth",
"",
true),
786 false,
false, ($this->display_mode ==
'mmon'));
796 $ilUser->writePref(
"il_pd_cal_mode",
"evt");
797 $this->display_mode =
"evt";
798 if ($ilCtrl->isAsynch())
805 $ilCtrl->redirectByClass(
"ilpersonaldesktopgui",
"show");
813 $ilUser->writePref(
"il_pd_cal_mode",
"mmon");
814 $this->display_mode =
"mmon";
815 if ($ilCtrl->isAsynch())
822 $ilCtrl->redirectByClass(
"ilpersonaldesktopgui",
"show");
832 include_once(
'./Services/Calendar/classes/class.ilCalendarSchedule.php');
834 $schedule->addSubitemCalendars(
true);
835 $schedule->setEventsLimit(20);
836 $schedule->calculate();
837 $events = $schedule->getScheduledEvents();
842 foreach($events as $item)
844 $start = $item[
"dstart"];
845 $end = $item[
"dend"];
857 $ilCtrl->clearParametersByClass(
'ilcalendardaygui');
858 $ilCtrl->setParameterByClass(
'ilcalendardaygui',
'seed',$start->get(
IL_CAL_DATE));
859 $link = $ilCtrl->getLinkTargetByClass(
'ilcalendardaygui',
'');
860 $ilCtrl->clearParametersByClass(
'ilcalendardaygui');
864 "title" => $item[
"event"]->getPresentationTitle(),
874 "date" => $lng->txt(
"msg_no_search_result"),