MDL-22164 backup - finished cleaning of questions backup code
authorEloy Lafuente <stronk7@moodle.org>
Tue, 21 Sep 2010 00:23:26 +0000 (00:23 +0000)
committerEloy Lafuente <stronk7@moodle.org>
Tue, 21 Sep 2010 00:23:26 +0000 (00:23 +0000)
question/type/numerical/questiontype.php
question/type/questiontype.php

index e124008..4d287ac 100644 (file)
@@ -1204,39 +1204,6 @@ class question_numerical_qtype extends question_shortanswer_qtype {
         return false;
     }
 
         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 /////////////////
 
     /**
     /// RESTORE FUNCTIONS /////////////////
 
     /**
index 9b0181c..74543f1 100644 (file)
@@ -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 /////////////////
 
     /*
 /// RESTORE FUNCTIONS /////////////////
 
     /*