ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilTestPasswordProtectionGUI Class Reference
+ Collaboration diagram for ilTestPasswordProtectionGUI:

Public Member Functions

 __construct (ilCtrl $ctrl, ilGlobalTemplateInterface $tpl, ilLanguage $lng, ilTestPlayerAbstractGUI $parentGUI, ilTestPasswordChecker $passwordChecker)
 
 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 ()
 

Protected Attributes

 $ctrl
 
 $tpl
 
 $lng
 
 $parentGUI
 
 $passwordChecker
 

Private Member Functions

 showPasswordFormCmd ()
 
 saveEnteredPasswordCmd ()
 
 backToInfoScreenCmd ()
 
 setNextCommandClass ($nextCommandClass)
 
 getNextCommandClass ()
 
 setNextCommandCmd ($nextCommandCmd)
 
 getNextCommandCmd ()
 

Private Attributes

ILIAS Test InternalRequestService $testrequest
 
 $nextCommandClass
 
 $nextCommandCmd
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilTestPasswordProtectionGUI::__construct ( ilCtrl  $ctrl,
ilGlobalTemplateInterface  $tpl,
ilLanguage  $lng,
ilTestPlayerAbstractGUI  $parentGUI,
ilTestPasswordChecker  $passwordChecker 
)

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

References $ctrl, $DIC, $lng, $parentGUI, $passwordChecker, $tpl, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ backToInfoScreenCmd()

ilTestPasswordProtectionGUI::backToInfoScreenCmd ( )
private

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

References ILIAS\Repository\ctrl().

161  {
162  $this->ctrl->redirectByClass('ilObjTestGUI', 'infoScreen');
163  }
+ Here is the call graph for this function:

◆ buildPasswordForm()

ilTestPasswordProtectionGUI::buildPasswordForm ( )
protected
Returns
ilPropertyFormGUI

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

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

Referenced by showPasswordFormCmd().

113  {
114  $form = new ilPropertyFormGUI();
115  $form->setTitle($this->lng->txt("tst_password_form"));
116  $form->setDescription($this->lng->txt("tst_password_introduction"));
117 
118  $form->setFormAction($this->ctrl->getFormAction($this));
119  $form->addCommandButton(self::CMD_SAVE_ENTERED_PASSWORD, $this->lng->txt("submit"));
120  $form->addCommandButton(self::CMD_BACK_TO_INFO_SCREEN, $this->lng->txt("cancel"));
121 
122  $inp = new ilPasswordInputGUI($this->lng->txt("tst_password"), 'password');
123  $inp->setRequired(true);
124  $inp->setRetype(false);
125  $form->addItem($inp);
126  return $form;
127  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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 97 of file class.ilTestPasswordProtectionGUI.php.

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

Referenced by showPasswordFormCmd().

97  : string
98  {
99  if (!$this->passwordChecker->wrongUserEnteredPasswordExist()) {
100  return '';
101  }
102 
104  $this->lng->txt('tst_password_entered_wrong_password'),
105  'failure'
106  );
107  }
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 80 of file class.ilTestPasswordProtectionGUI.php.

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

81  {
82  $this->ctrl->saveParameter($this, 'nextCommand');
83  $nextCommand = explode('::', $this->testrequest->getNextCommand());
84  $this->setNextCommandClass($nextCommand[0]);
85  $this->setNextCommandCmd($nextCommand[1]);
86 
87  $this->ctrl->saveParameter($this->parentGUI, 'lock');
88 
89  switch ($this->ctrl->getNextClass()) {
90  default:
91 
92  $cmd = $this->ctrl->getCmd() . 'Cmd';
93  $this->$cmd();
94  }
95  }
+ Here is the call graph for this function:

◆ getNextCommandClass()

ilTestPasswordProtectionGUI::getNextCommandClass ( )
private

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

References $nextCommandClass.

Referenced by saveEnteredPasswordCmd().

170  : string
171  {
173  }
+ Here is the caller graph for this function:

◆ getNextCommandCmd()

ilTestPasswordProtectionGUI::getNextCommandCmd ( )
private

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

References $nextCommandCmd.

Referenced by saveEnteredPasswordCmd().

180  : string
181  {
182  return $this->nextCommandCmd;
183  }
+ Here is the caller graph for this function:

◆ saveEnteredPasswordCmd()

ilTestPasswordProtectionGUI::saveEnteredPasswordCmd ( )
private

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

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

150  {
151  $this->passwordChecker->setUserEnteredPassword($_POST["password"]);
152 
153  if (!$this->passwordChecker->isUserEnteredPasswordCorrect()) {
154  $this->passwordChecker->logWrongEnteredPassword();
155  }
156 
157  $this->ctrl->redirectByClass($this->getNextCommandClass(), $this->getNextCommandCmd());
158  }
+ Here is the call graph for this function:

◆ setNextCommandClass()

ilTestPasswordProtectionGUI::setNextCommandClass (   $nextCommandClass)
private

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

References $nextCommandClass.

Referenced by executeCommand().

166  {
167  $this->nextCommandClass = $nextCommandClass;
168  }
+ Here is the caller graph for this function:

◆ setNextCommandCmd()

ilTestPasswordProtectionGUI::setNextCommandCmd (   $nextCommandCmd)
private

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

References $nextCommandCmd.

Referenced by executeCommand().

176  {
177  $this->nextCommandCmd = $nextCommandCmd;
178  }
+ Here is the caller graph for this function:

◆ showPasswordFormCmd()

ilTestPasswordProtectionGUI::showPasswordFormCmd ( )
private

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

References $DIC, buildPasswordForm(), buildPasswordMsg(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ilTestPlayerLayoutProvider\TEST_PLAYER_TITLE.

130  {
131  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
132  require_once 'Services/Form/classes/class.ilPasswordInputGUI.php';
133 
134  global $DIC;
135  $DIC->globalScreen()->tool()->context()->current()->getAdditionalData()->replace(
137  $this->parentGUI->getObject()->getTitle() . ' - ' . $this->lng->txt('tst_password_form')
138  );
139 
140  $msg = $this->buildPasswordMsg();
141  $form = $this->buildPasswordForm();
142 
143  $this->tpl->setVariable(
144  $this->parentGUI->getContentBlockName(),
145  $msg . $this->ctrl->getHTML($form)
146  );
147  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilTestPasswordProtectionGUI::$ctrl
protected

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

Referenced by __construct().

◆ $lng

ilTestPasswordProtectionGUI::$lng
protected

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

Referenced by __construct().

◆ $nextCommandClass

ilTestPasswordProtectionGUI::$nextCommandClass
private

◆ $nextCommandCmd

ilTestPasswordProtectionGUI::$nextCommandCmd
private

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

Referenced by getNextCommandCmd(), and setNextCommandCmd().

◆ $parentGUI

ilTestPasswordProtectionGUI::$parentGUI
protected

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

Referenced by __construct().

◆ $passwordChecker

ilTestPasswordProtectionGUI::$passwordChecker
protected

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

Referenced by __construct().

◆ $testrequest

ILIAS Test InternalRequestService ilTestPasswordProtectionGUI::$testrequest
private

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

◆ $tpl

ilTestPasswordProtectionGUI::$tpl
protected

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

Referenced by __construct().

◆ CMD_BACK_TO_INFO_SCREEN

const ilTestPasswordProtectionGUI::CMD_BACK_TO_INFO_SCREEN = 'backToInfoScreen'

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

◆ CMD_SAVE_ENTERED_PASSWORD

const ilTestPasswordProtectionGUI::CMD_SAVE_ENTERED_PASSWORD = 'saveEnteredPassword'

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

◆ CMD_SHOW_PASSWORD_FORM

const ilTestPasswordProtectionGUI::CMD_SHOW_PASSWORD_FORM = 'showPasswordForm'

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


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