See Release Notes
Long Term Support Release
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * This file contains the class for restore of this submission plugin 19 * 20 * @package assignsubmission_file 21 * @copyright 2012 NetSpot {@link http://www.netspot.com.au} 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 /** 26 * Restore subplugin class. 27 * 28 * Provides the necessary information 29 * needed to restore one assign_submission subplugin. 30 * 31 * @package assignsubmission_file 32 * @copyright 2012 NetSpot {@link http://www.netspot.com.au} 33 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 34 */ 35 class restore_assignsubmission_file_subplugin extends restore_subplugin { 36 37 /** 38 * Returns the paths to be handled by the subplugin at workshop level 39 * @return array 40 */ 41 protected function define_submission_subplugin_structure() { 42 43 $paths = array(); 44 45 $elename = $this->get_namefor('submission'); 46 $elepath = $this->get_pathfor('/submission_file'); 47 // We used get_recommended_name() so this works. 48 $paths[] = new restore_path_element($elename, $elepath); 49 50 return $paths; 51 } 52 53 /** 54 * Processes one submission_file element 55 * @param mixed $data 56 * @return void 57 */ 58 public function process_assignsubmission_file_submission($data) { 59 global $DB; 60 61 $data = (object)$data; 62 $data->assignment = $this->get_new_parentid('assign'); 63 $oldsubmissionid = $data->submission; 64 // The mapping is set in the restore for the core assign activity 65 // when a submission node is processed. 66 $data->submission = $this->get_mappingid('submission', $data->submission); 67 68 $DB->insert_record('assignsubmission_file', $data); 69 70 $this->add_related_files('assignsubmission_file', 71 'submission_files', 72 'submission', 73 null, 74 $oldsubmissionid); 75 } 76 77 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body