ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilParticipant Class Reference

Base class for course and group participant. More...

+ Inheritance diagram for ilParticipant:
+ Collaboration diagram for ilParticipant:

Public Member Functions

 getUserId ()
 get user id More...
 
 isBlocked ()
 
 isContact ()
 Check if user is contact for current object. More...
 
 isAssigned ()
 
 isMember ()
 
 isAdmin ()
 
 isTutor ()
 
 isParticipant ()
 
 getNumberOfMembers ()
 
 add ($a_usr_id, $a_role)
 Add user to course/group. More...
 
 delete ($a_usr_id)
 Drop user from all roles. More...
 
 deleteSubscriber ($a_usr_id)
 Delete subsciber. More...
 
 addDesktopItem ($a_usr_id)
 Add desktop item. More...
 
 dropDesktopItem ($a_usr_id)
 Drop desktop item. More...
 
 updateContact ($a_usr_id, $a_contact)
 ilDB $ilDB More...
 
 updateNotification ($a_usr_id, $a_notification)
 Update notification status. More...
 
 checkLastAdmin ($a_usr_ids)
 Check if user for deletion are last admins. More...
 

Static Public Member Functions

static updateMemberRoles ($a_obj_id, $a_usr_id, $a_role_id, $a_status)
 Update member roles ilDB $ilDB. More...
 
static getMembershipRoleType ($a_role_id)
 
static lookupStatusByMembershipRoleType ($a_obj_id, $a_usr_id, $a_membership_role_type)
 lookup assignment status ilDB $ilDB More...
 

Data Fields

const MEMBERSHIP_ADMIN = 1
 
const MEMBERSHIP_TUTOR = 2
 
const MEMBERSHIP_MEMBER = 3
 

Protected Member Functions

 __construct ($a_component_name, $a_obj_id, $a_usr_id)
 Singleton Constructor. More...
 
 getComponent ()
 Get component name Used for event handling. More...
 
 readParticipant ()
 Read participant. More...
 
 readParticipantStatus ()
 Read participant status ilDB $ilDB. More...
 

Protected Attributes

 $type = ''
 

Private Attributes

 $obj_id = 0
 
 $usr_id = 0
 
 $ref_id = 0
 
 $component = ''
 
 $participants = false
 
 $admins = false
 
 $tutors = false
 
 $members = false
 
 $numMembers = null
 
 $member_roles = []
 
 $participants_status = array()
 

Detailed Description

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 34 of file class.ilParticipant.php.

Constructor & Destructor Documentation

◆ __construct()

ilParticipant::__construct (   $a_component_name,
  $a_obj_id,
  $a_usr_id 
)
protected

Singleton Constructor.

protected

Parameters
intobj_id of container

Definition at line 65 of file class.ilParticipant.php.

References $DIC, $ilDB, $lng, ilObject\_getAllReferences(), ilObject\_lookupType(), readParticipant(), and readParticipantStatus().

66  {
67  global $DIC;
68 
69  $ilDB = $DIC['ilDB'];
70  $lng = $DIC['lng'];
71 
72  $this->obj_id = $a_obj_id;
73  $this->usr_id = $a_usr_id;
74  $this->type = ilObject::_lookupType($a_obj_id);
75  $ref_ids = ilObject::_getAllReferences($this->obj_id);
76  $this->ref_id = current($ref_ids);
77 
78  $this->component = $a_component_name;
79 
80  $this->readParticipant();
81  $this->readParticipantStatus();
82  }
global $DIC
Definition: saml.php:7
readParticipantStatus()
Read participant status ilDB $ilDB.
static _getAllReferences($a_id)
get all reference ids of object
$lng
static _lookupType($a_id, $a_reference=false)
lookup object type
readParticipant()
Read participant.
global $ilDB
+ Here is the call graph for this function:

Member Function Documentation

◆ add()

ilParticipant::add (   $a_usr_id,
  $a_role 
)

Add user to course/group.

public

Parameters
intuser id
introle IL_CRS_ADMIN || IL_CRS_TUTOR || IL_CRS_MEMBER

global ilRbacReview $rbacreview

Definition at line 407 of file class.ilParticipant.php.

References $DIC, $ilLog, addDesktopItem(), deleteSubscriber(), ilWaitingList\deleteUserEntry(), getComponent(), IL_CRS_ADMIN, IL_CRS_MEMBER, IL_CRS_TUTOR, IL_GRP_ADMIN, and IL_GRP_MEMBER.

408  {
409  global $DIC;
410 
411  $rbacadmin = $DIC['rbacadmin'];
412  $ilLog = $DIC->logger()->mmbr();
413  $ilAppEventHandler = $DIC['ilAppEventHandler'];
414  $rbacreview = $DIC['rbacreview'];
415 
416 
417  if ($rbacreview->isAssignedToAtLeastOneGivenRole($a_usr_id, $this->roles)) {
418  return false;
419  }
420 
421  switch ($a_role) {
422  case IL_CRS_ADMIN:
423  $this->admins = true;
424  break;
425 
426  case IL_CRS_TUTOR:
427  $this->tutors = true;
428  break;
429 
430  case IL_CRS_MEMBER:
431  $this->members = true;
432  break;
433 
434  case IL_GRP_ADMIN:
435  $this->admins = true;
436  break;
437 
438  case IL_GRP_MEMBER:
439  $this->members = true;
440  break;
441  }
442 
443  $rbacadmin->assignUser($this->role_data[$a_role], $a_usr_id);
444  $this->addDesktopItem($a_usr_id);
445 
446  // Delete subscription request
447  $this->deleteSubscriber($a_usr_id);
448 
449  include_once './Services/Membership/classes/class.ilWaitingList.php';
450  ilWaitingList::deleteUserEntry($a_usr_id, $this->obj_id);
451 
452  $ilLog->debug(': Raise new event: ' . $this->getComponent() . ' addParticipant');
453  $ilAppEventHandler->raise(
454  $this->getComponent(),
455  "addParticipant",
456  array(
457  'obj_id' => $this->obj_id,
458  'usr_id' => $a_usr_id,
459  'role_id' => $a_role)
460  );
461  return true;
462  }
global $DIC
Definition: saml.php:7
const IL_GRP_ADMIN
const IL_CRS_TUTOR
deleteSubscriber($a_usr_id)
Delete subsciber.
const IL_GRP_MEMBER
getComponent()
Get component name Used for event handling.
const IL_CRS_MEMBER
const IL_CRS_ADMIN
Base class for course and group participants.
addDesktopItem($a_usr_id)
Add desktop item.
static deleteUserEntry($a_usr_id, $a_obj_id)
Delete one user entry.
+ Here is the call graph for this function:

◆ addDesktopItem()

ilParticipant::addDesktopItem (   $a_usr_id)

Add desktop item.

public

Parameters
intusr_id

Definition at line 525 of file class.ilParticipant.php.

References ilObjUser\_addDesktopItem(), and ilObjUser\_isDesktopItem().

Referenced by add().

526  {
527  if (!ilObjUser::_isDesktopItem($a_usr_id, $this->ref_id, $this->type)) {
528  ilObjUser::_addDesktopItem($a_usr_id, $this->ref_id, $this->type);
529  }
530  return true;
531  }
static _addDesktopItem($a_usr_id, $a_item_id, $a_type, $a_par="")
add an item to user's personal desktop
static _isDesktopItem($a_usr_id, $a_item_id, $a_type)
check wether an item is on the users desktop or not
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkLastAdmin()

ilParticipant::checkLastAdmin (   $a_usr_ids)

Check if user for deletion are last admins.

public

Parameters
arrayarray of user ids for deletion

Definition at line 621 of file class.ilParticipant.php.

References $data, $DIC, $ilDB, $query, $res, IL_CRS_ADMIN, and IL_GRP_ADMIN.

622  {
623  global $DIC;
624 
625  $ilDB = $DIC['ilDB'];
626 
627  $admin_role_id =
628  $this->type == 'crs' ?
629  $this->role_data[IL_CRS_ADMIN] :
630  $this->role_data[IL_GRP_ADMIN];
631 
632 
633  $query = "
634  SELECT COUNT(rolesusers.usr_id) cnt
635 
636  FROM object_data rdata
637 
638  LEFT JOIN rbac_ua rolesusers
639  ON rolesusers.rol_id = rdata.obj_id
640 
641  WHERE rdata.obj_id = %s
642  ";
643 
644  $query .= ' AND ' . $ilDB->in('rolesusers.usr_id', $a_usr_ids, true, 'integer');
645  $res = $ilDB->queryF($query, array('integer'), array($admin_role_id));
646 
647  $data = $ilDB->fetchAssoc($res);
648 
649  return (int) $data['cnt'] > 0;
650  }
global $DIC
Definition: saml.php:7
const IL_GRP_ADMIN
foreach($_POST as $key=> $value) $res
const IL_CRS_ADMIN
Base class for course and group participants.
$query
global $ilDB
$data
Definition: bench.php:6

◆ delete()

ilParticipant::delete (   $a_usr_id)

Drop user from all roles.

public

Parameters
intusr_id

Definition at line 471 of file class.ilParticipant.php.

References $DIC, $ilDB, $query, $res, dropDesktopItem(), and getComponent().

472  {
473  global $DIC;
474 
475  $rbacadmin = $DIC['rbacadmin'];
476  $ilDB = $DIC['ilDB'];
477  $ilAppEventHandler = $DIC['ilAppEventHandler'];
478 
479  $this->dropDesktopItem($a_usr_id);
480  foreach ($this->roles as $role_id) {
481  $rbacadmin->deassignUser($role_id, $a_usr_id);
482  }
483 
484  $query = "DELETE FROM obj_members " .
485  "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
486  "AND obj_id = " . $ilDB->quote($this->obj_id, 'integer');
487  $res = $ilDB->manipulate($query);
488 
489  $ilAppEventHandler->raise(
490  $this->getComponent(),
491  "deleteParticipant",
492  array(
493  'obj_id' => $this->obj_id,
494  'usr_id' => $a_usr_id)
495  );
496  return true;
497  }
global $DIC
Definition: saml.php:7
getComponent()
Get component name Used for event handling.
foreach($_POST as $key=> $value) $res
dropDesktopItem($a_usr_id)
Drop desktop item.
$query
global $ilDB
+ Here is the call graph for this function:

◆ deleteSubscriber()

ilParticipant::deleteSubscriber (   $a_usr_id)

Delete subsciber.

public

Definition at line 504 of file class.ilParticipant.php.

References $DIC, $ilDB, $query, and $res.

Referenced by add().

