ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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...
 
 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...
 

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()
 
 $participants = array()
 
 $participants_status = array()
 
 $members = array()
 
 $tutors = array()
 
 $admins = array()
 
 $subscribers = array()
 
 $ilDB
 
 $lng
 

Detailed Description

Definition at line 20 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 50 of file class.ilParticipants.php.

51 {
52 global $ilDB,$lng;
53
54 $this->ilDB = $ilDB;
55 $this->lng = $lng;
56
57 $this->component = $a_component_name;
58
59 $this->obj_id = $a_obj_id;
60 $this->type = ilObject::_lookupType($a_obj_id);
61 $ref_ids = ilObject::_getAllReferences($this->obj_id);
62 $this->ref_id = current($ref_ids);
63
64 $this->readParticipants();
66 }
Database Wrapper.
Definition: class.ilDB.php:29
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 326 of file class.ilParticipants.php.

327 {
328 global $ilDB;
329
330 $query = "DELETE FROM obj_members ".
331 "WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ";
332 $res = $ilDB->manipulate($query);
333
334 $query = "DELETE FROM il_subscribers ".
335 "WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')."";
336 $res = $ilDB->manipulate($query);
337
338 $query = 'DELETE FROM crs_waiting_list '.
339 'WHERE obj_id = '.$ilDB->quote($a_obj_id,'integer');
340 $ilDB->manipulate($query);
341
342 return true;
343 }

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

354 {
355 global $ilDB;
356
357 $query = "DELETE FROM obj_members WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')."";
358 $res = $ilDB->manipulate($query);
359
360 $query = "DELETE FROM il_subscribers WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')."";
361 $res = $ilDB->manipulate($query);
362
363 include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
365 }
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 1502 of file class.ilParticipants.php.

1503 {
1504 global $ilDB;
1505
1506 // todo: join the two queries or alternatively reuse _getMembershipByType
1507 // for the first part
1508
1509 // this will also dismiss local roles!
1510 $j2 = "JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id) ";
1511 $a2 = "AND obd2.title LIKE 'il_".$a_type."_mem%' ";
1512
1513 // #14290 - no role folder anymore
1514 $query = "SELECT DISTINCT obd.obj_id,obr.ref_id FROM rbac_ua ua ".
1515 "JOIN rbac_fa fa ON ua.rol_id = fa.rol_id ".
1516 "JOIN object_reference obr ON fa.parent = obr.ref_id ".
1517 "JOIN object_data obd ON obr.obj_id = obd.obj_id ".
1518 $j2.
1519 "WHERE obd.type = ".$ilDB->quote($a_type,'text')." ".
1520 "AND fa.assign = 'y' ".
1521 "AND ua.usr_id = ".$ilDB->quote($a_usr_id,'integer')." ".
1522 $a2;
1523
1524 $res = $ilDB->query($query);
1525 $obj_ids = array();
1526 while($row = $ilDB->fetchObject($res))
1527 {
1528 $obj_ids[] = $row->obj_id;
1529 }
1530
1531 $set = $ilDB->query("SELECT obj_id, usr_id FROM obj_members ".
1532 " WHERE ".$ilDB->in("obj_id", $obj_ids, false, "integer").
1533 " AND contact = ".$ilDB->quote(1, "integer"));
1534 $res = array();
1535 while ($rec = $ilDB->fetchAssoc($set))
1536 {
1537 $res[] = $rec;
1538 }
1539
1540 return $res;
1541 }

References $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 159 of file class.ilParticipants.php.

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

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

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

306 {
307 global $ilDB;
308
309 $query = "SELECT * FROM obj_members ".
310 "WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ".
311 "AND usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
312 "AND passed = '1'";
313 $res = $ilDB->query($query);
314 return $res->numRows() ? true : false;
315 }

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

285 {
286 global $ilDB;
287
288 $query = "SELECT * FROM obj_members ".
289 "WHERE obj_id = ".$ilDB->quote($a_obj_id,'integer')." ".
290 "AND usr_id = ".$ilDB->quote($a_usr_id,'integer')." ".
291 "AND blocked = ".$ilDB->quote(1,'integer');
292 $res = $ilDB->query($query);
293 return $res->numRows() ? true : false;
294 }

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

213 {
214 global $rbacreview,$ilObjDataCache,$ilDB,$ilLog;
215
216 $local_roles = $rbacreview->getRolesOfRoleFolder($a_ref_id,false);
217
218 return $rbacreview->isAssignedToAtLeastOneGivenRole($a_usr_id, $local_roles);
219 }

References $ilDB, and $ilLog.

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

1411 {
1412 global $ilDB;
1413
1414 $query = "SELECT * FROM il_subscribers ".
1415 "WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
1416 "AND obj_id = ".$ilDB->quote($a_obj_id ,'integer')."";
1417
1418 $res = $ilDB->query($query);
1419 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
1420 {
1421 return true;
1422 }
1423 return false;
1424 }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11

References $ilDB, $query, $res, $row, and DB_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

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

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

948 {
949 if(!ilObjUser::_isDesktopItem($a_usr_id, $this->ref_id,$this->type))
950 {
951 ilObjUser::_addDesktopItem($a_usr_id, $this->ref_id,$this->type);
952 }
953 return true;
954 }
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 1286 of file class.ilParticipants.php.

1287 {
1288 global $ilDB;
1289
1290 $query = "INSERT INTO il_subscribers (usr_id,obj_id,subject,sub_time) ".
1291 " VALUES (".
1292 $ilDB->quote($a_usr_id ,'integer').",".
1293 $ilDB->quote($this->obj_id ,'integer').", ".
1294 $ilDB->quote('','text').", ".
1295 $ilDB->quote(time() ,'integer').
1296 ")";
1297 $res = $ilDB->manipulate($query);
1298
1299 return true;
1300 }

References $ilDB, $query, and $res.

◆ assignSubscriber()

ilParticipants::assignSubscriber (   $a_usr_id)

Assign subscriber.

@access public

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

1222 {
1223 global $ilErr;
1224
1225 $ilErr->setMessage("");
1226 if(!$this->isSubscriber($a_usr_id))
1227 {
1228 $ilErr->appendMessage($this->lng->txt("crs_user_notsubscribed"));
1229
1230 return false;
1231 }
1232 if($this->isAssigned($a_usr_id))
1233 {
1234 $tmp_obj = ilObjectFactory::getInstanceByObjId($a_usr_id);
1235 $ilErr->appendMessage($tmp_obj->getLogin().": ".$this->lng->txt("crs_user_already_assigned"));
1236
1237 return false;
1238 }
1239
1240 if(!$tmp_obj =& ilObjectFactory::getInstanceByObjId($a_usr_id))
1241 {
1242 $ilErr->appendMessage($this->lng->txt("crs_user_not_exists"));
1243
1244 return false;
1245 }
1246
1247 // TODO: must be group or course member role
1248 $this->add($tmp_obj->getId(),IL_CRS_MEMBER);
1249 $this->deleteSubscriber($a_usr_id);
1250
1251 return true;
1252 }
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

References $ilErr, add(), deleteSubscriber(), ilObjectFactory\getInstanceByObjId(), IL_CRS_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 1200 of file class.ilParticipants.php.

1201 {
1202 if(!is_array($a_usr_ids) or !count($a_usr_ids))
1203 {
1204 return false;
1205 }
1206 foreach($a_usr_ids as $id)
1207 {
1208 if(!$this->assignSubscriber($id))
1209 {
1210 return false;
1211 }
1212 }
1213 return true;
1214 }
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 1259 of file class.ilParticipants.php.

1260 {
1261 $this->readSubscribers();
1262
1263 $counter = 0;
1264 foreach($this->subscribers as $subscriber)
1265 {
1266 if(!$this->assignSubscriber($subscriber))
1267 {
1268 continue;
1269 }
1270 else
1271 {
1272 // TODO: notification
1273 #$this->sendNotification($this->NOTIFY_ACCEPT_SUBSCRIBER,$subscriber);
1274 }
1275 ++$counter;
1276 }
1277
1278 return $counter;
1279 }
readSubscribers()
read subscribers

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

655 {
656 foreach($this->getAdmins() as $admin_id)
657 {
658 if(!in_array($admin_id,$a_usr_ids))
659 {
660 return true;
661 }
662 }
663 return false;
664 }
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 705 of file class.ilParticipants.php.

706 {
707 global $rbacadmin,$ilDB;
708
709 $this->dropDesktopItem($a_usr_id);
710 foreach($this->roles as $role_id)
711 {
712 $rbacadmin->deassignUser($role_id,$a_usr_id);
713 }
714
715 $query = "DELETE FROM obj_members ".
716 "WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
717 "AND obj_id = ".$ilDB->quote($this->obj_id ,'integer');
718 $res = $ilDB->manipulate($query);
719
720 $this->readParticipants();
721 $this->readParticipantsStatus();
722
723 $GLOBALS['ilAppEventHandler']->raise(
724 $this->getComponent(),
725 "deleteParticipant",
726 array(
727 'obj_id' => $this->obj_id,
728 'usr_id' => $a_usr_id)
729 );
730
731 return true;
732 }
dropDesktopItem($a_usr_id)
Drop desktop item.
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276

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

932 {
933 foreach($a_user_ids as $user_id)
934 {
935 $this->delete($user_id);
936 }
937 return true;
938 }

◆ deleteSubscriber()

ilParticipants::deleteSubscriber (   $a_usr_id)

Delete subsciber.

@access public

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

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

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

1365 {
1366 global $ilErr,$ilDB;
1367
1368 if(!is_array($a_usr_ids) or !count($a_usr_ids))
1369 {
1370 $ilErr->setMessage('');
1371 $ilErr->appendMessage($this->lng->txt("no_usr_ids_given"));
1372
1373 return false;
1374 }
1375 $query = "DELETE FROM il_subscribers ".
1376 "WHERE ".$ilDB->in('usr_id',(array) $a_usr_ids,false,'integer')." ".
1377 "AND obj_id = ".$ilDB->quote($this->obj_id,'integer');
1378 $res = $ilDB->query($query);
1379 return true;
1380 }

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

◆ dropDesktopItem()

ilParticipants::dropDesktopItem (   $a_usr_id)

Drop desktop item.

@access public

Parameters
intusr_id

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

964 {
965 if(ilObjUser::_isDesktopItem($a_usr_id, $this->ref_id,$this->type))
966 {
967 ilObjUser::_dropDesktopItem($a_usr_id, $this->ref_id,$this->type);
968 }
969
970 return true;
971 }
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 490 of file class.ilParticipants.php.

491 {
492 return $this->admins ? $this->admins : array();
493 }

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

598 {
599 global $rbacreview;
600
601 foreach($this->roles as $role)
602 {
603 if($rbacreview->isAssigned($a_usr_id,$role))
604 {
605 $assigned[] = $role;
606 }
607 }
608 return $assigned ? $assigned : array();
609 }

◆ getComponent()

ilParticipants::getComponent ( )
protected

Get component name Used for raising events.

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

104 {
105 return $this->component;
106 }

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

802 {
803 $contacts = array();
804 foreach((array) $this->participants_status as $usr_id => $status)
805 {
806 if($status['contact'])
807 {
808 $contacts[] = $usr_id;
809 }
810 }
811 return $contacts;
812 }

◆ getCountAdmins()

ilParticipants::getCountAdmins ( )

Get number of admins.

Returns

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

500 {
501 return count($this->getAdmins());
502 }

References getAdmins().

+ Here is the call graph for this function:

◆ getCountMembers()

ilParticipants::getCountMembers ( )

Get number of members (not participants)

@access public

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

444 {
445 return count($this->members);
446 }

◆ getCountParticipants()

ilParticipants::getCountParticipants ( )

Get number of participants.

@access public

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

455 {
456 return count($this->participants);
457 }

◆ getCountSubscribers()

ilParticipants::getCountSubscribers ( )

get number of subscribers

@access public

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

1179 {
1180 return count($this->getSubscribers());
1181 }
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 367 of file class.ilParticipants.php.

368 {
369 global $ilCtrl;
370
371 $obj_id = ilObject::_lookupObjId($a_ref_id);
373
374 if(!in_array($type,array('crs','grp')))
375 {
376 return 0;
377 }
378
379 global $rbacreview;
380
381
382 $roles = $rbacreview->getRolesOfRoleFolder($a_ref_id,false);
383
384 foreach($roles as $role)
385 {
386 $title = ilObject::_lookupTitle($role);
387 if(substr($title, 0, 13) == ('il_'.$type.'_member'))
388 {
389 return $role;
390 }
391 }
392 return 0;
393 }
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
global $ilCtrl
Definition: ilias.php:18

References $ilCtrl, $obj_id, $roles, $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 75 of file class.ilParticipants.php.

76 {
77 $type = ilObject::_lookupType($a_obj_id);
78 switch($type)
79 {
80 case 'crs':
81 include_once './Modules/Course/classes/class.ilCourseParticipants.php';
83
84 case 'grp':
85 include_once './Modules/Group/classes/class.ilGroupParticipants.php';
87
88 case 'sess':
89 include_once './Modules/Session/classes/class.ilSessionParticipants.php';
91
92 default:
93 $GLOBALS['ilLog']->logStack();
94 $GLOBALS['ilLog']->write(__METHOD__.': Invalid obj_id given: '.$a_obj_id);
95 throw new InvalidArgumentException('Invalid obj id given');
96 }
97 }
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 ilObjSessionGUI\assignSubscribersObject(), ilPortfolioAccessHandler\findSharedObjects(), ilWorkspaceAccessHandler\findSharedObjects(), ilECSAppEventListener\handleMembership(), hasParticipantListAccess(), ilObjCourseGUI\infoScreen(), ilRepositorySearchGUI\listUsers(), ilObjSessionGUI\membersObject(), ilRepositoryObjectResultTableGUI\parseObjectIds(), ilObjSessionGUI\refuseSubscribersObject(), ilObjSessionGUI\registerObject(), and ilObjSessionGUI\showJoinRequestButton().

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

481 {
482 return $this->members ? $this->members : array();
483 }

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

420 {
421 global $ilDB;
422
423 $query = "SELECT * FROM obj_members ".
424 "WHERE notification = 1 ".
425 "AND obj_id = ".$ilDB->quote($this->obj_id)." ";
426 $res = $ilDB->query($query);
427 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
428 {
429 if($this->isAdmin($row->usr_id) or $this->isTutor($row->usr_id))
430 {
431 $recp[] = $row->usr_id;
432 }
433 }
434 return $recp ? $recp : array();
435 }
isAdmin($a_usr_id)
is user admin

References $ilDB, $query, $res, $row, DB_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 399 of file class.ilParticipants.php.

400 {
401 return $this->obj_id;
402 }

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

469 {
470 return $this->participants ? $this->participants : array();
471 }

Referenced by isGroupingMember().

+ Here is the caller graph for this function:

◆ getRoles()

ilParticipants::getRoles ( )

Get course roles.

@access public

Parameters

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

586 {
587 return $this->roles ? $this->roles : array();
588 }

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

1189 {
1190 return $this->readSubscriberData($a_usr_id);
1191 }
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 1165 of file class.ilParticipants.php.

1166 {
1167 $this->readSubscribers();
1168
1169 return $this->subscribers;
1170 }

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

512 {
513 return $this->tutors ? $this->tutors : array();
514 }

◆ getType()

ilParticipants::getType ( )

Get object type.

Returns
string obj_type

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

409 {
410 return $this->type;
411 }

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

116 {
117 if(!$a_usr_id)
118 {
119 $a_usr_id = $GLOBALS['ilUser']->getId();
120 }
121
122 // if write access granted => return true
123 $refs = ilObject::_getAllReferences($a_obj_id);
124 $ref_id = end($refs);
125
126 if($GLOBALS['ilAccess']->checkAccess('write','',$ref_id))
127 {
128 return true;
129 }
130 $part = self::getInstanceByObjId($a_obj_id);
131 if($part->isAssigned($a_usr_id))
132 {
133 if($part->getType() == 'crs')
134 {
135 // Check for show_members
136 include_once './Modules/Course/classes/class.ilObjCourse.php';
138 {
139 return false;
140 }
141 }
142 return true;
143 }
144 // User is not assigned to course/group => no read access
145 return false;
146 }
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 689 of file class.ilParticipants.php.

690 {
691 if(isset($this->participants_status[$a_usr_id]))
692 {
693 return $this->participants_status[$a_usr_id]['passed'] ? true : false;
694 }
695 return false;
696 }

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

524 {
525 return in_array($a_usr_id,$this->admins) ? true : false;
526 }

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

563 {
564 return in_array($a_usr_id,$this->participants);
565 }

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

674 {
675 if(isset($this->participants_status[$a_usr_id]))
676 {
677 return $this->participants_status[$a_usr_id]['blocked'] ? true : false;
678 }
679 return false;
680 }

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

997 {
998 if(isset($this->participants_status[$a_usr_id]))
999 {
1000 return (bool) $this->participants_status[$a_usr_id]['contact'];
1001 }
1002 return FALSE;
1003 }

◆ isGroupingMember()

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

Check grouping membership.

@access public

Parameters

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

1103 {
1104 global $rbacreview,$ilObjDataCache,$ilDB;
1105
1106 // Used for membership limitations -> check membership by given field
1107 if($a_field)
1108 {
1109 include_once './Services/User/classes/class.ilObjUser.php';
1110
1111 $tmp_user =& ilObjectFactory::getInstanceByObjId($a_usr_id);
1112 switch($a_field)
1113 {
1114 case 'login':
1115 $and = "AND login = ".$ilDB->quote($tmp_user->getLogin(),'text')." ";
1116 break;
1117 case 'email':
1118 $and = "AND email = ".$ilDB->quote($tmp_user->getEmail(),'text')." ";
1119 break;
1120 case 'matriculation':
1121 $and = "AND matriculation = ".$ilDB->quote($tmp_user->getMatriculation(),'text')." ";
1122 break;
1123
1124 default:
1125 $and = "AND usr_id = ".$ilDB->quote($a_usr_id,'integer'). " ";
1126 break;
1127 }
1128
1129 if(!$this->getParticipants())
1130 {
1131 return false;
1132 }
1133
1134 $query = "SELECT * FROM usr_data ud ".
1135 "WHERE ".$ilDB->in('usr_id',$this->getParticipants(),false,'integer')." ".
1136 $and;
1137
1138 $res = $ilDB->query($query);
1139 return $res->numRows() ? true : false;
1140 }
1141 }
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 572 of file class.ilParticipants.php.

573 {
574 return in_array($a_usr_id,$this->getAdmins()) and count($this->getAdmins()) == 1;
575 }

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

548 {
549 return in_array($a_usr_id,$this->members) ? true : false;
550 }

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

983 {
984 if(isset($this->participants_status[$a_usr_id]))
985 {
986 return $this->participants_status[$a_usr_id]['notification'] ? true : false;
987 }
988 return false;
989 }

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

1389 {
1390 global $ilDB;
1391
1392 $query = "SELECT * FROM il_subscribers ".
1393 "WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
1394 "AND obj_id = ".$ilDB->quote($this->obj_id ,'integer')."";
1395
1396 $res = $ilDB->query($query);
1397 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
1398 {
1399 return true;
1400 }
1401 return false;
1402 }

References $ilDB, $query, $res, $row, and DB_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 535 of file class.ilParticipants.php.

536 {
537 return in_array($a_usr_id,$this->tutors) ? true : false;
538 }

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

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

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

229 {
230 global $rbacreview;
231
232 $lroles = $rbacreview->getRolesOfRoleFolder($a_ref_id,false);
233 return $rbacreview->getNumberOfAssignedUsers($lroles);
234 }

◆ lookupSubscribers()

static ilParticipants::lookupSubscribers (   $a_obj_id)
static

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

1144 {
1145 global $ilDB;
1146
1147 $subscribers = array();
1148 $query = "SELECT usr_id FROM il_subscribers ".
1149 "WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ".
1150 "ORDER BY sub_time ";
1151
1152 $res = $ilDB->query($query);
1153 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
1154 {
1155 $subscribers[] = $row->usr_id;
1156 }
1157 return $subscribers;
1158 }

