ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\LegalDocuments\Wiring Class Reference
+ Inheritance diagram for ILIAS\LegalDocuments\Wiring:
+ Collaboration diagram for ILIAS\LegalDocuments\Wiring:

Public Member Functions

 __construct (private readonly SlotConstructor $slot, ?Map $map=null)
 
 afterLogin (callable $after_login)
 
 showInFooter (callable $show)
 
 canWithdraw (WithdrawProcess $withdraw_process)
 
 showOnLoginPage (callable $show)
 
 hasPublicPage (callable $public_page, ?string $goto_name=null)
 
 hasAgreement (Agreement $on_login, ?string $goto_name=null)
 
 hasHistory ()
 
 onSelfRegistration (SelfRegistration $self_registration)
 
 hasOnlineStatusFilter (callable $only_visible_users)
 
 canReadInternalMails (Constraint $constraint)
 
 canUseSoapApi (Constraint $constraint)
 
 hasDocuments (array $content_as_component=[], ?SelectionMap $available_conditions=null)
 
 hasUserManagementFields (callable $field_value)
 
 hasPublicApi (PublicApi $api)
 
 map ()
 

Private Member Functions

 error (string $message)
 
 addTo (string $name, $id_or_value, $value=null)
 
 protect (Closure $to_be_protected, Closure $protector)
 A B More...
 
 path (string $class)
 

Private Attributes

readonly Map $map
 

Detailed Description

Definition at line 44 of file Wiring.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\LegalDocuments\Wiring::__construct ( private readonly SlotConstructor  $slot,
?Map  $map = null 
)

Definition at line 48 of file Wiring.php.

References ILIAS\LegalDocuments\Wiring\map().

49  {
50  $this->map = $map ?? new Map();
51  }
+ Here is the call graph for this function:

Member Function Documentation

◆ addTo()

ILIAS\LegalDocuments\Wiring::addTo ( string  $name,
  $id_or_value,
  $value = null 
)
private

Definition at line 156 of file Wiring.php.

References ILIAS\LegalDocuments\Wiring\$map, ILIAS\LegalDocuments\Wiring\map(), and null.

Referenced by ILIAS\LegalDocuments\Wiring\afterLogin(), ILIAS\LegalDocuments\Wiring\canReadInternalMails(), ILIAS\LegalDocuments\Wiring\canUseSoapApi(), ILIAS\LegalDocuments\Wiring\canWithdraw(), ILIAS\LegalDocuments\Wiring\hasAgreement(), ILIAS\LegalDocuments\Wiring\hasDocuments(), ILIAS\LegalDocuments\Wiring\hasHistory(), ILIAS\LegalDocuments\Wiring\hasOnlineStatusFilter(), ILIAS\LegalDocuments\Wiring\hasPublicApi(), ILIAS\LegalDocuments\Wiring\hasPublicPage(), ILIAS\LegalDocuments\Wiring\hasUserManagementFields(), ILIAS\LegalDocuments\Wiring\onSelfRegistration(), ILIAS\LegalDocuments\Wiring\showInFooter(), and ILIAS\LegalDocuments\Wiring\showOnLoginPage().

156  : self
157  {
158  $map = $this->map;
159  if ($value !== null) {
160  if ($this->map->has($name, $id_or_value)) {
161  throw new Exception('Duplicated entry. Key ' . $id_or_value . ' already exists for ' . $name);
162  }
163  $map = $map->set($name, $id_or_value, $value);
164  } else {
165  $map = $map->add($name, $id_or_value);
166  }
167 
168  return new self($this->slot, $map);
169  }
set(string $name, string $key, $item)
Definition: Map.php:41
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
add(string $name, $item)
Definition: Map.php:36
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ afterLogin()

ILIAS\LegalDocuments\Wiring::afterLogin ( callable  $after_login)
Parameters
callable()void $after_login

Implements ILIAS\LegalDocuments\UseSlot.

Definition at line 53 of file Wiring.php.

References ILIAS\LegalDocuments\Wiring\addTo().

53  : self
54  {
55  return $this->addTo('after-login', Closure::fromCallable($after_login));
56  }
addTo(string $name, $id_or_value, $value=null)
Definition: Wiring.php:156
+ Here is the call graph for this function:

◆ canReadInternalMails()

ILIAS\LegalDocuments\Wiring::canReadInternalMails ( Constraint  $constraint)

Implements ILIAS\LegalDocuments\UseSlot.

Definition at line 116 of file Wiring.php.

References ILIAS\LegalDocuments\Wiring\addTo().

116  : self
117  {
118  return $this->addTo('constrain-internal-mail', $constraint);
119  }
addTo(string $name, $id_or_value, $value=null)
Definition: Wiring.php:156
+ Here is the call graph for this function:

◆ canUseSoapApi()

ILIAS\LegalDocuments\Wiring::canUseSoapApi ( Constraint  $constraint)

Implements ILIAS\LegalDocuments\UseSlot.

Definition at line 121 of file Wiring.php.

References ILIAS\LegalDocuments\Wiring\addTo().

121  : self
122  {
123  return $this->addTo('use-soap-api', $constraint);
124  }
addTo(string $name, $id_or_value, $value=null)
Definition: Wiring.php:156
+ Here is the call graph for this function:

◆ canWithdraw()

ILIAS\LegalDocuments\Wiring::canWithdraw ( WithdrawProcess  $withdraw_process)

Implements ILIAS\LegalDocuments\UseSlot.

Definition at line 63 of file Wiring.php.

References ILIAS\LegalDocuments\Wiring\addTo(), ILIAS\LegalDocuments\ConsumerSlots\WithdrawProcess\isOnGoing(), ILIAS\LegalDocuments\Wiring\path(), ILIAS\LegalDocuments\Wiring\protect(), ILIAS\LegalDocuments\ConsumerSlots\WithdrawProcess\showValidatePasswordMessage(), ILIAS\LegalDocuments\ConsumerSlots\WithdrawProcess\showWithdraw(), and ILIAS\LegalDocuments\ConsumerSlots\WithdrawProcess\withdrawalFinished().

63  : self
64  {
65  $withdraw = $this->protect($withdraw_process->showWithdraw(...), $withdraw_process->isOnGoing(...));
66 
67  return $this->addTo('withdraw', $this->slot->id(), $withdraw)
68  ->addTo('intercept', new ConditionalIntercept($withdraw_process->isOnGoing(...), $this->slot->id(), new Target($this->path(ilLegalDocumentsWithdrawalGUI::class))))
69  ->addTo('logout-text', $this->slot->id(), $withdraw_process->showValidatePasswordMessage(...))
70  ->addTo('show-on-login-page', $this->slot->withdrawalFinished($withdraw_process->withdrawalFinished(...)));
71  }
addTo(string $name, $id_or_value, $value=null)
Definition: Wiring.php:156
protect(Closure $to_be_protected, Closure $protector)
A B
Definition: Wiring.php:179
path(string $class)
Definition: Wiring.php:187
+ Here is the call graph for this function:

◆ error()

ILIAS\LegalDocuments\Wiring::error ( string  $message)
private

Definition at line 151 of file Wiring.php.

Referenced by ILIAS\LegalDocuments\Wiring\hasHistory().

151  : void
152  {
153  throw new Exception($message);
154  }
$message
Definition: xapiexit.php:31
+ Here is the caller graph for this function:

◆ hasAgreement()

ILIAS\LegalDocuments\Wiring::hasAgreement ( Agreement  $on_login,
?string  $goto_name = null 
)

Implements ILIAS\LegalDocuments\UseSlot.

Definition at line 86 of file Wiring.php.

References ILIAS\LegalDocuments\Wiring\addTo(), ILIAS\LegalDocuments\ConsumerSlots\Agreement\needsToAgree(), null, ILIAS\LegalDocuments\Wiring\path(), ILIAS\LegalDocuments\Wiring\protect(), ILIAS\LegalDocuments\ConsumerSlots\Agreement\showAgreement(), and ILIAS\LegalDocuments\ConsumerSlots\Agreement\showAgreementForm().

86  : self
87  {
88  $public_target = new Target(ilStartUpGUI::class, 'showLegalDocuments', ['id' => $this->slot->id()]);
89  $agreement_target = new Target($this->path(ilLegalDocumentsAgreementGUI::class), '', ['id' => $this->slot->id()]);
90 
91  $wiring = $this->addTo('public-page', $this->slot->id(), fn(...$args) => new Ok($on_login->showAgreement(...$args)))
92  ->addTo('agreement-form', $this->slot->id(), $this->protect($on_login->showAgreementForm(...), $on_login->needsToAgree(...)))
93  ->addTo('intercept', new ConditionalIntercept($on_login->needsToAgree(...), $this->slot->id(), $agreement_target));
94 
95  return null === $goto_name ?
96  $wiring :
97  $wiring->addTo('goto', new ConditionalGotoLink($goto_name, fn() => $on_login->needsToAgree() ? $agreement_target : $public_target));
98  }
addTo(string $name, $id_or_value, $value=null)
Definition: Wiring.php:156
protect(Closure $to_be_protected, Closure $protector)
A B
Definition: Wiring.php:179
path(string $class)
Definition: Wiring.php:187
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ hasDocuments()

ILIAS\LegalDocuments\Wiring::hasDocuments ( array  $content_as_component = [],
?SelectionMap  $available_conditions = null 
)
Parameters
array<string,callable(DocumentContent)Component> $content_as_component
null|SelectionMap<ConditionDefinition>$available_conditions

Implements ILIAS\LegalDocuments\UseSlot.

Definition at line 126 of file Wiring.php.

References ILIAS\LegalDocuments\Wiring\addTo().

126  : self
127  {
128  $available_conditions ??= new SelectionMap();
129  $repository = $this->slot->documentRepository();
130  $document = $this->slot->document($this->slot->readOnlyDocuments($repository), $available_conditions, $content_as_component);
131 
132  return $this->addTo('document', $this->slot->id(), $document)
133  ->addTo('writable-document', $this->slot->id(), $this->slot->document($repository, $available_conditions, $content_as_component));
134  }
addTo(string $name, $id_or_value, $value=null)
Definition: Wiring.php:156
+ Here is the call graph for this function:

◆ hasHistory()

ILIAS\LegalDocuments\Wiring::hasHistory ( )

Implements ILIAS\LegalDocuments\UseSlot.

Definition at line 100 of file Wiring.php.

References ILIAS\LegalDocuments\Wiring\addTo(), ILIAS\LegalDocuments\Wiring\error(), and ILIAS\LegalDocuments\Wiring\map().

100  : self
101  {
102  $document = $this->map->value()['document'][$this->slot->id()] ?? $this->error('Cannot have a history without documents.');
103  return $this->addTo('history', $this->slot->id(), $this->slot->history($document));
104  }
addTo(string $name, $id_or_value, $value=null)
Definition: Wiring.php:156
error(string $message)
Definition: Wiring.php:151
+ Here is the call graph for this function:

◆ hasOnlineStatusFilter()

ILIAS\LegalDocuments\Wiring::hasOnlineStatusFilter ( callable  $only_visible_users)
Parameters
callable(int[])int[] $only_visible_users

Implements ILIAS\LegalDocuments\UseSlot.

Definition at line 111 of file Wiring.php.

References ILIAS\LegalDocuments\Wiring\addTo().

111  : self
112  {
113  return $this->addTo('filter-online-users', $only_visible_users);
114  }
addTo(string $name, $id_or_value, $value=null)
Definition: Wiring.php:156
+ Here is the call graph for this function:

◆ hasPublicApi()

ILIAS\LegalDocuments\Wiring::hasPublicApi ( PublicApi  $api)

Implements ILIAS\LegalDocuments\UseSlot.

Definition at line 141 of file Wiring.php.

References ILIAS\LegalDocuments\Wiring\addTo().

141  : self
142  {
143  return $this->addTo('public-api', $this->slot->id(), $api);
144  }
addTo(string $name, $id_or_value, $value=null)
Definition: Wiring.php:156
+ Here is the call graph for this function:

◆ hasPublicPage()

ILIAS\LegalDocuments\Wiring::hasPublicPage ( callable  $public_page,
?string  $goto_name = null 
)
Parameters
callable(string,string)PageFragment $public_page

Implements ILIAS\LegalDocuments\UseSlot.

Definition at line 78 of file Wiring.php.

References ILIAS\LegalDocuments\Wiring\addTo(), and null.

