ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilParticipants Class Reference

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

+ Inheritance diagram for ilParticipants:
+ Collaboration diagram for ilParticipants:

Public Member Functions

 __construct (string $a_component_name, int $a_ref_id)
 
 getObjId ()
 
 getType ()
 
 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 ()
 
 getTutors ()
 Get all tutors ids. More...
 
 isAdmin (int $a_usr_id)
 check if user is admin More...
 
 isTutor (int $a_usr_id)
 is user tutor More...
 
 isMember (int $a_usr_id)
 is user member More...
 
 isAssigned (int $a_usr_id)
 check if user is assigned More...
 
 isLastAdmin (int $a_usr_id)
 Check if user is last admin. More...
 
 getRoles ()
 Get object roles. More...
 
 getAssignedRoles (int $a_usr_id)
 Get assigned roles. More...
 
 updateRoleAssignments ($a_usr_id, $a_roles)
 Update role assignments public. More...
 
 checkLastAdmin (array $a_usr_ids)
 Check if users for deletion are last admins public. More...
 
 isBlocked (int $a_usr_id)
 Check if user is blocked. More...
 
 hasPassed (int $a_usr_id)
 Check if user has passed object. More...
 
 delete (int $a_usr_id)
 Drop user from all roles. More...
 
 updateBlocked (int $a_usr_id, bool $a_blocked)
 Update blocked status. More...
 
 updateContact (int $a_usr_id, bool $a_contact)
 
 getContacts ()
 get user ids which are confirgured as contact More...
 
 updateNotification (int $a_usr_id, bool $a_notification)
 Update notification status. More...
 
 add (int $a_usr_id, int $a_role)
 
 deleteParticipants (array $a_user_ids)
 
 addRecommendation (int $a_usr_id)
 Add desktop item public. More...
 
 isNotificationEnabled (int $a_usr_id)
 
 isContact (int $a_usr_id)
 
 getAutoGeneratedRoleId (int $a_role_type)
 
 isGroupingMember (int $a_usr_id, string $a_field='')
 Check membership for. More...
 
 getSubscribers ()
 get all subscribers int[] More...
 
 getCountSubscribers ()
 
 getSubscriberData (int $a_usr_id)
 
 assignSubscribers (array $a_usr_ids)
 
 assignSubscriber (int $a_usr_id)
 
 autoFillSubscribers ()
 
 addSubscriber (int $a_usr_id)
 
 updateSubscriptionTime (int $a_usr_id, int $a_subtime)
 
 updateSubject (int $a_usr_id, string $a_subject)
 
 deleteSubscriber (int $a_usr_id)
 
 deleteSubscribers (array $a_usr_ids)
 
 isSubscriber (int $a_usr_id)
 
 setRoleOrderPosition (int $a_user_id)
 Set role order position. More...
 

Static Public Member Functions

static getInstance (int $a_ref_id)
 
static getInstanceByObjId (int $a_obj_id)
 Get instance by obj type. More...
 
static hasParticipantListAccess (int $a_obj_id, int $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 (array $a_user_ids, array $a_type, bool $a_only_member_roles)
 Get user membership assignments by type. More...
 
static _getMembershipByType (int $a_usr_id, array $a_type, bool $a_only_member_role=false)
 get membership by type Get course or group membership More...
 
static _isParticipant (int $a_ref_id, int $a_usr_id)
 Static function to check if a user is a participant of the container object. More...
 
static lookupNumberOfParticipants (int $a_ref_id)
 Lookup the number of participants (crs admins, tutors, members, grp admins, members) More...
 
static lookupNumberOfMembers (int $a_ref_id)
 Lookup number of members. More...
 
static _isBlocked (int $a_obj_id, int $a_usr_id)
 Check if user is blocked. More...
 
static _hasPassed (int $a_obj_id, int $a_usr_id)
 Check if user has passed course. More...
 
static _deleteAllEntries (int $a_obj_id)
 Delete all entries Normally called in case of object deletion. More...
 
static _deleteUser (int $a_usr_id)
 Delete user data. More...
 
static getDefaultMemberRole (int $a_ref_id)
 
static lookupSubscribers (int $a_obj_id)
 
static _isSubscriber (int $a_obj_id, int $a_usr_id)
 
static lookupSubscribersData (int $a_obj_id)
 
static _getAllSupportContactsOfUser (int $a_usr_id, string $a_type)
 Get all support contacts for a user. More...
 

Data Fields

const IL_CRS_ADMIN = 1
 
const IL_CRS_TUTOR = 3
 
const IL_CRS_MEMBER = 2
 
const IL_GRP_ADMIN = 4
 
const IL_GRP_MEMBER = 5
 
const IL_SESS_MEMBER = 6
 
const IL_LSO_ADMIN = 7
 
const IL_LSO_MEMBER = 8
 
const IL_ROLE_POSITION_ADMIN = 1
 
const IL_ROLE_POSITION_TUTOR = 2
 
const IL_ROLE_POSITION_MEMBER = 3
 

Protected Member Functions

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

Protected Attributes

string $component = ''
 
int $ref_id = 0
 
int $obj_id = 0
 
string $type = ''
 
array $roles = []
 
array $role_data = []
 
array $roles_sorted = []
 
array $role_assignments = []
 
array $participants = []
 
array $participants_status = []
 
array $members = []
 
array $tutors = []
 
array $admins = []
 
array $subscribers = []
 
ilAppEventHandler $eventHandler
 
ilRbacReview $rbacReview
 
ilRbacAdmin $rbacAdmin
 
ilObjectDataCache $objectDataCache
 
ilDBInterface $ilDB
 
ilLanguage $lng
 
ilLogger $logger
 
ilErrorHandling $error
 
ilRecommendedContentManager $recommended_content_manager
 

Detailed Description

Base class for course and group participants.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$
Todo:
move these constants to ilParticipants

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

Constructor & Destructor Documentation

◆ __construct()

ilParticipants::__construct ( string  $a_component_name,
int  $a_ref_id 
)
Parameters
stringcomponent definition e.g Modules/Course used for event handler
intref_id of container

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

References $DIC, ilObject\_lookupObjId(), ilObject\_lookupType(), ILIAS\Repository\lng(), ILIAS\Repository\logger(), readParticipants(), and readParticipantsStatus().

73  {
74  global $DIC;
75 
76  $this->ilDB = $DIC->database();
77  $this->lng = $DIC->language();
78  $this->logger = $DIC->logger()->mmbr();
79  $this->eventHandler = $DIC->event();
80  $this->rbacReview = $DIC->rbac()->review();
81  $this->rbacAdmin = $DIC->rbac()->admin();
82  $this->objectDataCache = $DIC['ilObjDataCache'];
83  $this->error = $DIC['ilErr'];
84  $this->component = $a_component_name;
85  $this->ref_id = $a_ref_id;
86  $this->obj_id = ilObject::_lookupObjId($a_ref_id);
87  $this->type = ilObject::_lookupType($this->obj_id);
88  $this->recommended_content_manager = new ilRecommendedContentManager();
89 
90  $this->readParticipants();
91  $this->readParticipantsStatus();
92  }
readParticipantsStatus()
Read status of participants (blocked, notification, passed)
static _lookupObjId(int $ref_id)
global $DIC
Definition: feed.php:28
static _lookupType(int $id, bool $reference=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

Member Function Documentation

◆ _deleteAllEntries()

static ilParticipants::_deleteAllEntries ( int  $a_obj_id)
static

Delete all entries Normally called in case of object deletion.

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

References $DIC, $query, $res, ilDBInterface\manipulate(), and ilDBInterface\quote().

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

442  : void
443  {
444  global $DIC;
445 
446  $ilDB = $DIC->database();
447  $query = "DELETE FROM obj_members " .
448  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " ";
450 
451  $query = "DELETE FROM il_subscribers " .
452  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " ";
454 
455  $query = 'DELETE FROM crs_waiting_list ' .
456  'WHERE obj_id = ' . $ilDB->quote($a_obj_id, 'integer');
458  }
$res
Definition: ltiservices.php:69
quote($value, string $type)
global $DIC
Definition: feed.php:28
$query
manipulate(string $query)
Run a (write) Query on the database.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _deleteUser()

static ilParticipants::_deleteUser ( int  $a_usr_id)
static

Delete user data.

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

References $DIC, $query, $res, ilWaitingList\_deleteUser(), ilDBInterface\manipulate(), and ilDBInterface\quote().

Referenced by ilObjCourse\_deleteUser().

463  : void
464  {
465  global $DIC;
466 
467  $ilDB = $DIC->database();
468  $query = "DELETE FROM obj_members WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer');
470 
471  $query = "DELETE FROM il_subscribers WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer');
473 
475  }
$res
Definition: ltiservices.php:69
quote($value, string $type)
global $DIC
Definition: feed.php:28
static _deleteUser(int $a_usr_id)
$query
manipulate(string $query)
Run a (write) Query on the database.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getAllSupportContactsOfUser()

static ilParticipants::_getAllSupportContactsOfUser ( int  $a_usr_id,
string  $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)
Todo:

join the two queries or alternatively reuse _getMembershipByType

fix returning fetchAssoc result

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

References $DIC, $query, $res, ilDBInterface\fetchAssoc(), ilDBInterface\fetchObject(), ilDBInterface\in(), ILIAS\Repository\int(), ilDBInterface\query(), and ilDBInterface\quote().

Referenced by ILIAS\Awareness\User\ProviderCourseContacts\getInitialUserSet().

1338  : array
1339  {
1340  global $DIC;
1341 
1342  $ilDB = $DIC['ilDB'];
1343 
1344  // for the first part
1345 
1346  // this will also dismiss local roles!
1347  $j2 = "JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id) ";
1348  $a2 = "AND obd2.title LIKE 'il_" . $a_type . "_mem%' ";
1349 
1350  // #14290 - no role folder anymore
1351  $query = "SELECT DISTINCT obd.obj_id,obr.ref_id FROM rbac_ua ua " .
1352  "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id " .
1353  "JOIN object_reference obr ON fa.parent = obr.ref_id " .
1354  "JOIN object_data obd ON obr.obj_id = obd.obj_id " .
1355  $j2 .
1356  "WHERE obd.type = " . $ilDB->quote($a_type, 'text') . " " .
1357  "AND fa.assign = 'y' " .
1358  "AND ua.usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1359  $a2;
1360 
1361  $res = $ilDB->query($query);
1362  $obj_ids = array();
1363  while ($row = $ilDB->fetchObject($res)) {
1364  $obj_ids[] = (int) $row->obj_id;
1365  }
1366 
1367  $set = $ilDB->query("SELECT obj_id, usr_id FROM obj_members " .
1368  " WHERE " . $ilDB->in("obj_id", $obj_ids, false, "integer") .
1369  " AND contact = " . $ilDB->quote(1, "integer"));
1370  $res = array();
1371  while ($rec = $ilDB->fetchAssoc($set)) {
1372  $res[] = $rec;
1373  }
1374  return $res;
1375  }
$res
Definition: ltiservices.php:69
fetchAssoc(ilDBStatement $statement)
quote($value, string $type)
global $DIC
Definition: feed.php:28
fetchObject(ilDBStatement $query_result)
query(string $query)
Run a (read-only) Query on the database.
$query
in(string $field, array $values, bool $negate=false, string $type="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getMembershipByType()

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

get membership by type Get course or group membership

Parameters
int$a_usr_idusr_id
string[]$a_type array of object types
Returns
int[]

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

References $DIC, $query, $res, ilDBInterface\concat(), ilDBInterface\fetchObject(), ilDBInterface\in(), ILIAS\Repository\int(), ilDBInterface\query(), and ilDBInterface\quote().

Referenced by ilNewsItem\_getNewsItemsOfUser(), ilMailSearchObjectGUI\cancel(), ilDashboardLearningSequenceGUI\getAssignments(), ilPortfolioPageGUI\getCoursesOfUser(), ILIAS\Awareness\User\ProviderMemberships\getInitialUserSet(), ilTestEvaluationData\getParticipants(), ilWorkspaceAccessHandler\getPossibleSharedTargets(), ilPortfolioAccessHandler\getPossibleSharedTargets(), ilWorkspaceShareTableGUI\initFilter(), ilCalendarCategories\readPDCalendars(), ilCalendarCategories\readReposCalendars(), ilWorkspaceAccessGUI\share(), and ilObjectCopyGUI\showSourceSelectionMembership().

310  : array {
311  global $DIC;
312 
313  $ilDB = $DIC['ilDB'];
314 
315  $j2 = '';
316  $a2 = '';
317  // this will also dismiss local roles!
318  if ($a_only_member_role) {
319  $j2 = "JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id) ";
320  $a2 = 'AND obd2.title = ' . $ilDB->concat(
321  array(
322  array($ilDB->quote('il_', 'text')),
323  array('obd.type'),
324  array($ilDB->quote('_member_', 'text')),
325  array('obr.ref_id'),
326  ),
327  false
328  );
329  }
330 
331  // #14290 - no role folder anymore
332  $query = "SELECT DISTINCT obd.obj_id,obr.ref_id FROM rbac_ua ua " .
333  "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id " .
334  "JOIN object_reference obr ON fa.parent = obr.ref_id " .
335  "JOIN object_data obd ON obr.obj_id = obd.obj_id " .
336  $j2 .
337  "WHERE " . $ilDB->in("obd.type", $a_type, false, "text") . ' ' .
338  "AND fa.assign = 'y' " .
339  "AND ua.usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
340  'AND obr.deleted IS NULL ' .
341  $a2;
342  $res = $ilDB->query($query);
343  $ref_ids = [];
344  while ($row = $ilDB->fetchObject($res)) {
345  $ref_ids[] = (int) $row->obj_id;
346  }
347  return $ref_ids;
348  }
$res
Definition: ltiservices.php:69
quote($value, string $type)
global $DIC
Definition: feed.php:28
fetchObject(ilDBStatement $query_result)
query(string $query)
Run a (read-only) Query on the database.
$query
in(string $field, array $values, bool $negate=false, string $type="")
concat(array $values, bool $allow_null=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _hasPassed()

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

Check if user has passed course.

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

References $DIC, $query, $res, ilDBInterface\query(), and ilDBInterface\quote().

Referenced by ilObjCourseAccess\checkCondition(), and ilLPStatusManualByTutor\refreshStatus().

425  : bool
426  {
427  global $DIC;
428 
429  $ilDB = $DIC->database();
430  $query = "SELECT * FROM obj_members " .
431  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
432  "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
433  "AND passed = '1'";
434  $res = $ilDB->query($query);
435  return (bool) $res->numRows();
436  }
$res
Definition: ltiservices.php:69
quote($value, string $type)
global $DIC
Definition: feed.php:28
query(string $query)
Run a (read-only) Query on the database.
$query
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _isBlocked()

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

Check if user is blocked.

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

References $DIC, $query, $res, ilDBInterface\query(), and ilDBInterface\quote().

409  : bool
410  {
411  global $DIC;
412 
413  $ilDB = $DIC->database();
414  $query = "SELECT * FROM obj_members " .
415  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
416  "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
417  "AND blocked = " . $ilDB->quote(1, 'integer');
418  $res = $ilDB->query($query);
419  return (bool) $res->numRows();
420  }
$res
Definition: ltiservices.php:69
quote($value, string $type)
global $DIC
Definition: feed.php:28
query(string $query)
Run a (read-only) Query on the database.
$query
+ Here is the call graph for this function:

◆ _isParticipant()

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

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

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

References $DIC.

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

353  : bool
354  {
355  global $DIC;
356 
357  $rbacreview = $DIC->rbac()->review();
358  $local_roles = $rbacreview->getRolesOfRoleFolder($a_ref_id, false);
359  return $rbacreview->isAssignedToAtLeastOneGivenRole($a_usr_id, $local_roles);
360  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ _isSubscriber()

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

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

References $DIC, $query, $res, ilDBConstants\FETCHMODE_OBJECT, ilDBInterface\query(), and ilDBInterface\quote().

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

1254  : bool
1255  {
1256  global $DIC;
1257 
1258  $ilDB = $DIC->database();
1259  $query = "SELECT * FROM il_subscribers " .
1260  "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1261  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
1262 
1263  $res = $ilDB->query($query);
1264  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1265  return true;
1266  }
1267  return false;
1268  }
$res
Definition: ltiservices.php:69
quote($value, string $type)
global $DIC
Definition: feed.php:28
query(string $query)
Run a (read-only) Query on the database.
$query
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add()

ilParticipants::add ( int  $a_usr_id,
int  $a_role 
)

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

References deleteSubscriber(), ilWaitingList\deleteUserEntry(), getComponent(), and isAssigned().

Referenced by assignSubscriber().

820  : bool
821  {
822  if ($this->isAssigned($a_usr_id)) {
823  return false;
824  }
825 
826  switch ($a_role) {
827  case self::IL_LSO_ADMIN:
828  case self::IL_GRP_ADMIN:
829  case self::IL_CRS_ADMIN:
830  $this->admins[] = $a_usr_id;
831  break;
832 
833  case self::IL_CRS_TUTOR:
834  $this->tutors[] = $a_usr_id;
835  break;
836 
837  case self::IL_SESS_MEMBER:
838  case self::IL_LSO_MEMBER:
839  case self::IL_GRP_MEMBER:
840  case self::IL_CRS_MEMBER:
841  $this->members[] = $a_usr_id;
842  break;
843 
844  }
845 
846  $this->participants[] = $a_usr_id;
847  $this->rbacAdmin->assignUser($this->role_data[$a_role], $a_usr_id);
848 
849  // Delete subscription request
850  $this->deleteSubscriber($a_usr_id);
851 
852  ilWaitingList::deleteUserEntry($a_usr_id, $this->obj_id);
853 
854  $this->eventHandler->raise(
855  $this->getComponent(),
856  "addParticipant",
857  array(
858  'obj_id' => $this->obj_id,
859  'usr_id' => $a_usr_id,
860  'role_id' => $a_role
861  )
862  );
863  return true;
864  }
isAssigned(int $a_usr_id)
check if user is assigned
deleteSubscriber(int $a_usr_id)
static deleteUserEntry(int $a_usr_id, int $a_obj_id)
getComponent()
Get component name Used for raising events.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addRecommendation()

ilParticipants::addRecommendation ( int  $a_usr_id)

Add desktop item public.

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

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

881  : void
882  {
883  // deactivated for now, see discussion at
884  // https://docu.ilias.de/goto_docu_wiki_wpage_5620_1357.html
885  // $this->recommended_content_manager->addObjectRecommendation($a_usr_id, $this->ref_id);
886  }
+ Here is the caller graph for this function:

◆ addSubscriber()

ilParticipants::addSubscriber ( int  $a_usr_id)

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

References $query, and $res.

1189  : void
1190  {
1191  $query = "INSERT INTO il_subscribers (usr_id,obj_id,subject,sub_time) " .
1192  " VALUES (" .
1193  $this->ilDB->quote($a_usr_id, 'integer') . "," .
1194  $this->ilDB->quote($this->obj_id, 'integer') . ", " .
1195  $this->ilDB->quote('', 'text') . ", " .
1196  $this->ilDB->quote(time(), 'integer') .
1197  ")";
1198  $res = $this->ilDB->manipulate($query);
1199  }
$res
Definition: ltiservices.php:69
$query

◆ assignSubscriber()

ilParticipants::assignSubscriber ( int  $a_usr_id)

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

References add(), deleteSubscriber(), ilObjectFactory\getInstanceByObjId(), isAssigned(), isSubscriber(), and ILIAS\Repository\lng().

Referenced by assignSubscribers(), and autoFillSubscribers().

1137  : bool
1138  {
1139  $this->error->setMessage("");
1140  if (!$this->isSubscriber($a_usr_id)) {
1141  $this->error->appendMessage($this->lng->txt("crs_user_notsubscribed"));
1142 
1143  return false;
1144  }
1145  if ($this->isAssigned($a_usr_id)) {
1146  $tmp_obj = ilObjectFactory::getInstanceByObjId($a_usr_id);
1147  $this->error->appendMessage($tmp_obj->getLogin() . ": " . $this->lng->txt("crs_user_already_assigned"));
1148 
1149  return false;
1150  }
1151 
1152  if (!$tmp_obj = ilObjectFactory::getInstanceByObjId($a_usr_id, false)) {
1153  $this->error->appendMessage($this->lng->txt("crs_user_not_exists"));
1154  return false;
1155  }
1156 
1157  if ($this instanceof ilCourseParticipants) {
1158  $this->add($tmp_obj->getId(), self::IL_CRS_MEMBER);
1159  }
1160  if ($this instanceof ilGroupParticipants) {
1161  $this->add($tmp_obj->getId(), self::IL_GRP_MEMBER);
1162  }
1163  if ($this instanceof ilLearningSequenceParticipants) {
1164  $this->add($tmp_obj->getId(), self::IL_LSO_MEMBER);
1165  }
1166  if ($this instanceof ilSessionParticipants) {
1167  $this->register($tmp_obj->getId());
1168  }
1169  $this->deleteSubscriber($a_usr_id);
1170  return true;
1171  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
isAssigned(int $a_usr_id)
check if user is assigned
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
deleteSubscriber(int $a_usr_id)
isSubscriber(int $a_usr_id)
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
add(int $a_usr_id, int $a_role)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ assignSubscribers()

ilParticipants::assignSubscribers ( array  $a_usr_ids)

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

References $id, and assignSubscriber().

1124  : bool
1125  {
1126  if (!is_array($a_usr_ids) || !count($a_usr_ids)) {
1127  return false;
1128  }
1129  foreach ($a_usr_ids as $id) {
1130  if (!$this->assignSubscriber($id)) {
1131  return false;
1132  }
1133  }
1134  return true;
1135  }
assignSubscriber(int $a_usr_id)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ autoFillSubscribers()

ilParticipants::autoFillSubscribers ( )
Todo:
check and fix notification

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

References assignSubscriber(), and readSubscribers().

1176  : int
1177  {
1178  $this->readSubscribers();
1179  $counter = 0;
1180  foreach ($this->subscribers as $subscriber) {
1181  if (!$this->assignSubscriber($subscriber)) {
1182  continue;
1183  }
1184  ++$counter;
1185  }
1186  return $counter;
1187  }
assignSubscriber(int $a_usr_id)
+ 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 199 of file class.ilParticipants.php.

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

Referenced by ilMailSearchObjectGUI\cancel(), and ilMailSearchObjectGUI\mailObjects().

203  : bool {
204  global $DIC;
205 
206  $access = $DIC->access();
207  $rbacsystem = $DIC->rbac()->system();
208 
209  if (is_null($usr_id)) {
210  $usr_id = $DIC->user()->getId();
211  }
212  if (is_null($mail_obj_ref_id)) {
213  $mail_obj_ref_id = (new ilMail($usr_id))->getMailObjectReferenceId();
214  }
215  if (is_int($ref_id_or_instance)) {
216  $ref_id = $ref_id_or_instance;
217  } elseif ($ref_id_or_instance instanceof ilObject) {
218  $ref_id = (int) $ref_id_or_instance->getRefId();
219  if ($ref_id === 0) {
220  $ref_id = array_keys(ilObject::_getAllReferences($ref_id_or_instance->getId()))[0];
221  }
222  } else {
223  return false;
224  }
225 
226  if (
227  $access->checkAccess('manage_members', '', $ref_id) &&
228  $rbacsystem->checkAccess('internal_mail', $mail_obj_ref_id)
229  ) {
230  return true;
231  }
232 
233  $part = self::getInstance($ref_id);
234  if (!$part->isAssigned($usr_id)) {
235  return false;
236  }
237 
238  $object = $ref_id_or_instance;
239  if (is_int($ref_id_or_instance)) {
240  $object = ilObjectFactory::getInstanceByRefId($ref_id_or_instance);
241  }
242 
243  if ($object instanceof ilObjCourse) {
244  return $object->getMailToMembersType() == ilCourseConstants::MAIL_ALLOWED_ALL;
245  } elseif ($object instanceof ilObjGroup) {
246  return $object->getMailToMembersType() == ilObjGroup::MAIL_ALLOWED_ALL;
247  } elseif ($object instanceof ilObjSession) {
248  return $object->getMailToMembersType() == ilObjSession::MAIL_ALLOWED_ALL;
249  }
250 
251  return false;
252  }
static _getAllReferences(int $id)
get all reference ids for object ID
global $DIC
Definition: feed.php:28
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
const MAIL_ALLOWED_ALL
Class ilObjGroup.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkLastAdmin()

ilParticipants::checkLastAdmin ( array  $a_usr_ids)

Check if users for deletion are last admins public.

Parameters
int[]array of user ids for deletion
Todo:
fix this and add unit test

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

References getAdmins().

677  : bool
678  {
679  foreach ($this->getAdmins() as $admin_id) {
680  if (!in_array($admin_id, $a_usr_ids)) {
681  return true;
682  }
683  }
684  return false;
685  }
getAdmins()
Get all admins ids.
+ Here is the call graph for this function:

◆ delete()

ilParticipants::delete ( int  $a_usr_id)

Drop user from all roles.

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

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

712  : void
713  {
714  $this->recommended_content_manager->removeObjectRecommendation($a_usr_id, $this->ref_id);
715  foreach ($this->roles as $role_id) {
716  $this->rbacAdmin->deassignUser($role_id, $a_usr_id);
717  }
718 
719  $query = "DELETE FROM obj_members " .
720  "WHERE usr_id = " . $this->ilDB->quote($a_usr_id, 'integer') . " " .
721  "AND obj_id = " . $this->ilDB->quote($this->obj_id, 'integer');
722  $res = $this->ilDB->manipulate($query);
723 
724  $this->readParticipants();
725  $this->readParticipantsStatus();
726 
727  $this->eventHandler->raise(
728  $this->getComponent(),
729  "deleteParticipant",
730  [
731  'obj_id' => $this->obj_id,
732  'usr_id' => $a_usr_id
733  ]
734  );
735  }
$res
Definition: ltiservices.php:69
readParticipantsStatus()
Read status of participants (blocked, notification, passed)
$query
getComponent()
Get component name Used for raising events.
+ Here is the call graph for this function:

◆ deleteParticipants()

ilParticipants::deleteParticipants ( array  $a_user_ids)
Parameters
int[]

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

869  : bool
870  {
871  foreach ($a_user_ids as $user_id) {
872  $this->delete($user_id);
873  }
874  return true;
875  }

◆ deleteSubscriber()

ilParticipants::deleteSubscriber ( int  $a_usr_id)

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

References $query, and $res.

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

1219  : void
1220  {
1221  $query = "DELETE FROM il_subscribers " .
1222  "WHERE usr_id = " . $this->ilDB->quote($a_usr_id, 'integer') . " " .
1223  "AND obj_id = " . $this->ilDB->quote($this->obj_id, 'integer') . " ";
1224  $res = $this->ilDB->manipulate($query);
1225  }
$res
Definition: ltiservices.php:69
$query
+ Here is the caller graph for this function:

◆ deleteSubscribers()

ilParticipants::deleteSubscribers ( array  $a_usr_ids)

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

References $query, $res, and ILIAS\Repository\lng().

1227  : bool
1228  {
1229  if (!count($a_usr_ids)) {
1230  $this->error->setMessage('');
1231  $this->error->appendMessage($this->lng->txt("no_usr_ids_given"));
1232  return false;
1233  }
1234  $query = "DELETE FROM il_subscribers " .
1235  "WHERE " . $this->ilDB->in('usr_id', $a_usr_ids, false, 'integer') . " " .
1236  "AND obj_id = " . $this->ilDB->quote($this->obj_id, 'integer');
1237  $res = $this->ilDB->query($query);
1238  return true;
1239  }
$res
Definition: ltiservices.php:69
$query
+ Here is the call graph for this function:

◆ getAdmins()

ilParticipants::getAdmins ( )

Get all admins ids.

Returns
int[]

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

References $admins.

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

568  : array
569  {
570  return $this->admins;
571  }
+ Here is the caller graph for this function:

◆ getAssignedRoles()

ilParticipants::getAssignedRoles ( int  $a_usr_id)

Get assigned roles.

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

638  : array
639  {
640  $assigned = [];
641  foreach ($this->roles as $role) {
642  if ($this->rbacReview->isAssigned($a_usr_id, $role)) {
643  $assigned[] = $role;
644  }
645  }
646  return $assigned;
647  }

◆ getAutoGeneratedRoleId()

ilParticipants::getAutoGeneratedRoleId ( int  $a_role_type)

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

904  : int
905  {
906  if (array_key_exists($a_role_type, $this->role_data)) {
907  return $this->role_data[$a_role_type];
908  }
909  return 0;
910  }

◆ getComponent()

ilParticipants::getComponent ( )
protected

Get component name Used for raising events.

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

References $component.

Referenced by add(), and delete().

151  : string
152  {
153  return $this->component;
154  }
+ Here is the caller graph for this function:

◆ getContacts()

ilParticipants::getContacts ( )

get user ids which are confirgured as contact

Returns
int[]

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

References ILIAS\Repository\int().

780  : array
781  {
782  $contacts = array();
783  foreach ($this->participants_status as $usr_id => $status) {
784  if ($status['contact']) {
785  $contacts[] = (int) $usr_id;
786  }
787  }
788  return $contacts;
789  }
+ Here is the call graph for this function:

◆ getCountAdmins()

ilParticipants::getCountAdmins ( )

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

References getAdmins().

573  : int
574  {
575  return count($this->getAdmins());
576  }
getAdmins()
Get all admins ids.
+ Here is the call graph for this function:

◆ getCountMembers()

ilParticipants::getCountMembers ( )

Get number of members (not participants)

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

532  : int
533  {
534  return count($this->members);
535  }

◆ getCountParticipants()

ilParticipants::getCountParticipants ( )

Get number of participants.

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

540  : int
541  {
542  return count($this->participants);
543  }

◆ getCountSubscribers()

ilParticipants::getCountSubscribers ( )

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

References getSubscribers().

1114  : int
1115  {
1116  return count($this->getSubscribers());
1117  }
getSubscribers()
get all subscribers int[]
+ Here is the call graph for this function:

◆ getDefaultMemberRole()

static ilParticipants::getDefaultMemberRole ( int  $a_ref_id)
static

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

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

477  : int
478  {
479  global $DIC;
480 
481  $rbacreview = $DIC->rbac()->review();
482 
483  $obj_id = ilObject::_lookupObjId($a_ref_id);
485 
486  if (!in_array($type, array('crs', 'grp'))) {
487  return 0;
488  }
489 
490  $roles = $rbacreview->getRolesOfRoleFolder($a_ref_id, false);
491  foreach ($roles as $role) {
492  $title = ilObject::_lookupTitle($role);
493  if (strpos($title, ('il_' . $type . '_member')) === 0) {
494  return $role;
495  }
496  }
497  return 0;
498  }
static _lookupObjId(int $ref_id)
global $DIC
Definition: feed.php:28
static _lookupTitle(int $obj_id)
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInstance()

static ilParticipants::getInstance ( int  $a_ref_id)
static

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

References $DIC, $logger, ilObject\_lookupObjId(), ilObject\_lookupType(), ilSessionParticipants\getInstance(), ilLogger\logStack(), and ilLogger\warning().

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

95  {
96  global $DIC;
97 
98  $logger = $DIC->logger()->mmbr();
99 
100  $obj_id = ilObject::_lookupObjId($a_ref_id);
102 
103  switch ($type) {
104  case 'crs':
105  case 'grp':
106  case 'lso':
107  return self::getInstanceByObjId($obj_id);
108  case 'sess':
109  return ilSessionParticipants::getInstance($a_ref_id);
110  default:
111  $logger()->mem()->logStack();
112  $logger()->mem()->warning('Invalid ref_id -> obj_id given: ' . $a_ref_id . ' -> ' . $obj_id);
113  throw new InvalidArgumentException('Invalid obj_id given.');
114  }
115  }
warning(string $a_message)
logStack(?int $a_level=null, string $a_message='')
static _lookupObjId(int $ref_id)
global $DIC
Definition: feed.php:28
static getInstance(int $a_ref_id)
Base class for course and group participants.
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInstanceByObjId()

static ilParticipants::getInstanceByObjId ( int  $a_obj_id)
static

Get instance by obj type.

Deprecated:
since version 5.4 use getInstance() (ref_id based)
Todo:
remove this method in favour of selff::getInstance

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

References $DIC, $logger, ilCourseParticipants\_getInstanceByObjId(), ilSessionParticipants\_getInstanceByObjId(), ilLearningSequenceParticipants\_getInstanceByObjId(), ilGroupParticipants\_getInstanceByObjId(), ilObject\_lookupType(), ilLogger\logStack(), ilLogLevel\WARNING, and ilLogger\warning().

Referenced by ilGroupParticipantsTableGUI\__construct(), ilCourseParticipantsTableGUI\__construct(), ilGroupAddToGroupActionGUI\addUser(), ilMailSearchObjectGUI\cancel(), 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().

123  {
124  global $DIC;
125 
126  $logger = $DIC->logger()->mmbr();
127 
128  $type = ilObject::_lookupType($a_obj_id);
129  switch ($type) {
130  case 'crs':
132 
133  case 'grp':
135 
136  case 'sess':
138  case 'lso':
140  default:
142  $logger()->mmbr()->warning(': Invalid obj_id given: ' . $a_obj_id);
143  throw new InvalidArgumentException('Invalid obj id given');
144  }
145  }
warning(string $a_message)
logStack(?int $a_level=null, string $a_message='')
global $DIC
Definition: feed.php:28
static _getInstanceByObjId(int $a_obj_id)
Base class for course and group participants.
static _getInstanceByObjId(int $a_obj_id)
Get singleton instance.
static _getInstanceByObjId(int $a_obj_id)
static _lookupType(int $id, bool $reference=false)
+ 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.

Returns
int[]

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

References $members.

559  : array
560  {
561  return $this->members;
562  }

◆ getNotificationRecipients()

ilParticipants::getNotificationRecipients ( )

Get admin, tutor which have notification enabled.

Returns
int[] of user ids

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

References $query, $res, ilDBConstants\FETCHMODE_OBJECT, ILIAS\Repository\int(), isAdmin(), isTutor(), and ilDBConstants\T_INTEGER.

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

514  : array
515  {
516  $query = "SELECT * FROM obj_members " .
517  "WHERE notification = 1 " .
518  "AND obj_id = " . $this->ilDB->quote($this->obj_id, ilDBConstants::T_INTEGER) . " ";
519  $res = $this->ilDB->query($query);
520  $recp = [];
521  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
522  if ($this->isAdmin((int) $row->usr_id) || $this->isTutor((int) $row->usr_id)) {
523  $recp[] = (int) $row->usr_id;
524  }
525  }
526  return $recp;
527  }
$res
Definition: ltiservices.php:69
isAdmin(int $a_usr_id)
check if user is admin
$query
isTutor(int $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 ( )

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

References $obj_id.

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

500  : int
501  {
502  return $this->obj_id;
503  }
+ Here is the caller graph for this function:

◆ getParticipants()

ilParticipants::getParticipants ( )

Get all participants ids.

Returns
int[]

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

References $participants.

Referenced by isGroupingMember(), and ilSessionParticipants\readParticipantsStatus().

549  : array
550  {
551  return $this->participants;
552  }
+ Here is the caller graph for this function:

◆ getRoles()

ilParticipants::getRoles ( )

Get object roles.

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

References $roles.

Referenced by updateRoleAssignments().

630  : array
631  {
632  return $this->roles;
633  }
+ Here is the caller graph for this function:

◆ getSubscriberData()

ilParticipants::getSubscriberData ( int  $a_usr_id)

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

References readSubscriberData().

1119  : array
1120  {
1121  return $this->readSubscriberData($a_usr_id);
1122  }
readSubscriberData(int $a_usr_id)
+ Here is the call graph for this function:

◆ getSubscribers()

ilParticipants::getSubscribers ( )

get all subscribers int[]

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

References $subscribers, and readSubscribers().

Referenced by getCountSubscribers().

1108  : array
1109  {
1110  $this->readSubscribers();
1111  return $this->subscribers;
1112  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTutors()

ilParticipants::getTutors ( )

Get all tutors ids.

Returns
int[]

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

References $tutors.

582  : array
583  {
584  return $this->tutors;
585  }

◆ getType()

ilParticipants::getType ( )

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

References $type.

Referenced by ilMailMemberSearchDataProvider\__construct().

505  : string
506  {
507  return $this->type;
508  }
+ Here is the caller graph for this function:

◆ getUserMembershipAssignmentsByType()

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

Get user membership assignments by type.

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

References $DIC, $query, $res, ilDBInterface\concat(), ilDBInterface\fetchObject(), ilDBInterface\in(), ILIAS\Repository\int(), ilDBInterface\query(), and ilDBInterface\quote().

Referenced by ilTimingsUser\lookupTimings().

262  : array {
263  global $DIC;
264 
265  $ilDB = $DIC->database();
266 
267  $j2 = $a2 = '';
268  if ($a_only_member_roles) {
269  $j2 = "JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id) ";
270  $a2 = 'AND obd2.title = ' . $ilDB->concat(
271  array(
272  array($ilDB->quote('il_', 'text')),
273  array('obd.type'),
274  array($ilDB->quote('_member_', 'text')),
275  array('obr.ref_id'),
276  ),
277  false
278  );
279  }
280 
281  $query = "SELECT DISTINCT obd.obj_id,obr.ref_id,ua.usr_id FROM rbac_ua ua " .
282  "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id " .
283  "JOIN object_reference obr ON fa.parent = obr.ref_id " .
284  "JOIN object_data obd ON obr.obj_id = obd.obj_id " .
285  $j2 .
286  "WHERE " . $ilDB->in("obd.type", $a_type, false, "text") .
287  "AND fa.assign = 'y' " .
288  'AND ' . $ilDB->in('ua.usr_id', $a_user_ids, false, 'integer') . ' ' .
289  $a2;
290 
291  $obj_ids = [];
292  $res = $ilDB->query($query);
293  while ($row = $ilDB->fetchObject($res)) {
294  $obj_ids[(int) $row->obj_id][] = (int) $row->usr_id;
295  }
296  return $obj_ids;
297  }
$res
Definition: ltiservices.php:69
quote($value, string $type)
global $DIC
Definition: feed.php:28
fetchObject(ilDBStatement $query_result)
query(string $query)
Run a (read-only) Query on the database.
$query
in(string $field, array $values, bool $negate=false, string $type="")
concat(array $values, bool $allow_null=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasParticipantListAccess()

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

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

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

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

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

159  : bool
160  {
161  global $DIC;
162 
163  $access = $DIC->access();
164 
165  if (!$a_usr_id) {
166  $a_usr_id = $DIC->user()->getId();
167  }
168 
169  // if write access granted => return true
170  $refs = ilObject::_getAllReferences($a_obj_id);
171  $ref_id = end($refs);
172 
173  if ($access->checkAccess('manage_members', '', $ref_id)) {
174  return true;
175  }
176  $part = self::getInstance($ref_id);
177  if ($part->isAssigned($a_usr_id)) {
178  if ($part->getType() === 'crs') {
179  if (!ilObjCourse::lookupShowMembersEnabled($a_obj_id)) {
180  return false;
181  }
182  }
183  if ($part->getType() === 'grp') {
184  if (!ilObjGroup::lookupShowMembersEnabled($a_obj_id)) {
185  return false;
186  }
187  }
188  return true;
189  }
190  // User is not assigned to course/group => no read access
191  return false;
192  }
static lookupShowMembersEnabled(int $a_obj_id)
static _getAllReferences(int $id)
get all reference ids for object ID
global $DIC
Definition: feed.php:28
static lookupShowMembersEnabled(int $a_obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasPassed()

ilParticipants::hasPassed ( int  $a_usr_id)

Check if user has passed object.

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

701  : bool
702  {
703  if (isset($this->participants_status[$a_usr_id])) {
704  return (bool) $this->participants_status[$a_usr_id]['passed'];
705  }
706  return false;
707  }

◆ isAdmin()

ilParticipants::isAdmin ( int  $a_usr_id)

check if user is admin

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

Referenced by ilMembershipGUI\executeCommand(), and getNotificationRecipients().

590  : bool
591  {
592  return in_array($a_usr_id, $this->admins);
593  }
+ Here is the caller graph for this function:

◆ isAssigned()

ilParticipants::isAssigned ( int  $a_usr_id)

check if user is assigned

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

Referenced by add(), and assignSubscriber().

614  : bool
615  {
616  return in_array($a_usr_id, $this->participants);
617  }
+ Here is the caller graph for this function:

◆ isBlocked()

ilParticipants::isBlocked ( int  $a_usr_id)

Check if user is blocked.

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

690  : bool
691  {
692  if (isset($this->participants_status[$a_usr_id])) {
693  return (bool) $this->participants_status[$a_usr_id]['blocked'];
694  }
695  return false;
696  }

◆ isContact()

ilParticipants::isContact ( int  $a_usr_id)

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

896  : bool
897  {
898  if (isset($this->participants_status[$a_usr_id])) {
899  return (bool) $this->participants_status[$a_usr_id]['contact'];
900  }
901  return false;
902  }

◆ isGroupingMember()

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

Check membership for.

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

References $query, $res, ilLogLevel\ERROR, ilObjectFactory\getInstanceByObjId(), getParticipants(), and ILIAS\Repository\logger().

1045  : bool
1046  {
1047  if ($a_field === '') {
1048  return false;
1049  }
1050  // Used for membership limitations -> check membership by given field
1051  $tmp_user = ilObjectFactory::getInstanceByObjId($a_usr_id);
1052  if (!$tmp_user instanceof ilObjUser) {
1053  $this->logger->logStack(ilLogLevel::ERROR);
1054  throw new DomainException('Invalid user id given: ' . $a_usr_id);
1055  }
1056  switch ($a_field) {
1057  case 'login':
1058  $and = "AND login = " . $this->ilDB->quote($tmp_user->getLogin(), 'text') . " ";
1059  break;
1060  case 'email':
1061  $and = "AND email = " . $this->ilDB->quote($tmp_user->getEmail(), 'text') . " ";
1062  break;
1063  case 'matriculation':
1064  $and = "AND matriculation = " . $this->ilDB->quote($tmp_user->getMatriculation(), 'text') . " ";
1065  break;
1066 
1067  default:
1068  $and = "AND usr_id = " . $this->ilDB->quote($a_usr_id, 'integer') . " ";
1069  break;
1070  }
1071 
1072  if (!$this->getParticipants()) {
1073  return false;
1074  }
1075 
1076  $query = "SELECT * FROM usr_data ud " .
1077  "WHERE " . $this->ilDB->in('usr_id', $this->getParticipants(), false, 'integer') . " " .
1078  $and;
1079 
1080  $res = $this->ilDB->query($query);
1081  return (bool) $res->numRows();
1082  }
$res
Definition: ltiservices.php:69
getParticipants()
Get all participants ids.
$query
static getInstanceByObjId(?int $obj_id, bool $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 ( int  $a_usr_id)

Check if user is last admin.

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

References getAdmins().

622  : bool
623  {
624  return in_array($a_usr_id, $this->getAdmins()) && count($this->getAdmins()) === 1;
625  }
getAdmins()
Get all admins ids.
+ Here is the call graph for this function:

◆ isMember()

ilParticipants::isMember ( int  $a_usr_id)

is user member

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

606  : bool
607  {
608  return in_array($a_usr_id, $this->members);
609  }

◆ isNotificationEnabled()

ilParticipants::isNotificationEnabled ( int  $a_usr_id)

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

888  : bool
889  {
890  if (isset($this->participants_status[$a_usr_id])) {
891  return (bool) $this->participants_status[$a_usr_id]['notification'];
892  }
893  return false;
894  }

◆ isSubscriber()

ilParticipants::isSubscriber ( int  $a_usr_id)

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

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

Referenced by assignSubscriber().

1241  : bool
1242  {
1243  $query = "SELECT * FROM il_subscribers " .
1244  "WHERE usr_id = " . $this->ilDB->quote($a_usr_id, 'integer') . " " .
1245  "AND obj_id = " . $this->ilDB->quote($this->obj_id, 'integer');
1246 
1247  $res = $this->ilDB->query($query);
1248  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1249  return true;
1250  }
1251  return false;
1252  }
$res
Definition: ltiservices.php:69
$query
+ Here is the caller graph for this function:

◆ isTutor()

ilParticipants::isTutor ( int  $a_usr_id)

is user tutor

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

Referenced by getNotificationRecipients().

598  : bool
599  {
600  return in_array($a_usr_id, $this->tutors);
601  }
+ Here is the caller graph for this function:

◆ lookupNumberOfMembers()

static ilParticipants::lookupNumberOfMembers ( int  $a_ref_id)
static

Lookup number of members.

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

References $DIC.

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

377  : int
378  {
379  global $DIC;
380 
381  $rbacreview = $DIC->rbac()->review();
382  $ilObjDataCache = $DIC['ilObjDataCache'];
383  $has_policies = $rbacreview->getLocalPolicies($a_ref_id);
384  if (!$has_policies) {
385  return 0;
386  }
387  $lroles = $rbacreview->getRolesOfRoleFolder($a_ref_id, false);
388  $memberRoles = array();
389  foreach ($lroles as $role_id) {
390  $title = $ilObjDataCache->lookupTitle($role_id);
391  switch (substr($title, 0, 8)) {
392  case 'il_crs_a':
393  case 'il_crs_t':
394  case 'il_grp_a':
395  case 'il_sess_':
396  break;
397 
398  default:
399  $memberRoles[] = $role_id;
400  break;
401  }
402  }
403  return $rbacreview->getNumberOfAssignedUsers($memberRoles);
404  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ lookupNumberOfParticipants()

static ilParticipants::lookupNumberOfParticipants ( int  $a_ref_id)
static

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

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

References $DIC.

365  : int
366  {
367  global $DIC;
368 
369  $rbacreview = $DIC->rbac()->review();
370  $lroles = $rbacreview->getRolesOfRoleFolder($a_ref_id, false);
371  return $rbacreview->getNumberOfAssignedUsers($lroles);
372  }
global $DIC
Definition: feed.php:28

◆ lookupSubscribers()

static ilParticipants::lookupSubscribers ( int  $a_obj_id)
static
Returns
int[]

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

References $DIC, $query, $res, $subscribers, ilDBConstants\FETCHMODE_OBJECT, ILIAS\Repository\int(), ilDBInterface\query(), and ilDBInterface\quote().

1087  : array
1088  {
1089  global $DIC;
1090 
1091  $ilDB = $DIC['ilDB'];
1092  $subscribers = array();
1093  $query = "SELECT usr_id FROM il_subscribers " .
1094  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
1095  "ORDER BY sub_time ";
1096 
1097  $res = $ilDB->query($query);
1098  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1099  $subscribers[] = (int) $row->usr_id;
1100  }
1101  return $subscribers;
1102  }
$res
Definition: ltiservices.php:69
quote($value, string $type)
global $DIC
Definition: feed.php:28
query(string $query)
Run a (read-only) Query on the database.
$query
+ Here is the call graph for this function:

◆ lookupSubscribersData()

static ilParticipants::lookupSubscribersData ( int  $a_obj_id)
static
Parameters
int$a_usr_id
Returns
array<int, array<{time: int, usr_id: int, subject: string}>>

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

References $data, $DIC, $query, $res, ilDBConstants\FETCHMODE_OBJECT, ILIAS\Repository\int(), ilDBInterface\query(), and ilDBInterface\quote().

Referenced by ilSubscriberTableGUI\readSubscriberData().

1312  : array
1313  {
1314  global $DIC;
1315 
1316  $ilDB = $DIC->database();
1317  $query = 'SELECT * FROM il_subscribers ' .
1318  'WHERE obj_id = ' . $ilDB->quote($a_obj_id, 'integer');
1319  $res = $ilDB->query($query);
1320 
1321  $data = array();
1322  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1323  $data[$row->usr_id]['time'] = (int) $row->sub_time;
1324  $data[$row->usr_id]['usr_id'] = (int) $row->usr_id;
1325  $data[$row->usr_id]['subject'] = (string) $row->subject;
1326  }
1327  return $data;
1328  }
$res
Definition: ltiservices.php:69
quote($value, string $type)
global $DIC
Definition: feed.php:28
query(string $query)
Run a (read-only) Query on the database.
$query
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readParticipants()

ilParticipants::readParticipants ( )
protected

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

References $participants.

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

912  : void
913  {
914  $this->roles = $this->rbacReview->getRolesOfRoleFolder($this->ref_id, false);
915  $this->participants = [];
916  $this->members = $this->admins = $this->tutors = [];
917 
918  $additional_roles = [];
919  $auto_generated_roles = [];
920  foreach ($this->roles as $role_id) {
921  $title = $this->objectDataCache->lookupTitle($role_id);
922  switch (substr($title, 0, 8)) {
923  case 'il_crs_m':
924  $auto_generated_roles[$role_id] = self::IL_ROLE_POSITION_MEMBER;
925  $this->role_data[self::IL_CRS_MEMBER] = $role_id;
926  $this->participants = array_unique(array_merge(
927  $assigned = $this->rbacReview->assignedUsers($role_id),
929  ));
930  $this->members = array_unique(array_merge($assigned, $this->members));
931  $this->role_assignments[$role_id] = $assigned;
932  break;
933 
934  case 'il_crs_a':
935  $auto_generated_roles[$role_id] = self::IL_ROLE_POSITION_ADMIN;
936  $this->role_data[self::IL_CRS_ADMIN] = $role_id;
937  $this->participants = array_unique(array_merge(
938  $assigned = $this->rbacReview->assignedUsers($role_id),
940  ));
941  $this->admins = $this->rbacReview->assignedUsers($role_id);
942  $this->role_assignments[$role_id] = $assigned;
943  break;
944 
945  case 'il_crs_t':
946  $auto_generated_roles[$role_id] = self::IL_ROLE_POSITION_TUTOR;
947  $this->role_data[self::IL_CRS_TUTOR] = $role_id;
948  $this->participants = array_unique(array_merge(
949  $assigned = $this->rbacReview->assignedUsers($role_id),
951  ));
952  $this->tutors = $this->rbacReview->assignedUsers($role_id);
953  $this->role_assignments[$role_id] = $assigned;
954  break;
955 
956  case 'il_grp_a':
957  $auto_generated_roles[$role_id] = self::IL_ROLE_POSITION_ADMIN;
958  $this->role_data[self::IL_GRP_ADMIN] = $role_id;
959  $this->participants = array_unique(array_merge(
960  $assigned = $this->rbacReview->assignedUsers($role_id),
962  ));
963  $this->admins = $this->rbacReview->assignedUsers($role_id);
964  $this->role_assignments[$role_id] = $assigned;
965  break;
966 
967  case 'il_grp_m':
968  $auto_generated_roles[$role_id] = self::IL_ROLE_POSITION_MEMBER;
969  $this->role_data[self::IL_GRP_MEMBER] = $role_id;
970  $this->participants = array_unique(array_merge(
971  $assigned = $this->rbacReview->assignedUsers($role_id),
973  ));
974  $this->members = $this->rbacReview->assignedUsers($role_id);
975  $this->role_assignments[$role_id] = $assigned;
976  break;
977 
978  case 'il_sess_':
979  $this->role_data[self::IL_SESS_MEMBER] = $role_id;
980  $this->participants = array_unique(array_merge(
981  $assigned = $this->rbacReview->assignedUsers($role_id),
983  ));
984  $this->members = $this->rbacReview->assignedUsers($role_id);
985  break;
986 
987  case 'il_lso_m':
988  $auto_generated_roles[$role_id] = self::IL_ROLE_POSITION_MEMBER;
989  $this->role_data[self::IL_LSO_MEMBER] = $role_id;
990  $this->participants = array_unique(array_merge(
991  $assigned = $this->rbacReview->assignedUsers($role_id),
993  ));
994  $this->members = $this->rbacReview->assignedUsers($role_id);
995  $this->role_assignments[$role_id] = $assigned;
996  break;
997 
998  case 'il_lso_a':
999  $auto_generated_roles[$role_id] = self::IL_ROLE_POSITION_ADMIN;
1000  $this->role_data[self::IL_LSO_ADMIN] = $role_id;
1001  $this->participants = array_unique(array_merge(
1002  $assigned = $this->rbacReview->assignedUsers($role_id),
1004  ));
1005  $this->admins = $this->rbacReview->assignedUsers($role_id);
1006  $this->role_assignments[$role_id] = $assigned;
1007  break;
1008 
1009  default:
1010  $additional_roles[$role_id] = $title;
1011  $this->participants = array_unique(array_merge(
1012  $assigned = $this->rbacReview->assignedUsers($role_id),
1014  ));
1015  $this->members = array_unique(array_merge($assigned, $this->members));
1016  $this->role_assignments[$role_id] = $assigned;
1017  break;
1018  }
1019  }
1020  asort($auto_generated_roles);
1021  asort($additional_roles);
1022  $this->roles_sorted = $auto_generated_roles + $additional_roles;
1023  }
+ Here is the caller graph for this function:

◆ readParticipantsStatus()

ilParticipants::readParticipantsStatus ( )
protected

Read status of participants (blocked, notification, passed)

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

References $query, $res, ilDBConstants\FETCHMODE_OBJECT, and ILIAS\Repository\int().

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

1028  : void
1029  {
1030  $query = "SELECT * FROM obj_members " .
1031  "WHERE obj_id = " . $this->ilDB->quote($this->obj_id, 'integer') . " ";
1032  $res = $this->ilDB->query($query);
1033  $this->participants_status = [];
1034  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1035  $this->participants_status[(int) $row->usr_id]['blocked'] = (bool) $row->blocked;
1036  $this->participants_status[(int) $row->usr_id]['notification'] = (bool) $row->notification;
1037  $this->participants_status[(int) $row->usr_id]['passed'] = (bool) $row->passed;
1038  $this->participants_status[(int) $row->usr_id]['contact'] = (bool) $row->contact;
1039  }
1040  }
$res
Definition: ltiservices.php:69
$query
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readSubscriberData()

ilParticipants::readSubscriberData ( int  $a_usr_id)
protected
Returns
array<{time: int, usr_id: int, subject: string}>

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

References $data, $query, $res, ilDBConstants\FETCHMODE_OBJECT, and ILIAS\Repository\int().

Referenced by getSubscriberData().

1292  : array
1293  {
1294  $query = "SELECT * FROM il_subscribers " .
1295  "WHERE obj_id = " . $this->ilDB->quote($this->obj_id, 'integer') . " " .
1296  "AND usr_id = " . $this->ilDB->quote($a_usr_id, 'integer');
1297 
1298  $res = $this->ilDB->query($query);
1299  $data = [];
1300  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1301  $data["time"] = (int) $row->sub_time;
1302  $data["usr_id"] = (int) $row->usr_id;
1303  $data['subject'] = (string) $row->subject;
1304  }
1305  return $data;
1306  }
$res
Definition: ltiservices.php:69
$query
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readSubscribers()

ilParticipants::readSubscribers ( )
protected
Todo:
fix performance; check if method is in use

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

References $query, $res, deleteSubscriber(), ilDBConstants\FETCHMODE_OBJECT, ilObjectFactory\getInstanceByObjId(), and ILIAS\Repository\int().

Referenced by autoFillSubscribers(), and getSubscribers().

1273  : void
1274  {
1275  $this->subscribers = [];
1276  $query = "SELECT usr_id FROM il_subscribers " .
1277  "WHERE obj_id = " . $this->ilDB->quote($this->obj_id, 'integer') . " " .
1278  "ORDER BY sub_time ";
1279 
1280  $res = $this->ilDB->query($query);
1281  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1282  if (!ilObjectFactory::getInstanceByObjId((int) $row->usr_id, false)) {
1283  $this->deleteSubscriber((int) $row->usr_id);
1284  }
1285  $this->subscribers[] = (int) $row->usr_id;
1286  }
1287  }
$res
Definition: ltiservices.php:69
deleteSubscriber(int $a_usr_id)
$query
static getInstanceByObjId(?int $obj_id, bool $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 ( int  $a_user_id)

Set role order position.

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

1380  : string
1381  {
1382  $counter = 0;
1383  $sortable_assignments = '9999999999';
1384  foreach ($this->roles_sorted as $role_id => $trash) {
1385  if (in_array($a_user_id, (array) $this->role_assignments[$role_id])) {
1386  $sortable_assignments = substr_replace($sortable_assignments, '1', $counter, 1);
1387  }
1388  ++$counter;
1389  }
1390  return $sortable_assignments;
1391  }

◆ updateBlocked()

ilParticipants::updateBlocked ( int  $a_usr_id,
bool  $a_blocked 
)

Update blocked status.

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

References $query, $res, and ILIAS\Repository\int().

740  : void
741  {
742  $this->participants_status[$a_usr_id]['blocked'] = (int) $a_blocked;
743  $query = "SELECT * FROM obj_members " .
744  "WHERE obj_id = " . $this->ilDB->quote($this->obj_id, 'integer') . " " .
745  "AND usr_id = " . $this->ilDB->quote($a_usr_id, 'integer');
746  $res = $this->ilDB->query($query);
747  if ($res->numRows()) {
748  $query = "UPDATE obj_members SET " .
749  "blocked = " . $this->ilDB->quote((int) $a_blocked, 'integer') . " " .
750  "WHERE obj_id = " . $this->ilDB->quote($this->obj_id, 'integer') . " " .
751  "AND usr_id = " . $this->ilDB->quote($a_usr_id, 'integer');
752  } else {
753  $query = "INSERT INTO obj_members (blocked,obj_id,usr_id,notification,passed) " .
754  "VALUES ( " .
755  $this->ilDB->quote((int) $a_blocked, 'integer') . ", " .
756  $this->ilDB->quote($this->obj_id, 'integer') . ", " .
757  $this->ilDB->quote($a_usr_id, 'integer') . ", " .
758  $this->ilDB->quote(0, 'integer') . ", " .
759  $this->ilDB->quote(0, 'integer') .
760  ") ON DUPLICATE KEY UPDATE blocked = VALUES(blocked)";
761  }
762  $res = $this->ilDB->manipulate($query);
763  }
$res
Definition: ltiservices.php:69
$query
+ Here is the call graph for this function:

◆ updateContact()

ilParticipants::updateContact ( int  $a_usr_id,
bool  $a_contact 
)

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

765  : void
766  {
767  $this->ilDB->manipulate(
768  'UPDATE obj_members SET ' .
769  'contact = ' . $this->ilDB->quote($a_contact, 'integer') . ' ' .
770  'WHERE obj_id = ' . $this->ilDB->quote($this->obj_id, 'integer') . ' ' .
771  'AND usr_id = ' . $this->ilDB->quote($a_usr_id, 'integer')
772  );
773  $this->participants_status[$a_usr_id]['contact'] = $a_contact;
774  }

◆ updateNotification()

ilParticipants::updateNotification ( int  $a_usr_id,
bool  $a_notification 
)

Update notification status.

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

References $query, and $res.

Referenced by ilLearningSequenceMembershipGUI\updateParticipantsStatus().

794  : void
795  {
796  $this->participants_status[$a_usr_id]['notification'] = $a_notification;
797 
798  $query = "SELECT * FROM obj_members " .
799  "WHERE obj_id = " . $this->ilDB->quote($this->obj_id, 'integer') . " " .
800  "AND usr_id = " . $this->ilDB->quote($a_usr_id, 'integer');
801  $res = $this->ilDB->query($query);
802  if ($res->numRows()) {
803  $query = "UPDATE obj_members SET " .
804  "notification = " . $this->ilDB->quote((int) $a_notification, 'integer') . " " .
805  "WHERE obj_id = " . $this->ilDB->quote($this->obj_id, 'integer') . " " .
806  "AND usr_id = " . $this->ilDB->quote($a_usr_id, 'integer');
807  } else {
808  $query = "INSERT INTO obj_members (notification,obj_id,usr_id,passed,blocked) " .
809  "VALUES ( " .
810  $this->ilDB->quote((int) $a_notification, 'integer') . ", " .
811  $this->ilDB->quote($this->obj_id, 'integer') . ", " .
812  $this->ilDB->quote($a_usr_id, 'integer') . ", " .
813  $this->ilDB->quote(0, 'integer') . ", " .
814  $this->ilDB->quote(0, 'integer') .
815  ") ON DUPLICATE KEY UPDATE notification = VALUES(notification)";
816  }
817  $res = $this->ilDB->manipulate($query);
818  }
$res
Definition: ltiservices.php:69
$query
+ Here is the caller graph for this function:

◆ updateRoleAssignments()

ilParticipants::updateRoleAssignments (   $a_usr_id,
  $a_roles 
)

Update role assignments public.

Parameters
intusr_id
int[]array of new roles

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

References getRoles(), readParticipants(), and readParticipantsStatus().

655  : void
656  {
657  foreach ($this->getRoles() as $role_id) {
658  if ($this->rbacReview->isAssigned($a_usr_id, $role_id)) {
659  if (!in_array($role_id, $a_roles)) {
660  $this->rbacAdmin->deassignUser($role_id, $a_usr_id);
661  }
662  } elseif (in_array($role_id, $a_roles)) {
663  $this->rbacAdmin->assignUser($role_id, $a_usr_id);
664  }
665  }
666  $this->rbacReview->clearCaches();
667  $this->readParticipants();
668  $this->readParticipantsStatus();
669  }
readParticipantsStatus()
Read status of participants (blocked, notification, passed)
getRoles()
Get object roles.
+ Here is the call graph for this function:

◆ updateSubject()

ilParticipants::updateSubject ( int  $a_usr_id,
string  $a_subject 
)

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

References $query, and $res.

1210  : void
1211  {
1212  $query = "UPDATE il_subscribers " .
1213  "SET subject = " . $this->ilDB->quote($a_subject, 'text') . " " .
1214  "WHERE usr_id = " . $this->ilDB->quote($a_usr_id, 'integer') . " " .
1215  "AND obj_id = " . $this->ilDB->quote($this->obj_id, 'integer') . " ";
1216  $res = $this->ilDB->manipulate($query);
1217  }
$res
Definition: ltiservices.php:69
$query

◆ updateSubscriptionTime()

ilParticipants::updateSubscriptionTime ( int  $a_usr_id,
int  $a_subtime 
)

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

References $query, and $res.

1201  : void
1202  {
1203  $query = "UPDATE il_subscribers " .
1204  "SET sub_time = " . $this->ilDB->quote($a_subtime, 'integer') . " " .
1205  "WHERE usr_id = " . $this->ilDB->quote($a_usr_id, 'integer') . " " .
1206  "AND obj_id = " . $this->ilDB->quote($this->obj_id, 'integer') . " ";
1207  $res = $this->ilDB->manipulate($query);
1208  }
$res
Definition: ltiservices.php:69
$query

Field Documentation

◆ $admins

array ilParticipants::$admins = []
protected

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

Referenced by getAdmins().

◆ $component

string ilParticipants::$component = ''
protected

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

Referenced by getComponent().

◆ $error

ilErrorHandling ilParticipants::$error
protected

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

◆ $eventHandler

ilAppEventHandler ilParticipants::$eventHandler
protected

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

◆ $ilDB

◆ $lng

ilLanguage ilParticipants::$lng
protected

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

◆ $logger

◆ $members

array ilParticipants::$members = []
protected

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

Referenced by getMembers().

◆ $obj_id

int ilParticipants::$obj_id = 0
protected

◆ $objectDataCache

ilObjectDataCache ilParticipants::$objectDataCache
protected

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

◆ $participants

array ilParticipants::$participants = []
protected

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

Referenced by getParticipants(), and readParticipants().

◆ $participants_status

array ilParticipants::$participants_status = []
protected

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

◆ $rbacAdmin

ilRbacAdmin ilParticipants::$rbacAdmin
protected

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

◆ $rbacReview

ilRbacReview ilParticipants::$rbacReview
protected

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

◆ $recommended_content_manager

ilRecommendedContentManager ilParticipants::$recommended_content_manager
protected

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

◆ $ref_id

int ilParticipants::$ref_id = 0
protected

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

◆ $role_assignments

array ilParticipants::$role_assignments = []
protected

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

◆ $role_data

array ilParticipants::$role_data = []
protected

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

◆ $roles

◆ $roles_sorted

array ilParticipants::$roles_sorted = []
protected

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

◆ $subscribers

array ilParticipants::$subscribers = []
protected

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

Referenced by getSubscribers(), and lookupSubscribers().

◆ $tutors

array ilParticipants::$tutors = []
protected

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

Referenced by getTutors().

◆ $type

string ilParticipants::$type = ''
protected

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

Referenced by getType().

◆ IL_CRS_ADMIN

◆ IL_CRS_MEMBER

◆ IL_CRS_TUTOR

◆ IL_GRP_ADMIN

◆ IL_GRP_MEMBER

◆ IL_LSO_ADMIN

const ilParticipants::IL_LSO_ADMIN = 7

◆ IL_LSO_MEMBER

const ilParticipants::IL_LSO_MEMBER = 8

◆ IL_ROLE_POSITION_ADMIN

const ilParticipants::IL_ROLE_POSITION_ADMIN = 1

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

◆ IL_ROLE_POSITION_MEMBER

const ilParticipants::IL_ROLE_POSITION_MEMBER = 3

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

◆ IL_ROLE_POSITION_TUTOR

const ilParticipants::IL_ROLE_POSITION_TUTOR = 2

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

◆ IL_SESS_MEMBER

const ilParticipants::IL_SESS_MEMBER = 6

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