\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

Properties

$models

$models : array

Required models

Type

array

$db

$db : \nre\models\DatabaseDriver

Database connection

Type

\nre\models\DatabaseDriver

Methods

__construct()

__construct() 

Construct a new SeminariesModel.

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

getSeminaries()

getSeminaries() : array

Get registered seminaries.

Returns

array —

Seminaries

getSeminaryById()

getSeminaryById(string  $seminaryId) : array

Get a seminary and its data by its ID.

Parameters

string $seminaryId

ID of a seminary

Throws

\nre\exceptions\IdNotFoundException

Returns

array —

Seminary

getSeminaryByUrl()

getSeminaryByUrl(string  $seminaryUrl) : array

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

Parameters

string $seminaryUrl

URL-Title of a seminary

Throws

\nre\exceptions\IdNotFoundException

Returns

array —

Seminary

getTotalXPs()

getTotalXPs(integer  $seminaryId) : integer

Calculate sum of XPs for a Seminary.

Parameters

integer $seminaryId

ID of Seminary

Returns

integer —

Total sum of XPs

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

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

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

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

\nre\exceptions\DatamodelException

deleteSeminary()

deleteSeminary(integer  $seminaryId) 

Delete a seminary.

Parameters

integer $seminaryId

ID of the seminary to delete

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