ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
Slot.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
26use ilLink;
36use Closure;
37use ilObjUser;
38use ilTemplate;
39
40class Slot
41{
42 public function __construct(
43 private readonly string $id,
44 private readonly Blocks $blocks,
45 private readonly Provide $provide,
46 private readonly Container $container
47 ) {
48 }
49
51 {
52 return new ShowOnLoginPage($this->provide, $this->blocks->ui(), $this->template(...));
53 }
54
58 public function withdrawProcess(User $user, Settings $global_settings, Closure $after_user_withdrawal): WithdrawProcess
59 {
60 return new WithdrawProcess(
61 $user,
62 $this->blocks->ui(),
63 $this->blocks->routing(),
64 $global_settings,
65 $this->blocks->retrieveQueryParameter(...),
66 $this->provide,
67 $after_user_withdrawal
68 );
69 }
70
71 public function agreement(User $user): Agreement
72 {
73 return new Agreement($user, $this->blocks->ui(), $this->blocks->routing(), $this->blocks->withRequest(...));
74 }
75
76 public function modifyFooter(User $user, ?string $goto_target = null): ModifyFooter
77 {
78 $link = $goto_target ? static fn() => new URI(ilLink::_getLink(null, 'usr', [], $goto_target)) : null;
79 return new ModifyFooter(
80 $this->blocks->ui(),
81 $user,
82 $this->provide,
83 fn($arg) => $this->container->ui()->renderer()->render($arg),
84 $this->template(...),
85 $link
86 );
87 }
88
89 public function dummyFooter(Closure $footer): Closure
90 {
91 return $footer($this->provide->id(), $this->blocks->ui()->txt('usr_agreement'), null);
92 }
93
97 public function selfRegistration(User $user, Closure $build_user): SelfRegistration
98 {
99 return new SelfRegistration(
100 $this->id,
101 $this->blocks->ui(),
102 $user,
103 $this->provide,
104 fn($arg) => $this->container->ui()->renderer()->render($arg),
105 $build_user
106 );
107 }
108
112 public function onlineStatusFilter(callable $select_didnt_agree): OnlineStatusFilter
113 {
114 return new OnlineStatusFilter(
115 Closure::fromCallable($select_didnt_agree),
116 $this->container->rbac()->review()
117 );
118 }
119
123 public function canReadInternalMails(Closure $build_user): Constraint
124 {
125 return $this->container->refinery()->custom()->constraint(
126 static function (ilObjUser $user) use ($build_user): bool {
127 $user = $build_user($user);
128 return $user->cannotAgree() || !$user->neverAgreed();
129 },
130 fn(): string => 'Missing acceptance for: ' . $this->id
131 );
132 }
133
134 private function template(string $name): ilTemplate
135 {
136 return new ilTemplate($name, true, true, 'components/ILIAS/LegalDocuments');
137 }
138}
$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:42
modifyFooter(User $user, ?string $goto_target=null)
Definition: Slot.php:76
selfRegistration(User $user, Closure $build_user)
Definition: Slot.php:97
canReadInternalMails(Closure $build_user)
Definition: Slot.php:123
withdrawProcess(User $user, Settings $global_settings, Closure $after_user_withdrawal)
Definition: Slot.php:58
onlineStatusFilter(callable $select_didnt_agree)
Definition: Slot.php:112
Inspired by: Laminas escaper: https://github.com/laminas/laminas-escaper.
Definition: URL.php:36
User class.
special template class to simplify handling of ITX/PEAR
A constraint encodes some resrtictions on values.
Definition: Constraint.php:32
This describes commonalities between the different modals.
Definition: Modal.php:35
$container
@noRector
Definition: wac.php:37