[ 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 * Define all the backup steps that will be used by the backup_assign_activity_task 19 * 20 * @package mod_assign 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 defined('MOODLE_INTERNAL') || die(); 26 27 /** 28 * Define the complete choice structure for backup, with file and id annotations 29 * 30 * @package mod_assign 31 * @copyright 2012 NetSpot {@link http://www.netspot.com.au} 32 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 33 */ 34 class backup_assign_activity_structure_step extends backup_activity_structure_step { 35 36 /** 37 * Define the structure for the assign activity 38 * @return void 39 */ 40 protected function define_structure() { 41 42 // To know if we are including userinfo. 43 $userinfo = $this->get_setting_value('userinfo'); 44 45 // Define each element separated. 46 $assign = new backup_nested_element('assign', array('id'), 47 array('name', 48 'intro', 49 'introformat', 50 'alwaysshowdescription', 51 'submissiondrafts', 52 'sendnotifications', 53 'sendlatenotifications', 54 'sendstudentnotifications', 55 'duedate', 56 'cutoffdate', 57 'allowsubmissionsfromdate', 58 'grade', 59 'timemodified', 60 'completionsubmit', 61 'requiresubmissionstatement', 62 'teamsubmission', 63 'requireallteammemberssubmit', 64 'teamsubmissiongroupingid', 65 'blindmarking', 66 'revealidentities', 67 'attemptreopenmethod', 68 'maxattempts', 69 'markingworkflow', 70 'markingallocation')); 71 72 $userflags = new backup_nested_element('userflags'); 73 74 $userflag = new backup_nested_element('userflag', array('id'), 75 array('userid', 76 'assignment', 77 'mailed', 78 'locked', 79 'extensionduedate', 80 'workflowstate', 81 'allocatedmarker')); 82 83 $submissions = new backup_nested_element('submissions'); 84 85 $submission = new backup_nested_element('submission', array('id'), 86 array('userid', 87 'timecreated', 88 'timemodified', 89 'status', 90 'groupid', 91 'attemptnumber', 92 'latest')); 93 94 $grades = new backup_nested_element('grades'); 95 96 $grade = new backup_nested_element('grade', array('id'), 97 array('userid', 98 'timecreated', 99 'timemodified', 100 'grader', 101 'grade', 102 'attemptnumber')); 103 104 $pluginconfigs = new backup_nested_element('plugin_configs'); 105 106 $pluginconfig = new backup_nested_element('plugin_config', array('id'), 107 array('plugin', 108 'subtype', 109 'name', 110 'value')); 111 112 // Build the tree. 113 $assign->add_child($userflags); 114 $userflags->add_child($userflag); 115 $assign->add_child($submissions); 116 $submissions->add_child($submission); 117 $assign->add_child($grades); 118 $grades->add_child($grade); 119 $assign->add_child($pluginconfigs); 120 $pluginconfigs->add_child($pluginconfig); 121 122 // Define sources. 123 $assign->set_source_table('assign', array('id' => backup::VAR_ACTIVITYID)); 124 $pluginconfig->set_source_table('assign_plugin_config', 125 array('assignment' => backup::VAR_PARENTID)); 126 127 if ($userinfo) { 128 $userflag->set_source_table('assign_user_flags', 129 array('assignment' => backup::VAR_PARENTID)); 130 131 $submission->set_source_table('assign_submission', 132 array('assignment' => backup::VAR_PARENTID)); 133 134 $grade->set_source_table('assign_grades', 135 array('assignment' => backup::VAR_PARENTID)); 136 137 // Support 2 types of subplugins. 138 $this->add_subplugin_structure('assignsubmission', $submission, true); 139 $this->add_subplugin_structure('assignfeedback', $grade, true); 140 } 141 142 // Define id annotations. 143 $userflag->annotate_ids('user', 'userid'); 144 $userflag->annotate_ids('user', 'allocatedmarker'); 145 $submission->annotate_ids('user', 'userid'); 146 $submission->annotate_ids('group', 'groupid'); 147 $grade->annotate_ids('user', 'userid'); 148 $grade->annotate_ids('user', 'grader'); 149 $assign->annotate_ids('grouping', 'teamsubmissiongroupingid'); 150 151 // Define file annotations. 152 // These file areas don't have an itemid. 153 $assign->annotate_files('mod_assign', 'intro', null); 154 $assign->annotate_files('mod_assign', 'introattachment', null); 155 156 // Return the root element (choice), wrapped into standard activity structure. 157 158 return $this->prepare_activity_structure($assign); 159 } 160 }
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 |