12define(
"IL_CRS_ADMIN", 1);
 
   13define(
"IL_CRS_TUTOR", 3);
 
   14define(
"IL_CRS_MEMBER", 2);
 
   16define(
'IL_GRP_ADMIN', 4);
 
   17define(
'IL_GRP_MEMBER', 5);
 
   19define(
'IL_SESS_MEMBER', 6);
 
   21define(
'IL_LSO_ADMIN', 7);
 
   22define(
'IL_LSO_MEMBER', 8);
 
   24define(
"IL_ROLE_POSITION_ADMIN", 1);
 
   25define(
"IL_ROLE_POSITION_TUTOR", 2);
 
   26define(
"IL_ROLE_POSITION_MEMBER", 3);
 
   81        $this->ilDB = 
$GLOBALS[
'DIC']->database();
 
   82        $this->lng = 
$GLOBALS[
'DIC']->language();
 
   83        $this->logger = 
$GLOBALS[
'DIC']->logger()->mem();
 
   85        $this->component = $a_component_name;
 
   87        $this->ref_id = $a_ref_id;
 
  112                include_once 
'./Modules/Session/classes/class.ilSessionParticipants.php';
 
  115                $GLOBALS[
'DIC']->logger()->mem()->logStack();
 
  116                $GLOBALS[
'DIC']->logger()->mem()->warning(
'Invalid ref_id -> obj_id given: ' . $a_ref_id . 
' -> ' . 
$obj_id);
 
  117                throw new \InvalidArgumentException(
'Invalid obj_id given.');
 
  134                include_once 
'./Modules/Course/classes/class.ilCourseParticipants.php';
 
  138                include_once 
'./Modules/Group/classes/class.ilGroupParticipants.php';
 
  142                include_once 
'./Modules/Session/classes/class.ilSessionParticipants.php';
 
  148                $GLOBALS[
'DIC']->logger()->mmbr()->warning(
': Invalid obj_id given: ' . $a_obj_id);
 
  149                throw new InvalidArgumentException(
'Invalid obj id given');
 
  173        $access = 
$DIC->access();
 
  176            $a_usr_id = 
