# \hhu\z\modelsMediaModel

Model to interact with the Media-tables.

## Summary

Methods
Properties
Constants
__construct()
load()
factory()
getMediaByUrl()
getMediaById()
getSeminaryMediaByUrl()
getSeminaryMediaById()
createMoodpic()
createAvatarpicture()
createQuestgrouppicture()
createQuestMedia()
createCharactergroupMedia()
createAchievementMedia()
No public properties found
No constants found
No protected methods found
$db
N/A
loadDriver()
connect()
getClassName()
loadModels()
createSeminaryMedia()
No private properties found
N/A

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

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

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

### getMediaByUrl()

    getMediaByUrl(  $mediaUrl) : array

Get a medium by its URL.

#### Parameters

| $mediaUrl |

#### Throws

\nre\exceptions\IdNotFoundException

#### Returns

array —

Medium data

#

## Tags

None found

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

#

## Tags

None found

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

#

## Tags

None found

### getSeminaryMediaById()

    getSeminaryMediaById(  $mediaId) : array

Get a Seminary medium by its ID.

#### Parameters

| $mediaId |

#### Throws

\nre\exceptions\IdNotFoundException

#### Returns

array —

Seminary medium data

#

## Tags

None found

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

#

## Tags

None found

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

#

## Tags

None found

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

#

## Tags

None found

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

#

## Tags

None found

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

#

## Tags

None found

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

#

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

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

#

## Tags

None found

### MediaModel.inc