Properties

$db

$db : \nre\models\DatabaseDriver

Database connection

Type

\nre\models\DatabaseDriver

Methods

__construct()

__construct() 

Construct a new MediaModel.

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

getMediaByUrl()

getMediaByUrl(  $mediaUrl) : array

Get a medium by its URL.

Parameters

$mediaUrl

Throws

\nre\exceptions\IdNotFoundException

Returns

array —

Medium data

getMediaById()

getMediaById(integer  $mediaId) : array

Get a medium by its ID.

Parameters

integer $mediaId

ID of the Medium

Throws

\nre\exceptions\IdNotFoundException

Returns

array —

Medium data

getSeminaryMediaByUrl()

getSeminaryMediaByUrl(integer  $seminaryId, string  $seminaryMediaUrl) : array

Get a Seminary medium by its URL.

Parameters

integer $seminaryId

ID of the seminary

string $seminaryMediaUrl

URL-name of the Seminary medium

Throws

\nre\exceptions\IdNotFoundException

Returns

array —

Seminary medium data

getSeminaryMediaById()

getSeminaryMediaById(  $mediaId) : array

Get a Seminary medium by its ID.

Parameters

$mediaId

Throws

\nre\exceptions\IdNotFoundException

Returns

array —

Seminary medium data

createMoodpic()

createMoodpic(integer  $userId, integer  $seminaryId, string  $filename, string  $description, string  $mimetype, string  $tmpFilename) : mixed

Create a new moodpic.

Parameters

integer $userId

ID of user that does the upload

integer $seminaryId

ID of Seminary

string $filename

Filename of uploading media

string $description

Description for media

string $mimetype

Mimetype of media

string $tmpFilename

Name of temporary uploaded file

Returns

mixed —

ID of media record or false if upload failed

createAvatarpicture()

createAvatarpicture(integer  $userId, integer  $seminaryId, string  $filename, string  $description, string  $mimetype, string  $tmpFilename) : mixed

Create a new Avatar picture for a Charactertype by creating a new Seminarymedia and adding it to the list of Avatar pictures.

Parameters

integer $userId

ID of user that does the upload

integer $seminaryId

ID of Seminary

string $filename

Filename of uploading media

string $description

Description for media

string $mimetype

Mimetype of media

string $tmpFilename

Name of temporary uploaded file

Returns

mixed —

ID of media record or false if upload failed

createQuestgrouppicture()

createQuestgrouppicture(integer  $userId, integer  $seminaryId, integer  $questgroupId, string  $filename, string  $description, string  $mimetype, string  $tmpFilename) : mixed

Create a new Questgroup picture (Moodpic).

Parameters

integer $userId

ID of user that does the upload

integer $seminaryId

ID of Seminary

integer $questgroupId

ID of Questgroup to create picture for

string $filename

Filename of uploading media

string $description

Description for media

string $mimetype

Mimetype of media

string $tmpFilename

Name of temporary uploaded file

Returns

mixed —

ID of media record or false if upload failed

createQuestMedia()

createQuestMedia(integer  $userId, integer  $seminaryId, string  $filename, string  $description, string  $mimetype, string  $tmpFilename) : mixed

Create a new Quests media by creating a new Seminarymedia and adding it to the list of Quests media.

Parameters

integer $userId

ID of user that does the upload

integer $seminaryId

ID of Seminary

string $filename

Filename of uploading media

string $description

Description for media

string $mimetype

Mimetype of media

string $tmpFilename

Name of temporary uploaded file

Returns

mixed —

ID of media record or false if upload failed

createCharactergroupMedia()

createCharactergroupMedia(integer  $userId, integer  $seminaryId, string  $filename, string  $description, string  $mimetype, string  $tmpFilename) : mixed

Create a new Character groups media by creating a new Seminarymedia and adding it to the list of media for Character groups.

Parameters

integer $userId

ID of user that does the upload

integer $seminaryId

ID of Seminary

string $filename

Filename of uploading media

string $description

Description for media

string $mimetype

Mimetype of media

string $tmpFilename

Name of temporary uploaded file

Returns

mixed —

ID of media record or false if upload failed

createAchievementMedia()

createAchievementMedia(integer  $userId, integer  $seminaryId, string  $filename, string  $description, string  $mimetype, string  $tmpFilename) : mixed

Create a new Achievement media by creating a new Seminarymedia and adding it to the list of media for Achievements.

Parameters

integer $userId

ID of user that does the upload

integer $seminaryId

ID of Seminary

string $filename

Filename of uploading media

string $description

Description for media

string $mimetype

Mimetype of media

string $tmpFilename

Name of temporary uploaded file

Returns

mixed —

ID of media record or false if upload failed

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

createSeminaryMedia()

createSeminaryMedia(integer  $userId, integer  $seminaryId, string  $filename, string  $description, string  $mimetype) : mixed

Create a new Seminary media.

Parameters

integer $userId

ID of user that does the upload

integer $seminaryId

ID of Seminary

string $filename

Filename of uploading media

string $description

Description for media

string $mimetype

Mimetype of media

Returns

mixed —

ID of media record or false if upload failed