ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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 (int|ilObject $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(), ILIAS\Repository\objectDataCache(), 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: shib_login.php:22
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 441 of file class.ilParticipants.php.

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

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

441  : void
442  {
443  global $DIC;
444 
445  $ilDB = $DIC->database();
446  $query = "DELETE FROM obj_members " .
447  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " ";
448  $res = $ilDB->manipulate($query);
449 
450  $query = "DELETE FROM il_subscribers " .
451  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " ";
452  $res = $ilDB->manipulate($query);
453 
454  $query = 'DELETE FROM crs_waiting_list ' .
455  'WHERE obj_id = ' . $ilDB->quote($a_obj_id, 'integer');
456  $ilDB->manipulate($query);
457  }
$res
Definition: ltiservices.php:66
quote($value, string $type)
global $DIC
Definition: shib_login.php:22
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 462 of file class.ilParticipants.php.

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

Referenced by ilObjCourse\_deleteUser().

462  : void
463  {
464  global $DIC;
465 
466  $ilDB = $DIC->database();
467  $query = "DELETE FROM obj_members WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer');
468  $res = $ilDB->manipulate($query);
469 
470  $query = "DELETE FROM il_subscribers WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer');
471  $res = $ilDB->manipulate($query);
472 
474  }
$res
Definition: ltiservices.php:66
quote($value, string $type)
global $DIC
Definition: shib_login.php:22
static _deleteUser(int $a_usr_id)
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 1336 of file class.ilParticipants.php.

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

Referenced by ceLTIc\LTI\User\ProviderCourseContacts\getInitialUserSet().

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

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

Referenced by ilNewsItem\_getNewsItemsOfUser(), ilLPPersonalGUI\buildViewControls(), ilMailSearchObjectGUI\cancel(), ilPortfolioPageGUI\getCoursesOfUser(), ceLTIc\LTI\User\ProviderMemberships\getInitialUserSet(), ilTestEvaluationData\getParticipants(), ilWorkspaceAccessHandler\getPossibleSharedTargets(), ilPortfolioAccessHandler\getPossibleSharedTargets(), ILIAS\News\Dashboard\DashboardNewsManager\getUserNewsObjectRefIds(), ilWorkspaceShareTableGUI\initFilter(), ilDashboardLearningSequenceGUI\initViewSettings(), ilCalendarCategories\readPDCalendars(), ilCalendarCategories\readReposCalendars(), ilWorkspaceAccessGUI\share(), and ilObjectCopyGUI\showSourceSelectionMembership().

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

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

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

424  : bool
425  {
426  global $DIC;
427 
428  $ilDB = $DIC->database();
429  $query = "SELECT * FROM obj_members " .
430  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
431  "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
432  "AND passed = '1'";
433  $res = $ilDB->query($query);
434  return (bool) $res->numRows();
435  }
$res
Definition: ltiservices.php:66
quote($value, string $type)
global $DIC
Definition: shib_login.php:22
query(string $query)
Run a (read-only) Query on the database.
+ 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 408 of file class.ilParticipants.php.

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

408  : bool
409  {
410  global $DIC;
411 
412  $ilDB = $DIC->database();
413  $query = "SELECT * FROM obj_members " .
414  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
415  "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
416  "AND blocked = " . $ilDB->quote(1, 'integer');
417  $res = $ilDB->query($query);
418  return (bool) $res->numRows();
419  }
$res
Definition: ltiservices.php:66
quote($value, string $type)
global $DIC
Definition: shib_login.php:22
query(string $query)
Run a (read-only) Query on the database.
+ 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 352 of file class.ilParticipants.php.

References $DIC.

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

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

◆ _isSubscriber()

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

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

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

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

1252  : bool
1253  {
1254  global $DIC;
1255 
1256  $ilDB = $DIC->database();
1257  $query = "SELECT * FROM il_subscribers " .
1258  "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1259  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
1260 
1261  $res = $ilDB->query($query);
1262  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1263  return true;
1264  }
1265  return false;
1266  }
$res
Definition: ltiservices.php:66
quote($value, string $type)
global $DIC
Definition: shib_login.php:22
query(string $query)
Run a (read-only) Query on the database.
+ 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 819 of file class.ilParticipants.php.

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

Referenced by assignSubscriber().

819  : bool
820  {
821  if ($this->isAssigned($a_usr_id)) {
822  return false;
823  }
824 
825  switch ($a_role) {
826  case self::IL_LSO_ADMIN:
827  case self::IL_GRP_ADMIN:
828  case self::IL_CRS_ADMIN:
829  $this->admins[] = $a_usr_id;
830  break;
831 
832  case self::IL_CRS_TUTOR:
833  $this->tutors[] = $a_usr_id;
834  break;
835 
836  case self::IL_SESS_MEMBER:
837  case self::IL_LSO_MEMBER:
838  case self::IL_GRP_MEMBER:
839  case self::IL_CRS_MEMBER:
840  $this->members[] = $a_usr_id;
841  break;
842  }
843 
844  $this->participants[] = $a_usr_id;
845  $this->rbacAdmin->assignUser($this->role_data[$a_role], $a_usr_id);
846 
847  // Delete subscription request
848  $this->deleteSubscriber($a_usr_id);
849 
850  ilWaitingList::deleteUserEntry($a_usr_id, $this->obj_id);
851 
852  $this->eventHandler->raise(
853  $this->getComponent(),
854  "addParticipant",
855  array(
856  'obj_id' => $this->obj_id,
857  'usr_id' => $a_usr_id,
858  'role_id' => $a_role
859  )
860  );
861  return true;
862  }
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 879 of file class.ilParticipants.php.

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

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

◆ addSubscriber()

ilParticipants::addSubscriber ( int  $a_usr_id)

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

References $res.

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

◆ assignSubscriber()

ilParticipants::assignSubscriber ( int  $a_usr_id)

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

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

Referenced by assignSubscribers(), and autoFillSubscribers().

1135  : bool
1136  {
1137  $this->error->setMessage("");
1138  if (!$this->isSubscriber($a_usr_id)) {
1139  $this->error->appendMessage($this->lng->txt("crs_user_notsubscribed"));
1140 
1141  return false;
1142  }
1143  if ($this->isAssigned($a_usr_id)) {
1144  $tmp_obj = ilObjectFactory::getInstanceByObjId($a_usr_id);
1145  $this->error->appendMessage($tmp_obj->getLogin() . ": " . $this->lng->txt("crs_user_already_assigned"));
1146 
1147  return false;
1148  }
1149 
1150  if (!$tmp_obj = ilObjectFactory::getInstanceByObjId($a_usr_id, false)) {
1151  $this->error->appendMessage($this->lng->txt("crs_user_not_exists"));
1152  return false;
1153  }
1154 
1155  if ($this instanceof ilCourseParticipants) {
1156  $this->add($tmp_obj->getId(), self::IL_CRS_MEMBER);
1157  }
1158  if ($this instanceof ilGroupParticipants) {
1159  $this->add($tmp_obj->getId(), self::IL_GRP_MEMBER);
1160  }
1161  if ($this instanceof ilLearningSequenceParticipants) {
1162  $this->add($tmp_obj->getId(), self::IL_LSO_MEMBER);
1163  }
1164  if ($this instanceof ilSessionParticipants) {
1165  $this->register($tmp_obj->getId());
1166  }
1167  $this->deleteSubscriber($a_usr_id);
1168  return true;
1169  }
Session participation handling.
isAssigned(int $a_usr_id)
check if user is assigned
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 1122 of file class.ilParticipants.php.

References $id, and assignSubscriber().

1122  : bool
1123  {
1124  if (!is_array($a_usr_ids) || !count($a_usr_ids)) {
1125  return false;
1126  }
1127  foreach ($a_usr_ids as $id) {
1128  if (!$this->assignSubscriber($id)) {
1129  return false;
1130  }
1131  }
1132  return true;
1133  }
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 1174 of file class.ilParticipants.php.

References assignSubscriber(), and readSubscribers().

1174  : int
1175  {
1176  $this->readSubscribers();
1177  $counter = 0;
1178  foreach ($this->subscribers as $subscriber) {
1179  if (!$this->assignSubscriber($subscriber)) {
1180  continue;
1181  }
1182  ++$counter;
1183  }
1184  return $counter;
1185  }
assignSubscriber(int $a_usr_id)
+ Here is the call graph for this function:

◆ canSendMailToMembers()

static ilParticipants::canSendMailToMembers ( int|ilObject  $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.

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

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

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

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

References getAdmins().

676  : bool
677  {
678  foreach ($this->getAdmins() as $admin_id) {
679  if (!in_array($admin_id, $a_usr_ids)) {
680  return true;
681  }
682  }
683  return false;
684  }
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 711 of file class.ilParticipants.php.

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

711  : void
712  {
713  $this->recommended_content_manager->removeObjectRecommendation($a_usr_id, $this->ref_id);
714  foreach ($this->roles as $role_id) {
715  $this->rbacAdmin->deassignUser($role_id, $a_usr_id);
716  }
717 
718  $query = "DELETE FROM obj_members " .
719  "WHERE usr_id = " . $this->ilDB->quote($a_usr_id, 'integer') . " " .
720  "AND obj_id = " . $this->ilDB->quote($this->obj_id, 'integer');
721  $res = $this->ilDB->manipulate($query);
722 
723  $this->readParticipants();
724  $this->readParticipantsStatus();
725 
726  $this->eventHandler->raise(
727  $this->getComponent(),
728  "deleteParticipant",
729  [
730  'obj_id' => $this->obj_id,
731  'usr_id' => $a_usr_id
732  ]
733  );
734  }
$res
Definition: ltiservices.php:66
readParticipantsStatus()
Read status of participants (blocked, notification, passed)
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 867 of file class.ilParticipants.php.

References $user_id.

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

◆ deleteSubscriber()

ilParticipants::deleteSubscriber ( int  $a_usr_id)

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

References $res.

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

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

◆ deleteSubscribers()

ilParticipants::deleteSubscribers ( array  $a_usr_ids)

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

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

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

◆ getAdmins()

ilParticipants::getAdmins ( )

Get all admins ids.

Returns
int[]

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

References $admins.

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

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

◆ getAssignedRoles()

ilParticipants::getAssignedRoles ( int  $a_usr_id)

Get assigned roles.

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

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

◆ getAutoGeneratedRoleId()

ilParticipants::getAutoGeneratedRoleId ( int  $a_role_type)

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

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

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

References ILIAS\Repository\int().

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

◆ getCountAdmins()

ilParticipants::getCountAdmins ( )

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

References getAdmins().

572  : int
573  {
574  return count($this->getAdmins());
575  }
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 531 of file class.ilParticipants.php.

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

◆ getCountParticipants()

ilParticipants::getCountParticipants ( )

Get number of participants.

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

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

◆ getCountSubscribers()

ilParticipants::getCountSubscribers ( )

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

References getSubscribers().

1112  : int
1113  {
1114  return count($this->getSubscribers());
1115  }
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 476 of file class.ilParticipants.php.

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

Referenced by ilContSkillPresentationGUI\__construct(), ilContProfileTableGUI\__construct(), ilContSkillAdminGUI\__construct(), ilCourseRegistrationGUI\add(), ilRepositorySearchGUI\addRole(), ilContainerImporter\finalProcessing(), ILIAS\Skill\Usage\SkillUsageManager\getAssignedObjectsForSkillProfile(), ILIAS\Container\Skills\ContainerSkillManager\getProfileSkills(), ilRbacSystem\initMemberView(), ilStartUpGUI\processIndexPHP(), and ilSkillProfileGUI\saveLocal().

476  : int
477  {
478  global $DIC;
479 
480  $rbacreview = $DIC->rbac()->review();
481 
482  $obj_id = ilObject::_lookupObjId($a_ref_id);
484 
485  if (!in_array($type, array('crs', 'grp'))) {
486  return 0;
487  }
488 
489  $roles = $rbacreview->getRolesOfRoleFolder($a_ref_id, false);
490  foreach ($roles as $role) {
491  $title = ilObject::_lookupTitle($role);
492  if (strpos($title, ('il_' . $type . '_member')) === 0) {
493  return $role;
494  }
495  }
496  return 0;
497  }
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
global $DIC
Definition: shib_login.php:22
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(), ilDashboardBlockGUI\getManageFields(), ilCourseReferenceLP\getMembers(), ilMembershipGUI\getMembersObject(), ilSessionParticipantsTableGUI\getParentLocalRoles(), ilTrQuery\getParticipantsForObject(), ilStudyProgrammeMembershipSourceReaderFactory\getReaderFor(), ilECSAppEventListener\handleMembership(), ilCourseReferenceAppEventListener\handleReferences(), ilObjGroupGUI\infoScreen(), ilMembershipGUI\initAttendanceList(), ilCourseReferencePathInfo\isReferenceMemberUpdateConfirmationRequired(), 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  }
logStack(?int $level=null, string $message='', array $context=[])
warning(string $message, array $context=[])
static _lookupObjId(int $ref_id)
static getInstance(int $a_ref_id)
global $DIC
Definition: shib_login.php:22
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  }
logStack(?int $level=null, string $message='', array $context=[])
warning(string $message, array $context=[])
static _getInstanceByObjId(int $a_obj_id)
global $DIC
Definition: shib_login.php:22
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 558 of file class.ilParticipants.php.

References $members.

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

◆ getNotificationRecipients()

ilParticipants::getNotificationRecipients ( )

Get admin, tutor which have notification enabled.

Returns
int[] of user ids

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

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

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

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

References $obj_id.

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

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

◆ getParticipants()

ilParticipants::getParticipants ( )

Get all participants ids.

Returns
int[]

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

References $participants.

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

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

◆ getRoles()

ilParticipants::getRoles ( )

Get object roles.

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

References $roles.

Referenced by updateRoleAssignments().

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

◆ getSubscriberData()

ilParticipants::getSubscriberData ( int  $a_usr_id)

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

References readSubscriberData().

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

◆ getSubscribers()

ilParticipants::getSubscribers ( )

get all subscribers int[]

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

References $subscribers, and readSubscribers().

Referenced by getCountSubscribers().

1106  : array
1107  {
1108  $this->readSubscribers();
1109  return $this->subscribers;
1110  }
+ 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 581 of file class.ilParticipants.php.

References $tutors.

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

◆ getType()

ilParticipants::getType ( )

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

References $type.

504  : string
505  {
506  return $this->type;
507  }

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

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

Referenced by ilTimingsUser\lookupTimings().

261  : array {
262  global $DIC;
263 
264  $ilDB = $DIC->database();
265 
266  $j2 = $a2 = '';
267  if ($a_only_member_roles) {
268  $j2 = "JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id) ";
269  $a2 = 'AND obd2.title = ' . $ilDB->concat(
270  array(
271  array($ilDB->quote('il_', 'text')),
272  array('obd.type'),
273  array($ilDB->quote('_member_', 'text')),
274  array('obr.ref_id'),
275  ),
276  false
277  );
278  }
279 
280  $query = "SELECT DISTINCT obd.obj_id,obr.ref_id,ua.usr_id FROM rbac_ua ua " .
281  "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id " .
282  "JOIN object_reference obr ON fa.parent = obr.ref_id " .
283  "JOIN object_data obd ON obr.obj_id = obd.obj_id " .
284  $j2 .
285  "WHERE " . $ilDB->in("obd.type", $a_type, false, "text") .
286  "AND fa.assign = 'y' " .
287  'AND ' . $ilDB->in('ua.usr_id', $a_user_ids, false, 'integer') . ' ' .
288  $a2;
289 
290  $obj_ids = [];
291  $res = $ilDB->query($query);
292  while ($row = $ilDB->fetchObject($res)) {
293  $obj_ids[(int) $row->obj_id][] = (int) $row->usr_id;
294  }
295  return $obj_ids;
296  }
$res
Definition: ltiservices.php:66
quote($value, string $type)
global $DIC
Definition: shib_login.php:22
fetchObject(ilDBStatement $query_result)
query(string $query)
Run a (read-only) Query on the database.
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
static lookupShowMembersEnabled(int $a_obj_id)
global $DIC
Definition: shib_login.php:22
+ 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 700 of file class.ilParticipants.php.

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

