⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scorm_12.js.php

📁 很棒的在线教学系统
💻 PHP
📖 第 1 页 / 共 3 页
字号:
            } else {                errorCode = "301";            }        } else {            errorCode = "201";        }        <?php             if (debugging('',DEBUG_DEVELOPER)) {                echo 'LogAPICall("LMSCommit", param, "", 0);';            }        ?>        return "false";    }        function LMSGetLastError () {     <?php         if (debugging('',DEBUG_DEVELOPER)) {            echo 'LogAPICall("LMSGetLastError", "", "", errorCode);';        }    ?>        return errorCode;    }        function LMSGetErrorString (param) {        if (param != "") {            var errorString = new Array();            errorString["0"] = "No error";            errorString["101"] = "General exception";            errorString["201"] = "Invalid argument error";            errorString["202"] = "Element cannot have children";            errorString["203"] = "Element not an array - cannot have count";            errorString["301"] = "Not initialized";            errorString["401"] = "Not implemented error";            errorString["402"] = "Invalid set value, element is a keyword";            errorString["403"] = "Element is read only";            errorString["404"] = "Element is write only";            errorString["405"] = "Incorrect data type";            <?php             if (debugging('',DEBUG_DEVELOPER)) {                echo 'LogAPICall("LMSGetErrorString", param,  errorString[param], 0);';            }             ?>            return errorString[param];        } else {           <?php             if (debugging('',DEBUG_DEVELOPER)) {                echo 'LogAPICall("LMSGetErrorString", param,  "No error string found!", 0);';            }             ?>           return "";        }    }        function LMSGetDiagnostic (param) {        if (param == "") {            param = errorCode;        }        <?php             if (debugging('',DEBUG_DEVELOPER)) {                echo 'LogAPICall("LMSGetDiagnostic", param, param, 0);';            }        ?>        return param;    }    function AddTime (first, second) {        var sFirst = first.split(":");        var sSecond = second.split(":");        var cFirst = sFirst[2].split(".");        var cSecond = sSecond[2].split(".");        var change = 0;        FirstCents = 0;  //Cents        if (cFirst.length > 1) {            FirstCents = parseInt(cFirst[1],10);        }        SecondCents = 0;        if (cSecond.length > 1) {            SecondCents = parseInt(cSecond[1],10);        }        var cents = FirstCents + SecondCents;        change = Math.floor(cents / 100);        cents = cents - (change * 100);        if (Math.floor(cents) < 10) {            cents = "0" + cents.toString();        }        var secs = parseInt(cFirst[0],10)+parseInt(cSecond[0],10)+change;  //Seconds        change = Math.floor(secs / 60);        secs = secs - (change * 60);        if (Math.floor(secs) < 10) {            secs = "0" + secs.toString();        }        mins = parseInt(sFirst[1],10)+parseInt(sSecond[1],10)+change;   //Minutes        change = Math.floor(mins / 60);        mins = mins - (change * 60);        if (mins < 10) {            mins = "0" + mins.toString();        }        hours = parseInt(sFirst[0],10)+parseInt(sSecond[0],10)+change;  //Hours        if (hours < 10) {            hours = "0" + hours.toString();        }        if (cents != '0') {            return hours + ":" + mins + ":" + secs + '.' + cents;        } else {            return hours + ":" + mins + ":" + secs;        }    }    function TotalTime() {        total_time = AddTime(cmi.core.total_time, cmi.core.session_time);        return '&'+underscore('cmi.core.total_time')+'='+encodeURIComponent(total_time);    }    function CollectData(data,parent) {        var datastring = '';        for (property in data) {            if (typeof data[property] == 'object') {                datastring += CollectData(data[property],parent+'.'+property);            } else {                element = parent+'.'+property;                expression = new RegExp(CMIIndex,'g');                elementmodel = String(element).replace(expression,'.n.');                if (elementmodel != "cmi.core.session_time") {                    if ((typeof eval('datamodel["'+elementmodel+'"]')) != "undefined") {                        if (eval('datamodel["'+elementmodel+'"].mod') != 'r') {                            elementstring = '&'+underscore(element)+'='+encodeURIComponent(data[property]);                            if ((typeof eval('datamodel["'+elementmodel+'"].defaultvalue')) != "undefined") {                                if (eval('datamodel["'+elementmodel+'"].defaultvalue') != data[property] || eval('typeof(datamodel["'+elementmodel+'"].defaultvalue)') != typeof(data[property])) {                                    datastring += elementstring;                                }                            } else {                                datastring += elementstring;                            }                        }                    }                }            }        }        return datastring;    }    function StoreData(data,storetotaltime) {        if (storetotaltime) {            if (cmi.core.lesson_status == 'not attempted') {                cmi.core.lesson_status = 'completed';            }            if (cmi.core.lesson_mode == 'normal') {                if (cmi.core.credit == 'credit') {                    if (cmi.core.lesson_status == 'completed') {                        if (cmi.student_data.mastery_score != '' && cmi.core.score.raw != '') {                            if (parseFloat(cmi.core.score.raw) >= parseFloat(cmi.student_data.mastery_score)) {                                cmi.core.lesson_status = 'passed';                            } else {                                cmi.core.lesson_status = 'failed';                            }                        }                    }                }            }            if (cmi.core.lesson_mode == 'browse') {                if (datamodel['cmi.core.lesson_status'].defaultvalue == '' && cmi.core.lesson_status == 'not attempted') {                    cmi.core.lesson_status = 'browsed';                }            }            datastring = CollectData(data,'cmi');            datastring += TotalTime();        } else {            datastring = CollectData(data,'cmi');        }        datastring += '&attempt=<?php echo $attempt ?>';        datastring += '&scoid=<?php echo $scoid ?>';                var myRequest = NewHttpReq();        result = DoRequest(myRequest,"<?php p($CFG->wwwroot) ?>/mod/scorm/datamodel.php","id=<?php p($id) ?>&sesskey=<?php p($USER->sesskey) ?>"+datastring);        results = String(result).split('\n');        errorCode = results[1];        return results[0];    }    this.LMSInitialize = LMSInitialize;    this.LMSFinish = LMSFinish;    this.LMSGetValue = LMSGetValue;    this.LMSSetValue = LMSSetValue;    this.LMSCommit = LMSCommit;    this.LMSGetLastError = LMSGetLastError;    this.LMSGetErrorString = LMSGetErrorString;    this.LMSGetDiagnostic = LMSGetDiagnostic;}var API = new SCORMapi1_2();<?php// pull in the debugging utilitiesif (debugging('',DEBUG_DEVELOPER)) {    include_once($CFG->dirroot.'/mod/scorm/datamodels/debug.js.php');    echo 'AppendToLog("Moodle SCORM 1.2 API Loaded, Activity: '.$scorm->name.', SCO: '.$sco->identifier.'", 0);';} ?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -