Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
 
3
// This file is part of Moodle - http://moodle.org/
4
//
5
// Moodle is free software: you can redistribute it and/or modify
6
// it under the terms of the GNU General Public License as published by
7
// the Free Software Foundation, either version 3 of the License, or
8
// (at your option) any later version.
9
//
10
// Moodle is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
// GNU General Public License for more details.
14
//
15
// You should have received a copy of the GNU General Public License
16
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
17
 
18
/**
19
 * Define all the backup steps that will be used by the backup_resource_activity_task
20
 *
21
 * @package    mod_resource
22
 * @copyright  2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
23
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24
 */
25
 
26
defined('MOODLE_INTERNAL') || die;
27
 
28
/**
29
 * Define the complete resource structure for backup, with file and id annotations
30
 */
31
class backup_resource_activity_structure_step extends backup_activity_structure_step {
32
 
33
    protected function define_structure() {
34
 
35
        // To know if we are including userinfo
36
        $userinfo = $this->get_setting_value('userinfo');
37
 
38
        // Define each element separated
39
        $resource = new backup_nested_element('resource', array('id'), array(
40
            'name', 'intro', 'introformat', 'tobemigrated',
41
            'legacyfiles', 'legacyfileslast', 'display',
42
            'displayoptions', 'filterfiles', 'revision', 'timemodified'));
43
 
44
        // Build the tree
45
        // (love this)
46
 
47
        // Define sources
48
        $resource->set_source_table('resource', array('id' => backup::VAR_ACTIVITYID));
49
 
50
        // Define id annotations
51
        // (none)
52
 
53
        // Define file annotations
54
        $resource->annotate_files('mod_resource', 'intro', null); // This file areas haven't itemid
55
        $resource->annotate_files('mod_resource', 'content', null); // This file areas haven't itemid
56
 
57
        // Return the root element (resource), wrapped into standard activity structure
58
        return $this->prepare_activity_structure($resource);
59
    }
60
}