19declare(strict_types=1);
 
   70        $this->
logger = $DIC->logger()->cal();
 
   71        $this->
tabs = $DIC->tabs();
 
   72        $this->obj_data_cache = 
$DIC[
"ilObjDataCache"];
 
   73        $this->
ui = $DIC->ui();
 
   74        $this->
help = $DIC->help();
 
   75        $this->
http = $DIC->http();
 
   78        $this->
lng->loadLanguageModule(
"dateplaner");
 
   79        $this->
help->addHelpSection(
"cal_block");
 
   81        $this->
ctrl->saveParameter($this, 
'bkid');
 
   87        $this->allow_moving = 
false;
 
   89        $params = 
$DIC->http()->request()->getQueryParams();
 
   90        $this->requested_cal_agenda_per = (
int) (
$params[
'cal_agenda_per'] ?? 
null);
 
   95        } elseif (strlen($seed_str)) {
 
   98            $seed_str = date(
'Y-m-d', time());
 
  104        $mode = $this->
user->getPref(
"il_pd_cal_mode");
 
  105        $this->display_mode = 
$mode ?: 
"mmon";
 
  107        if ($this->display_mode !== 
"mmon") {
 
  114        if ($this->
http->wrapper()->query()->has(
'bkid')) {
 
  115            return $this->
http->wrapper()->query()->retrieve(
 
  125        if ($this->
http->wrapper()->query()->has(
'seed')) {
 
  126            return $this->
http->wrapper()->query()->retrieve(
 
  128                $this->
refinery->kindlyTo()->string()
 
  136        if ($this->
http->wrapper()->query()->has(
'app_id')) {
 
  137            return $this->
http->wrapper()->query()->retrieve(
 
  147        if ($this->
http->wrapper()->query()->has(
'dt')) {
 
  148            return $this->
http->wrapper()->query()->retrieve(
 
  161        return ($this->
settings->getShowWeeks() && $this->user_settings->getShowWeeks());
 
  182        $this->parent_gui = $a_val;
 
  192        $this->force_month_view = $a_val;
 
  194            $this->display_mode = 
"mmon";
 
  211        $ilCtrl = 
$DIC->ctrl();
 
  212        $cmd_class = $ilCtrl->getCmdClass();
 
  214        $cmd = $ilCtrl->getCmd();
 
  216        if ($cmd_class == 
"ilcalendarappointmentgui" ||
 
  217            $cmd_class == 
"ilconsultationhoursgui" ||
 
  218            $cmd == 
'showCalendarSubscription') {
 
  226        $next_class = $this->
ctrl->getNextClass();
 
  227        $cmd = $this->
ctrl->getCmd(
"getHTML");
 
  231        switch ($next_class) {
 
  232            case "ilcalendarappointmentgui":
 
  235                $this->
ctrl->forwardCommand($app_gui);
 
  238            case "ilconsultationhoursgui":
 
  240                $this->
ctrl->forwardCommand($hours);
 
  243            case "ilcalendarappointmentpresentationgui":
 
  249                        'Invalid appointment ID for ref_id: ' .
 
  251                        (
string) $this->requested_ref_id
 
  259            case "ilcalendarmonthgui":
 
  260                $this->
tabs->setSubTabActive(
'app_month');
 
  262                $this->
ctrl->forwardCommand($month_gui);
 
  266                return $this->$cmd();
 
  273        if ($this->display_mode != 
"mmon") {
 
  274            $this->
setRowTemplate(
"tpl.pd_event_list.html", 
"Services/Calendar");
 
  279                "tpl.calendar_block.html",
 
  292        $target_class = array();
 
  294            $target_class = array(
"ildashboardgui", 
"ilcalendarpresentationgui");
 
  298                    $target_class = array(
"ilobjcoursegui", 
"ilcalendarpresentationgui");
 
  302                    $target_class = array(
"ilobjgroupgui", 
"ilcalendarpresentationgui");
 
  306        return $target_class;
 
  322            $a_tpl->
setVariable(
'TXT_WEEKDAY', $this->
lng->txt(
"cal_week_abbrev"));
 
  325        for (
$i = $this->user_settings->getWeekStart(); 
$i < (7 + $this->user_settings->getWeekStart()); 
$i++) {
 
  334            $disable_empty = 
true;
 
  336            $user_id = $this->
user->getId();
 
  337            $disable_empty = 
false;
 
  340        $this->scheduler->addSubitemCalendars(
true);
 
  341        $this->scheduler->calculate();
 
  347            $this->user_settings->getWeekStart()
 
  351            $events = $this->scheduler->getByDay($date, $this->
user->getTimeZone());
 
  352            $has_events = (bool) count($events);
 
  353            if ($has_events || !$disable_empty) {
 
  359            if ($disable_empty) {
 
  361                    $a_tpl->
setVariable(
'DAY_CLASS', 
'calminiinactive');
 
  363                    $week_has_events = 
true;
 
  364                    foreach ($events as $event) {
 
  366                        if ($booking->hasBooked($event[
'event']->getEntryId())) {
 
  372            } elseif ($has_events) {
 
  373                $week_has_events = 
true;
 
  383            $last_gui = end(
$path);
 
  384            $this->
ctrl->setParameterByClass($last_gui, 
'seed', $date->get(
IL_CAL_DATE));
 
  385            if ($agenda_view_type = $this->requested_cal_agenda_per) {
 
  386                $this->
ctrl->setParameterByClass($last_gui, 
"cal_agenda_per", $agenda_view_type);
 
  388            $a_tpl->
setVariable(
'OPEN_DAY_VIEW', $this->
ctrl->getLinkTargetByClass($this->getTargetGUIClassPath(), 
''));
 
  408            if ($counter and !($counter % 7)) {
 
  421                $week_has_events = 
false;
 
  425        if ($a_include_view_ctrl) {
 
  426            $a_tpl->
setVariable(
"VIEW_CTRL_SECTION", 
$ui->renderer()->render($this->getViewControl()));
 
  437        $first_of_month = substr($this->seed->get(
IL_CAL_DATE), 0, 7) . 
"-01";
 
  443        $prev_link = $this->
ctrl->getLinkTarget($this, 
"setSeed", 
"", 
true);
 
  447        $next_link = $this->
ctrl->getLinkTarget($this, 
"setSeed", 
"", 
true);
 
  449        $this->
ctrl->setParameter($this, 
'seed', 
"");
 
  455        $b1 = 
$ui->factory()->button()->standard($this->
lng->txt(
"previous"), 
"#")->withOnLoadCode(
function (
$id) use (
 
  460                "$('#" . 
$id . 
"').click(function() { ilBlockJSHandler('block_" . $blockgui->getBlockType() .
 
  461                "_" . $blockgui->getBlockId() . 
"','" . $prev_link . 
"'); return false;});";
 
  465        $this->
ctrl->clearParameterByClass(
"ilcalendarblockgui", 
'seed');
 
  466        $month_link = $this->
ctrl->getLinkTarget($this, 
"setSeed", 
"", 
true, 
false);
 
  467        $seed_parts = explode(
"-", $this->seed->get(
IL_CAL_DATE));
 
  468        $b2 = 
$ui->factory()->button()->month($seed_parts[1] . 
"-" . $seed_parts[0])->withOnLoadCode(
function (
$id) use (
 
  472            return "$('#" . 
$id . 
"').on('il.ui.button.month.changed', function(el, id, month) { var m = month.split('-'); ilBlockJSHandler('block_" . $blockgui->getBlockType() .
 
  473                "_" . $blockgui->getBlockId() . 
"','" . $month_link . 
"' + '&seed=' + m[1] + '-' + m[0] + '-01'); return false;});";
 
  476        $b3 = 
$ui->factory()->button()->standard($this->
lng->txt(
"next"), 
"#")->withOnLoadCode(
function (
$id) use (
 
  481                "$('#" . 
$id . 
"').click(function() { ilBlockJSHandler('block_" . $blockgui->getBlockType() .
 
  482                "_" . $blockgui->getBlockId() . 
"','" . $next_link . 
"'); return false;});";
 
  485        return $ui->factory()->viewControl()->section($b1, $b2, $b3);
 
  501                $obj_id = $ilObjDataCache->lookupObjId((
int) $this->requested_ref_id);
 
  503                $users = array_unique(array_merge($participants->getTutors(), $participants->getAdmins()));
 
  506                foreach ($users as $user_id) {
 
  511                    $next_app = end($appointments);
 
  512                    reset($appointments);
 
  514                    foreach ($appointments as $entry) {
 
  520                        if (!in_array($obj_id, $booking_entry->getTargetObjIds())) {
 
  524                        if (!$booking_entry->isAppointmentBookableForUser($entry->getEntryId(), 
$user->
getId())) {
 
  532                    $this->
ctrl->setParameterByClass(end(
$path), 
"ch_user_id", $user_id);
 
  535                        $this->cal_footer[] = array(
 
  536                            'link' => $this->
ctrl->getLinkTargetByClass(
 
  537                                $this->getTargetGUIClassPath(),
 
  538                                'selectCHCalendarOfUser' 
  540                            'txt' => str_replace(
 
  543                                $this->
lng->txt(
"cal_consultation_hours_for_user")
 
  548                    $last_gui = end(
$path);
 
  549                    $this->
ctrl->setParameterByClass($last_gui, 
"ch_user_id", 
"");
 
  550                    $this->
ctrl->setParameterByClass($last_gui, 
"bkid", $bkid);
 
  551                    $this->
ctrl->setParameterByClass($last_gui, 
"seed", $this->seed->get(
IL_CAL_DATE));
 
  553                $this->
ctrl->setParameter($this, 
"bkid", 
"");
 
  554                $this->
ctrl->setParameter($this, 
'seed', 
'');
 
  556                $this->
ctrl->setParameter($this, 
"bkid", 
"");
 
  558                    $this->
ctrl->getLinkTarget($this),
 
  559                    $this->lng->txt(
"back")
 
  567                $this->
ctrl->getLinkTarget($this, 
"editSettings"),
 
  568                $this->lng->txt(
"settings")
 
  573        $ret = parent::getHTML();
 
  577        if ($this->
ctrl->isAsynch()) {
 
  578            $f = $this->
ui->factory()->legacy(
"");
 
  579            $ret .= $this->
ui->renderer()->renderAsync(
$f);
 
  581        if (count($this->modals) > 0) {
 
  582            if ($this->
ctrl->isAsynch()) {
 
  583                $ret .= $this->
ui->renderer()->renderAsync($this->modals);
 
  585                $ret .= $this->
ui->renderer()->render($this->modals);
 
  596        $events = $schedule->getChangedEvents(
true);
 
  598        $this->
ctrl->setParameterByClass(
'ilcalendarinboxgui', 
'changed', 1);
 
  599        $link = 
'<a href=' . $this->
ctrl->getLinkTargetByClass(
'ilcalendarinboxgui', 
'') . 
'>';
 
  600        $this->
ctrl->setParameterByClass(
'ilcalendarinboxgui', 
'changed', 
'');
 
  601        $text = 
'<div class="small">' . (count($events)) . 
" " . $this->
lng->txt(
"cal_changed_events_header") . 
"</div>";
 
  604        return $link . $text . $end_link;
 
  613        } elseif (!$cats->getMode()) {
 
  616                (
int) $this->requested_ref_id,
 
  624        $this->
tabs->clearSubTabs();
 
  633        if ($this->
ctrl->isAsynch()) {
 
  643        $this->
ctrl->returnToParent($this);
 
  653                $this->
ctrl->getLinkTarget($this, 
"setPdModeEvents"),
 
  654                $this->lng->txt(
"cal_upcoming_events_header"),
 
  661                $this->
ctrl->getLinkTarget($this, 
"setPdModeMonth"),
 
  662                $this->lng->txt(
"app_month"),
 
  663                $this->ctrl->getLinkTarget($this, 
"setPdModeMonth", 
"", 
true)
 
  668                $this->
ctrl->setParameterByClass(
'ilcalendarpresentationgui', 
'seed', 
'');
 
  670                    $this->
ctrl->getLinkTargetByClass($this->getTargetGUIClassPath(), 
""),
 
  671                    $this->lng->txt(
"cal_open_calendar")
 
  674                if ($this->
access->checkAccess(
'edit_event', 
'', (
int) $this->requested_ref_id)) {
 
  675                    $this->
ctrl->setParameter($this, 
"add_mode", 
"");
 
  677                        $this->
ctrl->getLinkTargetByClass(
"ilCalendarAppointmentGUI", 
"add"),
 
  678                        $this->lng->txt(
"add_appointment")
 
  680                    $this->
ctrl->setParameter($this, 
"add_mode", 
"");
 
  690        $this->
user->writePref(
"il_pd_cal_mode", 
"evt");
 
  691        $this->display_mode = 
"evt";
 
  693        if ($this->
ctrl->isAsynch()) {
 
  697            $this->
ctrl->returnToParent($this);
 
  705        $this->
user->writePref(
"il_pd_cal_mode", 
"mmon");
 
  706        $this->display_mode = 
"mmon";
 
  708        if ($this->
ctrl->isAsynch()) {
 
  712            $this->
ctrl->redirectByClass(
"ildashboardgui", 
"show");
 
  720                array_key_exists(
'event', $event) &&
 
  722                $event[
'event']->getEntryId() === $a_appointment_id
 
  735        $schedule->addSubitemCalendars(
true); 
 
  736        $schedule->setEventsLimit(20);
 
  737        $schedule->calculate();
 
  739        return $schedule->getScheduledEvents();
 
  752        if (
sizeof($events)) {
 
  753            foreach ($events as $item) {
 
  754                $this->
ctrl->setParameter($this, 
"app_id", $item[
"event"]->getEntryId());
 
  755                $this->
ctrl->setParameter($this, 
'dt', $item[
'dstart']);
 
  756                $url = $this->
ctrl->getLinkTarget($this, 
"getModalForApp", 
"", 
true, 
false);
 
  759                $modal = 
$f->modal()->roundtrip(
'', [])->withAsyncRenderUrl(
$url);
 
  763                $shy = 
$f->button()->shy(
 
  764                    $item[
"event"]->getPresentationTitle(),
 
  766                )->withOnClick($modal->getShowSignal());
 
  770                    "title" => $item[
"event"]->getPresentationTitle(),
 
  772                    "shy_button" => $shy,
 
  798        $start = $item[
"dstart"];
 
  799        $end = $item[
"dend"];
 
  800        if ($item[
"fullday"]) {
 
  807        return array(
"start" => $start, 
"end" => $end);
 
  820        $r = 
$ui->renderer();
 
  824        foreach ($events as $item) {
 
  830                $content = $this->
ctrl->getHTML($next_gui);
 
  832                $modal = 
$f->modal()->roundtrip(
 
  836                echo $r->renderAsync($modal);
 
  865            "tpl.calendar_block.html",
 
  873        $panel_tpl = new \ilTemplate(
 
  874            'tpl.cal_block_panel.html',
 
  882        return $tpl->
get() . $panel_tpl->get();
 
  891        if (isset(
$data[
"modal"])) {
 
  892            $this->modals[] = 
$data[
"modal"];
 
  894        if (isset(
$data[
"shy_button"])) {
 
  895            return $factory->item()->standard(
$data[
"shy_button"])->withDescription(
$data[
"date"]);
 
  907        return $this->
lng->txt(
"cal_no_events_block");
 
  917        $ui_factory = 
$DIC->ui()->factory();
 
  918        $ui_renderer = 
$DIC->ui()->renderer();
 
  921        $gui_path[] = strtolower(\ilCalendarSubscriptionGUI::class);
 
  922        $url = $this->
ctrl->getLinkTargetByClass($gui_path, 
'getModalForSubscription', 
"", 
true, 
false);
 
  924        $roundtrip_modal = $ui_factory->modal()->roundtrip(
'', [])->withAsyncRenderUrl(
$url);
 
  926        $standard_button = $ui_factory->button()->standard($this->
lng->txt(
'btn_ical'), 
'')->withOnClick(
 
  927            $roundtrip_modal->getShowSignal()
 
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
 
setVariable($variable, $value='')
Sets a variable value.
 
This class represents a block method of a block.
 
setDataSection(string $a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
 
setTitle(string $a_title)
 
setPresentation(int $type)
 
getProperty(string $a_property)
 
fillDataSection()
Standard implementation for row based data.
 
addBlockCommand(string $a_href, string $a_text, string $a_onclick="")
 
setBlockId(string $a_block_id="0")
 
setEnableNumInfo(bool $a_enablenuminfo)
 
setRowTemplate(string $a_rowtemplatename, string $a_rowtemplatedir="")
Set Row Template Name.
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static lookupBookableUsersForObject(array $a_obj_id, array $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, array $a_app)
get singleton instance
 
Calendar blocks, displayed in different contexts, e.g.
 
static string $block_type
 
ilCalendarSettings $settings
 
setParentGUI(string $a_val)
 
ilObjectDataCache $obj_data_cache
 
initAppointmentIdFromQuery()
 
addMiniMonth(ilTemplate $a_tpl, bool $a_include_view_ctrl=false)
Add mini version of monthly overview (Maybe extracted to another class, if used in pd calendar tab.
 
getNoItemFoundContent()
No item entry.
 
initBookingUserFromQuery()
 
isRepositoryObject()
Returns whether block has a corresponding repository object.
 
getEventByAppointmentId(int $a_appointment_id)
 
setForceMonthView(bool $a_val)
 
addSubscriptionButton(ilTemplate $panel_template)
Add subscription button.
 
fillDataSection()
Standard implementation for row based data.
 
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.
 
getDatesForItem(array $item)
Get start/end date for item.
 
ilCalendarUserSettings $user_settings
 
__construct()
Constructor.
 
static getScreenMode()
Get Screen Mode for current command.
 
ilCalendarSchedule $scheduler
 
int $requested_cal_agenda_per
 
getViewControls()
Get view controls.array
 
RefineryFactory $refinery
 
getLegacyContent()
Get legacy content.string
 
const MODE_REPOSITORY_CONTAINER_ONLY
 
static _getInstance($a_usr_id=0)
get singleton instance
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Represents a list of calendar appointments (including recurring events) for a specific user in a give...
 
Stores all calendar relevant settings.
 
static _getInstanceByUserId(int $a_user_id)
 
static _numericDayToString(int $a_day, bool $a_long=true)
 
static _buildMonthDayList(int $a_month, int $a_year, int $weekstart)
Build a month day list.
 
static _isToday(ilDateTime $date)
 
static getAppointments(int $a_user_id)
Get all appointments.
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static _getInstanceByObjId(int $a_obj_id)
 
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false)
Format a period of two dates Shows: 14.
 
@classDescription Date and time handling
 
static _equals(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
Check if two date are equal.
 
static _before(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets.
 
Component logger with individual log levels by component id.
 
static _lookupFullname(int $a_user_id)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static _lookupType(int $id, bool $reference=false)
 
static get(string $a_var)
 
static set(string $a_var, $a_val)
Set a value.
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
special template class to simplify handling of ITX/PEAR
 
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
 
get(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
Returns a block with all replacements done.
 
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
 
This describes a Section Control.
 
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
 
static http()
Fetches the global http state from ILIAS.
 
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
getViewControls()
@inheritDoc
 
Class ChatMainBarProvider \MainMenu\Provider.