ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilTestPasswordProtectionGUI Class Reference
+ Collaboration diagram for ilTestPasswordProtectionGUI:

Public Member Functions

 __construct (ilCtrl $ctrl, ilTemplate $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

 $nextCommandClass
 
 $nextCommandCmd
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

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

Member Function Documentation

◆ backToInfoScreenCmd()

ilTestPasswordProtectionGUI::backToInfoScreenCmd ( )
private

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

138  {
139  $this->ctrl->redirectByClass('ilObjTestGUI', 'infoScreen');
140  }

◆ buildPasswordForm()

ilTestPasswordProtectionGUI::buildPasswordForm ( )
protected
Returns
ilPropertyFormGUI

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

References $form, and ilFormPropertyGUI\setRequired().

Referenced by showPasswordFormCmd().

96  {
97  $form = new ilPropertyFormGUI();
98  $form->setTitle($this->lng->txt("tst_password_form"));
99  $form->setDescription($this->lng->txt("tst_password_introduction"));
100 
101  $form->setFormAction($this->ctrl->getFormAction($this));
102  $form->addCommandButton(self::CMD_SAVE_ENTERED_PASSWORD, $this->lng->txt("submit"));
103  $form->addCommandButton(self::CMD_BACK_TO_INFO_SCREEN, $this->lng->txt("cancel"));
104 
105  $inp = new ilPasswordInputGUI($this->lng->txt("tst_password"), 'password');
106  $inp->setRequired(true);
107  $inp->setRetype(false);
108  $form->addItem($inp);
109  return $form;
110  }
This class represents a property form user interface.
if(isset($_POST['submit'])) $form
This class represents a password property in a property form.
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildPasswordMsg()

ilTestPasswordProtectionGUI::buildPasswordMsg ( )
protected

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

Referenced by showPasswordFormCmd().

81  {
82  if (!$this->passwordChecker->wrongUserEnteredPasswordExist()) {
83  return '';
84  }
85 
86  return $this->tpl->getMessageHTML(
87  $this->lng->txt('tst_password_entered_wrong_password'),
88  'failure'
89  );
90  }
+ Here is the caller graph for this function:

◆ executeCommand()

ilTestPasswordProtectionGUI::executeCommand ( )

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

References $_GET, setNextCommandClass(), and setNextCommandCmd().

64  {
65  $this->ctrl->saveParameter($this, 'nextCommand');
66  $nextCommand = explode('::', $_GET['nextCommand']);
67  $this->setNextCommandClass($nextCommand[0]);
68  $this->setNextCommandCmd($nextCommand[1]);
69 
70  $this->ctrl->saveParameter($this->parentGUI, 'lock');
71 
72  switch ($this->ctrl->getNextClass()) {
73  default:
74 
75  $cmd = $this->ctrl->getCmd() . 'Cmd';
76  $this->$cmd();
77  }
78  }
$_GET["client_id"]
+ Here is the call graph for this function:

◆ getNextCommandClass()

ilTestPasswordProtectionGUI::getNextCommandClass ( )
private

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

References $nextCommandClass.

Referenced by saveEnteredPasswordCmd().

+ Here is the caller graph for this function:

◆ getNextCommandCmd()

ilTestPasswordProtectionGUI::getNextCommandCmd ( )
private

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

References $nextCommandCmd.

Referenced by saveEnteredPasswordCmd().

+ Here is the caller graph for this function:

◆ saveEnteredPasswordCmd()

ilTestPasswordProtectionGUI::saveEnteredPasswordCmd ( )
private

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

References $_POST, getNextCommandClass(), and getNextCommandCmd().

127  {
128  $this->passwordChecker->setUserEnteredPassword($_POST["password"]);
129 
130  if (!$this->passwordChecker->isUserEnteredPasswordCorrect()) {
131  $this->passwordChecker->logWrongEnteredPassword();
132  }
133 
134  $this->ctrl->redirectByClass($this->getNextCommandClass(), $this->getNextCommandCmd());
135  }
$_POST["username"]
+ Here is the call graph for this function:

◆ setNextCommandClass()

ilTestPasswordProtectionGUI::setNextCommandClass (   $nextCommandClass)
private

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

References $nextCommandClass.

Referenced by executeCommand().

143  {
144  $this->nextCommandClass = $nextCommandClass;
145  }
+ Here is the caller graph for this function:

◆ setNextCommandCmd()

ilTestPasswordProtectionGUI::setNextCommandCmd (   $nextCommandCmd)
private

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

References $nextCommandCmd.

Referenced by executeCommand().

153  {
154  $this->nextCommandCmd = $nextCommandCmd;
155  }
+ Here is the caller graph for this function:

◆ showPasswordFormCmd()

ilTestPasswordProtectionGUI::showPasswordFormCmd ( )
private

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

References $form, buildPasswordForm(), and buildPasswordMsg().

113  {
114  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
115  require_once 'Services/Form/classes/class.ilPasswordInputGUI.php';
116 
117  $msg = $this->buildPasswordMsg();
118  $form = $this->buildPasswordForm();
119 
120  $this->tpl->setVariable(
121  $this->parentGUI->getContentBlockName(),
122  $msg . $this->ctrl->getHTML($form)
123  );
124  }
if(isset($_POST['submit'])) $form
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilTestPasswordProtectionGUI::$ctrl
protected

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

Referenced by __construct().

◆ $lng

ilTestPasswordProtectionGUI::$lng
protected

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

Referenced by __construct().

◆ $nextCommandClass

ilTestPasswordProtectionGUI::$nextCommandClass
private

◆ $nextCommandCmd

ilTestPasswordProtectionGUI::$nextCommandCmd
private

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

Referenced by getNextCommandCmd(), and setNextCommandCmd().

◆ $parentGUI

ilTestPasswordProtectionGUI::$parentGUI
protected

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

Referenced by __construct().

◆ $passwordChecker

ilTestPasswordProtectionGUI::$passwordChecker
protected

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

Referenced by __construct().

◆ $tpl

ilTestPasswordProtectionGUI::$tpl
protected

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

Referenced by __construct().

◆ CMD_BACK_TO_INFO_SCREEN

const ilTestPasswordProtectionGUI::CMD_BACK_TO_INFO_SCREEN = 'backToInfoScreen'

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

◆ CMD_SAVE_ENTERED_PASSWORD

const ilTestPasswordProtectionGUI::CMD_SAVE_ENTERED_PASSWORD = 'saveEnteredPassword'

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

◆ CMD_SHOW_PASSWORD_FORM

const ilTestPasswordProtectionGUI::CMD_SHOW_PASSWORD_FORM = 'showPasswordForm'

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


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