| 58 | | Exercises are PHP scripts that call Bolt API functions. |
| 59 | | Here's an example consisting of a multiple-choice question: |
| | 58 | Exercises are PHP scripts that call Bolt API functions to create questions. |
| | 59 | The API is: |
| | 60 | {{{ |
| | 61 | exclusive_choice( |
| | 62 | 'option1', |
| | 63 | 'option2', |
| | 64 | ... |
| | 65 | [ weight(X) ] |
| | 66 | ); |
| | 67 | }}} |
| | 68 | This specifies a multiple-choice question where at most one answer can be chosen. |
| | 69 | The correct choice is the first one |
| | 70 | (when the question is shown, the choices are presented in a random order). |
| | 71 | |
| | 72 | An exercise script can contain multiple questions. |
| | 73 | If '''weight()''' is given, it specifies this question's grading weight; |
| | 74 | the default is 1. |
| | 75 | |
| | 76 | {{{ |
| | 77 | inclusive_choice( |
| | 78 | array('option1', true|false), |
| | 79 | array('option2', true|false), |
| | 80 | [ weight(X) ] |
| | 81 | ); |
| | 82 | }}} |
| | 83 | This specifies a multiple-choice question where any number of answers can be chosen. |
| | 84 | |
| | 85 | {{{ |
| | 86 | image_rect( |
| | 87 | image_filename, |
| | 88 | array(100, 60, 110, 70) |
| | 89 | ); |
| | 90 | ?> |
| | 91 | }}} |
| | 92 | This specifies a question where the student clicks on an image; |
| | 93 | a correct answer is a click in the indicated subrectangle. |
| | 94 | |
| | 95 | In addition to calling these functions, |
| | 96 | an exercise script can put text before or after the questions. |
| | 97 | Example: |
| 64 | | array( |
| 65 | | 'They carry their seeds in cones.' |
| 66 | | 'They are cone-shaped.', |
| 67 | | 'They originated during the Coniceous era.', |
| 68 | | ), |
| 69 | | ); |
| 70 | | ?> |
| 71 | | }}} |
| 72 | | The correct choice is the first element of the array. |
| 73 | | Each time the question is shown, |
| 74 | | the choices are presented in a random order. |
| 75 | | |
| 76 | | Here's an example that shows an image; |
| 77 | | a correct answer is a click in the indicated subrectangle. |
| 78 | | {{{ |
| 79 | | <?php |
| 80 | | echo "Click on the dog's nose:<p>"; |
| 81 | | image_rect( |
| 82 | | 'dog.jpg', |
| 83 | | array(100, 60, 110, 70) |
| 84 | | ); |
| 85 | | ?> |
| 86 | | }}} |
| 87 | | |
| 88 | | Bolt supplies functions for other types of questions, |
| 89 | | such as inclusive multiple-choice and fill-in-the-blank. |
| 90 | | An exercise can include multiple questions. |
| | 102 | 'They carry their seeds in cones.' |
| | 103 | 'They are cone-shaped.', |
| | 104 | 'They originated during the Coniceous era.' |
| | 105 | ); |
| | 106 | ?> |
| | 107 | }}} |
| | 108 | |