ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilGroupParticipantsTableGUI.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 
46  public function __construct($a_parent_obj,$a_type = 'admin',$show_content = true,$show_learning_progress = false)
47  {
48  global $lng,$ilCtrl;
49 
50  $this->show_learning_progress = $show_learning_progress;
51 
52  $this->lng = $lng;
53  $this->lng->loadLanguageModule('grp');
54  $this->lng->loadLanguageModule('trac');
55  $this->ctrl = $ilCtrl;
56 
57  $this->type = $a_type;
58 
59  include_once('./Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
60  $this->privacy = ilPrivacySettings::_getInstance();
61 
62  parent::__construct($a_parent_obj,'members');
63 
64  $this->setFormName('participants');
65 
66  $this->addColumn('','f',"1");
67  $this->addColumn($this->lng->txt('name'),'lastname','20%');
68  $this->addColumn($this->lng->txt('login'),'login','25%');
69 
70  if($this->show_learning_progress)
71  {
72  $this->addColumn($this->lng->txt('learning_progress'),'progress');
73  }
74 
75  if($this->privacy->enabledGroupAccessTimes())
76  {
77  $this->addColumn($this->lng->txt('last_access'),'access_time_unix');
78  }
79  if($this->type == 'admin')
80  {
81  $this->setPrefix('admin');
82  $this->setSelectAllCheckbox('admins');
83  $this->addColumn($this->lng->txt('grp_notification'),'notification');
84  $this->addCommandButton('updateStatus',$this->lng->txt('save'));
85  }
86  else
87  {
88  $this->setPrefix('member');
89  $this->setSelectAllCheckbox('members');
90  }
91  $this->addColumn($this->lng->txt(''),'optional');
92  $this->setDefaultOrderField('lastname');
93 
94  $this->setRowTemplate("tpl.show_participants_row.html","Modules/Group");
95 
96  if($show_content)
97  {
98  $this->enable('sort');
99  $this->enable('header');
100  $this->enable('numinfo');
101  $this->enable('select_all');
102  }
103  else
104  {
105  $this->disable('content');
106  $this->disable('header');
107  $this->disable('footer');
108  $this->disable('numinfo');
109  $this->disable('select_all');
110  }
111  }
112 
120  public function fillRow($a_set)
121  {
122  global $ilUser,$ilAccess;
123 
124  $this->tpl->setVariable('VAL_ID',$a_set['usr_id']);
125  $this->tpl->setVariable('VAL_NAME',$a_set['lastname'].', '.$a_set['firstname']);
126  if(!$ilAccess->checkAccessOfUser($a_set['usr_id'],'read','',$this->getParentObject()->object->getRefId()) and
127  is_array($info = $ilAccess->getInfo()))
128  {
129  $this->tpl->setVariable('PARENT_ACCESS',$info[0]['text']);
130  }
131 
132 
133  if($this->privacy->enabledGroupAccessTimes())
134  {
135  $this->tpl->setVariable('VAL_ACCESS',$a_set['access_time']);
136  }
137 
138  if($this->show_learning_progress)
139  {
140  $this->tpl->setCurrentBlock('lp');
141  switch($a_set['progress'])
142  {
143  case LP_STATUS_COMPLETED:
144  $this->tpl->setVariable('LP_STATUS_ALT',$this->lng->txt($a_set['progress']));
145  $this->tpl->setVariable('LP_STATUS_PATH',ilUtil::getImagePath('scorm/complete.gif'));
146  break;
147 
149  $this->tpl->setVariable('LP_STATUS_ALT',$this->lng->txt($a_set['progress']));
150  $this->tpl->setVariable('LP_STATUS_PATH',ilUtil::getImagePath('scorm/incomplete.gif'));
151  break;
152 
154  $this->tpl->setVariable('LP_STATUS_ALT',$this->lng->txt($a_set['progress']));
155  $this->tpl->setVariable('LP_STATUS_PATH',ilUtil::getImagePath('scorm/not_attempted.gif'));
156  break;
157 
158  case LP_STATUS_FAILED:
159  $this->tpl->setVariable('LP_STATUS_ALT',$this->lng->txt($a_set['progress']));
160  $this->tpl->setVariable('LP_STATUS_PATH',ilUtil::getImagePath('scorm/failed.gif'));
161  break;
162 
163  }
164  $this->tpl->parseCurrentBlock();
165  }
166 
167 
168  if($this->type == 'admin')
169  {
170  $this->tpl->setVariable('VAL_POSTNAME','admins');
171  $this->tpl->setVariable('VAL_NOTIFICATION_ID',$a_set['usr_id']);
172  $this->tpl->setVariable('VAL_NOTIFICATION_CHECKED',$a_set['notification'] ? 'checked="checked"' : '');
173  }
174  else
175  {
176  $this->tpl->setVariable('VAL_POSTNAME','members');
177  }
178 
179  $this->ctrl->setParameter($this->parent_obj,'member_id',$a_set['usr_id']);
180  $this->tpl->setVariable('LINK_NAME',$this->ctrl->getLinkTarget($this->parent_obj,'editMember'));
181  $this->tpl->setVariable('LINK_TXT',$this->lng->txt('edit'));
182  $this->ctrl->clearParameters($this->parent_obj);
183 
184  $this->tpl->setVariable('VAL_LOGIN',$a_set['login']);
185 
186 
187  }
188 
189 }
190 ?>