ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 $lng->loadLanguageModule('sess');
51
52 parent::__construct();
53 }
54
61 public function init()
62 {
63 $this->delete_enabled = true;
64 $this->cut_enabled = true;
65 $this->copy_enabled = true;
66 $this->subscribe_enabled = true;
67 $this->link_enabled = true;
68 $this->info_screen_enabled = true;
69 $this->subitems_enabled = true;
70 $this->type = "sess";
71 $this->gui_class_name = "ilobjsessiongui";
72
73 // general commands array
74 include_once('./Modules/Session/classes/class.ilObjSessionAccess.php');
75 $this->commands = ilObjSessionAccess::_getCommands();
76 }
77
87 public function getTitle()
88 {
90 $title = strlen($this->title) ? (': '.$this->title) : '';
92 }
93
94
95
103 public function getCommandLink($a_cmd)
104 {
105 global $ilCtrl;
106
107 // separate method for this line
108 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->ref_id);
109 $cmd_link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", $a_cmd);
110 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
111 return $cmd_link;
112 }
113
123 public function checkCommandAccess($a_permission,$a_cmd,$a_ref_id,$a_type,$a_obj_id="")
124 {
125 if($a_cmd != 'register' and $a_cmd != 'unregister')
126 {
127 $a_cmd = '';
128 }
129 return parent::checkCommandAccess($a_permission,$a_cmd,$a_ref_id,$a_type,$a_obj_id);
130 }
131
132
140 public function getProperties()
141 {
142 $app_info = $this->getAppointmentInfo();
143
144 /*
145 $props[] = array(
146 'alert' => false,
147 'property' => $this->lng->txt('event_date'),
148 'value' => ilSessionAppointment::_appointmentToString($app_info['start'],$app_info['end'],$app_info['fullday']));
149 */
150 include_once './Modules/Session/classes/class.ilObjSession.php';
151 $session_data = new ilObjSession($this->obj_id, false);
152 include_once './Modules/Session/classes/class.ilSessionParticipants.php';
153 $part = ilSessionParticipants::_getInstanceByObjId($this->obj_id);
154
155 if($session_data->isRegistrationUserLimitEnabled()) {
156 if ($part->getCountMembers() <= $session_data->getRegistrationMaxUsers()) {
157 $props[] = array(
158 'alert' => false,
159 'property' => $this->lng->txt('sess_list_reg_limit_places'),
160 'value' => max(
161 0,
162 $session_data->getRegistrationMaxUsers() - $part->getCountMembers()
163 )
164 );
165 }
166 }
167
169 {
170 if($items = self::lookupAssignedMaterials($this->obj_id))
171 {
172 $props[] = array(
173 'alert' => false,
174 'property' => $this->lng->txt('event_ass_materials_prop'),
175 'value' => count($items)
176 );
177
178 }
179 }
181 {
182 include_once './Modules/Session/classes/class.ilObjSession.php';
183 $session_data = ilObjSession::lookupSession($this->obj_id);
184
185 if(strlen($session_data['location']))
186 {
187 $props[] = array(
188 'alert' => false,
189 'property' => $this->lng->txt('event_location'),
190 'value' => $session_data['location']
191 );
192 }
193 if(strlen($session_data['details']))
194 {
195 $props[] = array(
196 'alert' => false,
197 'property' => $this->lng->txt('event_details_workflow'),
198 'value' => nl2br($session_data['details']),
199 'newline' => true
200 );
201 }
202 $has_new_line = false;
203 if(strlen($session_data['name']))
204 {
205 $props[] = array(
206 'alert' => false,
207 'property' => $this->lng->txt('event_lecturer'),
208 'value' => $session_data['name'],
209 'newline' => true
210 );
211 $has_new_line = true;
212 }
213 if(strlen($session_data['email']))
214 {
215 $props[] = array(
216 'alert' => false,
217 'property' => $this->lng->txt('tutor_email'),
218 'value' => $session_data['email'],
219 'newline' => $has_new_line ? false : true
220 );
221 $has_new_line = true;
222 }
223 if(strlen($session_data['phone']))
224 {
225 $props[] = array(
226 'alert' => false,
227 'property' => $this->lng->txt('tutor_phone'),
228 'value' => $session_data['phone'],
229 'newline' => $has_new_line ? false : true
230 );
231 $has_new_line = true;
232 }
233 }
234
235 return $props;
236 }
237
238
239
246 protected function getAppointmentInfo()
247 {
248 if(isset($this->app_info[$this->obj_id]))
249 {
250 return $this->app_info[$this->obj_id];
251 }
252 include_once('./Modules/Session/classes/class.ilSessionAppointment.php');
253 return $this->app_info[$this->obj_id] = ilSessionAppointment::_lookupAppointment($this->obj_id);
254 }
255
261 protected static function lookupAssignedMaterials($a_sess_id)
262 {
263 global $ilDB;
264
265 $query = 'SELECT * FROM event_items ei '.
266 'JOIN tree ON item_id = child '.
267 'WHERE event_id = '.$ilDB->quote($a_sess_id,'integer').' '.
268 'AND tree > 0';
269 $res = $ilDB->query($query);
270 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
271 {
272 $items[] = $row->item_id;
273 }
274 return $items ? $items : array();
275 }
276
277}
278?>
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
static _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)
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:17
global $ilDB
$a_type
Definition: workflow.php:93