]> git.mjollnir.org Git - moodle.git/commitdiff
Fix some Eclipse code warnings. Merged from MOODLE_16_STABLE.
authortjhunt <tjhunt>
Fri, 18 Aug 2006 21:23:15 +0000 (21:23 +0000)
committertjhunt <tjhunt>
Fri, 18 Aug 2006 21:23:15 +0000 (21:23 +0000)
question/category_class.php
question/editlib.php
question/restorelib.php

index e02f8a7566d48ff2064aae1eb96005e55c516f77..be560663400b93a4752ab4266f75f706a6b712a1 100644 (file)
@@ -406,7 +406,7 @@ class question_category_object {
         $publishoptions[1] = get_string("yes");
         $strupdate = get_string('update');
 
-        unset ($edittable);
+        $edittable = new stdClass;
 
         $edittable->head  = array ($this->str->parent, $this->str->category, $this->str->categoryinfo, $this->str->publish, $this->str->action);
         $edittable->width = 200;
@@ -581,13 +581,14 @@ class question_category_object {
             if (!$category2 = get_record("question_categories", "id", $destcategoryid)) {  // security
                 error("No such category $destcategoryid!", "category.php?id={$this->course->id}");
             }
-            if (! set_field('question', 'category', $category2, 'category', $category1)) {
+            if (! set_field('question', 'category', $destcategoryid, 'category', $deletecat)) {
                 error("Error while moving questions from category '$category->name' to '$category2->name'", "category.php?id={$this->course->id}");
             }
 
         } else {
             // todo: delete any hidden questions that are not actually in use any more
             if ($count = count_records("question", "category", $category->id)) {
+                $vars = new stdClass;
                 $vars->name = $category->name;
                 $vars->count = $count;
                 print_simple_box(get_string("categorymove", "quiz", $vars), "center");
@@ -606,7 +607,6 @@ class question_category_object {
                 exit;
             }
         }
-        delete_records("question_categories", "id", $category->id);
 
         /// Send the children categories to live with their grandparent
         if ($childcats = get_records("question_categories", "parent", $category->id)) {
index 61cd688faa3004bcf741065856061e7854b79917..0e1fa467dfbb0b082f5baf4e0b32e32268b82aac 100644 (file)
@@ -254,6 +254,7 @@ function question_list($course, $categoryid, $quizid=0,
         return;
     }
     echo "<center>";
+    $formatoptions = new stdClass;
     $formatoptions->noclean = true;
     echo format_text($category->info, FORMAT_MOODLE, $formatoptions, $course->id);
 
index a094e432174f5a0ced2088f0423213c6fdb14759..25630ccfcee0b320f289a6f5ee465732a4a98cdb 100644 (file)
             //$GLOBALS['traverse_array']="";                                                              //Debug
 
             //Now, build the question_categories record structure
+            $question_cat = new stdClass;
             $question_cat->course = $restore->course_id;
             $question_cat->name = backup_todb($info['QUESTION_CATEGORY']['#']['NAME']['0']['#']);
             $question_cat->info = backup_todb($info['QUESTION_CATEGORY']['#']['INFO']['0']['#']);
                 $oldid = backup_todb($ans_info['#']['ID']['0']['#']);
 
                 //Now, build the question_answers record structure
+                $answer = new stdClass;
                 $answer->question = $new_question_id;
                 $answer->answer = backup_todb($ans_info['#']['ANSWER_TEXT']['0']['#']);
                 $answer->fraction = backup_todb($ans_info['#']['FRACTION']['0']['#']);
             //$GLOBALS['traverse_array']="";                                                              //Debug
 
             //Now, build the question_numerical_UNITS record structure
+            $numerical_unit = new stdClass;
             $numerical_unit->question = $new_question_id;
             $numerical_unit->multiplier = backup_todb($nu_info['#']['MULTIPLIER']['0']['#']);
             $numerical_unit->unit = backup_todb($nu_info['#']['UNIT']['0']['#']);
             //$GLOBALS['traverse_array']="";                                                              //Debug
 
             //Now, build the question_dataset_DEFINITION record structure
+            $dataset_definition = new stdClass;
             $dataset_definition->category = backup_todb($dd_info['#']['CATEGORY']['0']['#']);
             $dataset_definition->name = backup_todb($dd_info['#']['NAME']['0']['#']);
             $dataset_definition->type = backup_todb($dd_info['#']['TYPE']['0']['#']);
             //Now, we must have a definition (created o reused). Its id is in newid. Create the question_datasets record
             //to join the question and the dataset_definition
             if ($newid) {
+                $question_dataset = new stdClass;
                 $question_dataset->question = $new_question_id;
                 $question_dataset->datasetdefinition = $newid;
                 $newid = insert_record ("question_datasets",$question_dataset);
             //$GLOBALS['traverse_array']="";                                                              //Debug
 
             //Now, build the question_dataset_ITEMS record structure
+            $dataset_item = new stdClass;
             $dataset_item->definition = $definitionid;
             $dataset_item->number = backup_todb($di_info['#']['NUMBER']['0']['#']);
             $dataset_item->value = backup_todb($di_info['#']['VALUE']['0']['#']);
             $oldid = backup_todb($res_info['#']['ID']['0']['#']);
 
             //Now, build the STATES record structure
+            $state = new stdClass;
             $state->attempt = $attempt_id;
             $state->question = backup_todb($res_info['#']['QUESTION']['0']['#']);
             $state->originalquestion = backup_todb($res_info['#']['ORIGINALQUESTION']['0']['#']);
             //$GLOBALS['traverse_array']="";                                                              //Debug
 
             //Now, build the NEWEST_STATES record structure
+            $session = new stdClass;
             $session->attemptid = $attempt_id;
             $session->questionid = backup_todb($res_info['#']['QUESTIONID']['0']['#']);
             $session->newest = backup_todb($res_info['#']['NEWEST']['0']['#']);