restore_bigbluebuttonbn_activity_task   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 70
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 70
rs 10
c 0
b 0
f 0
wmc 6
lcom 0
cbo 1

6 Methods

Rating   Name   Duplication   Size   Complexity  
A define_my_settings() 0 3 1
A define_my_steps() 0 4 1
A define_decode_contents() 0 6 1
A define_decode_rules() 0 6 1
A define_restore_log_rules() 0 8 1
A define_restore_log_rules_for_course() 0 5 1
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 restore 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
require_once($CFG->dirroot.'/mod/bigbluebuttonbn/backup/moodle2/restore_bigbluebuttonbn_stepslib.php');
30
31
/**
32
 * Restore task that provides all the settings and steps to perform one complete restore of the activity.
33
 *
34
 * @package   mod_bigbluebuttonbn
35
 * @copyright 2010 onwards, Blindside Networks Inc
36
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
37
 */
38
class restore_bigbluebuttonbn_activity_task extends restore_activity_task
39
{
40
    /**
41
     * Define (add) particular settings this activity can have.
42
     *
43
     * @return void
44
     */
45
    protected function define_my_settings() {
46
        // No particular settings for this activity.
47
    }
48
49
    /**
50
     * Define (add) particular steps this activity can have.
51
     *
52
     * @return void
53
     */
54
    protected function define_my_steps() {
55
        // BigBlueButtonBN only has one structure step.
56
        $this->add_step(new restore_bigbluebuttonbn_activity_structure_step('bigbluebuttonbn_structure', 'bigbluebuttonbn.xml'));
57
    }
58
59
    /**
60
     * Define the contents in the activity that must be processed by the link decoder.
61
     *
62
     * @return array
63
     */
64
    public static function define_decode_contents() {
65
        $contents = array();
66
        $contents[] = new restore_decode_content('bigbluebuttonbn', array('intro'), 'bigbluebuttonbn');
67
        $contents[] = new restore_decode_content('bigbluebuttonbn_logs', array('log'), 'bigbluebuttonbn_logs');
68
        return $contents;
69
    }
70
71
    /**
72
     * Define the decoding rules for links belonging to the activity to be executed by the link decoder.
73
     *
74
     * @return array
75
     */
76
    public static function define_decode_rules() {
77
        $rules = array();
78
        $rules[] = new restore_decode_rule('BIGBLUEBUTTONBNVIEWBYID', '/mod/bigbluebuttonbn/view.php?id=$1', 'course_module');
79
        $rules[] = new restore_decode_rule('BIGBLUEBUTTONBNINDEX', '/mod/bigbluebuttonbn/index.php?id=$1', 'course');
80
        return $rules;
81
    }
82
83
    /**
84
     * Define the restoring rules for logs belonging to the activity to be executed by the link decoder.
85
     *
86
     * @return array
87
     */
88
    public static function define_restore_log_rules() {
89
        $rules = array();
90
        $rules[] = new restore_log_rule('bigbluebuttonbn', 'add', 'view.php?id={course_module}', '{bigbluebuttonbn}');
91
        $rules[] = new restore_log_rule('bigbluebuttonbn', 'update', 'view.php?id={course_module}', '{bigbluebuttonbn}');
92
        $rules[] = new restore_log_rule('bigbluebuttonbn', 'view', 'view.php?id={course_module}', '{bigbluebuttonbn}');
93
        $rules[] = new restore_log_rule('bigbluebuttonbn', 'report', 'report.php?id={course_module}', '{bigbluebuttonbn}');
94
        return $rules;
95
    }
96
97
    /**
98
     * Define the restoring rules for course associated to the activity to be executed by the link decoder.
99
     *
100
     * @return array
101
     */
102
    public static function define_restore_log_rules_for_course() {
103
        $rules = array();
104
        $rules[] = new restore_log_rule('bigbluebuttonbn', 'view all', 'index.php?id={course}', null);
105
        return $rules;
106
    }
107
}
108