# \hhu\z\modelsCharactergroupsquestsModel

Model of the CharactergroupsquestsAgent to interact with Charactergroupsquests-table.

## Summary

Methods
Properties
Constants
__construct()
load()
factory()
getQuestsForCharactergroupsgroup()
getQuestByUrl()
getQuestById()
getQuestsForGroup()
getXPsOfGroupForQuest()
setXPsOfGroupForQuest()
deleteGroupForQuest()
characterGroupsQuestTitleExists()
setMediaForQuest()
uploadMediaForQuest()
getMediaForQuest()
createQuest()
editQuest()
deleteQuest()
$models
No constants found
No protected methods found
$db
N/A
loadDriver()
connect()
getClassName()
loadModels()
No private properties found
N/A

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

## Tags

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

## Properties

### $models

    $models : array

Required models

#### Type

array

#

## Tags

None found

### $db

    $db : \nre\models\DatabaseDriver

Database connection

#### Type

\nre\models\DatabaseDriver

#

Inherited from
  \nre\models\DatabaseModel

## Tags

static |

## Methods

### __construct()

    __construct()

Construct a new CharactergroupsquestsModel.

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

### getQuestsForCharactergroupsgroup()

    getQuestsForCharactergroupsgroup(integer  $groupsgroupId) : array

Get Character groups Quests of a Character groups-groups.

#### Parameters

integer | $groupsgroupId | ID of the Character groups-group

#### Returns

array —

Character groups Quest data

#

## Tags

None found

### getQuestByUrl()

    getQuestByUrl(integer  $groupsgroupId, string  $questUrl) : array

Get a Character groups Quest by its URL.

#### Parameters

integer | $groupsgroupId | ID of the Character groups-group
string | $questUrl | URL-title of the Character groups Quest

#### Throws

\nre\exceptions\IdNotFoundException

#### Returns

array —

Character groups Quest data

#

## Tags

None found

### getQuestById()

    getQuestById(integer  $questId) : array

Get a Character groups Quest by its ID.

#### Parameters

integer | $questId | ID of the Character groups Quest

#### Throws

\nre\exceptions\IdNotFoundException

#### Returns

array —

Character groups Quest data

#

## Tags

None found

### getQuestsForGroup()

    getQuestsForGroup(integer  $groupId) : array

Get Character groups Quests for a Character group.

#### Parameters

integer | $groupId | ID of the Character group

#### Returns

array —

Character groups Quests

#

## Tags

None found

### getXPsOfGroupForQuest()

    getXPsOfGroupForQuest(integer  $questId, integer  $groupId) : array

Get XPs of a Character group for a Character groups Quest.

#### Parameters

integer | $questId | ID of Character groups Quest
integer | $groupId | ID of Character group to get XPs of

#### Returns

array —

XP-record

#

## Tags

None found

### setXPsOfGroupForQuest()

    setXPsOfGroupForQuest(integer  $questId, integer  $groupId, float  $xpsFactor)

Set XPs of a Character group for a Character groups Quest.

#### Parameters

integer | $questId | ID of Character groups Quest
integer | $groupId | ID of Character group to set XPs of
float | $xpsFactor | XPs-factor

#

## Tags

None found

### deleteGroupForQuest()

    deleteGroupForQuest(integer  $questId, integer  $groupId)

Remove a Character group from a Character groups Quest.

#### Parameters

integer | $questId | ID of Character groups Quest
integer | $groupId | ID of Character group to remove

#

## Tags

None found

### characterGroupsQuestTitleExists()

    characterGroupsQuestTitleExists(  $title, integer  $questId = null) : boolean

Check if a Character groups Quest title already exists.

#### Parameters

| $title |
integer | $questId | Do not check this ID (for editing)

#### Returns

boolean —

Whether Character groups Quest title exists or not

#

## Tags

None found

### setMediaForQuest()

    setMediaForQuest(integer  $questId, integer  $mediaId)

Set the media for a Character groups Quest.

#### Parameters

integer | $questId | ID of Quest to upload media for
integer | $mediaId | ID of Quests media

#

## Tags

None found

### uploadMediaForQuest()

    uploadMediaForQuest(integer  $userId, integer  $seminaryId, integer  $questId, array  $file, string  $filename) : boolean

Upload a media for a Character groups Quest.

#### Parameters

integer | $userId | ID of user that does the upload
integer | $seminaryId | ID of Seminary
integer | $questId | ID of Quest to upload media for
array | $file | File-array of file to upload
string | $filename | Filename for media

#### Returns

boolean —

Whether upload succeeded or not

#

## Tags

None found

### getMediaForQuest()

    getMediaForQuest(integer  $questId) : array

Get uploaded Medai for a Character groups Quest.

#### Parameters

integer | $questId | ID of Quest to get media for

#### Returns

array —

Seminary uploads

#

## Tags

None found

### createQuest()

    createQuest(integer  $userId, integer  $groupsgroupId, integer  $questgroupId, string  $title, string  $description, integer  $xps, string  $rules, string  $wonText, string  $lostText) : integer

Create a new Character groups Quest.

#### Parameters

integer | $userId | ID of user
integer | $groupsgroupId | ID of Character groups-group
integer | $questgroupId | ID of Quest group
string | $title | Title of new Quest
string | $description | Description of new Quset
integer | $xps | Amount of XPs for new Quest
string | $rules | Rules of new Quest
string | $wonText | Won-text of new Quset
string | $lostText | Lost-text of new Quest

#### Returns

integer —

ID of newly created Quest

#

## Tags

None found

### editQuest()

    editQuest(integer  $questId, integer  $groupsgroupId, integer  $questgroupId, string  $title, string  $description, integer  $xps, string  $rules, string  $wonText, string  $lostText)

Edit a Character groups Quest.

#### Parameters

integer | $questId | ID of Character groups Quest to edit
integer | $groupsgroupId | ID of Character groups-group
integer | $questgroupId | ID of Quest group
string | $title | Title of new Quest
string | $description | Description of new Quset
integer | $xps | Amount of XPs for new Quest
string | $rules | Rules of new Quest
string | $wonText | Won-text of new Quset
string | $lostText | Lost-text of new Quest

#

## Tags

None found

### deleteQuest()

    deleteQuest(integer  $questId)

Delete a Character groups Quest.

#### Parameters

integer | $questId | ID of Character groups Quest 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

### CharactergroupsquestsModel.inc