Minor - Fixing tab/whitespaces

1.9.x
Julio Montoya 11 years ago
parent 9066071c63
commit efe49d7ae1
  1. 200
      main/exercice/answer.class.php

@ -10,45 +10,45 @@
/** /**
* 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
public $answer; // these are arrays
public $correct; public $answer;
public $comment; public $correct;
public $weighting; public $comment;
public $position; public $weighting;
public $hotspot_coordinates; public $position;
public $hotspot_type; public $hotspot_coordinates;
public $destination; public $hotspot_type;
// these arrays are used to save temporarily new answers public $destination;
// then they are moved into the arrays above or deleted in the event of cancellation // these arrays are used to save temporarily new answers
public $new_answer; // then they are moved into the arrays above or deleted in the event of cancellation
public $new_correct; public $new_answer;
public $new_comment; public $new_correct;
public $new_weighting; public $new_comment;
public $new_position; public $new_weighting;
public $new_hotspot_coordinates; public $new_position;
public $new_hotspot_type; public $new_hotspot_coordinates;
public $new_hotspot_type;
public $nbrAnswers;
public $new_nbrAnswers; public $nbrAnswers;
public $new_destination; // id of the next question if feedback option is set to Directfeedback public $new_nbrAnswers;
public $new_destination; // id of the next question if feedback option is set to Directfeedback
public $course; //Course information public $course; //Course information
/** /**
* constructor of the class * constructor of the class
* *
* @author Olivier Brouckaert * @author Olivier Brouckaert
* @param integer Question ID that answers belong to * @param integer Question ID that answers belong to
*/ */
function Answer($questionId, $course_id = null) function Answer($questionId, $course_id = null)
{ {
$this->questionId = intval($questionId); $this->questionId = intval($questionId);
$this->answer = array(); $this->answer = array();
@ -81,37 +81,37 @@ class Answer {
} }
} }
/** /**
* Clears $new_* arrays * Clears $new_* arrays
* *
* @author - Olivier Brouckaert * @author - Olivier Brouckaert
*/ */
function cancel() { function cancel() {
$this->new_answer = array(); $this->new_answer = array();
$this->new_correct = array(); $this->new_correct = array();
$this->new_comment = array(); $this->new_comment = array();
$this->new_weighting = array(); $this->new_weighting = array();
$this->new_position = array(); $this->new_position = array();
$this->new_hotspot_coordinates = array(); $this->new_hotspot_coordinates = array();
$this->new_hotspot_type = array(); $this->new_hotspot_type = array();
$this->new_nbrAnswers = 0; $this->new_nbrAnswers = 0;
$this->new_destination = array(); $this->new_destination = array();
} }
/** /**
* Reads answer informations from the data base * Reads answer informations from the data base
* *
* @author - Olivier Brouckaert * @author - Olivier Brouckaert
*/ */
function read() { function read() {
$TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER); $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER);
$questionId = $this->questionId; $questionId = $this->questionId;
$sql="SELECT id, id_auto, answer,correct,comment,ponderation, position, hotspot_coordinates, hotspot_type, destination FROM $sql="SELECT id, id_auto, answer,correct,comment,ponderation, position, hotspot_coordinates, hotspot_type, destination FROM
$TBL_ANSWER WHERE c_id = {$this->course_id} AND question_id ='".$questionId."' ORDER BY position"; $TBL_ANSWER WHERE c_id = {$this->course_id} AND question_id ='".$questionId."' ORDER BY position";
$result = Database::query($sql); $result = Database::query($sql);
$i=1; $i=1;
// while a record is found // while a record is found
while ($object=Database::fetch_object($result)) { while ($object=Database::fetch_object($result)) {
@ -129,13 +129,15 @@ class Answer {
} }
$this->nbrAnswers=$i-1; $this->nbrAnswers=$i-1;
} }
/**
* reads answer informations from the data base ordered by parameter /**
* @param string Field we want to order by * reads answer informations from the data base ordered by parameter
* @param string DESC or ASC * @param string Field we want to order by
* @author Frederic Vauthier * @param string DESC or ASC
*/ * @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;
} }
@ -230,7 +234,7 @@ class Answer {
return $this->destination[$id]; return $this->destination[$id];
} }
/** /**
* returns the answer title * returns the answer title
* *
* @author - Olivier Brouckaert * @author - Olivier Brouckaert
@ -258,13 +262,13 @@ class Answer {
return false; return false;
} }
/** /**
* returns the answer title from an answer's position * returns the answer title from an answer's position
* *
* @author - Yannick Warnier * @author - Yannick Warnier
* @param - integer $id - answer ID * @param - integer $id - answer ID
* @return - bool - answer title * @return - bool - answer title
*/ */
function selectAnswerIdByPosition($pos) { function selectAnswerIdByPosition($pos) {
foreach ($this->position as $k => $v) { foreach ($this->position as $k => $v) {
if ($v != $pos) { continue; } if ($v != $pos) { continue; }
@ -273,11 +277,11 @@ class Answer {
return false; return false;
} }
/** /**
* Returns a list of answers * Returns a list of answers
* @author Yannick Warnier <ywarnier@beeznest.org> * @author Yannick Warnier <ywarnier@beeznest.org>
* @return array List of answers where each answer is an array of (id, answer, comment, grade) and grade=weighting * @return array List of answers where each answer is an array of (id, answer, comment, grade) and grade=weighting
*/ */
function getAnswersList($decode = false) function getAnswersList($decode = false)
{ {
$list = array(); $list = array();
@ -434,16 +438,21 @@ class Answer {
$this->new_destination[$id] = $destination; $this->new_destination[$id] = $destination;
} }
/** /**
* 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
function updateAnswers($answer,$comment, $correct, $weighting, $position, $destination, $hotspot_coordinates, $hotspot_type) * @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)
{ {
$TBL_REPONSES = Database :: get_course_table(TABLE_QUIZ_ANSWER); $TBL_REPONSES = Database :: get_course_table(TABLE_QUIZ_ANSWER);
@ -608,4 +617,3 @@ class Answer {
} }
} }
} }
endif;

Loading…
Cancel
Save