ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilTermsOfServiceAcceptanceHistoryGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
7 
13 {
16 
18  protected $tos;
19 
21  protected $tpl;
22 
24  protected $ctrl;
25 
27  protected $lng;
28 
30  protected $rbacsystem;
31 
33  protected $error;
34 
36  protected $uiFactory;
37 
39  protected $uiRenderer;
40 
42  protected $request;
43 
46 
61  public function __construct(
65  \ilCtrl $ctrl,
73  ) {
74  $this->tos = $tos;
75  $this->criterionTypeFactory = $criterionTypeFactory;
76  $this->tpl = $tpl;
77  $this->ctrl = $ctrl;
78  $this->lng = $lng;
79  $this->rbacsystem = $rbacsystem;
80  $this->error = $error;
81  $this->request = $request;
82  $this->uiFactory = $uiFactory;
83  $this->uiRenderer = $uiRenderer;
84  $this->tableDataProviderFactory = $tableDataProviderFactory;
85  }
86 
90  public function executeCommand()
91  {
92  $nextClass = $this->ctrl->getNextClass($this);
93  $cmd = $this->ctrl->getCmd();
94 
95  if (
96  !$this->rbacsystem->checkAccess('read', $this->tos->getRefId()) ||
97  !$this->rbacsystem->checkAccess('read', USER_FOLDER_ID)
98  ) {
99  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
100  }
101 
102  switch (strtolower($nextClass)) {
103  default:
104  if ($cmd == '' || !method_exists($this, $cmd)) {
105  $cmd = 'showAcceptanceHistory';
106  }
107  $this->$cmd();
108  break;
109  }
110  }
111 
117  {
118  $table = new \ilTermsOfServiceAcceptanceHistoryTableGUI(
119  $this,
120  'showAcceptanceHistory',
121  $this->criterionTypeFactory,
122  $this->uiFactory,
123  $this->uiRenderer
124  );
125  $table->setProvider($this->tableDataProviderFactory->getByContext(\ilTermsOfServiceTableDataProviderFactory::CONTEXT_ACCEPTANCE_HISTORY));
126 
127  return $table;
128  }
129 
133  protected function showAcceptanceHistory()
134  {
136 
137  $table->populate();
138 
139  $this->tpl->setContent($table->getHTML());
140  }
141 
142 
146  protected function applyAcceptanceHistoryFilter()
147  {
149  $table->resetOffset();
150  $table->writeFilterToSession();
151 
152  $this->showAcceptanceHistory();
153  }
154 
158  protected function resetAcceptanceHistoryFilter()
159  {
161  $table->resetOffset();
162  $table->resetFilter();
163 
164  $this->showAcceptanceHistory();
165  }
166 
170  protected function addUserAutoComplete()
171  {
172  $auto = new \ilUserAutoComplete();
173  $auto->setSearchFields(array('login', 'firstname', 'lastname', 'email'));
174  $auto->enableFieldSearchableCheck(false);
175  $auto->setMoreLinkAvailable(true);
176 
177  $isFetchAllRequest = $this->request->getQueryParams()['fetchall'] ?? false;
178  if ((bool) $isFetchAllRequest) {
179  $auto->setLimit(ilUserAutoComplete::MAX_ENTRIES);
180  }
181 
182  $query = \ilUtil::stripSlashes($this->request->getQueryParams()['term'] ?? '');
183  echo $auto->getList($query);
184  exit();
185  }
186 }
An entity that renders components to a string output.
Definition: Renderer.php:14
This class provides processing control methods.
Representation of an incoming, server-side HTTP request.
class ilRbacSystem system function like checkAccess, addActiveRole ...
Interface ilTermsOfServiceControllerEnabled.
This is how the factory for UI elements looks.
Definition: Factory.php:15
special template class to simplify handling of ITX/PEAR
__construct(\ilObjTermsOfService $tos, \ilTermsOfServiceCriterionTypeFactoryInterface $criterionTypeFactory, \ilTemplate $tpl, \ilCtrl $ctrl, \ilLanguage $lng, \ilRbacSystem $rbacsystem, \ilErrorHandling $error, ServerRequestInterface $request, Factory $uiFactory, Renderer $uiRenderer, ilTermsOfServiceTableDataProviderFactory $tableDataProviderFactory)
ilTermsOfServiceDocumentGUI constructor.
$query
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
exit
Definition: backend.php:16
const USER_FOLDER_ID
Class ilObjUserFolder.
Class ilObjTermsOfService.
language handling
if(empty($password)) $table
Definition: pwgen.php:24
executeCommand()
The implemented class should be enabled and execute or forward the given command.