ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilParticipants Class Reference
+ Inheritance diagram for ilParticipants:
+ Collaboration diagram for ilParticipants:

Public Member Functions

 __construct ($a_component_name, $a_ref_id)
 Singleton Constructor. More...
 
 getObjId ()
 get current obj_id More...
 
 getType ()
 Get object type. More...
 
 getNotificationRecipients ()
 Get admin, tutor which have notification enabled. More...
 
 getCountMembers ()
 Get number of members (not participants) More...
 
 getCountParticipants ()
 Get number of participants. More...
 
 getParticipants ()
 Get all participants ids. More...
 
 getMembers ()
 Get all members ids (admins and tutors are not members) Use get participants to fetch all. More...
 
 getAdmins ()
 Get all admins ids. More...
 
 getCountAdmins ()
 Get number of admins. More...
 
 getTutors ()
 Get all tutors ids. More...
 
 isAdmin ($a_usr_id)
 is user admin More...
 
 isTutor ($a_usr_id)
 is user tutor More...
 
 isMember ($a_usr_id)
 is user member More...
 
 isAssigned ($a_usr_id)
 check if user is assigned More...
 
 isLastAdmin ($a_usr_id)
 Check if user is last admin. More...
 
 getRoles ()
 Get course roles. More...
 
 getAssignedRoles ($a_usr_id)
 Get assigned roles. More...
 
 updateRoleAssignments ($a_usr_id, $a_roles)
 Update role assignments. More...
 
 checkLastAdmin ($a_usr_ids)
 Check if user for deletion are last admins. More...
 
 isBlocked ($a_usr_id)
 Check if user is blocked. More...
 
 hasPassed ($a_usr_id)
 Check if user has passed course. More...
 
 delete ($a_usr_id)
 Drop user from all roles. More...
 
 updateBlocked ($a_usr_id, $a_blocked)
 Update blocked status. More...
 
 updateContact ($a_usr_id, $a_contact)
 Update contact setting @global type $ilDB. More...
 
 getContacts ()
 get user ids which are confirgured as contact More...
 
 updateNotification ($a_usr_id, $a_notification)
 Update notification status. More...
 
 add ($a_usr_id, $a_role)
 Add user to object. More...
 
 deleteParticipants ($a_user_ids)
 Delete users. More...
 
 addDesktopItem ($a_usr_id)
 Add desktop item. More...
 
 dropDesktopItem ($a_usr_id)
 Drop desktop item. More...
 
 isNotificationEnabled ($a_usr_id)
 check if notification is enabled More...
 
 isContact ($a_usr_id)
 Check if user is contact. More...
 
 getAutoGeneratedRoleId ($a_role_type)
 Get role id of auto generated role type. More...
 
 isGroupingMember ($a_usr_id, $a_field='')
 Check grouping membership. More...
 
 getSubscribers ()
 get all subscribers More...
 
 getCountSubscribers ()
 get number of subscribers More...
 
 getSubscriberData ($a_usr_id)
 get subscriber data More...
 
 assignSubscribers ($a_usr_ids)
 Assign subscribers. More...
 
 assignSubscriber ($a_usr_id)
 Assign subscriber. More...
 
 autoFillSubscribers ()
 Assign subscriber. More...
 
 addSubscriber ($a_usr_id)
 Add subscriber. More...
 
 updateSubscriptionTime ($a_usr_id, $a_subtime)
 Update subscription time. More...
 
 updateSubject ($a_usr_id, $a_subject)
 update subject More...
 
 deleteSubscriber ($a_usr_id)
 Delete subsciber. More...
 
 deleteSubscribers ($a_usr_ids)
 Delete subscibers. More...
 
 isSubscriber ($a_usr_id)
 check if is subscriber More...
 
 setRoleOrderPosition ($a_user_id)
 Set role order position. More...
 

Static Public Member Functions

static getInstance ($a_ref_id)
 Get instance by ref_id. More...
 
static getInstanceByObjId ($a_obj_id)
 Get instance by obj type. More...
 
static hasParticipantListAccess ($a_obj_id, $a_usr_id=null)
 Check if (current) user has access to the participant list. More...
 
static _getMembershipByType ($a_usr_id, $a_type, $a_only_member_role=false)
 get membership by type Get course or group membership More...
 
static _isParticipant ($a_ref_id, $a_usr_id)
 Static function to check if a user is a participant of the container object. More...
 
static lookupNumberOfParticipants ($a_ref_id)
 Lookup the number of participants (crs admins, tutors, members, grp admins, members) More...
 
static lookupNumberOfMembers ($a_ref_id)
 Lookup number of members @global ilRbacReview $rbacreview @global <type> $ilObjDataCache. More...
 
static _isBlocked ($a_obj_id, $a_usr_id)
 Check if user is blocked. More...
 
static _hasPassed ($a_obj_id, $a_usr_id)
 Check if user has passed course. More...
 
static _deleteAllEntries ($a_obj_id)
 Delete all entries Normally called for course deletion. More...
 
static _deleteUser ($a_usr_id)
 Delete user data. More...
 
static getDefaultMemberRole ($a_ref_id)
 
static lookupSubscribers ($a_obj_id)
 
static _isSubscriber ($a_obj_id, $a_usr_id)
 check if user is subscriber More...
 
static lookupSubscribersData ($a_obj_id)
 
static _getAllSupportContactsOfUser ($a_usr_id, $a_type)
 Get all support contacts for a user. More...
 

Protected Member Functions

 getComponent ()
 Get component name Used for raising events. More...
 
 readParticipants ()
 Read participants. More...
 
 readParticipantsStatus ()
 Read status of participants (blocked, notification, passed) More...
 
 readSubscribers ()
 read subscribers More...
 
 readSubscriberData ($a_usr_id)
 read subscribers More...
 

Protected Attributes

 $component = ''
 
 $obj_id = 0
 
 $type = ''
 
 $ref_id = 0
 
 $roles = array()
 
 $role_data = array()
 
 $roles_sorted = []
 
 $role_assignments = []
 
 $participants = array()
 
 $participants_status = array()
 
 $members = array()
 
 $tutors = array()
 
 $admins = array()
 
 $subscribers = array()
 
 $ilDB
 
 $lng
 
 $logger = null
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilParticipants::__construct (   $a_component_name,
  $a_ref_id 
)

Singleton Constructor.

@access public

Parameters
stringcomponent definition e.g Modules/Course
intobj_id of container

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

73 {
74 $this->ilDB = $GLOBALS['DIC']->database();
75 $this->lng = $GLOBALS['DIC']->language();
76 $this->logger = $GLOBALS['DIC']->logger()->mem();
77
78 $this->component = $a_component_name;
79
80 $this->ref_id = $a_ref_id;
81 $this->obj_id = ilObject::_lookupObjId($a_ref_id);
82 $this->type = ilObject::_lookupType($this->obj_id);
83
84 $this->readParticipants();
86 }
Database Wrapper.
Definition: class.ilDB.php:30
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
readParticipants()
Read participants.
readParticipantsStatus()
Read status of participants (blocked, notification, passed)
$GLOBALS['loaded']
Global hash that tracks already loaded includes.

References $GLOBALS, ilObject\_lookupObjId(), ilObject\_lookupType(), readParticipants(), and readParticipantsStatus().

+ Here is the call graph for this function:

Member Function Documentation

◆ _deleteAllEntries()

static ilParticipants::_deleteAllEntries (   $a_obj_id)
static

Delete all entries Normally called for course deletion.

@access public

Parameters
intobj_id

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

369 {
370 global $ilDB;
371
372 $query = "DELETE FROM obj_members " .
373 "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " ";
374 $res = $ilDB->manipulate($query);
375
376 $query = "DELETE FROM il_subscribers " .
377 "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . "";
378 $res = $ilDB->manipulate($query);
379
380 $query = 'DELETE FROM crs_waiting_list ' .
381 'WHERE obj_id = ' . $ilDB->quote($a_obj_id, 'integer');
382 $ilDB->manipulate($query);
383
384 return true;
385 }
$query
foreach($_POST as $key=> $value) $res

References $ilDB, $query, and $res.

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

+ Here is the caller graph for this function:

◆ _deleteUser()

static ilParticipants::_deleteUser (   $a_usr_id)
static

Delete user data.

@access public

Parameters
intuser id

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

396 {
397 global $ilDB;
398
399 $query = "DELETE FROM obj_members WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . "";
400 $res = $ilDB->manipulate($query);
401
402 $query = "DELETE FROM il_subscribers WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . "";
403 $res = $ilDB->manipulate($query);
404
405 include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
407 }
static _deleteUser($a_usr_id)
Delete user.

References $ilDB, $query, $res, and ilWaitingList\_deleteUser().

Referenced by ilObjCourse\_deleteUser().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getAllSupportContactsOfUser()

static ilParticipants::_getAllSupportContactsOfUser (   $a_usr_id,
  $a_type 
)
static

Get all support contacts for a user.

Parameters
int$a_usr_idusr_id
string$a_typecrs or grp
Returns
array array of contacts (keys are usr_id and obj_id)

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

1534 {
1535 global $ilDB;
1536
1537 // todo: join the two queries or alternatively reuse _getMembershipByType
1538 // for the first part
1539
1540 // this will also dismiss local roles!
1541 $j2 = "JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id) ";
1542 $a2 = "AND obd2.title LIKE 'il_" . $a_type . "_mem%' ";
1543
1544 // #14290 - no role folder anymore
1545 $query = "SELECT DISTINCT obd.obj_id,obr.ref_id FROM rbac_ua ua " .
1546 "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id " .
1547 "JOIN object_reference obr ON fa.parent = obr.ref_id " .
1548 "JOIN object_data obd ON obr.obj_id = obd.obj_id " .
1549 $j2 .
1550 "WHERE obd.type = " . $ilDB->quote($a_type, 'text') . " " .
1551 "AND fa.assign = 'y' " .
1552 "AND ua.usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1553 $a2;
1554
1555 $res = $ilDB->query($query);
1556 $obj_ids = array();
1557 while ($row = $ilDB->fetchObject($res)) {
1558 $obj_ids[] = $row->obj_id;
1559 }
1560
1561 $set = $ilDB->query("SELECT obj_id, usr_id FROM obj_members " .
1562 " WHERE " . $ilDB->in("obj_id", $obj_ids, false, "integer") .
1563 " AND contact = " . $ilDB->quote(1, "integer"));
1564 $res = array();
1565 while ($rec = $ilDB->fetchAssoc($set)) {
1566 $res[] = $rec;
1567 }
1568
1569 return $res;
1570 }
$a_type
Definition: workflow.php:92

References $a_type, $ilDB, $query, $res, and $row.

Referenced by ilAwarenessUserProviderCourseContacts\getInitialUserSet().

+ Here is the caller graph for this function:

◆ _getMembershipByType()

static ilParticipants::_getMembershipByType (   $a_usr_id,
  $a_type,
  $a_only_member_role = false 
)
static

get membership by type Get course or group membership

@access public

Parameters
int$a_usr_idusr_id
string | array$a_typecrs or grp | array of strings
bool$a_only_member_role
Returns

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

208 {
209 global $ilDB;
210
211 if (!is_array($a_type)) {
212 $a_type = array($a_type);
213 }
214
215 // this will also dismiss local roles!
216 if ($a_only_member_role) {
217 $j2 = "JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id) ";
218 $a2 = 'AND obd2.title = ' . $ilDB->concat(
219 array(
220 array($ilDB->quote('il_', 'text')),
221 array('obd.type'),
222 array($ilDB->quote('_member_', 'text')),
223 array('obr.ref_id'),
224 ),
225 false
226 );
227 }
228
229 // #14290 - no role folder anymore
230 $query = "SELECT DISTINCT obd.obj_id,obr.ref_id FROM rbac_ua ua " .
231 "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id " .
232 "JOIN object_reference obr ON fa.parent = obr.ref_id " .
233 "JOIN object_data obd ON obr.obj_id = obd.obj_id " .
234 $j2 .
235 "WHERE " . $ilDB->in("obd.type", $a_type, false, "text") .
236 "AND fa.assign = 'y' " .
237 "AND ua.usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
238 $a2;
239 $res = $ilDB->query($query);
240 while ($row = $ilDB->fetchObject($res)) {
241 $ref_ids[] = $row->obj_id;
242 }
243
244 return $ref_ids ? $ref_ids : array();
245 }

References $a_type, $ilDB, $query, $res, and $row.

Referenced by ilNewsItem\_getNewsItemsOfUser(), ilPortfolioPageGUI\getCoursesOfUser(), ilAwarenessUserProviderMemberships\getInitialUserSet(), ilCourseVerificationTableGUI\getItems(), ilPDSelectedItemsBlockMembershipsProvider\getObjectsByMembership(), ilTestEvaluationData\getParticipants(), ilPortfolioAccessHandler\getPossibleSharedTargets(), ilWorkspaceAccessHandler\getPossibleSharedTargets(), ilWorkspaceShareTableGUI\initFilter(), ilCalendarCategories\readPDCalendars(), ilCalendarCategories\readReposCalendars(), ilWorkspaceAccessGUI\share(), and ilObjectCopyGUI\showSourceSelectionMembership().

+ Here is the caller graph for this function:

◆ _hasPassed()

static ilParticipants::_hasPassed (   $a_obj_id,
  $a_usr_id 
)
static

Check if user has passed course.

@access public

Parameters
intobj_id
intuser id

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

348 {
349 global $ilDB;
350
351 $query = "SELECT * FROM obj_members " .
352 "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
353 "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
354 "AND passed = '1'";
355 $res = $ilDB->query($query);
356 return $res->numRows() ? true : false;
357 }

References $ilDB, $query, and $res.

Referenced by ilObjCourseAccess\checkCondition().

+ Here is the caller graph for this function:

◆ _isBlocked()

static ilParticipants::_isBlocked (   $a_obj_id,
  $a_usr_id 
)
static

Check if user is blocked.

@access public

Parameters
intcourse id
intusr_id

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

327 {
328 global $ilDB;
329
330 $query = "SELECT * FROM obj_members " .
331 "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
332 "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
333 "AND blocked = " . $ilDB->quote(1, 'integer');
334 $res = $ilDB->query($query);
335 return $res->numRows() ? true : false;
336 }

References $ilDB, $query, and $res.

◆ _isParticipant()

static ilParticipants::_isParticipant (   $a_ref_id,
  $a_usr_id 
)
static

Static function to check if a user is a participant of the container object.

@access public

Parameters
intref_id
intuser id

Reimplemented in ilGroupParticipants, and ilSessionParticipants.

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

258 {
259 global $rbacreview;
260
261 $local_roles = $rbacreview->getRolesOfRoleFolder($a_ref_id, false);
262
263 return $rbacreview->isAssignedToAtLeastOneGivenRole($a_usr_id, $local_roles);
264 }

Referenced by ilForumModeratorsGUI\detachModeratorRole(), ilObjCourseGUI\executeCommand(), ilAwarenessUserProviderMemberships\getInitialUserSet(), ilObjCourseGUI\getTabs(), ilNotification\hasNotification(), and ilObjCourseGUI\initHeaderAction().

+ Here is the caller graph for this function:

◆ _isSubscriber()

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

check if user is subscriber

@access public

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

1447 {
1448 global $ilDB;
1449
1450 $query = "SELECT * FROM il_subscribers " .
1451 "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1452 "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . "";
1453
1454 $res = $ilDB->query($query);
1455 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1456 return true;
1457 }
1458 return false;
1459 }

References $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilObjCourseListGUI\getProperties(), and ilMembershipTest\testSubscription().

+ Here is the caller graph for this function:

◆ add()

ilParticipants::add (   $a_usr_id,
  $a_role 
)

Add user to object.

@access public

Parameters
intuser id
introle IL_CRS_ADMIN || IL_CRS_TUTOR || IL_CRS_MEMBER

Reimplemented in ilCourseParticipants, ilGroupParticipants, and ilSessionParticipants.

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

885 {
886 global $rbacadmin,$ilLog,$ilAppEventHandler;
887
888 if ($this->isAssigned($a_usr_id)) {
889 return false;
890 }
891
892 switch ($a_role) {
893 case IL_CRS_ADMIN:
894 $this->admins[] = $a_usr_id;
895 break;
896
897 case IL_CRS_TUTOR:
898 $this->tutors[] = $a_usr_id;
899 break;
900
901 case IL_CRS_MEMBER:
902 $this->members[] = $a_usr_id;
903 break;
904
905 case IL_GRP_ADMIN:
906 $this->admins[] = $a_usr_id;
907 break;
908
909 case IL_GRP_MEMBER:
910 $this->members[] = $a_usr_id;
911 break;
912
913 case IL_SESS_MEMBER:
914 $this->members[] = $a_usr_id;
915 break;
916 }
917
918 $this->participants[] = $a_usr_id;
919 $rbacadmin->assignUser($this->role_data[$a_role], $a_usr_id);
920
921 // Delete subscription request
922 $this->deleteSubscriber($a_usr_id);
923
924 include_once './Services/Membership/classes/class.ilWaitingList.php';
925 ilWaitingList::deleteUserEntry($a_usr_id, $this->obj_id);
926
927 $ilLog->write(__METHOD__ . ': Raise new event: ' . $this->getComponent() . ' addParticipant');
928 $ilAppEventHandler->raise(
929 $this->getComponent(),
930 "addParticipant",
931 array(
932 'obj_id' => $this->obj_id,
933 'usr_id' => $a_usr_id,
934 'role_id' => $a_role)
935 );
936 return true;
937 }
const IL_SESS_MEMBER
const IL_CRS_ADMIN
Base class for course and group participants.
const IL_CRS_MEMBER
const IL_GRP_MEMBER
const IL_CRS_TUTOR
const IL_GRP_ADMIN
getComponent()
Get component name Used for raising events.
isAssigned($a_usr_id)
check if user is assigned
deleteSubscriber($a_usr_id)
Delete subsciber.
static deleteUserEntry($a_usr_id, $a_obj_id)
Delete one user entry.

References $ilLog, deleteSubscriber(), ilWaitingList\deleteUserEntry(), getComponent(), IL_CRS_ADMIN, IL_CRS_MEMBER, IL_CRS_TUTOR, IL_GRP_ADMIN, IL_GRP_MEMBER, IL_SESS_MEMBER, and isAssigned().

Referenced by assignSubscriber().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addDesktopItem()

ilParticipants::addDesktopItem (   $a_usr_id)

Add desktop item.

@access public

Parameters
intusr_id

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

963 {
964 if (!ilObjUser::_isDesktopItem($a_usr_id, $this->ref_id, $this->type)) {
965 ilObjUser::_addDesktopItem($a_usr_id, $this->ref_id, $this->type);
966 }
967 return true;
968 }
static _isDesktopItem($a_usr_id, $a_item_id, $a_type)
check wether an item is on the users desktop or not
static _addDesktopItem($a_usr_id, $a_item_id, $a_type, $a_par="")
add an item to user's personal desktop

References ilObjUser\_addDesktopItem(), and ilObjUser\_isDesktopItem().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addSubscriber()

ilParticipants::addSubscriber (   $a_usr_id)

Add subscriber.

@access public

Reimplemented in ilCourseParticipants, and ilGroupParticipants.

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

1325 {
1326 global $ilDB;
1327
1328 $query = "INSERT INTO il_subscribers (usr_id,obj_id,subject,sub_time) " .
1329 " VALUES (" .
1330 $ilDB->quote($a_usr_id, 'integer') . "," .
1331 $ilDB->quote($this->obj_id, 'integer') . ", " .
1332 $ilDB->quote('', 'text') . ", " .
1333 $ilDB->quote(time(), 'integer') .
1334 ")";
1335 $res = $ilDB->manipulate($query);
1336
1337 return true;
1338 }

References $ilDB, $query, and $res.

◆ assignSubscriber()

ilParticipants::assignSubscriber (   $a_usr_id)

Assign subscriber.

@access public

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

1260 {
1261 global $ilErr;
1262
1263 $ilErr->setMessage("");
1264 if (!$this->isSubscriber($a_usr_id)) {
1265 $ilErr->appendMessage($this->lng->txt("crs_user_notsubscribed"));
1266
1267 return false;
1268 }
1269 if ($this->isAssigned($a_usr_id)) {
1270 $tmp_obj = ilObjectFactory::getInstanceByObjId($a_usr_id);
1271 $ilErr->appendMessage($tmp_obj->getLogin() . ": " . $this->lng->txt("crs_user_already_assigned"));
1272
1273 return false;
1274 }
1275
1276 if (!$tmp_obj =&ilObjectFactory::getInstanceByObjId($a_usr_id)) {
1277 $ilErr->appendMessage($this->lng->txt("crs_user_not_exists"));
1278
1279 return false;
1280 }
1281
1282 // TODO: must be group or course member role
1283 if ($this instanceof ilCourseParticipants) {
1284 $this->add($tmp_obj->getId(), IL_CRS_MEMBER);
1285 }
1286 if ($this instanceof ilGroupParticipants) {
1287 $this->add($tmp_obj->getId(), IL_GRP_MEMBER);
1288 }
1289 if ($this instanceof ilSessionParticipants) {
1290 $this->register($tmp_obj->getId());
1291 }
1292 $this->deleteSubscriber($a_usr_id);
1293 return true;
1294 }
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
add($a_usr_id, $a_role)
Add user to object.
isSubscriber($a_usr_id)
check if is subscriber
Session participation handling.
global $ilErr
Definition: raiseError.php:16

References $ilErr, add(), deleteSubscriber(), ilObjectFactory\getInstanceByObjId(), IL_CRS_MEMBER, IL_GRP_MEMBER, isAssigned(), and isSubscriber().

Referenced by assignSubscribers(), and autoFillSubscribers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ assignSubscribers()

ilParticipants::assignSubscribers (   $a_usr_ids)

Assign subscribers.

@access public

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

1242 {
1243 if (!is_array($a_usr_ids) or !count($a_usr_ids)) {
1244 return false;
1245 }
1246 foreach ($a_usr_ids as $id) {
1247 if (!$this->assignSubscriber($id)) {
1248 return false;
1249 }
1250 }
1251 return true;
1252 }
assignSubscriber($a_usr_id)
Assign subscriber.
if(!array_key_exists('StateId', $_REQUEST)) $id

References $id, and assignSubscriber().

+ Here is the call graph for this function:

◆ autoFillSubscribers()

ilParticipants::autoFillSubscribers ( )

Assign subscriber.

@access public

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

1302 {
1303 $this->readSubscribers();
1304
1305 $counter = 0;
1306 foreach ($this->subscribers as $subscriber) {
1307 if (!$this->assignSubscriber($subscriber)) {
1308 continue;
1309 } else {
1310 // TODO: notification
1311 #$this->sendNotification($this->NOTIFY_ACCEPT_SUBSCRIBER,$subscriber);
1312 }
1313 ++$counter;
1314 }
1315
1316 return $counter;
1317 }
readSubscribers()
read subscribers
$counter

References $counter, assignSubscriber(), and readSubscribers().

+ Here is the call graph for this function:

◆ checkLastAdmin()

ilParticipants::checkLastAdmin (   $a_usr_ids)

Check if user for deletion are last admins.

@access public

Parameters
arrayarray of user ids for deletion

Reimplemented in ilSessionParticipants.

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

684 {
685 foreach ($this->getAdmins() as $admin_id) {
686 if (!in_array($admin_id, $a_usr_ids)) {
687 return true;
688 }
689 }
690 return false;
691 }
getAdmins()
Get all admins ids.

References getAdmins().

+ Here is the call graph for this function:

◆ delete()

ilParticipants::delete (   $a_usr_id)

Drop user from all roles.

@access public

Parameters
intusr_id

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

731 {
732 global $rbacadmin,$ilDB;
733
734 $this->dropDesktopItem($a_usr_id);
735 foreach ($this->roles as $role_id) {
736 $rbacadmin->deassignUser($role_id, $a_usr_id);
737 }
738
739 $query = "DELETE FROM obj_members " .
740 "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
741 "AND obj_id = " . $ilDB->quote($this->obj_id, 'integer');
742 $res = $ilDB->manipulate($query);
743
744 $this->readParticipants();
745 $this->readParticipantsStatus();
746
747 $GLOBALS['ilAppEventHandler']->raise(
748 $this->getComponent(),
749 "deleteParticipant",
750 array(
751 'obj_id' => $this->obj_id,
752 'usr_id' => $a_usr_id)
753 );
754
755 return true;
756 }
dropDesktopItem($a_usr_id)
Drop desktop item.

References $GLOBALS, $ilDB, $query, $res, dropDesktopItem(), getComponent(), readParticipants(), and readParticipantsStatus().

+ Here is the call graph for this function:

◆ deleteParticipants()

ilParticipants::deleteParticipants (   $a_user_ids)

Delete users.

@access public

Parameters
arrayuser ids

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

948 {
949 foreach ($a_user_ids as $user_id) {
950 $this->delete($user_id);
951 }
952 return true;
953 }

◆ deleteSubscriber()

ilParticipants::deleteSubscriber (   $a_usr_id)

Delete subsciber.

@access public

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

1385 {
1386 global $ilDB;
1387
1388 $query = "DELETE FROM il_subscribers " .
1389 "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1390 "AND obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " ";
1391 $res = $ilDB->manipulate($query);
1392
1393 return true;
1394 }

References $ilDB, $query, and $res.

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

+ Here is the caller graph for this function:

◆ deleteSubscribers()

ilParticipants::deleteSubscribers (   $a_usr_ids)

Delete subscibers.

@access public

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

1403 {
1404 global $ilErr,$ilDB;
1405
1406 if (!is_array($a_usr_ids) or !count($a_usr_ids)) {
1407 $ilErr->setMessage('');
1408 $ilErr->appendMessage($this->lng->txt("no_usr_ids_given"));
1409
1410 return false;
1411 }
1412 $query = "DELETE FROM il_subscribers " .
1413 "WHERE " . $ilDB->in('usr_id', (array) $a_usr_ids, false, 'integer') . " " .
1414 "AND obj_id = " . $ilDB->quote($this->obj_id, 'integer');
1415 $res = $ilDB->query($query);
1416 return true;
1417 }

References $ilDB, $ilErr, $query, and $res.

◆ dropDesktopItem()

ilParticipants::dropDesktopItem (   $a_usr_id)

Drop desktop item.

@access public

Parameters
intusr_id

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

978 {
979 if (ilObjUser::_isDesktopItem($a_usr_id, $this->ref_id, $this->type)) {
980 ilObjUser::_dropDesktopItem($a_usr_id, $this->ref_id, $this->type);
981 }
982
983 return true;
984 }
static _dropDesktopItem($a_usr_id, $a_item_id, $a_type)
drop an item from user's personal desktop

References ilObjUser\_dropDesktopItem(), and ilObjUser\_isDesktopItem().

Referenced by delete().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAdmins()

ilParticipants::getAdmins ( )

Get all admins ids.

@access public

Returns
array array of user ids

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

528 {
529 return $this->admins ? $this->admins : array();
530 }

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

+ Here is the caller graph for this function:

◆ getAssignedRoles()

ilParticipants::getAssignedRoles (   $a_usr_id)

Get assigned roles.

@access public

Parameters
intuser_id

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

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

◆ getAutoGeneratedRoleId()

ilParticipants::getAutoGeneratedRoleId (   $a_role_type)

Get role id of auto generated role type.

Parameters
type$a_role_type

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

1023 {
1024 if (array_key_exists($a_role_type, $this->role_data)) {
1025 return $this->role_data[$a_role_type];
1026 }
1027
1028 return 0;
1029 }

◆ getComponent()

ilParticipants::getComponent ( )
protected

Get component name Used for raising events.

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

150 {
151 return $this->component;
152 }

References $component.

Referenced by add(), and delete().

+ Here is the caller graph for this function:

◆ getContacts()

ilParticipants::getContacts ( )

get user ids which are confirgured as contact

Returns
array

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

823 {
824 $contacts = array();
825 foreach ((array) $this->participants_status as $usr_id => $status) {
826 if ($status['contact']) {
827 $contacts[] = $usr_id;
828 }
829 }
830 return $contacts;
831 }

◆ getCountAdmins()

ilParticipants::getCountAdmins ( )

Get number of admins.

Returns

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

537 {
538 return count($this->getAdmins());
539 }

References getAdmins().

+ Here is the call graph for this function:

◆ getCountMembers()

ilParticipants::getCountMembers ( )

Get number of members (not participants)

@access public

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

481 {
482 return count($this->members);
483 }

◆ getCountParticipants()

ilParticipants::getCountParticipants ( )

Get number of participants.

@access public

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

492 {
493 return count($this->participants);
494 }

◆ getCountSubscribers()

ilParticipants::getCountSubscribers ( )

get number of subscribers

@access public

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

1220 {
1221 return count($this->getSubscribers());
1222 }
getSubscribers()
get all subscribers

References getSubscribers().

+ Here is the call graph for this function:

◆ getDefaultMemberRole()

static ilParticipants::getDefaultMemberRole (   $a_ref_id)
static

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

410 {
411 global $ilCtrl;
412
413 $obj_id = ilObject::_lookupObjId($a_ref_id);
415
416 if (!in_array($type, array('crs','grp'))) {
417 return 0;
418 }
419
420 global $rbacreview;
421
422
423 $roles = $rbacreview->getRolesOfRoleFolder($a_ref_id, false);
424
425 foreach ($roles as $role) {
427 if (substr($title, 0, 13) == ('il_' . $type . '_member')) {
428 return $role;
429 }
430 }
431 return 0;
432 }
static _lookupTitle($a_id)
lookup object title
global $ilCtrl
Definition: ilias.php:18

References $ilCtrl, $obj_id, $roles, $title, $type, ilObject\_lookupObjId(), ilObject\_lookupTitle(), and ilObject\_lookupType().

Referenced by ilStartUpGUI\_checkGoto(), ilCourseRegistrationGUI\add(), and ilRbacSystem\initMemberView().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInstance()

static ilParticipants::getInstance (   $a_ref_id)
static

Get instance by ref_id.

Parameters
int$a_ref_id
Returns
ilParticipants

Reimplemented in ilSessionParticipants.

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

94 {
97
98 switch ($type) {
99 case 'crs':
100 case 'grp':
102
103 case 'sess':
104 include_once './Modules/Session/classes/class.ilSessionParticipants.php';
105 return ilSessionParticipants::getInstance($a_ref_id);
106
107 default:
108 $GLOBALS['DIC']->logger()->mem()->logStack();
109 $GLOBALS['DIC']->logger()->mem()->warning('Invalid ref_id -> obj_id given: ' . $a_ref_id . ' -> ' . $obj_id);
110 throw new \InvalidArgumentException('Invalid obj_id given.');
111 }
112 }
static getInstanceByObjId($a_obj_id)
Get instance by obj type.
static getInstance($a_ref_id)
Get instance.

References $GLOBALS, $obj_id, $type, ilObject\_lookupObjId(), ilObject\_lookupType(), ilSessionParticipants\getInstance(), and getInstanceByObjId().

Referenced by ilSessionParticipantsTableGUI\__construct(), ilSessionParticipantsTableGUI\collectParticipants(), ilSessionParticipantsTableGUI\getParentLocalRoles(), ilTrQuery\getParticipantsForObject(), hasParticipantListAccess(), ilObjSessionGUI\registerObject(), ilObjSessionGUI\showJoinRequestButton(), and ilSessionMembershipGUI\updateMembers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInstanceByObjId()

static ilParticipants::getInstanceByObjId (   $a_obj_id)
static

Get instance by obj type.

Parameters
int$a_obj_id
Returns
ilParticipants
Exceptions
InvalidArgumentException
Deprecated:
since version 5.4 use getInstance() (ref_id based)

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

123 {
124 $type = ilObject::_lookupType($a_obj_id);
125 switch ($type) {
126 case 'crs':
127 include_once './Modules/Course/classes/class.ilCourseParticipants.php';
129
130 case 'grp':
131 include_once './Modules/Group/classes/class.ilGroupParticipants.php';
133
134 case 'sess':
135 include_once './Modules/Session/classes/class.ilSessionParticipants.php';
137
138 default:
139 $GLOBALS['ilLog']->logStack();
140 $GLOBALS['ilLog']->write(__METHOD__ . ': Invalid obj_id given: ' . $a_obj_id);
141 throw new InvalidArgumentException('Invalid obj id given');
142 }
143 }
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static _getInstanceByObjId($a_obj_id)
Get instance.

References $GLOBALS, $type, ilCourseParticipants\_getInstanceByObjId(), ilGroupParticipants\_getInstanceByObjId(), ilSessionParticipants\_getInstanceByObjId(), and ilObject\_lookupType().

Referenced by ilCourseParticipantsTableGUI\__construct(), ilGroupParticipantsTableGUI\__construct(), ilGroupAddToGroupActionGUI\addUser(), ilAppointmentPresentationCourseGUI\collectPropertiesAndActions(), ilGroupAddToGroupActionGUI\confirmAddUser(), ilGroupAddToGroupActionGUI\createGroupAndAddUser(), ilPortfolioAccessHandler\findSharedObjects(), ilWorkspaceAccessHandler\findSharedObjects(), getInstance(), ilLPStatusManualByTutor\getMembers(), ilLPStatusEvent\getMembers(), ilContSkillMemberTableGUI\getMembers(), ilMembershipGUI\getMembersObject(), ilECSAppEventListener\handleMembership(), ilObjCourseGUI\infoScreen(), ilRepositorySearchGUI\listUsers(), ilMembershipGUI\membersMap(), and ilRepositoryObjectResultTableGUI\parseObjectIds().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMembers()

ilParticipants::getMembers ( )

Get all members ids (admins and tutors are not members) Use get participants to fetch all.

@access public

Returns
array array of user ids

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

518 {
519 return $this->members ? $this->members : array();
520 }

Referenced by ilSessionParticipants\readParticipantsStatus().

+ Here is the caller graph for this function:

◆ getNotificationRecipients()

ilParticipants::getNotificationRecipients ( )

Get admin, tutor which have notification enabled.

@access public

Returns
array array of user ids

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

459 {
460 global $ilDB;
461
462 $query = "SELECT * FROM obj_members " .
463 "WHERE notification = 1 " .
464 "AND obj_id = " . $ilDB->quote($this->obj_id) . " ";
465 $res = $ilDB->query($query);
466 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
467 if ($this->isAdmin($row->usr_id) or $this->isTutor($row->usr_id)) {
468 $recp[] = $row->usr_id;
469 }
470 }
471 return $recp ? $recp : array();
472 }
isAdmin($a_usr_id)
is user admin

References $ilDB, $query, $res, $row, ilDBConstants\FETCHMODE_OBJECT, and isAdmin().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getObjId()

ilParticipants::getObjId ( )

get current obj_id

Returns
type

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

439 {
440 return $this->obj_id;
441 }

References $obj_id.

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

+ Here is the caller graph for this function:

◆ getParticipants()

ilParticipants::getParticipants ( )

Get all participants ids.

@access public

Returns
array array of user ids

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

506 {
507 return $this->participants ? $this->participants : array();
508 }

Referenced by isGroupingMember().

+ Here is the caller graph for this function:

◆ getRoles()

ilParticipants::getRoles ( )

Get course roles.

@access public

Parameters

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

623 {
624 return $this->roles ? $this->roles : array();
625 }

Referenced by updateRoleAssignments().

+ Here is the caller graph for this function:

◆ getSubscriberData()

ilParticipants::getSubscriberData (   $a_usr_id)

get subscriber data

@access public

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

1230 {
1231 return $this->readSubscriberData($a_usr_id);
1232 }
readSubscriberData($a_usr_id)
read subscribers

References readSubscriberData().

+ Here is the call graph for this function:

◆ getSubscribers()

ilParticipants::getSubscribers ( )

get all subscribers

@access public

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

1207 {
1208 $this->readSubscribers();
1209
1210 return $this->subscribers;
1211 }

References $subscribers, and readSubscribers().

Referenced by getCountSubscribers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTutors()

ilParticipants::getTutors ( )

Get all tutors ids.

@access public

Returns
array array of user ids

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

549 {
550 return $this->tutors ? $this->tutors : array();
551 }

◆ getType()

ilParticipants::getType ( )

Get object type.

Returns
string obj_type

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

448 {
449 return $this->type;
450 }

References $type.

◆ hasParticipantListAccess()

static ilParticipants::hasParticipantListAccess (   $a_obj_id,
  $a_usr_id = null 
)
static

Check if (current) user has access to the participant list.

Parameters
int$a_obj
int$a_usr_id

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

162 {
163 global $DIC;
164
165 $access = $DIC->access();
166
167 if (!$a_usr_id) {
168 $a_usr_id = $GLOBALS['ilUser']->getId();
169 }
170
171 // if write access granted => return true
172 $refs = ilObject::_getAllReferences($a_obj_id);
173 $ref_id = end($refs);
174
175 if ($access->checkAccess('manage_members', '', $ref_id)) {
176 return true;
177 }
178 $part = self::getInstance($ref_id);
179 if ($part->isAssigned($a_usr_id)) {
180 if ($part->getType() == 'crs') {
182 return false;
183 }
184 }
185 if ($part->getType() == 'grp') {
186 if (!ilObjGroup::lookupShowMembersEnabled($a_obj_id)) {
187 return false;
188 }
189 }
190 return true;
191 }
192 // User is not assigned to course/group => no read access
193 return false;
194 }
static lookupShowMembersEnabled($a_obj_id)
Check if show member is enabled.
static lookupShowMembersEnabled(int $a_obj_id)
static _getAllReferences($a_id)
get all reference ids of object
static getInstance($a_ref_id)
Get instance by ref_id.
global $DIC
Definition: saml.php:7

References $DIC, $GLOBALS, $ref_id, ilObject\_getAllReferences(), getInstance(), ilObjCourse\lookupShowMembersEnabled(), and ilObjGroup\lookupShowMembersEnabled().

Referenced by ilRepositorySearchGUI\listUsers(), ilRepositoryObjectResultTableGUI\parseObjectIds(), and ilMailSearchGUI\showResults().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasPassed()

ilParticipants::hasPassed (   $a_usr_id)

Check if user has passed course.

@access public

Parameters
intuser_id

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

716 {
717 if (isset($this->participants_status[$a_usr_id])) {
718 return $this->participants_status[$a_usr_id]['passed'] ? true : false;
719 }
720 return false;
721 }

Referenced by ilCourseParticipants\__buildStatusBody().

+ Here is the caller graph for this function:

◆ isAdmin()

ilParticipants::isAdmin (   $a_usr_id)

is user admin

@access public

Parameters
intusr_id

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

561 {
562 return in_array($a_usr_id, $this->admins) ? true : false;
563 }

Referenced by ilCourseParticipants\__buildStatusBody(), and getNotificationRecipients().

+ Here is the caller graph for this function:

◆ isAssigned()

ilParticipants::isAssigned (   $a_usr_id)

check if user is assigned

@access public

Parameters

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

600 {
601 return in_array($a_usr_id, $this->participants);
602 }

Referenced by add(), and assignSubscriber().

+ Here is the caller graph for this function:

◆ isBlocked()

ilParticipants::isBlocked (   $a_usr_id)

Check if user is blocked.

@access public

Parameters
intuser_id

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

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

Referenced by ilCourseParticipants\__buildStatusBody().

+ Here is the caller graph for this function:

◆ isContact()

ilParticipants::isContact (   $a_usr_id)

Check if user is contact.

Parameters
intusr_id

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

1009 {
1010 if (isset($this->participants_status[$a_usr_id])) {
1011 return (bool) $this->participants_status[$a_usr_id]['contact'];
1012 }
1013 return false;
1014 }

◆ isGroupingMember()

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

Check grouping membership.

@access public

Parameters

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

1148 {
1149 global $rbacreview,$ilObjDataCache,$ilDB;
1150
1151 // Used for membership limitations -> check membership by given field
1152 if ($a_field) {
1153 include_once './Services/User/classes/class.ilObjUser.php';
1154
1155 $tmp_user =&ilObjectFactory::getInstanceByObjId($a_usr_id);
1156 switch ($a_field) {
1157 case 'login':
1158 $and = "AND login = " . $ilDB->quote($tmp_user->getLogin(), 'text') . " ";
1159 break;
1160 case 'email':
1161 $and = "AND email = " . $ilDB->quote($tmp_user->getEmail(), 'text') . " ";
1162 break;
1163 case 'matriculation':
1164 $and = "AND matriculation = " . $ilDB->quote($tmp_user->getMatriculation(), 'text') . " ";
1165 break;
1166
1167 default:
1168 $and = "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " ";
1169 break;
1170 }
1171
1172 if (!$this->getParticipants()) {
1173 return false;
1174 }
1175
1176 $query = "SELECT * FROM usr_data ud " .
1177 "WHERE " . $ilDB->in('usr_id', $this->getParticipants(), false, 'integer') . " " .
1178 $and;
1179
1180 $res = $ilDB->query($query);
1181 return $res->numRows() ? true : false;
1182 }
1183 }
getParticipants()
Get all participants ids.

References $ilDB, $query, $res, ilObjectFactory\getInstanceByObjId(), and getParticipants().

+ Here is the call graph for this function:

◆ isLastAdmin()

ilParticipants::isLastAdmin (   $a_usr_id)

Check if user is last admin.

Parameters
int$a_usr_id
Returns
bool

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

610 {
611 return in_array($a_usr_id, $this->getAdmins()) and count($this->getAdmins()) == 1;
612 }

References getAdmins().

+ Here is the call graph for this function:

◆ isMember()

ilParticipants::isMember (   $a_usr_id)

is user member

@access public

Parameters
intusr_id

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

585 {
586 return in_array($a_usr_id, $this->members) ? true : false;
587 }

Referenced by ilCourseParticipants\__buildStatusBody().

+ Here is the caller graph for this function:

◆ isNotificationEnabled()

ilParticipants::isNotificationEnabled (   $a_usr_id)

check if notification is enabled

@access public

Parameters

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

996 {
997 if (isset($this->participants_status[$a_usr_id])) {
998 return $this->participants_status[$a_usr_id]['notification'] ? true : false;
999 }
1000 return false;
1001 }

Referenced by ilCourseParticipants\__buildStatusBody().

+ Here is the caller graph for this function:

◆ isSubscriber()

ilParticipants::isSubscriber (   $a_usr_id)

check if is subscriber

@access public

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

1426 {
1427 global $ilDB;
1428
1429 $query = "SELECT * FROM il_subscribers " .
1430 "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1431 "AND obj_id = " . $ilDB->quote($this->obj_id, 'integer') . "";
1432
1433 $res = $ilDB->query($query);
1434 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1435 return true;
1436 }
1437 return false;
1438 }

References $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by assignSubscriber().

+ Here is the caller graph for this function:

◆ isTutor()

ilParticipants::isTutor (   $a_usr_id)

is user tutor

@access public

Parameters
intusr_id

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

573 {
574 return in_array($a_usr_id, $this->tutors) ? true : false;
575 }

Referenced by ilCourseParticipants\__buildStatusBody().

+ Here is the caller graph for this function:

◆ lookupNumberOfMembers()

static ilParticipants::lookupNumberOfMembers (   $a_ref_id)
static

Lookup number of members @global ilRbacReview $rbacreview @global <type> $ilObjDataCache.

Parameters
<type>$a_ref_id
Returns
int

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

289 {
290 global $rbacreview, $ilObjDataCache;
291
292 $has_policies = $rbacreview->getLocalPolicies($a_ref_id);
293
294 if (!$has_policies) {
295 return 0;
296 }
297 $lroles = $rbacreview->getRolesOfRoleFolder($a_ref_id, false);
298
299 $memberRoles = array();
300 foreach ($lroles as $role_id) {
301 $title = $ilObjDataCache->lookupTitle($role_id);
302 switch (substr($title, 0, 8)) {
303 case 'il_crs_a':
304 case 'il_crs_t':
305 case 'il_grp_a':
306 break;
307
308 default:
309 $memberRoles[] = $role_id;
310 break;
311 }
312 }
313 return $rbacreview->getNumberOfAssignedUsers($memberRoles);
314 }

References $title.

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

+ Here is the caller graph for this function:

◆ lookupNumberOfParticipants()

static ilParticipants::lookupNumberOfParticipants (   $a_ref_id)
static

Lookup the number of participants (crs admins, tutors, members, grp admins, members)

@global ilRbacReview $rbacreview

Parameters
int$a_ref_id

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

274 {
275 global $rbacreview;
276
277 $lroles = $rbacreview->getRolesOfRoleFolder($a_ref_id, false);
278 return $rbacreview->getNumberOfAssignedUsers($lroles);
279 }

