ILIAS  release_8 Revision v8.23
ilEmployeeTalkMyStaffUserGUI Class Reference

Class ilEmployeeTalkMyStaffUserGUI. More...

+ Inheritance diagram for ilEmployeeTalkMyStaffUserGUI:
+ Collaboration diagram for ilEmployeeTalkMyStaffUserGUI:

Public Member Functions

 __construct (ilMyStaffAccess $access, ilCtrl $ctrl, ilLanguage $language, RequestInterface $request, ilGlobalTemplateInterface $template, ilTabsGUI $tabs, EmployeeTalkRepository $repository, UIServices $ui, ilObjEmployeeTalkAccess $employeeTalkAccess, ilObjUser $currentUser)
 ilEmployeeTalkMyStaffUserGUI constructor. More...
 
 executeCommand ()
 

Private Member Functions

 checkAccessOrFail ()
 
 applyFilter ()
 
 resetFilter ()
 
 view ()
 
 loadActionBar ()
 

Private Attributes

int $usrId
 
ilMyStaffAccess $access
 
ilCtrl $ctrl
 
ilLanguage $language
 
RequestInterface $request
 
ilGlobalTemplateInterface $template
 
ilTabsGUI $tabs
 
EmployeeTalkRepository $repository
 
UIServices $ui
 
ilObjEmployeeTalkAccess $talkAccess
 
ilObjUser $currentUser
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilEmployeeTalkMyStaffUserGUI::__construct ( ilMyStaffAccess  $access,
ilCtrl  $ctrl,
ilLanguage  $language,
RequestInterface  $request,
ilGlobalTemplateInterface  $template,
ilTabsGUI  $tabs,
EmployeeTalkRepository  $repository,
UIServices  $ui,
ilObjEmployeeTalkAccess  $employeeTalkAccess,
ilObjUser  $currentUser 
)

ilEmployeeTalkMyStaffUserGUI constructor.

Parameters
ilMyStaffAccess$access
ilCtrl$ctrl
ilLanguage$language
RequestInterface$request
ilGlobalTemplateInterface$template
ilTabsGUI$tabs
EmployeeTalkRepository$repository
UIServices$ui

Definition at line 63 of file class.ilEmployeeTalkMyStaffUserGUI.php.

References $access, $ctrl, $currentUser, $language, $repository, $request, $tabs, $template, $ui, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\UI\examples\Symbol\Glyph\Language\language(), ILIAS\UI\examples\Deck\repository(), ILIAS\Repository\tabs(), and ILIAS\Repository\ui().

74  {
75  $this->access = $access;
76  $this->ctrl = $ctrl;
77  $this->language = $language;
78  $this->request = $request;
79  $this->template = $template;
80  $this->tabs = $tabs;
81  $this->repository = $repository;
82  $this->ui = $ui;
83  $this->talkAccess = $employeeTalkAccess;
84  $this->currentUser = $currentUser;
85 
86  $this->usrId = intval($this->request->getQueryParams()['usr_id']);
87  $this->ctrl->setParameter($this, 'usr_id', $this->usrId);
88  $this->language->loadLanguageModule('etal');
89  }
+ Here is the call graph for this function:

Member Function Documentation

◆ applyFilter()

ilEmployeeTalkMyStaffUserGUI::applyFilter ( )
private

Definition at line 158 of file class.ilEmployeeTalkMyStaffUserGUI.php.

References view().

Referenced by executeCommand().

