@@ -24,6 +24,10 @@ discard block |
||
| 24 | 24 | * @param int Question ID |
| 25 | 25 | * @param int $resultsDisabled |
| 26 | 26 | * @param string $originalStudentAnswer |
| 27 | + * @param integer $feedbackType |
|
| 28 | + * @param string $answer |
|
| 29 | + * @param integer $id |
|
| 30 | + * @param integer $questionId |
|
| 27 | 31 | * @return void |
| 28 | 32 | */ |
| 29 | 33 | public static function display_fill_in_blanks_answer($feedbackType, $answer, $id, $questionId, $resultsDisabled, $originalStudentAnswer = '') |
@@ -62,6 +66,10 @@ discard block |
||
| 62 | 66 | * @param string Answer text |
| 63 | 67 | * @param int Exercise ID |
| 64 | 68 | * @param int Question ID |
| 69 | + * @param integer $feedback_type |
|
| 70 | + * @param string $answer |
|
| 71 | + * @param integer $id |
|
| 72 | + * @param integer $questionId |
|
| 65 | 73 | * @return void |
| 66 | 74 | */ |
| 67 | 75 | static function display_calculated_answer($feedback_type, $answer, $id, $questionId) |
@@ -95,6 +103,9 @@ discard block |
||
| 95 | 103 | * @param string Answer text |
| 96 | 104 | * @param int Exercise ID |
| 97 | 105 | * @param int Question ID |
| 106 | + * @param integer $feedback_type |
|
| 107 | + * @param integer $exe_id |
|
| 108 | + * @param integer $questionId |
|
| 98 | 109 | * @return void |
| 99 | 110 | */ |
| 100 | 111 | static function display_free_answer($feedback_type, $answer, $exe_id, $questionId, $questionScore = null) |
@@ -117,6 +128,12 @@ discard block |
||
| 117 | 128 | } |
| 118 | 129 | } |
| 119 | 130 | |
| 131 | + /** |
|
| 132 | + * @param integer $feedback_type |
|
| 133 | + * @param integer $id |
|
| 134 | + * @param integer $questionId |
|
| 135 | + * @param Nanogong $nano |
|
| 136 | + */ |
|
| 120 | 137 | static function display_oral_expression_answer($feedback_type, $answer, $id, $questionId, $nano = null) |
| 121 | 138 | { |
| 122 | 139 | if (isset($nano)) { |
@@ -234,6 +251,12 @@ discard block |
||
| 234 | 251 | * @param integer Exercise ID |
| 235 | 252 | * @param integer Question ID |
| 236 | 253 | * @param boolean Whether to show the answer comment or not |
| 254 | + * @param integer $answerType |
|
| 255 | + * @param string $answer |
|
| 256 | + * @param string $answerComment |
|
| 257 | + * @param integer $answerCorrect |
|
| 258 | + * @param integer $id |
|
| 259 | + * @param integer $questionId |
|
| 237 | 260 | * @return void |
| 238 | 261 | */ |
| 239 | 262 | static function display_unique_or_multiple_answer( |
@@ -318,6 +341,13 @@ discard block |
||
| 318 | 341 | * @param integer Exercise ID |
| 319 | 342 | * @param integer Question ID |
| 320 | 343 | * @param boolean Whether to show the answer comment or not |
| 344 | + * @param integer $feedback_type |
|
| 345 | + * @param integer $answerType |
|
| 346 | + * @param string $answer |
|
| 347 | + * @param string $answerComment |
|
| 348 | + * @param integer $answerCorrect |
|
| 349 | + * @param integer $id |
|
| 350 | + * @param integer $questionId |
|
| 321 | 351 | * @return void |
| 322 | 352 | */ |
| 323 | 353 | static function display_multiple_answer_true_false( |
@@ -408,6 +438,13 @@ discard block |
||
| 408 | 438 | * @param integer Exercise ID |
| 409 | 439 | * @param integer Question ID |
| 410 | 440 | * @param boolean Whether to show the answer comment or not |
| 441 | + * @param integer $feedback_type |
|
| 442 | + * @param integer $answerType |
|
| 443 | + * @param string $answer |
|
| 444 | + * @param string $answerComment |
|
| 445 | + * @param integer $answerCorrect |
|
| 446 | + * @param integer $id |
|
| 447 | + * @param integer $questionId |
|
| 411 | 448 | * @return void |
| 412 | 449 | */ |
| 413 | 450 | static function display_multiple_answer_combination_true_false( |
@@ -12,21 +12,21 @@ discard block |
||
| 12 | 12 | * @todo convert queries to use Database API |
| 13 | 13 | */ |
| 14 | 14 | /** |
| 15 | - * Class |
|
| 16 | - * @package chamilo.library |
|
| 17 | - */ |
|
| 15 | + * Class |
|
| 16 | + * @package chamilo.library |
|
| 17 | + */ |
|
| 18 | 18 | class ExerciseShowFunctions |
| 19 | 19 | { |
| 20 | - /** |
|
| 21 | - * Shows the answer to a fill-in-the-blanks question, as HTML |
|
| 22 | - * @param string Answer text |
|
| 23 | - * @param int Exercise ID |
|
| 24 | - * @param int Question ID |
|
| 20 | + /** |
|
| 21 | + * Shows the answer to a fill-in-the-blanks question, as HTML |
|
| 22 | + * @param string Answer text |
|
| 23 | + * @param int Exercise ID |
|
| 24 | + * @param int Question ID |
|
| 25 | 25 | * @param int $resultsDisabled |
| 26 | 26 | * @param string $originalStudentAnswer |
| 27 | - * @return void |
|
| 28 | - */ |
|
| 29 | - public static function display_fill_in_blanks_answer($feedbackType, $answer, $id, $questionId, $resultsDisabled, $originalStudentAnswer = '') |
|
| 27 | + * @return void |
|
| 28 | + */ |
|
| 29 | + public static function display_fill_in_blanks_answer($feedbackType, $answer, $id, $questionId, $resultsDisabled, $originalStudentAnswer = '') |
|
| 30 | 30 | { |
| 31 | 31 | $answerHTML = FillBlanks::getHtmlDisplayForAnswer($answer, $resultsDisabled); |
| 32 | 32 | if (strpos($originalStudentAnswer, 'font color') !== false) { |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | </tr> |
| 56 | 56 | <?php |
| 57 | 57 | } |
| 58 | - } |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * Shows the answer to a calculated question, as HTML |
@@ -90,14 +90,14 @@ discard block |
||
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - /** |
|
| 94 | - * Shows the answer to a free-answer question, as HTML |
|
| 95 | - * @param string Answer text |
|
| 96 | - * @param int Exercise ID |
|
| 97 | - * @param int Question ID |
|
| 98 | - * @return void |
|
| 99 | - */ |
|
| 100 | - static function display_free_answer($feedback_type, $answer, $exe_id, $questionId, $questionScore = null) |
|
| 93 | + /** |
|
| 94 | + * Shows the answer to a free-answer question, as HTML |
|
| 95 | + * @param string Answer text |
|
| 96 | + * @param int Exercise ID |
|
| 97 | + * @param int Question ID |
|
| 98 | + * @return void |
|
| 99 | + */ |
|
| 100 | + static function display_free_answer($feedback_type, $answer, $exe_id, $questionId, $questionScore = null) |
|
| 101 | 101 | { |
| 102 | 102 | $comments = Event::get_comments($exe_id, $questionId); |
| 103 | 103 | |
@@ -115,9 +115,9 @@ discard block |
||
| 115 | 115 | echo '</tr>'; |
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | - } |
|
| 118 | + } |
|
| 119 | 119 | |
| 120 | - static function display_oral_expression_answer($feedback_type, $answer, $id, $questionId, $nano = null) |
|
| 120 | + static function display_oral_expression_answer($feedback_type, $answer, $id, $questionId, $nano = null) |
|
| 121 | 121 | { |
| 122 | 122 | if (isset($nano)) { |
| 123 | 123 | echo $nano->show_audio_file(); |
@@ -151,8 +151,8 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - /** |
|
| 155 | - * Displays the answer to a hotspot question |
|
| 154 | + /** |
|
| 155 | + * Displays the answer to a hotspot question |
|
| 156 | 156 | * @param int $feedback_type |
| 157 | 157 | * @param int $answerId |
| 158 | 158 | * @param string $answer |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | * @param string $in_results_disabled |
| 162 | 162 | * @param int $orderColor |
| 163 | 163 | */ |
| 164 | - public static function display_hotspot_answer( |
|
| 164 | + public static function display_hotspot_answer( |
|
| 165 | 165 | $feedback_type, |
| 166 | 166 | $answerId, |
| 167 | 167 | $answer, |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | $hide_expected_answer = true; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - $hotspot_colors = array( |
|
| 179 | + $hotspot_colors = array( |
|
| 180 | 180 | "", // $i starts from 1 on next loop (ugly fix) |
| 181 | 181 | "#4271B5", |
| 182 | 182 | "#FE8E16", |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | "#ED2024", |
| 192 | 192 | "#3B3B3B", |
| 193 | 193 | "#F7BDE2"); |
| 194 | - ?> |
|
| 194 | + ?> |
|
| 195 | 195 | <table class="data_table"> |
| 196 | 196 | <tr> |
| 197 | 197 | <td class="text-center" width="5%"> |
@@ -203,10 +203,10 @@ discard block |
||
| 203 | 203 | <td class="text-left" width="10%"> |
| 204 | 204 | <?php |
| 205 | 205 | if (!$hide_expected_answer) { |
| 206 | - $my_choice = ($studentChoice)?get_lang('Correct'):get_lang('Fault'); |
|
| 207 | - echo $my_choice; |
|
| 206 | + $my_choice = ($studentChoice)?get_lang('Correct'):get_lang('Fault'); |
|
| 207 | + echo $my_choice; |
|
| 208 | 208 | } |
| 209 | - ?> |
|
| 209 | + ?> |
|
| 210 | 210 | </td> |
| 211 | 211 | <?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?> |
| 212 | 212 | <td class="text-left" width="60%"> |
@@ -214,29 +214,29 @@ discard block |
||
| 214 | 214 | if ($studentChoice) { |
| 215 | 215 | echo '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>'; |
| 216 | 216 | } |
| 217 | - ?> |
|
| 217 | + ?> |
|
| 218 | 218 | </td> |
| 219 | 219 | <?php } else { ?> |
| 220 | 220 | <td class="text-left" width="60%"> </td> |
| 221 | 221 | <?php } ?> |
| 222 | 222 | </tr> |
| 223 | 223 | <?php |
| 224 | - } |
|
| 224 | + } |
|
| 225 | 225 | |
| 226 | - /** |
|
| 227 | - * Display the answers to a multiple choice question |
|
| 228 | - * @param int $feedback_type Feedback type |
|
| 229 | - * @param integer Answer type |
|
| 230 | - * @param integer Student choice |
|
| 231 | - * @param string Textual answer |
|
| 232 | - * @param string Comment on answer |
|
| 233 | - * @param string Correct answer comment |
|
| 234 | - * @param integer Exercise ID |
|
| 235 | - * @param integer Question ID |
|
| 236 | - * @param boolean Whether to show the answer comment or not |
|
| 237 | - * @return void |
|
| 238 | - */ |
|
| 239 | - static function display_unique_or_multiple_answer( |
|
| 226 | + /** |
|
| 227 | + * Display the answers to a multiple choice question |
|
| 228 | + * @param int $feedback_type Feedback type |
|
| 229 | + * @param integer Answer type |
|
| 230 | + * @param integer Student choice |
|
| 231 | + * @param string Textual answer |
|
| 232 | + * @param string Comment on answer |
|
| 233 | + * @param string Correct answer comment |
|
| 234 | + * @param integer Exercise ID |
|
| 235 | + * @param integer Question ID |
|
| 236 | + * @param boolean Whether to show the answer comment or not |
|
| 237 | + * @return void |
|
| 238 | + */ |
|
| 239 | + static function display_unique_or_multiple_answer( |
|
| 240 | 240 | $feedback_type, |
| 241 | 241 | $answerType, |
| 242 | 242 | $studentChoice, |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | if ($feedback_type == 0 && $in_results_disabled == 2) { |
| 254 | 254 | $hide_expected_answer = true; |
| 255 | 255 | } |
| 256 | - ?> |
|
| 256 | + ?> |
|
| 257 | 257 | <tr> |
| 258 | 258 | <td width="5%"> |
| 259 | 259 | <img src="../img/<?php echo (in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION))) ? 'radio':'checkbox'; echo $studentChoice?'_on':'_off'; ?>.gif" |
@@ -269,43 +269,43 @@ discard block |
||
| 269 | 269 | </td> |
| 270 | 270 | <td width="40%"> |
| 271 | 271 | <?php |
| 272 | - echo $answer; |
|
| 273 | - ?> |
|
| 272 | + echo $answer; |
|
| 273 | + ?> |
|
| 274 | 274 | </td> |
| 275 | 275 | |
| 276 | 276 | <?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?> |
| 277 | 277 | <td width="20%"> |
| 278 | 278 | <?php |
| 279 | 279 | if ($studentChoice) { |
| 280 | - if ($answerCorrect) { |
|
| 280 | + if ($answerCorrect) { |
|
| 281 | 281 | $color = 'green'; |
| 282 | - //echo '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>'; |
|
| 283 | - } else { |
|
| 282 | + //echo '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>'; |
|
| 283 | + } else { |
|
| 284 | 284 | $color = 'black'; |
| 285 | 285 | //echo '<span style="font-weight: bold; color: #FF0000;">'.nl2br($answerComment).'</span>'; |
| 286 | - } |
|
| 286 | + } |
|
| 287 | 287 | echo '<span style="font-weight: bold; color: '.$color.';">'.nl2br($answerComment).'</span>'; |
| 288 | 288 | |
| 289 | - } else { |
|
| 290 | - if ($answerCorrect) { |
|
| 291 | - //echo '<span style="font-weight: bold; color: #000;">'.nl2br($answerComment).'</span>'; |
|
| 292 | - } else { |
|
| 289 | + } else { |
|
| 290 | + if ($answerCorrect) { |
|
| 291 | + //echo '<span style="font-weight: bold; color: #000;">'.nl2br($answerComment).'</span>'; |
|
| 292 | + } else { |
|
| 293 | 293 | //echo '<span style="font-weight: normal; color: #000;">'.nl2br($answerComment).'</span>'; |
| 294 | - } |
|
| 295 | - } |
|
| 296 | - ?> |
|
| 294 | + } |
|
| 295 | + } |
|
| 296 | + ?> |
|
| 297 | 297 | </td> |
| 298 | 298 | <?php |
| 299 | - if ($ans==1) { |
|
| 300 | - $comm = Event::get_comments($id,$questionId); |
|
| 301 | - } |
|
| 302 | - ?> |
|
| 299 | + if ($ans==1) { |
|
| 300 | + $comm = Event::get_comments($id,$questionId); |
|
| 301 | + } |
|
| 302 | + ?> |
|
| 303 | 303 | <?php } else { ?> |
| 304 | 304 | <td> </td> |
| 305 | 305 | <?php } ?> |
| 306 | 306 | </tr> |
| 307 | 307 | <?php |
| 308 | - } |
|
| 308 | + } |
|
| 309 | 309 | |
| 310 | 310 | /** |
| 311 | 311 | * Display the answers to a multiple choice question |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | if (isset($new_options[$studentChoice])) { |
| 350 | 350 | echo get_lang($new_options[$studentChoice]['name']); |
| 351 | 351 | } else { |
| 352 | - echo '-'; |
|
| 352 | + echo '-'; |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | ?> |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | <td width="5%"> |
| 358 | 358 | <?php |
| 359 | 359 | |
| 360 | - //Expected choice |
|
| 360 | + //Expected choice |
|
| 361 | 361 | if (!$hide_expected_answer) { |
| 362 | 362 | if (isset($new_options[$answerCorrect])) { |
| 363 | 363 | echo get_lang($new_options[$answerCorrect]['name']); |
@@ -397,19 +397,19 @@ discard block |
||
| 397 | 397 | <?php |
| 398 | 398 | } |
| 399 | 399 | |
| 400 | - /** |
|
| 401 | - * Display the answers to a multiple choice question |
|
| 402 | - * |
|
| 403 | - * @param integer Answer type |
|
| 404 | - * @param integer Student choice |
|
| 405 | - * @param string Textual answer |
|
| 406 | - * @param string Comment on answer |
|
| 407 | - * @param string Correct answer comment |
|
| 408 | - * @param integer Exercise ID |
|
| 409 | - * @param integer Question ID |
|
| 410 | - * @param boolean Whether to show the answer comment or not |
|
| 411 | - * @return void |
|
| 412 | - */ |
|
| 400 | + /** |
|
| 401 | + * Display the answers to a multiple choice question |
|
| 402 | + * |
|
| 403 | + * @param integer Answer type |
|
| 404 | + * @param integer Student choice |
|
| 405 | + * @param string Textual answer |
|
| 406 | + * @param string Comment on answer |
|
| 407 | + * @param string Correct answer comment |
|
| 408 | + * @param integer Exercise ID |
|
| 409 | + * @param integer Question ID |
|
| 410 | + * @param boolean Whether to show the answer comment or not |
|
| 411 | + * @return void |
|
| 412 | + */ |
|
| 413 | 413 | static function display_multiple_answer_combination_true_false( |
| 414 | 414 | $feedback_type, |
| 415 | 415 | $answerType, |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | <tr> |
| 431 | 431 | <td width="5%"> |
| 432 | 432 | <?php |
| 433 | - //Your choice |
|
| 433 | + //Your choice |
|
| 434 | 434 | $question = new MultipleAnswerCombinationTrueFalse(); |
| 435 | 435 | if (isset($question->options[$studentChoice])) { |
| 436 | 436 | echo $question->options[$studentChoice]; |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | </td> |
| 442 | 442 | <td width="5%"> |
| 443 | 443 | <?php |
| 444 | - //Expected choice |
|
| 444 | + //Expected choice |
|
| 445 | 445 | if (!$hide_expected_answer) { |
| 446 | 446 | if (isset($question->options[$answerCorrect])) { |
| 447 | 447 | echo $question->options[$answerCorrect]; |
@@ -466,20 +466,20 @@ discard block |
||
| 466 | 466 | <?php |
| 467 | 467 | //@todo replace this harcoded value |
| 468 | 468 | if ($studentChoice) { |
| 469 | - $color = "black"; |
|
| 469 | + $color = "black"; |
|
| 470 | 470 | if ($studentChoice == $answerCorrect) { |
| 471 | 471 | $color = "green"; |
| 472 | 472 | } |
| 473 | 473 | echo '<span style="font-weight: bold; color: '.$color.';">'.nl2br($answerComment).'</span>'; |
| 474 | 474 | } |
| 475 | 475 | if ($studentChoice == 2 || $studentChoice == '') { |
| 476 | - //echo '<span style="font-weight: bold; color: #000;">'.nl2br($answerComment).'</span>'; |
|
| 476 | + //echo '<span style="font-weight: bold; color: #000;">'.nl2br($answerComment).'</span>'; |
|
| 477 | 477 | } else { |
| 478 | - if ($studentChoice == $answerCorrect) { |
|
| 479 | - //echo '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>'; |
|
| 480 | - } else { |
|
| 478 | + if ($studentChoice == $answerCorrect) { |
|
| 479 | + //echo '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>'; |
|
| 480 | + } else { |
|
| 481 | 481 | //echo '<span style="font-weight: bold; color: #FF0000;">'.nl2br($answerComment).'</span>'; |
| 482 | - } |
|
| 482 | + } |
|
| 483 | 483 | } |
| 484 | 484 | ?> |
| 485 | 485 | </td> |