]> git.mjollnir.org Git - moodle.git/commitdiff
Taken out some $THEME
authorgustav_delius <gustav_delius>
Sat, 5 Feb 2005 17:28:06 +0000 (17:28 +0000)
committergustav_delius <gustav_delius>
Sat, 5 Feb 2005 17:28:06 +0000 (17:28 +0000)
mod/quiz/edit.php
mod/quiz/export.php
mod/quiz/format/coursetestmanager/format.php
mod/quiz/import.php
mod/quiz/lib.php
mod/quiz/locallib.php
mod/quiz/multiple.php
mod/quiz/questiontypes/datasetdependent/categorydatasetdefinitions.php

index 19ebc425c7e70e32640f4086a4c7b4853fc823b6..661b09287bce0520de6effbcb06447d4523168be 100644 (file)
         }
         $modform->instance = $modform->id;
         $SESSION->modform = $modform;    // Save the form in the current session
-            
+
         $cm = get_coursemodule_from_instance('quiz', $modform->instance);
-        add_to_log($cm->course, 'quiz', 'editquestions', 
-                           "view.php?id=$modform->instance", 
-                           "$modform->name", $cm->id); 
+        add_to_log($cm->course, 'quiz', 'editquestions',
+                           "view.php?id=$modform->instance",
+                           "$modform->name", $cm->id);
 
     } else if ($courseid) { // Page retrieve through "Edit Questions" link - no quiz selected
         $modform->course = $courseid;
         unset($modform->instance);
         $SESSION->modform = $modform;    // Save the form in the current session
-        
+
         add_to_log($courseid, 'quiz', 'editquestions', "index.php?id=$courseid");
-        
+
     } else {
         if (!isset($SESSION->modform)) {
           // We currently also get here after editing a question by
@@ -40,7 +40,7 @@
             error('');
         }
 
-        // The data is obtained from a $SESSION variable. This is mostly for historic reasons. 
+        // The data is obtained from a $SESSION variable. This is mostly for historic reasons.
         // With the way things work now it would be just as possible to get the data from the database.
         $modform = $SESSION->modform;
     }
                 $questionrecord = get_record("quiz_questions", "id", $key);
 
                 if (!empty($questionrecord->defaultgrade)) {
-                    $modform->grades[$key] = $questionrecord->defaultgrade; 
+                    $modform->grades[$key] = $questionrecord->defaultgrade;
                 } else if ($questionrecord->qtype == DESCRIPTION){
-                    $modform->grades[$key] = 0; 
+                    $modform->grades[$key] = 0;
                 } else {
-                    $modform->grades[$key] = 1; 
+                    $modform->grades[$key] = 1;
                 }
             }
         }
         quiz_questiongrades_update($modform->grades, $modform->instance);
     }
 
-    if (isset($_REQUEST['delete']) and confirm_sesskey()) { /// Delete a question from the list 
+    if (isset($_REQUEST['delete']) and confirm_sesskey()) { /// Delete a question from the list
         $questions = explode(",", $modform->questions);
         foreach ($questions as $key => $question) {
             if ($question == $delete) {
         }
         quiz_questiongrades_update($modform->grades, $modform->instance);
     }
-    
+
     if (isset($_REQUEST['cat'])) { /// coming from category selection drop-down menu
         $modform->category = $cat;
     }
-        
+
     if (isset($_REQUEST['recurse'])) { /// coming from checkbox below category selection form
         $modform->recurse = $recurse;
     }
-    
+
 /// all commands have been dealt with, now print the page
 
-    if (empty($modform->category) or !record_exists('quiz_categories', 'id', $modform->category)) { 
+    if (empty($modform->category) or !record_exists('quiz_categories', 'id', $modform->category)) {
         $category = quiz_get_default_category($course->id);
         $modform->category = $category->id;
     }
                  " -> $strediting");
         echo '<table border="0" width="100%" cellpadding="2" cellspacing="0">';
         echo '<tr><td width="50%" valign="top">';
-        print_simple_box_start("center", "100%", $THEME->cellcontent2);        
+        print_simple_box_start("center", "100%");
         print_heading($modform->name);
         $sumgrades = quiz_print_question_list($modform->questions, $modform->grades);
         if (!set_field('quiz', 'sumgrades', $sumgrades, 'id', $modform->instance)) {
         echo '</td><td valign="top" width="50%">';
     }
     // non-quiz-specific column
-    print_simple_box_start("center", "100%", $THEME->cellcontent2);
+    print_simple_box_start("center", "100%");
     // starts with category selection form
     quiz_print_category_form($course, $modform->category, $modform->recurse);
     print_simple_box_end();
-    
+
     print_spacer(5,1);
     // continues with list of questions
-    print_simple_box_start("center", "100%", $THEME->cellcontent2);
+    print_simple_box_start("center", "100%");
     quiz_print_cat_question_list($modform->category,
                                  isset($modform->instance), $modform->recurse, $page, $perpage);
     print_simple_box_end();
index 95b54d37d34a78cc0479383402dd85c5be32e389..5b2c790d18308d1cd40146b5b80a4927fb1d41c5 100644 (file)
         $format = new quiz_file_format();
 
         if (! $format->exportpreprocess($category, $course)) {   // Do anything before that we need to
-            error("Error occurred during pre-processing!", 
+            error("Error occurred during pre-processing!",
                     "$CFG->wwwroot/mod/quiz/export.php?category=$category->id");
         }
 
         if (! $format->exportprocess($exportfilename)) {         // Process the export data
-            error("Error occurred during processing!", 
+            error("Error occurred during processing!",
                     "$CFG->wwwroot/mod/quiz/export.php?category=$category->id");
         }
 
         if (! $format->exportpostprocess()) {                    // In case anything needs to be done after
-            error("Error occurred during post-processing!", 
+            error("Error occurred during post-processing!",
                     "$CFG->wwwroot/mod/quiz/export.php?category=$category->id");
         }
 
@@ -63,7 +63,7 @@
         print_continue("edit.php");
         print_footer($course);
         exit;
-    } 
+    }
 
     /// Print upload form
 
     // get filename
     if (!isset($exportfilename)) {
         $exportfilename = default_export_filename($course, $category);
-    }    
+    }
 
     print_heading_with_help($strexportquestions, "export", "quiz");
 
-    print_simple_box_start("center", "", "$THEME->cellheading");
+    print_simple_box_start("center");
     echo "<form enctype=\"multipart/form-data\" method=\"post\" action=\"export.php\">";
     echo "<table cellpadding=\"5\">";
 
index 18cbe553a6579a1be4e6dd6db778d6b5b535b4eb..5c971d219c09f4879022a1331f1d178803545ea9 100755 (executable)
@@ -1,4 +1,4 @@
-<?php  // $Id$ 
+<?php  // $Id$
 ////////////////////////////////////////////////////////////////////
 /// Class for importing course test manager questions.            //
 ///                                                               //
@@ -14,227 +14,227 @@ class quiz_file_format {
         return true;
     }
     function importprocess($filename) {
-      global $CFG,$QUIZ_FILE_FORMAT,$strimportquestions,$form,$question_category,$category,$course,$THEME,
+      global $CFG,$QUIZ_FILE_FORMAT,$strimportquestions,$form,$question_category,$category,$course,
       $hostname, $mdapath, $mdbpath;
-                       if ((PHP_OS == "Linux") and isset($hostname)) {
-                               $hostname = trim($hostname);
-                               // test the ODBC socket server connection
-                               // if failure, unset hostname and set hostname_access_error
+            if ((PHP_OS == "Linux") and isset($hostname)) {
+                $hostname = trim($hostname);
+                // test the ODBC socket server connection
+                // if failure, unset hostname and set hostname_access_error
         $question_categories = $this->getquestioncategories($mdbpath, $mdapath, $hostname);
-        if (!$question_categories) { 
-               $hostname_access_error = $hostname . " ";
-               unset($hostname);
+        if (!$question_categories) {
+            $hostname_access_error = $hostname . " ";
+            unset($hostname);
         } else  {
-               $hostname_access_error = 0;
+            $hostname_access_error = 0;
         }
-                       }
+            }
 
-                       if ((PHP_OS == "Linux") and !isset($hostname)) {
-                                                               // copy the file to a semi-permanent location
-                   if (! $basedir = make_upload_directory("$course->id")) {
-                       error("The site administrator needs to fix the file permissions for the data directory");
-                   }
-                               if (!isset($hostname_access_error)) { 
-                 $bname=basename($filename);
-               $cleanfilename = clean_filename($bname);
-               if ($cleanfilename) {
-                   $newfile = "$basedir/$cleanfilename";
-                   if (move_uploaded_file($filename, $newfile)) {
-                       chmod($newfile, 0666);
+            if ((PHP_OS == "Linux") and !isset($hostname)) {
+                                // copy the file to a semi-permanent location
+            if (! $basedir = make_upload_directory("$course->id")) {
+                error("The site administrator needs to fix the file permissions for the data directory");
+            }
+                if (!isset($hostname_access_error)) {
+              $bname=basename($filename);
+            $cleanfilename = clean_filename($bname);
+            if ($cleanfilename) {
+                $newfile = "$basedir/$cleanfilename";
+                if (move_uploaded_file($filename, $newfile)) {
+                    chmod($newfile, 0666);
                     clam_log_upload($newfile,$course);
-                   } else {
-                       notify(get_string("uploadproblem", "", $filename));
-                   }
-               }
-               $filename = $newfile;
-                               }
-                   print_heading_with_help($strimportquestions, "import", "quiz");
-                   print_simple_box_start("center", "", "$THEME->cellheading");
-                               if ($hostname_access_error) { notify("couldn't connect to ODBC Socket Server on " . $hostname_access_error); }
-                   echo "<form method=\"post\" action=\"import.php\">";
-                   echo "<table cellpadding=\"5\">";
+                } else {
+                    notify(get_string("uploadproblem", "", $filename));
+                }
+            }
+            $filename = $newfile;
+                }
+            print_heading_with_help($strimportquestions, "import", "quiz");
+            print_simple_box_start("center");
+                if ($hostname_access_error) { notify("couldn't connect to ODBC Socket Server on " . $hostname_access_error); }
+            echo "<form method=\"post\" action=\"import.php\">";
+            echo "<table cellpadding=\"5\">";
 
         echo "<tr><td align=\"right\">";
-                   echo "What is the hostname or IP address of the ODBC Socket Server:</td><td>";
-                   echo " <input name=\"hostname\" type=\"text\" size=\"50\" value=\"".stripslashes($hostname_access_error)."\" />";
-                   echo " <input name=\"filename\" type=\"hidden\" value=\"".$filename."\" />";
-                   echo " <input name=\"category\" type=\"hidden\" value=\"".$category->id."\" />";
-                   echo " <input name=\"format\" type=\"hidden\" value=\"".$form->format."\" />";
-                   echo "</td><td>&nbsp;</td></tr>";
+            echo "What is the hostname or IP address of the ODBC Socket Server:</td><td>";
+            echo " <input name=\"hostname\" type=\"text\" size=\"50\" value=\"".stripslashes($hostname_access_error)."\" />";
+            echo " <input name=\"filename\" type=\"hidden\" value=\"".$filename."\" />";
+            echo " <input name=\"category\" type=\"hidden\" value=\"".$category->id."\" />";
+            echo " <input name=\"format\" type=\"hidden\" value=\"".$form->format."\" />";
+            echo "</td><td>&nbsp;</td></tr>";
         echo "<tr><td align=\"right\">";
-                   echo "What is the location of the database (.mdb file) on the Socket Server:</td><td>";
-                   echo " <input name=\"mdbpath\" type=\"text\" size=\"50\" value=\"".stripslashes($mdbpath)."\" />";
-                               echo "</td><td>&nbsp;</td></tr>";
+            echo "What is the location of the database (.mdb file) on the Socket Server:</td><td>";
+            echo " <input name=\"mdbpath\" type=\"text\" size=\"50\" value=\"".stripslashes($mdbpath)."\" />";
+                echo "</td><td>&nbsp;</td></tr>";
         echo "<tr><td align=\"right\">";
-                   echo "What is the location of the system database (System.mda file) on the Socket Server:</td><td>";
-                   echo " <input name=\"mdapath\" type=\"text\" size=\"50\" value=\"".stripslashes($mdapath)."\" />";
-                               echo "</td><td>&nbsp;</td></tr>";
-                   echo "<tr><td>&nbsp;</td><td>";
-                   echo " <input type=\"submit\" name=\"save\" value=\"Connect to Server\" />";
-                   echo "</td></tr>";
-                   echo "</table>";
-                   echo "</form>";
-                   print_simple_box_end();
-                   print_footer($course);
-             exit;
-                       } 
-                               
-                       // we get here if running windows or after connect to ODBC socket server on linux
+            echo "What is the location of the system database (System.mda file) on the Socket Server:</td><td>";
+            echo " <input name=\"mdapath\" type=\"text\" size=\"50\" value=\"".stripslashes($mdapath)."\" />";
+                echo "</td><td>&nbsp;</td></tr>";
+            echo "<tr><td>&nbsp;</td><td>";
+            echo " <input type=\"submit\" name=\"save\" value=\"Connect to Server\" />";
+            echo "</td></tr>";
+            echo "</table>";
+            echo "</form>";
+            print_simple_box_end();
+            print_footer($course);
+          exit;
+            }
+
+            // we get here if running windows or after connect to ODBC socket server on linux
 //
 // this generates the page to choose categories of questions to import
 //
-           if (!isset($question_category)) {
+        if (!isset($question_category)) {
 
-                               if (PHP_OS == "WINNT") { 
-                                       // copy the file to a semi-permanent location
-                           if (! $basedir = make_upload_directory("$course->id")) {
-                               error("The site administrator needs to fix the file permissions for the data directory");
-                           }
-                 $bname=basename($filename);
-               $cleanfilename = clean_filename($bname);
-               if ($cleanfilename) {
-                   $newfile = "$basedir/$cleanfilename";
-                   if (move_uploaded_file($filename, $newfile)) {
-                       chmod($newfile, 0666);
+                if (PHP_OS == "WINNT") {
+                    // copy the file to a semi-permanent location
+                if (! $basedir = make_upload_directory("$course->id")) {
+                    error("The site administrator needs to fix the file permissions for the data directory");
+                }
+              $bname=basename($filename);
+            $cleanfilename = clean_filename($bname);
+            if ($cleanfilename) {
+                $newfile = "$basedir/$cleanfilename";
+                if (move_uploaded_file($filename, $newfile)) {
+                    chmod($newfile, 0666);
                     clam_log_upload($newfile,$course);
-                   } else {
-                       notify(get_string("uploadproblem", "", $filename));
-                   }
-               }
-               $filename = $newfile;
-                               }
+                } else {
+                    notify(get_string("uploadproblem", "", $filename));
+                }
+            }
+            $filename = $newfile;
+                }
         // end of file copy
 
-                               // don't have to do this on linux, since it's alreay been done in the test above
+                // don't have to do this on linux, since it's alreay been done in the test above
         if (PHP_OS == "WINNT") { $question_categories = $this->getquestioncategories($filename); }
         // print the intermediary form
-                   if (!$categories = quiz_get_category_menu($course->id, true)) {
-                       error("No categories!");
-                   }
-                   print_heading_with_help($strimportquestions, "import", "quiz");
-                   print_simple_box_start("center", "", "$THEME->cellheading");
-                   echo "<form method=\"post\" action=\"import.php\">";
-                   echo "<table cellpadding=\"5\">";
+            if (!$categories = quiz_get_category_menu($course->id, true)) {
+                error("No categories!");
+            }
+            print_heading_with_help($strimportquestions, "import", "quiz");
+            print_simple_box_start("center");
+            echo "<form method=\"post\" action=\"import.php\">";
+            echo "<table cellpadding=\"5\">";
         echo "<tr><td align=\"right\">";
-                   echo "Choose a category of questions to import:</td><td>";
-                   asort($question_categories);
-                   choose_from_menu($question_categories, "question_category","All Categories","All Categories", "", "allcategories");
-                   echo " <input name=\"filename\" type=\"hidden\" value=\"".$filename."\" />";
-                   echo " <input name=\"category\" type=\"hidden\" value=\"".$category->id."\" />";
-                   echo " <input name=\"format\" type=\"hidden\" value=\"".$form->format."\" />";
-                   if (PHP_OS == "Linux") {
-                           echo " <input name=\"hostname\" type=\"hidden\" value=\"".stripslashes(trim($hostname))."\" />";
-                           echo " <input name=\"mdbpath\" type=\"hidden\" value=\"".stripslashes($mdbpath)."\" />";
-                           echo " <input name=\"mdapath\" type=\"hidden\" value=\"".stripslashes($mdapath)."\" />";
-                   }
-                   echo "</td><td>&nbsp;</td>";
-                   echo "</tr><tr><td>&nbsp;</td><td>";
-                   echo " <input type=\"submit\" name=\"save\" value=\"Import Questions\" />";
-                   echo "</td></tr>";
-                   echo "</table>";
-                   echo "</form>";
-                   print_simple_box_end();
-                   print_footer($course);
-             exit;             
-           }
+            echo "Choose a category of questions to import:</td><td>";
+            asort($question_categories);
+            choose_from_menu($question_categories, "question_category","All Categories","All Categories", "", "allcategories");
+            echo " <input name=\"filename\" type=\"hidden\" value=\"".$filename."\" />";
+            echo " <input name=\"category\" type=\"hidden\" value=\"".$category->id."\" />";
+            echo " <input name=\"format\" type=\"hidden\" value=\"".$form->format."\" />";
+            if (PHP_OS == "Linux") {
+                echo " <input name=\"hostname\" type=\"hidden\" value=\"".stripslashes(trim($hostname))."\" />";
+                echo " <input name=\"mdbpath\" type=\"hidden\" value=\"".stripslashes($mdbpath)."\" />";
+                echo " <input name=\"mdapath\" type=\"hidden\" value=\"".stripslashes($mdapath)."\" />";
+            }
+            echo "</td><td>&nbsp;</td>";
+            echo "</tr><tr><td>&nbsp;</td><td>";
+            echo " <input type=\"submit\" name=\"save\" value=\"Import Questions\" />";
+            echo "</td></tr>";
+            echo "</table>";
+            echo "</form>";
+            print_simple_box_end();
+            print_footer($course);
+          exit;
+        }
 //
 // this is the main import section
 //
     notify("Importing questions");
-    if (PHP_OS == "Linux") { 
-       $hostname = trim($hostname);
-       $records = $this->getquestions($mdbpath,$question_category,$mdapath, $hostname);
+    if (PHP_OS == "Linux") {
+        $hostname = trim($hostname);
+        $records = $this->getquestions($mdbpath,$question_category,$mdapath, $hostname);
     } else {
-       $records = $this->getquestions($filename,$question_category);
+        $records = $this->getquestions($filename,$question_category);
     }
-                               foreach ($records as $qrec)
-                               {
-               $question = NULL;
-               $question->image = "";  // No images with this format
-                                       if ($qrec[9] != "") {
-                                               $question->image = $qrec[9];
-                                       }
-               $question->defaultgrade = 1;
-//     0       Selected
-//     1       PracticeTestOK?
-//     2       QuestionText
-//     3       QuestionType
-//     4       Option1Text
-//     5       Option2Text
-//     6       Option3Text
-//     7       Option4Text
-//     8       CorrectAnswer
-//     9       Graphic
-//     10      Module
-//     11      ChapterNumber
-//     12      PageNumber
+                foreach ($records as $qrec)
+                {
+            $question = NULL;
+            $question->image = "";  // No images with this format
+                    if ($qrec[9] != "") {
+                        $question->image = $qrec[9];
+                    }
+            $question->defaultgrade = 1;
+//  0   Selected
+//  1   PracticeTestOK?
+//  2   QuestionText
+//  3   QuestionType
+//  4   Option1Text
+//  5   Option2Text
+//  6   Option3Text
+//  7   Option4Text
+//  8   CorrectAnswer
+//  9   Graphic
+//  10  Module
+//  11  ChapterNumber
+//  12  PageNumber
           $ref = "Answer can be found in chapter ". $qrec[11] . ", page " . $qrec[12] . ".";
-                                       switch ($qrec[3]) {
-                                 case 1:                               
-                               $question->qtype = MULTICHOICE; // MULTICHOICE, SHORTANSWER, TRUEFALSE
-               //                      echo "<pre>";echo htmlspecialchars($qrec[2]); echo "</pre>";
-                               $question->questiontext = addslashes(trim($qrec[2]));
-               //                      echo "<pre>";echo $question->questiontext; echo "</pre>";
-                               $question->name = preg_replace("/<br />/", "", $question->questiontext);
-                               $question->single = 1;  // Only one answer is allowed -- used for multiple choicers
-                                                       $fractionset = 0;
-                                                       for ($i=4;$i<=7;$i++) {
-                                                               if ($qrec[$i] != "") {
-                                                                       $question->answer[$i-3]=addslashes($qrec[$i]);
-                                                                       if ($qrec[8] == $i-3) {  // if this is the index of CorrectAnswer
-                                                                         $question->fraction[$i-3] = 1;
-                                                                         $fractionset = 1;
-                                                                       } else {
-                                                                         $question->fraction[$i-3] = 0;
-                                                                       }
-                                                                       $question->feedback[$i-3] = (($qrec[8] == $i-3)?"Correct. ":"Incorrect. ") . $ref;
-                                                               }
-                                                       }
-                                                       if ($fractionset == 0) { $question->fraction[1] = 1; }
-                                       break;
-                                               case 2:  // TRUE FALSE
-                               $question->qtype = TRUEFALSE; 
-                               $question->questiontext = addslashes(trim($qrec[2]));
-                               $question->name = preg_replace("/<br />/", "", $question->questiontext);
-                                                       // for TF, $question->answer should be 1 for true, 0 for false
-                               if ($qrec[8] == "T") { $question->answer =1;} else { $question->answer = 0; }
-                                     // for TF, use $question->feedbacktrue and feedbackfalse
-                                       $question->feedbacktrue = (($qrec[8] =="T")?"Correct. ":"Incorrect. ") . $ref;
-                                       $question->feedbackfalse = (($qrec[8] =="F")?"Correct. ":"Incorrect. ") . $ref;
-                                       break;
-                                               case 3:
-                               $question->qtype = SHORTANSWER;
-                               $question->questiontext = addslashes(trim($qrec[2]));
-               //                      echo "<pre>";echo $question->questiontext; echo "</pre>";
-                               $question->name = preg_replace("/<br />/", "", $question->questiontext);
-                               $question->usecase=0;  // Ignore case -- for SHORT ANSWER questions
-                                                       $answers = explode("~", $qrec[8]);
-                                                       $question->answer[0]=" ";
-                                                       $question->fraction[0]=1;
-                                                       for ($i=0;$i<count($answers);$i++) {
-                                                               $question->answer[$i] = addslashes(trim($answers[$i]));
-                                                       $question->feedback[$i] = $ref;
-                                                               $question->fraction[$i] = 1; // 1 for 100%, 0 for none or somewhere in between
-                                                       }
-                                       break;
-                                               case 4:
-                                                 $question = 0;
-                                                       notify("Cannot use essay questions - skipping question ". $qrec[2] . " " . $ref);
-                                       break;
-                                               default:
-                                                       $question = 0;
-                                                       notify("Misformatted Record.  Question Skipped.");
-                                       break;
-                                       }
+                    switch ($qrec[3]) {
+                  case 1:
+                    $question->qtype = MULTICHOICE; // MULTICHOICE, SHORTANSWER, TRUEFALSE
+        //          echo "<pre>";echo htmlspecialchars($qrec[2]); echo "</pre>";
+                    $question->questiontext = addslashes(trim($qrec[2]));
+        //          echo "<pre>";echo $question->questiontext; echo "</pre>";
+                    $question->name = preg_replace("/<br />/", "", $question->questiontext);
+                    $question->single = 1;  // Only one answer is allowed -- used for multiple choicers
+                            $fractionset = 0;
+                            for ($i=4;$i<=7;$i++) {
+                                if ($qrec[$i] != "") {
+                                    $question->answer[$i-3]=addslashes($qrec[$i]);
+                                    if ($qrec[8] == $i-3) {  // if this is the index of CorrectAnswer
+                                      $question->fraction[$i-3] = 1;
+                                      $fractionset = 1;
+                                    } else {
+                                      $question->fraction[$i-3] = 0;
+                                    }
+                                    $question->feedback[$i-3] = (($qrec[8] == $i-3)?"Correct. ":"Incorrect. ") . $ref;
+                                }
+                            }
+                            if ($fractionset == 0) { $question->fraction[1] = 1; }
+                        break;
+                        case 2:  // TRUE FALSE
+                    $question->qtype = TRUEFALSE;
+                    $question->questiontext = addslashes(trim($qrec[2]));
+                    $question->name = preg_replace("/<br />/", "", $question->questiontext);
+                            // for TF, $question->answer should be 1 for true, 0 for false
+                    if ($qrec[8] == "T") { $question->answer =1;} else { $question->answer = 0; }
+                      // for TF, use $question->feedbacktrue and feedbackfalse
+                    $question->feedbacktrue = (($qrec[8] =="T")?"Correct. ":"Incorrect. ") . $ref;
+                    $question->feedbackfalse = (($qrec[8] =="F")?"Correct. ":"Incorrect. ") . $ref;
+                        break;
+                        case 3:
+                    $question->qtype = SHORTANSWER;
+                    $question->questiontext = addslashes(trim($qrec[2]));
+        //          echo "<pre>";echo $question->questiontext; echo "</pre>";
+                    $question->name = preg_replace("/<br />/", "", $question->questiontext);
+                    $question->usecase=0;  // Ignore case -- for SHORT ANSWER questions
+                            $answers = explode("~", $qrec[8]);
+                            $question->answer[0]=" ";
+                            $question->fraction[0]=1;
+                            for ($i=0;$i<count($answers);$i++) {
+                                $question->answer[$i] = addslashes(trim($answers[$i]));
+                                $question->feedback[$i] = $ref;
+                                $question->fraction[$i] = 1; // 1 for 100%, 0 for none or somewhere in between
+                            }
+                        break;
+                        case 4:
+                          $question = 0;
+                            notify("Cannot use essay questions - skipping question ". $qrec[2] . " " . $ref);
+                        break;
+                        default:
+                            $question = 0;
+                            notify("Misformatted Record.  Question Skipped.");
+                        break;
+                    }
           if ($question) { $questions[] = $question; }
-                               }
-                               $count = 0;
-                               // process all the questions
-                               if (PHP_OS == "WINNT") {
-                                       $filename = str_replace("\\\\","\\",$filename);
-                                       $filename = str_replace("/","\\",$filename);
-                               }
-                               foreach ($questions as $question) {   // Process and store each question
+                }
+                $count = 0;
+                // process all the questions
+                if (PHP_OS == "WINNT") {
+                    $filename = str_replace("\\\\","\\",$filename);
+                    $filename = str_replace("/","\\",$filename);
+                }
+                foreach ($questions as $question) {   // Process and store each question
           $count++;
           echo "<hr /><p><b>$count</b>. ".stripslashes($question->questiontext)."</p>";
           $question->category = $this->category->id;
@@ -265,245 +265,245 @@ class quiz_file_format {
         return true;
     }
 
-         function deletedatabase($filename) {
-               if (! $this->fulldelete($filename)) {
+      function deletedatabase($filename) {
+        if (! $this->fulldelete($filename)) {
         echo "<br />Error: Could not delete: $filename";
         return false;
       }
-                       return true;
-         }
+            return true;
+      }
 
-               function getquestions($filename, $category, $mdapath="", $hostname="") {
-                       if (($category == "allcategories") or ($category == "")) {
-                       $sql = "SELECT * FROM TBQuestions";
-                       } else {
-                       $sql = "SELECT * FROM TBQuestions where module = '".$category."'";
-                       }
-                       if (PHP_OS == "WINNT") {
-               $ldb =& $this->connect_win($filename);
-                         $qset = $ldb->Execute("$sql");
-             if ( $qset->RecordCount() > 0 ) {
-               $records = $qset->GetAssoc(true);
-                         } else {
-               $this->err("There were no records in the database.",$dsn);
-                     $ldb->Close();
-                     return false;
-                         }
-                       $ldb->Close();
-                       } else  { // if PHP_OS == WINNT
-                         // we have a linux installation
-                               $result = $this->query_linux($sql,$filename, $mdapath,$hostname);
-             if ( count($result) > 0 ) {
-                                       // get rid of the ID field in the first column.
-                                       for($i=0;$i<count($result);$i++) {
-                                               foreach (array_keys($result[$i]) as $j) {
-                                                       $records[$i][$j-1] = $result[$i][$j];
-                                               }
-                                       }
-                         } else {
-               $this->err("There were no records in the database.",$dsn);
-                                       $ldb->Close();
-                     return false;
-                         }
-                               // xml test and connect
-                       }  // PHP_OS TEST
-                       return $records;
-               }
+        function getquestions($filename, $category, $mdapath="", $hostname="") {
+            if (($category == "allcategories") or ($category == "")) {
+            $sql = "SELECT * FROM TBQuestions";
+            } else {
+            $sql = "SELECT * FROM TBQuestions where module = '".$category."'";
+            }
+            if (PHP_OS == "WINNT") {
+            $ldb =& $this->connect_win($filename);
+              $qset = $ldb->Execute("$sql");
+          if ( $qset->RecordCount() > 0 ) {
+            $records = $qset->GetAssoc(true);
+              } else {
+            $this->err("There were no records in the database.",$dsn);
+              $ldb->Close();
+              return false;
+              }
+            $ldb->Close();
+            } else  { // if PHP_OS == WINNT
+              // we have a linux installation
+                $result = $this->query_linux($sql,$filename, $mdapath,$hostname);
+          if ( count($result) > 0 ) {
+                    // get rid of the ID field in the first column.
+                    for($i=0;$i<count($result);$i++) {
+                        foreach (array_keys($result[$i]) as $j) {
+                            $records[$i][$j-1] = $result[$i][$j];
+                        }
+                    }
+              } else {
+            $this->err("There were no records in the database.",$dsn);
+                    $ldb->Close();
+              return false;
+              }
+                // xml test and connect
+            }  // PHP_OS TEST
+            return $records;
+        }
 
     function getquestioncategories($filename, $mdapath="", $hostname="") {
       global $CFG, $result;
-                       $sql = "SELECT Distinct module FROM TBQuestions";
-                       if (PHP_OS == "WINNT") {
-                               $ldb =& $this->connect_win($filename);                          
-                               $qset = $ldb->Execute("$sql");
+            $sql = "SELECT Distinct module FROM TBQuestions";
+            if (PHP_OS == "WINNT") {
+                $ldb =& $this->connect_win($filename);
+                $qset = $ldb->Execute("$sql");
         if ( $qset->RecordCount() > 0 ) {
           $records = $qset->GetArray(true);
-                                 foreach ($records as $record) {
-                                   $categories[$record[0]] = $record[0];
-                                 }
-             } else { // if recordcount 
+                  foreach ($records as $record) {
+                    $categories[$record[0]] = $record[0];
+                  }
+          } else { // if recordcount
           $this->err("There were no records in the database.",$dsn);
-                       $ldb->Close();
-               return false;
-             }
-               $ldb->Close();
-                       } else  { // if PHP_OS == WINNT
-                         // we have a linux installation
-                                       $result = $this->query_linux($sql, $filename, $mdapath, $hostname);
-                                       for($i=0;$i<count($result);$i++) {
-                                               $categories[$result[$i][0]] = $result[$i][0];
-                                       }
-                       }  // PHP_OS TEST
-                       return $categories;
+                $ldb->Close();
+            return false;
+          }
+        $ldb->Close();
+            } else  { // if PHP_OS == WINNT
+              // we have a linux installation
+                    $result = $this->query_linux($sql, $filename, $mdapath, $hostname);
+                    for($i=0;$i<count($result);$i++) {
+                        $categories[$result[$i][0]] = $result[$i][0];
+                    }
+            }  // PHP_OS TEST
+            return $categories;
     }
-               
-               function query_linux($sql, $mdbpath, $mdapath, $hostname) {
-                               global $result;
-                               include_once("odbcsocketserver.class.php");
-                               // set up socket server object to connect to remote host
-                               $oTest = new ODBCSocketServer;
-                               //Set the Hostname, port, and connection string
-                         $oTest->sHostName = $hostname;
-                               $oTest->nPort = 9628;
-//                       $oTest->sConnectionString="DRIVER=Microsoft Access Driver (*.mdb);SystemDB=C:\CTM\System.mda;DBQ=C:\CTM\of2K3\ctm.mdb;UID=Assess;PWD=VBMango;";
-                         $oTest->sConnectionString="DRIVER=Microsoft Access Driver (*.mdb);SystemDB=".
-                           $mdapath.";DBQ=".$mdbpath.";UID=Assess;PWD=VBMango;";
-                               // send and receive XML communication
-                               $qResult = $oTest->ExecSQL($sql);
-                               // set up XML parser to read the results
-                               $xml_parser = xml_parser_create("US-ASCII");
-                               xml_set_element_handler($xml_parser, "quiz_xmlstart", "quiz_xmlend");
+
+        function query_linux($sql, $mdbpath, $mdapath, $hostname) {
+                global $result;
+                include_once("odbcsocketserver.class.php");
+                // set up socket server object to connect to remote host
+                $oTest = new ODBCSocketServer;
+                //Set the Hostname, port, and connection string
+              $oTest->sHostName = $hostname;
+                $oTest->nPort = 9628;
+//            $oTest->sConnectionString="DRIVER=Microsoft Access Driver (*.mdb);SystemDB=C:\CTM\System.mda;DBQ=C:\CTM\of2K3\ctm.mdb;UID=Assess;PWD=VBMango;";
+              $oTest->sConnectionString="DRIVER=Microsoft Access Driver (*.mdb);SystemDB=".
+                $mdapath.";DBQ=".$mdbpath.";UID=Assess;PWD=VBMango;";
+                // send and receive XML communication
+                $qResult = $oTest->ExecSQL($sql);
+                // set up XML parser to read the results
+                $xml_parser = xml_parser_create("US-ASCII");
+                xml_set_element_handler($xml_parser, "quiz_xmlstart", "quiz_xmlend");
         xml_set_character_data_handler($xml_parser, "quiz_xmldata");
         // parse the XML and get back the result set array
         if (!xml_parse($xml_parser, $qResult)) {
-                       $this->err("XML error: ".xml_error_string(xml_get_error_code($xml_parser))
-                         ." at line ".xml_get_current_line_number($xml_parser),$oTest->sConnectionString);
-                                       return false;
-        } else  { 
-//             echo("Successful XML parse.  ");
-               // prepare the array for use in the pull-down
-/*             echo "<br />count of rows is ". count ($result);
-                                       echo "<pre>\n";
-                                       $qResult = HtmlSpecialChars($qResult);
-                                       echo $qResult;
-                                       echo "\n</pre>";
+            $this->err("XML error: ".xml_error_string(xml_get_error_code($xml_parser))
+              ." at line ".xml_get_current_line_number($xml_parser),$oTest->sConnectionString);
+                    return false;
+        } else  {
+//          echo("Successful XML parse.  ");
+            // prepare the array for use in the pull-down
+/*          echo "<br />count of rows is ". count ($result);
+                    echo "<pre>\n";
+                    $qResult = HtmlSpecialChars($qResult);
+                    echo $qResult;
+                    echo "\n</pre>";
 */
-                               xml_parser_free($xml_parser);
-//     $sResult = HtmlSpecialChars($qResult);
-       //echo("<pre>");
-//     echo($sResult);
-//     echo("</pre>");
+                xml_parser_free($xml_parser);
+//  $sResult = HtmlSpecialChars($qResult);
+    //echo("<pre>");
+//  echo($sResult);
+//  echo("</pre>");
 
-                                       return $result;
+                    return $result;
+        }
         }
-               } 
 
-               function connect_win($filename) {
-                       global $CFG, $systemdb;
-                       // first, verify the location of System.mda
-                       if (!isset($systemdb)) { 
-                   $systemdb=$this->findfile("System.mda");
-                       }
-       if (! $systemdb) {
+        function connect_win($filename) {
+            global $CFG, $systemdb;
+            // first, verify the location of System.mda
+            if (!isset($systemdb)) {
+            $systemdb=$this->findfile("System.mda");
+            }
+        if (! $systemdb) {
         $this->err("The system database System.mda cannot be found.  Check that you've uploaded it to the course.",$dsn);
         die;
-       }
+        }
 
-                       $ldb = &ADONewConnection('access');
-                 $dsn="DRIVER=Microsoft Access Driver (*.mdb);SystemDB=".$systemdb.";DBQ=".$filename.";UID=Assess;PWD=VBMango;";
-                 $dbconnected = $ldb->Connect($dsn);
-       if (! $dbconnected) {
+            $ldb = &ADONewConnection('access');
+          $dsn="DRIVER=Microsoft Access Driver (*.mdb);SystemDB=".$systemdb.";DBQ=".$filename.";UID=Assess;PWD=VBMango;";
+          $dbconnected = $ldb->Connect($dsn);
+        if (! $dbconnected) {
         $this->err("Moodle could not connect to the database.",$dsn);
         die;
-       }
-                       return $ldb;
-               }
+        }
+            return $ldb;
+        }
 
     function err($message, $dsn) {
-               echo "<font color=\"#990000\">";
-             echo "<p>Error: $message</p>";
-             echo "<p>ODBC File DSN: $dsn<br />";
-             echo "</font>";
-    }          
+            echo "<font color=\"#990000\">";
+          echo "<p>Error: $message</p>";
+          echo "<p>ODBC File DSN: $dsn<br />";
+          echo "</font>";
+    }
 
-               function fulldelete($location) { 
-                   if (is_dir($location)) {
-                       $currdir = opendir($location);
-                       while ($file = readdir($currdir)) { 
-                           if ($file <> ".." && $file <> ".") {
-                               $fullfile = $location."/".$file;
-                               if (is_dir($fullfile)) { 
-                                   if (!fulldelete($fullfile)) {
-                                       return false;
-                                   }
-                               } else {
-                                   if (!unlink($fullfile)) {
-                                       return false;
-                                   }
-                               } 
-                           }
-                       } 
-                       closedir($currdir);
-                       if (! rmdir($location)) {
-                           return false;
-                       }
-               
-                   } else {
-                       if (!unlink($location)) {
-                           return false;
-                       }
-                   }
-                   return true;
-               }
+        function fulldelete($location) {
+            if (is_dir($location)) {
+                $currdir = opendir($location);
+                while ($file = readdir($currdir)) {
+                    if ($file <> ".." && $file <> ".") {
+                        $fullfile = $location."/".$file;
+                        if (is_dir($fullfile)) {
+                            if (!fulldelete($fullfile)) {
+                                return false;
+                            }
+                        } else {
+                            if (!unlink($fullfile)) {
+                                return false;
+                            }
+                        }
+                    }
+                }
+                closedir($currdir);
+                if (! rmdir($location)) {
+                    return false;
+                }
 
+            } else {
+                if (!unlink($location)) {
+                    return false;
+                }
+            }
+            return true;
+        }
 
-    function findfile($filename) { 
-       global $CFG;
-                       $dirs = $this->getcoursedirs();
-                       $dirs[] = $CFG->dirroot."\mod\quiz\format";
-                       foreach ($dirs as $dir) {
-                               $file = $dir . "\System.mda";
-                               // look for System.mda
-                               if (is_file($file)) return $file;
-                       }                       
-                       return false;
+
+    function findfile($filename) {
+        global $CFG;
+            $dirs = $this->getcoursedirs();
+            $dirs[] = $CFG->dirroot."\mod\quiz\format";
+            foreach ($dirs as $dir) {
+                $file = $dir . "\System.mda";
+                // look for System.mda
+                if (is_file($file)) return $file;
+            }
+            return false;
     }
 
     function getcoursedirs() {
-       global $CFG;
-               // for every course in the system, find the root of the data directory
-                               $courses = get_records_sql("select distinct id,fullname from ".$CFG->prefix."course");
-                               $dirs = array();
-                               if ($courses) {
-                                       foreach ($courses as $course) {
-                                               $dir = $CFG->dataroot . "/" . $course->id;
-                                               if (is_dir($dir)) { $dirs[] = $dir; }
-                                       }
-                               }
-                               return $dirs;
+        global $CFG;
+        // for every course in the system, find the root of the data directory
+                $courses = get_records_sql("select distinct id,fullname from ".$CFG->prefix."course");
+                $dirs = array();
+                if ($courses) {
+                    foreach ($courses as $course) {
+                        $dir = $CFG->dataroot . "/" . $course->id;
+                        if (is_dir($dir)) { $dirs[] = $dir; }
+                    }
+                }
+                return $dirs;
     }
 
 } // END OF CLASS
 
-       //Handler for starting elements
-       function quiz_xmlstart($parser, $name, $attribs) { 
-               global $result,$row, $col, $incolumn;
-               $name = strtolower($name);
-               switch ($name) {
-                       case "row":
+    //Handler for starting elements
+    function quiz_xmlstart($parser, $name, $attribs) {
+        global $result,$row, $col, $incolumn;
+        $name = strtolower($name);
+        switch ($name) {
+            case "row":
         $col=0;break;
-                       case "column":
-                               $incolumn = 1;break;
-                       case "error":
+            case "column":
+                $incolumn = 1;break;
+            case "error":
         break;
-                       case "result":
-                               $row = 0; break;
-               } // switch
-       }
+            case "result":
+                $row = 0; break;
+        } // switch
+    }
 
-       //handler for the end of elements
-       function quiz_xmlend($parser, $name) {
-               global $result, $row, $col, $incolumn;
-               $name = strtolower($name);
-               switch ($name) {
-                       case "row":
+    //handler for the end of elements
+    function quiz_xmlend($parser, $name) {
+        global $result, $row, $col, $incolumn;
+        $name = strtolower($name);
+        switch ($name) {
+            case "row":
         $row++;break;
-                       case "column":
-                               $incolumn = 0;
+            case "column":
+                $incolumn = 0;
         $col++;
         break;
-                       case "error":
+            case "error":
         break;
-                       case "result":
+            case "result":
         break;
-               } // switch
-       }  // function
+        } // switch
+    }  // function
 
-       //handler for character data
-       function quiz_xmldata($parser, $data) {
-               global $result, $row, $col, $incolumn;
-               if ($incolumn) { $result[$row][$col] = $result[$row][$col] . $data;
-               }
-       }
+    //handler for character data
+    function quiz_xmldata($parser, $data) {
+        global $result, $row, $col, $incolumn;
+        if ($incolumn) { $result[$row][$col] = $result[$row][$col] . $data;
+        }
+    }
 
 ?>
index b5a60412dcf0da1bb3c9f1db7575f2e6acc189c4..90bdccedd692f78062733507c9b0305f202dece7 100644 (file)
     if ($form = data_submitted()) {   /// Filename
 
         if (isset($form->filename)) {                 // file already on server
-            $newfile['tmp_name'] = $form->filename; 
+            $newfile['tmp_name'] = $form->filename;
             $newfile['size'] = filesize($form->filename);
-            
+
         } else if (!empty($_FILES['newfile'])) {      // file was just uploaded
             require_once($CFG->dirroot.'/lib/uploadlib.php');
             $um = new upload_manager('newfile',false,false,$course,false,0,false);
-            if ($um->preprocess_files()) { // validate and virus check! 
+            if ($um->preprocess_files()) { // validate and virus check!
                 $newfile = $_FILES['newfile'];
             }
         }
             $format = new quiz_file_format();
 
             if (! $format->importpreprocess($category)) {             // Do anything before that we need to
-                error("Error occurred during pre-processing!", 
+                error("Error occurred during pre-processing!",
                       "$CFG->wwwroot/mod/quiz/import.php?category=$category->id");
             }
 
             if (! $format->importprocess($newfile['tmp_name'])) {     // Process the uploaded file
-                error("Error occurred during processing!", 
+                error("Error occurred during processing!",
                       "$CFG->wwwroot/mod/quiz/import.php?category=$category->id");
             }
 
             if (! $format->importpostprocess()) {                     // In case anything needs to be done after
-                error("Error occurred during post-processing!", 
+                error("Error occurred during post-processing!",
                       "$CFG->wwwroot/mod/quiz/import.php?category=$category->id");
             }
 
@@ -78,7 +78,7 @@
             print_footer($course);
             exit;
         }
-    } 
+    }
 
     /// Print upload form
 
 
     print_heading_with_help($strimportquestions, "import", "quiz");
 
-    print_simple_box_start("center", "", "$THEME->cellheading");
+    print_simple_box_start("center");
     echo "<form enctype=\"multipart/form-data\" method=\"post\" action=\"import.php\">";
     echo "<table cellpadding=\"5\">";
 
index b4b08143f791465cd1b3bacf022a73b6eb65cacb..72fad5b9fee991e971ade2ce8cdc7da6d9d9b280 100644 (file)
@@ -20,7 +20,7 @@ function quiz_add_instance($quiz) {
                                      $quiz->openhour, $quiz->openminute, 0);
     $quiz->timeclose = make_timestamp($quiz->closeyear, $quiz->closemonth, $quiz->closeday,
                                       $quiz->closehour, $quiz->closeminute, 0);
-    
+
     if (empty($quiz->name)) {
         if (empty($quiz->intro)) {
             $quiz->name = get_string('modulename', 'quiz');
@@ -33,7 +33,7 @@ function quiz_add_instance($quiz) {
     if (!$quiz->id = insert_record("quiz", $quiz)) {
         return false;  // some error occurred
     }
-    
+
     if (isset($quiz->optionsettingspref)) {
         set_user_preference('quiz_optionsettingspref', $quiz->optionsettingspref);
     }
@@ -102,7 +102,7 @@ function quiz_update_instance($quiz) {
             delete_event($event->id);
         }
     }
-    
+
     unset($event);
     $event->description = $quiz->intro;
     $event->courseid    = $quiz->course;
@@ -420,11 +420,11 @@ function quiz_get_recent_mod_activity(&$activities, &$index, $sincetime, $course
 
 
 function quiz_print_recent_mod_activity($activity, $course, $detail=false) {
-    global $CFG, $THEME;
+    global $CFG
 
     echo '<table border="0" cellpadding="3" cellspacing="0">';
 
-    echo "<tr><td bgcolor=\"$THEME->cellcontent2\" class=\"forumpostpicture\" width=\"35\" valign=\"top\">";
+    echo "<tr><td class=\"forumpostpicture\" width=\"35\" valign=\"top\">";
     print_user_picture($activity->user->userid, $course, $activity->user->picture);
     echo "</td><td width=\"100%\"><font size=\"2\">";
 
index 4917fa585c13f2c900f5f09f243812b993bb54a6..614824c069882ecc96daff5d574fee2ef07541a1 100644 (file)
@@ -344,7 +344,7 @@ class quiz_default_questiontype {
 
         // No options by default
         return false;
-    } 
+    }
 }
 
 quiz_load_questiontypes();
@@ -386,7 +386,7 @@ function quiz_get_question_grades($quizid, $questionlist) {
 }
 
 function quiz_questiongrades_update($grades, $quizid) {
-    // this is called from edit.php to store changes to the question grades 
+    // this is called from edit.php to store changes to the question grades
     // in the quiz_question_grades table. It does not update 'sumgrades' in the quiz table.
     $existing = get_records("quiz_question_grades", "quiz", $quizid, "", "question,grade,id");
     foreach ($grades as $question => $grade) {
@@ -432,7 +432,7 @@ function quiz_get_attempt_questions($quiz, $attempt, $attempting = false) {
     /// Returns the questions of the quiz attempt in a format used for
     /// grading and printing them...
     ///
-    /// $attempting should be set to true if this function is called in 
+    /// $attempting should be set to true if this function is called in
     ///   order to create an attempt page and false if it is called to create
     ///   a review page.
     ///
@@ -617,14 +617,10 @@ function quiz_extract_posted_id($name, $nameprefix='question') {
 }
 
 function quiz_print_comment($text) {
-    global $THEME;
-
     echo "<span class=\"feedbacktext\">".format_text($text, true, false)."</span>";
 }
 
 function quiz_print_correctanswer($text) {
-    global $THEME;
-
     echo "<p align=\"right\"><span class=\"highlight\">$text</span></p>";
 }
 
@@ -1142,7 +1138,7 @@ function quiz_print_question_list($questionlist, $grades) {
 // $questionlist is comma-separated list
 // $grades is an array of corresponding grades
 
-    global $THEME, $USER;
+    global $USER;
 
     if (!$questionlist) {
         echo "<p align=\"center\">";
@@ -1186,7 +1182,7 @@ function quiz_print_question_list($questionlist, $grades) {
         $question = $questions[$qnum];
         $canedit = isteacheredit($question->course);
         $count++;
-        echo "<tr bgcolor=\"$THEME->cellcontent\">";
+        echo "<tr>";
         echo "<td>$count</td>";
         echo "<td>";
         if ($count != 1) {
@@ -1228,7 +1224,7 @@ function quiz_print_question_list($questionlist, $grades) {
     echo "<tr><td colspan=\"5\" align=\"right\">\n";
     echo "<input type=\"submit\" value=\"$strsavegrades:\" />\n";
     echo "<input type=\"hidden\" name=\"setgrades\" value=\"save\" />\n";
-    echo "<td align=\"left\" bgcolor=\"$THEME->cellcontent\">\n";
+    echo "<td align=\"left\">\n";
     echo "<b>$sumgrade</b>";
     echo "</td><td>\n</td></tr>\n";
     echo "</table>\n";
@@ -1241,7 +1237,7 @@ function quiz_print_question_list($questionlist, $grades) {
 function quiz_print_cat_question_list($categoryid, $quizselected=true, $recurse=1, $page, $perpage) {
 // Prints the table of questions in a category with interactions
 
-    global $THEME, $QUIZ_QUESTION_TYPE, $USER;
+    global $QUIZ_QUESTION_TYPE, $USER;
 
     $strcategory = get_string("category", "quiz");
     $strquestion = get_string("question", "quiz");
@@ -1339,7 +1335,7 @@ function quiz_print_cat_question_list($categoryid, $quizselected=true, $recurse=
         if ($question->qtype == RANDOM) {
             //continue;
         }
-        echo "<tr bgcolor=\"$THEME->cellcontent\">\n";
+        echo "<tr>\n";
         if ($quizselected) {
             echo "<td align=\"center\">";
             echo "<input type=\"checkbox\" name=\"q$question->id\" value=\"1\" />\n";
index 411771f546f8edc83adde09e6d994b3c7600a5a7..bdee00bce10234f4b27b2a2ff086f8b4f4bc78e0 100644 (file)
@@ -34,7 +34,7 @@
     if ($form = data_submitted() and confirm_sesskey()) {
         if ($form->randomcreate > 0) {
             $newquestionids = array(); // this will hold the ids of the random questions
-            
+
             // find existing random questions in this category
             $random = RANDOM;
             if ($existingquestions = get_records_select('quiz_questions', "qtype = '$random' AND category = '$category->id'")) {
@@ -47,7 +47,7 @@
                 // now take as many of these as needed
                 $i = 0;
                 while (($existingquestion = array_pop($existingquestions)) and ($i < $form->randomcreate)) {
-                    if ($existingquestion->questiontext == "$form->recurse") { 
+                    if ($existingquestion->questiontext == "$form->recurse") {
                         // this question has the right recurse property, so use it
                         $newquestionids[] = $existingquestion->id;
                         $i++;
@@ -63,7 +63,7 @@
                 $question->qtype = RANDOM;
                 $question->category = $category->id;
                 $question->name = get_string('random', 'quiz') .' ('. $category->name .')';
-                $question->questiontext = "$form->recurse"; // we use the questiontext field to store the info 
+                $question->questiontext = "$form->recurse"; // we use the questiontext field to store the info
                                                             // on whether to include questions in subcategories
                 $question->image = '';
                 $question->defaultgrade = $form->randomgrade;
     $options[0] = get_string('no');
     $options[1] = get_string('yes');
 
-    print_simple_box_start('center', '', $THEME->cellheading);
+    print_simple_box_start('center');
     echo '<form method="POST" action="multiple.php">';
     echo "<input type=\"hidden\" name=\"sesskey\" value=\"$USER->sesskey\">";
     echo '<table cellpadding="5">';
index cef314e436489109a25c4bcc1a792317c94f206a..f63b6ae84a0169e601a835b8fbce39da7030f7ac 100644 (file)
@@ -41,7 +41,7 @@
             $definition->name = $name;
             $definition->id   = $form->id[$key];
             $definition->type = $form->type[$key];
-            
+
             if ($definition->id) {
                 if (!update_record('quiz_dataset_definitions', $definition)) {
                     notify("Could not update dataset item definition");
 
     print_heading_with_help($strdefinedataset, "datasets", "quiz");
 
-    print_simple_box_start("center", "", "$THEME->cellheading");
+    print_simple_box_start("center");
     echo "<form method=\"post\" action=\"categorydatasetdefinitions.php\">";
     echo "<input type=\"hidden\" name=\"category\" value=\"$category->id\" />";
     if ($question) {
         echo "<input type=\"hidden\" name=\"question\" value=\"$question\" />";
     }
-    
+
     echo "<table cellpadding=\"5\">";
 
     $definitions = get_records('quiz_dataset_definitions',