19 declare(strict_types=1);
43 private readonly
User $user,
44 private readonly
UI $ui,
45 private readonly
Routing $routing,
46 private readonly
Closure $with_request
52 $title =
'accept_usr_agreement_anonymous';
53 $info =
'accept_usr_agreement_anonymous_intro';
54 if ($this->
user->isLoggedIn()) {
55 $title =
'usr_agreement';
56 $info =
'usr_agreement_footer_intro';
63 $form = $this->
user->matchingDocument()->isOk() ?
65 $this->
ui->create()->divider()->horizontal();
67 $content = (
new PageContent($this->
ui->txt(
'accept_usr_agreement'), [
73 return $this->
user->matchingDocument()->isOk() ?
74 $content->withOnScreenMessage(
'info', $this->
ui->txt(
'accept_usr_agreement_intro')) :
80 return !$this->
user->cannotAgree()
81 && $this->
user->needsToAcceptNewDocument();
88 ->map(fn(
Document $document) => $this->
ui->create()->legacy()->content($document->
content()->value()))
89 ->except(fn() =>
new Ok($this->
ui->create()->legacy(sprintf(
90 $this->
ui->txt(
'no_agreement_description'),
97 $url = $this->routing->ctrl()->getFormActionByClass($gui, $cmd);
98 $form = $this->
ui->create()->input()->container()->form()->standard(
$url, [
99 'accept?' => $this->
ui->create()->input()->field()->radio($this->
ui->txt(
'accept_usr_agreement'))
100 ->withOption(
'yes', $this->
ui->txt(
'accept_usr_agreement_btn'))
101 ->withOption(
'no', $this->
ui->txt(
'deny_usr_agreement_btn'))
104 return ($this->with_request)($form,
function (array
$data) {
107 $this->routing->ctrl()->redirectToURL($this->routing->logoutUrl());
109 $this->
user->acceptMatchingDocument();
110 $this->routing->redirectToOriginalTarget();
117 return $this->
ui->create()->button()->standard($this->
ui->txt(
'logout'), $this->routing->logoutUrl());
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
A result encapsulates a value or an error and simplifies the handling of those.