24 include_once(
"Services/Block/classes/class.ilBlockGUI.php");
25 include_once
'./Services/Calendar/classes/class.ilCalendarCategories.php';
61 $lng->loadLanguageModule(
"dateplaner");
62 include_once(
"./Services/News/classes/class.ilNewsItem.php");
64 $ilCtrl->saveParameter($this,
'bkid');
76 if(!isset(
$_GET[
"bkid"]))
78 $title = $lng->txt(
"calendar");
88 $this->allow_moving =
false;
91 include_once(
'Services/Calendar/classes/class.ilDate.php');
92 include_once(
'Services/Calendar/classes/class.ilCalendarUserSettings.php');
95 if ((!isset(
$_GET[
"seed"]) ||
$_GET[
"seed"] ==
"") &&
98 $seed_str =
$_SESSION[
"il_cal_block_".$this->getBlockType().
"_".$this->
getBlockId().
"_seed"];
100 else if (isset(
$_GET[
"seed"]))
102 $seed_str =
$_GET[
"seed"];
105 if (isset(
$_GET[
"seed"]) &&
$_GET[
"seed"] !=
"")
121 $tpl->addCSS(
"./Services/Calendar/css/calendar.css");
123 $tpl->addCSS(
"./Services/Calendar/templates/default/delos.css");
153 $cmd_class = $ilCtrl->getCmdClass();
155 if ($cmd_class ==
"ilcalendarappointmentgui" ||
156 $cmd_class ==
"ilcalendardaygui" ||
157 $cmd_class ==
"ilcalendarweekgui" ||
158 $cmd_class ==
"ilcalendarmonthgui" ||
159 $cmd_class ==
"ilcalendarinboxgui" ||
160 $cmd_class ==
"ilconsultationhoursgui" ||
161 $_GET[
'cmd'] ==
'showCalendarSubscription')
166 switch($ilCtrl->getCmd())
185 $next_class = $ilCtrl->getNextClass();
186 $cmd = $ilCtrl->getCmd(
"getHTML");
192 case "ilcalendarappointmentgui":
193 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentGUI.php');
195 $ilCtrl->forwardCommand($app_gui);
198 case "ilcalendardaygui":
199 $ilTabs->setSubTabActive(
'app_day');
200 include_once(
'./Services/Calendar/classes/class.ilCalendarDayGUI.php');
202 $ilCtrl->forwardCommand($day_gui);
205 case "ilcalendarweekgui":
206 $ilTabs->setSubTabActive(
'app_week');
207 include_once(
'./Services/Calendar/classes/class.ilCalendarWeekGUI.php');
209 $ilCtrl->forwardCommand($week_gui);
212 case "ilcalendarmonthgui":
213 $ilTabs->setSubTabActive(
'app_month');
214 include_once(
'./Services/Calendar/classes/class.ilCalendarMonthGUI.php');
216 $ilCtrl->forwardCommand($month_gui);
219 case "ilcalendarinboxgui":
220 include_once(
'./Services/Calendar/classes/class.ilCalendarInboxGUI.php');
222 $ilCtrl->forwardCommand($inbox);
225 case "ilconsultationhoursgui":
226 include_once(
'./Services/Calendar/classes/ConsultationHours/class.ilConsultationHoursGUI.php');
228 $ilCtrl->forwardCommand($hours);
232 return $this->
$cmd();
243 $this->enable_edit = $a_enable_edit;
253 return $this->enable_edit;
264 "Services/Calendar");
284 include_once(
'Services/Calendar/classes/class.ilCalendarUtil.php');
285 $a_tpl->setCurrentBlock(
'month_header_col');
286 $a_tpl->setVariable(
'TXT_WEEKDAY', $lng->txt(
"cal_week_abbrev"));
287 $a_tpl->parseCurrentBlock();
288 for($i = (
int) $this->user_settings->getWeekStart();$i < (7 + (int) $this->user_settings->getWeekStart());$i++)
290 $a_tpl->setCurrentBlock(
'month_header_col');
292 $a_tpl->parseCurrentBlock();
295 if(isset(
$_GET[
"bkid"]))
297 $user_id =
$_GET[
"bkid"];
298 $disable_empty =
true;
302 $user_id = $ilUser->getId();
303 $disable_empty =
false;
305 include_once(
'Services/Calendar/classes/class.ilCalendarSchedule.php');
307 $this->scheduler->addSubitemCalendars(
true);
308 $this->scheduler->calculate();
313 $this->user_settings->getWeekStart())->
get() as $date)
317 $events = $this->scheduler->getByDay($date,$ilUser->getTimeZone());
318 $has_events = (bool)count($events);
319 if($has_events || !$disable_empty)
321 $a_tpl->setCurrentBlock(
'month_col_link');
325 $a_tpl->setCurrentBlock(
'month_col_no_link');
332 $a_tpl->setVariable(
'DAY_CLASS',
'calminiinactive');
336 $week_has_events =
true;
337 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
338 foreach($events as $event)
341 if($booking->hasBooked($event[
'event']->getEntryId()))
343 $a_tpl->setVariable(
'DAY_CLASS',
'calminiapp');
351 $week_has_events =
true;
352 $a_tpl->setVariable(
'DAY_CLASS',
'calminiapp');
361 $ilCtrl->clearParametersByClass(
'ilcalendardaygui');
362 $ilCtrl->setParameterByClass(
'ilcalendardaygui',
'seed',$date->get(
IL_CAL_DATE));
363 $a_tpl->setVariable(
'OPEN_DAY_VIEW', $ilCtrl->getLinkTargetByClass(
'ilcalendardaygui',
''));
364 $ilCtrl->clearParametersByClass(
'ilcalendardaygui');
366 $a_tpl->setVariable(
'MONTH_DAY',$month_day);
368 $a_tpl->parseCurrentBlock();
371 $a_tpl->setCurrentBlock(
'month_col');
373 include_once(
'./Services/Calendar/classes/class.ilCalendarUtil.php');
376 $a_tpl->setVariable(
'TD_CLASS',
'calminitoday');
378 #elseif(ilDateTime::_equals($date,$this->seed,IL_CAL_DAY))
380 # $a_tpl->setVariable('TD_CLASS','calmininow');
384 $a_tpl->setVariable(
'TD_CLASS',
'calministd');
388 $a_tpl->setVariable(
'TD_CLASS',
'calminiprev');
392 $a_tpl->setVariable(
'TD_CLASS',
'calmininext');
395 $a_tpl->parseCurrentBlock();
398 if($counter and !($counter % 7))
400 if(!$disable_empty || $week_has_events)
402 $a_tpl->setCurrentBlock(
'month_row_link');
403 $ilCtrl->clearParametersByClass(
'ilcalendarweekgui');
404 $ilCtrl->setParameterByClass(
'ilcalendarweekgui',
'seed',$date->get(
IL_CAL_DATE));
405 $a_tpl->setVariable(
'OPEN_WEEK_VIEW', $ilCtrl->getLinkTargetByClass(
'ilcalendarweekgui',
''));
406 $ilCtrl->clearParametersByClass(
'ilcalendarweekgui');
410 $a_tpl->setCurrentBlock(
'month_row_no_link');
411 $a_tpl->setVariable(
'WEEK_CLASS',
'calminiinactive');
413 $a_tpl->setVariable(
'WEEK',
415 $a_tpl->parseCurrentBlock();
417 $a_tpl->setCurrentBlock(
'month_row');
418 $a_tpl->setVariable(
'TD_CLASS',
'calminiweek');
419 $a_tpl->parseCurrentBlock();
421 $week_has_events =
false;
424 $a_tpl->setCurrentBlock(
'mini_month');
425 $a_tpl->setVariable(
'TXT_MONTH_OVERVIEW', $lng->txt(
"cal_month_overview"));
426 $a_tpl->setVariable(
'TXT_MONTH',
429 $myseed = clone($this->seed);
430 $ilCtrl->setParameterByClass(
'ilcalendarmonthgui',
'seed',$myseed->get(
IL_CAL_DATE));
431 $a_tpl->setVariable(
'OPEN_MONTH_VIEW',$ilCtrl->getLinkTargetByClass(
'ilcalendarmonthgui',
''));
434 $ilCtrl->setParameter($this,
'seed',$myseed->get(
IL_CAL_DATE));
437 $a_tpl->setVariable(
'BL_ID', $this->
getBlockId());
439 $a_tpl->setVariable(
'PREV_MONTH',
440 $ilCtrl->getLinkTarget($this,
"setSeed"));
441 $a_tpl->setVariable(
'PREV_MONTH_ASYNC',
442 $ilCtrl->getLinkTarget($this,
"setSeed",
"",
true));
445 $ilCtrl->setParameter($this,
'seed',$myseed->get(
IL_CAL_DATE));
446 $a_tpl->setVariable(
'NEXT_MONTH',
447 $ilCtrl->getLinkTarget($this,
"setSeed"));
448 $a_tpl->setVariable(
'NEXT_MONTH_ASYNC',
449 $ilCtrl->getLinkTarget($this,
"setSeed",
"",
true));
451 $ilCtrl->setParameter($this,
'seed',
"");
452 $a_tpl->parseCurrentBlock();
468 #if ($this->getEnableEdit())
474 $this->ctrl->getLinkTarget($this,
'showCalendarSubscription'),
475 $lng->txt(
'ical_export'),
485 if(!isset(
$_GET[
"bkid"]))
487 if($ilAccess->checkAccess(
'edit_event',
'',(
int)
$_GET[
'ref_id']))
489 $ilCtrl->setParameter($this,
"add_mode",
"block");
491 $ilCtrl->getLinkTargetByClass(
"ilCalendarAppointmentGUI",
493 $lng->txt(
"add_appointment"));
494 $ilCtrl->setParameter($this,
"add_mode",
"");
497 global $ilObjDataCache;
499 include_once
"Modules/Course/classes/class.ilCourseParticipants.php";
500 $obj_id = $ilObjDataCache->lookupObjId((
int) $_GET[
'ref_id']);
502 $users = array_unique(array_merge($participants->getTutors(), $participants->getAdmins()));
504 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
508 foreach($users as $user_id)
510 if(!isset($_GET[
"bkid"]) || $_GET[
"bkid"] != $user_id)
512 $ilCtrl->setParameter($this,
"bkid", $user_id);
514 $ilCtrl->getLinkTargetByClass(
"ilCalendarMonthGUI",
519 $ilCtrl->setParameter($this,
"bkid",
"");
524 $ilCtrl->setParameter($this,
"bkid",
"");
526 $ilCtrl->getLinkTarget($this),
528 $ilCtrl->setParameter($this,
"bkid", (
int)
$_GET[
"bkid"]);
535 $ilCtrl->getLinkTarget($this,
"editSettings"),
536 $lng->txt(
"settings"));
539 $ilCtrl->setParameterByClass(
"ilcolumngui",
"seed", isset(
$_GET[
"seed"]) ?
$_GET[
"seed"] :
"");
541 $ilCtrl->setParameterByClass(
"ilcolumngui",
"seed",
"");
562 include_once(
'./Services/Calendar/classes/class.ilCalendarSchedule.php');
564 $events = $schedule->getChangedEvents(
true);
566 $ilCtrl->setParameterByClass(
'ilcalendarinboxgui',
'changed', 1);
567 $link =
'<a href='.$ilCtrl->getLinkTargetByClass(
'ilcalendarinboxgui',
'').
'>';
568 $ilCtrl->setParameterByClass(
'ilcalendarinboxgui',
'changed',
'');
569 $text =
'<div class="small">'.((int) count($events)).
" ".$lng->txt(
"cal_changed_events_header").
"</div>";
572 return $link.$text.$end_link;
579 $a_content_block->addHeaderCommand($ilCtrl->getParentReturn($this),
580 $lng->txt(
"close"),
true);
594 include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
596 if(!isset(
$_GET[
'bkid']))
615 $ilTabs->clearSubTabs();
622 $ilTabs->addSubTabTarget(
'app_day',$this->ctrl->getLinkTargetByClass(
'ilCalendarDayGUI',
''));
623 $ilTabs->addSubTabTarget(
'app_week',$this->ctrl->getLinkTargetByClass(
'ilCalendarWeekGUI',
''));
624 $ilTabs->addSubTabTarget(
'app_month',$this->ctrl->getLinkTargetByClass(
'ilCalendarMonthGUI',
''));
639 if ($ilCtrl->isAsynch())
657 $ilCtrl->returnToParent($this);
663 global
$lng, $ilUser;
665 $tpl =
new ilTemplate(
'tpl.show_calendar_subscription.html',
true,
true,
'Services/Calendar');
667 $tpl->setVariable(
'TXT_TITLE',$lng->txt(
'cal_subscription_header'));
668 $tpl->setVariable(
'TXT_INFO',$lng->txt(
'cal_subscription_info'));
669 $tpl->setVariable(
'TXT_CAL_URL',$lng->txt(
'cal_subscription_url'));
671 include_once
'./Services/Calendar/classes/class.ilCalendarAuthenticationToken.php';
695 $token->setCalendar($calendar);
696 $hash = $token->add();
698 $url = ILIAS_HTTP_PATH.
'/calendar.php?client_id='.CLIENT_ID.
'&token='.$hash;
700 $tpl->setVariable(
'VAL_CAL_URL',$url);
701 $tpl->setVariable(
'VAL_CAL_URL_TXT',$url);
703 include_once(
"./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
705 $content_block->setContent(
$tpl->get());
706 $content_block->setTitle($lng->txt(
"calendar"));
707 #$content_block->setImage(ilUtil::getImagePath("icon_news.gif"));
708 $content_block->addHeaderCommand($this->ctrl->getParentReturn($this),
709 $lng->txt(
"selected_items_back"));
711 return $content_block->getHTML();