diff --git a/backup/moodle2/backup_hvp_activity_task.class.php b/backup/moodle2/backup_hvp_activity_task.class.php index 3ef6448e8ae21f69471eb4a7b8d0ed4cd0a8cf60..ccf035c70df19761ed2650bc61f65d2703d94599 100644 --- a/backup/moodle2/backup_hvp_activity_task.class.php +++ b/backup/moodle2/backup_hvp_activity_task.class.php @@ -45,4 +45,26 @@ class backup_hvp_activity_task extends backup_activity_task { protected function define_my_steps() { // $this->add_step(new backup_hvp_activity_structure_step('hvp_structure', 'hvp.xml')); } + + /** + * Encodes URLs to the index.php and view.php scripts + * + * @param string $content some HTML text that eventually contains URLs to the activity instance scripts + * @return string the content with the URLs encoded + */ + static public function encode_content_links($content) { + global $CFG; + + $base = preg_quote($CFG->wwwroot,"/"); + + // Link to the list of glossaries + $search="/(".$base."\/mod\/hvp\/index.php\?id\=)([0-9]+)/"; + $content= preg_replace($search, '$@HVPINDEX*$2@$', $content); + + // Link to hvp view by moduleid + $search="/(".$base."\/mod\/hvp\/view.php\?id\=)([0-9]+)/"; + $content= preg_replace($search, '$@HVPVIEWBYID*$2@$', $content); + + return $content; + } }