This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:create:points [06.12.2015 15:03] – [Correct and Incorrect Answers] admin | en:create:points [30.03.2022 15:28] (current) – admin | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== | + | ====== Score Responses ====== |
| In most socio-scientific surveys, we are interested in the participant' | In most socio-scientific surveys, we are interested in the participant' | ||
| Line 18: | Line 18: | ||
| The simplest way of keeping score is for a quiz or a knowledge test. These have a range of selection questions and one of the options is correct for each one. | The simplest way of keeping score is for a quiz or a knowledge test. These have a range of selection questions and one of the options is correct for each one. | ||
| - | The following PHP code initially defines which questions will be evaluated and what the correct response is. An [[: | + | The following PHP code initially defines which questions will be evaluated and what the correct response is. An [[: |
| Line 26: | Line 26: | ||
| <code php> | <code php> | ||
| // Define questions and the correct answers | // Define questions and the correct answers | ||
| - | $questions = array( | + | $questions = [ |
| ' | ' | ||
| ' | ' | ||
| Line 33: | Line 33: | ||
| ' | ' | ||
| // and so on | // and so on | ||
| - | ); | + | ]; |
| // Initialize counter variable | // Initialize counter variable | ||
| Line 77: | Line 77: | ||
| <code php> | <code php> | ||
| // Define questions and the values of possible answers | // Define questions and the values of possible answers | ||
| - | $questions = array( | + | $questions = [ |
| - | ' | + | ' |
| - | ' | + | ' |
| - | ' | + | ' |
| - | ' | + | ' |
| - | ' | + | ' |
| // u.s.w. | // u.s.w. | ||
| - | ); | + | ]; |
| // Initialize counter variable | // Initialize counter variable | ||
| Line 158: | Line 158: | ||
| <code php> | <code php> | ||
| // List of items - providing polarity in each case | // List of items - providing polarity in each case | ||
| - | $items = array( | + | $items = [ |
| ' | ' | ||
| ' | ' | ||
| Line 165: | Line 165: | ||
| ' | ' | ||
| // and so on. | // and so on. | ||
| - | ); | + | ]; |
| // Initialization of points variable | // Initialization of points variable | ||
| Line 221: | Line 221: | ||
| // Define questions and their correct answers | // Define questions and their correct answers | ||
| // Only items are defined that will also be checked | // Only items are defined that will also be checked | ||
| - | $questions = array( | + | $questions = [ |
| // In question AB01, 1 and 2 have to be checked, 3 and 4 must not be checked | // In question AB01, 1 and 2 have to be checked, 3 and 4 must not be checked | ||
| - | ' | + | ' |
| // In question AB02, 2 and 3 have to be checked, 4 must not, and the value for 1 is irrelevant | // In question AB02, 2 and 3 have to be checked, 4 must not, and the value for 1 is irrelevant | ||
| - | ' | + | ' |
| // In AB03, all 4 have to be checked | // In AB03, all 4 have to be checked | ||
| - | ' | + | ' |
| // and so on. | // and so on. | ||
| - | ' | + | ' |
| - | ' | + | ' |
| - | ); | + | ]; |
| // Initialize counter variable | // Initialize counter variable | ||
| Line 242: | Line 242: | ||
| foreach ($answers as $itemId => $default) { | foreach ($answers as $itemId => $default) { | ||
| // Assemble item ID | // Assemble item ID | ||
| - | $id = $questionId.' | + | $id = id($questionId, $itemId); |
| // Call up participant' | // Call up participant' | ||
| $answer = value($id); | $answer = value($id); | ||