Properties

$db

$db : \nre\models\DatabaseDriver

Database connection

Type

\nre\models\DatabaseDriver

Methods

__construct()

__construct() 

Construct a new CharactergroupsModel.

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

getGroupsroupsForSeminary()

getGroupsroupsForSeminary(integer  $seminaryId) : array

Get Character groups-groups of a Seminary.

Parameters

integer $seminaryId

ID of the corresponding Seminary

Returns

array —

Character groups-groups data

getGroupsgroupByUrl()

getGroupsgroupByUrl(integer  $seminaryId, string  $groupsgroupUrl) : array

Get a Character groups-group by its URL.

Parameters

integer $seminaryId

ID of the corresponding Seminary

string $groupsgroupUrl

URL-name of the Character groups-group

Throws

\nre\exceptions\IdNotFoundException

Returns

array —

Character groups-group data

getGroupsgroupById()

getGroupsgroupById(string  $groupsgroupId) : array

Get a Character groups-group by its ID.

Parameters

string $groupsgroupId

ID of the Character groups-group

Throws

\nre\exceptions\IdNotFoundException

Returns

array —

Character groups-group data

characterGroupsgroupNameExists()

characterGroupsgroupNameExists(string  $name, integer  $groupsgroupId = null) : boolean

Check if a Character groups-group name already exists.

Parameters

string $name

Name to check

integer $groupsgroupId

Do not check this ID (for editing)

Returns

boolean —

Whether name exists or not

createGroupsgroup()

createGroupsgroup(integer  $userId, integer  $seminaryId, string  $name, boolean  $preferred) : integer

Create a new Character groups-group.

Parameters

integer $userId

ID of user

integer $seminaryId

ID of Seminary

string $name

Name of new groups-group

boolean $preferred

Whether groups-group is preferred or not

Returns

integer —

ID of newly created groups-group

editGroupsgroup()

editGroupsgroup(integer  $groupsgroupId, string  $name, boolean  $preferred) 

Edit a Character groups-group.

Parameters

integer $groupsgroupId

ID of groups-group to edit

string $name

New name of groups-group

boolean $preferred

Whether groups-group is preferred or not

deleteGroupsgroup()

deleteGroupsgroup(integer  $groupsgroupId) 

Delete a Character groups-group.

Parameters

integer $groupsgroupId

ID of groups-group to delete

getGroupsForGroupsgroup()

getGroupsForGroupsgroup(integer  $groupsgroupId, string  $sortorder = 'name') : array

Get Character groups for a Character groups-group.

Parameters

integer $groupsgroupId

ID of the Character groups-group

string $sortorder

Field to sort by (optional)

Returns

array —

Character groups

getGroupsForCharacter()

getGroupsForCharacter(integer  $characterId) : array

Get Character groups for a Character.

Parameters

integer $characterId

ID of the Character

Returns

array —

Character groups

getGroupByUrl()

getGroupByUrl(integer  $groupsgroupId, string  $groupUrl) : array

Get a Character group by its URL.

Parameters

integer $groupsgroupId

ID of the Character groups-group

string $groupUrl

URL-name of the Character group

Throws

\nre\exceptions\IdNotFoundException

Returns

array —

Character group data

getGroupById()

getGroupById(  $groupId) : array

Get a Character group by its ID.

Parameters

$groupId

Throws

\nre\exceptions\IdNotFoundException

Returns

array —

Character group data

getGroupsForQuest()

getGroupsForQuest(integer  $questId) : array

Get the Character groups for a Quest.

Parameters

integer $questId

ID of the Character groups Quest

Returns

array —

Character groups

characterGroupNameExists()

characterGroupNameExists(string  $name,   $groupId = null) : boolean

Check if a Character group name already exists.

Parameters

string $name

Name to check

$groupId

Returns

boolean —

Whether name exists or not

createGroup()

createGroup(integer  $userId, integer  $groupsgroupId, string  $name, string  $motto) : integer

Create a new Character group.

Parameters

integer $userId

ID of user

integer $groupsgroupId

ID of Character groups-group

string $name

Name of new group

string $motto

Motto of new group

Returns

integer —

ID of newly created group

setMediaForGroup()

setMediaForGroup(integer  $groupId, integer  $mediaId) 

Set the media for a Character group.

Parameters

integer $groupId

ID of Character group to set media for

integer $mediaId

ID of Character groups media

editGroup()

editGroup(integer  $groupId, string  $name, string  $motto) 

Edit a Character group.

Parameters

integer $groupId

ID of Character group to edit

string $name

New name of group

string $motto

New motto of group

deleteGroup()

deleteGroup(integer  $groupId) 

Delete a Character group.

Parameters

integer $groupId

ID of Character group to delete

getXPRank()

getXPRank(  $groupsgroupId, integer  $xps) : integer

Get the rank of a XP-value of a Character.

Parameters

$groupsgroupId
integer $xps

XP-value to get rank for

Returns

integer —

Rank of XP-value

addCharacterToCharactergroup()

addCharacterToCharactergroup(integer  $groupId, integer  $characterId) 

Add a Character to a Character group.

Parameters

integer $groupId

ID of Character group

integer $characterId

ID of Character to add

removeCharacterFromCharactergroup()

removeCharacterFromCharactergroup(integer  $groupId, integer  $characterId) 

Remove a Character from a Character group.

Parameters

integer $groupId

ID of Character group

integer $characterId

ID of Character to remove

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