ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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)
 
 onLogout (string $gui)
 
 loginPageHTML (string $id)
 
 logoutText ()
 
 modifyFooter (Footer $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)
 

Private Member Functions

 find (Closure $predicate, array $array)
 A More...
 
 any (Closure $predicate, array $array)
 A More...
 
 all (Closure $predicate, array $array)
 A More...
 
 byQueryParams (string $gui, string $cmd, string $key)
 
 renderPageFragment (string $gui, string $cmd)
 
 setMainTemplateContent (string $content)
 
 createInternal ()
 
 footerBridge (Footer $footer, array $collection)
 
 collectFooterItems (array $items)
 

Private Attributes

readonly Internal $internal
 
readonly Routing $routing
 

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 51 of file Conductor.php.

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

52  {
53  $this->internal = $internal ?? $this->createInternal();
54  $this->routing = $routing ?? new Routing(
55  $this->container->ctrl(),
56  new SelectSetting(new SessionStore(), new Marshal($this->container->refinery())),
59  );
60  }
readonly Internal $internal
Definition: Conductor.php:48
static logoutUrl(array $parameters=[])
Return the logout URL with a valid CSRF token.
readonly Routing $routing
Definition: Conductor.php:49
static redirectToStartingPage(string $target='')
+ Here is the call graph for this function:

Member Function Documentation

◆ afterLogin()

ILIAS\LegalDocuments\Conductor::afterLogin ( )

Definition at line 158 of file Conductor.php.

158  : void
159  {
160  array_map(fn($proc) => $proc(), $this->internal->all('after-login'));
161  }

◆ agree()

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

Definition at line 109 of file Conductor.php.

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

109  : void
110  {
111  $this->setMainTemplateContent($this->agreeContent($gui, $cmd));
112  }
setMainTemplateContent(string $content)
Definition: Conductor.php:262
agreeContent(string $gui, string $cmd)
Definition: Conductor.php:114
+ Here is the call graph for this function:

◆ agreeContent()

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

Definition at line 114 of file Conductor.php.

References ILIAS\LTI\ToolProvider\$key, ILIAS\LegalDocuments\Conductor\byQueryParams(), and ILIAS\LegalDocuments\Conductor\renderPageFragment().

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

114  : string
115  {
116  $key = ilLegalDocumentsAgreementGUI::class === $gui ? 'agreement-form' : 'public-page';
117  $result = $this->byQueryParams($gui, $cmd, $key)->then($this->renderPageFragment($gui, $cmd));
118 
119  if (!$result->isOk() && $result->error() === 'Not available.') {
120  $this->routing->redirectToOriginalTarget();
121  }
122 
123  return $result->value();
124  }
renderPageFragment(string $gui, string $cmd)
Definition: Conductor.php:254
string $key
Consumer key/client ID value.
Definition: System.php:193
byQueryParams(string $gui, string $cmd, string $key)
Definition: Conductor.php:232
+ 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

A

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

Definition at line 227 of file Conductor.php.

References ILIAS\LegalDocuments\Conductor\any().

227  : bool
228  {
229  return !$this->any(static fn($x) => !$predicate($x), $array);
230  }
any(Closure $predicate, array $array)
A
Definition: Conductor.php:217
+ Here is the call graph for this function:

◆ any()

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

A

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

Definition at line 217 of file Conductor.php.

References ILIAS\LegalDocuments\Conductor\find().

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

217  : bool
218  {
219  return $this->find($predicate, $array)->isOk();
220  }
find(Closure $predicate, array $array)
A
Definition: Conductor.php:201
+ 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 232 of file Conductor.php.

References Vendor\Package\$e, and $id.

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

232  : Result
233  {
234  try {
235  $id = $this->container->http()->wrapper()->query()->retrieve('id', $this->container->refinery()->to()->string());
236  } catch (Exception $e) {
237  return new Error('No provider ID given.');
238  }
239 
240  $this->container->ctrl()->setParameterByClass($gui, 'id', $id);
241 
242  $value = $this->internal->get($key, $id);
243 
244  if (null === $value) {
245  return new Error('Field not defined.');
246  }
247 
248  return new Ok($value);
249  }
string $key
Consumer key/client ID value.
Definition: System.php:193
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the caller graph for this function:

◆ canUseSoapApi()

ILIAS\LegalDocuments\Conductor::canUseSoapApi ( )

Definition at line 153 of file Conductor.php.

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

◆ collectFooterItems()

ILIAS\LegalDocuments\Conductor::collectFooterItems ( array  $items)
private

Definition at line 302 of file Conductor.php.

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

302  : Closure
303  {
304  return function (...$args) use ($items) {
305  if ($args === []) {
306  return $items;
307  }
308  return $this->collectFooterItems(array_merge($items, [$args]));
309  };
310  }
collectFooterItems(array $items)
Definition: Conductor.php:302
+ Here is the caller graph for this function:

◆ createInternal()

ILIAS\LegalDocuments\Conductor::createInternal ( )
private

Definition at line 267 of file Conductor.php.

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

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

267  : Internal
268  {
269  $clock = (new DataFactory())->clock()->system();
270  $action = new UserAction($this->container->user(), $clock);
271 
272  return new Internal($this->provide(...), fn(string $id) => new Wiring(new SlotConstructor(
273  $id,
274  $this->container,
275  $action
276  )));
277  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ 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

A

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

Definition at line 201 of file Conductor.php.

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

201  : Result
202  {
203  foreach ($array as $x) {
204  if ($predicate($x)) {
205  return new Ok($x);
206  }
207  }
208 
209  return new Error('Not found.');
210  }
+ Here is the caller graph for this function:

◆ findGotoLink()

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

Definition at line 166 of file Conductor.php.

References ILIAS\LegalDocuments\Conductor\find().

166  : Result
167  {
168  return $this->find(
169  fn($goto_link) => $goto_link->name() === $goto_target,
170  $this->internal->all('goto')
171  )->map(fn($goto_link) => $goto_link->target());
172  }
find(Closure $predicate, array $array)
A
Definition: Conductor.php:201
+ Here is the call graph for this function:

◆ footerBridge()

ILIAS\LegalDocuments\Conductor::footerBridge ( Footer  $footer,
array  $collection 
)
private

Definition at line 279 of file Conductor.php.

References Vendor\Package\$f, $id, ILIAS\UI\Component\MainControls\Footer\getLinks(), ILIAS\UI\Component\MainControls\Footer\getModals(), ILIAS\UI\Component\MainControls\Footer\getPermanentURL(), ILIAS\UI\Component\MainControls\Footer\getText(), and ILIAS\UI\Component\MainControls\Footer\withAdditionalModalAndTrigger().

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

279  : Footer
280  {
281  $new_links = [];
282  $add_item = function (string $id, string $title, object $obj) use (&$footer, &$new_links): void {
283  if ($obj instanceof Modal) {
284  $footer = $footer->withAdditionalModalAndTrigger($obj, $this->container->ui()->factory()->button()->shy($title, ''));
285  } else {
286  $new_links[] = $this->container->ui()->factory()->link()->standard($title, (string) $obj);
287  }
288  };
289 
290  foreach ($collection as $args) {
291  $add_item(...$args);
292  }
293 
294  $old_links = $footer->getLinks();
295  $modals = $footer->getModals();
296  $new_footer = $this->container->ui()->factory()->mainControls()->footer(array_merge($old_links, $new_links), $footer->getText());
297  $new_footer = $footer->getPermanentURL() ? $new_footer->withPermanentURL($footer->getPermanentURL()) : $new_footer;
298 
299  return array_reduce($modals, static fn(Footer $f, array $m) => $f->withAdditionalModalAndTrigger(...$m), $new_footer);
300  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ intercepting()

ILIAS\LegalDocuments\Conductor::intercepting ( )

Definition at line 174 of file Conductor.php.

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

174  : array
175  {
176  return $this->internal->all('intercept');
177  }
+ Here is the caller graph for this function:

◆ loginPageHTML()

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

Definition at line 82 of file Conductor.php.

82  : string
83  {
84  $create = $this->internal->get('show-on-login-page', $id);
85  if (!$create) {
86  return '';
87  }
88  return $this->container->ui()->renderer()->render($create());
89  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ logoutText()

ILIAS\LegalDocuments\Conductor::logoutText ( )

Definition at line 91 of file Conductor.php.

References Vendor\Package\$e, and $id.

91  : string
92  {
93  try {
94  $id = $this->container->http()->wrapper()->query()->retrieve('withdraw_from', $this->container->refinery()->to()->string());
95  } catch (Exception $e) {
96  return '';
97  }
98 
99  $logout_text = $this->internal->get('logout-text', $id);
100 
101  return null === $logout_text ? '' : $this->container->ui()->renderer()->render($logout_text());
102  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ modifyFooter()

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

Definition at line 104 of file Conductor.php.

References ILIAS\LegalDocuments\Conductor\collectFooterItems(), and ILIAS\LegalDocuments\Conductor\footerBridge().

104  : Footer
105  {
106  return $this->footerBridge($footer, array_reduce($this->internal->all('footer'), fn(Closure $footer, Closure $proc) => $proc($footer), $this->collectFooterItems([]))());
107  }
collectFooterItems(array $items)
Definition: Conductor.php:302
footerBridge(Footer $footer, array $collection)
Definition: Conductor.php:279
+ Here is the call graph for this function:

◆ onLogout()

ILIAS\LegalDocuments\Conductor::onLogout ( string  $gui)

Definition at line 67 of file Conductor.php.

References Vendor\Package\$e, and $id.

67  : void
68  {
69  try {
70  $id = $this->container->http()->wrapper()->query()->retrieve('withdraw_consent', $this->container->refinery()->to()->string());
71  } catch (Exception $e) {
72  return;
73  }
74 
75  $logout = $this->internal->get('logout', $id);
76  if (null !== $logout) {
77  $this->container->ctrl()->setParameterByClass($gui, 'withdraw_from', $id);
78  $logout();
79  }
80  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ provide()

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

Definition at line 62 of file Conductor.php.

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

62  : Provide
63  {
64  return new Provide($id, $this->internal, $this->container);
65  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ 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 254 of file Conductor.php.

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

254  : Closure
255  {
256  return fn(Closure $proc) => $proc($gui, $cmd)->map(fn($fragment) => $fragment->render(
257  $this->container->ui()->mainTemplate(),
258  $this->container->ui()->renderer()
259  ));
260  }
+ Here is the caller graph for this function:

◆ selfRegistration()

ILIAS\LegalDocuments\Conductor::selfRegistration ( )

Definition at line 179 of file Conductor.php.

179  : SelfRegistration
180  {
181  return new Bundle($this->internal->all('self-registration'));
182  }

◆ setMainTemplateContent()

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

Definition at line 262 of file Conductor.php.

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

262  : void
263  {
264  $this->container->ui()->mainTemplate()->setContent($content);
265  }
+ Here is the caller graph for this function:

◆ userCanReadInternalMail()

ILIAS\LegalDocuments\Conductor::userCanReadInternalMail ( )

Definition at line 148 of file Conductor.php.

148  : Transformation
149  {
150  return $this->container->refinery()->in()->series(array_values($this->internal->all('constrain-internal-mail')));
151  }

◆ userManagementFields()

ILIAS\LegalDocuments\Conductor::userManagementFields ( ilObjUser  $user)

Definition at line 184 of file Conductor.php.

References Vendor\Package\$f.

184  : array
185  {
186  return array_reduce(
187  $this->internal->all('user-management-fields'),
188  static fn(array $prev, callable $f): array => [...$prev, ...$f($user)],
189  []
190  );
191  }

◆ usersWithHiddenOnlineStatus()

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

Definition at line 135 of file Conductor.php.

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

◆ withdraw()

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

Definition at line 126 of file Conductor.php.

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

126  : void
127  {
128  $this->setMainTemplateContent($this->byQueryParams($gui, $cmd, 'withdraw')->then($this->renderPageFragment($gui, $cmd))->value());
129  }
renderPageFragment(string $gui, string $cmd)
Definition: Conductor.php:254
setMainTemplateContent(string $content)
Definition: Conductor.php:262
byQueryParams(string $gui, string $cmd, string $key)
Definition: Conductor.php:232
+ 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.

◆ $routing

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

Definition at line 49 of file Conductor.php.


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