ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilCalendarRecurrenceTableGUI.php
Go to the documentation of this file.
1<?php
2
7{
8 private const REC_TABLE_ID = 'recurrence_table';
9
13 private $entry;
14
15 public function __construct(ilCalendarEntry $entry, $a_parent_obj, $a_parent_cmd = "", $a_template_context = "")
16 {
17 $this->setId(self::REC_TABLE_ID);
18 parent::__construct($a_parent_obj, $a_parent_cmd, $a_template_context);
19
20 $this->entry = $entry;
21 }
22
23 public function init()
24 {
25 $this->setFormAction($this->ctrl->getFormAction($this->getParentObject(), $this->getParentCmd()));
26 $this->setFormName('appointments');
27 $this->addColumn('', 'f', "1");
28 $this->addColumn($this->lng->txt('title'));
29 $this->setRowTemplate("tpl.show_recurrence_row.html", 'Services/Calendar');
30
31 $this->setSelectAllCheckbox('recurrence_ids');
32 $this->addMultiCommand(
33 'deleteExclude',
34 $this->lng->txt('delete')
35 );
36 $this->addCommandButton(
37 'delete',
38 $this->lng->txt('cal_delete_recurrence_rule')
39 );
40 $this->addCommandButton(
41 'cancel',
42 $this->lng->txt('cancel')
43 );
44 $this->setShowRowsSelector(false);
45 }
46
47 public function fillRow($row)
48 {
49 $this->tpl->setVariable('VAL_ID', $row['id']);
50 $this->tpl->setVariable('TITLE', $row['title']);
51 }
52
53 public function parse()
54 {
55 $calculator = new ilCalendarRecurrenceCalculator(
56 $this->entry,
57 ilCalendarRecurrences::_getFirstRecurrence($this->entry->getEntryId())
58 );
59
60 $end = clone $this->entry->getStart();
61 $end->increment(IL_CAL_YEAR, 10);
62
63 $appointments = $calculator->calculateDateList(
64 $this->entry->getStart(),
65 $end
66 );
67 $rows = [];
68 foreach ($appointments as $recurrence_date) {
69 $row = [];
70 $row['id'] = $recurrence_date->get(IL_CAL_UNIX);
71 $row['title'] = $this->entry->getTitle() . ' ( ' . ilDatePresentation::formatDate($recurrence_date) . ' ) ';
72
73 $rows[] = $row;
74 }
75 $this->setData($rows);
76 }
77}
An exception for terminatinating execution or to throw for unit testing.
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, $a_parent_obj, $a_parent_cmd="", $a_template_context="")
fillRow($row)
Standard Version of Fill Row.
static _getFirstRecurrence($a_cal_id)
get first recurrence
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
Class ilTable2GUI.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addMultiCommand($a_cmd, $a_text)
Add Command button.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setId($a_val)
Set id.
setFormName($a_formname="")
Set Form name.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$rows
Definition: xhr_table.php:10