原文出处
一般步骤
1. cmi.core.total_time
这个参数是指学习本sco用的总时间,只能读,不能写,它由平台自动累加,而在课程中只需上传每次学习sco的时间,即回话时间(cmi.core.session_time),即可。当然,在从平台读取数据时,还是要取一次的。
var totalTime = doLMSGetValue("cim.core.total_time"); alert("您目前这个单元的总学习时长时间是:" + totalTime);
2. cmi.core.score.raw
这个参数是测试成绩,可读可写。如果不上传,则为空,在平台计算成绩时就不会计算在内。如果上传,则至少为0。有的平台,要求计算课程的平均得分,若sco中没有测试题,不用上传成绩,则最好去掉上传成绩的语句,不让会把整个课程的平均成绩拉下来的。
3. cmi.core.lesson_location
这个参数是记录上次离开sco时的位置,课件读取后,可依次进入到上次离开的位置,当然,这要在课程中做相应的设置才行。
4. cmi.core.lesson_status
记录sco的完成情况,包括not attempted(未尝试/未学习)、incomplete(未完成),completed(已完成)。在平台上,课程的进度实际上是(已完成的sco数/sco总数)×100%。所以若是单sco的课程,就则只有两种,0%和100%。而sco内部的记录跟平台是没有关系的。
passed
(通过)
|
completed
(已完成)
|
browsed
(浏览)
|
incomplete
(非完成)
|
failed
(失败)
|
not attempted
(未尝试)
|
5. cmi.core.exit
var time=doLMSGetValue( "cmi.core.total_time"); arr=time.split(":"); hh=Number(arr[0]); mm=Number(arr[1]); ss=Number(arr[2]); hms=hh*3600+mm*60+ss + currentSeconds; alert(hms); if (hms>=60){ //这里设定的时间60秒,这个时间可以自己根据本节sco的视频学习时间需求进行更改。
result = doLMSSetValue("cmi.core.lesson_status", "completed"); } else { result = doLMSSetValue("cmi.core.lesson_status", "imcomplete"); }
SCORM1.2中主要Datamodel含义
element |
Supported |
Use |
Possible values |
Limitations |
cmi.core.lesson_status |
Yes |
存储完成状态 |
Not Attempted |
Must be one of the strings listed in the possible values column |
cmi.core.suspend_data |
Yes |
To store any information that the course needs to function |
Free text |
No special characters. Supported characters are ",", ":" |
cmi.core.score.raw |
Yes |
To store the number/weightage of questions answered correctly in a test |
Takes a number |
考试分数 |
cmi.core.score.max |
Yes |
To store the total number/weightage of questions in a test |
Takes a number |
|
cmi.core.score.min |
Yes |
The minimal number/weightage of questions in a test(usually 0) |
Takes a number |
|
cmi._version |
Yes |
Represents the version of the data model |
The value is 1.2 for this version |
版本 |
cmi.core.student_name |
Yes |
Name provided for the learner by the LMS |
|
|
cmi.core.student.id |
Yes |
Login ID provided for the learner by the LMS |
|
|
cmi.core.lesson_location |
Yes |
Represents the last page visited before the learner quits the course. |
Can be decided by the ourseware |
|
cmi.core.credit |
Yes |
Indicates if the learner will be credited for performance for this SCO. |
|
Only field value "Credit" supported |
cmi.core.entry |
Yes |
Checks if the learner has already entered the course before |
ab-initio resume "" |
"Ab-initio" and "Resume" are the possible values that will be returned 通过API(APIAdapterApplet)来更新,课件中不直接赋值,其根据exit参数来确定。 |
cmi.core.total_time |
Yes |
Returns the time spent by the learner in a SCO |
|
章节总学习时间 |
cmi.core.lesson_mode |
Yes |
Returns the mode in which the sco is presented to the learner |
review 回顾 browse 浏览 |
Currently only "Normal" is supported 课件展现形式,比如choice、auto |
cmi.core.exit |
Yes |
Indicates the state of exit(logout, suspend etc) |
"time-out"、"suspend"、"logout"、"" |
课件中的js直接赋值,其主要发生在跳转、暂停、关闭等操作时 |
cmi.core.session_time |
Yes |
Indicates the time spent on the SCO in this session |
|
章节的某次学习时长 |
cmi.launch_data |
Yes |
Any data provided by the LMS(From the manifest) to the SCO after the launch |
|
|
cmi.comments |
Yes |
Storing any comments |
|
Has a limitation of 4k for the data |
cmi.comments_from_lms |
Yes |
Storing any comments from LMS |
|
评语、注解、说明等 |
list[0] = "normal"; //正常
list[1] = "review"; //回顾
list[2] = "browse"; //浏览
2) status类型:
list[0] = "passed"; //通过
list[1] = "completed";//完成
list[2] = "failed"; //失败
list[3] = "incomplete";//未完成
list[4] = "browsed"; //浏览
list[5] = "not attempted";//未参加
3) Exit类型:
list[0] = ""; //空,可能是强制退出或是未退出的状态
list[1] = "time-out"; //超时后退出
list[2] = "suspend"; //暂停(非正常退出时标识为“挂起”状态)
list[3] = "logout"; //正常退出
4) Credit类型:(学分)
list[0] = "credit"; //有学分
list[1] = "no-credit";//无学分
5) Entry类型: (是否已进入)
list[0] = ""; //空(已完成) 有待讨论
list[1] = "ab-initio"; //中间
list[2] = "resume"; //重新开始
6) TimeLimitAction类型:时间界限
list[0] = ""; //空
list[1] = "exit,message"; //退出,反馈信息
list[2] = "exit,no message"; //退出,无反馈信息
list[3] = "continue,message"; //继续,反馈信息
list[4] = "continue,no message";//继续,无反馈信息
7) Interaction类型:课件与平台产生的交互信息
list[0] = "true-false"; //true or false
list[1] = "choice"; //选择
list[2] = "fill-in"; //填写
list[3] = "matching"; //搭配
list[4] = "performance";//性能
list[5] = "likert"; //?
list[6] = "sequencing"; //排序
list[7] = "numeric"; //数字
8) result类型:结果
list[0] = "correct"; //正确
list[1] = "wrong"; //错误
list[2] = "unanticipated";//非正常
list[3] = "neutral"; //中立
1) LMSInitilize
LMSInitialize 负责启动SCO,当学习者进入开始阅读一个SCO时,SCO第一步就是先要呼叫LMSInitialize,LMSInitialize function判断该学员之上课记录,当学员第一次阅读该门课的该SCO时,LMSInitialize就会将设定初值至相关的环境变量;若学习者并不是第一次阅读该SCO,LMSInitialize则必须将该学习者之前的上课记录取出,并存入环境变量中,如此即完成启动SCO之动作。
var result = LMSInitialize("") if (result == "false"){ // Do some error handling } else { // continue with the execution of the SCO }
2) LMSFinish
当学习者阅读完并要离开一个SCO时,在结束时SCO便会将呼叫LMSFinish,LMSFinish主要负责将环境变量重设,并判断该SCO是否在结束之前己经有呼叫LMSCommit将所有记录回存至LMS,若尚未储存,则会自动呼叫将所有学习者在该SCO的上课记录回存。
var result = LMSFinish("");
3) LMSGetValue
LMSGetValue 主要负责将数据由LMS取出,当SCO呼叫LMSGetValue时,LMSSetValue会先判断data model是否可以读取,若不可读取,则写入其错误代码;若该data model是可以读取,则进取出其值并回传给SCO。但在设计时,如同LMSSetValue并没有直接和receiver相连,所以是将数据由暂存的内存中取出。
// A typical return value might be "Hyde, Jackson". var value = LMSGetValue("cmi.core.student_name"); // A typical return value might be "incomplete". var value = LMSGetValue("cmi.core.lesson_status"); var value = LMSGetValue(“cmi._version”);
4) LMSSetValue:
在LMSSetValue 是相当复杂的Function,负责储存所有相关的学习记录,当SCO呼叫欲将某个data model回存时,LMSSetValue第一步先判断所欲回存之data model,判断该data model是否可以set(写入),其次判断其型别,当型别错误时,记录其Error Code,当型别检查通过时,则依SCORM1.2 RTE所订定该data model的处理规则,并将数据存入内存中。
var result = LMSSetValue("cmi.core.score.raw","95");
5) LMSCommit
相较于LMSSetValue和LMSGetValue,LMSCommit可以说简单多了,其主要负责将所有暂存在内存中的学习记录,回存到LMS,在设计时应用了XMLHTTP之技术,所以当LMSCommit被呼叫时,会将所有之暂存数据组成XML文件,再应用XMLHTTP对象将数据POST到 Receiver,当Receiver收到这个Request时,就会解译所传入之XML文件,再将XML文件中的数据直接存入数据库中。
var result = LMSCommit("");
6) GetLastError
该函数将返回一个错误代码,每次API function呼叫后,该函数的值将被重置。(LMSGetErrorString及LMSGetDiagnostic除外)。
var errorCode = LMSGetLastError();
7) GetErrorString
var errorString = LMSGetErrorString("403");
8) LMSGetDiagnostic
var moreInfo = LMSGetDiagnostic("403");