References $ilDB, $query, $res, $row, $subscribers, and DB_FETCHMODE_OBJECT.

Referenced by ilObjCourseGUI\membersObject().

+ Here is the caller graph for this function:

◆ lookupSubscribersData()

static ilParticipants::lookupSubscribersData (   $a_obj_id)
static

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

1478 {
1479 global $ilDB;
1480
1481 $query = 'SELECT * FROM il_subscribers '.
1482 'WHERE obj_id = '.$ilDB->quote($a_obj_id,'integer');
1483 $res = $ilDB->query($query);
1484
1485 $data = array();
1486 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
1487 {
1488 $data[$row->usr_id]['time'] = $row->sub_time;
1489 $data[$row->usr_id]['usr_id'] = $row->usr_id;
1490 $data[$row->usr_id]['subject'] = $row->subject;
1491 }
1492 return $data;
1493 }
$data

References $data, $ilDB, $query, $res, $row, and DB_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 1015 of file class.ilParticipants.php.

1016 {
1017 global $rbacreview,$ilObjDataCache,$ilLog;
1018
1019 $GLOBALS['rbacreview']->clearCaches();
1020 $this->roles = $rbacreview->getRolesOfRoleFolder($this->ref_id,false);
1021
1022 $users = array();
1023 $this->participants = array();
1024 $this->members = $this->admins = $this->tutors = array();
1025
1026 foreach($this->roles as $role_id)
1027 {
1028 $title = $ilObjDataCache->lookupTitle($role_id);
1029 switch(substr($title,0,8))
1030 {
1031 case 'il_crs_m':
1032 $this->role_data[IL_CRS_MEMBER] = $role_id;
1033 $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id),$this->participants));
1034 $this->members = array_unique(array_merge($assigned,$this->members));
1035 break;
1036
1037 case 'il_crs_a':
1038 $this->role_data[IL_CRS_ADMIN] = $role_id;
1039 $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id),$this->participants));
1040 $this->admins = $rbacreview->assignedUsers($role_id);
1041 break;
1042
1043 case 'il_crs_t':
1044 $this->role_data[IL_CRS_TUTOR] = $role_id;
1045 $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id),$this->participants));
1046 $this->tutors = $rbacreview->assignedUsers($role_id);
1047 break;
1048
1049 case 'il_grp_a':
1050 $this->role_data[IL_GRP_ADMIN] = $role_id;
1051 $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id),$this->participants));
1052 $this->admins = $rbacreview->assignedUsers($role_id);
1053 break;
1054
1055 case 'il_grp_m':
1056 $this->role_data[IL_GRP_MEMBER] = $role_id;
1057 $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id),$this->participants));
1058 $this->members = $rbacreview->assignedUsers($role_id);
1059 break;
1060
1061 default:
1062 $this->participants = array_unique(array_merge($assigned = $rbacreview->assignedUsers($role_id),$this->participants));
1063 $this->members = array_unique(array_merge($assigned,$this->members));
1064 break;
1065 }
1066 }
1067 }

References $GLOBALS, $ilLog, IL_CRS_ADMIN, IL_CRS_MEMBER, IL_CRS_TUTOR, IL_GRP_ADMIN, and IL_GRP_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 1076 of file class.ilParticipants.php.

1077 {
1078 global $ilDB;
1079
1080 $query = "SELECT * FROM obj_members ".
1081 "WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ";
1082 $res = $ilDB->query($query);
1083 $this->participants_status = array();
1084 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
1085 {
1086 $this->participants_status[$row->usr_id]['blocked'] = $row->blocked;
1087 $this->participants_status[$row->usr_id]['notification'] = $row->notification;
1088 $this->participants_status[$row->usr_id]['passed'] = $row->passed;
1089 // cognos-blu-patch: begin
1090 $this->participants_status[$row->usr_id]['contact'] = $row->contact;
1091 // cognos-blu-patch: end
1092 }
1093 }

References $ilDB, $query, $res, $row, and DB_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 1459 of file class.ilParticipants.php.

