ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilGroupEditParticipantsTableGUI.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  public $container = null;
37 
45  public function __construct($a_parent_obj)
46  {
47  global $lng,$ilCtrl;
48 
49  $this->lng = $lng;
50  $this->lng->loadLanguageModule('grp');
51  $this->ctrl = $ilCtrl;
52 
53  $this->container = $a_parent_obj;
54 
55  include_once('./Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
56  $this->privacy = ilPrivacySettings::_getInstance();
57 
58  $this->participants = ilGroupParticipants::_getInstanceByObjId($a_parent_obj->object->getId());
59 
60  parent::__construct($a_parent_obj,'editMembers');
61  $this->setFormName('participants');
62  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
63 
64  $this->addColumn($this->lng->txt('lastname'),'lastname','20%');
65  $this->addColumn($this->lng->txt('login'),'login','25%');
66 
67  if($this->privacy->enabledGroupAccessTimes())
68  {
69  $this->addColumn($this->lng->txt('last_access'),'access_time');
70  }
71  $this->addColumn($this->lng->txt('grp_notification'),'notification');
72  $this->addColumn($this->lng->txt('objs_role'),'roles');
73 
74  $this->addCommandButton('updateMembers',$this->lng->txt('save'));
75  $this->addCommandButton('members',$this->lng->txt('cancel'));
76 
77  $this->setRowTemplate("tpl.edit_participants_row.html","Modules/Group");
78 
79  $this->disable('sort');
80  $this->enable('header');
81  $this->enable('numinfo');
82  $this->disable('select_all');
83  }
84 
91  public function fillRow($a_set)
92  {
93 
94  $this->tpl->setVariable('VAL_ID',$a_set['usr_id']);
95  $this->tpl->setVariable('VAL_NAME',$a_set['lastname'].', '.$a_set['firstname']);
96 
97  $this->tpl->setVariable('VAL_LOGIN',$a_set['login']);
98 
99  if($this->privacy->enabledGroupAccessTimes())
100  {
101  $this->tpl->setVariable('VAL_ACCESS',$a_set['access_time']);
102  }
103  $this->tpl->setVariable('VAL_NOTIFICATION_ID',$a_set['usr_id']);
104  $this->tpl->setVariable('VAL_NOTIFICATION_CHECKED',$a_set['notification'] ? 'checked="checked"' : '');
105 
106  $this->tpl->setVariable('NUM_ROLES',count($this->participants->getRoles()));
107 
108  $assigned = $this->participants->getAssignedRoles($a_set['usr_id']);
109  foreach($this->container->object->getLocalGroupRoles(true) as $name => $role_id)
110  {
111  $this->tpl->setCurrentBlock('roles');
112  $this->tpl->setVariable('ROLE_ID',$role_id);
113  $this->tpl->setVariable('ROLE_NAME',$name);
114 
115  if(in_array($role_id,$assigned))
116  {
117  $this->tpl->setVariable('ROLE_CHECKED','selected="selected"');
118  }
119  $this->tpl->parseCurrentBlock();
120  }
121  }
122 }
123 ?>