19 declare(strict_types=1);
    72     public function __construct(
string $a_component_name, 
int $a_ref_id)
    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();
    83         $this->error = $DIC[
'ilErr'];
    84         $this->component = $a_component_name;
    85         $this->ref_id = $a_ref_id;
    98         $logger = $DIC->logger()->mmbr();
   107                 return self::getInstanceByObjId($obj_id);
   112                 $logger->
warning(
'Invalid ref_id -> obj_id given: ' . $a_ref_id . 
' -> ' . $obj_id);
   126         $logger = $DIC->logger()->mmbr();
   142                 $logger()->mmbr()->
warning(
': Invalid obj_id given: ' . $a_obj_id);
   163         $access = $DIC->access();
   166             $a_usr_id = $DIC->user()->getId();
   171         $ref_id = end($refs);
   173         if ($access->checkAccess(
'manage_members', 
'', $ref_id)) {
   176         $part = self::getInstance($ref_id);
   177         if ($part->isAssigned($a_usr_id)) {
   178             if ($part->getType() === 
'crs') {
   183             if ($part->getType() === 
'grp') {
   201         ?
int $mail_obj_ref_id = null
   205         $access = $DIC->access();
   206         $rbacsystem = $DIC->rbac()->system();
   208         if (is_null($usr_id)) {
   209             $usr_id = $DIC->user()->getId();
   211         if (is_null($mail_obj_ref_id)) {
   212             $mail_obj_ref_id = (
new ilMail($usr_id))->getMailObjectReferenceId();
   214         if (is_int($ref_id_or_instance)) {
   215             $ref_id = $ref_id_or_instance;
   216         } elseif ($ref_id_or_instance instanceof 
ilObject) {
   226             $access->checkAccess(
'manage_members', 
'', $ref_id) &&
   227             $rbacsystem->checkAccess(
'internal_mail', $mail_obj_ref_id)
   232         $part = self::getInstance($ref_id);
   233         if (!$part->isAssigned($usr_id)) {
   237         $object = $ref_id_or_instance;
   238         if (is_int($ref_id_or_instance)) {
   260         bool $a_only_member_roles
   264         $ilDB = $DIC->database();
   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(
   271                         array($ilDB->
quote(
'il_', 
'text')),
   273                         array($ilDB->
quote(
'_member_', 
'text')),
   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 " .
   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') . 
' ' .
   293             $obj_ids[(
int) $row->obj_id][] = (
int) $row->usr_id;
   308         bool $a_only_member_role = 
false   312         $ilDB = $DIC[
'ilDB'];
   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(
   321                         array($ilDB->
quote(
'il_', 
'text')),
   323                         array($ilDB->
quote(
'_member_', 
'text')),
   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 " .
   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 ' .
   344             $ref_ids[] = (
int) $row->obj_id;
   356         $rbacreview = $DIC->rbac()->review();
   357         $local_roles = $rbacreview->getRolesOfRoleFolder($a_ref_id, 
false);
   358         return $rbacreview->isAssignedToAtLeastOneGivenRole($a_usr_id, $local_roles);
   368         $rbacreview = $DIC->rbac()->review();
   369         $lroles = $rbacreview->getRolesOfRoleFolder($a_ref_id, 
false);
   370         return $rbacreview->getNumberOfAssignedUsers($lroles);
   380         $rbacreview = $DIC->rbac()->review();
   381         $ilObjDataCache = $DIC[
'ilObjDataCache'];
   382         $has_policies = $rbacreview->getLocalPolicies($a_ref_id);
   383         if (!$has_policies) {
   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)) {
   398                     $memberRoles[] = $role_id;
   402         return $rbacreview->getNumberOfAssignedUsers($memberRoles);
   408     public static function _isBlocked(
int $a_obj_id, 
int $a_usr_id): bool
   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');
   418         return (
bool) 
$res->numRows();
   424     public static function _hasPassed(
int $a_obj_id, 
int $a_usr_id): bool
   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') . 
" " .
   434         return (
bool) 
$res->numRows();
   445         $ilDB = $DIC->database();
   446         $query = 
"DELETE FROM obj_members " .
   447             "WHERE obj_id = " . $ilDB->
quote($a_obj_id, 
'integer') . 
" ";
   450         $query = 
"DELETE FROM il_subscribers " .
   451             "WHERE obj_id = " . $ilDB->
quote($a_obj_id, 
'integer') . 
" ";
   454         $query = 
'DELETE FROM crs_waiting_list ' .
   455             'WHERE obj_id = ' . $ilDB->
quote($a_obj_id, 
'integer');
   466         $ilDB = $DIC->database();
   467         $query = 
"DELETE FROM obj_members WHERE usr_id = " . $ilDB->
quote($a_usr_id, 
'integer');
   470         $query = 
"DELETE FROM il_subscribers WHERE usr_id = " . $ilDB->
quote($a_usr_id, 
'integer');
   480         $rbacreview = $DIC->rbac()->review();
   485         if (!in_array($type, array(
'crs', 
'grp'))) {
   489         $roles = $rbacreview->getRolesOfRoleFolder($a_ref_id, 
false);
   490         foreach ($roles as $role) {
   492             if (strpos($title, (
'il_' . $type . 
'_member')) === 0) {
   515         $query = 
"SELECT * FROM obj_members " .
   516             "WHERE notification = 1 " .
   518         $res = $this->ilDB->query($query);
   521             if ($this->
isAdmin((
int) $row->usr_id) || $this->
isTutor((
int) $row->usr_id)) {
   522                 $recp[] = (
int) $row->usr_id;
   533         return count($this->members);
   541         return count($this->participants);
   591         return in_array($a_usr_id, $this->admins);
   599         return in_array($a_usr_id, $this->tutors);
   607         return in_array($a_usr_id, $this->members);
   615         return in_array($a_usr_id, $this->participants);
   640         foreach ($this->roles as $role) {
   641             if ($this->rbacReview->isAssigned($a_usr_id, $role)) {
   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);
   661             } elseif (in_array($role_id, $a_roles)) {
   662                 $this->rbacAdmin->assignUser($role_id, $a_usr_id);
   665         $this->rbacReview->clearCaches();
   678         foreach ($this->
getAdmins() as $admin_id) {
   679             if (!in_array($admin_id, $a_usr_ids)) {
   691         if (isset($this->participants_status[$a_usr_id])) {
   692             return (
bool) ($this->participants_status[$a_usr_id][
'blocked'] ?? 
false);
   702         if (isset($this->participants_status[$a_usr_id])) {
   703             return (
bool) ($this->participants_status[$a_usr_id][
'passed'] ?? 
false);
   711     public function delete(
int $a_usr_id): 
void   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);
   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);
   726         $this->eventHandler->raise(
   730                 'obj_id' => $this->obj_id,
   731                 'usr_id' => $a_usr_id
   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');
   752             $query = 
"INSERT INTO obj_members (blocked,obj_id,usr_id,notification,passed) " .
   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)";
   761         $res = $this->ilDB->manipulate($query);
   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')
   772         $this->participants_status[$a_usr_id][
'contact'] = $a_contact;
   782         foreach ($this->participants_status as $usr_id => $status) {
   783             if ($status[
'contact']) {
   784                 $contacts[] = (
int) $usr_id;
   795         $this->participants_status[$a_usr_id][
'notification'] = $a_notification;
   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');
   807             $query = 
"INSERT INTO obj_members (notification,obj_id,usr_id,passed,blocked) " .
   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)";
   816         $res = $this->ilDB->manipulate($query);
   819     public function add(
int $a_usr_id, 
int $a_role): bool
   826             case self::IL_LSO_ADMIN:
   827             case self::IL_GRP_ADMIN:
   828             case self::IL_CRS_ADMIN:
   829                 $this->admins[] = $a_usr_id;
   832             case self::IL_CRS_TUTOR:
   833                 $this->tutors[] = $a_usr_id;
   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;
   844         $this->participants[] = $a_usr_id;
   845         $this->rbacAdmin->assignUser($this->role_data[$a_role], $a_usr_id);
   852         $this->eventHandler->raise(
   856                 'obj_id' => $this->obj_id,
   857                 'usr_id' => $a_usr_id,
   888         if (isset($this->participants_status[$a_usr_id])) {
   889             return (
bool) ($this->participants_status[$a_usr_id][
'notification'] ?? 
false);
   896         if (isset($this->participants_status[$a_usr_id])) {
   897             return (
bool) ($this->participants_status[$a_usr_id][
'contact'] ?? 
false);
   904         if (array_key_exists($a_role_type, $this->role_data)) {
   905             return $this->role_data[$a_role_type];
   912         $this->roles = $this->rbacReview->getRolesOfRoleFolder($this->ref_id, 
false);
   913         $this->participants = [];
   914         $this->members = $this->admins = $this->tutors = [];
   916         $additional_roles = [];
   917         $auto_generated_roles = [];
   918         foreach ($this->roles as $role_id) {
   920             switch (substr($title, 0, 8)) {
   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),
   928                     $this->members = array_unique(array_merge($assigned, $this->members));
   929                     $this->role_assignments[$role_id] = $assigned;
   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),
   939                     $this->admins = $this->rbacReview->assignedUsers($role_id);
   940                     $this->role_assignments[$role_id] = $assigned;
   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),
   950                     $this->tutors = $this->rbacReview->assignedUsers($role_id);
   951                     $this->role_assignments[$role_id] = $assigned;
   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),
   961                     $this->admins = $this->rbacReview->assignedUsers($role_id);
   962                     $this->role_assignments[$role_id] = $assigned;
   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),
   972                     $this->members = $this->rbacReview->assignedUsers($role_id);
   973                     $this->role_assignments[$role_id] = $assigned;
   977                     $this->role_data[self::IL_SESS_MEMBER] = $role_id;
   978                     $this->participants = array_unique(array_merge(
   979                         $assigned = $this->rbacReview->assignedUsers($role_id),
   982                     $this->members = $this->rbacReview->assignedUsers($role_id);
   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),
   992                     $this->members = $this->rbacReview->assignedUsers($role_id);
   993                     $this->role_assignments[$role_id] = $assigned;
   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),
  1003                     $this->admins = $this->rbacReview->assignedUsers($role_id);
  1004                     $this->role_assignments[$role_id] = $assigned;
  1008                     $additional_roles[$role_id] = $title;
  1009                     $this->participants = array_unique(array_merge(
  1010                         $assigned = $this->rbacReview->assignedUsers($role_id),
  1013                     $this->members = array_unique(array_merge($assigned, $this->members));
  1014                     $this->role_assignments[$role_id] = $assigned;
  1018         asort($auto_generated_roles);
  1019         asort($additional_roles);
  1020         $this->roles_sorted = $auto_generated_roles + $additional_roles;
  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 = [];
  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;
  1045         if ($a_field === 
'') {
  1052             throw new DomainException(
'Invalid user id given: ' . $a_usr_id);
  1056                 $and = 
"AND login = " . $this->ilDB->quote($tmp_user->getLogin(), 
'text') . 
" ";
  1059                 $and = 
"AND email = " . $this->ilDB->quote($tmp_user->getEmail(), 
'text') . 
" ";
  1061             case 'matriculation':
  1062                 $and = 
"AND matriculation = " . $this->ilDB->quote($tmp_user->getMatriculation(), 
'text') . 
" ";
  1066                 $and = 
"AND usr_id = " . $this->ilDB->quote($a_usr_id, 
'integer') . 
" ";
  1074         $query = 
"SELECT * FROM usr_data ud " .
  1075             "WHERE " . $this->ilDB->in(
'usr_id', $this->
getParticipants(), 
false, 
'integer') . 
" " .
  1078         $res = $this->ilDB->query($query);
  1079         return (
bool) 
$res->numRows();
  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 ";
  1097             $subscribers[] = (
int) $row->usr_id;
  1124         if (!is_array($a_usr_ids) || !count($a_usr_ids)) {
  1127         foreach ($a_usr_ids as 
$id) {
  1137         $this->error->setMessage(
"");
  1139             $this->error->appendMessage($this->
lng->txt(
"crs_user_notsubscribed"));
  1145             $this->error->appendMessage($tmp_obj->getLogin() . 
": " . $this->
lng->txt(
"crs_user_already_assigned"));
  1151             $this->error->appendMessage($this->
lng->txt(
"crs_user_not_exists"));
  1156             $this->
add($tmp_obj->getId(), self::IL_CRS_MEMBER);
  1159             $this->
add($tmp_obj->getId(), self::IL_GRP_MEMBER);
  1162             $this->
add($tmp_obj->getId(), self::IL_LSO_MEMBER);
  1165             $this->
register($tmp_obj->getId());
  1178         foreach ($this->subscribers as $subscriber) {
  1189         $query = 
"INSERT INTO il_subscribers (usr_id,obj_id,subject,sub_time) " .
  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') .
  1196         $res = $this->ilDB->manipulate($query);
  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);
  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);
  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);
  1227         if (!count($a_usr_ids)) {
  1228             $this->error->setMessage(
'');
  1229             $this->error->appendMessage($this->
lng->txt(
"no_usr_ids_given"));
  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);
  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');
  1245         $res = $this->ilDB->query($query);
  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');
  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 ";
  1278         $res = $this->ilDB->query($query);
  1283             $this->subscribers[] = (
int) $row->usr_id;
  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');
  1296         $res = $this->ilDB->query($query);
  1299             $data[
"time"] = (
int) $row->sub_time;
  1300             $data[
"usr_id"] = (
int) $row->usr_id;
  1301             $data[
'subject'] = (string) $row->subject;
  1314         $ilDB = $DIC->database();
  1315         $query = 
'SELECT * FROM il_subscribers ' .
  1316             'WHERE obj_id = ' . $ilDB->
quote($a_obj_id, 
'integer');
  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;
  1340         $ilDB = $DIC[
'ilDB'];
  1345         $j2 = 
"JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id) ";
  1346         $a2 = 
"AND obd2.title LIKE 'il_" . $a_type . 
"_mem%' ";
  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 " .
  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') . 
" " .
  1362             $obj_ids[] = (
int) $row->obj_id;
  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"));
  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);
  1388         return $sortable_assignments;
 
checkLastAdmin(array $a_usr_ids)
Check if users for deletion are last admins  public. 
 
getCountMembers()
Get number of members (not participants) 
 
updateContact(int $a_usr_id, bool $a_contact)
 
ilAppEventHandler $eventHandler
 
array $participants_status
 
static _getInstanceByObjId(int $obj_id)
 
updateNotification(int $a_usr_id, bool $a_notification)
Update notification status. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
readParticipantsStatus()
Read status of participants (blocked, notification, passed) 
 
updateSubject(int $a_usr_id, string $a_subject)
 
deleteParticipants(array $a_user_ids)
 
const IL_ROLE_POSITION_ADMIN
 
isGroupingMember(int $a_usr_id, string $a_field='')
Check membership for. 
 
readSubscriberData(int $a_usr_id)
 
logStack(?int $level=null, string $message='', array $context=[])
 
static lookupShowMembersEnabled(int $a_obj_id)
 
fetchAssoc(ilDBStatement $statement)
 
static _isBlocked(int $a_obj_id, int $a_usr_id)
Check if user is blocked. 
 
static getInstance(int $a_ref_id)
 
static _getAllReferences(int $id)
get all reference ids for object ID 
 
static _isSubscriber(int $a_obj_id, int $a_usr_id)
 
static getInstanceByObjId(int $a_obj_id)
Get instance by obj type. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
isAdmin(int $a_usr_id)
check if user is admin 
 
const IL_ROLE_POSITION_MEMBER
 
quote($value, string $type)
 
assignSubscriber(int $a_usr_id)
 
isAssigned(int $a_usr_id)
check if user is assigned 
 
static getDefaultMemberRole(int $a_ref_id)
 
static _hasPassed(int $a_obj_id, int $a_usr_id)
Check if user has passed course. 
 
warning(string $message, array $context=[])
 
getAutoGeneratedRoleId(int $a_role_type)
 
static _lookupObjId(int $ref_id)
 
setRoleOrderPosition(int $a_user_id)
Set role order position. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
__construct(string $a_component_name, int $a_ref_id)
 
addRecommendation(int $a_usr_id)
Add desktop item  public. 
 
static _deleteUser(int $a_usr_id)
Delete user data. 
 
getAssignedRoles(int $a_usr_id)
Get assigned roles. 
 
static lookupSubscribersData(int $a_obj_id)
 
isNotificationEnabled(int $a_usr_id)
 
getMembers()
Get all members ids (admins and tutors are not members) Use get participants to fetch all...
 
static lookupShowMembersEnabled(int $a_obj_id)
 
static _lookupTitle(int $obj_id)
 
static _getInstanceByObjId(int $a_obj_id)
 
updateSubscriptionTime(int $a_usr_id, int $a_subtime)
 
static getInstance(int $a_ref_id)
 
static _getAllSupportContactsOfUser(int $a_usr_id, string $a_type)
Get all support contacts for a user. 
 
getCountParticipants()
Get number of participants. 
 
isMember(int $a_usr_id)
is user member 
 
getSubscribers()
get all subscribers int[] 
 
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id 
 
getParticipants()
Get all participants ids. 
 
deleteSubscriber(int $a_usr_id)
 
fetchObject(ilDBStatement $query_result)
 
updateBlocked(int $a_usr_id, bool $a_blocked)
Update blocked status. 
 
query(string $query)
Run a (read-only) Query on the database. 
 
static _deleteUser(int $a_usr_id)
 
static deleteUserEntry(int $a_usr_id, int $a_obj_id)
 
deleteSubscribers(array $a_usr_ids)
 
static hasParticipantListAccess(int $a_obj_id, int $a_usr_id=null)
Check if (current) user has access to the participant list. 
 
getRoles()
Get object roles. 
 
getSubscriberData(int $a_usr_id)
 
ilObjectDataCache $objectDataCache
 
assignSubscribers(array $a_usr_ids)
 
static _deleteAllEntries(int $a_obj_id)
Delete all entries Normally called in case of object deletion. 
 
isSubscriber(int $a_usr_id)
 
in(string $field, array $values, bool $negate=false, string $type="")
 
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id 
 
Base class for course and group participants. 
 
updateRoleAssignments($a_usr_id, $a_roles)
Update role assignments  public. 
 
static lookupNumberOfMembers(int $a_ref_id)
Lookup number of members. 
 
add(int $a_usr_id, int $a_role)
 
static _getInstanceByObjId(int $a_obj_id)
Get singleton instance. 
 
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins 
 
ilRecommendedContentManager $recommended_content_manager
 
getAdmins()
Get all admins ids. 
 
getComponent()
Get component name Used for raising events. 
 
static _getInstanceByObjId(int $a_obj_id)
 
getNotificationRecipients()
Get admin, tutor which have notification enabled. 
 
getContacts()
get user ids which are confirgured as contact 
 
static getUserMembershipAssignmentsByType(array $a_user_ids, array $a_type, bool $a_only_member_roles)
Get user membership assignments by type. 
 
static _isParticipant(int $a_ref_id, int $a_usr_id)
Static function to check if a user is a participant of the container object. 
 
const IL_ROLE_POSITION_TUTOR
 
static lookupNumberOfParticipants(int $a_ref_id)
Lookup the number of participants (crs admins, tutors, members, grp admins, members) ...
 
isLastAdmin(int $a_usr_id)
Check if user is last admin. 
 
Class ilRbacAdmin Core functions for role based access control. 
 
isBlocked(int $a_usr_id)
Check if user is blocked. 
 
addSubscriber(int $a_usr_id)
 
static _getMembershipByType(int $a_usr_id, array $a_type, bool $a_only_member_role=false)
get membership by type Get course or group membership 
 
isTutor(int $a_usr_id)
is user tutor 
 
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. 
 
manipulate(string $query)
Run a (write) Query on the database. 
 
static _lookupType(int $id, bool $reference=false)
 
static lookupSubscribers(int $a_obj_id)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
hasPassed(int $a_usr_id)
Check if user has passed object. 
 
getTutors()
Get all tutors ids. 
 
concat(array $values, bool $allow_null=true)