1460 {
1461 global $ilDB;
1462
1463 $query = "SELECT * FROM il_subscribers ".
1464 "WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ".
1465 "AND usr_id = ".$ilDB->quote($a_usr_id ,'integer')."";
1466
1467 $res = $this->ilDB->query($query);
1468 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
1469 {
1470 $data["time"] = $row->sub_time;
1471 $data["usr_id"] = $row->usr_id;
1472 $data['subject'] = $row->subject;
1473 }
1474 return $data ? $data : array();
1475 }
query($sql, $a_handle_error=true)
Query.

References $data, $ilDB, $query, $res, $row, DB_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 1431 of file class.ilParticipants.php.

1432 {
1433 global $ilDB;
1434
1435 $this->subscribers = array();
1436
1437 $query = "SELECT usr_id FROM il_subscribers ".
1438 "WHERE obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ".
1439 "ORDER BY sub_time ";
1440
1441 $res = $this->ilDB->query($query);
1442 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
1443 {
1444 // DELETE SUBSCRIPTION IF USER HAS BEEN DELETED
1445 if(!ilObjectFactory::getInstanceByObjId($row->usr_id,false))
1446 {
1447 $this->deleteSubscriber($row->usr_id);
1448 }
1449 $this->subscribers[] = $row->usr_id;
1450 }
1451 return true;
1452 }

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, deleteSubscriber(), 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:

◆ updateBlocked()

ilParticipants::updateBlocked (   $a_usr_id,
  $a_blocked 
)

Update blocked status.

@access public

Parameters
intusr_id
boolblocked

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

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

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

784 {
785 global $ilDB;
786
787 $ilDB->manipulate(
788 'UPDATE obj_members SET '.
789 'contact = '.$ilDB->quote($a_contact,'integer').' '.
790 'WHERE obj_id = '.$ilDB->quote($this->obj_id,'integer').' '.
791 'AND usr_id = '.$ilDB->quote($a_usr_id,'integer'));
792
793 $this->participants_status[$a_usr_id]['contact'] = $a_contact;
794 return TRUE;
795 }

References $ilDB.

◆ updateNotification()

ilParticipants::updateNotification (   $a_usr_id,
  $a_notification 
)

Update notification status.

@access public

Parameters
intusr_id
boolpassed

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

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

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

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

1329 {
1330 global $ilDB;
1331
1332 $query = "UPDATE il_subscribers ".
1333 "SET subject = ".$ilDB->quote($a_subject ,'text')." ".
1334 "WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
1335 "AND obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ";
1336 $res = $ilDB->manipulate($query);
1337 return true;
1338 }

References $ilDB, $query, and $res.

◆ updateSubscriptionTime()

ilParticipants::updateSubscriptionTime (   $a_usr_id,
  $a_subtime 
)

Update subscription time.

@access public

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

1309 {
1310 global $ilDB;
1311
1312 $query = "UPDATE il_subscribers ".
1313 "SET sub_time = ".$ilDB->quote($a_subtime ,'integer')." ".
1314 "WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
1315 "AND obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ";
1316 $res = $ilDB->manipulate($query);
1317
1318 return true;
1319 }

References $ilDB, $query, and $res.

Field Documentation

◆ $admins

ilParticipants::$admins = array()
protected

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

◆ $component

ilParticipants::$component = ''
protected

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

Referenced by getComponent().

◆ $ilDB

◆ $lng

ilParticipants::$lng
protected

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

Referenced by __construct().

◆ $members

ilParticipants::$members = array()
protected

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

◆ $obj_id

ilParticipants::$obj_id = 0
protected

◆ $participants

ilParticipants::$participants = array()
protected

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

◆ $participants_status

ilParticipants::$participants_status = array()
protected

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

◆ $ref_id

ilParticipants::$ref_id = 0
protected

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

Referenced by hasParticipantListAccess().

◆ $role_data

ilParticipants::$role_data = array()
protected

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

◆ $roles

ilParticipants::$roles = array()
protected

◆ $subscribers

ilParticipants::$subscribers = array()
protected

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

Referenced by getSubscribers(), and lookupSubscribers().

◆ $tutors

ilParticipants::$tutors = array()
protected

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

◆ $type

ilParticipants::$type = ''
protected

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

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


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