Differences Between: [Versions 311 and 401] [Versions 311 and 402] [Versions 311 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 // This page is called via AJAX to repopulte the TOC when LMSFinish() is called. 18 19 require_once('../../config.php'); 20 require_once($CFG->dirroot.'/mod/scorm/locallib.php'); 21 22 $id = optional_param('id', '', PARAM_INT); // Course Module ID, or 23 $a = optional_param('a', '', PARAM_INT); // scorm ID 24 $scoid = required_param('scoid', PARAM_INT); // sco ID 25 $attempt = required_param('attempt', PARAM_INT); // attempt number 26 $mode = optional_param('mode', 'normal', PARAM_ALPHA); // navigation mode 27 $currentorg = optional_param('currentorg', '', PARAM_RAW); // selected organization. 28 29 if (!empty($id)) { 30 if (! $cm = get_coursemodule_from_id('scorm', $id)) { 31 print_error('invalidcoursemodule'); 32 } 33 if (! $course = $DB->get_record("course", array("id" => $cm->course))) { 34 print_error('coursemisconf'); 35 } 36 if (! $scorm = $DB->get_record("scorm", array("id" => $cm->instance))) { 37 print_error('invalidcoursemodule'); 38 } 39 } else if (!empty($a)) { 40 if (! $scorm = $DB->get_record("scorm", array("id" => $a))) { 41 print_error('invalidcoursemodule'); 42 } 43 if (! $course = $DB->get_record("course", array("id" => $scorm->course))) { 44 print_error('coursemisconf'); 45 } 46 if (! $cm = get_coursemodule_from_instance("scorm", $scorm->id, $course->id)) { 47 print_error('invalidcoursemodule'); 48 } 49 } else { 50 print_error('missingparameter'); 51 } 52 53 // PARAM_RAW is used for $currentorg, validate it against records stored in the table. 54 if (!empty($currentorg)) { 55 if (!$DB->record_exists('scorm_scoes', array('scorm' => $scorm->id, 'identifier' => $currentorg))) { 56 $currentorg = ''; 57 } 58 } 59 60 $PAGE->set_url('/mod/scorm/prereqs.php', array('scoid' => $scoid, 'attempt' => $attempt, 'id' => $cm->id)); 61 62 require_login($course, false, $cm); 63 64 $scorm->version = strtolower(clean_param($scorm->version, PARAM_SAFEDIR)); // Just to be safe. 65 if (!file_exists($CFG->dirroot.'/mod/scorm/datamodels/'.$scorm->version.'lib.php')) { 66 $scorm->version = 'scorm_12'; 67 } 68 require_once($CFG->dirroot.'/mod/scorm/datamodels/'.$scorm->version.'lib.php'); 69 70 71 if (confirm_sesskey() && (!empty($scoid))) { 72 $result = true; 73 $request = null; 74 if (has_capability('mod/scorm:savetrack', context_module::instance($cm->id))) { 75 $result = scorm_get_toc($USER, $scorm, $cm->id, TOCJSLINK, $currentorg, $scoid, $mode, $attempt, true, false); 76 echo $result->toc; 77 } 78 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body