Skip to content
Browse files

MDL-27532 Add backup support for course report per-course data

  • Loading branch information...
1 parent f9ba5c5 commit 9e5855cb1aaf2c7013a9bf1886610f608469e64a @sammarshallou sammarshallou committed with stronk7 May 16, 2011
View
34 backup/moodle2/backup_coursereport_plugin.class.php
@@ -0,0 +1,34 @@
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Base class for course report backup plugins.
+ *
+ * NOTE: When you back up a course, it potentially may run backup for all
+ * course reports. In order to control whether a particular report gets
+ * backed up, a course report should make use of the second and third
+ * parameters in get_plugin_element().
+ *
+ * @package moodlecore
+ * @subpackage backup-moodle2
+ * @copyright 2011 onwards The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+abstract class backup_coursereport_plugin extends backup_plugin {
+ // Use default parent behaviour
+}
View
1 backup/moodle2/backup_plan_builder.class.php
@@ -36,6 +36,7 @@
require_once($CFG->dirroot . '/backup/moodle2/backup_qtype_plugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/backup_format_plugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/backup_theme_plugin.class.php');
+require_once($CFG->dirroot . '/backup/moodle2/backup_coursereport_plugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/backup_plagiarism_plugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/backup_subplugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/backup_settingslib.php');
View
4 backup/moodle2/backup_stepslib.php
@@ -419,6 +419,10 @@ protected function define_structure() {
// save course data (in case of user theme, legacy theme, etc)
$this->add_plugin_structure('theme', $course, true);
+ // attach course report plugin structure to $course element; multiple
+ // course reports can save course data if required
+ $this->add_plugin_structure('coursereport', $course, true);
+
// attach plagiarism plugin structure to $course element, only one allowed
$this->add_plugin_structure('plagiarism', $course, false);
View
29 backup/moodle2/restore_coursereport_plugin.class.php
@@ -0,0 +1,29 @@
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Restore for course plugin: course report.
+ *
+ * @package moodlecore
+ * @subpackage backup-moodle2
+ * @copyright 2011 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+abstract class restore_coursereport_plugin extends restore_plugin {
+ // Use default parent behaviour
+}
View
2 backup/moodle2/restore_plan_builder.class.php
@@ -35,11 +35,13 @@
require_once($CFG->dirroot . '/backup/moodle2/restore_qtype_plugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/restore_format_plugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/restore_theme_plugin.class.php');
+require_once($CFG->dirroot . '/backup/moodle2/restore_coursereport_plugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/restore_plagiarism_plugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/backup_plugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/backup_qtype_plugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/backup_format_plugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/backup_theme_plugin.class.php');
+require_once($CFG->dirroot . '/backup/moodle2/backup_coursereport_plugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/backup_plagiarism_plugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/restore_subplugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/restore_settingslib.php');
View
3 backup/moodle2/restore_stepslib.php
@@ -1010,6 +1010,9 @@ protected function define_structure() {
// Apply for 'theme' plugins optional paths at course level
$this->add_plugin_structure('theme', $course);
+ // Apply for 'course report' plugins optional paths at course level
+ $this->add_plugin_structure('coursereport', $course);
+
// Apply for plagiarism plugins optional paths at course level
$this->add_plugin_structure('plagiarism', $course);

0 comments on commit 9e5855c

Please sign in to comment.
Something went wrong with that request. Please try again.