Properties

$components

$components : array

Required components

Type

array

$models

$models : array

Required models

Type

array

$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

\nre\exceptions\DriverNotFoundException
\nre\exceptions\DriverNotValidException
\nre\exceptions\ModelNotValidException
\nre\exceptions\ModelNotFoundException
\nre\exceptions\ViewNotFoundException
\hhu\z\exceptions\QuesttypeModelNotValidException
\hhu\z\exceptions\QuesttypeModelNotFoundException

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\exceptions\QuesttypeControllerNotFoundException
\hhu\z\exceptions\QuesttypeControllerNotValidException

factory()

factory(string  $controllerName, string  $layoutName, string  $action, \nre\core\Agent  $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

\nre\core\Agent $agent

Corresponding Agent

Throws

\nre\exceptions\DatamodelException
\nre\exceptions\DriverNotFoundException
\nre\exceptions\DriverNotValidException
\nre\exceptions\ModelNotValidException
\nre\exceptions\ModelNotFoundException
\nre\exceptions\ViewNotFoundException
\hhu\z\exceptions\QuesttypeModelNotValidException
\hhu\z\exceptions\QuesttypeModelNotFoundException

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\exceptions\ParamsNotValidException
\nre\exceptions\IdNotFoundException
\nre\exceptions\DatamodelException
\nre\exceptions\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, \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

\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

\nre\exceptions\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

\nre\exceptions\DatamodelException
\nre\exceptions\DriverNotFoundException
\nre\exceptions\DriverNotValidException
\nre\exceptions\ModelNotValidException
\nre\exceptions\ModelNotFoundException
\hhu\z\exceptions\QuesttypeModelNotValidException
\hhu\z\exceptions\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

\nre\exceptions\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\exceptions\ComponentNotValidException
\nre\exceptions\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

\nre\exceptions\ClassNotFoundException

loadModel()

loadModel() 

Load the Model of the Questtype.

Throws

\hhu\z\exceptions\QuesttypeModelNotValidException
\hhu\z\exceptions\QuesttypeModelNotFoundException