# \hhu\z\modelsQuesttopicsModel

Model to interact with Questtopics-table.

## Summary

Methods
Properties
Constants
__construct()
load()
factory()
getQuesttopicByUrl()
getQuesttopicById()
getQuesttopicsForSeminary()
getQuestCountForQuesttopic()
getCharacterQuestCountForQuesttopic()
getSubtopicsForQuesttopic()
getQuestsubtopicsForQuest()
setQuestsubtopicsForQuest()
questtopicTitleExists()
createQuesttopic()
editQuesttopic()
deleteQuesttopic()
questsubtopicTitleExists()
createQuestsubtopic()
editQuestsubtopic()
deleteQuestsubtopic()
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/QuesttopicsModel.inc
Package
  Default
Class hierarchy
  \nre\core\Model
  \nre\models\DatabaseModel
  \hhu\z\Model
  \hhu\z\models\QuesttopicsModel

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

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

### getQuesttopicByUrl()

    getQuesttopicByUrl(integer  $seminaryId, string  $questtopicUrl) : array

Get a Questtopic by its URL.

#### Parameters

integer | $seminaryId | ID of Seminary
string | $questtopicUrl | URL-Title of Questtopic

#### Returns

array —

Questtopic data

#

## Tags

None found

### getQuesttopicById()

    getQuesttopicById(integer  $questtopicId) : array

Get a Questtopic by its ID.

#### Parameters

integer | $questtopicId | ID of Questtopic

#### Returns

array —

Questtopic data

#

## Tags

None found

### getQuesttopicsForSeminary()

    getQuesttopicsForSeminary(integer  $seminaryId) : array

Get all Questtopics for a Seminary.

#### Parameters

integer | $seminaryId | ID of Seminary

#### Returns

array —

List of Questtopics

#

## Tags

None found

### getQuestCountForQuesttopic()

    getQuestCountForQuesttopic(integer  $questtopicId) : integer

Get count of Quests that are linked to a Questtopic.

#### Parameters

integer | $questtopicId | ID of Questtopic

#### Returns

integer —

Count of Quests

#

## Tags

None found

### getCharacterQuestCountForQuesttopic()

    getCharacterQuestCountForQuesttopic(integer  $questtopicId, integer  $characterId) : integer

Get count of Quests that are linked to a Questtopic and are unlocked by a Character.

#### Parameters

integer | $questtopicId | ID of Questtopic
integer | $characterId | ID of Character

#### Returns

integer —

Count of Quests

#

## Tags

None found

### getSubtopicsForQuesttopic()

    getSubtopicsForQuesttopic(integer  $questtopicId) : array

Get alle Questsubtopics for a Questtopic.

#### Parameters

integer | $questtopicId | ID of Questtopic

#### Returns

array —

List of Questsubtopics for this Questtopic

#

## Tags

None found

### getQuestsubtopicsForQuest()

    getQuestsubtopicsForQuest(integer  $questId) : array

Get all Questsubtopics for a Quest.

#### Parameters

integer | $questId | ID of Quest

#### Returns

array —

List of Questsubtopics

#

## Tags

None found

### setQuestsubtopicsForQuest()

    setQuestsubtopicsForQuest(integer  $questId, array  $questsubtopicIds)

Set Questsubtopics for a Quest.

#### Parameters

integer | $questId | ID of Quest to set subtopics for
array | $questsubtopicIds | List of IDs of subtopics to set

#

## Tags

None found

### questtopicTitleExists()

    questtopicTitleExists(string  $title, integer  $questtopicId = null) : boolean

Check if a Questtopic title already exists.

#### Parameters

string | $title | Questtopic title to check
integer | $questtopicId | Do not check this ID (for editing)

#### Returns

boolean —

Whether Questtopic title exists or not

#

## Tags

None found

### createQuesttopic()

    createQuesttopic(integer  $userId, integer  $seminaryId, string  $title) : integer

Create a new Questtopic for a Seminary.

#### Parameters

integer | $userId | ID of creating user
integer | $seminaryId | ID of Seminary
string | $title | Title for new Questtopic

#### Returns

integer —

ID of newly created Questtopic

#

## Tags

None found

### editQuesttopic()

    editQuesttopic(integer  $questtopicId, string  $title)

Edit a Questtopic.

#### Parameters

integer | $questtopicId | ID of Questtopic to edit
string | $title | New title of Questtopic

#

## Tags

None found

### deleteQuesttopic()

    deleteQuesttopic(integer  $questtopicId)

Delete a Questtopic.

#### Parameters

integer | $questtopicId | ID of Questtopic to delete

#

## Tags

None found

### questsubtopicTitleExists()

    questsubtopicTitleExists(integer  $questtopicId, string  $title, integer  $questsubtopicId = null) : boolean

Check if a Questsubtopic title already exists.

#### Parameters

integer | $questtopicId | ID of Questtopic
string | $title | Questsubtopic title to check
integer | $questsubtopicId | Do not check this ID (for editing)

#### Returns

boolean —

Whether Questsubtopic title exists or not

#

## Tags

None found

### createQuestsubtopic()

    createQuestsubtopic(integer  $userId, integer  $questtopicId, string  $title) : integer

Create a new Questsubtopic for a Questtopic.

#### Parameters

integer | $userId | ID of creating user
integer | $questtopicId | ID of Qusttopic
string | $title | Title for new Questtopic

#### Returns

integer —

ID of newly created Questsubtopic

#

## Tags

None found

### editQuestsubtopic()

    editQuestsubtopic(integer  $questsubtopicId, string  $title)

Edit a Questsubtopic.

#### Parameters

integer | $questsubtopicId | ID of Questsubtopic to edit
string | $title | New title of Questsubtopic

#

## Tags

None found

### deleteQuestsubtopic()

    deleteQuestsubtopic(  $questtopicId)

Delete a Questsubtopic.

#### Parameters

| $questtopicId |

#

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

### QuesttopicsModel.inc