backup_bigbluebuttonbn_activity_task   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 44
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A define_my_settings() 0 3 1
A define_my_steps() 0 4 1
A encode_content_links() 0 15 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 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
require_once($CFG->dirroot.'/mod/bigbluebuttonbn/backup/moodle2/backup_bigbluebuttonbn_stepslib.php');
30
31
/**
32
 * Backup task that provides all the settings and steps to perform one complete backup 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 backup_bigbluebuttonbn_activity_task extends backup_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
        // Choice only has one structure step.
56
        $this->add_step(new backup_bigbluebuttonbn_activity_structure_step('bigbluebuttonbn_structure', 'bigbluebuttonbn.xml'));
57
    }
58
59
    /**
60
     * Code the transformations to perform in the activity in order to get transportable (encoded) links.
61
     *
62
     * @param string $content
63
     *
64
     * @return string
65
     */
66
    public static function encode_content_links($content) {
67
        global $CFG;
68
69
        $base = preg_quote($CFG->wwwroot.'/mod/bigbluebuttonbn', '#');
70
71
        // Link to the list of bigbluebuttonbns.
72
        $pattern = '#('.$base."\/index.php\?id\=)([0-9]+)#";
73
        $content = preg_replace($pattern, '$@BIGBLUEBUTTONBNINDEX*$2@$', $content);
74
75
        // Link to bigbluebuttonbn view by moduleid.
76
        $pattern = '#('.$base."\/view.php\?id\=)([0-9]+)#";
77
        $content = preg_replace($pattern, '$@BIGBLUEBUTTONBNVIEWBYID*$2@$', $content);
78
79
        return $content;
80
    }
81
}
82