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
 * Provides the restore 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/restore_zoom_stepslib.php');
29
 
30
use mod_zoom\restore_activity_structure_step;
31
 
32
/**
33
 * Restore task for the zoom activity module
34
 *
35
 * Provides all the settings and steps to perform complete restore of the activity.
36
 */
37
class restore_zoom_activity_task extends restore_activity_task {
38
    /**
39
     * Define (add) particular settings this activity can have
40
     */
41
    protected function define_my_settings() {
42
        // No particular settings for this activity.
43
    }
44
 
45
    /**
46
     * Define (add) particular steps this activity can have
47
     */
48
    protected function define_my_steps() {
49
        // We have just one structure step here.
50
        $this->add_step(new restore_activity_structure_step('zoom_structure', 'zoom.xml'));
51
    }
52
 
53
    /**
54
     * Define the contents in the activity that must be
55
     * processed by the link decoder
56
     */
57
    public static function define_decode_contents() {
58
        $contents = [];
59
 
60
        $contents[] = new restore_decode_content('zoom', ['intro'], 'zoom');
61
 
62
        return $contents;
63
    }
64
 
65
    /**
66
     * Define the decoding rules for links belonging
67
     * to the activity to be executed by the link decoder
68
     */
69
    public static function define_decode_rules() {
70
        $rules = [];
71
 
72
        $rules[] = new restore_decode_rule('ZOOMVIEWBYID', '/mod/zoom/view.php?id=$1', 'course_module');
73
        $rules[] = new restore_decode_rule('ZOOMINDEX', '/mod/zoom/index.php?id=$1', 'course_module');
74
 
75
        return $rules;
76
    }
77
 
78
    /**
79
     * Define the restore log rules that will be applied by the
80
     * restore_logs_processor when restoring zoom logs. It must return one array
81
     * of restore_log_rule objects
82
     */
83
    public static function define_restore_log_rules() {
84
        $rules = [];
85
 
86
        $rules[] = new restore_log_rule('zoom', 'add', 'view.php?id={course_module}', '{zoom}');
87
        $rules[] = new restore_log_rule('zoom', 'update', 'view.php?id={course_module}', '{zoom}');
88
        $rules[] = new restore_log_rule('zoom', 'view', 'view.php?id={course_module}', '{zoom}');
89
 
90
        return $rules;
91
    }
92
 
93
    /**
94
     * Define the restore log rules that will be applied by the
95
     * restore_logs_processor when restoring course logs. It must return one
96
     * array of restore_log_rule objects
97
     *
98
     * Note this rules are applied when restoring course logs
99
     * by the restore final task, but are defined here at
100
     * activity level. All them are rules not linked to any module instance (cmid = 0)
101
     */
102
    public static function define_restore_log_rules_for_course() {
103
        $rules = [];
104
 
105
        $rules[] = new restore_log_rule('zoom', 'view all', 'index.php?id={course}', null);
106
 
107
        return $rules;
108
    }
109
}