ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilAwarenessUserProviderMemberships Class Reference

All members of the same courses/groups as the user. More...

+ Inheritance diagram for ilAwarenessUserProviderMemberships:
+ Collaboration diagram for ilAwarenessUserProviderMemberships:

Public Member Functions

 __construct ()
 Constructor. More...
 
 getProviderId ()
 Get provider id. More...
 
 getTitle ()
 Provider title (used in awareness overlay and in administration settings) More...
 
 getInfo ()
 Provider info (used in administration settings) More...
 
 getInitialUserSet ()
 Get initial set of users. More...
 
- Public Member Functions inherited from ilAwarenessUserProvider
 __construct ()
 Constructor. More...
 
 setActivationMode ($a_val)
 Activate provider. More...
 
 getActivationMode ()
 Get Activate provider. More...
 
 setUserId ($a_val)
 Set user id. More...
 
 getUserId ()
 Get user id. More...
 
 setRefId ($a_val)
 Set ref id. More...
 
 getRefId ()
 Get ref id. More...
 
 setOnlineUserFilter ($a_val)
 Set online user filter. More...
 
 getOnlineUserFilter ()
 Get online user filter. More...
 
 getProviderId ()
 This should return a unique id for the provider The ID should start with the service/module id, separated by "_" and a second part that is unique within the module/service, e.g. More...
 
 getTitle ()
 Provider title (used in awareness overlay and in administration settings) More...
 
 getInfo ()
 Provider info (used in administration settings) More...
 
 getInitialUserSet ()
 Get initial set of users. More...
 
 collectUsers ()
 Collect all users. More...
 
 isHighlighted ()
 Is highlighted. More...
 

Additional Inherited Members

- Data Fields inherited from ilAwarenessUserProvider
const MODE_INACTIVE = 0
 
const MODE_ONLINE_ONLY = 1
 
const MODE_INCL_OFFLINE = 2
 
- Protected Member Functions inherited from ilAwarenessUserProvider
 addUserToCollection ($a_user_id, ilAwarenessUserCollection $a_collection)
 Add user to collection. More...
 
- Protected Attributes inherited from ilAwarenessUserProvider
 $user_id
 
 $ref_id
 
 $lng
 
 $db
 
 $online_user_filter = false
 
 $log
 

Detailed Description

All members of the same courses/groups as the user.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 14 of file class.ilAwarenessUserProviderMemberships.php.

Constructor & Destructor Documentation

◆ __construct()

ilAwarenessUserProviderMemberships::__construct ( )

Constructor.

Definition at line 20 of file class.ilAwarenessUserProviderMemberships.php.

References $DIC.

21  {
22  global $DIC;
23 
24  parent::__construct();
25 
26  $this->db = $DIC->database();
27  }
global $DIC
Definition: saml.php:7

Member Function Documentation

◆ getInfo()

ilAwarenessUserProviderMemberships::getInfo ( )

Provider info (used in administration settings)

Returns
string provider info text

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

56  {
57  $this->lng->loadLanguageModule("crs");
58  return $this->lng->txt("mmbr_awrn_my_groups_courses_info");
59  }

◆ getInitialUserSet()

ilAwarenessUserProviderMemberships::getInitialUserSet ( )

Get initial set of users.

Returns
array array of user IDs

Definition at line 66 of file class.ilAwarenessUserProviderMemberships.php.

References ilAwarenessUserProvider\$db, $ilDB, ilAwarenessUserProvider\$ref_id, ilObject\_getAllReferences(), ilParticipants\_getMembershipByType(), ilParticipants\_isParticipant(), ilObject\_lookupTitle(), array, ilLogLevel\DEBUG, and ilAwarenessUserProvider\getUserId().

67  {
68  $ilDB = $this->db;
69 
70 
71  include_once("./Services/Membership/classes/class.ilParticipants.php");
72  $groups_and_courses_of_user = ilParticipants::_getMembershipByType($this->getUserId(), array("grp", "crs"));
73  $this->log->debug("user: " . $this->getUserId() . ", courses and groups: " . implode(",", $groups_and_courses_of_user));
74 
75  $set = $ilDB->query(
76  "SELECT DISTINCT usr_id, obj_id FROM obj_members " .
77  " WHERE " . $ilDB->in("obj_id", $groups_and_courses_of_user, false, "integer") . ' ' .
78  'AND (admin > ' . $ilDB->quote(0, 'integer') . ' ' .
79  'OR tutor > ' . $ilDB->quote(0, 'integer') . ' ' .
80  'OR member > ' . $ilDB->quote(0, 'integer') . ")"
81  );
82  $ub = array();
83  while ($rec = $ilDB->fetchAssoc($set)) {
84  if (!in_array($rec["usr_id"], $ub)) {
85  $ub[] = $rec["usr_id"];
86  if ($this->log->isHandling(ilLogLevel::DEBUG)) {
87  // cross-check if user is in course
88  include_once("./Services/Membership/classes/class.ilParticipants.php");
89  $ref_ids = ilObject::_getAllReferences($rec["obj_id"]);
90  $ref_id = current($ref_ids);
91  $this->log->debug("Cross-checking all members...");
92  if (!ilParticipants::_isParticipant($ref_id, $rec["usr_id"])) {
93  $this->log->debug("ERROR: obj_members has entry for user id: " . $rec["usr_id"] .
94  ", user : " . ilObject::_lookupTitle($rec["usr_id"]) . ", course ref: " . $ref_id . ", course: " .
95  ilObject::_lookupTitle($rec["obj_id"]) . ", but ilParticipants does not list this user as a member.");
96  }
97  }
98  }
99  }
100 
101  $this->log->debug("Got " . count($ub) . " distinct members.");
102 
103  return $ub;
104  }
static _isParticipant($a_ref_id, $a_usr_id)
Static function to check if a user is a participant of the container object.
static _getMembershipByType($a_usr_id, $a_type, $a_only_member_role=false)
get membership by type Get course or group membership
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ getProviderId()

ilAwarenessUserProviderMemberships::getProviderId ( )

Get provider id.

Returns
string provider id

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

35  {
36  return "mmbr_user_grpcrs";
37  }

◆ getTitle()

ilAwarenessUserProviderMemberships::getTitle ( )

Provider title (used in awareness overlay and in administration settings)

Returns
string provider title

Definition at line 44 of file class.ilAwarenessUserProviderMemberships.php.

45  {
46  $this->lng->loadLanguageModule("mmbr");
47  return $this->lng->txt("mmbr_awrn_my_groups_courses");
48  }

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