| 13 | | A user's sequential position is stored in the DB as the logical name |
| 14 | | or last item viewed. |
| 15 | | On continuation, Bolt looks up that item. |
| | 11 | * [/trac/browser/trunk/boinc/html/inc/bolt.inc bolt.inc]: implementation of course document functions. |
| | 12 | * [/trac/browser/trunk/boinc/html/inc/bolt_db.inc bolt_db.inc]: Bolt-specific DB abstraction layer. |
| | 13 | * [/trac/browser/trunk/boinc/html/inc/db_conn.inc db_conn.inc]: General DB abstraction layer. |
| | 14 | * [/trac/browser/trunk/boinc/html/inc/bolt_ex.inc bolt_ex.inc]: Exercise API functions. |
| | 15 | * [/trac/browser/trunk/boinc/html/inc/bolt_util.inc bolt_util.inc]: Miscellaneous HTML. |
| 25 | | Bolt's exercise primitives perform all these functions for you; |
| 26 | | however, you're free to implement your own exercises. |
| | 26 | * [/trac/browser/trunk/boinc/html/ops/bolt_refresh.php bolt_refresh.php]: Periodic task to send refresh emails. |
| | 27 | * [/trac/browser/trunk/boinc/html/ops/bolt_setup_sample.php bolt_setup_sample.php]: Example script to create a course. |
| | 28 | |
| | 29 | == How exercises are implemented == |
| | 30 | |
| | 31 | The following information is intended for those who want to add new exercise types. |
| | 32 | |
| | 33 | An exercise is a function that is called with three global variables: |
| | 34 | |
| | 35 | * '''$bolt_ex_mode''' |
| | 36 | * '''$bolt_ex_index''' |
| | 37 | * '''$bolt_ex_score''' |
| | 38 | |
| | 39 | If '''$bolt_ex_mode''' is BOLT_MODE_SHOW, the function should display the exercise, |
| | 40 | typically generating some "form" input items. |
| | 41 | '''$bolt_ex_index''' is a sequential index (0, 1, ...) indicating the order of this |
| | 42 | question in a file containing multiple questions; |
| | 43 | it should be included in form variable names. |
| | 44 | |
| | 45 | If '''$bolt_ex_mode''' is BOLT_MODE_SCORE, the function should score the student's response |
| | 46 | (based on $_GET values) and should store the result (a floating-point number in [0..1]) |
| | 47 | in '''$bolt_ex_score'''. |
| | 48 | |
| | 49 | If '''$bolt_ex_mode''' is BOLT_MODE_ANSWER, the function should display an "answer page" |
| | 50 | that shows the students the correct answers, |
| | 51 | and whether the student's responses were right or wrong. |