Project

General

Profile

root / trunk / model / sources / academic / gen / _scorm / widg / scormSaveScore.uiwidget @ 1445

1
<?xml version="1.0" encoding="UTF-8"?><sm:openUiWidget xmlns:sm="http://www.utc.fr/ics/scenari/v3/modeling" xmlns:sc="http://www.utc.fr/ics/scenari/v3/core" code="scormSaveScorm">
2
	<sm:content>
3
		<script xmlns="http://www.w3.org/1999/xhtml" type="text/javascript">var scormSaveScorm = scOnLoads[scOnLoads.length] = {
4
 onLoad : function() {
5
   var vScore = Math.round( (scGlobalEval.fScorePts - scGlobalEval.fMinPts) / (scGlobalEval.fMaxPts - scGlobalEval.fMinPts) * 100);
6
   if(scServices.scorm2k4 &amp;&amp; scServices.scorm2k4.isScorm2k4Active()) {
7
	var vApi = scServices.scorm2k4.getScorm2k4API();
8
	vApi.SetValue("cmi.score.scaled", vScore/100 );
9
	vApi.SetValue("cmi.score.raw", scGlobalEval.fScorePts );
10
	vApi.SetValue("cmi.score.min", scGlobalEval.fMinPts );
11
	vApi.SetValue("cmi.score.max", scGlobalEval.fMaxPts );
12
	vApi.Commit("");
13
   } else if(scServices.scorm12 &amp;&amp; scServices.scorm12.isScorm12Active()) {
14
	var vApi = scServices.scorm12.getScorm12API();
15
	vApi.LMSSetValue("cmi.core.score.raw", vScore);
16
	vApi.SetValue("cmi.core.score.min", 0 );
17
	vApi.SetValue("cmi.core.score.max", 100 );
18
	vApi.LMSSetValue("cmi.core.lesson_status", "completed");
19
	vApi.LMSCommit("");
20
   }
21
 },
22
 loadSortKey : "ZZ"
23
}
24
</script>
25
	</sm:content>
26
</sm:openUiWidget>
(2-2/2)