1

我们在之前的电子学习“引擎”中一直使用 SCORM,但我们希望更改我们的托管学习环境 (MLE) 跟踪的元素,即电子学习模块中的每个可完成组件。

在运行时,我们运行以下代码来设置我们的 SCORM 连接:

var vault = {};                             //vault 'namespace' helps ensure no conflicts with possible other "SCORM" variables
vault.UTILS = {};                           //For holding UTILS functions
vault.debug = { isActive: true };                   //Enable (true) or disable (false) for debug mode

vault.SCORM = {                             //Define the SCORM object
    version:    null,                               //Store SCORM version.
    handleCompletionStatus: true,               //Whether or not the wrapper should automatically handle the initial completion status
    handleExitMode: true,                       //Whether or not the wrapper should automatically handle the exit mode
    API:{handle: null, isFound: false},             //Create API child object
    connection: { isActive: false },                //Create connection child object
    data: { completionStatus: null, exitStatus: null},  //Create data child object
    debug:{}                                        //Create debug child object
};

vault.SCORM.API.find('win'); 
            vault.SCORM.connection.initialize();
            if (vault.SCORM.data.get("cmi.core.lesson_status")=="not attempted") {

                vault.SCORM.data.set("cmi.core.lesson_status" , "incomplete");

                vault.SCORM.data.save();

            }

SCORM.js 文件中还有更多功能,但关键是这一切都有效;当模块加载到我们的 MLE 中时,以下代码会触发课程完成:

vault.SCORM.data.set("cmi.core.lesson_status" , "completed");

那么我们如何在 SCORM 中注册一个可完成的组件呢?(我们的“引擎”中的组件是通常称为“元素”的 jQuery 对象)。像下面这样的工作,或者 SCORM 中的自定义调用是不可能的?

vault.SCORM.data.set("cmi.interactions.n."+element.componentId() , "incomplete");

但是如果我通过指定一个id来注册一个交互,如下...

 vault.SCORM.data.set("cmi.interactions.n.id", element.componentId());

...然后我如何设置或访问该组件的“完成”?

我一直在阅读来自各个站点的帖子和 pdf 规范,但解释充其量是稀疏的。

我知道这里没有很多 SCORM 追随者,但如果你有任何信息,我很想听听。

4

1 回答 1

3

FWIW,这是我的 pipwerks SCORM 包装器,但变量pipwerks更改为ncalt.

在http://pipwerks.com上有关于如何使用我的包装器的文档(在搜索字段中搜索“scorm wrapper”)。原始源代码可以在https://github.com/pipwerks/scorm-api-wrapper找到。

请注意,您的示例代码没有按照预期的方式使用包装器。例如,这个:

ncalt.SCORM.data.set("cmi.core.lesson_status" , "completed");

应该是这个(data是一个内部助手,不是必需的):

ncalt.SCORM.set("cmi.core.lesson_status" , "completed");

您可以通过引用变量进一步缩短它,如下所示:

var scorm = ncalt.SCORM;
scorm.set("cmi.core.lesson_status" , "completed");
scorm.save();
scorm.get("cmi.core.lesson_status"); //returns "completed"

至于您的“组件”,如果您想使用 SCORM 的cmi.interactions模型,请确保您使用的是正确的语法。SCORM 文档 ( cmi.interactions.n.id) 中的“n”表示数字,而不是文字“n”。

scorm.set("cmi.interactions.0.id", "myfirstinteraction");
scorm.save();

要从该交互中检索数据,您需要指定数字来代替 n:

scorm.get("cmi.interactions.0.id"); //returns "myfirstinteraction"

请注意,CMI 数据模型不为cmi.interactions. 你需要使用cmi.objectives.

scorm.set("cmi.objectives.0.status", "completed");
scorm.save();
scorm.get("cmi.objectives.0.status"); // returns "completed"

CMI 数据模型(在 SCORM 中可用)在此处详细说明:http: //scorm.com/scorm-explained/technical-scorm/run-time/run-time-reference/

于 2016-09-08T16:38:24.703 回答