ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilCalendarSharedListTableGUI.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');
25include_once('./Services/Calendar/classes/class.ilCalendarShared.php');
26
35{
36 protected $calendar_id;
37
46 {
47 global $DIC;
48
49 $ilCtrl = $DIC['ilCtrl'];
50
52
53 $this->setRowTemplate('tpl.calendar_shared_list_row.html', 'Services/Calendar');
54 $this->setFormAction($ilCtrl->getFormAction($this->getParentObject()));
55
56 $this->addColumn('', 'id', '1px');
57 $this->addColumn($this->lng->txt('type'), 'type', '1px');
58 $this->addColumn($this->lng->txt('title'), 'title', '80%');
59 $this->addColumn($this->lng->txt('cal_shared_access_table_col'), 'access', '20%');
60
61 $this->addMultiCommand('shareDeassign', $this->lng->txt('cal_unshare_cal'));
62 $this->setPrefix('shared');
63 $this->setSelectAllCheckbox('obj_ids');
64 }
65
73 public function setCalendarId($a_calendar_id)
74 {
75 $this->calendar_id = $a_calendar_id;
76 }
77
84 public function fillRow($a_set)
85 {
86 $this->tpl->setVariable('VAL_ID', $a_set['obj_id']);
87 $this->tpl->setVariable('NAME', $a_set['title']);
88
89 if (strlen($a_set['description'])) {
90 $this->tpl->setVariable('DESCRIPTION', $a_set['description']);
91 }
92
93 $this->tpl->setVariable('TYPE_IMG', ilUtil::getImagePath('icon_' . $a_set['type'] . '.svg'));
94 $this->tpl->setVariable('ALT_IMG', $this->lng->txt('obj_' . $a_set['type']));
95
96 if ($a_set['writable']) {
97 $this->tpl->setVariable('CAL_ACCESS', $this->lng->txt('cal_shared_access_read_write'));
98 } else {
99 $this->tpl->setVariable('CAL_ACCESS', $this->lng->txt('cal_shared_access_read_only'));
100 }
101 }
102
109 public function parse()
110 {
111 $this->shared_obj = new ilCalendarShared($this->calendar_id);
112
113 $items = array();
114 foreach ($this->shared_obj->getShared() as $item) {
115 switch ($item['obj_type']) {
117 $data['type'] = 'usr';
118
119 $name = ilObjUser::_lookupName($item['obj_id']);
120 $data['title'] = $name['lastname'] . ', ' . $name['firstname'];
121 $data['description'] = '';
122 break;
123
124
126 $data['type'] = 'role';
127 $data['title'] = ilObject::_lookupTitle($item['obj_id']);
128 $data['description'] = ilObject::_lookupDescription($item['obj_id']);
129 break;
130 }
131 $data['obj_id'] = $item['obj_id'];
132 $data['create_date'] = $item['create_date'];
133 $data['writable'] = $item['writable'];
134
135 $items[] = $data;
136 }
137 $this->setData($items ? $items : array());
138 return true;
139 }
140}
An exception for terminatinating execution or to throw for unit testing.
__construct($parent_obj, $parent_cmd)
Constructor.
Handles shared calendars.
static _lookupName($a_user_id)
lookup user name
static _lookupTitle($a_id)
lookup object title
static _lookupDescription($a_id)
lookup object description
Class ilTable2GUI.
setPrefix($a_prefix)
set prefix for sort and offset fields (if you have two or more tables on a page that you want to sort...
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.
addMultiCommand($a_cmd, $a_text)
Add Command 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.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
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
if($format !==null) $name
Definition: metadata.php:230
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$DIC
Definition: xapitoken.php:46