ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilTermsOfServiceAcceptanceHistoryGUI.php
Go to the documentation of this file.
1 <?php declare(strict_types=1);
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,
69  ServerRequestInterface $request,
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() : void
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  {
119  $this,
120  'showAcceptanceHistory',
121  $this->criterionTypeFactory,
122  $this->uiFactory,
123  $this->uiRenderer,
124  $this->tpl
125  );
126  $table->setProvider($this->tableDataProviderFactory->getByContext(ilTermsOfServiceTableDataProviderFactory::CONTEXT_ACCEPTANCE_HISTORY));
127 
128  return $table;
129  }
130 
134  protected function showAcceptanceHistory() : void
135  {
136  $table = $this->getAcceptanceHistoryTable();
137 
138  $table->populate();
139 
140  $this->tpl->setContent($table->getHTML());
141  }
142 
146  protected function applyAcceptanceHistoryFilter() : void
147  {
148  $table = $this->getAcceptanceHistoryTable();
149  $table->resetOffset();
150  $table->writeFilterToSession();
151 
152  $this->showAcceptanceHistory();
153  }
154 
158  protected function resetAcceptanceHistoryFilter() : void
159  {
160  $table = $this->getAcceptanceHistoryTable();
161  $table->resetOffset();
162  $table->resetFilter();
163 
164  $this->showAcceptanceHistory();
165  }
166 
170  protected function addUserAutoComplete() : void
171  {
172  $auto = new ilUserAutoComplete();
173  $auto->setSearchFields(['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.
exit
Definition: login.php:29
class ilRbacSystem system function like checkAccess, addActiveRole ...
const USER_FOLDER_ID
Definition: constants.php:31
Interface ilTermsOfServiceControllerEnabled.
Auto completion class for user lists.
Class ilGlobalPageTemplate.
This is how the factory for UI elements looks.
Definition: Factory.php:17
$query
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
__construct(ilObjTermsOfService $tos, ilTermsOfServiceCriterionTypeFactoryInterface $criterionTypeFactory, ilGlobalPageTemplate $tpl, ilCtrl $ctrl, ilLanguage $lng, ilRbacSystem $rbacsystem, ilErrorHandling $error, ServerRequestInterface $request, Factory $uiFactory, Renderer $uiRenderer, ilTermsOfServiceTableDataProviderFactory $tableDataProviderFactory)
ilTermsOfServiceDocumentGUI constructor.
Class ilObjTermsOfService.
executeCommand()
The implemented class should be ilCtrl enabled and execute or forward the given command.