# \hhu\z\modelsCharactergroupsModel

Model of the CharactergroupsAgent to interact with Charactergroups-table.

## Summary

Methods
Properties
Constants
__construct()
load()
factory()
getGroupsroupsForSeminary()
getGroupsgroupByUrl()
getGroupsgroupById()
characterGroupsgroupNameExists()
createGroupsgroup()
editGroupsgroup()
deleteGroupsgroup()
getGroupsForGroupsgroup()
getGroupsForCharacter()
getGroupByUrl()
getGroupById()
getGroupsForQuest()
characterGroupNameExists()
createGroup()
setMediaForGroup()
editGroup()
deleteGroup()
getXPRank()
addCharacterToCharactergroup()
removeCharacterFromCharactergroup()
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/CharactergroupsModel.inc
Package
  Default
Class hierarchy
  \nre\core\Model
  \nre\models\DatabaseModel
  \hhu\z\Model
  \hhu\z\models\CharactergroupsModel

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

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

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

#

## Tags

None found

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

#

## Tags

None found

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

#

## Tags

None found

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

#

## Tags

None found

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

#

## Tags

None found

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

#

## Tags

None found

### deleteGroupsgroup()

    deleteGroupsgroup(integer  $groupsgroupId)

Delete a Character groups-group.

#### Parameters

integer | $groupsgroupId | ID of groups-group to delete

#

## Tags

None found

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

#

## Tags

None found

### getGroupsForCharacter()

    getGroupsForCharacter(integer  $characterId) : array

Get Character groups for a Character.

#### Parameters

integer | $characterId | ID of the Character

#### Returns

array —

Character groups

#

## Tags

None found

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

#

## Tags

None found

### getGroupById()

    getGroupById(  $groupId) : array

Get a Character group by its ID.

#### Parameters

| $groupId |

#### Throws

\nre\exceptions\IdNotFoundException

#### Returns

array —

Character group data

#

## Tags

None found

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

#

## Tags

None found

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

#

## Tags

None found

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

#

## Tags

None found

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

#

## Tags

None found

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

#

## Tags

None found

### deleteGroup()

    deleteGroup(integer  $groupId)

Delete a Character group.

#### Parameters

integer | $groupId | ID of Character group to delete

#

## Tags

None found

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

#

## Tags

None found

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

#

## Tags

None found

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

#

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

### CharactergroupsModel.inc