# \hhu\z\questtypesDragndropQuesttypeModel

Model of the DragndropQuesttypeAgent for Drag&Drop.

## Summary

Methods
Properties
Constants
load()
factory()
checkClass()
getDragndrop()
getDrops()
getDrags()
dragMatchesDrop()
setCharacterSubmission()
getCharacterSubmission()
No public properties found
No constants found
__construct()
$db
N/A
getClassName()
loadClass()
loadDriver()
connect()
loadModels()
No private properties found
N/A

File
  questtypes/dragndrop/DragndropQuesttypeModel.inc
Package
  Default
Class hierarchy
  \nre\core\Model
  \nre\models\DatabaseModel
  \hhu\z\Model
  \hhu\z\models\QuesttypeModel
  \hhu\z\questtypes\DragndropQuesttypeModel

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

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

### checkClass()

    checkClass(string  $className, string  $parentClassName)

Check inheritance of the QuesttypeModel-class.

#### Parameters

string | $className | Name of the class to check
string | $parentClassName | Name of the parent class

#### Throws

\nre\exceptions\ClassNotValidException

#

static

Inherited from
  \hhu\z\models\QuesttypeModel

## Tags

static |

### getDragndrop()

    getDragndrop(integer  $questId) : array

Get Drag&Drop-field.

#### Parameters

integer | $questId | ID of Quest

#### Returns

array —

Drag&Drop-field

#

## Tags

None found

### getDrops()

    getDrops(integer  $dragndropId) : array

Get Drop-items.

#### Parameters

integer | $dragndropId | ID of Drag&Drop-field

#### Returns

array —

Drop-items

#

## Tags

None found

### getDrags()

    getDrags(integer  $dragndropId, boolean  $onlyUsed = false) : array

Get Drag-items.

#### Parameters

integer | $dragndropId | ID of Drag&Drop-field
boolean | $onlyUsed | Only Drag-items that are used for a Drop-item

#### Returns

array —

Drag-items

#

## Tags

None found

### dragMatchesDrop()

    dragMatchesDrop(integer  $dragId, integer  $dropId) : boolean

Check if a Drag-item mathes a Drop-item.

#### Parameters

integer | $dragId | ID of Drag-field
integer | $dropId | ID of Drop-field

#### Returns

boolean —

Drag-item is valid for Drop-item

#

## Tags

None found

### setCharacterSubmission()

    setCharacterSubmission(integer  $dropId, integer  $characterId, string  $answer)

Save Character’s submitted answer for one Drop-field.

#### Parameters

integer | $dropId | ID of Drop-field
integer | $characterId | ID of Character
string | $answer | Submitted Drag-field-ID for this field

#

## Tags

None found

### getCharacterSubmission()

    getCharacterSubmission(integer  $dropId, integer  $characterId) : integer

Get Character’s saved answer for one Drop-field.

#### Parameters

integer | $dropId | ID of Drop-field
integer | $characterId | ID of Character

#### Returns

integer —

ID of Drag-field or null

#

## Tags

None found

### __construct()

    __construct()

Construct a new Model.

TODO Catch exception

#### Throws

\nre\exceptions\DatamodelException
\nre\exceptions\DriverNotFoundException
\nre\exceptions\DriverNotValidException
\nre\exceptions\ModelNotValidException
\nre\exceptions\ModelNotFoundException

#

Inherited from
  \nre\core\Model

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

### loadClass()

    loadClass(string  $questtypeName, string  $fullClassName)

Load the class of a QuesttypeModel.

#### Parameters

string | $questtypeName | Name of the QuesttypeModel to load
string | $fullClassName | Name of the class to load

#### Throws

\nre\exceptions\ClassNotFoundException

#

static

Inherited from
  \hhu\z\models\QuesttypeModel

## Tags

static |

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

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

### DragndropQuesttypeModel.inc