MDL-37801 mod_glossary - encode / decode links to 'showentry' pages during backup...
authorDavo Smith <git@davosmith.co.uk>
Thu, 31 Jan 2013 12:52:26 +0000 (12:52 +0000)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 5 Feb 2013 00:03:44 +0000 (01:03 +0100)
mod/glossary/backup/moodle2/backup_glossary_activity_task.class.php
mod/glossary/backup/moodle2/restore_glossary_activity_task.class.php

index 89e0ce0..bd3fe72 100644 (file)
@@ -65,6 +65,10 @@ class backup_glossary_activity_task extends backup_activity_task {
         $search="/(".$base."\/mod\/glossary\/view.php\?id\=)([0-9]+)/";
         $content= preg_replace($search, '$@GLOSSARYVIEWBYID*$2@$', $content);
 
+        // Link to glossary entry
+        $search="/(".$base."\/mod\/glossary\/showentry.php\?courseid=)([0-9]+)(&|&amp;)eid=([0-9]+)/";
+        $content = preg_replace($search, '$@GLOSSARYSHOWENTRY*$2*$4@$', $content);
+
         return $content;
     }
 }
index f542436..fdb5cb8 100644 (file)
@@ -69,6 +69,8 @@ class restore_glossary_activity_task extends restore_activity_task {
 
         $rules[] = new restore_decode_rule('GLOSSARYVIEWBYID', '/mod/glossary/view.php?id=$1', 'course_module');
         $rules[] = new restore_decode_rule('GLOSSARYINDEX', '/mod/glossary/index.php?id=$1', 'course');
+        $rules[] = new restore_decode_rule('GLOSSARYSHOWENTRY', '/mod/glossary/showentry.php?courseid=$1&eid=$2',
+                                           array('course', 'glossary_entry'));
 
         return $rules;