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");
140 return self::$block_type;
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';
524 foreach($users as $user_id)
526 if(!isset($_GET[
"bkid"]))
528 include_once
'./Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
533 $next_app = end($appointments);
534 reset($appointments);
536 foreach($appointments as $entry)
543 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
545 if(!$booking_entry->isAppointmentBookableForUser($entry->getEntryId(),
$GLOBALS[
'ilUser']->getId()))
553 $ilCtrl->setParameter($this,
"bkid", $user_id);
556 $ilCtrl->setParameter(
564 $ilCtrl->getLinkTargetByClass(
565 "ilCalendarMonthGUI",
570 $this->cal_footer[] = array(
571 'link' => $ilCtrl->getLinkTargetByClass(
'ilCalendarMonthGUI',
''),
577 $ilCtrl->setParameter($this,
"bkid",
"");
578 $ilCtrl->setParameter($this,
'seed',
'');
582 $ilCtrl->setParameter($this,
"bkid",
"");
584 $ilCtrl->getLinkTarget($this),
586 $ilCtrl->setParameter($this,
"bkid", (
int)
$_GET[
"bkid"]);
593 $ilCtrl->getLinkTarget($this,
"editSettings"),
594 $lng->txt(
"settings"));
597 $ilCtrl->setParameterByClass(
"ilcolumngui",
"seed", isset(
$_GET[
"seed"]) ?
$_GET[
"seed"] :
"");
598 $ret = parent::getHTML();
599 $ilCtrl->setParameterByClass(
"ilcolumngui",
"seed",
"");
611 include_once(
'./Services/Calendar/classes/class.ilCalendarSchedule.php');
613 $events = $schedule->getChangedEvents(
true);
615 $ilCtrl->setParameterByClass(
'ilcalendarinboxgui',
'changed', 1);
616 $link =
'<a href='.$ilCtrl->getLinkTargetByClass(
'ilcalendarinboxgui',
'').
'>';
617 $ilCtrl->setParameterByClass(
'ilcalendarinboxgui',
'changed',
'');
618 $text =
'<div class="small">'.((int) count($events)).
" ".$lng->txt(
"cal_changed_events_header").
"</div>";
621 return $link.$text.$end_link;
628 $a_content_block->addHeaderCommand($ilCtrl->getParentReturn($this),
629 $lng->txt(
"close"),
true);
643 include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
645 if(!isset(
$_GET[
'bkid']))
666 $ilTabs->clearSubTabs();
673 $ilTabs->addSubTabTarget(
'app_day',$this->ctrl->getLinkTargetByClass(
'ilCalendarDayGUI',
''));
674 $ilTabs->addSubTabTarget(
'app_week',$this->ctrl->getLinkTargetByClass(
'ilCalendarWeekGUI',
''));
675 $ilTabs->addSubTabTarget(
'app_month',$this->ctrl->getLinkTargetByClass(
'ilCalendarMonthGUI',
''));
690 if ($ilCtrl->isAsynch())
708 $ilCtrl->returnToParent($this);
716 $tpl =
new ilTemplate(
'tpl.show_calendar_subscription.html',
true,
true,
'Services/Calendar');
718 $tpl->setVariable(
'TXT_TITLE',$lng->txt(
'cal_subscription_header'));
719 $tpl->setVariable(
'TXT_INFO',$lng->txt(
'cal_subscription_info'));
720 $tpl->setVariable(
'TXT_CAL_URL',$lng->txt(
'cal_subscription_url'));
722 include_once
'./Services/Calendar/classes/class.ilCalendarAuthenticationToken.php';
746 $token->setCalendar($calendar);
747 $hash = $token->add();
749 $url = ILIAS_HTTP_PATH.
'/calendar.php?client_id='.CLIENT_ID.
'&token='.$hash;
751 $tpl->setVariable(
'VAL_CAL_URL',$url);
752 $tpl->setVariable(
'VAL_CAL_URL_TXT',$url);
754 include_once(
"./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
756 $content_block->setContent(
$tpl->get());
757 $content_block->setTitle($lng->txt(
"calendar"));
758 $content_block->addHeaderCommand($this->ctrl->getParentReturn($this),
759 $lng->txt(
"selected_items_back"));
761 return $content_block->getHTML();
770 foreach((array) $this->cal_footer as $link_info)
772 $this->tpl->setCurrentBlock(
'data_section');
773 $this->tpl->setVariable(
'DATA',
774 sprintf(
'<a href="%s">%s</a>',$link_info[
'link'],$link_info[
'txt'])
777 $this->tpl->parseCurrentBlock();
783 $this->tpl->setVariable(
"FCOLSPAN", $this->
getColSpan());
784 if ($this->tpl->blockExists(
"block_footer"))
786 $this->tpl->setCurrentBlock(
"block_footer");
787 $this->tpl->parseCurrentBlock();
806 $this->
addFooterLink($lng->txt(
"cal_upcoming_events_header"),
807 $ilCtrl->getLinkTarget($this,
"setPdModeEvents"),
808 $ilCtrl->getLinkTarget($this,
"setPdModeEvents",
"",
true),
810 false,
false, ($this->display_mode !=
'mmon'));
816 $ilCtrl->getLinkTarget($this,
"setPdModeMonth"),
817 $ilCtrl->getLinkTarget($this,
"setPdModeMonth",
"",
true),
819 false,
false, ($this->display_mode ==
'mmon'));
829 $ilUser->writePref(
"il_pd_cal_mode",
"evt");
830 $this->display_mode =
"evt";
831 if ($ilCtrl->isAsynch())
838 $ilCtrl->redirectByClass(
"ilpersonaldesktopgui",
"show");
846 $ilUser->writePref(
"il_pd_cal_mode",
"mmon");
847 $this->display_mode =
"mmon";
848 if ($ilCtrl->isAsynch())
855 $ilCtrl->redirectByClass(
"ilpersonaldesktopgui",
"show");
865 include_once(
'./Services/Calendar/classes/class.ilCalendarSchedule.php');
867 $schedule->addSubitemCalendars(
true);
868 $schedule->setEventsLimit(20);
869 $schedule->calculate();
870 $events = $schedule->getScheduledEvents();
875 foreach($events as $item)
877 $start = $item[
"dstart"];
878 $end = $item[
"dend"];
890 $ilCtrl->clearParametersByClass(
'ilcalendardaygui');
891 $ilCtrl->setParameterByClass(
'ilcalendardaygui',
'seed',$start->get(
IL_CAL_DATE));
892 $link = $ilCtrl->getLinkTargetByClass(
'ilcalendardaygui',
'');
893 $ilCtrl->clearParametersByClass(
'ilcalendardaygui');
897 "title" => $item[
"event"]->getPresentationTitle(),
907 "date" => $lng->txt(
"msg_no_search_result"),
static _buildMonthDayList($a_month, $a_year, $weekstart)
Build a month day list.
Consultation hours editor.
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.
static getScreenMode()
Get Screen Mode for current command.
const MODE_PERSONAL_DESKTOP_MEMBERSHIP
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.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
showCalendarSubscription()
setEnableEdit($a_enable_edit=0)
Set EnableEdit.
fillFooterLinks($a_top=false, $a_numinfo="")
Fill footer links.
addBlockCommand($a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
Add Block Command.
static getBlockType()
Get block type.
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
getHTML()
Get bloch HTML code.
_lookupFullname($a_user_id)
Lookup Full Name.
setColSpan($a_colspan)
Set Columns Span.
initCategories()
init categories
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.
fillDataSection()
Fill data section.
setTitle($a_title)
Set Title.
setBlockId($a_block_id=0)
Set Block Id.
static getAppointments($a_user_id)
Get all appointments.
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
setAvailableDetailLevels($a_max, $a_min=0)
Set Available Detail Levels.
addCloseCommand($a_content_block)
static _getInstance($a_usr_id=0)
get singleton instance
getBlockId()
Get Block Id.
setLimit($a_limit)
Set Limit.
Administrate calendar appointments.
Calendar blocks, displayed in different contexts, e.g.
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.
setSelectionType($a_type)
set selection type
fillDataSection()
Standard implementation for row based data.
getOverview()
Get overview.
static _isToday($date)
check if a date is today
getCurrentDetailLevel()
Get Current Detail Level.
Represents a list of calendar appointments (including recurring events) for a specific user in a give...
const MODE_PERSONAL_DESKTOP_ITEMS