backup_bigbluebuttonbn_activity_structure_step   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 50
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A define_structure() 0 42 2
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
 * Class for the structure used for backup BigBlueButtonBN.
19
 *
20
 * @package   mod_bigbluebuttonbn
21
 * @copyright 2010 onwards, Blindside Networks Inc
22
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23
 * @author    Fred Dixon  (ffdixon [at] blindsidenetworks [dt] com)
24
 * @author    Jesus Federico  (jesus [at] blindsidenetworks [dt] com)
25
 */
26
27
defined('MOODLE_INTERNAL') || die();
28
29
/**
30
 * Define all the backup steps that will be used by the backup_bigbluebuttonbn_activity_task.
31
 *
32
 * @package   mod_bigbluebuttonbn
33
 * @copyright 2010 onwards, Blindside Networks Inc
34
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
35
 */
36
class backup_bigbluebuttonbn_activity_structure_step extends backup_activity_structure_step
37
{
38
    /**
39
     * Define the complete bigbluebuttonbn structure for backup, with file and id annotations.
40
     *
41
     * @return object
42
     */
43
    protected function define_structure() {
44
45
        // To know if we are including userinfo.
46
        $userinfo = $this->get_setting_value('userinfo');
47
48
        // Define each element separated.
49
        $bigbluebuttonbn = new backup_nested_element('bigbluebuttonbn', array('id'), array(
50
                            'type', 'course', 'name', 'intro', 'introformat', 'meetingid',
51
                            'moderatorpass', 'viewerpass', 'wait', 'record', 'recordallfromstart',
52
                            'recordhidebutton', 'welcome', 'voicebridge', 'openingtime', 'closingtime', 'timecreated',
53
                            'timemodified', 'presentation', 'participants', 'userlimit',
54
                            'recordings_html', 'recordings_deleted', 'recordings_imported', 'recordings_preview',
55
                            'clienttype', 'muteonstart', 'completionattendance',
56
                            'completionengagementchats', 'completionengagementtalks', 'completionengagementraisehand',
57
                            'completionengagementpollvotes', 'completionengagementemojis'));
58
59
        $logs = new backup_nested_element('logs');
60
61
        $log = new backup_nested_element('log', array('id'), array(
62
                'courseid', 'bigbluebuttonbnid', 'userid', 'timecreated', 'meetingid', 'log', 'meta', ));
63
64
        // Build the tree.
65
        $bigbluebuttonbn->add_child($logs);
66
        $logs->add_child($log);
67
68
        // Define sources.
69
        $bigbluebuttonbn->set_source_table('bigbluebuttonbn', array('id' => backup::VAR_ACTIVITYID));
70
71
        // This source definition only happen if we are including user info.
72
        if ($userinfo) {
73
            $log->set_source_table('bigbluebuttonbn_logs', array('bigbluebuttonbnid' => backup::VAR_PARENTID));
74
        }
75
76
        // Define id annotations.
77
        $log->annotate_ids('user', 'userid');
78
79
        // Define file annotations.
80
        $bigbluebuttonbn->annotate_files('mod_bigbluebuttonbn', 'intro', null);
81
82
        // Return the root element (bigbluebuttonbn), wrapped into standard activity structure.
83
        return $this->prepare_activity_structure($bigbluebuttonbn);
84
    }
85
}
86