|
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 00034 class anonymizer_final_element extends backup_final_element { 00035 00036 public function set_value($value) { 00037 // Get parent name 00038 $pname = $this->get_parent()->get_name(); 00039 // Get my name 00040 $myname = $this->get_name(); 00041 // Define class and function name 00042 $classname = 'backup_anonymizer_helper'; 00043 $methodname= 'process_' . $pname . '_' . $myname; 00044 // Invoke the interception method 00045 $result = call_user_func(array($classname, $methodname), $value); 00046 // Finally set it 00047 parent::set_value($result); 00048 } 00049 } 00050 00059 class mnethosturl_final_element extends backup_final_element { 00060 00061 public function set_value($value) { 00062 global $CFG; 00063 00064 $localhostwwwroot = backup_plan_dbops::get_mnet_localhost_wwwroot(); 00065 00066 // If user wwwroot matches mnet local host one or if 00067 // there isn't associated wwwroot, skip sending it to file 00068 if ($localhostwwwroot == $value || empty($value)) { 00069 // Do nothing 00070 } else { 00071 parent::set_value($value); 00072 } 00073 } 00074 } 00075 00085 class file_nested_element extends backup_nested_element { 00086 00087 protected $backupid; 00088 00089 public function process($processor) { 00090 // Get current backupid from processor, we'll need later 00091 if (is_null($this->backupid)) { 00092 $this->backupid = $processor->get_var(backup::VAR_BACKUPID); 00093 } 00094 parent::process($processor); 00095 } 00096 00097 public function fill_values($values) { 00098 // Fill values 00099 parent::fill_values($values); 00100 // Do our own tasks (copy file from moodle to backup) 00101 backup_file_manager::copy_file_moodle2backup($this->backupid, $values); 00102 } 00103 } 00104 00109 class backup_plugin_element extends backup_optigroup_element { } 00110 00115 class backup_subplugin_element extends backup_optigroup_element { }