ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilAwarenessMetaBarProvider Class Reference

Who-Is-Online meta bar provider. More...

+ Inheritance diagram for ilAwarenessMetaBarProvider:
+ Collaboration diagram for ilAwarenessMetaBarProvider:

Public Member Functions

 getAllIdentifications ()
 @inheritDoc More...
 
 getMetaBarItems ()
 @inheritDoc More...
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Scope\MetaBar\Provider\AbstractStaticMetaBarProvider
 __construct (Container $dic)
 @inheritDoc More...
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 __construct (Container $dic)
 @inheritDoc More...
 
 getFullyQualifiedClassName ()
 @inheritDoc More...
 
 getProviderNameForPresentation ()
 
 getFullyQualifiedClassName ()
 
 getProviderNameForPresentation ()
 
 getMetaBarItems ()
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Scope\MetaBar\Provider\MetaBarProviderInterface
 getProviderNameForPresentation ()
 

Private Member Functions

 getId ()
 

Additional Inherited Members

- Data Fields inherited from ILIAS\GlobalScreen\Scope\MetaBar\Provider\StaticMetaBarProvider
const PURPOSE_MBS = "meta_bar_static"
 
- Protected Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 globalScreen ()
 
- Protected Attributes inherited from ILIAS\GlobalScreen\Scope\MetaBar\Provider\AbstractStaticMetaBarProvider
 $dic
 
 $if
 
 $meta_bar
 
- Protected Attributes inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 $dic
 

Detailed Description

Who-Is-Online meta bar provider.

Author
killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Member Function Documentation

◆ getAllIdentifications()

ilAwarenessMetaBarProvider::getAllIdentifications ( )

@inheritDoc

Definition at line 29 of file class.ilAwarenessMetaBarProvider.php.

29 : array
30 {
31 return [$this->getId()];
32 }

References getId().

+ Here is the call graph for this function:

◆ getId()

ilAwarenessMetaBarProvider::getId ( )
private
Returns
IdentificationInterface

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

21 {
22 return $this->if->identifier('awareness');
23 }

Referenced by getAllIdentifications(), and getMetaBarItems().

+ Here is the caller graph for this function:

◆ getMetaBarItems()

ilAwarenessMetaBarProvider::getMetaBarItems ( )

@inheritDoc

Implements ILIAS\GlobalScreen\Scope\MetaBar\Provider\StaticMetaBarProvider.

Definition at line 38 of file class.ilAwarenessMetaBarProvider.php.

38 : array
39 {
40 global $DIC;
41
42 $ilUser = $DIC->user();
43
44 $awrn_set = new ilSetting("awrn");
45 if (!$awrn_set->get("awrn_enabled", false) || ANONYMOUS_USER_ID == $ilUser->getId() || $ilUser->getId() == 0) {
46 return [];
47 }
48
49 $cache_period = (int) $awrn_set->get("caching_period");
50 $last_update = ilSession::get("awrn_last_update");
51 $now = time();
52
53 $act = ilAwarenessAct::getInstance($ilUser->getId());
54 $act->setRefId((int) $_GET["ref_id"]);
55 if ($last_update == "" || ($now - $last_update) >= $cache_period) {
56 $cnt = explode(":", $act->getAwarenessUserCounter());
57 $hcnt = $cnt[1];
58 $cnt = $cnt[0];
59 $act->notifyOnNewOnlineContacts();
60 ilSession::set("awrn_last_update", $now);
61 ilSession::set("awrn_nr_users", $cnt);
62 ilSession::set("awrn_nr_husers", $hcnt);
63 } else {
64 $cnt = (int) ilSession::get("awrn_nr_users");
65 $hcnt = (int) ilSession::get("awrn_nr_husers");
66 }
67
68
69 $gui = new ilAwarenessGUI();
70 $result = $gui->getAwarenessList(true);
71
72 $content = function () use ($result) {
73 return $this->dic->ui()->factory()->legacy($result["html"]);
74 };
75
76 $mb = $this->globalScreen()->metaBar();
77
78 $f = $DIC->ui()->factory();
79
80 $online = explode(":", $result["cnt"]);
81 $online = $online[0];
82
83 $item = $mb
84 ->topLegacyItem($this->getId())
85 ->addComponentDecorator(static function (ILIAS\UI\Component\Component $c) : ILIAS\UI\Component\Component {
86 if ($c instanceof Bulky) {
87 return $c->withAdditionalOnLoadCode(static function (string $id) : string {
88
89 // ...we never get the bulky button of the legacy slate item here
90 return "$('#$id').on('click', function() {
91 console.log('click slate button');
92 })";
93 });
94 }
95 return $c;
96 })
97 ->withLegacyContent($content())
98 ->withSymbol(
99 $this->dic->ui()->factory()
100 ->symbol()
101 ->glyph()
102 ->user()
103 ->withCounter($f->counter()->status((int) $cnt))
104 ->withCounter($f->counter()->novelty((int) $hcnt))
105 )
106 ->withTitle($this->dic->language()->txt("awra"))
107 ->withPosition(2)
108 ->withAvailableCallable(
109 function () use ($DIC, $online) {
110 $ilUser = $DIC->user();
111
112 $awrn_set = new ilSetting("awrn");
113 if ($online <= 0 || !$awrn_set->get("awrn_enabled", false) || ANONYMOUS_USER_ID == $ilUser->getId()) {
114 return false;
115 }
116 return true;
117 }
118 );
119
120 return [$item];
121 }
$result
$_GET["client_id"]
static getInstance($a_user_id)
Get instance (for a user)
Awareness GUI class.
static set($a_var, $a_val)
Set a value.
static get($a_var)
Get a value.
ILIAS Setting Class.
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46

References $_GET, Vendor\Package\$c, $DIC, Vendor\Package\$f, $ilUser, $result, ilSession\get(), getId(), ilAwarenessAct\getInstance(), ILIAS\GlobalScreen\Provider\AbstractProvider\globalScreen(), and ilSession\set().

+ Here is the call graph for this function:

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