78  : self
79  {
80  $wiring = $this->addTo('public-page', $this->slot->id(), fn(...$args) => new Ok($public_page(...$args)));
81  return null === $goto_name ?
82  $wiring :
83  $wiring->addTo('goto', new ConditionalGotoLink($goto_name, fn() => new Target(ilStartUpGUI::class, 'showLegalDocuments', ['id' => $this->slot->id()])));
84  }
addTo(string $name, $id_or_value, $value=null)
Definition: Wiring.php:156
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ hasUserManagementFields()

ILIAS\LegalDocuments\Wiring::hasUserManagementFields ( callable  $fields)
Parameters
callable(ilObjUser)array<string, string|ilNonEditableValueGUI> $fields

Implements ILIAS\LegalDocuments\UseSlot.

Definition at line 136 of file Wiring.php.

References ILIAS\LegalDocuments\Wiring\addTo().

136  : self
137  {
138  return $this->addTo('user-management-fields', $this->slot->id(), $field_value);
139  }
addTo(string $name, $id_or_value, $value=null)
Definition: Wiring.php:156
+ Here is the call graph for this function:

◆ map()

ILIAS\LegalDocuments\Wiring::map ( )

Definition at line 146 of file Wiring.php.

References ILIAS\LegalDocuments\Wiring\$map.

Referenced by ILIAS\LegalDocuments\Wiring\__construct(), ILIAS\LegalDocuments\Wiring\addTo(), and ILIAS\LegalDocuments\Wiring\hasHistory().

146  : Map
147  {
148  return $this->map;
149  }
+ Here is the caller graph for this function:

◆ onSelfRegistration()

ILIAS\LegalDocuments\Wiring::onSelfRegistration ( SelfRegistration  $self_registration)

Implements ILIAS\LegalDocuments\UseSlot.

Definition at line 106 of file Wiring.php.

References ILIAS\LegalDocuments\Wiring\addTo().

106  : self
107  {
108  return $this->addTo('self-registration', $self_registration);
109  }
addTo(string $name, $id_or_value, $value=null)
Definition: Wiring.php:156
+ Here is the call graph for this function:

◆ path()

ILIAS\LegalDocuments\Wiring::path ( string  $class)
private
Returns
string[]

Definition at line 187 of file Wiring.php.

Referenced by ILIAS\LegalDocuments\Wiring\canWithdraw(), and ILIAS\LegalDocuments\Wiring\hasAgreement().

187  : array
188  {
189  return [ilDashboardGUI::class, ilPersonalProfileGUI::class, $class];
190  }
+ Here is the caller graph for this function:

◆ protect()

ILIAS\LegalDocuments\Wiring::protect ( Closure  $to_be_protected,
Closure  $protector 
)
private

A B

Parameters
Closure(A...): B $to_be_protected
Closure()bool $protector
Returns
Closure(A ...): Result

Definition at line 179 of file Wiring.php.

Referenced by ILIAS\LegalDocuments\Wiring\canWithdraw(), and ILIAS\LegalDocuments\Wiring\hasAgreement().

179  : Closure
180  {
181  return static fn(...$args): Result => $protector() ? new Ok($to_be_protected(...$args)) : new Error('Not available.');
182  }
+ Here is the caller graph for this function:

◆ showInFooter()

ILIAS\LegalDocuments\Wiring::showInFooter ( callable  $show)
Parameters
callable(Footer)Footer $show

Implements ILIAS\LegalDocuments\UseSlot.

Definition at line 58 of file Wiring.php.

References ILIAS\LegalDocuments\Wiring\addTo().

58  : self
59  {
60  return $this->addTo('footer', $this->slot->id(), Closure::fromCallable($show));
61  }
addTo(string $name, $id_or_value, $value=null)
Definition: Wiring.php:156
+ Here is the call graph for this function:

◆ showOnLoginPage()

ILIAS\LegalDocuments\Wiring::showOnLoginPage ( callable  $show)
Parameters
callable()string $show

Implements ILIAS\LegalDocuments\UseSlot.

Definition at line 73 of file Wiring.php.

References ILIAS\LegalDocuments\Wiring\addTo().

73  : self
74  {
75  return $this->addTo('show-on-login-page', $this->slot->id(), Closure::fromCallable($show));
76  }
addTo(string $name, $id_or_value, $value=null)
Definition: Wiring.php:156
+ Here is the call graph for this function:

Field Documentation

◆ $map

readonly Map ILIAS\LegalDocuments\Wiring::$map
private

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