ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilAwarenessUserProvider.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2014 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
13 {
14  const MODE_INACTIVE = 0;
15  const MODE_ONLINE_ONLY = 1;
16  const MODE_INCL_OFFLINE = 2;
17 
18  protected $user_id;
19  protected $ref_id;
20  protected $lng;
21  protected $db;
22  protected $online_user_filter = false;
23 
27  protected $log;
28 
32  public function __construct()
33  {
34  global $DIC;
35 
36  $lng = $DIC->language();
37  $ilDB = $DIC->database();
38 
39  $this->lng = $lng;
40  $this->db = $ilDB;
41  $this->settings = new ilSetting("awrn");
42  $this->log = ilLoggerFactory::getLogger('awrn');
43  }
44 
50  public function setActivationMode($a_val)
51  {
52  $this->settings->set("up_act_" . $this->getProviderId(), (int) $a_val);
53  }
54 
60  public function getActivationMode()
61  {
62  return (int) $this->settings->get("up_act_" . $this->getProviderId());
63  }
64 
70  public function setUserId($a_val)
71  {
72  $this->user_id = $a_val;
73  }
74 
80  public function getUserId()
81  {
82  return $this->user_id;
83  }
84 
90  public function setRefId($a_val)
91  {
92  $this->ref_id = $a_val;
93  }
94 
100  public function getRefId()
101  {
102  return $this->ref_id;
103  }
104 
110  public function setOnlineUserFilter($a_val)
111  {
112  $this->online_user_filter = $a_val;
113  }
114 
120  public function getOnlineUserFilter()
121  {
123  }
124 
132  abstract public function getProviderId();
133 
139  abstract public function getTitle();
140 
146  abstract public function getInfo();
147 
153  abstract public function getInitialUserSet();
154 
160  public function collectUsers()
161  {
163 
164  foreach ($this->getInitialUserSet() as $u) {
165  $this->addUserToCollection($u, $coll);
166  }
167 
168  return $coll;
169  }
170 
177  protected function addUserToCollection($a_user_id, ilAwarenessUserCollection $a_collection)
178  {
179  $ou = $this->getOnlineUserFilter();
180  if ($this->getUserId() != $a_user_id && ($ou === false || in_array($a_user_id, $ou))) {
181  $a_collection->addUser($a_user_id);
182  }
183  }
184 
190  public function isHighlighted()
191  {
192  return false;
193  }
194 }
getActivationMode()
Get Activate provider.
global $DIC
Definition: saml.php:7
setActivationMode($a_val)
Activate provider.
getInfo()
Provider info (used in administration settings)
A class that provides a collection of users for the awareness tool.
getInitialUserSet()
Get initial set of users.
setOnlineUserFilter($a_val)
Set online user filter.
getTitle()
Provider title (used in awareness overlay and in administration settings)
settings()
Definition: settings.php:2
getProviderId()
This should return a unique id for the provider The ID should start with the service/module id...
Represents a set of collected users.
global $ilDB
static getLogger($a_component_id)
Get component logger.
getOnlineUserFilter()
Get online user filter.
addUserToCollection($a_user_id, ilAwarenessUserCollection $a_collection)
Add user to collection.