ILIAS  release_8 Revision v8.24
class.ilCalendarChangedAppointmentsTableGUI.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
30{
31 private int $cat_id = 0;
32 private bool $is_editable = false;
34
35 public function __construct(?object $a_parent_obj, string $a_parent_cmd)
36 {
37 global $DIC;
38
39 $this->user = $DIC->user();
40 $this->lng = $DIC->language();
41 $this->lng->loadLanguageModule('dateplaner');
42 $this->ctrl = $DIC->ctrl();
43
44 $this->setId('calinbox');
45
46 parent::__construct($a_parent_obj, $a_parent_cmd);
47 $this->setFormName('appointments');
48 $this->addColumn($this->lng->txt('date'), 'begin', "30%");
49 $this->addColumn($this->lng->txt('title'), 'title', "40%");
50 #$this->addColumn($this->lng->txt('cal_duration'),'duration',"15%");
51 $this->addColumn($this->lng->txt('cal_recurrences'), 'frequence', "15%");
52 $this->addColumn($this->lng->txt('last_update'), 'last_update', "15%");
53
54 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
55 $this->setRowTemplate("tpl.show_changed_appointment_row.html", "Services/Calendar");
56
57 $this->setShowRowsSelector(true);
58 $this->enable('sort');
59 $this->enable('header');
60 $this->enable('numinfo');
61
62 $this->setDefaultOrderField('begin');
63 $this->setDefaultOrderDirection('asc');
64 }
65
66 protected function fillRow(array $a_set): void
67 {
68 global $DIC;
69
70 $ilUser = $DIC['ilUser'];
71 $lng = $DIC['lng'];
72
73 if ($a_set["milestone"]) {
74 $this->tpl->setCurrentBlock("img_ms");
75 $this->tpl->setVariable("IMG_MS", ilUtil::getImagePath("icon_ms.svg"));
76 $this->tpl->setVariable("ALT_MS", $this->lng->txt("cal_milestone"));
77 $this->tpl->parseCurrentBlock();
78 }
79
80 $this->tpl->setVariable('VAL_DESCRIPTION', $a_set['description']);
81
82 $this->tpl->setVariable('VAL_TITLE_LINK', $a_set['title']);
83 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_set['id']);
84 $this->tpl->setVariable('VAL_LINK', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'edit'));
85
86 switch ($a_set['frequence']) {
88 $this->tpl->setVariable('VAL_FREQUENCE', $this->lng->txt('cal_daily'));
89 break;
90
92 $this->tpl->setVariable('VAL_FREQUENCE', $this->lng->txt('cal_weekly'));
93 break;
94
96 $this->tpl->setVariable('VAL_FREQUENCE', $this->lng->txt('cal_monthly'));
97 break;
98
100 $this->tpl->setVariable('VAL_FREQUENCE', $this->lng->txt('cal_yearly'));
101 break;
102
103 default:
104 #$this->tpl->setVariable('VAL_FREQUENCE',$this->lng->txt('cal_no_recurrence'));
105 break;
106 }
107 if ($a_set['fullday']) {
109 new ilDate($a_set['begin'], IL_CAL_UNIX),
110 new ilDate($a_set['end'], IL_CAL_UNIX)
111 );
112 } else {
114 new ilDateTime($a_set['begin'], IL_CAL_UNIX),
115 new ilDateTime($a_set['end'], IL_CAL_UNIX)
116 );
117 }
118 $this->tpl->setVariable('VAL_BEGIN', $date);
119 $update = new ilDateTime($a_set['last_update'], IL_CAL_UNIX, $this->user->getTimeZone());
120 $this->tpl->setVariable('VAL_LAST_UPDATE', ilDatePresentation::formatDate($update));
121 }
122
123 public function setAppointments(array $a_apps): void
124 {
125 $appointments = [];
126 foreach ($a_apps as $event) {
127 $entry = $event['event'];
128
129 $rec = ilCalendarRecurrences::_getFirstRecurrence($entry->getEntryId());
130
131 $tmp_arr['id'] = $entry->getEntryId();
132 $tmp_arr['milestone'] = $entry->isMilestone();
133 $tmp_arr['title'] = $entry->getPresentationTitle();
134 $tmp_arr['description'] = $entry->getDescription();
135 $tmp_arr['fullday'] = $entry->isFullday();
136
137 $tmp_arr['begin'] = $event['dstart'];
138 $tmp_arr['end'] = $event['dend'];
139
140 $tmp_arr['duration'] = $tmp_arr['end'] - $tmp_arr['begin'];
141 if ($tmp_arr['fullday']) {
142 $tmp_arr['duration'] += (60 * 60 * 24);
143 }
144 if (!$tmp_arr['fullday'] and $tmp_arr['end'] == $tmp_arr['begin']) {
145 $tmp_arr['duration'] = '';
146 }
147
148 $tmp_arr['last_update'] = $entry->getLastUpdate()->get(IL_CAL_UNIX);
149 $tmp_arr['frequence'] = $rec->getFrequenceType();
150
151 $appointments[] = $tmp_arr;
152 }
153
154 //cuts appointments array after Limit
155 $appointments = array_slice($appointments, 0, $this->getLimit());
156 $this->setData($appointments);
157 }
158}
const IL_CAL_UNIX
__construct(?object $a_parent_obj, string $a_parent_cmd)
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false)
Format a period of two dates Shows: 14.
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
@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.
ilLanguage $lng
enable(string $a_module_name)
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
global $DIC
Definition: feed.php:28
$update
Definition: imgupload.php:92
$ilUser
Definition: imgupload.php:34
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc