ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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  function __construct()
28  {
29  global $lng, $ilDB;
30 
31  $this->lng = $lng;
32  $this->db = $ilDB;
33  $this->settings = new ilSetting("awrn");
34  }
35 
41  function setActivationMode($a_val)
42  {
43  $this->settings->set("up_act_".$this->getProviderId(), (int) $a_val);
44  }
45 
51  function getActivationMode()
52  {
53  return (int) $this->settings->get("up_act_".$this->getProviderId());
54  }
55 
61  function setUserId($a_val)
62  {
63  $this->user_id = $a_val;
64  }
65 
71  function getUserId()
72  {
73  return $this->user_id;
74  }
75 
81  function setRefId($a_val)
82  {
83  $this->ref_id = $a_val;
84  }
85 
91  function getRefId()
92  {
93  return $this->ref_id;
94  }
95 
101  function setOnlineUserFilter($a_val)
102  {
103  $this->online_user_filter = $a_val;
104  }
105 
112  {
114  }
115 
123  abstract function getProviderId();
124 
130  abstract function getTitle();
131 
137  abstract function getInfo();
138 
144  abstract function getInitialUserSet();
145 
151  function collectUsers()
152  {
154 
155  foreach ($this->getInitialUserSet() as $u)
156  {
157  $this->addUserToCollection($u, $coll);
158  }
159 
160  return $coll;
161  }
162 
169  protected function addUserToCollection($a_user_id, ilAwarenessUserCollection $a_collection)
170  {
171  $ou = $this->getOnlineUserFilter();
172  if ($this->getUserId() != $a_user_id && ($ou === false || in_array($a_user_id, $ou)))
173  {
174  $a_collection->addUser($a_user_id);
175  }
176  }
177 
183  function isHighlighted()
184  {
185  return false;
186  }
187 
188 }
189 
190 ?>
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)
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
getOnlineUserFilter()
Get online user filter.
addUserToCollection($a_user_id, ilAwarenessUserCollection $a_collection)
Add user to collection.