dokeos-exercise
[ class tree: dokeos-exercise ] [ index: dokeos-exercise ] [ all elements ]

Class: Question

Source Location: /main/exercice/question.class.php

Class Overview


This class allows to instantiate an object of type Question


Author(s):

  • Patrick Cool, LaTeX support
  • Olivier Brouckaert, original author

Variables

Methods


Child classes:

Matching
This class allows to instantiate an object of type MULTIPLE_ANSWER (MULTIPLE CHOICE, MULTIPLE ANSWER), extending the class question
FreeAnswer
File containing the FreeAnswer class.
UniqueAnswer
This class allows to instantiate an object of type UNIQUE_ANSWER (MULTIPLE CHOICE, UNIQUE ANSWER), extending the class question
HotSpot
This class allows to instantiate an object of type HotSpot (MULTIPLE CHOICE, UNIQUE ANSWER), extending the class question
FillBlanks
This class allows to instantiate an object of type MULTIPLE_ANSWER (MULTIPLE CHOICE, MULTIPLE ANSWER), extending the class question
MultipleAnswer
This class allows to instantiate an object of type MULTIPLE_ANSWER (MULTIPLE CHOICE, MULTIPLE ANSWER), extending the class question

Class Details

[line 51]
This class allows to instantiate an object of type Question



Tags:

author:  Patrick Cool, LaTeX support
author:  Olivier Brouckaert, original author
abstract:  


[ Top ]


Class Variables

static $explanationLangVar =  ''

[line 65]


Type:   mixed


[ Top ]

static $questionTypes = array(
                     UNIQUE_ANSWER => array('unique_answer.class.php' , 'UniqueAnswer'),MULTIPLE_ANSWER=>array('multiple_answer.class.php','MultipleAnswer'),FILL_IN_BLANKS=>array('fill_blanks.class.php','FillBlanks'),MATCHING=>array('matching.class.php','Matching'),FREE_ANSWER=>array('freeanswer.class.php','FreeAnswer'),HOT_SPOT=>array('hotspot.class.php','HotSpot'))

[line 66]


Type:   mixed


[ Top ]

static $typePicture =  'new_question.png'

[line 64]


Type:   mixed


[ Top ]

$description =

[line 55]


Type:   mixed


[ Top ]

$exerciseList =

[line 62]


Type:   mixed


[ Top ]

$id =

[line 53]


Type:   mixed


[ Top ]

$picture =

[line 60]


Type:   mixed


[ Top ]

$position =

[line 57]


Type:   mixed


[ Top ]

$question =

[line 54]


Type:   mixed


[ Top ]

$type =

[line 58]


Type:   mixed


[ Top ]

$weighting =

[line 56]


Type:   mixed


[ Top ]



Class Methods


static method display_type_menu [line 808]

static void display_type_menu( )

Displays the menu of question types



[ Top ]

static method getInstance [line 709]

static an getInstance( integer $type)

Returns an instance of the class corresponding to the type



Tags:

return:  instance of a Question subclass (or of Questionc class by default)


Parameters:

integer   $type   the type of the question

[ Top ]

static method read [line 99]

static - read( - $id)

reads question informations from the data base



Tags:

return:  boolean - true if question exists, otherwise false
author:  - Olivier Brouckaert


Parameters:

-   $id   integer $id - question ID

[ Top ]

constructor Question [line 80]

Question Question( )

constructor of the class



Tags:

author:  - Olivier Brouckaert


[ Top ]

method addToList [line 589]

void addToList( - $exerciseId)

adds an exercise into the exercise list



Tags:

author:  - Olivier Brouckaert


Parameters:

-   $exerciseId   integer $exerciseId - exercise ID

[ Top ]

method createAnswersForm [line 796]

void createAnswersForm( the $form)

abstract function which creates the form to create / edit the answers of the question



Tags:

abstract:  


Overridden in child classes as:

Matching::createAnswersForm()
function which redifines Question::createAnswersForm
FreeAnswer::createAnswersForm()
function which redifines Question::createAnswersForm
UniqueAnswer::createAnswersForm()
function which redifines Question::createAnswersForm
HotSpot::createAnswersForm()
FillBlanks::createAnswersForm()
function which redifines Question::createAnswersForm
MultipleAnswer::createAnswersForm()
function which redifines Question::createAnswersForm

Parameters:

the   $form   formvalidator instance

[ Top ]

method createForm [line 733]

void createForm( &$form, FormValidator $form)

Creates the form to create / edit a question A subclass can redifine this function to add fields...



Overridden in child classes as:

HotSpot::createForm()

Parameters:

FormValidator   $form   the formvalidator instance (by reference)
   &$form  

[ Top ]

method delete [line 647]

void delete( [- $deleteFromEx = 0])

deletes a question from the database the parameter tells if the question is removed from all exercises (value = 0), or just from one exercise (value = exercise ID)



Tags:

author:  - Olivier Brouckaert


Parameters:

-   $deleteFromEx   integer $deleteFromEx - exercise ID if the question is only removed from one exercise

[ Top ]

method duplicate [line 683]

- duplicate( )

duplicates the question



Tags:

return:  integer - ID of the new question
author:  - Olivier Brouckaert


[ Top ]

method exportPicture [line 451]

- exportPicture( - $questionId)

exports a picture to another question



Tags:

return:  boolean - true if copied, otherwise false
author:  - Olivier Brouckaert


Parameters:

-   $questionId   integer $questionId - ID of the target question

[ Top ]

method getTmpPicture [line 499]

- getTmpPicture( )

moves the temporary question "tmp" to "quiz-$questionId" Temporary pictures are used when we don't want to save a picture right after a form submission.

For example, if we first show a confirmation box.




Tags:

return:  boolean - true if moved, otherwise false
author:  - Olivier Brouckaert


[ Top ]

method processAnswersCreation [line 802]

void processAnswersCreation( the $form)

abstract function which process the creation of answers



Tags:

abstract:  


Overridden in child classes as:

Matching::processAnswersCreation()
abstract function which creates the form to create / edit the answers of the question
FreeAnswer::processAnswersCreation()
abstract function which creates the form to create / edit the answers of the question
UniqueAnswer::processAnswersCreation()
abstract function which creates the form to create / edit the answers of the question
HotSpot::processAnswersCreation()
FillBlanks::processAnswersCreation()
abstract function which creates the form to create / edit the answers of the question
MultipleAnswer::processAnswersCreation()
abstract function which creates the form to create / edit the answers of the question

Parameters:

the   $form   formvalidator instance

[ Top ]

method processCreation [line 780]

void processCreation( FormValidator $form, Exercise $objExercise)

function which process the creation of questions



Overridden in child classes as:

HotSpot::processCreation()

Parameters:

FormValidator   $form   the formvalidator instance
Exercise   $objExercise   the Exercise instance

[ Top ]

method removeFromList [line 613]

- removeFromList( - $exerciseId)

removes an exercise from the exercise list



Tags:

return:  boolean - true if removed, otherwise false
author:  - Olivier Brouckaert


Parameters:

-   $exerciseId   integer $exerciseId - exercise ID

[ Top ]

method removePicture [line 428]

- removePicture( )

deletes the picture



Tags:

return:  boolean - true if removed, otherwise false
author:  - Olivier Brouckaert


[ Top ]

method resizePicture [line 342]

- resizePicture( - $Dimension, - $Max)

Resizes a picture || Warning!: can only be called after uploadPicture, or if picture is already available in object.



Tags:

return:  boolean - true if success, false if failed
author:  - Toon Keppens


Parameters:

-   $Dimension   string $Dimension - Resizing happens proportional according to given dimension: height|width|any
-   $Max   integer $Max - Maximum size

[ Top ]

method save [line 534]

void save( [- $exerciseId = 0])

updates the question in the data base if an exercise ID is provided, we add that exercise ID into the exercise list



Tags:

author:  - Olivier Brouckaert


Parameters:

-   $exerciseId   integer $exerciseId - exercise ID if saving in an exercise

[ Top ]

method selectDescription [line 167]

- selectDescription( )

returns the question description



Tags:

return:  string - question description
author:  - Olivier Brouckaert


[ Top ]

method selectExerciseList [line 223]

- selectExerciseList( )

returns the array with the exercise ID list



Tags:

return:  array - list of exercise ID which the question is in
author:  - Olivier Brouckaert


[ Top ]

method selectId [line 144]

- selectId( )

returns the question ID



Tags:

return:  integer - question ID
author:  - Olivier Brouckaert


[ Top ]

method selectNbrExercises [line 234]

- selectNbrExercises( )

returns the number of exercises which this question is in



Tags:

return:  integer - number of exercises
author:  - Olivier Brouckaert


[ Top ]

method selectPicture [line 212]

- selectPicture( )

returns the picture name



Tags:

return:  string - picture name
author:  - Olivier Brouckaert


[ Top ]

method selectPosition [line 190]

- selectPosition( )

returns the question position



Tags:

return:  integer - question position
author:  - Olivier Brouckaert


[ Top ]

method selectTitle [line 155]

- selectTitle( )

returns the question title



Tags:

return:  string - question title
author:  - Olivier Brouckaert


[ Top ]

method selectType [line 201]

- selectType( )

returns the answer type



Tags:

return:  integer - answer type
author:  - Olivier Brouckaert


[ Top ]

method selectWeighting [line 179]

- selectWeighting( )

returns the question weighting



Tags:

return:  integer - question weighting
author:  - Olivier Brouckaert


[ Top ]

method setTmpPicture [line 480]

void setTmpPicture( - $Picture, - $PictureName)

saves the picture coming from POST into a temporary file Temporary pictures are used when we don't want to save a picture right after a form submission.

For example, if we first show a confirmation box.




Tags:

author:  - Olivier Brouckaert


Parameters:

-   $Picture   string $Picture - temporary path of the picture to move
-   $PictureName   string $PictureName - Name of the picture

[ Top ]

method updateDescription [line 256]

void updateDescription( - $description)

changes the question description



Tags:

author:  - Olivier Brouckaert


Parameters:

-   $description   string $description - question description

[ Top ]

method updatePosition [line 278]

void updatePosition( - $position)

changes the question position



Tags:

author:  - Olivier Brouckaert


Parameters:

-   $position   integer $position - question position

[ Top ]

method updateTitle [line 245]

void updateTitle( - $title)

changes the question title



Tags:

author:  - Olivier Brouckaert


Parameters:

-   $title   string $title - question title

[ Top ]

method updateType [line 290]

void updateType( - $type)

changes the answer type. If the user changes the type from "unique answer" to "multiple answers" (or conversely) answers are not deleted, otherwise yes



Tags:

author:  - Olivier Brouckaert


Parameters:

-   $type   integer $type - answer type

[ Top ]

method updateWeighting [line 267]

void updateWeighting( - $weighting)

changes the question weighting



Tags:

author:  - Olivier Brouckaert


Parameters:

-   $weighting   integer $weighting - question weighting

[ Top ]

method uploadPicture [line 317]

- uploadPicture( - $Picture, - $PictureName)

adds a picture to the question



Tags:

return:  boolean - true if uploaded, otherwise false
author:  - Olivier Brouckaert


Parameters:

-   $Picture   string $Picture - temporary path of the picture to upload
-   $PictureName   string $PictureName - Name of the picture

[ Top ]


Documentation generated on Wed, 05 Sep 2007 06:15:03 +0200 by phpDocumentor 1.4.0