ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilAwarenessGUI Class Reference

Awareness GUI class. More...

+ Collaboration diagram for ilAwarenessGUI:

Public Member Functions

 __construct ()
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 getMainMenuHTML ()
 Get main menu html. More...
 
 getAwarenessList ()
 Get awareness list (ajax) More...
 

Static Public Member Functions

static getInstance ()
 Get instance. More...
 

Protected Attributes

 $ctrl
 

Detailed Description

Awareness GUI class.

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.ilAwarenessGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilAwarenessGUI::__construct ( )

Constructor.

Definition at line 19 of file class.ilAwarenessGUI.php.

20 {
21 global $ilCtrl;
22
23 $this->ref_id = (int) $_GET["ref_id"];
24 $this->ctrl = $ilCtrl;
25 }
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18

References $_GET, and $ilCtrl.

Member Function Documentation

◆ executeCommand()

ilAwarenessGUI::executeCommand ( )

Execute command.

Definition at line 30 of file class.ilAwarenessGUI.php.

31 {
32 $cmd = $this->ctrl->getCmd();
33
34 if (in_array($cmd, array("getAwarenessList")))
35 {
36 $this->$cmd();
37 }
38 }
$cmd
Definition: sahs_server.php:35

References $cmd.

◆ getAwarenessList()

ilAwarenessGUI::getAwarenessList ( )

Get awareness list (ajax)

Definition at line 127 of file class.ilAwarenessGUI.php.

128 {
129 global $ilUser;
130
131 $filter = $_GET["filter"];
132
133 $tpl = new ilTemplate("tpl.awareness_list.html", true, true, "Services/Awareness");
134
135 include_once("./Services/Awareness/classes/class.ilAwarenessAct.php");
136 $act = ilAwarenessAct::getInstance($ilUser->getId());
137 $act->setRefId($this->ref_id);
138
139 $ad = $act->getAwarenessData($filter);
140
141 // update counter
142 $now = time();
143 $cnt = explode(":",$ad["cnt"]);
144 $hcnt = $cnt[1];
145 $cnt = $cnt[0];
146 ilSession::set("awrn_last_update", $now);
147 ilSession::set("awrn_nr_users", $cnt);
148 ilSession::set("awrn_nr_husers", $hcnt);
149
150
151 $users = $ad["data"];
152
153 $ucnt = 0;
154 $last_uc_title = "";
155 foreach ($users as $u)
156 {
157 if ($u->collector != $last_uc_title)
158 {
159 if ($u->highlighted)
160 {
161 $tpl->touchBlock("highlighted");
162 }
163 $tpl->setCurrentBlock("uc_title");
164 $tpl->setVariable("UC_TITLE", $u->collector);
165 $tpl->parseCurrentBlock();
166 $tpl->setCurrentBlock("item");
167 $tpl->parseCurrentBlock();
168 }
169 $last_uc_title = $u->collector;
170
171 $ucnt++;
172
173 $fcnt = 0;
174 foreach ($u->features as $f)
175 {
176 $fcnt++;
177 if ($fcnt == 1)
178 {
179 $tpl->touchBlock("arrow");
180 //$tpl->setCurrentBlock("arrow");
181 //$tpl->parseCurrentBlock();
182 }
183 if (is_array($f->data) && count($f->data) > 0)
184 {
185 foreach ($f->data as $k => $v)
186 {
187 $tpl->setCurrentBlock("f_data");
188 $tpl->setVariable("DATA_KEY", $k);
189 $tpl->setVariable("DATA_VAL", ilUtil::prepareFormOutput($v));
190 $tpl->parseCurrentBlock();
191 }
192 }
193 $tpl->setCurrentBlock("feature");
194 $tpl->setVariable("FEATURE_HREF", $f->href);
195 $tpl->setVariable("FEATURE_TEXT", $f->text);
196 $tpl->parseCurrentBlock();
197 }
198
199 if ($u->online)
200 {
201 $tpl->touchBlock("uonline");
202 }
203
204 $tpl->setCurrentBlock("user");
205 if ($u->public_profile)
206 {
207 $tpl->setVariable("UNAME", $u->lastname.", ".$u->firstname);
208 }
209 else
210 {
211 $tpl->setVariable("UNAME", " ");
212 }
213 $tpl->setVariable("UACCOUNT", $u->login);
214
215 $tpl->setVariable("USERIMAGE", $u->img);
216 $tpl->setVariable("CNT", $ucnt);
217 $tpl->parseCurrentBlock();
218 $tpl->setCurrentBlock("item");
219 $tpl->parseCurrentBlock();
220 }
221
222 include_once("./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
223 $tpl->setCurrentBlock("filter");
224 $tpl->setVariable("GL_FILTER", ilGlyphGUI::get(ilGlyphGUI::FILTER));
225 $tpl->setVariable("VAL_FILTER", ilUtil::prepareFormOutput($filter));
226 $tpl->parseCurrentBlock();
227
228 echo json_encode(array("html" => $tpl->get(),
229 "cnt" => $ad["cnt"]));
230 exit;
231 }
global $tpl
Definition: ilias.php:8
static getInstance($a_user_id)
Get instance (for a user)
static get($a_glyph, $a_text="")
Get glyph html.
static set($a_var, $a_val)
Set a value.
special template class to simplify handling of ITX/PEAR
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
exit
Definition: login.php:54
global $ilUser
Definition: imgupload.php:15

References $_GET, $ilUser, $tpl, exit, ilGlyphGUI\FILTER, ilGlyphGUI\get(), ilAwarenessAct\getInstance(), ilUtil\prepareFormOutput(), and ilSession\set().

+ Here is the call graph for this function:

◆ getInstance()

static ilAwarenessGUI::getInstance ( )
static

Get instance.

Returns
ilAwarenessGUI awareness gui object

Definition at line 46 of file class.ilAwarenessGUI.php.

47 {
48 return new ilAwarenessGUI();
49 }
Awareness GUI class.

Referenced by ilMainMenuGUI\renderAwareness().

+ Here is the caller graph for this function:

◆ getMainMenuHTML()

ilAwarenessGUI::getMainMenuHTML ( )

Get main menu html.

Definition at line 54 of file class.ilAwarenessGUI.php.

55 {
56 global $ilUser;
57
58 $awrn_set = new ilSetting("awrn");
59 if (!$awrn_set->get("awrn_enabled", false) || ANONYMOUS_USER_ID == $ilUser->getId())
60 {
61 return "";
62 }
63
64 $cache_period = (int) $awrn_set->get("caching_period");
65 $last_update = ilSession::get("awrn_last_update");
66 $now = time();
67
68 // init js
69 $GLOBALS["tpl"]->addJavascript("./Services/Awareness/js/Awareness.js");
70 $this->ctrl->setParameter($this, "ref_id", $this->ref_id);
71 $GLOBALS["tpl"]->addOnloadCode("il.Awareness.setBaseUrl('".$this->ctrl->getLinkTarget($this,
72 "", "", true, false)."');");
73 $GLOBALS["tpl"]->addOnloadCode("il.Awareness.setLoaderSrc('".ilUtil::getImagePath("loader.svg")."');");
74 $GLOBALS["tpl"]->addOnloadCode("il.Awareness.init();");
75
76 $tpl = new ilTemplate("tpl.awareness.html", true, true, "Services/Awareness");
77
78 include_once("./Services/Awareness/classes/class.ilAwarenessAct.php");
79 $act = ilAwarenessAct::getInstance($ilUser->getId());
80 $act->setRefId($this->ref_id);
81
82 if ($last_update == "" || ($now - $last_update) >= $cache_period)
83 {
84 $cnt = explode(":", $act->getAwarenessUserCounter());
85 $hcnt = $cnt[1];
86 $cnt = $cnt[0];
87 $act->notifyOnNewOnlineContacts();
88 ilSession::set("awrn_last_update", $now);
89 ilSession::set("awrn_nr_users", $cnt);
90 ilSession::set("awrn_nr_husers", $hcnt);
91 }
92 else
93 {
94 $cnt = (int) ilSession::get("awrn_nr_users");
95 $hcnt = (int) ilSession::get("awrn_nr_husers");
96 }
97
98 if ($hcnt > 0 || $cnt > 0)
99 {
100 $tpl->setCurrentBlock("status_text");
101 $tpl->setVariable("STATUS_TXT", $cnt);
102 if ($cnt == 0)
103 {
104 $tpl->setVariable("HIDDEN", "ilAwrnBadgeHidden");
105 }
106 $tpl->parseCurrentBlock();
107 $tpl->setCurrentBlock("h_status_text");
108 $tpl->setVariable("H_STATUS_TXT", $hcnt);
109 if ($hcnt == 0)
110 {
111 $tpl->setVariable("H_HIDDEN", "ilAwrnBadgeHidden");
112 }
113 $tpl->parseCurrentBlock();
114 $tpl->setVariable("HSP", " ");
115
116 $tpl->setVariable("LOADER", ilUtil::getImagePath("loader.svg"));
117
118 return $tpl->get();
119 }
120
121 return "";
122 }
static get($a_var)
Get a value.
ILIAS Setting Class.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276

References $GLOBALS, $ilUser, $tpl, ilSession\get(), ilUtil\getImagePath(), ilAwarenessAct\getInstance(), and ilSession\set().

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilAwarenessGUI::$ctrl
protected

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


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