ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilParticipants Class Reference
+ Inheritance diagram for ilParticipants:
+ Collaboration diagram for ilParticipants:

Public Member Functions

 __construct ($a_component_name, $a_ref_id)
 Singleton Constructor. More...
 
 getObjId ()
 get current obj_id More...
 
 getType ()
 Get object type. More...
 
 getNotificationRecipients ()
 Get admin, tutor which have notification enabled. More...
 
 getCountMembers ()
 Get number of members (not participants) More...
 
 getCountParticipants ()
 Get number of participants. More...
 
 getParticipants ()
 Get all participants ids. More...
 
 getMembers ()
 Get all members ids (admins and tutors are not members) Use get participants to fetch all. More...
 
 getAdmins ()
 Get all admins ids. More...
 
 getCountAdmins ()
 Get number of admins. More...
 
 getTutors ()
 Get all tutors ids. More...
 
 isAdmin ($a_usr_id)
 is user admin More...
 
 isTutor ($a_usr_id)
 is user tutor More...
 
 isMember ($a_usr_id)
 is user member More...
 
 isAssigned ($a_usr_id)
 check if user is assigned More...
 
 isLastAdmin ($a_usr_id)
 Check if user is last admin. More...
 
 getRoles ()
 Get course roles. More...
 
 getAssignedRoles ($a_usr_id)
 Get assigned roles. More...
 
 updateRoleAssignments ($a_usr_id, $a_roles)
 Update role assignments. More...
 
 checkLastAdmin ($a_usr_ids)
 Check if user for deletion are last admins. More...
 
 isBlocked ($a_usr_id)
 Check if user is blocked. More...
 
 hasPassed ($a_usr_id)
 Check if user has passed course. More...
 
 delete ($a_usr_id)
 Drop user from all roles. More...
 
 updateBlocked ($a_usr_id, $a_blocked)
 Update blocked status. More...
 
 updateContact ($a_usr_id, $a_contact)
 Update contact setting type $ilDB. More...
 
 getContacts ()
 get user ids which are confirgured as contact More...
 
 updateNotification ($a_usr_id, $a_notification)
 Update notification status. More...
 
 add ($a_usr_id, $a_role)
 Add user to object. More...
 
 deleteParticipants ($a_user_ids)
 Delete users. More...
 
 addRecommendation ($a_usr_id)
 Add desktop item. More...
 
 isNotificationEnabled ($a_usr_id)
 check if notification is enabled More...
 
 isContact ($a_usr_id)
 Check if user is contact. More...
 
 getAutoGeneratedRoleId ($a_role_type)
 Get role id of auto generated role type. More...
 
 isGroupingMember ($a_usr_id, $a_field='')
 Check grouping membership. More...
 
 getSubscribers ()
 get all subscribers More...
 
 getCountSubscribers ()
 get number of subscribers More...
 
 getSubscriberData ($a_usr_id)
 get subscriber data More...
 
 assignSubscribers ($a_usr_ids)
 Assign subscribers. More...
 
 assignSubscriber ($a_usr_id)
 Assign subscriber. More...
 
 autoFillSubscribers ()
 Assign subscriber. More...
 
 addSubscriber ($a_usr_id)
 Add subscriber. More...
 
 updateSubscriptionTime ($a_usr_id, $a_subtime)
 Update subscription time. More...
 
 updateSubject ($a_usr_id, $a_subject)
 update subject More...
 
 deleteSubscriber ($a_usr_id)
 Delete subsciber. More...
 
 deleteSubscribers ($a_usr_ids)
 Delete subscibers. More...
 
 isSubscriber ($a_usr_id)
 check if is subscriber More...
 
 setRoleOrderPosition ($a_user_id)
 Set role order position. More...
 

Static Public Member Functions

static getInstance ($a_ref_id)
 Get instance by ref_id. More...
 
static getInstanceByObjId ($a_obj_id)
 Get instance by obj type. More...
 
static hasParticipantListAccess ($a_obj_id, $a_usr_id=null)
 Check if (current) user has access to the participant list. More...
 
static getUserMembershipAssignmentsByType ($a_user_ids, $a_type, $a_only_member_roles)
 Get user membership assignments by type. More...
 
static _getMembershipByType ($a_usr_id, $a_type, $a_only_member_role=false)
 get membership by type Get course or group membership More...
 
static _isParticipant ($a_ref_id, $a_usr_id)
 Static function to check if a user is a participant of the container object. More...
 
static lookupNumberOfParticipants ($a_ref_id)
 Lookup the number of participants (crs admins, tutors, members, grp admins, members) More...
 
static lookupNumberOfMembers ($a_ref_id)
 Lookup number of members ilRbacReview $rbacreview <type> $ilObjDataCache. More...
 
static _isBlocked ($a_obj_id, $a_usr_id)
 Check if user is blocked. More...
 
static _hasPassed ($a_obj_id, $a_usr_id)
 Check if user has passed course. More...
 
static _deleteAllEntries ($a_obj_id)
 Delete all entries Normally called for course deletion. More...
 
static _deleteUser ($a_usr_id)
 Delete user data. More...
 
static getDefaultMemberRole ($a_ref_id)
 
static lookupSubscribers ($a_obj_id)
 
static _isSubscriber ($a_obj_id, $a_usr_id)
 check if user is subscriber More...
 
static lookupSubscribersData ($a_obj_id)
 
static _getAllSupportContactsOfUser ($a_usr_id, $a_type)
 Get all support contacts for a user. More...
 

Protected Member Functions

 getComponent ()
 Get component name Used for raising events. More...
 
 readParticipants ()
 Read participants. More...
 
 readParticipantsStatus ()
 Read status of participants (blocked, notification, passed) More...
 
 readSubscribers ()
 read subscribers More...
 
 readSubscriberData ($a_usr_id)
 read subscribers More...
 

Protected Attributes

 $component = ''
 
 $obj_id = 0
 
 $type = ''
 
 $ref_id = 0
 
 $roles = array()
 
 $role_data = array()
 
 $roles_sorted = []
 
 $role_assignments = []
 
 $participants = array()
 
 $participants_status = array()
 
 $members = array()
 
 $tutors = array()
 
 $admins = array()
 
 $subscribers = array()
 
 $ilDB
 
 $lng
 
 $logger = null
 
 $recommended_content_manager
 

Detailed Description

Definition at line 29 of file class.ilParticipants.php.

Constructor & Destructor Documentation

◆ __construct()

ilParticipants::__construct (   $a_component_name,
  $a_ref_id 
)

Singleton Constructor.

public

Parameters
stringcomponent definition e.g Modules/Course
intobj_id of container

Definition at line 79 of file class.ilParticipants.php.

References $GLOBALS, ilObject\_lookupObjId(), ilObject\_lookupType(), readParticipants(), and readParticipantsStatus().

80  {
81  $this->ilDB = $GLOBALS['DIC']->database();
82  $this->lng = $GLOBALS['DIC']->language();
83  $this->logger = $GLOBALS['DIC']->logger()->mem();
84 
85  $this->component = $a_component_name;
86 
87  $this->ref_id = $a_ref_id;
88  $this->obj_id = ilObject::_lookupObjId($a_ref_id);
89  $this->type = ilObject::_lookupType($this->obj_id);
90 
91  $this->readParticipants();
92  $this->readParticipantsStatus();
93  $this->recommended_content_manager = new ilRecommendedContentManager();
94  }
readParticipantsStatus()
Read status of participants (blocked, notification, passed)
static _lookupObjId($a_id)
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static _lookupType($a_id, $a_reference=false)
lookup object type
Recommended content manager (business logic)
readParticipants()
Read participants.
+ Here is the call graph for this function:

Member Function Documentation

◆ _deleteAllEntries()

static ilParticipants::_deleteAllEntries (   $a_obj_id)
static

Delete all entries Normally called for course deletion.

public

Parameters
intobj_id

Definition at line 441 of file class.ilParticipants.php.

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

Referenced by ilObjLearningSequence\delete(), ilObjGroup\delete(), ilObjCourse\delete(), and ilSoapCourseAdministration\updateCourse().

442  {
443  global $DIC;
444 
445  $ilDB = $DIC['ilDB'];
446 
447  $query = "DELETE FROM obj_members " .
448  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " ";
449  $res = $ilDB->manipulate($query);
450 
451  $query = "DELETE FROM il_subscribers " .
452  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . "";
453  $res = $ilDB->manipulate($query);
454 
455  $query = 'DELETE FROM crs_waiting_list ' .
456  'WHERE obj_id = ' . $ilDB->quote($a_obj_id, 'integer');
457  $ilDB->manipulate($query);
458 
459  return true;
460  }
foreach($_POST as $key=> $value) $res
$query
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ _deleteUser()

static ilParticipants::_deleteUser (   $a_usr_id)
static

Delete user data.

public

Parameters
intuser id

Definition at line 470 of file class.ilParticipants.php.

References $DIC, $ilDB, $query, $res, and ilWaitingList\_deleteUser().

Referenced by ilObjCourse\_deleteUser().

