ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
24 include_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');
51  }
52 
59  public function init()
60  {
61  $this->delete_enabled = true;
62  $this->cut_enabled = false;
63  $this->copy_enabled = true;
64  $this->subscribe_enabled = true;
65  $this->link_enabled = false;
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  {
88  $app_info = $this->getAppointmentInfo();
89  $title = strlen($this->title) ? (': '.$this->title) : '';
91  }
92 
93 
94 
102  public function getCommandLink($a_cmd)
103  {
104  // separate method for this line
105  return "repository.php?ref_id=".$this->ref_id."&cmd=$a_cmd";
106  }
107 
117  public function checkCommandAccess($a_permission,$a_cmd,$a_ref_id,$a_type,$a_obj_id="")
118  {
119  if($a_cmd != 'register' and $a_cmd != 'unregister')
120  {
121  $a_cmd = '';
122  }
123  return parent::checkCommandAccess($a_permission,$a_cmd,$a_ref_id,$a_type,$a_obj_id);
124  }
125 
126 
134  public function getProperties()
135  {
136  $app_info = $this->getAppointmentInfo();
137 
138  /*
139  $props[] = array(
140  'alert' => false,
141  'property' => $this->lng->txt('event_date'),
142  'value' => ilSessionAppointment::_appointmentToString($app_info['start'],$app_info['end'],$app_info['fullday']));
143  */
144 
146  {
147  if($items = self::lookupAssignedMaterials($this->obj_id))
148  {
149  $props[] = array(
150  'alert' => false,
151  'property' => $this->lng->txt('event_ass_materials_prop'),
152  'value' => count($items)
153  );
154 
155  }
156  }
158  {
159  include_once './Modules/Session/classes/class.ilObjSession.php';
160  $session_data = ilObjSession::lookupSession($this->obj_id);
161 
162  if(strlen($session_data['location']))
163  {
164  $props[] = array(
165  'alert' => false,
166  'property' => $this->lng->txt('event_location'),
167  'value' => $session_data['location']
168  );
169  }
170  if(strlen($session_data['details']))
171  {
172  $props[] = array(
173  'alert' => false,
174  'property' => $this->lng->txt('event_details_workflow'),
175  'value' => nl2br($session_data['details']),
176  'newline' => true
177  );
178  }
179  $has_new_line = false;
180  if(strlen($session_data['name']))
181  {
182  $props[] = array(
183  'alert' => false,
184  'property' => $this->lng->txt('event_lecturer'),
185  'value' => $session_data['name'],
186  'newline' => true
187  );
188  $has_new_line = true;
189  }
190  if(strlen($session_data['email']))
191  {
192  $props[] = array(
193  'alert' => false,
194  'property' => $this->lng->txt('tutor_email'),
195  'value' => $session_data['email'],
196  'newline' => $has_new_line ? false : true
197  );
198  $has_new_line = true;
199  }
200  if(strlen($session_data['phone']))
201  {
202  $props[] = array(
203  'alert' => false,
204  'property' => $this->lng->txt('tutor_phone'),
205  'value' => $session_data['phone'],
206  'newline' => $has_new_line ? false : true
207  );
208  $has_new_line = true;
209  }
210  }
211  return $props;
212  }
213 
214 
215 
222  protected function getAppointmentInfo()
223  {
224  if(isset($this->app_info[$this->obj_id]))
225  {
226  return $this->app_info[$this->obj_id];
227  }
228  include_once('./Modules/Session/classes/class.ilSessionAppointment.php');
229  return $this->app_info[$this->obj_id] = ilSessionAppointment::_lookupAppointment($this->obj_id);
230  }
231 
237  protected static function lookupAssignedMaterials($a_sess_id)
238  {
239  global $ilDB;
240 
241  $query = 'SELECT * FROM event_items '.
242  'WHERE event_id = '.$ilDB->quote($a_sess_id).' ';
243  $res = $ilDB->query($query);
244  while($row = $res->fetchRow(FETCHMODE_OBJECT))
245  {
246  $items[] = $row['item_id'];
247  }
248  return $items ? $items : array();
249  }
250 
251 }
252 ?>