ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilCalendarChangedAppointmentsTableGUI.php
Go to the documentation of this file.
1<?php
24{
25 private int $cat_id = 0;
26 private bool $is_editable = false;
28
29 public function __construct(?object $a_parent_obj, string $a_parent_cmd)
30 {
31 global $DIC;
32
33 $this->user = $DIC->user();
34 $this->lng = $DIC->language();
35 $this->lng->loadLanguageModule('dateplaner');
36 $this->ctrl = $DIC->ctrl();
37
38 $this->setId('calinbox');
39
40 parent::__construct($a_parent_obj, $a_parent_cmd);
41 $this->setFormName('appointments');
42 $this->addColumn($this->lng->txt('date'), 'begin', "30%");
43 $this->addColumn($this->lng->txt('title'), 'title', "40%");
44 #$this->addColumn($this->lng->txt('cal_duration'),'duration',"15%");
45 $this->addColumn($this->lng->txt('cal_recurrences'), 'frequence', "15%");
46 $this->addColumn($this->lng->txt('last_update'), 'last_update', "15%");
47
48 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
49 $this->setRowTemplate("tpl.show_changed_appointment_row.html", "components/ILIAS/Calendar");
50
51 $this->setShowRowsSelector(true);
52 $this->enable('sort');
53 $this->enable('header');
54 $this->enable('numinfo');
55
56 $this->setDefaultOrderField('begin');
57 $this->setDefaultOrderDirection('asc');
58 }
59
60 protected function fillRow(array $a_set): void
61 {
62 $this->tpl->setVariable('VAL_DESCRIPTION', $a_set['description']);
63
64 $this->tpl->setVariable('VAL_TITLE_LINK', $a_set['title']);
65 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_set['id']);
66 $this->tpl->setVariable('VAL_LINK', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'edit'));
67
68 switch ($a_set['frequence']) {
70 $this->tpl->setVariable('VAL_FREQUENCE', $this->lng->txt('cal_daily'));
71 break;
72
74 $this->tpl->setVariable('VAL_FREQUENCE', $this->lng->txt('cal_weekly'));
75 break;
76
78 $this->tpl->setVariable('VAL_FREQUENCE', $this->lng->txt('cal_monthly'));
79 break;
80
82 $this->tpl->setVariable('VAL_FREQUENCE', $this->lng->txt('cal_yearly'));
83 break;
84
85 default:
86 #$this->tpl->setVariable('VAL_FREQUENCE',$this->lng->txt('cal_no_recurrence'));
87 break;
88 }
89 if ($a_set['fullday']) {
91 new ilDate($a_set['begin'], IL_CAL_UNIX),
92 new ilDate($a_set['end'], IL_CAL_UNIX)
93 );
94 } else {
96 new ilDateTime($a_set['begin'], IL_CAL_UNIX),
97 new ilDateTime($a_set['end'], IL_CAL_UNIX)
98 );
99 }
100 $this->tpl->setVariable('VAL_BEGIN', $date);
101 $update = new ilDateTime($a_set['last_update'], IL_CAL_UNIX, $this->user->getTimeZone());
102 $this->tpl->setVariable('VAL_LAST_UPDATE', ilDatePresentation::formatDate($update));
103 }
104
105 public function setAppointments(array $a_apps): void
106 {
107 $appointments = [];
108 foreach ($a_apps as $event) {
109 $entry = $event['event'];
110
111 $rec = ilCalendarRecurrences::_getFirstRecurrence($entry->getEntryId());
112
113 $tmp_arr['id'] = $entry->getEntryId();
114 $tmp_arr['title'] = $entry->getPresentationTitle();
115 $tmp_arr['description'] = $entry->getDescription();
116 $tmp_arr['fullday'] = $entry->isFullday();
117
118 $tmp_arr['begin'] = $event['dstart'];
119 $tmp_arr['end'] = $event['dend'];
120
121 $tmp_arr['duration'] = $tmp_arr['end'] - $tmp_arr['begin'];
122 if ($tmp_arr['fullday']) {
123 $tmp_arr['duration'] += (60 * 60 * 24);
124 }
125 if (!$tmp_arr['fullday'] and $tmp_arr['end'] == $tmp_arr['begin']) {
126 $tmp_arr['duration'] = '';
127 }
128
129 $tmp_arr['last_update'] = $entry->getLastUpdate()->get(IL_CAL_UNIX);
130 $tmp_arr['frequence'] = $rec->getFrequenceType();
131
132 $appointments[] = $tmp_arr;
133 }
134
135 //cuts appointments array after Limit
136 $appointments = array_slice($appointments, 0, $this->getLimit());
137 $this->setData($appointments);
138 }
139}
const IL_CAL_UNIX
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(?object $a_parent_obj, string $a_parent_cmd)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false, ?ilObjUser $user=null)
Format a period of two dates Shows: 14.
@classDescription Date and time handling
Class for single dates.
User class.
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.
setFormName(string $a_name="")
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)
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setDefaultOrderDirection(string $a_defaultorderdirection)
setData(array $a_data)
Set table data.
enable(string $a_module_name)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26