Changes between Version 4 and Version 5 of BoltRef


Ignore:
Timestamp:
Dec 4, 2007, 6:54:31 PM (17 years ago)
Author:
davea
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • BoltRef

    v4 v5  
    9191return lesson(
    9292    name('lesson 1'),
    93     filename('lesson_1.php');
     93    filename('lesson_1.php'),
    9494);
    9595?>
    9696}}}
     97
     98Attributes can be associated with units, e.g.:
     99{{{
     100<?php
     101return lesson(
     102    name('lesson 1'),
     103    filename('lesson_1.php'),
     104    reading_level(11.0),
     105    detail_level(.5)
     106);
     107?>
     108}}}
     109
    97110=== Sequences ===
     111
     112Course documents can also have various 'control structures'.
     113The most basic of these is a 'sequence',
     114which contains a set of units that are shown in sequence.
    98115Here's an example of a course with two lessons followed by an exercise:
    99116{{{
     
    117134}}}
    118135
    119 Course items can be grouped into '''sets'''; for example:
     136=== Random ===
     137The '''random''' control structure
     138{{{
     139<?php
     140return 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 ===
    120155
    121156{{{
    122 {
    123    "type": "set",
    124    "show_n": 1,
    125    "order": "random",
    126    "items": {
    127       {
    128       ...
    129       }
    130    }
    131 }
     157<?php
     158return 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?>
    132172}}}
    133 
    134 The attributes of a set include:
    135 
    136  * show_n: the number of items in the set to show
    137  * order: whether to show the items sequentially or randomly
    138 
    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.8
    149    }
    150 },
    151 }}}
    152 
    153 When Bolt has a choice of items (e.g. when it encounters a set from which a
    154 single item is to be shown) it calls, for each item, a course-supplied
    155 '''matchmaking function''', passing to it the student object
    156 (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 estimated
    159 effectiveness of that item for that student,
    160 and Bolt chooses the item with the highest value.
    161173
    162174