# \hhu\z\modelsQuestgroupshierarchyModel

Model to interact with Questgroupshierarchy-table.

## Summary

Methods
Properties
Constants
__construct()
load()
factory()
getHierarchyById()
getHierarchyByUrl()
getHierarchyOfSeminary()
getHierarchyForQuestgroup()
getChildQuestgroupshierarchy()
questgroupshierarchyTitleSingularExists()
createQuestgroupshierarchy()
editQuestgroupshierarchy()
moveQuestgroupshierarchy()
deleteQuestgroupshierarchy()
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/QuestgroupshierarchyModel.inc
Package
  Default
Class hierarchy
  \nre\core\Model
  \nre\models\DatabaseModel
  \hhu\z\Model
  \hhu\z\models\QuestgroupshierarchyModel

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

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

### getHierarchyById()

    getHierarchyById(integer  $questgroupshierarchyId) : array

Get a Questgroup hierarchy by its ID.

throws \nre\exceptions\IdNotFoundException

#### Parameters

integer | $questgroupshierarchyId | ID of a Questgroup hierarchy

#### Returns

array —

Questgroup hierarchy

#

## Tags

None found

### getHierarchyByUrl()

    getHierarchyByUrl(integer  $seminaryId,   $questgroupshierarchyUrl) : array

Get a Questgroup hierarchy by its URL.

#### Parameters

integer | $seminaryId | ID of Seminary
| $questgroupshierarchyUrl |

#### Throws

\nre\exceptions\IdNotFoundException

#### Returns

array —

Questgroup hierarchy

#

## Tags

None found

### getHierarchyOfSeminary()

    getHierarchyOfSeminary(integer  $seminaryId) : array

Get the toplevel hierarchy entries of a Seminary.

#### Parameters

integer | $seminaryId | ID of the seminary to get hierarchy for

#### Returns

array —

Toplevel hierarchy

#

## Tags

None found

### getHierarchyForQuestgroup()

    getHierarchyForQuestgroup(integer  $questgroupId) : array

Get the Questgroup-Hierarchy for a Questgroup.

#### Parameters

integer | $questgroupId | ID of Questgroup

#### Returns

array —

Hierarchy for Questgroup

#

## Tags

None found

### getChildQuestgroupshierarchy()

    getChildQuestgroupshierarchy(integer  $questgroupshierarchyId) : array

Get the child hierarchy entries of a Questgroup hierarchy.

#### Parameters

integer | $questgroupshierarchyId | ID of a Questgroup hierarchy

#### Returns

array —

Child Questgroup hierarchy entries

#

## Tags

None found

### questgroupshierarchyTitleSingularExists()

    questgroupshierarchyTitleSingularExists(string  $title, integer  $seminaryId, integer  $questgroupshierarchyId = null) : \hhu\z\models\Whether

Check if a title for a Questgroupshierarchy already exists for a Seminary.

#### Parameters

string | $title |
integer | $seminaryId |
integer | $questgroupshierarchyId | Do not check this Questgroupshierarchy (for editing)

#### Returns

\hhu\z\models\Whether —

title already exists or not

#

## Tags

None found

### createQuestgroupshierarchy()

    createQuestgroupshierarchy(integer  $userId, integer  $seminaryId, integer  $parentQuestgroupsierarchyId,   $titleSingular,   $titlePlural)

Create a new Questgroupshierarchy for a Seminary

#### Parameters

integer | $userId | ID of creating user
integer | $seminaryId | ID of Seminary
integer | $parentQuestgroupsierarchyId | ID of parent Questgroupshierarchy
| $titleSingular |
| $titlePlural |

#

## Tags

None found

### editQuestgroupshierarchy()

    editQuestgroupshierarchy(integer  $questgroupshierarchyId,   $titleSingular,   $titlePlural)

Edit a Questgroupshierarchy.

#### Parameters

integer | $questgroupshierarchyId | ID of Questgroupshierarchy to edit
| $titleSingular |
| $titlePlural |

#

## Tags

None found

### moveQuestgroupshierarchy()

    moveQuestgroupshierarchy(array  $questgroupshierarchy, boolean  $up)

Move a Questgroupshierarchy up (decrement position) or down (increment position).

#### Parameters

array | $questgroupshierarchy | Questgroupshierarchy to move
boolean | $up | True for moving up, false for down

#

## Tags

None found

### deleteQuestgroupshierarchy()

    deleteQuestgroupshierarchy(  $questgroupshierarchyId)

Delete a Questgroupshierarchy.

#### Parameters

| $questgroupshierarchyId |

#

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

### QuestgroupshierarchyModel.inc