[ Index ] |
PHP Cross Reference of Unnamed Project |
[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 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 'displayactivityname')); 50 51 $scoes = new backup_nested_element('scoes'); 52 53 $sco = new backup_nested_element('sco', array('id'), array( 54 'manifest', 'organization', 'parent', 'identifier', 55 'launch', 'scormtype', 'title', 'sortorder')); 56 57 $scodatas = new backup_nested_element('sco_datas'); 58 59 $scodata = new backup_nested_element('sco_data', array('id'), array( 60 'name', 'value')); 61 62 $seqruleconds = new backup_nested_element('seq_ruleconds'); 63 64 $seqrulecond = new backup_nested_element('seq_rulecond', array('id'), array( 65 'conditioncombination', 'ruletype', 'action')); 66 67 $seqrulecondsdatas = new backup_nested_element('seq_rulecond_datas'); 68 69 $seqrulecondsdata = new backup_nested_element('seq_rulecond_data', array('id'), array( 70 'refrencedobjective', 'measurethreshold', 'operator', 'cond')); 71 72 $seqrolluprules = new backup_nested_element('seq_rolluprules'); 73 74 $seqrolluprule = new backup_nested_element('seq_rolluprule', array('id'), array( 75 'childactivityset', 'minimumcount', 'minimumpercent', 'conditioncombination', 76 'action')); 77 78 $seqrollupruleconds = new backup_nested_element('seq_rollupruleconds'); 79 80 $seqrolluprulecond = new backup_nested_element('seq_rolluprulecond', array('id'), array( 81 'cond', 'operator')); 82 83 $seqobjectives = new backup_nested_element('seq_objectives'); 84 85 $seqobjective = new backup_nested_element('seq_objective', array('id'), array( 86 'primaryobj', 'objectiveid', 'satisfiedbymeasure', 'minnormalizedmeasure')); 87 88 $seqmapinfos = new backup_nested_element('seq_mapinfos'); 89 90 $seqmapinfo = new backup_nested_element('seq_mapinfo', array('id'), array( 91 'targetobjectiveid', 'readsatisfiedstatus', 'readnormalizedmeasure', 'writesatisfiedstatus', 92 'writenormalizedmeasure')); 93 94 $scotracks = new backup_nested_element('sco_tracks'); 95 96 $scotrack = new backup_nested_element('sco_track', array('id'), array( 97 'userid', 'attempt', 'element', 'value', 98 'timemodified')); 99 100 // Build the tree 101 $scorm->add_child($scoes); 102 $scoes->add_child($sco); 103 104 $sco->add_child($scodatas); 105 $scodatas->add_child($scodata); 106 107 $sco->add_child($seqruleconds); 108 $seqruleconds->add_child($seqrulecond); 109 110 $seqrulecond->add_child($seqrulecondsdatas); 111 $seqrulecondsdatas->add_child($seqrulecondsdata); 112 113 $sco->add_child($seqrolluprules); 114 $seqrolluprules->add_child($seqrolluprule); 115 116 $seqrolluprule->add_child($seqrollupruleconds); 117 $seqrollupruleconds->add_child($seqrolluprulecond); 118 119 $sco->add_child($seqobjectives); 120 $seqobjectives->add_child($seqobjective); 121 122 $seqobjective->add_child($seqmapinfos); 123 $seqmapinfos->add_child($seqmapinfo); 124 125 $sco->add_child($scotracks); 126 $scotracks->add_child($scotrack); 127 128 // Define sources 129 $scorm->set_source_table('scorm', array('id' => backup::VAR_ACTIVITYID)); 130 131 // Order is important for several SCORM calls (especially scorm_scoes) in the following calls to set_source_table 132 $sco->set_source_table('scorm_scoes', array('scorm' => backup::VAR_PARENTID), 'sortorder, id'); 133 $scodata->set_source_table('scorm_scoes_data', array('scoid' => backup::VAR_PARENTID), 'id ASC'); 134 $seqrulecond->set_source_table('scorm_seq_ruleconds', array('scoid' => backup::VAR_PARENTID), 'id ASC'); 135 $seqrulecondsdata->set_source_table('scorm_seq_rulecond', array('ruleconditionsid' => backup::VAR_PARENTID), 'id ASC'); 136 $seqrolluprule->set_source_table('scorm_seq_rolluprule', array('scoid' => backup::VAR_PARENTID), 'id ASC'); 137 $seqrolluprulecond->set_source_table('scorm_seq_rolluprulecond', array('rollupruleid' => backup::VAR_PARENTID), 'id ASC'); 138 $seqobjective->set_source_table('scorm_seq_objective', array('scoid' => backup::VAR_PARENTID), 'id ASC'); 139 $seqmapinfo->set_source_table('scorm_seq_mapinfo', array('objectiveid' => backup::VAR_PARENTID), 'id ASC'); 140 141 // All the rest of elements only happen if we are including user info 142 if ($userinfo) { 143 $scotrack->set_source_table('scorm_scoes_track', array('scoid' => backup::VAR_PARENTID), 'id ASC'); 144 } 145 146 // Define id annotations 147 $scotrack->annotate_ids('user', 'userid'); 148 149 // Define file annotations 150 $scorm->annotate_files('mod_scorm', 'intro', null); // This file area hasn't itemid 151 $scorm->annotate_files('mod_scorm', 'content', null); // This file area hasn't itemid 152 $scorm->annotate_files('mod_scorm', 'package', null); // This file area hasn't itemid 153 154 // Return the root element (scorm), wrapped into standard activity structure 155 return $this->prepare_activity_structure($scorm); 156 } 157 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |