19declare(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();
82 $this->objectDataCache =
$DIC[
'ilObjDataCache'];
83 $this->
error = $DIC[
'ilErr'];
84 $this->component = $a_component_name;
85 $this->ref_id = $a_ref_id;
113 throw new InvalidArgumentException(
'Invalid obj_id given.');
142 $logger()->mmbr()->
warning(
': Invalid obj_id given: ' . $a_obj_id);
143 throw new InvalidArgumentException(
'Invalid obj id given');
163 $access =
$DIC->access();
166 $a_usr_id =
$DIC->user()->getId();
173 if ($access->checkAccess(
'manage_members',
'',
$ref_id)) {
177 if ($part->isAssigned($a_usr_id)) {
178 if ($part->getType() ===
'crs') {
183 if ($part->getType() ===
'grp') {
202 ?
int $mail_obj_ref_id =
null
206 $access =
$DIC->access();
207 $rbacsystem =
$DIC->rbac()->system();
209 if (is_null($usr_id)) {
210 $usr_id =
$DIC->user()->getId();
212 if (is_null($mail_obj_ref_id)) {
213 $mail_obj_ref_id = (
new ilMail($usr_id))->getMailObjectReferenceId();
215 if (is_int($ref_id_or_instance)) {
217 } elseif ($ref_id_or_instance instanceof
ilObject) {
218 $ref_id = (
int) $ref_id_or_instance->getRefId();
227 $access->checkAccess(
'manage_members',
'',
$ref_id) &&
228 $rbacsystem->checkAccess(
'internal_mail', $mail_obj_ref_id)
234 if (!$part->isAssigned($usr_id)) {
238 $object = $ref_id_or_instance;
239 if (is_int($ref_id_or_instance)) {
261 bool $a_only_member_roles
268 if ($a_only_member_roles) {
269 $j2 =
"JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id) ";
270 $a2 =
'AND obd2.title = ' .
$ilDB->concat(
272 array(
$ilDB->quote(
'il_',
'text')),
274 array(
$ilDB->quote(
'_member_',
'text')),
281 $query =
"SELECT DISTINCT obd.obj_id,obr.ref_id,ua.usr_id FROM rbac_ua ua " .
282 "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id " .
283 "JOIN object_reference obr ON fa.parent = obr.ref_id " .
284 "JOIN object_data obd ON obr.obj_id = obd.obj_id " .
286 "WHERE " .
$ilDB->in(
"obd.type", $a_type,
false,
"text") .
287 "AND fa.assign = 'y' " .
288 'AND ' .
$ilDB->in(
'ua.usr_id', $a_user_ids,
false,
'integer') .
' ' .
293 while ($row =
$ilDB->fetchObject(
$res)) {
294 $obj_ids[(
int) $row->obj_id][] = (
int) $row->usr_id;
309 bool $a_only_member_role =
false
318 if ($a_only_member_role) {
319 $j2 =
"JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id) ";
320 $a2 =
'AND obd2.title = ' .
$ilDB->concat(
322 array(
$ilDB->quote(
'il_',
'text')),
324 array(
$ilDB->quote(
'_member_',
'text')),
332 $query =
"SELECT DISTINCT obd.obj_id,obr.ref_id FROM rbac_ua ua " .
333 "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id " .
334 "JOIN object_reference obr ON fa.parent = obr.ref_id " .
335 "JOIN object_data obd ON obr.obj_id = obd.obj_id " .
337 "WHERE " .
$ilDB->in(
"obd.type", $a_type,
false,
"text") .
' ' .
338 "AND fa.assign = 'y' " .
339 "AND ua.usr_id = " .
$ilDB->quote($a_usr_id,
'integer') .
" " .
340 'AND obr.deleted IS NULL ' .
344 while ($row =
$ilDB->fetchObject(
$res)) {
345 $ref_ids[] = (
int) $row->obj_id;
357 $rbacreview =
$DIC->rbac()->review();
358 $local_roles = $rbacreview->getRolesOfRoleFolder($a_ref_id,
false);
359 return $rbacreview->isAssignedToAtLeastOneGivenRole($a_usr_id, $local_roles);
369 $rbacreview =
$DIC->rbac()->review();
370 $lroles = $rbacreview->getRolesOfRoleFolder($a_ref_id,
false);
371 return $rbacreview->getNumberOfAssignedUsers($lroles);
381 $rbacreview =
$DIC->rbac()->review();
382 $ilObjDataCache =
$DIC[
'ilObjDataCache'];
383 $has_policies = $rbacreview->getLocalPolicies($a_ref_id);
384 if (!$has_policies) {
387 $lroles = $rbacreview->getRolesOfRoleFolder($a_ref_id,
false);
388 $memberRoles = array();
389 foreach ($lroles as $role_id) {
390 $title = $ilObjDataCache->lookupTitle($role_id);
391 switch (substr($title, 0, 8)) {
399 $memberRoles[] = $role_id;
403 return $rbacreview->getNumberOfAssignedUsers($memberRoles);
409 public static function _isBlocked(
int $a_obj_id,
int $a_usr_id): bool
414 $query =
"SELECT * FROM obj_members " .
415 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
'integer') .
" " .
416 "AND usr_id = " .
$ilDB->quote($a_usr_id,
'integer') .
" " .
417 "AND blocked = " .
$ilDB->quote(1,
'integer');
419 return (
bool)
$res->numRows();
425 public static function _hasPassed(
int $a_obj_id,
int $a_usr_id): bool
430 $query =
"SELECT * FROM obj_members " .
431 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
'integer') .
" " .
432 "AND usr_id = " .
$ilDB->quote($a_usr_id,
'integer') .
" " .
435 return (
bool)
$res->numRows();
447 $query =
"DELETE FROM obj_members " .
448 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
'integer') .
" ";
451 $query =
"DELETE FROM il_subscribers " .
452 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
'integer') .
" ";
455 $query =
'DELETE FROM crs_waiting_list ' .
456 'WHERE obj_id = ' .
$ilDB->quote($a_obj_id,
'integer');
468 $query =
"DELETE FROM obj_members WHERE usr_id = " .
$ilDB->quote($a_usr_id,
'integer');
471 $query =
"DELETE FROM il_subscribers WHERE usr_id = " .
$ilDB->quote($a_usr_id,
'integer');
481 $rbacreview =
$DIC->rbac()->review();
486 if (!in_array(
$type, array(
'crs',
'grp'))) {
490 $roles = $rbacreview->getRolesOfRoleFolder($a_ref_id,
false);
491 foreach ($roles as $role) {
493 if (strpos($title, (
'il_' .
$type .
'_member')) === 0) {
502 return $this->obj_id;
516 $query =
"SELECT * FROM obj_members " .
517 "WHERE notification = 1 " .
522 if ($this->isAdmin((
int) $row->usr_id) || $this->isTutor((
int) $row->usr_id)) {
523 $recp[] = (
int) $row->usr_id;
534 return count($this->members);
542 return count($this->participants);
551 return $this->participants;
561 return $this->members;
570 return $this->admins;
575 return count($this->getAdmins());
584 return $this->tutors;
592 return in_array($a_usr_id, $this->admins);
600 return in_array($a_usr_id, $this->tutors);
608 return in_array($a_usr_id, $this->members);
616 return in_array($a_usr_id, $this->participants);
624 return in_array($a_usr_id, $this->getAdmins()) && count($this->getAdmins()) === 1;
641 foreach ($this->roles as $role) {
642 if ($this->rbacReview->isAssigned($a_usr_id, $role)) {
657 foreach ($this->getRoles() as $role_id) {
658 if ($this->rbacReview->isAssigned($a_usr_id, $role_id)) {
659 if (!in_array($role_id, $a_roles)) {
660 $this->rbacAdmin->deassignUser($role_id, $a_usr_id);
662 } elseif (in_array($role_id, $a_roles)) {
663 $this->rbacAdmin->assignUser($role_id, $a_usr_id);
666 $this->rbacReview->clearCaches();
667 $this->readParticipants();
668 $this->readParticipantsStatus();
679 foreach ($this->getAdmins() as $admin_id) {
680 if (!in_array($admin_id, $a_usr_ids)) {
692 if (isset($this->participants_status[$a_usr_id])) {
693 return (
bool) $this->participants_status[$a_usr_id][
'blocked'];
703 if (isset($this->participants_status[$a_usr_id])) {
704 return (
bool) $this->participants_status[$a_usr_id][
'passed'];
712 public function delete(
int $a_usr_id):
void
714 $this->recommended_content_manager->removeObjectRecommendation($a_usr_id, $this->ref_id);
715 foreach ($this->roles as $role_id) {
716 $this->rbacAdmin->deassignUser($role_id, $a_usr_id);
719 $query =
"DELETE FROM obj_members " .
720 "WHERE usr_id = " . $this->ilDB->quote($a_usr_id,
'integer') .
" " .
721 "AND obj_id = " . $this->ilDB->quote($this->obj_id,
'integer');
724 $this->readParticipants();
725 $this->readParticipantsStatus();
727 $this->eventHandler->raise(
728 $this->getComponent(),
731 'obj_id' => $this->obj_id,
732 'usr_id' => $a_usr_id
742 $this->participants_status[$a_usr_id][
'blocked'] = (
int) $a_blocked;
743 $query =
"SELECT * FROM obj_members " .
744 "WHERE obj_id = " . $this->ilDB->quote($this->obj_id,
'integer') .
" " .
745 "AND usr_id = " . $this->ilDB->quote($a_usr_id,
'integer');
747 if (
$res->numRows()) {
748 $query =
"UPDATE obj_members SET " .
749 "blocked = " . $this->ilDB->quote((
int) $a_blocked,
'integer') .
" " .
750 "WHERE obj_id = " . $this->ilDB->quote($this->obj_id,
'integer') .
" " .
751 "AND usr_id = " . $this->ilDB->quote($a_usr_id,
'integer');
753 $query =
"INSERT INTO obj_members (blocked,obj_id,usr_id,notification,passed) " .
755 $this->ilDB->quote((
int) $a_blocked,
'integer') .
", " .
756 $this->ilDB->quote($this->obj_id,
'integer') .
", " .
757 $this->ilDB->quote($a_usr_id,
'integer') .
", " .
758 $this->ilDB->quote(0,
'integer') .
", " .
759 $this->ilDB->quote(0,
'integer') .
760 ") ON DUPLICATE KEY UPDATE blocked = VALUES(blocked)";
767 $this->ilDB->manipulate(
768 'UPDATE obj_members SET ' .
769 'contact = ' . $this->ilDB->quote($a_contact,
'integer') .
' ' .
770 'WHERE obj_id = ' . $this->ilDB->quote($this->obj_id,
'integer') .
' ' .
771 'AND usr_id = ' . $this->ilDB->quote($a_usr_id,
'integer')
773 $this->participants_status[$a_usr_id][
'contact'] = $a_contact;
783 foreach ($this->participants_status as $usr_id => $status) {
784 if ($status[
'contact']) {
785 $contacts[] = (
int) $usr_id;
796 $this->participants_status[$a_usr_id][
'notification'] = $a_notification;
798 $query =
"SELECT * FROM obj_members " .
799 "WHERE obj_id = " . $this->ilDB->quote($this->obj_id,
'integer') .
" " .
800 "AND usr_id = " . $this->ilDB->quote($a_usr_id,
'integer');
802 if (
$res->numRows()) {
803 $query =
"UPDATE obj_members SET " .
804 "notification = " . $this->ilDB->quote((
int) $a_notification,
'integer') .
" " .
805 "WHERE obj_id = " . $this->ilDB->quote($this->obj_id,
'integer') .
" " .
806 "AND usr_id = " . $this->ilDB->quote($a_usr_id,
'integer');
808 $query =
"INSERT INTO obj_members (notification,obj_id,usr_id,passed,blocked) " .
810 $this->ilDB->quote((
int) $a_notification,
'integer') .
", " .
811 $this->ilDB->quote($this->obj_id,
'integer') .
", " .
812 $this->ilDB->quote($a_usr_id,
'integer') .
", " .
813 $this->ilDB->quote(0,
'integer') .
", " .
814 $this->ilDB->quote(0,
'integer') .
815 ") ON DUPLICATE KEY UPDATE notification = VALUES(notification)";
820 public function add(
int $a_usr_id,
int $a_role): bool
822 if ($this->isAssigned($a_usr_id)) {
827 case self::IL_LSO_ADMIN:
828 case self::IL_GRP_ADMIN:
829 case self::IL_CRS_ADMIN:
830 $this->admins[] = $a_usr_id;
833 case self::IL_CRS_TUTOR:
834 $this->tutors[] = $a_usr_id;
837 case self::IL_SESS_MEMBER:
838 case self::IL_LSO_MEMBER:
839 case self::IL_GRP_MEMBER:
840 case self::IL_CRS_MEMBER:
841 $this->members[] = $a_usr_id;
846 $this->participants[] = $a_usr_id;
847 $this->rbacAdmin->assignUser($this->role_data[$a_role], $a_usr_id);
850 $this->deleteSubscriber($a_usr_id);
854 $this->eventHandler->raise(
855 $this->getComponent(),
858 'obj_id' => $this->obj_id,
859 'usr_id' => $a_usr_id,
871 foreach ($a_user_ids as $user_id) {
872 $this->
delete($user_id);
890 if (isset($this->participants_status[$a_usr_id])) {
891 return (
bool) $this->participants_status[$a_usr_id][
'notification'];
898 if (isset($this->participants_status[$a_usr_id])) {
899 return (
bool) $this->participants_status[$a_usr_id][
'contact'];
906 if (array_key_exists($a_role_type, $this->role_data)) {
907 return $this->role_data[$a_role_type];
914 $this->roles = $this->rbacReview->getRolesOfRoleFolder($this->ref_id,
false);
915 $this->participants = [];
916 $this->members = $this->admins = $this->tutors = [];
918 $additional_roles = [];
919 $auto_generated_roles = [];
920 foreach ($this->roles as $role_id) {
921 $title = $this->objectDataCache->lookupTitle($role_id);
922 switch (substr($title, 0, 8)) {
924 $auto_generated_roles[$role_id] = self::IL_ROLE_POSITION_MEMBER;
925 $this->role_data[self::IL_CRS_MEMBER] = $role_id;
926 $this->participants = array_unique(array_merge(
927 $assigned = $this->rbacReview->assignedUsers($role_id),
930 $this->members = array_unique(array_merge($assigned, $this->members));
931 $this->role_assignments[$role_id] = $assigned;
935 $auto_generated_roles[$role_id] = self::IL_ROLE_POSITION_ADMIN;
936 $this->role_data[self::IL_CRS_ADMIN] = $role_id;
937 $this->participants = array_unique(array_merge(
938 $assigned = $this->rbacReview->assignedUsers($role_id),
941 $this->admins = $this->rbacReview->assignedUsers($role_id);
942 $this->role_assignments[$role_id] = $assigned;
946 $auto_generated_roles[$role_id] = self::IL_ROLE_POSITION_TUTOR;
947 $this->role_data[self::IL_CRS_TUTOR] = $role_id;
948 $this->participants = array_unique(array_merge(
949 $assigned = $this->rbacReview->assignedUsers($role_id),
952 $this->tutors = $this->rbacReview->assignedUsers($role_id);
953 $this->role_assignments[$role_id] = $assigned;
957 $auto_generated_roles[$role_id] = self::IL_ROLE_POSITION_ADMIN;
958 $this->role_data[self::IL_GRP_ADMIN] = $role_id;
959 $this->participants = array_unique(array_merge(
960 $assigned = $this->rbacReview->assignedUsers($role_id),
963 $this->admins = $this->rbacReview->assignedUsers($role_id);
964 $this->role_assignments[$role_id] = $assigned;
968 $auto_generated_roles[$role_id] = self::IL_ROLE_POSITION_MEMBER;
969 $this->role_data[self::IL_GRP_MEMBER] = $role_id;
970 $this->participants = array_unique(array_merge(
971 $assigned = $this->rbacReview->assignedUsers($role_id),
974 $this->members = $this->rbacReview->assignedUsers($role_id);
975 $this->role_assignments[$role_id] = $assigned;
979 $this->role_data[self::IL_SESS_MEMBER] = $role_id;
980 $this->participants = array_unique(array_merge(
981 $assigned = $this->rbacReview->assignedUsers($role_id),
984 $this->members = $this->rbacReview->assignedUsers($role_id);
988 $auto_generated_roles[$role_id] = self::IL_ROLE_POSITION_MEMBER;
989 $this->role_data[self::IL_LSO_MEMBER] = $role_id;
990 $this->participants = array_unique(array_merge(
991 $assigned = $this->rbacReview->assignedUsers($role_id),
994 $this->members = $this->rbacReview->assignedUsers($role_id);
995 $this->role_assignments[$role_id] = $assigned;
999 $auto_generated_roles[$role_id] = self::IL_ROLE_POSITION_ADMIN;
1000 $this->role_data[self::IL_LSO_ADMIN] = $role_id;
1001 $this->participants = array_unique(array_merge(
1002 $assigned = $this->rbacReview->assignedUsers($role_id),
1005 $this->admins = $this->rbacReview->assignedUsers($role_id);
1006 $this->role_assignments[$role_id] = $assigned;
1010 $additional_roles[$role_id] = $title;
1011 $this->participants = array_unique(array_merge(
1012 $assigned = $this->rbacReview->assignedUsers($role_id),
1015 $this->members = array_unique(array_merge($assigned, $this->members));
1016 $this->role_assignments[$role_id] = $assigned;
1020 asort($auto_generated_roles);
1021 asort($additional_roles);
1022 $this->roles_sorted = $auto_generated_roles + $additional_roles;
1030 $query =
"SELECT * FROM obj_members " .
1031 "WHERE obj_id = " . $this->ilDB->quote($this->obj_id,
'integer') .
" ";
1033 $this->participants_status = [];
1035 $this->participants_status[(
int) $row->usr_id][
'blocked'] = (
bool) $row->blocked;
1036 $this->participants_status[(
int) $row->usr_id][
'notification'] = (
bool) $row->notification;
1037 $this->participants_status[(
int) $row->usr_id][
'passed'] = (
bool) $row->passed;
1038 $this->participants_status[(
int) $row->usr_id][
'contact'] = (
bool) $row->contact;
1047 if ($a_field ===
'') {
1054 throw new DomainException(
'Invalid user id given: ' . $a_usr_id);
1058 $and =
"AND login = " . $this->ilDB->quote($tmp_user->getLogin(),
'text') .
" ";
1061 $and =
"AND email = " . $this->ilDB->quote($tmp_user->getEmail(),
'text') .
" ";
1063 case 'matriculation':
1064 $and =
"AND matriculation = " . $this->ilDB->quote($tmp_user->getMatriculation(),
'text') .
" ";
1068 $and =
"AND usr_id = " . $this->ilDB->quote($a_usr_id,
'integer') .
" ";
1072 if (!$this->getParticipants()) {
1076 $query =
"SELECT * FROM usr_data ud " .
1077 "WHERE " . $this->ilDB->in(
'usr_id', $this->getParticipants(),
false,
'integer') .
" " .
1081 return (
bool)
$res->numRows();
1092 $subscribers = array();
1093 $query =
"SELECT usr_id FROM il_subscribers " .
1094 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
'integer') .
" " .
1095 "ORDER BY sub_time ";
1099 $subscribers[] = (
int) $row->usr_id;
1101 return $subscribers;
1110 $this->readSubscribers();
1111 return $this->subscribers;
1116 return count($this->getSubscribers());
1121 return $this->readSubscriberData($a_usr_id);
1126 if (!is_array($a_usr_ids) || !count($a_usr_ids)) {
1129 foreach ($a_usr_ids as
$id) {
1130 if (!$this->assignSubscriber(
$id)) {
1139 $this->
error->setMessage(
"");
1140 if (!$this->isSubscriber($a_usr_id)) {
1141 $this->
error->appendMessage($this->
lng->txt(
"crs_user_notsubscribed"));
1145 if ($this->isAssigned($a_usr_id)) {
1147 $this->
error->appendMessage($tmp_obj->getLogin() .
": " . $this->lng->txt(
"crs_user_already_assigned"));
1153 $this->
error->appendMessage($this->
lng->txt(
"crs_user_not_exists"));
1158 $this->
add($tmp_obj->getId(), self::IL_CRS_MEMBER);
1161 $this->
add($tmp_obj->getId(), self::IL_GRP_MEMBER);
1164 $this->
add($tmp_obj->getId(), self::IL_LSO_MEMBER);
1167 $this->
register($tmp_obj->getId());
1169 $this->deleteSubscriber($a_usr_id);
1178 $this->readSubscribers();
1180 foreach ($this->subscribers as $subscriber) {
1181 if (!$this->assignSubscriber($subscriber)) {
1191 $query =
"INSERT INTO il_subscribers (usr_id,obj_id,subject,sub_time) " .
1193 $this->ilDB->quote($a_usr_id,
'integer') .
"," .
1194 $this->ilDB->quote($this->obj_id,
'integer') .
", " .
1195 $this->ilDB->quote(
'',
'text') .
", " .
1196 $this->ilDB->quote(time(),
'integer') .
1203 $query =
"UPDATE il_subscribers " .
1204 "SET sub_time = " . $this->ilDB->quote($a_subtime,
'integer') .
" " .
1205 "WHERE usr_id = " . $this->ilDB->quote($a_usr_id,
'integer') .
" " .
1206 "AND obj_id = " . $this->ilDB->quote($this->obj_id,
'integer') .
" ";
1212 $query =
"UPDATE il_subscribers " .
1213 "SET subject = " . $this->ilDB->quote($a_subject,
'text') .
" " .
1214 "WHERE usr_id = " . $this->ilDB->quote($a_usr_id,
'integer') .
" " .
1215 "AND obj_id = " . $this->ilDB->quote($this->obj_id,
'integer') .
" ";
1221 $query =
"DELETE FROM il_subscribers " .
1222 "WHERE usr_id = " . $this->ilDB->quote($a_usr_id,
'integer') .
" " .
1223 "AND obj_id = " . $this->ilDB->quote($this->obj_id,
'integer') .
" ";
1229 if (!count($a_usr_ids)) {
1230 $this->
error->setMessage(
'');
1231 $this->
error->appendMessage($this->
lng->txt(
"no_usr_ids_given"));
1234 $query =
"DELETE FROM il_subscribers " .
1235 "WHERE " . $this->ilDB->in(
'usr_id', $a_usr_ids,
false,
'integer') .
" " .
1236 "AND obj_id = " . $this->ilDB->quote($this->obj_id,
'integer');
1243 $query =
"SELECT * FROM il_subscribers " .
1244 "WHERE usr_id = " . $this->ilDB->quote($a_usr_id,
'integer') .
" " .
1245 "AND obj_id = " . $this->ilDB->quote($this->obj_id,
'integer');
1259 $query =
"SELECT * FROM il_subscribers " .
1260 "WHERE usr_id = " .
$ilDB->quote($a_usr_id,
'integer') .
" " .
1261 "AND obj_id = " .
$ilDB->quote($a_obj_id,
'integer');
1275 $this->subscribers = [];
1276 $query =
"SELECT usr_id FROM il_subscribers " .
1277 "WHERE obj_id = " . $this->ilDB->quote($this->obj_id,
'integer') .
" " .
1278 "ORDER BY sub_time ";
1283 $this->deleteSubscriber((
int) $row->usr_id);
1285 $this->subscribers[] = (
int) $row->usr_id;
1294 $query =
"SELECT * FROM il_subscribers " .
1295 "WHERE obj_id = " . $this->ilDB->quote($this->obj_id,
'integer') .
" " .
1296 "AND usr_id = " . $this->ilDB->quote($a_usr_id,
'integer');
1301 $data[
"time"] = (
int) $row->sub_time;
1302 $data[
"usr_id"] = (
int) $row->usr_id;
1303 $data[
'subject'] = (string) $row->subject;
1317 $query =
'SELECT * FROM il_subscribers ' .
1318 'WHERE obj_id = ' .
$ilDB->quote($a_obj_id,
'integer');
1323 $data[$row->usr_id][
'time'] = (
int) $row->sub_time;
1324 $data[$row->usr_id][
'usr_id'] = (
int) $row->usr_id;
1325 $data[$row->usr_id][
'subject'] = (string) $row->subject;
1347 $j2 =
"JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id) ";
1348 $a2 =
"AND obd2.title LIKE 'il_" . $a_type .
"_mem%' ";
1351 $query =
"SELECT DISTINCT obd.obj_id,obr.ref_id FROM rbac_ua ua " .
1352 "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id " .
1353 "JOIN object_reference obr ON fa.parent = obr.ref_id " .
1354 "JOIN object_data obd ON obr.obj_id = obd.obj_id " .
1356 "WHERE obd.type = " .
$ilDB->quote($a_type,
'text') .
" " .
1357 "AND fa.assign = 'y' " .
1358 "AND ua.usr_id = " .
$ilDB->quote($a_usr_id,
'integer') .
" " .
1363 while ($row =
$ilDB->fetchObject(
$res)) {
1364 $obj_ids[] = (
int) $row->obj_id;
1367 $set =
$ilDB->query(
"SELECT obj_id, usr_id FROM obj_members " .
1368 " WHERE " .
$ilDB->in(
"obj_id", $obj_ids,
false,
"integer") .
1369 " AND contact = " .
$ilDB->quote(1,
"integer"));
1371 while ($rec =
$ilDB->fetchAssoc($set)) {
1383 $sortable_assignments =
'9999999999';
1384 foreach ($this->roles_sorted as $role_id => $trash) {
1385 if (in_array($a_user_id, (array) $this->role_assignments[$role_id])) {
1386 $sortable_assignments = substr_replace($sortable_assignments,
'1', $counter, 1);
1390 return $sortable_assignments;
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
static _getInstanceByObjId(int $a_obj_id)
Error Handling & global info handling uses PEAR error class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getInstanceByObjId(int $a_obj_id)
Get singleton instance.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getInstanceByObjId(int $obj_id)
Component logger with individual log levels by component id.
warning(string $a_message)
logStack(?int $a_level=null, string $a_message='')
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static lookupShowMembersEnabled(int $a_obj_id)
static lookupShowMembersEnabled(int $a_obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupType(int $id, bool $reference=false)
static _getAllReferences(int $id)
get all reference ids for object ID
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
Base class for course and group participants.
getAdmins()
Get all admins ids.
deleteSubscribers(array $a_usr_ids)
getComponent()
Get component name Used for raising events.
static _getMembershipByType(int $a_usr_id, array $a_type, bool $a_only_member_role=false)
get membership by type Get course or group membership
static lookupNumberOfMembers(int $a_ref_id)
Lookup number of members.
static _hasPassed(int $a_obj_id, int $a_usr_id)
Check if user has passed course.
setRoleOrderPosition(int $a_user_id)
Set role order position.
addRecommendation(int $a_usr_id)
Add desktop item @access public.
isNotificationEnabled(int $a_usr_id)
updateBlocked(int $a_usr_id, bool $a_blocked)
Update blocked status.
getParticipants()
Get all participants ids.
static getInstanceByObjId(int $a_obj_id)
Get instance by obj type.
const IL_ROLE_POSITION_TUTOR
ilAppEventHandler $eventHandler
updateContact(int $a_usr_id, bool $a_contact)
getRoles()
Get object roles.
static hasParticipantListAccess(int $a_obj_id, int $a_usr_id=null)
Check if (current) user has access to the participant list.
getCountParticipants()
Get number of participants.
const IL_ROLE_POSITION_MEMBER
static getInstance(int $a_ref_id)
static lookupSubscribers(int $a_obj_id)
deleteParticipants(array $a_user_ids)
isTutor(int $a_usr_id)
is user tutor
static lookupNumberOfParticipants(int $a_ref_id)
Lookup the number of participants (crs admins, tutors, members, grp admins, members)
updateNotification(int $a_usr_id, bool $a_notification)
Update notification status.
isBlocked(int $a_usr_id)
Check if user is blocked.
isLastAdmin(int $a_usr_id)
Check if user is last admin.
readParticipantsStatus()
Read status of participants (blocked, notification, passed)
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.
updateRoleAssignments($a_usr_id, $a_roles)
Update role assignments @access public.
getSubscriberData(int $a_usr_id)
assignSubscribers(array $a_usr_ids)
getNotificationRecipients()
Get admin, tutor which have notification enabled.
ilObjectDataCache $objectDataCache
static _isParticipant(int $a_ref_id, int $a_usr_id)
Static function to check if a user is a participant of the container object.
array $participants_status
getMembers()
Get all members ids (admins and tutors are not members) Use get participants to fetch all.
getAutoGeneratedRoleId(int $a_role_type)
static _deleteAllEntries(int $a_obj_id)
Delete all entries Normally called in case of object deletion.
getSubscribers()
get all subscribers int[]
static getUserMembershipAssignmentsByType(array $a_user_ids, array $a_type, bool $a_only_member_roles)
Get user membership assignments by type.
static _isBlocked(int $a_obj_id, int $a_usr_id)
Check if user is blocked.
getCountMembers()
Get number of members (not participants)
ilRecommendedContentManager $recommended_content_manager
static _deleteUser(int $a_usr_id)
Delete user data.
static _getAllSupportContactsOfUser(int $a_usr_id, string $a_type)
Get all support contacts for a user.
getContacts()
get user ids which are confirgured as contact
isAssigned(int $a_usr_id)
check if user is assigned
const IL_ROLE_POSITION_ADMIN
isSubscriber(int $a_usr_id)
static lookupSubscribersData(int $a_obj_id)
checkLastAdmin(array $a_usr_ids)
Check if users for deletion are last admins @access public.
__construct(string $a_component_name, int $a_ref_id)
static _isSubscriber(int $a_obj_id, int $a_usr_id)
static getDefaultMemberRole(int $a_ref_id)
isGroupingMember(int $a_usr_id, string $a_field='')
Check membership for.
assignSubscriber(int $a_usr_id)
hasPassed(int $a_usr_id)
Check if user has passed object.
addSubscriber(int $a_usr_id)
updateSubscriptionTime(int $a_usr_id, int $a_subtime)
deleteSubscriber(int $a_usr_id)
readSubscriberData(int $a_usr_id)
getTutors()
Get all tutors ids.
getAssignedRoles(int $a_usr_id)
Get assigned roles.
isMember(int $a_usr_id)
is user member
updateSubject(int $a_usr_id, string $a_subject)
isAdmin(int $a_usr_id)
check if user is admin
add(int $a_usr_id, int $a_role)
Class ilRbacAdmin Core functions for role based access control.
class ilRbacReview Contains Review functions of core Rbac.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance(int $a_ref_id)
static _getInstanceByObjId(int $a_obj_id)
static deleteUserEntry(int $a_usr_id, int $a_obj_id)
static _deleteUser(int $a_usr_id)