See Release Notes
Long Term Support Release
Differences Between: [Versions 39 and 400] [Versions 39 and 401] [Versions 39 and 402] [Versions 39 and 403]
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 mod_scorm 19 * @subpackage backup-moodle2 20 * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} 21 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 22 */ 23 24 /** 25 * Define all the backup steps that will be used by the backup_scorm_activity_task 26 */ 27 28 /** 29 * Define the complete scorm structure for backup, with file and id annotations 30 */ 31 class backup_scorm_activity_structure_step extends backup_activity_structure_step { 32 33 protected function define_structure() { 34 35 // To know if we are including userinfo 36 $userinfo = $this->get_setting_value('userinfo'); 37 38 // Define each element separated 39 $scorm = new backup_nested_element('scorm', array('id'), array( 40 'name', 'scormtype', 'reference', 'intro', 41 'introformat', 'version', 'maxgrade', 'grademethod', 42 'whatgrade', 'maxattempt', 'forcecompleted', 'forcenewattempt', 43 'lastattemptlock', 'masteryoverride', 'displayattemptstatus', 'displaycoursestructure', 'updatefreq', 44 'sha1hash', 'md5hash', 'revision', 'launch', 45 'skipview', 'hidebrowse', 'hidetoc', 'nav', 'navpositionleft', 'navpositiontop', 46 'auto', 'popup', 'options', 'width', 47 'height', 'timeopen', 'timeclose', 'timemodified', 48 'completionstatusrequired', 'completionscorerequired', 49 'completionstatusallscos', 'displayactivityname', 50 'autocommit')); 51 52 $scoes = new backup_nested_element('scoes'); 53 54 $sco = new backup_nested_element('sco', array('id'), array( 55 'manifest', 'organization', 'parent', 'identifier', 56 'launch', 'scormtype', 'title', 'sortorder')); 57 58 $scodatas = new backup_nested_element('sco_datas'); 59 60 $scodata = new backup_nested_element('sco_data', array('id'), array( 61 'name', 'value')); 62 63 $seqruleconds = new backup_nested_element('seq_ruleconds'); 64 65 $seqrulecond = new backup_nested_element('seq_rulecond', array('id'), array( 66 'conditioncombination', 'ruletype', 'action')); 67 68 $seqrulecondsdatas = new backup_nested_element('seq_rulecond_datas'); 69 70 $seqrulecondsdata = new backup_nested_element('seq_rulecond_data', array('id'), array( 71 'refrencedobjective', 'measurethreshold', 'operator', 'cond')); 72 73 $seqrolluprules = new backup_nested_element('seq_rolluprules'); 74 75 $seqrolluprule = new backup_nested_element('seq_rolluprule', array('id'), array( 76 'childactivityset', 'minimumcount', 'minimumpercent', 'conditioncombination', 77 'action')); 78 79 $seqrollupruleconds = new backup_nested_element('seq_rollupruleconds'); 80 81 $seqrolluprulecond = new backup_nested_element('seq_rolluprulecond', array('id'), array( 82 'cond', 'operator')); 83 84 $seqobjectives = new backup_nested_element('seq_objectives'); 85 86 $seqobjective = new backup_nested_element('seq_objective', array('id'), array( 87 'primaryobj', 'objectiveid', 'satisfiedbymeasure', 'minnormalizedmeasure')); 88 89 $seqmapinfos = new backup_nested_element('seq_mapinfos'); 90 91 $seqmapinfo = new backup_nested_element('seq_mapinfo', array('id'), array( 92 'targetobjectiveid', 'readsatisfiedstatus', 'readnormalizedmeasure', 'writesatisfiedstatus', 93 'writenormalizedmeasure')); 94 95 $scotracks = new backup_nested_element('sco_tracks'); 96 97 $scotrack = new backup_nested_element('sco_track', array('id'), array( 98 'userid', 'attempt', 'element', 'value', 99 'timemodified')); 100 101 // Build the tree 102 $scorm->add_child($scoes); 103 $scoes->add_child($sco); 104 105 $sco->add_child($scodatas); 106 $scodatas->add_child($scodata); 107 108 $sco->add_child($seqruleconds); 109 $seqruleconds->add_child($seqrulecond); 110 111 $seqrulecond->add_child($seqrulecondsdatas); 112 $seqrulecondsdatas->add_child($seqrulecondsdata); 113 114 $sco->add_child($seqrolluprules); 115 $seqrolluprules->add_child($seqrolluprule); 116 117 $seqrolluprule->add_child($seqrollupruleconds); 118 $seqrollupruleconds->add_child($seqrolluprulecond); 119 120 $sco->add_child($seqobjectives); 121 $seqobjectives->add_child($seqobjective); 122 123 $seqobjective->add_child($seqmapinfos); 124 $seqmapinfos->add_child($seqmapinfo); 125 126 $sco->add_child($scotracks); 127 $scotracks->add_child($scotrack); 128 129 // Define sources 130 $scorm->set_source_table('scorm', array('id' => backup::VAR_ACTIVITYID)); 131 132 // Order is important for several SCORM calls (especially scorm_scoes) in the following calls to set_source_table 133 $sco->set_source_table('scorm_scoes', array('scorm' => backup::VAR_PARENTID), 'sortorder, id'); 134 $scodata->set_source_table('scorm_scoes_data', array('scoid' => backup::VAR_PARENTID), 'id ASC'); 135 $seqrulecond->set_source_table('scorm_seq_ruleconds', array('scoid' => backup::VAR_PARENTID), 'id ASC'); 136 $seqrulecondsdata->set_source_table('scorm_seq_rulecond', array('ruleconditionsid' => backup::VAR_PARENTID), 'id ASC'); 137 $seqrolluprule->set_source_table('scorm_seq_rolluprule', array('scoid' => backup::VAR_PARENTID), 'id ASC'); 138 $seqrolluprulecond->set_source_table('scorm_seq_rolluprulecond', array('rollupruleid' => backup::VAR_PARENTID), 'id ASC'); 139 $seqobjective->set_source_table('scorm_seq_objective', array('scoid' => backup::VAR_PARENTID), 'id ASC'); 140 $seqmapinfo->set_source_table('scorm_seq_mapinfo', array('objectiveid' => backup::VAR_PARENTID), 'id ASC'); 141 142 // All the rest of elements only happen if we are including user info 143 if ($userinfo) { 144 $scotrack->set_source_table('scorm_scoes_track', array('scoid' => backup::VAR_PARENTID), 'id ASC'); 145 } 146 147 // Define id annotations 148 $scotrack->annotate_ids('user', 'userid'); 149 150 // Define file annotations 151 $scorm->annotate_files('mod_scorm', 'intro', null); // This file area hasn't itemid 152 $scorm->annotate_files('mod_scorm', 'content', null); // This file area hasn't itemid 153 $scorm->annotate_files('mod_scorm', 'package', null); // This file area hasn't itemid 154 155 // Return the root element (scorm), wrapped into standard activity structure 156 return $this->prepare_activity_structure($scorm); 157 } 158 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body