ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilSessionParticipantsTableGUI.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/Table/classes/class.ilTable2GUI.php');
25 
34 {
35  private $session_participants = null;
36  private $participants = array();
37  private $reg_enabled = true;
38 
46  public function __construct($a_parent_obj)
47  {
48  global $lng,$ilCtrl;
49 
50  $this->lng = $lng;
51  $this->lng->loadLanguageModule('sess');
52  $this->lng->loadLanguageModule('crs');
53  $this->lng->loadLanguageModule('trac');
54  $this->ctrl = $ilCtrl;
55 
56  parent::__construct($a_parent_obj,'members');
57 
58  $this->session_participants = new ilEventParticipants($this->getParentObject()->object->getId());
59  }
60 
68  public function enableRegistration($a_status)
69  {
70  $this->reg_enabled = $a_status;
71  }
72 
79  public function isRegistrationEnabled()
80  {
81  return $this->reg_enabled;
82  }
83 
91  public function setParticipants($a_part)
92  {
93  $this->participants = $a_part;
94  }
95 
102  public function getParticipants()
103  {
104  return $this->participants;
105  }
106 
113  public function parse()
114  {
115  $this->init();
116 
117  foreach($this->getParticipants() as $participant_id)
118  {
119  $usr_data = $this->session_participants->getUser($participant_id);
120 
121  $tmp_data['id'] = $participant_id;
122  $name = ilObjUser::_lookupName($participant_id);
123 
124  $tmp_data['name'] = $name['lastname'];
125  $tmp_data['lastname'] = $name['lastname'];
126  $tmp_data['firstname'] = $name['firstname'];
127  $tmp_data['login'] = ilObjUser::_lookupLogin($participant_id);
128  $tmp_data['mark'] = $usr_data['mark'];
129  $tmp_data['comment'] = $usr_data['comment'];
130  $tmp_data['participated'] = $this->session_participants->hasParticipated($participant_id);
131  $tmp_data['registered'] = $this->session_participants->isRegistered($participant_id);
132 
133  $part[] = $tmp_data;
134  }
135  $this->setData($part ? $part : array());
136  }
137 
144  public function fillRow($a_set)
145  {
146  $this->tpl->setVariable('VAL_ID',$a_set['id']);
147  $this->tpl->setVariable('LASTNAME',$a_set['lastname']);
148  $this->tpl->setVariable('FIRSTNAME',$a_set['firstname']);
149  $this->tpl->setVariable('LOGIN',$a_set['login']);
150  $this->tpl->setVariable('MARK',$a_set['mark']);
151  $this->tpl->setVariable('COMMENT',$a_set['comment']);
152  $this->tpl->setVariable('PART_CHECKED',$a_set['participated'] ? 'checked="checked"' : '');
153 
154  if($this->isRegistrationEnabled())
155  {
156  $this->tpl->setCurrentBlock('registered_col');
157  if($a_set['registered'])
158  {
159  $this->tpl->setVariable('IMAGE_REGISTERED',ilUtil::getImagePath('icon_ok.gif'));
160  $this->tpl->setVariable('REGISTERED',$this->lng->txt('event_registered'));
161  }
162  else
163  {
164  $this->tpl->setVariable('IMAGE_REGISTERED',ilUtil::getImagePath('icon_not_ok.gif'));
165  $this->tpl->setVariable('REGISTERED',$this->lng->txt('event_not_registered'));
166  }
167  $this->tpl->parseCurrentBlock();
168  }
169  }
170 
171 
179  protected function init()
180  {
181  $this->setFormName('participants');
182  $this->setFormAction($this->ctrl->getFormAction($this->getParentObject(),'members'));
183 
184  $this->addColumn($this->lng->txt('lastname'),'name','30%');
185  $this->addColumn($this->lng->txt('trac_mark'),'mark');
186  $this->addColumn($this->lng->txt('trac_comment'),'comment');
187  if($this->isRegistrationEnabled())
188  {
189  $this->addColumn($this->lng->txt('event_tbl_registered'),'registered');
190  }
191  $this->addColumn($this->lng->txt('event_tbl_participated'),'participated');
192  $this->setRowTemplate("tpl.sess_members_row.html","Modules/Session");
193 
194  $this->addCommandButton('updateMembers',$this->lng->txt('save'));
195 
196  $this->enable('sort');
197  $this->enable('header');
198 
199  $this->setDefaultOrderField('name');
200  }
201 }
202 ?>