ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilAwarenessAct Class Reference

High level business class, interface to front ends. More...

+ Collaboration diagram for ilAwarenessAct:

Public Member Functions

 setRefId ($a_val)
 Set ref id. More...
 
 getRefId ()
 Get ref id. More...
 
 getAwarenessData ($a_filter)
 Get awareness data. More...
 
 getAwarenessUserCounter ()
 Get awareness data. More...
 
 notifyOnNewOnlineContacts ()
 Send OSD notification on new users. More...
 

Static Public Member Functions

static getInstance ($a_user_id)
 Get instance (for a user) More...
 

Protected Member Functions

 __construct ($a_user_id)
 Constructor. More...
 

Protected Attributes

 $user_id
 
 $ref_id = 0
 

Static Protected Attributes

static $instances = array()
 
static $collector
 

Detailed Description

High level business class, interface to front ends.

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

Definition at line 12 of file class.ilAwarenessAct.php.

Constructor & Destructor Documentation

◆ __construct()

ilAwarenessAct::__construct (   $a_user_id)
protected

Constructor.

Parameters
int$a_user_iduser ud

Definition at line 24 of file class.ilAwarenessAct.php.

25  {
26  $this->user_id = $a_user_id;
27  }

Member Function Documentation

◆ getAwarenessData()

ilAwarenessAct::getAwarenessData (   $a_filter)

Get awareness data.

Returns
ilAwarenessData awareness data

Definition at line 70 of file class.ilAwarenessAct.php.

References $data, ilAwarenessData\getInstance(), and getRefId().

71  {
72  include_once("./Services/Awareness/classes/class.ilAwarenessData.php");
73  $data = ilAwarenessData::getInstance($this->user_id);
74  $data->setRefId($this->getRefId());
75  $data->setFilter($a_filter);
76  return $data->getData();
77  }
getRefId()
Get ref id.
static getInstance($a_user_id)
Get instance (for a user)
+ Here is the call graph for this function:

◆ getAwarenessUserCounter()

ilAwarenessAct::getAwarenessUserCounter ( )

Get awareness data.

Returns
ilAwarenessData awareness data

Definition at line 84 of file class.ilAwarenessAct.php.

References $data, ilAwarenessData\getInstance(), and getRefId().

85  {
86  include_once("./Services/Awareness/classes/class.ilAwarenessData.php");
87  $data = ilAwarenessData::getInstance($this->user_id);
88  $data->setRefId($this->getRefId());
89  return $data->getUserCounter();
90  }
getRefId()
Get ref id.
static getInstance($a_user_id)
Get instance (for a user)
+ Here is the call graph for this function:

◆ getInstance()

static ilAwarenessAct::getInstance (   $a_user_id)
static

Get instance (for a user)

Parameters
int$a_user_iduser id
Returns
ilAwarenessAct actor class

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

Referenced by ilAwarenessGUI\getAwarenessList(), and ilAwarenessGUI\getMainMenuHTML().

56  {
57  if (!isset(self::$instances[$a_user_id]))
58  {
59  self::$instances[$a_user_id] = new ilAwarenessAct($a_user_id);
60  }
61 
62  return self::$instances[$a_user_id];
63  }
High level business class, interface to front ends.
+ Here is the caller graph for this function:

◆ getRefId()

ilAwarenessAct::getRefId ( )

Get ref id.

Returns
int ref id

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

References $ref_id.

Referenced by getAwarenessData(), getAwarenessUserCounter(), and notifyOnNewOnlineContacts().

45  {
46  return $this->ref_id;
47  }
+ Here is the caller graph for this function:

◆ notifyOnNewOnlineContacts()

ilAwarenessAct::notifyOnNewOnlineContacts ( )

Send OSD notification on new users.

Definition at line 95 of file class.ilAwarenessAct.php.

References $d, $data, $lng, array, date, ilNotificationConfig\DEFAULT_TTS, ilSession\get(), ilAwarenessData\getInstance(), getRefId(), ilSession\set(), time, and ilNotificationConfig\TTL_SHORT.

96  {
97  global $lng;
98 
99  $awrn_set = new ilSetting("awrn");
100  if (!$awrn_set->get("use_osd", true))
101  {
102  return;
103  }
104 
105  $ts = ilSession::get("awr_online_user_ts");
106 
107  $data = ilAwarenessData::getInstance($this->user_id);
108  $data->setRefId($this->getRefId());
109  $d = $data->getOnlineUserData($ts);
110 
111  $new_online_users = array();
112  $no_ids = array();
113  foreach ($d as $u)
114  {
115  $uname = "[".$u->login."]";
116  if ($u->public_profile)
117  {
118  $uname = "<a href='./goto.php?target=usr_".$u->id."'>".$u->lastname.", ".$u->firstname." ".$uname."</a>";
119  }
120  if (!in_array($u->id, $no_ids))
121  {
122  $new_online_users[] = $uname;
123  $no_ids[] = $u->id;
124  }
125  }
126 
127  if (count($new_online_users) == 0)
128  {
129  return;
130  }
131 //var_dump($d); exit;
132  $lng->loadLanguageModule('mail');
133 
134  include_once("./Services/Object/classes/class.ilObjectFactory.php");
135  //$recipient = ilObjectFactory::getInstanceByObjId($this->user_id);
136  $bodyParams = array(
137  'online_user_names' => implode("<br />", $new_online_users)
138  );
139 //var_dump($bodyParams); exit;
140  require_once 'Services/Notifications/classes/class.ilNotificationConfig.php';
141  $notification = new ilNotificationConfig('osd_main');
142  $notification->setTitleVar('awareness_now_online', $bodyParams, 'awrn');
143  $notification->setShortDescriptionVar('awareness_now_online_users', $bodyParams, 'awrn');
144  $notification->setLongDescriptionVar('', $bodyParams, '');
145  $notification->setAutoDisable(false);
146  //$notification->setLink();
147  $notification->setIconPath('templates/default/images/icon_usr.svg');
148  $notification->setValidForSeconds(ilNotificationConfig::TTL_SHORT);
149  $notification->setVisibleForSeconds(ilNotificationConfig::DEFAULT_TTS);
150 
151  //$notification->setHandlerParam('mail.sender', $sender_id);
152 
153  ilSession::set("awr_online_user_ts", date("Y-m-d H:i:s", time()));
154 
155  $notification->notifyByUsers(array($this->user_id));
156  }
ILIAS Setting Class.
getRefId()
Get ref id.
static get($a_var)
Get a value.
static set($a_var, $a_val)
Set a value.
for($col=0; $col< 50; $col++) $d
Describes a notification and provides methods for publishing this notification.
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
static getInstance($a_user_id)
Get instance (for a user)
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:

◆ setRefId()

ilAwarenessAct::setRefId (   $a_val)

Set ref id.

Parameters
int$a_valref id

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

35  {
36  $this->ref_id = $a_val;
37  }

Field Documentation

◆ $collector

ilAwarenessAct::$collector
staticprotected

Definition at line 17 of file class.ilAwarenessAct.php.

◆ $instances

ilAwarenessAct::$instances = array()
staticprotected

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

◆ $ref_id

ilAwarenessAct::$ref_id = 0
protected

Definition at line 16 of file class.ilAwarenessAct.php.

Referenced by getRefId().

◆ $user_id

ilAwarenessAct::$user_id
protected

Definition at line 15 of file class.ilAwarenessAct.php.


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