You are on page 1of 7

Elearning Standards

SCORM

Code

26th July, 2004

c o n f i d e n t i a l
FCS Proprietory Information. Do not Copy or distribute without prior permission

fcs soft ware solut ions. offshore development cent er: a- 86, sect or 57, noida. t el: 91- 4583703 fax: 91- 4583805 www.fcsltd.com

FCS Proprietory Information. Do not Copy or distribute without prior permission

Elearning Standards

// JavaScript Document //============================================================== ============================================= // BEGIN OF CMI FUNCTION MAPPING-----//============================================================== ============================================= // CMI api OBJECT INITIALIZATION -----------//var api = window.opener.parent.api; var api = window.opener.parent; //-------------------------------------CMICore = new Array("cmi.core.student_id", "cmi.core.student_name", "cmi.core.credit", "cmi.core.lesson_mode", "cmi.launch_data", "cmi.comments_from_lms", "cmi.student_data.mastery_score", "cmi.student_data.max_time_allowed", "cmi.student_data.time_limit_action", "cmi.core.lesson_location", "cmi.core.lesson_status", "cmi.core.entry", "cmi.core.score.raw", "cmi.core.total_time", "cmi.core.exit", "cmi.core.session_time", "cmi.suspend_data", "cmi.student_preference.language", "cmi.student_preference.text"); // var student_id, student_name, lesson_location, lesson_status, launch_data, score; var suspend_data_array = new Array(); // initialized to true; set to false inside the for loop; var allAttempted = true; // suspend_data_array = opener.parent.suspend_data_array; function CMIData(command, args) { args = String(args); command = String(command); var F_intData = args.split(";"); // check for existence of scorm api if (api == null) return; switch (command) { case "CMIStartSession" : break; case "LMSGetValue" : student_id = api.doLMSGetValue(CMICore[0]); student_name = api.doLMSGetValue(CMICore[1]); lesson_location = api.doLMSGetValue(CMICore[9]); lesson_status = api.doLMSGetValue(CMICore[10]); launch_data = api.doLMSGetValue(CMICore[4]); score = api.doLMSGetValue(CMICore[12]); suspend_data = api.doLMSGetValue(CMICore[16]); c o n f i d e n t i a l
FCS Proprietory Information. Do not Copy or distribute without prior permission

fcs soft ware solut ions. offshore development cent er: a- 86, sect or 57, noida. t el: 91- 4583703 fax: 91- 4583805 www.fcsltd.com

FCS Proprietory Information. Do not Copy or distribute without prior permission

Elearning Standards

// read suspend data if (suspend_data != "") { var temp_data = suspend_data.split(","); if (temp_data.length == suspend_data_array.length) { suspend_data_array = temp_data; } } //CMISetData(data) if (F_intData[0] != "") { suspend_data_array[parseInt(F_intData[0])] = 1; api.doLMSSetValue(CMICore[16], suspend_data_array.join(",")); } for(i=0; i<suspend_data_array.length; i++) { if (suspend_data_array[i] == 0) { allAttempted = false; break; } } // if (score == "" || score == undefined) { score = 0; } if (lesson_status == "not attempted") { // the student is now attempting the lesson api.doLMSSetValue( CMICore[10], api.normalizeStatus("I")); } else if (allAttempted == true && lesson_status != "passed") { // the student has completed the lesson api.doLMSSetValue( CMICore[10], api.normalizeStatus("C")); } break; case "CMISendInteractionInfo" : //MM_cmiSendInteractionInfo(date, time, intid, objid, intrtype, correct, student, result, weight, latency) var n = api.doLMSGetValue("cmi.interactions._count"); api.doLMSSetValue("cmi.interactions." + n + ".time", F_intData[1]); api.doLMSSetValue("cmi.interactions." + n + ".id", F_intData[2]); c o n f i d e n t i a l
FCS Proprietory Information. Do not Copy or distribute without prior permission

fcs soft ware solut ions. offshore development cent er: a- 86, sect or 57, noida. t el: 91- 4583703 fax: 91- 4583805 www.fcsltd.com

FCS Proprietory Information. Do not Copy or distribute without prior permission

Elearning Standards

