ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilParticipants.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
12define("IL_CRS_ADMIN", 1);
13define("IL_CRS_TUTOR", 3);
14define("IL_CRS_MEMBER", 2);
15
16define('IL_GRP_ADMIN', 4);
17define('IL_GRP_MEMBER', 5);
18
19define('IL_SESS_MEMBER', 6);
20
21define('IL_LSO_ADMIN', 7);
22define('IL_LSO_MEMBER', 8);
23
24define("IL_ROLE_POSITION_ADMIN", 1);
25define("IL_ROLE_POSITION_TUTOR", 2);
26define("IL_ROLE_POSITION_MEMBER", 3);
27
28
29abstract class ilParticipants
30{
31 protected $component = '';
32
33 protected $obj_id = 0;
34 protected $type = '';
35 protected $ref_id = 0;
36
37 protected $roles = array();
38 protected $role_data = array();
39 protected $roles_sorted = [];
40 protected $role_assignments = [];
41
42 protected $participants = array();
43 protected $participants_status = array();
44 protected $members = array();
45 protected $tutors = array();
46 protected $admins = array();
47
48 protected $subscribers = array();
49
53 protected $ilDB;
54
58 protected $lng;
59
64 protected $logger = null;
65
70
79 public function __construct($a_component_name, $a_ref_id)
80 {
81 $this->ilDB = $GLOBALS['DIC']->database();
82 $this->lng = $GLOBALS['DIC']->language();
83 $this->logger = $GLOBALS['DIC']->logger()->mem();
84
85 $this->component = $a_component_name;
86
87 $this->ref_id = $a_ref_id;
88 $this->obj_id = ilObject::_lookupObjId($a_ref_id);
89 $this->type = ilObject::_lookupType($this->obj_id);
90
91 $this->readParticipants();
93 $this->recommended_content_manager = new ilRecommendedContentManager();
94 }
95
101 public static function getInstance($a_ref_id)
102 {
103 $obj_id = ilObject::_lookupObjId($a_ref_id);
105
106 switch ($type) {
107 case 'crs':
108 case 'grp':
109 case 'lso':
111 case 'sess':
112 include_once './Modules/Session/classes/class.ilSessionParticipants.php';
113 return ilSessionParticipants::getInstance($a_ref_id);
114 default:
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.');
118 }
119 }
120
129 public static function getInstanceByObjId($a_obj_id)
130 {
131 $type = ilObject::_lookupType($a_obj_id);
132 switch ($type) {
133 case 'crs':
134 include_once './Modules/Course/classes/class.ilCourseParticipants.php';
136
137 case 'grp':
138 include_once './Modules/Group/classes/class.ilGroupParticipants.php';
140
141 case 'sess':
142 include_once './Modules/Session/classes/class.ilSessionParticipants.php';
144 case 'lso':
146 default:
147 $GLOBALS['DIC']->logger()->mmbr()->logStack(ilLogLevel::WARNING);
148 $GLOBALS['DIC']->logger()->mmbr()->warning(': Invalid obj_id given: ' . $a_obj_id);
149 throw new InvalidArgumentException('Invalid obj id given');
150 }
151 }
152
157 protected function getComponent()
158 {
159 return $this->component;
160 }
161
162
163
169 public static function hasParticipantListAccess($a_obj_id, $a_usr_id = null)
170 {
171 global $DIC;
172
173 $access = $DIC->access();
174
175 if (!$a_usr_id) {
176 $a_usr_id = $GLOBALS['DIC']['ilUser']->getId();
177 }
178
179 // if write access granted => return true
180 $refs = ilObject::_getAllReferences($a_obj_id);
181 $ref_id = end($refs);
182
183 if ($access->checkAccess('manage_members', '', $ref_id)) {
184 return true;
185 }
186 $part = self::getInstance($ref_id);
187 if ($part->isAssigned($a_usr_id)) {
188 if ($part->getType() == 'crs') {
190 return false;
191 }
192 }
193 if ($part->getType() == 'grp') {
194 if (!ilObjGroup::lookupShowMembersEnabled($a_obj_id)) {
195 return false;
196 }
197 }
198 return true;
199 }
200 // User is not assigned to course/group => no read access
201 return false;
202 }
203
204
212 public static function getUserMembershipAssignmentsByType($a_user_ids, $a_type, $a_only_member_roles)
213 {
214 global $DIC;
215
216 $logger = $DIC->logger()->mmbr();
217 $ilDB = $DIC->database();
218
219 if ($a_only_member_roles) {
220 $j2 = "JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id) ";
221 $a2 = 'AND obd2.title = ' . $ilDB->concat(
222 array(
223 array($ilDB->quote('il_', 'text')),
224 array('obd.type'),
225 array($ilDB->quote('_member_', 'text')),
226 array('obr.ref_id'),
227 ),
228 false
229 );
230 }
231
232 $query = "SELECT DISTINCT obd.obj_id,obr.ref_id,ua.usr_id FROM rbac_ua ua " .
233 "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id " .
234 "JOIN object_reference obr ON fa.parent = obr.ref_id " .
235 "JOIN object_data obd ON obr.obj_id = obd.obj_id " .
236 $j2 .
237 "WHERE " . $ilDB->in("obd.type", $a_type, false, "text") .
238 "AND fa.assign = 'y' " .
239 'AND ' . $ilDB->in('ua.usr_id', $a_user_ids, false, 'integer') . ' ' .
240 $a2;
241
242 $logger->debug($query);
243
244
245 $obj_ids = [];
246 $res = $ilDB->query($query);
247 while ($row = $ilDB->fetchObject($res)) {
248 $obj_ids[$row->obj_id][] = $row->usr_id;
249 }
250
251 $logger->dump($obj_ids, \ilLogLevel::DEBUG);
252
253 return $obj_ids;
254 }
255
267 public static function _getMembershipByType($a_usr_id, $a_type, $a_only_member_role = false)
268 {
269 global $DIC;
270
271 $ilDB = $DIC['ilDB'];
272
273 if (!is_array($a_type)) {
274 $a_type = array($a_type);
275 }
276
277 // this will also dismiss local roles!
278 if ($a_only_member_role) {
279 $j2 = "JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id) ";
280 $a2 = 'AND obd2.title = ' . $ilDB->concat(
281 array(
282 array($ilDB->quote('il_', 'text')),
283 array('obd.type'),
284 array($ilDB->quote('_member_', 'text')),
285 array('obr.ref_id'),
286 ),
287 false
288 );
289 }
290
291 // #14290 - no role folder anymore
292 $query = "SELECT DISTINCT obd.obj_id,obr.ref_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 " .
296 $j2 .
297 "WHERE " . $ilDB->in("obd.type", $a_type, false, "text") .
298 "AND fa.assign = 'y' " .
299 "AND ua.usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
300 $a2;
301 $res = $ilDB->query($query);
302 while ($row = $ilDB->fetchObject($res)) {
303 $ref_ids[] = $row->obj_id;
304 }
305
306 return $ref_ids ? $ref_ids : array();
307 }
308
309
310
319 public static function _isParticipant($a_ref_id, $a_usr_id)
320 {
321 global $DIC;
322
323 $rbacreview = $DIC['rbacreview'];
324
325 $local_roles = $rbacreview->getRolesOfRoleFolder($a_ref_id, false);
326
327 return $rbacreview->isAssignedToAtLeastOneGivenRole($a_usr_id, $local_roles);
328 }
329
337 public static function lookupNumberOfParticipants($a_ref_id)
338 {
339 global $DIC;
340
341 $rbacreview = $DIC['rbacreview'];
342
343 $lroles = $rbacreview->getRolesOfRoleFolder($a_ref_id, false);
344 return $rbacreview->getNumberOfAssignedUsers($lroles);
345 }
346
354 public static function lookupNumberOfMembers($a_ref_id)
355 {
356 global $DIC;
357
358 $rbacreview = $DIC->rbac()->review();
359 $ilObjDataCache = $DIC['ilObjDataCache'];
360
361 $has_policies = $rbacreview->getLocalPolicies($a_ref_id);
362
363 if (!$has_policies) {
364 return 0;
365 }
366 $lroles = $rbacreview->getRolesOfRoleFolder($a_ref_id, false);
367
368 $memberRoles = array();
369 foreach ($lroles as $role_id) {
370 $title = $ilObjDataCache->lookupTitle($role_id);
371 switch (substr($title, 0, 8)) {
372 case 'il_crs_a':
373 case 'il_crs_t':
374 case 'il_grp_a':
375 break;
376
377 default:
378 $memberRoles[] = $role_id;
379 break;
380 }
381 }
382 return $rbacreview->getNumberOfAssignedUsers($memberRoles);
383 }
384
385
395 public static function _isBlocked($a_obj_id, $a_usr_id)
396 {
397 global $DIC;
398
399 $ilDB = $DIC['ilDB'];
400
401 $query = "SELECT * FROM obj_members " .
402 "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
403 "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
404 "AND blocked = " . $ilDB->quote(1, 'integer');
405 $res = $ilDB->query($query);
406 return $res->numRows() ? true : false;
407 }
408
418 public static function _hasPassed($a_obj_id, $a_usr_id)
419 {
420 global $DIC;
421
422 $ilDB = $DIC['ilDB'];
423
424 $query = "SELECT * FROM obj_members " .
425 "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
426 "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
427 "AND passed = '1'";
428 $res = $ilDB->query($query);
429 return $res->numRows() ? true : false;
430 }
431
441 public static function _deleteAllEntries($a_obj_id)
442 {
443 global $DIC;
444
445 $ilDB = $DIC['ilDB'];
446
447 $query = "DELETE FROM obj_members " .
448 "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " ";
449 $res = $ilDB->manipulate($query);
450
451 $query = "DELETE FROM il_subscribers " .
452 "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . "";
453 $res = $ilDB->manipulate($query);
454
455 $query = 'DELETE FROM crs_waiting_list ' .
456 'WHERE obj_id = ' . $ilDB->quote($a_obj_id, 'integer');
457 $ilDB->manipulate($query);
458
459 return true;
460 }
461
470 public static function _deleteUser($a_usr_id)
471 {
472 global $DIC;
473
474 $ilDB = $DIC['ilDB'];
475
476 $query = "DELETE FROM obj_members WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . "";
477 $res = $ilDB->manipulate($query);
478
479 $query = "DELETE FROM il_subscribers WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . "";
480 $res = $ilDB->manipulate($query);
481
482 include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
484 }
485
486 public static function getDefaultMemberRole($a_ref_id)
487 {
488 global $DIC;
489
490 $ilCtrl = $DIC['ilCtrl'];
491
492 $obj_id = ilObject::_lookupObjId($a_ref_id);
494
495 if (!in_array($type, array('crs','grp'))) {
496 return 0;
497 }
498
499 global $DIC;
500
501 $rbacreview = $DIC['rbacreview'];
502
503
504 $roles = $rbacreview->getRolesOfRoleFolder($a_ref_id, false);
505
506 foreach ($roles as $role) {
507 $title = ilObject::_lookupTitle($role);
508 if (substr($title, 0, 13) == ('il_' . $type . '_member')) {
509 return $role;
510 }
511 }
512 return 0;
513 }
514
519 public function getObjId()
520 {
521 return $this->obj_id;
522 }
523
528 public function getType()
529 {
530 return $this->type;
531 }
532
540 {
541 global $DIC;
542
543 $ilDB = $DIC['ilDB'];
544
545 $query = "SELECT * FROM obj_members " .
546 "WHERE notification = 1 " .
547 "AND obj_id = " . $ilDB->quote($this->obj_id) . " ";
548 $res = $ilDB->query($query);
549 $recp = [];
550 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
551 if ($this->isAdmin($row->usr_id) or $this->isTutor($row->usr_id)) {
552 $recp[] = $row->usr_id;
553 }
554 }
555 return $recp;
556 }
557
564 public function getCountMembers()
565 {
566 return count($this->members);
567 }
568
575 public function getCountParticipants()
576 {
577 return count($this->participants);
578 }
579
580
581
582
589 public function getParticipants()
590 {
591 return $this->participants ? $this->participants : array();
592 }
593
601 public function getMembers()
602 {
603 return $this->members ? $this->members : array();
604 }
611 public function getAdmins()
612 {
613 return $this->admins ? $this->admins : array();
614 }
615
620 public function getCountAdmins()
621 {
622 return count($this->getAdmins());
623 }
624
625
632 public function getTutors()
633 {
634 return $this->tutors ? $this->tutors : array();
635 }
636
644 public function isAdmin($a_usr_id)
645 {
646 return in_array($a_usr_id, $this->admins) ? true : false;
647 }
648
656 public function isTutor($a_usr_id)
657 {
658 return in_array($a_usr_id, $this->tutors) ? true : false;
659 }
660
668 public function isMember($a_usr_id)
669 {
670 return in_array($a_usr_id, $this->members) ? true : false;
671 }
672
673
674
675
683 public function isAssigned($a_usr_id)
684 {
685 return in_array($a_usr_id, $this->participants);
686 }
687
693 public function isLastAdmin($a_usr_id)
694 {
695 return in_array($a_usr_id, $this->getAdmins()) and count($this->getAdmins()) == 1;
696 }
697
698
706 public function getRoles()
707 {
708 return $this->roles ? $this->roles : array();
709 }
710
718 public function getAssignedRoles($a_usr_id)
719 {
720 global $DIC;
721
722 $rbacreview = $DIC['rbacreview'];
723
724 foreach ($this->roles as $role) {
725 if ($rbacreview->isAssigned($a_usr_id, $role)) {
726 $assigned[] = $role;
727 }
728 }
729 return $assigned ? $assigned : array();
730 }
731
740 public function updateRoleAssignments($a_usr_id, $a_roles)
741 {
742 global $DIC;
743
744 $rbacreview = $DIC['rbacreview'];
745 $rbacadmin = $DIC['rbacadmin'];
746
747 $roles = $a_roles ? $a_roles : array();
748
749 foreach ($this->getRoles() as $role_id) {
750 if ($rbacreview->isAssigned($a_usr_id, $role_id)) {
751 if (!in_array($role_id, $roles)) {
752 $rbacadmin->deassignUser($role_id, $a_usr_id);
753 }
754 } else {
755 if (in_array($role_id, $roles)) {
756 $rbacadmin->assignUser($role_id, $a_usr_id);
757 }
758 }
759 }
760 $rbacreview->clearCaches();
761 $this->readParticipants();
762 $this->readParticipantsStatus();
763 }
764
772 public function checkLastAdmin($a_usr_ids)
773 {
774 foreach ($this->getAdmins() as $admin_id) {
775 if (!in_array($admin_id, $a_usr_ids)) {
776 return true;
777 }
778 }
779 return false;
780 }
781
789 public function isBlocked($a_usr_id)
790 {
791 if (isset($this->participants_status[$a_usr_id])) {
792 return $this->participants_status[$a_usr_id]['blocked'] ? true : false;
793 }
794 return false;
795 }
796
804 public function hasPassed($a_usr_id)
805 {
806 if (isset($this->participants_status[$a_usr_id])) {
807 return $this->participants_status[$a_usr_id]['passed'] ? true : false;
808 }
809 return false;
810 }
811
819 public function delete($a_usr_id)
820 {
821 global $DIC;
822
823 $rbacadmin = $DIC['rbacadmin'];
824 $ilDB = $DIC['ilDB'];
825
826 $this->recommended_content_manager->removeObjectRecommendation($a_usr_id, $this->ref_id);
827
828 foreach ($this->roles as $role_id) {
829 $rbacadmin->deassignUser($role_id, $a_usr_id);
830 }
831
832 $query = "DELETE FROM obj_members " .
833 "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
834 "AND obj_id = " . $ilDB->quote($this->obj_id, 'integer');
835 $res = $ilDB->manipulate($query);
836
837 $this->readParticipants();
838 $this->readParticipantsStatus();
839
840 $GLOBALS['DIC']['ilAppEventHandler']->raise(
841 $this->getComponent(),
842 "deleteParticipant",
843 array(
844 'obj_id' => $this->obj_id,
845 'usr_id' => $a_usr_id)
846 );
847
848 return true;
849 }
850
859 public function updateBlocked($a_usr_id, $a_blocked)
860 {
861 global $DIC;
862
863 $ilDB = $DIC['ilDB'];
864
865 $this->participants_status[$a_usr_id]['blocked'] = (int) $a_blocked;
866
867 $query = "SELECT * FROM obj_members " .
868 "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
869 "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer');
870 $res = $ilDB->query($query);
871 if ($res->numRows()) {
872 $query = "UPDATE obj_members SET " .
873 "blocked = " . $ilDB->quote((int) $a_blocked, 'integer') . " " .
874 "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
875 "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer');
876 } else {
877 $query = "INSERT INTO obj_members (blocked,obj_id,usr_id,notification,passed) " .
878 "VALUES ( " .
879 $ilDB->quote((int) $a_blocked, 'integer') . ", " .
880 $ilDB->quote($this->obj_id, 'integer') . ", " .
881 $ilDB->quote($a_usr_id, 'integer') . ", " .
882 $ilDB->quote(0, 'integer') . ", " .
883 $ilDB->quote(0, 'integer') .
884 ")";
885 }
886 $res = $ilDB->manipulate($query);
887 return true;
888 }
889
890 // cognos-blu-patch: begin
898 public function updateContact($a_usr_id, $a_contact)
899 {
900 global $DIC;
901
902 $ilDB = $DIC['ilDB'];
903
904 $ilDB->manipulate(
905 'UPDATE obj_members SET ' .
906 'contact = ' . $ilDB->quote($a_contact, 'integer') . ' ' .
907 'WHERE obj_id = ' . $ilDB->quote($this->obj_id, 'integer') . ' ' .
908 'AND usr_id = ' . $ilDB->quote($a_usr_id, 'integer')
909 );
910
911 $this->participants_status[$a_usr_id]['contact'] = $a_contact;
912 return true;
913 }
914
919 public function getContacts()
920 {
921 $contacts = array();
922 foreach ((array) $this->participants_status as $usr_id => $status) {
923 if ($status['contact']) {
924 $contacts[] = $usr_id;
925 }
926 }
927 return $contacts;
928 }
929
930
931 // cognos-blu-patch: end
932
941 public function updateNotification($a_usr_id, $a_notification)
942 {
943 global $DIC;
944
945 $ilDB = $DIC['ilDB'];
946
947 $this->participants_status[$a_usr_id]['notification'] = (int) $a_notification;
948
949 $query = "SELECT * FROM obj_members " .
950 "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
951 "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer');
952 $res = $ilDB->query($query);
953 if ($res->numRows()) {
954 $query = "UPDATE obj_members SET " .
955 "notification = " . $ilDB->quote((int) $a_notification, 'integer') . " " .
956 "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
957 "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer');
958 } else {
959 $query = "INSERT INTO obj_members (notification,obj_id,usr_id,passed,blocked) " .
960 "VALUES ( " .
961 $ilDB->quote((int) $a_notification, 'integer') . ", " .
962 $ilDB->quote($this->obj_id, 'integer') . ", " .
963 $ilDB->quote($a_usr_id, 'integer') . ", " .
964 $ilDB->quote(0, 'integer') . ", " .
965 $ilDB->quote(0, 'integer') .
966 ")";
967 }
968 $res = $ilDB->manipulate($query);
969 return true;
970 }
971
972
973
974
983 public function add($a_usr_id, $a_role)
984 {
985 global $DIC;
986
987 $rbacadmin = $DIC['rbacadmin'];
988 $ilAppEventHandler = $DIC['ilAppEventHandler'];
989
990 if ($this->isAssigned($a_usr_id)) {
991 return false;
992 }
993
994 switch ($a_role) {
995 case IL_CRS_ADMIN:
996 $this->admins[] = $a_usr_id;
997 break;
998
999 case IL_CRS_TUTOR:
1000 $this->tutors[] = $a_usr_id;
1001 break;
1002
1003 case IL_CRS_MEMBER:
1004 $this->members[] = $a_usr_id;
1005 break;
1006
1007 case IL_GRP_ADMIN:
1008 $this->admins[] = $a_usr_id;
1009 break;
1010
1011 case IL_GRP_MEMBER:
1012 $this->members[] = $a_usr_id;
1013 break;
1014
1015 case IL_LSO_ADMIN:
1016 $this->admins[] = $a_usr_id;
1017 break;
1018
1019 case IL_LSO_MEMBER:
1020 $this->members[] = $a_usr_id;
1021 break;
1022
1023 case IL_SESS_MEMBER:
1024 $this->members[] = $a_usr_id;
1025 break;
1026 }
1027
1028 $this->participants[] = $a_usr_id;
1029 $rbacadmin->assignUser($this->role_data[$a_role], $a_usr_id);
1030
1031 // Delete subscription request
1032 $this->deleteSubscriber($a_usr_id);
1033
1034 include_once './Services/Membership/classes/class.ilWaitingList.php';
1035 ilWaitingList::deleteUserEntry($a_usr_id, $this->obj_id);
1036
1037 $ilAppEventHandler->raise(
1038 $this->getComponent(),
1039 "addParticipant",
1040 array(
1041 'obj_id' => $this->obj_id,
1042 'usr_id' => $a_usr_id,
1043 'role_id' => $a_role)
1044 );
1045 return true;
1046 }
1047
1048
1056 public function deleteParticipants($a_user_ids)
1057 {
1058 foreach ($a_user_ids as $user_id) {
1059 $this->delete($user_id);
1060 }
1061 return true;
1062 }
1063
1071 public function addRecommendation($a_usr_id)
1072 {
1073 // deactivated for now, see discussion at
1074 // https://docu.ilias.de/goto_docu_wiki_wpage_5620_1357.html
1075 // $this->recommended_content_manager->addObjectRecommendation($a_usr_id, $this->ref_id);
1076 return true;
1077 }
1078
1079
1080
1088 public function isNotificationEnabled($a_usr_id)
1089 {
1090 if (isset($this->participants_status[$a_usr_id])) {
1091 return $this->participants_status[$a_usr_id]['notification'] ? true : false;
1092 }
1093 return false;
1094 }
1095
1096 // cognos-blu-patch: begin
1101 public function isContact($a_usr_id)
1102 {
1103 if (isset($this->participants_status[$a_usr_id])) {
1104 return (bool) $this->participants_status[$a_usr_id]['contact'];
1105 }
1106 return false;
1107 }
1108 // cognos-blu-patch: end
1109
1110
1115 public function getAutoGeneratedRoleId($a_role_type)
1116 {
1117 if (array_key_exists($a_role_type, $this->role_data)) {
1118 return $this->role_data[$a_role_type];
1119 }
1120
1121 return 0;
1122 }
1123
1124
1132 protected function readParticipants()
1133 {
1134 global $DIC;
1135
1136 $rbacreview = $DIC['rbacreview'];
1137 $ilObjDataCache = $DIC['ilObjDataCache'];
1138 $ilLog = $DIC['ilLog'];
1139
1140 $GLOBALS['DIC']['rbacreview']->clearCaches();
1141 $this->roles = $rbacreview->getRolesOfRoleFolder($this->ref_id, false);
1142
1143 $users = array();
1144 $this->participants = array();
1145 $this->members = $this->admins = $this->tutors = array();
1146
1147 $additional_roles = [];
1148 $auto_generated_roles = [];
1149 foreach ($this->roles as $role_id) {
1150 $title = $ilObjDataCache->lookupTitle($role_id);
1151 switch (substr($title, 0, 8)) {
1152 case 'il_crs_m':
1153 $auto_generated_roles[$role_id] = IL_ROLE_POSITION_MEMBER;
1154 $this->role_data[IL_CRS_MEMBER] = $role_id;
1155 $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1156 $this->members = array_unique(array_merge($assigned, $this->members));
1157 $this->role_assignments[$role_id] = $assigned;
1158 break;
1159
1160 case 'il_crs_a':
1161 $auto_generated_roles[$role_id] = IL_ROLE_POSITION_ADMIN;
1162 $this->role_data[IL_CRS_ADMIN] = $role_id;
1163 $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1164 $this->admins = $rbacreview->assignedUsers($role_id);
1165 $this->role_assignments[$role_id] = $assigned;
1166 break;
1167
1168 case 'il_crs_t':
1169 $auto_generated_roles[$role_id] = IL_ROLE_POSITION_TUTOR;
1170 $this->role_data[IL_CRS_TUTOR] = $role_id;
1171 $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1172 $this->tutors = $rbacreview->assignedUsers($role_id);
1173 $this->role_assignments[$role_id] = $assigned;
1174 break;
1175
1176 case 'il_grp_a':
1177 $auto_generated_roles[$role_id] = IL_ROLE_POSITION_ADMIN;
1178 $this->role_data[IL_GRP_ADMIN] = $role_id;
1179 $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1180 $this->admins = $rbacreview->assignedUsers($role_id);
1181 $this->role_assignments[$role_id] = $assigned;
1182 break;
1183
1184 case 'il_grp_m':
1185 $auto_generated_roles[$role_id] = IL_ROLE_POSITION_MEMBER;
1186 $this->role_data[IL_GRP_MEMBER] = $role_id;
1187 $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1188 $this->members = $rbacreview->assignedUsers($role_id);
1189 $this->role_assignments[$role_id] = $assigned;
1190 break;
1191
1192 case 'il_sess_':
1193 $this->role_data[IL_SESS_MEMBER] = $role_id;
1194 $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1195 $this->members = $rbacreview->assignedUsers($role_id);
1196 break;
1197
1198 case 'il_lso_m':
1199 $auto_generated_roles[$role_id] = IL_ROLE_POSITION_MEMBER;
1200 $this->role_data[IL_LSO_MEMBER] = $role_id;
1201 $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1202 $this->members = $rbacreview->assignedUsers($role_id);
1203 $this->role_assignments[$role_id] = $assigned;
1204 break;
1205
1206 case 'il_lso_a':
1207 $auto_generated_roles[$role_id] = IL_ROLE_POSITION_ADMIN;
1208 $this->role_data[IL_LSO_ADMIN] = $role_id;
1209 $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1210 $this->admins = $rbacreview->assignedUsers($role_id);
1211 $this->role_assignments[$role_id] = $assigned;
1212 break;
1213
1214 default:
1215 $additional_roles[$role_id] = $title;
1216 $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1217 $this->members = array_unique(array_merge($assigned, $this->members));
1218 $this->role_assignments[$role_id] = $assigned;
1219 break;
1220 }
1221 }
1222 asort($auto_generated_roles);
1223 asort($additional_roles);
1224 $this->roles_sorted = $auto_generated_roles + $additional_roles;
1225 }
1226
1234 protected function readParticipantsStatus()
1235 {
1236 global $DIC;
1237
1238 $ilDB = $DIC['ilDB'];
1239
1240 $query = "SELECT * FROM obj_members " .
1241 "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " ";
1242 $res = $ilDB->query($query);
1243 $this->participants_status = array();
1244 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1245 $this->participants_status[$row->usr_id]['blocked'] = $row->blocked;
1246 $this->participants_status[$row->usr_id]['notification'] = $row->notification;
1247 $this->participants_status[$row->usr_id]['passed'] = $row->passed;
1248 // cognos-blu-patch: begin
1249 $this->participants_status[$row->usr_id]['contact'] = $row->contact;
1250 // cognos-blu-patch: end
1251 }
1252 }
1253
1261 public function isGroupingMember($a_usr_id, $a_field = '')
1262 {
1263 global $DIC;
1264
1265 $rbacreview = $DIC['rbacreview'];
1266 $ilObjDataCache = $DIC['ilObjDataCache'];
1267 $ilDB = $DIC['ilDB'];
1268
1269 // Used for membership limitations -> check membership by given field
1270 if ($a_field) {
1271 include_once './Services/User/classes/class.ilObjUser.php';
1272
1273 $tmp_user = &ilObjectFactory::getInstanceByObjId($a_usr_id);
1274 switch ($a_field) {
1275 case 'login':
1276 $and = "AND login = " . $ilDB->quote($tmp_user->getLogin(), 'text') . " ";
1277 break;
1278 case 'email':
1279 $and = "AND email = " . $ilDB->quote($tmp_user->getEmail(), 'text') . " ";
1280 break;
1281 case 'matriculation':
1282 $and = "AND matriculation = " . $ilDB->quote($tmp_user->getMatriculation(), 'text') . " ";
1283 break;
1284
1285 default:
1286 $and = "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " ";
1287 break;
1288 }
1289
1290 if (!$this->getParticipants()) {
1291 return false;
1292 }
1293
1294 $query = "SELECT * FROM usr_data ud " .
1295 "WHERE " . $ilDB->in('usr_id', $this->getParticipants(), false, 'integer') . " " .
1296 $and;
1297
1298 $res = $ilDB->query($query);
1299 return $res->numRows() ? true : false;
1300 }
1301 }
1302
1303 public static function lookupSubscribers($a_obj_id)
1304 {
1305 global $DIC;
1306
1307 $ilDB = $DIC['ilDB'];
1308
1309 $subscribers = array();
1310 $query = "SELECT usr_id FROM il_subscribers " .
1311 "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
1312 "ORDER BY sub_time ";
1313
1314 $res = $ilDB->query($query);
1315 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1316 $subscribers[] = $row->usr_id;
1317 }
1318 return $subscribers;
1319 }
1320
1326 public function getSubscribers()
1327 {
1328 $this->readSubscribers();
1329
1330 return $this->subscribers;
1331 }
1332
1333
1339 public function getCountSubscribers()
1340 {
1341 return count($this->getSubscribers());
1342 }
1343
1349 public function getSubscriberData($a_usr_id)
1350 {
1351 return $this->readSubscriberData($a_usr_id);
1352 }
1353
1354
1355
1361 public function assignSubscribers($a_usr_ids)
1362 {
1363 if (!is_array($a_usr_ids) or !count($a_usr_ids)) {
1364 return false;
1365 }
1366 foreach ($a_usr_ids as $id) {
1367 if (!$this->assignSubscriber($id)) {
1368 return false;
1369 }
1370 }
1371 return true;
1372 }
1373
1379 public function assignSubscriber($a_usr_id)
1380 {
1381 global $DIC;
1382
1383 $ilErr = $DIC['ilErr'];
1384
1385 $ilErr->setMessage("");
1386 if (!$this->isSubscriber($a_usr_id)) {
1387 $ilErr->appendMessage($this->lng->txt("crs_user_notsubscribed"));
1388
1389 return false;
1390 }
1391 if ($this->isAssigned($a_usr_id)) {
1392 $tmp_obj = ilObjectFactory::getInstanceByObjId($a_usr_id);
1393 $ilErr->appendMessage($tmp_obj->getLogin() . ": " . $this->lng->txt("crs_user_already_assigned"));
1394
1395 return false;
1396 }
1397
1398 if (!$tmp_obj = &ilObjectFactory::getInstanceByObjId($a_usr_id)) {
1399 $ilErr->appendMessage($this->lng->txt("crs_user_not_exists"));
1400
1401 return false;
1402 }
1403
1404 // TODO: must be group or course member role
1405 if ($this instanceof ilCourseParticipants) {
1406 $this->add($tmp_obj->getId(), IL_CRS_MEMBER);
1407 }
1408 if ($this instanceof ilGroupParticipants) {
1409 $this->add($tmp_obj->getId(), IL_GRP_MEMBER);
1410 }
1411 if ($this instanceof ilLearningSequenceParticipants) {
1412 $this->add($tmp_obj->getId(), IL_LSO_MEMBER);
1413 }
1414 if ($this instanceof ilSessionParticipants) {
1415 $this->register($tmp_obj->getId());
1416 }
1417 $this->deleteSubscriber($a_usr_id);
1418 return true;
1419 }
1420
1426 public function autoFillSubscribers()
1427 {
1428 $this->readSubscribers();
1429
1430 $counter = 0;
1431 foreach ($this->subscribers as $subscriber) {
1432 if (!$this->assignSubscriber($subscriber)) {
1433 continue;
1434 } else {
1435 // TODO: notification
1436 #$this->sendNotification($this->NOTIFY_ACCEPT_SUBSCRIBER,$subscriber);
1437 }
1438 ++$counter;
1439 }
1440
1441 return $counter;
1442 }
1443
1449 public function addSubscriber($a_usr_id)
1450 {
1451 global $DIC;
1452
1453 $ilDB = $DIC['ilDB'];
1454
1455 $query = "INSERT INTO il_subscribers (usr_id,obj_id,subject,sub_time) " .
1456 " VALUES (" .
1457 $ilDB->quote($a_usr_id, 'integer') . "," .
1458 $ilDB->quote($this->obj_id, 'integer') . ", " .
1459 $ilDB->quote('', 'text') . ", " .
1460 $ilDB->quote(time(), 'integer') .
1461 ")";
1462 $res = $ilDB->manipulate($query);
1463
1464 return true;
1465 }
1466
1467
1473 public function updateSubscriptionTime($a_usr_id, $a_subtime)
1474 {
1475 global $DIC;
1476
1477 $ilDB = $DIC['ilDB'];
1478
1479 $query = "UPDATE il_subscribers " .
1480 "SET sub_time = " . $ilDB->quote($a_subtime, 'integer') . " " .
1481 "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1482 "AND obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " ";
1483 $res = $ilDB->manipulate($query);
1484
1485 return true;
1486 }
1487
1495 public function updateSubject($a_usr_id, $a_subject)
1496 {
1497 global $DIC;
1498
1499 $ilDB = $DIC['ilDB'];
1500
1501 $query = "UPDATE il_subscribers " .
1502 "SET subject = " . $ilDB->quote($a_subject, 'text') . " " .
1503 "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1504 "AND obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " ";
1505 $res = $ilDB->manipulate($query);
1506 return true;
1507 }
1508
1509
1515 public function deleteSubscriber($a_usr_id)
1516 {
1517 global $DIC;
1518
1519 $ilDB = $DIC['ilDB'];
1520
1521 $query = "DELETE FROM il_subscribers " .
1522 "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1523 "AND obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " ";
1524 $res = $ilDB->manipulate($query);
1525
1526 return true;
1527 }
1528
1529
1535 public function deleteSubscribers($a_usr_ids)
1536 {
1537 global $DIC;
1538
1539 $ilErr = $DIC['ilErr'];
1540 $ilDB = $DIC['ilDB'];
1541
1542 if (!is_array($a_usr_ids) or !count($a_usr_ids)) {
1543 $ilErr->setMessage('');
1544 $ilErr->appendMessage($this->lng->txt("no_usr_ids_given"));
1545
1546 return false;
1547 }
1548 $query = "DELETE FROM il_subscribers " .
1549 "WHERE " . $ilDB->in('usr_id', (array) $a_usr_ids, false, 'integer') . " " .
1550 "AND obj_id = " . $ilDB->quote($this->obj_id, 'integer');
1551 $res = $ilDB->query($query);
1552 return true;
1553 }
1554
1555
1561 public function isSubscriber($a_usr_id)
1562 {
1563 global $DIC;
1564
1565 $ilDB = $DIC['ilDB'];
1566
1567 $query = "SELECT * FROM il_subscribers " .
1568 "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1569 "AND obj_id = " . $ilDB->quote($this->obj_id, 'integer') . "";
1570
1571 $res = $ilDB->query($query);
1572 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1573 return true;
1574 }
1575 return false;
1576 }
1577
1584 public static function _isSubscriber($a_obj_id, $a_usr_id)
1585 {
1586 global $DIC;
1587
1588 $ilDB = $DIC['ilDB'];
1589
1590 $query = "SELECT * FROM il_subscribers " .
1591 "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1592 "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . "";
1593
1594 $res = $ilDB->query($query);
1595 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1596 return true;
1597 }
1598 return false;
1599 }
1600
1606 protected function readSubscribers()
1607 {
1608 global $DIC;
1609
1610 $ilDB = $DIC['ilDB'];
1611
1612 $this->subscribers = array();
1613
1614 $query = "SELECT usr_id FROM il_subscribers " .
1615 "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
1616 "ORDER BY sub_time ";
1617
1618 $res = $this->ilDB->query($query);
1619 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1620 // DELETE SUBSCRIPTION IF USER HAS BEEN DELETED
1621 if (!ilObjectFactory::getInstanceByObjId($row->usr_id, false)) {
1622 $this->deleteSubscriber($row->usr_id);
1623 }
1624 $this->subscribers[] = $row->usr_id;
1625 }
1626 return true;
1627 }
1628
1634 protected function readSubscriberData($a_usr_id)
1635 {
1636 global $DIC;
1637
1638 $ilDB = $DIC['ilDB'];
1639
1640 $query = "SELECT * FROM il_subscribers " .
1641 "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
1642 "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer') . "";
1643
1644 $res = $this->ilDB->query($query);
1645 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1646 $data["time"] = $row->sub_time;
1647 $data["usr_id"] = $row->usr_id;
1648 $data['subject'] = $row->subject;
1649 }
1650 return $data ? $data : array();
1651 }
1652
1653 public static function lookupSubscribersData($a_obj_id)
1654 {
1655 global $DIC;
1656
1657 $ilDB = $DIC['ilDB'];
1658
1659 $query = 'SELECT * FROM il_subscribers ' .
1660 'WHERE obj_id = ' . $ilDB->quote($a_obj_id, 'integer');
1661 $res = $ilDB->query($query);
1662
1663 $data = array();
1664 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1665 $data[$row->usr_id]['time'] = $row->sub_time;
1666 $data[$row->usr_id]['usr_id'] = $row->usr_id;
1667 $data[$row->usr_id]['subject'] = $row->subject;
1668 }
1669 return $data;
1670 }
1671
1679 public static function _getAllSupportContactsOfUser($a_usr_id, $a_type)
1680 {
1681 global $DIC;
1682
1683 $ilDB = $DIC['ilDB'];
1684
1685 // todo: join the two queries or alternatively reuse _getMembershipByType
1686 // for the first part
1687
1688 // this will also dismiss local roles!
1689 $j2 = "JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id) ";
1690 $a2 = "AND obd2.title LIKE 'il_" . $a_type . "_mem%' ";
1691
1692 // #14290 - no role folder anymore
1693 $query = "SELECT DISTINCT obd.obj_id,obr.ref_id FROM rbac_ua ua " .
1694 "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id " .
1695 "JOIN object_reference obr ON fa.parent = obr.ref_id " .
1696 "JOIN object_data obd ON obr.obj_id = obd.obj_id " .
1697 $j2 .
1698 "WHERE obd.type = " . $ilDB->quote($a_type, 'text') . " " .
1699 "AND fa.assign = 'y' " .
1700 "AND ua.usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1701 $a2;
1702
1703 $res = $ilDB->query($query);
1704 $obj_ids = array();
1705 while ($row = $ilDB->fetchObject($res)) {
1706 $obj_ids[] = $row->obj_id;
1707 }
1708
1709 $set = $ilDB->query("SELECT obj_id, usr_id FROM obj_members " .
1710 " WHERE " . $ilDB->in("obj_id", $obj_ids, false, "integer") .
1711 " AND contact = " . $ilDB->quote(1, "integer"));
1712 $res = array();
1713 while ($rec = $ilDB->fetchAssoc($set)) {
1714 $res[] = $rec;
1715 }
1716
1717 return $res;
1718 }
1719
1725 public function setRoleOrderPosition($a_user_id)
1726 {
1727 $counter = 0;
1728 $sortable_assignments = '9999999999';
1729 foreach ($this->roles_sorted as $role_id => $trash) {
1730 if (in_array($a_user_id, (array) $this->role_assignments[$role_id])) {
1731 $sortable_assignments = substr_replace($sortable_assignments, '1', $counter, 1);
1732 }
1733 ++$counter;
1734 }
1735 return $sortable_assignments;
1736 }
1737}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
An exception for terminatinating execution or to throw for unit testing.
const IL_SESS_MEMBER
const IL_LSO_ADMIN
const IL_CRS_ADMIN
Base class for course and group participants.
const IL_CRS_MEMBER
const IL_ROLE_POSITION_TUTOR
const IL_LSO_MEMBER
const IL_GRP_MEMBER
const IL_ROLE_POSITION_ADMIN
const IL_CRS_TUTOR
const IL_ROLE_POSITION_MEMBER
const IL_GRP_ADMIN
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
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 _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.
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.
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.
global $ilCtrl
Definition: ilias.php:18
$query
$ilErr
Definition: raiseError.php:18
foreach($_POST as $key=> $value) $res
$data
Definition: storeScorm.php:23
$a_type
Definition: workflow.php:92
$DIC
Definition: xapitoken.php:46