ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilAwarenessGUI Class Reference

Awareness GUI class. More...

+ Inheritance diagram for ilAwarenessGUI:
+ Collaboration diagram for ilAwarenessGUI:

Public Member Functions

 __construct (InternalDataService $data_service=null, InternalDomainService $domain_service=null, InternalGUIService $gui_service=null)
 
 executeCommand ()
 
 initJS ()
 
 getAwarenessList (bool $return=false)
 Get awareness list (ajax) More...
 

Protected Attributes

InternalGUIService $gui
 
ilGlobalTemplateInterface $main_tpl
 
int $ref_id
 
ILIAS Awareness StandardGUIRequest $request
 
WidgetManager $manager
 
ilObjUser $user
 
ilCtrl $ctrl
 
UIServices $ui
 
ilLanguage $lng
 
InternalDataService $data_service
 
ilUserActionGUI $user_action_gui
 

Detailed Description

Awareness GUI class.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Constructor & Destructor Documentation

◆ __construct()

ilAwarenessGUI::__construct ( InternalDataService  $data_service = null,
InternalDomainService  $domain_service = null,
InternalGUIService  $gui_service = null 
)

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

References $DIC, $lng, $ref_id, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\ui(), and ILIAS\Repository\user().

47  {
48  global $DIC;
49 
50  $this->data_service = $data_service
51  ?? $DIC->awareness()->internal()->data();
52  $domain_service = $domain_service
53  ?? $DIC->awareness()->internal()->domain();
54  $gui_service = $gui_service
55  ?? $DIC->awareness()->internal()->gui();
56  $this->user = $domain_service->user();
57  $this->lng = $domain_service->lng();
58  $this->ui = $gui_service->ui();
59  $this->ctrl = $gui_service->ctrl();
60 
61  $this->lng->loadLanguageModule("awrn");
62  $this->request = $gui_service->standardRequest();
63  $this->main_tpl = $gui_service->mainTemplate();
64 
65  $this->ref_id = $this->request->getRefId();
66  $this->manager = $domain_service->widget(
67  $this->user->getId(),
69  );
70  $this->gui = $DIC->awareness()->internal()->gui();
71  $this->user_action_gui = new ilUserActionGUI(
74  $DIC['tpl'],
75  $this->ui->factory(),
76  $this->ui->renderer(),
77  $this->lng,
78  $DIC['ilDB'],
79  $this->user->getId()
80  );
81  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
A class that provides a collection of actions on users.
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilAwarenessGUI::executeCommand ( )

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

References ILIAS\Repository\ctrl().

83  : void
84  {
85  $cmd = $this->ctrl->getCmd();
86 
87  if (in_array($cmd, array("getAwarenessList"))) {
88  $this->$cmd();
89  }
90  }
+ Here is the call graph for this function:

◆ getAwarenessList()

ilAwarenessGUI::getAwarenessList ( bool  $return = false)

Get awareness list (ajax)

Returns
?array<string,string>
Exceptions
ilWACException

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

References exit, initJS(), ILIAS\Repository\lng(), and ilLegacyFormElementsUtil\prepareFormOutput().

116  : ?array
117  {
118  $filter = $this->request->getFilter();
119 
120  $tpl = new ilTemplate("tpl.awareness_list.html", true, true, "Services/Awareness");
121 
122  $ad = $this->manager->getListData($filter);
123 
124  $users = $ad["data"];
125 
126  $ucnt = 0;
127  $last_uc_title = "";
128  foreach ($users as $u) {
129  if ($u->collector != $last_uc_title) {
130  if ($u->highlighted) {
131  $tpl->touchBlock("highlighted");
132  }
133  $tpl->setCurrentBlock("uc_title");
134  $tpl->setVariable("UC_TITLE", $u->collector);
135  $tpl->parseCurrentBlock();
136  $tpl->setCurrentBlock("item");
137  $tpl->parseCurrentBlock();
138  }
139  $last_uc_title = $u->collector;
140 
141  $ucnt++;
142 
143  $fcnt = 0;
144  foreach ($u->actions as $act) {
145  $fcnt++;
146  if ($fcnt == 1) {
147  $tpl->touchBlock("arrow");
148  //$tpl->setCurrentBlock("arrow");
149  //$tpl->parseCurrentBlock();
150  }
151  if (is_array($act->data) && count($act->data) > 0) {
152  foreach ($act->data as $k => $v) {
153  $tpl->setCurrentBlock("f_data");
154  $tpl->setVariable("DATA_KEY", $k);
155  $tpl->setVariable("DATA_VAL", ilLegacyFormElementsUtil::prepareFormOutput($v));
156  $tpl->parseCurrentBlock();
157  }
158  }
159  $tpl->setCurrentBlock("feature");
160  $tpl->setVariable("FEATURE_HREF", $act->href);
161  $tpl->setVariable("FEATURE_TEXT", $act->text);
162  $tpl->parseCurrentBlock();
163  }
164 
165  if ($u->online) {
166  $tpl->touchBlock("uonline");
167  $tpl->setCurrentBlock("uonline_text");
168  $tpl->setVariable("TXT_ONLINE", $this->lng->txt("awrn_online"));
169  $tpl->parseCurrentBlock();
170  }
171 
172  $tpl->setCurrentBlock("user");
173  if ($u->public_profile) {
174  $tpl->setVariable("UNAME", $u->lastname . ", " . $u->firstname);
175  } else {
176  $tpl->setVariable("UNAME", "-");
177  }
178  $tpl->setVariable("UACCOUNT", $u->login);
179 
180  $tpl->setVariable("USERIMAGE", $u->img);
181  $tpl->setVariable("CNT", $ucnt);
182  $tpl->parseCurrentBlock();
183  $tpl->setCurrentBlock("item");
184  $tpl->parseCurrentBlock();
185  }
186 
187  $tpl->setCurrentBlock("filter");
188  $tpl->setVariable("GL_FILTER", $this->gui->symbol()->glyph("filter")->render());
189  $tpl->setVariable("FILTER_INPUT_LABEL", $this->lng->txt("awrn_filter"));
190  $tpl->parseCurrentBlock();
191 
192 
193  $result = ["html" => $tpl->get(),
194  "filter_val" => ilLegacyFormElementsUtil::prepareFormOutput($filter),
195  "cnt" => $ad["cnt"]];
196 
197  if ($return) {
198  $this->initJS();
199  return $result;
200  }
201 
202  echo json_encode($result, JSON_THROW_ON_ERROR);
203  exit;
204  }
exit
Definition: login.php:29
static prepareFormOutput($a_str, bool $a_strip=false)
+ Here is the call graph for this function:

◆ initJS()

ilAwarenessGUI::initJS ( )

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

References $user, ILIAS\Repository\ctrl(), and ilUtil\getImagePath().

Referenced by getAwarenessList().

92  : void
93  {
94  $ilUser = $this->user;
95  // init js
96  $this->main_tpl->addJavaScript("./Services/Awareness/js/Awareness.js");
97  $this->ctrl->setParameter($this, "ref_id", $this->ref_id);
98  $this->main_tpl->addOnLoadCode("il.Awareness.setBaseUrl('" . $this->ctrl->getLinkTarget(
99  $this,
100  "",
101  "",
102  true,
103  false
104  ) . "');");
105  $this->main_tpl->addOnLoadCode("il.Awareness.setLoaderSrc('" . ilUtil::getImagePath("media/loader.svg") . "');");
106  $this->main_tpl->addOnLoadCode("il.Awareness.init();");
107 
108  $this->user_action_gui->init();
109  }
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ilAwarenessGUI::$ctrl
protected

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

◆ $data_service

InternalDataService ilAwarenessGUI::$data_service
protected

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

◆ $gui

InternalGUIService ilAwarenessGUI::$gui
protected

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

◆ $lng

ilLanguage ilAwarenessGUI::$lng
protected

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

Referenced by __construct().

◆ $main_tpl

ilGlobalTemplateInterface ilAwarenessGUI::$main_tpl
protected

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

◆ $manager

WidgetManager ilAwarenessGUI::$manager
protected

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

◆ $ref_id

int ilAwarenessGUI::$ref_id
protected

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

Referenced by __construct().

◆ $request

ILIAS Awareness StandardGUIRequest ilAwarenessGUI::$request
protected

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

◆ $ui

UIServices ilAwarenessGUI::$ui
protected

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

◆ $user

ilObjUser ilAwarenessGUI::$user
protected

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

Referenced by initJS().

◆ $user_action_gui

ilUserActionGUI ilAwarenessGUI::$user_action_gui
protected

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


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