ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\LegalDocuments\Conductor Class Reference
+ Collaboration diagram for ILIAS\LegalDocuments\Conductor:

Public Member Functions

 __construct (private readonly Container $container, ?Internal $internal=null, ?Routing $routing=null)
 
 provide (string $id)
 
 loginPageHTML (string $id)
 
 logoutText ()
 
 logoutTarget (LogoutTarget $target)
 
 modifyFooter (Closure $footer)
 
 agree (string $gui, string $cmd)
 
 agreeContent (string $gui, string $cmd)
 
 withdraw (string $gui, string $cmd)
 
 usersWithHiddenOnlineStatus (array $users)
 
 userCanReadInternalMail ()
 
 canUseSoapApi ()
 
 afterLogin ()
 
 findGotoLink (string $goto_target)
 
 intercepting ()
 
 selfRegistration ()
 
 userManagementFields (ilObjUser $user)
 
 userManagementModals ()
 

Private Member Functions

 find (Closure $predicate, array $array)
 @template A More...
 
 any (Closure $predicate, array $array)
 @template A More...
 
 all (Closure $predicate, array $array)
 @template A More...
 
 byQueryParams (string $gui, string $cmd, string $key)
 
 renderPageFragment (string $gui, string $cmd)
 
 setMainTemplateContent (string $content)
 
 createInternal ()
 

Private Attributes

readonly Internal $internal
 
readonly Routing $routing
 
array $modals = []
 

Detailed Description

Definition at line 46 of file Conductor.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\LegalDocuments\Conductor::__construct ( private readonly Container  $container,
?Internal  $internal = null,
?Routing  $routing = null 
)

Definition at line 54 of file Conductor.php.

58 {
59 $this->internal = $internal ?? $this->createInternal();
60 $this->routing = $routing ?? new Routing(
61 $this->container->ctrl(),
62 new SelectSetting(new SessionStore(), new Marshal($this->container->refinery())),
65 );
66 }
readonly Internal $internal
Definition: Conductor.php:48
readonly Routing $routing
Definition: Conductor.php:49
static redirectToStartingPage(string $target='')
static logoutUrl(array $parameters=[])
Return the logout URL with a valid CSRF token.

References ILIAS\LegalDocuments\Conductor\$routing, ILIAS\LegalDocuments\Conductor\createInternal(), ilStartUpGUI\logoutUrl(), and ilInitialisation\redirectToStartingPage().

+ Here is the call graph for this function:

Member Function Documentation

◆ afterLogin()

ILIAS\LegalDocuments\Conductor::afterLogin ( )

Definition at line 161 of file Conductor.php.

161 : void
162 {
163 array_map(fn($proc) => $proc(), $this->internal->all('after-login'));
164 }

◆ agree()

ILIAS\LegalDocuments\Conductor::agree ( string  $gui,
string  $cmd 
)

Definition at line 112 of file Conductor.php.

112 : void
113 {
114 $this->setMainTemplateContent($this->agreeContent($gui, $cmd));
115 }
setMainTemplateContent(string $content)
Definition: Conductor.php:290
agreeContent(string $gui, string $cmd)
Definition: Conductor.php:117

References ILIAS\LegalDocuments\Conductor\agreeContent(), and ILIAS\LegalDocuments\Conductor\setMainTemplateContent().

+ Here is the call graph for this function:

◆ agreeContent()

ILIAS\LegalDocuments\Conductor::agreeContent ( string  $gui,
string  $cmd 
)

Definition at line 117 of file Conductor.php.

117 : string
118 {
119 $key = ilLegalDocumentsAgreementGUI::class === $gui ? 'agreement-form' : 'public-page';
120 $result = $this->byQueryParams($gui, $cmd, $key)->then($this->renderPageFragment($gui, $cmd));
121
122 if (!$result->isOk() && $result->error() === 'Not available.') {
123 $this->routing->redirectToOriginalTarget();
124 }
125
126 return $result->value();
127 }
byQueryParams(string $gui, string $cmd, string $key)
Definition: Conductor.php:260
renderPageFragment(string $gui, string $cmd)
Definition: Conductor.php:282

References ILIAS\LegalDocuments\Conductor\byQueryParams(), and ILIAS\LegalDocuments\Conductor\renderPageFragment().

Referenced by ILIAS\LegalDocuments\Conductor\agree().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ all()

ILIAS\LegalDocuments\Conductor::all ( Closure  $predicate,
array  $array 
)
private

@template A

Parameters
Closure(A)bool $predicate
list<A>$array

Definition at line 255 of file Conductor.php.

255 : bool
256 {
257 return !$this->any(static fn($x) => !$predicate($x), $array);
258 }
any(Closure $predicate, array $array)
@template A
Definition: Conductor.php:245

References ILIAS\LegalDocuments\Conductor\any().

+ Here is the call graph for this function:

◆ any()

ILIAS\LegalDocuments\Conductor::any ( Closure  $predicate,
array  $array 
)
private

@template A

Parameters
Closure(A)bool $predicate
list<A>$array

Definition at line 245 of file Conductor.php.