◆ lookupSubscribers()

static ilParticipants::lookupSubscribers (   $a_obj_id)
static

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

1186 {
1187 global $ilDB;
1188
1189 $subscribers = array();
1190 $query = "SELECT usr_id FROM il_subscribers " .
1191 "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
1192 "ORDER BY sub_time ";
1193
1194 $res = $ilDB->query($query);
1195 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1196 $subscribers[] = $row->usr_id;
1197 }
1198 return $subscribers;
1199 }

References $ilDB, $query, $res, $row, $subscribers, and ilDBConstants\FETCHMODE_OBJECT.

◆ lookupSubscribersData()

static ilParticipants::lookupSubscribersData (   $a_obj_id)
static

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

1510 {
1511 global $ilDB;
1512
1513 $query = 'SELECT * FROM il_subscribers ' .
1514 'WHERE obj_id = ' . $ilDB->quote($a_obj_id, 'integer');
1515 $res = $ilDB->query($query);
1516
1517 $data = array();
1518 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1519 $data[$row->usr_id]['time'] = $row->sub_time;
1520 $data[$row->usr_id]['usr_id'] = $row->usr_id;
1521 $data[$row->usr_id]['subject'] = $row->subject;
1522 }
1523 return $data;
1524 }

References $data, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilSubscriberTableGUI\readSubscriberData().

+ Here is the caller graph for this function:

◆ readParticipants()

ilParticipants::readParticipants ( )
protected

Read participants.

@access private

Parameters

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

1040 {
1041 global $rbacreview,$ilObjDataCache,$ilLog;
1042
1043 $GLOBALS['rbacreview']->clearCaches();
1044 $this->roles = $rbacreview->getRolesOfRoleFolder($this->ref_id, false);
1045
1046 $users = array();
1047 $this->participants = array();
1048 $this->members = $this->admins = $this->tutors = array();
1049
1050 $additional_roles = [];
1051 $auto_generated_roles = [];
1052 foreach ($this->roles as $role_id) {
1053 $title = $ilObjDataCache->lookupTitle($role_id);
1054 switch (substr($title, 0, 8)) {
1055 case 'il_crs_m':
1056 $auto_generated_roles[$role_id] = IL_ROLE_POSITION_MEMBER;
1057 $this->role_data[IL_CRS_MEMBER] = $role_id;
1058 $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1059 $this->members = array_unique(array_merge($assigned, $this->members));
1060 $this->role_assignments[$role_id] = $assigned;
1061 break;
1062
1063 case 'il_crs_a':
1064 $auto_generated_roles[$role_id] = IL_ROLE_POSITION_ADMIN;
1065 $this->role_data[IL_CRS_ADMIN] = $role_id;
1066 $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1067 $this->admins = $rbacreview->assignedUsers($role_id);
1068 $this->role_assignments[$role_id] = $assigned;
1069 break;
1070
1071 case 'il_crs_t':
1072 $auto_generated_roles[$role_id] = IL_ROLE_POSITION_TUTOR;
1073 $this->role_data[IL_CRS_TUTOR] = $role_id;
1074 $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1075 $this->tutors = $rbacreview->assignedUsers($role_id);
1076 $this->role_assignments[$role_id] = $assigned;
1077 break;
1078
1079 case 'il_grp_a':
1080 $auto_generated_roles[$role_id] = IL_ROLE_POSITION_ADMIN;
1081 $this->role_data[IL_GRP_ADMIN] = $role_id;
1082 $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1083 $this->admins = $rbacreview->assignedUsers($role_id);
1084 $this->role_assignments[$role_id] = $assigned;
1085 break;
1086
1087 case 'il_grp_m':
1088 $auto_generated_roles[$role_id] = IL_ROLE_POSITION_MEMBER;
1089 $this->role_data[IL_GRP_MEMBER] = $role_id;
1090 $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1091 $this->members = $rbacreview->assignedUsers($role_id);
1092 $this->role_assignments[$role_id] = $assigned;
1093 break;
1094
1095 case 'il_sess_':
1096 $this->role_data[IL_SESS_MEMBER] = $role_id;
1097 $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1098 $this->members = $rbacreview->assignedUsers($role_id);
1099 break;
1100
1101
1102 default:
1103 $additional_roles[$role_id] = $title;
1104 $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id), $this->participants));
1105 $this->members = array_unique(array_merge($assigned, $this->members));
1106 $this->role_assignments[$role_id] = $assigned;
1107 break;
1108 }
1109 }
1110 asort($auto_generated_roles);
1111 asort($additional_roles);
1112 $this->roles_sorted = $auto_generated_roles + $additional_roles;
1113 }
$users
Definition: authpage.php:44
const IL_ROLE_POSITION_TUTOR
const IL_ROLE_POSITION_ADMIN
const IL_ROLE_POSITION_MEMBER

References $GLOBALS, $ilLog, $title, $users, IL_CRS_ADMIN, IL_CRS_MEMBER, IL_CRS_TUTOR, IL_GRP_ADMIN, IL_GRP_MEMBER, IL_ROLE_POSITION_ADMIN, IL_ROLE_POSITION_MEMBER, IL_ROLE_POSITION_TUTOR, and IL_SESS_MEMBER.

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

+ Here is the caller graph for this function:

◆ readParticipantsStatus()

ilParticipants::readParticipantsStatus ( )
protected

Read status of participants (blocked, notification, passed)

@access private

Parameters

Reimplemented in ilSessionParticipants.

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

1123 {
1124 global $ilDB;
1125
1126 $query = "SELECT * FROM obj_members " .
1127 "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " ";
1128 $res = $ilDB->query($query);
1129 $this->participants_status = array();
1130 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1131 $this->participants_status[$row->usr_id]['blocked'] = $row->blocked;
1132 $this->participants_status[$row->usr_id]['notification'] = $row->notification;
1133 $this->participants_status[$row->usr_id]['passed'] = $row->passed;
1134 // cognos-blu-patch: begin
1135 $this->participants_status[$row->usr_id]['contact'] = $row->contact;
1136 // cognos-blu-patch: end
1137 }
1138 }

References $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

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

+ Here is the caller graph for this function:

◆ readSubscriberData()

ilParticipants::readSubscriberData (   $a_usr_id)
protected

read subscribers

@access protected

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

1493 {
1494 global $ilDB;
1495
1496 $query = "SELECT * FROM il_subscribers " .
1497 "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
1498 "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer') . "";
1499
1500 $res = $this->ilDB->query($query);
1501 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1502 $data["time"] = $row->sub_time;
1503 $data["usr_id"] = $row->usr_id;
1504 $data['subject'] = $row->subject;
1505 }
1506 return $data ? $data : array();
1507 }
query($sql, $a_handle_error=true)
Query.

References $data, $ilDB, $query, $res, $row, ilDBConstants\FETCHMODE_OBJECT, and ilDB\query().

Referenced by getSubscriberData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readSubscribers()

ilParticipants::readSubscribers ( )
protected

read subscribers

@access protected

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

1467 {
1468 global $ilDB;
1469
1470 $this->subscribers = array();
1471
1472 $query = "SELECT usr_id FROM il_subscribers " .
1473 "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
1474 "ORDER BY sub_time ";
1475
1476 $res = $this->ilDB->query($query);
1477 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1478 // DELETE SUBSCRIPTION IF USER HAS BEEN DELETED
1479 if (!ilObjectFactory::getInstanceByObjId($row->usr_id, false)) {
1480 $this->deleteSubscriber($row->usr_id);
1481 }
1482 $this->subscribers[] = $row->usr_id;
1483 }
1484 return true;
1485 }

