ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  function __construct()
33  {
34  global $lng, $ilDB;
35 
36  $this->lng = $lng;
37  $this->db = $ilDB;
38  $this->settings = new ilSetting("awrn");
39  $this->log = ilLoggerFactory::getLogger('awrn');
40  }
41 
47  function setActivationMode($a_val)
48  {
49  $this->settings->set("up_act_".$this->getProviderId(), (int) $a_val);
50  }
51 
57  function getActivationMode()
58  {
59  return (int) $this->settings->get("up_act_".$this->getProviderId());
60  }
61 
67  function setUserId($a_val)
68  {
69  $this->user_id = $a_val;
70  }
71 
77  function getUserId()
78  {
79  return $this->user_id;
80  }
81 
87  function setRefId($a_val)
88  {
89  $this->ref_id = $a_val;
90  }
91 
97  function getRefId()
98  {
99  return $this->ref_id;
100  }
101 
107  function setOnlineUserFilter($a_val)
108  {
109  $this->online_user_filter = $a_val;
110  }
111 
118  {
120  }
121 
129  abstract function getProviderId();
130 
136  abstract function getTitle();
137 
143  abstract function getInfo();
144 
150  abstract function getInitialUserSet();
151 
157  function collectUsers()
158  {
160 
161  foreach ($this->getInitialUserSet() as $u)
162  {
163  $this->addUserToCollection($u, $coll);
164  }
165 
166  return $coll;
167  }
168 
175  protected function addUserToCollection($a_user_id, ilAwarenessUserCollection $a_collection)
176  {
177  $ou = $this->getOnlineUserFilter();
178  if ($this->getUserId() != $a_user_id && ($ou === false || in_array($a_user_id, $ou)))
179  {
180  $a_collection->addUser($a_user_id);
181  }
182  }
183 
189  function isHighlighted()
190  {
191  return false;
192  }
193 
194 }
195 
196 ?>
ILIAS Setting Class.
getActivationMode()
Get Activate provider.
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.