[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Summary view] [Print] [Text view]
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 * @package block_quiz_results 19 * @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} 20 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 21 */ 22 23 defined('MOODLE_INTERNAL') || die(); 24 25 /** 26 * Specialised restore task for the quiz_results block 27 * (using execute_after_tasks for recoding of target quiz) 28 * 29 * TODO: Finish phpdocs 30 * 31 * @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} 32 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 33 */ 34 class restore_quiz_results_block_task extends restore_block_task { 35 36 protected function define_my_settings() { 37 } 38 39 protected function define_my_steps() { 40 } 41 42 public function get_fileareas() { 43 return array(); // No associated fileareas 44 } 45 46 public function get_configdata_encoded_attributes() { 47 return array(); // No special handling of configdata 48 } 49 50 /** 51 * This function, executed after all the tasks in the plan 52 * have been executed, will perform the recode of the 53 * target quiz for the block. This must be done here 54 * and not in normal execution steps because the quiz 55 * can be restored after the block. 56 */ 57 public function after_restore() { 58 global $DB; 59 60 // Get the blockid 61 $blockid = $this->get_blockid(); 62 63 // Extract block configdata and update it to point to the new quiz 64 if ($configdata = $DB->get_field('block_instances', 'configdata', array('id' => $blockid))) { 65 $config = unserialize(base64_decode($configdata)); 66 if (!empty($config->quizid)) { 67 // Get quiz mapping and replace it in config 68 if ($quizmap = restore_dbops::get_backup_ids_record($this->get_restoreid(), 'quiz', $config->quizid)) { 69 $config->quizid = $quizmap->newitemid; 70 $configdata = base64_encode(serialize($config)); 71 $DB->set_field('block_instances', 'configdata', $configdata, array('id' => $blockid)); 72 } 73 } 74 } 75 } 76 77 static public function define_decode_contents() { 78 return array(); 79 } 80 81 static public function define_decode_rules() { 82 return array(); 83 } 84 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |