ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilCmiXapiRegistrationGUI Class Reference
+ Collaboration diagram for ilCmiXapiRegistrationGUI:

Public Member Functions

 __construct (ilObjCmiXapi $object)
 ilCmiXapiRegistrationGUI constructor. More...
 
 executeCommand ()
 

Data Fields

const CMD_SHOW_FORM = 'showForm'
 
const CMD_SAVE_FORM = 'saveForm'
 
const CMD_CANCEL = 'cancel'
 
const DEFAULT_CMD = self::CMD_SHOW_FORM
 

Protected Member Functions

 cancelCmd ()
 
 showFormCmd (?ilPropertyFormGUI $form=null)
 
 saveFormCmd ()
 
 buildForm ()
 
 hasRegistration ()
 
 saveRegistration (ilPropertyFormGUI $form)
 

Protected Attributes

ilObjCmiXapi $object
 
ilCmiXapiUser $cmixUser
 

Private Attributes

ilGlobalTemplateInterface $main_tpl
 
ILIAS DI Container $dic
 

Detailed Description

Definition at line 30 of file class.ilCmiXapiRegistrationGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilCmiXapiRegistrationGUI::__construct ( ilObjCmiXapi  $object)

ilCmiXapiRegistrationGUI constructor.

Definition at line 47 of file class.ilCmiXapiRegistrationGUI.php.

48 {
49 global $DIC;
50 $this->dic = $DIC;
51 $this->main_tpl = $DIC->ui()->mainTemplate();
52
53 $this->object = $object;
54
55 $this->cmixUser = new ilCmiXapiUser($object->getId(), $DIC->user()->getId(), $object->getPrivacyIdent());
56 }
global $DIC
Definition: shib_login.php:26

References $DIC, $object, ilObject\getId(), and ilObjCmiXapi\getPrivacyIdent().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildForm()

ilCmiXapiRegistrationGUI::buildForm ( )
protected
Exceptions
ilCtrlException

Definition at line 114 of file class.ilCmiXapiRegistrationGUI.php.

115 {
116 $form = new ilPropertyFormGUI();
117
118 $form->setFormAction($this->dic->ctrl()->getFormAction($this, self::CMD_SHOW_FORM));
119
120 if (!$this->hasRegistration()) {
121 $form->setTitle($this->dic->language()->txt('form_create_registration'));
122 $form->addCommandButton(self::CMD_SAVE_FORM, $this->dic->language()->txt('btn_create_registration'));
123 } else {
124 $form->setTitle($this->dic->language()->txt('form_change_registration'));
125 $form->addCommandButton(self::CMD_SAVE_FORM, $this->dic->language()->txt('btn_change_registration'));
126 }
127
128 $form->addCommandButton(self::CMD_CANCEL, $this->dic->language()->txt('cancel'));
129
130 $userIdent = new ilEMailInputGUI($this->dic->language()->txt('field_user_ident'), 'user_ident');
131 $userIdent->setInfo($this->dic->language()->txt('field_user_ident_info'));
132 $userIdent->setRequired(true);
133 $userIdent->setValue($this->cmixUser->getUsrIdent());
134 $form->addItem($userIdent);
135
136 return $form;
137 }
This class represents a email property in a property form.
This class represents a property form user interface.

References hasRegistration().

Referenced by saveFormCmd(), and showFormCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancelCmd()

ilCmiXapiRegistrationGUI::cancelCmd ( )
protected
Exceptions
ilCtrlException

Definition at line 75 of file class.ilCmiXapiRegistrationGUI.php.

75 : void
76 {
77 $this->dic->ctrl()->redirectByClass(ilObjCmiXapiGUI::class, ilObjCmiXapiGUI::CMD_INFO_SCREEN);
78 }

References ilObjCmiXapiGUI\CMD_INFO_SCREEN.

◆ executeCommand()

ilCmiXapiRegistrationGUI::executeCommand ( )
Exceptions
ilCtrlException

Definition at line 61 of file class.ilCmiXapiRegistrationGUI.php.

61 : void
62 {
63 global $DIC; /* @var \ILIAS\DI\Container $DIC */
64
65 switch ($DIC->ctrl()->getNextClass()) {
66 default:
67 $command = $DIC->ctrl()->getCmd(self::DEFAULT_CMD) . 'Cmd';
68 $this->{$command}();
69 }
70 }

References $DIC.

◆ hasRegistration()

ilCmiXapiRegistrationGUI::hasRegistration ( )
protected

Definition at line 139 of file class.ilCmiXapiRegistrationGUI.php.

139 : int
140 {
141 return strlen($this->cmixUser->getUsrIdent());
142 }

Referenced by buildForm().

+ Here is the caller graph for this function:

◆ saveFormCmd()

ilCmiXapiRegistrationGUI::saveFormCmd ( )
protected
Exceptions
ilCtrlException

Definition at line 95 of file class.ilCmiXapiRegistrationGUI.php.

95 : void
96 {
97 $form = $this->buildForm();
98
99 if (!$form->checkInput()) {
100 $form->setValuesByPost();
101 $this->showFormCmd($form);
102 return;
103 }
104
105 $this->saveRegistration($form);
106
107 $this->main_tpl->setOnScreenMessage('success', $this->dic->language()->txt('registration_saved_successfully'), true);
108 $this->dic->ctrl()->redirectByClass(ilObjCmiXapiGUI::class, ilObjCmiXapiGUI::CMD_INFO_SCREEN);
109 }
showFormCmd(?ilPropertyFormGUI $form=null)
saveRegistration(ilPropertyFormGUI $form)

References buildForm(), ilObjCmiXapiGUI\CMD_INFO_SCREEN, saveRegistration(), and showFormCmd().

+ Here is the call graph for this function:

◆ saveRegistration()

ilCmiXapiRegistrationGUI::saveRegistration ( ilPropertyFormGUI  $form)
protected

Definition at line 144 of file class.ilCmiXapiRegistrationGUI.php.

144 : void
145 {
146 $this->cmixUser->setUsrIdent($form->getInput('user_ident'));
147 $this->cmixUser->save();
148 }
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-...

References ilPropertyFormGUI\getInput().

Referenced by saveFormCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showFormCmd()

ilCmiXapiRegistrationGUI::showFormCmd ( ?ilPropertyFormGUI  $form = null)
protected
Parameters
ilPropertyFormGUI | null$form

Definition at line 83 of file class.ilCmiXapiRegistrationGUI.php.

83 : void
84 {
85 if ($form === null) {
86 $form = $this->buildForm();
87 }
88
89 $this->main_tpl->setContent($form->getHTML());
90 }

References buildForm().

Referenced by saveFormCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $cmixUser

ilCmiXapiUser ilCmiXapiRegistrationGUI::$cmixUser
protected

Definition at line 40 of file class.ilCmiXapiRegistrationGUI.php.

◆ $dic

ILIAS DI Container ilCmiXapiRegistrationGUI::$dic
private

Definition at line 42 of file class.ilCmiXapiRegistrationGUI.php.

◆ $main_tpl

ilGlobalTemplateInterface ilCmiXapiRegistrationGUI::$main_tpl
private

Definition at line 41 of file class.ilCmiXapiRegistrationGUI.php.

◆ $object

ilObjCmiXapi ilCmiXapiRegistrationGUI::$object
protected

Definition at line 38 of file class.ilCmiXapiRegistrationGUI.php.

Referenced by __construct().

◆ CMD_CANCEL

const ilCmiXapiRegistrationGUI::CMD_CANCEL = 'cancel'

Definition at line 34 of file class.ilCmiXapiRegistrationGUI.php.

◆ CMD_SAVE_FORM

const ilCmiXapiRegistrationGUI::CMD_SAVE_FORM = 'saveForm'

Definition at line 33 of file class.ilCmiXapiRegistrationGUI.php.

◆ CMD_SHOW_FORM

const ilCmiXapiRegistrationGUI::CMD_SHOW_FORM = 'showForm'

Definition at line 32 of file class.ilCmiXapiRegistrationGUI.php.

◆ DEFAULT_CMD

const ilCmiXapiRegistrationGUI::DEFAULT_CMD = self::CMD_SHOW_FORM

Definition at line 36 of file class.ilCmiXapiRegistrationGUI.php.


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