ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
class.ilTestPasswordProtectionGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4
14{
15 const CMD_SHOW_PASSWORD_FORM = 'showPasswordForm';
16 const CMD_SAVE_ENTERED_PASSWORD = 'saveEnteredPassword';
17 const CMD_BACK_TO_INFO_SCREEN = 'backToInfoScreen';
18
22 protected $ctrl;
23
27 protected $tpl;
28
32 protected $lng;
33
37 protected $parentGUI;
38
43
48
53
55 {
56 $this->ctrl = $ctrl;
57 $this->tpl = $tpl;
58 $this->lng = $lng;
59 $this->parentGUI = $parentGUI;
60 $this->passwordChecker = $passwordChecker;
61 }
62
63 public function executeCommand()
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 }
80
81 private function showPasswordFormCmd()
82 {
83 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
84 require_once 'Services/Form/classes/class.ilPasswordInputGUI.php';
85
86 $form = new ilPropertyFormGUI();
87 $form->setTitle($this->lng->txt("tst_password_form"));
88 $form->setDescription($this->lng->txt("tst_password_introduction"));
89
90 $form->setFormAction($this->ctrl->getFormAction($this));
91 $form->addCommandButton(self::CMD_SAVE_ENTERED_PASSWORD, $this->lng->txt("submit"));
92 $form->addCommandButton(self::CMD_BACK_TO_INFO_SCREEN, $this->lng->txt("cancel"));
93
94 $inp = new ilPasswordInputGUI($this->lng->txt("tst_password"), 'password');
95 $inp->setRequired(true);
96 $inp->setRetype(false);
97 $form->addItem($inp);
98
99 $this->tpl->setVariable($this->parentGUI->getContentBlockName(), $this->ctrl->getHTML($form));
100 }
101
102 private function saveEnteredPasswordCmd()
103 {
104 $this->passwordChecker->setUserEnteredPassword($_POST["password"]);
105
106 if( !$this->passwordChecker->isUserEnteredPasswordCorrect() )
107 {
108 ilUtil::sendFailure($this->lng->txt("tst_password_entered_wrong_password"), true);
109 }
110
111 $this->ctrl->redirectByClass($this->getNextCommandClass(), $this->getNextCommandCmd());
112 }
113
114 private function backToInfoScreenCmd()
115 {
116 $this->ctrl->redirectByClass('ilObjTestGUI', 'infoScreen');
117 }
118
120 {
121 $this->nextCommandClass = $nextCommandClass;
122 }
123
124 private function getNextCommandClass()
125 {
127 }
128
130 {
131 $this->nextCommandCmd = $nextCommandCmd;
132 }
133
134 private function getNextCommandCmd()
135 {
137 }
138}
$_GET["client_id"]
This class provides processing control methods.
language handling
This class represents a password property in a property form.
This class represents a property form user interface.
special template class to simplify handling of ITX/PEAR
__construct(ilCtrl $ctrl, ilTemplate $tpl, ilLanguage $lng, ilTestPlayerAbstractGUI $parentGUI, ilTestPasswordChecker $passwordChecker)
Output class for assessment test execution.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST['username']
Definition: cron.php:12
$cmd
Definition: sahs_server.php:35