505  {
506  global $DIC;
507 
508  $ilDB = $DIC['ilDB'];
509 
510  $query = "DELETE FROM il_subscribers " .
511  "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
512  "AND obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " ";
513  $res = $ilDB->manipulate($query);
514 
515  return true;
516  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the caller graph for this function:

◆ dropDesktopItem()

ilParticipant::dropDesktopItem (   $a_usr_id)

Drop desktop item.

public

Parameters
intusr_id

Definition at line 540 of file class.ilParticipant.php.

References ilObjUser\_dropDesktopItem(), and ilObjUser\_isDesktopItem().

Referenced by delete().

541  {
542  if (ilObjUser::_isDesktopItem($a_usr_id, $this->ref_id, $this->type)) {
543  ilObjUser::_dropDesktopItem($a_usr_id, $this->ref_id, $this->type);
544  }
545 
546  return true;
547  }
static _dropDesktopItem($a_usr_id, $a_item_id, $a_type)
drop an item from user's personal desktop
static _isDesktopItem($a_usr_id, $a_item_id, $a_type)
check wether an item is on the users desktop or not
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getComponent()

ilParticipant::getComponent ( )
protected

Get component name Used for event handling.

Returns
type

Definition at line 228 of file class.ilParticipant.php.

References $component.

Referenced by add(), and delete().

229  {
230  return $this->component;
231  }
+ Here is the caller graph for this function:

◆ getMembershipRoleType()

static ilParticipant::getMembershipRoleType (   $a_role_id)
static
Parameters
type$a_role_id

Definition at line 171 of file class.ilParticipant.php.

References $title, and ilObject\_lookupTitle().

172  {
173  $title = ilObject::_lookupTitle($a_role_id);
174  switch (substr($title, 0, 8)) {
175  case 'il_crs_a':
176  case 'il_grp_a':
177  return self::MEMBERSHIP_ADMIN;
178 
179  case 'il_crs_t':
180  return self::MEMBERSHIP_TUTOR;
181 
182  case 'il_crs_m':
183  default:
184  return self::MEMBERSHIP_MEMBER;
185 
186  }
187  }
static _lookupTitle($a_id)
lookup object title
+ Here is the call graph for this function:

◆ getNumberOfMembers()

ilParticipant::getNumberOfMembers ( )

Definition at line 283 of file class.ilParticipant.php.

References $DIC, and $numMembers.

284  {
285  global $DIC;
286 
287  $rbacreview = $DIC['rbacreview'];
288 
289  if ($this->numMembers === null) {
290  $this->numMembers = $rbacreview->getNumberOfAssignedUsers($this->member_roles);
291  }
292  return $this->numMembers;
293  }
global $DIC
Definition: saml.php:7

◆ getUserId()

ilParticipant::getUserId ( )

get user id

Returns
int

Definition at line 237 of file class.ilParticipant.php.

References $usr_id.

Referenced by isBlocked(), isContact(), and readParticipantStatus().

238  {
239  return $this->usr_id;
240  }
+ Here is the caller graph for this function:

◆ isAdmin()

ilParticipant::isAdmin ( )

Definition at line 268 of file class.ilParticipant.php.

References $admins.

269  {
270  return $this->admins;
271  }

◆ isAssigned()

ilParticipant::isAssigned ( )

Definition at line 258 of file class.ilParticipant.php.

References $participants.

259  {
260  return (bool) $this->participants;
261  }

◆ isBlocked()

ilParticipant::isBlocked ( )

Definition at line 242 of file class.ilParticipant.php.

References getUserId().

243  {
244  return (bool) $this->participants_status[$this->getUserId()]['blocked'];
245  }
getUserId()
get user id
+ Here is the call graph for this function:

◆ isContact()

ilParticipant::isContact ( )

Check if user is contact for current object.

Returns
bool

Definition at line 252 of file class.ilParticipant.php.

References getUserId().

253  {
254  return (bool) $this->participants_status[$this->getUserId()]['contact'];
255  }
getUserId()
get user id
+ Here is the call graph for this function:

◆ isMember()

ilParticipant::isMember ( )

Definition at line 263 of file class.ilParticipant.php.

References $members.

264  {
265  return (bool) $this->members;
266  }

◆ isParticipant()

ilParticipant::isParticipant ( )

Definition at line 278 of file class.ilParticipant.php.

References $participants.

279  {
280  return (bool) $this->participants;
281  }

◆ isTutor()

ilParticipant::isTutor ( )

Definition at line 273 of file class.ilParticipant.php.

References $tutors.

274  {
275  return (bool) $this->tutors;
276  }

◆ lookupStatusByMembershipRoleType()

static ilParticipant::lookupStatusByMembershipRoleType (   $a_obj_id,
  $a_usr_id,
  $a_membership_role_type 
)
static

lookup assignment status ilDB $ilDB

Parameters
type$a_obj_id
type$a_usr_id
type$a_membership_role_type
Returns
int

Definition at line 197 of file class.ilParticipant.php.

References $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

198  {
199  global $DIC;
200 
201  $ilDB = $DIC['ilDB'];
202 
203  $query = 'SELECT * FROM obj_members ' .
204  'WHERE obj_id = ' . $ilDB->quote($a_obj_id, 'integer') . ' ' .
205  'AND usr_id = ' . $ilDB->quote($a_usr_id) . ' ';
206  $res = $ilDB->query($query);
207  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
208  switch ($a_membership_role_type) {
209  case self::MEMBERSHIP_ADMIN:
210  return $row->admin;
211 
212  case self::MEMBERSHIP_TUTOR:
213  return $row->tutor;
214 
215  case self::MEMBERSHIP_MEMBER:
216  return $row->member;
217  }
218  }
219  return 0;
220  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB

◆ readParticipant()

ilParticipant::readParticipant ( )
protected

Read participant.

Returns
void

Definition at line 300 of file class.ilParticipant.php.

References $DIC, $title, $users, IL_CRS_ADMIN, IL_CRS_MEMBER, IL_CRS_TUTOR, IL_GRP_ADMIN, and IL_GRP_MEMBER.

Referenced by __construct().

301  {
302  global $DIC;
303 
304  $rbacreview = $DIC['rbacreview'];
305  $ilObjDataCache = $DIC['ilObjDataCache'];
306 
307  $this->roles = $rbacreview->getRolesOfRoleFolder($this->ref_id, false);
308 
309  $users = array();
310  $this->participants = array();
311  $this->members = $this->admins = $this->tutors = array();
312  $this->member_roles = [];
313 
314  foreach ($this->roles as $role_id) {
315  $title = $ilObjDataCache->lookupTitle($role_id);
316  switch (substr($title, 0, 8)) {
317  case 'il_crs_m':
318  $this->member_roles[] = $role_id;
319  $this->role_data[IL_CRS_MEMBER] = $role_id;
320  if ($rbacreview->isAssigned($this->getUserId(), $role_id)) {
321  $this->participants = true;
322  $this->members = true;
323  }
324  break;
325 
326  case 'il_crs_a':
327  $this->role_data[IL_CRS_ADMIN] = $role_id;
328  if ($rbacreview->isAssigned($this->getUserId(), $role_id)) {
329  $this->participants = true;
330  $this->admins = true;
331  }
332  break;
333 
334  case 'il_crs_t':
335  $this->role_data[IL_CRS_TUTOR] = $role_id;
336  if ($rbacreview->isAssigned($this->getUserId(), $role_id)) {
337  $this->participants = true;
338  $this->tutors = true;
339  }
340  break;
341 
342  case 'il_grp_a':
343  $this->role_data[IL_GRP_ADMIN] = $role_id;
344  if ($rbacreview->isAssigned($this->getUserId(), $role_id)) {
345  $this->participants = true;
346  $this->admins = true;
347  }
348  break;
349 
350  case 'il_grp_m':
351  $this->member_roles[] = $role_id;
352  $this->role_data[IL_GRP_MEMBER] = $role_id;
353  if ($rbacreview->isAssigned($this->getUserId(), $role_id)) {
354  $this->participants = true;
355  $this->members = true;
356  }
357  break;
358 
359  default:
360 
361  $this->member_roles[] = $role_id;
362  if ($rbacreview->isAssigned($this->getUserId(), $role_id)) {
363  $this->participants = true;
364  $this->members = true;
365  }
366  break;
367  }
368  }
369  }
global $DIC
Definition: saml.php:7
const IL_GRP_ADMIN
const IL_CRS_TUTOR
const IL_GRP_MEMBER
const IL_CRS_MEMBER
const IL_CRS_ADMIN
Base class for course and group participants.
$users
Definition: authpage.php:44
+ Here is the caller graph for this function:

◆ readParticipantStatus()

ilParticipant::readParticipantStatus ( )
protected

Read participant status ilDB $ilDB.

Definition at line 375 of file class.ilParticipant.php.

References $DIC, $ilDB, $query, $res, $row, ilDBConstants\FETCHMODE_OBJECT, and getUserId().

Referenced by __construct().

376  {
377  global $DIC;
378 
379  $ilDB = $DIC['ilDB'];
380 
381  $query = "SELECT * FROM obj_members " .
382  "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
383  'AND usr_id = ' . $ilDB->quote($this->getUserId(), 'integer');
384 
385  $res = $ilDB->query($query);
386  $this->participants_status = array();
387  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
388  $this->participants_status[$this->getUserId()]['blocked'] = $row->blocked;
389  $this->participants_status[$this->getUserId()]['notification'] = $row->notification;
390  $this->participants_status[$this->getUserId()]['passed'] = $row->passed;
391  // cognos-blu-patch: begin
392  $this->participants_status[$this->getUserId()]['contact'] = $row->contact;
393  // cognos-blu-patch: end
394  }
395  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB
getUserId()
get user id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateContact()

ilParticipant::updateContact (   $a_usr_id,
  $a_contact 
)

ilDB $ilDB

Parameters
type$a_usr_id
type$a_contact
Returns
boolean

Definition at line 557 of file class.ilParticipant.php.

References $DIC, and $ilDB.

558  {
559  global $DIC;
560 
561  $ilDB = $DIC['ilDB'];
562 
563  $ilDB->manipulate(
564  'UPDATE obj_members SET ' .
565  'contact = ' . $ilDB->quote($a_contact, 'integer') . ' ' .
566  'WHERE obj_id = ' . $ilDB->quote($this->obj_id, 'integer') . ' ' .
567  'AND usr_id = ' . $ilDB->quote($a_usr_id, 'integer')
568  );
569 
570  $this->participants_status[$a_usr_id]['contact'] = $a_contact;
571  return true;
572  }
global $DIC
Definition: saml.php:7
global $ilDB

◆ updateMemberRoles()

static ilParticipant::updateMemberRoles (   $a_obj_id,
  $a_usr_id,
  $a_role_id,
  $a_status 
)
static

Update member roles ilDB $ilDB.

Parameters
type$a_obj_id
type$a_role_id
type$a_status

Definition at line 91 of file class.ilParticipant.php.

References $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilGroupAppEventListener\handleUserAssignments(), and ilCourseAppEventListener\handleUserAssignments().

92  {
93  global $DIC;
94 
95  $ilDB = $DIC['ilDB'];
96 
97  $a_membership_role_type = self::getMembershipRoleType($a_role_id);
98 
99  switch ($a_membership_role_type) {
100  case self::MEMBERSHIP_ADMIN:
101  $update_fields = array('admin' => array('integer', $a_status ? 1 : 0));
102  $update_string = ('admin = ' . $ilDB->quote($a_status ? 1 : 0, 'integer'));
103  break;
104 
105  case self::MEMBERSHIP_TUTOR:
106  $update_fields = array('tutor' => array('integer', $a_status ? 1 : 0));
107  $update_string = ('tutor = ' . $ilDB->quote($a_status ? 1 : 0, 'integer'));
108  break;
109 
110  case self::MEMBERSHIP_MEMBER:
111  default:
112  $current_status = self::lookupStatusByMembershipRoleType($a_obj_id, $a_usr_id, $a_membership_role_type);
113 
114  if ($a_status) {
115  $new_status = $current_status + 1;
116  }
117  if (!$a_status) {
118  $new_status = $current_status - 1;
119  if ($new_status < 0) {
120  $new_status = 0;
121  }
122  }
123 
124  $update_fields = array('member' => array('integer', $new_status));
125  $update_string = ('member = ' . $ilDB->quote($new_status, 'integer'));
126  break;
127  }
128 
129  $query = 'SELECT count(*) num FROM obj_members ' .
130  'WHERE obj_id = ' . $ilDB->quote($a_obj_id, 'integer') . ' ' .
131  'AND usr_id = ' . $ilDB->quote($a_usr_id, 'integer');
132  $res = $ilDB->query($query);
133 
134  $found = false;
135  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
136  if ($row->num) {
137  $found = true;
138  }
139  }
140  if (!$found) {
141  $ilDB->replace(
142  'obj_members',
143  array(
144  'obj_id' => array('integer',$a_obj_id),
145  'usr_id' => array('integer',$a_usr_id)
146  ),
147  $update_fields
148  );
149  } else {
150  $query = 'UPDATE obj_members SET ' .
151  $update_string . ' ' .
152  'WHERE obj_id = ' . $ilDB->quote($a_obj_id, 'integer') . ' ' .
153  'AND usr_id = ' . $ilDB->quote($a_usr_id, 'integer');
154 
155  $ilDB->manipulate($query);
156  }
157 
158  $query = 'DELETE from obj_members ' .
159  'WHERE obj_id = ' . $ilDB->quote($a_obj_id, 'integer') . ' ' .
160  'AND usr_id = ' . $ilDB->quote($a_usr_id, 'integer') . ' ' .
161  'AND admin = ' . $ilDB->quote(0, 'integer') . ' ' .
162  'AND tutor = ' . $ilDB->quote(0, 'integer') . ' ' .
163  'AND member = ' . $ilDB->quote(0, 'integer');
164  $ilDB->manipulate($query);
165  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB
+ Here is the caller graph for this function:

◆ updateNotification()

ilParticipant::updateNotification (   $a_usr_id,
  $a_notification 
)

Update notification status.

public

Parameters
intusr_id
boolpassed

Definition at line 583 of file class.ilParticipant.php.

References $DIC, $ilDB, $query, and $res.

584  {
585  global $DIC;
586 
587  $ilDB = $DIC['ilDB'];
588 
589  $this->participants_status[$a_usr_id]['notification'] = (int) $a_notification;
590 
591  $query = "SELECT * FROM obj_members " .
592  "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
593  "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer');
594  $res = $ilDB->query($query);
595  if ($res->numRows()) {
596  $query = "UPDATE obj_members SET " .
597  "notification = " . $ilDB->quote((int) $a_notification, 'integer') . " " .
598  "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
599  "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer');
600  } else {
601  $query = "INSERT INTO obj_members (notification,obj_id,usr_id,passed,blocked) " .
602  "VALUES ( " .
603  $ilDB->quote((int) $a_notification, 'integer') . ", " .
604  $ilDB->quote($this->obj_id, 'integer') . ", " .
605  $ilDB->quote($a_usr_id, 'integer') . ", " .
606  $ilDB->quote(0, 'integer') . ", " .
607  $ilDB->quote(0, 'integer') .
608  ")";
609  }
610  $res = $ilDB->manipulate($query);
611  return true;
612  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
global $ilDB

Field Documentation

◆ $admins

ilParticipant::$admins = false
private

Definition at line 49 of file class.ilParticipant.php.

Referenced by isAdmin().

◆ $component

ilParticipant::$component = ''
private

Definition at line 46 of file class.ilParticipant.php.

Referenced by getComponent().

◆ $member_roles

ilParticipant::$member_roles = []
private

Definition at line 55 of file class.ilParticipant.php.

◆ $members

ilParticipant::$members = false
private

Definition at line 51 of file class.ilParticipant.php.

Referenced by isMember().

◆ $numMembers

ilParticipant::$numMembers = null
private

Definition at line 53 of file class.ilParticipant.php.

Referenced by getNumberOfMembers().

◆ $obj_id

ilParticipant::$obj_id = 0
private

Definition at line 41 of file class.ilParticipant.php.

◆ $participants

ilParticipant::$participants = false
private

Definition at line 48 of file class.ilParticipant.php.

Referenced by isAssigned(), and isParticipant().

◆ $participants_status

ilParticipant::$participants_status = array()
private

Definition at line 57 of file class.ilParticipant.php.

◆ $ref_id

ilParticipant::$ref_id = 0
private

Definition at line 44 of file class.ilParticipant.php.

◆ $tutors

ilParticipant::$tutors = false
private

Definition at line 50 of file class.ilParticipant.php.

Referenced by isTutor().

◆ $type

ilParticipant::$type = ''
protected

Definition at line 43 of file class.ilParticipant.php.

◆ $usr_id

ilParticipant::$usr_id = 0
private

Definition at line 42 of file class.ilParticipant.php.

Referenced by getUserId().

◆ MEMBERSHIP_ADMIN

const ilParticipant::MEMBERSHIP_ADMIN = 1

Definition at line 36 of file class.ilParticipant.php.

◆ MEMBERSHIP_MEMBER

const ilParticipant::MEMBERSHIP_MEMBER = 3

Definition at line 38 of file class.ilParticipant.php.

◆ MEMBERSHIP_TUTOR

const ilParticipant::MEMBERSHIP_TUTOR = 2

Definition at line 37 of file class.ilParticipant.php.


The documentation for this class was generated from the following file: