[[PageOutline]] = 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 or
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 " "; } }}} 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: {{{ }}} 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. {{{ "; 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: {{{ }}} Attributes can be associated with units, e.g.: {{{ }}} == 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: {{{ }}} === Random === The '''random''' control structure selects randomly from a set of units. {{{ }}} === 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. {{{ 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 ==