19declare(strict_types=1);
35use ILIAS\LegalDocuments\Provide\History;
50 $this->
map = $map ??
new Map();
55 return $this->
addTo(
'after-login', Closure::fromCallable($after_login));
60 return $this->
addTo(
'footer', $this->slot->id(), Closure::fromCallable($show));
67 return $this->
addTo(
'withdraw', $this->slot->id(), $withdraw)
70 ->addTo(
'show-on-login-page', $this->slot->withdrawalFinished($withdraw_process->
withdrawalFinished(...)));
75 return $this->
addTo(
'show-on-login-page', $this->slot->id(), Closure::fromCallable($show));
78 public function hasPublicPage(callable $public_page, ?
string $goto_name =
null): self
80 $wiring = $this->
addTo(
'public-page', $this->slot->id(), fn(...$args) =>
new Ok($public_page(...$args)));
81 return null === $goto_name ?
83 $wiring->addTo(
'goto',
new ConditionalGotoLink($goto_name, fn() =>
new Target(ilStartUpGUI::class,
'showLegalDocuments', [
'id' => $this->slot->id()])));
88 $public_target =
new Target(ilStartUpGUI::class,
'showLegalDocuments', [
'id' => $this->slot->id()]);
89 $agreement_target =
new Target($this->
path(ilLegalDocumentsAgreementGUI::class),
'', [
'id' => $this->slot->id()]);
91 $wiring = $this->
addTo(
'public-page', $this->slot->id(), fn(...$args) =>
new Ok($on_login->
showAgreement(...$args)))
95 return null === $goto_name ?
102 $document = $this->
map->value()[
'document'][$this->slot->id()] ?? $this->
error(
'Cannot have a history without documents.');
103 return $this->
addTo(
'history', $this->slot->id(), $this->slot->history($document));
108 return $this->
addTo(
'self-registration', $self_registration);
113 return $this->
addTo(
'filter-online-users', $only_visible_users);
118 return $this->
addTo(
'constrain-internal-mail', $constraint);
123 return $this->
addTo(
'use-soap-api', $constraint);
129 $repository = $this->slot->documentRepository();
130 $document = $this->slot->document($this->slot->readOnlyDocuments($repository), $available_conditions, $content_as_component);
132 return $this->
addTo(
'document', $this->slot->id(), $document)
133 ->addTo(
'writable-document', $this->slot->id(), $this->slot->document($repository, $available_conditions, $content_as_component));
138 return $this->
addTo(
'user-management-fields', $this->slot->id(), $field_value);
143 return $this->
addTo(
'public-api', $this->slot->id(), $api);
156 private function addTo(
string $name, $id_or_value, $value =
null): self
159 if ($value !==
null) {
160 if ($this->
map->has($name, $id_or_value)) {
161 throw new Exception(
'Duplicated entry. Key ' . $id_or_value .
' already exists for ' . $name);
168 return new self($this->slot,
$map);
179 private function protect(Closure $to_be_protected, Closure $protector): Closure
181 return static fn(...$args):
Result => $protector() ?
new Ok($to_be_protected(...$args)) :
new Error(
'Not available.');
187 private function path(
string $class): array
189 return [ilDashboardGUI::class, PersonalProfileGUI::class, $class];
A result encapsulates a value or an error and simplifies the handling of those.
set(string $name, string $key, $item)
hasPublicPage(callable $public_page, ?string $goto_name=null)
afterLogin(callable $after_login)
hasUserManagementFields(callable $field_value)
canWithdraw(WithdrawProcess $withdraw_process)
showOnLoginPage(callable $show)
__construct(private readonly SlotConstructor $slot, ?Map $map=null)
canReadInternalMails(Constraint $constraint)
canUseSoapApi(Constraint $constraint)
hasOnlineStatusFilter(callable $only_visible_users)
protect(Closure $to_be_protected, Closure $protector)
@template A @template B
showInFooter(callable $show)
hasDocuments(array $content_as_component=[], ?SelectionMap $available_conditions=null)
hasPublicApi(PublicApi $api)
hasAgreement(Agreement $on_login, ?string $goto_name=null)
onSelfRegistration(SelfRegistration $self_registration)
addTo(string $name, $id_or_value, $value=null)
GUI class for personal profile.
@ilCtrl_Calls ilDashboardGUI: ILIAS\User\Profile\PersonalProfileGUI @ilCtrl_Calls ilDashboardGUI: ilO...
@ilCtrl_Calls ilStartUpGUI: ilAccountRegistrationGUI, ilPasswordAssistanceGUI, ilLoginPageGUI,...
A result encapsulates a value or an error and simplifies the handling of those.
showAgreement(string $gui, string $cmd)
showAgreementForm(string $gui, string $cmd)
showValidatePasswordMessage()
showWithdraw(string $gui, string $cmd)
A constraint encodes some resrtictions on values.