|
|
@ -10,12 +10,12 @@ |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Code |
|
|
|
* Code |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
if(!class_exists('Answer')): |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Answer class |
|
|
|
* Answer class |
|
|
|
* @package chamilo.exercise |
|
|
|
* @package chamilo.exercise |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
class Answer { |
|
|
|
class Answer |
|
|
|
|
|
|
|
{ |
|
|
|
public $questionId; |
|
|
|
public $questionId; |
|
|
|
|
|
|
|
|
|
|
|
// these are arrays |
|
|
|
// these are arrays |
|
|
@ -129,13 +129,15 @@ class Answer { |
|
|
|
} |
|
|
|
} |
|
|
|
$this->nbrAnswers=$i-1; |
|
|
|
$this->nbrAnswers=$i-1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* reads answer informations from the data base ordered by parameter |
|
|
|
* reads answer informations from the data base ordered by parameter |
|
|
|
* @param string Field we want to order by |
|
|
|
* @param string Field we want to order by |
|
|
|
* @param string DESC or ASC |
|
|
|
* @param string DESC or ASC |
|
|
|
* @author Frederic Vauthier |
|
|
|
* @author Frederic Vauthier |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function readOrderedBy($field, $order='ASC') { |
|
|
|
function readOrderedBy($field, $order='ASC') |
|
|
|
|
|
|
|
{ |
|
|
|
$field = Database::escape_string($field); |
|
|
|
$field = Database::escape_string($field); |
|
|
|
if (empty($field)) { |
|
|
|
if (empty($field)) { |
|
|
|
$field = 'position'; |
|
|
|
$field = 'position'; |
|
|
@ -189,14 +191,14 @@ class Answer { |
|
|
|
$this->nbrAnswers = $i-1; |
|
|
|
$this->nbrAnswers = $i-1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* returns the autoincrement id identificator |
|
|
|
* returns the autoincrement id identificator |
|
|
|
* |
|
|
|
* |
|
|
|
* @author - Juan Carlos Ra<EFBFBD>a |
|
|
|
* @author - Juan Carlos Ra<EFBFBD>a |
|
|
|
* @return - integer - answer num |
|
|
|
* @return - integer - answer num |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function selectAutoId($id) { |
|
|
|
function selectAutoId($id) |
|
|
|
|
|
|
|
{ |
|
|
|
return $this->autoId[$id]; |
|
|
|
return $this->autoId[$id]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -206,7 +208,8 @@ class Answer { |
|
|
|
* @author - Olivier Brouckaert |
|
|
|
* @author - Olivier Brouckaert |
|
|
|
* @return - integer - number of answers |
|
|
|
* @return - integer - number of answers |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function selectNbrAnswers() { |
|
|
|
function selectNbrAnswers() |
|
|
|
|
|
|
|
{ |
|
|
|
return $this->nbrAnswers; |
|
|
|
return $this->nbrAnswers; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -216,7 +219,8 @@ class Answer { |
|
|
|
* @author - Olivier Brouckaert |
|
|
|
* @author - Olivier Brouckaert |
|
|
|
* @return - integer - the question ID |
|
|
|
* @return - integer - the question ID |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function selectQuestionId() { |
|
|
|
function selectQuestionId() |
|
|
|
|
|
|
|
{ |
|
|
|
return $this->questionId; |
|
|
|
return $this->questionId; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -435,13 +439,18 @@ class Answer { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* updates an answer |
|
|
|
* Updates an answer |
|
|
|
* |
|
|
|
* |
|
|
|
* @author Toon Keppens |
|
|
|
* @author Toon Keppens |
|
|
|
* @param string Answer title |
|
|
|
* |
|
|
|
* @param string Answer comment |
|
|
|
* @param string $answer |
|
|
|
* @param integer Answer weighting |
|
|
|
* @param string $comment |
|
|
|
* @param integer Answer position |
|
|
|
* @param string $correct |
|
|
|
|
|
|
|
* @param string $weighting |
|
|
|
|
|
|
|
* @param string $position |
|
|
|
|
|
|
|
* @param string $destination |
|
|
|
|
|
|
|
* @param string $hotspot_coordinates |
|
|
|
|
|
|
|
* @param string $hotspot_type |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function updateAnswers($answer, $comment, $correct, $weighting, $position, $destination, $hotspot_coordinates, $hotspot_type) |
|
|
|
function updateAnswers($answer, $comment, $correct, $weighting, $position, $destination, $hotspot_coordinates, $hotspot_type) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -608,4 +617,3 @@ class Answer { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
endif; |
|
|
|
|
|
|
|