ILIAS  release_8 Revision v8.24
class.ilCalendarRecurrenceTableGUI.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
9{
10 private const REC_TABLE_ID = 'recurrence_table';
11
13
14 public function __construct(
16 object $a_parent_obj,
17 string $a_parent_cmd = "",
18 string $a_template_context = ""
19 ) {
20 $this->setId(self::REC_TABLE_ID);
21 parent::__construct($a_parent_obj, $a_parent_cmd, $a_template_context);
22 $this->entry = $entry;
23 }
24
25 public function init(): void
26 {
27 $this->setFormAction($this->ctrl->getFormAction($this->getParentObject(), $this->getParentCmd()));
28 $this->setFormName('appointments');
29 $this->addColumn('', 'f', "1");
30 $this->addColumn($this->lng->txt('title'));
31 $this->setRowTemplate("tpl.show_recurrence_row.html", 'Services/Calendar');
32
33 $this->setSelectAllCheckbox('recurrence_ids');
34 $this->addMultiCommand(
35 'deleteExclude',
36 $this->lng->txt('delete')
37 );
38 $this->addCommandButton(
39 'delete',
40 $this->lng->txt('cal_delete_recurrence_rule')
41 );
42 $this->addCommandButton(
43 'cancel',
44 $this->lng->txt('cancel')
45 );
46 $this->setShowRowsSelector(false);
47 }
48
49 protected function fillRow(array $a_set): void
50 {
51 $this->tpl->setVariable('VAL_ID', $a_set['id']);
52 $this->tpl->setVariable('TITLE', $a_set['title']);
53 }
54
55 public function parse(): void
56 {
57 $calculator = new ilCalendarRecurrenceCalculator(
58 $this->entry,
59 ilCalendarRecurrences::_getFirstRecurrence($this->entry->getEntryId())
60 );
61
62 $end = clone $this->entry->getStart();
63 $end->increment(IL_CAL_YEAR, 10);
64
65 $appointments = $calculator->calculateDateList(
66 $this->entry->getStart(),
67 $end
68 );
69 $rows = [];
70 foreach ($appointments as $recurrence_date) {
71 $row = [];
72 $row['id'] = (int) $recurrence_date->get(IL_CAL_UNIX);
73 $row['title'] = $this->entry->getTitle() . ' ( ' . ilDatePresentation::formatDate($recurrence_date) . ' ) ';
74 $rows[] = $row;
75 }
76 $this->setData($rows);
77 }
78}
const IL_CAL_UNIX
const IL_CAL_YEAR
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...
Class ilCalendarRecurrenceTableGUI.
__construct(ilCalendarEntry $entry, object $a_parent_obj, string $a_parent_cmd="", string $a_template_context="")
fillRow(array $a_set)
Standard Version of Fill Row.
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
setFormName(string $a_name="")
addMultiCommand(string $a_cmd, string $a_text)
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setData(array $a_data)
Set table data.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$rows
Definition: xhr_table.php:10