Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/mod/url/backup/moodle2/backup_url_activity_task.class.php
Go to the documentation of this file.
00001 <?php
00002 
00003 // This file is part of Moodle - http://moodle.org/
00004 //
00005 // Moodle is free software: you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation, either version 3 of the License, or
00008 // (at your option) any later version.
00009 //
00010 // Moodle is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00017 
00025 defined('MOODLE_INTERNAL') || die;
00026 
00027  // This activity has not particular settings but the inherited from the generic
00028  // backup_activity_task so here there isn't any class definition, like the ones
00029  // existing in /backup/moodle2/backup_settingslib.php (activities section)
00030 
00031 require_once($CFG->dirroot . '/mod/url/backup/moodle2/backup_url_stepslib.php'); // Because it exists (must)
00032 
00037 class backup_url_activity_task extends backup_activity_task {
00038 
00042     protected function define_my_settings() {
00043         // No particular settings for this activity
00044     }
00045 
00049     protected function define_my_steps() {
00050         $this->add_step(new backup_url_activity_structure_step('url_structure', 'url.xml'));
00051     }
00052 
00057     static public function encode_content_links($content) {
00058         global $CFG;
00059 
00060         $base = preg_quote($CFG->wwwroot.'/mod/url','#');
00061 
00062         //Access a list of all links in a course
00063         $pattern = '#('.$base.'/index\.php\?id=)([0-9]+)#';
00064         $replacement = '$@URLINDEX*$2@$';
00065         $content = preg_replace($pattern, $replacement, $content);
00066 
00067         //Access the link supplying a course module id
00068         $pattern = '#('.$base.'/view\.php\?id=)([0-9]+)#';
00069         $replacement = '$@URLVIEWBYID*$2@$';
00070         $content = preg_replace($pattern, $replacement, $content);
00071 
00072         //Access the link supplying an instance id
00073         $pattern = '#('.$base.'/view\.php\?u=)([0-9]+)#';
00074         $replacement = '$@URLVIEWBYU*$2@$';
00075         $content = preg_replace($pattern, $replacement, $content);
00076 
00077         return $content;
00078     }
00079 }
 All Data Structures Namespaces Files Functions Variables Enumerations