ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilParticipants Class Reference
+ Inheritance diagram for ilParticipants:
+ Collaboration diagram for ilParticipants:

Public Member Functions

 __construct ($a_component_name, $a_obj_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 course. 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 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
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilParticipants::__construct (   $a_component_name,
  $a_obj_id 
)

Singleton Constructor.

@access public

Parameters
intobj_id of container

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

57 {
58 global $ilDB,$lng;
59
60 $this->ilDB = $ilDB;
61 $this->lng = $lng;
62
63 $this->component = $a_component_name;
64
65 $this->obj_id = $a_obj_id;
66 $this->type = ilObject::_lookupType($a_obj_id);
67 $ref_ids = ilObject::_getAllReferences($this->obj_id);
68 $this->ref_id = current($ref_ids);
69
70 $this->readParticipants();
72 }
Database Wrapper.
Definition: class.ilDB.php:30
static _getAllReferences($a_id)
get all reference ids of object
static _lookupType($a_id, $a_reference=false)
lookup object type
readParticipants()
Read participants.
readParticipantsStatus()
Read status of participants (blocked, notification, passed)

References $ilDB, $lng, ilObject\_getAllReferences(), 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 332 of file class.ilParticipants.php.

333 {
334 global $ilDB;
335
336 $query = "DELETE FROM obj_members ".
337 "WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ";
338 $res = $ilDB->manipulate($query);
339
340 $query = "DELETE FROM il_subscribers ".
341 "WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')."";
342 $res = $ilDB->manipulate($query);
343
344 $query = 'DELETE FROM crs_waiting_list '.
345 'WHERE obj_id = '.$ilDB->quote($a_obj_id,'integer');
346 $ilDB->manipulate($query);
347
348 return true;
349 }

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 359 of file class.ilParticipants.php.

360 {
361 global $ilDB;
362
363 $query = "DELETE FROM obj_members WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')."";
364 $res = $ilDB->manipulate($query);
365
366 $query = "DELETE FROM il_subscribers WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')."";
367 $res = $ilDB->manipulate($query);
368
369 include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
371 }
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 1545 of file class.ilParticipants.php.

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

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 165 of file class.ilParticipants.php.

166 {
167 global $ilDB;
168
169 if (!is_array($a_type))
170 {
171 $a_type = array($a_type);
172 }
173
174 // this will also dismiss local roles!
175 if ($a_only_member_role)
176 {
177 $j2 = "JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id) ";
178 $a2 = 'AND obd2.title = '.$ilDB->concat(
179 array(
180 array($ilDB->quote('il_','text')),
181 array('obd.type'),
182 array($ilDB->quote('_member_','text')),
183 array('obr.ref_id'),
184 ),
185 false
186 );
187 }
188
189 // #14290 - no role folder anymore
190 $query = "SELECT DISTINCT obd.obj_id,obr.ref_id FROM rbac_ua ua ".
191 "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id ".
192 "JOIN object_reference obr ON fa.parent = obr.ref_id ".
193 "JOIN object_data obd ON obr.obj_id = obd.obj_id ".
194 $j2.
195 "WHERE ".$ilDB->in("obd.type", $a_type, false, "text").
196 "AND fa.assign = 'y' ".
197 "AND ua.usr_id = ".$ilDB->quote($a_usr_id,'integer')." ".
198 $a2;
199 $res = $ilDB->query($query);
200 while($row = $ilDB->fetchObject($res))
201 {
202 $ref_ids[] = $row->obj_id;
203 }
204
205 return $ref_ids ? $ref_ids : array();
206 }

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

Referenced by ilNewsItem\_getNewsItemsOfUser(), ilPortfolioPageGUI\getCoursesOfUser(), ilAwarenessUserProviderMemberships\getInitialUserSet(), ilCourseVerificationTableGUI\getItems(), ilPDSelectedItemsBlockGUI\getObjectsByMembership(), ilTestEvaluationData\getParticipants(), ilPortfolioAccessHandler\getPossibleSharedTargets(), ilWorkspaceAccessHandler\getPossibleSharedTargets(), ilWorkspaceShareTableGUI\initFilter(), ilCalendarCategories\readPDCalendars(), 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 311 of file class.ilParticipants.php.

312 {
313 global $ilDB;
314
315 $query = "SELECT * FROM obj_members ".
316 "WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ".
317 "AND usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
318 "AND passed = '1'";
319 $res = $ilDB->query($query);
320 return $res->numRows() ? true : false;
321 }

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 290 of file class.ilParticipants.php.

291 {
292 global $ilDB;
293
294 $query = "SELECT * FROM obj_members ".
295 "WHERE obj_id = ".$ilDB->quote($a_obj_id,'integer')." ".
296 "AND usr_id = ".$ilDB->quote($a_usr_id,'integer')." ".
297 "AND blocked = ".$ilDB->quote(1,'integer');
298 $res = $ilDB->query($query);
299 return $res->numRows() ? true : false;
300 }

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 218 of file class.ilParticipants.php.

219 {
220 global $rbacreview,$ilObjDataCache,$ilDB,$ilLog;
221
222 $local_roles = $rbacreview->getRolesOfRoleFolder($a_ref_id,false);
223
224 return $rbacreview->isAssignedToAtLeastOneGivenRole($a_usr_id, $local_roles);
225 }

References $ilDB, and $ilLog.

Referenced by ilForumModeratorsGUI\detachModeratorRole(), ilObjCourseGUI\executeCommand(), ilAwarenessUserProviderMemberships\getInitialUserSet(), ilObjCourseGUI\getTabs(), 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 1453 of file class.ilParticipants.php.

1454 {
1455 global $ilDB;
1456
1457 $query = "SELECT * FROM il_subscribers ".
1458 "WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
1459 "AND obj_id = ".$ilDB->quote($a_obj_id ,'integer')."";
1460
1461 $res = $ilDB->query($query);
1462 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
1463 {
1464 return true;
1465 }
1466 return false;
1467 }

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 course.

@access public

Parameters
intuser id
introle IL_CRS_ADMIN || IL_CRS_TUTOR || IL_CRS_MEMBER

Reimplemented in ilSessionParticipants.

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

876 {
877 global $rbacadmin,$ilLog,$ilAppEventHandler;
878
879 if($this->isAssigned($a_usr_id))
880 {
881 return false;
882 }
883
884 switch($a_role)
885 {
886 case IL_CRS_ADMIN:
887 $this->admins[] = $a_usr_id;
888 break;
889
890 case IL_CRS_TUTOR:
891 $this->tutors[] = $a_usr_id;
892 break;
893
894 case IL_CRS_MEMBER:
895 $this->members[] = $a_usr_id;
896 break;
897
898 case IL_GRP_ADMIN:
899 $this->admins[] = $a_usr_id;
900 break;
901
902 case IL_GRP_MEMBER:
903 $this->members[] = $a_usr_id;
904 break;
905 }
906
907 $this->participants[] = $a_usr_id;
908 $rbacadmin->assignUser($this->role_data[$a_role],$a_usr_id);
909 $this->addDesktopItem($a_usr_id);
910
911 // Delete subscription request
912 $this->deleteSubscriber($a_usr_id);
913
914 include_once './Services/Membership/classes/class.ilWaitingList.php';
915 ilWaitingList::deleteUserEntry($a_usr_id,$this->obj_id);
916
917 $ilLog->write(__METHOD__.': Raise new event: '.$this->getComponent().' addParticipant');
918 $ilAppEventHandler->raise(
919 $this->getComponent(),
920 "addParticipant",
921 array(
922 'obj_id' => $this->obj_id,
923 'usr_id' => $a_usr_id,
924 'role_id' => $a_role)
925 );
926 return true;
927 }
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.
addDesktopItem($a_usr_id)
Add desktop item.
static deleteUserEntry($a_usr_id, $a_obj_id)
Delete one user entry.

References $ilLog, addDesktopItem(), deleteSubscriber(), ilWaitingList\deleteUserEntry(), getComponent(), IL_CRS_ADMIN, IL_CRS_MEMBER, IL_CRS_TUTOR, IL_GRP_ADMIN, IL_GRP_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 953 of file class.ilParticipants.php.

954 {
955 if(!ilObjUser::_isDesktopItem($a_usr_id, $this->ref_id,$this->type))
956 {
957 ilObjUser::_addDesktopItem($a_usr_id, $this->ref_id,$this->type);
958 }
959 return true;
960 }
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 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 1329 of file class.ilParticipants.php.

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

References $ilDB, $query, and $res.

◆ assignSubscriber()

ilParticipants::assignSubscriber (   $a_usr_id)

Assign subscriber.

@access public

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

1259 {
1260 global $ilErr;
1261
1262 $ilErr->setMessage("");
1263 if(!$this->isSubscriber($a_usr_id))
1264 {
1265 $ilErr->appendMessage($this->lng->txt("crs_user_notsubscribed"));
1266
1267 return false;
1268 }
1269 if($this->isAssigned($a_usr_id))
1270 {
1271 $tmp_obj = ilObjectFactory::getInstanceByObjId($a_usr_id);
1272 $ilErr->appendMessage($tmp_obj->getLogin().": ".$this->lng->txt("crs_user_already_assigned"));
1273
1274 return false;
1275 }
1276
1277 if(!$tmp_obj =& ilObjectFactory::getInstanceByObjId($a_usr_id))
1278 {
1279 $ilErr->appendMessage($this->lng->txt("crs_user_not_exists"));
1280
1281 return false;
1282 }
1283
1284 // TODO: must be group or course member role
1285 if($this instanceof ilCourseParticipants)
1286 {
1287 $this->add($tmp_obj->getId(),IL_CRS_MEMBER);
1288 }
1289 if($this instanceof ilGroupParticipants)
1290 {
1291 $this->add($tmp_obj->getId(),IL_GRP_MEMBER);
1292 }
1293 $this->deleteSubscriber($a_usr_id);
1294 return true;
1295 }
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 course.
isSubscriber($a_usr_id)
check if is subscriber
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 1237 of file class.ilParticipants.php.

1238 {
1239 if(!is_array($a_usr_ids) or !count($a_usr_ids))
1240 {
1241 return false;
1242 }
1243 foreach($a_usr_ids as $id)
1244 {
1245 if(!$this->assignSubscriber($id))
1246 {
1247 return false;
1248 }
1249 }
1250 return true;
1251 }
assignSubscriber($a_usr_id)
Assign subscriber.

References assignSubscriber().

+ Here is the call graph for this function:

◆ autoFillSubscribers()

ilParticipants::autoFillSubscribers ( )

Assign subscriber.

@access public

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

1303 {
1304 $this->readSubscribers();
1305
1306 $counter = 0;
1307 foreach($this->subscribers as $subscriber)
1308 {
1309 if(!$this->assignSubscriber($subscriber))
1310 {
1311 continue;
1312 }
1313 else
1314 {
1315 // TODO: notification
1316 #$this->sendNotification($this->NOTIFY_ACCEPT_SUBSCRIBER,$subscriber);
1317 }
1318 ++$counter;
1319 }
1320
1321 return $counter;
1322 }
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

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

661 {
662 foreach($this->getAdmins() as $admin_id)
663 {
664 if(!in_array($admin_id,$a_usr_ids))
665 {
666 return true;
667 }
668 }
669 return false;
670 }
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

Reimplemented in ilSessionParticipants.

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

712 {
713 global $rbacadmin,$ilDB;
714
715 $this->dropDesktopItem($a_usr_id);
716 foreach($this->roles as $role_id)
717 {
718 $rbacadmin->deassignUser($role_id,$a_usr_id);
719 }
720
721 $query = "DELETE FROM obj_members ".
722 "WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
723 "AND obj_id = ".$ilDB->quote($this->obj_id ,'integer');
724 $res = $ilDB->manipulate($query);
725
726 $this->readParticipants();
727 $this->readParticipantsStatus();
728
729 $GLOBALS['ilAppEventHandler']->raise(
730 $this->getComponent(),
731 "deleteParticipant",
732 array(
733 'obj_id' => $this->obj_id,
734 'usr_id' => $a_usr_id)
735 );
736
737 return true;
738 }
dropDesktopItem($a_usr_id)
Drop desktop item.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.

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 937 of file class.ilParticipants.php.

938 {
939 foreach($a_user_ids as $user_id)
940 {
941 $this->delete($user_id);
942 }
943 return true;
944 }

◆ deleteSubscriber()

ilParticipants::deleteSubscriber (   $a_usr_id)

Delete subsciber.

@access public

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

1390 {
1391 global $ilDB;
1392
1393 $query = "DELETE FROM il_subscribers ".
1394 "WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
1395 "AND obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ";
1396 $res = $ilDB->manipulate($query);
1397
1398 return true;
1399 }

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 1407 of file class.ilParticipants.php.

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

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

◆ dropDesktopItem()

ilParticipants::dropDesktopItem (   $a_usr_id)

Drop desktop item.

@access public

Parameters
intusr_id

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

970 {
971 if(ilObjUser::_isDesktopItem($a_usr_id, $this->ref_id,$this->type))
972 {
973 ilObjUser::_dropDesktopItem($a_usr_id, $this->ref_id,$this->type);
974 }
975
976 return true;
977 }
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 496 of file class.ilParticipants.php.

497 {
498 return $this->admins ? $this->admins : array();
499 }

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 603 of file class.ilParticipants.php.

604 {
605 global $rbacreview;
606
607 foreach($this->roles as $role)
608 {
609 if($rbacreview->isAssigned($a_usr_id,$role))
610 {
611 $assigned[] = $role;
612 }
613 }
614 return $assigned ? $assigned : array();
615 }

◆ getAutoGeneratedRoleId()

ilParticipants::getAutoGeneratedRoleId (   $a_role_type)

Get role id of auto generated role type.

Parameters
type$a_role_type

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

1018 {
1019 if(array_key_exists($a_role_type, $this->role_data))
1020 {
1021 return $this->role_data[$a_role_type];
1022 }
1023
1024 return 0;
1025 }

◆ getComponent()

ilParticipants::getComponent ( )
protected

Get component name Used for raising events.

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

110 {
111 return $this->component;
112 }

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 807 of file class.ilParticipants.php.

808 {
809 $contacts = array();
810 foreach((array) $this->participants_status as $usr_id => $status)
811 {
812 if($status['contact'])
813 {
814 $contacts[] = $usr_id;
815 }
816 }
817 return $contacts;
818 }

◆ getCountAdmins()

ilParticipants::getCountAdmins ( )

Get number of admins.

Returns

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

506 {
507 return count($this->getAdmins());
508 }

References getAdmins().

+ Here is the call graph for this function:

◆ getCountMembers()

ilParticipants::getCountMembers ( )

Get number of members (not participants)

@access public

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

450 {
451 return count($this->members);
452 }

◆ getCountParticipants()

ilParticipants::getCountParticipants ( )

Get number of participants.

@access public

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

461 {
462 return count($this->participants);
463 }

◆ getCountSubscribers()

ilParticipants::getCountSubscribers ( )

get number of subscribers

@access public

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

1216 {
1217 return count($this->getSubscribers());
1218 }
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 373 of file class.ilParticipants.php.

374 {
375 global $ilCtrl;
376
377 $obj_id = ilObject::_lookupObjId($a_ref_id);
379
380 if(!in_array($type,array('crs','grp')))
381 {
382 return 0;
383 }
384
385 global $rbacreview;
386
387
388 $roles = $rbacreview->getRolesOfRoleFolder($a_ref_id,false);
389
390 foreach($roles as $role)
391 {
393 if(substr($title, 0, 13) == ('il_'.$type.'_member'))
394 {
395 return $role;
396 }
397 }
398 return 0;
399 }
static _lookupObjId($a_id)
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:

◆ getInstanceByObjId()

static ilParticipants::getInstanceByObjId (   $a_obj_id)
static

Get instance by obj type.

Parameters
int$a_obj_id
Returns
ilParticipants
Exceptions
InvalidArgumentException

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

82 {
83 $type = ilObject::_lookupType($a_obj_id);
84 switch($type)
85 {
86 case 'crs':
87 include_once './Modules/Course/classes/class.ilCourseParticipants.php';
89
90 case 'grp':
91 include_once './Modules/Group/classes/class.ilGroupParticipants.php';
93
94 case 'sess':
95 include_once './Modules/Session/classes/class.ilSessionParticipants.php';
97
98 default:
99 $GLOBALS['ilLog']->logStack();
100 $GLOBALS['ilLog']->write(__METHOD__.': Invalid obj_id given: '.$a_obj_id);
101 throw new InvalidArgumentException('Invalid obj id given');
102 }
103 }
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.

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

Referenced by ilCourseParticipantsTableGUI\__construct(), ilGroupParticipantsTableGUI\__construct(), ilObjSessionAccess\_checkAccess(), ilObjSessionGUI\assignSubscribersObject(), ilPortfolioAccessHandler\findSharedObjects(), ilWorkspaceAccessHandler\findSharedObjects(), ilLPStatusManualByTutor\getMembers(), ilMembershipGUI\getMembersObject(), ilECSAppEventListener\handleMembership(), hasParticipantListAccess(), ilObjCourseGUI\infoScreen(), ilRepositorySearchGUI\listUsers(), ilMembershipGUI\membersMap(), ilObjSessionGUI\membersObject(), ilRepositoryObjectResultTableGUI\parseObjectIds(), ilObjSessionGUI\refuseSubscribersObject(), ilObjSessionGUI\registerObject(), ilObjSessionGUI\showJoinRequestButton(), and ilObjSessionGUI\unregisterObject().

+ 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 486 of file class.ilParticipants.php.

487 {
488 return $this->members ? $this->members : array();
489 }

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 425 of file class.ilParticipants.php.

426 {
427 global $ilDB;
428
429 $query = "SELECT * FROM obj_members ".
430 "WHERE notification = 1 ".
431 "AND obj_id = ".$ilDB->quote($this->obj_id)." ";
432 $res = $ilDB->query($query);
433 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
434 {
435 if($this->isAdmin($row->usr_id) or $this->isTutor($row->usr_id))
436 {
437 $recp[] = $row->usr_id;
438 }
439 }
440 return $recp ? $recp : array();
441 }
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 405 of file class.ilParticipants.php.

406 {
407 return $this->obj_id;
408 }

References $obj_id.

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

+ 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 474 of file class.ilParticipants.php.

475 {
476 return $this->participants ? $this->participants : array();
477 }

Referenced by isGroupingMember().

+ Here is the caller graph for this function:

◆ getRoles()

ilParticipants::getRoles ( )

Get course roles.

@access public

Parameters

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

592 {
593 return $this->roles ? $this->roles : array();
594 }

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 1225 of file class.ilParticipants.php.

1226 {
1227 return $this->readSubscriberData($a_usr_id);
1228 }
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 1202 of file class.ilParticipants.php.

1203 {
1204 $this->readSubscribers();
1205
1206 return $this->subscribers;
1207 }

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 517 of file class.ilParticipants.php.

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

◆ getType()

ilParticipants::getType ( )

Get object type.

Returns
string obj_type

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

415 {
416 return $this->type;
417 }

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
type$a_obj
type$a_usr_id

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

122 {
123 if(!$a_usr_id)
124 {
125 $a_usr_id = $GLOBALS['ilUser']->getId();
126 }
127
128 // if write access granted => return true
129 $refs = ilObject::_getAllReferences($a_obj_id);
130 $ref_id = end($refs);
131
132 if($GLOBALS['ilAccess']->checkAccess('write','',$ref_id))
133 {
134 return true;
135 }
136 $part = self::getInstanceByObjId($a_obj_id);
137 if($part->isAssigned($a_usr_id))
138 {
139 if($part->getType() == 'crs')
140 {
141 // Check for show_members
142 include_once './Modules/Course/classes/class.ilObjCourse.php';
144 {
145 return false;
146 }
147 }
148 return true;
149 }
150 // User is not assigned to course/group => no read access
151 return false;
152 }
static lookupShowMembersEnabled($a_obj_id)
Check if show member is enabled.
static getInstanceByObjId($a_obj_id)
Get instance by obj type.

References $GLOBALS, $ref_id, ilObject\_getAllReferences(), getInstanceByObjId(), and ilObjCourse\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 695 of file class.ilParticipants.php.

696 {
697 if(isset($this->participants_status[$a_usr_id]))
698 {
699 return $this->participants_status[$a_usr_id]['passed'] ? true : false;
700 }
701 return false;
702 }

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 529 of file class.ilParticipants.php.

530 {
531 return in_array($a_usr_id,$this->admins) ? true : false;
532 }

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 568 of file class.ilParticipants.php.

569 {
570 return in_array($a_usr_id,$this->participants);
571 }

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 679 of file class.ilParticipants.php.

680 {
681 if(isset($this->participants_status[$a_usr_id]))
682 {
683 return $this->participants_status[$a_usr_id]['blocked'] ? true : false;
684 }
685 return false;
686 }

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 1002 of file class.ilParticipants.php.

1003 {
1004 if(isset($this->participants_status[$a_usr_id]))
1005 {
1006 return (bool) $this->participants_status[$a_usr_id]['contact'];
1007 }
1008 return FALSE;
1009 }

◆ isGroupingMember()

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

Check grouping membership.

@access public

Parameters

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

1140 {
1141 global $rbacreview,$ilObjDataCache,$ilDB;
1142
1143 // Used for membership limitations -> check membership by given field
1144 if($a_field)
1145 {
1146 include_once './Services/User/classes/class.ilObjUser.php';
1147
1148 $tmp_user =& ilObjectFactory::getInstanceByObjId($a_usr_id);
1149 switch($a_field)
1150 {
1151 case 'login':
1152 $and = "AND login = ".$ilDB->quote($tmp_user->getLogin(),'text')." ";
1153 break;
1154 case 'email':
1155 $and = "AND email = ".$ilDB->quote($tmp_user->getEmail(),'text')." ";
1156 break;
1157 case 'matriculation':
1158 $and = "AND matriculation = ".$ilDB->quote($tmp_user->getMatriculation(),'text')." ";
1159 break;
1160
1161 default:
1162 $and = "AND usr_id = ".$ilDB->quote($a_usr_id,'integer'). " ";
1163 break;
1164 }
1165
1166 if(!$this->getParticipants())
1167 {
1168 return false;
1169 }
1170
1171 $query = "SELECT * FROM usr_data ud ".
1172 "WHERE ".$ilDB->in('usr_id',$this->getParticipants(),false,'integer')." ".
1173 $and;
1174
1175 $res = $ilDB->query($query);
1176 return $res->numRows() ? true : false;
1177 }
1178 }
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 578 of file class.ilParticipants.php.

579 {
580 return in_array($a_usr_id,$this->getAdmins()) and count($this->getAdmins()) == 1;
581 }

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 553 of file class.ilParticipants.php.

554 {
555 return in_array($a_usr_id,$this->members) ? true : false;
556 }

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 988 of file class.ilParticipants.php.

989 {
990 if(isset($this->participants_status[$a_usr_id]))
991 {
992 return $this->participants_status[$a_usr_id]['notification'] ? true : false;
993 }
994 return false;
995 }

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 1431 of file class.ilParticipants.php.

1432 {
1433 global $ilDB;
1434
1435 $query = "SELECT * FROM il_subscribers ".
1436 "WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
1437 "AND obj_id = ".$ilDB->quote($this->obj_id ,'integer')."";
1438
1439 $res = $ilDB->query($query);
1440 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
1441 {
1442 return true;
1443 }
1444 return false;
1445 }

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 541 of file class.ilParticipants.php.

542 {
543 return in_array($a_usr_id,$this->tutors) ? true : false;
544 }

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 249 of file class.ilParticipants.php.

250 {
251 global $rbacreview, $ilObjDataCache;
252
253 $has_policies = $rbacreview->getLocalPolicies($a_ref_id);
254
255 if(!$has_policies)
256 {
257 return 0;
258 }
259 $lroles = $rbacreview->getRolesOfRoleFolder($a_ref_id,false);
260
261 $memberRoles = array();
262 foreach($lroles as $role_id)
263 {
264 $title = $ilObjDataCache->lookupTitle($role_id);
265 switch(substr($title,0,8))
266 {
267 case 'il_crs_a':
268 case 'il_crs_t':
269 case 'il_grp_a':
270 break;
271
272 default:
273 $memberRoles[] = $role_id;
274 break;
275 }
276 }
277 return $rbacreview->getNumberOfAssignedUsers($memberRoles);
278 }

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 234 of file class.ilParticipants.php.

235 {
236 global $rbacreview;
237
238 $lroles = $rbacreview->getRolesOfRoleFolder($a_ref_id,false);
239 return $rbacreview->getNumberOfAssignedUsers($lroles);
240 }

◆ lookupSubscribers()

static ilParticipants::lookupSubscribers (   $a_obj_id)
static

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

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

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

◆ lookupSubscribersData()

static ilParticipants::lookupSubscribersData (   $a_obj_id)
static

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

1521 {
1522 global $ilDB;
1523
1524 $query = 'SELECT * FROM il_subscribers '.
1525 'WHERE obj_id = '.$ilDB->quote($a_obj_id,'integer');
1526 $res = $ilDB->query($query);
1527
1528 $data = array();
1529 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
1530 {
1531 $data[$row->usr_id]['time'] = $row->sub_time;
1532 $data[$row->usr_id]['usr_id'] = $row->usr_id;
1533 $data[$row->usr_id]['subject'] = $row->subject;
1534 }
1535 return $data;
1536 }

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

Reimplemented in ilSessionParticipants.

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

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

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

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 1113 of file class.ilParticipants.php.

1114 {
1115 global $ilDB;
1116
1117 $query = "SELECT * FROM obj_members ".
1118 "WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ";
1119 $res = $ilDB->query($query);
1120 $this->participants_status = array();
1121 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
1122 {
1123 $this->participants_status[$row->usr_id]['blocked'] = $row->blocked;
1124 $this->participants_status[$row->usr_id]['notification'] = $row->notification;
1125 $this->participants_status[$row->usr_id]['passed'] = $row->passed;
1126 // cognos-blu-patch: begin
1127 $this->participants_status[$row->usr_id]['contact'] = $row->contact;
1128 // cognos-blu-patch: end
1129 }
1130 }

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 1502 of file class.ilParticipants.php.

1503 {
1504 global $ilDB;
1505
1506 $query = "SELECT * FROM il_subscribers ".
1507 "WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ".
1508 "AND usr_id = ".$ilDB->quote($a_usr_id ,'integer')."";
1509
1510 $res = $this->ilDB->query($query);
1511 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
1512 {
1513 $data["time"] = $row->sub_time;
1514 $data["usr_id"] = $row->usr_id;
1515 $data['subject'] = $row->subject;
1516 }
1517 return $data ? $data : array();
1518 }
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 1474 of file class.ilParticipants.php.

1475 {
1476 global $ilDB;
1477
1478 $this->subscribers = array();
1479
1480 $query = "SELECT usr_id FROM il_subscribers ".
1481 "WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ".
1482 "ORDER BY sub_time ";
1483
1484 $res = $this->ilDB->query($query);
1485 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
1486 {
1487 // DELETE SUBSCRIPTION IF USER HAS BEEN DELETED
1488 if(!ilObjectFactory::getInstanceByObjId($row->usr_id,false))
1489 {
1490 $this->deleteSubscriber($row->usr_id);
1491 }
1492 $this->subscribers[] = $row->usr_id;
1493 }
1494 return true;
1495 }

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 1591 of file class.ilParticipants.php.

1592 {
1593 $counter = 0;
1594 $sortable_assignments = '9999999999';
1595 foreach($this->roles_sorted as $role_id => $trash)
1596 {
1597 if(in_array($a_user_id,(array) $this->role_assignments[$role_id]))
1598 {
1599 $sortable_assignments = substr_replace($sortable_assignments,'1',$counter,1);
1600 }
1601 ++$counter;
1602 }
1603 return $sortable_assignments;
1604 }

References $counter.

◆ updateBlocked()

ilParticipants::updateBlocked (   $a_usr_id,
  $a_blocked 
)

Update blocked status.

@access public

Parameters
intusr_id
boolblocked

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

749 {
750 global $ilDB;
751
752 $this->participants_status[$a_usr_id]['blocked'] = (int) $a_blocked;
753
754 $query = "SELECT * FROM obj_members ".
755 "WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ".
756 "AND usr_id = ".$ilDB->quote($a_usr_id ,'integer');
757 $res = $ilDB->query($query);
758 if($res->numRows())
759 {
760 $query = "UPDATE obj_members SET ".
761 "blocked = ".$ilDB->quote((int) $a_blocked ,'integer')." ".
762 "WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ".
763 "AND usr_id = ".$ilDB->quote($a_usr_id ,'integer');
764 }
765 else
766 {
767 $query = "INSERT INTO obj_members (blocked,obj_id,usr_id,notification,passed) ".
768 "VALUES ( ".
769 $ilDB->quote((int) $a_blocked ,'integer').", ".
770 $ilDB->quote($this->obj_id ,'integer').", ".
771 $ilDB->quote($a_usr_id ,'integer').", ".
772 $ilDB->quote(0,'integer').", ".
773 $ilDB->quote(0,'integer').
774 ")";
775
776 }
777 $res = $ilDB->manipulate($query);
778 return true;
779 }

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 789 of file class.ilParticipants.php.

790 {
791 global $ilDB;
792
793 $ilDB->manipulate(
794 'UPDATE obj_members SET '.
795 'contact = '.$ilDB->quote($a_contact,'integer').' '.
796 'WHERE obj_id = '.$ilDB->quote($this->obj_id,'integer').' '.
797 'AND usr_id = '.$ilDB->quote($a_usr_id,'integer'));
798
799 $this->participants_status[$a_usr_id]['contact'] = $a_contact;
800 return TRUE;
801 }

References $ilDB.

◆ updateNotification()

ilParticipants::updateNotification (   $a_usr_id,
  $a_notification 
)

Update notification status.

@access public

Parameters
intusr_id
boolpassed

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

832 {
833 global $ilDB;
834
835 $this->participants_status[$a_usr_id]['notification'] = (int) $a_notification;
836
837 $query = "SELECT * FROM obj_members ".
838 "WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ".
839 "AND usr_id = ".$ilDB->quote($a_usr_id ,'integer');
840 $res = $ilDB->query($query);
841 if($res->numRows())
842 {
843 $query = "UPDATE obj_members SET ".
844 "notification = ".$ilDB->quote((int) $a_notification ,'integer')." ".
845 "WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ".
846 "AND usr_id = ".$ilDB->quote($a_usr_id ,'integer');
847 }
848 else
849 {
850 $query = "INSERT INTO obj_members (notification,obj_id,usr_id,passed,blocked) ".
851 "VALUES ( ".
852 $ilDB->quote((int) $a_notification ,'integer').", ".
853 $ilDB->quote($this->obj_id ,'integer').", ".
854 $ilDB->quote($a_usr_id ,'integer').", ".
855 $ilDB->quote(0,'integer').", ".
856 $ilDB->quote(0,'integer').
857 ")";
858
859 }
860 $res = $ilDB->manipulate($query);
861 return true;
862 }

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 625 of file class.ilParticipants.php.

626 {
627 global $rbacreview,$rbacadmin;
628
629 $roles = $a_roles ? $a_roles : array();
630
631 foreach($this->getRoles() as $role_id)
632 {
633 if($rbacreview->isAssigned($a_usr_id,$role_id))
634 {
635 if(!in_array($role_id,$roles))
636 {
637 $rbacadmin->deassignUser($role_id,$a_usr_id);
638 }
639 }
640 else
641 {
642 if(in_array($role_id,$roles))
643 {
644 $rbacadmin->assignUser($role_id,$a_usr_id);
645 }
646 }
647 }
648 $rbacreview->clearCaches();
649 $this->readParticipants();
650 $this->readParticipantsStatus();
651 }
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 1371 of file class.ilParticipants.php.

1372 {
1373 global $ilDB;
1374
1375 $query = "UPDATE il_subscribers ".
1376 "SET subject = ".$ilDB->quote($a_subject ,'text')." ".
1377 "WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
1378 "AND obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ";
1379 $res = $ilDB->manipulate($query);
1380 return true;
1381 }

References $ilDB, $query, and $res.

◆ updateSubscriptionTime()

ilParticipants::updateSubscriptionTime (   $a_usr_id,
  $a_subtime 
)

Update subscription time.

@access public

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

1352 {
1353 global $ilDB;
1354
1355 $query = "UPDATE il_subscribers ".
1356 "SET sub_time = ".$ilDB->quote($a_subtime ,'integer')." ".
1357 "WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
1358 "AND obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ";
1359 $res = $ilDB->manipulate($query);
1360
1361 return true;
1362 }

References $ilDB, $query, and $res.

Field Documentation

◆ $admins

ilParticipants::$admins = array()
protected

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

◆ $component

ilParticipants::$component = ''
protected

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

Referenced by getComponent().

◆ $ilDB

◆ $lng

ilParticipants::$lng
protected

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

Referenced by __construct().

◆ $members

ilParticipants::$members = array()
protected

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

◆ $obj_id

ilParticipants::$obj_id = 0
protected

◆ $participants

ilParticipants::$participants = array()
protected

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

◆ $participants_status

ilParticipants::$participants_status = array()
protected

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

◆ $ref_id

ilParticipants::$ref_id = 0
protected

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

Referenced by hasParticipantListAccess().

◆ $role_assignments

ilParticipants::$role_assignments = []
protected

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

◆ $role_data

ilParticipants::$role_data = array()
protected

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

◆ $roles

ilParticipants::$roles = array()
protected

◆ $roles_sorted

ilParticipants::$roles_sorted = []
protected

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

◆ $subscribers

ilParticipants::$subscribers = array()
protected

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

Referenced by getSubscribers(), and lookupSubscribers().

◆ $tutors

ilParticipants::$tutors = array()
protected

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

◆ $type

ilParticipants::$type = ''
protected

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

Referenced by getDefaultMemberRole(), getInstanceByObjId(), and getType().


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