158  : void
159  {
160  $table = new ilEmployeeTalkTableGUI($this, ControlFlowCommand::APPLY_FILTER);
161  $table->writeFilterToSession();
162  $table->resetOffset();
163  $this->view();
164  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkAccessOrFail()

ilEmployeeTalkMyStaffUserGUI::checkAccessOrFail ( )
private

Definition at line 94 of file class.ilEmployeeTalkMyStaffUserGUI.php.

References ILIAS\Repository\access(), ILIAS\Repository\ctrl(), and ILIAS\UI\examples\Symbol\Glyph\Language\language().

Referenced by executeCommand().

94  : void
95  {
96  if (!$this->usrId) {
97  $this->template->setOnScreenMessage('failure', $this->language->txt("permission_denied"), true);
98  $this->ctrl->redirectByClass(ilDashboardGUI::class, "");
99  }
100 
101  if (!$this->access->hasCurrentUserAccessToTalks() || !$this->access->hasCurrentUserAccessToUser($this->usrId)) {
102  $this->template->setOnScreenMessage('failure', $this->language->txt("permission_denied"), true);
103  $this->ctrl->redirectByClass(ilDashboardGUI::class, "");
104  }
105  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilEmployeeTalkMyStaffUserGUI::executeCommand ( )

Implements ILIAS\EmployeeTalk\UI\ControlFlowCommandHandler.

Definition at line 111 of file class.ilEmployeeTalkMyStaffUserGUI.php.

References applyFilter(), checkAccessOrFail(), ILIAS\Repository\ctrl(), resetFilter(), and view().

111  : void
112  {
113  $this->checkAccessOrFail();
114 
115  $cmd = $this->ctrl->getCmd();
116  $nextClass = $this->ctrl->getNextClass();
117 
118  switch ($nextClass) {
119  case strtolower(ilObjEmployeeTalkGUI::class):
120  $gui = new ilObjEmployeeTalkGUI();
121  $this->ctrl->redirect($gui, ControlFlowCommand::INDEX);
122  break;
123  case strtolower(ilFormPropertyDispatchGUI::class):
124  $this->ctrl->setReturn($this, ControlFlowCommand::INDEX);
125  $table = new ilEmployeeTalkTableGUI($this, ControlFlowCommand::INDEX);
126  $table->executeCommand();
127  break;
128  case strtolower(ilObjEmployeeTalkSeriesGUI::class):
129  $gui = new ilObjEmployeeTalkSeriesGUI();
130  $this->ctrl->saveParameter($gui, 'template');
131  $this->ctrl->saveParameter($gui, 'new_type');
132  $this->ctrl->saveParameter($gui, 'usr_id');
133  $this->ctrl->redirectByClass([
134  strtolower(ilDashboardGUI::class),
135  strtolower(ilMyStaffGUI::class),
136  strtolower(ilEmployeeTalkMyStaffListGUI::class),
137  strtolower(ilObjEmployeeTalkSeriesGUI::class)
138  ], $cmd);
139  break;
140  default:
141  switch ($cmd) {
142  case ControlFlowCommand::INDEX:
143  $this->view();
144  break;
145  case ControlFlowCommand::APPLY_FILTER:
146  $this->applyFilter();
147  break;
148  case ControlFlowCommand::RESET_FILTER:
149  $this->resetFilter();
150  break;
151  default:
152  $this->ctrl->redirectByClass(ilDashboardGUI::class, "");
153  break;
154  }
155  }
156  }
Class ilObjEmployeeTalkGUI.
+ Here is the call graph for this function:

◆ loadActionBar()

ilEmployeeTalkMyStaffUserGUI::loadActionBar ( )
private

Definition at line 191 of file class.ilEmployeeTalkMyStaffUserGUI.php.

References $path, $refId, $type, $url, $usrId, ilObject\_getAllReferences(), ilObject\_getIcon(), ilObject\_getObjectsByType(), ilObject\_hasUntrashedReference(), ILIAS\Repository\ctrl(), ilHelp\getObjCreationTooltipText(), ilObjTalkTemplateAdministration\getRootRefId(), ilUtil\img(), ILIAS\UI\examples\Symbol\Glyph\Language\language(), ilAdvancedSelectionListGUI\STYLE_EMPH, ilObjEmployeeTalkSeries\TYPE, and ILIAS\Repository\ui().

Referenced by view().

191  : void
192  {
193  $gl = new ilGroupedListGUI();
194  $gl->setAsDropDown(true, false);
195 
196  $templates = new CallbackFilterIterator(
198  function (array $item) {
199  return
200  (
201  $item['offline'] === "0" ||
202  $item['offline'] === null
203  ) && ilObjTalkTemplate::_hasUntrashedReference(intval($item['obj_id']));
204  }
205  );
206 
207  foreach ($templates as $item) {
208  $type = $item["type"];
209 
210  $path = ilObject::_getIcon(0, 'tiny', $type);
211  $icon = ($path != "")
212  ? ilUtil::img($path, "") . " "
213  : "";
214 
215  $this->ctrl->setParameterByClass(
216  ilObjEmployeeTalkSeriesGUI::class,
217  "new_type",
219  );
220  $url = $this->ctrl->getLinkTargetByClass(strtolower(ilObjEmployeeTalkSeriesGUI::class), ControlFlowCommand::CREATE);
221  //$url = $this->ctrl->appendRequestTokenParameterString($base_url . "&new_type=" . ilObjEmployeeTalkSeries::TYPE);
222  $refId = ilObject::_getAllReferences(intval($item['obj_id']));
223 
224  // Templates only have one ref id
225  $url .= "&template=" . array_pop($refId);
227  $url .= '&usr_id=' . $this->usrId;
228 
229  $ttip = ilHelp::getObjCreationTooltipText("tals");
230 
231  $gl->addEntry(
232  $icon . $item["title"],
233  $url,
234  "_top",
235  "",
236  "",
237  $type,
238  $ttip,
239  "bottom center",
240  "top center",
241  false
242  );
243  }
244 
245  $adv = new ilAdvancedSelectionListGUI();
246  $adv->setListTitle($this->language->txt("etal_add_new_item"));
247  //$gl->getHTML();
248  $adv->setGroupedList($gl);
250  //$this->toolbar->addDropDown($this->language->txt("cntr_add_new_item"), $adv->getHTML());
251  $this->ui->mainTemplate()->setVariable("SELECT_OBJTYPE_REPOS", $adv->getHTML());
252  }
static getObjCreationTooltipText(string $a_type)
Get object_creation tooltip tab text.
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
$type
static _getAllReferences(int $id)
get all reference ids for object ID
static _hasUntrashedReference(int $obj_id)
checks whether an object has at least one reference that is not in trash
$refId
Definition: xapitoken.php:58
static _getObjectsByType(string $obj_type="", int $owner=null)
static img(string $a_src, ?string $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
$path
Definition: ltiservices.php:32
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$url
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetFilter()

ilEmployeeTalkMyStaffUserGUI::resetFilter ( )
private

Definition at line 167 of file class.ilEmployeeTalkMyStaffUserGUI.php.

References view().

Referenced by executeCommand().

167  : void
168  {
169  $table = new ilEmployeeTalkTableGUI($this, ControlFlowCommand::RESET_FILTER);
170  $table->resetOffset();
171  $table->resetFilter();
172  $this->view();
173  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ view()

ilEmployeeTalkMyStaffUserGUI::view ( )
private

Definition at line 175 of file class.ilEmployeeTalkMyStaffUserGUI.php.

References loadActionBar(), and ILIAS\UI\examples\Deck\repository().

Referenced by applyFilter(), executeCommand(), and resetFilter().

175  : void
176  {
177  $this->loadActionBar();
178  $table = new ilEmployeeTalkTableGUI($this, ControlFlowCommand::INDEX);
179  $userId = intval($this->usrId);
180 
181  $talks = null;
182  if ($this->talkAccess->hasPermissionToReadUnownedTalksOfUser($userId)) {
183  $talks = $this->repository->findByEmployee($userId);
184  } else {
185  $talks = $this->repository->findTalksBetweenEmployeeAndOwner($userId, $this->currentUser->getId());
186  }
187  $table->setTalkData($talks);
188  $this->template->setContent($table->getHTML());
189  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilMyStaffAccess ilEmployeeTalkMyStaffUserGUI::$access
private

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

Referenced by __construct().

◆ $ctrl

ilCtrl ilEmployeeTalkMyStaffUserGUI::$ctrl
private

Definition at line 42 of file class.ilEmployeeTalkMyStaffUserGUI.php.

Referenced by __construct().

◆ $currentUser

ilObjUser ilEmployeeTalkMyStaffUserGUI::$currentUser
private

Definition at line 50 of file class.ilEmployeeTalkMyStaffUserGUI.php.

Referenced by __construct().

◆ $language

ilLanguage ilEmployeeTalkMyStaffUserGUI::$language
private

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

Referenced by __construct().

◆ $repository

EmployeeTalkRepository ilEmployeeTalkMyStaffUserGUI::$repository
private

Definition at line 47 of file class.ilEmployeeTalkMyStaffUserGUI.php.

Referenced by __construct().

◆ $request

RequestInterface ilEmployeeTalkMyStaffUserGUI::$request
private

Definition at line 44 of file class.ilEmployeeTalkMyStaffUserGUI.php.

Referenced by __construct().

◆ $tabs

ilTabsGUI ilEmployeeTalkMyStaffUserGUI::$tabs
private

Definition at line 46 of file class.ilEmployeeTalkMyStaffUserGUI.php.

Referenced by __construct().

◆ $talkAccess

ilObjEmployeeTalkAccess ilEmployeeTalkMyStaffUserGUI::$talkAccess
private

Definition at line 49 of file class.ilEmployeeTalkMyStaffUserGUI.php.

◆ $template

ilGlobalTemplateInterface ilEmployeeTalkMyStaffUserGUI::$template
private

Definition at line 45 of file class.ilEmployeeTalkMyStaffUserGUI.php.

Referenced by __construct().

◆ $ui

UIServices ilEmployeeTalkMyStaffUserGUI::$ui
private

Definition at line 48 of file class.ilEmployeeTalkMyStaffUserGUI.php.

Referenced by __construct().

◆ $usrId

int ilEmployeeTalkMyStaffUserGUI::$usrId
private

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

Referenced by loadActionBar().


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