implement dummy-QuesttypeAgent for testing basic QuesttypeAgent-functionality

This commit is contained in:
coderkun 2014-02-26 20:32:02 +01:00
commit 256558e048
4 changed files with 101 additions and 0 deletions

View file

@ -0,0 +1,24 @@
<?php
/**
* The Legend of Z
*
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
* @license http://www.gnu.org/licenses/gpl.html
* @link https://bitbucket.org/coderkun/the-legend-of-z
*/
namespace hhu\z\questtypes;
/**
* Dummy-QuesttypeAgent for testing basic QuesttypeAgent-functionality.
*
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
*/
class DummyQuesttypeAgent extends \hhu\z\QuesttypeAgent
{
}
?>

View file

@ -0,0 +1,48 @@
<?php
/**
* The Legend of Z
*
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
* @license http://www.gnu.org/licenses/gpl.html
* @link https://bitbucket.org/coderkun/the-legend-of-z
*/
namespace hhu\z\questtypes;
/**
* Controller of the Dummy-QuesttypeAgent for testing basic
* QuesttypeAgent-functionality.
*
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
*/
class DummyQuesttypeController extends \hhu\z\QuesttypeController
{
/**
* Action: index.
*/
public function index()
{
// Check for submission
if($this->request->getRequestMethod() == 'POST')
{
// Right answer (dummy)
if(!is_null($this->request->getPostParam('submit'))) {
$this->setQuestSolved();
}
// Wrong answer (dummy)
else {
$this->setQuestUnsolved();
}
}
}
}
?>

View file

@ -0,0 +1,25 @@
<?php
/**
* The Legend of Z
*
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
* @license http://www.gnu.org/licenses/gpl.html
* @link https://bitbucket.org/coderkun/the-legend-of-z
*/
namespace hhu\z\questtypes;
/**
* Model of the Dummy-QuesttypeAgent for testing basic
* QuesttypeAgent-functionality.
*
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
*/
class DummyQuesttypeModel extends \hhu\z\QuesttypeModel
{
}
?>

View file

@ -0,0 +1,4 @@
<form method="post">
<input type="submit" name="submit" value="richtige Antwort" />
<input type="submit" name="wrong" value="falsche Antwort" />
</form>