api.doLMSSetValue("cmi.interactions." + n + ".objectives.0.id", F_intData[3]); api.doLMSSetValue("cmi.interactions." + n + ".type", api.normalizeType(F_intData[4])); api.doLMSSetValue("cmi.interactions." + n + ".correct_responses.0.pattern", F_intData[5]); api.doLMSSetValue("cmi.interactions." + n + ".student_response", F_intData[6]); api.doLMSSetValue("cmi.interactions." + n + ".result", api.normalizeResult(F_intData[7])); api.doLMSSetValue("cmi.interactions." + n + ".weighting", F_intData[8]); api.doLMSSetValue("cmi.interactions." + n + ".latency", F_intData[9]); break; case "CMISendObjectiveInfo" : //CMISendObjectiveInfo(index, objid, score, status) //CMIData('CMISendObjectiveInfo', '1;l1t1;0;I'); var n = api.doLMSGetValue("cmi.objectives._count"); api.doLMSSetValue("cmi.objectives." + n + ".id", F_intData[1]); api.doLMSSetValue("cmi.objectives." + n + ".score.raw", F_intData[2]); api.doLMSSetValue("cmi.objectives." + n + ".status", api.normalizeStatus(F_intData[3])); break; case "CMISetScore": case "CMISendScore" : //MM_cmiSendScore(theScore) // set the highest score //if(F_intData[1] > parseInt(score)) // data type :: [score;percent;totalQuestions] //F_intData[0] = score; //F_intData[1] = percent; //F_intData[2] = totalQuestions; if(F_intData[0] > parseInt(score)) { //this code passes the actual score to the LMS (Docent 6.5) api.doLMSSetValue("cmi.core.score.min", "0"); api.doLMSSetValue("cmi.core.score.max", "100"); api.doLMSSetValue("cmi.core.score.raw", F_intData[0]); //---------------------------------------------------// //this code passes the percentage score to the LMS (Docent 6.5) c o n f i d e n t i a l
FCS Proprietory Information. Do not Copy or distribute without prior permission

fcs soft ware solut ions. offshore development cent er: a- 86, sect or 57, noida. t el: 91- 4583703 fax: 91- 4583805 www.fcsltd.com

FCS Proprietory Information. Do not Copy or distribute without prior permission

Elearning Standards

//api.doLMSSetValue("cmi.core.score.min", "0"); //api.doLMSSetValue("cmi.core.score.max", "100"); //api.doLMSSetValue("cmi.core.score.raw", F_intData[1]); //---------------------------------------------------} if(lesson_status != "Passed") { if(F_intData[1] >= 80) { api.doLMSSetValue("cmi.core.lesson_status", api.normalizeStatus("P")); } else { //if (lesson_status != "passed") //{ api.doLMSSetValue("cmi.core.lesson_status", api.normalizeStatus("F")); //} } } break; case "CMISetStatus": case "CMISetLessonStatus" : //MM_cmiSetLessonStatus(theStatus) lesson_status = api.doLMSGetValue(CMICore[10]); if (lesson_status == "incomplete") { api.doLMSSetValue("cmi.core.lesson_status", api.normalizeStatus(F_intData[0])); } break; case "CMISetTime" : //CMISetTime(t) api.doLMSSetValue("cmi.core.session_time", F_intData[0]); break; case "CMISetCompleted" : //CMISetCompleted() api.doLMSSetValue("cmi.core.lesson_status", "completed"); break;

c o n f i d e n t i a l
FCS Proprietory Information. Do not Copy or distribute without prior permission

fcs soft ware solut ions. offshore development cent er: a- 86, sect or 57, noida. t el: 91- 4583703 fax: 91- 4583805 www.fcsltd.com

FCS Proprietory Information. Do not Copy or distribute without prior permission

Elearning Standards

case "CMISetStarted" : //CMISetCompleted() api.doLMSSetValue("cmi.core.lesson_status", "incomplete"); break; case "CMISetPassed": //CMISetCompleted() api.doLMSSetValue("cmi.core.lesson_status", "passed"); break; case "CMISetFailed": //CMISetCompleted() api.doLMSSetValue("cmi.core.lesson_status", "failed"); break; case "CMISetData": //CMISetData(data) api.doLMSSetValue("cmi.suspend_data", F_intData[0]); break; case "CMISetLocation": //CMISetLocation(loc) api.doLMSSetValue("cmi.core.lesson_location", F_intData[0]); break; case "CMISetTimedOut": //CMISetTimedOut() api.doLMSSetValue("cmi.core.exit", "time-out"); break; case "CMIInitialize": //CMIInitialize() api.doLMSInitialize(args); break; case "CMIFinish": break; case "CMIExitAU": api.doLMSFinish(args); break; } // END OF CMI FUNCTION MAPPING } setInterval("checkParent()", 500); c o n f i d e n t i a l
FCS Proprietory Information. Do not Copy or distribute without prior permission

fcs soft ware solut ions. offshore development cent er: a- 86, sect or 57, noida. t el: 91- 4583703 fax: 91- 4583805 www.fcsltd.com

FCS Proprietory Information. Do not Copy or distribute without prior permission

Elearning Standards

function checkParent() { try { if(window.opener.closed) window.close(); } catch(nullException) { window.close(); } }

c o n f i d e n t i a l
FCS Proprietory Information. Do not Copy or distribute without prior permission

fcs soft ware solut ions. offshore development cent er: a- 86, sect or 57, noida. t el: 91- 4583703 fax: 91- 4583805 www.fcsltd.com

FCS Proprietory Information. Do not Copy or distribute without prior permission

You might also like