ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilTestPasswordProtectionGUI Class Reference
+ Collaboration diagram for ilTestPasswordProtectionGUI:

Public Member Functions

 __construct (private ilCtrlInterface $ctrl, private ilGlobalTemplateInterface $tpl, private ilLanguage $lng, private ilTestPlayerAbstractGUI $parent_gui, private ilTestPasswordChecker $password_checker, private RequestDataCollector $testrequest, private GlobalScreen $global_screen)
 
 executeCommand ()
 

Data Fields

const CMD_SHOW_PASSWORD_FORM = 'showPasswordForm'
 
const CMD_SAVE_ENTERED_PASSWORD = 'saveEnteredPassword'
 
const CMD_BACK_TO_INFO_SCREEN = 'backToInfoScreen'
 

Protected Member Functions

 buildPasswordMsg ()
 
 buildPasswordForm ()
 

Private Member Functions

 showPasswordFormCmd ()
 
 saveEnteredPasswordCmd ()
 
 backToInfoScreenCmd ()
 
 setNextCommandClass (string $next_command_class)
 
 getNextCommandClass ()
 
 setNextCommandCmd (string $next_command_cmd)
 
 getNextCommandCmd ()
 

Private Attributes

string $next_command_class
 
string $next_command_cmd
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilTestPasswordProtectionGUI::__construct ( private ilCtrlInterface  $ctrl,
private ilGlobalTemplateInterface  $tpl,
private ilLanguage  $lng,
private ilTestPlayerAbstractGUI  $parent_gui,
private ilTestPasswordChecker  $password_checker,
private RequestDataCollector  $testrequest,
private GlobalScreen  $global_screen 
)

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

49  {
50  }

Member Function Documentation

◆ backToInfoScreenCmd()

ilTestPasswordProtectionGUI::backToInfoScreenCmd ( )
private

Definition at line 122 of file class.ilTestPasswordProtectionGUI.php.

References ILIAS\Repository\ctrl().

122  : void
123  {
124  $this->ctrl->redirectByClass([ilRepositoryGUI::class, ilObjTestGUI::class, ilInfoScreenGUI::class]);
125  }
+ Here is the call graph for this function:

◆ buildPasswordForm()

ilTestPasswordProtectionGUI::buildPasswordForm ( )
protected

Definition at line 81 of file class.ilTestPasswordProtectionGUI.php.

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ilFormPropertyGUI\setRequired().

Referenced by showPasswordFormCmd().

82  {
83  $form = new ilPropertyFormGUI();
84  $form->setTitle($this->lng->txt("tst_password_form"));
85  $form->setDescription($this->lng->txt("tst_password_introduction"));
86 
87  $form->setFormAction($this->ctrl->getFormAction($this));
88  $form->addCommandButton(self::CMD_SAVE_ENTERED_PASSWORD, $this->lng->txt("submit"));
89  $form->addCommandButton(self::CMD_BACK_TO_INFO_SCREEN, $this->lng->txt("cancel"));
90 
91  $inp = new ilPasswordInputGUI($this->lng->txt("tst_password"), 'password');
92  $inp->setRequired(true);
93  $inp->setRetype(false);
94  $form->addItem($inp);
95  return $form;
96  }
This class represents a password property in a property form.
setRequired(bool $a_required)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildPasswordMsg()

ilTestPasswordProtectionGUI::buildPasswordMsg ( )
protected

Definition at line 69 of file class.ilTestPasswordProtectionGUI.php.

References ilUtil\getSystemMessageHTML(), and ILIAS\Repository\lng().

Referenced by showPasswordFormCmd().

69  : string
70  {
71  if (!$this->password_checker->wrongUserEnteredPasswordExist()) {
72  return '';
73  }
74 
76  $this->lng->txt('tst_password_entered_wrong_password'),
77  'failure'
78  );
79  }
static getSystemMessageHTML(string $a_txt, string $a_type="info")
Get HTML for a system message.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilTestPasswordProtectionGUI::executeCommand ( )

Definition at line 52 of file class.ilTestPasswordProtectionGUI.php.

References ILIAS\Repository\ctrl(), setNextCommandClass(), and setNextCommandCmd().

