ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilCourseEditParticipantsTableGUI.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
24include_once('./Services/Table/classes/class.ilTable2GUI.php');
25
34{
35 public $container = null;
36
40 protected $rep_object = null;
41
50 private $localCourseRoles = null;
51
59 public function __construct($a_parent_obj, $rep_object)
60 {
61 global $lng,$ilCtrl;
62
63 $this->lng = $lng;
64 $this->lng->loadLanguageModule('crs');
65 $this->ctrl = $ilCtrl;
66
67 $this->container = $a_parent_obj;
68 $this->rep_object = $rep_object;
69
70 include_once('./Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
71 $this->privacy = ilPrivacySettings::_getInstance();
72
73 $this->participants = ilCourseParticipants::_getInstanceByObjId($this->rep_object->getId());
74
75 parent::__construct($a_parent_obj, 'editMembers');
76 $this->setFormName('participants');
77 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
78
79 $this->addColumn($this->lng->txt('name'), 'name', '20%');
80 $this->addColumn($this->lng->txt('login'), 'login', '25%');
81
82 if ($this->privacy->enabledCourseAccessTimes()) {
83 $this->addColumn($this->lng->txt('last_access'), 'access_time');
84 }
85 $this->addColumn($this->lng->txt('crs_passed'), 'passed');
86 $this->addColumn($this->lng->txt('crs_blocked'), 'blocked');
87 // cognos-blu-patch: begin
88 $this->addColumn($this->lng->txt('crs_mem_contact'), 'contact');
89 // cognos-blu-patch: end
90 $this->addColumn($this->lng->txt('crs_notification'), 'notification');
91 $this->addColumn($this->lng->txt('objs_role'), 'roles');
92
93 $this->addCommandButton('updateParticipants', $this->lng->txt('save'));
94 $this->addCommandButton('participants', $this->lng->txt('cancel'));
95
96 $this->setRowTemplate("tpl.edit_participants_row.html", "Modules/Course");
97
98 $this->disable('sort');
99 $this->enable('header');
100 $this->enable('numinfo');
101 $this->disable('select_all');
102
103 // Performance improvement: We read the local course roles
104 // only once, instead of reading them for each row in method fillRow().
105 $this->localCourseRoles = array();
106 foreach ($this->rep_object->getLocalCourseRoles(false) as $title => $role_id) {
107 $this->localCourseRoles[ilObjRole::_getTranslation($title)] = array('role_id'=>$role_id, 'title'=>$title);
108 }
109 }
110
117 public function fillRow($a_set)
118 {
119 global $rbacsystem, $ilAccess, $ilUser;
120 $hasEditPermissionAccess =
121 (
122 $ilAccess->checkAccess('edit_permission', '', $this->rep_object->getRefId()) or
123 $this->participants->isAdmin($ilUser->getId())
124 );
125
126 $this->tpl->setVariable('VAL_ID', $a_set['usr_id']);
127 $this->tpl->setVariable('VAL_NAME', $a_set['lastname'] . ', ' . $a_set['firstname']);
128
129 $this->tpl->setVariable('VAL_LOGIN', $a_set['login']);
130
131 if ($this->privacy->enabledCourseAccessTimes()) {
132 $this->tpl->setVariable('VAL_ACCESS', $a_set['access_time']);
133 }
134 // cognos-blu-patch: begin
135 $this->tpl->setVariable('VAL_CONTACT_CHECKED', $a_set['contact'] ? 'checked="checked"' : '');
136 // cognos-blu-patch: end
137
138 $this->tpl->setVariable('VAL_NOTIFICATION_CHECKED', $a_set['notification'] ? 'checked="checked"' : '');
139 $this->tpl->setVariable('VAL_PASSED_CHECKED', $a_set['passed'] ? 'checked="checked"' : '');
140 $this->tpl->setVariable('VAL_BLOCKED_CHECKED', $a_set['blocked'] ? 'checked="checked"' : '');
141
142 $this->tpl->setVariable('NUM_ROLES', count($this->participants->getRoles()));
143
144 $assigned = $this->participants->getAssignedRoles($a_set['usr_id']);
145 foreach ($this->localCourseRoles as $localizedTitle => $roleData) {
146 if ($hasEditPermissionAccess || substr($roleData['title'], 0, 12) != 'il_crs_admin') {
147 $this->tpl->setCurrentBlock('roles');
148 $this->tpl->setVariable('ROLE_ID', $roleData['role_id']);
149 $this->tpl->setVariable('ROLE_NAME', $localizedTitle);
150
151 if (in_array($roleData['role_id'], $assigned)) {
152 $this->tpl->setVariable('ROLE_CHECKED', 'selected="selected"');
153 }
154 $this->tpl->parseCurrentBlock();
155 }
156 }
157 }
158}
An exception for terminatinating execution or to throw for unit testing.
__construct($a_parent_obj, $rep_object)
Constructor.
$localCourseRoles
Holds the local roles of the course object.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static _getTranslation($a_role_title)
static _getInstance()
Get instance of ilPrivacySettings.
Class ilTable2GUI.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
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.
setFormName($a_formname="")
Set Form name.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
disable($a_module_name)
diesables particular modules of table
enable($a_module_name)
enables particular modules of table
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18