19 declare(strict_types=1);
54 $this->container =
$DIC;
55 $config =
new Config($DIC[
'legalDocuments']->provide(Consumer::ID));
56 if ($this->rbac_system->checkAccess(
'write', $this->object->getRefId())) {
57 $config = $config->allowEditing();
63 $this->
ui =
new UI($this->
getType(), $this->container->ui(), $this->container->language());
76 $this->container->language()->loadLanguageModule(
'dpro');
77 $this->container->language()->loadLanguageModule(
'ldoc');
79 $next_class = $this->
ctrl->getNextClass($this);
80 $cmd = $this->
ctrl->getCmd(
'settings');
82 switch (strtolower($next_class)) {
83 case strtolower(ilLegalDocumentsAdministrationGUI::class):
84 if ($cmd ===
'documents') {
87 $this->
ctrl->forwardCommand($this->legal_documents);
89 case strtolower(ilPermissionGUI::class):
90 $this->tabs_gui->activateTab(
'permissions');
96 $this->
ctrl->redirectByClass(ilLegalDocumentsAdministrationGUI::class,
'documents');
100 if (!$reflection->hasMethod($cmd) || !$reflection->getMethod($cmd)->isPublic()) {
101 throw new Exception(
'Undefined command.');
115 $this->container->tabs()->activateTab(
'settings');
119 if ($this->data_protection_settings->enabled()->value() && $this->config->legalDocuments()->document()->repository()->countAll() === 0) {
120 $components[] = $this->
ui->create()->messageBox()->info(
121 $this->
ui->txt(
'no_documents_exist')
125 $components[] = $this->legal_documents->admin()->externalSettingsMessage($this->data_protection_settings->deleteUserOnWithdrawal()->value());
127 $components[] = $this->
form();
128 $this->tpl->setContent($this->container->ui()->renderer()->render($components));
133 $this->container->tabs()->activateTab(
'documents');
134 $this->legal_documents->admin()->requireEditable();
135 $this->legal_documents->admin()->setContent((
new Confirmation($this->
lng))->render(
136 $this->
ctrl->getFormAction($this,
'resetNow'),
139 $this->
ui->txt(
'sure_reset_tos')
145 $this->legal_documents->admin()->requireEditable();
148 $this->container->database()->manipulate(
"delete from usr_pref WHERE keyword = 'dpro_agree_date' AND $in");
149 $this->data_protection_settings->lastResetDate()->update((
new DataFactory())->clock()->system()->now());
150 $this->
ctrl->redirect($this->legal_documents,
'documents');
155 $this->container->language()->loadLanguageModule(
'tos');
156 $this->legal_documents->tabs([
157 'documents' => fn() => $this->tabs_gui->addTab(
'settings', $this->ui->txt(
'settings'), $this->
ctrl->getLinkTarget($this,
'settings')),
159 $this->tabs_gui->addTab(
'permissions', $this->
ui->txt(
'perm_settings'), $this->
ctrl->getLinkTargetByClass([self::class, ilPermissionGUI::class],
'perm'));
164 if ($this->config->legalDocuments()->document()->repository()->countAll() === 0) {
165 $this->data_protection_settings->enabled()->update(
false);
171 if (!$this->rbac_system->checkAccess(
'read', $this->object->getRefId())) {
172 $this->error->raiseError($this->container->language()->txt(
'msg_no_perm_read'), $this->error->WARNING);
179 'type' => $this->
radio(
'mode', [
181 'eval_on_login' =>
'reevaluate_on_login',
182 'no_acceptance' =>
'no_acceptance',
184 $this->data_protection_settings->validateOnLogin()->value() ?
186 ($this->data_protection_settings->noAcceptance()->value() ?
'no_acceptance' :
'once')
187 )->withRequired(
true),
190 $enabled = $enabled->withValue($this->data_protection_settings->enabled()->value() ? [
191 'type' => $this->data_protection_settings->validateOnLogin()->value() ?
193 ($this->data_protection_settings->noAcceptance()->value() ?
'no_acceptance' :
'once'),
196 $enabled = $enabled->withDisabled(!$this->config->editable())->withRequired(
true);
198 $form = $this->
ui->create()->input()->container()->form()->standard(
199 $this->
ctrl->getFormAction($this,
'settings'),
203 if (!$this->config->editable()) {
204 $form = $form->withSubmitLabel($this->
lng->txt(
'refresh'));
205 return $this->legal_documents->admin()->withFormData($form,
function () {
206 $this->
ctrl->redirect($this,
'settings');
210 return $this->legal_documents->admin()->withFormData($form,
function (array
$data):
void {
211 $no_documents = $this->config->legalDocuments()->document()->repository()->countAll() === 0;
212 if ($no_documents && isset($data[
'enabled'])) {
213 $this->tpl->setOnScreenMessage(
'failure', $this->
ui->txt(
'no_documents_exist_cant_save'),
true);
214 $this->
ctrl->redirect($this,
'settings');
216 $type = $data[
'enabled'][
'type'] ??
false;
217 $this->data_protection_settings->enabled()->update(isset($data[
'enabled']));
218 if (isset($data[
'enabled'])) {
219 $this->data_protection_settings->validateOnLogin()->update(
$type ===
'eval_on_login');
220 $this->data_protection_settings->noAcceptance()->update(
$type ===
'no_acceptance');
223 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_obj_modified'),
true);
224 $this->
ctrl->redirect($this,
'settings');
230 return $this->
ui->create()->input()->field()->optionalGroup(
232 $this->
ui->txt($label),
233 $this->
ui->txt($description)
239 $field = $this->
ui->create()->input()->field()->radio($this->
ui->txt($prefix), $this->
ui->txt($prefix .
'_desc'));
240 foreach ($options as
$key => $label) {
241 $field = $field->withOption((
string)
$key, $this->
ui->txt($label));
250 $this->config->editable() ? $store :
new ReadOnlyStore($store),
251 new Marshal($this->container->refinery())
257 $buttons = $this->config->editable() ?
258 [$this->legal_documents->admin()->resetButton($this->
ctrl->getLinkTarget($this,
'confirmReset'))] :
261 $reset_date = $this->data_protection_settings->lastResetDate()->value();
262 $this->tpl->setCurrentBlock(
'mess');
263 $this->legal_documents->admin()->setVariable(
'MESSAGE', $this->legal_documents->admin()->resetBox($reset_date, $buttons));
264 $this->tpl->parseCurrentBlock(
'mess');
New implementation of ilObjectGUI.
readonly Settings $data_protection_settings
const SYSTEM_USER_ID
This file contains constants for PHPStan analyis, see: https://phpstan.org/config-reference#constants...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
radio(string $prefix, array $options)
prepareOutput(bool $show_sub_objects=true)
ilObjDataProtectionGUI: ilAdministrationGUI ilObjDataProtectionGUI: ilLegalDocumentsAdministrationGU...
readonly Container $container
Customizing of pimple-DIC for ILIAS.
readonly ilLegalDocumentsAdministrationGUI $legal_documents
optionalGroup(string $label, string $description, array $fields)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
createDataProtectionSettings()