ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 
34 {
35  public $container = null;
36 
40  protected $rep_object = null;
41 
49  public function __construct($a_parent_obj, $rep_object)
50  {
51  global $DIC;
52 
53  $lng = $DIC['lng'];
54  $ilCtrl = $DIC['ilCtrl'];
55 
56  $this->lng = $lng;
57  $this->lng->loadLanguageModule('grp');
58  $this->ctrl = $ilCtrl;
59 
60  $this->container = $a_parent_obj;
61 
62  $this->rep_object = $rep_object;
63 
64  include_once('./Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
65  $this->privacy = ilPrivacySettings::_getInstance();
66 
67  $this->participants = ilGroupParticipants::_getInstanceByObjId($this->rep_object->getId());
68 
69  parent::__construct($a_parent_obj, 'editMembers');
70  $this->setFormName('participants');
71  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
72 
73  $this->addColumn($this->lng->txt('name'), 'name', '20%');
74  $this->addColumn($this->lng->txt('login'), 'login', '25%');
75 
76  if ($this->privacy->enabledGroupAccessTimes()) {
77  $this->addColumn($this->lng->txt('last_access'), 'access_time');
78  }
79  $this->addColumn($this->lng->txt('grp_contact'), 'contact');
80  $this->addColumn($this->lng->txt('grp_notification'), 'notification');
81  $this->addColumn($this->lng->txt('objs_role'), 'roles');
82 
83  $this->addCommandButton('updateParticipants', $this->lng->txt('save'));
84  $this->addCommandButton('participants', $this->lng->txt('cancel'));
85 
86  $this->setRowTemplate("tpl.edit_participants_row.html", "Modules/Group");
87 
88  $this->disable('sort');
89  $this->enable('header');
90  $this->enable('numinfo');
91  $this->disable('select_all');
92  }
93 
100  public function fillRow($a_set)
101  {
102  $this->tpl->setVariable('VAL_ID', $a_set['usr_id']);
103  $this->tpl->setVariable('VAL_NAME', $a_set['lastname'] . ', ' . $a_set['firstname']);
104 
105  $this->tpl->setVariable('VAL_LOGIN', $a_set['login']);
106 
107  if ($this->privacy->enabledGroupAccessTimes()) {
108  $this->tpl->setVariable('VAL_ACCESS', $a_set['access_time']);
109  }
110  $this->tpl->setVariable('VAL_CONTACT_CHECKED', $a_set['contact'] ? 'checked="checked"' : '');
111  $this->tpl->setVariable('VAL_NOTIFICATION_ID', $a_set['usr_id']);
112  $this->tpl->setVariable('VAL_NOTIFICATION_CHECKED', $a_set['notification'] ? 'checked="checked"' : '');
113 
114  $this->tpl->setVariable('NUM_ROLES', count($this->participants->getRoles()));
115 
116  $assigned = $this->participants->getAssignedRoles($a_set['usr_id']);
117  foreach ($this->rep_object->getLocalGroupRoles(true) as $name => $role_id) {
118  $this->tpl->setCurrentBlock('roles');
119  $this->tpl->setVariable('ROLE_ID', $role_id);
120  $this->tpl->setVariable('ROLE_NAME', $name);
121 
122  if (in_array($role_id, $assigned)) {
123  $this->tpl->setVariable('ROLE_CHECKED', 'selected="selected"');
124  }
125  $this->tpl->parseCurrentBlock();
126  }
127  }
128 }
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
global $DIC
Definition: saml.php:7
global $ilCtrl
Definition: ilias.php:18
Class ilTable2GUI.
__construct($a_parent_obj, $rep_object)
Constructor.
enable($a_module_name)
enables particular modules of table
setRowTemplate($a_template, $a_template_dir="")
Set row template.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
disable($a_module_name)
diesables particular modules of table
setFormName($a_formname="")
Set Form name.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
static _getInstance()
Get instance of ilPrivacySettings.