ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilCalendarManageTableGUI.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/Table/classes/class.ilTable2GUI.php');
25
36{
40 protected $actions;
41
49 public function __construct($a_parent_obj)
50 {
51 global $DIC;
52
53 $lng = $DIC['lng'];
54 $ilCtrl = $DIC['ilCtrl'];
55 $ilUser = $DIC['ilUser'];
56
57 $this->setId("calmng");
58
59 include_once("./Services/Calendar/classes/class.ilCalendarActions.php");
60 $this->actions = ilCalendarActions::getInstance();
61
62 $this->lng = $lng;
63 $this->lng->loadLanguageModule('dateplaner');
64 $this->ctrl = $ilCtrl;
65
66 parent::__construct($a_parent_obj, 'manage');
67 $this->setFormName('categories');
68 $this->addColumn('', '', '1px', true);
69 $this->addColumn($this->lng->txt('type'), 'type_sortable', '1%');
70 $this->addColumn($this->lng->txt('title'), 'title', '79%');
71 $this->addColumn('', '', '20%');
72
73 $this->setRowTemplate("tpl.manage_row.html", "Services/Calendar");
74 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, "manage"));
75
76 $this->enable('select_all');
77 $this->enable('sort');
78 $this->enable('header');
79 $this->enable('num_info');
80
81 $this->setSelectAllCheckbox('selected_cat_ids');
82 $this->setShowRowsSelector(true);
83 // $this->setDisplayAsBlock(true);
84
85
86 /*
87 $title = $this->lng->txt('cal_table_categories');
88 $title .= $this->appendCalendarSelection();
89 $table_gui->setTitle($title);
90 */
91
92 $this->addMultiCommand('confirmDelete', $this->lng->txt('delete'));
93 // $this->addCommandButton('add',$this->lng->txt('add'));
94
95 $this->setDefaultOrderDirection('asc');
96 $this->setDefaultOrderField('type_sortable');
97 }
98
102 public function resetToDefaults()
103 {
104 $this->resetOffset();
105 $this->setOrderField('type_sortable');
106 $this->setOrderDirection('asc');
107 }
108
116 protected function fillRow($a_set)
117 {
118 include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
119 $current_selection_list = new ilAdvancedSelectionListGUI();
120 $current_selection_list->setListTitle($this->lng->txt("actions"));
121 $current_selection_list->setId("act_" . $a_set['id']);
122
123 $this->ctrl->setParameter($this->getParentObject(), 'category_id', $a_set['id']);
124
125 // edit
126 if ($this->actions->checkSettingsCal($a_set['id'])) {
127 $url = $this->ctrl->getLinkTarget($this->getParentObject(), 'edit');
128 $current_selection_list->addItem($this->lng->txt('settings'), '', $url);
129 }
130
131 // import (ics appointments)
132 if ($this->actions->checkAddEvent($a_set['id'])) {
133 $url = $this->ctrl->getLinkTarget($this->getParentObject(), 'importAppointments');
134 $current_selection_list->addItem($this->lng->txt('cal_import_appointments'), '', $url);
135 }
136
137 // unshare
138 if ($this->actions->checkUnshareCal($a_set['id'])) {
139 $url = $this->ctrl->getLinkTarget($this->getParentObject(), 'unshare');
140 $current_selection_list->addItem($this->lng->txt('cal_unshare'), '', $url);
141 }
142
143 // share
144 if ($this->actions->checkShareCal($a_set['id'])) {
145 $url = $this->ctrl->getLinkTarget($this->getParentObject(), 'shareSearch');
146 $current_selection_list->addItem($this->lng->txt('cal_share'), '', $url);
147 }
148
149 // synchronize
150 if ($this->actions->checkSynchronizeCal($a_set['id'])) {
151 $url = $this->ctrl->getLinkTarget($this->getParentObject(), 'synchroniseCalendar');
152 $current_selection_list->addItem($this->lng->txt('cal_cal_synchronize'), '', $url);
153 }
154
155 // delete
156 if ($this->actions->checkDeleteCal($a_set['id'])) {
157 $url = $this->ctrl->getLinkTarget($this->getParentObject(), 'confirmDelete');
158 $current_selection_list->addItem($this->lng->txt('delete'), '', $url);
159
160 $this->tpl->setCurrentBlock("checkbox");
161 $this->tpl->setVariable('VAL_ID', $a_set['id']);
162 $this->tpl->parseCurrentBlock();
163 }
164
165 $this->ctrl->setParameter($this->getParentObject(), 'category_id', '');
166
167 switch ($a_set['type']) {
169 $this->tpl->setVariable('IMG_SRC', ilUtil::getImagePath('icon_calg.svg'));
170 $this->tpl->setVariable('IMG_ALT', $this->lng->txt('cal_type_system'));
171 break;
172
174 $this->tpl->setVariable('IMG_SRC', ilUtil::getImagePath('icon_usr.svg'));
175 $this->tpl->setVariable('IMG_ALT', $this->lng->txt('cal_type_personal'));
176 break;
177
179 $type = ilObject::_lookupType($a_set['obj_id']);
180 $this->tpl->setVariable('IMG_SRC', ilUtil::getImagePath('icon_' . $type . '.svg'));
181 $this->tpl->setVariable('IMG_ALT', $this->lng->txt('cal_type_' . $type));
182 break;
183
185 $this->tpl->setVariable('IMG_SRC', ilUtil::getImagePath('icon_book.svg'));
186 $this->tpl->setVariable('IMG_ALT', $this->lng->txt('cal_type_' . $type));
187 break;
188
190 $this->tpl->setVariable('IMG_SRC', ilUtil::getImagePath('icon_calch.svg'));
191 $this->tpl->setVariable('IMG_ALT', $this->lng->txt('cal_ch_ch'));
192 break;
193
194 }
195
196 $this->tpl->setVariable('VAL_TITLE', $a_set['title']);
197 $this->ctrl->setParameterByClass(ilCalendarPresentationGUI::class, 'backvm', 1);
198 $this->ctrl->setParameterByClass(
199 "ilcalendarpresentationgui",
200 'category_id',
201 $a_set['id']
202 );
203 $this->tpl->setVariable(
204 'EDIT_LINK',
205 $this->ctrl->getLinkTargetByClass(
206 "ilcalendarpresentationgui",
207 ''
208 )
209 );
210 $this->ctrl->setParameterByClass("ilcalendarpresentationgui", 'category_id', $_GET["category_id"]);
211
212 $this->tpl->setVariable('BGCOLOR', $a_set['color']);
213 $this->tpl->setVariable("ACTIONS", $current_selection_list->getHTML());
214
215 /* if(strlen($a_set['path']))
216 {
217 $this->tpl->setCurrentBlock('calendar_path');
218 $this->tpl->setVariable('ADD_PATH_INFO',$a_set['path']);
219 $this->tpl->parseCurrentBlock();
220 }*/
221 }
222
229 public function parse()
230 {
231 global $DIC;
232
233 $ilUser = $DIC['ilUser'];
234 $tree = $DIC['tree'];
235
236 include_once('./Services/Calendar/classes/class.ilCalendarCategories.php');
238 //$cats->initialize(ilCalendarCategories::MODE_MANAGE);
239
240 $tmp_title_counter = array();
241 $categories = array();
242 foreach ($cats->getCategoriesInfo() as $category) {
243 $tmp_arr['obj_id'] = $category['obj_id'];
244 $tmp_arr['id'] = $category['cat_id'];
245 $tmp_arr['title'] = $category['title'];
246 $tmp_arr['type'] = $category['type'];
247
248 // Append object type to make type sortable
249 $tmp_arr['type_sortable'] = ilCalendarCategory::lookupCategorySortIndex($category['type']);
250 if ($category['type'] == ilCalendarCategory::TYPE_OBJ) {
251 $tmp_arr['type_sortable'] .= ('_' . ilObject::_lookupType($category['obj_id']));
252 }
253
254 $tmp_arr['color'] = $category['color'];
255 $tmp_arr['editable'] = $category['editable'];
256 $tmp_arr['accepted'] = $category['accepted'];
257 $tmp_arr['remote'] = $category['remote'];
258
259 $categories[] = $tmp_arr;
260
261 // count title for appending the parent container if there is more than one entry.
262 $tmp_title_counter[$category['type'] . '_' . $category['title']]++;
263 }
264
265 $path_categories = array();
266 foreach ($categories as $cat) {
267 if ($cat['type'] == ilCalendarCategory::TYPE_OBJ) {
268 if ($tmp_title_counter[$cat['type'] . '_' . $cat['title']] > 1) {
269 foreach (ilObject::_getAllReferences($cat['obj_id']) as $ref_id) {
270 include_once './Services/Tree/classes/class.ilPathGUI.php';
271 $path = new ilPathGUI();
272 $path->setUseImages(false);
273 $path->enableTextOnly(false);
274 $cat['path'] = $path->getPath(ROOT_FOLDER_ID, $ref_id);
275 break;
276 }
277 }
278 }
279 $path_categories[] = $cat;
280 }
281 $this->setData($path_categories);
282 }
283}
$path
Definition: aliased.php:25
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
User interface class for advanced drop-down selection lists.
static getInstance()
Get instance.
static _getInstance($a_usr_id=0)
get singleton instance
static lookupCategorySortIndex($a_type_id)
Lookup sort index of calendar type.
show list of alle calendars to manage
resetToDefaults()
reset table to defaults
__construct($a_parent_obj)
Constructor.
static _getAllReferences($a_id)
get all reference ids of object
static _lookupType($a_id, $a_reference=false)
lookup object type
Creates a path for a start and endnode.
Class ilTable2GUI.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
getParentObject()
Get parent object.
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.
resetOffset($a_in_determination=false)
Reset offset.
addMultiCommand($a_cmd, $a_text)
Add Command button.
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.
setOrderField($a_order_field)
set order column
setFormName($a_formname="")
Set Form name.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setOrderDirection($a_order_direction)
set order direction @access public
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 $ilCtrl
Definition: ilias.php:18
$type
$url
global $DIC
Definition: saml.php:7
$ilUser
Definition: imgupload.php:18