Browse Source

Fixing typo + cleaning code

Julio Montoya 13 years ago
parent
commit
94c8960bb1
1 changed files with 10 additions and 8 deletions
  1. 10 8
      main/exercice/exercise.class.php

+ 10 - 8
main/exercice/exercise.class.php

@@ -481,7 +481,10 @@ class Exercise {
 	 * @param - integer $random - 0 if not random, otherwise the draws
 	 */
 	function setRandom($random) {
-		$this->random=$random;
+		/*if ($random == 'all') {
+			$random = $this->selectNbrQuestions();
+		}*/
+		$this->random = $random;
 	}
 
 
@@ -492,7 +495,7 @@ class Exercise {
 	 * @param - integer $random_answers - random answers
 	 */
 	function updateRandomAnswers($random_answers) {
-		$this->$random_answers = $random_answers;
+		$this->random_answers = $random_answers;
 	}
 
 	/**
@@ -995,13 +998,12 @@ class Exercise {
 					$form->addElement('hidden', 'exerciseType', ONE_PER_PAGE);
 				}
 			}
-
-			$random = array();
-			$option=array();
+			
+			$option = array();
 			$max = ($this->id > 0) ? $this->selectNbrQuestions() : 10 ;
 			$option = range(0,$max);
-			$option[0]=get_lang('No');
-
+			$option[0] = get_lang('No');
+			
 			$form->addElement('select', 'randomQuestions',array(get_lang('RandomQuestions'), get_lang('RandomQuestionsHelp')), $option, array('id'=>'randomQuestions','class'=>'chzn-select'));			
 
 			//random answers
@@ -1112,7 +1114,7 @@ class Exercise {
 
 		// defaults
 		if ($type=='full') {
-			if($this->id > 0) {
+			if ($this->id > 0) {
 				if ($this->random > $this->selectNbrQuestions()) {
 					$defaults['randomQuestions'] =  $this->selectNbrQuestions();
 				} else {