24 include_once(
"Services/Block/classes/class.ilBlockGUI.php");
25 include_once
'./Services/Calendar/classes/class.ilCalendarCategories.php';
63 $lng->loadLanguageModule(
"dateplaner");
64 $ilHelp->addHelpSection(
"cal_block");
66 include_once(
"./Services/News/classes/class.ilNewsItem.php");
68 $ilCtrl->saveParameter($this,
'bkid');
82 if(!isset(
$_GET[
"bkid"]))
84 $title = $lng->txt(
"calendar");
93 $this->allow_moving =
false;
96 include_once(
'Services/Calendar/classes/class.ilDate.php');
97 include_once(
'Services/Calendar/classes/class.ilCalendarUserSettings.php');
100 if ((!isset(
$_GET[
"seed"]) ||
$_GET[
"seed"] ==
"") &&
103 $seed_str =
$_SESSION[
"il_cal_block_".$this->getBlockType().
"_".$this->
getBlockId().
"_seed"];
105 else if (isset(
$_GET[
"seed"]))
107 $seed_str =
$_GET[
"seed"];
110 if (isset(
$_GET[
"seed"]) &&
$_GET[
"seed"] !=
"")
126 $tpl->addCSS(
"./Services/Calendar/css/calendar.css");
128 $tpl->addCSS(
"./Services/Calendar/templates/default/delos.css");
130 $mode = $ilUser->getPref(
"il_pd_cal_mode");
161 $cmd_class = $ilCtrl->getCmdClass();
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')
174 switch($ilCtrl->getCmd())
193 $next_class = $ilCtrl->getNextClass();
194 $cmd = $ilCtrl->getCmd(
"getHTML");
200 case "ilcalendarappointmentgui":
201 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentGUI.php');
203 $ilCtrl->forwardCommand($app_gui);
206 case "ilcalendardaygui":
207 $ilTabs->setSubTabActive(
'app_day');
208 include_once(
'./Services/Calendar/classes/class.ilCalendarDayGUI.php');
210 $ilCtrl->forwardCommand($day_gui);
213 case "ilcalendarweekgui":
214 $ilTabs->setSubTabActive(
'app_week');
215 include_once(
'./Services/Calendar/classes/class.ilCalendarWeekGUI.php');
217 $ilCtrl->forwardCommand($week_gui);
220 case "ilcalendarmonthgui":
221 $ilTabs->setSubTabActive(
'app_month');
222 include_once(
'./Services/Calendar/classes/class.ilCalendarMonthGUI.php');
224 $ilCtrl->forwardCommand($month_gui);
227 case "ilcalendarinboxgui":
228 include_once(
'./Services/Calendar/classes/class.ilCalendarInboxGUI.php');
230 $ilCtrl->forwardCommand($inbox);
233 case "ilconsultationhoursgui":
234 include_once(
'./Services/Calendar/classes/ConsultationHours/class.ilConsultationHoursGUI.php');
236 $ilCtrl->forwardCommand($hours);
240 return $this->
$cmd();
251 $this->enable_edit = $a_enable_edit;
261 return $this->enable_edit;
273 $this->tpl->addBlockFile(
"BLOCK_ROW",
"block_row",
"tpl.pd_event_list.html",
"Services/Calendar");
283 "Services/Calendar");
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++)
310 $a_tpl->setCurrentBlock(
'month_header_col');
312 $a_tpl->parseCurrentBlock();
315 if(isset(
$_GET[
"bkid"]))
317 $user_id =
$_GET[
"bkid"];
318 $disable_empty =
true;
322 $user_id = $ilUser->getId();
323 $disable_empty =
false;
325 include_once(
'Services/Calendar/classes/class.ilCalendarSchedule.php');
327 $this->scheduler->addSubitemCalendars(
true);
328 $this->scheduler->calculate();
333 $this->user_settings->getWeekStart())->
get() as $date)
337 $events = $this->scheduler->getByDay($date,$ilUser->getTimeZone());
338 $has_events = (bool)count($events);
339 if($has_events || !$disable_empty)
341 $a_tpl->setCurrentBlock(
'month_col_link');
345 $a_tpl->setCurrentBlock(
'month_col_no_link');
352 $a_tpl->setVariable(
'DAY_CLASS',
'calminiinactive');
356 $week_has_events =
true;
357 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
358 foreach($events as $event)
361 if($booking->hasBooked($event[
'event']->getEntryId()))
363 $a_tpl->setVariable(
'DAY_CLASS',
'calminiapp');
371 $week_has_events =
true;
372 $a_tpl->setVariable(
'DAY_CLASS',
'calminiapp');
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');
386 $a_tpl->setVariable(
'MONTH_DAY',$month_day);
388 $a_tpl->parseCurrentBlock();
391 $a_tpl->setCurrentBlock(
'month_col');
393 include_once(
'./Services/Calendar/classes/class.ilCalendarUtil.php');
396 $a_tpl->setVariable(
'TD_CLASS',
'calminitoday');
398 #elseif(ilDateTime::_equals($date,$this->seed,IL_CAL_DAY))
400 # $a_tpl->setVariable('TD_CLASS','calmininow');
404 $a_tpl->setVariable(
'TD_CLASS',
'calministd');
408 $a_tpl->setVariable(
'TD_CLASS',
'calminiprev');
412 $a_tpl->setVariable(
'TD_CLASS',
'calmininext');
415 $a_tpl->parseCurrentBlock();
418 if($counter and !($counter % 7))
420 if(!$disable_empty || $week_has_events)
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');
430 $a_tpl->setCurrentBlock(
'month_row_no_link');
431 $a_tpl->setVariable(
'WEEK_CLASS',
'calminiinactive');
433 $a_tpl->setVariable(
'WEEK',
435 $a_tpl->parseCurrentBlock();
437 $a_tpl->setCurrentBlock(
'month_row');
438 $a_tpl->setVariable(
'TD_CLASS',
'calminiweek');
439 $a_tpl->parseCurrentBlock();
441 $week_has_events =
false;
444 $a_tpl->setCurrentBlock(
'mini_month');
445 $a_tpl->setVariable(
'TXT_MONTH_OVERVIEW', $lng->txt(
"cal_month_overview"));
446 $a_tpl->setVariable(
'TXT_MONTH',
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',
''));
454 $ilCtrl->setParameter($this,
'seed',$myseed->get(
IL_CAL_DATE));
457 $a_tpl->setVariable(
'BL_ID', $this->
getBlockId());
459 $a_tpl->setVariable(
'PREV_MONTH',
460 $ilCtrl->getLinkTarget($this,
"setSeed"));
461 $a_tpl->setVariable(
'PREV_MONTH_ASYNC',
462 $ilCtrl->getLinkTarget($this,
"setSeed",
"",
true));
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));
471 $ilCtrl->setParameter($this,
'seed',
"");
472 $a_tpl->parseCurrentBlock();
488 #if ($this->getEnableEdit())
494 $this->ctrl->getLinkTarget($this,
'showCalendarSubscription'),
495 $lng->txt(
'ical_export'),
505 if(!isset(
$_GET[
"bkid"]))
507 if($ilAccess->checkAccess(
'edit_event',
'',(
int)
$_GET[
'ref_id']))
509 $ilCtrl->setParameter($this,
"add_mode",
"block");
511 $ilCtrl->getLinkTargetByClass(
"ilCalendarAppointmentGUI",
513 $lng->txt(
"add_appointment"));
514 $ilCtrl->setParameter($this,
"add_mode",
"");
517 global $ilObjDataCache;
519 include_once
"Modules/Course/classes/class.ilCourseParticipants.php";
520 $obj_id = $ilObjDataCache->lookupObjId((
int) $_GET[
'ref_id']);
522 $users = array_unique(array_merge($participants->getTutors(), $participants->getAdmins()));
524 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
528 foreach($users as $user_id)
530 if(!isset($_GET[
"bkid"]) || $_GET[
"bkid"] != $user_id)
532 $ilCtrl->setParameter($this,
"bkid", $user_id);
534 $ilCtrl->getLinkTargetByClass(
"ilCalendarMonthGUI",
539 $ilCtrl->setParameter($this,
"bkid",
"");
544 $ilCtrl->setParameter($this,
"bkid",
"");
546 $ilCtrl->getLinkTarget($this),
548 $ilCtrl->setParameter($this,
"bkid", (
int)
$_GET[
"bkid"]);
555 $ilCtrl->getLinkTarget($this,
"editSettings"),
556 $lng->txt(
"settings"));
559 $ilCtrl->setParameterByClass(
"ilcolumngui",
"seed", isset(
$_GET[
"seed"]) ?
$_GET[
"seed"] :
"");
561 $ilCtrl->setParameterByClass(
"ilcolumngui",
"seed",
"");
573 include_once(
'./Services/Calendar/classes/class.ilCalendarSchedule.php');
575 $events = $schedule->getChangedEvents(
true);
577 $ilCtrl->setParameterByClass(
'ilcalendarinboxgui',
'changed', 1);
578 $link =
'<a href='.$ilCtrl->getLinkTargetByClass(
'ilcalendarinboxgui',
'').
'>';
579 $ilCtrl->setParameterByClass(
'ilcalendarinboxgui',
'changed',
'');
580 $text =
'<div class="small">'.((int) count($events)).
" ".$lng->txt(
"cal_changed_events_header").
"</div>";
583 return $link.$text.$end_link;
590 $a_content_block->addHeaderCommand($ilCtrl->getParentReturn($this),
591 $lng->txt(
"close"),
true);
605 include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
607 if(!isset(
$_GET[
'bkid']))
626 $ilTabs->clearSubTabs();
633 $ilTabs->addSubTabTarget(
'app_day',$this->ctrl->getLinkTargetByClass(
'ilCalendarDayGUI',
''));
634 $ilTabs->addSubTabTarget(
'app_week',$this->ctrl->getLinkTargetByClass(
'ilCalendarWeekGUI',
''));
635 $ilTabs->addSubTabTarget(
'app_month',$this->ctrl->getLinkTargetByClass(
'ilCalendarMonthGUI',
''));
650 if ($ilCtrl->isAsynch())
668 $ilCtrl->returnToParent($this);
676 $tpl =
new ilTemplate(
'tpl.show_calendar_subscription.html',
true,
true,
'Services/Calendar');
678 $tpl->setVariable(
'TXT_TITLE',$lng->txt(
'cal_subscription_header'));
679 $tpl->setVariable(
'TXT_INFO',$lng->txt(
'cal_subscription_info'));
680 $tpl->setVariable(
'TXT_CAL_URL',$lng->txt(
'cal_subscription_url'));
682 include_once
'./Services/Calendar/classes/class.ilCalendarAuthenticationToken.php';
706 $token->setCalendar($calendar);
707 $hash = $token->add();
709 $url = ILIAS_HTTP_PATH.
'/calendar.php?client_id='.CLIENT_ID.
'&token='.$hash;
711 $tpl->setVariable(
'VAL_CAL_URL',$url);
712 $tpl->setVariable(
'VAL_CAL_URL_TXT',$url);
714 include_once(
"./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
716 $content_block->setContent(
$tpl->get());
717 $content_block->setTitle($lng->txt(
"calendar"));
718 #$content_block->setImage(ilUtil::getImagePath("icon_news.png"));
719 $content_block->addHeaderCommand($this->ctrl->getParentReturn($this),
720 $lng->txt(
"selected_items_back"));
722 return $content_block->getHTML();
732 $this->tpl->setVariable(
"FCOLSPAN", $this->
getColSpan());
733 if ($this->tpl->blockExists(
"block_footer"))
735 $this->tpl->setCurrentBlock(
"block_footer");
736 $this->tpl->parseCurrentBlock();
754 $this->
addFooterLink($lng->txt(
"cal_upcoming_events_header"),
755 $ilCtrl->getLinkTarget($this,
"setPdModeEvents"),
756 $ilCtrl->getLinkTarget($this,
"setPdModeEvents",
"",
true),
758 false,
false, ($this->display_mode !=
'mmon'));
764 $ilCtrl->getLinkTarget($this,
"setPdModeMonth"),
765 $ilCtrl->getLinkTarget($this,
"setPdModeMonth",
"",
true),
767 false,
false, ($this->display_mode ==
'mmon'));
777 $ilUser->writePref(
"il_pd_cal_mode",
"evt");
778 $this->display_mode =
"evt";
779 if ($ilCtrl->isAsynch())
786 $ilCtrl->redirectByClass(
"ilpersonaldesktopgui",
"show");
794 $ilUser->writePref(
"il_pd_cal_mode",
"mmon");
795 $this->display_mode =
"mmon";
796 if ($ilCtrl->isAsynch())
803 $ilCtrl->redirectByClass(
"ilpersonaldesktopgui",
"show");
813 include_once(
'./Services/Calendar/classes/class.ilCalendarSchedule.php');
815 $schedule->addSubitemCalendars(
true);
816 $schedule->setEventsLimit(20);
817 $schedule->calculate();
818 $events = $schedule->getScheduledEvents();
823 foreach($events as $item)
825 $start = $item[
"dstart"];
826 $end = $item[
"dend"];
838 $ilCtrl->clearParametersByClass(
'ilcalendardaygui');
839 $ilCtrl->setParameterByClass(
'ilcalendardaygui',
'seed', $start->get(
IL_CAL_DATE));
840 $link = $ilCtrl->getLinkTargetByClass(
'ilcalendardaygui',
'');
841 $ilCtrl->clearParametersByClass(
'ilcalendardaygui');
845 "title" => $item[
"event"]->getPresentationTitle(),
855 "date" => $lng->txt(
"msg_no_search_result"),