ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilCalendarRecurrenceTableGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
25{
26 private const REC_TABLE_ID = 'recurrence_table';
27
29
30 public function __construct(
32 object $a_parent_obj,
33 string $a_parent_cmd = "",
34 string $a_template_context = ""
35 ) {
36 $this->setId(self::REC_TABLE_ID);
37 parent::__construct($a_parent_obj, $a_parent_cmd, $a_template_context);
38 $this->entry = $entry;
39 }
40
41 public function init(): void
42 {
43 $this->setFormAction($this->ctrl->getFormAction($this->getParentObject(), $this->getParentCmd()));
44 $this->setFormName('appointments');
45 $this->addColumn('', 'f', "1");
46 $this->addColumn($this->lng->txt('title'));
47 $this->setRowTemplate("tpl.show_recurrence_row.html", 'components/ILIAS/Calendar');
48
49 $this->setSelectAllCheckbox('recurrence_ids');
50 $this->addMultiCommand(
51 'deleteExclude',
52 $this->lng->txt('delete')
53 );
54 $this->addCommandButton(
55 'delete',
56 $this->lng->txt('cal_delete_recurrence_rule')
57 );
58 $this->addCommandButton(
59 'cancel',
60 $this->lng->txt('cancel')
61 );
62 $this->setShowRowsSelector(false);
63 }
64
65 protected function fillRow(array $a_set): void
66 {
67 $this->tpl->setVariable('VAL_ID', $a_set['id']);
68 $this->tpl->setVariable('TITLE', $a_set['title']);
69 }
70
71 public function parse(): void
72 {
73 $calculator = new ilCalendarRecurrenceCalculator(
74 $this->entry,
75 ilCalendarRecurrences::_getFirstRecurrence($this->entry->getEntryId())
76 );
77
78 $end = clone $this->entry->getStart();
79 $end->increment(IL_CAL_YEAR, 10);
80
81 $appointments = $calculator->calculateDateList(
82 $this->entry->getStart(),
83 $end
84 );
85 $rows = [];
86 foreach ($appointments as $recurrence_date) {
87 $row = [];
88 $row['id'] = (int) $recurrence_date->get(IL_CAL_UNIX);
89 $row['title'] = $this->entry->getTitle() . ' ( ' . ilDatePresentation::formatDate($recurrence_date) . ' ) ';
90 $rows[] = $row;
91 }
92 $this->setData($rows);
93 }
94}
const IL_CAL_UNIX
const IL_CAL_YEAR
Model for a calendar entry.
Calculates an ilDateList for a given calendar entry and recurrence rule.
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, ?ilObjUser $user=null,)
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