ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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.

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(),
68 $this->ref_id
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 }
InternalDataService $data_service
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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: shib_login.php:26

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

+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilAwarenessGUI::executeCommand ( )

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

83 : void
84 {
85 $cmd = $this->ctrl->getCmd();
86
87 if (in_array($cmd, array("getAwarenessList"))) {
88 $this->$cmd();
89 }
90 }

References ILIAS\Repository\ctrl().

+ 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 117 of file class.ilAwarenessGUI.php.

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

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

+ Here is the call graph for this function:

◆ initJS()

ilAwarenessGUI::initJS ( )

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

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

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

Referenced by getAwarenessList().

+ 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.

Referenced by __construct().

◆ $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.

◆ $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.

◆ $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: