Properties

$models

$models : array

Required models

Type

array

$components

$components : array

Required components

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

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.

Display a text with input fields and evaluate if user input matches with stored regular expressions.

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

load()

load(string  $controllerName) 

Load the class of a Controller.

Parameters

string $controllerName

Name of the Controller to load

Throws

\nre\exceptions\ControllerNotFoundException
\nre\exceptions\ControllerNotValidException

factory()

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

Instantiate a Controller (Factory Pattern).

Parameters

string $controllerName

Name of the Controller to instantiate

string $layoutName

Name of the current Layout

string $action

Current Action

string $agent

Corresponding Agent

Throws

\nre\exceptions\DatamodelException
\nre\exceptions\DriverNotFoundException
\nre\exceptions\DriverNotValidException
\nre\exceptions\ModelNotValidException
\nre\exceptions\ModelNotFoundException
\nre\exceptions\ViewNotFoundException

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

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

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

__construct()

__construct(string  $layoutName, string  $action, \nre\core\Agent  $agent) 

Construct a new Controller.

Parameters

string $layoutName

Name of the current Layout

string $action

Current Action

\nre\core\Agent $agent

Corresponding Agent

Throws

\nre\exceptions\DriverNotFoundException
\nre\exceptions\DriverNotValidException
\nre\exceptions\ModelNotValidException
\nre\exceptions\ModelNotFoundException
\nre\exceptions\ViewNotFoundException

loadModels()

loadModels() 

Load the Models of this Controller.

Throws

\nre\exceptions\DatamodelException
\nre\exceptions\DriverNotFoundException
\nre\exceptions\DriverNotValidException
\nre\exceptions\ModelNotValidException
\nre\exceptions\ModelNotFoundException

loadView()

loadView(string  $layoutName, string  $action) 

Load the View of this Controller.

Parameters

string $layoutName

Name of the current Layout

string $action

Current Action

Throws

\nre\exceptions\ViewNotFoundException

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

getClassName()

getClassName(string  $controllerName) : string

Determine the classname for the given Controller name.

Parameters

string $controllerName

Controller name to get classname of

Returns

string —

Classname for the Controller name

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

loadComponents()

loadComponents() 

Load the Components of this Controller.

Throws

\nre\exceptions\ComponentNotValidException
\nre\exceptions\ComponentNotFoundException

isMatching()

isMatching(string  $regex, string  $answer) : boolean

Check if an Character answer matches a Regex.

Parameters

string $regex

Regex to match against

string $answer

Character answer to match

Returns

boolean —

Whether answer matches Regex or not