ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
class.ilObjSessionListGUI.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/Object/classes/class.ilObjectListGUI.php');
25
26
35{
36 protected $app_info = array();
37
38
45 public function __construct()
46 {
47 global $lng;
48
49 $lng->loadLanguageModule('crs');
50 parent::__construct();
51 }
52
59 public function init()
60 {
61 $this->delete_enabled = true;
62 $this->cut_enabled = true;
63 $this->copy_enabled = true;
64 $this->subscribe_enabled = true;
65 $this->link_enabled = true;
66 $this->payment_enabled = false;
67 $this->info_screen_enabled = true;
68 $this->subitems_enabled = true;
69 $this->type = "sess";
70 $this->gui_class_name = "ilobjsessiongui";
71
72 // general commands array
73 include_once('./Modules/Session/classes/class.ilObjSessionAccess.php');
74 $this->commands = ilObjSessionAccess::_getCommands();
75 }
76
86 public function getTitle()
87 {
89 $title = strlen($this->title) ? (': '.$this->title) : '';
90 return ilSessionAppointment::_appointmentToString($app_info['start'], $app_info['end'],$app_info['fullday']) . $title;
91 }
92
93
94
102 public function getCommandLink($a_cmd)
103 {
104 global $ilCtrl;
105
106 // separate method for this line
107 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->ref_id);
108 $cmd_link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", $a_cmd);
109 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
110 return $cmd_link;
111 }
112
122 public function checkCommandAccess($a_permission,$a_cmd,$a_ref_id,$a_type,$a_obj_id="")
123 {
124 if($a_cmd != 'register' and $a_cmd != 'unregister')
125 {
126 $a_cmd = '';
127 }
128 return parent::checkCommandAccess($a_permission,$a_cmd,$a_ref_id,$a_type,$a_obj_id);
129 }
130
131
139 public function getProperties()
140 {
141 $app_info = $this->getAppointmentInfo();
142
143 /*
144 $props[] = array(
145 'alert' => false,
146 'property' => $this->lng->txt('event_date'),
147 'value' => ilSessionAppointment::_appointmentToString($app_info['start'],$app_info['end'],$app_info['fullday']));
148 */
149
151 {
152 if($items = self::lookupAssignedMaterials($this->obj_id))
153 {
154 $props[] = array(
155 'alert' => false,
156 'property' => $this->lng->txt('event_ass_materials_prop'),
157 'value' => count($items)
158 );
159
160 }
161 }
163 {
164 include_once './Modules/Session/classes/class.ilObjSession.php';
165 $session_data = ilObjSession::lookupSession($this->obj_id);
166
167 if(strlen($session_data['location']))
168 {
169 $props[] = array(
170 'alert' => false,
171 'property' => $this->lng->txt('event_location'),
172 'value' => $session_data['location']
173 );
174 }
175 if(strlen($session_data['details']))
176 {
177 $props[] = array(
178 'alert' => false,
179 'property' => $this->lng->txt('event_details_workflow'),
180 'value' => nl2br($session_data['details']),
181 'newline' => true
182 );
183 }
184 $has_new_line = false;
185 if(strlen($session_data['name']))
186 {
187 $props[] = array(
188 'alert' => false,
189 'property' => $this->lng->txt('event_lecturer'),
190 'value' => $session_data['name'],
191 'newline' => true
192 );
193 $has_new_line = true;
194 }
195 if(strlen($session_data['email']))
196 {
197 $props[] = array(
198 'alert' => false,
199 'property' => $this->lng->txt('tutor_email'),
200 'value' => $session_data['email'],
201 'newline' => $has_new_line ? false : true
202 );
203 $has_new_line = true;
204 }
205 if(strlen($session_data['phone']))
206 {
207 $props[] = array(
208 'alert' => false,
209 'property' => $this->lng->txt('tutor_phone'),
210 'value' => $session_data['phone'],
211 'newline' => $has_new_line ? false : true
212 );
213 $has_new_line = true;
214 }
215 }
216
217 return $props;
218 }
219
220
221
228 protected function getAppointmentInfo()
229 {
230 if(isset($this->app_info[$this->obj_id]))
231 {
232 return $this->app_info[$this->obj_id];
233 }
234 include_once('./Modules/Session/classes/class.ilSessionAppointment.php');
235 return $this->app_info[$this->obj_id] = ilSessionAppointment::_lookupAppointment($this->obj_id);
236 }
237
243 protected static function lookupAssignedMaterials($a_sess_id)
244 {
245 global $ilDB;
246
247 $query = 'SELECT * FROM event_items ei '.
248 'JOIN tree ON item_id = child '.
249 'WHERE event_id = '.$ilDB->quote($a_sess_id,'integer').' '.
250 'AND tree > 0';
251 $res = $ilDB->query($query);
252 while($row = $res->fetchRow(FETCHMODE_OBJECT))
253 {
254 $items[] = $row->item_id;
255 }
256 return $items ? $items : array();
257 }
258
259}
260?>
$_GET["client_id"]
_getCommands()
get list of command/permission combinations
getTitle()
get title Overwritten since sessions prepend the date of the session to the title
static lookupAssignedMaterials($a_sess_id)
Get assigned items of event.
getCommandLink($a_cmd)
Get command link url.
getAppointmentInfo()
get appointment info
checkCommandAccess($a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id="")
Only check cmd access for cmd 'register' and 'unregister'.
static lookupSession($a_obj_id)
Get session data.
Class ilObjectListGUI.
getDetailsLevel()
Get current details level.
static _lookupAppointment($a_obj_id)
lookup appointment
static _appointmentToString($start, $end, $fulltime)
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
global $ilDB