Properties

$models

$models : array

Required models

Type

array

$db

$db : \nre\models\DatabaseDriver

Database connection

Type

\nre\models\DatabaseDriver

Methods

__construct()

__construct() 

Construct a new CharactergroupsquestsModel.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

deleteQuest()

deleteQuest(integer  $questId) 

Delete a Character groups Quest.

Parameters

integer $questId

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