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';
529 foreach($users as $user_id)
531 if(!isset($_GET[
"bkid"]))
533 $ilCtrl->setParameter($this,
"bkid", $user_id);
535 $ilCtrl->getLinkTargetByClass(
"ilCalendarMonthGUI",
539 $this->cal_footer[] = array(
540 'link' => $ilCtrl->getLinkTargetByClass(
'ilCalendarMonthGUI',
''),
546 $ilCtrl->setParameter($this,
"bkid",
"");
551 $ilCtrl->setParameter($this,
"bkid",
"");
553 $ilCtrl->getLinkTarget($this),
555 $ilCtrl->setParameter($this,
"bkid", (
int)
$_GET[
"bkid"]);
562 $ilCtrl->getLinkTarget($this,
"editSettings"),
563 $lng->txt(
"settings"));
566 $ilCtrl->setParameterByClass(
"ilcolumngui",
"seed", isset(
$_GET[
"seed"]) ?
$_GET[
"seed"] :
"");
568 $ilCtrl->setParameterByClass(
"ilcolumngui",
"seed",
"");
580 include_once(
'./Services/Calendar/classes/class.ilCalendarSchedule.php');
582 $events = $schedule->getChangedEvents(
true);
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>";
590 return $link.$text.$end_link;
597 $a_content_block->addHeaderCommand($ilCtrl->getParentReturn($this),
598 $lng->txt(
"close"),
true);
612 include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
614 if(!isset(
$_GET[
'bkid']))
635 $ilTabs->clearSubTabs();
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',
''));
659 if ($ilCtrl->isAsynch())
677 $ilCtrl->returnToParent($this);
685 $tpl =
new ilTemplate(
'tpl.show_calendar_subscription.html',
true,
true,
'Services/Calendar');
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'));
691 include_once
'./Services/Calendar/classes/class.ilCalendarAuthenticationToken.php';
715 $token->setCalendar($calendar);
716 $hash = $token->add();
718 $url = ILIAS_HTTP_PATH.
'/calendar.php?client_id='.CLIENT_ID.
'&token='.$hash;
720 $tpl->setVariable(
'VAL_CAL_URL',$url);
721 $tpl->setVariable(
'VAL_CAL_URL_TXT',$url);
723 include_once(
"./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
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"));
731 return $content_block->getHTML();
740 foreach((array) $this->cal_footer as $link_info)
742 $this->tpl->setCurrentBlock(
'data_section');
743 $this->tpl->setVariable(
'DATA',
744 sprintf(
'<a href="%s">%s</a>',$link_info[
'link'],$link_info[
'txt'])
747 $this->tpl->parseCurrentBlock();
753 $this->tpl->setVariable(
"FCOLSPAN", $this->
getColSpan());
754 if ($this->tpl->blockExists(
"block_footer"))
756 $this->tpl->setCurrentBlock(
"block_footer");
757 $this->tpl->parseCurrentBlock();
776 $this->
addFooterLink($lng->txt(
"cal_upcoming_events_header"),
777 $ilCtrl->getLinkTarget($this,
"setPdModeEvents"),
778 $ilCtrl->getLinkTarget($this,
"setPdModeEvents",
"",
true),
780 false,
false, ($this->display_mode !=
'mmon'));
786 $ilCtrl->getLinkTarget($this,
"setPdModeMonth"),
787 $ilCtrl->getLinkTarget($this,
"setPdModeMonth",
"",
true),
789 false,
false, ($this->display_mode ==
'mmon'));
799 $ilUser->writePref(
"il_pd_cal_mode",
"evt");
800 $this->display_mode =
"evt";
801 if ($ilCtrl->isAsynch())
808 $ilCtrl->redirectByClass(
"ilpersonaldesktopgui",
"show");
816 $ilUser->writePref(
"il_pd_cal_mode",
"mmon");
817 $this->display_mode =
"mmon";
818 if ($ilCtrl->isAsynch())
825 $ilCtrl->redirectByClass(
"ilpersonaldesktopgui",
"show");
835 include_once(
'./Services/Calendar/classes/class.ilCalendarSchedule.php');
837 $schedule->addSubitemCalendars(
true);
838 $schedule->setEventsLimit(20);
839 $schedule->calculate();
840 $events = $schedule->getScheduledEvents();
845 foreach($events as $item)
847 $start = $item[
"dstart"];
848 $end = $item[
"dend"];
860 $ilCtrl->clearParametersByClass(
'ilcalendardaygui');
861 $ilCtrl->setParameterByClass(
'ilcalendardaygui',
'seed', $start->get(
IL_CAL_DATE));
862 $link = $ilCtrl->getLinkTargetByClass(
'ilcalendardaygui',
'');
863 $ilCtrl->clearParametersByClass(
'ilcalendardaygui');
867 "title" => $item[
"event"]->getPresentationTitle(),
877 "date" => $lng->txt(
"msg_no_search_result"),