ILIAS  release_7 Revision v7.30-3-g800a261c036
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
24include_once('./Services/Calendar/classes/class.ilCalendarCategories.php');
25include_once('./Services/Table/classes/class.ilTable2GUI.php');
26
35{
36 private $cat_id = 0;
37 private $categories = null;
38 private $is_editable = false;
39
47 public function __construct($a_parent_obj, $a_parent_cmd)
48 {
49 global $DIC;
50
51 $lng = $DIC['lng'];
52 $ilCtrl = $DIC['ilCtrl'];
53
54
55 $this->categories = ilCalendarCategories::_getInstance();
56
57 $this->lng = $lng;
58 $this->lng->loadLanguageModule('dateplaner');
59 $this->ctrl = $ilCtrl;
60
61 $this->setId('calinbox');
62
63 parent::__construct($a_parent_obj, $a_parent_cmd);
64 $this->setFormName('appointments');
65 $this->addColumn($this->lng->txt('date'), 'begin', "30%");
66 $this->addColumn($this->lng->txt('title'), 'title', "40%");
67 #$this->addColumn($this->lng->txt('cal_duration'),'duration',"15%");
68 $this->addColumn($this->lng->txt('cal_recurrences'), 'frequence', "15%");
69 $this->addColumn($this->lng->txt('last_update'), 'last_update', "15%");
70
71
72 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
73 $this->setRowTemplate("tpl.show_changed_appointment_row.html", "Services/Calendar");
74
75 $this->setShowRowsSelector(true);
76 $this->enable('sort');
77 $this->enable('header');
78 $this->enable('numinfo');
79
80 $this->setDefaultOrderField('begin');
81 $this->setDefaultOrderDirection('asc');
82 }
83
84
92 protected function fillRow($a_set)
93 {
94 global $DIC;
95
96 $ilUser = $DIC['ilUser'];
97 $lng = $DIC['lng'];
98
99 if ($a_set["milestone"]) {
100 $this->tpl->setCurrentBlock("img_ms");
101 $this->tpl->setVariable("IMG_MS", ilUtil::getImagePath("icon_ms.svg"));
102 $this->tpl->setVariable("ALT_MS", $lng->txt("cal_milestone"));
103 $this->tpl->parseCurrentBlock();
104 }
105
106 $this->tpl->setVariable('VAL_DESCRIPTION', $a_set['description']);
107
108 $this->tpl->setVariable('VAL_TITLE_LINK', $a_set['title']);
109 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_set['id']);
110 $this->tpl->setVariable('VAL_LINK', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'edit'));
111
112 switch ($a_set['frequence']) {
114 $this->tpl->setVariable('VAL_FREQUENCE', $this->lng->txt('cal_daily'));
115 break;
116
118 $this->tpl->setVariable('VAL_FREQUENCE', $this->lng->txt('cal_weekly'));
119 break;
120
122 $this->tpl->setVariable('VAL_FREQUENCE', $this->lng->txt('cal_monthly'));
123 break;
124
126 $this->tpl->setVariable('VAL_FREQUENCE', $this->lng->txt('cal_yearly'));
127 break;
128
129 default:
130 #$this->tpl->setVariable('VAL_FREQUENCE',$this->lng->txt('cal_no_recurrence'));
131 break;
132 }
133 if ($a_set['fullday']) {
135 new ilDate($a_set['begin'], IL_CAL_UNIX),
136 new ilDate($a_set['end'], IL_CAL_UNIX)
137 );
138 } else {
140 new ilDateTime($a_set['begin'], IL_CAL_UNIX),
141 new ilDateTime($a_set['end'], IL_CAL_UNIX)
142 );
143 }
144 $this->tpl->setVariable('VAL_BEGIN', $date);
145 /*
146 if($a_set['duration'])
147 {
148 if($a_set['milestone'])
149 {
150 $this->tpl->setVariable('VAL_DURATION','-');
151 }
152 else
153 {
154 $this->tpl->setVariable('VAL_DURATION',ilDatePresentation::secondsToString($a_set['duration']));
155 }
156 }
157 else
158 {
159 $this->tpl->setVariable('VAL_DURATION','');
160 }
161 */
162 $update = new ilDateTime($a_set['last_update'], IL_CAL_UNIX, $ilUser->getTimeZone());
163 $this->tpl->setVariable('VAL_LAST_UPDATE', ilDatePresentation::formatDate($update));
164 }
165
172 public function setAppointments($a_apps)
173 {
174 include_once('./Services/Calendar/classes/class.ilCalendarEntry.php');
175 include_once('./Services/Calendar/classes/class.ilCalendarRecurrences.php');
176 $appointments = array();
177
178 foreach ($a_apps as $event) {
179 $entry = $event['event'];
180
181 $rec = ilCalendarRecurrences::_getFirstRecurrence($entry->getEntryId());
182
183 $tmp_arr['id'] = $entry->getEntryId();
184 $tmp_arr['milestone'] = $entry->isMilestone();
185 $tmp_arr['title'] = $entry->getPresentationTitle();
186 $tmp_arr['description'] = $entry->getDescription();
187 $tmp_arr['fullday'] = $entry->isFullday();
188 #$tmp_arr['begin'] = $entry->getStart()->get(IL_CAL_UNIX);
189 #$tmp_arr['end'] = $entry->getEnd()->get(IL_CAL_UNIX);
190
191 $tmp_arr['begin'] = $event['dstart'];
192 $tmp_arr['end'] = $event['dend'];
193
194 $tmp_arr['duration'] = $tmp_arr['end'] - $tmp_arr['begin'];
195 if ($tmp_arr['fullday']) {
196 $tmp_arr['duration'] += (60 * 60 * 24);
197 }
198 if (!$tmp_arr['fullday'] and $tmp_arr['end'] == $tmp_arr['begin']) {
199 $tmp_arr['duration'] = '';
200 }
201
202 $tmp_arr['last_update'] = $entry->getLastUpdate()->get(IL_CAL_UNIX);
203 $tmp_arr['frequence'] = $rec->getFrequenceType();
204
205 $appointments[] = $tmp_arr;
206 }
207
208 //cuts appointments array after Limit
209 $appointments = array_slice($appointments, 0, $this->getLimit());
210
211 $this->setData($appointments ? $appointments : array());
212 }
213}
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_FREQ_YEARLY
const IL_CAL_FREQ_MONTHLY
const IL_CAL_FREQ_WEEKLY
const IL_CAL_UNIX
static _getInstance($a_usr_id=0)
get singleton instance
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.
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
@classDescription Date and time handling
Class for single dates.
Class ilTable2GUI.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setData($a_data)
set table data @access public
getLimit()
Get limit.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
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.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
enable($a_module_name)
enables particular modules of table
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
global $DIC
Definition: goto.php:24
const IL_CAL_FREQ_DAILY
Model of calendar entry recurrcences.
$ilUser
Definition: imgupload.php:18
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc