Base class for course and group participant.
More...
Base class for course and group participant.
- Author
- Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
- Version
- $Id$
Definition at line 26 of file class.ilParticipant.php.
◆ __construct()
ilParticipant::__construct |
( |
string |
$a_component_name, |
|
|
int |
$a_obj_id, |
|
|
int |
$a_usr_id |
|
) |
| |
|
protected |
Definition at line 57 of file class.ilParticipant.php.
References $DIC, ilObject\_getAllReferences(), ilObject\_lookupType(), readParticipant(), and readParticipantStatus().
61 $this->obj_id = $a_obj_id;
62 $this->usr_id = $a_usr_id;
65 $this->ref_id = current($ref_ids);
66 $this->component = $a_component_name;
69 $this->db = $DIC->database();
70 $this->rbacReview = $DIC->rbac()->review();
71 $this->rbacAdmin = $DIC->rbac()->admin();
72 $this->objectDataCache = $DIC[
'ilObjDataCache'];
73 $this->eventHandler = $DIC->event();
static _getAllReferences(int $id)
get all reference ids for object ID
static _lookupType(int $id, bool $reference=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
◆ add()
ilParticipant::add |
( |
int |
$a_usr_id, |
|
|
int |
$a_role |
|
) |
| |
Definition at line 336 of file class.ilParticipant.php.
References addRecommendation(), deleteSubscriber(), ilWaitingList\deleteUserEntry(), getComponent(), ilParticipants\IL_CRS_ADMIN, ilParticipants\IL_CRS_MEMBER, ilParticipants\IL_CRS_TUTOR, ilParticipants\IL_GRP_ADMIN, and ilParticipants\IL_GRP_MEMBER.
338 if ($this->rbacReview->isAssignedToAtLeastOneGivenRole($a_usr_id, $this->roles)) {
345 $this->admins =
true;
349 $this->tutors =
true;
354 $this->members =
true;
359 $this->rbacAdmin->assignUser($this->role_data[$a_role], $a_usr_id);
367 $this->eventHandler->raise(
371 'obj_id' => $this->obj_id,
372 'usr_id' => $a_usr_id,
getComponent()
Get component name Used for event handling.
addRecommendation($a_usr_id)
static deleteUserEntry(int $a_usr_id, int $a_obj_id)
deleteSubscriber(int $a_usr_id)
◆ addRecommendation()
ilParticipant::addRecommendation |
( |
|
$a_usr_id | ) |
|
◆ checkLastAdmin()
ilParticipant::checkLastAdmin |
( |
array |
$a_usr_ids | ) |
|
◆ delete()
ilParticipant::delete |
( |
int |
$a_usr_id | ) |
|
Definition at line 379 of file class.ilParticipant.php.
References $query, $res, and getComponent().
381 $this->recommended_content_manager->removeObjectRecommendation($a_usr_id, $this->ref_id);
382 foreach ($this->roles as $role_id) {
383 $this->rbacAdmin->deassignUser($role_id, $a_usr_id);
386 $query =
"DELETE FROM obj_members " .
387 "WHERE usr_id = " . $this->db->quote($a_usr_id,
'integer') .
" " .
388 "AND obj_id = " . $this->db->quote($this->obj_id,
'integer');
391 $this->eventHandler->raise(
395 'obj_id' => $this->obj_id,
396 'usr_id' => $a_usr_id
getComponent()
Get component name Used for event handling.
◆ deleteSubscriber()
ilParticipant::deleteSubscriber |
( |
int |
$a_usr_id | ) |
|
Definition at line 401 of file class.ilParticipant.php.
References $query, and $res.
Referenced by add().
403 $query =
"DELETE FROM il_subscribers " .
404 "WHERE usr_id = " . $this->db->quote($a_usr_id,
'integer') .
" " .
405 "AND obj_id = " . $this->db->quote($this->obj_id,
'integer') .
" ";
◆ getComponent()
ilParticipant::getComponent |
( |
| ) |
|
|
protected |
◆ getMembershipRoleType()
static ilParticipant::getMembershipRoleType |
( |
int |
$a_role_id | ) |
|
|
static |
Definition at line 154 of file class.ilParticipant.php.
References ilObject\_lookupTitle().
157 switch (substr($title, 0, 8)) {
160 return self::MEMBERSHIP_ADMIN;
163 return self::MEMBERSHIP_TUTOR;
167 return self::MEMBERSHIP_MEMBER;
static _lookupTitle(int $obj_id)
◆ getNumberOfMembers()
ilParticipant::getNumberOfMembers |
( |
| ) |
|
Definition at line 251 of file class.ilParticipant.php.
References $numMembers.
253 if ($this->numMembers === null) {
254 $this->numMembers = $this->rbacReview->getNumberOfAssignedUsers($this->member_roles);
◆ getUserId()
ilParticipant::getUserId |
( |
| ) |
|
◆ isAdmin()
ilParticipant::isAdmin |
( |
| ) |
|
◆ isAssigned()
ilParticipant::isAssigned |
( |
| ) |
|
◆ isBlocked()
ilParticipant::isBlocked |
( |
| ) |
|
◆ isContact()
ilParticipant::isContact |
( |
| ) |
|
◆ isMember()
ilParticipant::isMember |
( |
| ) |
|
◆ isParticipant()
ilParticipant::isParticipant |
( |
| ) |
|
◆ isTutor()
ilParticipant::isTutor |
( |
| ) |
|
◆ lookupStatusByMembershipRoleType()
static ilParticipant::lookupStatusByMembershipRoleType |
( |
int |
$a_obj_id, |
|
|
int |
$a_usr_id, |
|
|
int |
$a_membership_role_type |
|
) |
| |
|
static |
◆ readParticipant()
ilParticipant::readParticipant |
( |
| ) |
|
|
protected |
Definition at line 259 of file class.ilParticipant.php.
References ilParticipants\IL_CRS_ADMIN, ilParticipants\IL_CRS_MEMBER, ilParticipants\IL_CRS_TUTOR, ilParticipants\IL_GRP_ADMIN, and ilParticipants\IL_GRP_MEMBER.
Referenced by __construct().
261 $this->roles = $this->rbacReview->getRolesOfRoleFolder($this->ref_id,
false);
262 $this->member_roles = [];
263 foreach ($this->roles as $role_id) {
264 $title = $this->objectDataCache->lookupTitle($role_id);
265 switch (substr($title, 0, 8)) {
267 $this->member_roles[] = $role_id;
269 if ($this->rbacReview->isAssigned($this->getUserId(), $role_id)) {
270 $this->participants =
true;
271 $this->members =
true;
277 if ($this->rbacReview->isAssigned($this->getUserId(), $role_id)) {
278 $this->participants =
true;
279 $this->admins =
true;
285 if ($this->rbacReview->isAssigned($this->getUserId(), $role_id)) {
286 $this->participants =
true;
287 $this->tutors =
true;
293 if ($this->rbacReview->isAssigned($this->getUserId(), $role_id)) {
294 $this->participants =
true;
295 $this->admins =
true;
300 $this->member_roles[] = $role_id;
302 if ($this->rbacReview->isAssigned($this->getUserId(), $role_id)) {
303 $this->participants =
true;
304 $this->members =
true;
310 $this->member_roles[] = $role_id;
311 if ($this->rbacReview->isAssigned($this->getUserId(), $role_id)) {
312 $this->participants =
true;
313 $this->members =
true;
◆ readParticipantStatus()
ilParticipant::readParticipantStatus |
( |
| ) |
|
|
protected |
Definition at line 320 of file class.ilParticipant.php.
References $query, $res, ilDBConstants\FETCHMODE_OBJECT, and getUserId().
Referenced by __construct().
322 $query =
"SELECT * FROM obj_members " .
323 "WHERE obj_id = " . $this->db->quote($this->obj_id,
'integer') .
" " .
324 'AND usr_id = ' . $this->db->quote($this->
getUserId(),
'integer');
327 $this->participants_status = array();
329 $this->participants_status[$this->
getUserId()][
'blocked'] = (bool) $row->blocked;
330 $this->participants_status[$this->getUserId()][
'notification'] = (bool) $row->notification;
331 $this->participants_status[$this->getUserId()][
'passed'] = (bool) $row->passed;
332 $this->participants_status[$this->getUserId()][
'contact'] = (bool) $row->contact;
◆ updateContact()
ilParticipant::updateContact |
( |
int |
$a_usr_id, |
|
|
bool |
$a_contact |
|
) |
| |
Definition at line 416 of file class.ilParticipant.php.
418 $this->db->manipulate(
419 'UPDATE obj_members SET ' .
420 'contact = ' . $this->db->quote($a_contact,
'integer') .
' ' .
421 'WHERE obj_id = ' . $this->db->quote($this->obj_id,
'integer') .
' ' .
422 'AND usr_id = ' . $this->db->quote($a_usr_id,
'integer')
424 $this->participants_status[$a_usr_id][
'contact'] = $a_contact;
◆ updateMemberRoles()
static ilParticipant::updateMemberRoles |
( |
int |
$a_obj_id, |
|
|
int |
$a_usr_id, |
|
|
int |
$a_role_id, |
|
|
int |
$a_status |
|
) |
| |
|
static |
Definition at line 79 of file class.ilParticipant.php.
References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.
Referenced by ilGroupAppEventListener\handleUserAssignments(), and ilCourseAppEventListener\handleUserAssignments().
83 $ilDB = $DIC->database();
85 $a_membership_role_type = self::getMembershipRoleType($a_role_id);
86 switch ($a_membership_role_type) {
87 case self::MEMBERSHIP_ADMIN:
88 $update_fields = array(
'admin' => array(
'integer', $a_status ? 1 : 0));
89 $update_string = (
'admin = ' .
$ilDB->quote($a_status ? 1 : 0,
'integer'));
92 case self::MEMBERSHIP_TUTOR:
93 $update_fields = array(
'tutor' => array(
'integer', $a_status ? 1 : 0));
94 $update_string = (
'tutor = ' .
$ilDB->quote($a_status ? 1 : 0,
'integer'));
97 case self::MEMBERSHIP_MEMBER:
99 $current_status = self::lookupStatusByMembershipRoleType($a_obj_id, $a_usr_id, $a_membership_role_type);
102 $new_status = $current_status + 1;
105 $new_status = $current_status - 1;
106 if ($new_status < 0) {
111 $update_fields = array(
'member' => array(
'integer', $new_status));
112 $update_string = (
'member = ' .
$ilDB->quote($new_status,
'integer'));
116 $query =
'SELECT count(*) num FROM obj_members ' .
117 'WHERE obj_id = ' .
$ilDB->quote($a_obj_id,
'integer') .
' ' .
118 'AND usr_id = ' .
$ilDB->quote($a_usr_id,
'integer');
131 'obj_id' => array(
'integer', $a_obj_id),
132 'usr_id' => array(
'integer', $a_usr_id)
137 $query =
'UPDATE obj_members SET ' .
138 $update_string .
' ' .
139 'WHERE obj_id = ' .
$ilDB->quote($a_obj_id,
'integer') .
' ' .
140 'AND usr_id = ' .
$ilDB->quote($a_usr_id,
'integer');
145 $query =
'DELETE from obj_members ' .
146 'WHERE obj_id = ' .
$ilDB->quote($a_obj_id,
'integer') .
' ' .
147 'AND usr_id = ' .
$ilDB->quote($a_usr_id,
'integer') .
' ' .
148 'AND admin = ' .
$ilDB->quote(0,
'integer') .
' ' .
149 'AND tutor = ' .
$ilDB->quote(0,
'integer') .
' ' .
150 'AND member = ' .
$ilDB->quote(0,
'integer');
◆ updateNotification()
ilParticipant::updateNotification |
( |
int |
$a_usr_id, |
|
|
bool |
$a_notification |
|
) |
| |
Definition at line 427 of file class.ilParticipant.php.
References $query, and $res.
429 $this->participants_status[$a_usr_id][
'notification'] = $a_notification;
431 $query =
"SELECT * FROM obj_members " .
432 "WHERE obj_id = " . $this->db->quote($this->obj_id,
'integer') .
" " .
433 "AND usr_id = " . $this->db->quote($a_usr_id,
'integer');
435 if (
$res->numRows()) {
436 $query =
"UPDATE obj_members SET " .
437 "notification = " . $this->db->quote((
int) $a_notification,
'integer') .
" " .
438 "WHERE obj_id = " . $this->db->quote($this->obj_id,
'integer') .
" " .
439 "AND usr_id = " . $this->db->quote($a_usr_id,
'integer');
441 $query =
"INSERT INTO obj_members (notification,obj_id,usr_id,passed,blocked) " .
443 $this->db->quote((
int) $a_notification,
'integer') .
", " .
444 $this->db->quote($this->obj_id,
'integer') .
", " .
445 $this->db->quote($a_usr_id,
'integer') .
", " .
446 $this->db->quote(0,
'integer') .
", " .
447 $this->db->quote(0,
'integer') .
448 ") ON DUPLICATE KEY UPDATE notification = VALUES(notification)";
450 $this->db->manipulate(
$query);
◆ $admins
bool ilParticipant::$admins = false |
|
private |
◆ $component
string ilParticipant::$component = '' |
|
private |
◆ $db
◆ $eventHandler
◆ $member_roles
array ilParticipant::$member_roles = [] |
|
private |
◆ $members
bool ilParticipant::$members = false |
|
private |
◆ $numMembers
int ilParticipant::$numMembers = null |
|
private |
◆ $obj_id
int ilParticipant::$obj_id = 0 |
|
private |
◆ $objectDataCache
◆ $participants
bool ilParticipant::$participants = false |
|
private |
◆ $participants_status
array ilParticipant::$participants_status = array() |
|
private |
◆ $rbacAdmin
◆ $rbacReview
◆ $recommended_content_manager
◆ $ref_id
int ilParticipant::$ref_id = 0 |
|
private |
◆ $role_data
array ilParticipant::$role_data = [] |
|
private |
◆ $roles
array ilParticipant::$roles = [] |
|
private |
◆ $tutors
bool ilParticipant::$tutors = false |
|
private |
◆ $type
string ilParticipant::$type = '' |
|
protected |
◆ $usr_id
int ilParticipant::$usr_id = 0 |
|
private |
◆ MEMBERSHIP_ADMIN
const ilParticipant::MEMBERSHIP_ADMIN = 1 |
|
protected |
◆ MEMBERSHIP_MEMBER
const ilParticipant::MEMBERSHIP_MEMBER = 3 |
|
protected |
◆ MEMBERSHIP_TUTOR
const ilParticipant::MEMBERSHIP_TUTOR = 2 |
|
protected |
The documentation for this class was generated from the following file: