Explorar o código

Minor - cleaning code

Julio Montoya %!s(int64=12) %!d(string=hai) anos
pai
achega
273ca23abb

+ 2 - 20
main/coursecopy/classes/Quiz.class.php

@@ -25,29 +25,11 @@ class Quiz extends Resource
      * @param int $type
      * @param int $active
      */
-//    function Quiz($id, $title, $description, $random, $type, $active, $media, $attempts = 0, $results_disabled = 0, $access_condition = null, $start_time = '0000-00-00 00:00:00', $end_time = '0000-00-00 00:00:00', $feedback_type = 0, $random_answers = 0, $expired_time = 0, $session_id = 0) {
+    public $obj; //question
+
     function Quiz($obj) {
         parent::Resource($obj->id, RESOURCE_QUIZ);
         $this->obj = $obj;
-
-        /*
-        $this->title = $title;
-        $this->description = $description;
-        $this->random = $random;
-        $this->quiz_type = $type;
-        $this->active = $active;
-        $this->media = $media;
-        $this->attempts = $attempts;
-        $this->question_ids = array();
-        $this->question_orders = array();
-        $this->results_disabled = $results_disabled;
-        $this->access_condition = $access_condition;
-        $this->start_time = $start_time;
-        $this->end_time = $end_time;
-        $this->feedback_type = $feedback_type;
-        $this->random_answers = $random_answers;
-        $this->expired_time = $expired_time;
-        $this->session_id = $session_id;*/
     }
 
     /**

+ 87 - 77
main/coursecopy/classes/QuizQuestion.class.php

@@ -1,4 +1,5 @@
 <?php
+
 /* For licensing terms, see /license.txt */
 /**
  * Exercises questions backup script
@@ -8,6 +9,7 @@
  * Code
  */
 require_once 'Resource.class.php';
+
 /**
  * An QuizQuestion
  * @author Bart Mollet <bart.mollet@hogent.be>
@@ -15,82 +17,90 @@ require_once 'Resource.class.php';
  */
 class QuizQuestion extends Resource
 {
-	/**
-	 * The question
-	 */
-	var $question;
-	/**
-	 * The description
-	 */
-	var $description;
-	/**
-	 * Ponderation
-	 */
-	var $ponderation;
-	/**
-	 * Type
-	 */
-	var $quiz_type;
-	/**
-	 * Position
-	 */
-	var $position;
-	/**
-	 * Level
-	 */
-	var $level;
-	/**
-	 * Answers
-	 */
-	var $answers;
-	/**
-	 * Picture
-	 */
-	var $picture;
-    
+
+    /**
+     * The question
+     */
+    var $question;
+
+    /**
+     * The description
+     */
+    var $description;
+
+    /**
+     * Ponderation
+     */
+    var $ponderation;
+
+    /**
+     * Type
+     */
+    var $quiz_type;
+
+    /**
+     * Position
+     */
+    var $position;
+
+    /**
+     * Level
+     */
+    var $level;
+
+    /**
+     * Answers
+     */
+    var $answers;
+
+    /**
+     * Picture
+     */
+    var $picture;
     var $extra;
-	/**
-	 * Create a new QuizQuestion
-	 * @param string $question
-	 * @param string $description
-	 * @param int $ponderation
-	 * @param int $type
-	 * @param int $position
-	 */
-	function QuizQuestion($id,$question,$description,$ponderation,$type,$position,$picture,$level, $extra) {
-		parent::Resource($id, RESOURCE_QUIZQUESTION);
-		$this->question = $question;
-		$this->description = $description;
-		$this->ponderation = $ponderation;
-		$this->quiz_type = $type;
-		$this->position = $position;
-		$this->picture = $picture;
-		$this->level = $level;
-		$this->answers = array();
+
+    /**
+     * Create a new QuizQuestion
+     * @param string $question
+     * @param string $description
+     * @param int $ponderation
+     * @param int $type
+     * @param int $position
+     */
+    function QuizQuestion($id, $question, $description, $ponderation, $type, $position, $picture, $level, $extra) {
+        parent::Resource($id, RESOURCE_QUIZQUESTION);
+        $this->question = $question;
+        $this->description = $description;
+        $this->ponderation = $ponderation;
+        $this->quiz_type = $type;
+        $this->position = $position;
+        $this->picture = $picture;
+        $this->level = $level;
+        $this->answers = array();
         $this->extra = $extra;
-	}
-    
-	/**
-	 * Add an answer to this QuizQuestion
-	 */
-	function add_answer($answer_id, $answer_text,$correct,$comment,$ponderation,$position,$hotspot_coordinates,$hotspot_type) {
-		$answer = array();		
-		$answer['id'] = $answer_id;
-		$answer['answer'] = $answer_text;
-		$answer['correct'] = $correct;
-		$answer['comment'] = $comment;
-		$answer['ponderation'] = $ponderation;
-		$answer['position'] = $position;
-		$answer['hotspot_coordinates'] = $hotspot_coordinates;
-		$answer['hotspot_type'] = $hotspot_type;
-		$this->answers[] = $answer;
-	}
-    
-	/**
-	 * Show this question
-	 */
-	function show() {
-		parent::show();
-		echo $this->question;
-	}
-}
+    }
+
+    /**
+     * Add an answer to this QuizQuestion
+     */
+    function add_answer($answer_id, $answer_text, $correct, $comment, $ponderation, $position, $hotspot_coordinates, $hotspot_type) {
+        $answer = array();
+        $answer['id'] = $answer_id;
+        $answer['answer'] = $answer_text;
+        $answer['correct'] = $correct;
+        $answer['comment'] = $comment;
+        $answer['ponderation'] = $ponderation;
+        $answer['position'] = $position;
+        $answer['hotspot_coordinates'] = $hotspot_coordinates;
+        $answer['hotspot_type'] = $hotspot_type;
+        $this->answers[] = $answer;
+    }
+
+    /**
+     * Show this question
+     */
+    function show() {
+        parent::show();
+        echo $this->question;
+    }
+}