References $ilDB, $query, $res, $row, deleteSubscriber(), ilDBConstants\FETCHMODE_OBJECT, ilObjectFactory\getInstanceByObjId(), and ilDB\query().

Referenced by autoFillSubscribers(), and getSubscribers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setRoleOrderPosition()

ilParticipants::setRoleOrderPosition (   $a_user_id)

Set role order position.

Parameters
int$a_user_id
Returns
string

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

1578 {
1579 $counter = 0;
1580 $sortable_assignments = '9999999999';
1581 foreach ($this->roles_sorted as $role_id => $trash) {
1582 if (in_array($a_user_id, (array) $this->role_assignments[$role_id])) {
1583 $sortable_assignments = substr_replace($sortable_assignments, '1', $counter, 1);
1584 }
1585 ++$counter;
1586 }
1587 return $sortable_assignments;
1588 }

References $counter.

◆ updateBlocked()

ilParticipants::updateBlocked (   $a_usr_id,
  $a_blocked 
)

Update blocked status.

@access public

Parameters
intusr_id
boolblocked

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

767 {
768 global $ilDB;
769
770 $this->participants_status[$a_usr_id]['blocked'] = (int) $a_blocked;
771
772 $query = "SELECT * FROM obj_members " .
773 "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
774 "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer');
775 $res = $ilDB->query($query);
776 if ($res->numRows()) {
777 $query = "UPDATE obj_members SET " .
778 "blocked = " . $ilDB->quote((int) $a_blocked, 'integer') . " " .
779 "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
780 "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer');
781 } else {
782 $query = "INSERT INTO obj_members (blocked,obj_id,usr_id,notification,passed) " .
783 "VALUES ( " .
784 $ilDB->quote((int) $a_blocked, 'integer') . ", " .
785 $ilDB->quote($this->obj_id, 'integer') . ", " .
786 $ilDB->quote($a_usr_id, 'integer') . ", " .
787 $ilDB->quote(0, 'integer') . ", " .
788 $ilDB->quote(0, 'integer') .
789 ")";
790 }
791 $res = $ilDB->manipulate($query);
792 return true;
793 }

References $ilDB, $query, and $res.

◆ updateContact()

ilParticipants::updateContact (   $a_usr_id,
  $a_contact 
)

Update contact setting @global type $ilDB.

Parameters
type$a_usr_id
type$a_contact
Returns
boolean

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

804 {
805 global $ilDB;
806
807 $ilDB->manipulate(
808 'UPDATE obj_members SET ' .
809 'contact = ' . $ilDB->quote($a_contact, 'integer') . ' ' .
810 'WHERE obj_id = ' . $ilDB->quote($this->obj_id, 'integer') . ' ' .
811 'AND usr_id = ' . $ilDB->quote($a_usr_id, 'integer')
812 );
813
814 $this->participants_status[$a_usr_id]['contact'] = $a_contact;
815 return true;
816 }

References $ilDB.

◆ updateNotification()

ilParticipants::updateNotification (   $a_usr_id,
  $a_notification 
)

Update notification status.

@access public

Parameters
intusr_id
boolpassed

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

845 {
846 global $ilDB;
847
848 $this->participants_status[$a_usr_id]['notification'] = (int) $a_notification;
849
850 $query = "SELECT * FROM obj_members " .
851 "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
852 "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer');
853 $res = $ilDB->query($query);
854 if ($res->numRows()) {
855 $query = "UPDATE obj_members SET " .
856 "notification = " . $ilDB->quote((int) $a_notification, 'integer') . " " .
857 "WHERE obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " " .
858 "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer');
859 } else {
860 $query = "INSERT INTO obj_members (notification,obj_id,usr_id,passed,blocked) " .
861 "VALUES ( " .
862 $ilDB->quote((int) $a_notification, 'integer') . ", " .
863 $ilDB->quote($this->obj_id, 'integer') . ", " .
864 $ilDB->quote($a_usr_id, 'integer') . ", " .
865 $ilDB->quote(0, 'integer') . ", " .
866 $ilDB->quote(0, 'integer') .
867 ")";
868 }
869 $res = $ilDB->manipulate($query);
870 return true;
871 }

References $ilDB, $query, and $res.

◆ updateRoleAssignments()

ilParticipants::updateRoleAssignments (   $a_usr_id,
  $a_roles 
)

Update role assignments.

@access public

Parameters
intusr_id
arrayarray of new roles

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

655 {
656 global $rbacreview,$rbacadmin;
657
658 $roles = $a_roles ? $a_roles : array();
659
660 foreach ($this->getRoles() as $role_id) {
661 if ($rbacreview->isAssigned($a_usr_id, $role_id)) {
662 if (!in_array($role_id, $roles)) {
663 $rbacadmin->deassignUser($role_id, $a_usr_id);
664 }
665 } else {
666 if (in_array($role_id, $roles)) {
667 $rbacadmin->assignUser($role_id, $a_usr_id);
668 }
669 }
670 }
671 $rbacreview->clearCaches();
672 $this->readParticipants();
673 $this->readParticipantsStatus();
674 }
getRoles()
Get course roles.

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

+ Here is the call graph for this function:

◆ updateSubject()

ilParticipants::updateSubject (   $a_usr_id,
  $a_subject 
)

update subject

@access public

Parameters

return

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

1367 {
1368 global $ilDB;
1369
1370 $query = "UPDATE il_subscribers " .
1371 "SET subject = " . $ilDB->quote($a_subject, 'text') . " " .
1372 "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1373 "AND obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " ";
1374 $res = $ilDB->manipulate($query);
1375 return true;
1376 }

References $ilDB, $query, and $res.

◆ updateSubscriptionTime()

ilParticipants::updateSubscriptionTime (   $a_usr_id,
  $a_subtime 
)

Update subscription time.

@access public

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

1347 {
1348 global $ilDB;
1349
1350 $query = "UPDATE il_subscribers " .
1351 "SET sub_time = " . $ilDB->quote($a_subtime, 'integer') . " " .
1352 "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
1353 "AND obj_id = " . $ilDB->quote($this->obj_id, 'integer') . " ";
1354 $res = $ilDB->manipulate($query);
1355
1356 return true;
1357 }

References $ilDB, $query, and $res.

Field Documentation

◆ $admins

ilParticipants::$admins = array()
protected

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

◆ $component

ilParticipants::$component = ''
protected

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

Referenced by getComponent().

◆ $ilDB

◆ $lng

ilParticipants::$lng
protected

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

◆ $logger

ilParticipants::$logger = null
protected

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

◆ $members

ilParticipants::$members = array()
protected

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

◆ $obj_id

ilParticipants::$obj_id = 0
protected

◆ $participants

ilParticipants::$participants = array()
protected

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

◆ $participants_status

ilParticipants::$participants_status = array()
protected

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

◆ $ref_id

ilParticipants::$ref_id = 0
protected

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

Referenced by hasParticipantListAccess().

◆ $role_assignments

ilParticipants::$role_assignments = []
protected

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

◆ $role_data

ilParticipants::$role_data = array()
protected

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

◆ $roles

ilParticipants::$roles = array()
protected

◆ $roles_sorted

ilParticipants::$roles_sorted = []
protected

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

◆ $subscribers

ilParticipants::$subscribers = array()
protected

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

Referenced by getSubscribers(), and lookupSubscribers().

◆ $tutors

ilParticipants::$tutors = array()
protected

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

◆ $type

ilParticipants::$type = ''
protected

The documentation for this class was generated from the following file: