ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 $lng, $ilCtrl, $ilUser;
52
53 $this->setId("calmng");
54
55 include_once("./Services/Calendar/classes/class.ilCalendarActions.php");
56 $this->actions = ilCalendarActions::getInstance();
57
58 $this->lng = $lng;
59 $this->lng->loadLanguageModule('dateplaner');
60 $this->ctrl = $ilCtrl;
61
62 parent::__construct($a_parent_obj, 'manage');
63 $this->setFormName('categories');
64 $this->addColumn('', '', '1px', true);
65 $this->addColumn($this->lng->txt('type'), 'type_sortable', '1%');
66 $this->addColumn($this->lng->txt('title'), 'title', '79%');
67 $this->addColumn('', '', '20%');
68
69 $this->setRowTemplate("tpl.manage_row.html", "Services/Calendar");
70 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, "manage"));
71
72 $this->enable('select_all');
73 $this->enable('sort');
74 $this->enable('header');
75 $this->enable('num_info');
76
77 $this->setSelectAllCheckbox('selected_cat_ids');
78 $this->setShowRowsSelector(true);
79 // $this->setDisplayAsBlock(true);
80
81
82 /*
83 $title = $this->lng->txt('cal_table_categories');
84 $title .= $this->appendCalendarSelection();
85 $table_gui->setTitle($title);
86 */
87
88 $this->addMultiCommand('confirmDelete', $this->lng->txt('delete'));
89 // $this->addCommandButton('add',$this->lng->txt('add'));
90
91 $this->setDefaultOrderDirection('asc');
92 $this->setDefaultOrderField('type_sortable');
93 }
94
98 public function resetToDefaults()
99 {
100 $this->resetOffset();
101 $this->setOrderField('type_sortable');
102 $this->setOrderDirection('asc');
103 }
104
112 protected function fillRow($a_set)
113 {
114 include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
115 $current_selection_list = new ilAdvancedSelectionListGUI();
116 $current_selection_list->setListTitle($this->lng->txt("actions"));
117 $current_selection_list->setId("act_" . $a_set['id']);
118
119 $this->ctrl->setParameter($this->getParentObject(), 'category_id', $a_set['id']);
120
121 // edit
122 if ($this->actions->checkSettingsCal($a_set['id'])) {
123 $url = $this->ctrl->getLinkTarget($this->getParentObject(), 'edit');
124 $current_selection_list->addItem($this->lng->txt('settings'), '', $url);
125 }
126
127 // import (ics appointments)
128 if ($this->actions->checkAddEvent($a_set['id'])) {
129 $this->ctrl->setParameterByClass(get_class($this->getParentObject()), 'backv', ilCalendarCategoryGUI::VIEW_MANAGE);
130 $url = $this->ctrl->getLinkTarget($this->getParentObject(), 'importAppointments');
131 $current_selection_list->addItem($this->lng->txt('cal_import_appointments'), '', $url);
132 $this->ctrl->clearParameterByClass(get_class($this->getParentObject()), 'backv');
133 }
134
135 // unshare
136 if ($this->actions->checkUnshareCal($a_set['id'])) {
137 $url = $this->ctrl->getLinkTarget($this->getParentObject(), 'unshare');
138 $current_selection_list->addItem($this->lng->txt('cal_unshare'), '', $url);
139 }
140
141 // share
142 if ($this->actions->checkShareCal($a_set['id'])) {
143 $url = $this->ctrl->getLinkTarget($this->getParentObject(), 'shareSearch');
144 $current_selection_list->addItem($this->lng->txt('cal_share'), '', $url);
145 }
146
147 // synchronize
148 if ($this->actions->checkSynchronizeCal($a_set['id'])) {
149 $url = $this->ctrl->getLinkTarget($this->getParentObject(), 'synchroniseCalendar');
150 $current_selection_list->addItem($this->lng->txt('cal_cal_synchronize'), '', $url);
151 }
152
153 // delete
154 if ($this->actions->checkDeleteCal($a_set['id'])) {
155 $url = $this->ctrl->getLinkTarget($this->getParentObject(), 'confirmDelete');
156 $current_selection_list->addItem($this->lng->txt('delete'), '', $url);
157
158 $this->tpl->setCurrentBlock("checkbox");
159 $this->tpl->setVariable('VAL_ID', $a_set['id']);
160 $this->tpl->parseCurrentBlock();
161 }
162
163 $this->ctrl->setParameter($this->getParentObject(), 'category_id', '');
164
165 switch ($a_set['type']) {
167 $this->tpl->setVariable('IMG_SRC', ilUtil::getImagePath('icon_calg.svg'));
168 $this->tpl->setVariable('IMG_ALT', $this->lng->txt('cal_type_system'));
169 break;
170
172 $this->tpl->setVariable('IMG_SRC', ilUtil::getImagePath('icon_usr.svg'));
173 $this->tpl->setVariable('IMG_ALT', $this->lng->txt('cal_type_personal'));
174 break;
175
177 $type = ilObject::_lookupType($a_set['obj_id']);
178 $this->tpl->setVariable('IMG_SRC', ilUtil::getImagePath('icon_' . $type . '.svg'));
179 $this->tpl->setVariable('IMG_ALT', $this->lng->txt('cal_type_' . $type));
180 break;
181
183 $this->tpl->setVariable('IMG_SRC', ilUtil::getImagePath('icon_book.svg'));
184 $this->tpl->setVariable('IMG_ALT', $this->lng->txt('cal_type_' . $type));
185 break;
186
188 $this->tpl->setVariable('IMG_SRC', ilUtil::getImagePath('icon_calch.svg'));
189 $this->tpl->setVariable('IMG_ALT', $this->lng->txt('cal_ch_ch'));
190 break;
191
192 }
193
194 $this->tpl->setVariable('VAL_TITLE', $a_set['title']);
195 $this->ctrl->setParameterByClass(
196 "ilcalendarpresentationgui",
197 'category_id',
198 $a_set['id']
199 );
200 $this->tpl->setVariable(
201 'EDIT_LINK',
202 $this->ctrl->getLinkTargetByClass(
203 "ilcalendarpresentationgui",
204 ''
205 )
206 );
207 $this->ctrl->setParameterByClass("ilcalendarpresentationgui", 'category_id', $_GET["category_id"]);
208
209 $this->tpl->setVariable('BGCOLOR', $a_set['color']);
210 $this->tpl->setVariable("ACTIONS", $current_selection_list->getHTML());
211
212 /* if(strlen($a_set['path']))
213 {
214 $this->tpl->setCurrentBlock('calendar_path');
215 $this->tpl->setVariable('ADD_PATH_INFO',$a_set['path']);
216 $this->tpl->parseCurrentBlock();
217 }*/
218 }
219
226 public function parse()
227 {
228 global $ilUser, $tree;
229
230 include_once('./Services/Calendar/classes/class.ilCalendarCategories.php');
232 //$cats->initialize(ilCalendarCategories::MODE_MANAGE);
233
234 $tmp_title_counter = array();
235 $categories = array();
236 foreach ($cats->getCategoriesInfo() as $category) {
237 $tmp_arr['obj_id'] = $category['obj_id'];
238 $tmp_arr['id'] = $category['cat_id'];
239 $tmp_arr['title'] = $category['title'];
240 $tmp_arr['type'] = $category['type'];
241
242 // Append object type to make type sortable
243 $tmp_arr['type_sortable'] = ilCalendarCategory::lookupCategorySortIndex($category['type']);
244 if ($category['type'] == ilCalendarCategory::TYPE_OBJ) {
245 $tmp_arr['type_sortable'] .= ('_' . ilObject::_lookupType($category['obj_id']));
246 }
247
248 $tmp_arr['color'] = $category['color'];
249 $tmp_arr['editable'] = $category['editable'];
250 $tmp_arr['accepted'] = $category['accepted'];
251 $tmp_arr['remote'] = $category['remote'];
252
253 $categories[] = $tmp_arr;
254
255 // count title for appending the parent container if there is more than one entry.
256 $tmp_title_counter[$category['type'] . '_' . $category['title']]++;
257 }
258
259 $path_categories = array();
260 foreach ($categories as $cat) {
261 if ($cat['type'] == ilCalendarCategory::TYPE_OBJ) {
262 if ($tmp_title_counter[$cat['type'] . '_' . $cat['title']] > 1) {
263 foreach (ilObject::_getAllReferences($cat['obj_id']) as $ref_id) {
264 include_once './Services/Tree/classes/class.ilPathGUI.php';
265 $path = new ilPathGUI();
266 $path->setUseImages(false);
267 $path->enableTextOnly(false);
268 $cat['path'] = $path->getPath(ROOT_FOLDER_ID, $ref_id);
269 break;
270 }
271 }
272 }
273 $path_categories[] = $cat;
274 }
275 $this->setData($path_categories);
276 }
277}
$_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.
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.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all 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.
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
$ilUser
Definition: imgupload.php:18