Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1441 ariadna 1
<?php
2
// This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>.
16
 
17
/**
18
 * Backup steps for mod_subsection are defined here.
19
 *
20
 * @package     mod_subsection
21
 * @category    backup
22
 * @copyright   2023 Amaia Anabitarte <amaia@moodle.com>
23
 * @license     https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24
 */
25
 
26
// More information about the backup process: {@link https://docs.moodle.org/dev/Backup_API}.
27
 
28
/**
29
 * Define the complete structure for backup, with file and id annotations.
30
 */
31
class backup_subsection_activity_structure_step extends backup_activity_structure_step {
32
 
33
    /**
34
     * Defines the structure of the resulting xml file.
35
     *
36
     * @return backup_nested_element The structure wrapped by the common 'activity' element.
37
     */
38
    protected function define_structure() {
39
        // Define each element separated.
40
        $subsection = new backup_nested_element('subsection', ['id'], ['name', 'timemodified']);
41
 
42
        // Define sources.
43
        $subsection->set_source_table('subsection', ['id' => backup::VAR_ACTIVITYID]);
44
 
45
        // Return the root element (subsection), wrapped into standard activity structure.
46
        return $this->prepare_activity_structure($subsection);
47
    }
48
}