Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
// This file is part of the Zoom plugin for 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
 * Defines backup_zoom_activity_task class
19
 *
20
 * @package   mod_zoom
21
 * @category  backup
22
 * @copyright 2015 UC Regents
23
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24
 */
25
 
26
defined('MOODLE_INTERNAL') || die;
27
 
28
require_once($CFG->dirroot . '/mod/zoom/backup/moodle2/backup_zoom_stepslib.php');
29
 
30
use mod_zoom\backup_activity_structure_step;
31
 
32
/**
33
 * Provides the steps to perform one complete backup of the zoom instance
34
 */
35
class backup_zoom_activity_task extends backup_activity_task {
36
    /**
37
     * No specific settings for this activity
38
     */
39
    protected function define_my_settings() {
40
    }
41
 
42
    /**
43
     * Defines a backup step to store the instance data in the zoom.xml file
44
     */
45
    protected function define_my_steps() {
46
        $this->add_step(new backup_activity_structure_step('zoom_structure', 'zoom.xml'));
47
    }
48
 
49
    /**
50
     * Encodes URLs to the index.php and view.php scripts
51
     *
52
     * @param string $content some HTML text that eventually contains URLs to the activity instance scripts
53
     * @return string the content with the URLs encoded
54
     */
55
    public static function encode_content_links($content) {
56
        global $CFG;
57
 
58
        $base = preg_quote($CFG->wwwroot, '/');
59
 
60
        // Link to the list of zooms.
61
        $search = '/(' . $base . '\/mod\/zoom\/index.php\?id\=)([0-9]+)/';
62
        $content = preg_replace($search, '$@ZOOMINDEX*$2@$', $content);
63
 
64
        // Link to zoom view by moduleid.
65
        $search = '/(' . $base . '\/mod\/zoom\/view.php\?id\=)([0-9]+)/';
66
        $content = preg_replace($search, '$@ZOOMVIEWBYID*$2@$', $content);
67
 
68
        return $content;
69
    }
70
}