ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 138 of file class.ilTestPasswordProtectionGUI.php.

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

◆ buildPasswordForm()

ilTestPasswordProtectionGUI::buildPasswordForm ( )
protected
Returns
ilPropertyFormGUI

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

References ilFormPropertyGUI\setRequired().

Referenced by showPasswordFormCmd().

97  {
98  $form = new ilPropertyFormGUI();
99  $form->setTitle($this->lng->txt("tst_password_form"));
100  $form->setDescription($this->lng->txt("tst_password_introduction"));
101 
102  $form->setFormAction($this->ctrl->getFormAction($this));
103  $form->addCommandButton(self::CMD_SAVE_ENTERED_PASSWORD, $this->lng->txt("submit"));
104  $form->addCommandButton(self::CMD_BACK_TO_INFO_SCREEN, $this->lng->txt("cancel"));
105 
106  $inp = new ilPasswordInputGUI($this->lng->txt("tst_password"), 'password');
107  $inp->setRequired(true);
108  $inp->setRetype(false);
109  $form->addItem($inp);
110  return $form;
111  }
This class represents a property form user interface.
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 81 of file class.ilTestPasswordProtectionGUI.php.

Referenced by showPasswordFormCmd().

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

◆ executeCommand()

ilTestPasswordProtectionGUI::executeCommand ( )

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

References $_GET, $cmd, 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  {
74  default:
75 
76  $cmd = $this->ctrl->getCmd().'Cmd';
77  $this->$cmd();
78  }
79  }
$_GET["client_id"]
$cmd
Definition: sahs_server.php:35
+ Here is the call graph for this function:

◆ getNextCommandClass()

ilTestPasswordProtectionGUI::getNextCommandClass ( )
private

Definition at line 148 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 158 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  {
132  $this->passwordChecker->logWrongEnteredPassword();
133  }
134 
135  $this->ctrl->redirectByClass($this->getNextCommandClass(), $this->getNextCommandCmd());
136  }
$_POST["username"]
+ Here is the call graph for this function:

◆ setNextCommandClass()

ilTestPasswordProtectionGUI::setNextCommandClass (   $nextCommandClass)
private

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

References $nextCommandClass.

Referenced by executeCommand().

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

◆ setNextCommandCmd()

ilTestPasswordProtectionGUI::setNextCommandCmd (   $nextCommandCmd)
private

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

References $nextCommandCmd.

Referenced by executeCommand().

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

◆ showPasswordFormCmd()

ilTestPasswordProtectionGUI::showPasswordFormCmd ( )
private

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

References buildPasswordForm(), and buildPasswordMsg().

114  {
115  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
116  require_once 'Services/Form/classes/class.ilPasswordInputGUI.php';
117 
118  $msg = $this->buildPasswordMsg();
119  $form = $this->buildPasswordForm();
120 
121  $this->tpl->setVariable(
122  $this->parentGUI->getContentBlockName(), $msg.$this->ctrl->getHTML($form)
123  );
124  }
+ 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: