5include_once(
"Services/Block/classes/class.ilBlockGUI.php");
6include_once
'./Services/Calendar/classes/class.ilCalendarCategories.php';
60 parent::__construct();
62 $this->tabs =
$DIC->tabs();
63 $this->obj_data_cache =
$DIC[
"ilObjDataCache"];
64 $this->ui =
$DIC->ui();
70 $ilHelp =
$DIC[
"ilHelp"];
73 $lng->loadLanguageModule(
"dateplaner");
74 $ilHelp->addHelpSection(
"cal_block");
76 include_once(
"./Services/News/classes/class.ilNewsItem.php");
78 $ilCtrl->saveParameter($this,
'bkid');
99 $this->allow_moving =
false;
102 include_once(
'Services/Calendar/classes/class.ilDate.php');
103 include_once(
'Services/Calendar/classes/class.ilCalendarUserSettings.php');
106 if ((!isset(
$_GET[
"seed"]) ||
$_GET[
"seed"] ==
"") &&
109 } elseif (isset(
$_GET[
"seed"])) {
110 $seed_str =
$_GET[
"seed"];
113 if (isset(
$_GET[
"seed"]) &&
$_GET[
"seed"] !=
"") {
118 if ($seed_str ==
"") {
139 return ($this->
settings->getShowWeeks() && $this->user_settings->getShowWeeks());
170 $this->parent_gui = $a_val;
190 $this->force_month_view = $a_val;
192 $this->display_mode =
"mmon";
215 $cmd_class =
$ilCtrl->getCmdClass();
217 if ($cmd_class ==
"ilcalendarappointmentgui" ||
218 $cmd_class ==
"ilconsultationhoursgui" ||
219 $_GET[
'cmd'] ==
'showCalendarSubscription') {
243 $next_class =
$ilCtrl->getNextClass();
244 $cmd =
$ilCtrl->getCmd(
"getHTML");
248 switch ($next_class) {
249 case "ilcalendarappointmentgui":
250 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentGUI.php');
252 $ilCtrl->forwardCommand($app_gui);
255 case "ilconsultationhoursgui":
256 include_once(
'./Services/Calendar/classes/ConsultationHours/class.ilConsultationHoursGUI.php');
258 $ilCtrl->forwardCommand($hours);
261 case "ilcalendarappointmentpresentationgui":
264 $ilCtrl->forwardCommand($presentation);
267 case "ilcalendarmonthgui":
268 $ilTabs->setSubTabActive(
'app_month');
269 include_once(
'./Services/Calendar/classes/class.ilCalendarMonthGUI.php');
271 $ilCtrl->forwardCommand($month_gui);
275 return $this->$cmd();
286 $this->enable_edit = $a_enable_edit;
296 return $this->enable_edit;
307 $this->
setRowTemplate(
"tpl.pd_event_list.html",
"Services/Calendar");
314 "tpl.calendar_block.html",
336 $target_class = array();
338 $target_class = array(
"ilpersonaldesktopgui",
"ilcalendarpresentationgui");
342 $target_class = array(
"ilobjcoursegui",
"ilcalendarpresentationgui");
346 $target_class = array(
"ilobjgroupgui",
"ilcalendarpresentationgui");
350 return $target_class;
366 include_once(
'Services/Calendar/classes/class.ilCalendarUtil.php');
368 $a_tpl->setCurrentBlock(
'month_header_col');
369 $a_tpl->setVariable(
'TXT_WEEKDAY',
$lng->txt(
"cal_week_abbrev"));
370 $a_tpl->parseCurrentBlock();
372 for (
$i = (
int) $this->user_settings->getWeekStart();
$i < (7 + (
int) $this->user_settings->getWeekStart());
$i++) {
373 $a_tpl->setCurrentBlock(
'month_header_col');
375 $a_tpl->parseCurrentBlock();
378 if (isset(
$_GET[
"bkid"])) {
379 $user_id =
$_GET[
"bkid"];
380 $disable_empty =
true;
383 $disable_empty =
false;
385 include_once(
'Services/Calendar/classes/class.ilCalendarSchedule.php');
387 $this->scheduler->addSubitemCalendars(
true);
388 $this->scheduler->calculate();
394 $this->user_settings->getWeekStart()
398 $events = $this->scheduler->getByDay($date,
$ilUser->getTimeZone());
399 $has_events = (bool) count($events);
400 if ($has_events || !$disable_empty) {
401 $a_tpl->setCurrentBlock(
'month_col_link');
403 $a_tpl->setCurrentBlock(
'month_col_no_link');
406 if ($disable_empty) {
408 $a_tpl->setVariable(
'DAY_CLASS',
'calminiinactive');
410 $week_has_events =
true;
411 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
412 foreach ($events as $event) {
414 if ($booking->hasBooked($event[
'event']->getEntryId())) {
415 $a_tpl->setVariable(
'DAY_CLASS',
'calminiapp');
420 } elseif ($has_events) {
421 $week_has_events =
true;
422 $a_tpl->setVariable(
'DAY_CLASS',
'calminiapp');
432 if ($agenda_view_type = (
int)
$_GET[
'cal_agenda_per']) {
435 $a_tpl->setVariable(
'OPEN_DAY_VIEW',
$ilCtrl->getLinkTargetByClass($this->getTargetGUIClassPath(),
''));
437 $a_tpl->setVariable(
'MONTH_DAY', $month_day);
439 $a_tpl->parseCurrentBlock();
442 $a_tpl->setCurrentBlock(
'month_col');
444 include_once(
'./Services/Calendar/classes/class.ilCalendarUtil.php');
446 $a_tpl->setVariable(
'TD_CLASS',
'calminitoday');
448 #elseif(ilDateTime::_equals($date,$this->seed,IL_CAL_DAY))
450 # $a_tpl->setVariable('TD_CLASS','calmininow');
453 $a_tpl->setVariable(
'TD_CLASS',
'calministd');
455 $a_tpl->setVariable(
'TD_CLASS',
'calminiprev');
457 $a_tpl->setVariable(
'TD_CLASS',
'calmininext');
460 $a_tpl->parseCurrentBlock();
465 $a_tpl->setCurrentBlock(
'week');
470 $a_tpl->parseCurrentBlock();
473 $a_tpl->setCurrentBlock(
'month_row');
475 $a_tpl->parseCurrentBlock();
477 $week_has_events =
false;
480 $a_tpl->setCurrentBlock(
'mini_month');
481 $a_tpl->setVariable(
'TXT_MONTH_OVERVIEW',
$lng->txt(
"cal_month_overview"));
483 $myseed = clone($this->seed);
488 $prev_link =
$ilCtrl->getLinkTarget($this,
"setSeed",
"",
true);
492 $next_link =
$ilCtrl->getLinkTarget($this,
"setSeed",
"",
true);
494 $ilCtrl->setParameter($this,
'seed',
"");
500 $b1 =
$ui->factory()->button()->standard(
$lng->txt(
"previous"),
"#")->withOnLoadCode(
function (
$id) use ($prev_link, $blockgui) {
502 "$('#" .
$id .
"').click(function() { ilBlockJSHandler('block_" . $blockgui->getBlockType() .
503 "_" . $blockgui->getBlockId() .
"','" . $prev_link .
"'); return false;});";
507 $ilCtrl->clearParameterByClass(
"ilcalendarblockgui",
'seed');
508 $month_link =
$ilCtrl->getLinkTarget($this,
"setSeed",
"",
true,
false);
509 $seed_parts = explode(
"-", $this->seed->get(
IL_CAL_DATE));
510 $b2 =
$ui->factory()->button()->month($seed_parts[1] .
"-" . $seed_parts[0])->withOnLoadCode(
function (
$id) use ($month_link, $blockgui) {
511 return "$('#" .
$id .
"').on('il.ui.button.month.changed', function(el, id, month) { var m = month.split('-'); ilBlockJSHandler('block_" . $blockgui->getBlockType() .
512 "_" . $blockgui->getBlockId() .
"','" . $month_link .
"' + '&seed=' + m[1] + '-' + m[0] + '-01'); return false;});";
515 $b3 =
$ui->factory()->button()->standard(
$lng->txt(
"next"),
"#")->withOnLoadCode(
function (
$id) use ($next_link, $blockgui) {
517 "$('#" .
$id .
"').click(function() { ilBlockJSHandler('block_" . $blockgui->getBlockType() .
518 "_" . $blockgui->getBlockId() .
"','" . $next_link .
"'); return false;});";
522 $vc =
$ui->factory()->viewControl()->section($b1, $b2, $b3);
523 $a_tpl->setVariable(
"VIEW_CTRL_SECTION",
$ui->renderer()->render($vc));
525 $a_tpl->parseCurrentBlock();
545 #if ($this->getEnableEdit())
557 include_once(
"./Services/News/classes/class.ilRSSButtonGUI.php");
559 $gui_path[] =
"ilcalendarsubscriptiongui";
561 $this->ctrl->getLinkTargetByClass($gui_path),
562 $lng->txt(
'ical_export'),
573 if (!isset(
$_GET[
"bkid"])) {
585 include_once
"Modules/Course/classes/class.ilCourseParticipants.php";
586 $obj_id = $ilObjDataCache->lookupObjId((
int)
$_GET[
'ref_id']);
588 $users = array_unique(array_merge($participants->getTutors(), $participants->getAdmins()));
590 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
592 foreach (
$users as $user_id) {
593 if (!isset(
$_GET[
"bkid"])) {
594 include_once
'./Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
599 $next_app = end($appointments);
600 reset($appointments);
602 foreach ($appointments as $entry) {
607 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
609 if (!in_array($obj_id, $booking_entry->getTargetObjIds())) {
613 if (!$booking_entry->isAppointmentBookableForUser($entry->getEntryId(),
$user->getId())) {
645 $this->cal_footer[] = array(
646 'link' =>
$ilCtrl->getLinkTargetByClass($this->getTargetGUIClassPath(),
'selectCHCalendarOfUser'),
655 $ilCtrl->setParameter($this,
"bkid",
"");
656 $ilCtrl->setParameter($this,
'seed',
'');
658 $ilCtrl->setParameter($this,
"bkid",
"");
663 $ilCtrl->setParameter($this,
"bkid", (
int)
$_GET[
"bkid"]);
669 $ilCtrl->getLinkTarget($this,
"editSettings"),
670 $lng->txt(
"settings")
675 $ret = parent::getHTML();
681 $f =
$DIC->ui()->factory()->legacy(
"");
682 $ret.=
$DIC->ui()->renderer()->renderAsync($f);
697 include_once(
'./Services/Calendar/classes/class.ilCalendarSchedule.php');
699 $events = $schedule->getChangedEvents(
true);
701 $ilCtrl->setParameterByClass(
'ilcalendarinboxgui',
'changed', 1);
702 $link =
'<a href=' .
$ilCtrl->getLinkTargetByClass(
'ilcalendarinboxgui',
'') .
'>';
703 $ilCtrl->setParameterByClass(
'ilcalendarinboxgui',
'changed',
'');
704 $text =
'<div class="small">' . ((int) count($events)) .
" " .
$lng->txt(
"cal_changed_events_header") .
"</div>";
707 return $link .
$text . $end_link;
715 $a_content_block->addHeaderCommand(
716 $ilCtrl->getParentReturn($this),
737 elseif (!$cats->getMode()) {
740 (
int)
$_GET[
'ref_id'],
755 $ilTabs->clearSubTabs();
783 $ilCtrl->returnToParent($this);
797 $tpl =
new ilTemplate(
'tpl.show_calendar_subscription.html',
true,
true,
'Services/Calendar');
799 $tpl->setVariable(
'TXT_TITLE',
$lng->txt(
'cal_subscription_header'));
800 $tpl->setVariable(
'TXT_INFO',
$lng->txt(
'cal_subscription_info'));
801 $tpl->setVariable(
'TXT_CAL_URL',
$lng->txt(
'cal_subscription_url'));
803 include_once
'./Services/Calendar/classes/class.ilCalendarAuthenticationToken.php';
805 switch ($this->mode) {
821 $token->setSelectionType($selection);
822 $token->setCalendar($calendar);
823 $hash = $token->add();
825 $url = ILIAS_HTTP_PATH .
'/calendar.php?client_id=' . CLIENT_ID .
'&token=' . $hash;
827 $tpl->setVariable(
'VAL_CAL_URL',
$url);
828 $tpl->setVariable(
'VAL_CAL_URL_TXT',
$url);
830 include_once(
"./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
832 $content_block->setContent(
$tpl->get());
833 $content_block->setTitle(
$lng->txt(
"calendar"));
834 $content_block->addHeaderCommand(
835 $this->ctrl->getParentReturn($this),
836 $lng->txt(
"selected_items_back")
839 return $content_block->getHTML();
845 foreach ((array) $this->cal_footer as $link_info) {
846 $this->tpl->setCurrentBlock(
'data_section');
847 $this->tpl->setVariable(
849 sprintf(
'<a href="%s">%s</a>', $link_info[
'link'], $link_info[
'txt'])
851 $this->tpl->parseCurrentBlock();
857 $this->tpl->setVariable(
"FCOLSPAN", $this->
getColSpan());
858 if ($this->tpl->blockExists(
"block_footer")) {
859 $this->tpl->setCurrentBlock(
"block_footer");
860 $this->tpl->parseCurrentBlock();
877 $lng->txt(
"cal_upcoming_events_header"),
878 $ilCtrl->getLinkTarget($this,
"setPdModeEvents"),
879 $ilCtrl->getLinkTarget($this,
"setPdModeEvents",
"",
true),
880 "block_" . $this->getBlockType() .
"_" . $this->block_id,
883 ($this->display_mode !=
'mmon')
887 $lng->txt(
"app_month"),
888 $ilCtrl->getLinkTarget($this,
"setPdModeMonth"),
889 $ilCtrl->getLinkTarget($this,
"setPdModeMonth",
"",
true),
890 "block_" . $this->getBlockType() .
"_" . $this->block_id,
893 ($this->display_mode ==
'mmon')
898 $ilCtrl->setParameterByClass(
'ilcalendarpresentationgui',
'seed',
'');
900 $lng->txt(
"cal_open_calendar"),
901 $ilCtrl->getLinkTargetByClass($this->getTargetGUIClassPath(),
""),
903 "block_" . $this->getBlockType() .
"_" . $this->block_id,
908 $ilCtrl->setParameter($this,
"add_mode",
"");
910 $lng->txt(
"add_appointment"),
911 $ilCtrl->getLinkTargetByClass(
"ilCalendarAppointmentGUI",
"add"),
913 "block_" . $this->getBlockType() .
"_" . $this->block_id,
917 $ilCtrl->setParameter($this,
"add_mode",
"");
928 $ilUser->writePref(
"il_pd_cal_mode",
"evt");
929 $this->display_mode =
"evt";
934 $ilCtrl->redirectByClass(
"ilpersonaldesktopgui",
"show");
943 $ilUser->writePref(
"il_pd_cal_mode",
"mmon");
944 $this->display_mode =
"mmon";
949 $ilCtrl->redirectByClass(
"ilpersonaldesktopgui",
"show");
963 include_once(
'./Services/Calendar/classes/class.ilCalendarSchedule.php');
965 $schedule->addSubitemCalendars(
true);
966 $schedule->setEventsLimit(20);
967 $schedule->calculate();
968 $ev = $schedule->getScheduledEvents();
982 if (
sizeof($events)) {
983 foreach ($events as $item) {
984 $this->ctrl->setParameter($this,
"app_id", $item[
"event"]->getEntryId());
985 $this->ctrl->setParameter($this,
'dt', $item[
'dstart']);
986 $url = $this->ctrl->getLinkTarget($this,
"getModalForApp",
"",
true,
false);
987 $this->ctrl->setParameter($this,
"app_id",
$_GET[
"app_id"]);
988 $this->ctrl->setParameter($this,
"dt",
$_GET[
"dt"]);
989 $modal = $f->modal()->roundtrip(
'', [])->withAsyncRenderUrl(
$url);
993 $comps = [$f->button()->shy($item[
"event"]->getPresentationTitle(),
"")->withOnClick($modal->getShowSignal()), $modal];
994 $renderer =
$ui->renderer();
995 $shy = $renderer->render($comps);
999 "title" => $item[
"event"]->getPresentationTitle(),
1001 "shy_button" => $shy
1007 "date" =>
$lng->txt(
"msg_no_search_result"),
1026 $start = $item[
"dstart"];
1027 $end = $item[
"dend"];
1028 if ($item[
"fullday"]) {
1035 return array(
"start" => $start,
"end" =>
$end);
1049 $f =
$ui->factory();
1050 $r =
$ui->renderer();
1054 foreach ($events as $item) {
1055 if ($item[
"event"]->getEntryId() == (
int)
$_GET[
"app_id"] && $item[
'dstart'] == (
int)
$_GET[
'dt']) {
1059 include_once(
"./Services/Calendar/classes/class.ilCalendarAppointmentPresentationGUI.php");
1061 $content =
$ilCtrl->getHTML($next_gui);
1064 echo
$r->renderAsync($modal);
sprintf('%.4f', $callTime)
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
An exception for terminatinating execution or to throw for unit testing.
This class represents a block method of a block.
setRowTemplate($a_rowtemplatename, $a_rowtemplatedir="")
Set Row Template Name.
setLimit($a_limit)
Set Limit.
getCurrentDetailLevel()
Get Current Detail Level.
getBlockId()
Get Block Id.
setAvailableDetailLevels($a_max, $a_min=0)
Set Available Detail Levels.
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.
getRepositoryMode()
Get RepositoryMode.
fillFooterLinks($a_top=false, $a_numinfo="")
Fill footer links.
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
fillDataSection()
Standard implementation for row based data.
setColSpan($a_colspan)
Set Columns Span.
setTitle($a_title)
Set Title.
setBlockId($a_block_id=0)
Set Block Id.
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
addBlockCommand( $a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
Add Block Command.
getColSpan()
Get Columns Span.
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...
Administrate calendar appointments.
static _getInstance(ilDate $seed, $a_app)
get singleton instance
Handles calendar authentication tokens for external calendar subscriptions.
static lookupAuthToken($a_user_id, $a_selection, $a_calendar=0)
Calendar blocks, displayed in different contexts, e.g.
setParentGUI($a_val)
Set parent gui.
getEnableEdit()
Get EnableEdit.
setEnableEdit($a_enable_edit=0)
Set EnableEdit.
initCategories()
init categories
static getBlockType()
Get block type.
addMiniMonth($a_tpl)
Add mini version of monthly overview (Maybe extracted to another class, if used in pd calendar tab.
addCloseCommand($a_content_block)
getDatesForItem($item)
Get start/end date for item.
fillDataSection()
Fill data section.
getModalForApp()
Get modal for appointment (see similar code in ilCalendarAgendaListGUI) todo use all this methods fro...
getShowWeeksColumn()
Show weeks column.
getHTML()
Get bloch HTML code.
executeCommand()
execute command
__construct()
Constructor.
getOverview()
Get overview.
static getScreenMode()
Get Screen Mode for current command.
getParentGUI()
Get parent gui.
returnToUpperContext()
Return to upper context.
showCalendarSubscription()
static isRepositoryObject()
Is this a repository object.
getTargetGUIClassPath()
Get target gui class path (for presenting the calendar)
getForceMonthView()
Get force month view.
setForceMonthView($a_val)
Set force month view.
const MODE_PERSONAL_DESKTOP_MEMBERSHIP
const MODE_PERSONAL_DESKTOP_ITEMS
const MODE_REPOSITORY_CONTAINER_ONLY
static _getInstance($a_usr_id=0)
get singleton instance
Represents a list of calendar appointments (including recurring events) for a specific user in a give...
static _getInstance()
get singleton instance
static _getInstanceByUserId($a_user_id)
get singleton instance
static _isToday($date)
check if a date is today
static _numericDayToString($a_day, $a_long=true)
get
static _buildMonthDayList($a_month, $a_year, $weekstart)
Build a month day list.
static getAppointments($a_user_id)
Get all appointments.
Consultation hours editor.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
@classDescription Date and time handling
static _equals(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
Check if two date are equal.
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 _lookupFullname($a_user_id)
Lookup Full Name.
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
BlockGUI class for (centered) Content on Personal Desktop.
special template class to simplify handling of ITX/PEAR
if(!array_key_exists('StateId', $_REQUEST)) $id