# \hhu\z\questtypesMultiplechoiceQuesttypeModel

Model of the MultiplechoiceQuesttypeAgent for multiple choice.

## Summary

Methods
Properties
Constants
load()
factory()
checkClass()
getQuestionsCountOfQuest()
getQuestionsOfQuest()
getQuestionOfQuest()
getAnswersOfQuestion()
setCharacterSubmission()
getCharacterSubmission()
setQuestionForQuest()
deleteQuestionsOfQuest()
setAnswerForQuestion()
deleteAnswersOfQuestion()
No public properties found
No constants found
__construct()
$db
N/A
getClassName()
loadClass()
loadDriver()
connect()
loadModels()
No private properties found
N/A

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

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

### getQuestionsCountOfQuest()

    getQuestionsCountOfQuest(integer  $questId) : integer

Get the count of multiple choice questions for a Quest.

#### Parameters

integer | $questId | ID of Quest to get count for

#### Returns

integer —

Conut of questions

#

## Tags

None found

### getQuestionsOfQuest()

    getQuestionsOfQuest(integer  $questId) : array

Get all multiple choice questions of a Quest.

#### Parameters

integer | $questId | ID of Quest

#### Returns

array —

Multiple choice questions

#

## Tags

None found

### getQuestionOfQuest()

    getQuestionOfQuest(integer  $questId, integer  $pos) : array

Get one multiple choice question of a Quest.

#### Parameters

integer | $questId | ID of Quest
integer | $pos | Position of question

#### Returns

array —

Question data

#

## Tags

None found

### getAnswersOfQuestion()

    getAnswersOfQuestion(integer  $questionId) : array

Get all answers of a multiple choice question.

#### Parameters

integer | $questionId | ID of multiple choice question

#### Returns

array —

Answers of question

#

## Tags

None found

### setCharacterSubmission()

    setCharacterSubmission(integer  $answerId, integer  $characterId, boolean  $answer)

Save Character’s submitted answer for one option.

#### Parameters

integer | $answerId | ID of multiple choice answer
integer | $characterId | ID of Character
boolean | $answer | Submitted answer for this option

#

## Tags

None found

### getCharacterSubmission()

    getCharacterSubmission(integer  $answerId, integer  $characterId) : boolean

Get answer of one option submitted by Character.

#### Parameters

integer | $answerId | ID of multiple choice answer
integer | $characterId | ID of Character

#### Returns

boolean —

Submitted answer of Character or false

#

## Tags

None found

### setQuestionForQuest()

    setQuestionForQuest(integer  $userId, integer  $questId, integer  $pos, string  $question)

Set a question for a multiplechoice Quest.

#### Parameters

integer | $userId | ID of user
integer | $questId | ID of Quest to set question for
integer | $pos | Position of question
string | $question | Question text

#

## Tags

None found

### deleteQuestionsOfQuest()

    deleteQuestionsOfQuest(integer  $questId, integer  $offset)

Delete questions of a Quest.

#### Parameters

integer | $questId | ID of Quest to delete question of
integer | $offset | Only delete questions after this position

#

## Tags

None found

### setAnswerForQuestion()

    setAnswerForQuestion(integer  $userId, integer  $questId, integer  $questionPos, integer  $answerPos, string  $answer, boolean  $tick)

Set an answer for a question.

#### Parameters

integer | $userId | ID of user
integer | $questId | ID of Quest to set answer for
integer | $questionPos | Position of question
integer | $answerPos | Position of answer
string | $answer | Answer text
boolean | $tick | Whether answer is correct or not

#

## Tags

None found

### deleteAnswersOfQuestion()

    deleteAnswersOfQuestion(integer  $questId, integer  $questionPos, integer  $offset)

Delete answers of a question.

#### Parameters

integer | $questId | ID of Quest to delete answers for
integer | $questionPos | Position of question
integer | $offset | Only delete answers after this position

#

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

### MultiplechoiceQuesttypeModel.inc