Constants

QUEST_STATUS_ENTERED

QUEST_STATUS_ENTERED

Quest-status: Entered

QUEST_STATUS_SUBMITTED

QUEST_STATUS_SUBMITTED

Quest-status: submitted

QUEST_STATUS_UNSOLVED

QUEST_STATUS_UNSOLVED

Quest-status: Unsolved

QUEST_STATUS_SOLVED

QUEST_STATUS_SOLVED

Quest-status: Solved

Properties

$db

$db : \nre\models\DatabaseDriver

Database connection

Type

\nre\models\DatabaseDriver

Methods

__construct()

__construct() 

Construct a new QuestsModel.

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

getQuestByUrl()

getQuestByUrl(integer  $seminaryId, integer  $questgroupId,   $questUrl) : array

Get a Quest and its data by its URL.

Parameters

integer $seminaryId

ID of the corresponding Seminary

integer $questgroupId

ID of the corresponding Questgroup

$questUrl

Throws

\nre\exceptions\IdNotFoundException

Returns

array —

Quest data

getQuestById()

getQuestById(string  $questId) : array

Get a Quest and its data by its ID.

Parameters

string $questId

ID of a Quest

Throws

\nre\exceptions\IdNotFoundException

Returns

array —

Quest data

getFirstQuestOfQuestgroup()

getFirstQuestOfQuestgroup(  $questgroupId) : array

Get the first Quest of a Qusetgroup.

Parameters

$questgroupId

Returns

array —

Data of first Quest

getLastQuestsOfQuestgroup()

getLastQuestsOfQuestgroup(  $questgroupId) : array

Get all Quests a Qusetgroup that do not have a following Quest.

Parameters

$questgroupId

Returns

array —

List of last Quests

getNextQuests()

getNextQuests(integer  $questId) : array

Get Quests that follow-up a Quest.

Parameters

integer $questId

ID of Quest to get next Quests of

Returns

array —

Quests data

getPreviousQuests()

getPreviousQuests(integer  $questId) : array

Get Quests that the given Quests follows-up to.

Parameters

integer $questId

ID of Quest to get previous Quests of

Returns

array —

Quests data

setPreviousQuest()

setPreviousQuest(integer  $questId, integer  $previousQuestId) 

Set the previous Quest for a Quest.

Parameters

integer $questId

ID of Quest to set previous Quest for

integer $previousQuestId

Id of previous Quest

setQuestEntered()

setQuestEntered(integer  $questId, integer  $characterId) 

Mark a Quest as entered for a Character.

Parameters

integer $questId

ID of Quest to mark as entered

integer $characterId

ID of Character that entered the Quest

setQuestSubmitted()

setQuestSubmitted(integer  $questId, integer  $characterId) 

Mark a Quest as submitted for a Character.

Parameters

integer $questId

ID of Quest to mark as unsolved

integer $characterId

ID of Character that unsolved the Quest

setQuestUnsolved()

setQuestUnsolved(integer  $questId, integer  $characterId) 

Mark a Quest as unsolved for a Character.

Parameters

integer $questId

ID of Quest to mark as unsolved

integer $characterId

ID of Character that unsolved the Quest

setQuestSolved()

setQuestSolved(integer  $questId, integer  $characterId) 

Mark a Quest as solved for a Character.

Parameters

integer $questId

ID of Quest to mark as solved

integer $characterId

ID of Character that solved the Quest

hasCharacterEnteredQuest()

hasCharacterEnteredQuest(integer  $questId, integer  $characterId) 

Determine if the given Character has entered a Quest.

Parameters

integer $questId

ID of Quest to check

integer $characterId

ID of Character to check

hasCharacterTriedQuest()

hasCharacterTriedQuest(integer  $questId, integer  $characterId) 

Determine if the given Character has tried to solve a Quest.

Parameters

integer $questId

ID of Quest to check

integer $characterId

ID of Character to check

hasCharacterSolvedQuest()

hasCharacterSolvedQuest(integer  $questId, integer  $characterId) 

Determine if the given Character has solved the given Quest.

Parameters

integer $questId

ID of Quest to check

integer $characterId

ID of Character to check

getLastQuestForCharacter()

