ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilSessionMembershipGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5include_once './Services/Membership/classes/class.ilMembershipGUI.php';
6
18{
26 protected function checkRbacOrPositionAccessBool($a_rbac_perm, $a_pos_perm, $a_ref_id = 0)
27 {
28 if (!$a_ref_id) {
29 $a_ref_id = $this->getParentObject()->getRefId();
30 }
31 return $this->checkPermissionBool($a_rbac_perm, $a_ref_id);
32 }
33
34
35
39 protected function initParticipantTemplate()
40 {
41 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.sess_edit_members.html', 'Modules/Session');
42 }
43
48 protected function initWaitingList()
49 {
50 include_once './Modules/Session/classes/class.ilSessionWaitingList.php';
51 $wait = new ilSessionWaitingList($this->getParentObject()->getId());
52 return $wait;
53 }
54
58 protected function initParticipantTableGUI()
59 {
61 $this,
62 $this->getParentObject(),
63 'participants'
64 );
65 $table->init();
66 return $table;
67 }
68
72 protected function updateMembers()
73 {
74 $this->checkPermission('write');
75
76 $part = ilParticipants::getInstance($this->getParentObject()->getRefId());
77
78 foreach ((array) $_REQUEST['visible_participants'] as $part_id) {
79 $participated = (bool) $_POST['participated'][$part_id];
80 $registered = (bool) $_POST['registered'][$part_id];
81
82 $this->getLogger()->debug('Participated: ' . (int) $participated);
83 $this->getLogger()->debug('Registered: ' . (int) $registered);
84
85 if ($part->isAssigned($part_id)) {
86 if (!$participated && !$registered) {
87 $part->delete($part_id);
88 }
89 } else {
90 if ($participated || $registered) {
91 $part->add($part_id, IL_SESS_MEMBER);
92 }
93 }
94 $event_part = new ilEventParticipants($this->getParentObject()->getId());
95 $event_part->setUserId($part_id);
96 $event_part->setMark(ilUtil::stripSlashes($_POST['mark'][$part_id]));
97 $event_part->setComment(ilUtil::stripSlashes($_POST['comment'][$part_id]));
98 $event_part->setParticipated($participated);
99 $event_part->setRegistered($registered);
100 $event_part->updateUser();
101 }
102
103 ilUtil::sendSuccess($this->getLanguage()->txt('settings_saved'), true);
104 $this->getCtrl()->redirect($this, 'participants');
105 }
106
107
111 protected function confirmDeleteParticipants()
112 {
113 $participants = (array) $_POST['participants'];
114
115 if (!count($participants)) {
116 ilUtil::sendFailure($this->lng->txt('no_checkbox'), true);
117 $this->ctrl->redirect($this, 'participants');
118 }
119
120 include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
121 $confirm = new ilConfirmationGUI();
122 $confirm->setFormAction($this->ctrl->getFormAction($this, 'confirmDeleteParticipants'));
123 $confirm->setHeaderText($this->lng->txt($this->getParentObject()->getType() . '_header_delete_members'));
124 $confirm->setConfirm($this->lng->txt('confirm'), 'deleteParticipants');
125 $confirm->setCancel($this->lng->txt('cancel'), 'participants');
126
127 foreach ($participants as $usr_id) {
128 $name = ilObjUser::_lookupName($usr_id);
129
130 $confirm->addItem(
131 'participants[]',
132 $name['user_id'],
133 $name['lastname'] . ', ' . $name['firstname'] . ' [' . $name['login'] . ']',
134 ilUtil::getImagePath('icon_usr.svg')
135 );
136 }
137
138 $this->tpl->setContent($confirm->getHTML());
139 }
140
149 protected function deleteParticipants()
150 {
151 $this->checkPermission('write');
152
153 $participants = (array) $_POST['participants'];
154
155 if (!is_array($participants) or !count($participants)) {
156 ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
157 $this->ctrl->redirect($this, 'participants');
158 }
159
160 foreach ($participants as $part_id) {
161 // delete role assignment
162 $this->getMembersObject()->delete($part_id);
163 // delete further settings
164 $event_part = new ilEventParticipants($this->getParentObject()->getId());
165 $event_part->setUserId($part_id);
166 $event_part->setParticipated(false);
167 $event_part->setRegistered(false);
168 $event_part->setMark('');
169 $event_part->setComment('');
170 $event_part->updateUser();
171 }
172
173 ilUtil::sendSuccess($this->lng->txt($this->getParentObject()->getType() . "_members_deleted"), true);
174 $this->ctrl->redirect($this, "participants");
175
176 return true;
177 }
178
179
183 protected function showParticipantsToolbar()
184 {
185 $ilToolbar = $GLOBALS['DIC']->toolbar();
186 // print button
187
188 $ilToolbar->addButton(
189 $this->lng->txt($this->getParentObject()->getType() . "_print_list"),
190 $this->ctrl->getLinkTarget($this, 'printMembers')
191 );
192 }
193
197 protected function setSubTabs(ilTabsGUI $tabs)
198 {
199 }
200
205 public function getPrintMemberData($a_members)
206 {
207 return $a_members;
208 }
209
210
211
217 public function getAttendanceListUserData($a_user_id, $a_filters)
218 {
219 $data = $this->getMembersObject()->getEventParticipants()->getUser($a_user_id);
220
221 if ($a_filters && $a_filters["registered"] && !$data["registered"]) {
222 return;
223 }
224
225 $data['registered'] = $data['registered'] ?
226 $this->lng->txt('yes') :
227 $this->lng->txt('no');
228 $data['participated'] = $data['participated'] ?
229 $this->lng->txt('yes') :
230 $this->lng->txt('no');
231
232 return $data;
233 }
234
240 protected function checkPermission($a_permission, $a_cmd = "")
241 {
242 if ($a_permission == 'manage_members') {
243 $a_permission = 'write';
244 }
245 return parent::checkPermission($a_permission, $a_cmd);
246 }
247
248
252 protected function checkPermissionBool($a_permission, $a_cmd = '', $a_type = '', $a_ref_id = 0)
253 {
254 if ($a_permission == 'manage_members') {
255 $a_permission = 'write';
256 }
257 return parent::checkPermissionBool($a_permission, $a_cmd, $a_type, $a_ref_id);
258 }
259
264 protected function canAddOrSearchUsers()
265 {
266 return $this->checkPermissionBool('write');
267 }
268
269
273 protected function jump2UsersGallery()
274 {
275 return $this->participants();
276 }
277}
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
const IL_SESS_MEMBER
Confirmation screen class.
Base class for member tab content.
participants()
Show participant table, subscriber table, wating list table;.
getParentObject()
Get parent object.
getMembersObject()
Get member object.
static _lookupName($a_user_id)
lookup user name
static getInstance($a_ref_id)
Get instance by ref_id.
GUI class for membership features.
checkPermissionBool($a_permission, $a_cmd='', $a_type='', $a_ref_id=0)
Check permission.
checkPermission($a_permission, $a_cmd="")
Check permission has no manage members.
getAttendanceListUserData($a_user_id, $a_filters)
Callback from attendance list.
showParticipantsToolbar()
Show participants toolbar.
updateMembers()
update entries from member table
checkRbacOrPositionAccessBool($a_rbac_perm, $a_pos_perm, $a_ref_id=0)
No support for positions in sessions Check if rbac or position access is granted.
confirmDeleteParticipants()
Show confirmation screen for participants deletion.
initParticipantTemplate()
Init participant view template.
deleteParticipants()
Delete participants @global type $rbacreview @global type $rbacsystem @global type $ilAccess @global ...
setSubTabs(ilTabsGUI $tabs)
Set sub tabs.
jump2UsersGallery()
Workaround for unavailable gallery.
canAddOrSearchUsers()
Check if current user is allowed to add / search users.
Tabs GUI.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
if(!empty($this->data['faventry'])) $tabs
Definition: disco.tpl.php:124
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
if($format !==null) $name
Definition: metadata.php:146
if(empty($password)) $table
Definition: pwgen.php:24
$a_type
Definition: workflow.php:92