简体   繁体   English

如何使用 SCORM API 检索数据?

[英]How to use SCORM API to retrieve data?

I am developing a simple LMS for medical trainees.我正在为医学实习生开发一个简单的 LMS。 So far i have developed a PHP LMS.到目前为止,我已经开发了 PHP LMS。 For the content i have prepared a SCORM course with quizzes created with Articulate Storyline software.对于内容,我准备了一个 SCORM 课程,其中包含使用 Articulate Storyline 软件创建的测验。 To communicate with SCORM and to retrieve quiz result i tried to implement SCORM API.为了与 SCORM 通信并检索测验结果,我尝试实现 SCORM API。

this is my Run time environment file这是我的运行时环境文件

<html>
<head>

<title>VS SCORM - RTE Frameset</title>
<!-- Rev 1.0 - Sunday, May 31, 2009 -->

</head>
<frameset 
  frameborder="0" framespacing="0" 
  border="0" rows="0,*" cols="*" >
    <frame src="api.html" name="API" noresize></frame>
    <frame src="/packadge/JStest/story.html" name="course"></frame>
</frameset>
</html>

this is the api.html这是api.html

<html>
<head>

<title>VS SCORM - RTE API</title>

<script language="javascript">

var debug = true;

// ------------------------------------------
//   SCORM RTE Functions - Initialization
// ------------------------------------------
function LMSInitialize(dummyString) { 
  if (debug) { alert('*** LMSInitialize ***'); }
  return "true";
}

// ------------------------------------------
//   SCORM RTE Functions - Getting and Setting Values
// ------------------------------------------
function LMSGetValue(varname) {
  if (debug) { 
    alert('*** LMSGetValue varname='+varname
                          +' varvalue=value ***');
  }
  return "value";
}

function LMSSetValue(varname,varvalue) {
  if (debug) { 
    alert('*** LMSSetValue varname='+varname
                          +' varvalue='+varvalue+' ***');
  }
  return "true";
}

function LMSCommit(dummyString) {
  if (debug) { alert('*** LMSCommit ***'); }
  return "true";
}

// ------------------------------------------
//   SCORM RTE Functions - Closing The Session
// ------------------------------------------
function LMSFinish(dummyString) {
  if (debug) { alert('*** LMSFinish ***'); }
  return "true";
}

// ------------------------------------------
//   SCORM RTE Functions - Error Handling
// ------------------------------------------
function LMSGetLastError() {
  if (debug) { alert('*** LMSGetLastError ***'); }
  return 0;
}

function LMSGetDiagnostic(errorCode) {
  if (debug) { 
    alert('*** LMSGetDiagnostic errorCode='+errorCode+' ***');
  }
  return "diagnostic string";
}

function LMSGetErrorString(errorCode) {
  if (debug) { 
    alert('*** LMSGetErrorString errorCode='+errorCode+' ***'); 
  }
  return "error string";
}

</script>

</head>
<body>

<p> 

</body>
</html>

but I don't see these functions are being triggered at the initiation of the SCORM project.但我没有看到这些功能在 SCORM 项目启动时被触发。

how to get Quiz result and alert it?如何获得测验结果并提醒它? (my idea is if I can do so, I will be able to send that results via ajax post to the sever) (我的想法是,如果我可以这样做,我将能够通过 ajax 将结果发送到服务器)

In order for any course to find the API you need to declare window.API and the API itself contains all those LMSxxxxxxx() functions.为了让任何课程都能找到 API,您需要声明 window.API 和 ZDB974238714CA8DE634A7CE1D0xxxxxx8xxxx 本身包含所有这些函数。

For example:例如:

var SCORM = {}; // Create blank object

// ------------------------------------------
//   SCORM RTE Functions - Initialization
// ------------------------------------------
SCORM.LMSInitialize = function(dummyString) { 
  if (debug) { alert('*** LMSInitialize ***'); }
  return "true";
}

// ------------------------------------------
//   SCORM RTE Functions - Getting and Setting Values
// ------------------------------------------
SCORM.LMSGetValue = function(varname) {
  if (debug) { 
    alert('*** LMSGetValue varname='+varname
                      +' varvalue=value ***');
  }
  return "value";
}

// repeat for other LMSxxxxx() functions then assign to window.API

window.API = SCORM;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM