LM-Light: A New E-Learning Standard
About LM-Light Courses Learning Management Systems More Info

Introduction

The LM-Light Standard
 - Course Structure
 - LM-Light Tags
 - Starting a Course
 - On Each Page
 - Exiting a Course
 - Starting a Test
 - Saving a Test Score
 - Course Completion
 - Configuration File

Course Development
 - Development Environment
 - Using a Text Editor
 - Including Tests
 - Using PowerPoint
    - Option 1 - PDF
    - Option 2 - GIF/JPG
    - Option 3 - HTML
 - Using Lectora
 - Download Tools
 - Diagnosing Problems

Home Page

LM-Light Standard : Creating Courses : Saving a Test Score

When a course has been completed, you have the option to pass back the score to the LMS. Note that this is not always necessary. For instance, if a course simply has an assertion question at the end (e.g. "Yes, I agree to follow this policy"), a percentage score is meaningless.

The test score can be transferred using this LM-Light call:

<?php LMsetTestScore(); ?>

The test score should be passed to the page containing the LMsetTestScore tag as a GET or POST variable.

Examples

Here is a a simple example that uses JavaScript for the test. First, here is the page that holds and grades the test:

<?php require "LM-Light.php"; ?>
<html>
<head>
<title></title>
</head>
<body>

<h1>Mastery Test</h1>

<script language="javascript">
  function getAnswer(question) {
    var radio = document.forms['mtest'].elements[question];
    for (var i=0; i < radio.length; i++) {
      if (radio[i].checked) {
        var answer = radio[i].value;
      }
    }
    return answer;
  }
  function gradeTest() {
    var score = 0;
    if (getAnswer('answer1') == 'A') { score = score + 50; }
    if (getAnswer('answer2') == 'C') { score = score + 50; }
    if (score == 100) {
      document.location.href = 'passed.html?LMtestScore='+score;
    }
    else {
      document.location.href = 'failed.html?LMtestScore='+score;
    }
  }
</script>

<form onsubmit="gradeTest();" name="mtest">

<p>Question 1: What is the capital of France?
<blockquote>
  <br><input type="radio" name="answer1" value="A"> A: Paris
  <br><input type="radio" name="answer1" value="B"> B: London
  <br><input type="radio" name="answer1" value="C"> C: Moscow
</blockquote>

<p>Question 2: What is the State Capital of Washington?
<blockquote>
  <br><input type="radio" name="answer2" value="A"> A: Seattle
  <br><input type="radio" name="answer2" value="B"> B: Spokane
  <br><input type="radio" name="answer2" value="C"> C: Olympia
</blockquote>

<p><input type="submit" value="Grade Test">

</form>

</body>
</html>

Now we add two pages - one for the test having been passed (passed.html) and the other for the test having been failed (failed.html). Here's 'failed.html':

<?php require "LM-Light.php"; ?>
<?php LMsetTestScore(); ?>
<html>
<head>
<title></title>
</head>
<body>

<h1>Test Results</h1>
<p>Sorry ... you failed. Please try again.

</body>
</html>

And here's 'passed.html':

<?php require "LM-Light.php"; ?>
<?php LMsetTestScore(); ?>
<?php LMsetCourseComplete(); ?>
<html>
<head>
<title></title>
</head>
<body>

<h1>Test Results</h1>
<p>Well done ... you passed!

</body>
</html>

 

Copyright & Licensing Information
Unless otherwise stated, material in this website is Copyright, Addison Robson LLC. Use of the website content for commercial and non-commercial purposes is permitted under Creative Commons licenses. For more information, please consult [this page] or use [this form] to contact us.
Creative Commons License