繁体   English   中英

如何使用 SCORM API 检索数据?

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

我正在为医学实习生开发一个简单的 LMS。 到目前为止,我已经开发了 PHP LMS。 对于内容,我准备了一个 SCORM 课程,其中包含使用 Articulate Storyline 软件创建的测验。 为了与 SCORM 通信并检索测验结果,我尝试实现 SCORM API。

这是我的运行时环境文件

<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>

这是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>

但我没有看到这些功能在 SCORM 项目启动时被触发。

如何获得测验结果并提醒它? (我的想法是,如果我可以这样做,我将能够通过 ajax 将结果发送到服务器)

为了让任何课程都能找到 API,您需要声明 window.API 和 ZDB974238714CA8DE634A7CE1D0xxxxxx8xxxx 本身包含所有这些函数。

例如:

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