471  {
472  global $DIC;
473 
474  $ilDB = $DIC['ilDB'];
475 
476  $query = "DELETE FROM obj_members WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . "";
477  $res = $ilDB->manipulate($query);
478 
479  $query = "DELETE FROM il_subscribers WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . "";
480  $res = $ilDB->manipulate($query);
481 
482  include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
484  }
static _deleteUser($a_usr_id)
Delete user.
foreach($_POST as $key=> $value) $res
$query
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getAllSupportContactsOfUser()

static ilParticipants::_getAllSupportContactsOfUser (   $a_usr_id,
  $a_type 
)
static

Get all support contacts for a user.

Parameters
int$a_usr_idusr_id
string$a_typecrs or grp
Returns
array array of contacts (keys are usr_id and obj_id)

Definition at line 1679 of file class.ilParticipants.php.

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

Referenced by ilAwarenessUserProviderCourseContacts\getInitialUserSet().

1680  {
1681  global $DIC;
1682 
1683  $ilDB = $DIC['ilDB'];
1684 
1685  // todo: join the two queries or alternatively reuse _getMembershipByType
1686  // for the first part
1687 
1688  // this will also dismiss local roles!
1689  $j2 = "JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id) ";
1690  $a2 = "AND obd2.title LIKE 'il_" . $a_type . "_mem%' ";
1691 
1692  // #14290 - no role folder anymore
1693  $query = "SELECT DISTINCT obd.obj_id,obr.ref_id FROM rbac_ua ua " .
1694  "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id " .
1695  "JOIN object_reference obr ON fa.parent = obr.ref_id " .
1696  "JOIN object_data obd ON obr.obj_id = obd.obj_id " .
1697  $j2 .
1698  "WHERE obd.type = " . $ilDB->quote($a_type, 'text') . " " .
1699  "AND fa.assign = 'y' " .
1700  "AND ua.usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1701  $a2;
1702 
1703  $res = $ilDB->query($query);
1704  $obj_ids = array();
1705  while ($row = $ilDB->fetchObject($res)) {
1706  $obj_ids[] = $row->obj_id;
1707  }
1708 
1709  $set = $ilDB->query("SELECT obj_id, usr_id FROM obj_members " .
1710  " WHERE " . $ilDB->in("obj_id", $obj_ids, false, "integer") .
1711  " AND contact = " . $ilDB->quote(1, "integer"));
1712  $res = array();
1713  while ($rec = $ilDB->fetchAssoc($set)) {
1714  $res[] = $rec;
1715  }
1716 
1717  return $res;
1718  }
$a_type
Definition: workflow.php:92
foreach($_POST as $key=> $value) $res
$query
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ _getMembershipByType()

static ilParticipants::_getMembershipByType (   $a_usr_id,
  $a_type,
  $a_only_member_role = false 
)
static

get membership by type Get course or group membership

public

Parameters
int$a_usr_idusr_id
string | array$a_typecrs or grp | array of strings
bool$a_only_member_role
Returns

Definition at line 267 of file class.ilParticipants.php.

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

Referenced by ilNewsItem\_getNewsItemsOfUser(), ilMailSearchGroupsGUI\cancel(), ilMailSearchCoursesGUI\cancel(), ilDashboardLearningSequenceGUI\getAssignments(), ilPortfolioPageGUI\getCoursesOfUser(), ilAwarenessUserProviderMemberships\getInitialUserSet(), ilTestEvaluationData\getParticipants(), ilPortfolioAccessHandler\getPossibleSharedTargets(), ilWorkspaceAccessHandler\getPossibleSharedTargets(), ilWorkspaceShareTableGUI\initFilter(), ilCalendarCategories\readPDCalendars(), ilCalendarCategories\readReposCalendars(), ilWorkspaceAccessGUI\share(), and ilObjectCopyGUI\showSourceSelectionMembership().

268  {
269  global $DIC;
270 
271  $ilDB = $DIC['ilDB'];
272 
273  if (!is_array($a_type)) {
274  $a_type = array($a_type);
275  }
276 
277  // this will also dismiss local roles!
278  if ($a_only_member_role) {
279  $j2 = "JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id) ";
280  $a2 = 'AND obd2.title = ' . $ilDB->concat(
281  array(
282  array($ilDB->quote('il_', 'text')),
283  array('obd.type'),
284  array($ilDB->quote('_member_', 'text')),
285  array('obr.ref_id'),
286  ),
287  false
288  );
289  }
290 
291  // #14290 - no role folder anymore
292  $query = "SELECT DISTINCT obd.obj_id,obr.ref_id FROM rbac_ua ua " .
293  "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id " .
294  "JOIN object_reference obr ON fa.parent = obr.ref_id " .
295  "JOIN object_data obd ON obr.obj_id = obd.obj_id " .
296  $j2 .
297  "WHERE " . $ilDB->in("obd.type", $a_type, false, "text") .
298  "AND fa.assign = 'y' " .
299  "AND ua.usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
300  $a2;
301  $res = $ilDB->query($query);
302  while ($row = $ilDB->fetchObject($res)) {
303  $ref_ids[] = $row->obj_id;
304  }
305 
306  return $ref_ids ? $ref_ids : array();
307  }
$a_type
Definition: workflow.php:92
foreach($_POST as $key=> $value) $res
$query
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ _hasPassed()

static ilParticipants::_hasPassed (   $a_obj_id,
  $a_usr_id 
)
static

Check if user has passed course.

public

Parameters
intobj_id
intuser id

Definition at line 418 of file class.ilParticipants.php.

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

Referenced by ilObjCourseAccess\checkCondition().

419  {
420  global $DIC;
421 
422  $ilDB = $DIC['ilDB'];
423 
424  $query = "SELECT * FROM obj_members " .
425  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
426  "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
427  "AND passed = '1'";
428  $res = $ilDB->query($query);
429  return $res->numRows() ? true : false;
430  }
foreach($_POST as $key=> $value) $res
$query
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ _isBlocked()

static ilParticipants::_isBlocked (   $a_obj_id,
  $a_usr_id 
)
static

Check if user is blocked.

public

Parameters
intcourse id
intusr_id

Definition at line 395 of file class.ilParticipants.php.

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

396  {
397  global $DIC;
398 
399  $ilDB = $DIC['ilDB'];
400 
401  $query = "SELECT * FROM obj_members " .
402  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
403  "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
404  "AND blocked = " . $ilDB->quote(1, 'integer');
405  $res = $ilDB->query($query);
406  return $res->numRows() ? true : false;
407  }
foreach($_POST as $key=> $value) $res
$query
$DIC
Definition: xapitoken.php:46

◆ _isParticipant()

static ilParticipants::_isParticipant (   $a_ref_id,
  $a_usr_id 
)
static

Static function to check if a user is a participant of the container object.

public

Parameters
intref_id
intuser id

Definition at line 319 of file class.ilParticipants.php.

References $DIC.

Referenced by ilForumModeratorsGUI\detachModeratorRole(), ilObjCourseGUI\executeCommand(), ilMembershipGUI\filterUserIdsByRbacOrPositionOfCurrentUser(), ilObjCourseGUI\getTabs(), ilNotification\hasNotification(), and ilObjCourseGUI\initHeaderAction().

320  {
321  global $DIC;
322 
323  $rbacreview = $DIC['rbacreview'];
324 
325  $local_roles = $rbacreview->getRolesOfRoleFolder($a_ref_id, false);
326 
327  return $rbacreview->isAssignedToAtLeastOneGivenRole($a_usr_id, $local_roles);
328  }
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ _isSubscriber()

static ilParticipants::_isSubscriber (   $a_obj_id,
  $a_usr_id 
)
static

check if user is subscriber

public

Definition at line 1584 of file class.ilParticipants.php.

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

Referenced by ilObjSessionAccess\_checkAccess(), ilObjCourseListGUI\getProperties(), and ilMembershipTest\testSubscription().

1585  {
1586  global $DIC;
1587 
1588  $ilDB = $DIC['ilDB'];
1589 
1590  $query = "SELECT * FROM il_subscribers " .
1591  "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1592  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . "";
1593 
1594  $res = $ilDB->query($query);
1595  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1596  return true;
1597  }
1598  return false;
1599  }
foreach($_POST as $key=> $value) $res
$query
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ add()

ilParticipants::add (   $a_usr_id,
  $a_role 
)

Add user to object.

public

Parameters
intuser id
introle IL_CRS_ADMIN || IL_CRS_TUTOR || IL_CRS_MEMBER

Definition at line 983 of file class.ilParticipants.php.

References $DIC, deleteSubscriber(), ilWaitingList\deleteUserEntry(), getComponent(), IL_CRS_ADMIN, IL_CRS_MEMBER, IL_CRS_TUTOR, IL_GRP_ADMIN, IL_GRP_MEMBER, IL_LSO_ADMIN, IL_LSO_MEMBER, IL_SESS_MEMBER, and isAssigned().

Referenced by assignSubscriber().

984  {
985  global $DIC;
986 
987  $rbacadmin = $DIC['rbacadmin'];
988  $ilAppEventHandler = $DIC['ilAppEventHandler'];
989 
990  if ($this->isAssigned($a_usr_id)) {
991  return false;
992  }
993 
994  switch ($a_role) {
995  case IL_CRS_ADMIN:
996  $this->admins[] = $a_usr_id;
997  break;
998 
999  case IL_CRS_TUTOR:
1000  $this->tutors[] = $a_usr_id;
1001  break;
1002 
1003  case IL_CRS_MEMBER:
1004  $this->members[] = $a_usr_id;
1005  break;
1006 
1007  case IL_GRP_ADMIN:
1008  $this->admins[] = $a_usr_id;
1009  break;
1010 
1011  case IL_GRP_MEMBER:
1012  $this->members[] = $a_usr_id;
1013  break;
1014 
1015  case IL_LSO_ADMIN:
1016  $this->admins[] = $a_usr_id;
1017  break;
1018 
1019  case IL_LSO_MEMBER:
1020  $this->members[] = $a_usr_id;
1021  break;
1022 
1023  case IL_SESS_MEMBER:
1024  $this->members[] = $a_usr_id;
1025  break;
1026  }
1027 
1028  $this->participants[] = $a_usr_id;
1029  $rbacadmin->assignUser($this->role_data[$a_role], $a_usr_id);
1030 
1031  // Delete subscription request
1032  $this->deleteSubscriber($a_usr_id);
1033 
1034  include_once './Services/Membership/classes/class.ilWaitingList.php';
1035  ilWaitingList::deleteUserEntry($a_usr_id, $this->obj_id);
1036 
1037  $ilAppEventHandler->raise(
1038  $this->getComponent(),
1039  "addParticipant",
1040  array(
1041  'obj_id' => $this->obj_id,
1042  'usr_id' => $a_usr_id,
1043  'role_id' => $a_role)
1044  );
1045  return true;
1046  }
isAssigned($a_usr_id)
check if user is assigned
const IL_LSO_MEMBER
const IL_GRP_ADMIN
const IL_CRS_TUTOR
deleteSubscriber($a_usr_id)
Delete subsciber.
const IL_GRP_MEMBER
const IL_LSO_ADMIN
const IL_CRS_MEMBER
const IL_CRS_ADMIN
Base class for course and group participants.
getComponent()
Get component name Used for raising events.
$DIC
Definition: xapitoken.php:46
static deleteUserEntry($a_usr_id, $a_obj_id)
Delete one user entry.
const IL_SESS_MEMBER
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addRecommendation()

ilParticipants::addRecommendation (   $a_usr_id)

Add desktop item.

public

Parameters
intusr_id

Definition at line 1071 of file class.ilParticipants.php.

Referenced by ilCourseParticipants\add(), and ilGroupParticipants\add().

1072  {
1073  // deactivated for now, see discussion at
1074  // https://docu.ilias.de/goto_docu_wiki_wpage_5620_1357.html
1075  // $this->recommended_content_manager->addObjectRecommendation($a_usr_id, $this->ref_id);
1076  return true;
1077  }
+ Here is the caller graph for this function:

◆ addSubscriber()

ilParticipants::addSubscriber (   $a_usr_id)

Add subscriber.

public

Definition at line 1449 of file class.ilParticipants.php.

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

1450  {
1451  global $DIC;
1452 
1453  $ilDB = $DIC['ilDB'];
1454 
1455  $query = "INSERT INTO il_subscribers (usr_id,obj_id,subject,sub_time) " .
1456  " VALUES (" .
1457  $ilDB->quote($a_usr_id, 'integer') . "," .
1458  $ilDB->quote($this->obj_id, 'integer') . ", " .
1459  $ilDB->quote('', 'text') . ", " .
1460  $ilDB->quote(time(), 'integer') .
1461  ")";
1462  $res = $ilDB->manipulate($query);
1463 
1464  return true;
1465  }
foreach($_POST as $key=> $value) $res
$query
$DIC
Definition: xapitoken.php:46

◆ assignSubscriber()

ilParticipants::assignSubscriber (   $a_usr_id)

Assign subscriber.

public

Definition at line 1379 of file class.ilParticipants.php.

References $DIC, $ilErr, add(), deleteSubscriber(), ilObjectFactory\getInstanceByObjId(), IL_CRS_MEMBER, IL_GRP_MEMBER, IL_LSO_MEMBER, isAssigned(), and isSubscriber().

Referenced by assignSubscribers(), and autoFillSubscribers().

1380  {
1381  global $DIC;
1382 
1383  $ilErr = $DIC['ilErr'];
1384 
1385  $ilErr->setMessage("");
1386  if (!$this->isSubscriber($a_usr_id)) {
1387  $ilErr->appendMessage($this->lng->txt("crs_user_notsubscribed"));
1388 
1389  return false;
1390  }
1391  if ($this->isAssigned($a_usr_id)) {
1392  $tmp_obj = ilObjectFactory::getInstanceByObjId($a_usr_id);
1393  $ilErr->appendMessage($tmp_obj->getLogin() . ": " . $this->lng->txt("crs_user_already_assigned"));
1394 
1395  return false;
1396  }
1397 
1398  if (!$tmp_obj = &ilObjectFactory::getInstanceByObjId($a_usr_id)) {
1399  $ilErr->appendMessage($this->lng->txt("crs_user_not_exists"));
1400 
1401  return false;
1402  }
1403 
1404  // TODO: must be group or course member role
1405  if ($this instanceof ilCourseParticipants) {
1406  $this->add($tmp_obj->getId(), IL_CRS_MEMBER);
1407  }
1408  if ($this instanceof ilGroupParticipants) {
1409  $this->add($tmp_obj->getId(), IL_GRP_MEMBER);
1410  }
1411  if ($this instanceof ilLearningSequenceParticipants) {
1412  $this->add($tmp_obj->getId(), IL_LSO_MEMBER);
1413  }
1414  if ($this instanceof ilSessionParticipants) {
1415  $this->register($tmp_obj->getId());
1416  }
1417  $this->deleteSubscriber($a_usr_id);
1418  return true;
1419  }
Session participation handling.
isAssigned($a_usr_id)
check if user is assigned
const IL_LSO_MEMBER
deleteSubscriber($a_usr_id)
Delete subsciber.
const IL_GRP_MEMBER
add($a_usr_id, $a_role)
Add user to object.
$ilErr
Definition: raiseError.php:18
const IL_CRS_MEMBER
isSubscriber($a_usr_id)
check if is subscriber
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ assignSubscribers()

ilParticipants::assignSubscribers (   $a_usr_ids)

Assign subscribers.

public

Definition at line 1361 of file class.ilParticipants.php.

References assignSubscriber().

1362  {
1363  if (!is_array($a_usr_ids) or !count($a_usr_ids)) {
1364  return false;
1365  }
1366  foreach ($a_usr_ids as $id) {
1367  if (!$this->assignSubscriber($id)) {
1368  return false;
1369  }
1370  }
1371  return true;
1372  }
assignSubscriber($a_usr_id)
Assign subscriber.
+ Here is the call graph for this function:

◆ autoFillSubscribers()

ilParticipants::autoFillSubscribers ( )

Assign subscriber.

public

Definition at line 1426 of file class.ilParticipants.php.

References assignSubscriber(), and readSubscribers().

1427  {
1428  $this->readSubscribers();
1429 
1430  $counter = 0;
1431  foreach ($this->subscribers as $subscriber) {
1432  if (!$this->assignSubscriber($subscriber)) {
1433  continue;
1434  } else {
1435  // TODO: notification
1436  #$this->sendNotification($this->NOTIFY_ACCEPT_SUBSCRIBER,$subscriber);
1437  }
1438  ++$counter;
1439  }
1440 
1441  return $counter;
1442  }
assignSubscriber($a_usr_id)
Assign subscriber.
readSubscribers()
read subscribers
+ Here is the call graph for this function:

◆ checkLastAdmin()

ilParticipants::checkLastAdmin (   $a_usr_ids)

Check if user for deletion are last admins.

public

Parameters
arrayarray of user ids for deletion

Definition at line 772 of file class.ilParticipants.php.

References getAdmins().

773  {
774  foreach ($this->getAdmins() as $admin_id) {
775  if (!in_array($admin_id, $a_usr_ids)) {
776  return true;
777  }
778  }
779  return false;
780  }
getAdmins()
Get all admins ids.
+ Here is the call graph for this function:

◆ delete()

ilParticipants::delete (   $a_usr_id)

Drop user from all roles.

public

Parameters
intusr_id

Definition at line 819 of file class.ilParticipants.php.

References $DIC, $GLOBALS, $ilDB, $query, $res, getComponent(), readParticipants(), and readParticipantsStatus().

820  {
821  global $DIC;
822 
823  $rbacadmin = $DIC['rbacadmin'];
824  $ilDB = $DIC['ilDB'];
825 
826  $this->recommended_content_manager->removeObjectRecommendation($a_usr_id, $this->ref_id);
827 
828  foreach ($this->roles as $role_id) {
829  $rbacadmin->deassignUser($role_id, $a_usr_id);
830  }
831 
832  $query = "DELETE FROM obj_members " .
833  "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
834  "AND obj_id = " . $ilDB->quote($this->obj_id, 'integer');
835  $res = $ilDB->manipulate($query);
836 
837  $this->readParticipants();
838  $this->readParticipantsStatus();
839 
840  $GLOBALS['DIC']['ilAppEventHandler']->raise(
841  $this->getComponent(),
842  "deleteParticipant",
843  array(
844  'obj_id' => $this->obj_id,
845  'usr_id' => $a_usr_id)
846  );
847 
848  return true;
849  }
readParticipantsStatus()
Read status of participants (blocked, notification, passed)
foreach($_POST as $key=> $value) $res
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$query
getComponent()
Get component name Used for raising events.
$DIC
Definition: xapitoken.php:46
readParticipants()
Read participants.
+ Here is the call graph for this function:

◆ deleteParticipants()

ilParticipants::deleteParticipants (   $a_user_ids)

Delete users.

public

Parameters
arrayuser ids

Definition at line 1056 of file class.ilParticipants.php.

1057  {
1058  foreach ($a_user_ids as $user_id) {
1059  $this->delete($user_id);
1060  }
1061  return true;
1062  }

◆ deleteSubscriber()

ilParticipants::deleteSubscriber (   $a_usr_id)

Delete subsciber.

public

Definition at line 1515 of file class.ilParticipants.php.

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

Referenced by add(), assignSubscriber(), and readSubscribers().

1516  {
1517  global $DIC;
1518 
1519  $ilDB = $DIC['ilDB'];
1520 
1521  $query = "DELETE FROM il_subscribers " .
1522  "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1523  "AND obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " ";
1524  $res = $ilDB->manipulate($query);
1525 
1526  return true;
1527  }
foreach($_POST as $key=> $value) $res
$query
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ deleteSubscribers()

ilParticipants::deleteSubscribers (   $a_usr_ids)

Delete subscibers.

public

Definition at line 1535 of file class.ilParticipants.php.

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

1536  {
1537  global $DIC;
1538 
1539  $ilErr = $DIC['ilErr'];
1540  $ilDB = $DIC['ilDB'];
1541 
1542  if (!is_array($a_usr_ids) or !count($a_usr_ids)) {
1543  $ilErr->setMessage('');
1544  $ilErr->appendMessage($this->lng->txt("no_usr_ids_given"));
1545 
1546  return false;
1547  }
1548  $query = "DELETE FROM il_subscribers " .
1549  "WHERE " . $ilDB->in('usr_id', (array) $a_usr_ids, false, 'integer') . " " .
1550  "AND obj_id = " . $ilDB->quote($this->obj_id, 'integer');
1551  $res = $ilDB->query($query);
1552  return true;
1553  }
$ilErr
Definition: raiseError.php:18
foreach($_POST as $key=> $value) $res
$query
$DIC
Definition: xapitoken.php:46

◆ getAdmins()

ilParticipants::getAdmins ( )

Get all admins ids.

public

Returns
array array of user ids

Definition at line 611 of file class.ilParticipants.php.

Referenced by checkLastAdmin(), getCountAdmins(), and isLastAdmin().

612  {
613  return $this->admins ? $this->admins : array();
614  }
+ Here is the caller graph for this function:

◆ getAssignedRoles()

ilParticipants::getAssignedRoles (   $a_usr_id)

Get assigned roles.

public

Parameters
intuser_id

Definition at line 718 of file class.ilParticipants.php.

References $DIC.

719  {
720  global $DIC;
721 
722  $rbacreview = $DIC['rbacreview'];
723 
724  foreach ($this->roles as $role) {
725  if ($rbacreview->isAssigned($a_usr_id, $role)) {
726  $assigned[] = $role;
727  }
728  }
729  return $assigned ? $assigned : array();
730  }
$DIC
Definition: xapitoken.php:46

◆ getAutoGeneratedRoleId()

ilParticipants::getAutoGeneratedRoleId (   $a_role_type)

Get role id of auto generated role type.

Parameters
type$a_role_type

Definition at line 1115 of file class.ilParticipants.php.

1116  {
1117  if (array_key_exists($a_role_type, $this->role_data)) {
1118  return $this->role_data[$a_role_type];
1119  }
1120 
1121  return 0;
1122  }

◆ getComponent()

ilParticipants::getComponent ( )
protected

Get component name Used for raising events.

Definition at line 157 of file class.ilParticipants.php.

References $component.

Referenced by add(), and delete().

158  {
159  return $this->component;
160  }
+ Here is the caller graph for this function:

◆ getContacts()

ilParticipants::getContacts ( )

get user ids which are confirgured as contact

Returns
array

Definition at line 919 of file class.ilParticipants.php.

920  {
921  $contacts = array();
922  foreach ((array) $this->participants_status as $usr_id => $status) {
923  if ($status['contact']) {
924  $contacts[] = $usr_id;
925  }
926  }
927  return $contacts;
928  }

◆ getCountAdmins()

ilParticipants::getCountAdmins ( )

Get number of admins.

Returns

Definition at line 620 of file class.ilParticipants.php.

References getAdmins().

621  {
622  return count($this->getAdmins());
623  }
getAdmins()
Get all admins ids.
+ Here is the call graph for this function:

◆ getCountMembers()

ilParticipants::getCountMembers ( )

Get number of members (not participants)

public

Definition at line 564 of file class.ilParticipants.php.

565  {
566  return count($this->members);
567  }

◆ getCountParticipants()

ilParticipants::getCountParticipants ( )

Get number of participants.

public

Definition at line 575 of file class.ilParticipants.php.

576  {
577  return count($this->participants);
578  }

◆ getCountSubscribers()

ilParticipants::getCountSubscribers ( )

get number of subscribers

public

Definition at line 1339 of file class.ilParticipants.php.

References getSubscribers().

1340  {
1341  return count($this->getSubscribers());
1342  }
getSubscribers()
get all subscribers
+ Here is the call graph for this function:

◆ getDefaultMemberRole()

static ilParticipants::getDefaultMemberRole (   $a_ref_id)
static

Definition at line 486 of file class.ilParticipants.php.

References $DIC, $ilCtrl, $obj_id, $roles, $type, ilObject\_lookupObjId(), ilObject\_lookupTitle(), and ilObject\_lookupType().

Referenced by ilStartUpGUI\_checkGoto(), ilCourseRegistrationGUI\add(), ilRepositorySearchGUI\addRole(), and ilRbacSystem\initMemberView().

487  {
488  global $DIC;
489 
490  $ilCtrl = $DIC['ilCtrl'];
491 
492  $obj_id = ilObject::_lookupObjId($a_ref_id);
494 
495  if (!in_array($type, array('crs','grp'))) {
496  return 0;
497  }
498 
499  global $DIC;
500 
501  $rbacreview = $DIC['rbacreview'];
502 
503 
504  $roles = $rbacreview->getRolesOfRoleFolder($a_ref_id, false);
505 
506  foreach ($roles as $role) {
507  $title = ilObject::_lookupTitle($role);
508  if (substr($title, 0, 13) == ('il_' . $type . '_member')) {
509  return $role;
510  }
511  }
512  return 0;
513  }
static _lookupTitle($a_id)
lookup object title
global $ilCtrl
Definition: ilias.php:18
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInstance()

static ilParticipants::getInstance (   $a_ref_id)
static

Get instance by ref_id.

Parameters
int$a_ref_id
Returns
ilParticipants

Definition at line 101 of file class.ilParticipants.php.

References $GLOBALS, $obj_id, $type, ilObject\_lookupObjId(), ilObject\_lookupType(), and ilSessionParticipants\getInstance().

Referenced by ilSessionParticipantsTableGUI\__construct(), ilEventParticipants\_deleteByUser(), ilSessionParticipantsTableGUI\collectParticipants(), ilCourseMembershipGUI\deleteParticipantsWithLinkedCourses(), ilMembershipGUI\filterUserIdsByRbacOrPositionOfCurrentUser(), ilConsultationHourUtils\getConsultationHourLinksForRepositoryObject(), ilCourseReferenceLP\getMembers(), ilMembershipGUI\getMembersObject(), ilLearningSequenceMembershipGUI\getMembersObject(), ilSessionParticipantsTableGUI\getParentLocalRoles(), ilTrQuery\getParticipantsForObject(), ilStudyProgrammeMembershipSourceReaderFactory\getReaderFor(), ilECSAppEventListener\handleMembership(), ilCourseReferenceAppEventListener\handleReferences(), ilObjSessionGUI\infoScreen(), ilObjGroupGUI\infoScreen(), ilCourseReferencePathInfo\isReferenceMemberUpdateConfirmationRequired(), ilMembershipGUI\jump2UsersGallery(), ilPDSelectedItemsBlockGUI\manageObject(), ilCourseReferenceDeleteConfirmationTableGUI\readLinkedCourseAssignments(), ilObjSessionGUI\registerObject(), ilObjSessionGUI\showJoinRequestButton(), and ilSessionMembershipGUI\updateMembers().

102  {
103  $obj_id = ilObject::_lookupObjId($a_ref_id);
105 
106  switch ($type) {
107  case 'crs':
108  case 'grp':
109  case 'lso':
110  return self::getInstanceByObjId($obj_id);
111  case 'sess':
112  include_once './Modules/Session/classes/class.ilSessionParticipants.php';
113  return ilSessionParticipants::getInstance($a_ref_id);
114  default:
115  $GLOBALS['DIC']->logger()->mem()->logStack();
116  $GLOBALS['DIC']->logger()->mem()->warning('Invalid ref_id -> obj_id given: ' . $a_ref_id . ' -> ' . $obj_id);
117  throw new \InvalidArgumentException('Invalid obj_id given.');
118  }
119  }
static _lookupObjId($a_id)
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static _lookupType($a_id, $a_reference=false)
lookup object type
static getInstance($a_ref_id)
Get instance.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInstanceByObjId()

