ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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)
 
 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 }

References ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\SelfRegistration\$create_input.

Member Function Documentation

◆ checkboxVariableName()

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

Definition at line 115 of file SelfRegistration.php.

115 : string
116 {
117 return 'accept_' . $this->id;
118 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id.

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

+ 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.

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 }

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().

+ 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.

60 : array
61 {
62 return $this->user->matchingDocument()->map($this->guis(...))->except(fn() => new Ok([]))->value();
63 }

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

+ 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.

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 }
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-...
getItemByPostVar(string $a_post_var)
static getMailsToAddress()
Get mailto: emails.

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

+ 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.

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 }

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

+ 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: