From 7660715f65729d4895868544e56e85e07f593407 Mon Sep 17 00:00:00 2001 From: Eloy Lafuente Date: Tue, 21 Sep 2010 00:23:26 +0000 Subject: [PATCH 1/1] MDL-22164 backup - finished cleaning of questions backup code --- question/type/numerical/questiontype.php | 33 ------------------- question/type/questiontype.php | 40 ------------------------ 2 files changed, 73 deletions(-) diff --git a/question/type/numerical/questiontype.php b/question/type/numerical/questiontype.php index e124008875d..4d287acd4a9 100644 --- a/question/type/numerical/questiontype.php +++ b/question/type/numerical/questiontype.php @@ -1204,39 +1204,6 @@ class question_numerical_qtype extends question_shortanswer_qtype { return false; } - /// BACKUP FUNCTIONS //////////////////////////// - - /** - * Backup the data in the question - * - * This is used in question/backuplib.php - */ - function backup($bf,$preferences,$question,$level=6) { - global $DB; - - $status = true; - - $numericals = $DB->get_records('question_numerical', array('question' => $question), 'id ASC'); - //If there are numericals - if ($numericals) { - //Iterate over each numerical - foreach ($numericals as $numerical) { - $status = fwrite ($bf,start_tag("NUMERICAL",$level,true)); - //Print numerical contents - fwrite ($bf,full_tag("ANSWER",$level+1,false,$numerical->answer)); - fwrite ($bf,full_tag("TOLERANCE",$level+1,false,$numerical->tolerance)); - //Now backup numerical_units - $status = question_backup_numerical_units($bf,$preferences,$question,7); - $status = fwrite ($bf,end_tag("NUMERICAL",$level,true)); - } - $status = question_backup_numerical_options($bf,$preferences,$question,$level); - - //Now print question_answers - $status = question_backup_answers($bf,$preferences,$question); - } - return $status; - } - /// RESTORE FUNCTIONS ///////////////// /** diff --git a/question/type/questiontype.php b/question/type/questiontype.php index 9b0181cbb4e..74543f1713a 100644 --- a/question/type/questiontype.php +++ b/question/type/questiontype.php @@ -1633,46 +1633,6 @@ class default_questiontype { } } -/// BACKUP FUNCTIONS //////////////////////////// - - /* - * Backup the data in the question - * - * This is used in question/backuplib.php - */ - function backup($bf,$preferences,$question,$level=6) { - global $DB; - - $status = true; - $extraquestionfields = $this->extra_question_fields(); - - if (is_array($extraquestionfields)) { - $questionextensiontable = array_shift($extraquestionfields); - $record = $DB->get_record($questionextensiontable, array($this->questionid_column_name() => $question)); - if ($record) { - $tagname = strtoupper($this->name()); - $status = $status && fwrite($bf, start_tag($tagname, $level, true)); - foreach ($extraquestionfields as $field) { - if (!isset($record->$field)) { - echo "No data for field $field when backuping " . - $this->name() . ' question id ' . $question; - return false; - } - fwrite($bf, full_tag(strtoupper($field), $level + 1, false, $record->$field)); - } - $status = $status && fwrite($bf, end_tag($tagname, $level, true)); - } - } - - $extraasnwersfields = $this->extra_answer_fields(); - if (is_array($extraasnwersfields)) { - //TODO backup the answers, with any extra data. - } else { - $status = $status && question_backup_answers($bf, $preferences, $question); - } - return $status; - } - /// RESTORE FUNCTIONS ///////////////// /* -- 2.43.0