Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/mod/imscp/backup/moodle2/restore_imscp_stepslib.php
Go to the documentation of this file.
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 
00032 class restore_imscp_activity_structure_step extends restore_activity_structure_step {
00033 
00034     protected function define_structure() {
00035 
00036         $paths = array();
00037         $paths[] = new restore_path_element('imscp', '/activity/imscp');
00038 
00039         // Return the paths wrapped into standard activity structure
00040         return $this->prepare_activity_structure($paths);
00041     }
00042 
00043     protected function process_imscp($data) {
00044         global $DB;
00045 
00046         $data = (object)$data;
00047         $oldid = $data->id;
00048         $data->course = $this->get_courseid();
00049         $data->timemodified = $this->apply_date_offset($data->timemodified);
00050 
00051         // insert the imscp record
00052         $newitemid = $DB->insert_record('imscp', $data);
00053         // immediately after inserting "activity" record, call this
00054         $this->apply_activity_instance($newitemid);
00055     }
00056 
00057     protected function after_execute() {
00058         // Add imscp related files, no need to match by itemname (just internally handled context)
00064         $this->add_related_files('mod_imscp', 'intro', null);
00065         $this->add_related_files('mod_imscp', 'backup', null);
00066         $this->add_related_files('mod_imscp', 'content', null);
00067     }
00068 }
 All Data Structures Namespaces Files Functions Variables Enumerations