wiki:BoltRef

Version 9 (modified by davea, 16 years ago) (diff)

--

Bolt reference manual

A Bolt course consists of:

  • Lessons: any web-based teaching material
  • Exercises, used for reinforcement and/or assessment.
  • A course document describing the order in which lessons and exercises are shown.

Lessons

A Lesson contains instructional material. It may be either an HTML file or PHP script. It may contain embedded audio, video, Flash, or any other content. Some restrictions:

  • It shouldn't contain enclosing <html> or <body> tags (Bolt will supply these, as well as navigational header and footer).
  • It shouldn't contain any hyperlinks (Bolt will supply navigational links).

If a lesson is implemented as a PHP script, information about the student is available to it in a global variable $student, This information may be used to customize the page. The available information is:

$student.sex;    // 0=unknown, 1=male, 2=female
$student.birth_year;
$student.country;
$student.name;
$student.bandwidth;  // 1: <100Kb; 2: <1Mb; 3: <10Mb etc.
$student.has_audio_output;    // 1: no, 2: yes
$student.has_audio_input;

For example, suppose you want to use a larger font for students over 50:

if ($student.age > 50) {
    echo "<style>
        body {font-size: large;}
        </style>
    ";
}

Note: an alternative way to vary content based on student attributes is to use separate lesson files, selected in the course document.

Exercises

Exercises are PHP scripts that call Bolt API functions. Here's an example consisting of a multiple-choice question:

<?php
echo 'Conifers are so named because:';
bolt_exclusive_choice(
   array(
      'They carry their seeds in cones.'
      'They are cone-shaped.',
      'They originated during the Coniceous era.',
   ),
);
?>

The correct choice is the first element of the array. Each time the question is shown, the choices are presented in a random order.

Here's an example that shows an image; a correct answer is a click in the indicated subrectangle.

<?php
echo "Click on the dog's nose:<p>";
bolt_image_rect(
   'dog.jpg',
   array(100, 60, 110, 70)
);
?>

Bolt supplies functions for other types of questions, such as inclusive multiple-choice and fill-in-the-blank. An exercise can include multiple questions.

Course documents

The structure of a Bolt course is defined by a PHP script. The script calls Bolt API functions to create a hierarchy of "units". Each unit has a "name", used to identify the unit within the course (it is now shown to students).

The basic types of units are lessons and exercises. Each has accompanying filename. For example, the following course consists of a single lesson:

<?php
return lesson(
    name('lesson 1'),
    title('The ecology of a conifer forest'),
    filename('lesson_1.php'),
    reading_level(11.0),
    detail_level(.5)
);
?>

Nesting and functions

Names and state

Control structures

Sequences

Course documents can also have various 'control structures'. The most basic of these is a 'sequence', which contains a set of units that are shown in sequence. Here's an example of a course with two lessons followed by an exercise:

<?php
return sequence(
    name('course'),
    lesson(
        name('lesson 1'),
        filename('bolt_sample_lesson1.php')
    ),
    lesson(
        name('lesson 2'),
        filename('bolt_sample_lesson2.php')
    ),
    exercise(
        name('exercise 1'),
        filename('bolt_sample_exercise1.php')
    ),
);
?>

Random

The random control structure selects randomly from a set of units.

<?php
return select(
    name('course'),
    lesson(
        name('lesson 1'),
        filename('bolt_sample_lesson1.php')
    ),
    lesson(
        name('lesson 2'),
        filename('bolt_sample_lesson2.php')
    ),
);
?>

Select

The select structure takes a set of units and a 'valuator' function. The valuator function returns the 'value' (i.e. the likely benefit) of showing the unit to the student. The unit for which this value is greatest is shown.

<?php
function value($unit) {
    global $student;
    return abs($student->verbal_level - $unit->verbal_level);
}

return select(
    name('course'),
    valuator('value'),
    lesson(
        name('lesson 1'),
        filename('bolt_sample_lesson1.php')
    ),
    lesson(
        name('lesson 2'),
        filename('bolt_sample_lesson2.php')
    ),
);
?>

Exercise set

The 'exercise_set' structure specifies a set of exercises and a value 'num_to_show'. This number of exercises is chosen randomly and administered.

exercise_set(
    name('exer_set'),
    num_to_show(1),
    exercise(
        name('exercise 1'),
        filename('file_1.php')
    ),
    exercise(
        name('exercise 1'),
        filename('file_1.php')
    ),
    review(.3, basic_review()),
    review(.7, int_review()),
    refresh(array(7,14,28))
);

Review

Optionally, one or more review attributes can be given. Each specifies a grade threshold X and a list of review units. If the student's grade on the exercise set is less than some Y,

Memory refresh