5include_once(
"Services/Block/classes/class.ilBlockGUI.php");
6include_once
'./Services/Calendar/classes/class.ilCalendarCategories.php';
61 $this->tabs =
$DIC->tabs();
62 $this->obj_data_cache =
$DIC[
"ilObjDataCache"];
63 $this->
ui = $DIC->ui();
69 $ilHelp =
$DIC[
"ilHelp"];
71 $lng->loadLanguageModule(
"dateplaner");
72 $ilHelp->addHelpSection(
"cal_block");
74 include_once(
"./Services/News/classes/class.ilNewsItem.php");
76 $ilCtrl->saveParameter($this,
'bkid');
87 $this->allow_moving =
false;
89 include_once(
'Services/Calendar/classes/class.ilDate.php');
90 include_once(
'Services/Calendar/classes/class.ilCalendarUserSettings.php');
93 if ((!isset(
$_GET[
"seed"]) ||
$_GET[
"seed"] ==
"") &&
96 } elseif (isset(
$_GET[
"seed"])) {
97 $seed_str =
$_GET[
"seed"];
100 if (isset(
$_GET[
"seed"]) &&
$_GET[
"seed"] !=
"") {
105 if ($seed_str ==
"") {
118 if ($this->display_mode !==
"mmon") {
130 return ($this->
settings->getShowWeeks() && $this->user_settings->getShowWeeks());
155 $this->parent_gui = $a_val;
173 $this->force_month_view = $a_val;
175 $this->display_mode =
"mmon";
198 $cmd_class =
$ilCtrl->getCmdClass();
200 if ($cmd_class ==
"ilcalendarappointmentgui" ||
201 $cmd_class ==
"ilconsultationhoursgui" ||
202 $_GET[
'cmd'] ==
'showCalendarSubscription') {
225 $next_class =
$ilCtrl->getNextClass();
226 $cmd =
$ilCtrl->getCmd(
"getHTML");
230 switch ($next_class) {
231 case "ilcalendarappointmentgui":
232 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentGUI.php');
234 $ilCtrl->forwardCommand($app_gui);
237 case "ilconsultationhoursgui":
238 include_once(
'./Services/Calendar/classes/ConsultationHours/class.ilConsultationHoursGUI.php');
240 $ilCtrl->forwardCommand($hours);
243 case "ilcalendarappointmentpresentationgui":
249 case "ilcalendarmonthgui":
250 $ilTabs->setSubTabActive(
'app_month');
251 include_once(
'./Services/Calendar/classes/class.ilCalendarMonthGUI.php');
253 $ilCtrl->forwardCommand($month_gui);
257 return $this->$cmd();
267 $this->enable_edit = $a_enable_edit;
276 return $this->enable_edit;
284 if ($this->display_mode !=
"mmon") {
285 $this->
setRowTemplate(
"tpl.pd_event_list.html",
"Services/Calendar");
290 "tpl.calendar_block.html",
308 $target_class = array();
310 $target_class = array(
"ildashboardgui",
"ilcalendarpresentationgui");
314 $target_class = array(
"ilobjcoursegui",
"ilcalendarpresentationgui");
318 $target_class = array(
"ilobjgroupgui",
"ilcalendarpresentationgui");
322 return $target_class;
337 include_once(
'Services/Calendar/classes/class.ilCalendarUtil.php');
339 $a_tpl->setCurrentBlock(
'month_header_col');
340 $a_tpl->setVariable(
'TXT_WEEKDAY',
$lng->txt(
"cal_week_abbrev"));
341 $a_tpl->parseCurrentBlock();
343 for (
$i = (
int) $this->user_settings->getWeekStart();
$i < (7 + (
int) $this->user_settings->getWeekStart());
$i++) {
344 $a_tpl->setCurrentBlock(
'month_header_col');
346 $a_tpl->parseCurrentBlock();
349 if (isset(
$_GET[
"bkid"])) {
350 $user_id =
$_GET[
"bkid"];
351 $disable_empty =
true;
354 $disable_empty =
false;
356 include_once(
'Services/Calendar/classes/class.ilCalendarSchedule.php');
358 $this->scheduler->addSubitemCalendars(
true);
359 $this->scheduler->calculate();
365 $this->user_settings->getWeekStart()
369 $events = $this->scheduler->getByDay($date,
$ilUser->getTimeZone());
370 $has_events = (bool) count($events);
371 if ($has_events || !$disable_empty) {
372 $a_tpl->setCurrentBlock(
'month_col_link');
374 $a_tpl->setCurrentBlock(
'month_col_no_link');
377 if ($disable_empty) {
379 $a_tpl->setVariable(
'DAY_CLASS',
'calminiinactive');
381 $week_has_events =
true;
382 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
383 foreach ($events as $event) {
385 if ($booking->hasBooked($event[
'event']->getEntryId())) {
386 $a_tpl->setVariable(
'DAY_CLASS',
'calminiapp');
391 } elseif ($has_events) {
392 $week_has_events =
true;
393 $a_tpl->setVariable(
'DAY_CLASS',
'calminiapp');
402 if ($agenda_view_type = (
int)
$_GET[
'cal_agenda_per']) {
405 $a_tpl->setVariable(
'OPEN_DAY_VIEW',
$ilCtrl->getLinkTargetByClass($this->getTargetGUIClassPath(),
''));
407 $a_tpl->setVariable(
'MONTH_DAY', $month_day);
409 $a_tpl->parseCurrentBlock();
411 $a_tpl->setCurrentBlock(
'month_col');
413 include_once(
'./Services/Calendar/classes/class.ilCalendarUtil.php');
415 $a_tpl->setVariable(
'TD_CLASS',
'calminitoday');
417 #elseif(ilDateTime::_equals($date,$this->seed,IL_CAL_DAY))
419 # $a_tpl->setVariable('TD_CLASS','calmininow');
422 $a_tpl->setVariable(
'TD_CLASS',
'calministd');
424 $a_tpl->setVariable(
'TD_CLASS',
'calminiprev');
426 $a_tpl->setVariable(
'TD_CLASS',
'calmininext');
429 $a_tpl->parseCurrentBlock();
431 if ($counter and !($counter % 7)) {
433 $a_tpl->setCurrentBlock(
'week');
438 $a_tpl->parseCurrentBlock();
441 $a_tpl->setCurrentBlock(
'month_row');
443 $a_tpl->parseCurrentBlock();
445 $week_has_events =
false;
448 $a_tpl->setCurrentBlock(
'mini_month');
451 if ($a_include_view_ctrl) {
452 $a_tpl->setVariable(
"VIEW_CTRL_SECTION",
$ui->renderer()->render($this->getViewControl()));
455 $a_tpl->parseCurrentBlock();
468 $first_of_month = substr($this->seed->get(
IL_CAL_DATE), 0, 7) .
"-01";
474 $prev_link =
$ilCtrl->getLinkTarget($this,
"setSeed",
"",
true);
478 $next_link =
$ilCtrl->getLinkTarget($this,
"setSeed",
"",
true);
480 $ilCtrl->setParameter($this,
'seed',
"");
486 $b1 =
$ui->factory()->button()->standard(
$lng->txt(
"previous"),
"#")->withOnLoadCode(
function ($id) use ($prev_link, $blockgui) {
488 "$('#" . $id .
"').click(function() { ilBlockJSHandler('block_" . $blockgui->getBlockType() .
489 "_" . $blockgui->getBlockId() .
"','" . $prev_link .
"'); return false;});";
493 $ilCtrl->clearParameterByClass(
"ilcalendarblockgui",
'seed');
494 $month_link =
$ilCtrl->getLinkTarget($this,
"setSeed",
"",
true,
false);
495 $seed_parts = explode(
"-", $this->seed->get(
IL_CAL_DATE));
496 $b2 =
$ui->factory()->button()->month($seed_parts[1] .
"-" . $seed_parts[0])->withOnLoadCode(
function ($id) use ($month_link, $blockgui) {
497 return "$('#" . $id .
"').on('il.ui.button.month.changed', function(el, id, month) { var m = month.split('-'); ilBlockJSHandler('block_" . $blockgui->getBlockType() .
498 "_" . $blockgui->getBlockId() .
"','" . $month_link .
"' + '&seed=' + m[1] + '-' + m[0] + '-01'); return false;});";
501 $b3 =
$ui->factory()->button()->standard(
$lng->txt(
"next"),
"#")->withOnLoadCode(
function ($id) use ($next_link, $blockgui) {
503 "$('#" . $id .
"').click(function() { ilBlockJSHandler('block_" . $blockgui->getBlockType() .
504 "_" . $blockgui->getBlockId() .
"','" . $next_link .
"'); return false;});";
507 return $ui->factory()->viewControl()->section($b1, $b2, $b3);
522 if (!isset(
$_GET[
"bkid"])) {
523 include_once
"Modules/Course/classes/class.ilCourseParticipants.php";
524 $obj_id = $ilObjDataCache->lookupObjId((
int)
$_GET[
'ref_id']);
526 $users = array_unique(array_merge($participants->getTutors(), $participants->getAdmins()));
528 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
530 foreach ($users as $user_id) {
531 if (!isset(
$_GET[
"bkid"])) {
532 include_once
'./Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
537 $next_app = end($appointments);
538 reset($appointments);
540 foreach ($appointments as $entry) {
545 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
547 if (!in_array($obj_id, $booking_entry->getTargetObjIds())) {
551 if (!$booking_entry->isAppointmentBookableForUser($entry->getEntryId(),
$user->getId())) {
583 $this->cal_footer[] = array(
584 'link' =>
$ilCtrl->getLinkTargetByClass($this->getTargetGUIClassPath(),
'selectCHCalendarOfUser'),
593 $ilCtrl->setParameter($this,
"bkid",
"");
594 $ilCtrl->setParameter($this,
'seed',
'');
596 $ilCtrl->setParameter($this,
"bkid",
"");
601 $ilCtrl->setParameter($this,
"bkid", (
int)
$_GET[
"bkid"]);
607 $ilCtrl->getLinkTarget($this,
"editSettings"),
608 $lng->txt(
"settings")
613 $ret = parent::getHTML();
619 $f =
$DIC->ui()->factory()->legacy(
"");
620 $ret .=
$DIC->ui()->renderer()->renderAsync(
$f);
634 include_once(
'./Services/Calendar/classes/class.ilCalendarSchedule.php');
636 $events = $schedule->getChangedEvents(
true);
638 $ilCtrl->setParameterByClass(
'ilcalendarinboxgui',
'changed', 1);
639 $link =
'<a href=' .
$ilCtrl->getLinkTargetByClass(
'ilcalendarinboxgui',
'') .
'>';
640 $ilCtrl->setParameterByClass(
'ilcalendarinboxgui',
'changed',
'');
641 $text =
'<div class="small">' . ((int) count($events)) .
" " .
$lng->txt(
"cal_changed_events_header") .
"</div>";
644 return $link . $text . $end_link;
659 } elseif (!$cats->getMode()) {
662 (
int)
$_GET[
'ref_id'],
676 $ilTabs->clearSubTabs();
704 $ilCtrl->returnToParent($this);
713 foreach ((array) $this->cal_footer as $link_info) {
714 $this->tpl->setCurrentBlock(
'data_section');
715 $this->tpl->setVariable(
717 sprintf(
'<a href="%s">%s</a>', $link_info[
'link'], $link_info[
'txt'])
720 $this->tpl->parseCurrentBlock();
724 if ($this->tpl->blockExists(
"block_footer")) {
725 $this->tpl->setCurrentBlock(
"block_footer");
726 $this->tpl->parseCurrentBlock();
738 $ilCtrl->getLinkTarget($this,
"setPdModeEvents"),
739 $lng->txt(
"cal_upcoming_events_header"),
740 $ilCtrl->getLinkTarget($this,
"setPdModeEvents",
"",
true)
745 $ilCtrl->getLinkTarget($this,
"setPdModeMonth"),
746 $lng->txt(
"app_month"),
747 $ilCtrl->getLinkTarget($this,
"setPdModeMonth",
"",
true)
752 $ilCtrl->setParameterByClass(
'ilcalendarpresentationgui',
'seed',
'');
754 $ilCtrl->getLinkTargetByClass($this->getTargetGUIClassPath(),
""),
755 $lng->txt(
"cal_open_calendar")
758 $ilCtrl->setParameter($this,
"add_mode",
"");
760 $ilCtrl->getLinkTargetByClass(
"ilCalendarAppointmentGUI",
"add"),
761 $lng->txt(
"add_appointment")
763 $ilCtrl->setParameter($this,
"add_mode",
"");
773 $ilUser->writePref(
"il_pd_cal_mode",
"evt");
774 $this->display_mode =
"evt";
780 $ilCtrl->redirectByClass(
"ildashboardgui",
"show");
789 $ilUser->writePref(
"il_pd_cal_mode",
"mmon");
790 $this->display_mode =
"mmon";
796 $ilCtrl->redirectByClass(
"ildashboardgui",
"show");
809 include_once(
'./Services/Calendar/classes/class.ilCalendarSchedule.php');
811 $schedule->addSubitemCalendars(
true);
812 $schedule->setEventsLimit(20);
813 $schedule->calculate();
814 $ev = $schedule->getScheduledEvents();
828 if (
sizeof($events)) {
829 foreach ($events as $item) {
830 $this->ctrl->setParameter($this,
"app_id", $item[
"event"]->getEntryId());
831 $this->ctrl->setParameter($this,
'dt', $item[
'dstart']);
832 $url = $this->ctrl->getLinkTarget($this,
"getModalForApp",
"",
true,
false);
833 $this->ctrl->setParameter($this,
"app_id",
$_GET[
"app_id"]);
834 $this->ctrl->setParameter($this,
"dt",
$_GET[
"dt"]);
835 $modal =
$f->modal()->roundtrip(
'', [])->withAsyncRenderUrl(
$url);
839 $comps = [
$f->button()->shy($item[
"event"]->getPresentationTitle(),
"")->withOnClick($modal->getShowSignal()), $modal];
840 $renderer =
$ui->renderer();
841 $shy = $renderer->render($comps);
845 "title" => $item[
"event"]->getPresentationTitle(),
872 $start = $item[
"dstart"];
873 $end = $item[
"dend"];
874 if ($item[
"fullday"]) {
881 return array(
"start" => $start,
"end" => $end);
895 $r =
$ui->renderer();
899 foreach ($events as $item) {
900 if ($item[
"event"]->getEntryId() == (
int)
$_GET[
"app_id"] && $item[
'dstart'] == (
int)
$_GET[
'dt']) {
904 include_once(
"./Services/Calendar/classes/class.ilCalendarAppointmentPresentationGUI.php");
906 $content =
$ilCtrl->getHTML($next_gui);
909 echo $r->renderAsync($modal);
938 "tpl.calendar_block.html",
946 $panel_tpl = new \ilTemplate(
947 'tpl.cal_block_panel.html',
956 return $tpl->get().$panel_tpl->get();
965 if (isset(
$data[
"shy_button"])) {
966 return $factory->item()->standard(
$data[
"shy_button"])->withDescription(
$data[
"date"]);
978 return $this->lng->txt(
"cal_no_events_block");
996 (
int)
$_GET[
'ref_id'],
997 (
int)
$user->getId(),
998 $this->getTargetGUIClassPath()
1001 foreach ($links as $link) {
1002 $ui_factory =
$DIC->ui()->factory();
1003 $ui_renderer =
$DIC->ui()->renderer();
1005 $link_button = $ui_factory->button()->shy(
1010 $panel_template->
touchBlock(
'consultation_hour_buttons_multi');
1013 $panel_template->
setVariable(
'SHY_BUTTON', $ui_renderer->render([$link_button]));
1028 $ui_factory =
$DIC->ui()->factory();
1029 $ui_renderer =
$DIC->ui()->renderer();
1032 $gui_path[] = strtolower(\ilCalendarSubscriptionGUI::class);
1033 $url = $this->ctrl->getLinkTargetByClass($gui_path,
'getModalForSubscription',
"",
true,
false);
1035 $roundtrip_modal = $ui_factory->modal()->roundtrip(
'', [])->withAsyncRenderUrl(
$url);
1037 $standard_button = $ui_factory->button()->standard(
$lng->txt(
'btn_ical'),
'')->withOnClick(
1038 $roundtrip_modal->getShowSignal()
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.
getBlockId()
Get Block Id.
getRepositoryMode()
Get RepositoryMode.
setPresentation(int $type)
Set presentation.
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
fillDataSection()
Standard implementation for row based data.
addBlockCommand(string $a_href, string $a_text, string $a_onclick="")
Add Block Command.
setTitle($a_title)
Set Title.
getPresentation()
Get presentation type.
setBlockId($a_block_id=0)
Set Block Id.
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
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
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 @access protected
addMiniMonth($a_tpl, $a_include_view_ctrl=false)
Add mini version of monthly overview (Maybe extracted to another class, if used in pd calendar tab.
initCommands()
Init commands.
getNoItemFoundContent()
No item entry.
isRepositoryObject()
Returns whether block has a corresponding repository object.bool
getDatesForItem($item)
Get start/end date for item.
addSubscriptionButton(ilTemplate $panel_template)
Add subscription button.
fillDataSection()
Fill data section.
getModalForApp()
Get modal for appointment (see similar code in ilCalendarAgendaListGUI) todo use all this methods fro...
getShowWeeksColumn()
Show weeks column.
getListItemForData(array $data)
Get list item for data array.null|\ILIAS\UI\Component\Item\Item
getHTML()
Get bloch HTML code.
executeCommand()
execute command
addConsultationHourButtons(ilTemplate $panel_template)
Add consultation hour buttons.
getViewControl()
Get view control.
__construct()
Constructor.
getOverview()
Get overview.
static getScreenMode()
Get Screen Mode for current command.
getParentGUI()
Get parent gui.
returnToUpperContext()
Return to upper context.
getViewControls()
Get view controls.array
getLegacyContent()
Get legacy content.string
getTargetGUIClassPath()
Get target gui class path (for presenting the calendar)
getForceMonthView()
Get force month view.
setForceMonthView($a_val)
Set force month view.
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.
static getConsultationHourLinksForRepositoryObject(int $ref_id, int $current_user_id, array $ctrl_class_structure)
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 _lookupType($a_id, $a_reference=false)
lookup object type
special template class to simplify handling of ITX/PEAR
touchBlock($block)
overwrites ITX::touchBlock.
parseCurrentBlock($part="DEFAULT")
Überladene Funktion, die auf den aktuelle Block vorher noch ein replace ausführt @access public.
setCurrentBlock($part="DEFAULT")
Überladene Funktion, die sich hier lokal noch den aktuellen Block merkt.
setVariable($variable, $value='')
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
getViewControls()
@inheritDoc
Class ChatMainBarProvider \MainMenu\Provider.