52  : void
53  {
54  $this->ctrl->saveParameter($this, 'nextCommand');
55  $next_cmd = explode('::', $this->testrequest->getNextCommand());
56  $this->setNextCommandClass($next_cmd[0]);
57  $this->setNextCommandCmd($next_cmd[1]);
58 
59  $this->ctrl->saveParameter($this->parent_gui, 'lock');
60 
61  switch ($this->ctrl->getNextClass()) {
62  default:
63 
64  $cmd = $this->ctrl->getCmd() . 'Cmd';
65  $this->$cmd();
66  }
67  }
setNextCommandClass(string $next_command_class)
+ Here is the call graph for this function:

◆ getNextCommandClass()

ilTestPasswordProtectionGUI::getNextCommandClass ( )
private

Definition at line 132 of file class.ilTestPasswordProtectionGUI.php.

References $next_command_class.

Referenced by saveEnteredPasswordCmd().

132  : string
133  {
135  }
+ Here is the caller graph for this function:

◆ getNextCommandCmd()

ilTestPasswordProtectionGUI::getNextCommandCmd ( )
private

Definition at line 142 of file class.ilTestPasswordProtectionGUI.php.

References $next_command_cmd.

Referenced by saveEnteredPasswordCmd().

142  : string
143  {
145  }
+ Here is the caller graph for this function:

◆ saveEnteredPasswordCmd()

ilTestPasswordProtectionGUI::saveEnteredPasswordCmd ( )
private

Definition at line 111 of file class.ilTestPasswordProtectionGUI.php.

References ILIAS\Repository\ctrl(), getNextCommandClass(), and getNextCommandCmd().

111  : void
112  {
113  $this->password_checker->setUserEnteredPassword($this->testrequest->strVal('password'));
114 
115  if (!$this->password_checker->isUserEnteredPasswordCorrect()) {
116  $this->password_checker->logWrongEnteredPassword();
117  }
118 
119  $this->ctrl->redirectByClass($this->getNextCommandClass(), $this->getNextCommandCmd());
120  }
+ Here is the call graph for this function:

◆ setNextCommandClass()

ilTestPasswordProtectionGUI::setNextCommandClass ( string  $next_command_class)
private

Definition at line 127 of file class.ilTestPasswordProtectionGUI.php.

References $next_command_class.

Referenced by executeCommand().

127  : void
128  {
129  $this->next_command_class = $next_command_class;
130  }
+ Here is the caller graph for this function:

◆ setNextCommandCmd()

ilTestPasswordProtectionGUI::setNextCommandCmd ( string  $next_command_cmd)
private

Definition at line 137 of file class.ilTestPasswordProtectionGUI.php.

References $next_command_cmd.

Referenced by executeCommand().

137  : void
138  {
139  $this->next_command_cmd = $next_command_cmd;
140  }
+ Here is the caller graph for this function:

◆ showPasswordFormCmd()

ilTestPasswordProtectionGUI::showPasswordFormCmd ( )
private

Definition at line 98 of file class.ilTestPasswordProtectionGUI.php.

References buildPasswordForm(), buildPasswordMsg(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ilTestPlayerLayoutProvider\TEST_PLAYER_VIEW_TITLE.

98  : void
99  {
100  $this->global_screen->tool()->context()->current()->getAdditionalData()->replace(
102  $this->parent_gui->getObject()->getTitle() . ' - ' . $this->lng->txt('tst_password_form')
103  );
104 
105  $this->tpl->setVariable(
106  $this->parent_gui->getContentBlockName(),
107  $this->buildPasswordMsg() . $this->ctrl->getHTML($this->buildPasswordForm())
108  );
109  }
+ Here is the call graph for this function:

Field Documentation

◆ $next_command_class

string ilTestPasswordProtectionGUI::$next_command_class
private

◆ $next_command_cmd

string ilTestPasswordProtectionGUI::$next_command_cmd
private

Definition at line 39 of file class.ilTestPasswordProtectionGUI.php.

Referenced by getNextCommandCmd(), and setNextCommandCmd().

◆ CMD_BACK_TO_INFO_SCREEN

const ilTestPasswordProtectionGUI::CMD_BACK_TO_INFO_SCREEN = 'backToInfoScreen'

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

◆ CMD_SAVE_ENTERED_PASSWORD

const ilTestPasswordProtectionGUI::CMD_SAVE_ENTERED_PASSWORD = 'saveEnteredPassword'

Definition at line 35 of file class.ilTestPasswordProtectionGUI.php.

◆ CMD_SHOW_PASSWORD_FORM

const ilTestPasswordProtectionGUI::CMD_SHOW_PASSWORD_FORM = 'showPasswordForm'

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


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