Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
4 ariadna 1
<?php
2
// This file is part of VPL for Moodle - http://vpl.dis.ulpgc.es/
3
//
4
// VPL for 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
// VPL for 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 VPL for Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
 
17
/**
18
 * Define backup structure for additional DB tables this block uses.
19
 *
20
 * @package    block_point_view
21
 * @copyright  2022 Astor Bizard
22
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23
 */
24
 
25
/**
26
 * Backup structure definition for point_view block.
27
 *
28
 * @copyright  2022 Astor Bizard
29
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
30
 */
31
class backup_point_view_block_structure_step extends backup_block_structure_step {
32
 
33
    /**
34
     * {@inheritDoc}
35
     * @see backup_structure_step::define_structure()
36
     */
37
    protected function define_structure() {
38
        $pointview = new backup_nested_element('point_view');
39
 
40
        if ($this->get_setting_value('users')) {
41
            $reactions = new backup_nested_element('reactions');
42
            $reaction = new backup_nested_element('reaction', [ 'id' ], [ 'courseid', 'cmid', 'userid', 'vote' ]);
43
            $reaction->set_source_table('block_point_view', [ 'courseid' => backup::VAR_COURSEID ]);
44
            $reaction->annotate_ids('user', 'userid');
45
            $reactions->add_child($reaction);
46
            $pointview->add_child($reactions);
47
        }
48
 
49
        return $this->prepare_block_structure($pointview);
50
    }
51
}