Properties

$db

$db : \nre\models\DatabaseDriver

Database connection

Type

\nre\models\DatabaseDriver

Methods

__construct()

__construct() 

Construct a new QuesttextsModel.

TODO Catch exception

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

getFirstQuestText()

getFirstQuestText(integer  $questId) : string

Get the first text of a Quest.

Parameters

integer $questId

ID of a Quest

Returns

string —

First text of this Quest or NULL

getQuesttextsOfQuest()

getQuesttextsOfQuest(integer  $questId, string  $questtexttypeUrl = null) : array

Get all Questtexts for a Quest.

Parameters

integer $questId

ID of the Quest

string $questtexttypeUrl

URL of the Questtexttype

Returns

array —

All Questtexts for a Quest

getQuesttextCountOfQuest()

getQuesttextCountOfQuest(integer  $questId, string  $questtexttypeUrl = null) : integer

Get count of Questtexts for a Quest.

Parameters

integer $questId

ID of the Quest

string $questtexttypeUrl

URL of the Questtexttype

Returns

integer —

Amount of Questtexts for a Quest

getRelatedQuesttextsForQuestgroup()

getRelatedQuesttextsForQuestgroup(integer  $questgroupId) 

Get corresponding Questtexts for a Questgroup.

Parameters

integer $questgroupId

ID of Questgroup to get the Questtexst for

Throws

\nre\exceptions\IdNotFoundException

pickQuesttextLastEnteredByCharacter()

pickQuesttextLastEnteredByCharacter(integer  $characterId, array  $questtexts) : array

Get the Questtext that was last entered by a Character.

Parameters

integer $characterId

ID of Character

array $questtexts

List of Questtexts to look into

Returns

array —

Questtext data

getQuesttexttypes()

getQuesttexttypes() : array

Get all registered Questtexttypes.

Returns

array —

Registered Questtexttypes

getQuesttexttypeByUrl()

getQuesttexttypeByUrl(string  $questtexttypeUrl) : array

Get a Questtexttype by its URL.

Parameters

string $questtexttypeUrl

URL-type of Questtexttype

Returns

array —

Questtexttype data

addQuesttextToQuest()

addQuesttextToQuest(integer  $userId, integer  $questId, string  $questtexttypeUrl, string  $text) 

Add a Questtexts to a Quest.

Parameters

integer $userId

ID of user

integer $questId

ID of Quest to add texts to

string $questtexttypeUrl

URL-type of Questtexttype of texts

string $text

Text to add.

setQuestmedia()

setQuestmedia(integer  $questtextId,   $questsmediaId) 

Set the media for a Quest text.

Parameters

integer $questtextId

ID of Quest text to set media for

$questsmediaId

editQuesttext()

editQuesttext(integer  $questtextId, string  $text) 

Edit a Quest text.

Parameters

integer $questtextId

ID of Quest text to edit

string $text

New text

deleteQuesttext()

deleteQuesttext(array  $questtext) 

Delete a Quest text.

Parameters

array $questtext

Data of Quest text to delete

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

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

loadModels()

loadModels() 

Load the Models of this Model.

Throws

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