30 $this->ui =
$DIC->ui();
32 $this->ref_id = (int)
$_GET[
"ref_id"];
33 $this->ctrl =
$DIC->ctrl();
41 $cmd = $this->ctrl->getCmd();
43 if (in_array(
$cmd, array(
"getAwarenessList")))
68 if (!$awrn_set->get(
"awrn_enabled",
false) || ANONYMOUS_USER_ID ==
$ilUser->getId())
73 $cache_period = (int) $awrn_set->get(
"caching_period");
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($this,
81 "",
"",
true,
false).
"');");
83 $GLOBALS[
"tpl"]->addOnloadCode(
"il.Awareness.init();");
85 $tpl =
new ilTemplate(
"tpl.awareness.html",
true,
true,
"Services/Awareness");
87 include_once(
"./Services/Awareness/classes/class.ilAwarenessAct.php");
89 $act->setRefId($this->ref_id);
91 if ($last_update ==
"" || ($now - $last_update) >= $cache_period)
93 $cnt = explode(
":", $act->getAwarenessUserCounter());
96 $act->notifyOnNewOnlineContacts();
107 if ($hcnt > 0 || $cnt > 0)
126 $f = $this->ui->factory();
127 $renderer = $this->ui->renderer();
129 $glyph = $f->glyph()->user(
"#");
132 $glyph = $glyph->withCounter($f->counter()->status((
int) $cnt));
136 $glyph =$glyph->withCounter($f->counter()->novelty((
int) $hcnt));
138 $glyph_html = $renderer->render($glyph);
139 $tpl->setVariable(
"GLYPH", $glyph_html);
158 $filter =
$_GET[
"filter"];
160 $tpl =
new ilTemplate(
"tpl.awareness_list.html",
true,
true,
"Services/Awareness");
162 include_once(
"./Services/Awareness/classes/class.ilAwarenessAct.php");
164 $act->setRefId($this->ref_id);
166 $ad = $act->getAwarenessData($filter);
170 $cnt = explode(
":",$ad[
"cnt"]);
178 $users = $ad[
"data"];
182 foreach ($users as $u)
184 if ($u->collector != $last_uc_title)
188 $tpl->touchBlock(
"highlighted");
190 $tpl->setCurrentBlock(
"uc_title");
191 $tpl->setVariable(
"UC_TITLE", $u->collector);
192 $tpl->parseCurrentBlock();
193 $tpl->setCurrentBlock(
"item");
194 $tpl->parseCurrentBlock();
196 $last_uc_title = $u->collector;
201 foreach ($u->actions as $act)
206 $tpl->touchBlock(
"arrow");
210 if (is_array($act->data) && count($act->data) > 0)
212 foreach ($act->data as $k => $v)
214 $tpl->setCurrentBlock(
"f_data");
215 $tpl->setVariable(
"DATA_KEY", $k);
217 $tpl->parseCurrentBlock();
220 $tpl->setCurrentBlock(
"feature");
221 $tpl->setVariable(
"FEATURE_HREF", $act->href);
222 $tpl->setVariable(
"FEATURE_TEXT", $act->text);
223 $tpl->parseCurrentBlock();
228 $tpl->touchBlock(
"uonline");
231 $tpl->setCurrentBlock(
"user");
232 if ($u->public_profile)
234 $tpl->setVariable(
"UNAME", $u->lastname.
", ".$u->firstname);
238 $tpl->setVariable(
"UNAME",
" ");
240 $tpl->setVariable(
"UACCOUNT", $u->login);
242 $tpl->setVariable(
"USERIMAGE", $u->img);
243 $tpl->setVariable(
"CNT", $ucnt);
244 $tpl->parseCurrentBlock();
245 $tpl->setCurrentBlock(
"item");
246 $tpl->parseCurrentBlock();
249 include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
250 $tpl->setCurrentBlock(
"filter");
253 $tpl->parseCurrentBlock();
255 echo json_encode(array(
"html" =>
$tpl->get(),
256 "cnt" => $ad[
"cnt"]));
An exception for terminatinating execution or to throw for unit testing.
static getInstance($a_user_id)
Get instance (for a user)
static getInstance()
Get instance.
executeCommand()
Execute command.
getMainMenuHTML()
Get main menu html.
__construct()
Constructor.
getAwarenessList()
Get awareness list (ajax)
static get($a_glyph, $a_text="")
Get glyph html.
static set($a_var, $a_val)
Set a value.
static get($a_var)
Get a value.
special template class to simplify handling of ITX/PEAR
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
$GLOBALS['loaded']
Global hash that tracks already loaded includes.