SCORM Users Guide For Programmers PDF
SCORM Users Guide For Programmers PDF
SCORM Users Guide For Programmers PDF
Programmers
Version 10
Cookbook ................................................................................................................................................................................... 70
14. Bookmarking ....................................................................................................................................................................................... 70
15. Prerequisites ........................................................................................................................................................................................ 73
16. Assessments .......................................................................................................................................................................................... 77
17. The Menu SCO ..................................................................................................................................................................................... 81
18. Sequencing Collections .................................................................................................................................................................... 85
Index......................................................................................................................................................................................... 102
Detailed Table of Contents
Getting Started with SCORM ..................................................................................................................................................7
1.1 Programmer Process ................................................................................................................................................................... 7
1.2 Your First SCORM Course .......................................................................................................................................................... 8
1.3 SCORM Terms ................................................................................................................................................................................. 9
Cookbook ................................................................................................................................................................................... 70
14. Bookmarking ....................................................................................................................................................................................... 70
14.1 Background .................................................................................................................................................................................70
14.2 How to Implement ...................................................................................................................................................................70
14.3 Learner Option ..........................................................................................................................................................................71
15. Prerequisites ........................................................................................................................................................................................ 73
15.1 Background .................................................................................................................................................................................73
15.2 How to Implement ...................................................................................................................................................................73
16. Assessments.......................................................................................................................................................................................... 77
16.1 Introduction ................................................................................................................................................................................77
16.2 When to Implement ................................................................................................................................................................77
16.3 Examples ......................................................................................................................................................................................77
16.4 How to Implement ...................................................................................................................................................................77
17. The Menu SCO ..................................................................................................................................................................................... 81
17.1 Background .................................................................................................................................................................................81
17.2 How to Implement ...................................................................................................................................................................81
17.3 Create a SCO that Contains a Nice "Menu" ....................................................................................................................82
17.4 Impact on Reuse .......................................................................................................................................................................84
18. Sequencing Collections .................................................................................................................................................................... 85
18.1 Background .................................................................................................................................................................................85
18.2 How to Implement ...................................................................................................................................................................85
Index......................................................................................................................................................................................... 102
SCORM Best Practices Guide for Programmers
Getting Started with SCORM - Introduction
If you are new to the Sharable Content Object Reference Model (SCORM) standards, or have
only used a version prior to SCORM 2004, this section will help you acclimate to currently
accepted SCORM development procedures. In the first part, we present a typical
programmer approach to creating SCORM-conformant e-learning, and in the second part
we walk you through setting up your first SCORM course.
Glossary of SCORM
Terminology
Look up SCORM terms
Resources, Tools, &
Development Support
Figure out what files
need to be changed
Test
Figure 1.1 Programmer process for developing SCORM-conformant e-learning.
A typical programmer approach to navigating the SCORM waters and creating SCORM-
conformant e-learning is outlined in Figure 1.1. For example, after understanding the
instructional task that the instructional systems designer (ISD) has shared with you, it is
important to understand how SCORM file structures can support the task. The sections that
7
SCORM Best Practices Guide for Programmers
Getting Started with SCORM - Introduction
will help you understand SCORM file structures (see Figure 1.1) are Sequencing &
Navigation1, Course Structure & Organization, and LMS Management & Communication.
You will also need to look up and understand new SCORM terms and get familiar with the
resources available to you. This information can be found in the Glossary and the
Resources, Tools, & Development Support sections, respectively.
Templates are typically provided by the community and may implement instructional
design patterns. For the purposes of this document we will use a simple starter template
provided by ADL located (download from SCORM API/Code Example). The structure of the
starter template is simple. It contains a single SCO followed by an aggregation of 2 SCOs
(see Figure 1.2).
1 Blue dotted-underlined text are section names and contain hot links to those sections in this document.
8
SCORM Best Practices Guide for Programmers
Getting Started with SCORM - Introduction
Steps 1-4 of this process should be straightforward to a programmer familiar with web
application development. Step 5 will be more challenging to those starting out in SCORM.
Refer to the remainder of this document for information on how to implement sequencing
and other advanced features of SCORM 2004.
Branching instructions to the Rollup and Sequencing rules (not Rollup and Sequencing rules
programmer, flowcharts internal branching within a SCO)
Learner interactivity data Interactions Interaction Data/
(any interactions with cmi.interactions (see the
content, usually used for Assessments Cookbook section)
assessment data)
9
SCORM Best Practices Guide for Programmers
Course Structure & Organization - Introduction
2The Content Aggregation Model is one of the SCORM Books. The whole suite of books (CAM, SN, & RTE) is
available for download under Documentation at http://www.adlnet.gov/capabilities/scorm#tab-learn.
10
SCORM Best Practices Guide for Programmers
Course Structure & Organization - Introduction
2.2 Asset
Assets are electronic representations of media, text, images, sounds, HTML pages,
assessment objects, and other pieces of data. They do not communicate with the
LMS. Assets will likely be your most reusable items; they can be redeployed,
rearranged, repurposed, or reused in many different contexts and applications.
The figure to the left depicts each asset as a small blue box with examples of
several asset types (such as .gif, .mpg, .html, .txt, .jpg).
For example, in Figure 2.2, an image of the Hazard Class 7 Radioactive placard
could be used in training materials for different audiences in both commercial and
DoD transportation as well as by different individuals such as truck drivers, first
responders, and shipping inspectors who may be affected by the transportation of
hazardous materials. The radioactive symbol could be reused as a slice (separate
graphic file) which is seamlessly integrated into the top and bottom of each
composite graphic.
11
SCORM Best Practices Guide for Programmers
Course Structure & Organization - Introduction
In technical terms, a SCO is defined as the only component of the course that uses
the SCORM Application Programming Interface (API) for communication with an
LMS. The SCORM API is a standardized method for a SCO to communicate with
the LMS when learners are interacting with a SCO. There is specific information
the SCO can retrieve from the LMS and store in the LMS. For example, it can store
values in the LMS, such as a score or completion status, or retrieve information from the
LMS, such as a learners name. Figure 2.3 depicts the API communication link between a
SCO and an LMS.
Experienced SCORM designers talk about SCOs as the content that learners see and interact
with, but this is not the complete story. Technically, a SCO must communicate with the LMS
to be called a SCO (see Content Packages section).
12
SCORM Best Practices Guide for Programmers
Course Structure & Organization - Introduction
2.4 Aggregation
An aggregation is a collection of related activities. An aggregation may contain
SCOs or other aggregations. In this Guide, an aggregation is defined as a parent
and its children.
The figure to the left depicts aggregations as green boxes and SCOs as gold boxes
containing blue assets. Aggregations are used to group related content so that it
can be delivered to learners in the manner your ISD prescribes.
Figure 2.4 depicts a SCORM aggregation called Hazard Classes that contains multiple
aggregations: Hazard Class 1 Explosives; Hazard Class 2 Gases, and others. This structure
would continue to reveal individual aggregations for all nine hazardous materials classes.
These aggregations, the green boxes, do not contain content themselves, but are a way of
structuring content to apply sequencing rules.
Figure 2.5 depicts the expansion of the Hazard Class 1 Explosives aggregation, the green
box, with six SCOs, gold boxes: Hazard Class 1 Explosives Overview, Division 1.1 Mass
Explosion Hazard, Division 1.2 Fragmentation Hazard, Division 1.3 Fire Hazard, Division
1.4 Minor Explosion Hazard, Division 1.5 Very Insensitive Explosion Hazard, and Division
1.6 Extremely Insensitive Explosion Hazard. (Refer to Sequencing to learn more about
structuring content for sequencing).
13
SCORM Best Practices Guide for Programmers
Course Structure & Organization - Introduction
2.5 Organization
The organization is the part of a content package where SCOs are
ordered into a tree structure and sequencing behaviors are assigned to
them. The figure to the left depicts an organization as a red box
containing multiple green aggregations and gold SCOS. The organization
outlines the entire structure you have created for the content that you
intend to deliver as a single content package. Each organization is a top-
level aggregation, also referred to as the root aggregation in this
document.
Note: Originally, the content package was defined to allow for multiple organizations.
However, this is currently not supported, so it is suggested that you only use one
organization per content package.
Figure 2.6 depicts the organization called Types of Hazardous Materials (HazMat) using a
red box at the top of the tree with rounded corners. The organization represents a content
package containing three aggregations. The aggregations: Types of HazMat, Hazard Classes,
and Transportation Documentation, are green boxes. The Types of HazMat and Hazard
Classes aggregations also show their associated SCOs, the gold boxes, so you can see how
organizations are structured.
14
SCORM Best Practices Guide for Programmers
Course Structure & Organization - Introduction
The curriculum for a truck driver may include SCORM-conformant content organizations in
loading, hazardous materials transportation, and road safety, as well as, actual driving or
loading experiences on a test course and also on public roadways. The LMS would deliver
15
SCORM Best Practices Guide for Programmers
Course Structure & Organization - Introduction
and store learners performance data for the SCORM-conformant content organizations,
and it might also store and manage the scheduling and completed work accomplished on
the test course and public roadways.
16
SCORM Best Practices Guide for Programmers
Course Structure & Organization - Content Packages
3. Content Packages
3.1 Introduction
All SCORM content is ultimately placed in a content package. The content package is a .zip
file, sometimes called a Package Interchange File (PIF), that contains everything needed to
deliver content to learners via a SCORM 2004 conformant (see Glossary of SCORM
Terminology for a definition) LMS. As the programmer on your team, you are typically
responsible for creating the SCORM content package.
There are tools available to create content packages or you may choose to create them from
scratch. Some authoring tools will create the entire content package after you load your
SCOs and assets into the tool. The ADL version of the RELOAD is an example of such a tool.
RELOAD provides a graphical interface for creating a content package and managing
sequencing and other values contained in the manifest file that is described below. Ensure
that the tools you select match the knowledge, skill, and ability levels of the team members
who will use them. This guide will not go into much detail on tools as there are many
variations in functionality.
17
SCORM Best Practices Guide for Programmers
Course Structure & Organization - Content Packages
Manifest File
An Extensible Markup Language (XML) file called a manifest organizes the content package.
The manifest is a detailed set of instructions, structured in a manner specified by SCORM,
that organizes your content package and tells the LMS when, how, and what content to
deliver to your learners.
An authoring tool typically creates the manifest, though some programmers prefer to
create them from scratch using an XML editor. In this guide, we will not assume the use of
authoring tools, so you can begin to understand all the components and how they fit
together.
The manifest file is always named imsmanifest.xml and it always appears at the top
level of a content package (zip file), regardless of the structure of the rest of the package.
Metadata
The metadata section is where additional informative data about the course is placed. See
CAM 4 or the section about the Content Aggregation Model (CAM) Book in this document,
18
SCORM Best Practices Guide for Programmers
Course Structure & Organization - Content Packages
for details of how this section is structured. At its simplest and most common form, it only
contains the schema and schemaVersion elements:
<metadata>
<schema>ADL SCORM</schema>
<schemaversion>2004 4th Edition</schemaversion>
</metadata>
Note: The schemaVersion designates the SCORM version and many LMSs read this
value to determine which SCORM engine to apply during the runtime of a course.
Additional metadata regarding the organization, activities, and assets in the course may be
referenced in the manifest file. This metadata is typically provided to you by the ISD (see
Glossary of SCORM Terminology). For further reading on how to reference metadata in the
manifest file, see CAM 4.5 or the section that describes the Content Aggregation Model
(CAM) Book in this document.
Organizations
The organization consists of multiple activities (SCO or aggregation) represented by item
elements. This structured representation of the content is typically called the "Activity
Tree." Inside the organization and item is where all the sequencing (see Sequencing &
Navigation) is defined.
<organizations default="ORG-SAMPLE">
<organization identifier="ORG-SAMPLE"
adlseq:objectivesGlobalToSystem="false">
<item identifier="AGGREGATION1">
<title>Sample Aggregation</title>
<item identifier="SCO1" identifierref="RES1">
<title>Sample SCO</title>
</item>
<item identifier="SCO2" identifierref="RES2">
<title>Another Sample SCO</title>
</item>
</item>
</organization>
</organizations>
Resources
SCORM content typically consists of web-delivered assets. These assets may be HTML,
images, Flash objects, audio, video, etc. All of these assets are listed in the resources section
of the manifest file. A resource is a grouping of related assets. There are two types of
resources: SCO resources and asset resources. This is designated by the adlcp:scormType
attribute in a resource. A SCO resource contains the starting or "launch" point for a SCO
along with a list of files and dependencies used by the SCO, while an asset resource
19
SCORM Best Practices Guide for Programmers
Course Structure & Organization - Content Packages
provides supporting
materials which could also Best Practice: An important attribute of the
support other SCOs. The organization element is the
href attribute in the adlseq:objectivesGlobalToSystem. This tells the
resource element is used to LMS how to scope the global objectives in the course.
determine which file is Global objectives are programmer-specified variables
initially delivered to the
stored on the LMS which can be read and written by a
learner. If a set of assets is
shared by multiple SCOs, SCORM 2004 course (see section on Tracking across
then an asset resource SCOs using Global Objectives). Typically, it is a best
listing may be created to practice to contain them in the content package and
remove repetition of assets therefore a value of "false" should be used. The
in the manifest file. The default is "true," so it's important to explicitly define
asset resource is
this.
referenced using the
dependency element. The following code shows a simple example of a manifest file having a
resource for a SCO (SCO-RESOURCE) that has a dependency on another resource (LESSON-
COMMON).
<organizations>
<organization>
<title>Example Course</title>
<item identifier="EXAMPLE-SCO" identifierref="SCO-RESOURCE">
<title>Example SCO</title>
</item>
</organization>
</organizations>
<resources>
<resource identifier="SCO-RESOURCE" adlcp:scormType="sco" type="webcontent"
href="load.html" >
<file href="load.html" />
<file href="example.jpg" />
<file href="example.swf" />
<file href="example.mp3" />
<dependency identifierref="LESSON_COMMON" />
</resource>
<resource identifier="LESSON-COMMON" adlcp:scormType="asset"
type="webcontent" >
<file href="common/apiwrapper.js" />
<file href="common/common.js" />
<file href="common/logo.jpg" />
</resource>
</resources>
Best Practice: Using dependencies is useful to reduce redundancy in the manifest file
and keep it better organized.
3.3.2 Content
SCORM does not dictate the format of the content of a SCO. It is typically standard web
content that can be delivered in a web browser.
20
SCORM Best Practices Guide for Programmers
Course Structure & Organization - Content Packages
API Wrapper
There are some required elements of this web content that make it a SCO. A SCO must find
an instance of the SCORM. This is accomplished by including a special JavaScript file in the
content's main HTML page. This JavaScript file is sometimes called the API Wrapper. It
will be named differently depending on where you acquired this file. For the context of this
document, we will reference it as APIWrapper.js. The functions referenced in this
document will the ones provided in the APIWrapper.js file included in the starter template
and in the Appendix (see SCORM 2004 API Wrapper).
The APIWrapper.js file will locate the SCORM API instance and contains all the functions
required for the content to communicate with the LMS. These functions are standard
JavaScript functions and may be used just like any other JavaScript functions in a web page.
To be conformant, a SCO must make, at a minimum, two calls. The first, doInitialize(), must
be called to initiate communication between the LMS and the SCO. The second,
doTerminate(), must be called at some point before the SCO exits. The HTML of the
simplest SCO might look like this:
<html>
<head>
<script type="text/javascript" src="APIWrapper.js">
<script type="text/javascript">
function doOnload() {
doInitialize();
doTerminate();
}
</script>
</head>
<body onload=doOnload()>
Hello World, I am a SCO
</body>
</html>
Content Organization
SCORM does not impose any restrictions on the file structure of your content. It only
requires that certain non-content files exist in the package, including the imsmanifest.xml
file and other schema related files (see
Content Packages). The imsmanifest.xml Best Practice: It may be useful to
file must exist in the top-level, or root organize the content into folders that are
directory, of the Package Interchange
represented in the resources section of
Format (PIF) file, which is a zip archive.
the manifest file. This will make it easier to
Even though SCORM lets you organize repurpose and reorganize the content
files however you wish, there are some going forward.
suggestions that may help. The content
of a SCORM 2004 content package is
organized in related groups called resources. These resources are defined and referenced
in the manifest file.
21
SCORM Best Practices Guide for Programmers
Course Structure & Organization - Content Packages
In this example, we have one SCO and two Resources. A good plan would be to organize the
content into folders, with each folder corresponding to a Resource.
Another tip is to put all the content you create into a separate folder, named content or
something similar. So, in this example, we would have:
22
SCORM Best Practices Guide for Programmers
Course Structure & Organization - Content Packages
This structure makes it easy to keep everything organized and to be prepared for any
repurposing or reuse that may be in your future plans.
Note: Many tools will handle all this organization for you. However, be aware that not
everyone will use the same tools as you do, so do what you can to keep the file structure
and organization neat and clean.
Best Practice: When possible, remove the redundancy of duplicated files in the
content package. Use the dependency element (see Content Packages section and CAM
3.6.2) in the resource XML to encapsulate common resources and reuse within the
content package.
23
SCORM Best Practices Guide for Programmers
LMS Management & Communication - Understanding the SCORM API
4.1 Introduction
The SCORM Application Programming Interface (API) is a standardized method for a
sharable content object (SCO) to communicate with the learning management system
(LMS) when a learner is interacting with a SCO. There is a specific set of information the
SCO can set or retrieve. For example, it can retrieve information such as a student name, or
set values such as a score.
To use the API, the content implements ECMAScript code, typically JavaScript, which makes
API-specific calls to communicate with the LMS.
Note: The API wrapper files are typically used to make the life of the programmer a little
easier. They are not required, and the programmer may directly communicate with the
API. However, for the purposes of this document, we will assume the use of an API
wrapper and reference functions found within it.
24
SCORM Best Practices Guide for Programmers
LMS Management & Communication - Understanding the SCORM API
Note: If content does not need to communicate scoring or status information to the
LMS, then Initialize() and Terminate() are the only required API calls for the SCO to be
considered conformant. They may be called at any time after the content loads and
before it closes.
25
SCORM Best Practices Guide for Programmers
LMS Management & Communication - CMI Data Model
In SCORM 2004, every LMS must implement certain functionality to ensure interoperability
and achieve SCORM-conformance. One element of this functionality governs how data is
retrieved and stored. The SCORM data
model elements govern how data on Note: Every SCO has a full set of data model
learners performance and interactions elements, but it is not possible to access the
is retrieved and stored. data model elements of another SCO. For
example, you cannot access the completion
A SCO must initiate all communication
status of different SCOs in the course. There
with the LMS. After the SCO has
initiated communication with the are ways to share certain information across
SCORM API, requests to store or SCOs: through the use of global objectives (see
retrieve data from the LMS can be Section 11 Tracking across SCOs using Global
initiated by the SCO. The SCORM data Objectives) and a special data model element,
model elements, described in detail in named adl.data (see Section 5.3.1 Inter-SCO
the SCORM RTE book (also see the Data Storage). These elements allow the
section on the Run-Time Environment
sharing of some status data and also a data
(RTE) Book), facilitate the collection of
learner information as learners bucket for sharing generic strings across SCOs.
progress through a SCO. An LMS is
required to support all of the data model elements, but you are not required to use any of
them. As a programmer, you need to know what data can be communicated via the SCORM
data model so you can assist your ISD in knowing what options are available.
The learner's name for use inside the content (i.e., "Well done, Jane.")
The last location in the content the learner viewed (i.e., "Do you want to start where
you left off?") (see the Bookmarking Cookbook section)
The learner's language, presentation, or other preferences
26
SCORM Best Practices Guide for Programmers
LMS Management & Communication - CMI Data Model
You may also want to store information in the LMS such as the learner's:
Score
Total time spent in a SCO Note: If your course design requires
Time spent in a single session of a minimal tracking or learner interaction,
SCO no data model elements need to be stored.
Completion status Again, it is important to work with the
Responses to assessment items designer to understand what is required.
Interactions within a SCO
Pass/fail status
5.2 Examples
Table 5.1 provides a description and application of the most common SCORM data model
elements, using the simple name and the cmi name. See CAM 4.1 or the section that
describes Content Aggregation Model (CAM) Book in this document, for the complete
description of the data model and list of elements with their allowed value formats.
Launch Data Provides data specific to a SCO that the Allows SCOs to be configured with data
SCO can use for initialization. This value from the LMS at the time of launch. This
cmi.launch_data
is initialized by the LMS using the data data is defined in the manifest file element
from the manifest file element dataFromLMS (see CAM 3.4.1.14). For
<adlcp:dataFromLMS>. example, configuration data for scenarios
can be passed via this element.
Location Represents a location in the SCO. Used for book-marking the learners
position in a SCO in a given instance,
cmi.location
allowing the learner to resume the SCO at
the same point at which learning was
suspended. This value is not interpreted
by the LMS, but is made available to the
programmer to implement features such
as book-marking.
27
SCORM Best Practices Guide for Programmers
LMS Management & Communication - CMI Data Model
Content Initialization
Learner Name Allows the SCO to present the name of Typically used to customize learning
the learner inside the content, in the form content, for example:
cmi.learner_name
lastname, firstname.
Welcome back Sgt Thomas. or Nice
work, Capt. Brown.
Score Reporting
Completion Status Indicates if the learner has completed the The completion status [see Status and
SCO. Scoring], determined by the ISD, can be
cmi.completion_status
based on a test score, navigation through
content, completion activities, etc.
Scaled Passing Score Identifies the scaled passing score Will be initialized to your minimum passing
required to master the SCO. This field is score and may be retrieved for reference.
cmi.scaled_passing_score
set from the LMS using the value in
<adlcp:minNormalizedMeasure>.
This value is read-only.
Score Identifies the learners score for the SCO. This is typically the result of some
A SCO can only report one score. [see interaction the learner has with the
cmi.score.raw
RTE 4.2.20] content where a numeric score is relevant.
cmi.score.min The score object is broken down into 4
sub-elements, with scaled being the most
cmi.score.max
commonly used to represent a mastery
cmi.score.scaled percentage.
Success Status Indicates if the learner has mastered the The criteria, defined by the ISD, can be
cmi.success_status SCO, as indicated by a passed or failed based on a percentage of interactions
value. being passed or objectives being met, a
score for a test or quiz, etc. See Status
and Scoring for additional details on how
this field is used.
Exit Data
Exit Indicates how the learner left the SCO. Can be used to impact sequencing
cmi.exit (see Exiting SCOs and Courses) decisions and determines if a SCO is
suspended or exited normally.
28
SCORM Best Practices Guide for Programmers
LMS Management & Communication - CMI Data Model
Total Time Stores the learners cumulative time for all Stores the total time spent in every
sessions of a specific SCO for a given session of a given SCO, for a given
cmi.total_time
learner attempt. learner.
Values of the cmi data model are simple strings and numbers. Here are some examples in
JavaScript.
// store the current state data of the SCO to be used after resuming.
// save this data refers to a string stored in the LMS that upon
// resumption of the course will be fetched and used to initialize the
// content
doSetValue("cmi.suspend_data", save this data);
Data stores are associated with a SCO using the <adlcp:data> (see CAM 3.4.1.18 and RTE
4.3) extension element in the Manifest File. This element is the last element in the <item>
29
SCORM Best Practices Guide for Programmers
LMS Management & Communication - CMI Data Model
element and a SCO may be associated with many data stores. The following XML will share
two data stores with a SCO.
<item identifier="SCO1" identifierref="RES1">
<title>SCO with shared data</title>
<adlcp:data>
<adlcp:map targetID = "shared_data_1" />
<adlcp:map targetID = "shared_data_2" />
</adlcp:data>
</item>
From within the content, the adl.data is accessed similar to global objectives (see Section
11 Tracking across SCOs using Global Objectives). The data store is located by searching
for it within an array of data store elements. In the Starter Template, a function called
findDataStore() is provided. To access the data in the store, the following JavaScript is
used:
var index = findDataStore("shared_data_1");
// grab the data
var sharedData = doGetValue("adl.data." + index + ".store");
// store the data
doSetValue("adl.data." + index + ".store",
"some data you would like to share");
The data stored in adl.store may be shared across content packages as well. An attribute
adlseq:sharedDataGlobalToSystem in the <organization> element of the manifest controls if
this data is accessible outside the scope of the content package. The default value is true, so
be sure to set the value to false if you wish to restrict access.
<organization identifier="ORG-SAMPLE" adlseq:sharedDataGlobalToSystem="false">
30
SCORM Best Practices Guide for Programmers
LMS Management & Communication - Status and Scoring
6.1 Introduction
Each activity in SCORM 2004 has a status. As described in the section on global objectives
(see Section 11 Tracking across SCOs using Global Objectives), both a SCO and an
aggregation have a primary objective. This primary objective is an object holding status
values related to the progress and
success of the learner's interaction with Note: Setting the score by itself does not
the activity. Each SCO can set values in have any immediate side effect in the
its own primary objective. The course. It just sets the value, which is
following information is stored in the stored in the LMS. However, as noted in
primary objective:
the next section, when used in
combination with manifest file settings,
Success_status
Completion_status the scaled score may impact success
Score (scaled, raw, min, max) status.
Progress_measure
Note that these are the same values defined in the CMI Data Model for statuses.
Note: The organization element in the manifest file is a special type of aggregation,
sometimes called the "root" aggregation. Just like regular aggregations, the organization
has a primary objective. This objective will ultimately contain the final status available to
the LMS for the content package.
doSetValue("cmi.score.scaled", ".85");
31
SCORM Best Practices Guide for Programmers
LMS Management & Communication - Status and Scoring
doSetValue("cmi.success_status", "passed");
Another method is to use some special XML in the manifest file to calculate whether the
saved score represents a passed or failed attempt by the learner. This element is called
imsss:minNormalizedMeasure
and is detailed in CAM Best Practice: Using the manifest to drive the success
5.1.7.1.1. When used in
status of the activity is a really good method to use if you
conjunction with the
satisfiedByMeasure attribute in need more dynamic control over the passing threshold of
the primary objective, the a SCO. For example, a pre-assessment of a course may
pass/fail status of the activity require 90% mastery, while the same content when used
can easily be controlled by the as a post-test may only require 80%. This XML method
manifest. In the following makes it easy to make alterations without the need to
example, any score of 60% or
change content.
higher will result in a passing
status.
cmi.progress_measure
This is used to indicate partial completion and also automatically update
cmi.completion_status. Referencing the table in RTE 4.2.18, cmi.progress_measure has the
following impact on cmi.completion_status:
32
SCORM Best Practices Guide for Programmers
LMS Management & Communication - Status and Scoring
cmi.progress_measure cmi.completion_status
0 "not attempted"
1 "completed"
0 < value < 1 "incomplete" (typically, unless a
cmi.completion_threshold is defined and the
cmi.progress_measure >=
cmi.completion_threshold)
cmi.completion_status
This may be set to "incomplete" or "completed." Default value is "not attempted." As the
programmer, you are typically responsible for setting this value unless
cmi.progress_measure is used.
Completion Threshold
It's also possible, though not as common, to define a completion threshold in the manifest
file. In the SCORM books, Sequencing & Navigation 3.14 and CAM 3.4.1.15, ADL has
provided a special element to control completion. This element has three attributes:
The following code is an example manifest entry for a SCO that is considered completed if
the progress measure is 75% completed.
33
SCORM Best Practices Guide for Programmers
LMS Management & Communication - Status and Scoring
34
SCORM Best Practices Guide for Programmers
Sequencing & Navigation - Control Modes
7.1 Introduction
In SCORM 1.2, the learner could choose any SCO at any time by clicking on a desired entry
in the LMS-provided table of contents. In SCORM 2004, Sequencing gives you, the
programmer, the option to control the order in which the SCOs in a given Aggregation is
presented. If you do not need to implement sequencing, the default settings will allow
learners to choose any SCO at any time.
However, if you need to control the order in which your learners experience the SCOs
within a given aggregation, SCORM Sequencing provides several options called Control
Modes that you set to true or false. Table 7.1 describes the most common control modes.
Details and information on additional modes can be obtained in SN section 3.2. We will discuss
the most commonly used modes in this guide.
7.3 Example
In Figure 7.1 we have a simple course structure. From the Root Aggregation, we have a series of
SCOs (indicated in gold) related to changing a flat tire in a vehicle. All the SCOs exist at the
35
SCORM Best Practices Guide for Programmers
Sequencing & Navigation - Control Modes
same level as children of the root aggregation. Depending on the design SCOs may be presented
in a linear order or the instructional designer (ISD) may choose to allow the learners to pick and
choose the order these lessons are presented.
For example, to allow the learner to experience the SCOs in any order he/she wants, the control
mode of the Root Aggregation in Figure 7.1 might look like this:
However, the ISD may feel it's important that the learner experience the SCOs in the order they
are listed above. To accomplish this, the following control would be used:
As mentioned, control modes are defined at the aggregation levels in the course structure
(also called the activity tree) and affect only the immediate children of that aggregation. In
SCORM, a SCO is always a child and will
never be a parent with a SCO beneath Best Practice: It is important to work
it. Aggregations, however, can be both closely with the instructional designer when
parents and children. Remember that selecting control modes and deciding how to
aggregations are simply collections of implement the sequencing of a course. These
SCOs and other aggregations. An easy mode selections should be driven by the ISDs
way to remember how modes apply in
design. As a programmer, become familiar
sequencing is that all of the children
will follow the control mode defined in with their meanings and impact on the
the parent; no child is special. For content so you can best realize the desired
example, if an aggregation defines output and give advice on possibilities and
control mode choice as "true", then all limitations.
the child SCOs or child aggregations
36
SCORM Best Practices Guide for Programmers
Sequencing & Navigation - Control Modes
For Figure 7.2, you might write the following rules for control mode:
For the Root Aggregation, learners must view all of the items in order. They can go
back at any time.
o <imsss:controlMode flow="true" choice="false"/>
37
SCORM Best Practices Guide for Programmers
Sequencing & Navigation - Control Modes
For the Safety Aggregation, allow learners to choose Safety Precautions, Recognizing
a Flat, or both.
o <imsss:controlMode flow="false" choice="true"/>
Note: Sometimes, the ISD will dictate a more dynamic control mode than SCORM
allows. For example, the design might dictate that the learner experience lessons in a
certain order before a quiz. However, once taken, the learner can review the material in
any order before moving on. This is not immediately accomplished in SCORM 2004
using control modes as mode values are static and can't be changed throughout the
course. There are ways to accomplish designs like this. See cookbook section on The
Menu SCO for an example.
Best Practice: Control Mode Choice Exit is not as common as flow and choice.
However, there is one very important use of Choice Exit that needs to be noted. In the
table of contents, the top-level item (the root organization) is rendered in the table of
contents as a clickable link to comply with a component of the UI conformance
requirements of SCORM. This is problematic as the learner may click the top link
anytime during the session. The result is that the activity tree is started over from the
beginning and the current session will probably end up in an undefined state. To
overcome this, choiceExit should be set to false in the course's organization's control
mode element.
Note: This method is not currently interoperable across LMSs due to a gray area in the
conformance criteria of SCORM 2004 4th Edition. To do this interoperably, a hidden
aggregation must be added as a child of the root organization element. Setting
isvisible="false" in this new aggregation's item element and adding an attribute of
choiceExit="false" to the control mode element will hide the clickable link related to the
organization element from the learner, yet still present the entire organization's
activities to the learner in the Table of Contents. Your real content will be a child to this
new aggregation. This method should work in all LMSs. Test on your LMS to see how it
functions.
38
SCORM Best Practices Guide for Programmers
Sequencing & Navigation - Navigation
8. Navigation
8.1 Introduction
Navigation is the process in which content (see the Sequencing section) is initiated. A
navigation request, as detailed in section 4.4.3 of the SN book, is the process of initiating
events, which results in the identification of learning activities (SCOs, Organizations or
Clusters) for delivery. Both learner and system may initiate these events.
8.2 Examples
Some conceptual examples of these requests are:
39
SCORM Best Practices Guide for Programmers
Sequencing & Navigation - Navigation
In the example below, only the suspendAll navigation element will be available in the LMS
provided navigation UI.
Best Practice: It is suggested to only allow a suspendAll navigation device from the
LMS. This allows the learner to explicitly pause a course (to take a break) and resume
later. On occasion, previous and continue may be appropriate. However, in many cases, it
may be preferred to embed previous and next navigation into the content itself. This
allows for a more consistent interface for the learner. See the section 8.4.3 Navigating
from within Content for details on how to navigate from content. Also see the Cookbook
section on The Menu SCO for additional options on navigating within the course.
40
SCORM Best Practices Guide for Programmers
Sequencing & Navigation - Navigation
The tokens available for use in SetValue are the same actions listed above in Section 8.3.
The tokens of choice and jump have special syntax to designate the targeted activity.
doSetValue("adl.nav.request", "{target=<ACTIVITY_ID>}choice");
doSetValue("adl.nav.request", "{target=<ACTIVITY_ID>}jump");
ACTIVITY_ID is the identifier attribute found in the manifest file for the <item> element
associated with the targeted activity.
Note: jump is a new request in 4th Edition. It was introduced to allow content to have
more navigation control. A choice request is only allowed if the parent cluster of a SCO
has choice enabled in its control mode (see Section 7. Control Modes). To enable content
to target an activity for launch, regardless of control mode, the jump request was
introduced. Other than this, they exhibit identical behaviors.
The following code should be placed within the SCO at a section that is executed when the
learner is finished with a given attempt on the SCO.
doSetValue("adl.nav.request", "continue");
doTerminate();
41
SCORM Best Practices Guide for Programmers
Sequencing & Navigation - Navigation
42
SCORM Best Practices Guide for Programmers
Sequencing & Navigation - Sequencing
9. Sequencing
9.1 Introduction
Sequencing is the process in which content objects are selected by the LMS for delivery to
the learner. Sequencing is typically initiated by a navigation request, as described in section
4.4.3 of the SN book (also see Navigation section in this document). During the sequencing
process, rules are evaluated and an activity (SCO or aggregation) is identified for delivery.
Sequencing is the most complex part of SCORM. In this guide, we will break down the most
commonly used pieces of sequencing and give you the information needed to be successful.
Under the blanket of sequencing, there is a lot of functionality. Some of this functionality is
complex enough to warrant its own section in this document (Tracking across SCOs using
Global Objectives, Control Modes, and Rollups), and we will address them separately. .
In this section, we will cover Sequencing as it relates to moving from one activity to another
and also address some miscellaneous sequencing items (Limit Conditions, Randomization,
and Delivery Controls). For a full list of sequencing components, see SN 3.1 and CAM 5.1.1.
9.2 Examples
Some conceptual examples of sequencing are:
43
SCORM Best Practices Guide for Programmers
Sequencing & Navigation - Sequencing
All sequencing rules have the same syntax. In the sequencing element of an activity, found
in the manifest file, there is a sequencingRules element, which may contain any number of
pre, post, and exit condition rules. Here is an example of the syntax:
<imsss:sequencingRules>
<imsss:preConditionRule>
<imsss:ruleConditions conditionCombination="all|any">
<imsss:ruleCondition condition="someCondition" />
<imsss:ruleCondition condition="someOtherCondition" />
</imsss:ruleConditions>
<imsss:ruleAction action=
"skip|disabled|hiddenFromChoice|stopForwardTraversal" />
</imsss:preConditionRule>
<imsss:postConditionRule>
<imsss:ruleConditions conditionCombination="all|any">
<imsss:ruleCondition condition="someCondition" />
</imsss:ruleConditions>
<imsss:ruleAction action=
"exitParent|exitAll|retry|retryAll|continue|previous" />
</imsss:postConditionRule>
<imsss:exitConditionRule>
<imsss:ruleConditions conditionCombination="all|any">
<imsss:ruleCondition condition="someCondition" />
</imsss:ruleConditions>
<imsss:ruleAction action="exit" />
</imsss:exitConditionRule>
</imsss:sequencingRules>
First, rule conditions are either combined using AND or OR logic. This is done using the
conditionCombination attribute in the imsss:ruleConditions element. The values of "all" and
"any" correspond to AND and OR.
44
SCORM Best Practices Guide for Programmers
Sequencing & Navigation - Sequencing
This example only checks if the pre-assessment was failed. If the optional pre-
assessment was skipped, the referenced objective [see Tracking across SCOs using
Global Objectives on how to use them] "obj-pre" will have a value of "unknown."
Therefore, you need to add a second condition:
<imsss:preConditionRule>
<imsss:ruleConditions conditionCombination="any">
<imsss:ruleCondition operator="not"
condition="objectiveStatusKnown"
referencedObjective="obj-pre" />
<imsss:ruleCondition operator="not"
condition="satisfied"
referencedObjective="obj-pre" />
</imsss:ruleConditions>
<imsss:ruleAction action="skip " />
</imsss:preConditionRule>
This properly checks the condition "If the activity has never been attempted or if it is
failed."
Figure 3.4a from the SN book, shown below, explains how these values fit together:
45
SCORM Best Practices Guide for Programmers
Sequencing & Navigation - Sequencing
The conditions are documented well in Table 3.4.2a of the SN book. Here is a simplified
table explaining the conditions:
Condition Description
always Always True
satisfied True if activity or referenced objective is passed
completed True if activity or referenced objective is completed
attempted True if activity has been attempted
objectiveStatusKnown True if the activity or referenced objective has a
satisfied status is not unknown.
objectiveMeasureKnown True if the activity or referenced objective has a
normalized measure (score.scaled) is not unknown
objectiveMeasureGreaterThan True if the activity or referenced objective has a
normalized measure greater than the
measureThreshold
objectiveMeasureLessThan True if the activity or referenced objective has a
normalized measure less than the measureThreshold
activityProgressKnown True if the activity or referenced objective is in
progress
attemptLimitExceeded True if the number of attempts on the activity is
greater than or equal to any defined attempt limit on
the activity
Note: You can program multiple sequencing rules for an activity. They will be
evaluated in top-down order.
skip - skip over this activity and select the next available
46
SCORM Best Practices Guide for Programmers
Sequencing & Navigation - Sequencing
disabled - disallows an activity for delivery of any kind. Typically seen as grayed out
in Table of Contents. (see Prerequisites Cookbook section)
hiddenFromChoice - disallows activity as target of choice request. Will be grayed
out or completely hidden in table of contents.
For example, to skip an activity if it's already been attempted, the following rule should be
used:
<imsss:preConditionRule>
<imsss:ruleConditions conditionCombination="any">
<imsss:ruleCondition condition="satisfied" />
</imsss:ruleConditions>
<imsss:ruleAction action="skip" />
</imsss:preConditionRule>
Note: Pre-Condition rules are continuously evaluated. This is in contrast to Post and
Exit-Condition rules which are evaluated only after an activity Terminates. The reason
behind this is that the execution of some of the actions such as disabled and
hiddenFromChoice cannot be tied to a specific point in time.
exitParent - Exit the current aggregation and execute post-condition rules of the
parent
exitAll - Terminate this attempt on the course
retry - Retry the current activity. Note: All prior attempt data for this activity will
be erased and a new attempt generated.
retryAll - Retry the entire activity tree
continue - Sequence to the next available activity in the tree
previous - Sequence to the prior activity as available
47
SCORM Best Practices Guide for Programmers
Sequencing & Navigation - Sequencing
<imsss:limitConditions attemptLimit="1"/>
Best Practice: An activity may not be delivered more than its defined attempt limit.
Sequencing does not provide an alternate activity or action if the attempt limit
threshold is met. Typically the LMS will only show a message saying that the activity
was not available for delivery. It's up to you as the programmer to use sequencing rules,
specifically with condition attemptLimitExceeded, as defined above, to send the learner
to an appropriate alternative activity.
<imsss:randomizationControls randomizationTiming="onEachNewAttempt"
reorderChildren="true"/>
Best Practice: If you want to only deliver one of the activities in an aggregation when
using randomization controls, you will need to use post-condition rules to exit the
aggregation after the learner takes the randomized activity presented to them. This will
prevent the remaining sibling activities from being delivered. The following XML could
be placed in the sequencing XML of each child in the aggregation.
<imsss:postConditionRule>
<imsss:ruleConditions conditionCombination="any">
<imsss:ruleCondition condition="always" />
</imsss:ruleConditions>
<imsss:ruleAction action="exitParent" />
</imsss:postConditionRule>
48
SCORM Best Practices Guide for Programmers
Sequencing & Navigation - Sequencing
tracked (SN 3.13.1) - Whether or not the LMS manages tracking status information.
Default = true.
completionSetByContent (SN 3.13.2) - If true, the content is required to set
completion status (CMI Data Model). If false, the activity is marked as completed
automatically on termination. Default = false.
objectiveSetByContent (SN 3.13.3) - If true, the content is required to set
satisfied status (CMI Data Model). If false, the activity is marked as passed
automatically on termination. Default = false.
49
SCORM Best Practices Guide for Programmers
Sequencing & Navigation - Tracking across SCOs using Global Objectives
In sequencing, the variables that can store information about one SCO in the LMS that can
be retrieved for later use are called "objectives," (SN 3.10). These are not to be confused
with learning objectives, which in traditional instructional design, are used to measure the
attainment of knowledge, skill, or ability in accordance with a predefined behavior, a
prescribed condition, or an achievement standard. When discussing your sequencing
behaviors with an ISD, make sure you are both referring to objectives in the same way to
avoid confusion. As a programmer, you should consider these sequencing objectives as
"variables" in which some information may be stored and shared with other activities.
Each SCO can set or read multiple objectives, and a single objective can be set or read by
multiple SCOs. Objectives contain the following information. Note that these are the same
values defined in the CMI Data Model for statuses.
success_status
completion_status
score (scaled, raw, min, max)
progress_measure
10.2 Examples
Sequencing objectives may be used to track information at a level more granular than the
SCO itself. An objective may be used to:
Track the status of parts of Assessments within a SCO for the purpose of remediation
Share the score of one SCO with another SCO
50
SCORM Best Practices Guide for Programmers
Sequencing & Navigation - Tracking across SCOs using Global Objectives
As mentioned, an activity may contain multiple objectives. But there is one special
objective called the primary objective. This refers to the objective containing the activity's
own status values. The remaining objectives are sometimes referred to as secondary
objectives, though that is not an official name.
Best Practice: As discussed in the content packaging section of this guide, shared
global objectives may be scoped to the namespace of the entire LMS. This is through the
use of the Objective Global to System attribute in the Organization [see Best Practice in
Content Package Organizations]. Be very careful when using the default value of this
attribute (True) as the global namespace may become cluttered.
<imsss:sequencing>
<!-- other sequencing rules go here -->
<imsss:objectives>
51
SCORM Best Practices Guide for Programmers
Sequencing & Navigation - Tracking across SCOs using Global Objectives
</imsss:objectives>
. . .
</imsss:sequencing>
In this example, we have defined a primary objective and mapped it to a shared global
named obj-global-1. We have also defined another local objective, obj-local-1, and mapped
it to the shared global objective obj-global-1.
Note: Even though we give the primary objective an ID, this identifier is really never
used in practice. Only the identifiers of the secondary objectives are important.
Best Practice: There is no real restriction on the naming of the objective identifiers.
However, as a best practice, choose a naming convention that makes sense for your
organization. It is a good idea to make the global identifiers something that will be
unique universally. This can be done with a globally unique identifier (GUID) or using
any local conventions. Also, since objectives can represent learning objectives and
variables, many have opted to use prefixes like "obj-" and "var-" when naming
objectives.
52
SCORM Best Practices Guide for Programmers
Sequencing & Navigation - Tracking across SCOs using Global Objectives
Completion Status
Raw Score
Min Score
Max Score
Progress Measure
However, since these elements were not part of the original IMS Sequencing specification
for objectives, ADL had to add an extension to sequencing. A new element, adlseq:objectives
was added to allow this additional information to be mapped to global objectives. The
adlseq:objectives element is placed immediately after the imsss:objectives element. Using
our example above, the following code allows for the Completion Status of the SCOs
primary objective to be written to shared global obj-global-abc and the Progress Measure of
local objective obj-local-xyz to be written to global obj-global-xyz.
<imsss:objectives>
<imsss:primaryObjective objectiveID="obj-primary" satisfiedByMeasure="false">
<imsss:mapInfo targetObjectiveID="obj-global-abc"
writeSatisfiedStatus="true" />
</imsss:primaryObjective>
<imsss:objective objectiveID="obj-local-xyz " satisfiedByMeasure="false">
<imsss:mapInfo targetObjectiveID="obj-global-xyz"
writeSatisfiedStatus="true" />
</imsss:objective>
</imsss:objectives>
<adlseq:objectives>
< adlseq:objective objectiveID="obj-primary">
< adlseq:mapInfo targetObjectiveID="obj-global-abc"
writeCompletionStatus="true" />
</ adlseq:objective>
< adlseq:objective objectiveID="obj-local-xyz">
< adlseq:mapInfo targetObjectiveID="obj-global-xyz"
writeProgressMeasure="true" />
</ adlseq:objective>
</ adlseq:objectives>
Note: The last SCO to write a completion status to a global objective is the value
that finally gets stored there.
53
SCORM Best Practices Guide for Programmers
Sequencing & Navigation - Tracking across SCOs using Global Objectives
For objectives other than the primary, the cmi.objectives data model element is used. The
content must know the objectiveID of the local objective. It does not need to know the
global's ID as it always accesses it via the local objective to which it is mapped.
To access a local objective, you must search for it in the array of objectives. Using the
APIWrapper from the Starter Template, you use the findObjective JavaScript function.
var index=findObjective("obj-local-xyz");
Now that you have the index, the information may be accessed in cmi.objectives.
Note: The index must be searched for as the order in which they are found in the
objectives array is not guaranteed to follow the order defined in the manifest.
54
SCORM Best Practices Guide for Programmers
Sequencing & Navigation - Rollups
11. Rollups
11.1 Introduction
Activities in SCORM are organized in a hierarchical tree structure, called the Activity Tree.
There are an infinite number of structures and designs that are possible in SCORM 2004,
but at the end of the day, there needs to be a status reported for the root of this tree (i.e.,
the organization, described elsewhere (see Content Packages). The mechanism for
calculating and bubbling up statuses through the activity tree is called Rollups.
Rollup rules (see CAM 5.1.6 and SN 3.7) are used to report the status of children to their
parents. Each aggregation conceptually asks its children what their status is. The
aggregation can then determine its status and report its status up the tree until the root
aggregation knows the status of each of its children. Like standard sequencing rules, rollup
rules follow an if/then pattern using conditions defined from the limited vocabulary shown
in SN Figure 3.7a, reproduced below. Rollup rules apply to a defined subset of the children.
11.2 Examples
Some conceptual examples of rollups are:
55
SCORM Best Practices Guide for Programmers
Sequencing & Navigation - Rollups
Rollups always exist whether explicitly defined or not. If no rules are defined, the following
default rules will be applied in order.
1. Satisfied Status:
If all children have a known status (passed or failed) and any failed, then not
satisfied
Otherwise, If all satisfied, then satisfied
2. Completion Status:
If all children have a known completion status (completed or incomplete) and any
incomplete, then incomplete
Otherwise, if all completed, then completed
3. For numeric scores, the default is to calculate the weighted average of all the scores of
the children.
Once these four questions are answered, Rollup Rules may be written to satisfy them all.
Lets look at a few examples using the ones mentioned above:
<imsss:rollupRule childActivitySet="all">
<imsss:rollupConditions conditionCombination="any">
<imsss:rollupCondition condition="satisfied"/>
</imsss:rollupConditions>
<imsss:rollupAction action="satisfied"/>
</imsss:rollupRule>
56
SCORM Best Practices Guide for Programmers
Sequencing & Navigation - Rollups
</imsss:rollupRules>
<imsss:objectives> </imsss:objectives>
<imsss:sequencing>
As mentioned before, rollup rules only apply to aggregations. However, all activities may
participate in rollup in some way or another, even SCOs. Every activity has the opportunity
to contribute to the rollup of the parent aggregation or not. This is defined in the three
attributes of imsss:rollupRules.
Not all activities should contribute to rollup. Consider a series of lessons followed by an
assessment. You may program the course so that only the assessment contributes to the
Satisfied Status, while both the lessons and the assessment must be completed for the
course to be marked completed. In this case, each lesson will have
rollupObjectiveSatisfied set to "false".
Best Practice: Be careful when using scores in rollups. By default, scores of the
children are averaged and the resulting average score is assigned to the parent. In
practice, this may not be desired. When using scores, it may be more appropriate to set
objectiveMeasureWeight to 0.0 (doing this keeps rollups from setting a score of
any kind) and use global objectives (see Tracking across SCOs using Global Objectives)
when calculating and assigning a score to the parent.
57
SCORM Best Practices Guide for Programmers
Sequencing & Navigation - Rollups
Note: Globals always take precedence over Rollups. If there is ever a conflict in the
values of the statuses or scores, the Global wins.
58
SCORM Best Practices Guide for Programmers
Sequencing & Navigation - Exiting SCOs and Courses
12.1 Introduction
The concept of exiting learning content is an important one. Everything that gets launched
must eventually exit. There are many variations of exiting a course, that will appear to be
similar from the learner's perspective, but the results are quite unique.
12.2 Examples
There are multiple applications of the word "exit," so to make it clear, consider the
following use cases:
1. The learner has finished a SCO and is ready for the next activity.
2. The learner needs to "pause" in the course and return later.
3. The learner has completed all the activities in the course.
Each of these represents a way to "exit" an activity in the course. The resulting state of the
course is different for each scenario.
59
SCORM Best Practices Guide for Programmers
Sequencing & Navigation - Exiting SCOs and Courses
doSetValue("cmi.exit","suspend");
doTerminate();
From the learner's perspective, nothing happens when these JavaScript calls are made. The
content remains on the screen and the learner may continue to interact with it. It is up to
you as the developer, to remove the
Best Practice: If a SCO is exited in the content from the screen and provide
suspend exit state, it probably is a good idea to input to the learner regarding what
implement bookmarking. Check with your actions to take next.
ISD to see what bookmarking is required in
In many cases, the learner may exit the
the course. If cmi.exit is set to suspend, SCO at unexpected times. This can
additional data model elements are available occur if the learner clicks the LMS
to store information that may be retrieved navigation menu or table of contents
upon reentry into the course. See or simply closes the browser using the
Bookmarking for examples. window's close button. As the
programmer, you need to be prepared
for such cases using the browser's
event handling functions. For example, if the learner closes the browser, the following code
will show a confirmation dialog and suspend the SCO if closed.
function doOnUnload() {
Note: If the element adl.nav.request (see section 8.4.3, Navigating from within
Content) was set prior to terminating the SCO, the content will initiate the defined
navigation request. This is the only time content will be removed upon termination.
60
SCORM Best Practices Guide for Programmers
Sequencing & Navigation - Exiting SCOs and Courses
From within a SCO, when explicitly wanting to pause the course, the following code should
be used:
doSetValue("cmi.exit","suspend");
doSetValue("adl.nav.request", "suspendAll");
doTerminate();
This will exit the SCO, leaving it in a suspended state and exit the course, leaving the entire
course in a suspended state. At this
point, the entire learning session will
Best Practice: Two other requests, abandon be removed from the screen and
and abandonAll, will completely remove the control will be handed back to the LMS.
attempt as if it never took place. It is The course may be launched again and
suggested to use these with caution. will resume at the suspended SCO. If
the adl.nav.request element is not set,
then the content will remain on the screen. It is up to you as the programmer to provide
instructions to the learner on how to launch another activity.
The following code can be used in the sequencing section of the SCO where a course exit is
desired:
<imsss:sequencing>
<imsss:sequencingRules>
<imsss:postConditionRule>
<imsss:ruleConditions>
<imsss:ruleCondition condition = "satisfied"/>
</imsss:ruleConditions>
<imsss:ruleAction action = "exitAll"/>
</imsss:postConditionRule>
</imsss:sequencingRules>
</imsss:sequencing>
61
SCORM Best Practices Guide for Programmers
Sequencing & Navigation - Exiting SCOs and Courses
Best Practice: In many cases, it may be best to exit the course in all cases where the
learner closes the content window without using the provided navigation elements.
This is necessary in courses that use the Control Modes and hide the LMS navigation
controls as the Table of Contents is not accessible and the learner has no option to
choose a new activity.
62
SCORM Best Practices Guide for Programmers
Sequencing & Navigation - Exiting SCOs and Courses
selected for the learner. Content will need to be handled in a similar manner as above.
63
SCORM Best Practices Guide for Programmers
Sequencing & Navigation - Exiting SCOs and Courses
Note: Where does an exit condition fit into all this? An exit condition rule may be applied
at the cluster level to force an exit action on the cluster. Note that this is different than
actually exiting or leaving a SCO or cluster. This is a special action in sequencing that will
trigger the execution of post-condition rules in the cluster. In a cluster, these rules are
executed only if a child explicitly executes an exitParent action in its own post condition
rules or if the cluster's Exit Condition Rule executes an exit action. The following code will
cause a cluster's post-condition rules to be evaluated if the cluster is satisfied.
<imsss:sequencingRules>
<imsss:exitConditionRule>
<imsss:ruleConditions>
<imsss:ruleCondition condition="satisfied"/>
</imsss:ruleConditions>
<imsss:ruleAction action="exit"/>
</imsss:exitConditionRule>
</imsss:sequencingRules>
64
SCORM Best Practices Guide for Programmers
Resources, Tools, & Development Support - ADL SCORM Resources Overview
13.1 Background
ADL does not provide or recommend tools to build content. However, there are a few ADL
applications and documents that can assist in the development process. Located at
http://www.adlnet.gov/capabilities/scorm#tab-learn, they are:
SCORM 2004 4th Edition Document Suite (CAM, SN, & RTE SCORM Books)
SCORM 2004 4th Edition Sample Run-Time Environment (SRTE)
SCORM 2004 4th Edition Test Suite (TS)
ADL SCORM 2004 4th Edition Content Examples
"The SCORM Content Aggregation Model (CAM) book describes the components used in
a learning experience, how to package those components for exchange from system to
system, how to describe those components to enable search and discovery and how to
define sequencing information for the components. The SCORM CAM promotes the
consistent storage, labeling, packaging, exchange and discovery of learning content."
65
SCORM Best Practices Guide for Programmers
Resources, Tools, & Development Support - ADL SCORM Resources Overview
"The SCORM RTE book describes the learning management system (LMS) requirements
in managing the run-time environment (i.e., content launch process, standardized
communication between content and LMSs and standardized data model elements used
for passing information relevant to the learners experience with the content). The RTE
book also covers the requirements of Sharable Content Objects (SCOs) and their use of a
common application programming interface (API) and the SCORM Run-Time
Environment Data Model."
SCORM API
CMI Data Model Overview
66
SCORM Best Practices Guide for Programmers
Resources, Tools, & Development Support - ADL SCORM Resources Overview
Content Import
The SRTE will do a validation on your content package before importing it to ensure
conformance. For more detailed testing, use the SCORM 2004 4th Edition Test Suite (TS),
described below.
Content Delivery
The SRTE will allow you to launch your content and see how it will appear when running in
an LMS.
Note: All LMSes will provide a similar UI, but the look and feel will vary. The SRTE will
give you an idea and will also allow you to test your content in a browser environment.
67
SCORM Best Practices Guide for Programmers
Resources, Tools, & Development Support - ADL SCORM Resources Overview
68
SCORM Best Practices Guide for Programmers
Resources, Tools, & Development Support - ADL SCORM Resources Overview
The PITE shows how to implement SCORM 2004 web-based solutions beyond that of
JavaScript by looking at strategies of using SCORM 2004 with both Adobe Flash and
Adobe Director.
69
SCORM Best Practices Guide for Programmers
Cookbook - Bookmarking
Cookbook
In this section of the guide, we will address common questions about SCORM that have
surfaced over the years. We have included examples, tips, tricks, and best practices based
on expert input and experience.
14. Bookmarking
14.1 Background
Bookmarking is the common term used for allowing the learner to take a break and then
return to where they left off in the content. SCORM 2004 does not use the term
Bookmarking, but provides multiple ways to accomplish this.
cmi.location
The CMI Data Model has a location element (see RTE 4.2.14) that can be used to store a
string. It can hold 1000 characters.
Example:
// to set the data
doSetValue("cmi.location", "some data that you want to store");
// to retrieve it later
var bookmark = doGetValue("cmi.location");
// The programmer should use this bookmark variable to initialize the SCO
// and put the learner back where they left off. Nothing automatically happens
// here.
cmi.suspend_data
If 1000 characters are not enough, the CMI Data Model has an element to store the
suspended state of a SCO (see RTE 4.2.23). This element can also be used to store a string.
It can hold 64000 characters.
70
SCORM Best Practices Guide for Programmers
Cookbook - Bookmarking
Example:
// to set the data
doSetValue("cmi.suspend_data",
"some more data that you want to store");
// to retrieve it later
var bookmark = doGetValue("cmi.suspend_data");
// The programmer should use this bookmark variable to initialize the SCO
// and put the learner back where they left off. Nothing automatically happens
// here.
doSetValue("cmi.exit", "suspend");
doTerminate();
At this point, you will need to provide the learner with an option to choose another activity.
Typically, when the learner needs to suspend for a period of time, control should be
returned to the LMS. This is accomplished through a Suspend All navigation request (see
Navigation). This can be done by using the LMS-provided UI or the following JavaScript
code within the content:
doSetValue("cmi.exit", "suspend");
doSetValue("adl.nav.request", "suspendAll");
doTerminate();
71
SCORM Best Practices Guide for Programmers
Cookbook - Bookmarking
72
SCORM Best Practices Guide for Programmers
Cookbook - Prerequisites
15. Prerequisites
15.1 Background
A very common design pattern is that of a prerequisite. This is where the availability of
one activity is dependent on some external condition, typically the completion or
satisfaction of a prior activity.
For example, Figure 15.1 shows a flowchart with a series of lessons followed by an
assessment. The design dictates that the lessons be completed before the assessment is
accessible.
73
SCORM Best Practices Guide for Programmers
Cookbook - Prerequisites
<title>Lesson Aggregation</title>
<item identifier="LESSON1" identifierref="RES-SCO1"
isvisible="true">
<title>Child 1</title>
</item>
<item identifier="LESSON2" identifierref="RES-SCO2"
isvisible="true">
<title>Child 2</title>
</item>
<item identifier="ASSESSMENT" identifierref="RES-SCO3"
isvisible="true">
<title>Child 3</title>
</item>
<imsss:sequencing>
<imsss:controlMode flow="true" choice="true"/>
</imsss:sequencing>
</item>
<!--
Two important rules:
- If any are incomplete, the cluster is incomplete.
- If all are completed, the cluster is complete.
-->
<imsss:rollupRules rollupObjectiveSatisfied="true"
rollupProgressCompletion="true">
<imsss:rollupRule childActivitySet="any">
<imsss:rollupConditions conditionCombination="any">
<imsss:rollupCondition operator="not" condition="completed"/>
<imsss:rollupConditions>
<imsss:rollupAction action="incomplete"/>
</imsss:rollupRule>
<imsss:rollupRule childActivitySet="all">
<imsss:rollupConditions conditionCombination="any">
<imsss:rollupCondition condition="completed"/>
</imsss:rollupConditions>
<imsss:rollupAction action="complete"/>
</imsss:rollupRule>
</imsss:rollupRules>
74
SCORM Best Practices Guide for Programmers
Cookbook - Prerequisites
<imsss:objectives>
<!
Map that global to the primary of the aggregation so it gets the core status.
-->
<!--
Use the 4th Ed adlseq:objectives to capture if this aggregation is completed
in a global named obj-global-lessons.
-->
<adlseq:objectives>
<adlseq:objective objectiveID = "obj-primary">
<adlseq:mapInfo targetObjectiveID = "obj-global-lessons"
writeCompletionStatus="true" />
</adlseq:objective>
</adlseq:objectives>
<imsss:sequencing>
<imsss:sequencingRules>
<!--
You can now sequence off the completed status of the global.
You have to account for the "unknown" state of completion, so 2
conditions are needed
-->
<imsss:preConditionRule>
<imsss:ruleConditions conditionCombination="any">
<imsss:ruleCondition operator="not" condition="completed"
referencedObjective="obj-prereqs" />
<imsss:ruleCondition operator="not" condition="activityProgressKnown"
referencedObjective="obj-prereqs" />
</imsss:ruleConditions>
<imsss:ruleAction action="disabled" />
</imsss:preConditionRule>
</imsss:sequencingRules>
75
SCORM Best Practices Guide for Programmers
Cookbook - Prerequisites
<imsss:rollupRules rollupObjectiveSatisfied="true"
rollupProgressCompletion="true" />
<imsss:objectives>
<imsss:primaryObjective objectiveID="obj-primary"
satisfiedByMeasure="false"/>
<imsss:objective objectiveID="obj-prereqs" satisfiedByMeasure="false">
<imsss:mapInfo targetObjectiveID="obj-global-lessons"
readSatisfiedStatus="true"/>
</imsss:objective>
</imsss:objectives>
<imsss:deliveryControls objectiveSetByContent = "true"/>
<adlseq:objectives>
<!--
This lets you read the global's completion status and bring it into
scope
-->
<adlseq:objective objectiveID = "obj-prereqs">
<adlseq:mapInfo targetObjectiveID = "obj-global-lessons"
readCompletionStatus="true" />
</adlseq:objective>
</adlseq:objectives>
</imsss:sequencing>
76
SCORM Best Practices Guide for Programmers
Cookbook - Assessments
16. Assessments
16.1 Introduction
An assessment, otherwise known as a test, is a common type of content. It is implemented
as a normal SCO. However, SCORM provides some features that can assist in the tracking
and reporting of the learner's experience in the assessment. In this section, we will look at
the CMI Data Model of cmi.success_status, cmi.score, cmi.interactions and how they may be
utilized in assessments.
16.3 Examples
SCORM provides some functionality that is commonly used in assessments and will help
you implement almost any design your ISD provides. An assessment can be a simple set of
questions (multiple-choice, true/false, fill in the blank, etc.), or it can be a complex scenario
with detailed step-by-step processes that must be performed in a certain order. SCORM
does not impose any restrictions on assessments. An assessment in SCORM is treated just
like any other type of SCO.
77
SCORM Best Practices Guide for Programmers
Cookbook - Assessments
Many assessments are also given a numeric score. The calculated numeric score is stored
in the LMS using the cmi.score object:
For more details regarding SCORM and scoring, refer to the section on Status and Scoring.
16.4.2 Interactions
In some assessments, detailed information about each assessed item is also captured and
stored. To track details about each tested item in an assessment, the data model element
cmi.interactions is used (see RTE 4.2.9). Interactions allow a SCO to send data to the
Learning Management System (LMS) about a learners performance in an interoperable
way. It provides a detailed model for designers and programmers to collect metrics about
learner responses or performance within a SCO, particularly detailed data related to
performance on assessments such as expected correct response, the learners response,
duration taken to respond, etc.
The cmi.interactions data model element is an array type object consisting of many
interactions. A single interaction describes a tested item. An interaction is represented by
dot notation similar to other cmi data model elements. Refer to the section on CMI Data
Model for details on this syntax.
The most common elements used in the cmi.interaction object are shown below. See RTE
Table 4.2.9a for details of the syntax used in creating an interaction.
The interactions are a collection of information stored in arrays. The cmi data-model uses a
zero-based index position (n) in the dot-notation to separate the data. For example, if there
were ten assessment items, the identifier of the third one would be accessed like this:
cmi.interactions.2.id
78
SCORM Best Practices Guide for Programmers
Cookbook - Assessments
A - Los Angeles
B - Santa Fe
C - Austin
D - New York City
This example is then repeated for each tested item in the assessment.
79
SCORM Best Practices Guide for Programmers
Cookbook - Assessments
80
SCORM Best Practices Guide for Programmers
Cookbook - The Menu SCO
17.1 Background
As mentioned in the section on Navigation, the LMS will provide some rudimentary
methods for the learner to navigate the activity tree of a course. The Table of Contents is a
requirement of SCORM and is useful in many situations. However, it's not customizable
and has a few notable shortcomings:
All these issues keep the Table of Contents from being a viable navigation element in some
cases. There is a design pattern, which we will call the Menu SCO, which may be used to
help.
81
SCORM Best Practices Guide for Programmers
Cookbook - The Menu SCO
82
SCORM Best Practices Guide for Programmers
Cookbook - The Menu SCO
Again, this is a time to work with your ISD to determine what needs to be shown. It's
important to choose features that will be engaging and add value.
You also have to make sure your content updates the global objectives. If the objectives are
mapped to the content's primary objectives, then ensure the content is updating the
necessary CMI Data Model values that will update the global. (See CMI Data Model and
Globals.)
To target this SCO from our Menu SCO, the following JavaScript code is implemented within
the Menu SCO HTML file:
doSetValue("adl.nav.request", "{target=SCO-PERSIAN-GULF-1990}jump"};
doTerminate();
83
SCORM Best Practices Guide for Programmers
Cookbook - The Menu SCO
The LMS will immediately terminate the Menu SCO and deliver the content for the Persian
Gulf War.
The value of the menu SCO may be passed from the manifest file by using the
adlcp:dataFromLMS element as shown in this example:
<item identifier="SCO1" identifierref="RESOURCE1">
<title>Lesson 1</title>
<adlcp:dataFromLMS>NAV-MENU</adlcp:dataFromLMS>
</item>
And in JavaScript:
84
SCORM Best Practices Guide for Programmers
Cookbook - Sequencing Collections
18.1 Background
Sequencing can be complex and XML can be very verbose. This combination can make for
rather lengthy manifest files. Many times the patterns in sequencing will be repeated
throughout a course. When these patterns emerge, Sequencing Collections can come in
handy to reduce the size and redundancy of the XML. This makes the manifest more
readable and maintainable as functionality is encapsulated in one location.
<imsss:sequencing>
<imsss:sequencingRules>
<imsss:postConditionRule>
<imsss:ruleConditions conditionCombination="any">
<imsss:ruleCondition condition="satisfied" />
</imsss:ruleConditions>
<imsss:ruleAction action="exitParent" />
</imsss:postConditionRule>
</imsss:sequencingRules>
<imsss:rollupRules rollupObjectiveSatisfied="true"
rollupProgressCompletion="true" />
<imsss:objectives>
<imsss:primaryObjective objectiveID="obj-primary"
satisfiedByMeasure="false">
<imsss:mapInfo targetObjectiveID="g-obj-item-one-1"
writeSatisfiedStatus="true"/>
</imsss:primaryObjective>
</imsss:objectives>
<imsss:deliveryControls objectiveSetByContent = "true"
completionSetByContent="true"/>
</imsss:sequencing>
Imagine having a series of twenty SCOs with this same flow pattern. There would be over
300 lines of repeated XML for the sequencing. To solve this, we create a
sequencingCollection element that encapsulates the repeated components of the XML.
<imsss:sequencingCollection>
<imsss:sequencing ID="lesson_seq_rules">
<!-- exit parent when terminating, if satisfied -->
<imsss:sequencingRules>
<imsss:postConditionRule>
<imsss:ruleConditions conditionCombination="any">
<imsss:ruleCondition condition="satisfied" />
</imsss:ruleConditions>
85
SCORM Best Practices Guide for Programmers
Cookbook - Sequencing Collections
<!-- Note that the objectives are not included here! -->
<imsss:deliveryControls completionSetByContent="true"
objectiveSetByContent="true"/>
</imsss:sequencing>
</imsss:sequencingCollection>
This XML for the collection is placed at the bottom of the manifest file, just before the
closing manifest tag, </manifest>.
Note: As noted in the XML comment, the objectives element is not included. The
collection only contains repeated bits of the XML. Any additional elements and rules
will be left in the original sequencing section and will be merged at runtime.
Going back to our original sequencing sections, we can replace them with this code:
<imsss:sequencing IDRef="lesson_seq_rules">
<!-- the objectives element is unique per activity, therefore it is
not abstracted out into the collection -->
<imsss:objectives>
<imsss:primaryObjective objectiveID="obj-primary"
satisfiedByMeasure="false">
<imsss:mapInfo targetObjectiveID="g-obj-item-one-1"
writeSatisfiedStatus="true"/>
</imsss:primaryObjective>
</imsss:objectives>
</imsss:sequencing>
In our example, we have taken a seventeen-line segment of XML and reduced it to seven
lines. Doesn't seem like much, but this was a simple example and it adds up the more times
it's repeated. If you have ten SCOs like this, the savings is 100 lines. But the bigger win is
that there is now only one place to edit to alter the behavior across the course. There is
much less room for mistakes.
Note: If you are using a tool to produce your XML, it may or may not support
collections. You will have to refer to the specific documentation of the tool to determine
if this is a viable option for you.
86
SCORM Best Practices Guide for Programmers
Glossary of SCORM Terminology
Asset: Assets are electronic representations of media, text, images, sounds, web pages and
other pieces of data that can be delivered to a Web client. They do not communicate with
the LMS directly. Assets, like the sharable content objects (SCOs) in which they appear, are
highly reusable. In order to be reused, assets are described using metadata so that they are
both searchable and discoverable in online content repositories.
Certification or Certified: "Certification" indicates that materials have been tested by an
independent third party to assess conformance with the guidelines established in SCORM.
"Certification" indicates a successful testing by the Conformance Test Suite. All "certified"
products are "conformant."
Choice: A control mode that defines if the learner may select an activity of this cluster
through a choice navigation request.
87
SCORM Best Practices Guide for Programmers
Glossary of SCORM Terminology
Data Model Elements: A set of information about a learners performance in, and
interaction with, the instructional content initiated by the SCO and stored in an LMS. Data
model elements are made interoperable by the SCORM Run Time Environment Data Model.
The SCORM data model elements allow the LMS to collect data on the learners and their
progress through the SCO. This data can then be used by the LMS for reporting purposes
and to offer personalized content.
Durable: Durable content does not require modification to operate as versions of software
systems and platforms are changed or upgraded.
Flow: A control mode that defines if the LMS may sequence move activities of this cluster
using SCORM 2004 Sequencing.
Interactions: An element of the CMI data model used to track learner interaction with
content. Typically used to track item level interactions in assessments.
88
SCORM Best Practices Guide for Programmers
Glossary of SCORM Terminology
Normalized Measure: The numeric value held in global objective. Typically used as a
score and maps to the "score.scaled" element of the CMI data model when accessed from
within the SCO.
Objective Map: Used to define how a local objective is mapped to a global objective.
Organization: The organization is the part of a content package where SCOs are ordered
into a structure and sequencing behaviors are assigned to them. The organization outlines
89
SCORM Best Practices Guide for Programmers
Glossary of SCORM Terminology
the entire structure you have created for your content. The organization provides order to
the otherwise unordered collection of SCOs and their metadata.
Primary Objective: Used to define the objective that contributes to the rollup of an
activity.
Progress Measure: The number used to track progress for an activity. This number is
represented by a scaled decimal number between 0 and 1.
Reuse: Reused content is existing content used in new or different contexts or applications.
SCORM content can be reused in multiple ways: redeployed, repurposed, rearranged, or
rewritten.
Rollup Rules: Rules used to define how tracking data is propagated up from a child activity
to its parent.
Shareable Content Object Reference Model (SCORM): SCORM is a model that references
and integrates a set of interrelated technical standards, specifications, and guidelines
designed to meet high-level requirements for e-learning content and systems.
Sequencing: Sequencing is similar to the ISD term branching in that it describes and
prescribes the manner in which learners receive content. SCORM 2004 sequencing defines
a method for representing the intended behavior of an authored learning experience such
that any LMS will sequence discrete learning activities consistently, based upon rules
created by the designer.
Sharable Content Object (SCO): In general terms, a SCO is a collection of assets that
becomes an independent, defined piece of instructional material. SCOs are the smallest
logical unit of instruction you can deliver and track via a learning management system
(LMS).
90
SCORM Best Practices Guide for Programmers
SCORM 2004 API Wrapper
**************************************************************************
*SCORM_2004_APIwrapper.js code is licensed under the Creative Commons
Attribution-ShareAlike 3.0 Unported License.
- Visit http://creativecommons.org/licenses/by-sa/3.0/
- Or send a letter to
Creative Commons, 444 Castro Street, Suite 900, Mountain View,
California, 94041, USA.
- http://creativecommons.org/licenses/by-sa/3.0/legalcode
**************************************************************************
- Share Alike: If you alter, transform, or build upon this work, you
may distribute the resulting work only under the same or similar
license to this one.
91
SCORM Best Practices Guide for Programmers
SCORM 2004 API Wrapper
- Waiver: Any of the above conditions can be waived if you get permission
from the copyright holder.
- Public Domain: Where the work or any of its elements is in the public
domain under applicable law, that status is in no way affected by the
license.
- Other Rights: In no way are any of the following rights affected by the
license:
* Rights other persons may have either in the work itself or in how
the work is used, such as publicity or privacy rights.
- Notice: For any reuse or distribution, you must make clear to others the
license terms of this work.
*************************************************************************/
/*************************************************************************
** Usage: Executable course content can call the API Wrapper
** functions as follows:
**
** javascript:
** var result = doInitialize();
** if (result != true)
** {
** // handle error
** }
**
** authorware:
** result := ReadURL("javascript:doInitialize()", 100)
**
** director:
** result = externalEvent("javascript:doInitialize()")
**
**
*************************************************************************/
var output = window.console; // output can be set to any object that has a
log(string) function
// such as: var output = { log:
function(str){alert(str);} };
/*************************************************************************
**
92
SCORM Best Practices Guide for Programmers
SCORM 2004 API Wrapper
** Function: doInitialize()
** Inputs: None
** Return: true if the initialization was successful, or
** false if the initialization failed.
**
** Description:
** Initialize communication with LMS by calling the Initialize
** function which will be implemented by the LMS.
**
*************************************************************************/
function doInitialize()
{
if (initialized) return "true";
if (result.toString() != "true")
{
var err = ErrorHandler();
message("Initialize failed with error code: " + err.code);
}
else
{
initialized = true;
}
return result.toString();
}
/******************************************************************************
**
** Function doTerminate()
** Inputs: None
** Return: true if successful
** false if failed.
**
** Description:
** Close communication with LMS by calling the Terminate
** function which will be implemented by the LMS
**
*******************************************************************************
/
function doTerminate()
{
if (! initialized) return "true";
93
SCORM Best Practices Guide for Programmers
SCORM 2004 API Wrapper
initialized = false;
return result.toString();
}
/******************************************************************************
**
** Function doGetValue(name)
** Inputs: name - string representing the cmi data model defined category or
** element (e.g. cmi.learner_id)
** Return: The value presently assigned by the LMS to the cmi data model
** element defined by the element or category identified by the name
** input value.
**
** Description:
** Wraps the call to the GetValue method
**
*******************************************************************************
/
function doGetValue(name)
{
var api = getAPIHandle();
var result = "";
if (api == null)
{
message("Unable to locate the LMS's API Implementation.\nGetValue was not
successful.");
}
else if (!initialized && ! doInitialize())
{
var err = ErrorHandler();
message("GetValue failed - Could not initialize communication with the
LMS - error code: " + err.code);
}
else
{
result = api.GetValue(name);
/******************************************************************************
**
** Function doSetValue(name, value)
** Inputs: name -string representing the data model defined category or
94
SCORM Best Practices Guide for Programmers
SCORM 2004 API Wrapper
** element value -the value that the named element or category will be
** assigned
** Return: true if successful
** false if failed.
**
** Description:
** Wraps the call to the SetValue function
**
*******************************************************************************
/
function doSetValue(name, value)
{
var api = getAPIHandle();
var result = "false";
if (api == null)
{
message("Unable to locate the LMS's API Implementation.\nSetValue was not
successful.");
}
else if (!initialized && !doInitialize())
{
var error = ErrorHandler();
message("SetValue failed - Could not initialize communication with the
LMS - error code: " + error.code);
}
else
{
result = api.SetValue(name, value);
if (result.toString() != "true")
{
var err = ErrorHandler();
message("SetValue("+name+", "+value+") failed. \n"+ err.code + ": " +
err.string);
}
}
return result.toString();
}
/******************************************************************************
**
** Function doCommit()
** Inputs: None
** Return: true if successful
** false if failed
**
** Description:
** Commits the data to the LMS.
**
*******************************************************************************
/
function doCommit()
{
var api = getAPIHandle();
var result = "false";
if (api == null)
{
message("Unable to locate the LMS's API Implementation.\nCommit was not
successful.");
}
else if (!initialized && ! doInitialize())
{
var error = ErrorHandler();
95
SCORM Best Practices Guide for Programmers
SCORM 2004 API Wrapper
return result.toString();
}
/******************************************************************************
**
** Function doGetLastError()
** Inputs: None
** Return: The error code that was set by the last LMS function call
**
** Description:
** Call the GetLastError function
**
*******************************************************************************
/
function doGetLastError()
{
var api = getAPIHandle();
if (api == null)
{
message("Unable to locate the LMS's API Implementation.\nGetLastError was
not successful.");
//since we can't get the error code from the LMS, return a general error
return _GeneralException.code;
}
return api.GetLastError().toString();
}
/******************************************************************************
**
** Function doGetErrorString(errorCode)
** Inputs: errorCode - Error Code
** Return: The textual description that corresponds to the input error code
**
** Description:
** Call the GetErrorString function
**
*******************************************************************************
*/
function doGetErrorString(errorCode)
{
var api = getAPIHandle();
if (api == null)
{
message("Unable to locate the LMS's API Implementation.\nGetErrorString
was not successful.");
return _GeneralException.string;
}
return api.GetErrorString(errorCode).toString();
96
SCORM Best Practices Guide for Programmers
SCORM 2004 API Wrapper
/******************************************************************************
**
** Function doGetDiagnostic(errorCode)
** Inputs: errorCode - Error Code(integer format), or null
** Return: The vendor specific textual description that corresponds to the
** input error code
**
** Description:
** Call the LMSGetDiagnostic function
**
*******************************************************************************
/
function doGetDiagnostic(errorCode)
{
var api = getAPIHandle();
if (api == null)
{
message("Unable to locate the LMS's API Implementation.\nGetDiagnostic
was not successful.");
return "Unable to locate the LMS's API Implementation. GetDiagnostic was
not successful.";
}
return api.GetDiagnostic(errorCode).toString();
}
/******************************************************************************
**
** Function ErrorHandler()
** Inputs: None
** Return: The current error
**
** Description:
** Determines if an error was encountered by the previous API call
** and if so, returns the error.
**
** Usage:
** var last_error = ErrorHandler();
** if (last_error.code != _NoError.code)
** {
** message("Encountered an error. Code: " + last_error.code +
** "\nMessage: " + last_error.string +
** "\nDiagnostics: " + last_error.diagnostic);
** }
*******************************************************************************
/
function ErrorHandler()
{
var error = {"code":_NoError.code, "string":_NoError.string,
"diagnostic":_NoError.diagnostic};
var api = getAPIHandle();
if (api == null)
{
message("Unable to locate the LMS's API Implementation.\nCannot determine
LMS error code.");
error.code = _GeneralException.code;
error.string = _GeneralException.string;
error.diagnostic = "Unable to locate the LMS's API Implementation. Cannot
determine LMS error code.";
return error;
}
97
SCORM Best Practices Guide for Programmers
SCORM 2004 API Wrapper
return error;
}
/******************************************************************************
**
** Function getAPIHandle()
** Inputs: None
** Return: value contained by APIHandle
**
** Description:
** Returns the handle to API object if it was previously set,
** otherwise it returns null
**
*******************************************************************************
/
function getAPIHandle()
{
if (apiHandle == null)
{
apiHandle = getAPI();
}
return apiHandle;
}
/******************************************************************************
**
** Function findAPI(win)
** Inputs: win - a Window Object
** Return: If an API object is found, it's returned, otherwise null is
** returned
**
** Description:
** This function looks for an object named API_1484_11 in parent and opener
** windows
**
*******************************************************************************
/
function findAPI(win)
{
var findAPITries = 0;
while ((win.API_1484_11 == null) && (win.parent != null) && (win.parent !=
win))
{
findAPITries++;
98
SCORM Best Practices Guide for Programmers
SCORM 2004 API Wrapper
win = win.parent;
}
return win.API_1484_11;
}
/******************************************************************************
**
** Function getAPI()
** Inputs: none
** Return: If an API object is found, it's returned, otherwise null is
** returned
**
** Description:
** This function looks for an object named API_1484_11, first in the current
** window's frame hierarchy and then, if necessary, in the current window's
** opener window hierarchy (if there is an opener window).
**
*******************************************************************************
/
function getAPI()
{
var theAPI = findAPI(window);
if ((theAPI == null) && (window.opener != null) && (typeof(window.opener) !=
"undefined"))
{
theAPI = findAPI(window.opener);
}
if (theAPI == null)
{
message("Unable to find an API adapter");
}
return theAPI
}
/******************************************************************************
**
** Function findObjective(objId)
** Inputs: objId - the id of the objective
** Return: the index where this objective is located
**
** Description:
** This function looks for the objective within the objective array and returns
** the index where it was found or it will create the objective for you and
** return the new index.
**
*******************************************************************************
/
function findObjective(objId)
{
var num = doGetValue("cmi.objectives._count");
var objIndex = -1;
if (objIndex == -1) {
message("Objective " + objId + " not found.");
objIndex = num;
99
SCORM Best Practices Guide for Programmers
SCORM 2004 API Wrapper
/******************************************************************************
** NOTE: This is a SCORM 2004 4th Edition feature.
**
** Function findDataStore(id)
** Inputs: id - the id of the data store
** Return: the index where this data store is located or -1 if the id wasn't
** found
**
** Description:
** This function looks for the data store within the data array and returns
** the index where it was found or returns -1 to indicate the id wasn't found
** in the collection.
**
** Usage:
** var dsIndex = findDataStore("myds");
** if (dsIndex > -1)
** {
** doSetValue("adl.data." + dsIndex + ".store", "save this info...");
** }
** else
** {
** var appending_data = doGetValue("cmi.suspend_data");
** doSetValue("cmi.suspend_data", appending_data + "myds:save this info");
** }
*******************************************************************************
/
function findDataStore(id)
{
var num = doGetValue("adl.data._count");
var index = -1;
if (index == -1)
{
message("Data store " + id + " not found.");
}
}
return index;
}
/******************************************************************************
**
** Function message(str)
** Inputs: String - message you want to send to the designated output
100
SCORM Best Practices Guide for Programmers
SCORM 2004 API Wrapper
** Return: none
** Depends on: boolean debug to indicate if output is wanted
** object output to handle the messages. must implement a function
** log(string)
**
** Description:
** This function outputs messages to a specified output. You can define your
** own output object. It will just need to implement a log(string) function.
** This interface was used so that the output could be assigned the
** window.console object.
*******************************************************************************
/
function message(str)
{
if(debug)
{
output.log(str);
}
}
101
SCORM Best Practices Guide for Programmers
Index
Index
activity tree....................................................... 19 learning management systems (LMSs) . 10
aggregation ..................................................... 13 manifest ............................................................. 17
aggregations ..................................................... 10 manifest file ...................................................... 17
API Wrapper ....................... 21, 24, 29, 54, 91 navigation .................................................. 35, 39
assessments.................................................... 77 objective mapping.......................................... 58
assets................................................................... 10 objectives ......................................................... 58
authoring tools ................................................ 17 organization ..................................................... 14
bookmarking ...................................... 59, 68, 70 organizations ................................................... 10
branching......................................................... 43 post-condition ................................................. 44
CAM book .......................................................... 65 precondition..................................................... 44
choice................................................................... 35 prerequisites ................................................. 73
cluster ................................................................. 13 RELOAD ............................................................. 17
CMI ....................................................................... 24 resources .................................................. 19, 65
conditional branching............................... 43 resuming a course .......................................... 59
conformance .................................................... 68 rollups................................................................. 58
content aggregation ............................... 10, 17 Run-Time Environment ........................... 66
content package ....................................... 10, 17 scoring ............................................................... 31
control mode.................................................. 35 SCORM Books .................................................. 65
course ................................................................. 15 SCORM-conformant e-learning .................... 7
curricula............................................................. 10 sequencing ...................................................... 43
curriculum ........................................................ 15 sequencing and navigation ......................... 66
dependency ...................................................... 20 Sharable Content Object (SCO) ................. 12
exit condition ................................................... 44 status ................................................................... 31
first SCORM course ........................................... 7 suspend .............................................................. 59
flow ...................................................................... 35 Test Suite, ADL ................................................ 67
interactions ...................................................... 77 XML ...................................................................... 17
item element .................................................... 19 zip file ................................................................. 17
launch ................................................................. 19
102