3 declare(strict_types=1);
36 protected int $period = self::PERIOD_WEEK;
41 $this->
ctrl->saveParameter($this,
"cal_agenda_per");
43 $this->
ctrl->setParameterByClass(
"ilcalendarinboxgui",
"seed", $this->seed->get(
IL_CAL_DATE));
49 if ($this->
http->wrapper()->query()->has(
'cal_agenda_per')) {
50 return $this->
http->wrapper()->query()->retrieve(
65 if ($calendar_period > 0 && $calendar_period <= 4) {
66 $this->period = $calendar_period;
67 } elseif (!empty($this->
user->getPref(
'cal_list_view'))) {
68 $this->period = intval($this->
user->getPref(
'cal_list_view'));
70 $this->period = $cal_setting->getDefaultPeriod();
72 $this->
user->writePref(
'cal_list_view', (
string) $this->period);
81 switch ($this->period) {
82 case self::PERIOD_DAY:
86 case self::PERIOD_WEEK:
90 case self::PERIOD_MONTH:
94 case self::PERIOD_HALF_YEAR:
98 $this->period_end_day = $end_date->get(
IL_CAL_DATE);
103 $next_class = $this->
ctrl->getNextClass($this);
104 $cmd = $this->
ctrl->getCmd(
"getHTML");
106 switch ($next_class) {
107 case "ilcalendarappointmentpresentationgui":
108 $this->
ctrl->setReturn($this,
"");
116 $this->
ctrl->forwardCommand($gui);
120 $this->
ctrl->setReturn($this,
"");
121 if (in_array($cmd, array(
"getHTML",
"getModalForApp"))) {
122 return $this->$cmd();
135 $navigation->getHTML();
138 $this->
ctrl->setReturn($this,
"");
144 $df = new \ILIAS\Data\Factory();
151 foreach ($events as
$e) {
152 if ($e[
'event']->isFullDay()) {
167 $this->
user->getTimeZone()
176 $this->
user->getTimeZone()
183 if ($group_date->isNull()) {
185 $begin->get(
IL_CAL_DATE,
'', $this->user->getTimeZone()),
192 $groups[] = $this->ui_factory->item()->group(
215 $this->
ctrl->setParameter($this,
'app_id', $e[
"event"]->getEntryId());
216 $this->
ctrl->setParameter($this,
'dt', $e[
'dstart']);
217 $this->
ctrl->setParameter($this,
'seed', $this->seed->get(
IL_CAL_DATE));
220 $url = $this->
ctrl->getLinkTarget($this,
"getModalForApp",
"",
true,
false);
226 if ($this->
http->wrapper()->query()->has(
'modal_title')) {
227 $modal_title = $this->
http->wrapper()->query()->retrieve(
229 $this->
refinery->kindlyTo()->string()
232 $this->
ctrl->setParameter($this,
'modal_title', $modal_title);
233 $modal = $this->ui_factory->modal()->roundtrip(
'', [])->withAsyncRenderUrl(
$url);
234 $shy = $this->ui_factory->button()->shy(
235 $e[
"event"]->getPresentationTitle(
false),
237 )->withOnClick($modal->getShowSignal());
240 if ($e[
'event']->isFullDay()) {
241 $lead_text = $this->
lng->txt(
"cal_all_day");
245 $li = $this->ui_factory->item()->standard($shy)
246 ->withDescription(
"" . nl2br(strip_tags($e[
"event"]->getDescription())))
247 ->withLeadText($lead_text)
249 ->withColor($df->color(
'#' . $cat_info[
"color"]));
252 $li = $li_edited_by_plugin;
263 $app_gui->setListItemMode($li);
264 $this->
ctrl->getHTML($app_gui);
265 $items[] = $app_gui->getListItem();
268 if (!$group_date->isNull()) {
269 $groups[] = $this->ui_factory->item()->group(
276 $images = array_fill(1, 4,
"<span class=\"ilAdvNoImg\"></span>");
279 if ($cal_agenda_per > 0) {
280 $images[$cal_agenda_per] =
"<img src='./templates/default/images/icon_checked.svg' alt='Month'>";
282 $images[
$this->period] =
"<img src='./templates/default/images/icon_checked.svg' alt='Month'>";
285 #21479 Set seed if the view does not contain any event. 286 $this->
ctrl->setParameter($this,
'seed', $this->seed->get(
IL_CAL_DATE));
289 $this->
ctrl->setParameter($this,
"cal_agenda_per", self::PERIOD_DAY);
290 $items[] = $this->ui_factory->button()->shy(
291 $images[1] .
"1 " . $this->
lng->txt(
"day"),
292 $this->
ctrl->getLinkTarget($this,
"getHTML")
294 $this->
ctrl->setParameter($this,
"cal_agenda_per", self::PERIOD_WEEK);
295 $items[] = $this->ui_factory->button()->shy(
296 $images[2] .
"1 " . $this->
lng->txt(
"week"),
297 $this->
ctrl->getLinkTarget($this,
"getHTML")
299 $this->
ctrl->setParameter($this,
"cal_agenda_per", self::PERIOD_MONTH);
300 $items[] = $this->ui_factory->button()->shy(
301 $images[3] .
"1 " . $this->
lng->txt(
"month"),
302 $this->
ctrl->getLinkTarget($this,
"getHTML")
304 $this->
ctrl->setParameter($this,
"cal_agenda_per", self::PERIOD_HALF_YEAR);
305 $items[] = $this->ui_factory->button()->shy(
306 $images[4] .
"6 " . $this->
lng->txt(
"months"),
307 $this->
ctrl->getLinkTarget($this,
"getHTML")
309 $this->
ctrl->setParameter($this,
"cal_agenda_per", $this->period);
311 $actions = $this->ui_factory->dropdown()->standard($items)->withLabel($this->
lng->txt(
"cal_period"));
318 if ($this->period != self::PERIOD_DAY) {
324 $list = $this->ui_factory->panel()->listing()->standard($list_title, $groups)
325 ->withActions($actions);
326 $comps = array_merge($modals, array($list));
327 $html = $this->ui_renderer->render($comps);
328 if (count($groups) == 0) {
339 $plugin->setAppointment($appointment, $appointment->
getStart());
341 $li = $plugin->editAgendaItem($a_item);
354 $user = $DIC->user();
358 $calendar_agenda_period = (
int) ($DIC->http()->request()->getQueryParams()[
'cal_agenda_per'] ?? 0);
359 if ($calendar_agenda_period > 0 && $calendar_agenda_period <= 4) {
360 return $calendar_agenda_period;
static _getInstance(ilDate $seed, array $a_app)
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...
static getSystemMessageHTML(string $a_txt, string $a_type="info")
Get HTML for a system message.
getActivePlugins(string $a_slot_id)
__construct(ilDate $seed)
static _lookupCategory(int $a_cal_id)
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.
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
increment(string $a_type, int $a_count=1)
initAppointmentIdFromQuery()
getPluginAgendaItem(Item $a_item, ilCalendarEntry $appointment)
initCalendarPeriodFromRequest()
const CAL_PRESENTATION_AGENDA_LIST
static getPeriod()
needed in CalendarInboxGUI to get events using a proper period.
static http()
Fetches the global http state from ILIAS.
static _after(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
compare two dates and check start is after end This method does not consider tz offsets.
initInitialDateTimeFromQuery()
getPref(string $a_keyword)
Common interface to all items.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
static _getInstance($a_usr_id=0)
get singleton instance
getStart()
Get start of date period.
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false)
Format a period of two dates Shows: 14.
__construct(Container $dic, ilPlugin $plugin)
static _equals(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
Check if two date are equal.
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
initEndPeriod()
Initialises end date for calendar list view.