# \hhu\z\modelsSeminariesModel

Model of the SeminariesAgent to list registered seminaries.

## Summary

Methods
Properties
Constants
__construct()
load()
factory()
getSeminaries()
getSeminaryById()
getSeminaryByUrl()
getTotalXPs()
seminaryTitleExists()
createSeminary()
setMoodpicForSeminary()
editSeminary()
deleteSeminary()
$models
No constants found
No protected methods found
$db
N/A
loadDriver()
connect()
getClassName()
loadModels()
No private properties found
N/A

File
  models/SeminariesModel.inc
Package
  Default
Class hierarchy
  \nre\core\Model
  \nre\models\DatabaseModel
  \hhu\z\Model
  \hhu\z\models\SeminariesModel

## Tags

author | Oliver Hanraths oliver.hanraths@uni-duesseldorf.de

## Properties

### $models

    $models : array

Required models

#### Type

array

#

## Tags

None found

### $db

    $db : \nre\models\DatabaseDriver

Database connection

#### Type

\nre\models\DatabaseDriver

#

Inherited from
  \nre\models\DatabaseModel

## Tags

static |

## Methods

### __construct()

    __construct()

Construct a new SeminariesModel.

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\core\ModelNotFoundException
\nre\core\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

### getSeminaries()

    getSeminaries() : array

Get registered seminaries.

#### Returns

array —

Seminaries

#

## Tags

None found

### getSeminaryById()

    getSeminaryById(string  $seminaryId) : array

Get a seminary and its data by its ID.

#### Parameters

string | $seminaryId | ID of a seminary

#### Throws

\hhu\z\models\IdNotFoundException

#### Returns

array —

Seminary

#

## Tags

None found

### getSeminaryByUrl()

    getSeminaryByUrl(string  $seminaryUrl) : array

Get a seminary and its data by its URL-title.

#### Parameters

string | $seminaryUrl | URL-Title of a seminary

#### Throws

\hhu\z\models\IdNotFoundException

#### Returns

array —

Seminary

#

## Tags

None found

### getTotalXPs()

    getTotalXPs(  $seminaryId)

#### Parameters

| $seminaryId |

#

## Tags

None found

### seminaryTitleExists()

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

Check if a Seminary title already exists.

#### Parameters

string | $title | Seminary title to check
integer | $seminaryId | Do not check this ID (for editing)

#### Returns

boolean —

Whether Seminary title exists or not

#

## Tags

None found

### createSeminary()

    createSeminary(integer  $userId, string  $title, string  $course, string  $description) : integer

Create a new Seminary.

#### Parameters

integer | $userId | ID of creating user
string | $title | Title of Seminary to create
string | $course | Course of Seminary
string | $description | Description of new Seminary

#### Returns

integer —

ID of the newly created Seminary

#

## Tags

None found

### setMoodpicForSeminary()

    setMoodpicForSeminary(integer  $seminaryId, integer  $mediaId)

Set the moodpic for a Seminary.

#### Parameters

integer | $seminaryId | ID of Seminary to set moodpic for
integer | $mediaId | ID of moodpic media

#

## Tags

None found

### editSeminary()

    editSeminary(integer  $seminaryId, string  $title, string  $course, string  $description)

Edit a seminary.

#### Parameters

integer | $seminaryId | ID of Seminary to edit
string | $title | New title of Seminary
string | $course | New course of Seminary
string | $description | New description of Seminary

#### Throws

\hhu\z\models\DatamodelException

#

## Tags

None found

### deleteSeminary()

    deleteSeminary(integer  $seminaryId)

Delete a seminary.

#### Parameters

integer | $seminaryId | ID of the seminary to delete

#

## Tags

None found

### loadDriver()

    loadDriver(string  $driverName)

Load the database driver.

#### Parameters

string | $driverName | Name of the database driver

#### Throws

\nre\models\DriverNotFoundException
\nre\models\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\models\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\core\DatamodelException
\nre\core\DriverNotFoundException
\nre\core\DriverNotValidException
\nre\core\ModelNotValidException
\nre\core\ModelNotFoundException

#

Inherited from
  \nre\core\Model

## Tags

None found

### SeminariesModel.inc