ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Slot.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24use ilLink;
34use Closure;
35use ilObjUser;
36use ilTemplate;
37
38class Slot
39{
40 public function __construct(
41 private readonly string $id,
42 private readonly Blocks $blocks,
43 private readonly Provide $provide,
44 private readonly Container $container
45 ) {
46 }
47
49 {
50 return new ShowOnLoginPage($this->provide, $this->blocks->ui(), $this->template(...));
51 }
52
56 public function withdrawProcess(User $user, Settings $global_settings, Closure $after_user_withdrawal): WithdrawProcess
57 {
58 return new WithdrawProcess(
59 $user,
60 $this->blocks->ui(),
61 $this->blocks->routing(),
62 $global_settings,
63 $this->blocks->retrieveQueryParameter(...),
64 $this->provide,
65 $after_user_withdrawal
66 );
67 }
68
69 public function agreement(User $user): Agreement
70 {
71 return new Agreement($user, $this->blocks->ui(), $this->blocks->routing(), $this->blocks->withRequest(...));
72 }
73
74 public function modifyFooter(User $user, ?string $goto_target = null): ModifyFooter
75 {
76 $link = $goto_target ? static fn() => new URI(ilLink::_getLink(null, 'usr', [], $goto_target)) : null;
77 return new ModifyFooter($this->blocks->ui(), $user, $this->provide, fn($arg) => $this->container->ui()->renderer()->render($arg), $this->template(...), $link);
78 }
79
83 public function selfRegistration(User $user, Closure $build_user): SelfRegistration
84 {
85 return new SelfRegistration(
86 $this->id,
87 $this->blocks->ui(),
88 $user,
89 $this->provide,
90 fn($arg) => $this->container->ui()->renderer()->render($arg),
91 $build_user
92 );
93 }
94
98 public function onlineStatusFilter(callable $select_didnt_agree): OnlineStatusFilter
99 {
100 return new OnlineStatusFilter(
101 Closure::fromCallable($select_didnt_agree),
102 $this->container->rbac()->review()
103 );
104 }
105
109 public function canReadInternalMails(Closure $build_user): Constraint
110 {
111 return $this->container->refinery()->custom()->constraint(
112 static function (ilObjUser $user) use ($build_user): bool {
113 $user = $build_user($user);
114 return $user->cannotAgree() || !$user->neverAgreed();
115 },
116 fn(): string => 'Missing acceptance for: ' . $this->id
117 );
118 }
119
120 private function template(string $name): ilTemplate
121 {
122 return new ilTemplate($name, true, true, 'components/ILIAS/LegalDocuments');
123 }
124}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:35
__construct(private readonly string $id, private readonly Blocks $blocks, private readonly Provide $provide, private readonly Container $container)
Definition: Slot.php:40
modifyFooter(User $user, ?string $goto_target=null)
Definition: Slot.php:74
selfRegistration(User $user, Closure $build_user)
Definition: Slot.php:83
canReadInternalMails(Closure $build_user)
Definition: Slot.php:109
withdrawProcess(User $user, Settings $global_settings, Closure $after_user_withdrawal)
Definition: Slot.php:56
onlineStatusFilter(callable $select_didnt_agree)
Definition: Slot.php:98
User class.
special template class to simplify handling of ITX/PEAR
A constraint encodes some resrtictions on values.
Definition: Constraint.php:32
$container
@noRector
Definition: wac.php:37