19 declare(strict_types=1);
53 $this->container =
$DIC;
54 $config =
new Config($DIC[
'legalDocuments']->provide(Consumer::ID));
55 if ($this->rbac_system->checkAccess(
'write', $this->object->getRefId())) {
56 $config = $config->allowEditing();
62 $this->
ui =
new UI($this->
getType(), $this->container->ui(), $this->container->language());
75 $this->container->language()->loadLanguageModule(
'dpro');
76 $this->container->language()->loadLanguageModule(
'ldoc');
78 $next_class = $this->
ctrl->getNextClass($this) ??
'';
79 $cmd = $this->
ctrl->getCmd(
'settings');
81 switch (strtolower($next_class)) {
82 case strtolower(ilLegalDocumentsAdministrationGUI::class):
83 if ($cmd ===
'documents') {
86 $this->
ctrl->forwardCommand($this->legal_documents);
88 case strtolower(ilPermissionGUI::class):
89 $this->tabs_gui->activateTab(
'permissions');
95 $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) {
121 $this->
ui->txt(
'no_documents_exist')
125 $components[] = $this->legal_documents->admin()->externalSettingsMessage($this->data_protection_settings->deleteUserOnWithdrawal()->value());
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);
178 $no_documents = $this->config->legalDocuments()->document()->repository()->countAll() === 0;
180 $this->tpl->setOnScreenMessage(
'info', $this->
ui->txt(
'no_documents_exist'),
true);
183 $enabled = $this->
optionalGroup(
'status_enable',
'status_enable_desc', [
184 'type' => $this->
radio(
'mode', [
186 'eval_on_login' =>
'reevaluate_on_login',
187 'no_acceptance' =>
'no_acceptance',
189 $this->data_protection_settings->validateOnLogin()->value() ?
191 ($this->data_protection_settings->noAcceptance()->value() ?
'no_acceptance' :
'once')
192 )->withRequired(
true),
195 $enabled = $enabled->withValue($this->data_protection_settings->enabled()->value() ? [
196 'type' => $this->data_protection_settings->validateOnLogin()->value() ?
198 ($this->data_protection_settings->noAcceptance()->value() ?
'no_acceptance' :
'once'),
201 $enabled = $enabled->withDisabled(!$this->config->editable())->withRequired(
true);
203 $form = $this->
ui->create()->input()->container()->form()->standard(
204 $this->
ctrl->getFormAction($this,
'settings'),
205 [
'enabled' => $enabled]
208 if (!$this->config->editable()) {
209 $form = $form->withSubmitLabel($this->
lng->txt(
'refresh'));
210 return $this->legal_documents->admin()->withFormData($form,
function () {
211 $this->
ctrl->redirect($this,
'settings');
215 return $this->legal_documents->admin()->withFormData($form,
function (array
$data) use ($no_documents):
void {
216 if ($no_documents && isset($data[
'enabled'])) {
217 $this->tpl->setOnScreenMessage(
'failure', $this->
ui->txt(
'no_documents_exist_cant_save'),
true);
218 $this->
ctrl->redirect($this,
'settings');
220 $type = $data[
'enabled'][
'type'] ??
false;
221 $this->data_protection_settings->enabled()->update(isset($data[
'enabled']));
222 if (isset($data[
'enabled'])) {
223 $this->data_protection_settings->validateOnLogin()->update(
$type ===
'eval_on_login');
224 $this->data_protection_settings->noAcceptance()->update(
$type ===
'no_acceptance');
227 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_obj_modified'),
true);
228 $this->
ctrl->redirect($this,
'settings');
237 return $this->
ui->create()->input()->field()->optionalGroup(
239 $this->
ui->txt($label),
240 $this->
ui->txt($description)
249 $field = $this->
ui->create()->input()->field()->radio($this->
ui->txt($prefix), $this->
ui->txt($prefix .
'_desc'));
250 foreach ($options as $key => $label) {
251 $field = $field->withOption((
string) $key, $this->
ui->txt($label));
260 $this->config->editable() ? $store :
new ReadOnlyStore($store),
261 new Marshal($this->container->refinery())
267 $buttons = $this->config->editable() ?
268 [$this->legal_documents->admin()->resetButton($this->
ctrl->getLinkTarget($this,
'confirmReset'))] :
271 $reset_date = $this->data_protection_settings->lastResetDate()->value();
272 $this->tpl->setCurrentBlock(
'mess');
273 $this->legal_documents->admin()->setVariable(
'MESSAGE', $this->legal_documents->admin()->resetBox($reset_date, $buttons));
274 $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.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
readonly ilLegalDocumentsAdministrationGUI $legal_documents
optionalGroup(string $label, string $description, array $fields)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
createDataProtectionSettings()