$GLOBALS[
'DIC'][
'ilUser']->getId();
 
  183        if ($access->checkAccess(
'manage_members', 
'', 
$ref_id)) {
 
  187        if ($part->isAssigned($a_usr_id)) {
 
  188            if ($part->getType() == 
'crs') {
 
  193            if ($part->getType() == 
'grp') {
 
  212        ?
int $mail_obj_ref_id = 
null 
  216        $access = 
$DIC->access();
 
  217        $rbacsystem = 
$DIC->rbac()->system();
 
  219        if (is_null($usr_id)) {
 
  220            $usr_id = 
$DIC->user()->getId();
 
  222        if (is_null($mail_obj_ref_id)) {
 
  223            $mail_obj_ref_id = (
new ilMail($usr_id))->getMailObjectReferenceId();
 
  225        if (is_int($ref_id_or_instance)) {
 
  227        } elseif ($ref_id_or_instance instanceof 
ilObject) {
 
  228            $ref_id = (int) $ref_id_or_instance->getRefId();
 
  237            $access->checkAccess(
'manage_members', 
'', 
$ref_id) &&
 
  238            $rbacsystem->checkAccess(
'internal_mail', $mail_obj_ref_id)
 
  244        if (!$part->isAssigned($usr_id)) {
 
  248        $object = $ref_id_or_instance;
 
  249        if (is_int($ref_id_or_instance)) {
 
  276        $logger = 
$DIC->logger()->mmbr();
 
  279        if ($a_only_member_roles) {
 
  280            $j2 = 
"JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id) ";
 
  281            $a2 = 
'AND obd2.title = ' . 
$ilDB->concat(
 
  283                        array(
$ilDB->quote(
'il_', 
'text')),
 
  285                        array(
$ilDB->quote(
'_member_', 
'text')),
 
  292        $query = 
"SELECT DISTINCT obd.obj_id,obr.ref_id,ua.usr_id FROM rbac_ua ua " .
 
  293            "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id " .
 
  294            "JOIN object_reference obr ON fa.parent = obr.ref_id " .
 
  295            "JOIN object_data obd ON obr.obj_id = obd.obj_id " .
 
  297            "WHERE " . 
$ilDB->in(
"obd.type", $a_type, 
false, 
"text") .
 
  298            "AND fa.assign = 'y' " .
 
  299            'AND ' . 
$ilDB->in(
'ua.usr_id', $a_user_ids, 
false, 
'integer') . 
' ' .
 
  304        while ($row = 
$ilDB->fetchObject(
$res)) {
 
  305            $obj_ids[$row->obj_id][] = $row->usr_id;
 
  330        if (!is_array($a_type)) {
 
  331            $a_type = array($a_type);
 
  335        if ($a_only_member_role) {
 
  336            $j2 = 
"JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id) ";
 
  337            $a2 = 
'AND obd2.title = ' . 
$ilDB->concat(
 
  339                    array(
$ilDB->quote(
'il_', 
'text')),
 
  341                    array(
$ilDB->quote(
'_member_', 
'text')),
 
  349        $query = 
"SELECT DISTINCT obd.obj_id,obr.ref_id FROM rbac_ua ua " .
 
  350            "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id " .
 
  351            "JOIN object_reference obr ON fa.parent = obr.ref_id " .
 
  352            "JOIN object_data obd ON obr.obj_id = obd.obj_id " .
 
  354            "WHERE " . 
$ilDB->in(
"obd.type", $a_type, 
false, 
"text") . 
' ' .
 
  355            "AND fa.assign = 'y' " .
 
  356            "AND ua.usr_id = " . 
$ilDB->quote($a_usr_id, 
'integer') . 
" " .
 
  357            'AND obr.deleted IS NULL ' .
 
  360        while ($row = 
$ilDB->fetchObject(
$res)) {
 
  361            $ref_ids[] = $row->obj_id;
 
  364        return $ref_ids ? $ref_ids : array();
 
  381        $rbacreview = 
$DIC[
'rbacreview'];
 
  383        $local_roles = $rbacreview->getRolesOfRoleFolder($a_ref_id, 
false);
 
  385        return $rbacreview->isAssignedToAtLeastOneGivenRole($a_usr_id, $local_roles);
 
  399        $rbacreview = 
$DIC[
'rbacreview'];
 
  401        $lroles = $rbacreview->getRolesOfRoleFolder($a_ref_id, 
false);
 
  402        return $rbacreview->getNumberOfAssignedUsers($lroles);
 
  416        $rbacreview = 
$DIC->rbac()->review();
 
  417        $ilObjDataCache = 
$DIC[
'ilObjDataCache'];
 
  419        $has_policies = $rbacreview->getLocalPolicies($a_ref_id);
 
  421        if (!$has_policies) {
 
  424        $lroles = $rbacreview->getRolesOfRoleFolder($a_ref_id, 
false);
 
  426        $memberRoles = array();
 
  427        foreach ($lroles as $role_id) {
 
  428            $title = $ilObjDataCache->lookupTitle($role_id);
 
  429            switch (substr($title, 0, 8)) {
 
  436                    $memberRoles[] = $role_id;
 
  440        return $rbacreview->getNumberOfAssignedUsers($memberRoles);
 
  459        $query = 
"SELECT * FROM obj_members " .
 
  460            "WHERE obj_id = " . 
$ilDB->quote($a_obj_id, 
'integer') . 
" " .
 
  461            "AND usr_id = " . 
$ilDB->quote($a_usr_id, 
'integer') . 
" " .
 
  462            "AND blocked = " . 
$ilDB->quote(1, 
'integer');
 
  464        return $res->numRows() ? 
true : 
false;
 
  482        $query = 
"SELECT * FROM obj_members " .
 
  483            "WHERE obj_id = " . 
$ilDB->quote($a_obj_id, 
'integer') . 
" " .
 
  484            "AND usr_id = " . 
$ilDB->quote($a_usr_id, 
'integer') . 
" " .
 
  487        return $res->numRows() ? 
true : 
false;
 
  505        $query = 
"DELETE FROM obj_members " .
 
  506            "WHERE obj_id = " . 
$ilDB->quote($a_obj_id, 
'integer') . 
" ";
 
  509        $query = 
"DELETE FROM il_subscribers " .
 
  510            "WHERE obj_id = " . 
$ilDB->quote($a_obj_id, 
'integer') . 
"";
 
  513        $query = 
'DELETE FROM crs_waiting_list ' .
 
  514                'WHERE obj_id = ' . 
$ilDB->quote($a_obj_id, 
'integer');
 
  534        $query = 
"DELETE FROM obj_members WHERE usr_id = " . 
$ilDB->quote($a_usr_id, 
'integer') . 
"";
 
  537        $query = 
"DELETE FROM il_subscribers WHERE usr_id = " . 
$ilDB->quote($a_usr_id, 
'integer') . 
"";
 
  540        include_once 
'./Modules/Course/classes/class.ilCourseWaitingList.php';
 
  548        $ilCtrl = 
$DIC[
'ilCtrl'];
 
  553        if (!in_array(
$type, array(
'crs',
'grp'))) {
 
  559        $rbacreview = 
$DIC[
'rbacreview'];
 
  562        $roles = $rbacreview->getRolesOfRoleFolder($a_ref_id, 
false);
 
  564        foreach ($roles as $role) {
 
  566            if (substr($title, 0, 13) == (
'il_' . 
$type . 
'_member')) {
 
  579        return $this->obj_id;
 
  603        $query = 
"SELECT * FROM obj_members " .
 
  604            "WHERE notification = 1 " .
 
  605            "AND obj_id = " . 
$ilDB->quote($this->obj_id) . 
" ";
 
  609            if ($this->isAdmin($row->usr_id) or $this->isTutor($row->usr_id)) {
 
  610                $recp[] = $row->usr_id;
 
  624        return count($this->members);
 
  635        return count($this->participants);
 
  649        return $this->participants ? $this->participants : array();
 
  661        return $this->members ? $this->members : array();
 
  671        return $this->admins ? $this->admins : array();
 
  680        return count($this->getAdmins());
 
  692        return $this->tutors ? $this->tutors : array();
 
  704        return in_array($a_usr_id, $this->admins) ? 
true : 
false;
 
  716        return in_array($a_usr_id, $this->tutors) ? 
true : 
false;
 
  728        return in_array($a_usr_id, $this->members) ? 
true : 
false;
 
  743        return in_array($a_usr_id, $this->participants);
 
  753        return in_array($a_usr_id, $this->getAdmins()) and count($this->getAdmins()) == 1;
 
  766        return $this->roles ? $this->roles : array();
 
  780        $rbacreview = 
$DIC[
'rbacreview'];
 
  782        foreach ($this->roles as $role) {
 
  783            if ($rbacreview->isAssigned($a_usr_id, $role)) {
 
  787        return $assigned ? $assigned : array();
 
  802        $rbacreview = 
$DIC[
'rbacreview'];
 
  803        $rbacadmin = 
$DIC[
'rbacadmin'];
 
  805        $roles = $a_roles ? $a_roles : array();
 
  807        foreach ($this->getRoles() as $role_id) {
 
  808            if ($rbacreview->isAssigned($a_usr_id, $role_id)) {
 
  809                if (!in_array($role_id, $roles)) {
 
  810                    $rbacadmin->deassignUser($role_id, $a_usr_id);
 
  813                if (in_array($role_id, $roles)) {
 
  814                    $rbacadmin->assignUser($role_id, $a_usr_id);
 
  818        $rbacreview->clearCaches();
 
  819        $this->readParticipants();
 
  820        $this->readParticipantsStatus();
 
  832        foreach ($this->getAdmins() as $admin_id) {
 
  833            if (!in_array($admin_id, $a_usr_ids)) {
 
  849        if (isset($this->participants_status[$a_usr_id])) {
 
  850            return $this->participants_status[$a_usr_id][
'blocked'] ? 
true : 
false;
 
  864        if (isset($this->participants_status[$a_usr_id])) {
 
  865            return $this->participants_status[$a_usr_id][
'passed'] ? 
true : 
false;
 
  877    public function delete($a_usr_id)
 
  881        $rbacadmin = 
$DIC[
'rbacadmin'];
 
  884        $this->recommended_content_manager->removeObjectRecommendation($a_usr_id, $this->ref_id);
 
  886        foreach ($this->roles as $role_id) {
 
  887            $rbacadmin->deassignUser($role_id, $a_usr_id);
 
  890        $query = 
"DELETE FROM obj_members " .
 
  891            "WHERE usr_id = " . 
$ilDB->quote($a_usr_id, 
'integer') . 
" " .
 
  892            "AND obj_id = " . 
$ilDB->quote($this->obj_id, 
'integer');
 
  895        $this->readParticipants();
 
  896        $this->readParticipantsStatus();
 
  898        $GLOBALS[
'DIC'][
'ilAppEventHandler']->raise(
 
  899            $this->getComponent(),
 
  902                    'obj_id' => $this->obj_id,
 
  903                    'usr_id' => $a_usr_id)
 
  923        $this->participants_status[$a_usr_id][
'blocked'] = (int) $a_blocked;
 
  925        $query = 
"SELECT * FROM obj_members " .
 
  926        "WHERE obj_id = " . 
$ilDB->quote($this->obj_id, 
'integer') . 
" " .
 
  927        "AND usr_id = " . 
$ilDB->quote($a_usr_id, 
'integer');
 
  929        if (
$res->numRows()) {
 
  930            $query = 
"UPDATE obj_members SET " .
 
  931                "blocked = " . 
$ilDB->quote((
int) $a_blocked, 
'integer') . 
" " .
 
  932                "WHERE obj_id = " . 
$ilDB->quote($this->obj_id, 
'integer') . 
" " .
 
  933                "AND usr_id = " . 
$ilDB->quote($a_usr_id, 
'integer');
 
  935            $query = 
"INSERT INTO obj_members (blocked,obj_id,usr_id,notification,passed) " .
 
  937                $ilDB->quote((
int) $a_blocked, 
'integer') . 
", " .
 
  938                $ilDB->quote($this->obj_id, 
'integer') . 
", " .
 
  939                $ilDB->quote($a_usr_id, 
'integer') . 
", " .
 
  940                $ilDB->quote(0, 
'integer') . 
", " .
 
  941                $ilDB->quote(0, 
'integer') .
 
  963            'UPDATE obj_members SET ' .
 
  964                'contact = ' . 
$ilDB->quote($a_contact, 
'integer') . 
' ' .
 
  965                'WHERE obj_id = ' . 
$ilDB->quote($this->obj_id, 
'integer') . 
' ' .
 
  966                'AND usr_id = ' . 
$ilDB->quote($a_usr_id, 
'integer')
 
  969        $this->participants_status[$a_usr_id][
'contact'] = $a_contact;
 
  980        foreach ((array) $this->participants_status as $usr_id => $status) {
 
  981            if ($status[
'contact']) {
 
  982                $contacts[] = $usr_id;
 
 1005        $this->participants_status[$a_usr_id][
'notification'] = (int) $a_notification;
 
 1007        $query = 
"SELECT * FROM obj_members " .
 
 1008        "WHERE obj_id = " . 
$ilDB->quote($this->obj_id, 
'integer') . 
" " .
 
 1009        "AND usr_id = " . 
$ilDB->quote($a_usr_id, 
'integer');
 
 1011        if (
$res->numRows()) {
 
 1012            $query = 
"UPDATE obj_members SET " .
 
 1013                "notification = " . 
$ilDB->quote((
int) $a_notification, 
'integer') . 
" " .
 
 1014                "WHERE obj_id = " . 
$ilDB->quote($this->obj_id, 
'integer') . 
" " .
 
 1015                "AND usr_id = " . 
$ilDB->quote($a_usr_id, 
'integer');
 
 1017            $query = 
"INSERT INTO obj_members (notification,obj_id,usr_id,passed,blocked) " .
 
 1019                $ilDB->quote((
int) $a_notification, 
'integer') . 
", " .
 
 1020                $ilDB->quote($this->obj_id, 
'integer') . 
", " .
 
 1021                $ilDB->quote($a_usr_id, 
'integer') . 
", " .
 
 1022                $ilDB->quote(0, 
'integer') . 
", " .
 
 1023                $ilDB->quote(0, 
'integer') .
 
 1041    public function add($a_usr_id, $a_role)
 
 1045        $rbacadmin = 
$DIC[
'rbacadmin'];
 
 1046        $ilAppEventHandler = 
$DIC[
'ilAppEventHandler'];
 
 1048        if ($this->isAssigned($a_usr_id)) {
 
 1054                $this->admins[] = $a_usr_id;
 
 1058                $this->tutors[] = $a_usr_id;
 
 1062                $this->members[] = $a_usr_id;
 
 1066                $this->admins[] = $a_usr_id;
 
 1070                $this->members[] = $a_usr_id;
 
 1074                $this->admins[] = $a_usr_id;
 
 1078                $this->members[] = $a_usr_id;
 
 1082                $this->members[] = $a_usr_id;
 
 1086        $this->participants[] = $a_usr_id;
 
 1087        $rbacadmin->assignUser($this->role_data[$a_role], $a_usr_id);
 
 1090        $this->deleteSubscriber($a_usr_id);
 
 1092        include_once 
'./Services/Membership/classes/class.ilWaitingList.php';
 
 1095        $ilAppEventHandler->raise(
 
 1096            $this->getComponent(),
 
 1099                    'obj_id' => $this->obj_id,
 
 1100                    'usr_id' => $a_usr_id,
 
 1101                    'role_id' => $a_role)
 
 1116        foreach ($a_user_ids as $user_id) {
 
 1117            $this->
delete($user_id);
 
 1148        if (isset($this->participants_status[$a_usr_id])) {
 
 1149            return $this->participants_status[$a_usr_id][
'notification'] ? 
true : 
false;
 
 1161        if (isset($this->participants_status[$a_usr_id])) {
 
 1162            return (
bool) $this->participants_status[$a_usr_id][
'contact'];
 
 1175        if (array_key_exists($a_role_type, $this->role_data)) {
 
 1176            return $this->role_data[$a_role_type];
 
 1194        $rbacreview = 
$DIC[
'rbacreview'];
 
 1195        $ilObjDataCache = 
$DIC[
'ilObjDataCache'];
 
 1196        $ilLog = 
$DIC[
'ilLog'];
 
 1198        $GLOBALS[
'DIC'][
'rbacreview']->clearCaches();
 
 1199        $this->roles = $rbacreview->getRolesOfRoleFolder($this->ref_id, 
false);
 
 1202        $this->participants = array();
 
 1203        $this->members = $this->admins = $this->tutors = array();
 
 1205        $additional_roles = [];
 
 1206        $auto_generated_roles = [];
 
 1207        foreach ($this->roles as $role_id) {
 
 1208            $title = $ilObjDataCache->lookupTitle($role_id);
 
 1209            switch (substr($title, 0, 8)) {
 
 1213                    $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
 
 1214                    $this->members = array_unique(array_merge($assigned, $this->members));
 
 1215                    $this->role_assignments[$role_id] = $assigned;
 
 1221                    $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
 
 1222                    $this->admins = $rbacreview->assignedUsers($role_id);
 
 1223                    $this->role_assignments[$role_id] = $assigned;
 
 1229                    $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
 
 1230                    $this->tutors = $rbacreview->assignedUsers($role_id);
 
 1231                    $this->role_assignments[$role_id] = $assigned;
 
 1237                    $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
 
 1238                    $this->admins = $rbacreview->assignedUsers($role_id);
 
 1239                    $this->role_assignments[$role_id] = $assigned;
 
 1245                    $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
 
 1246                    $this->members = $rbacreview->assignedUsers($role_id);
 
 1247                    $this->role_assignments[$role_id] = $assigned;
 
 1252                    $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
 
 1253                    $this->members = $rbacreview->assignedUsers($role_id);
 
 1259                    $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
 
 1260                    $this->members = $rbacreview->assignedUsers($role_id);
 
 1261                    $this->role_assignments[$role_id] = $assigned;
 
 1267                    $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
 
 1268                    $this->admins = $rbacreview->assignedUsers($role_id);
 
 1269                    $this->role_assignments[$role_id] = $assigned;
 
 1273                    $additional_roles[$role_id] = $title;
 
 1274                    $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
 
 1275                    $this->members = array_unique(array_merge($assigned, $this->members));
 
 1276                    $this->role_assignments[$role_id] = $assigned;
 
 1280        asort($auto_generated_roles);
 
 1281        asort($additional_roles);
 
 1282        $this->roles_sorted = $auto_generated_roles + $additional_roles;
 
 1298        $query = 
"SELECT * FROM obj_members " .
 
 1299            "WHERE obj_id = " . 
$ilDB->quote($this->obj_id, 
'integer') . 
" ";
 
 1301        $this->participants_status = array();
 
 1303            $this->participants_status[$row->usr_id][
'blocked'] = $row->blocked;
 
 1304            $this->participants_status[$row->usr_id][
'notification'] = $row->notification;
 
 1305            $this->participants_status[$row->usr_id][
'passed'] = $row->passed;
 
 1307            $this->participants_status[$row->usr_id][
'contact'] = $row->contact;
 
 1323        $rbacreview = 
$DIC[
'rbacreview'];
 
 1324        $ilObjDataCache = 
$DIC[
'ilObjDataCache'];
 
 1329            include_once 
'./Services/User/classes/class.ilObjUser.php';
 
 1334                    $and = 
"AND login = " . 
$ilDB->quote($tmp_user->getLogin(), 
'text') . 
" ";
 
 1337                    $and = 
"AND email = " . 
$ilDB->quote($tmp_user->getEmail(), 
'text') . 
" ";
 
 1339                case 'matriculation':
 
 1340                    $and = 
"AND matriculation = " . 
$ilDB->quote($tmp_user->getMatriculation(), 
'text') . 
" ";
 
 1344                    $and = 
"AND usr_id = " . 
$ilDB->quote($a_usr_id, 
'integer') . 
" ";
 
 1348            if (!$this->getParticipants()) {
 
 1352            $query = 
"SELECT * FROM usr_data ud " .
 
 1353                "WHERE " . 
$ilDB->in(
'usr_id', $this->getParticipants(), 
false, 
'integer') . 
" " .
 
 1357            return $res->numRows() ? 
true : 
false;
 
 1367        $subscribers = array();
 
 1368        $query = 
"SELECT usr_id FROM il_subscribers " .
 
 1369            "WHERE obj_id = " . 
$ilDB->quote($a_obj_id, 
'integer') . 
" " .
 
 1370            "ORDER BY sub_time ";
 
 1374            $subscribers[] = $row->usr_id;
 
 1376        return $subscribers;
 
 1386        $this->readSubscribers();
 
 1388        return $this->subscribers;
 
 1399        return count($this->getSubscribers());
 
 1409        return $this->readSubscriberData($a_usr_id);
 
 1421        if (!is_array($a_usr_ids) or !count($a_usr_ids)) {
 
 1424        foreach ($a_usr_ids as $id) {
 
 1425            if (!$this->assignSubscriber($id)) {
 
 1444        if (!$this->isSubscriber($a_usr_id)) {
 
 1445            $ilErr->appendMessage($this->lng->txt(
"crs_user_notsubscribed"));
 
 1449        if ($this->isAssigned($a_usr_id)) {
 
 1451            $ilErr->appendMessage($tmp_obj->getLogin() . 
": " . $this->lng->txt(
"crs_user_already_assigned"));
 
 1457            $ilErr->appendMessage($this->lng->txt(
"crs_user_not_exists"));
 
 1473            $this->
register($tmp_obj->getId());
 
 1475        $this->deleteSubscriber($a_usr_id);
 
 1486        $this->readSubscribers();
 
 1489        foreach ($this->subscribers as $subscriber) {
 
 1490            if (!$this->assignSubscriber($subscriber)) {
 
 1494                #$this->sendNotification($this->NOTIFY_ACCEPT_SUBSCRIBER,$subscriber); 
 1513        $query = 
"INSERT INTO il_subscribers (usr_id,obj_id,subject,sub_time) " .
 
 1515            $ilDB->quote($a_usr_id, 
'integer') . 
"," .
 
 1516            $ilDB->quote($this->obj_id, 
'integer') . 
", " .
 
 1517            $ilDB->quote(
'', 
'text') . 
", " .
 
 1518            $ilDB->quote(time(), 
'integer') .
 
 1537        $query = 
"UPDATE il_subscribers " .
 
 1538            "SET sub_time = " . 
$ilDB->quote($a_subtime, 
'integer') . 
" " .
 
 1539            "WHERE usr_id = " . 
$ilDB->quote($a_usr_id, 
'integer') . 
" " .
 
 1540            "AND obj_id = " . 
$ilDB->quote($this->obj_id, 
'integer') . 
" ";
 
 1559        $query = 
"UPDATE il_subscribers " .
 
 1560            "SET subject = " . 
$ilDB->quote($a_subject, 
'text') . 
" " .
 
 1561            "WHERE usr_id = " . 
$ilDB->quote($a_usr_id, 
'integer') . 
" " .
 
 1562            "AND obj_id = " . 
$ilDB->quote($this->obj_id, 
'integer') . 
" ";
 
 1579        $query = 
"DELETE FROM il_subscribers " .
 
 1580            "WHERE usr_id = " . 
$ilDB->quote($a_usr_id, 
'integer') . 
" " .
 
 1581            "AND obj_id = " . 
$ilDB->quote($this->obj_id, 
'integer') . 
" ";
 
 1600        if (!is_array($a_usr_ids) or !count($a_usr_ids)) {
 
 1602            $ilErr->appendMessage($this->lng->txt(
"no_usr_ids_given"));
 
 1606        $query = 
"DELETE FROM il_subscribers " .
 
 1607            "WHERE " . 
$ilDB->in(
'usr_id', (array) $a_usr_ids, 
false, 
'integer') . 
" " .
 
 1608            "AND obj_id = " . 
$ilDB->quote($this->obj_id, 
'integer');
 
 1625        $query = 
"SELECT * FROM il_subscribers " .
 
 1626            "WHERE usr_id = " . 
$ilDB->quote($a_usr_id, 
'integer') . 
" " .
 
 1627            "AND obj_id = " . 
$ilDB->quote($this->obj_id, 
'integer') . 
"";
 
 1648        $query = 
"SELECT * FROM il_subscribers " .
 
 1649            "WHERE usr_id = " . 
$ilDB->quote($a_usr_id, 
'integer') . 
" " .
 
 1650            "AND obj_id = " . 
$ilDB->quote($a_obj_id, 
'integer') . 
"";
 
 1670        $this->subscribers = array();
 
 1672        $query = 
"SELECT usr_id FROM il_subscribers " .
 
 1673            "WHERE obj_id = " . 
$ilDB->quote($this->obj_id, 
'integer') . 
" " .
 
 1674            "ORDER BY sub_time ";
 
 1680                $this->deleteSubscriber($row->usr_id);
 
 1682            $this->subscribers[] = $row->usr_id;
 
 1698        $query = 
"SELECT * FROM il_subscribers " .
 
 1699            "WHERE obj_id = " . 
$ilDB->quote($this->obj_id, 
'integer') . 
" " .
 
 1700            "AND usr_id = " . 
$ilDB->quote($a_usr_id, 
'integer') . 
"";
 
 1704            $data[
"time"] = $row->sub_time;
 
 1705            $data[
"usr_id"] = $row->usr_id;
 
 1706            $data[
'subject'] = $row->subject;
 
 1717        $query = 
'SELECT * FROM il_subscribers ' .
 
 1718            'WHERE obj_id = ' . 
$ilDB->quote($a_obj_id, 
'integer');
 
 1723            $data[$row->usr_id][
'time'] = $row->sub_time;
 
 1724            $data[$row->usr_id][
'usr_id'] = $row->usr_id;
 
 1725            $data[$row->usr_id][
'subject'] = $row->subject;
 
 1747        $j2 = 
"JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id) ";
 
 1748        $a2 = 
"AND obd2.title LIKE 'il_" . $a_type . 
"_mem%' ";
 
 1751        $query = 
"SELECT DISTINCT obd.obj_id,obr.ref_id FROM rbac_ua ua " .
 
 1752            "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id " .
 
 1753            "JOIN object_reference obr ON fa.parent = obr.ref_id " .
 
 1754            "JOIN object_data obd ON obr.obj_id = obd.obj_id " .
 
 1756            "WHERE obd.type = " . 
$ilDB->quote($a_type, 
'text') . 
" " .
 
 1757            "AND fa.assign = 'y' " .
 
 1758            "AND ua.usr_id = " . 
$ilDB->quote($a_usr_id, 
'integer') . 
" " .
 
 1763        while ($row = 
$ilDB->fetchObject(
$res)) {
 
 1764            $obj_ids[] = $row->obj_id;
 
 1767        $set = 
$ilDB->query(
"SELECT obj_id, usr_id FROM obj_members " .
 
 1768            " WHERE " . 
$ilDB->in(
"obj_id", $obj_ids, 
false, 
"integer") .
 
 1769            " AND contact = " . 
$ilDB->quote(1, 
"integer"));
 
 1771        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
 1786        $sortable_assignments = 
'9999999999';
 
 1787        foreach ($this->roles_sorted as $role_id => $trash) {
 
 1788            if (in_array($a_user_id, (array) $this->role_assignments[$role_id])) {
 
 1789                $sortable_assignments = substr_replace($sortable_assignments, 
'1', $counter, 1);
 
 1793        return $sortable_assignments;
 
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
An exception for terminatinating execution or to throw for unit testing.
return true
Flag indicating whether or not HTTP headers will be sent when outputting captcha image/audio.
const IL_CRS_ADMIN
Base class for course and group participants.
const IL_ROLE_POSITION_TUTOR
const IL_ROLE_POSITION_ADMIN
const IL_ROLE_POSITION_MEMBER
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static _getInstanceByObjId(int $obj_id)
static lookupShowMembersEnabled($a_obj_id)
Check if show member is enabled.
static lookupShowMembersEnabled(int $a_obj_id)
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
Class ilObject Basic functions for all objects.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
static _lookupType($a_id, $a_reference=false)
lookup object type
getAdmins()
Get all admins ids.
getComponent()
Get component name Used for raising events.
isLastAdmin($a_usr_id)
Check if user is last admin.
isAssigned($a_usr_id)
check if user is assigned
updateSubject($a_usr_id, $a_subject)
update subject
assignSubscribers($a_usr_ids)
Assign subscribers.
static getDefaultMemberRole($a_ref_id)
isTutor($a_usr_id)
is user tutor
static hasParticipantListAccess($a_obj_id, $a_usr_id=null)
Check if (current) user has access to the participant list.
getParticipants()
Get all participants ids.
readParticipants()
Read participants.
static _isSubscriber($a_obj_id, $a_usr_id)
check if user is subscriber
deleteSubscriber($a_usr_id)
Delete subsciber.
static getInstanceByObjId($a_obj_id)
Get instance by obj type.
getRoles()
Get course roles.
getCountParticipants()
Get number of participants.
isMember($a_usr_id)
is user member
isAdmin($a_usr_id)
is user admin
getSubscriberData($a_usr_id)
get subscriber data
getType()
Get object type.
addRecommendation($a_usr_id)
Add desktop item.
updateSubscriptionTime($a_usr_id, $a_subtime)
Update subscription time.
add($a_usr_id, $a_role)
Add user to object.
__construct($a_component_name, $a_ref_id)
Singleton Constructor.
static _isParticipant($a_ref_id, $a_usr_id)
Static function to check if a user is a participant of the container object.
getAssignedRoles($a_usr_id)
Get assigned roles.
static _getAllSupportContactsOfUser($a_usr_id, $a_type)
Get all support contacts for a user.
$recommended_content_manager
static lookupNumberOfParticipants($a_ref_id)
Lookup the number of participants (crs admins, tutors, members, grp admins, members)
static _getMembershipByType($a_usr_id, $a_type, $a_only_member_role=false)
get membership by type Get course or group membership
static _isBlocked($a_obj_id, $a_usr_id)
Check if user is blocked.
readParticipantsStatus()
Read status of participants (blocked, notification, passed)
isGroupingMember($a_usr_id, $a_field='')
Check grouping membership.
static canSendMailToMembers( $ref_id_or_instance, ?int $usr_id=null, ?int $mail_obj_ref_id=null)
This method was introduced as a band-aid fix for #22764.
updateNotification($a_usr_id, $a_notification)
Update notification status.
updateRoleAssignments($a_usr_id, $a_roles)
Update role assignments.
getCountSubscribers()
get number of subscribers
autoFillSubscribers()
Assign subscriber.
static lookupSubscribersData($a_obj_id)
getNotificationRecipients()
Get admin, tutor which have notification enabled.
static lookupSubscribers($a_obj_id)
deleteSubscribers($a_usr_ids)
Delete subscibers.
getMembers()
Get all members ids (admins and tutors are not members) Use get participants to fetch all.
isNotificationEnabled($a_usr_id)
check if notification is enabled
getSubscribers()
get all subscribers
getCountMembers()
Get number of members (not participants)
getObjId()
get current obj_id
assignSubscriber($a_usr_id)
Assign subscriber.
static getInstance($a_ref_id)
Get instance by ref_id.
getContacts()
get user ids which are confirgured as contact
hasPassed($a_usr_id)
Check if user has passed course.
static _hasPassed($a_obj_id, $a_usr_id)
Check if user has passed course.
deleteParticipants($a_user_ids)
Delete users.
isSubscriber($a_usr_id)
check if is subscriber
setRoleOrderPosition($a_user_id)
Set role order position.
static lookupNumberOfMembers($a_ref_id)
Lookup number of members @global ilRbacReview $rbacreview @global <type> $ilObjDataCache.
updateContact($a_usr_id, $a_contact)
Update contact setting @global type $ilDB.
static _deleteUser($a_usr_id)
Delete user data.
readSubscriberData($a_usr_id)
read subscribers
getCountAdmins()
Get number of admins.
checkLastAdmin($a_usr_ids)
Check if user for deletion are last admins.
static _deleteAllEntries($a_obj_id)
Delete all entries Normally called for course deletion.
readSubscribers()
read subscribers
getTutors()
Get all tutors ids.
getAutoGeneratedRoleId($a_role_type)
Get role id of auto generated role type.
addSubscriber($a_usr_id)
Add subscriber.
updateBlocked($a_usr_id, $a_blocked)
Update blocked status.
isContact($a_usr_id)
Check if user is contact.
static getUserMembershipAssignmentsByType($a_user_ids, $a_type, $a_only_member_roles)
Get user membership assignments by type.
isBlocked($a_usr_id)
Check if user is blocked.
Recommended content manager (business logic)
Session participation handling.
static _getInstanceByObjId($a_obj_id)
Get instance.
static getInstance($a_ref_id)
Get instance.
static _deleteUser($a_usr_id)
Delete user.
static deleteUserEntry($a_usr_id, $a_obj_id)
Delete one user entry.
foreach($_POST as $key=> $value) $res