static ilParticipants::getInstanceByObjId (   $a_obj_id)
static

Get instance by obj type.

Parameters
int$a_obj_id
Returns
ilParticipants
Exceptions
InvalidArgumentException
Deprecated:
since version 5.4 use getInstance() (ref_id based)

Definition at line 129 of file class.ilParticipants.php.

References $GLOBALS, $type, ilLearningSequenceParticipants\_getInstanceByObjId(), ilSessionParticipants\_getInstanceByObjId(), ilGroupParticipants\_getInstanceByObjId(), ilCourseParticipants\_getInstanceByObjId(), ilObject\_lookupType(), and ilLogLevel\WARNING.

Referenced by ilGroupParticipantsTableGUI\__construct(), ilCourseParticipantsTableGUI\__construct(), ilGroupAddToGroupActionGUI\addUser(), ilAppointmentPresentationCourseGUI\collectPropertiesAndActions(), ilGroupAddToGroupActionGUI\confirmAddUser(), ilGroupAddToGroupActionGUI\createGroupAndAddUser(), ilWorkspaceAccessHandler\findSharedObjects(), ilPortfolioAccessHandler\findSharedObjects(), ilContSkillMemberTableGUI\getMembers(), ilLPStatusEvent\getMembers(), ilLPStatusManualByTutor\getMembers(), ilObjCourseGUI\infoScreen(), ilRepositorySearchGUI\listUsers(), ilMembershipGUI\membersMap(), and ilRepositoryObjectResultTableGUI\parseObjectIds().

130  {
131  $type = ilObject::_lookupType($a_obj_id);
132  switch ($type) {
133  case 'crs':
134  include_once './Modules/Course/classes/class.ilCourseParticipants.php';
136 
137  case 'grp':
138  include_once './Modules/Group/classes/class.ilGroupParticipants.php';
140 
141  case 'sess':
142  include_once './Modules/Session/classes/class.ilSessionParticipants.php';
144  case 'lso':
146  default:
147  $GLOBALS['DIC']->logger()->mmbr()->logStack(ilLogLevel::WARNING);
148  $GLOBALS['DIC']->logger()->mmbr()->warning(': Invalid obj_id given: ' . $a_obj_id);
149  throw new InvalidArgumentException('Invalid obj id given');
150  }
151  }
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static _getInstanceByObjId($a_obj_id)
Get instance.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMembers()

ilParticipants::getMembers ( )

Get all members ids (admins and tutors are not members) Use get participants to fetch all.

public

Returns
array array of user ids

Definition at line 601 of file class.ilParticipants.php.

Referenced by ilSessionParticipants\readParticipantsStatus().

602  {
603  return $this->members ? $this->members : array();
604  }
+ Here is the caller graph for this function:

◆ getNotificationRecipients()

ilParticipants::getNotificationRecipients ( )

Get admin, tutor which have notification enabled.

public

Returns
int[] of user ids

Definition at line 539 of file class.ilParticipants.php.

References $DIC, $ilDB, $query, $res, ilDBConstants\FETCHMODE_OBJECT, isAdmin(), and isTutor().

Referenced by ilLearningSequenceParticipants\sendNotification(), ilGroupParticipants\sendNotification(), ilCourseParticipants\sendNotificationToAdmins(), ilCourseParticipants\sendSubscriptionRequestToAdmins(), and ilCourseParticipants\sendUnsubscribeNotificationToAdmins().

540  {
541  global $DIC;
542 
543  $ilDB = $DIC['ilDB'];
544 
545  $query = "SELECT * FROM obj_members " .
546  "WHERE notification = 1 " .
547  "AND obj_id = " . $ilDB->quote($this->obj_id) . " ";
548  $res = $ilDB->query($query);
549  $recp = [];
550  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
551  if ($this->isAdmin($row->usr_id) or $this->isTutor($row->usr_id)) {
552  $recp[] = $row->usr_id;
553  }
554  }
555  return $recp;
556  }
isAdmin($a_usr_id)
is user admin
foreach($_POST as $key=> $value) $res
$query
$DIC
Definition: xapitoken.php:46
isTutor($a_usr_id)
is user tutor
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getObjId()

ilParticipants::getObjId ( )

get current obj_id

Returns
type

Definition at line 519 of file class.ilParticipants.php.

References $obj_id.

Referenced by ilLearningSequenceParticipants\addSubscriber(), ilGroupParticipants\addSubscriber(), ilCourseParticipants\addSubscriber(), and ilSessionParticipants\register().

520  {
521  return $this->obj_id;
522  }
+ Here is the caller graph for this function:

◆ getParticipants()

ilParticipants::getParticipants ( )

Get all participants ids.

public

Returns
array array of user ids

Definition at line 589 of file class.ilParticipants.php.

Referenced by isGroupingMember().

590  {
591  return $this->participants ? $this->participants : array();
592  }
+ Here is the caller graph for this function:

◆ getRoles()

ilParticipants::getRoles ( )

Get course roles.

public

Parameters

Definition at line 706 of file class.ilParticipants.php.

Referenced by updateRoleAssignments().

707  {
708  return $this->roles ? $this->roles : array();
709  }
+ Here is the caller graph for this function:

◆ getSubscriberData()

ilParticipants::getSubscriberData (   $a_usr_id)

get subscriber data

public

Definition at line 1349 of file class.ilParticipants.php.

References readSubscriberData().

1350  {
1351  return $this->readSubscriberData($a_usr_id);
1352  }
readSubscriberData($a_usr_id)
read subscribers
+ Here is the call graph for this function:

◆ getSubscribers()

ilParticipants::getSubscribers ( )

get all subscribers

public

Definition at line 1326 of file class.ilParticipants.php.

References $subscribers, and readSubscribers().

Referenced by getCountSubscribers().

1327  {
1328  $this->readSubscribers();
1329 
1330  return $this->subscribers;
1331  }
readSubscribers()
read subscribers
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTutors()

ilParticipants::getTutors ( )

Get all tutors ids.

public

Returns
array array of user ids

Definition at line 632 of file class.ilParticipants.php.

633  {
634  return $this->tutors ? $this->tutors : array();
635  }

◆ getType()

ilParticipants::getType ( )

Get object type.

Returns
string obj_type

Definition at line 528 of file class.ilParticipants.php.

References $type.

529  {
530  return $this->type;
531  }

◆ getUserMembershipAssignmentsByType()

static ilParticipants::getUserMembershipAssignmentsByType (   $a_user_ids,
  $a_type,
  $a_only_member_roles 
)
static

Get user membership assignments by type.

Parameters
int[]$a_user_ids
string[]$a_type
bool$a_only_member_roles

Definition at line 212 of file class.ilParticipants.php.

References $a_type, $DIC, $ilDB, $logger, $query, $res, and ilLogLevel\DEBUG.

Referenced by ilTimingsUser\lookupTimings().

213  {
214  global $DIC;
215 
216  $logger = $DIC->logger()->mmbr();
217  $ilDB = $DIC->database();
218 
219  if ($a_only_member_roles) {
220  $j2 = "JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id) ";
221  $a2 = 'AND obd2.title = ' . $ilDB->concat(
222  array(
223  array($ilDB->quote('il_', 'text')),
224  array('obd.type'),
225  array($ilDB->quote('_member_', 'text')),
226  array('obr.ref_id'),
227  ),
228  false
229  );
230  }
231 
232  $query = "SELECT DISTINCT obd.obj_id,obr.ref_id,ua.usr_id FROM rbac_ua ua " .
233  "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id " .
234  "JOIN object_reference obr ON fa.parent = obr.ref_id " .
235  "JOIN object_data obd ON obr.obj_id = obd.obj_id " .
236  $j2 .
237  "WHERE " . $ilDB->in("obd.type", $a_type, false, "text") .
238  "AND fa.assign = 'y' " .
239  'AND ' . $ilDB->in('ua.usr_id', $a_user_ids, false, 'integer') . ' ' .
240  $a2;
241 
242  $logger->debug($query);
243 
244 
245  $obj_ids = [];
246  $res = $ilDB->query($query);
247  while ($row = $ilDB->fetchObject($res)) {
248  $obj_ids[$row->obj_id][] = $row->usr_id;
249  }
250 
251  $logger->dump($obj_ids, \ilLogLevel::DEBUG);
252 
253  return $obj_ids;
254  }
$a_type
Definition: workflow.php:92
foreach($_POST as $key=> $value) $res
$query
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ hasParticipantListAccess()

static ilParticipants::hasParticipantListAccess (   $a_obj_id,
  $a_usr_id = null 
)
static

Check if (current) user has access to the participant list.

Parameters
int$a_obj
int$a_usr_id

Definition at line 169 of file class.ilParticipants.php.

References $DIC, $GLOBALS, $ref_id, ilObject\_getAllReferences(), ilObjCourse\lookupShowMembersEnabled(), and ilObjGroup\lookupShowMembersEnabled().

Referenced by ilRepositorySearchGUI\listUsers(), ilRepositoryObjectResultTableGUI\parseObjectIds(), and ilMailSearchGUI\showResults().

170  {
171  global $DIC;
172 
173  $access = $DIC->access();
174 
175  if (!$a_usr_id) {
176  $a_usr_id = $GLOBALS['DIC']['ilUser']->getId();
177  }
178 
179  // if write access granted => return true
180  $refs = ilObject::_getAllReferences($a_obj_id);
181  $ref_id = end($refs);
182 
183  if ($access->checkAccess('manage_members', '', $ref_id)) {
184  return true;
185  }
186  $part = self::getInstance($ref_id);
187  if ($part->isAssigned($a_usr_id)) {
188  if ($part->getType() == 'crs') {
189  if (!ilObjCourse::lookupShowMembersEnabled($a_obj_id)) {
190  return false;
191  }
192  }
193  if ($part->getType() == 'grp') {
194  if (!ilObjGroup::lookupShowMembersEnabled($a_obj_id)) {
195  return false;
196  }
197  }
198  return true;
199  }
200  // User is not assigned to course/group => no read access
201  return false;
202  }
static _getAllReferences($a_id)
get all reference ids of object
static lookupShowMembersEnabled($a_obj_id)
Check if show member is enabled.
static lookupShowMembersEnabled(int $a_obj_id)
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasPassed()

ilParticipants::hasPassed (   $a_usr_id)

Check if user has passed course.

public

Parameters
intuser_id

Definition at line 804 of file class.ilParticipants.php.

Referenced by ilCourseParticipants\__buildStatusBody().

805  {
806  if (isset($this->participants_status[$a_usr_id])) {
807  return $this->participants_status[$a_usr_id]['passed'] ? true : false;
808  }
809  return false;
810  }
+ Here is the caller graph for this function:

◆ isAdmin()

ilParticipants::isAdmin (   $a_usr_id)

is user admin

public

Parameters
intusr_id

Definition at line 644 of file class.ilParticipants.php.

Referenced by ilCourseParticipants\__buildStatusBody(), and getNotificationRecipients().

645  {
646  return in_array($a_usr_id, $this->admins) ? true : false;
647  }
+ Here is the caller graph for this function:

◆ isAssigned()

ilParticipants::isAssigned (   $a_usr_id)

check if user is assigned

public

Parameters

Definition at line 683 of file class.ilParticipants.php.

Referenced by add(), and assignSubscriber().

684  {
685  return in_array($a_usr_id, $this->participants);
686  }
+ Here is the caller graph for this function:

◆ isBlocked()

ilParticipants::isBlocked (   $a_usr_id)

Check if user is blocked.

public

Parameters
intuser_id

Definition at line 789 of file class.ilParticipants.php.

Referenced by ilCourseParticipants\__buildStatusBody().

790  {
791  if (isset($this->participants_status[$a_usr_id])) {
792  return $this->participants_status[$a_usr_id]['blocked'] ? true : false;
793  }
794  return false;
795  }
+ Here is the caller graph for this function:

◆ isContact()

ilParticipants::isContact (   $a_usr_id)

Check if user is contact.

Parameters
intusr_id

Definition at line 1101 of file class.ilParticipants.php.

1102  {
1103  if (isset($this->participants_status[$a_usr_id])) {
1104  return (bool) $this->participants_status[$a_usr_id]['contact'];
1105  }
1106  return false;
1107  }

◆ isGroupingMember()

ilParticipants::isGroupingMember (   $a_usr_id,
  $a_field = '' 
)

Check grouping membership.

public

Parameters

Definition at line 1261 of file class.ilParticipants.php.

References $DIC, $ilDB, $query, $res, ilObjectFactory\getInstanceByObjId(), and getParticipants().

1262  {
1263  global $DIC;
1264 
1265  $rbacreview = $DIC['rbacreview'];
1266  $ilObjDataCache = $DIC['ilObjDataCache'];
1267  $ilDB = $DIC['ilDB'];
1268 
1269  // Used for membership limitations -> check membership by given field
1270  if ($a_field) {
1271  include_once './Services/User/classes/class.ilObjUser.php';
1272 
1273  $tmp_user = &ilObjectFactory::getInstanceByObjId($a_usr_id);
1274  switch ($a_field) {
1275  case 'login':
1276  $and = "AND login = " . $ilDB->quote($tmp_user->getLogin(), 'text') . " ";
1277  break;
1278  case 'email':
1279  $and = "AND email = " . $ilDB->quote($tmp_user->getEmail(), 'text') . " ";
1280  break;
1281  case 'matriculation':
1282  $and = "AND matriculation = " . $ilDB->quote($tmp_user->getMatriculation(), 'text') . " ";
1283  break;
1284 
1285  default:
1286  $and = "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " ";
1287  break;
1288  }
1289 
1290  if (!$this->getParticipants()) {
1291  return false;
1292  }
1293 
1294  $query = "SELECT * FROM usr_data ud " .
1295  "WHERE " . $ilDB->in('usr_id', $this->getParticipants(), false, 'integer') . " " .
1296  $and;
1297 
1298  $res = $ilDB->query($query);
1299  return $res->numRows() ? true : false;
1300  }
1301  }
foreach($_POST as $key=> $value) $res
getParticipants()
Get all participants ids.
$query
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ isLastAdmin()

ilParticipants::isLastAdmin (   $a_usr_id)

Check if user is last admin.

Parameters
int$a_usr_id
Returns
bool

Definition at line 693 of file class.ilParticipants.php.

References getAdmins().

694  {
695  return in_array($a_usr_id, $this->getAdmins()) and count($this->getAdmins()) == 1;
696  }
getAdmins()
Get all admins ids.
+ Here is the call graph for this function:

◆ isMember()

ilParticipants::isMember (   $a_usr_id)

is user member

public

Parameters
intusr_id

Definition at line 668 of file class.ilParticipants.php.

Referenced by ilCourseParticipants\__buildStatusBody().

669  {
670  return in_array($a_usr_id, $this->members) ? true : false;
671  }
+ Here is the caller graph for this function:

◆ isNotificationEnabled()

ilParticipants::isNotificationEnabled (   $a_usr_id)

check if notification is enabled

public

Parameters

Definition at line 1088 of file class.ilParticipants.php.

Referenced by ilCourseParticipants\__buildStatusBody().

1089  {
1090  if (isset($this->participants_status[$a_usr_id])) {
1091  return $this->participants_status[$a_usr_id]['notification'] ? true : false;
1092  }
1093  return false;
1094  }
+ Here is the caller graph for this function:

◆ isSubscriber()

ilParticipants::isSubscriber (   $a_usr_id)

check if is subscriber

public

Definition at line 1561 of file class.ilParticipants.php.

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

Referenced by assignSubscriber().

1562  {
1563  global $DIC;
1564 
1565  $ilDB = $DIC['ilDB'];
1566 
1567  $query = "SELECT * FROM il_subscribers " .
1568  "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1569  "AND obj_id = " . $ilDB->quote($this->obj_id, 'integer') . "";
1570 
1571  $res = $ilDB->query($query);
1572  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1573  return true;
1574  }
1575  return false;
1576  }
foreach($_POST as $key=> $value) $res
$query
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ isTutor()

ilParticipants::isTutor (   $a_usr_id)

is user tutor

public

Parameters
intusr_id

Definition at line 656 of file class.ilParticipants.php.

Referenced by ilCourseParticipants\__buildStatusBody(), and getNotificationRecipients().

657  {
658  return in_array($a_usr_id, $this->tutors) ? true : false;
659  }
+ Here is the caller graph for this function:

◆ lookupNumberOfMembers()

static ilParticipants::lookupNumberOfMembers (   $a_ref_id)
static

Lookup number of members ilRbacReview $rbacreview <type> $ilObjDataCache.

Parameters
<type>$a_ref_id
Returns
int

Definition at line 354 of file class.ilParticipants.php.

References $DIC.

Referenced by ilObjGroup\handleAutoFill(), and ilObjCourse\handleAutoFill().

355  {
356  global $DIC;
357 
358  $rbacreview = $DIC->rbac()->review();
359  $ilObjDataCache = $DIC['ilObjDataCache'];
360 
361  $has_policies = $rbacreview->getLocalPolicies($a_ref_id);
362 
363  if (!$has_policies) {
364  return 0;
365  }
366  $lroles = $rbacreview->getRolesOfRoleFolder($a_ref_id, false);
367 
368  $memberRoles = array();
369  foreach ($lroles as $role_id) {
370  $title = $ilObjDataCache->lookupTitle($role_id);
371  switch (substr($title, 0, 8)) {
372  case 'il_crs_a':
373  case 'il_crs_t':
374  case 'il_grp_a':
375  break;
376 
377  default:
378  $memberRoles[] = $role_id;
379  break;
380  }
381  }
382  return $rbacreview->getNumberOfAssignedUsers($memberRoles);
383  }
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ lookupNumberOfParticipants()

static ilParticipants::lookupNumberOfParticipants (   $a_ref_id)
static

Lookup the number of participants (crs admins, tutors, members, grp admins, members)

ilRbacReview $rbacreview

Parameters
int$a_ref_id

Definition at line 337 of file class.ilParticipants.php.

References $DIC.

338  {
339  global $DIC;
340 
341  $rbacreview = $DIC['rbacreview'];
342 
343  $lroles = $rbacreview->getRolesOfRoleFolder($a_ref_id, false);
344  return $rbacreview->getNumberOfAssignedUsers($lroles);
345  }
$DIC
Definition: xapitoken.php:46

