Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/mod/scorm/prereqs.php
Go to the documentation of this file.
00001 <?php
00002 // This file is part of Moodle - http://moodle.org/
00003 //
00004 // Moodle is free software: you can redistribute it and/or modify
00005 // it under the terms of the GNU General Public License as published by
00006 // the Free Software Foundation, either version 3 of the License, or
00007 // (at your option) any later version.
00008 //
00009 // Moodle is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00016 
00017     // this page is called via AJAX to repopulte the TOC when LMSFinish() is called
00018 
00019 require_once('../../config.php');
00020 require_once($CFG->dirroot.'/mod/scorm/locallib.php');
00021 
00022 $id = optional_param('id', '', PARAM_INT);       // Course Module ID, or
00023 $a = optional_param('a', '', PARAM_INT);         // scorm ID
00024 $scoid = required_param('scoid', PARAM_INT);  // sco ID
00025 $attempt = required_param('attempt', PARAM_INT);  // attempt number
00026 $mode = optional_param('mode', 'normal', PARAM_ALPHA); // navigation mode
00027 $currentorg = optional_param('currentorg', '', PARAM_RAW); // selected organization
00028 
00029 if (!empty($id)) {
00030     if (! $cm = get_coursemodule_from_id('scorm', $id)) {
00031         print_error('invalidcoursemodule');
00032     }
00033     if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
00034         print_error('coursemisconf');
00035     }
00036     if (! $scorm = $DB->get_record("scorm", array("id"=>$cm->instance))) {
00037         print_error('invalidcoursemodule');
00038     }
00039 } else if (!empty($a)) {
00040     if (! $scorm = $DB->get_record("scorm", array("id"=>$a))) {
00041         print_error('invalidcoursemodule');
00042     }
00043     if (! $course = $DB->get_record("course", array("id"=>$scorm->course))) {
00044         print_error('coursemisconf');
00045     }
00046     if (! $cm = get_coursemodule_from_instance("scorm", $scorm->id, $course->id)) {
00047         print_error('invalidcoursemodule');
00048     }
00049 } else {
00050     print_error('missingparameter');
00051 }
00052 
00053 $PAGE->set_url('/mod/scorm/prereqs.php', array('scoid'=>$scoid, 'attempt'=>$attempt, 'id'=>$cm->id));
00054 
00055 require_login($course->id, false, $cm);
00056 
00057 $scorm->version = strtolower(clean_param($scorm->version, PARAM_SAFEDIR));   // Just to be safe
00058 if (!file_exists($CFG->dirroot.'/mod/scorm/datamodels/'.$scorm->version.'lib.php')) {
00059     $scorm->version = 'scorm_12';
00060 }
00061 require_once($CFG->dirroot.'/mod/scorm/datamodels/'.$scorm->version.'lib.php');
00062 
00063 
00064 if (confirm_sesskey() && (!empty($scoid))) {
00065     $result = true;
00066     $request = null;
00067     if (has_capability('mod/scorm:savetrack', get_context_instance(CONTEXT_MODULE, $cm->id))) {
00068         $result = scorm_get_toc($USER, $scorm, $cm->id, TOCJSLINK, $currentorg, $scoid, $mode, $attempt, true, false);
00069         echo $result->toc;
00070     }
00071 }
 All Data Structures Namespaces Files Functions Variables Enumerations