\hhu\z\questtypesChoiceinputQuesttypeModel

Model of the ChoiceinputQuesttypeAgent for choosing between predefined input values.

Summary

Methods
Properties
Constants
load()
factory()
checkClass()
getChoiceinputQuest()
getChoiceinputLists()
getChoiceinputChoices()
setCharacterSubmission()
getCharacterSubmission()
setTextForQuest()
setListForText()
No public properties found
No constants found
__construct()
$db
N/A
getClassName()
loadClass()
loadDriver()
connect()
loadModels()
No private properties found
N/A

Properties

$db

$db : \nre\models\DatabaseDriver

Database connection

Type

\nre\models\DatabaseDriver

Methods

load()

load(string  $modelName) 

Load the class of a Model.

Parameters

string $modelName

Name of the Model to load

Throws

\nre\exceptions\ModelNotFoundException
\nre\exceptions\ModelNotValidException

factory()

factory(string  $modelName) 

Instantiate a Model (Factory Pattern).

Parameters

string $modelName

Name of the Model to instantiate

checkClass()

checkClass(string  $className, string  $parentClassName) 

Check inheritance of the QuesttypeModel-class.

Parameters

string $className

Name of the class to check

string $parentClassName

Name of the parent class

Throws

\nre\exceptions\ClassNotValidException

getChoiceinputQuest()

getChoiceinputQuest(integer  $questId) : array

Get choiceinput-text for a Quest.

Parameters

integer $questId

ID of Quest

Returns

array —

Choiceinput-text

getChoiceinputLists()

getChoiceinputLists(integer  $questId) : array

Get all lists of input values for a choiceinput-text.

Parameters

integer $questId

ID of Quest

Returns

array —

List

getChoiceinputChoices()

getChoiceinputChoices(integer  $listId) : array

Get the list of values for a choiceinput-list.

Parameters

integer $listId

ID of list

Returns

array —

Input values

setCharacterSubmission()

setCharacterSubmission(  $listId, integer  $characterId, string  $answer) 

Save Character’s submitted answer for one choiceinput-list.

Parameters

$listId
integer $characterId

ID of Character

string $answer

Submitted answer for this list

getCharacterSubmission()

getCharacterSubmission(  $listId, integer  $characterId) : integer

Get answer of one choiceinput-list submitted by Character.

Parameters

$listId
integer $characterId

ID of Character

Returns

integer —

Submitted answer for this list or null

setTextForQuest()

setTextForQuest(integer  $userId, integer  $questId, string  $text) 

Set the text for a Quest and correct choice input lists count.

Parameters

integer $userId

ID of user setting text

integer $questId

ID of Quest to set text for

string $text

Text for Quest

setListForText()

setListForText(integer  $questId, integer  $number, array  $choices, integer  $correctPos) 

Set list of choices for a text.

Parameters

integer $questId

ID of Quest to set choices for

integer $number

List number

array $choices

List of choices

integer $correctPos

Position of correct answer

__construct()

__construct() 

Construct a new Model.

TODO Catch exception

Throws

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

getClassName()

getClassName(string  $modelName) : string

Determine the classname for the given Model name.

Parameters

string $modelName

Model name to get classname of

Returns

string —

Classname fore the Model name

loadClass()

loadClass(string  $questtypeName, string  $fullClassName) 

Load the class of a QuesttypeModel.

Parameters

string $questtypeName

Name of the QuesttypeModel to load

string $fullClassName

Name of the class to load

Throws

\nre\exceptions\ClassNotFoundException

loadDriver()

loadDriver(string  $driverName) 

Load the database driver.

Parameters

string $driverName

Name of the database driver

Throws

\nre\exceptions\DriverNotFoundException
\nre\exceptions\DriverNotValidException

connect()

connect(string  $driverName, array  $config) 

Establish a connection to the database.

Parameters

string $driverName

Name of the database driver

array $config

Connection settings

Throws

\nre\exceptions\DatamodelException

loadModels()

loadModels() 

Load the Models of this Model.

Throws

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