ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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)
 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 ()
 

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.

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

55  {
56  $this->internal = $internal ?? $this->createInternal();
57  $this->routing = $routing ?? new Routing(
58  $this->container->ctrl(),
59  new SelectSetting(new SessionStore(), new Marshal($this->container->refinery())),
62  );
63  }
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:287
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\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:279
byQueryParams(string $gui, string $cmd, string $key)
Definition: Conductor.php:257
+ 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 252 of file Conductor.php.

References ILIAS\LegalDocuments\Conductor\any().

252  : bool
253  {
254  return !$this->any(static fn($x) => !$predicate($x), $array);
255  }
any(Closure $predicate, array $array)
A
Definition: Conductor.php:242
+ 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 242 of file Conductor.php.

References ILIAS\LegalDocuments\Conductor\find().

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

242  : bool
243  {
244  return $this->find($predicate, $array)->isOk();
245  }
find(Closure $predicate, array $array)
A
Definition: Conductor.php:226
+ 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 257 of file Conductor.php.

References $id.

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

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

◆ createInternal()

ILIAS\LegalDocuments\Conductor::createInternal ( )
private

Definition at line 292 of file Conductor.php.

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

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

292  : Internal
293  {
294  $clock = (new DataFactory())->clock()->system();
295  $action = new UserAction($this->container->user(), $clock);
296 
297  return new Internal($this->provide(...), fn(string $id) => new Wiring(new SlotConstructor(
298  $id,
299  $this->container,
300  $action
301  )));
302  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:24
+ 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 226 of file Conductor.php.

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

226  : Result
227  {
228  foreach ($array as $x) {
229  if ($predicate($x)) {
230  return new Ok($x);
231  }
232  }
233 
234  return new Error('Not found.');
235  }
+ 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:226
+ Here is the call graph for this function:

◆ intercepting()

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

Definition at line 177 of file Conductor.php.

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

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

◆ loginPageHTML()

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

Definition at line 70 of file Conductor.php.

70  : string
71  {
72  $create = $this->internal->get('show-on-login-page', $id);
73  if (!$create) {
74  return '';
75  }
76  return $this->container->ui()->renderer()->render($create());
77  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:24

◆ logoutTarget()

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

Definition at line 95 of file Conductor.php.

95  : LogoutTarget
96  {
97  return new WithdrawalAcknowledgementLogoutTarget(
98  $target,
99  $this->container->http()->wrapper()->query()->has('withdraw_consent'),
100  $this->container->ctrl()
101  );
102  }

◆ logoutText()

ILIAS\LegalDocuments\Conductor::logoutText ( )

Definition at line 79 of file Conductor.php.

References $id.

79  : string
80  {
81  try {
82  $id = $this->container->http()->wrapper()->query()->retrieve(
83  'withdraw_consent',
84  $this->container->refinery()->to()->string()
85  );
86  } catch (Exception) {
87  return '';
88  }
89 
90  $logout_text = $this->internal->get('logout-text', $id);
91 
92  return null === $logout_text ? '' : $this->container->ui()->renderer()->render($logout_text());
93  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:24

◆ modifyFooter()

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

Definition at line 104 of file Conductor.php.

104  : Closure
105  {
106  return array_reduce($this->internal->all('footer'), fn(Closure $footer, Closure $proc) => $proc($footer), $footer);
107  }

◆ provide()

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

Definition at line 65 of file Conductor.php.

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

65  : Provide
66  {
67  return new Provide($id, $this->internal, $this->container);
68  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:24
+ 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 279 of file Conductor.php.

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

279  : Closure
280  {
281  return fn(Closure $proc) => $proc($gui, $cmd)->map(fn($fragment) => $fragment->render(
282  $this->container->ui()->mainTemplate(),
283  $this->container->ui()->renderer()
284  ));
285  }
+ Here is the caller graph for this function:

◆ selfRegistration()

ILIAS\LegalDocuments\Conductor::selfRegistration ( )

Definition at line 182 of file Conductor.php.

182  : SelfRegistration
183  {
184  return new Bundle($this->internal->all('self-registration'));
185  }

◆ setMainTemplateContent()

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

Definition at line 287 of file Conductor.php.

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

287  : void
288  {
289  $this->container->ui()->mainTemplate()->setContent($content);
290  }
+ 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)
Returns
array<string|int, string>

Definition at line 190 of file Conductor.php.

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

190  : array
191  {
192  $this->modals = [];
193  return array_reduce(
194  $this->internal->all('user-management-fields'),
195  fn(array $prev, callable $f): array => [
196  ...$prev,
197  ...array_map(function ($val) {
198  if (is_array($val)) {
199  $this->find(fn($x) => $x instanceof Modal, $val)
200  ->map(fn($modal) => array_push($this->modals, $modal));
201  return $this->find(fn($x) => $x instanceof ilNonEditableValueGUI, $val)->value();
202  }
203  return $val;
204  }, $f($user))
205  ],
206  []
207  );
208  }
find(Closure $predicate, array $array)
A
Definition: Conductor.php:226
+ Here is the call graph for this function:

◆ userManagementModals()

ILIAS\LegalDocuments\Conductor::userManagementModals ( )

Definition at line 210 of file Conductor.php.

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

◆ 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:279
setMainTemplateContent(string $content)
Definition: Conductor.php:287
byQueryParams(string $gui, string $cmd, string $key)
Definition: Conductor.php:257
+ 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.


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