ILIAS  release_7 Revision v7.30-3-g800a261c036
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 canSendMailToMembers ( $ref_id_or_instance, ?int $usr_id=null, ?int $mail_obj_ref_id=null)
 This method was introduced as a band-aid fix for #22764. 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 499 of file class.ilParticipants.php.

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

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

500  {
501  global $DIC;
502 
503  $ilDB = $DIC['ilDB'];
504 
505  $query = "DELETE FROM obj_members " .
506  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " ";
507  $res = $ilDB->manipulate($query);
508 
509  $query = "DELETE FROM il_subscribers " .
510  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . "";
511  $res = $ilDB->manipulate($query);
512 
513  $query = 'DELETE FROM crs_waiting_list ' .
514  'WHERE obj_id = ' . $ilDB->quote($a_obj_id, 'integer');
515  $ilDB->manipulate($query);
516 
517  return true;
518  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
+ 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 528 of file class.ilParticipants.php.

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

Referenced by ilObjCourse\_deleteUser().

529  {
530  global $DIC;
531 
532  $ilDB = $DIC['ilDB'];
533 
534  $query = "DELETE FROM obj_members WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . "";
535  $res = $ilDB->manipulate($query);
536 
537  $query = "DELETE FROM il_subscribers WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . "";
538  $res = $ilDB->manipulate($query);
539 
540  include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
542  }
static _deleteUser($a_usr_id)
Delete user.
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
+ 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 1737 of file class.ilParticipants.php.

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

Referenced by ilAwarenessUserProviderCourseContacts\getInitialUserSet().

1738  {
1739  global $DIC;
1740 
1741  $ilDB = $DIC['ilDB'];
1742 
1743  // todo: join the two queries or alternatively reuse _getMembershipByType
1744  // for the first part
1745 
1746  // this will also dismiss local roles!
1747  $j2 = "JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id) ";
1748  $a2 = "AND obd2.title LIKE 'il_" . $a_type . "_mem%' ";
1749 
1750  // #14290 - no role folder anymore
1751  $query = "SELECT DISTINCT obd.obj_id,obr.ref_id FROM rbac_ua ua " .
1752  "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id " .
1753  "JOIN object_reference obr ON fa.parent = obr.ref_id " .
1754  "JOIN object_data obd ON obr.obj_id = obd.obj_id " .
1755  $j2 .
1756  "WHERE obd.type = " . $ilDB->quote($a_type, 'text') . " " .
1757  "AND fa.assign = 'y' " .
1758  "AND ua.usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1759  $a2;
1760 
1761  $res = $ilDB->query($query);
1762  $obj_ids = array();
1763  while ($row = $ilDB->fetchObject($res)) {
1764  $obj_ids[] = $row->obj_id;
1765  }
1766 
1767  $set = $ilDB->query("SELECT obj_id, usr_id FROM obj_members " .
1768  " WHERE " . $ilDB->in("obj_id", $obj_ids, false, "integer") .
1769  " AND contact = " . $ilDB->quote(1, "integer"));
1770  $res = array();
1771  while ($rec = $ilDB->fetchAssoc($set)) {
1772  $res[] = $rec;
1773  }
1774 
1775  return $res;
1776  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
+ 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 324 of file class.ilParticipants.php.

References $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().

325  {
326  global $DIC;
327 
328  $ilDB = $DIC['ilDB'];
329 
330  if (!is_array($a_type)) {
331  $a_type = array($a_type);
332  }
333 
334  // this will also dismiss local roles!
335  if ($a_only_member_role) {
336  $j2 = "JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id) ";
337  $a2 = 'AND obd2.title = ' . $ilDB->concat(
338  array(
339  array($ilDB->quote('il_', 'text')),
340  array('obd.type'),
341  array($ilDB->quote('_member_', 'text')),
342  array('obr.ref_id'),
343  ),
344  false
345  );
346  }
347 
348  // #14290 - no role folder anymore
349  $query = "SELECT DISTINCT obd.obj_id,obr.ref_id FROM rbac_ua ua " .
350  "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id " .
351  "JOIN object_reference obr ON fa.parent = obr.ref_id " .
352  "JOIN object_data obd ON obr.obj_id = obd.obj_id " .
353  $j2 .
354  "WHERE " . $ilDB->in("obd.type", $a_type, false, "text") . ' ' .
355  "AND fa.assign = 'y' " .
356  "AND ua.usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
357  'AND obr.deleted IS NULL ' .
358  $a2;
359  $res = $ilDB->query($query);
360  while ($row = $ilDB->fetchObject($res)) {
361  $ref_ids[] = $row->obj_id;
362  }
363 
364  return $ref_ids ? $ref_ids : array();
365  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
+ 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 476 of file class.ilParticipants.php.

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

Referenced by ilObjCourseAccess\checkCondition().

477  {
478  global $DIC;
479 
480  $ilDB = $DIC['ilDB'];
481 
482  $query = "SELECT * FROM obj_members " .
483  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
484  "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
485  "AND passed = '1'";
486  $res = $ilDB->query($query);
487  return $res->numRows() ? true : false;
488  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
+ 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 453 of file class.ilParticipants.php.

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

454  {
455  global $DIC;
456 
457  $ilDB = $DIC['ilDB'];
458 
459  $query = "SELECT * FROM obj_members " .
460  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
461  "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
462  "AND blocked = " . $ilDB->quote(1, 'integer');
463  $res = $ilDB->query($query);
464  return $res->numRows() ? true : false;
465  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query

◆ _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 377 of file class.ilParticipants.php.

References $DIC.

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

378  {
379  global $DIC;
380 
381  $rbacreview = $DIC['rbacreview'];
382 
383  $local_roles = $rbacreview->getRolesOfRoleFolder($a_ref_id, false);
384 
385  return $rbacreview->isAssignedToAtLeastOneGivenRole($a_usr_id, $local_roles);
386  }
global $DIC
Definition: goto.php:24
+ 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 1642 of file class.ilParticipants.php.

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

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

1643  {
1644  global $DIC;
1645 
1646  $ilDB = $DIC['ilDB'];
1647 
1648  $query = "SELECT * FROM il_subscribers " .
1649  "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1650  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . "";
1651 
1652  $res = $ilDB->query($query);
1653  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1654  return true;
1655  }
1656  return false;
1657  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
+ 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 1041 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().

1042  {
1043  global $DIC;
1044 
1045  $rbacadmin = $DIC['rbacadmin'];
1046  $ilAppEventHandler = $DIC['ilAppEventHandler'];
1047 
1048  if ($this->isAssigned($a_usr_id)) {
1049  return false;
1050  }
1051 
1052  switch ($a_role) {
1053  case IL_CRS_ADMIN:
1054  $this->admins[] = $a_usr_id;
1055  break;
1056 
1057  case IL_CRS_TUTOR:
1058  $this->tutors[] = $a_usr_id;
1059  break;
1060 
1061  case IL_CRS_MEMBER:
1062  $this->members[] = $a_usr_id;
1063  break;
1064 
1065  case IL_GRP_ADMIN:
1066  $this->admins[] = $a_usr_id;
1067  break;
1068 
1069  case IL_GRP_MEMBER:
1070  $this->members[] = $a_usr_id;
1071  break;
1072 
1073  case IL_LSO_ADMIN:
1074  $this->admins[] = $a_usr_id;
1075  break;
1076 
1077  case IL_LSO_MEMBER:
1078  $this->members[] = $a_usr_id;
1079  break;
1080 
1081  case IL_SESS_MEMBER:
1082  $this->members[] = $a_usr_id;
1083  break;
1084  }
1085 
1086  $this->participants[] = $a_usr_id;
1087  $rbacadmin->assignUser($this->role_data[$a_role], $a_usr_id);
1088 
1089  // Delete subscription request
1090  $this->deleteSubscriber($a_usr_id);
1091 
1092  include_once './Services/Membership/classes/class.ilWaitingList.php';
1093  ilWaitingList::deleteUserEntry($a_usr_id, $this->obj_id);
1094 
1095  $ilAppEventHandler->raise(
1096  $this->getComponent(),
1097  "addParticipant",
1098  array(
1099  'obj_id' => $this->obj_id,
1100  'usr_id' => $a_usr_id,
1101  'role_id' => $a_role)
1102  );
1103  return true;
1104  }
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
global $DIC
Definition: goto.php:24
const IL_CRS_ADMIN
Base class for course and group participants.
getComponent()
Get component name Used for raising events.
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 1129 of file class.ilParticipants.php.

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

1130  {
1131  // deactivated for now, see discussion at
1132  // https://docu.ilias.de/goto_docu_wiki_wpage_5620_1357.html
1133  // $this->recommended_content_manager->addObjectRecommendation($a_usr_id, $this->ref_id);
1134  return true;
1135  }
+ Here is the caller graph for this function:

◆ addSubscriber()

ilParticipants::addSubscriber (   $a_usr_id)

Add subscriber.

public

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

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

1508  {
1509  global $DIC;
1510 
1511  $ilDB = $DIC['ilDB'];
1512 
1513  $query = "INSERT INTO il_subscribers (usr_id,obj_id,subject,sub_time) " .
1514  " VALUES (" .
1515  $ilDB->quote($a_usr_id, 'integer') . "," .
1516  $ilDB->quote($this->obj_id, 'integer') . ", " .
1517  $ilDB->quote('', 'text') . ", " .
1518  $ilDB->quote(time(), 'integer') .
1519  ")";
1520  $res = $ilDB->manipulate($query);
1521 
1522  return true;
1523  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query

◆ assignSubscriber()

ilParticipants::assignSubscriber (   $a_usr_id)

Assign subscriber.

public

Definition at line 1437 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().

1438  {
1439  global $DIC;
1440 
1441  $ilErr = $DIC['ilErr'];
1442 
1443  $ilErr->setMessage("");
1444  if (!$this->isSubscriber($a_usr_id)) {
1445  $ilErr->appendMessage($this->lng->txt("crs_user_notsubscribed"));
1446 
1447  return false;
1448  }
1449  if ($this->isAssigned($a_usr_id)) {
1450  $tmp_obj = ilObjectFactory::getInstanceByObjId($a_usr_id);
1451  $ilErr->appendMessage($tmp_obj->getLogin() . ": " . $this->lng->txt("crs_user_already_assigned"));
1452 
1453  return false;
1454  }
1455 
1456  if (!$tmp_obj = &ilObjectFactory::getInstanceByObjId($a_usr_id)) {
1457  $ilErr->appendMessage($this->lng->txt("crs_user_not_exists"));
1458 
1459  return false;
1460  }
1461 
1462  // TODO: must be group or course member role
1463  if ($this instanceof ilCourseParticipants) {
1464  $this->add($tmp_obj->getId(), IL_CRS_MEMBER);
1465  }
1466  if ($this instanceof ilGroupParticipants) {
1467  $this->add($tmp_obj->getId(), IL_GRP_MEMBER);
1468  }
1469  if ($this instanceof ilLearningSequenceParticipants) {
1470  $this->add($tmp_obj->getId(), IL_LSO_MEMBER);
1471  }
1472  if ($this instanceof ilSessionParticipants) {
1473  $this->register($tmp_obj->getId());
1474  }
1475  $this->deleteSubscriber($a_usr_id);
1476  return true;
1477  }
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
global $DIC
Definition: goto.php:24
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
+ 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 1419 of file class.ilParticipants.php.

References assignSubscriber().

1420  {
1421  if (!is_array($a_usr_ids) or !count($a_usr_ids)) {
1422  return false;
1423  }
1424  foreach ($a_usr_ids as $id) {
1425  if (!$this->assignSubscriber($id)) {
1426  return false;
1427  }
1428  }
1429  return true;
1430  }
assignSubscriber($a_usr_id)
Assign subscriber.
+ Here is the call graph for this function:

◆ autoFillSubscribers()

ilParticipants::autoFillSubscribers ( )

Assign subscriber.

public

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

References assignSubscriber(), and readSubscribers().

1485  {
1486  $this->readSubscribers();
1487 
1488  $counter = 0;
1489  foreach ($this->subscribers as $subscriber) {
1490  if (!$this->assignSubscriber($subscriber)) {
1491  continue;
1492  } else {
1493  // TODO: notification
1494  #$this->sendNotification($this->NOTIFY_ACCEPT_SUBSCRIBER,$subscriber);
1495  }
1496  ++$counter;
1497  }
1498 
1499  return $counter;
1500  }
assignSubscriber($a_usr_id)
Assign subscriber.
readSubscribers()
read subscribers
+ Here is the call graph for this function:

◆ canSendMailToMembers()

static ilParticipants::canSendMailToMembers (   $ref_id_or_instance,
?int  $usr_id = null,
?int  $mail_obj_ref_id = null 
)
static

This method was introduced as a band-aid fix for #22764.

Please do not use this anywhere else.

Parameters
int | ilObject$ref_id_or_instance

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

References $DIC, $ref_id, ilObject\_getAllReferences(), ilObjectFactory\getInstanceByRefId(), ilObjSession\MAIL_ALLOWED_ALL, ilObjGroup\MAIL_ALLOWED_ALL, and ilCourseConstants\MAIL_ALLOWED_ALL.

Referenced by ilMailSearchGroupsGUI\cancel(), ilMailSearchCoursesGUI\cancel(), ilMailSearchCoursesGUI\mailCourses(), and ilMailSearchGroupsGUI\mailGroups().

213  : bool {
214  global $DIC;
215 
216  $access = $DIC->access();
217  $rbacsystem = $DIC->rbac()->system();
218 
219  if (is_null($usr_id)) {
220  $usr_id = $DIC->user()->getId();
221  }
222  if (is_null($mail_obj_ref_id)) {
223  $mail_obj_ref_id = (new ilMail($usr_id))->getMailObjectReferenceId();
224  }
225  if (is_int($ref_id_or_instance)) {
226  $ref_id = $ref_id_or_instance;
227  } elseif ($ref_id_or_instance instanceof ilObject) {
228  $ref_id = (int) $ref_id_or_instance->getRefId();
229  if ($ref_id === 0) {
230  $ref_id = array_keys(ilObject::_getAllReferences($ref_id_or_instance->getId()))[0];
231  }
232  } else {
233  return false;
234  }
235 
236  if (
237  $access->checkAccess('manage_members', '', $ref_id) &&
238  $rbacsystem->checkAccess('internal_mail', $mail_obj_ref_id)
239  ) {
240  return true;
241  }
242 
243  $part = self::getInstance($ref_id);
244  if (!$part->isAssigned($usr_id)) {
245  return false;
246  }
247 
248  $object = $ref_id_or_instance;
249  if (is_int($ref_id_or_instance)) {
250  $object = ilObjectFactory::getInstanceByRefId($ref_id_or_instance);
251  }
252 
253  if ($object instanceof ilObjCourse) {
254  return $object->getMailToMembersType() == ilCourseConstants::MAIL_ALLOWED_ALL;
255  } elseif ($object instanceof ilObjGroup) {
256  return $object->getMailToMembersType() == ilObjGroup::MAIL_ALLOWED_ALL;
257  } elseif ($object instanceof ilObjSession) {
258  return $object->getMailToMembersType() == ilObjSession::MAIL_ALLOWED_ALL;
259  }
260 
261  return false;
262  }
static _getAllReferences($a_id)
get all reference ids of object
global $DIC
Definition: goto.php:24
const MAIL_ALLOWED_ALL
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
Class ilObjGroup.
+ Here is the call graph for this function:
+ Here is the caller 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 830 of file class.ilParticipants.php.

References getAdmins().

831  {
832  foreach ($this->getAdmins() as $admin_id) {
833  if (!in_array($admin_id, $a_usr_ids)) {
834  return true;
835  }
836  }
837  return false;
838  }
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 877 of file class.ilParticipants.php.

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

878  {
879  global $DIC;
880 
881  $rbacadmin = $DIC['rbacadmin'];
882  $ilDB = $DIC['ilDB'];
883 
884  $this->recommended_content_manager->removeObjectRecommendation($a_usr_id, $this->ref_id);
885 
886  foreach ($this->roles as $role_id) {
887  $rbacadmin->deassignUser($role_id, $a_usr_id);
888  }
889 
890  $query = "DELETE FROM obj_members " .
891  "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
892  "AND obj_id = " . $ilDB->quote($this->obj_id, 'integer');
893  $res = $ilDB->manipulate($query);
894 
895  $this->readParticipants();
896  $this->readParticipantsStatus();
897 
898  $GLOBALS['DIC']['ilAppEventHandler']->raise(
899  $this->getComponent(),
900  "deleteParticipant",
901  array(
902  'obj_id' => $this->obj_id,
903  'usr_id' => $a_usr_id)
904  );
905 
906  return true;
907  }
readParticipantsStatus()
Read status of participants (blocked, notification, passed)
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$query
getComponent()
Get component name Used for raising events.
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 1114 of file class.ilParticipants.php.

1115  {
1116  foreach ($a_user_ids as $user_id) {
1117  $this->delete($user_id);
1118  }
1119  return true;
1120  }

◆ deleteSubscriber()

ilParticipants::deleteSubscriber (   $a_usr_id)

Delete subsciber.

public

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

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

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

1574  {
1575  global $DIC;
1576 
1577  $ilDB = $DIC['ilDB'];
1578 
1579  $query = "DELETE FROM il_subscribers " .
1580  "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1581  "AND obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " ";
1582  $res = $ilDB->manipulate($query);
1583 
1584  return true;
1585  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
+ Here is the caller graph for this function:

◆ deleteSubscribers()

ilParticipants::deleteSubscribers (   $a_usr_ids)

Delete subscibers.

public

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

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

1594  {
1595  global $DIC;
1596 
1597  $ilErr = $DIC['ilErr'];
1598  $ilDB = $DIC['ilDB'];
1599 
1600  if (!is_array($a_usr_ids) or !count($a_usr_ids)) {
1601  $ilErr->setMessage('');
1602  $ilErr->appendMessage($this->lng->txt("no_usr_ids_given"));
1603 
1604  return false;
1605  }
1606  $query = "DELETE FROM il_subscribers " .
1607  "WHERE " . $ilDB->in('usr_id', (array) $a_usr_ids, false, 'integer') . " " .
1608  "AND obj_id = " . $ilDB->quote($this->obj_id, 'integer');
1609  $res = $ilDB->query($query);
1610  return true;
1611  }
$ilErr
Definition: raiseError.php:18
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query

◆ getAdmins()

ilParticipants::getAdmins ( )

Get all admins ids.

public

Returns
array array of user ids

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

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

670  {
671  return $this->admins ? $this->admins : array();
672  }
+ Here is the caller graph for this function:

◆ getAssignedRoles()

ilParticipants::getAssignedRoles (   $a_usr_id)

Get assigned roles.

public

Parameters
intuser_id

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

References $DIC.

777  {
778  global $DIC;
779 
780  $rbacreview = $DIC['rbacreview'];
781 
782  foreach ($this->roles as $role) {
783  if ($rbacreview->isAssigned($a_usr_id, $role)) {
784  $assigned[] = $role;
785  }
786  }
787  return $assigned ? $assigned : array();
788  }
global $DIC
Definition: goto.php:24

◆ getAutoGeneratedRoleId()

ilParticipants::getAutoGeneratedRoleId (   $a_role_type)

Get role id of auto generated role type.

Parameters
type$a_role_type

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

1174  {
1175  if (array_key_exists($a_role_type, $this->role_data)) {
1176  return $this->role_data[$a_role_type];
1177  }
1178 
1179  return 0;
1180  }

◆ 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 977 of file class.ilParticipants.php.

978  {
979  $contacts = array();
980  foreach ((array) $this->participants_status as $usr_id => $status) {
981  if ($status['contact']) {
982  $contacts[] = $usr_id;
983  }
984  }
985  return $contacts;
986  }

◆ getCountAdmins()

ilParticipants::getCountAdmins ( )

Get number of admins.

Returns

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

References getAdmins().

679  {
680  return count($this->getAdmins());
681  }
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 622 of file class.ilParticipants.php.

623  {
624  return count($this->members);
625  }

◆ getCountParticipants()

ilParticipants::getCountParticipants ( )

Get number of participants.

public

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

634  {
635  return count($this->participants);
636  }

◆ getCountSubscribers()

ilParticipants::getCountSubscribers ( )

get number of subscribers

public

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

References getSubscribers().

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

◆ getDefaultMemberRole()

static ilParticipants::getDefaultMemberRole (   $a_ref_id)
static

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

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

Referenced by ilStartUpGUI\_checkGoto(), ilCourseRegistrationGUI\add(), ilRepositorySearchGUI\addRole(), ilContainerImporter\finalProcessing(), ilRbacSystem\initMemberView(), ilSkillProfileGUI\saveLocal(), ilContainerGlobalProfiles\setMemberRoleId(), and ilContainerLocalProfiles\setMemberRoleId().

545  {
546  global $DIC;
547 
548  $ilCtrl = $DIC['ilCtrl'];
549 
550  $obj_id = ilObject::_lookupObjId($a_ref_id);
552 
553  if (!in_array($type, array('crs','grp'))) {
554  return 0;
555  }
556 
557  global $DIC;
558 
559  $rbacreview = $DIC['rbacreview'];
560 
561 
562  $roles = $rbacreview->getRolesOfRoleFolder($a_ref_id, false);
563 
564  foreach ($roles as $role) {
565  $title = ilObject::_lookupTitle($role);
566  if (substr($title, 0, 13) == ('il_' . $type . '_member')) {
567  return $role;
568  }
569  }
570  return 0;
571  }
static _lookupTitle($a_id)
lookup object title
static _lookupObjId($a_id)
global $DIC
Definition: goto.php:24
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:

◆ 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\__read(), 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 ilCourseParticipantsTableGUI\__construct(), ilGroupParticipantsTableGUI\__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 659 of file class.ilParticipants.php.

Referenced by ilSessionParticipants\readParticipantsStatus().

660  {
661  return $this->members ? $this->members : array();
662  }
+ 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 597 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().

598  {
599  global $DIC;
600 
601  $ilDB = $DIC['ilDB'];
602 
603  $query = "SELECT * FROM obj_members " .
604  "WHERE notification = 1 " .
605  "AND obj_id = " . $ilDB->quote($this->obj_id) . " ";
606  $res = $ilDB->query($query);
607  $recp = [];
608  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
609  if ($this->isAdmin($row->usr_id) or $this->isTutor($row->usr_id)) {
610  $recp[] = $row->usr_id;
611  }
612  }
613  return $recp;
614  }
isAdmin($a_usr_id)
is user admin
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
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 577 of file class.ilParticipants.php.

References $obj_id.

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

578  {
579  return $this->obj_id;
580  }
+ 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 647 of file class.ilParticipants.php.

Referenced by isGroupingMember().

648  {
649  return $this->participants ? $this->participants : array();
650  }
+ Here is the caller graph for this function:

◆ getRoles()

ilParticipants::getRoles ( )

Get course roles.

public

Parameters

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

Referenced by updateRoleAssignments().

765  {
766  return $this->roles ? $this->roles : array();
767  }
+ Here is the caller graph for this function:

◆ getSubscriberData()

ilParticipants::getSubscriberData (   $a_usr_id)

get subscriber data

public

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

References readSubscriberData().

1408  {
1409  return $this->readSubscriberData($a_usr_id);
1410  }
readSubscriberData($a_usr_id)
read subscribers
+ Here is the call graph for this function:

◆ getSubscribers()

ilParticipants::getSubscribers ( )

get all subscribers

public

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

References $subscribers, and readSubscribers().

Referenced by getCountSubscribers().

1385  {
1386  $this->readSubscribers();
1387 
1388  return $this->subscribers;
1389  }
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 690 of file class.ilParticipants.php.

691  {
692  return $this->tutors ? $this->tutors : array();
693  }

◆ getType()

ilParticipants::getType ( )

Get object type.

Returns
string obj_type

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

References $type.

587  {
588  return $this->type;
589  }

◆ 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 272 of file class.ilParticipants.php.

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

Referenced by ilTimingsUser\lookupTimings().

273  {
274  global $DIC;
275 
276  $logger = $DIC->logger()->mmbr();
277  $ilDB = $DIC->database();
278 
279  if ($a_only_member_roles) {
280  $j2 = "JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id) ";
281  $a2 = 'AND obd2.title = ' . $ilDB->concat(
282  array(
283  array($ilDB->quote('il_', 'text')),
284  array('obd.type'),
285  array($ilDB->quote('_member_', 'text')),
286  array('obr.ref_id'),
287  ),
288  false
289  );
290  }
291 
292  $query = "SELECT DISTINCT obd.obj_id,obr.ref_id,ua.usr_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 ' . $ilDB->in('ua.usr_id', $a_user_ids, false, 'integer') . ' ' .
300  $a2;
301 
302  $obj_ids = [];
303  $res = $ilDB->query($query);
304  while ($row = $ilDB->fetchObject($res)) {
305  $obj_ids[$row->obj_id][] = $row->usr_id;
306  }
307 
308  $logger->dump($obj_ids, \ilLogLevel::DEBUG);
309 
310  return $obj_ids;
311  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
+ 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)
global $DIC
Definition: goto.php:24
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
+ 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 862 of file class.ilParticipants.php.

Referenced by ilCourseParticipants\__buildStatusBody().

863  {
864  if (isset($this->participants_status[$a_usr_id])) {
865  return $this->participants_status[$a_usr_id]['passed'] ? true : false;
866  }
867  return false;
868  }
+ Here is the caller graph for this function:

◆ isAdmin()

ilParticipants::isAdmin (   $a_usr_id)

is user admin

public

Parameters
intusr_id

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

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

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

◆ isAssigned()

ilParticipants::isAssigned (   $a_usr_id)

check if user is assigned

public

Parameters

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

Referenced by add(), and assignSubscriber().

742  {
743  return in_array($a_usr_id, $this->participants);
744  }
+ 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 847 of file class.ilParticipants.php.

Referenced by ilCourseParticipants\__buildStatusBody().

848  {
849  if (isset($this->participants_status[$a_usr_id])) {
850  return $this->participants_status[$a_usr_id]['blocked'] ? true : false;
851  }
852  return false;
853  }
+ 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 1159 of file class.ilParticipants.php.

1160  {
1161  if (isset($this->participants_status[$a_usr_id])) {
1162  return (bool) $this->participants_status[$a_usr_id]['contact'];
1163  }
1164  return false;
1165  }

◆ isGroupingMember()

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

Check grouping membership.

public

Parameters

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

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

1320  {
1321  global $DIC;
1322 
1323  $rbacreview = $DIC['rbacreview'];
1324  $ilObjDataCache = $DIC['ilObjDataCache'];
1325  $ilDB = $DIC['ilDB'];
1326 
1327  // Used for membership limitations -> check membership by given field
1328  if ($a_field) {
1329  include_once './Services/User/classes/class.ilObjUser.php';
1330 
1331  $tmp_user = &ilObjectFactory::getInstanceByObjId($a_usr_id);
1332  switch ($a_field) {
1333  case 'login':
1334  $and = "AND login = " . $ilDB->quote($tmp_user->getLogin(), 'text') . " ";
1335  break;
1336  case 'email':
1337  $and = "AND email = " . $ilDB->quote($tmp_user->getEmail(), 'text') . " ";
1338  break;
1339  case 'matriculation':
1340  $and = "AND matriculation = " . $ilDB->quote($tmp_user->getMatriculation(), 'text') . " ";
1341  break;
1342 
1343  default:
1344  $and = "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " ";
1345  break;
1346  }
1347 
1348  if (!$this->getParticipants()) {
1349  return false;
1350  }
1351 
1352  $query = "SELECT * FROM usr_data ud " .
1353  "WHERE " . $ilDB->in('usr_id', $this->getParticipants(), false, 'integer') . " " .
1354  $and;
1355 
1356  $res = $ilDB->query($query);
1357  return $res->numRows() ? true : false;
1358  }
1359  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
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
+ 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 751 of file class.ilParticipants.php.

References getAdmins().

752  {
753  return in_array($a_usr_id, $this->getAdmins()) and count($this->getAdmins()) == 1;
754  }
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 726 of file class.ilParticipants.php.

Referenced by ilCourseParticipants\__buildStatusBody().

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

◆ isNotificationEnabled()

ilParticipants::isNotificationEnabled (   $a_usr_id)

check if notification is enabled

public

Parameters

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

Referenced by ilCourseParticipants\__buildStatusBody().

1147  {
1148  if (isset($this->participants_status[$a_usr_id])) {
1149  return $this->participants_status[$a_usr_id]['notification'] ? true : false;
1150  }
1151  return false;
1152  }
+ Here is the caller graph for this function:

◆ isSubscriber()

ilParticipants::isSubscriber (   $a_usr_id)

check if is subscriber

public

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

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

Referenced by assignSubscriber().

1620  {
1621  global $DIC;
1622 
1623  $ilDB = $DIC['ilDB'];
1624 
1625  $query = "SELECT * FROM il_subscribers " .
1626  "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1627  "AND obj_id = " . $ilDB->quote($this->obj_id, 'integer') . "";
1628 
1629  $res = $ilDB->query($query);
1630  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1631  return true;
1632  }
1633  return false;
1634  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
+ Here is the caller graph for this function:

◆ isTutor()

ilParticipants::isTutor (   $a_usr_id)

is user tutor

public

Parameters
intusr_id

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

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

715  {
716  return in_array($a_usr_id, $this->tutors) ? true : false;
717  }
+ 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 412 of file class.ilParticipants.php.

References $DIC.

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

413  {
414  global $DIC;
415 
416  $rbacreview = $DIC->rbac()->review();
417  $ilObjDataCache = $DIC['ilObjDataCache'];
418 
419  $has_policies = $rbacreview->getLocalPolicies($a_ref_id);
420 
421  if (!$has_policies) {
422  return 0;
423  }
424  $lroles = $rbacreview->getRolesOfRoleFolder($a_ref_id, false);
425 
426  $memberRoles = array();
427  foreach ($lroles as $role_id) {
428  $title = $ilObjDataCache->lookupTitle($role_id);
429  switch (substr($title, 0, 8)) {
430  case 'il_crs_a':
431  case 'il_crs_t':
432  case 'il_grp_a':
433  break;
434 
435  default:
436  $memberRoles[] = $role_id;
437  break;
438  }
439  }
440  return $rbacreview->getNumberOfAssignedUsers($memberRoles);
441  }
global $DIC
Definition: goto.php:24
+ 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 395 of file class.ilParticipants.php.

References $DIC.

396  {
397  global $DIC;
398 
399  $rbacreview = $DIC['rbacreview'];
400 
401  $lroles = $rbacreview->getRolesOfRoleFolder($a_ref_id, false);
402  return $rbacreview->getNumberOfAssignedUsers($lroles);
403  }
global $DIC
Definition: goto.php:24

◆ lookupSubscribers()

static ilParticipants::lookupSubscribers (   $a_obj_id)
static

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

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

1362  {
1363  global $DIC;
1364 
1365  $ilDB = $DIC['ilDB'];
1366 
1367  $subscribers = array();
1368  $query = "SELECT usr_id FROM il_subscribers " .
1369  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
1370  "ORDER BY sub_time ";
1371 
1372  $res = $ilDB->query($query);
1373  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1374  $subscribers[] = $row->usr_id;
1375  }
1376  return $subscribers;
1377  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query

◆ lookupSubscribersData()

static ilParticipants::lookupSubscribersData (   $a_obj_id)
static

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

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

Referenced by ilSubscriberTableGUI\readSubscriberData().

1712  {
1713  global $DIC;
1714 
1715  $ilDB = $DIC['ilDB'];
1716 
1717  $query = 'SELECT * FROM il_subscribers ' .
1718  'WHERE obj_id = ' . $ilDB->quote($a_obj_id, 'integer');
1719  $res = $ilDB->query($query);
1720 
1721  $data = array();
1722  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1723  $data[$row->usr_id]['time'] = $row->sub_time;
1724  $data[$row->usr_id]['usr_id'] = $row->usr_id;
1725  $data[$row->usr_id]['subject'] = $row->subject;
1726  }
1727  return $data;
1728  }
$data
Definition: storeScorm.php:23
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
+ Here is the caller graph for this function:

◆ readParticipants()

ilParticipants::readParticipants ( )
protected

Read participants.

private

Parameters

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

References $DIC, $GLOBALS, $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().

1191  {
1192  global $DIC;
1193 
1194  $rbacreview = $DIC['rbacreview'];
1195  $ilObjDataCache = $DIC['ilObjDataCache'];
1196  $ilLog = $DIC['ilLog'];
1197 
1198  $GLOBALS['DIC']['rbacreview']->clearCaches();
1199  $this->roles = $rbacreview->getRolesOfRoleFolder($this->ref_id, false);
1200 
1201  $users = array();
1202  $this->participants = array();
1203  $this->members = $this->admins = $this->tutors = array();
1204 
1205  $additional_roles = [];
1206  $auto_generated_roles = [];
1207  foreach ($this->roles as $role_id) {
1208  $title = $ilObjDataCache->lookupTitle($role_id);
1209  switch (substr($title, 0, 8)) {
1210  case 'il_crs_m':
1211  $auto_generated_roles[$role_id] = IL_ROLE_POSITION_MEMBER;
1212  $this->role_data[IL_CRS_MEMBER] = $role_id;
1213  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1214  $this->members = array_unique(array_merge($assigned, $this->members));
1215  $this->role_assignments[$role_id] = $assigned;
1216  break;
1217 
1218  case 'il_crs_a':
1219  $auto_generated_roles[$role_id] = IL_ROLE_POSITION_ADMIN;
1220  $this->role_data[IL_CRS_ADMIN] = $role_id;
1221  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1222  $this->admins = $rbacreview->assignedUsers($role_id);
1223  $this->role_assignments[$role_id] = $assigned;
1224  break;
1225 
1226  case 'il_crs_t':
1227  $auto_generated_roles[$role_id] = IL_ROLE_POSITION_TUTOR;
1228  $this->role_data[IL_CRS_TUTOR] = $role_id;
1229  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1230  $this->tutors = $rbacreview->assignedUsers($role_id);
1231  $this->role_assignments[$role_id] = $assigned;
1232  break;
1233 
1234  case 'il_grp_a':
1235  $auto_generated_roles[$role_id] = IL_ROLE_POSITION_ADMIN;
1236  $this->role_data[IL_GRP_ADMIN] = $role_id;
1237  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1238  $this->admins = $rbacreview->assignedUsers($role_id);
1239  $this->role_assignments[$role_id] = $assigned;
1240  break;
1241 
1242  case 'il_grp_m':
1243  $auto_generated_roles[$role_id] = IL_ROLE_POSITION_MEMBER;
1244  $this->role_data[IL_GRP_MEMBER] = $role_id;
1245  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1246  $this->members = $rbacreview->assignedUsers($role_id);
1247  $this->role_assignments[$role_id] = $assigned;
1248  break;
1249 
1250  case 'il_sess_':
1251  $this->role_data[IL_SESS_MEMBER] = $role_id;
1252  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1253  $this->members = $rbacreview->assignedUsers($role_id);
1254  break;
1255 
1256  case 'il_lso_m':
1257  $auto_generated_roles[$role_id] = IL_ROLE_POSITION_MEMBER;
1258  $this->role_data[IL_LSO_MEMBER] = $role_id;
1259  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1260  $this->members = $rbacreview->assignedUsers($role_id);
1261  $this->role_assignments[$role_id] = $assigned;
1262  break;
1263 
1264  case 'il_lso_a':
1265  $auto_generated_roles[$role_id] = IL_ROLE_POSITION_ADMIN;
1266  $this->role_data[IL_LSO_ADMIN] = $role_id;
1267  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1268  $this->admins = $rbacreview->assignedUsers($role_id);
1269  $this->role_assignments[$role_id] = $assigned;
1270  break;
1271 
1272  default:
1273  $additional_roles[$role_id] = $title;
1274  $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1275  $this->members = array_unique(array_merge($assigned, $this->members));
1276  $this->role_assignments[$role_id] = $assigned;
1277  break;
1278  }
1279  }
1280  asort($auto_generated_roles);
1281  asort($additional_roles);
1282  $this->roles_sorted = $auto_generated_roles + $additional_roles;
1283  }
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
global $DIC
Definition: goto.php:24
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
const IL_CRS_ADMIN
Base class for course and group participants.
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 1292 of file class.ilParticipants.php.

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

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

1293  {
1294  global $DIC;
1295 
1296  $ilDB = $DIC['ilDB'];
1297 
1298  $query = "SELECT * FROM obj_members " .
1299  "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " ";
1300  $res = $ilDB->query($query);
1301  $this->participants_status = array();
1302  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1303  $this->participants_status[$row->usr_id]['blocked'] = $row->blocked;
1304  $this->participants_status[$row->usr_id]['notification'] = $row->notification;
1305  $this->participants_status[$row->usr_id]['passed'] = $row->passed;
1306  // cognos-blu-patch: begin
1307  $this->participants_status[$row->usr_id]['contact'] = $row->contact;
1308  // cognos-blu-patch: end
1309  }
1310  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
+ Here is the caller graph for this function:

◆ readSubscriberData()

ilParticipants::readSubscriberData (   $a_usr_id)
protected

read subscribers

protected

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

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

Referenced by getSubscriberData().

1693  {
1694  global $DIC;
1695 
1696  $ilDB = $DIC['ilDB'];
1697 
1698  $query = "SELECT * FROM il_subscribers " .
1699  "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
1700  "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer') . "";
1701 
1702  $res = $this->ilDB->query($query);
1703  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1704  $data["time"] = $row->sub_time;
1705  $data["usr_id"] = $row->usr_id;
1706  $data['subject'] = $row->subject;
1707  }
1708  return $data ? $data : array();
1709  }
$data
Definition: storeScorm.php:23
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
+ Here is the caller graph for this function:

◆ readSubscribers()

ilParticipants::readSubscribers ( )
protected

read subscribers

protected

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

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

Referenced by autoFillSubscribers(), and getSubscribers().

1665  {
1666  global $DIC;
1667 
1668  $ilDB = $DIC['ilDB'];
1669 
1670  $this->subscribers = array();
1671 
1672  $query = "SELECT usr_id FROM il_subscribers " .
1673  "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
1674  "ORDER BY sub_time ";
1675 
1676  $res = $this->ilDB->query($query);
1677  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1678  // DELETE SUBSCRIPTION IF USER HAS BEEN DELETED
1679  if (!ilObjectFactory::getInstanceByObjId($row->usr_id, false)) {
1680  $this->deleteSubscriber($row->usr_id);
1681  }
1682  $this->subscribers[] = $row->usr_id;
1683  }
1684  return true;
1685  }
deleteSubscriber($a_usr_id)
Delete subsciber.
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
+ 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 1783 of file class.ilParticipants.php.

1784  {
1785  $counter = 0;
1786  $sortable_assignments = '9999999999';
1787  foreach ($this->roles_sorted as $role_id => $trash) {
1788  if (in_array($a_user_id, (array) $this->role_assignments[$role_id])) {
1789  $sortable_assignments = substr_replace($sortable_assignments, '1', $counter, 1);
1790  }
1791  ++$counter;
1792  }
1793  return $sortable_assignments;
1794  }

◆ updateBlocked()

ilParticipants::updateBlocked (   $a_usr_id,
  $a_blocked 
)

Update blocked status.

public

Parameters
intusr_id
boolblocked

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

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

918  {
919  global $DIC;
920 
921  $ilDB = $DIC['ilDB'];
922 
923  $this->participants_status[$a_usr_id]['blocked'] = (int) $a_blocked;
924 
925  $query = "SELECT * FROM obj_members " .
926  "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
927  "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer');
928  $res = $ilDB->query($query);
929  if ($res->numRows()) {
930  $query = "UPDATE obj_members SET " .
931  "blocked = " . $ilDB->quote((int) $a_blocked, 'integer') . " " .
932  "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
933  "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer');
934  } else {
935  $query = "INSERT INTO obj_members (blocked,obj_id,usr_id,notification,passed) " .
936  "VALUES ( " .
937  $ilDB->quote((int) $a_blocked, 'integer') . ", " .
938  $ilDB->quote($this->obj_id, 'integer') . ", " .
939  $ilDB->quote($a_usr_id, 'integer') . ", " .
940  $ilDB->quote(0, 'integer') . ", " .
941  $ilDB->quote(0, 'integer') .
942  ")";
943  }
944  $res = $ilDB->manipulate($query);
945  return true;
946  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query

◆ 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 956 of file class.ilParticipants.php.

References $DIC, and $ilDB.

957  {
958  global $DIC;
959 
960  $ilDB = $DIC['ilDB'];
961 
962  $ilDB->manipulate(
963  'UPDATE obj_members SET ' .
964  'contact = ' . $ilDB->quote($a_contact, 'integer') . ' ' .
965  'WHERE obj_id = ' . $ilDB->quote($this->obj_id, 'integer') . ' ' .
966  'AND usr_id = ' . $ilDB->quote($a_usr_id, 'integer')
967  );
968 
969  $this->participants_status[$a_usr_id]['contact'] = $a_contact;
970  return true;
971  }
global $DIC
Definition: goto.php:24

◆ updateNotification()

ilParticipants::updateNotification (   $a_usr_id,
  $a_notification 
)

Update notification status.

public

Parameters
intusr_id
boolpassed

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

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

1000  {
1001  global $DIC;
1002 
1003  $ilDB = $DIC['ilDB'];
1004 
1005  $this->participants_status[$a_usr_id]['notification'] = (int) $a_notification;
1006 
1007  $query = "SELECT * FROM obj_members " .
1008  "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
1009  "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer');
1010  $res = $ilDB->query($query);
1011  if ($res->numRows()) {
1012  $query = "UPDATE obj_members SET " .
1013  "notification = " . $ilDB->quote((int) $a_notification, 'integer') . " " .
1014  "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
1015  "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer');
1016  } else {
1017  $query = "INSERT INTO obj_members (notification,obj_id,usr_id,passed,blocked) " .
1018  "VALUES ( " .
1019  $ilDB->quote((int) $a_notification, 'integer') . ", " .
1020  $ilDB->quote($this->obj_id, 'integer') . ", " .
1021  $ilDB->quote($a_usr_id, 'integer') . ", " .
1022  $ilDB->quote(0, 'integer') . ", " .
1023  $ilDB->quote(0, 'integer') .
1024  ")";
1025  }
1026  $res = $ilDB->manipulate($query);
1027  return true;
1028  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query

◆ updateRoleAssignments()

ilParticipants::updateRoleAssignments (   $a_usr_id,
  $a_roles 
)

Update role assignments.

public

Parameters
intusr_id
arrayarray of new roles

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

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

799  {
800  global $DIC;
801 
802  $rbacreview = $DIC['rbacreview'];
803  $rbacadmin = $DIC['rbacadmin'];
804 
805  $roles = $a_roles ? $a_roles : array();
806 
807  foreach ($this->getRoles() as $role_id) {
808  if ($rbacreview->isAssigned($a_usr_id, $role_id)) {
809  if (!in_array($role_id, $roles)) {
810  $rbacadmin->deassignUser($role_id, $a_usr_id);
811  }
812  } else {
813  if (in_array($role_id, $roles)) {
814  $rbacadmin->assignUser($role_id, $a_usr_id);
815  }
816  }
817  }
818  $rbacreview->clearCaches();
819  $this->readParticipants();
820  $this->readParticipantsStatus();
821  }
readParticipantsStatus()
Read status of participants (blocked, notification, passed)
global $DIC
Definition: goto.php:24
getRoles()
Get course roles.
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 1553 of file class.ilParticipants.php.

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

1554  {
1555  global $DIC;
1556 
1557  $ilDB = $DIC['ilDB'];
1558 
1559  $query = "UPDATE il_subscribers " .
1560  "SET subject = " . $ilDB->quote($a_subject, 'text') . " " .
1561  "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1562  "AND obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " ";
1563  $res = $ilDB->manipulate($query);
1564  return true;
1565  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query

◆ updateSubscriptionTime()

ilParticipants::updateSubscriptionTime (   $a_usr_id,
  $a_subtime 
)

Update subscription time.

public

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

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

1532  {
1533  global $DIC;
1534 
1535  $ilDB = $DIC['ilDB'];
1536 
1537  $query = "UPDATE il_subscribers " .
1538  "SET sub_time = " . $ilDB->quote($a_subtime, 'integer') . " " .
1539  "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1540  "AND obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " ";
1541  $res = $ilDB->manipulate($query);
1542 
1543  return true;
1544  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query

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: