ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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{
22 protected function getMailMemberRoles()
23 {
24 return new ilMailMemberSessionRoles();
25 }
26
27
35 protected function checkRbacOrPositionAccessBool($a_rbac_perm, $a_pos_perm, $a_ref_id = 0)
36 {
37 if (!$a_ref_id) {
38 $a_ref_id = $this->getParentObject()->getRefId();
39 }
40 return $this->checkPermissionBool($a_rbac_perm, $a_ref_id);
41 }
42
43
44
48 protected function initParticipantTemplate()
49 {
50 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.sess_edit_members.html', 'Modules/Session');
51 }
52
57 protected function initWaitingList()
58 {
59 include_once './Modules/Session/classes/class.ilSessionWaitingList.php';
60 $wait = new ilSessionWaitingList($this->getParentObject()->getId());
61 return $wait;
62 }
63
67 protected function initParticipantTableGUI()
68 {
70 $this,
71 $this->getParentObject(),
72 'participants'
73 );
74 $table->init();
75 return $table;
76 }
77
81 protected function initSubscriberTable()
82 {
83 $subscriber = new ilSubscriberTableGUI($this, $this->getParentObject(), true, false);
84 $subscriber->setTitle($this->lng->txt('group_new_registrations'));
85 return $subscriber;
86 }
87
88
92 protected function updateMembers()
93 {
94 $this->checkPermission('manage_members');
95
96 $part = ilParticipants::getInstance($this->getParentObject()->getRefId());
97
98
99 $wait = new ilSessionWaitingList($this->getParentObject()->getId());
100 $waiting = $wait->getUserIds();
101
102 foreach ((array) $_REQUEST['visible_participants'] as $part_id) {
103 if (in_array($part_id, $waiting)) {
104 // so not update users on waiting list
105 continue;
106 }
107
108 $participated = (bool) $_POST['participated'][$part_id];
109 $registered = (bool) $_POST['registered'][$part_id];
110 $contact = (bool) $_POST['contact'][$part_id];
111
112 if ($part->isAssigned($part_id)) {
113 if (!$participated && !$registered && !$contact) {
114 $part->delete($part_id);
115 }
116 } else {
117 if ($participated || $registered || $contact) {
118 $part->add($part_id, IL_SESS_MEMBER);
119 }
120 }
121 $event_part = new ilEventParticipants($this->getParentObject()->getId());
122 $event_part->setUserId($part_id);
123 $event_part->setMark(ilUtil::stripSlashes($_POST['mark'][$part_id]));
124 $event_part->setComment(ilUtil::stripSlashes($_POST['comment'][$part_id]));
125 $event_part->setParticipated($participated);
126 $event_part->setRegistered($registered);
127 $event_part->setContact($contact);
128 $event_part->updateUser();
129 }
130
131 ilUtil::sendSuccess($this->getLanguage()->txt('settings_saved'), true);
132 $this->getCtrl()->redirect($this, 'participants');
133 }
134
135
139 protected function confirmDeleteParticipants()
140 {
141 $participants = (array) $_POST['participants'];
142
143 if (!count($participants)) {
144 ilUtil::sendFailure($this->lng->txt('no_checkbox'), true);
145 $this->ctrl->redirect($this, 'participants');
146 }
147
148 include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
149 $confirm = new ilConfirmationGUI();
150 $confirm->setFormAction($this->ctrl->getFormAction($this, 'confirmDeleteParticipants'));
151 $confirm->setHeaderText($this->lng->txt($this->getParentObject()->getType() . '_header_delete_members'));
152 $confirm->setConfirm($this->lng->txt('confirm'), 'deleteParticipants');
153 $confirm->setCancel($this->lng->txt('cancel'), 'participants');
154
155 foreach ($participants as $usr_id) {
156 $name = ilObjUser::_lookupName($usr_id);
157
158 $confirm->addItem(
159 'participants[]',
160 $name['user_id'],
161 $name['lastname'] . ', ' . $name['firstname'] . ' [' . $name['login'] . ']',
162 ilUtil::getImagePath('icon_usr.svg')
163 );
164 }
165
166 $this->tpl->setContent($confirm->getHTML());
167 }
168
177 protected function deleteParticipants()
178 {
179 $this->checkPermission('manage_members');
180
181 $participants = (array) $_POST['participants'];
182
183 if (!is_array($participants) or !count($participants)) {
184 ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
185 $this->ctrl->redirect($this, 'participants');
186 }
187
188 foreach ($participants as $part_id) {
189 // delete role assignment
190 $this->getMembersObject()->delete($part_id);
191 // delete further settings
192 $event_part = new ilEventParticipants($this->getParentObject()->getId());
193 $event_part->setUserId($part_id);
194 $event_part->setParticipated(false);
195 $event_part->setRegistered(false);
196 $event_part->setMark('');
197 $event_part->setComment('');
198 $event_part->updateUser();
199 }
200
201 ilUtil::sendSuccess($this->lng->txt($this->getParentObject()->getType() . "_members_deleted"), true);
202 $this->ctrl->redirect($this, "participants");
203
204 return true;
205 }
206
207
208
213 public function getPrintMemberData($a_members)
214 {
215 return $a_members;
216 }
217
218
222 protected function canAddOrSearchUsers()
223 {
224 return false;
225 }
226
227
228
234 public function getAttendanceListUserData($a_user_id, $a_filters)
235 {
236 $data = $this->getMembersObject()->getEventParticipants()->getUser($a_user_id);
237
238 if ($a_filters && $a_filters["registered"] && !$data["registered"]) {
239 return;
240 }
241
242 $data['registered'] = $data['registered'] ?
243 $this->lng->txt('yes') :
244 $this->lng->txt('no');
245 $data['participated'] = $data['participated'] ?
246 $this->lng->txt('yes') :
247 $this->lng->txt('no');
248
249 return $data;
250 }
251
256 protected function getMemberTabName()
257 {
258 return $this->lng->txt($this->getParentObject()->getType() . '_members');
259 }
260
261
262
266 protected function getMailContextOptions()
267 {
268 $context_options = [];
269
270 $context_options =
271 [
273 'ref_id' => $this->getParentObject()->getRefId(),
274 'ts' => time()
275 ];
276 return $context_options;
277 }
278}
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
const IL_SESS_MEMBER
Confirmation screen class.
const CONTEXT_KEY
Session parameter for the context.
Class ilMailMemberSessionRoles.
Base class for member tab content.
checkPermissionBool($a_permission, $a_cmd='', $a_type='', $a_ref_id=0)
Check permission.
checkPermission($a_permission, $a_cmd="")
Check permission If not granted redirect to parent gui.
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.
getMemberTabName()
Get member tab name.
getAttendanceListUserData($a_user_id, $a_filters)
Callback from attendance list.
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.
getMailContextOptions()
Get mail context options.array
deleteParticipants()
Delete participants @global type $rbacreview @global type $rbacsystem @global type $ilAccess @global ...
canAddOrSearchUsers()
Check if current user is allowed to add / search users.bool
GUI class for course/group subscriptions.
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($password)) $table
Definition: pwgen.php:24
$data
Definition: bench.php:6