ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilTermsOfServiceAcceptanceHistoryGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
26 
32 {
37  protected ilLanguage $lng;
40  protected Factory $uiFactory;
41  protected Renderer $uiRenderer;
43  protected \ILIAS\Refinery\Factory $refinery;
45 
46  public function __construct(
50  ilCtrlInterface $ctrl,
51  ilLanguage $lng,
52  ilRbacSystem $rbacsystem,
53  ilErrorHandling $error,
54  GlobalHttpState $http,
55  \ILIAS\Refinery\Factory $refinery,
56  Factory $uiFactory,
57  Renderer $uiRenderer,
58  ilTermsOfServiceTableDataProviderFactory $tableDataProviderFactory
59  ) {
60  $this->tos = $tos;
61  $this->criterionTypeFactory = $criterionTypeFactory;
62  $this->tpl = $tpl;
63  $this->ctrl = $ctrl;
64  $this->lng = $lng;
65  $this->rbacsystem = $rbacsystem;
66  $this->error = $error;
67  $this->http = $http;
68  $this->refinery = $refinery;
69  $this->uiFactory = $uiFactory;
70  $this->uiRenderer = $uiRenderer;
71  $this->tableDataProviderFactory = $tableDataProviderFactory;
72  }
73 
74  public function executeCommand(): void
75  {
76  $nextClass = $this->ctrl->getNextClass($this);
77  $cmd = $this->ctrl->getCmd();
78 
79  if (
80  (defined('USER_FOLDER_ID') && !$this->rbacsystem->checkAccess('read', USER_FOLDER_ID)) ||
81  !$this->rbacsystem->checkAccess('read', $this->tos->getRefId())
82  ) {
83  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
84  }
85 
86  switch (strtolower($nextClass)) {
87  default:
88  if ($cmd === null || $cmd === '' || !method_exists($this, $cmd)) {
89  $cmd = 'showAcceptanceHistory';
90  }
91  $this->$cmd();
92  break;
93  }
94  }
95 
97  {
99  $this,
100  'showAcceptanceHistory',
101  $this->criterionTypeFactory,
102  $this->uiFactory,
103  $this->uiRenderer,
104  $this->tpl
105  );
106  $table->setProvider($this->tableDataProviderFactory->getByContext(ilTermsOfServiceTableDataProviderFactory::CONTEXT_ACCEPTANCE_HISTORY));
107 
108  return $table;
109  }
110 
111  protected function showAcceptanceHistory(): void
112  {
113  $table = $this->getAcceptanceHistoryTable();
114 
115  $table->populate();
116 
117  $this->tpl->setContent($table->getHTML());
118  }
119 
120  protected function applyAcceptanceHistoryFilter(): void
121  {
122  $table = $this->getAcceptanceHistoryTable();
123  $table->resetOffset();
124  $table->writeFilterToSession();
125 
126  $this->showAcceptanceHistory();
127  }
128 
129  protected function resetAcceptanceHistoryFilter(): void
130  {
131  $table = $this->getAcceptanceHistoryTable();
132  $table->resetOffset();
133  $table->resetFilter();
134 
135  $this->showAcceptanceHistory();
136  }
137 
138  protected function addUserAutoComplete(): void
139  {
140  $auto = new ilUserAutoComplete();
141  $auto->setSearchFields(['login', 'firstname', 'lastname', 'email']);
142  $auto->enableFieldSearchableCheck(false);
143  $auto->setMoreLinkAvailable(true);
144 
145  if ($this->http->wrapper()->query()->has('fetchall')) {
146  $auto->setLimit(ilUserAutoComplete::MAX_ENTRIES);
147  }
148 
149  if ($this->http->wrapper()->query()->has('term')) {
151  $this->http->wrapper()->query()->retrieve('term', $this->refinery->kindlyTo()->string())
152  );
153  $this->http->saveResponse(
154  $this->http->response()
155  ->withHeader(ResponseHeader::CONTENT_TYPE, 'application/json')
156  ->withBody(
157  Streams::ofString($auto->getList($query))
158  )
159  );
160  }
161 
162  $this->http->sendResponse();
163  $this->http->close();
164  }
165 }
Interface GlobalHttpState.
An entity that renders components to a string output.
Definition: Renderer.php:30
const USER_FOLDER_ID
Definition: constants.php:33
Class ChatMainBarProvider .
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
Interface ilTermsOfServiceControllerEnabled.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilTermsOfServiceTableDataProviderFactory $tableDataProviderFactory
static http()
Fetches the global http state from ILIAS.
ilTermsOfServiceCriterionTypeFactoryInterface $criterionTypeFactory
$query
Error Handling & global info handling uses PEAR error class.
Class ilObjTermsOfService.
__construct(ilObjTermsOfService $tos, ilTermsOfServiceCriterionTypeFactoryInterface $criterionTypeFactory, ilGlobalTemplateInterface $tpl, ilCtrlInterface $ctrl, ilLanguage $lng, ilRbacSystem $rbacsystem, ilErrorHandling $error, GlobalHttpState $http, \ILIAS\Refinery\Factory $refinery, Factory $uiFactory, Renderer $uiRenderer, ilTermsOfServiceTableDataProviderFactory $tableDataProviderFactory)
executeCommand()
The implemented class should be ilCtrlInterface enabled and execute or forward the given command...