◆ isAdmin()

ilParticipants::isAdmin ( int  $a_usr_id)

check if user is admin

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

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

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

◆ isAssigned()

ilParticipants::isAssigned ( int  $a_usr_id)

check if user is assigned

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

Referenced by add(), and assignSubscriber().

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

◆ isBlocked()

ilParticipants::isBlocked ( int  $a_usr_id)

Check if user is blocked.

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

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

◆ isContact()

ilParticipants::isContact ( int  $a_usr_id)

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

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

◆ isGroupingMember()

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

Check membership for.

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

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

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

References getAdmins().

621  : bool
622  {
623  return in_array($a_usr_id, $this->getAdmins()) && count($this->getAdmins()) === 1;
624  }
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 605 of file class.ilParticipants.php.

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

◆ isNotificationEnabled()

ilParticipants::isNotificationEnabled ( int  $a_usr_id)

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

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

◆ isSubscriber()

ilParticipants::isSubscriber ( int  $a_usr_id)

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

References $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by assignSubscriber().

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

◆ isTutor()

ilParticipants::isTutor ( int  $a_usr_id)

is user tutor

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

Referenced by getNotificationRecipients().

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

◆ lookupNumberOfMembers()

static ilParticipants::lookupNumberOfMembers ( int  $a_ref_id)
static

Lookup number of members.

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

References $DIC.

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

376  : int
377  {
378  global $DIC;
379 
380  $rbacreview = $DIC->rbac()->review();
381  $ilObjDataCache = $DIC['ilObjDataCache'];
382  $has_policies = $rbacreview->getLocalPolicies($a_ref_id);
383  if (!$has_policies) {
384  return 0;
385  }
386  $lroles = $rbacreview->getRolesOfRoleFolder($a_ref_id, false);
387  $memberRoles = array();
388  foreach ($lroles as $role_id) {
389  $title = $ilObjDataCache->lookupTitle($role_id);
390  switch (substr($title, 0, 8)) {
391  case 'il_crs_a':
392  case 'il_crs_t':
393  case 'il_grp_a':
394  case 'il_sess_':
395  break;
396 
397  default:
398  $memberRoles[] = $role_id;
399  break;
400  }
401  }
402  return $rbacreview->getNumberOfAssignedUsers($memberRoles);
403  }
global $DIC
Definition: shib_login.php:22
+ 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 364 of file class.ilParticipants.php.

References $DIC.

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

◆ lookupSubscribers()

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

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

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

1085  : array
1086  {
1087  global $DIC;
1088 
1089  $ilDB = $DIC['ilDB'];
1090  $subscribers = array();
1091  $query = "SELECT usr_id FROM il_subscribers " .
1092  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
1093  "ORDER BY sub_time ";
1094 
1095  $res = $ilDB->query($query);
1096  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1097  $subscribers[] = (int) $row->usr_id;
1098  }
1099  return $subscribers;
1100  }
$res
Definition: ltiservices.php:66
quote($value, string $type)
global $DIC
Definition: shib_login.php:22
query(string $query)
Run a (read-only) Query on the database.
+ 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 1310 of file class.ilParticipants.php.

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

Referenced by ilSubscriberTableGUI\readSubscriberData().

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

◆ readParticipants()

ilParticipants::readParticipants ( )
protected

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

References $participants, and ILIAS\Repository\objectDataCache().

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

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

◆ readParticipantsStatus()

ilParticipants::readParticipantsStatus ( )
protected

Read status of participants (blocked, notification, passed)

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

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

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

1026  : void
1027  {
1028  $query = "SELECT * FROM obj_members " .
1029  "WHERE obj_id = " . $this->ilDB->quote($this->obj_id, 'integer') . " ";
1030  $res = $this->ilDB->query($query);
1031  $this->participants_status = [];
1032  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1033  $this->participants_status[(int) $row->usr_id]['blocked'] = (bool) $row->blocked;
1034  $this->participants_status[(int) $row->usr_id]['notification'] = (bool) $row->notification;
1035  $this->participants_status[(int) $row->usr_id]['passed'] = (bool) $row->passed;
1036  $this->participants_status[(int) $row->usr_id]['contact'] = (bool) $row->contact;
1037  }
1038  }
$res
Definition: ltiservices.php:66
+ 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 1290 of file class.ilParticipants.php.

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

Referenced by getSubscriberData().

1290  : array
1291  {
1292  $query = "SELECT * FROM il_subscribers " .
1293  "WHERE obj_id = " . $this->ilDB->quote($this->obj_id, 'integer') . " " .
1294  "AND usr_id = " . $this->ilDB->quote($a_usr_id, 'integer');
1295 
1296  $res = $this->ilDB->query($query);
1297  $data = [];
1298  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1299  $data["time"] = (int) $row->sub_time;
1300  $data["usr_id"] = (int) $row->usr_id;
1301  $data['subject'] = (string) $row->subject;
1302  }
1303  return $data;
1304  }
$res
Definition: ltiservices.php:66
+ 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 1271 of file class.ilParticipants.php.

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

Referenced by autoFillSubscribers(), and getSubscribers().

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

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

◆ updateBlocked()

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

Update blocked status.

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

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

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

◆ updateContact()

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

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

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

◆ updateNotification()

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

Update notification status.

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

References $res.

Referenced by ilLearningSequenceMembershipGUI\updateParticipantsStatus().

793  : void
794  {
795  $this->participants_status[$a_usr_id]['notification'] = $a_notification;
796 
797  $query = "SELECT * FROM obj_members " .
798  "WHERE obj_id = " . $this->ilDB->quote($this->obj_id, 'integer') . " " .
799  "AND usr_id = " . $this->ilDB->quote($a_usr_id, 'integer');
800  $res = $this->ilDB->query($query);
801  if ($res->numRows()) {
802  $query = "UPDATE obj_members SET " .
803  "notification = " . $this->ilDB->quote((int) $a_notification, 'integer') . " " .
804  "WHERE obj_id = " . $this->ilDB->quote($this->obj_id, 'integer') . " " .
805  "AND usr_id = " . $this->ilDB->quote($a_usr_id, 'integer');
806  } else {
807  $query = "INSERT INTO obj_members (notification,obj_id,usr_id,passed,blocked) " .
808  "VALUES ( " .
809  $this->ilDB->quote((int) $a_notification, 'integer') . ", " .
810  $this->ilDB->quote($this->obj_id, 'integer') . ", " .
811  $this->ilDB->quote($a_usr_id, 'integer') . ", " .
812  $this->ilDB->quote(0, 'integer') . ", " .
813  $this->ilDB->quote(0, 'integer') .
814  ") ON DUPLICATE KEY UPDATE notification = VALUES(notification)";
815  }
816  $res = $this->ilDB->manipulate($query);
817  }
$res
Definition: ltiservices.php:66
+ 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 654 of file class.ilParticipants.php.

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

654  : void
655  {
656  foreach ($this->getRoles() as $role_id) {
657  if ($this->rbacReview->isAssigned($a_usr_id, $role_id)) {
658  if (!in_array($role_id, $a_roles)) {
659  $this->rbacAdmin->deassignUser($role_id, $a_usr_id);
660  }
661  } elseif (in_array($role_id, $a_roles)) {
662  $this->rbacAdmin->assignUser($role_id, $a_usr_id);
663  }
664  }
665  $this->rbacReview->clearCaches();
666  $this->readParticipants();
667  $this->readParticipantsStatus();
668  }
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 1208 of file class.ilParticipants.php.

References $res.

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

◆ updateSubscriptionTime()

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

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

References $res.

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

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: