From 4abc23b2ae721fd06b4c701102fde69403441036 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Fri, 18 Aug 2006 21:23:15 +0000 Subject: [PATCH] Fix some Eclipse code warnings. Merged from MOODLE_16_STABLE. --- question/category_class.php | 6 +++--- question/editlib.php | 1 + question/restorelib.php | 8 ++++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/question/category_class.php b/question/category_class.php index e02f8a7566..be56066340 100644 --- a/question/category_class.php +++ b/question/category_class.php @@ -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)) { diff --git a/question/editlib.php b/question/editlib.php index 61cd688faa..0e1fa467df 100644 --- a/question/editlib.php +++ b/question/editlib.php @@ -254,6 +254,7 @@ function question_list($course, $categoryid, $quizid=0, return; } echo "
"; + $formatoptions = new stdClass; $formatoptions->noclean = true; echo format_text($category->info, FORMAT_MOODLE, $formatoptions, $course->id); diff --git a/question/restorelib.php b/question/restorelib.php index a094e43217..25630ccfce 100644 --- a/question/restorelib.php +++ b/question/restorelib.php @@ -106,6 +106,7 @@ //$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']['#']); @@ -326,6 +327,7 @@ $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']['#']); @@ -440,6 +442,7 @@ //$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']['#']); @@ -472,6 +475,7 @@ //$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']['#']); @@ -531,6 +535,7 @@ //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); @@ -561,6 +566,7 @@ //$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']['#']); @@ -597,6 +603,7 @@ $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']['#']); @@ -673,6 +680,7 @@ //$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']['#']); -- 2.39.5