getLastQuestForCharacter(integer  $characterId) 

Get the last Quests for a Character.

Parameters

integer $characterId

ID of Character

getQuestsForSeminary()

getQuestsForSeminary(integer  $seminaryId) : array

Get all Quests for a Seminary.

Parameters

integer $seminaryId

ID of Seminary

Returns

array —

Quests for this Seminary

getCountForQuestsForSeminaryByOpenSubmissions()

getCountForQuestsForSeminaryByOpenSubmissions(integer  $seminaryId, integer  $questgroupId = null, integer  $questtypeId = null, string  $title = null) : integer

Get count of all Quests for a Seminary.

Parameters

integer $seminaryId

ID of Seminary

integer $questgroupId

ID of Questgroup (optional)

integer $questtypeId

ID of Questtype (optional)

string $title

Part of the title to filter for (optional)

Returns

integer —

Count of Quests for this Seminary

getQuestsForSeminaryByOpenSubmissions()

getQuestsForSeminaryByOpenSubmissions(integer  $seminaryId, integer  $questgroupId = null, integer  $questtypeId = null, string  $title = null, integer  $limit = null, integer  $offset) : array

Get all Quests for a Seminary order by their count of open submissions.

Parameters

integer $seminaryId

ID of Seminary

integer $questgroupId

ID of Questgroup (optional)

integer $questtypeId

ID of Questtype (optional)

string $title

Part of title to filter for (optional)

integer $limit

Limit amount of Quests (optional)

integer $offset

Offset (optional)

Returns

array —

Quests for this Seminary

getQuestsForQuesttopic()

getQuestsForQuesttopic(integer  $questtopicId) : array

Get all Quests that are linked to a Questtopic.

Parameters

integer $questtopicId

ID of Questtopic

Returns

array —

Quests for this Questtopic

getLastQuestStatus()

getLastQuestStatus(integer  $questId, integer  $characterId) : integer

Get the last status of a Quest for a Character.

Parameters

integer $questId

ID of Quest

integer $characterId

ID of Character to get status for

Returns

integer —

Last status

questTitleExists()

questTitleExists(string  $title, integer  $seminaryId, integer  $questId = null) : boolean

Check if a Quest title already exists.

Parameters

string $title

Quest title to check

integer $seminaryId

ID of Seminary

integer $questId

Do not check this ID (for editing)

Returns

boolean —

Whether Quest title exists or not

createQuest()

createQuest(integer  $userId, integer  $questgroupId, integer  $questtypeId, string  $title, integer  $xps, string  $task, string  $entrytext, string  $wrongtext) : integer

Create a new Quest.

Parameters

integer $userId

User-ID that creates the new character

integer $questgroupId

ID of Questgroup

integer $questtypeId

ID of Questtype

string $title

Title for new Quest

integer $xps

XPs for new Quest

string $task

Task for new Quest

string $entrytext

Entrytext for new Quest

string $wrongtext

Wrongtext for new Quest

Returns

integer —

ID of new Quest

setQuestmedia()

setQuestmedia(integer  $questId,   $questsmediaId) 

Set the media for a Quest.

Parameters

integer $questId

ID of Quest to set media for

$questsmediaId

editQuest()

editQuest(integer  $questId, integer  $questtypeId, string  $title, integer  $xps, string  $task, string  $entrytext, string  $wrongtext) 

Edit a new Quest.

Parameters

integer $questId

ID of Quest to edit

integer $questtypeId

ID of Questtype

string $title

New title for Quest

integer $xps

XPs for Quest

string $task

New task for Quest

string $entrytext

New entrytext for Quest

string $wrongtext

New wrongtext for Quest

deleteQuest()

deleteQuest(integer  $questId) 

Delete a Quest of a Seminary.

Parameters

integer $questId

ID of 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

setQuestStatus()

setQuestStatus(integer  $questId, integer  $characterId, integer  $status, boolean  $repeated = true) 

Mark a Quest for a Character.

Parameters

integer $questId

ID of Quest to mark

integer $characterId

ID of Character to mark the Quest for

integer $status

Quest status to mark

boolean $repeated

Insert although status is already set for this Quest and Character