ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\SelfRegistration Class Reference
+ Inheritance diagram for ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\SelfRegistration:
+ Collaboration diagram for ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\SelfRegistration:

Public Member Functions

 __construct (private readonly string $id, private readonly UI $ui, private readonly User $user, private readonly Provide $legal_documents, private readonly Closure $render, private readonly Closure $build_user, ?Closure $create_input=null)
 
 legacyInputGUIs ()
 
 saveLegacyForm (ilPropertyFormGUI $form)
 
 userCreation (ilObjUser $user)
 

Private Member Functions

 guis (Document $document)
 
 checkboxVariableName ()
 

Private Attributes

readonly Closure $create_input
 

Detailed Description

Definition at line 39 of file SelfRegistration.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\SelfRegistration::__construct ( private readonly string  $id,
private readonly UI  $ui,
private readonly User  $user,
private readonly Provide  $legal_documents,
private readonly Closure  $render,
private readonly Closure  $build_user,
?Closure  $create_input = null 
)
Parameters
Closure(list<Component>|Component)string $render
Closure(ilObjUser)User $build_user
Closure(string)object $create_input

Definition at line 48 of file SelfRegistration.php.

56  {
57  $this->create_input = $create_input ?? fn(string $class, ...$args) => new $class(...$args);
58  }

Member Function Documentation

◆ checkboxVariableName()

ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\SelfRegistration::checkboxVariableName ( )
private

Definition at line 115 of file SelfRegistration.php.

References $id.

Referenced by ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\SelfRegistration\guis(), and ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\SelfRegistration\saveLegacyForm().

115  : string
116  {
117  return 'accept_' . $this->id;
118  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the caller graph for this function:

◆ guis()

ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\SelfRegistration::guis ( Document  $document)
private
Returns
array<ilFormPropertyGUI|ilFormSectionHeaderGUI>

Definition at line 99 of file SelfRegistration.php.

References ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\SelfRegistration\$create_input, ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\SelfRegistration\checkboxVariableName(), ILIAS\LegalDocuments\Value\Document\content(), and ILIAS\Repository\ui().

Referenced by ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\SelfRegistration\legacyInputGUIs().

99  : array
100  {
101  $header = ($this->create_input)(ilFormSectionHeaderGUI::class);
102  $header->setTitle($this->ui->txt('usr_agreement'));
103 
104  $doc = ($this->create_input)(ilCustomInputGUI::class);
105  $document_content = ($this->render)($this->legal_documents->document()->contentAsComponent($document->content()));
106  $doc->setHtml(sprintf('<div id="%s_agreement">%s</div>', htmlentities($this->id), $document_content));
107 
108  $checkbox = ($this->create_input)(ilCheckboxInputGUI::class, $this->ui->txt('accept_usr_agreement'), $this->checkboxVariableName());
109  $checkbox->setRequired(true);
110  $checkbox->setValue('1');
111 
112  return [$header, $doc, $checkbox];
113  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ legacyInputGUIs()

ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\SelfRegistration::legacyInputGUIs ( )
Returns
list<ilFormPropertyGUI>

Implements ILIAS\LegalDocuments\ConsumerSlots\SelfRegistration.

Definition at line 60 of file SelfRegistration.php.

References ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\SelfRegistration\guis(), and ILIAS\Repository\user().

60  : array
61  {
62  return $this->user->matchingDocument()->map($this->guis(...))->except(fn() => new Ok([]))->value();
63  }
+ Here is the call graph for this function:

◆ saveLegacyForm()

ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\SelfRegistration::saveLegacyForm ( ilPropertyFormGUI  $form)

Implements ILIAS\LegalDocuments\ConsumerSlots\SelfRegistration.

Definition at line 65 of file SelfRegistration.php.

References ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\SelfRegistration\checkboxVariableName(), ilPropertyFormGUI\getInput(), ilPropertyFormGUI\getItemByPostVar(), ilSystemSupportContacts\getMailsToAddress(), ilLegacyFormElementsUtil\prepareFormOutput(), ILIAS\Repository\ui(), and ILIAS\Repository\user().

65  : bool
66  {
67  if ($this->user->matchingDocument()->isError()) {
68  $this->ui->loadLanguageModule($this->id);
69  $this->ui->loadLanguageModule('ldoc');
70  $this->ui->mainTemplate()->setOnScreenMessage('failure', sprintf(
71  $this->ui->txt('account_reg_not_possible'),
73  ), true);
74  return false;
75  }
76  $input = $form->getItemByPostVar($this->checkboxVariableName());
77  if ($input && !$form->getInput($this->checkboxVariableName())) {
78  $input->setAlert($this->ui->txt('force_accept_usr_agreement'));
79  return false;
80  }
81 
82  return true;
83  }
getItemByPostVar(string $a_post_var)
static prepareFormOutput($a_str, bool $a_strip=false)
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
static getMailsToAddress()
Get mailto: emails.
+ Here is the call graph for this function:

◆ userCreation()

ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\SelfRegistration::userCreation ( ilObjUser  $user)

Implements ILIAS\LegalDocuments\ConsumerSlots\SelfRegistration.

Definition at line 85 of file SelfRegistration.php.

Referenced by ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\SelfRegistrationTest\testUserCreation(), and ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\SelfRegistrationTest\testUserCreationFailed().

85  : void
86  {
87  // This will accept the document as the USER and NOT as anonymous. If the document is different thats not handled.
88  $user = ($this->build_user)($user);
89  try {
90  $user->acceptMatchingDocument();
91  } catch (NotOKException) {
92  $user->acceptAnyDocument();
93  }
94  }
+ Here is the caller graph for this function:

Field Documentation

◆ $create_input

readonly Closure ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\SelfRegistration::$create_input
private

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