ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
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 119 of file class.ilAwarenessGUI.php.

119 : ?array
120 {
121 $filter = $this->request->getFilter();
122
123 $tpl = new ilTemplate("tpl.awareness_list.html", true, true, "components/ILIAS/Awareness");
124
125 $ad = $this->manager->getListData($filter);
126
127 $users = $ad["data"];
128
129 $ucnt = 0;
130 $last_uc_title = "";
131 foreach ($users as $u) {
132 if ($u->collector != $last_uc_title) {
133 if ($u->highlighted) {
134 $tpl->touchBlock("highlighted");
135 }
136 $tpl->setCurrentBlock("uc_title");
137 $tpl->setVariable("UC_TITLE", $u->collector);
138 $tpl->parseCurrentBlock();
139 $tpl->setCurrentBlock("item");
140 $tpl->parseCurrentBlock();
141 }
142 $last_uc_title = $u->collector;
143
144 $ucnt++;
145
146 $fcnt = 0;
147 foreach ($u->actions as $act) {
148 $fcnt++;
149 if ($fcnt == 1) {
150 $tpl->touchBlock("arrow");
151 //$tpl->setCurrentBlock("arrow");
152 //$tpl->parseCurrentBlock();
153 }
154 if (is_array($act->data) && count($act->data) > 0) {
155 foreach ($act->data as $k => $v) {
156 $tpl->setCurrentBlock("f_data");
157 $tpl->setVariable("DATA_KEY", $k);
158 $tpl->setVariable("DATA_VAL", ilLegacyFormElementsUtil::prepareFormOutput($v));
159 $tpl->parseCurrentBlock();
160 }
161 }
162 $tpl->setCurrentBlock("feature");
163 $tpl->setVariable("FEATURE_HREF", $act->href);
164 $tpl->setVariable("FEATURE_TEXT", $act->text);
165 $tpl->parseCurrentBlock();
166 }
167
168 if ($u->online) {
169 $tpl->touchBlock("uonline");
170 $tpl->setCurrentBlock("uonline_text");
171 $tpl->setVariable("TXT_ONLINE", $this->lng->txt("awrn_online"));
172 $tpl->parseCurrentBlock();
173 }
174
175 $tpl->setCurrentBlock("user");
176 if ($u->public_profile) {
177 $tpl->setVariable("UNAME", $u->lastname . ", " . $u->firstname);
178 } else {
179 $tpl->setVariable("UNAME", "-");
180 }
181 $tpl->setVariable("UACCOUNT", $u->login);
182
183 $tpl->setVariable("USERIMAGE", $u->img);
184 $tpl->setVariable("CNT", $ucnt);
185 $tpl->parseCurrentBlock();
186 $tpl->setCurrentBlock("item");
187 $tpl->parseCurrentBlock();
188 }
189
190 $tpl->setCurrentBlock("filter");
191 $tpl->setVariable("GL_FILTER", $this->gui->symbol()->glyph("filter")->render());
192 $tpl->setVariable("FILTER_INPUT_LABEL", $this->lng->txt("awrn_filter"));
193 $tpl->parseCurrentBlock();
194
195
196 $result = ["html" => $tpl->get(),
197 "filter_val" => ilLegacyFormElementsUtil::prepareFormOutput($filter),
198 "cnt" => $ad["cnt"]];
199
200 if ($return) {
201 $this->initJS();
202 return $result;
203 }
204
205 echo json_encode($result, JSON_THROW_ON_ERROR);
206 exit;
207 }
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 $debug = false;
95 if ($debug) {
96 $this->main_tpl->addJavaScript("../components/ILIAS/Awareness/resources/Awareness.js");
97 } else {
98 $this->main_tpl->addJavaScript("./assets/js/Awareness.js");
99 }
100 $this->ctrl->setParameter($this, "ref_id", $this->ref_id);
101 $this->main_tpl->addOnLoadCode("il.Awareness.setBaseUrl('" . $this->ctrl->getLinkTarget(
102 $this,
103 "",
104 "",
105 true,
106 false
107 ) . "');");
108 $this->main_tpl->addOnLoadCode("il.Awareness.setLoaderSrc('" . ilUtil::getImagePath("media/loader.svg") . "');");
109 $this->main_tpl->addOnLoadCode("il.Awareness.init();");
110
111 $this->user_action_gui->init();
112 }
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 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.

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