ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\DataProtection\Consumer Class Reference
+ Inheritance diagram for ILIAS\DataProtection\Consumer:
+ Collaboration diagram for ILIAS\DataProtection\Consumer:

Public Member Functions

 __construct (?Container $container=null)
 
 id ()
 
 uses (UseSlot $slot, LazyProvide $provide)
 A More...
 

Data Fields

const ID = 'dpro'
 
const GOTO_NAME = 'data_protection'
 

Private Member Functions

 showMatchingDocument (User $user, UI $ui, Provide $legal_documents)
 
 userHasWithdrawn ()
 
 usersWhoDidntAgree (ilDBInterface $database)
 

Private Attributes

readonly Container $container
 

Detailed Description

Definition at line 42 of file Consumer.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\DataProtection\Consumer::__construct ( ?Container  $container = null)

Definition at line 49 of file Consumer.php.

References $GLOBALS.

50  {
51  $this->container = $container ?? $GLOBALS['DIC'] ?? new Container();
52  }
$GLOBALS["DIC"]
Definition: wac.php:53
readonly Container $container
Definition: Consumer.php:47

Member Function Documentation

◆ id()

ILIAS\DataProtection\Consumer::id ( )

Implements ILIAS\LegalDocuments\Consumer.

Definition at line 54 of file Consumer.php.

54  : string
55  {
56  return self::ID;
57  }

◆ showMatchingDocument()

ILIAS\DataProtection\Consumer::showMatchingDocument ( User  $user,
UI  $ui,
Provide  $legal_documents 
)
private

Definition at line 101 of file Consumer.php.

References ILIAS\LegalDocuments\ConsumerToolbox\User\cannotAgree(), ILIAS\LegalDocuments\Value\Document\content(), ILIAS\LegalDocuments\ConsumerToolbox\UI\create(), ILIAS\LegalDocuments\Provide\document(), ILIAS\LegalDocuments\ConsumerToolbox\User\isLoggedIn(), ILIAS\LegalDocuments\ConsumerToolbox\User\matchingDocument(), null, and ILIAS\LegalDocuments\ConsumerToolbox\UI\txt().

Referenced by ILIAS\DataProtection\Consumer\uses().

101  : Closure
102  {
103  return function (Closure $footer) use ($user, $ui, $legal_documents) {
104  $in_footer = fn($v) => $footer('usr_agreement', $ui->txt('usr_agreement'), $v);
105  if (!$user->isLoggedIn()) {
106  return $in_footer(new URI(ilLink::_getLink(null, 'usr', [], self::GOTO_NAME)));
107  }
108  if ($user->cannotAgree()) {
109  return $footer;
110  }
111 
112  $render = fn(Document $document): Closure => $in_footer($ui->create()->modal()->roundtrip(
113  $document->content()->title(),
114  [$legal_documents->document()->contentAsComponent($document->content())]
115  ));
116 
117  return $user->matchingDocument()
118  ->map($render)
119  ->except(fn() => new Ok($footer))->value();
120  };
121  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
modal(string $title="", string $cancel_label="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ userHasWithdrawn()

ILIAS\DataProtection\Consumer::userHasWithdrawn ( )
private

Definition at line 123 of file Consumer.php.

Referenced by ILIAS\DataProtection\Consumer\uses().

123  : void
124  {
125  $this->container['ilAppEventHandler']->raise(
126  'components/ILIAS/DataProtection',
127  'withdraw',
128  ['event' => $this->container->user()]
129  );
130  }
+ Here is the caller graph for this function:

◆ usersWhoDidntAgree()

ILIAS\DataProtection\Consumer::usersWhoDidntAgree ( ilDBInterface  $database)
private

Definition at line 132 of file Consumer.php.

References ilDBInterface\fetchAll(), ilDBInterface\in(), ilDBInterface\query(), and ilDBConstants\T_INTEGER.

Referenced by ILIAS\DataProtection\Consumer\uses().

132  : Closure
133  {
134  return function (array $users) use ($database): array {
135  $users = $database->in('usr_id', $users, false, ilDBConstants::T_INTEGER);
136  $result = $database->query(
137  'SELECT usr_id FROM usr_pref WHERE keyword = "dpro_agree_date" AND (value IS NULL OR value = "false" OR value = "") AND ' . $users
138  );
139 
140  return array_map(intval(...), array_column($database->fetchAll($result), 'usr_id'));
141  };
142  }
fetchAll(ilDBStatement $statement, int $fetch_mode=ilDBConstants::FETCHMODE_ASSOC)
query(string $query)
Run a (read-only) Query on the database.
in(string $field, array $values, bool $negate=false, string $type="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ uses()

ILIAS\DataProtection\Consumer::uses ( UseSlot  $slot,
LazyProvide  $provide 
)

A

Parameters
UseSlot<A>$slot
Returns
UseSlot

Implements ILIAS\LegalDocuments\Consumer.

Definition at line 59 of file Consumer.php.

References ILIAS\LegalDocuments\UseSlot\hasDocuments(), ILIAS\LegalDocuments\UseSlot\hasPublicPage(), ILIAS\DataProtection\Consumer\showMatchingDocument(), ILIAS\LegalDocuments\UseSlot\showOnLoginPage(), ILIAS\DataProtection\Consumer\userHasWithdrawn(), and ILIAS\DataProtection\Consumer\usersWhoDidntAgree().

59  : UseSlot
60  {
61  $blocks = new Blocks($this->id(), $this->container, $provide);
62  $default = $blocks->defaultMappings();
63  $global_settings = new Settings($blocks->selectSettingsFrom($blocks->readOnlyStore($blocks->globalStore())));
64  $is_active = $global_settings->enabled()->value();
65  $build_user = fn(ilObjUser $user) => $blocks->user($global_settings, new UserSettings(
66  $blocks->selectSettingsFrom($blocks->userStore($user))
67  ), $user);
68  $public_api = new PublicApi($is_active, $build_user);
69  $slot = $slot->hasDocuments($default->contentAsComponent(), $default->conditionDefinitions())
70  ->hasHistory()
71  ->hasPublicApi($public_api);
72 
73  if (!$is_active) {
74  return $slot->hasPublicPage($blocks->notAvailable(...), self::GOTO_NAME);
75  }
76 
77  $user = $build_user($this->container->user());
78 
79  $slot = $slot->showOnLoginPage($blocks->slot()->showOnLoginPage());
80 
81  $agreement = $blocks->slot()->agreement($user);
82  $constraint = $this->container->refinery()->custom()->constraint(...);
83 
84  if ($global_settings->noAcceptance()->value()) {
85  $slot = $slot->showInFooter($this->showMatchingDocument($user, $blocks->ui(), $provide))
86  ->hasPublicPage($agreement->showAgreement(...), self::GOTO_NAME);
87  } else {
88  $slot = $slot->canWithdraw($blocks->slot()->withdrawProcess($user, $global_settings, $this->userHasWithdrawn(...)))
89  ->hasAgreement($agreement, self::GOTO_NAME)
90  ->showInFooter($blocks->slot()->modifyFooter($user, self::GOTO_NAME))
91  ->onSelfRegistration($blocks->slot()->selfRegistration($user, $build_user))
92  ->hasOnlineStatusFilter($blocks->slot()->onlineStatusFilter($this->usersWhoDidntAgree($this->container->database())))
93  ->hasUserManagementFields($blocks->userManagementAgreeDateField($build_user, 'dpro_agree_date', 'dpro'))
94  ->canReadInternalMails($blocks->slot()->canReadInternalMails($build_user))
95  ->canUseSoapApi($constraint(fn($u) => !$public_api->needsToAgree($u), 'Data Protection not agreed.'));
96  }
97 
98  return $slot;
99  }
showMatchingDocument(User $user, UI $ui, Provide $legal_documents)
Definition: Consumer.php:101
usersWhoDidntAgree(ilDBInterface $database)
Definition: Consumer.php:132
+ Here is the call graph for this function:

Field Documentation

◆ $container

readonly Container ILIAS\DataProtection\Consumer::$container
private

Definition at line 47 of file Consumer.php.

◆ GOTO_NAME

const ILIAS\DataProtection\Consumer::GOTO_NAME = 'data_protection'

Definition at line 45 of file Consumer.php.

◆ ID

const ILIAS\DataProtection\Consumer::ID = 'dpro'

Definition at line 44 of file Consumer.php.

Referenced by ILIAS\DataProtection\test\ConsumerTest\testId().


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