ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
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

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

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

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

45  {
46  global $DIC;
47 
48  $this->data_service = $data_service
49  ?? $DIC->awareness()->internal()->data();
50  $domain_service = $domain_service
51  ?? $DIC->awareness()->internal()->domain();
52  $gui_service = $gui_service
53  ?? $DIC->awareness()->internal()->gui();
54  $this->user = $domain_service->user();
55  $this->lng = $domain_service->lng();
56  $this->ui = $gui_service->ui();
57  $this->ctrl = $gui_service->ctrl();
58 
59  $this->lng->loadLanguageModule("awrn");
60  $this->request = $gui_service->standardRequest();
61  $this->main_tpl = $gui_service->mainTemplate();
62 
63  $this->ref_id = $this->request->getRefId();
64  $this->manager = $domain_service->widget(
65  $this->user->getId(),
67  );
68  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilAwarenessGUI::executeCommand ( )

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

References ILIAS\Repository\ctrl().

70  : void
71  {
72  $cmd = $this->ctrl->getCmd();
73 
74  if (in_array($cmd, array("getAwarenessList"))) {
75  $this->$cmd();
76  }
77  }
+ 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 105 of file class.ilAwarenessGUI.php.

References $tpl, exit, ilGlyphGUI\FILTER, ilGlyphGUI\get(), initJS(), ILIAS\Repository\lng(), and ilLegacyFormElementsUtil\prepareFormOutput().

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

◆ initJS()

ilAwarenessGUI::initJS ( )

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

References $GLOBALS, $ilUser, $user, ILIAS\Repository\ctrl(), ilUtil\getImagePath(), and ilUserActionGUI\getInstance().

Referenced by getAwarenessList().

79  : void
80  {
82  // init js
83  $this->main_tpl->addJavaScript("./Services/Awareness/js/Awareness.js");
84  $this->ctrl->setParameter($this, "ref_id", $this->ref_id);
85  $this->main_tpl->addOnLoadCode("il.Awareness.setBaseUrl('" . $this->ctrl->getLinkTarget(
86  $this,
87  "",
88  "",
89  true,
90  false
91  ) . "');");
92  $this->main_tpl->addOnLoadCode("il.Awareness.setLoaderSrc('" . ilUtil::getImagePath("loader.svg") . "');");
93  $this->main_tpl->addOnLoadCode("il.Awareness.init();");
94 
95  // include user action js
97  $ua_gui->init();
98  }
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ilUser
Definition: imgupload.php:34
static getInstance(ilUserActionContext $a_user_action_context, ilGlobalTemplateInterface $a_global_tpl, int $a_current_user_id)
+ 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 36 of file class.ilAwarenessGUI.php.

◆ $data_service

InternalDataService ilAwarenessGUI::$data_service
protected

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

◆ $lng

ilLanguage ilAwarenessGUI::$lng
protected

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

◆ $main_tpl

ilGlobalTemplateInterface ilAwarenessGUI::$main_tpl
protected

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

◆ $manager

WidgetManager ilAwarenessGUI::$manager
protected

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

◆ $ref_id

int ilAwarenessGUI::$ref_id
protected

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

Referenced by __construct().

◆ $request

ILIAS Awareness StandardGUIRequest ilAwarenessGUI::$request
protected

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

◆ $ui

UIServices ilAwarenessGUI::$ui
protected

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

◆ $user

ilObjUser ilAwarenessGUI::$user
protected

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

Referenced by initJS().


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