41 $this->
user = $DIC->user();
43 $this->
ui = $DIC->ui();
45 $this->ref_id = (int)
$_GET[
"ref_id"];
46 $this->ctrl = $DIC->ctrl();
47 $this->lng = $DIC->language();
48 $this->lng->loadLanguageModule(
"awrn");
56 $cmd = $this->ctrl->getCmd();
58 if (in_array($cmd, array(
"getAwarenessList"))) {
78 $GLOBALS[
"tpl"]->addJavascript(
"./Services/Awareness/js/Awareness.js");
79 $this->ctrl->setParameter($this,
"ref_id", $this->ref_id);
80 $GLOBALS[
"tpl"]->addOnloadCode(
"il.Awareness.setBaseUrl('" . $this->ctrl->getLinkTarget(
88 $GLOBALS[
"tpl"]->addOnloadCode(
"il.Awareness.init();");
91 include_once(
"./Services/User/Actions/classes/class.ilUserActionGUI.php");
92 include_once(
"./Services/Awareness/classes/class.ilAwarenessUserActionContext.php");
105 if (!$awrn_set->get(
"awrn_enabled",
false) || ANONYMOUS_USER_ID ==
$ilUser->getId()) {
109 $cache_period = (int) $awrn_set->get(
"caching_period");
115 $tpl =
new ilTemplate(
"tpl.awareness.html",
true,
true,
"Services/Awareness");
117 include_once(
"./Services/Awareness/classes/class.ilAwarenessAct.php");
119 $act->setRefId($this->ref_id);
122 if ($last_update ==
"" || ($now - $last_update) >= $cache_period) {
123 $cnt = explode(
":", $act->getAwarenessUserCounter());
126 $act->notifyOnNewOnlineContacts();
135 if ($hcnt > 0 || $cnt > 0) {
153 $f = $this->
ui->factory();
154 $renderer = $this->
ui->renderer();
156 $glyph =
$f->symbol()->glyph()->user(
"#");
158 $glyph = $glyph->withCounter(
$f->counter()->status((
int) $cnt));
161 $glyph = $glyph->withCounter(
$f->counter()->novelty((
int) $hcnt));
163 $glyph_html = $renderer->render($glyph);
164 $tpl->setVariable(
"GLYPH", $glyph_html);
183 $filter =
$_GET[
"filter"];
185 $tpl =
new ilTemplate(
"tpl.awareness_list.html",
true,
true,
"Services/Awareness");
187 include_once(
"./Services/Awareness/classes/class.ilAwarenessAct.php");
189 $act->setRefId($this->ref_id);
191 $ad = $act->getAwarenessData($filter);
195 $cnt = explode(
":", $ad[
"cnt"]);
203 $users = $ad[
"data"];
207 foreach ($users as $u) {
208 if ($u->collector != $last_uc_title) {
209 if ($u->highlighted) {
210 $tpl->touchBlock(
"highlighted");
212 $tpl->setCurrentBlock(
"uc_title");
213 $tpl->setVariable(
"UC_TITLE", $u->collector);
214 $tpl->parseCurrentBlock();
215 $tpl->setCurrentBlock(
"item");
216 $tpl->parseCurrentBlock();
218 $last_uc_title = $u->collector;
223 foreach ($u->actions as $act) {
226 $tpl->touchBlock(
"arrow");
230 if (is_array($act->data) && count($act->data) > 0) {
231 foreach ($act->data as $k => $v) {
232 $tpl->setCurrentBlock(
"f_data");
233 $tpl->setVariable(
"DATA_KEY", $k);
235 $tpl->parseCurrentBlock();
238 $tpl->setCurrentBlock(
"feature");
239 $tpl->setVariable(
"FEATURE_HREF", $act->href);
240 $tpl->setVariable(
"FEATURE_TEXT", $act->text);
241 $tpl->parseCurrentBlock();
245 $tpl->touchBlock(
"uonline");
246 $tpl->setCurrentBlock(
"uonline_text");
247 $tpl->setVariable(
"TXT_ONLINE", $this->lng->txt(
"awrn_online"));
248 $tpl->parseCurrentBlock();
251 $tpl->setCurrentBlock(
"user");
252 if ($u->public_profile) {
253 $tpl->setVariable(
"UNAME", $u->lastname .
", " . $u->firstname);
255 $tpl->setVariable(
"UNAME",
"-");
257 $tpl->setVariable(
"UACCOUNT", $u->login);
259 $tpl->setVariable(
"USERIMAGE", $u->img);
260 $tpl->setVariable(
"CNT", $ucnt);
261 $tpl->parseCurrentBlock();
262 $tpl->setCurrentBlock(
"item");
263 $tpl->parseCurrentBlock();
266 include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
267 $tpl->setCurrentBlock(
"filter");
269 $tpl->setVariable(
"FILTER_INPUT_LABEL", $this->lng->txt(
"awrn_filter"));
270 $tpl->parseCurrentBlock();
275 "cnt" => $ad[
"cnt"]];
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
__construct()
Constructor.
static getInstance($a_user_id)
Get instance (for a user)
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
static getInstance()
Get instance.
getAwarenessList($return=false)
Get awareness list (ajax)
static get($a_var)
Get a value.
static get($a_glyph, $a_text="")
Get glyph html.
static set($a_var, $a_val)
Set a value.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
static getInstance(ilUserActionContext $a_user_action_context, ilGlobalTemplateInterface $a_global_tpl, $a_current_user_id)
Get instance.
getMainMenuHTML()
Get main menu html.
Awareness context for user actions.
executeCommand()
Execute command.