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"))) {
82 if (!$awrn_set->get(
"awrn_enabled",
false) || ANONYMOUS_USER_ID ==
$ilUser->getId()) {
86 $cache_period = (int) $awrn_set->get(
"caching_period");
91 $GLOBALS[
"tpl"]->addJavascript(
"./Services/Awareness/js/Awareness.js");
92 $this->ctrl->setParameter($this,
"ref_id", $this->ref_id);
93 $GLOBALS[
"tpl"]->addOnloadCode(
"il.Awareness.setBaseUrl('" . $this->ctrl->getLinkTarget(
101 $GLOBALS[
"tpl"]->addOnloadCode(
"il.Awareness.init();");
104 include_once(
"./Services/User/Actions/classes/class.ilUserActionGUI.php");
105 include_once(
"./Services/Awareness/classes/class.ilAwarenessUserActionContext.php");
109 $tpl =
new ilTemplate(
"tpl.awareness.html",
true,
true,
"Services/Awareness");
111 include_once(
"./Services/Awareness/classes/class.ilAwarenessAct.php");
113 $act->setRefId($this->ref_id);
115 if ($last_update ==
"" || ($now - $last_update) >= $cache_period) {
116 $cnt = explode(
":", $act->getAwarenessUserCounter());
119 $act->notifyOnNewOnlineContacts();
128 if ($hcnt > 0 || $cnt > 0) {
146 $f = $this->ui->factory();
147 $renderer = $this->ui->renderer();
149 $glyph = $f->glyph()->user(
"#");
151 $glyph = $glyph->withCounter($f->counter()->status((
int) $cnt));
154 $glyph =$glyph->withCounter($f->counter()->novelty((
int) $hcnt));
156 $glyph_html = $renderer->render($glyph);
157 $tpl->setVariable(
"GLYPH", $glyph_html);
176 $filter =
$_GET[
"filter"];
178 $tpl =
new ilTemplate(
"tpl.awareness_list.html",
true,
true,
"Services/Awareness");
180 include_once(
"./Services/Awareness/classes/class.ilAwarenessAct.php");
182 $act->setRefId($this->ref_id);
184 $ad = $act->getAwarenessData($filter);
188 $cnt = explode(
":", $ad[
"cnt"]);
201 if ($u->collector != $last_uc_title) {
202 if ($u->highlighted) {
203 $tpl->touchBlock(
"highlighted");
205 $tpl->setCurrentBlock(
"uc_title");
206 $tpl->setVariable(
"UC_TITLE", $u->collector);
207 $tpl->parseCurrentBlock();
208 $tpl->setCurrentBlock(
"item");
209 $tpl->parseCurrentBlock();
211 $last_uc_title = $u->collector;
216 foreach ($u->actions as $act) {
219 $tpl->touchBlock(
"arrow");
223 if (is_array($act->data) && count($act->data) > 0) {
224 foreach ($act->data as $k => $v) {
225 $tpl->setCurrentBlock(
"f_data");
226 $tpl->setVariable(
"DATA_KEY", $k);
228 $tpl->parseCurrentBlock();
231 $tpl->setCurrentBlock(
"feature");
232 $tpl->setVariable(
"FEATURE_HREF", $act->href);
233 $tpl->setVariable(
"FEATURE_TEXT", $act->text);
234 $tpl->parseCurrentBlock();
238 $tpl->touchBlock(
"uonline");
239 $tpl->setCurrentBlock(
"uonline_text");
240 $tpl->setVariable(
"TXT_ONLINE", $this->lng->txt(
"awrn_online"));
241 $tpl->parseCurrentBlock();
244 $tpl->setCurrentBlock(
"user");
245 if ($u->public_profile) {
246 $tpl->setVariable(
"UNAME", $u->lastname .
", " . $u->firstname);
248 $tpl->setVariable(
"UNAME",
" ");
250 $tpl->setVariable(
"UACCOUNT", $u->login);
252 $tpl->setVariable(
"USERIMAGE", $u->img);
253 $tpl->setVariable(
"CNT", $ucnt);
254 $tpl->parseCurrentBlock();
255 $tpl->setCurrentBlock(
"item");
256 $tpl->parseCurrentBlock();
259 include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
260 $tpl->setCurrentBlock(
"filter");
262 $tpl->parseCurrentBlock();
264 echo json_encode(
array(
"html" =>
$tpl->get(),
266 "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)
getAwarenessList()
Get awareness list (ajax)
static getInstance()
Get instance.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static get($a_var)
Get a value.
static get($a_glyph, $a_text="")
Get glyph html.
static getInstance(ilUserActionContext $a_user_action_context, ilTemplate $a_global_tpl, $a_current_user_id)
Get instance.
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)
special template class to simplify handling of ITX/PEAR
getMainMenuHTML()
Get main menu html.
Awareness context for user actions.
Create styles array
The data for the language used.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
executeCommand()
Execute command.