|
Moodle
2.2.1
http://www.collinsharper.com
|
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 require_once($CFG->dirroot . '/mod/forum/backup/moodle2/backup_forum_stepslib.php'); // Because it exists (must) 00026 require_once($CFG->dirroot . '/mod/forum/backup/moodle2/backup_forum_settingslib.php'); // Because it exists (optional) 00027 00032 class backup_forum_activity_task extends backup_activity_task { 00033 00037 protected function define_my_settings() { 00038 // No particular settings for this activity 00039 } 00040 00044 protected function define_my_steps() { 00045 // Forum only has one structure step 00046 $this->add_step(new backup_forum_activity_structure_step('forum structure', 'forum.xml')); 00047 } 00048 00053 static public function encode_content_links($content) { 00054 global $CFG; 00055 00056 $base = preg_quote($CFG->wwwroot,"/"); 00057 00058 // Link to the list of forums 00059 $search="/(".$base."\/mod\/forum\/index.php\?id\=)([0-9]+)/"; 00060 $content= preg_replace($search, '$@FORUMINDEX*$2@$', $content); 00061 00062 // Link to forum view by moduleid 00063 $search="/(".$base."\/mod\/forum\/view.php\?id\=)([0-9]+)/"; 00064 $content= preg_replace($search, '$@FORUMVIEWBYID*$2@$', $content); 00065 00066 // Link to forum view by forumid 00067 $search="/(".$base."\/mod\/forum\/view.php\?f\=)([0-9]+)/"; 00068 $content= preg_replace($search, '$@FORUMVIEWBYF*$2@$', $content); 00069 00070 // Link to forum discussion with parent syntax 00071 $search="/(".$base."\/mod\/forum\/discuss.php\?d\=)([0-9]+)\&parent\=([0-9]+)/"; 00072 $content= preg_replace($search, '$@FORUMDISCUSSIONVIEWPARENT*$2*$3@$', $content); 00073 00074 // Link to forum discussion with relative syntax 00075 $search="/(".$base."\/mod\/forum\/discuss.php\?d\=)([0-9]+)\#([0-9]+)/"; 00076 $content= preg_replace($search, '$@FORUMDISCUSSIONVIEWINSIDE*$2*$3@$', $content); 00077 00078 // Link to forum discussion by discussionid 00079 $search="/(".$base."\/mod\/forum\/discuss.php\?d\=)([0-9]+)/"; 00080 $content= preg_replace($search, '$@FORUMDISCUSSIONVIEW*$2@$', $content); 00081 00082 return $content; 00083 } 00084 }