87 | | The structure of a Bolt course is defined by a PHP script. |
88 | | The script calls Bolt API functions to create a hierarchy of "units". |
89 | | Each unit has a "name", used to identify the unit within the course |
90 | | (it is now shown to students). |
91 | | |
92 | | The basic types of units are lessons and exercises. |
93 | | Each has accompanying filename. |
| 86 | The structure of a Bolt course is defined by a PHP script called a '''course document'''. |
| 87 | The script calls Bolt API functions to create a hierarchy of "units" of two types: |
| 88 | |
| 89 | * '''Basic units''': lessons and exercises |
| 90 | * '''Control structures''' representing sets of units, together with rules the govern their use. |
| 91 | |
| 92 | The function '''lesson()''' specifies a lesson. |
| 106 | The parameters of the lesson are: |
| 107 | || name || the "logical name", used as an internal identifier but not visible to students; see "Names and state" below || |
| 108 | || title || a name shown to students || |
| 109 | || filename || the file containing lesson content || |
| 110 | || reading_level, detail_level || optional attributes of the lesson || |
| 111 | |
| 112 | Similarly, '''exercise()''' specifies an exercise: |
| 113 | {{{ |
| 114 | <?php |
| 115 | return exercise( |
| 116 | name('exercise 1'), |
| 117 | filename('bolt_sample_exercise1.php') |
| 118 | ); |
| 119 | ?> |
| 120 | }}} |
| 121 | |
| 122 | There are various control structures; see below. |
| 123 | The simples one is a 'sequence', |
| 124 | which specifies a set of units that are shown in sequence. |
| 125 | Here's an example of a course with two lessons followed by an exercise: |
| 126 | {{{ |
| 127 | <?php |
| 128 | return sequence( |
| 129 | name('course'), |
| 130 | lesson(...), |
| 131 | lesson(...), |
| 132 | exercise(...), |
| 133 | ); |
| 134 | ?> |
| 135 | }}} |
| 136 | |
| 137 | == Changing course documents == |
| 138 | |
| 139 | Course documents need not be static. |
| 140 | You can change them whenever you want (that's the point of Bolt). |
| 141 | |
| 142 | What happens if a course changes while |
| 143 | students are in the middle of it? |
| 144 | The general answer is the Bolt recovers as gracefully as possible. |
| 145 | For each student, Bolt maintains a "course state" - a set of data, |
| 146 | for each control structure that the student has visited in the course, |
| 147 | describing the student's "position" in that control structure. |
| 148 | When a student clicks the Next button, or resumes the course after an interval, |
| 149 | Bolt uses the course state to decide what item to display next. |
| 150 | |
| 151 | For example, suppose your course has a sequence with 3 elements, |
| 152 | with logical names (red, yellow, blue). |
| 153 | and a student is on the third. |
| 154 | The course state for the sequence consists of two items: (blue, 2). |
| 155 | 'blue' is the logical name of the third element, and the index number 2 |
| 156 | (indicates that the student has completed 2 units in the sequence). |
| 157 | |
| 158 | If the student resumes the course, Bolt will find their place in |
| 159 | the sequence first by looking up the logical name; |
| 160 | if it is not found, then it will use the index number. |
| 161 | For example: |
| 162 | * If you change the sequence to (red, blue, green, yellow) then the student will be shown the units blue, green, and yellow. |
| 163 | * If you change the sequence to (red, yellow, green) then the student will be shown the unit 'green'. |
| 164 | * If you change the sequence to (red, yellow) then the student will have finished the sequence. |
| 165 | |