|
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 defined('MOODLE_INTERNAL') || die(); 00026 00027 require_once($CFG->dirroot . '/mod/data/backup/moodle2/restore_data_stepslib.php'); // Because it exists (must) 00028 00033 class restore_data_activity_task extends restore_activity_task { 00034 00038 protected function define_my_settings() { 00039 // No particular settings for this activity 00040 } 00041 00045 protected function define_my_steps() { 00046 // Data only has one structure step 00047 $this->add_step(new restore_data_activity_structure_step('data_structure', 'data.xml')); 00048 } 00049 00054 static public function define_decode_contents() { 00055 $contents = array(); 00056 00057 $contents[] = new restore_decode_content('data', array( 00058 'intro', 'singletemplate', 'listtemplate', 'listtemplateheader', 'listtemplatefooter', 00059 'addtemplate', 'rsstemplate', 'rsstitletemplate', 'asearchtemplate'), 'data'); 00060 $contents[] = new restore_decode_content('data_fields', array( 00061 'description', 'param1', 'param2', 'param3', 00062 'param4', 'param5', 'param6', 'param7', 00063 'param8', 'param9', 'param10'), 'data_field'); 00064 $contents[] = new restore_decode_content('data_content', array( 00065 'content', 'content1', 'content2', 'content3', 'content4')); 00066 00067 return $contents; 00068 } 00069 00074 static public function define_decode_rules() { 00075 $rules = array(); 00076 00077 $rules[] = new restore_decode_rule('DATAVIEWBYID', '/mod/data/view.php?id=$1', 'course_module'); 00078 $rules[] = new restore_decode_rule('DATAVIEWBYD', '/mod/data/index.php?d=$1', 'data'); 00079 $rules[] = new restore_decode_rule('DATAINDEX', '/mod/data/index.php?id=$1', 'course'); 00080 $rules[] = new restore_decode_rule('DATAVIEWRECORD', '/mod/data/view.php?d=$1&rid=$2', array('data', 'data_record')); 00081 00082 return $rules; 00083 00084 } 00085 00092 static public function define_restore_log_rules() { 00093 $rules = array(); 00094 00095 $rules[] = new restore_log_rule('data', 'add', 'view.php?d={data}&rid={data_record}', '{data}'); 00096 $rules[] = new restore_log_rule('data', 'update', 'view.php?d={data}&rid={data_record}', '{data}'); 00097 $rules[] = new restore_log_rule('data', 'view', 'view.php?id={course_module}', '{data}'); 00098 $rules[] = new restore_log_rule('data', 'record delete', 'view.php?id={course_module}', '{data}'); 00099 $rules[] = new restore_log_rule('data', 'fields add', 'field.php?d={data}&mode=display&fid={data_field}', '{data_field}'); 00100 $rules[] = new restore_log_rule('data', 'fields update', 'field.php?d={data}&mode=display&fid={data_field}', '{data_field}'); 00101 $rules[] = new restore_log_rule('data', 'fields delete', 'field.php?d={data}', '[name]'); 00102 00103 return $rules; 00104 } 00105 00116 static public function define_restore_log_rules_for_course() { 00117 $rules = array(); 00118 00119 $rules[] = new restore_log_rule('data', 'view all', 'index.php?id={course}', null); 00120 00121 return $rules; 00122 } 00123 }