Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
// This file is part of Moodle - http://moodle.org/
3
//
4
// Moodle is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// Moodle is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
 
17
/**
18
 * This file contains the backup code for the feedback_editpdf plugin.
19
 *
20
 * @package   assignfeedback_editpdf
21
 * @copyright 2013 Damyon Wiese
22
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23
 */
24
defined('MOODLE_INTERNAL') || die();
25
 
26
/**
27
 * Provides the information to backup feedback pdf annotations.
28
 *
29
 * This just adds its fileareas to the annotations and the comments and annotation data.
30
 *
31
 * @package   assignfeedback_editpdf
32
 * @copyright 2013 Damyon Wiese
33
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
34
 */
35
class backup_assignfeedback_editpdf_subplugin extends backup_subplugin {
36
 
37
    /**
38
     * Returns the subplugin information to attach to feedback element
39
     * @return backup_subplugin_element
40
     */
41
    protected function define_grade_subplugin_structure() {
42
 
43
        // Create XML elements.
44
        $subplugin = $this->get_subplugin_element();
45
        $subpluginwrapper = new backup_nested_element($this->get_recommended_name());
46
        $subpluginelementfiles = new backup_nested_element('feedback_editpdf_files', null, array('gradeid'));
47
        $subpluginelementannotations = new backup_nested_element('feedback_editpdf_annotations');
48
        $subpluginelementannotation = new backup_nested_element('annotation', null, array('gradeid', 'pageno', 'type', 'x', 'y', 'endx', 'endy', 'colour', 'path', 'draft'));
49
        $subpluginelementcomments = new backup_nested_element('feedback_editpdf_comments');
50
        $subpluginelementcomment = new backup_nested_element('comment', null, array('gradeid', 'pageno', 'x', 'y', 'width', 'rawtext', 'colour', 'draft'));
51
        $subpluginelementrotation = new backup_nested_element('feedback_editpdf_rotation');
52
        $subpluginelementpagerotation = new backup_nested_element('pagerotation', null,
53
            array('gradeid', 'pageno', 'pathnamehash', 'isrotated', 'degree'));
54
 
55
        // Connect XML elements into the tree.
56
        $subplugin->add_child($subpluginwrapper);
57
        $subpluginelementannotations->add_child($subpluginelementannotation);
58
        $subpluginelementcomments->add_child($subpluginelementcomment);
59
        $subpluginelementrotation->add_child($subpluginelementpagerotation);
60
        $subpluginwrapper->add_child($subpluginelementfiles);
61
        $subpluginwrapper->add_child($subpluginelementannotations);
62
        $subpluginwrapper->add_child($subpluginelementcomments);
63
        $subpluginwrapper->add_child($subpluginelementrotation);
64
 
65
        // Set source to populate the data.
66
        $subpluginelementfiles->set_source_sql('SELECT id AS gradeid from {assign_grades} where id = :gradeid', array('gradeid' => backup::VAR_PARENTID));
67
        $subpluginelementannotation->set_source_table('assignfeedback_editpdf_annot', array('gradeid' => backup::VAR_PARENTID));
68
        $subpluginelementcomment->set_source_table('assignfeedback_editpdf_cmnt', array('gradeid' => backup::VAR_PARENTID));
69
        $subpluginelementpagerotation->set_source_table('assignfeedback_editpdf_rot', array('gradeid' => backup::VAR_PARENTID));
70
        // We only need to backup the files in the final pdf area, and the readonly page images - the others can be regenerated.
71
        $subpluginelementfiles->annotate_files('assignfeedback_editpdf',
72
            \assignfeedback_editpdf\document_services::FINAL_PDF_FILEAREA, 'gradeid');
73
        $subpluginelementfiles->annotate_files('assignfeedback_editpdf',
74
            \assignfeedback_editpdf\document_services::PAGE_IMAGE_READONLY_FILEAREA, 'gradeid');
75
        $subpluginelementfiles->annotate_files('assignfeedback_editpdf', 'stamps', 'gradeid');
76
        return $subplugin;
77
    }
78
 
79
}