Julio Montoya 10 anni fa
parent
commit
be823bac77

+ 1 - 1
main/exercice/answer.class.php

@@ -43,7 +43,7 @@ class Answer
      * @author 	Olivier Brouckaert
      * @param 	integer	Question ID that answers belong to
      */
-    function Answer($questionId, $course_id = null)
+    public function __construct($questionId, $course_id = null)
     {
         $this->questionId			= intval($questionId);
         $this->answer				= array();

+ 4 - 4
main/exercice/calculated_answer.class.php

@@ -15,9 +15,9 @@ class CalculatedAnswer extends Question
     /**
      * Constructor
      */
-    public function CalculatedAnswer()
+    public function __construct()
     {
-        parent::question();
+        parent::__construct();
         $this -> type = CALCULATED_ANSWER;
         $this -> isContent = $this-> getIsContent();
     }
@@ -31,7 +31,7 @@ class CalculatedAnswer extends Question
         $defaults = array();
 
         if (!empty($this->id)) {
-            $objAnswer = new answer($this->id);
+            $objAnswer = new Answer($this->id);
             $preArray = explode('@@', $objAnswer->selectAnswer(1));
             $defaults['formula'] = array_pop($preArray);
 
@@ -229,7 +229,7 @@ class CalculatedAnswer extends Question
                     $auxAnswer .= " [".$result."]@@".$formula;
                 }
                 $this->save();
-                $objAnswer = new answer($this->id);
+                $objAnswer = new Answer($this->id);
                 $objAnswer->createAnswer($auxAnswer, 1, '', $this->weighting, null);
                 $objAnswer->position = array();
                 $objAnswer->save();

+ 4 - 4
main/exercice/fill_blanks.class.php

@@ -16,9 +16,9 @@ class FillBlanks extends Question
     /**
      * Constructor
      */
-    public function FillBlanks()
+    public function __construct()
     {
-        parent::question();
+        parent::__construct();
         $this -> type = FILL_IN_BLANKS;
         $this -> isContent = $this-> getIsContent();
     }
@@ -32,7 +32,7 @@ class FillBlanks extends Question
         $defaults = array();
 
         if (!empty($this->id)) {
-            $objAnswer = new answer($this->id);
+            $objAnswer = new Answer($this->id);
 
             // the question is encoded like this
             // [A] B [C] D [E] F::10,10,10@1
@@ -179,7 +179,7 @@ class FillBlanks extends Question
 		$answer.= '@'.$is_multiple;
 
 		$this->save();
-        $objAnswer = new answer($this->id);
+        $objAnswer = new Answer($this->id);
         $objAnswer->createAnswer($answer, 0, '', 0, '1');
         $objAnswer->save();
 	}

+ 2 - 2
main/exercice/freeanswer.class.php

@@ -16,9 +16,9 @@ class FreeAnswer extends Question
     /**
      * Constructor
      */
-    function FreeAnswer()
+    public function __construct()
     {
-        parent::question();
+        parent::__construct();
         $this->type = FREE_ANSWER;
         $this->isContent = $this->getIsContent();
     }

+ 2 - 2
main/exercice/global_multiple_answer.class.php

@@ -12,9 +12,9 @@ class GlobalMultipleAnswer extends Question
     /**
      *
      */
-    public function GlobalMultipleAnswer()
+    public function __construct()
     {
-        parent::question();
+        parent::__construct();
         $this->type = GLOBAL_MULTIPLE_ANSWER;
         $this->isContent = $this->getIsContent();
     }

+ 4 - 4
main/exercice/hotspot.class.php

@@ -15,9 +15,9 @@ class HotSpot extends Question
 	static $typePicture = 'hotspot.png';
 	static $explanationLangVar = 'HotSpot';
 
-	public function HotSpot()
+	public function __construct()
 	{
-		parent::question();
+		parent::__construct();
 		$this -> type = HOT_SPOT;
 	}
 
@@ -85,9 +85,9 @@ class HotSpotDelineation extends HotSpot
 	static $typePicture = 'hotspot_delineation.gif';
 	static $explanationLangVar = 'HotspotDelineation';
 
-	function HotSpotDelineation()
+	function __construct()
 	{
-		parent::question();
+		parent::__construct();
 		$this -> type = HOT_SPOT_DELINEATION;
 
 	}

+ 3 - 3
main/exercice/matching.class.php

@@ -19,9 +19,9 @@ class Matching extends Question
     /**
      * Constructor
      */
-    public function Matching()
+    public function __construct()
     {
-        parent::question();
+        parent::__construct();
         $this->type = MATCHING;
         $this->isContent = $this-> getIsContent();
     }
@@ -122,7 +122,7 @@ class Matching extends Question
             $form->addText("answer[$i]", null);
             $form->addSelect("matches[$i]", null, $a_matches);
             $form->addText("weighting[$i]", null, true, ['value' => 10]);
-            
+
             $form->addHtml('</tr>');
         }
 

+ 2 - 2
main/exercice/multiple_answer.class.php

@@ -18,9 +18,9 @@ class MultipleAnswer extends Question
 	/**
 	 * Constructor
 	 */
-	function MultipleAnswer()
+	public function __construct()
     {
-		parent::question();
+		parent::__construct();
 		$this -> type = MULTIPLE_ANSWER;
 		$this -> isContent = $this-> getIsContent();
 	}

+ 2 - 2
main/exercice/multiple_answer_combination.class.php

@@ -18,9 +18,9 @@ class MultipleAnswerCombination extends Question
 	/**
 	 * Constructor
 	 */
-	function MultipleAnswerCombination()
+	public function __construct()
     {
-		parent::question();
+		parent::__construct();
 		$this -> type = MULTIPLE_ANSWER_COMBINATION;
 		$this -> isContent = $this-> getIsContent();
 	}

+ 2 - 2
main/exercice/multiple_answer_combination_true_false.class.php

@@ -18,9 +18,9 @@ class MultipleAnswerCombinationTrueFalse extends MultipleAnswerCombination
 	/**
 	 * Constructor
 	 */
-	function MultipleAnswerCombinationTrueFalse()
+	public function __construct()
     {
-		parent::question();
+		parent::__construct();
 		$this -> type = MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE;
 		$this -> isContent = $this-> getIsContent();
         $this->options = array('1'=>get_lang('True'),'0' =>get_lang('False'), '2' =>get_lang('DontKnow'));

+ 3 - 3
main/exercice/multiple_answer_true_false.class.php

@@ -18,9 +18,9 @@ class MultipleAnswerTrueFalse extends Question
 	/**
 	 * Constructor
 	 */
-	public function MultipleAnswerTrueFalse()
+	public function __construct()
     {
-		parent::question();
+		parent::__construct();
 		$this->type = MULTIPLE_ANSWER_TRUE_FALSE;
 		$this->isContent = $this-> getIsContent();
         $this->options = array(1 => 'True', 2 => 'False', 3 => 'DoubtScore');
@@ -190,7 +190,7 @@ class MultipleAnswerTrueFalse extends Question
         $renderer->setElementTemplate($correctInputTemplate, 'option[1]');
         $renderer->setElementTemplate($wrongInputTemplate, 'option[2]');
         $renderer->setElementTemplate($doubtScoreInputTempalte, 'option[3]');
- 
+
         // 3 scores
         $form->addElement('text', 'option[1]', get_lang('Correct'), array('class' => 'span1', 'value' => '1'));
         $form->addElement('text', 'option[2]', get_lang('Wrong'), array('class' => 'span1', 'value' => '-0.5'));

+ 1 - 1
main/exercice/oral_expression.class.php

@@ -17,7 +17,7 @@ class OralExpression extends Question
 	 */
 	public function __construct()
     {
-		parent::question();
+		parent::__construct();
 		$this -> type = ORAL_EXPRESSION;
 		$this -> isContent = $this-> getIsContent();
 	}

+ 14 - 14
main/exercice/question.class.php

@@ -54,20 +54,20 @@ abstract class Question
      *
      * @author Olivier Brouckaert
      */
-    public function Question()
+    public function __construct()
     {
-        $this->id=0;
-        $this->question='';
-        $this->description='';
-        $this->weighting=0;
-        $this->position=1;
-        $this->picture='';
+        $this->id = 0;
+        $this->question = '';
+        $this->description = '';
+        $this->weighting = 0;
+        $this->position = 1;
+        $this->picture = '';
         $this->level = 1;
-        $this->category=0;
+        $this->category = 0;
         // This variable is used when loading an exercise like an scenario with
         // an special hotspot: final_overlap, final_missing, final_excess
-        $this->extra='';
-        $this->exerciseList=array();
+        $this->extra = '';
+        $this->exerciseList = array();
         $this->course = api_get_course_info();
         $this->category_list = array();
         $this->parent_id = 0;
@@ -130,7 +130,7 @@ abstract class Question
                 $objQuestion->level			= (int) $object->level;
                 $objQuestion->extra         = $object->extra;
                 $objQuestion->course        = $course_info;
-                $objQuestion->category	    = Testcategory::getCategoryForQuestion($id);
+                $objQuestion->category	    = TestCategory::getCategoryForQuestion($id);
 
                 $sql = "SELECT exercice_id FROM $TBL_EXERCICE_QUESTION
                         WHERE c_id = $course_id AND question_id = $id";
@@ -1313,11 +1313,11 @@ abstract class Question
             $form->addElement('select', 'questionLevel', get_lang('Difficulty'), $select_level);
 
             // Categories
-            //$category_list = Testcategory::getCategoriesIdAndName();
+            //$category_list = TestCategory::getCategoriesIdAndName();
             //$form->addElement('select', 'questionCategory', get_lang('Category'), $category_list, array('multiple' => 'multiple'));
 
             // Categories
-            $tabCat = Testcategory::getCategoriesIdAndName();
+            $tabCat = TestCategory::getCategoriesIdAndName();
             $form->addElement('select', 'questionCategory', get_lang('Category'), $tabCat);
 
             if (in_array($this->type, array(UNIQUE_ANSWER, MULTIPLE_ANSWER))) {
@@ -1603,7 +1603,7 @@ abstract class Question
         $question_title = $this->question;
 
         // display question category, if any
-        $header = Testcategory::returnCategoryAndTitle($this->id);
+        $header = TestCategory::returnCategoryAndTitle($this->id);
         $show_media = null;
         if ($show_media) {
             $header .= $this->show_media_content();

+ 2 - 2
main/exercice/unique_answer.class.php

@@ -20,10 +20,10 @@ class UniqueAnswer extends Question
     /**
      * Constructor
      */
-    public function UniqueAnswer()
+    public function __construct()
     {
         //this is highly important
-        parent::question();
+        parent::__construct();
         $this->type = UNIQUE_ANSWER;
         $this->isContent = $this->getIsContent();
     }

+ 3 - 3
main/exercice/unique_answer_no_option.class.php

@@ -18,10 +18,10 @@ class UniqueAnswerNoOption extends Question
 	/**
 	 * Constructor
 	 */
-	function UniqueAnswerNoOption()
+	public function __construct()
     {
 		//this is highly important
-		parent::question();
+		parent::__construct();
 		$this -> type = UNIQUE_ANSWER_NO_OPTION;
 		$this -> isContent = $this-> getIsContent();
 	}
@@ -251,7 +251,7 @@ class UniqueAnswerNoOption extends Question
         //$form->addElement('select', 'destination'.$i, get_lang('SelectQuestion').' : ',$select_question,'multiple');
 
         $form->addText("weighting[$i]", null, false, ['value' => 0, 'readonly' => 'readonly']);
-        
+
         $form->addHTml('</tr>');
         $form->addHtml('</tbody></table>');