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 eduplayer module 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
 * @package    mod
19
 * @subpackage eduplayer
20
 * @author     Humanage Srl <info@humanage.it>
21
 * @copyright  2013 Humanage Srl <info@humanage.it>
22
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23
 */
24
 
25
defined('MOODLE_INTERNAL') || die();
26
 
27
require_once($CFG->dirroot . '/mod/eduplayer/backup/moodle2/restore_eduplayer_stepslib.php'); // Because it exists (must)
28
 
29
/**
30
 * eduplayer restore task that provides all the settings and steps to perform one
31
 * complete restore of the activity
32
 */
33
class restore_eduplayer_activity_task extends restore_activity_task {
34
 
35
    /**
36
     * Define (add) particular settings this activity can have
37
     */
38
    protected function define_my_settings() {
39
        // No particular settings for this activity
40
    }
41
 
42
    /**
43
     * Define (add) particular steps this activity can have
44
     */
45
    protected function define_my_steps() {
46
        // eduplayer only has one structure step
47
        $this->add_step(new restore_eduplayer_activity_structure_step('eduplayer_structure', 'eduplayer.xml'));
48
    }
49
 
50
    /**
51
     * Define the contents in the activity that must be
52
     * processed by the link decoder
53
     */
54
    static public function define_decode_contents() {
55
        $contents = array();
56
 
57
        $contents[] = new restore_decode_content('eduplayer', array('intro'), 'eduplayer');
58
        $contents[] = new restore_decode_content('eduplayer', array('notes'), 'eduplayer');
59
 
60
        return $contents;
61
    }
62
 
63
    /**
64
     * Define the decoding rules for links belonging
65
     * to the activity to be executed by the link decoder
66
     */
67
    static public function define_decode_rules() {
68
        $rules = array();
69
 
70
        $rules[] = new restore_decode_rule('EDUPLAYERVIEWBYID', '/mod/eduplayer/view.php?id=$1', 'course_module');
71
        $rules[] = new restore_decode_rule('EDUPLAYERINDEX', '/mod/eduplayer/index.php?id=$1', 'course');
72
 
73
        return $rules;
74
 
75
    }
76
 
77
    /**
78
     * Define the restore log rules that will be applied
79
     * by the {@link restore_logs_processor} when restoring
80
     * folder logs. It must return one array
81
     * of {@link restore_log_rule} objects
82
     */
83
    static public function define_restore_log_rules() {
84
        $rules = array();
85
 
86
        $rules[] = new restore_log_rule('eduplayer', 'add', 'view.php?id={course_module}', '{eduplayer}');
87
        $rules[] = new restore_log_rule('eduplayer', 'edit', 'edit.php?id={course_module}', '{eduplayer}');
88
        $rules[] = new restore_log_rule('eduplayer', 'view', 'view.php?id={course_module}', '{eduplayer}');
89
 
90
        return $rules;
91
    }
92
 
93
    /**
94
     * Define the restore log rules that will be applied
95
     * by the {@link restore_logs_processor} when restoring
96
     * course logs. It must return one array
97
     * of {@link restore_log_rule} objects
98
     *
99
     * Note this rules are applied when restoring course logs
100
     * by the restore final task, but are defined here at
101
     * activity level. All them are rules not linked to any module instance (cmid = 0)
102
     */
103
    static public function define_restore_log_rules_for_course() {
104
        $rules = array();
105
 
106
        $rules[] = new restore_log_rule('eduplayer', 'view all', 'index.php?id={course}', null);
107
 
108
        return $rules;
109
    }
110
}