MDL-30982 Improving phpDocs for the class backup_activity_task
[moodle.git] / mod / folder / backup / moodle2 / backup_folder_activity_task.class.php
CommitLineData
78692f23
EL
1<?php
2
3// This file is part of Moodle - http://moodle.org/
4//
5// Moodle is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// Moodle is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17
18/**
9fe1fbcc
PS
19 * @package mod
20 * @subpackage folder
21 * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
78692f23
EL
23 */
24
9fe1fbcc
PS
25defined('MOODLE_INTERNAL') || die();
26
78692f23
EL
27require_once($CFG->dirroot . '/mod/folder/backup/moodle2/backup_folder_stepslib.php'); // Because it exists (must)
28
29/**
30 * folder backup task that provides all the settings and steps to perform one
31 * complete backup of the activity
32 */
33class backup_folder_activity_task extends backup_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 // Choice only has one structure step
47 $this->add_step(new backup_folder_activity_structure_step('folder_structure', 'folder.xml'));
48 }
49
50 /**
51 * Code the transformations to perform in the activity in
52 * order to get transportable (encoded) links
53 */
54 static public function encode_content_links($content) {
55 global $CFG;
56
57 $base = preg_quote($CFG->wwwroot,"/");
58
59 // Link to the list of folder
60 $search="/(".$base."\/mod\/folder\/index.php\?id\=)([0-9]+)/";
61 $content= preg_replace($search, '$@FOLDERINDEX*$2@$', $content);
62
63 // Link to choice view by moduleid
64 $search="/(".$base."\/mod\/folder\/view.php\?id\=)([0-9]+)/";
65 $content= preg_replace($search, '$@FOLDERVIEWBYID*$2@$', $content);
66
67 return $content;
68 }
69}