◆ lookupSubscribers()

static ilParticipants::lookupSubscribers (   $a_obj_id)
static

Definition at line 1303 of file class.ilParticipants.php.

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

1304  {
1305  global $DIC;
1306 
1307  $ilDB = $DIC['ilDB'];
1308 
1309  $subscribers = array();
1310  $query = "SELECT usr_id FROM il_subscribers " .
1311  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
1312  "ORDER BY sub_time ";
1313 
1314  $res = $ilDB->query($query);
1315  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1316  $subscribers[] = $row->usr_id;
1317  }
1318  return $subscribers;
1319  }
foreach($_POST as $key=> $value) $res
$query
$DIC
Definition: xapitoken.php:46

◆ lookupSubscribersData()

static ilParticipants::lookupSubscribersData (   $a_obj_id)
static

Definition at line 1653 of file class.ilParticipants.php.

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

Referenced by ilSubscriberTableGUI\readSubscriberData().

1654  {
1655  global $DIC;
1656 
1657  $ilDB = $DIC['ilDB'];
1658 
1659  $query = 'SELECT * FROM il_subscribers ' .
1660  'WHERE obj_id = ' . $ilDB->quote($a_obj_id, 'integer');
1661  $res = $ilDB->query($query);
1662 
1663  $data = array();
1664  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1665  $data[$row->usr_id]['time'] = $row->sub_time;
1666  $data[$row->usr_id]['usr_id'] = $row->usr_id;
1667  $data[$row->usr_id]['subject'] = $row->subject;
1668  }
1669  return $data;
1670  }
$data
Definition: storeScorm.php:23
foreach($_POST as $key=> $value) $res
$query
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ readParticipants()

ilParticipants::readParticipants ( )
protected

Read participants.

private

Parameters

Definition at line 1132 of file class.ilParticipants.php.

References $DIC, $GLOBALS, $ilLog, $participants, IL_CRS_ADMIN, IL_CRS_MEMBER, IL_CRS_TUTOR, IL_GRP_ADMIN, IL_GRP_MEMBER, IL_LSO_ADMIN, IL_LSO_MEMBER, IL_ROLE_POSITION_ADMIN, IL_ROLE_POSITION_MEMBER, IL_ROLE_POSITION_TUTOR, and IL_SESS_MEMBER.

Referenced by __construct(), delete(), and updateRoleAssignments().

1133  {
1134  global $DIC;
1135 
1136  $rbacreview = $DIC['rbacreview'];
1137  $ilObjDataCache = $DIC['ilObjDataCache'];
1138  $ilLog = $DIC['ilLog'];
1139 
1140  $GLOBALS['DIC']['rbacreview']->clearCaches();
1141  $this->roles = $rbacreview->getRolesOfRoleFolder($this->ref_id, false);
1142 
1143  $users = array();
1144  $this->participants = array();
1145  $this->members = $this->admins = $this->tutors = array();
1146 
1147  $additional_roles = [];
1148  $auto_generated_roles = [];
1149  foreach ($this->roles as $role_id) {
1150  $title = $ilObjDataCache->lookupTitle($role_id);
1151  switch (substr($title, 0, 8)) {
1152  case 'il_crs_m':
1153  $auto_generated_roles[$role_id] = IL_ROLE_POSITION_MEMBER;
1154  $this->role_data[IL_CRS_MEMBER] = $role_id;
1155  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1156  $this->members = array_unique(array_merge($assigned, $this->members));
1157  $this->role_assignments[$role_id] = $assigned;
1158  break;
1159 
1160  case 'il_crs_a':
1161  $auto_generated_roles[$role_id] = IL_ROLE_POSITION_ADMIN;
1162  $this->role_data[IL_CRS_ADMIN] = $role_id;
1163  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1164  $this->admins = $rbacreview->assignedUsers($role_id);
1165  $this->role_assignments[$role_id] = $assigned;
1166  break;
1167 
1168  case 'il_crs_t':
1169  $auto_generated_roles[$role_id] = IL_ROLE_POSITION_TUTOR;
1170  $this->role_data[IL_CRS_TUTOR] = $role_id;
1171  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1172  $this->tutors = $rbacreview->assignedUsers($role_id);
1173  $this->role_assignments[$role_id] = $assigned;
1174  break;
1175 
1176  case 'il_grp_a':
1177  $auto_generated_roles[$role_id] = IL_ROLE_POSITION_ADMIN;
1178  $this->role_data[IL_GRP_ADMIN] = $role_id;
1179  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1180  $this->admins = $rbacreview->assignedUsers($role_id);
1181  $this->role_assignments[$role_id] = $assigned;
1182  break;
1183 
1184  case 'il_grp_m':
1185  $auto_generated_roles[$role_id] = IL_ROLE_POSITION_MEMBER;
1186  $this->role_data[IL_GRP_MEMBER] = $role_id;
1187  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1188  $this->members = $rbacreview->assignedUsers($role_id);
1189  $this->role_assignments[$role_id] = $assigned;
1190  break;
1191 
1192  case 'il_sess_':
1193  $this->role_data[IL_SESS_MEMBER] = $role_id;
1194  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1195  $this->members = $rbacreview->assignedUsers($role_id);
1196  break;
1197 
1198  case 'il_lso_m':
1199  $auto_generated_roles[$role_id] = IL_ROLE_POSITION_MEMBER;
1200  $this->role_data[IL_LSO_MEMBER] = $role_id;
1201  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1202  $this->members = $rbacreview->assignedUsers($role_id);
1203  $this->role_assignments[$role_id] = $assigned;
1204  break;
1205 
1206  case 'il_lso_a':
1207  $auto_generated_roles[$role_id] = IL_ROLE_POSITION_ADMIN;
1208  $this->role_data[IL_LSO_ADMIN] = $role_id;
1209  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1210  $this->admins = $rbacreview->assignedUsers($role_id);
1211  $this->role_assignments[$role_id] = $assigned;
1212  break;
1213 
1214  default:
1215  $additional_roles[$role_id] = $title;
1216  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1217  $this->members = array_unique(array_merge($assigned, $this->members));
1218  $this->role_assignments[$role_id] = $assigned;
1219  break;
1220  }
1221  }
1222  asort($auto_generated_roles);
1223  asort($additional_roles);
1224  $this->roles_sorted = $auto_generated_roles + $additional_roles;
1225  }
const IL_LSO_MEMBER
const IL_GRP_ADMIN
const IL_CRS_TUTOR
const IL_GRP_MEMBER
const IL_ROLE_POSITION_MEMBER
const IL_LSO_ADMIN
const IL_CRS_MEMBER
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
const IL_CRS_ADMIN
Base class for course and group participants.
$DIC
Definition: xapitoken.php:46
const IL_ROLE_POSITION_ADMIN
const IL_SESS_MEMBER
const IL_ROLE_POSITION_TUTOR
+ Here is the caller graph for this function:

◆ readParticipantsStatus()

ilParticipants::readParticipantsStatus ( )
protected

Read status of participants (blocked, notification, passed)

private

Parameters

Definition at line 1234 of file class.ilParticipants.php.

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

Referenced by __construct(), delete(), and updateRoleAssignments().

1235  {
1236  global $DIC;
1237 
1238  $ilDB = $DIC['ilDB'];
1239 
1240  $query = "SELECT * FROM obj_members " .
1241  "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " ";
1242  $res = $ilDB->query($query);
1243  $this->participants_status = array();
1244  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1245  $this->participants_status[$row->usr_id]['blocked'] = $row->blocked;
1246  $this->participants_status[$row->usr_id]['notification'] = $row->notification;
1247  $this->participants_status[$row->usr_id]['passed'] = $row->passed;
1248  // cognos-blu-patch: begin
1249  $this->participants_status[$row->usr_id]['contact'] = $row->contact;
1250  // cognos-blu-patch: end
1251  }
1252  }
foreach($_POST as $key=> $value) $res
$query
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ readSubscriberData()

ilParticipants::readSubscriberData (   $a_usr_id)
protected

read subscribers

protected

Definition at line 1634 of file class.ilParticipants.php.

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

Referenced by getSubscriberData().

1635  {
1636  global $DIC;
1637 
1638  $ilDB = $DIC['ilDB'];
1639 
1640  $query = "SELECT * FROM il_subscribers " .
1641  "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
1642  "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer') . "";
1643 
1644  $res = $this->ilDB->query($query);
1645  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1646  $data["time"] = $row->sub_time;
1647  $data["usr_id"] = $row->usr_id;
1648  $data['subject'] = $row->subject;
1649  }
1650  return $data ? $data : array();
1651  }
$data
Definition: storeScorm.php:23
foreach($_POST as $key=> $value) $res
$query
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ readSubscribers()

ilParticipants::readSubscribers ( )
protected

read subscribers

protected

Definition at line 1606 of file class.ilParticipants.php.

References $DIC, $ilDB, $query, $res, deleteSubscriber(), ilDBConstants\FETCHMODE_OBJECT, and ilObjectFactory\getInstanceByObjId().

Referenced by autoFillSubscribers(), and getSubscribers().