245 : bool
246 {
247 return $this->find($predicate, $array)->isOk();
248 }
find(Closure $predicate, array $array)
@template A
Definition: Conductor.php:229

References ILIAS\LegalDocuments\Conductor\find().

Referenced by ILIAS\LegalDocuments\Conductor\all().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ byQueryParams()

ILIAS\LegalDocuments\Conductor::byQueryParams ( string  $gui,
string  $cmd,
string  $key 
)
private

Definition at line 260 of file Conductor.php.

260 : Result
261 {
262 try {
263 $id = $this->container->http()->wrapper()->query()->retrieve('id', $this->container->refinery()->to()->string());
264 } catch (Exception) {
265 return new Error('No provider ID given.');
266 }
267
268 $this->container->ctrl()->setParameterByClass($gui, 'id', $id);
269
270 $value = $this->internal->get($key, $id);
271
272 if (null === $value) {
273 return new Error('Field not defined.');
274 }
275
276 return new Ok($value);
277 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id.

Referenced by ILIAS\LegalDocuments\Conductor\agreeContent(), and ILIAS\LegalDocuments\Conductor\withdraw().

+ Here is the caller graph for this function:

◆ canUseSoapApi()

ILIAS\LegalDocuments\Conductor::canUseSoapApi ( )

Definition at line 156 of file Conductor.php.

156 : Transformation
157 {
158 return $this->container->refinery()->in()->series(array_values($this->internal->all('use-soap-api')));
159 }

◆ createInternal()

ILIAS\LegalDocuments\Conductor::createInternal ( )
private

Definition at line 295 of file Conductor.php.

295 : Internal
296 {
297 $clock = (new DataFactory())->clock()->system();
298 $action = new UserAction($this->container->user(), $clock);
299
300 return new Internal($this->provide(...), fn(string $id) => new Wiring(new SlotConstructor(
301 $id,
302 $this->container,
303 $action
304 )));
305 }

References $id, and ILIAS\LegalDocuments\Conductor\provide().

Referenced by ILIAS\LegalDocuments\Conductor\__construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ find()

ILIAS\LegalDocuments\Conductor::find ( Closure  $predicate,
array  $array 
)
private

@template A

Parameters
Closure(A)bool $predicate
list<A>$array
Returns
Result

Definition at line 229 of file Conductor.php.

229 : Result
230 {
231 foreach ($array as $x) {
232 if ($predicate($x)) {
233 return new Ok($x);
234 }
235 }
236
237 return new Error('Not found.');
238 }

Referenced by ILIAS\LegalDocuments\Conductor\any(), ILIAS\LegalDocuments\Conductor\findGotoLink(), and ILIAS\LegalDocuments\Conductor\userManagementFields().

+ Here is the caller graph for this function:

◆ findGotoLink()

ILIAS\LegalDocuments\Conductor::findGotoLink ( string  $goto_target)
Returns
Result<Target>

Definition at line 169 of file Conductor.php.

169 : Result
170 {
171 return $this->find(
172 fn($goto_link) => $goto_link->name() === $goto_target,
173 $this->internal->all('goto')
174 )->map(fn($goto_link) => $goto_link->target());
175 }

References ILIAS\LegalDocuments\Conductor\find().

+ Here is the call graph for this function:

◆ intercepting()

ILIAS\LegalDocuments\Conductor::intercepting ( )
Returns
list<Intercept>

Definition at line 180 of file Conductor.php.

180 : array
181 {
182 return $this->internal->all('intercept');
183 }

Referenced by ILIAS\LegalDocuments\StartUpStep\__construct().

+ Here is the caller graph for this function:

◆ loginPageHTML()

ILIAS\LegalDocuments\Conductor::loginPageHTML ( string  $id)

Definition at line 73 of file Conductor.php.

73 : string
74 {
75 $create = $this->internal->get('show-on-login-page', $id);
76 if (!$create) {
77 return '';
78 }
79 return $this->container->ui()->renderer()->render($create());
80 }

◆ logoutTarget()

ILIAS\LegalDocuments\Conductor::logoutTarget ( LogoutTarget  $target)

Definition at line 98 of file Conductor.php.

99 {
100 return new WithdrawalAcknowledgementLogoutTarget(
101 $target,
102 $this->container->http()->wrapper()->query()->has('withdraw_consent'),
103 $this->container->ctrl()
104 );
105 }

◆ logoutText()

ILIAS\LegalDocuments\Conductor::logoutText ( )

Definition at line 82 of file Conductor.php.

82 : string
83 {
84 try {
85 $id = $this->container->http()->wrapper()->query()->retrieve(
86 'withdraw_consent',
87 $this->container->refinery()->to()->string()
88 );
89 } catch (Exception) {
90 return '';
91 }
92
93 $logout_text = $this->internal->get('logout-text', $id);
94
95 return null === $logout_text ? '' : $this->container->ui()->renderer()->render($logout_text());
96 }

References $id.

◆ modifyFooter()

ILIAS\LegalDocuments\Conductor::modifyFooter ( Closure  $footer)

Definition at line 107 of file Conductor.php.

107 : Closure
108 {
109 return array_reduce($this->internal->all('footer'), fn(Closure $footer, Closure $proc) => $proc($footer), $footer);
110 }

◆ provide()

ILIAS\LegalDocuments\Conductor::provide ( string  $id)

Definition at line 68 of file Conductor.php.

68 : Provide
69 {
70 return new Provide($id, $this->internal, $this->container);
71 }

References $id.

Referenced by ILIAS\LegalDocuments\Conductor\createInternal().

+ Here is the caller graph for this function:

◆ renderPageFragment()

ILIAS\LegalDocuments\Conductor::renderPageFragment ( string  $gui,
string  $cmd 
)
private
Returns
Closure(Closure(string, string): Result<PageFragment>): Result<string>

Definition at line 282 of file Conductor.php.

282 : Closure
283 {
284 return fn(Closure $proc) => $proc($gui, $cmd)->map(fn($fragment) => $fragment->render(
285 $this->container->ui()->mainTemplate(),
286 $this->container->ui()->renderer()
287 ));
288 }

Referenced by ILIAS\LegalDocuments\Conductor\agreeContent(), and ILIAS\LegalDocuments\Conductor\withdraw().

+ Here is the caller graph for this function:

◆ selfRegistration()

ILIAS\LegalDocuments\Conductor::selfRegistration ( )

Definition at line 185 of file Conductor.php.

185 : SelfRegistration
186 {
187 return new Bundle($this->internal->all('self-registration'));
188 }

◆ setMainTemplateContent()

ILIAS\LegalDocuments\Conductor::setMainTemplateContent ( string  $content)
private

Definition at line 290 of file Conductor.php.

290 : void
291 {
292 $this->container->ui()->mainTemplate()->setContent($content);
293 }

Referenced by ILIAS\LegalDocuments\Conductor\agree(), and ILIAS\LegalDocuments\Conductor\withdraw().

+ Here is the caller graph for this function:

◆ userCanReadInternalMail()

ILIAS\LegalDocuments\Conductor::userCanReadInternalMail ( )

Definition at line 151 of file Conductor.php.

151 : Transformation
152 {
153 return $this->container->refinery()->in()->series(array_values($this->internal->all('constrain-internal-mail')));
154 }

◆ userManagementFields()

ILIAS\LegalDocuments\Conductor::userManagementFields ( ilObjUser  $user)
Returns
array<string|int, string>

Definition at line 193 of file Conductor.php.

193 : array
194 {
195 $this->modals = [];
196 return array_reduce(
197 $this->internal->all('user-management-fields'),
198 fn(array $prev, callable $f): array => [
199 ...$prev,
200 ...array_map(function ($val) {
201 if (is_array($val)) {
202 $this->find(fn($x) => $x instanceof Modal, $val)
203 ->map(fn($modal) => array_push($this->modals, $modal));
204 return $this->find(fn($x) => $x instanceof ilNonEditableValueGUI, $val)->value();
205 }
206 return $val;
207 }, $f($user))
208 ],
209 []
210 );
211 }
This class represents a non editable value in a property form.

References Vendor\Package\$f, and ILIAS\LegalDocuments\Conductor\find().

+ Here is the call graph for this function:

◆ userManagementModals()

ILIAS\LegalDocuments\Conductor::userManagementModals ( )

Definition at line 213 of file Conductor.php.

213 : string
214 {
215 $string = $this->container->ui()->renderer()->render($this->modals);
216 $this->modals = [];
217
218 return $string;
219 }

◆ usersWithHiddenOnlineStatus()

ILIAS\LegalDocuments\Conductor::usersWithHiddenOnlineStatus ( array  $users)
Parameters
list<int>$users
Returns
list<int>

Definition at line 138 of file Conductor.php.

138 : array
139 {
140 $filters = $this->internal->all('filter-online-users');
141
142 $visible_users = array_reduce(
143 $filters,
144 fn($users, $only_visible_users) => $only_visible_users($users),
145 $users,
146 );
147
148 return array_values(array_diff($users, $visible_users));
149 }

◆ withdraw()

ILIAS\LegalDocuments\Conductor::withdraw ( string  $gui,
string  $cmd 
)

Definition at line 129 of file Conductor.php.

129 : void
130 {
131 $this->setMainTemplateContent($this->byQueryParams($gui, $cmd, 'withdraw')->then($this->renderPageFragment($gui, $cmd))->value());
132 }

References ILIAS\LegalDocuments\Conductor\byQueryParams(), ILIAS\LegalDocuments\Conductor\renderPageFragment(), and ILIAS\LegalDocuments\Conductor\setMainTemplateContent().

+ Here is the call graph for this function:

Field Documentation

◆ $internal

readonly Internal ILIAS\LegalDocuments\Conductor::$internal
private

Definition at line 48 of file Conductor.php.

◆ $modals

array ILIAS\LegalDocuments\Conductor::$modals = []
private

Definition at line 52 of file Conductor.php.

◆ $routing

readonly Routing ILIAS\LegalDocuments\Conductor::$routing
private

Definition at line 49 of file Conductor.php.

Referenced by ILIAS\LegalDocuments\Conductor\__construct().


The documentation for this class was generated from the following file: