Changes between Version 4 and Version 5 of BoltRef
- Timestamp:
- Dec 4, 2007, 6:54:31 PM (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
BoltRef
v4 v5 91 91 return lesson( 92 92 name('lesson 1'), 93 filename('lesson_1.php') ;93 filename('lesson_1.php'), 94 94 ); 95 95 ?> 96 96 }}} 97 98 Attributes can be associated with units, e.g.: 99 {{{ 100 <?php 101 return lesson( 102 name('lesson 1'), 103 filename('lesson_1.php'), 104 reading_level(11.0), 105 detail_level(.5) 106 ); 107 ?> 108 }}} 109 97 110 === Sequences === 111 112 Course documents can also have various 'control structures'. 113 The most basic of these is a 'sequence', 114 which contains a set of units that are shown in sequence. 98 115 Here's an example of a course with two lessons followed by an exercise: 99 116 {{{ … … 117 134 }}} 118 135 119 Course items can be grouped into '''sets'''; for example: 136 === Random === 137 The '''random''' control structure 138 {{{ 139 <?php 140 return select( 141 name('course'), 142 lesson( 143 name('lesson 1'), 144 filename('bolt_sample_lesson1.php') 145 ), 146 lesson( 147 name('lesson 2'), 148 filename('bolt_sample_lesson2.php') 149 ), 150 ); 151 ?> 152 }}} 153 154 === Select === 120 155 121 156 {{{ 122 { 123 "type": "set", 124 "show_n": 1, 125 "order": "random", 126 "items": { 127 { 128 ... 129 } 130 } 131 } 157 <?php 158 return select( 159 name('course'), 160 lesson( 161 value(val_func1($student)), 162 name('lesson 1'), 163 filename('bolt_sample_lesson1.php') 164 ), 165 lesson( 166 value(val_func1($student)), 167 name('lesson 2'), 168 filename('bolt_sample_lesson2.php') 169 ), 170 ); 171 ?> 132 172 }}} 133 134 The attributes of a set include:135 136 * show_n: the number of items in the set to show137 * order: whether to show the items sequentially or randomly138 139 Items (lessons, exercises, and sets) can include '''properties''', e.g.:140 141 {{{142 {143 "type": "lesson",144 "name": "The Linnaean hierarchy",145 "file": "linnaean.html"146 "properties": {147 "verbal_level": 12,148 "detail_level": 0.8149 }150 },151 }}}152 153 When Bolt has a choice of items (e.g. when it encounters a set from which a154 single item is to be shown) it calls, for each item, a course-supplied155 '''matchmaking function''', passing to it the student object156 (which includes demographics such as age)157 and the item's properties (represented as a PHP object).158 The matchmaking function returns a number representing the estimated159 effectiveness of that item for that student,160 and Bolt chooses the item with the highest value.161 173 162 174