]> git.mjollnir.org Git - moodle.git/commitdiff
Convert tabs to spaces.
authortjhunt <tjhunt>
Thu, 10 Aug 2006 18:23:09 +0000 (18:23 +0000)
committertjhunt <tjhunt>
Thu, 10 Aug 2006 18:23:09 +0000 (18:23 +0000)
question/category_class.php
question/format/aiken/format.php
question/format/blackboard/format.php
question/format/blackboard_6/format.php
question/format/examview/format.php
question/format/gift/format.php
question/format/learnwise/format.php
question/format/qti2/format.php

index 240d596b41d04798dbd6ac96cf635cf86747ccc4..e02f8a7566d48ff2064aae1eb96005e55c516f77 100644 (file)
@@ -58,7 +58,7 @@ class question_category_object {
         $this->str->editcategory   = get_string('editcategory', 'quiz');
         $this->str->cancel         = get_string('cancel');
         $this->str->editcategories = get_string('editcategories', 'quiz');
-        $this->str->page          = get_string('page');
+        $this->str->page           = get_string('page');
         $this->pixpath = $CFG->pixpath;
 
     }
index 3684ec389885e202b6f7f1b6f67d0da2860dbed0..c799bff83b889a7d475abd20527a2395bd404ef0 100644 (file)
@@ -59,7 +59,7 @@ class qformat_aiken extends qformat_default {
                     //trim off the label and space
                     $question->answer[] = substr($nowline,3);
                     $question->fraction[] = 0;
-                   $question->feedback[] = '';
+                    $question->feedback[] = '';
                     continue;
                 }
                 if ($leader == "AN"){
index 77bc06bd37adeeb66884bfcd38a06e06724f7ba9..a1aac2ab9f4fa1ab319d34ba7c247f9666502c1d 100644 (file)
@@ -91,15 +91,15 @@ function process_tf($xml, &$questions, $defaultq) {
         $question = $defaultq;
 
         $question->qtype = TRUEFALSE;
-        $question->single = 1; // Only one answer is allowed
+        $question->single = 1; // Only one answer is allowed
 
-       $thisquestion = $tfquestions[$i];
+        $thisquestion = $tfquestions[$i];
         // put questiontext in question object
-       $question->questiontext = addslashes(trim($thisquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"]));
+        $question->questiontext = addslashes(trim($thisquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"]));
         // put name in question object
         $question->name = $question->questiontext;
 
-       $choices = $thisquestion["#"]["ANSWER"];
+        $choices = $thisquestion["#"]["ANSWER"];
 
         $correct_answer = $thisquestion["#"]["GRADABLE"][0]["#"]["CORRECTANSWER"][0]["@"]["answer_id"];
 
@@ -136,30 +136,30 @@ function process_mc($xml, &$questions, $defaultq) {
         $question = $defaultq;
 
         $question->qtype = MULTICHOICE;
-        $question->single = 1; // Only one answer is allowed
+        $question->single = 1; // Only one answer is allowed
 
-       $thisquestion = $mcquestions[$i];
+        $thisquestion = $mcquestions[$i];
         // put questiontext in question object
-       $question->questiontext = addslashes(trim($thisquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"]));
+        $question->questiontext = addslashes(trim($thisquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"]));
         // put name of question in question object
         $question->name = $question->questiontext;
 
-       $choices = $thisquestion["#"]["ANSWER"];
-       for ($j = 0; $j < sizeof ($choices); $j++) {
+        $choices = $thisquestion["#"]["ANSWER"];
+        for ($j = 0; $j < sizeof ($choices); $j++) {
 
-           $choice = trim($choices[$j]["#"]["TEXT"][0]["#"]);
+            $choice = trim($choices[$j]["#"]["TEXT"][0]["#"]);
             // put this choice in the question object.
             $question->answer[$j] = addslashes($choice);
 
-           $id = $choices[$j]["@"]["id"];
-           $correct_answer_id = $thisquestion["#"]["GRADABLE"][0]["#"]["CORRECTANSWER"][0]["@"]["answer_id"];
+            $id = $choices[$j]["@"]["id"];
+            $correct_answer_id = $thisquestion["#"]["GRADABLE"][0]["#"]["CORRECTANSWER"][0]["@"]["answer_id"];
             // if choice is the answer, give 100%, otherwise give 0%
-           if (strcmp ($id, $correct_answer_id) == 0) {
-             $question->fraction[$j] = 1;
-              $question->feedback[$j] = addslashes(trim($thisquestion["#"]["GRADABLE"][0]["#"]["FEEDBACK_WHEN_CORRECT"][0]["#"]));
+            if (strcmp ($id, $correct_answer_id) == 0) {
+                $question->fraction[$j] = 1;
+                $question->feedback[$j] = addslashes(trim($thisquestion["#"]["GRADABLE"][0]["#"]["FEEDBACK_WHEN_CORRECT"][0]["#"]));
             } else {
-             $question->fraction[$j] = 0;
-              $question->feedback[$j] = addslashes(trim($thisquestion["#"]["GRADABLE"][0]["#"]["FEEDBACK_WHEN_INCORRECT"][0]["#"]));
+                $question->fraction[$j] = 0;
+                $question->feedback[$j] = addslashes(trim($thisquestion["#"]["GRADABLE"][0]["#"]["FEEDBACK_WHEN_INCORRECT"][0]["#"]));
             }
         }
         $questions[] = $question;
@@ -184,21 +184,21 @@ function process_ma($xml, &$questions, $defaultq) {
 
         $question->qtype = MULTICHOICE;
         $question->defaultgrade = 1;
-        $question->single = 0; // More than one answers allowed
-        $question->image = ""; // No images with this format
+        $question->single = 0; // More than one answers allowed
+        $question->image = ""; // No images with this format
 
-       $thisquestion = $maquestions[$i];
+        $thisquestion = $maquestions[$i];
         // put questiontext in question object
-       $question->questiontext = addslashes(trim($thisquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"]));
+        $question->questiontext = addslashes(trim($thisquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"]));
         // put name of question in question object
         $question->name = $question->questiontext;
 
-       $choices = $thisquestion["#"]["ANSWER"];
+        $choices = $thisquestion["#"]["ANSWER"];
         $correctanswers = $thisquestion["#"]["GRADABLE"][0]["#"]["CORRECTANSWER"];
 
-       for ($j = 0; $j < sizeof ($choices); $j++) {
+        for ($j = 0; $j < sizeof ($choices); $j++) {
 
-           $choice = trim($choices[$j]["#"]["TEXT"][0]["#"]);
+            $choice = trim($choices[$j]["#"]["TEXT"][0]["#"]);
             // put this choice in the question object.
             $question->answer[$j] = addslashes($choice);
 
@@ -243,15 +243,15 @@ function process_fib($xml, &$questions, $defaultq) {
         $question = $defaultq;
 
         $question->qtype = SHORTANSWER;
-        $question->usecase = 0;        // Ignore case
+        $question->usecase = 0; // Ignore case
 
-       $thisquestion = $fibquestions[$i];
+        $thisquestion = $fibquestions[$i];
         // put questiontext in question object
-       $question->questiontext = addslashes(trim($thisquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"]));
+        $question->questiontext = addslashes(trim($thisquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"]));
         // put name of question in question object
         $question->name = $question->questiontext;
 
-       $answer = trim($thisquestion["#"]["ANSWER"][0]["#"]["TEXT"][0]["#"]);
+        $answer = trim($thisquestion["#"]["ANSWER"][0]["#"]["TEXT"][0]["#"]);
 
         $question->answer[] = addslashes($answer);
         $question->fraction[] = 1;
@@ -280,54 +280,54 @@ function process_matching($xml, &$questions, $defaultq) {
 
         $question->qtype = MATCH;
 
-       $thisquestion = $matchquestions[$i];
+        $thisquestion = $matchquestions[$i];
         // put questiontext in question object
-       $question->questiontext = addslashes(trim($thisquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"]));
+        $question->questiontext = addslashes(trim($thisquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"]));
         // put name of question in question object
         $question->name = $question->questiontext;
 
-       $choices = $thisquestion["#"]["CHOICE"];
-       for ($j = 0; $j < sizeof ($choices); $j++) {
+        $choices = $thisquestion["#"]["CHOICE"];
+        for ($j = 0; $j < sizeof ($choices); $j++) {
 
             $subquestion = NULL;
 
-           $choice = $choices[$j]["#"]["TEXT"][0]["#"];
-           $choice_id = $choices[$j]["@"]["id"];
+            $choice = $choices[$j]["#"]["TEXT"][0]["#"];
+            $choice_id = $choices[$j]["@"]["id"];
           
             $question->subanswers[] = addslashes(trim($choice));
  
-           $correctanswers = $thisquestion["#"]["GRADABLE"][0]["#"]["CORRECTANSWER"];
-           for ($k = 0; $k < sizeof ($correctanswers); $k++) {
+            $correctanswers = $thisquestion["#"]["GRADABLE"][0]["#"]["CORRECTANSWER"];
+            for ($k = 0; $k < sizeof ($correctanswers); $k++) {
 
-               if (strcmp($choice_id, $correctanswers[$k]["@"]["choice_id"]) == 0) {
+                if (strcmp($choice_id, $correctanswers[$k]["@"]["choice_id"]) == 0) {
 
-                   $answer_id = $correctanswers[$k]["@"]["answer_id"];
+                    $answer_id = $correctanswers[$k]["@"]["answer_id"];
 
-                   $answers = $thisquestion["#"]["ANSWER"];
-                   for ($m = 0; $m < sizeof ($answers); $m++) {
+                    $answers = $thisquestion["#"]["ANSWER"];
+                    for ($m = 0; $m < sizeof ($answers); $m++) {
 
-                       $answer = $answers[$m];
-                       $current_ans_id = $answer["@"]["id"];
-                       if (strcmp ($current_ans_id, $answer_id) == 0) {
+                        $answer = $answers[$m];
+                        $current_ans_id = $answer["@"]["id"];
+                        if (strcmp ($current_ans_id, $answer_id) == 0) {
 
-                           $answer = $answer["#"]["TEXT"][0]["#"];
+                            $answer = $answer["#"]["TEXT"][0]["#"];
                             $question->subquestions[] = addslashes(trim($answer));
-                           break;
+                            break;
 
-                         }
+                        }
 
-                     }
+                    }
 
-                   break;
+                    break;
 
-                 }
+                }
 
-             }
+            }
            
-         }
+        }
 
-          $questions[] = $question;
+        $questions[] = $question;
           
-      }
+    }
 }
 ?>
index af2729565252ba701c9a0fec6ac02e88abd46358..1ae814c15ee26f82eea00a09f87466ea3bd864f8 100644 (file)
@@ -518,9 +518,9 @@ function process_tf($quest, &$questions) {
 
     $question->qtype = TRUEFALSE;
     $question->defaultgrade = 1;
-    $question->single = 1;     // Only one answer is allowed
-    $question->image = "";     // No images with this format
-       $question->questiontext = addslashes($quest->QUESTION_BLOCK->text);
+    $question->single = 1; // Only one answer is allowed
+    $question->image = ""; // No images with this format
+    $question->questiontext = addslashes($quest->QUESTION_BLOCK->text);
     // put name in question object
     $question->name = $question->questiontext;
 
@@ -679,8 +679,8 @@ function process_ma($quest, &$questions) {
     $question->name = $question->questiontext; 
     $question->qtype = MULTICHOICE;
     $question->defaultgrade = 1;
-    $question->single = 0;     // More than one answers allowed
-    $question->image = "";     // No images with this format
+    $question->single = 0; // More than one answers allowed
+    $question->image = ""; // No images with this format
 
     $answers = $quest->responses;
     $correct_answers = array();
@@ -727,8 +727,8 @@ function process_essay($quest, &$questions) {
         // treat as short answer
         $question->qtype = ESSAY;
         $question->defaultgrade = 1;
-        $question->usecase = 0;        // Ignore case
-        $question->image = ""; // No images with this format
+        $question->usecase = 0; // Ignore case
+        $question->image = ""; // No images with this format
         $question->questiontext = addslashes(trim($quest->QUESTION_BLOCK->text));
         $question->name = $question->questiontext;
     
index f7cdbef7fdfdbc8d30ee456e629c4fdaddb51295..d6e6e18348f130ed9da2072f2945d09a9c586e43 100755 (executable)
@@ -6,11 +6,14 @@
 **
 ** @TODO:
 **   Take care of odd unicode character mapping (ex: curly quotes)
-**      Image and table support
+**   Image and table support
 **   Formatting support
 **   Support of rejoinders
 **
 ** $Log$
+** Revision 1.4  2006/08/10 18:23:39  tjhunt
+** Convert tabs to spaces.
+**
 ** Revision 1.3  2006/05/04 11:17:50  thepurpleblob
 ** Merging from STABLE
 **
@@ -139,37 +142,37 @@ class qformat_examview extends qformat_default {
         }
         foreach($this->matching_questions as $match_group) {
             $question = $this->defaultquestion();
-                       $htmltext = $this->htmlPrepare($match_group->questiontext);
-                       $htmltext = addslashes($htmltext);
+            $htmltext = $this->htmlPrepare($match_group->questiontext);
+            $htmltext = addslashes($htmltext);
             $question->questiontext = $htmltext;
             $question->name = $question->questiontext;
             $question->qtype = MATCH;
             // No images with this format
-            //         print($question->questiontext.' '.$question->id."<BR>");
+            // print($question->questiontext.' '.$question->id."<BR>");
             
             $question->subquestions = array();
             $question->subanswers = array();
             foreach($match_group->subquestions as $key => $value) {
-                           $htmltext = $this->htmlPrepare($value);
-                               $htmltext = addslashes($htmltext);
+                $htmltext = $this->htmlPrepare($value);
+                $htmltext = addslashes($htmltext);
                 $question->subquestions[] = $htmltext;
 
                 $htmltext = $this->htmlPrepare($match_group->subanswers[$key]);
-                               $htmltext = addslashes($htmltext);
+                $htmltext = addslashes($htmltext);
                 $question->subanswers[] = $htmltext;
             }
             $questions[] = $question;
         }
     }
     
-       // cleans unicode characters from string
-       // add to the array unicode_array as necessary
-       function cleanUnicode($text) {
-               //$unicode_array = array(       "&#2019;" => "'");
-               //return strtr($text, $unicode_array);          
-               return str_replace('&#x2019;', "'", $text);
-       }
-       
+    // cleans unicode characters from string
+    // add to the array unicode_array as necessary
+    function cleanUnicode($text) {
+        //$unicode_array = array("&#2019;" => "'");
+        //return strtr($text, $unicode_array);
+        return str_replace('&#x2019;', "'", $text);
+    }
+    
     function readquestions($lines)
     {
         /// Parses an array of lines into an array of questions,
@@ -180,7 +183,7 @@ class qformat_examview extends qformat_default {
         $currentquestion = array();
         
         $text = implode($lines, ' ');
-               $text = $this->cleanUnicode($text);
+        $text = $this->cleanUnicode($text);
 
         $xml = xmlize($text, 0);
         $this->parse_matching_groups($xml['examview']['#']['matching-group']);
index 509e5ec020eb16a9cd5eee6b1abfd9e1cca1c953..6be1cd5ca973981ea5b64146c2f1c7d4360621b3 100755 (executable)
@@ -269,9 +269,9 @@ class qformat_gift extends qformat_default {
     
                 $countanswers = count($answers);
                 
-               if (!$this->check_answer_count( 2,$answers,$text )) {
-                 return false;
-                 break;
+                if (!$this->check_answer_count( 2,$answers,$text )) {
+                    return false;
+                    break;
                 }
 
                 foreach ($answers as $key => $answer) {
@@ -307,9 +307,9 @@ class qformat_gift extends qformat_default {
                     array_shift($answers);
                 }
     
-               if (!$this->check_answer_count( 2,$answers,$text )) {
-                 return false;
-                 break;
+                if (!$this->check_answer_count( 2,$answers,$text )) {
+                    return false;
+                    break;
                 }
     
                 foreach ($answers as $key => $answer) {
@@ -364,9 +364,9 @@ class qformat_gift extends qformat_default {
                     array_shift($answers);
                 }
     
-               if (!$this->check_answer_count( 1,$answers,$text )) {
-                 return false;
-                 break;
+                if (!$this->check_answer_count( 1,$answers,$text )) {
+                    return false;
+                    break;
                 }
 
                 foreach ($answers as $key => $answer) {
index 8834055d2db417adb9a4bb67b8b69e28d5d1eff8..1f3971374fccb822cc745250b60db2642f0acf9b 100755 (executable)
@@ -15,16 +15,16 @@ class qformat_learnwise extends qformat_default {
     function readquestions($lines) {
         $questions = array();
         $currentquestion = array();
-               
+
         foreach($lines as $line) {
             $line = trim($line);
             $currentquestion[] = $line;
-                       
+
             if ($question = $this->readquestion($currentquestion)) {
                 $questions[] = $question;
                 $currentquestion = array();
             }
-        }                              
+        }
         return $questions;
     }
 
@@ -100,7 +100,7 @@ class qformat_learnwise extends qformat_default {
         $question->questiontext = $questiontext;
         $question->single = ($type == 'multichoice') ? 1 : 0;
         $question->feedback[] = '';
-                       
+
         $question->fraction = array();
         $question->answer = array();
         for ($n = 0; $n < count($optionstext); ++$n) {
@@ -130,7 +130,7 @@ class qformat_learnwise extends qformat_default {
     function stringbetween($text, $start, $end) {
         $startpos = strpos($text, $start) + strlen($start);
         $endpos = strpos($text, $end);
-       
+
         if ($startpos <= $endpos) {
             return substr($text, $startpos, $endpos - $startpos);
         }
index 6c5c2e0ee58adb536d557b468f46e5cf97384187..208e39c17892741cf1400f828b51001a6de4d3c0 100644 (file)
@@ -305,8 +305,8 @@ function handle_questions_media(&$questions, $path, $courseid) {
         // zip files into single export file
         zip_files( array($path), "$path.zip" );
 
-       // remove the temporary directory
-               remove_dir( $path );
+        // remove the temporary directory
+        remove_dir( $path );
  
         return true;
     }
@@ -548,7 +548,7 @@ function xml_entitize(&$collection) {
                 $answers = $this->shuffle_things($answers);
             }
             
-           if (isset($question->response)) {
+        if (isset($question->response)) {
               $correctresponseid = $question->response[$questionid];
               if ($answers[0]['id'] == $correctresponseid) {
                   $correctresponse = $answers[0];