ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilAwarenessChatFeatureProvider.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2015 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5include_once("./Services/Awareness/classes/class.ilAwarenessFeatureProvider.php");
6
15{
16 protected static $user_access = array();
17 protected $pub_ref_id = 0;
18
22 function __construct()
23 {
24 parent::__construct();
25
26 include_once './Modules/Chatroom/classes/class.ilObjChatroom.php';
27 $this->pub_ref_id = ilObjChatroom::_getPublicRefId();
28
29 $chatSettings = new ilSetting('chatroom');
30 $this->chat_enabled = $chatSettings->get('chat_enabled');
31 }
32
39 function checkUserChatAccess($a_user_id)
40 {
41 global $rbacsystem;
42
43 if (!isset(self::$user_access[$a_user_id]))
44 {
45 self::$user_access[$a_user_id] =
46 $rbacsystem->checkAccessOfUser($a_user_id, 'read', $this->pub_ref_id);
47 }
48 return self::$user_access[$a_user_id];
49 }
50
51
52
59 function collectFeaturesForTargetUser($a_target_user)
60 {
62 include_once("./Services/Awareness/classes/class.ilAwarenessFeature.php");
63
64 if (!$this->chat_enabled)
65 {
66 return $coll;
67 }
68
69 if ($this->checkUserChatAccess($this->getUserId()))
70 {
71 // this check is not really needed anymore, since the current
72 // user will never be listed in the awareness tool
73 if ($a_target_user != $this->getUserId())
74 {
75 if ($this->checkUserChatAccess($a_target_user))
76 {
77 $f = new ilAwarenessFeature();
78 $f->setText($this->lng->txt('chat_invite_public_room'));
79 $f->setHref('./ilias.php?baseClass=ilRepositoryGUI&ref_id='.$this->pub_ref_id.
80 '&usr_id='.$a_target_user.'&cmd=view-invitePD');
81 //$this->tpl->setVariable('TXT_CHAT_INVITE_TOOLTIP', $lng->txt('chat_invite_public_room_tooltip'));
82 $coll->addFeature($f);
83 }
84 }
85 }
86
87 return $coll;
88 }
89}
90?>
collectFeaturesForTargetUser($a_target_user)
Collect all features.
checkUserChatAccess($a_user_id)
Check user chat access.
A class that provides a collection of features for the awareness tool.
Awareness tool feature (presented in user drop downs) (data object)
ILIAS Setting Class.