Properties

$components

$components : array

Required components

Type

array

$models

$models : array

Required models

Type

array

$log

$log : \hhu\z\Logger

Logger instance

Type

\hhu\z\Logger

$linker

$linker : \hhu\z\Linker

Linker instance

Type

\hhu\z\Linker

$view

$view : \nre\core\View

View of the Controller

Type

\nre\core\View

$viewData

$viewData : array

Data to pass to the View

Type

array

Methods

__construct()

__construct(string  $layoutName, string  $action, \hhu\z\controllers\Agent  $agent) 

Construct a new application Controller.

Parameters

string $layoutName

Name of the current Layout

string $action

Current Action

\hhu\z\controllers\Agent $agent

Corresponding Agent

Throws

\hhu\z\controllers\DriverNotFoundException
\hhu\z\controllers\DriverNotValidException
\hhu\z\controllers\ModelNotValidException
\hhu\z\controllers\ModelNotFoundException
\hhu\z\controllers\QuesttypeModelNotValidException
\hhu\z\controllers\QuesttypeModelNotFoundException
\hhu\z\controllers\ViewNotFoundException

preFilter()

preFilter(\nre\core\Request  $request, \nre\core\Response  $response) 

Prefilter that is executed before running the Controller.

Parameters

\nre\core\Request $request

Current request

\nre\core\Response $response

Current response

postFilter()

postFilter(\nre\core\Request  $request, \nre\core\Response  $response) 

Prefilter that is executed after running the Controller.

Parameters

\nre\core\Request $request

Current request

\nre\core\Response $response

Current response

load()

load(string  $controllerName) 

Load a QuesttypeController.

Parameters

string $controllerName

Name of the QuesttypeController to load

Throws

\hhu\z\controllers\QuesttypeControllerNotFoundException
\hhu\z\controllers\QuesttypeControllerNotValidException

factory()

factory(string  $controllerName, string  $layoutName, string  $action,   $agent) 

Instantiate a QuesttypeController (Factory Pattern).

Parameters

string $controllerName

Name of the QuesttypeController to instantiate

string $layoutName

Name of the current Layout

string $action

Current Action

$agent

Throws

\hhu\z\controllers\DatamodelException
\hhu\z\controllers\DriverNotFoundException
\hhu\z\controllers\DriverNotValidException
\hhu\z\controllers\ModelNotValidException
\hhu\z\controllers\ModelNotFoundException
\hhu\z\controllers\QuesttypeModelNotValidException
\hhu\z\controllers\QuesttypeModelNotFoundException
\hhu\z\controllers\ViewNotFoundException

run()

run(\nre\core\Request  $request, \nre\core\Response  $response) 

Run the Controller.

This method executes the Action of the Controller defined by the current Request.

Parameters

\nre\core\Request $request

Current request

\nre\core\Response $response

Current response

Throws

\nre\core\ParamsNotValidException
\nre\core\IdNotFoundException
\nre\core\DatamodelException
\nre\core\ActionNotFoundException

render()

render(array  $viewData = null) : string

Generate the output.

Parameters

array $viewData

Data to pass to the View

Returns

string —

Generated output

saveAnswersOfCharacter()

saveAnswersOfCharacter(array  $seminary, array  $questgroup, array  $quest, array  $character, array  $answers) 

Save the answers of a Character for a Quest.

Parameters

array $seminary

Current Seminary data

array $questgroup

Current Questgroup data

array $quest

Current Quest data

array $character

Current Character data

array $answers

Character answers for the Quest

saveDataForCharacterAnswers()

saveDataForCharacterAnswers(array  $seminary, array  $questgroup, array  $quest, array  $character, array  $data) 

Save additional data for the answers of a Character for a Quest.

Parameters

array $seminary

Current Seminary data

array $questgroup

Current Questgroup data

array $quest

Current Quest data

array $character

Current Character data

array $data

Additional (POST-) data

matchAnswersOfCharacter()

matchAnswersOfCharacter(array  $seminary, array  $questgroup, array  $quest, array  $character, array  $answers) : boolean

Check if answers of a Character for a Quest match the correct ones.

Parameters

array $seminary

Current Seminary data

array $questgroup

Current Questgroup data

array $quest

Current Quest data

array $character

Current Character data

array $answers

Character answers for the Quest

Returns

boolean —

True/false for a right/wrong answer or null for moderator evaluation

quest()

quest(array  $seminary, array  $questgroup, array  $quest, array  $character, \hhu\z\controllers\Exception  $exception) 

Action: quest.

Show the task of a Quest.

Parameters

array $seminary

Current Seminary data

array $questgroup

Current Questgroup data

array $quest

Current Quest data

array $character

Current Character data

\hhu\z\controllers\Exception $exception

Character submission exception

submission()

submission(array  $seminary, array  $questgroup, array  $quest, array  $character) 

Action: submission.

Show the submission of a Character for a Quest.

Parameters

array $seminary

Current Seminary data

array $questgroup

Current Questgroup data

array $quest

Current Quest data

array $character

Current Character data

edittask()

edittask(array  $seminary, array  $questgroup, array  $quest) 

Action: edittask.

Edit the task of a Quest.

Parameters

array $seminary

Current Seminary data

array $questgroup

Current Questgroup data

array $quest

Current Quest data

checkClass()

checkClass(string  $className, string  $parentClassName) 

Check inheritance of the QuesttypeController-class.

Parameters

string $className

Name of the class to check

string $parentClassName

Name of the parent class

Throws

\hhu\z\controllers\ClassNotValidException

log()

log(string  $message, integer  $logMode = \nre\core\Logger::LOGMODE_AUTO) 

Log an error.

Parameters

string $message

Error message to log

integer $logMode

Log mode (optional)

set()

set(string  $name, mixed  $data) 

Set data for the View.

Parameters

string $name

Key

mixed $data

Value

redirect()

redirect(string  $url) 

Redirect to the given URL.

Parameters

string $url

Relative URL

checkModels()

checkModels(string  $modelName) : boolean

Check if Models of this Controller are loaded and available.

Parameters

string $modelName

Arbitrary number of Models to check

Returns

boolean —

All given Models are loaded and available

getView()

getView() : \nre\core\View

Get the View of the Controller

Returns

\nre\core\View —

View of the Controller

loadModels()

loadModels() 

Load the Models of this Controller.

Throws

\hhu\z\controllers\DatamodelException
\hhu\z\controllers\DriverNotFoundException
\hhu\z\controllers\DriverNotValidException
\hhu\z\controllers\ModelNotValidException
\hhu\z\controllers\ModelNotFoundException
\hhu\z\controllers\QuesttypeModelNotValidException
\hhu\z\controllers\QuesttypeModelNotFoundException

loadView()

loadView(string  $layoutName, string  $action) 

Load the View of this QuesttypeController.

Parameters

string $layoutName

Name of the current Layout

string $action

Current Action

Throws

\hhu\z\controllers\ViewNotFoundException

getClassName()

getClassName(string  $questtypeName) : string

Determine the Controller-classname for the given Questtype-name.

Parameters

string $questtypeName

Questtype-name to get Controller-classname of

Returns

string —

Classname for the Questtype-name

loadComponents()

loadComponents() 

Load the Components of this Controller.

Throws

\nre\core\ComponentNotValidException
\nre\core\ComponentNotFoundException

loadClass()

loadClass(string  $questtypeName, string  $fullClassName) 

Load the class of a QuesttypeController

Parameters

string $questtypeName

Name of the QuesttypeController to load

string $fullClassName

Name of the class to load

Throws

\hhu\z\controllers\ClassNotFoundException

loadModel()

loadModel() 

Load the Model of the Questtype.

Throws

\hhu\z\controllers\QuesttypeModelNotValidException
\hhu\z\controllers\QuesttypeModelNotFoundException