1607  {
1608  global $DIC;
1609 
1610  $ilDB = $DIC['ilDB'];
1611 
1612  $this->subscribers = array();
1613 
1614  $query = "SELECT usr_id FROM il_subscribers " .
1615  "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
1616  "ORDER BY sub_time ";
1617 
1618  $res = $this->ilDB->query($query);
1619  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1620  // DELETE SUBSCRIPTION IF USER HAS BEEN DELETED
1621  if (!ilObjectFactory::getInstanceByObjId($row->usr_id, false)) {
1622  $this->deleteSubscriber($row->usr_id);
1623  }
1624  $this->subscribers[] = $row->usr_id;
1625  }
1626  return true;
1627  }
deleteSubscriber($a_usr_id)
Delete subsciber.
foreach($_POST as $key=> $value) $res
$query
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setRoleOrderPosition()

ilParticipants::setRoleOrderPosition (   $a_user_id)

Set role order position.

Parameters
int$a_user_id
Returns
string

Definition at line 1725 of file class.ilParticipants.php.

1726  {
1727  $counter = 0;
1728  $sortable_assignments = '9999999999';
1729  foreach ($this->roles_sorted as $role_id => $trash) {
1730  if (in_array($a_user_id, (array) $this->role_assignments[$role_id])) {
1731  $sortable_assignments = substr_replace($sortable_assignments, '1', $counter, 1);
1732  }
1733  ++$counter;
1734  }
1735  return $sortable_assignments;
1736  }

◆ updateBlocked()

ilParticipants::updateBlocked (   $a_usr_id,
  $a_blocked 
)

Update blocked status.

public

Parameters
intusr_id
boolblocked

Definition at line 859 of file class.ilParticipants.php.

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

860  {
861  global $DIC;
862 
863  $ilDB = $DIC['ilDB'];
864 
865  $this->participants_status[$a_usr_id]['blocked'] = (int) $a_blocked;
866 
867  $query = "SELECT * FROM obj_members " .
868  "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
869  "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer');
870  $res = $ilDB->query($query);
871  if ($res->numRows()) {
872  $query = "UPDATE obj_members SET " .
873  "blocked = " . $ilDB->quote((int) $a_blocked, 'integer') . " " .
874  "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
875  "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer');
876  } else {
877  $query = "INSERT INTO obj_members (blocked,obj_id,usr_id,notification,passed) " .
878  "VALUES ( " .
879  $ilDB->quote((int) $a_blocked, 'integer') . ", " .
880  $ilDB->quote($this->obj_id, 'integer') . ", " .
881  $ilDB->quote($a_usr_id, 'integer') . ", " .
882  $ilDB->quote(0, 'integer') . ", " .
883  $ilDB->quote(0, 'integer') .
884  ")";
885  }
886  $res = $ilDB->manipulate($query);
887  return true;
888  }
foreach($_POST as $key=> $value) $res
$query
$DIC
Definition: xapitoken.php:46

◆ updateContact()

ilParticipants::updateContact (   $a_usr_id,
  $a_contact 
)

Update contact setting type $ilDB.

Parameters
type$a_usr_id
type$a_contact
Returns
boolean

Definition at line 898 of file class.ilParticipants.php.

References $DIC, and $ilDB.

899  {
900  global $DIC;
901 
902  $ilDB = $DIC['ilDB'];
903 
904  $ilDB->manipulate(
905  'UPDATE obj_members SET ' .
906  'contact = ' . $ilDB->quote($a_contact, 'integer') . ' ' .
907  'WHERE obj_id = ' . $ilDB->quote($this->obj_id, 'integer') . ' ' .
908  'AND usr_id = ' . $ilDB->quote($a_usr_id, 'integer')
909  );
910 
911  $this->participants_status[$a_usr_id]['contact'] = $a_contact;
912  return true;
913  }
$DIC
Definition: xapitoken.php:46

◆ updateNotification()

ilParticipants::updateNotification (   $a_usr_id,
  $a_notification 
)

Update notification status.

public

Parameters
intusr_id
boolpassed

Definition at line 941 of file class.ilParticipants.php.

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

942  {
943  global $DIC;
944 
945  $ilDB = $DIC['ilDB'];
946 
947  $this->participants_status[$a_usr_id]['notification'] = (int) $a_notification;
948 
949  $query = "SELECT * FROM obj_members " .
950  "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
951  "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer');
952  $res = $ilDB->query($query);
953  if ($res->numRows()) {
954  $query = "UPDATE obj_members SET " .
955  "notification = " . $ilDB->quote((int) $a_notification, 'integer') . " " .
956  "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
957  "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer');
958  } else {
959  $query = "INSERT INTO obj_members (notification,obj_id,usr_id,passed,blocked) " .
960  "VALUES ( " .
961  $ilDB->quote((int) $a_notification, 'integer') . ", " .
962  $ilDB->quote($this->obj_id, 'integer') . ", " .
963  $ilDB->quote($a_usr_id, 'integer') . ", " .
964  $ilDB->quote(0, 'integer') . ", " .
965  $ilDB->quote(0, 'integer') .
966  ")";
967  }
968  $res = $ilDB->manipulate($query);
969  return true;
970  }
foreach($_POST as $key=> $value) $res
$query
$DIC
Definition: xapitoken.php:46

◆ updateRoleAssignments()

ilParticipants::updateRoleAssignments (   $a_usr_id,
  $a_roles 
)

Update role assignments.

public

Parameters
intusr_id
arrayarray of new roles

Definition at line 740 of file class.ilParticipants.php.

References $DIC, $roles, getRoles(), readParticipants(), and readParticipantsStatus().

741  {
742  global $DIC;
743 
744  $rbacreview = $DIC['rbacreview'];
745  $rbacadmin = $DIC['rbacadmin'];
746 
747  $roles = $a_roles ? $a_roles : array();
748 
749  foreach ($this->getRoles() as $role_id) {
750  if ($rbacreview->isAssigned($a_usr_id, $role_id)) {
751  if (!in_array($role_id, $roles)) {
752  $rbacadmin->deassignUser($role_id, $a_usr_id);
753  }
754  } else {
755  if (in_array($role_id, $roles)) {
756  $rbacadmin->assignUser($role_id, $a_usr_id);
757  }
758  }
759  }
760  $rbacreview->clearCaches();
761  $this->readParticipants();
762  $this->readParticipantsStatus();
763  }
readParticipantsStatus()
Read status of participants (blocked, notification, passed)
getRoles()
Get course roles.
$DIC
Definition: xapitoken.php:46
readParticipants()
Read participants.
+ Here is the call graph for this function:

◆ updateSubject()

ilParticipants::updateSubject (   $a_usr_id,
  $a_subject 
)

update subject

public

Parameters

Definition at line 1495 of file class.ilParticipants.php.

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

1496  {
1497  global $DIC;
1498 
1499  $ilDB = $DIC['ilDB'];
1500 
1501  $query = "UPDATE il_subscribers " .
1502  "SET subject = " . $ilDB->quote($a_subject, 'text') . " " .
1503  "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1504  "AND obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " ";
1505  $res = $ilDB->manipulate($query);
1506  return true;
1507  }
foreach($_POST as $key=> $value) $res
$query
$DIC
Definition: xapitoken.php:46

◆ updateSubscriptionTime()

ilParticipants::updateSubscriptionTime (   $a_usr_id,
  $a_subtime 
)

Update subscription time.

public

Definition at line 1473 of file class.ilParticipants.php.

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

1474  {
1475  global $DIC;
1476 
1477  $ilDB = $DIC['ilDB'];
1478 
1479  $query = "UPDATE il_subscribers " .
1480  "SET sub_time = " . $ilDB->quote($a_subtime, 'integer') . " " .
1481  "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1482  "AND obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " ";
1483  $res = $ilDB->manipulate($query);
1484 
1485  return true;
1486  }
foreach($_POST as $key=> $value) $res
$query
$DIC
Definition: xapitoken.php:46

Field Documentation

◆ $admins

ilParticipants::$admins = array()
protected

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

◆ $component

ilParticipants::$component = ''
protected

Definition at line 31 of file class.ilParticipants.php.

Referenced by getComponent().

◆ $ilDB

◆ $lng

ilParticipants::$lng
protected

Definition at line 58 of file class.ilParticipants.php.

◆ $logger

◆ $members

ilParticipants::$members = array()
protected

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

◆ $obj_id

◆ $participants

ilParticipants::$participants = array()
protected

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

Referenced by readParticipants().

◆ $participants_status

ilParticipants::$participants_status = array()
protected

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

◆ $recommended_content_manager

ilParticipants::$recommended_content_manager
protected

Definition at line 69 of file class.ilParticipants.php.

◆ $ref_id

◆ $role_assignments

ilParticipants::$role_assignments = []
protected

Definition at line 40 of file class.ilParticipants.php.

◆ $role_data

ilParticipants::$role_data = array()
protected

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

◆ $roles

◆ $roles_sorted

ilParticipants::$roles_sorted = []
protected

Definition at line 39 of file class.ilParticipants.php.

◆ $subscribers

ilParticipants::$subscribers = array()
protected

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

Referenced by getSubscribers(), and lookupSubscribers().

◆ $tutors

ilParticipants::$tutors = array()
protected

Definition at line 45 of file class.ilParticipants.php.

◆ $type

ilParticipants::$type = ''
protected

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