# \hhu\z\modelsQuesttextsModel

Model to interact with Questtexts-table.

## Summary

Methods
Properties
Constants
__construct()
load()
factory()
getFirstQuestText()
getQuesttextsOfQuest()
getQuesttextCountOfQuest()
getRelatedQuesttextsForQuestgroup()
pickQuesttextLastEnteredByCharacter()
getQuesttexttypes()
getQuesttexttypeByUrl()
addQuesttextToQuest()
setQuestmedia()
editQuesttext()
deleteQuesttext()
No public properties found
No constants found
No protected methods found
$db
N/A
loadDriver()
connect()
getClassName()
loadModels()
No private properties found
N/A

File
  models/QuesttextsModel.inc
Package
  Default
Class hierarchy
  \nre\core\Model
  \nre\models\DatabaseModel
  \hhu\z\Model
  \hhu\z\models\QuesttextsModel

## Tags

author | Oliver Hanraths oliver.hanraths@uni-duesseldorf.de

## Properties

### $db

    $db : \nre\models\DatabaseDriver

Database connection

#### Type

\nre\models\DatabaseDriver

#

Inherited from
  \nre\models\DatabaseModel

## Tags

static |

## Methods

### __construct()

    __construct()

Construct a new QuesttextsModel.

TODO Catch exception

#

## Tags

None found

### 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

#

static

Inherited from
  \nre\core\Model

## Tags

None found

### factory()

    factory(string  $modelName)

Instantiate a Model (Factory Pattern).

#### Parameters

string | $modelName | Name of the Model to instantiate

#

static

Inherited from
  \nre\core\Model

## Tags

None found

### 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

#

## Tags

None found

### 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

#

## Tags

None found

### 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

#

## Tags

None found

### 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

#

## Tags

None found

### 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

#

## Tags

None found

### getQuesttexttypes()

    getQuesttexttypes() : array

Get all registered Questtexttypes.

#### Returns

array —

Registered Questtexttypes

#

## Tags

None found

### getQuesttexttypeByUrl()

    getQuesttexttypeByUrl(string  $questtexttypeUrl) : array

Get a Questtexttype by its URL.

#### Parameters

string | $questtexttypeUrl | URL-type of Questtexttype

#### Returns

array —

Questtexttype data

#

## Tags

None found

### 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.

#

## Tags

None found

### setQuestmedia()

    setQuestmedia(integer  $questtextId,   $questsmediaId)

Set the media for a Quest text.

#### Parameters

integer | $questtextId | ID of Quest text to set media for
| $questsmediaId |

#

## Tags

None found

### editQuesttext()

    editQuesttext(integer  $questtextId, string  $text)

Edit a Quest text.

#### Parameters

integer | $questtextId | ID of Quest text to edit
string | $text | New text

#

## Tags

None found

### deleteQuesttext()

    deleteQuesttext(array  $questtext)

Delete a Quest text.

#### Parameters

array | $questtext | Data of Quest text to delete

#

## Tags

None found

### loadDriver()

    loadDriver(string  $driverName)

Load the database driver.

#### Parameters

string | $driverName | Name of the database driver

#### Throws

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

#

Inherited from
  \nre\models\DatabaseModel

## Tags

None found

### 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

#

Inherited from
  \nre\models\DatabaseModel

## Tags

None found

### 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

#

static

Inherited from
  \nre\core\Model

## Tags

None found

### loadModels()

    loadModels()

Load the Models of this Model.

#### Throws

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

#

Inherited from
  \nre\core\Model

## Tags

None found

### QuesttextsModel.inc