ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilCourseParticipantsTableGUI.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 
35 {
36  protected $type = 'admin';
37  protected $show_learning_progress = false;
38  protected $show_timings = false;
39  protected $show_edit_link = true;
40 
48  public function __construct($a_parent_obj,$a_type = 'admin',$show_content = true,$a_show_learning_progress = false,$a_show_timings = false, $a_show_edit_link=true)
49  {
50  global $lng,$ilCtrl;
51 
52  $this->show_learning_progress = $a_show_learning_progress;
53  $this->show_timings = $a_show_timings;
54  $this->show_edit_link = $a_show_edit_link;
55 
56  $this->lng = $lng;
57  $this->lng->loadLanguageModule('crs');
58  $this->lng->loadLanguageModule('trac');
59  $this->ctrl = $ilCtrl;
60 
61  $this->type = $a_type;
62 
63  include_once('./Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
64  $this->privacy = ilPrivacySettings::_getInstance();
65 
66  parent::__construct($a_parent_obj,'members');
67 
68  $this->setFormName('participants');
69 
70  $this->addColumn('','f',"1");
71  $this->addColumn($this->lng->txt('name'),'lastname','20%');
72  $this->addColumn($this->lng->txt('login'),'login','10%');
73 
74  if($this->show_learning_progress)
75  {
76  $this->addColumn($this->lng->txt('learning_progress'),'progress');
77  }
78 
79  if($this->privacy->enabledCourseAccessTimes())
80  {
81  $this->addColumn($this->lng->txt('last_access'),'access_ut','16em');
82  }
83  $this->addColumn($this->lng->txt('crs_member_passed'),'passed');
84  if($this->type == 'admin')
85  {
86  $this->setPrefix('admin');
87  $this->setSelectAllCheckbox('admins');
88  $this->addColumn($this->lng->txt('crs_notification'),'notification');
89  $this->addCommandButton('updateAdminStatus',$this->lng->txt('save'));
90  }
91  elseif($this->type == 'tutor')
92  {
93  $this->setPrefix('tutor');
94  $this->setSelectAllCheckbox('tutors');
95  $this->addColumn($this->lng->txt('crs_notification'),'notification');
96  $this->addCommandButton('updateTutorStatus',$this->lng->txt('save'));
97  }
98  else
99  {
100  $this->setPrefix('member');
101  $this->setSelectAllCheckbox('members');
102  $this->addColumn($this->lng->txt('crs_blocked'),'blocked');
103  $this->addCommandButton('updateMemberStatus',$this->lng->txt('save'));
104  }
105  $this->addColumn($this->lng->txt(''),'optional');
106 
107  $this->setRowTemplate("tpl.show_participants_row.html","Modules/Course");
108 
109  if($show_content)
110  {
111  $this->setDefaultOrderField('lastname');
112  $this->enable('sort');
113  $this->enable('header');
114  $this->enable('numinfo');
115  $this->enable('select_all');
116  }
117  else
118  {
119  $this->disable('content');
120  $this->disable('header');
121  $this->disable('footer');
122  $this->disable('numinfo');
123  $this->disable('select_all');
124  }
125  }
126 
134  public function fillRow($a_set)
135  {
136  global $ilUser,$ilAccess;
137 
138  $this->tpl->setVariable('VAL_ID',$a_set['usr_id']);
139  $this->tpl->setVariable('VAL_NAME',$a_set['lastname'].', '.$a_set['firstname']);
140 
141  if(!$ilAccess->checkAccessOfUser($a_set['usr_id'],'read','',$this->getParentObject()->object->getRefId()) and
142  is_array($info = $ilAccess->getInfo()))
143  {
144  $this->tpl->setVariable('PARENT_ACCESS',$info[0]['text']);
145  }
146 
147 
148  if($this->privacy->enabledCourseAccessTimes())
149  {
150  $this->tpl->setVariable('VAL_ACCESS',$a_set['access_time']);
151  }
152  if($this->show_learning_progress)
153  {
154  $this->tpl->setCurrentBlock('lp');
155  switch($a_set['progress'])
156  {
157  case LP_STATUS_COMPLETED:
158  $this->tpl->setVariable('LP_STATUS_ALT',$this->lng->txt($a_set['progress']));
159  $this->tpl->setVariable('LP_STATUS_PATH',ilUtil::getImagePath('scorm/complete.gif'));
160  break;
161 
163  $this->tpl->setVariable('LP_STATUS_ALT',$this->lng->txt($a_set['progress']));
164  $this->tpl->setVariable('LP_STATUS_PATH',ilUtil::getImagePath('scorm/incomplete.gif'));
165  break;
166 
168  $this->tpl->setVariable('LP_STATUS_ALT',$this->lng->txt($a_set['progress']));
169  $this->tpl->setVariable('LP_STATUS_PATH',ilUtil::getImagePath('scorm/not_attempted.gif'));
170  break;
171 
172  case LP_STATUS_FAILED:
173  $this->tpl->setVariable('LP_STATUS_ALT',$this->lng->txt($a_set['progress']));
174  $this->tpl->setVariable('LP_STATUS_PATH',ilUtil::getImagePath('scorm/failed.gif'));
175  break;
176 
177  }
178  $this->tpl->parseCurrentBlock();
179  }
180 
181  if($this->type == 'admin')
182  {
183  $this->tpl->setVariable('VAL_POSTNAME','admins');
184  $this->tpl->setVariable('VAL_NOTIFICATION_ID',$a_set['usr_id']);
185  $this->tpl->setVariable('VAL_NOTIFICATION_CHECKED',($a_set['notification'] ? 'checked="checked"' : ''));
186  }
187  elseif($this->type == 'tutor')
188  {
189  $this->tpl->setVariable('VAL_POSTNAME','tutors');
190  $this->tpl->setVariable('VAL_NOTIFICATION_ID',$a_set['usr_id']);
191  $this->tpl->setVariable('VAL_NOTIFICATION_CHECKED',($a_set['notification'] ? 'checked="checked"' : ''));
192  }
193  else
194  {
195  $this->tpl->setCurrentBlock('blocked');
196  $this->tpl->setVariable('VAL_BLOCKED_ID',$a_set['usr_id']);
197  $this->tpl->setVariable('VAL_BLOCKED_CHECKED',($a_set['blocked'] ? 'checked="checked"' : ''));
198  $this->tpl->parseCurrentBlock();
199 
200  $this->tpl->setVariable('VAL_POSTNAME','members');
201  }
202 
203  $this->tpl->setVariable('VAL_PASSED_ID',$a_set['usr_id']);
204  $this->tpl->setVariable('VAL_PASSED_CHECKED',($a_set['passed'] ? 'checked="checked"' : ''));
205 
206 
207  $this->ctrl->setParameter($this->parent_obj,'member_id',$a_set['usr_id']);
208  if ($this->show_edit_link)
209  {
210  $this->tpl->setCurrentBlock('link');
211  $this->tpl->setVariable('LINK_NAME',$this->ctrl->getLinkTarget($this->parent_obj,'editMember'));
212  $this->tpl->setVariable('LINK_TXT',$this->lng->txt('edit'));
213  $this->tpl->parseCurrentBlock();
214  }
215  $this->ctrl->clearParameters($this->parent_obj);
216 
217 
218  if($this->show_timings)
219  {
220  $this->ctrl->setParameterByClass('ilcoursecontentgui','member_id',$a_set['usr_id']);
221  $this->tpl->setCurrentBlock('link');
222  $this->tpl->setVariable('LINK_NAME',$this->ctrl->getLinkTargetByClass('ilcoursecontentgui','showUserTimings'));
223  $this->tpl->setVariable('LINK_TXT',$this->lng->txt('timings_timings'));
224  $this->tpl->parseCurrentBlock();
225  }
226 
227 
228  $this->tpl->setVariable('VAL_LOGIN',$a_set['login']);
229  }
230 
231 }
232 ?>