@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | require_once '../inc/global.inc.php'; |
| 14 | 14 | |
| 15 | -$current_course_tool = TOOL_QUIZ; |
|
| 15 | +$current_course_tool = TOOL_QUIZ; |
|
| 16 | 16 | |
| 17 | 17 | // Clear the exercise session just in case |
| 18 | 18 | if (isset($_SESSION['objExercise'])) { |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | if ($time_control) { |
| 51 | 51 | // Get time left for expiring time |
| 52 | - $time_left = api_strtotime($clock_expired_time,'UTC') - time(); |
|
| 52 | + $time_left = api_strtotime($clock_expired_time, 'UTC') - time(); |
|
| 53 | 53 | |
| 54 | 54 | $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/epiclock/stylesheet/jquery.epiclock.css'); |
| 55 | 55 | $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/epiclock/renderers/minute/epiclock.minute.css'); |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | $html = ''; |
| 74 | 74 | $message = ''; |
| 75 | -$html.= '<div class="exercise">'; |
|
| 75 | +$html .= '<div class="exercise">'; |
|
| 76 | 76 | $is_allowed_to_edit = api_is_allowed_to_edit(null, true); |
| 77 | 77 | $edit_link = ''; |
| 78 | 78 | if ($is_allowed_to_edit && $objExercise->sessionId == $sessionId) { |
@@ -177,8 +177,8 @@ discard block |
||
| 177 | 177 | $attempt_result['exe_result'], |
| 178 | 178 | $attempt_result['exe_weighting'] |
| 179 | 179 | ); |
| 180 | - $attempt_url = api_get_path(WEB_CODE_PATH) . 'exercice/result.php?'; |
|
| 181 | - $attempt_url .= api_get_cidreq() . '&show_headers=1&'; |
|
| 180 | + $attempt_url = api_get_path(WEB_CODE_PATH).'exercice/result.php?'; |
|
| 181 | + $attempt_url .= api_get_cidreq().'&show_headers=1&'; |
|
| 182 | 182 | $attempt_url .= http_build_query([ |
| 183 | 183 | 'id' => $attempt_result['exe_id'] |
| 184 | 184 | ]); |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | get_lang('Show'), |
| 189 | 189 | $attempt_url, |
| 190 | 190 | [ |
| 191 | - 'class' => $btn_class . 'btn btn-default', |
|
| 191 | + 'class' => $btn_class.'btn btn-default', |
|
| 192 | 192 | 'data-title' => get_lang('Show'), |
| 193 | 193 | 'data-size' => 'lg' |
| 194 | 194 | ] |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | ), |
| 207 | 207 | 'userIp' => $attempt_result['user_ip'] |
| 208 | 208 | ); |
| 209 | - $attempt_link .= " " . $teacher_revised; |
|
| 209 | + $attempt_link .= " ".$teacher_revised; |
|
| 210 | 210 | |
| 211 | 211 | if (in_array( |
| 212 | 212 | $objExercise->results_disabled, |
@@ -283,12 +283,12 @@ discard block |
||
| 283 | 283 | $attempt_message = Display::return_message($attempt_message, 'info'); |
| 284 | 284 | } |
| 285 | 285 | if ($visible_return['value'] == true) { |
| 286 | - $message .= $attempt_message; |
|
| 286 | + $message .= $attempt_message; |
|
| 287 | 287 | } |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | if ($time_control) { |
| 291 | - $html.= $objExercise->return_time_left_div(); |
|
| 291 | + $html .= $objExercise->return_time_left_div(); |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | $html .= $message; |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | $table_content, |
| 309 | 309 | ['class' => 'table-responsive'] |
| 310 | 310 | ); |
| 311 | -$html.= '</div>'; |
|
| 311 | +$html .= '</div>'; |
|
| 312 | 312 | echo $html; |
| 313 | 313 | |
| 314 | 314 | Display::display_footer(); |
@@ -25,6 +25,7 @@ discard block |
||
| 25 | 25 | * @param int $questionId Question ID |
| 26 | 26 | * @param int $resultsDisabled |
| 27 | 27 | * @param string $originalStudentAnswer |
| 28 | + * @param boolean $showTotalScoreAndUserChoices |
|
| 28 | 29 | * |
| 29 | 30 | * @return void |
| 30 | 31 | */ |
@@ -71,6 +72,10 @@ discard block |
||
| 71 | 72 | * @param string Answer text |
| 72 | 73 | * @param int Exercise ID |
| 73 | 74 | * @param int Question ID |
| 75 | + * @param integer $feedback_type |
|
| 76 | + * @param integer $id |
|
| 77 | + * @param integer $questionId |
|
| 78 | + * @param boolean|string $showTotalScoreAndUserChoices |
|
| 74 | 79 | * @return void |
| 75 | 80 | */ |
| 76 | 81 | public static function display_calculated_answer( |
@@ -110,6 +115,9 @@ discard block |
||
| 110 | 115 | * @param string Answer text |
| 111 | 116 | * @param int Exercise ID |
| 112 | 117 | * @param int Question ID |
| 118 | + * @param integer $feedback_type |
|
| 119 | + * @param integer $exe_id |
|
| 120 | + * @param integer $questionId |
|
| 113 | 121 | * @return void |
| 114 | 122 | */ |
| 115 | 123 | public static function display_free_answer( |
@@ -139,11 +147,11 @@ discard block |
||
| 139 | 147 | } |
| 140 | 148 | |
| 141 | 149 | /** |
| 142 | - * @param $feedback_type |
|
| 150 | + * @param integer $feedback_type |
|
| 143 | 151 | * @param $answer |
| 144 | - * @param $id |
|
| 145 | - * @param $questionId |
|
| 146 | - * @param null $nano |
|
| 152 | + * @param integer $id |
|
| 153 | + * @param integer $questionId |
|
| 154 | + * @param Nanogong|null $nano |
|
| 147 | 155 | * @param int $results_disabled |
| 148 | 156 | */ |
| 149 | 157 | public static function display_oral_expression_answer( |
@@ -195,6 +203,7 @@ discard block |
||
| 195 | 203 | * @param string $answerComment |
| 196 | 204 | * @param int $resultsDisabled |
| 197 | 205 | * @param int $orderColor |
| 206 | + * @param boolean $showTotalScoreAndUserChoices |
|
| 198 | 207 | */ |
| 199 | 208 | public static function display_hotspot_answer( |
| 200 | 209 | $feedback_type, |
@@ -279,6 +288,12 @@ discard block |
||
| 279 | 288 | * @param integer Exercise ID |
| 280 | 289 | * @param integer Question ID |
| 281 | 290 | * @param boolean Whether to show the answer comment or not |
| 291 | + * @param integer $answerType |
|
| 292 | + * @param string $answerComment |
|
| 293 | + * @param integer $answerCorrect |
|
| 294 | + * @param integer $id |
|
| 295 | + * @param integer $questionId |
|
| 296 | + * @param boolean $showTotalScoreAndUserChoices |
|
| 282 | 297 | * @return void |
| 283 | 298 | */ |
| 284 | 299 | public static function display_unique_or_multiple_answer( |
@@ -375,6 +390,13 @@ discard block |
||
| 375 | 390 | * @param integer Exercise ID |
| 376 | 391 | * @param integer Question ID |
| 377 | 392 | * @param boolean Whether to show the answer comment or not |
| 393 | + * @param integer $feedback_type |
|
| 394 | + * @param integer $answerType |
|
| 395 | + * @param string $answerComment |
|
| 396 | + * @param integer $answerCorrect |
|
| 397 | + * @param integer $id |
|
| 398 | + * @param integer $questionId |
|
| 399 | + * @param boolean $showTotalScoreAndUserChoices |
|
| 378 | 400 | * @return void |
| 379 | 401 | */ |
| 380 | 402 | public static function display_multiple_answer_true_false( |
@@ -479,6 +501,13 @@ discard block |
||
| 479 | 501 | * @param integer Exercise ID |
| 480 | 502 | * @param integer Question ID |
| 481 | 503 | * @param boolean Whether to show the answer comment or not |
| 504 | + * @param integer $feedback_type |
|
| 505 | + * @param integer $answerType |
|
| 506 | + * @param string $answerComment |
|
| 507 | + * @param integer $answerCorrect |
|
| 508 | + * @param integer $id |
|
| 509 | + * @param integer $questionId |
|
| 510 | + * @param boolean $showTotalScoreAndUserChoices |
|
| 482 | 511 | * @return void |
| 483 | 512 | */ |
| 484 | 513 | public static function display_multiple_answer_combination_true_false( |
@@ -17,25 +17,25 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | class ExerciseShowFunctions |
| 19 | 19 | { |
| 20 | - /** |
|
| 21 | - * Shows the answer to a fill-in-the-blanks question, as HTML |
|
| 20 | + /** |
|
| 21 | + * Shows the answer to a fill-in-the-blanks question, as HTML |
|
| 22 | 22 | * @param int $feedbackType |
| 23 | - * @param string $answer |
|
| 24 | - * @param int $id Exercise ID |
|
| 25 | - * @param int $questionId Question ID |
|
| 23 | + * @param string $answer |
|
| 24 | + * @param int $id Exercise ID |
|
| 25 | + * @param int $questionId Question ID |
|
| 26 | 26 | * @param int $resultsDisabled |
| 27 | 27 | * @param string $originalStudentAnswer |
| 28 | - * |
|
| 29 | - * @return void |
|
| 30 | - */ |
|
| 31 | - public static function display_fill_in_blanks_answer( |
|
| 32 | - $feedbackType, |
|
| 33 | - $answer, |
|
| 34 | - $id, |
|
| 35 | - $questionId, |
|
| 36 | - $resultsDisabled, |
|
| 37 | - $originalStudentAnswer = '', |
|
| 38 | - $showTotalScoreAndUserChoices |
|
| 28 | + * |
|
| 29 | + * @return void |
|
| 30 | + */ |
|
| 31 | + public static function display_fill_in_blanks_answer( |
|
| 32 | + $feedbackType, |
|
| 33 | + $answer, |
|
| 34 | + $id, |
|
| 35 | + $questionId, |
|
| 36 | + $resultsDisabled, |
|
| 37 | + $originalStudentAnswer = '', |
|
| 38 | + $showTotalScoreAndUserChoices |
|
| 39 | 39 | ) { |
| 40 | 40 | $answerHTML = FillBlanks::getHtmlDisplayForAnswer($answer, $resultsDisabled, $showTotalScoreAndUserChoices); |
| 41 | 41 | if (strpos($originalStudentAnswer, 'font color') !== false) { |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | </tr> |
| 65 | 65 | <?php |
| 66 | 66 | } |
| 67 | - } |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | 69 | /** |
| 70 | 70 | * Shows the answer to a calculated question, as HTML |
@@ -105,20 +105,20 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - /** |
|
| 109 | - * Shows the answer to a free-answer question, as HTML |
|
| 110 | - * @param string Answer text |
|
| 111 | - * @param int Exercise ID |
|
| 112 | - * @param int Question ID |
|
| 113 | - * @return void |
|
| 114 | - */ |
|
| 115 | - public static function display_free_answer( |
|
| 116 | - $feedback_type, |
|
| 117 | - $answer, |
|
| 118 | - $exe_id, |
|
| 119 | - $questionId, |
|
| 120 | - $questionScore = null, |
|
| 121 | - $results_disabled = 0 |
|
| 108 | + /** |
|
| 109 | + * Shows the answer to a free-answer question, as HTML |
|
| 110 | + * @param string Answer text |
|
| 111 | + * @param int Exercise ID |
|
| 112 | + * @param int Question ID |
|
| 113 | + * @return void |
|
| 114 | + */ |
|
| 115 | + public static function display_free_answer( |
|
| 116 | + $feedback_type, |
|
| 117 | + $answer, |
|
| 118 | + $exe_id, |
|
| 119 | + $questionId, |
|
| 120 | + $questionScore = null, |
|
| 121 | + $results_disabled = 0 |
|
| 122 | 122 | ) { |
| 123 | 123 | $comments = Event::get_comments($exe_id, $questionId); |
| 124 | 124 | |
@@ -136,21 +136,21 @@ discard block |
||
| 136 | 136 | echo '</tr>'; |
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | - } |
|
| 139 | + } |
|
| 140 | 140 | |
| 141 | 141 | /** |
| 142 | - * @param $feedback_type |
|
| 143 | - * @param $answer |
|
| 144 | - * @param $id |
|
| 145 | - * @param $questionId |
|
| 146 | - * @param null $nano |
|
| 147 | - * @param int $results_disabled |
|
| 142 | + * @param $feedback_type |
|
| 143 | + * @param $answer |
|
| 144 | + * @param $id |
|
| 145 | + * @param $questionId |
|
| 146 | + * @param null $nano |
|
| 147 | + * @param int $results_disabled |
|
| 148 | 148 | */ |
| 149 | - public static function display_oral_expression_answer( |
|
| 150 | - $feedback_type, |
|
| 151 | - $answer, |
|
| 152 | - $id, |
|
| 153 | - $questionId, |
|
| 149 | + public static function display_oral_expression_answer( |
|
| 150 | + $feedback_type, |
|
| 151 | + $answer, |
|
| 152 | + $id, |
|
| 153 | + $questionId, |
|
| 154 | 154 | $nano = null, |
| 155 | 155 | $results_disabled = 0 |
| 156 | 156 | ) { |
@@ -186,8 +186,8 @@ discard block |
||
| 186 | 186 | } |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - /** |
|
| 190 | - * Displays the answer to a hotspot question |
|
| 189 | + /** |
|
| 190 | + * Displays the answer to a hotspot question |
|
| 191 | 191 | * @param int $feedback_type |
| 192 | 192 | * @param int $answerId |
| 193 | 193 | * @param string $answer |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | * @param int $resultsDisabled |
| 197 | 197 | * @param int $orderColor |
| 198 | 198 | */ |
| 199 | - public static function display_hotspot_answer( |
|
| 199 | + public static function display_hotspot_answer( |
|
| 200 | 200 | $feedback_type, |
| 201 | 201 | $answerId, |
| 202 | 202 | $answer, |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | } |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - $hotspot_colors = array( |
|
| 222 | + $hotspot_colors = array( |
|
| 223 | 223 | "", // $i starts from 1 on next loop (ugly fix) |
| 224 | 224 | "#4271B5", |
| 225 | 225 | "#FE8E16", |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | "#F7BDE2" |
| 237 | 237 | ); |
| 238 | 238 | |
| 239 | - ?> |
|
| 239 | + ?> |
|
| 240 | 240 | <table class="data_table"> |
| 241 | 241 | <tr> |
| 242 | 242 | <td class="text-center" width="5%"> |
@@ -248,10 +248,10 @@ discard block |
||
| 248 | 248 | <td class="text-left" width="10%"> |
| 249 | 249 | <?php |
| 250 | 250 | if (!$hide_expected_answer) { |
| 251 | - $my_choice = $studentChoice ? get_lang('Correct') : get_lang('Fault'); |
|
| 252 | - echo $my_choice; |
|
| 251 | + $my_choice = $studentChoice ? get_lang('Correct') : get_lang('Fault'); |
|
| 252 | + echo $my_choice; |
|
| 253 | 253 | } |
| 254 | - ?> |
|
| 254 | + ?> |
|
| 255 | 255 | </td> |
| 256 | 256 | <?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?> |
| 257 | 257 | <td class="text-left" width="60%"> |
@@ -259,29 +259,29 @@ discard block |
||
| 259 | 259 | if ($studentChoice) { |
| 260 | 260 | echo '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>'; |
| 261 | 261 | } |
| 262 | - ?> |
|
| 262 | + ?> |
|
| 263 | 263 | </td> |
| 264 | 264 | <?php } else { ?> |
| 265 | 265 | <td class="text-left" width="60%"> </td> |
| 266 | 266 | <?php } ?> |
| 267 | 267 | </tr> |
| 268 | 268 | <?php |
| 269 | - } |
|
| 270 | - |
|
| 271 | - /** |
|
| 272 | - * Display the answers to a multiple choice question |
|
| 273 | - * @param int $feedback_type Feedback type |
|
| 274 | - * @param integer Answer type |
|
| 275 | - * @param integer Student choice |
|
| 276 | - * @param string Textual answer |
|
| 277 | - * @param string Comment on answer |
|
| 278 | - * @param string Correct answer comment |
|
| 279 | - * @param integer Exercise ID |
|
| 280 | - * @param integer Question ID |
|
| 281 | - * @param boolean Whether to show the answer comment or not |
|
| 282 | - * @return void |
|
| 283 | - */ |
|
| 284 | - public static function display_unique_or_multiple_answer( |
|
| 269 | + } |
|
| 270 | + |
|
| 271 | + /** |
|
| 272 | + * Display the answers to a multiple choice question |
|
| 273 | + * @param int $feedback_type Feedback type |
|
| 274 | + * @param integer Answer type |
|
| 275 | + * @param integer Student choice |
|
| 276 | + * @param string Textual answer |
|
| 277 | + * @param string Comment on answer |
|
| 278 | + * @param string Correct answer comment |
|
| 279 | + * @param integer Exercise ID |
|
| 280 | + * @param integer Question ID |
|
| 281 | + * @param boolean Whether to show the answer comment or not |
|
| 282 | + * @return void |
|
| 283 | + */ |
|
| 284 | + public static function display_unique_or_multiple_answer( |
|
| 285 | 285 | $feedback_type, |
| 286 | 286 | $answerType, |
| 287 | 287 | $studentChoice, |
@@ -309,14 +309,14 @@ discard block |
||
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | $icon = in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION)) ? 'radio':'checkbox'; |
| 312 | - $icon .= $studentChoice?'_on':'_off'; |
|
| 313 | - $icon .= '.gif'; |
|
| 312 | + $icon .= $studentChoice?'_on':'_off'; |
|
| 313 | + $icon .= '.gif'; |
|
| 314 | 314 | |
| 315 | - $iconAnswer = in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION)) ? 'radio':'checkbox'; |
|
| 316 | - $iconAnswer .= $answerCorrect ? '_on' : '_off'; |
|
| 317 | - $iconAnswer .= '.gif'; |
|
| 315 | + $iconAnswer = in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION)) ? 'radio':'checkbox'; |
|
| 316 | + $iconAnswer .= $answerCorrect ? '_on' : '_off'; |
|
| 317 | + $iconAnswer .= '.gif'; |
|
| 318 | 318 | |
| 319 | - ?> |
|
| 319 | + ?> |
|
| 320 | 320 | <tr> |
| 321 | 321 | <td width="5%"> |
| 322 | 322 | <?php echo Display::return_icon($icon); ?> |
@@ -330,39 +330,39 @@ discard block |
||
| 330 | 330 | </td> |
| 331 | 331 | <td width="40%"> |
| 332 | 332 | <?php |
| 333 | - echo $answer; |
|
| 334 | - ?> |
|
| 333 | + echo $answer; |
|
| 334 | + ?> |
|
| 335 | 335 | </td> |
| 336 | 336 | |
| 337 | 337 | <?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?> |
| 338 | 338 | <td width="20%"> |
| 339 | 339 | <?php |
| 340 | 340 | if ($studentChoice) { |
| 341 | - if ($answerCorrect) { |
|
| 341 | + if ($answerCorrect) { |
|
| 342 | 342 | $color = 'green'; |
| 343 | - //echo '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>'; |
|
| 344 | - } else { |
|
| 343 | + //echo '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>'; |
|
| 344 | + } else { |
|
| 345 | 345 | $color = 'black'; |
| 346 | 346 | //echo '<span style="font-weight: bold; color: #FF0000;">'.nl2br($answerComment).'</span>'; |
| 347 | - } |
|
| 348 | - if ($hide_expected_answer) { |
|
| 349 | - $color = ''; |
|
| 350 | - } |
|
| 347 | + } |
|
| 348 | + if ($hide_expected_answer) { |
|
| 349 | + $color = ''; |
|
| 350 | + } |
|
| 351 | 351 | echo '<span style="font-weight: bold; color: '.$color.';">'.nl2br($answerComment).'</span>'; |
| 352 | - } |
|
| 353 | - ?> |
|
| 352 | + } |
|
| 353 | + ?> |
|
| 354 | 354 | </td> |
| 355 | 355 | <?php |
| 356 | - if ($ans==1) { |
|
| 357 | - $comm = Event::get_comments($id,$questionId); |
|
| 358 | - } |
|
| 359 | - ?> |
|
| 356 | + if ($ans==1) { |
|
| 357 | + $comm = Event::get_comments($id,$questionId); |
|
| 358 | + } |
|
| 359 | + ?> |
|
| 360 | 360 | <?php } else { ?> |
| 361 | 361 | <td> </td> |
| 362 | 362 | <?php } ?> |
| 363 | 363 | </tr> |
| 364 | 364 | <?php |
| 365 | - } |
|
| 365 | + } |
|
| 366 | 366 | |
| 367 | 367 | /** |
| 368 | 368 | * Display the answers to a multiple choice question |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | if (isset($new_options[$studentChoice])) { |
| 416 | 416 | echo get_lang($new_options[$studentChoice]['name']); |
| 417 | 417 | } else { |
| 418 | - echo '-'; |
|
| 418 | + echo '-'; |
|
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | ?> |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | <td width="5%"> |
| 424 | 424 | <?php |
| 425 | 425 | |
| 426 | - // Expected choice |
|
| 426 | + // Expected choice |
|
| 427 | 427 | if (!$hide_expected_answer) { |
| 428 | 428 | if (isset($new_options[$answerCorrect])) { |
| 429 | 429 | echo get_lang($new_options[$answerCorrect]['name']); |
@@ -449,8 +449,8 @@ discard block |
||
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | if ($hide_expected_answer) { |
| 452 | - $color = ''; |
|
| 453 | - } |
|
| 452 | + $color = ''; |
|
| 453 | + } |
|
| 454 | 454 | |
| 455 | 455 | echo '<span style="font-weight: bold; color: '.$color.';">'.nl2br($answerComment).'</span>'; |
| 456 | 456 | } |
@@ -468,19 +468,19 @@ discard block |
||
| 468 | 468 | <?php |
| 469 | 469 | } |
| 470 | 470 | |
| 471 | - /** |
|
| 472 | - * Display the answers to a multiple choice question |
|
| 473 | - * |
|
| 474 | - * @param integer Answer type |
|
| 475 | - * @param integer Student choice |
|
| 476 | - * @param string Textual answer |
|
| 477 | - * @param string Comment on answer |
|
| 478 | - * @param string Correct answer comment |
|
| 479 | - * @param integer Exercise ID |
|
| 480 | - * @param integer Question ID |
|
| 481 | - * @param boolean Whether to show the answer comment or not |
|
| 482 | - * @return void |
|
| 483 | - */ |
|
| 471 | + /** |
|
| 472 | + * Display the answers to a multiple choice question |
|
| 473 | + * |
|
| 474 | + * @param integer Answer type |
|
| 475 | + * @param integer Student choice |
|
| 476 | + * @param string Textual answer |
|
| 477 | + * @param string Comment on answer |
|
| 478 | + * @param string Correct answer comment |
|
| 479 | + * @param integer Exercise ID |
|
| 480 | + * @param integer Question ID |
|
| 481 | + * @param boolean Whether to show the answer comment or not |
|
| 482 | + * @return void |
|
| 483 | + */ |
|
| 484 | 484 | public static function display_multiple_answer_combination_true_false( |
| 485 | 485 | $feedback_type, |
| 486 | 486 | $answerType, |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | <tr> |
| 512 | 512 | <td width="5%"> |
| 513 | 513 | <?php |
| 514 | - //Your choice |
|
| 514 | + //Your choice |
|
| 515 | 515 | $question = new MultipleAnswerCombinationTrueFalse(); |
| 516 | 516 | if (isset($question->options[$studentChoice])) { |
| 517 | 517 | echo $question->options[$studentChoice]; |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | </td> |
| 523 | 523 | <td width="5%"> |
| 524 | 524 | <?php |
| 525 | - // Expected choice |
|
| 525 | + // Expected choice |
|
| 526 | 526 | if (!$hide_expected_answer) { |
| 527 | 527 | if (isset($question->options[$answerCorrect])) { |
| 528 | 528 | echo $question->options[$answerCorrect]; |
@@ -547,7 +547,7 @@ discard block |
||
| 547 | 547 | <?php |
| 548 | 548 | //@todo replace this harcoded value |
| 549 | 549 | if ($studentChoice) { |
| 550 | - $color = "black"; |
|
| 550 | + $color = "black"; |
|
| 551 | 551 | if ($studentChoice == $answerCorrect) { |
| 552 | 552 | $color = "green"; |
| 553 | 553 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | </td> |
| 55 | 55 | |
| 56 | 56 | <?php |
| 57 | - if (!api_is_allowed_to_edit(null,true) && $feedbackType != EXERCISE_FEEDBACK_TYPE_EXAM) { ?> |
|
| 57 | + if (!api_is_allowed_to_edit(null, true) && $feedbackType != EXERCISE_FEEDBACK_TYPE_EXAM) { ?> |
|
| 58 | 58 | <td> |
| 59 | 59 | <?php |
| 60 | 60 | $comm = Event::get_comments($id, $questionId); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | $showTotalScoreAndUserChoices |
| 83 | 83 | ) { |
| 84 | 84 | if (empty($id)) { |
| 85 | - echo '<tr><td>'. Security::remove_XSS($answer).'</td></tr>'; |
|
| 85 | + echo '<tr><td>'.Security::remove_XSS($answer).'</td></tr>'; |
|
| 86 | 86 | } else { |
| 87 | 87 | ?> |
| 88 | 88 | <tr> |
@@ -93,10 +93,10 @@ discard block |
||
| 93 | 93 | </td> |
| 94 | 94 | |
| 95 | 95 | <?php |
| 96 | - if (!api_is_allowed_to_edit(null,true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?> |
|
| 96 | + if (!api_is_allowed_to_edit(null, true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?> |
|
| 97 | 97 | <td> |
| 98 | 98 | <?php |
| 99 | - $comm = Event::get_comments($id,$questionId); |
|
| 99 | + $comm = Event::get_comments($id, $questionId); |
|
| 100 | 100 | ?> |
| 101 | 101 | </td> |
| 102 | 102 | <?php } ?> |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | echo '</tr>'; |
| 165 | 165 | if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { |
| 166 | 166 | echo '<tr>'; |
| 167 | - echo Display::tag('td',get_lang('notCorrectedYet'), array('width'=>'45%')); |
|
| 167 | + echo Display::tag('td', get_lang('notCorrectedYet'), array('width'=>'45%')); |
|
| 168 | 168 | echo '</tr>'; |
| 169 | 169 | } else { |
| 170 | 170 | echo '<tr><td> </td></tr>'; |
@@ -177,9 +177,9 @@ discard block |
||
| 177 | 177 | } |
| 178 | 178 | echo '</td>'; |
| 179 | 179 | |
| 180 | - if (!api_is_allowed_to_edit(null,true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { |
|
| 180 | + if (!api_is_allowed_to_edit(null, true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { |
|
| 181 | 181 | echo '<td>'; |
| 182 | - $comm = Event::get_comments($id,$questionId); |
|
| 182 | + $comm = Event::get_comments($id, $questionId); |
|
| 183 | 183 | echo '</td>'; |
| 184 | 184 | } |
| 185 | 185 | echo '</tr>'; |
@@ -308,11 +308,11 @@ discard block |
||
| 308 | 308 | } |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | - $icon = in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION)) ? 'radio':'checkbox'; |
|
| 312 | - $icon .= $studentChoice?'_on':'_off'; |
|
| 311 | + $icon = in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION)) ? 'radio' : 'checkbox'; |
|
| 312 | + $icon .= $studentChoice ? '_on' : '_off'; |
|
| 313 | 313 | $icon .= '.gif'; |
| 314 | 314 | |
| 315 | - $iconAnswer = in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION)) ? 'radio':'checkbox'; |
|
| 315 | + $iconAnswer = in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION)) ? 'radio' : 'checkbox'; |
|
| 316 | 316 | $iconAnswer .= $answerCorrect ? '_on' : '_off'; |
| 317 | 317 | $iconAnswer .= '.gif'; |
| 318 | 318 | |
@@ -353,8 +353,8 @@ discard block |
||
| 353 | 353 | ?> |
| 354 | 354 | </td> |
| 355 | 355 | <?php |
| 356 | - if ($ans==1) { |
|
| 357 | - $comm = Event::get_comments($id,$questionId); |
|
| 356 | + if ($ans == 1) { |
|
| 357 | + $comm = Event::get_comments($id, $questionId); |
|
| 358 | 358 | } |
| 359 | 359 | ?> |
| 360 | 360 | <?php } else { ?> |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | ?> |
| 458 | 458 | </td> |
| 459 | 459 | <?php |
| 460 | - if ($ans==1) { |
|
| 460 | + if ($ans == 1) { |
|
| 461 | 461 | $comm = Event::get_comments($id, $questionId); |
| 462 | 462 | } |
| 463 | 463 | ?> |
@@ -560,8 +560,8 @@ discard block |
||
| 560 | 560 | ?> |
| 561 | 561 | </td> |
| 562 | 562 | <?php |
| 563 | - if ($ans==1) { |
|
| 564 | - $comm = Event::get_comments($id,$questionId); |
|
| 563 | + if ($ans == 1) { |
|
| 564 | + $comm = Event::get_comments($id, $questionId); |
|
| 565 | 565 | } |
| 566 | 566 | ?> |
| 567 | 567 | <?php } else { ?> |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | public $feedback_type; |
| 30 | 30 | public $end_time; |
| 31 | 31 | public $start_time; |
| 32 | - public $questionList; // array with the list of this exercise's questions |
|
| 32 | + public $questionList; // array with the list of this exercise's questions |
|
| 33 | 33 | /* including question list of the media */ |
| 34 | 34 | public $questionListUncompressed; |
| 35 | 35 | public $results_disabled; |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | $TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST); |
| 133 | 133 | $table_lp_item = Database::get_course_table(TABLE_LP_ITEM); |
| 134 | 134 | |
| 135 | - $id = intval($id); |
|
| 135 | + $id = intval($id); |
|
| 136 | 136 | if (empty($this->course_id)) { |
| 137 | 137 | |
| 138 | 138 | return false; |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | */ |
| 479 | 479 | public function isRandom() |
| 480 | 480 | { |
| 481 | - if($this->random > 0 || $this->random == -1) { |
|
| 481 | + if ($this->random > 0 || $this->random == -1) { |
|
| 482 | 482 | return true; |
| 483 | 483 | } else { |
| 484 | 484 | return false; |
@@ -639,7 +639,7 @@ discard block |
||
| 639 | 639 | $question_media = null; |
| 640 | 640 | if (!empty($objQuestionTmp->parent_id)) { |
| 641 | 641 | $objQuestionMedia = Question::read($objQuestionTmp->parent_id); |
| 642 | - $question_media = Question::getMediaLabel($objQuestionMedia->question); |
|
| 642 | + $question_media = Question::getMediaLabel($objQuestionMedia->question); |
|
| 643 | 643 | } |
| 644 | 644 | |
| 645 | 645 | $questionType = Display::tag('div', Display::return_icon($typeImg, $typeExpl, array(), ICON_SIZE_MEDIUM).$question_media); |
@@ -1032,7 +1032,7 @@ discard block |
||
| 1032 | 1032 | |
| 1033 | 1033 | foreach ($questions_by_category as $categoryId => $questionList) { |
| 1034 | 1034 | $cat = new TestCategory($categoryId); |
| 1035 | - $cat = (array)$cat; |
|
| 1035 | + $cat = (array) $cat; |
|
| 1036 | 1036 | $cat['iid'] = $cat['id']; |
| 1037 | 1037 | //*$cat['name'] = $cat['name']; |
| 1038 | 1038 | |
@@ -1097,7 +1097,7 @@ discard block |
||
| 1097 | 1097 | { |
| 1098 | 1098 | if ($this->specialCategoryOrders == false) { |
| 1099 | 1099 | if ($from_db && !empty($this->id)) { |
| 1100 | - $TBL_EXERCISE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); |
|
| 1100 | + $TBL_EXERCISE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); |
|
| 1101 | 1101 | $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION); |
| 1102 | 1102 | |
| 1103 | 1103 | $sql = "SELECT DISTINCT e.question_order |
@@ -1124,7 +1124,7 @@ discard block |
||
| 1124 | 1124 | $question_list = array(); |
| 1125 | 1125 | |
| 1126 | 1126 | while ($new_object = Database::fetch_object($result)) { |
| 1127 | - $question_list[$new_object->question_order]= $new_object->question_id; |
|
| 1127 | + $question_list[$new_object->question_order] = $new_object->question_id; |
|
| 1128 | 1128 | $temp_question_list[$counter] = $new_object->question_id; |
| 1129 | 1129 | $counter++; |
| 1130 | 1130 | } |
@@ -1268,7 +1268,7 @@ discard block |
||
| 1268 | 1268 | public function isInList($questionId) |
| 1269 | 1269 | { |
| 1270 | 1270 | if (is_array($this->questionList)) |
| 1271 | - return in_array($questionId,$this->questionList); |
|
| 1271 | + return in_array($questionId, $this->questionList); |
|
| 1272 | 1272 | else |
| 1273 | 1273 | return false; |
| 1274 | 1274 | } |
@@ -1281,7 +1281,7 @@ discard block |
||
| 1281 | 1281 | */ |
| 1282 | 1282 | public function updateTitle($title) |
| 1283 | 1283 | { |
| 1284 | - $this->exercise=$title; |
|
| 1284 | + $this->exercise = $title; |
|
| 1285 | 1285 | } |
| 1286 | 1286 | |
| 1287 | 1287 | /** |
@@ -1291,7 +1291,7 @@ discard block |
||
| 1291 | 1291 | */ |
| 1292 | 1292 | public function updateAttempts($attempts) |
| 1293 | 1293 | { |
| 1294 | - $this->attempts=$attempts; |
|
| 1294 | + $this->attempts = $attempts; |
|
| 1295 | 1295 | } |
| 1296 | 1296 | |
| 1297 | 1297 | /** |
@@ -1301,7 +1301,7 @@ discard block |
||
| 1301 | 1301 | */ |
| 1302 | 1302 | public function updateFeedbackType($feedback_type) |
| 1303 | 1303 | { |
| 1304 | - $this->feedback_type=$feedback_type; |
|
| 1304 | + $this->feedback_type = $feedback_type; |
|
| 1305 | 1305 | } |
| 1306 | 1306 | |
| 1307 | 1307 | /** |
@@ -1312,7 +1312,7 @@ discard block |
||
| 1312 | 1312 | */ |
| 1313 | 1313 | public function updateDescription($description) |
| 1314 | 1314 | { |
| 1315 | - $this->description=$description; |
|
| 1315 | + $this->description = $description; |
|
| 1316 | 1316 | } |
| 1317 | 1317 | |
| 1318 | 1318 | /** |
@@ -1442,23 +1442,23 @@ discard block |
||
| 1442 | 1442 | * @param string $sound - exercise sound file |
| 1443 | 1443 | * @param string $delete - ask to delete the file |
| 1444 | 1444 | */ |
| 1445 | - public function updateSound($sound,$delete) |
|
| 1445 | + public function updateSound($sound, $delete) |
|
| 1446 | 1446 | { |
| 1447 | 1447 | global $audioPath, $documentPath; |
| 1448 | 1448 | $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT); |
| 1449 | 1449 | |
| 1450 | - if ($sound['size'] && (strstr($sound['type'],'audio') || strstr($sound['type'],'video'))) { |
|
| 1451 | - $this->sound=$sound['name']; |
|
| 1450 | + if ($sound['size'] && (strstr($sound['type'], 'audio') || strstr($sound['type'], 'video'))) { |
|
| 1451 | + $this->sound = $sound['name']; |
|
| 1452 | 1452 | |
| 1453 | - if (@move_uploaded_file($sound['tmp_name'],$audioPath.'/'.$this->sound)) { |
|
| 1453 | + if (@move_uploaded_file($sound['tmp_name'], $audioPath.'/'.$this->sound)) { |
|
| 1454 | 1454 | $query = "SELECT 1 FROM $TBL_DOCUMENT |
| 1455 | - WHERE c_id = ".$this->course_id." AND path='".str_replace($documentPath,'',$audioPath).'/'.$this->sound."'"; |
|
| 1456 | - $result=Database::query($query); |
|
| 1455 | + WHERE c_id = ".$this->course_id." AND path='".str_replace($documentPath, '', $audioPath).'/'.$this->sound."'"; |
|
| 1456 | + $result = Database::query($query); |
|
| 1457 | 1457 | |
| 1458 | 1458 | if (!Database::num_rows($result)) { |
| 1459 | 1459 | $id = add_document( |
| 1460 | 1460 | $this->course, |
| 1461 | - str_replace($documentPath,'',$audioPath).'/'.$this->sound, |
|
| 1461 | + str_replace($documentPath, '', $audioPath).'/'.$this->sound, |
|
| 1462 | 1462 | 'file', |
| 1463 | 1463 | $sound['size'], |
| 1464 | 1464 | $sound['name'] |
@@ -1477,8 +1477,8 @@ discard block |
||
| 1477 | 1477 | ); |
| 1478 | 1478 | } |
| 1479 | 1479 | } |
| 1480 | - } elseif($delete && is_file($audioPath.'/'.$this->sound)) { |
|
| 1481 | - $this->sound=''; |
|
| 1480 | + } elseif ($delete && is_file($audioPath.'/'.$this->sound)) { |
|
| 1481 | + $this->sound = ''; |
|
| 1482 | 1482 | } |
| 1483 | 1483 | } |
| 1484 | 1484 | |
@@ -1490,7 +1490,7 @@ discard block |
||
| 1490 | 1490 | */ |
| 1491 | 1491 | public function updateType($type) |
| 1492 | 1492 | { |
| 1493 | - $this->type=$type; |
|
| 1493 | + $this->type = $type; |
|
| 1494 | 1494 | } |
| 1495 | 1495 | |
| 1496 | 1496 | /** |
@@ -1526,7 +1526,7 @@ discard block |
||
| 1526 | 1526 | */ |
| 1527 | 1527 | public function enable() |
| 1528 | 1528 | { |
| 1529 | - $this->active=1; |
|
| 1529 | + $this->active = 1; |
|
| 1530 | 1530 | } |
| 1531 | 1531 | |
| 1532 | 1532 | /** |
@@ -1536,7 +1536,7 @@ discard block |
||
| 1536 | 1536 | */ |
| 1537 | 1537 | public function disable() |
| 1538 | 1538 | { |
| 1539 | - $this->active=0; |
|
| 1539 | + $this->active = 0; |
|
| 1540 | 1540 | } |
| 1541 | 1541 | |
| 1542 | 1542 | /** |
@@ -1664,7 +1664,7 @@ discard block |
||
| 1664 | 1664 | api_get_user_id() |
| 1665 | 1665 | ); |
| 1666 | 1666 | |
| 1667 | - if (api_get_setting('search_enabled')=='true') { |
|
| 1667 | + if (api_get_setting('search_enabled') == 'true') { |
|
| 1668 | 1668 | $this->search_engine_edit(); |
| 1669 | 1669 | } |
| 1670 | 1670 | } else { |
@@ -1812,7 +1812,7 @@ discard block |
||
| 1812 | 1812 | public function removeFromList($questionId) |
| 1813 | 1813 | { |
| 1814 | 1814 | // searches the position of the question ID in the list |
| 1815 | - $pos = array_search($questionId,$this->questionList); |
|
| 1815 | + $pos = array_search($questionId, $this->questionList); |
|
| 1816 | 1816 | |
| 1817 | 1817 | // question not found |
| 1818 | 1818 | if ($pos === false) { |
@@ -1847,7 +1847,7 @@ discard block |
||
| 1847 | 1847 | api_item_property_update($this->course, TOOL_QUIZ, $this->id, 'QuizDeleted', api_get_user_id()); |
| 1848 | 1848 | api_item_property_update($this->course, TOOL_QUIZ, $this->id, 'delete', api_get_user_id()); |
| 1849 | 1849 | |
| 1850 | - if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian') ) { |
|
| 1850 | + if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) { |
|
| 1851 | 1851 | $this->search_engine_delete(); |
| 1852 | 1852 | } |
| 1853 | 1853 | } |
@@ -1856,7 +1856,7 @@ discard block |
||
| 1856 | 1856 | * Creates the form to create / edit an exercise |
| 1857 | 1857 | * @param FormValidator $form |
| 1858 | 1858 | */ |
| 1859 | - public function createForm($form, $type='full') |
|
| 1859 | + public function createForm($form, $type = 'full') |
|
| 1860 | 1860 | { |
| 1861 | 1861 | if (empty($type)) { |
| 1862 | 1862 | $type = 'full'; |
@@ -1887,7 +1887,7 @@ discard block |
||
| 1887 | 1887 | 'Width' => '100%', |
| 1888 | 1888 | 'Height' => '150', |
| 1889 | 1889 | ); |
| 1890 | - if (is_array($type)){ |
|
| 1890 | + if (is_array($type)) { |
|
| 1891 | 1891 | $editor_config = array_merge($editor_config, $type); |
| 1892 | 1892 | } |
| 1893 | 1893 | |
@@ -1941,7 +1941,7 @@ discard block |
||
| 1941 | 1941 | '2', |
| 1942 | 1942 | array('id' => 'exerciseType_2') |
| 1943 | 1943 | ); |
| 1944 | - $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'),get_lang('FeedbackDisplayOptions')), ''); |
|
| 1944 | + $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'), get_lang('FeedbackDisplayOptions')), ''); |
|
| 1945 | 1945 | |
| 1946 | 1946 | // Type of results display on the final page |
| 1947 | 1947 | $radios_results_disabled = array(); |
@@ -1985,8 +1985,8 @@ discard block |
||
| 1985 | 1985 | // Type of questions disposition on page |
| 1986 | 1986 | $radios = array(); |
| 1987 | 1987 | |
| 1988 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all')); |
|
| 1989 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'),'2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one')); |
|
| 1988 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all')); |
|
| 1989 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'), '2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one')); |
|
| 1990 | 1990 | |
| 1991 | 1991 | $form->addGroup($radios, null, get_lang('QuestionsPerPage'), ''); |
| 1992 | 1992 | |
@@ -1996,33 +1996,33 @@ discard block |
||
| 1996 | 1996 | |
| 1997 | 1997 | // feedback type |
| 1998 | 1998 | $radios_feedback = array(); |
| 1999 | - $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('ExerciseAtTheEndOfTheTest'),'0',array('id' =>'exerciseType_0', 'onclick' => 'check_feedback()')); |
|
| 1999 | + $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('ExerciseAtTheEndOfTheTest'), '0', array('id' =>'exerciseType_0', 'onclick' => 'check_feedback()')); |
|
| 2000 | 2000 | |
| 2001 | 2001 | if (api_get_setting('enable_quiz_scenario') == 'true') { |
| 2002 | - $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('DirectFeedback'), '1', array('id' =>'exerciseType_1' , 'onclick' => 'check_direct_feedback()')); |
|
| 2002 | + $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('DirectFeedback'), '1', array('id' =>'exerciseType_1', 'onclick' => 'check_direct_feedback()')); |
|
| 2003 | 2003 | } |
| 2004 | - $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('NoFeedback'),'2',array('id' =>'exerciseType_2')); |
|
| 2005 | - $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'),get_lang('FeedbackDisplayOptions'))); |
|
| 2004 | + $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('NoFeedback'), '2', array('id' =>'exerciseType_2')); |
|
| 2005 | + $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'), get_lang('FeedbackDisplayOptions'))); |
|
| 2006 | 2006 | |
| 2007 | 2007 | //$form->addElement('select', 'exerciseFeedbackType',get_lang('FeedbackType'),$feedback_option,'onchange="javascript:feedbackselection()"'); |
| 2008 | 2008 | $radios_results_disabled = array(); |
| 2009 | 2009 | $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('ShowScoreAndRightAnswer'), '0', array('id'=>'result_disabled_0')); |
| 2010 | - $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1',array('id'=>'result_disabled_1','onclick' => 'check_results_disabled()')); |
|
| 2011 | - $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2',array('id'=>'result_disabled_2','onclick' => 'check_results_disabled()')); |
|
| 2012 | - $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'),''); |
|
| 2010 | + $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1', array('id'=>'result_disabled_1', 'onclick' => 'check_results_disabled()')); |
|
| 2011 | + $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2', array('id'=>'result_disabled_2', 'onclick' => 'check_results_disabled()')); |
|
| 2012 | + $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'), ''); |
|
| 2013 | 2013 | |
| 2014 | 2014 | // Type of questions disposition on page |
| 2015 | 2015 | $radios = array(); |
| 2016 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1'); |
|
| 2017 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'),'2'); |
|
| 2016 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1'); |
|
| 2017 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'), '2'); |
|
| 2018 | 2018 | $form->addGroup($radios, null, get_lang('ExerciseType')); |
| 2019 | 2019 | |
| 2020 | 2020 | } else { |
| 2021 | 2021 | //Show options freeze |
| 2022 | 2022 | $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('ShowScoreAndRightAnswer'), '0', array('id'=>'result_disabled_0')); |
| 2023 | - $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1',array('id'=>'result_disabled_1','onclick' => 'check_results_disabled()')); |
|
| 2024 | - $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2',array('id'=>'result_disabled_2','onclick' => 'check_results_disabled()')); |
|
| 2025 | - $result_disable_group = $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'),''); |
|
| 2023 | + $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1', array('id'=>'result_disabled_1', 'onclick' => 'check_results_disabled()')); |
|
| 2024 | + $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2', array('id'=>'result_disabled_2', 'onclick' => 'check_results_disabled()')); |
|
| 2025 | + $result_disable_group = $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'), ''); |
|
| 2026 | 2026 | $result_disable_group->freeze(); |
| 2027 | 2027 | |
| 2028 | 2028 | //we force the options to the DirectFeedback exercisetype |
@@ -2030,8 +2030,8 @@ discard block |
||
| 2030 | 2030 | $form->addElement('hidden', 'exerciseType', ONE_PER_PAGE); |
| 2031 | 2031 | |
| 2032 | 2032 | // Type of questions disposition on page |
| 2033 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all')); |
|
| 2034 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'),'2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one')); |
|
| 2033 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all')); |
|
| 2034 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'), '2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one')); |
|
| 2035 | 2035 | |
| 2036 | 2036 | $type_group = $form->addGroup($radios, null, get_lang('QuestionsPerPage'), ''); |
| 2037 | 2037 | $type_group->freeze(); |
@@ -2163,26 +2163,26 @@ discard block |
||
| 2163 | 2163 | |
| 2164 | 2164 | // number of random question |
| 2165 | 2165 | |
| 2166 | - $max = ($this->id > 0) ? $this->selectNbrQuestions() : 10 ; |
|
| 2166 | + $max = ($this->id > 0) ? $this->selectNbrQuestions() : 10; |
|
| 2167 | 2167 | $option = range(0, $max); |
| 2168 | 2168 | $option[0] = get_lang('No'); |
| 2169 | 2169 | $option[-1] = get_lang('AllQuestionsShort'); |
| 2170 | - $form->addElement('select', 'randomQuestions',array(get_lang('RandomQuestions'), get_lang('RandomQuestionsHelp')), $option, array('id'=>'randomQuestions')); |
|
| 2170 | + $form->addElement('select', 'randomQuestions', array(get_lang('RandomQuestions'), get_lang('RandomQuestionsHelp')), $option, array('id'=>'randomQuestions')); |
|
| 2171 | 2171 | |
| 2172 | 2172 | // Random answers |
| 2173 | 2173 | $radios_random_answers = array(); |
| 2174 | - $radios_random_answers[] = $form->createElement('radio', 'randomAnswers', null, get_lang('Yes'),'1'); |
|
| 2175 | - $radios_random_answers[] = $form->createElement('radio', 'randomAnswers', null, get_lang('No'),'0'); |
|
| 2174 | + $radios_random_answers[] = $form->createElement('radio', 'randomAnswers', null, get_lang('Yes'), '1'); |
|
| 2175 | + $radios_random_answers[] = $form->createElement('radio', 'randomAnswers', null, get_lang('No'), '0'); |
|
| 2176 | 2176 | $form->addGroup($radios_random_answers, null, get_lang('RandomAnswers'), ''); |
| 2177 | 2177 | |
| 2178 | 2178 | // Random by category |
| 2179 | - $form->addElement('html','<div class="clear"> </div>'); |
|
| 2179 | + $form->addElement('html', '<div class="clear"> </div>'); |
|
| 2180 | 2180 | $radiocat = array(); |
| 2181 | - $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('YesWithCategoriesShuffled'),'1'); |
|
| 2182 | - $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('YesWithCategoriesSorted'),'2'); |
|
| 2183 | - $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('No'),'0'); |
|
| 2181 | + $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('YesWithCategoriesShuffled'), '1'); |
|
| 2182 | + $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('YesWithCategoriesSorted'), '2'); |
|
| 2183 | + $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('No'), '0'); |
|
| 2184 | 2184 | $radioCatGroup = $form->addGroup($radiocat, null, get_lang('RandomQuestionByCategory'), ''); |
| 2185 | - $form->addElement('html','<div class="clear"> </div>'); |
|
| 2185 | + $form->addElement('html', '<div class="clear"> </div>'); |
|
| 2186 | 2186 | |
| 2187 | 2187 | // add the radio display the category name for student |
| 2188 | 2188 | $radio_display_cat_name = array(); |
@@ -2203,36 +2203,36 @@ discard block |
||
| 2203 | 2203 | ); |
| 2204 | 2204 | |
| 2205 | 2205 | // Exercise time limit |
| 2206 | - $form->addElement('checkbox', 'activate_start_date_check',null, get_lang('EnableStartTime'), array('onclick' => 'activate_start_date()')); |
|
| 2206 | + $form->addElement('checkbox', 'activate_start_date_check', null, get_lang('EnableStartTime'), array('onclick' => 'activate_start_date()')); |
|
| 2207 | 2207 | |
| 2208 | 2208 | $var = Exercise::selectTimeLimit(); |
| 2209 | 2209 | |
| 2210 | 2210 | if (($this->start_time != '0000-00-00 00:00:00')) |
| 2211 | - $form->addElement('html','<div id="start_date_div" style="display:block;">'); |
|
| 2211 | + $form->addElement('html', '<div id="start_date_div" style="display:block;">'); |
|
| 2212 | 2212 | else |
| 2213 | - $form->addElement('html','<div id="start_date_div" style="display:none;">'); |
|
| 2213 | + $form->addElement('html', '<div id="start_date_div" style="display:none;">'); |
|
| 2214 | 2214 | |
| 2215 | 2215 | $form->addElement('date_time_picker', 'start_time'); |
| 2216 | 2216 | |
| 2217 | - $form->addElement('html','</div>'); |
|
| 2217 | + $form->addElement('html', '</div>'); |
|
| 2218 | 2218 | |
| 2219 | - $form->addElement('checkbox', 'activate_end_date_check', null , get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()')); |
|
| 2219 | + $form->addElement('checkbox', 'activate_end_date_check', null, get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()')); |
|
| 2220 | 2220 | |
| 2221 | 2221 | if (($this->end_time != '0000-00-00 00:00:00')) |
| 2222 | - $form->addElement('html','<div id="end_date_div" style="display:block;">'); |
|
| 2222 | + $form->addElement('html', '<div id="end_date_div" style="display:block;">'); |
|
| 2223 | 2223 | else |
| 2224 | - $form->addElement('html','<div id="end_date_div" style="display:none;">'); |
|
| 2224 | + $form->addElement('html', '<div id="end_date_div" style="display:none;">'); |
|
| 2225 | 2225 | |
| 2226 | 2226 | $form->addElement('date_time_picker', 'end_time'); |
| 2227 | - $form->addElement('html','</div>'); |
|
| 2227 | + $form->addElement('html', '</div>'); |
|
| 2228 | 2228 | |
| 2229 | 2229 | //$check_option=$this->selectType(); |
| 2230 | 2230 | $diplay = 'block'; |
| 2231 | 2231 | $form->addElement('checkbox', 'propagate_neg', null, get_lang('PropagateNegativeResults')); |
| 2232 | - $form->addElement('html','<div class="clear"> </div>'); |
|
| 2232 | + $form->addElement('html', '<div class="clear"> </div>'); |
|
| 2233 | 2233 | $form->addElement('checkbox', 'review_answers', null, get_lang('ReviewAnswers')); |
| 2234 | 2234 | |
| 2235 | - $form->addElement('html','<div id="divtimecontrol" style="display:'.$diplay.';">'); |
|
| 2235 | + $form->addElement('html', '<div id="divtimecontrol" style="display:'.$diplay.';">'); |
|
| 2236 | 2236 | |
| 2237 | 2237 | //Timer control |
| 2238 | 2238 | //$time_hours_option = range(0,12); |
@@ -2248,12 +2248,12 @@ discard block |
||
| 2248 | 2248 | 'onload' => 'check_load_time()', |
| 2249 | 2249 | ) |
| 2250 | 2250 | ); |
| 2251 | - $expired_date = (int)$this->selectExpiredTime(); |
|
| 2251 | + $expired_date = (int) $this->selectExpiredTime(); |
|
| 2252 | 2252 | |
| 2253 | - if (($expired_date!='0')) { |
|
| 2254 | - $form->addElement('html','<div id="timercontrol" style="display:block;">'); |
|
| 2253 | + if (($expired_date != '0')) { |
|
| 2254 | + $form->addElement('html', '<div id="timercontrol" style="display:block;">'); |
|
| 2255 | 2255 | } else { |
| 2256 | - $form->addElement('html','<div id="timercontrol" style="display:none;">'); |
|
| 2256 | + $form->addElement('html', '<div id="timercontrol" style="display:none;">'); |
|
| 2257 | 2257 | } |
| 2258 | 2258 | $form->addText( |
| 2259 | 2259 | 'enabletimercontroltotalminutes', |
@@ -2264,7 +2264,7 @@ discard block |
||
| 2264 | 2264 | 'cols-size' => [2, 2, 8] |
| 2265 | 2265 | ] |
| 2266 | 2266 | ); |
| 2267 | - $form->addElement('html','</div>'); |
|
| 2267 | + $form->addElement('html', '</div>'); |
|
| 2268 | 2268 | |
| 2269 | 2269 | $form->addElement( |
| 2270 | 2270 | 'text', |
@@ -2288,23 +2288,23 @@ discard block |
||
| 2288 | 2288 | $defaults = array(); |
| 2289 | 2289 | |
| 2290 | 2290 | if (api_get_setting('search_enabled') === 'true') { |
| 2291 | - require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'; |
|
| 2291 | + require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
|
| 2292 | 2292 | |
| 2293 | - $form->addElement ('checkbox', 'index_document','', get_lang('SearchFeatureDoIndexDocument')); |
|
| 2294 | - $form->addElement ('select_language', 'language', get_lang('SearchFeatureDocumentLanguage')); |
|
| 2293 | + $form->addElement('checkbox', 'index_document', '', get_lang('SearchFeatureDoIndexDocument')); |
|
| 2294 | + $form->addElement('select_language', 'language', get_lang('SearchFeatureDocumentLanguage')); |
|
| 2295 | 2295 | |
| 2296 | 2296 | $specific_fields = get_specific_field_list(); |
| 2297 | 2297 | |
| 2298 | 2298 | foreach ($specific_fields as $specific_field) { |
| 2299 | - $form->addElement ('text', $specific_field['code'], $specific_field['name']); |
|
| 2299 | + $form->addElement('text', $specific_field['code'], $specific_field['name']); |
|
| 2300 | 2300 | $filter = array( |
| 2301 | 2301 | 'c_id' => api_get_course_int_id(), |
| 2302 | 2302 | 'field_id' => $specific_field['id'], |
| 2303 | 2303 | 'ref_id' => $this->id, |
| 2304 | - 'tool_id' => "'" . TOOL_QUIZ . "'" |
|
| 2304 | + 'tool_id' => "'".TOOL_QUIZ."'" |
|
| 2305 | 2305 | ); |
| 2306 | 2306 | $values = get_specific_field_values_list($filter, array('value')); |
| 2307 | - if ( !empty($values) ) { |
|
| 2307 | + if (!empty($values)) { |
|
| 2308 | 2308 | $arr_str_values = array(); |
| 2309 | 2309 | foreach ($values as $value) { |
| 2310 | 2310 | $arr_str_values[] = $value['value']; |
@@ -2315,8 +2315,8 @@ discard block |
||
| 2315 | 2315 | //$form->addElement ('html','</div>'); |
| 2316 | 2316 | } |
| 2317 | 2317 | |
| 2318 | - $form->addElement('html','</div>'); //End advanced setting |
|
| 2319 | - $form->addElement('html','</div>'); |
|
| 2318 | + $form->addElement('html', '</div>'); //End advanced setting |
|
| 2319 | + $form->addElement('html', '</div>'); |
|
| 2320 | 2320 | } |
| 2321 | 2321 | |
| 2322 | 2322 | // submit |
@@ -2336,10 +2336,10 @@ discard block |
||
| 2336 | 2336 | } |
| 2337 | 2337 | |
| 2338 | 2338 | // defaults |
| 2339 | - if ($type=='full') { |
|
| 2339 | + if ($type == 'full') { |
|
| 2340 | 2340 | if ($this->id > 0) { |
| 2341 | 2341 | if ($this->random > $this->selectNbrQuestions()) { |
| 2342 | - $defaults['randomQuestions'] = $this->selectNbrQuestions(); |
|
| 2342 | + $defaults['randomQuestions'] = $this->selectNbrQuestions(); |
|
| 2343 | 2343 | } else { |
| 2344 | 2344 | $defaults['randomQuestions'] = $this->random; |
| 2345 | 2345 | } |
@@ -2366,8 +2366,8 @@ discard block |
||
| 2366 | 2366 | $defaults['activate_end_date_check'] = 1; |
| 2367 | 2367 | } |
| 2368 | 2368 | |
| 2369 | - $defaults['start_time'] = ($this->start_time!='0000-00-00 00:00:00') ? api_get_local_time($this->start_time) : date('Y-m-d 12:00:00'); |
|
| 2370 | - $defaults['end_time'] = ($this->end_time!='0000-00-00 00:00:00') ? api_get_local_time($this->end_time) : date('Y-m-d 12:00:00', time()+84600); |
|
| 2369 | + $defaults['start_time'] = ($this->start_time != '0000-00-00 00:00:00') ? api_get_local_time($this->start_time) : date('Y-m-d 12:00:00'); |
|
| 2370 | + $defaults['end_time'] = ($this->end_time != '0000-00-00 00:00:00') ? api_get_local_time($this->end_time) : date('Y-m-d 12:00:00', time() + 84600); |
|
| 2371 | 2371 | |
| 2372 | 2372 | // Get expired time |
| 2373 | 2373 | if ($this->expired_time != '0') { |
@@ -2388,7 +2388,7 @@ discard block |
||
| 2388 | 2388 | $defaults['text_when_finished'] = ""; |
| 2389 | 2389 | $defaults['start_time'] = date('Y-m-d 12:00:00'); |
| 2390 | 2390 | $defaults['display_category_name'] = 1; |
| 2391 | - $defaults['end_time'] = date('Y-m-d 12:00:00', time()+84600); |
|
| 2391 | + $defaults['end_time'] = date('Y-m-d 12:00:00', time() + 84600); |
|
| 2392 | 2392 | $defaults['pass_percentage'] = ''; |
| 2393 | 2393 | $defaults['end_button'] = $this->selectEndButton(); |
| 2394 | 2394 | $defaults['question_selection_type'] = 1; |
@@ -2474,7 +2474,7 @@ discard block |
||
| 2474 | 2474 | $end_time = $form->getSubmitValue('end_time'); |
| 2475 | 2475 | $this->end_time = api_get_utc_datetime($end_time); |
| 2476 | 2476 | } else { |
| 2477 | - $this->end_time = '0000-00-00 00:00:00'; |
|
| 2477 | + $this->end_time = '0000-00-00 00:00:00'; |
|
| 2478 | 2478 | } |
| 2479 | 2479 | |
| 2480 | 2480 | if ($form->getSubmitValue('enabletimercontrol') == 1) { |
@@ -2487,9 +2487,9 @@ discard block |
||
| 2487 | 2487 | } |
| 2488 | 2488 | |
| 2489 | 2489 | if ($form->getSubmitValue('randomAnswers') == 1) { |
| 2490 | - $this->random_answers=1; |
|
| 2490 | + $this->random_answers = 1; |
|
| 2491 | 2491 | } else { |
| 2492 | - $this->random_answers=0; |
|
| 2492 | + $this->random_answers = 0; |
|
| 2493 | 2493 | } |
| 2494 | 2494 | $this->save($type); |
| 2495 | 2495 | } |
@@ -2501,9 +2501,9 @@ discard block |
||
| 2501 | 2501 | } |
| 2502 | 2502 | $course_id = api_get_course_id(); |
| 2503 | 2503 | |
| 2504 | - require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php'; |
|
| 2505 | - require_once api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php'; |
|
| 2506 | - require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'; |
|
| 2504 | + require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'; |
|
| 2505 | + require_once api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php'; |
|
| 2506 | + require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
|
| 2507 | 2507 | |
| 2508 | 2508 | $specific_fields = get_specific_field_list(); |
| 2509 | 2509 | $ic_slide = new IndexableChunk(); |
@@ -2513,7 +2513,7 @@ discard block |
||
| 2513 | 2513 | if (isset($_REQUEST[$specific_field['code']])) { |
| 2514 | 2514 | $sterms = trim($_REQUEST[$specific_field['code']]); |
| 2515 | 2515 | if (!empty($sterms)) { |
| 2516 | - $all_specific_terms .= ' '. $sterms; |
|
| 2516 | + $all_specific_terms .= ' '.$sterms; |
|
| 2517 | 2517 | $sterms = explode(',', $sterms); |
| 2518 | 2518 | foreach ($sterms as $sterm) { |
| 2519 | 2519 | $ic_slide->addTerm(trim($sterm), $specific_field['code']); |
@@ -2530,15 +2530,15 @@ discard block |
||
| 2530 | 2530 | $xapian_data = array( |
| 2531 | 2531 | SE_COURSE_ID => $course_id, |
| 2532 | 2532 | SE_TOOL_ID => TOOL_QUIZ, |
| 2533 | - SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int)$this->id), |
|
| 2534 | - SE_USER => (int)api_get_user_id(), |
|
| 2533 | + SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int) $this->id), |
|
| 2534 | + SE_USER => (int) api_get_user_id(), |
|
| 2535 | 2535 | ); |
| 2536 | 2536 | $ic_slide->xapian_data = serialize($xapian_data); |
| 2537 | - $exercise_description = $all_specific_terms .' '. $this->description; |
|
| 2537 | + $exercise_description = $all_specific_terms.' '.$this->description; |
|
| 2538 | 2538 | $ic_slide->addValue("content", $exercise_description); |
| 2539 | 2539 | |
| 2540 | 2540 | $di = new ChamiloIndexer(); |
| 2541 | - isset($_POST['language'])? $lang=Database::escape_string($_POST['language']): $lang = 'english'; |
|
| 2541 | + isset($_POST['language']) ? $lang = Database::escape_string($_POST['language']) : $lang = 'english'; |
|
| 2542 | 2542 | $di->connectDb(NULL, NULL, $lang); |
| 2543 | 2543 | $di->addChunk($ic_slide); |
| 2544 | 2544 | |
@@ -2557,7 +2557,7 @@ discard block |
||
| 2557 | 2557 | function search_engine_edit() |
| 2558 | 2558 | { |
| 2559 | 2559 | // update search enchine and its values table if enabled |
| 2560 | - if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian')) { |
|
| 2560 | + if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) { |
|
| 2561 | 2561 | $course_id = api_get_course_id(); |
| 2562 | 2562 | |
| 2563 | 2563 | // actually, it consists on delete terms from db, |
@@ -2569,9 +2569,9 @@ discard block |
||
| 2569 | 2569 | $res = Database::query($sql); |
| 2570 | 2570 | |
| 2571 | 2571 | if (Database::num_rows($res) > 0) { |
| 2572 | - require_once(api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php'); |
|
| 2573 | - require_once(api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php'); |
|
| 2574 | - require_once(api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'); |
|
| 2572 | + require_once(api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'); |
|
| 2573 | + require_once(api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php'); |
|
| 2574 | + require_once(api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'); |
|
| 2575 | 2575 | |
| 2576 | 2576 | $se_ref = Database::fetch_array($res); |
| 2577 | 2577 | $specific_fields = get_specific_field_list(); |
@@ -2582,7 +2582,7 @@ discard block |
||
| 2582 | 2582 | delete_all_specific_field_value($course_id, $specific_field['id'], TOOL_QUIZ, $this->id); |
| 2583 | 2583 | if (isset($_REQUEST[$specific_field['code']])) { |
| 2584 | 2584 | $sterms = trim($_REQUEST[$specific_field['code']]); |
| 2585 | - $all_specific_terms .= ' '. $sterms; |
|
| 2585 | + $all_specific_terms .= ' '.$sterms; |
|
| 2586 | 2586 | $sterms = explode(',', $sterms); |
| 2587 | 2587 | foreach ($sterms as $sterm) { |
| 2588 | 2588 | $ic_slide->addTerm(trim($sterm), $specific_field['code']); |
@@ -2598,17 +2598,17 @@ discard block |
||
| 2598 | 2598 | $xapian_data = array( |
| 2599 | 2599 | SE_COURSE_ID => $course_id, |
| 2600 | 2600 | SE_TOOL_ID => TOOL_QUIZ, |
| 2601 | - SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int)$this->id), |
|
| 2602 | - SE_USER => (int)api_get_user_id(), |
|
| 2601 | + SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int) $this->id), |
|
| 2602 | + SE_USER => (int) api_get_user_id(), |
|
| 2603 | 2603 | ); |
| 2604 | 2604 | $ic_slide->xapian_data = serialize($xapian_data); |
| 2605 | - $exercise_description = $all_specific_terms .' '. $this->description; |
|
| 2605 | + $exercise_description = $all_specific_terms.' '.$this->description; |
|
| 2606 | 2606 | $ic_slide->addValue("content", $exercise_description); |
| 2607 | 2607 | |
| 2608 | 2608 | $di = new ChamiloIndexer(); |
| 2609 | - isset($_POST['language'])? $lang=Database::escape_string($_POST['language']): $lang = 'english'; |
|
| 2609 | + isset($_POST['language']) ? $lang = Database::escape_string($_POST['language']) : $lang = 'english'; |
|
| 2610 | 2610 | $di->connectDb(NULL, NULL, $lang); |
| 2611 | - $di->remove_document((int)$se_ref['search_did']); |
|
| 2611 | + $di->remove_document((int) $se_ref['search_did']); |
|
| 2612 | 2612 | $di->addChunk($ic_slide); |
| 2613 | 2613 | |
| 2614 | 2614 | //index and return search engine document id |
@@ -2633,7 +2633,7 @@ discard block |
||
| 2633 | 2633 | function search_engine_delete() |
| 2634 | 2634 | { |
| 2635 | 2635 | // remove from search engine if enabled |
| 2636 | - if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian') ) { |
|
| 2636 | + if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) { |
|
| 2637 | 2637 | $course_id = api_get_course_id(); |
| 2638 | 2638 | $tbl_se_ref = Database::get_main_table(TABLE_MAIN_SEARCH_ENGINE_REF); |
| 2639 | 2639 | $sql = 'SELECT * FROM %s WHERE course_code=\'%s\' AND tool_id=\'%s\' AND ref_id_high_level=%s AND ref_id_second_level IS NULL LIMIT 1'; |
@@ -2641,19 +2641,19 @@ discard block |
||
| 2641 | 2641 | $res = Database::query($sql); |
| 2642 | 2642 | if (Database::num_rows($res) > 0) { |
| 2643 | 2643 | $row = Database::fetch_array($res); |
| 2644 | - require_once(api_get_path(LIBRARY_PATH) .'search/ChamiloIndexer.class.php'); |
|
| 2644 | + require_once(api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'); |
|
| 2645 | 2645 | $di = new ChamiloIndexer(); |
| 2646 | - $di->remove_document((int)$row['search_did']); |
|
| 2646 | + $di->remove_document((int) $row['search_did']); |
|
| 2647 | 2647 | unset($di); |
| 2648 | 2648 | $tbl_quiz_question = Database::get_course_table(TABLE_QUIZ_QUESTION); |
| 2649 | - foreach ( $this->questionList as $question_i) { |
|
| 2649 | + foreach ($this->questionList as $question_i) { |
|
| 2650 | 2650 | $sql = 'SELECT type FROM %s WHERE id=%s'; |
| 2651 | 2651 | $sql = sprintf($sql, $tbl_quiz_question, $question_i); |
| 2652 | 2652 | $qres = Database::query($sql); |
| 2653 | 2653 | if (Database::num_rows($qres) > 0) { |
| 2654 | 2654 | $qrow = Database::fetch_array($qres); |
| 2655 | 2655 | $objQuestion = Question::getInstance($qrow['type']); |
| 2656 | - $objQuestion = Question::read((int)$question_i); |
|
| 2656 | + $objQuestion = Question::read((int) $question_i); |
|
| 2657 | 2657 | $objQuestion->search_engine_edit($this->id, FALSE, TRUE); |
| 2658 | 2658 | unset($objQuestion); |
| 2659 | 2659 | } |
@@ -2664,7 +2664,7 @@ discard block |
||
| 2664 | 2664 | Database::query($sql); |
| 2665 | 2665 | |
| 2666 | 2666 | // remove terms from db |
| 2667 | - require_once api_get_path(LIBRARY_PATH) .'specific_fields_manager.lib.php'; |
|
| 2667 | + require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
|
| 2668 | 2668 | delete_all_values_for_item($course_id, TOOL_QUIZ, $this->id); |
| 2669 | 2669 | } |
| 2670 | 2670 | } |
@@ -2759,7 +2759,7 @@ discard block |
||
| 2759 | 2759 | */ |
| 2760 | 2760 | public function copy_exercise() |
| 2761 | 2761 | { |
| 2762 | - $exercise_obj= new Exercise(); |
|
| 2762 | + $exercise_obj = new Exercise(); |
|
| 2763 | 2763 | $exercise_obj = $this; |
| 2764 | 2764 | |
| 2765 | 2765 | // force the creation of a new exercise |
@@ -2831,25 +2831,25 @@ discard block |
||
| 2831 | 2831 | $lp_id = 0; |
| 2832 | 2832 | } |
| 2833 | 2833 | if (empty($lp_item_id)) { |
| 2834 | - $lp_item_id = 0; |
|
| 2834 | + $lp_item_id = 0; |
|
| 2835 | 2835 | } |
| 2836 | 2836 | if (empty($lp_item_view_id)) { |
| 2837 | 2837 | $lp_item_view_id = 0; |
| 2838 | 2838 | } |
| 2839 | - $condition = ' WHERE exe_exo_id = ' . "'" . $this->id . "'" .' AND |
|
| 2840 | - exe_user_id = ' . "'" . api_get_user_id() . "'" . ' AND |
|
| 2841 | - c_id = ' . api_get_course_int_id() . ' AND |
|
| 2842 | - status = ' . "'" . Database::escape_string($status). "'" . ' AND |
|
| 2843 | - orig_lp_id = ' . "'" . $lp_id . "'" . ' AND |
|
| 2844 | - orig_lp_item_id = ' . "'" . $lp_item_id . "'" . ' AND |
|
| 2845 | - orig_lp_item_view_id = ' . "'" . $lp_item_view_id . "'" . ' AND |
|
| 2846 | - session_id = ' . "'" . api_get_session_id() . "' LIMIT 1"; //Adding limit 1 just in case |
|
| 2839 | + $condition = ' WHERE exe_exo_id = '."'".$this->id."'".' AND |
|
| 2840 | + exe_user_id = ' . "'".api_get_user_id()."'".' AND |
|
| 2841 | + c_id = ' . api_get_course_int_id().' AND |
|
| 2842 | + status = ' . "'".Database::escape_string($status)."'".' AND |
|
| 2843 | + orig_lp_id = ' . "'".$lp_id."'".' AND |
|
| 2844 | + orig_lp_item_id = ' . "'".$lp_item_id."'".' AND |
|
| 2845 | + orig_lp_item_view_id = ' . "'".$lp_item_view_id."'".' AND |
|
| 2846 | + session_id = ' . "'".api_get_session_id()."' LIMIT 1"; //Adding limit 1 just in case |
|
| 2847 | 2847 | |
| 2848 | 2848 | $sql_track = 'SELECT * FROM '.$track_exercises.$condition; |
| 2849 | 2849 | |
| 2850 | 2850 | $result = Database::query($sql_track); |
| 2851 | 2851 | $new_array = array(); |
| 2852 | - if (Database::num_rows($result) > 0 ) { |
|
| 2852 | + if (Database::num_rows($result) > 0) { |
|
| 2853 | 2853 | $new_array = Database::fetch_array($result, 'ASSOC'); |
| 2854 | 2854 | $new_array['num_exe'] = Database::num_rows($result); |
| 2855 | 2855 | } |
@@ -2892,12 +2892,12 @@ discard block |
||
| 2892 | 2892 | $questionList = array_map('intval', $questionList); |
| 2893 | 2893 | |
| 2894 | 2894 | $params = array( |
| 2895 | - 'exe_exo_id' => $this->id , |
|
| 2895 | + 'exe_exo_id' => $this->id, |
|
| 2896 | 2896 | 'exe_user_id' => api_get_user_id(), |
| 2897 | 2897 | 'c_id' => api_get_course_int_id(), |
| 2898 | 2898 | 'status' => 'incomplete', |
| 2899 | 2899 | 'session_id' => api_get_session_id(), |
| 2900 | - 'data_tracking' => implode(',', $questionList) , |
|
| 2900 | + 'data_tracking' => implode(',', $questionList), |
|
| 2901 | 2901 | 'start_date' => api_get_utc_datetime(), |
| 2902 | 2902 | 'orig_lp_id' => $safe_lp_id, |
| 2903 | 2903 | 'orig_lp_item_id' => $safe_lp_item_id, |
@@ -2929,7 +2929,7 @@ discard block |
||
| 2929 | 2929 | $nbrQuestions = $this->get_count_question_list(); |
| 2930 | 2930 | |
| 2931 | 2931 | $all_button = $html = $label = ''; |
| 2932 | - $hotspot_get = isset($_POST['hotspot']) ? Security::remove_XSS($_POST['hotspot']):null; |
|
| 2932 | + $hotspot_get = isset($_POST['hotspot']) ? Security::remove_XSS($_POST['hotspot']) : null; |
|
| 2933 | 2933 | |
| 2934 | 2934 | if ($this->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT && $this->type == ONE_PER_PAGE) { |
| 2935 | 2935 | $urlTitle = get_lang('ContinueTest'); |
@@ -2940,7 +2940,7 @@ discard block |
||
| 2940 | 2940 | |
| 2941 | 2941 | $html .= Display::url( |
| 2942 | 2942 | $urlTitle, |
| 2943 | - 'exercise_submit_modal.php?' . http_build_query([ |
|
| 2943 | + 'exercise_submit_modal.php?'.http_build_query([ |
|
| 2944 | 2944 | 'learnpath_id' => $safe_lp_id, |
| 2945 | 2945 | 'learnpath_item_id' => $safe_lp_item_id, |
| 2946 | 2946 | 'learnpath_item_view_id' => $safe_lp_item_view_id, |
@@ -2957,7 +2957,7 @@ discard block |
||
| 2957 | 2957 | 'data-size' => 'md' |
| 2958 | 2958 | ] |
| 2959 | 2959 | ); |
| 2960 | - $html .='<br />'; |
|
| 2960 | + $html .= '<br />'; |
|
| 2961 | 2961 | } else { |
| 2962 | 2962 | // User |
| 2963 | 2963 | if (api_is_allowed_to_session_edit()) { |
@@ -2982,7 +2982,7 @@ discard block |
||
| 2982 | 2982 | |
| 2983 | 2983 | //Next question |
| 2984 | 2984 | if (!empty($questions_in_media)) { |
| 2985 | - $questions_in_media = "['".implode("','",$questions_in_media)."']"; |
|
| 2985 | + $questions_in_media = "['".implode("','", $questions_in_media)."']"; |
|
| 2986 | 2986 | $all_button .= ' <a href="javascript://" class="'.$class.'" onclick="save_question_list('.$questions_in_media.'); ">'.$label.'</a>'; |
| 2987 | 2987 | } else { |
| 2988 | 2988 | $all_button .= ' <a href="javascript://" class="'.$class.'" onclick="save_now('.$question_id.', \'\', \''.$currentAnswer.'\'); ">'.$label.'</a>'; |
@@ -3000,7 +3000,7 @@ discard block |
||
| 3000 | 3000 | } |
| 3001 | 3001 | $class .= ' question-validate-btn'; // used to select it with jquery |
| 3002 | 3002 | $all_button = ' <a href="javascript://" class="'.$class.'" onclick="validate_all(); ">'.$all_label.'</a>'; |
| 3003 | - $all_button .= ' ' . Display::span(null, ['id' => 'save_all_reponse']); |
|
| 3003 | + $all_button .= ' '.Display::span(null, ['id' => 'save_all_reponse']); |
|
| 3004 | 3004 | $html .= $all_button; |
| 3005 | 3005 | } |
| 3006 | 3006 | } |
@@ -3243,8 +3243,8 @@ discard block |
||
| 3243 | 3243 | $params = array(); |
| 3244 | 3244 | $params['course_id'] = $course_id; |
| 3245 | 3245 | $params['session_id'] = api_get_session_id(); |
| 3246 | - $params['user_id'] = isset($exe_info['exe_user_id'])? $exe_info['exe_user_id'] : api_get_user_id(); |
|
| 3247 | - $params['exercise_id'] = isset($exe_info['exe_exo_id'])? $exe_info['exe_exo_id'] : $this->id; |
|
| 3246 | + $params['user_id'] = isset($exe_info['exe_user_id']) ? $exe_info['exe_user_id'] : api_get_user_id(); |
|
| 3247 | + $params['exercise_id'] = isset($exe_info['exe_exo_id']) ? $exe_info['exe_exo_id'] : $this->id; |
|
| 3248 | 3248 | $params['question_id'] = $questionId; |
| 3249 | 3249 | $params['exe_id'] = isset($exe_info['exe_id']) ? $exe_info['exe_id'] : $exeId; |
| 3250 | 3250 | |
@@ -3297,7 +3297,7 @@ discard block |
||
| 3297 | 3297 | $answer = $objAnswerTmp->selectAnswer($answerId); |
| 3298 | 3298 | $answerComment = $objAnswerTmp->selectComment($answerId); |
| 3299 | 3299 | $answerCorrect = $objAnswerTmp->isCorrect($answerId); |
| 3300 | - $answerWeighting = (float)$objAnswerTmp->selectWeighting($answerId); |
|
| 3300 | + $answerWeighting = (float) $objAnswerTmp->selectWeighting($answerId); |
|
| 3301 | 3301 | $answerAutoId = $objAnswerTmp->selectAutoId($answerId); |
| 3302 | 3302 | |
| 3303 | 3303 | if ($debug) { |
@@ -3307,7 +3307,7 @@ discard block |
||
| 3307 | 3307 | |
| 3308 | 3308 | // Delineation |
| 3309 | 3309 | $delineation_cord = $objAnswerTmp->selectHotspotCoordinates(1); |
| 3310 | - $answer_delineation_destination=$objAnswerTmp->selectDestination(1); |
|
| 3310 | + $answer_delineation_destination = $objAnswerTmp->selectDestination(1); |
|
| 3311 | 3311 | |
| 3312 | 3312 | switch ($answerType) { |
| 3313 | 3313 | // for unique answer |
@@ -3320,7 +3320,7 @@ discard block |
||
| 3320 | 3320 | exe_id = '".$exeId."' AND |
| 3321 | 3321 | question_id= '".$questionId."'"; |
| 3322 | 3322 | $result = Database::query($sql); |
| 3323 | - $choice = Database::result($result,0,"answer"); |
|
| 3323 | + $choice = Database::result($result, 0, "answer"); |
|
| 3324 | 3324 | |
| 3325 | 3325 | $studentChoice = $choice == $answerAutoId ? 1 : 0; |
| 3326 | 3326 | if ($studentChoice) { |
@@ -3371,7 +3371,7 @@ discard block |
||
| 3371 | 3371 | } else { |
| 3372 | 3372 | // If no result then the user just hit don't know |
| 3373 | 3373 | $studentChoice = 3; |
| 3374 | - $questionScore += $doubt_score; |
|
| 3374 | + $questionScore += $doubt_score; |
|
| 3375 | 3375 | } |
| 3376 | 3376 | $totalScore = $questionScore; |
| 3377 | 3377 | break; |
@@ -3387,17 +3387,17 @@ discard block |
||
| 3387 | 3387 | } |
| 3388 | 3388 | |
| 3389 | 3389 | $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null; |
| 3390 | - $real_answers[$answerId] = (bool)$studentChoice; |
|
| 3390 | + $real_answers[$answerId] = (bool) $studentChoice; |
|
| 3391 | 3391 | |
| 3392 | 3392 | if ($studentChoice) { |
| 3393 | - $questionScore +=$answerWeighting; |
|
| 3393 | + $questionScore += $answerWeighting; |
|
| 3394 | 3394 | } |
| 3395 | 3395 | } else { |
| 3396 | 3396 | $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null; |
| 3397 | - $real_answers[$answerId] = (bool)$studentChoice; |
|
| 3397 | + $real_answers[$answerId] = (bool) $studentChoice; |
|
| 3398 | 3398 | |
| 3399 | 3399 | if (isset($studentChoice)) { |
| 3400 | - $questionScore += $answerWeighting; |
|
| 3400 | + $questionScore += $answerWeighting; |
|
| 3401 | 3401 | } |
| 3402 | 3402 | } |
| 3403 | 3403 | $totalScore += $answerWeighting; |
@@ -3415,16 +3415,16 @@ discard block |
||
| 3415 | 3415 | $choice[$ind] = 1; |
| 3416 | 3416 | } |
| 3417 | 3417 | $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null; |
| 3418 | - $real_answers[$answerId] = (bool)$studentChoice; |
|
| 3418 | + $real_answers[$answerId] = (bool) $studentChoice; |
|
| 3419 | 3419 | if ($studentChoice) { |
| 3420 | - $questionScore +=$answerWeighting; |
|
| 3420 | + $questionScore += $answerWeighting; |
|
| 3421 | 3421 | } |
| 3422 | 3422 | } else { |
| 3423 | 3423 | $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null; |
| 3424 | 3424 | if (isset($studentChoice)) { |
| 3425 | 3425 | $questionScore += $answerWeighting; |
| 3426 | 3426 | } |
| 3427 | - $real_answers[$answerId] = (bool)$studentChoice; |
|
| 3427 | + $real_answers[$answerId] = (bool) $studentChoice; |
|
| 3428 | 3428 | } |
| 3429 | 3429 | $totalScore += $answerWeighting; |
| 3430 | 3430 | if ($debug) error_log("studentChoice: $studentChoice"); |
@@ -3436,7 +3436,7 @@ discard block |
||
| 3436 | 3436 | $resultans = Database::query($sql); |
| 3437 | 3437 | while ($row = Database::fetch_array($resultans)) { |
| 3438 | 3438 | $ind = $row['answer']; |
| 3439 | - $result = explode(':',$ind); |
|
| 3439 | + $result = explode(':', $ind); |
|
| 3440 | 3440 | if (isset($result[0])) { |
| 3441 | 3441 | $my_answer_id = isset($result[0]) ? $result[0] : ''; |
| 3442 | 3442 | $option = isset($result[1]) ? $result[1] : ''; |
@@ -3556,10 +3556,10 @@ discard block |
||
| 3556 | 3556 | } |
| 3557 | 3557 | // adds the piece of text that is before the blank |
| 3558 | 3558 | //and ends with '[' into a general storage array |
| 3559 | - $real_text[] = api_substr($temp, 0, $pos +1); |
|
| 3560 | - $answer .= api_substr($temp, 0, $pos +1); |
|
| 3559 | + $real_text[] = api_substr($temp, 0, $pos + 1); |
|
| 3560 | + $answer .= api_substr($temp, 0, $pos + 1); |
|
| 3561 | 3561 | //take the string remaining (after the last "[" we found) |
| 3562 | - $temp = api_substr($temp, $pos +1); |
|
| 3562 | + $temp = api_substr($temp, $pos + 1); |
|
| 3563 | 3563 | // quit the loop if there are no more blanks, and update $pos to the position of next ']' |
| 3564 | 3564 | if (($pos = api_strpos($temp, ']')) === false) { |
| 3565 | 3565 | // adds the end of the text |
@@ -3595,7 +3595,7 @@ discard block |
||
| 3595 | 3595 | //put the contents of the [] answer tag into correct_tags[] |
| 3596 | 3596 | $correct_tags[] = api_substr($temp, 0, $pos); |
| 3597 | 3597 | $j++; |
| 3598 | - $temp = api_substr($temp, $pos +1); |
|
| 3598 | + $temp = api_substr($temp, $pos + 1); |
|
| 3599 | 3599 | } |
| 3600 | 3600 | $answer = ''; |
| 3601 | 3601 | $real_correct_tags = $correct_tags; |
@@ -3618,7 +3618,7 @@ discard block |
||
| 3618 | 3618 | } elseif (!empty($user_tags[$i])) { |
| 3619 | 3619 | // else if the word entered by the student IS NOT the same as the one defined by the professor |
| 3620 | 3620 | // adds the word in red at the end of the string, and strikes it |
| 3621 | - $answer .= '<font color="red"><s>' . $user_tags[$i] . '</s></font>'; |
|
| 3621 | + $answer .= '<font color="red"><s>'.$user_tags[$i].'</s></font>'; |
|
| 3622 | 3622 | } else { |
| 3623 | 3623 | // adds a tabulation if no word has been typed by the student |
| 3624 | 3624 | $answer .= ''; // remove that causes issue |
@@ -3637,17 +3637,17 @@ discard block |
||
| 3637 | 3637 | } elseif (!empty ($user_tags[$i])) { |
| 3638 | 3638 | // else if the word entered by the student IS NOT the same as the one defined by the professor |
| 3639 | 3639 | // adds the word in red at the end of the string, and strikes it |
| 3640 | - $answer .= '<font color="red"><s>' . $user_tags[$i] . '</s></font>'; |
|
| 3640 | + $answer .= '<font color="red"><s>'.$user_tags[$i].'</s></font>'; |
|
| 3641 | 3641 | } else { |
| 3642 | 3642 | // adds a tabulation if no word has been typed by the student |
| 3643 | - $answer .= ''; // remove that causes issue |
|
| 3643 | + $answer .= ''; // remove that causes issue |
|
| 3644 | 3644 | } |
| 3645 | 3645 | } |
| 3646 | 3646 | |
| 3647 | 3647 | // adds the correct word, followed by ] to close the blank |
| 3648 | - $answer .= ' / <font color="green"><b>' . $real_correct_tags[$i] . '</b></font>]'; |
|
| 3649 | - if (isset($real_text[$i +1])) { |
|
| 3650 | - $answer .= $real_text[$i +1]; |
|
| 3648 | + $answer .= ' / <font color="green"><b>'.$real_correct_tags[$i].'</b></font>]'; |
|
| 3649 | + if (isset($real_text[$i + 1])) { |
|
| 3650 | + $answer .= $real_text[$i + 1]; |
|
| 3651 | 3651 | } |
| 3652 | 3652 | } |
| 3653 | 3653 | } else { |
@@ -3780,10 +3780,10 @@ discard block |
||
| 3780 | 3780 | } |
| 3781 | 3781 | // adds the piece of text that is before the blank |
| 3782 | 3782 | //and ends with '[' into a general storage array |
| 3783 | - $realText[] = api_substr($temp, 0, $pos +1); |
|
| 3784 | - $answer .= api_substr($temp, 0, $pos +1); |
|
| 3783 | + $realText[] = api_substr($temp, 0, $pos + 1); |
|
| 3784 | + $answer .= api_substr($temp, 0, $pos + 1); |
|
| 3785 | 3785 | //take the string remaining (after the last "[" we found) |
| 3786 | - $temp = api_substr($temp, $pos +1); |
|
| 3786 | + $temp = api_substr($temp, $pos + 1); |
|
| 3787 | 3787 | // quit the loop if there are no more blanks, and update $pos to the position of next ']' |
| 3788 | 3788 | if (($pos = api_strpos($temp, ']')) === false) { |
| 3789 | 3789 | // adds the end of the text |
@@ -3817,7 +3817,7 @@ discard block |
||
| 3817 | 3817 | //put the contents of the [] answer tag into correct_tags[] |
| 3818 | 3818 | $correctTags[] = api_substr($temp, 0, $pos); |
| 3819 | 3819 | $j++; |
| 3820 | - $temp = api_substr($temp, $pos +1); |
|
| 3820 | + $temp = api_substr($temp, $pos + 1); |
|
| 3821 | 3821 | } |
| 3822 | 3822 | $answer = ''; |
| 3823 | 3823 | $realCorrectTags = $correctTags; |
@@ -3847,21 +3847,21 @@ discard block |
||
| 3847 | 3847 | } elseif (!empty($userTags[$i])) { |
| 3848 | 3848 | // else if the word entered by the student IS NOT the same as the one defined by the professor |
| 3849 | 3849 | // adds the word in red at the end of the string, and strikes it |
| 3850 | - $answer .= '<font color="red"><s>' . $userTags[$i] . '</s></font>'; |
|
| 3850 | + $answer .= '<font color="red"><s>'.$userTags[$i].'</s></font>'; |
|
| 3851 | 3851 | } else { |
| 3852 | 3852 | // adds a tabulation if no word has been typed by the student |
| 3853 | 3853 | $answer .= ''; // remove that causes issue |
| 3854 | 3854 | } |
| 3855 | 3855 | // adds the correct word, followed by ] to close the blank |
| 3856 | - $answer .= ' / <font color="green"><b>' . $realCorrectTags[$i] . '</b></font>]'; |
|
| 3857 | - if (isset($realText[$i +1])) { |
|
| 3858 | - $answer .= $realText[$i +1]; |
|
| 3856 | + $answer .= ' / <font color="green"><b>'.$realCorrectTags[$i].'</b></font>]'; |
|
| 3857 | + if (isset($realText[$i + 1])) { |
|
| 3858 | + $answer .= $realText[$i + 1]; |
|
| 3859 | 3859 | } |
| 3860 | 3860 | } |
| 3861 | 3861 | break; |
| 3862 | 3862 | case FREE_ANSWER: |
| 3863 | 3863 | if ($from_database) { |
| 3864 | - $query = "SELECT answer, marks FROM ".$TBL_TRACK_ATTEMPT." |
|
| 3864 | + $query = "SELECT answer, marks FROM ".$TBL_TRACK_ATTEMPT." |
|
| 3865 | 3865 | WHERE exe_id = '".$exeId."' AND question_id= '".$questionId."'"; |
| 3866 | 3866 | $resq = Database::query($query); |
| 3867 | 3867 | $data = Database::fetch_array($resq); |
@@ -3872,9 +3872,9 @@ discard block |
||
| 3872 | 3872 | $questionScore = $data['marks']; |
| 3873 | 3873 | |
| 3874 | 3874 | if ($questionScore == -1) { |
| 3875 | - $totalScore+= 0; |
|
| 3875 | + $totalScore += 0; |
|
| 3876 | 3876 | } else { |
| 3877 | - $totalScore+= $questionScore; |
|
| 3877 | + $totalScore += $questionScore; |
|
| 3878 | 3878 | } |
| 3879 | 3879 | if ($questionScore == '') { |
| 3880 | 3880 | $questionScore = 0; |
@@ -3895,14 +3895,14 @@ discard block |
||
| 3895 | 3895 | $query = "SELECT answer, marks FROM ".$TBL_TRACK_ATTEMPT." |
| 3896 | 3896 | WHERE exe_id = '".$exeId."' AND question_id= '".$questionId."'"; |
| 3897 | 3897 | $resq = Database::query($query); |
| 3898 | - $choice = Database::result($resq,0,'answer'); |
|
| 3898 | + $choice = Database::result($resq, 0, 'answer'); |
|
| 3899 | 3899 | $choice = str_replace('\r\n', '', $choice); |
| 3900 | 3900 | $choice = stripslashes($choice); |
| 3901 | - $questionScore = Database::result($resq,0,"marks"); |
|
| 3901 | + $questionScore = Database::result($resq, 0, "marks"); |
|
| 3902 | 3902 | if ($questionScore == -1) { |
| 3903 | - $totalScore+=0; |
|
| 3903 | + $totalScore += 0; |
|
| 3904 | 3904 | } else { |
| 3905 | - $totalScore+=$questionScore; |
|
| 3905 | + $totalScore += $questionScore; |
|
| 3906 | 3906 | } |
| 3907 | 3907 | $arrques = $questionName; |
| 3908 | 3908 | $arrans = $choice; |
@@ -3947,7 +3947,7 @@ discard block |
||
| 3947 | 3947 | |
| 3948 | 3948 | while ($a_answers = Database::fetch_array($res_answers)) { |
| 3949 | 3949 | $i_answer_id = $a_answers['id']; //3 |
| 3950 | - $s_answer_label = $a_answers['answer']; // your daddy - your mother |
|
| 3950 | + $s_answer_label = $a_answers['answer']; // your daddy - your mother |
|
| 3951 | 3951 | $i_answer_correct_answer = $a_answers['correct']; //1 - 2 |
| 3952 | 3952 | $i_answer_id_auto = $a_answers['id_auto']; // 3 - 4 |
| 3953 | 3953 | |
@@ -4002,8 +4002,8 @@ discard block |
||
| 4002 | 4002 | $user_answer = ''; |
| 4003 | 4003 | } |
| 4004 | 4004 | echo '<tr>'; |
| 4005 | - echo '<td>' . $s_answer_label . '</td>'; |
|
| 4006 | - echo '<td>' . $user_answer; |
|
| 4005 | + echo '<td>'.$s_answer_label.'</td>'; |
|
| 4006 | + echo '<td>'.$user_answer; |
|
| 4007 | 4007 | |
| 4008 | 4008 | if (in_array($answerType, [MATCHING, MATCHING_DRAGGABLE])) { |
| 4009 | 4009 | if (isset($real_list[$i_answer_correct_answer]) && $showTotalScoreAndUserChoices == false) { |
@@ -4111,7 +4111,7 @@ discard block |
||
| 4111 | 4111 | if ($from_database) { |
| 4112 | 4112 | // getting the user answer |
| 4113 | 4113 | $TBL_TRACK_HOTSPOT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT); |
| 4114 | - $query = "SELECT hotspot_correct, hotspot_coordinate |
|
| 4114 | + $query = "SELECT hotspot_correct, hotspot_coordinate |
|
| 4115 | 4115 | FROM $TBL_TRACK_HOTSPOT |
| 4116 | 4116 | WHERE |
| 4117 | 4117 | hotspot_exe_id = '".$exeId."' AND |
@@ -4119,20 +4119,20 @@ discard block |
||
| 4119 | 4119 | hotspot_answer_id='1'"; |
| 4120 | 4120 | //by default we take 1 because it's a delineation |
| 4121 | 4121 | $resq = Database::query($query); |
| 4122 | - $row = Database::fetch_array($resq,'ASSOC'); |
|
| 4122 | + $row = Database::fetch_array($resq, 'ASSOC'); |
|
| 4123 | 4123 | |
| 4124 | 4124 | $choice = $row['hotspot_correct']; |
| 4125 | 4125 | $user_answer = $row['hotspot_coordinate']; |
| 4126 | 4126 | |
| 4127 | 4127 | // THIS is very important otherwise the poly_compile will throw an error!! |
| 4128 | 4128 | // round-up the coordinates |
| 4129 | - $coords = explode('/',$user_answer); |
|
| 4129 | + $coords = explode('/', $user_answer); |
|
| 4130 | 4130 | $user_array = ''; |
| 4131 | 4131 | foreach ($coords as $coord) { |
| 4132 | - list($x,$y) = explode(';',$coord); |
|
| 4132 | + list($x, $y) = explode(';', $coord); |
|
| 4133 | 4133 | $user_array .= round($x).';'.round($y).'/'; |
| 4134 | 4134 | } |
| 4135 | - $user_array = substr($user_array,0,-1); |
|
| 4135 | + $user_array = substr($user_array, 0, -1); |
|
| 4136 | 4136 | } else { |
| 4137 | 4137 | if (!empty($studentChoice)) { |
| 4138 | 4138 | $newquestionList[] = $questionId; |
@@ -4142,7 +4142,7 @@ discard block |
||
| 4142 | 4142 | $studentChoice = $choice[$answerId]; |
| 4143 | 4143 | $questionScore += $answerWeighting; |
| 4144 | 4144 | |
| 4145 | - if ($hotspot_delineation_result[1]==1) { |
|
| 4145 | + if ($hotspot_delineation_result[1] == 1) { |
|
| 4146 | 4146 | $totalScore += $answerWeighting; //adding the total |
| 4147 | 4147 | } |
| 4148 | 4148 | } |
@@ -4281,13 +4281,13 @@ discard block |
||
| 4281 | 4281 | $user_answer = $_SESSION['exerciseResultCoordinates'][$questionId]; |
| 4282 | 4282 | |
| 4283 | 4283 | //round-up the coordinates |
| 4284 | - $coords = explode('/',$user_answer); |
|
| 4284 | + $coords = explode('/', $user_answer); |
|
| 4285 | 4285 | $user_array = ''; |
| 4286 | 4286 | foreach ($coords as $coord) { |
| 4287 | - list($x,$y) = explode(';',$coord); |
|
| 4287 | + list($x, $y) = explode(';', $coord); |
|
| 4288 | 4288 | $user_array .= round($x).';'.round($y).'/'; |
| 4289 | 4289 | } |
| 4290 | - $user_array = substr($user_array,0,-1); |
|
| 4290 | + $user_array = substr($user_array, 0, -1); |
|
| 4291 | 4291 | |
| 4292 | 4292 | if ($next) { |
| 4293 | 4293 | |
@@ -4314,7 +4314,7 @@ discard block |
||
| 4314 | 4314 | //$overlap = round(polygons_overlap($poly_answer,$poly_user)); |
| 4315 | 4315 | // //this is an area in pixels |
| 4316 | 4316 | if ($debug > 0) { |
| 4317 | - error_log(__LINE__ . ' - Polygons results are ' . print_r($poly_results, 1), 0); |
|
| 4317 | + error_log(__LINE__.' - Polygons results are '.print_r($poly_results, 1), 0); |
|
| 4318 | 4318 | } |
| 4319 | 4319 | |
| 4320 | 4320 | if ($overlap < 1) { |
@@ -4327,43 +4327,43 @@ discard block |
||
| 4327 | 4327 | // that is overlapped by the user's polygon |
| 4328 | 4328 | $final_overlap = round(((float) $overlap / (float) $poly_answer_area) * 100); |
| 4329 | 4329 | if ($debug > 1) { |
| 4330 | - error_log(__LINE__ . ' - Final overlap is ' . $final_overlap, 0); |
|
| 4330 | + error_log(__LINE__.' - Final overlap is '.$final_overlap, 0); |
|
| 4331 | 4331 | } |
| 4332 | 4332 | // the final missing area is the percentage of the initial polygon |
| 4333 | 4333 | // that is not overlapped by the user's polygon |
| 4334 | 4334 | $final_missing = 100 - $final_overlap; |
| 4335 | 4335 | if ($debug > 1) { |
| 4336 | - error_log(__LINE__ . ' - Final missing is ' . $final_missing, 0); |
|
| 4336 | + error_log(__LINE__.' - Final missing is '.$final_missing, 0); |
|
| 4337 | 4337 | } |
| 4338 | 4338 | // the final excess area is the percentage of the initial polygon's size |
| 4339 | 4339 | // that is covered by the user's polygon outside of the initial polygon |
| 4340 | 4340 | $final_excess = round((((float) $poly_user_area - (float) $overlap) / (float) $poly_answer_area) * 100); |
| 4341 | 4341 | if ($debug > 1) { |
| 4342 | - error_log(__LINE__ . ' - Final excess is ' . $final_excess, 0); |
|
| 4342 | + error_log(__LINE__.' - Final excess is '.$final_excess, 0); |
|
| 4343 | 4343 | } |
| 4344 | 4344 | } |
| 4345 | 4345 | |
| 4346 | 4346 | //checking the destination parameters parsing the "@@" |
| 4347 | - $destination_items= explode('@@', $answerDestination); |
|
| 4347 | + $destination_items = explode('@@', $answerDestination); |
|
| 4348 | 4348 | $threadhold_total = $destination_items[0]; |
| 4349 | - $threadhold_items=explode(';',$threadhold_total); |
|
| 4349 | + $threadhold_items = explode(';', $threadhold_total); |
|
| 4350 | 4350 | $threadhold1 = $threadhold_items[0]; // overlap |
| 4351 | 4351 | $threadhold2 = $threadhold_items[1]; // excess |
| 4352 | - $threadhold3 = $threadhold_items[2]; //missing |
|
| 4352 | + $threadhold3 = $threadhold_items[2]; //missing |
|
| 4353 | 4353 | |
| 4354 | 4354 | // if is delineation |
| 4355 | - if ($answerId===1) { |
|
| 4355 | + if ($answerId === 1) { |
|
| 4356 | 4356 | //setting colors |
| 4357 | - if ($final_overlap>=$threadhold1) { |
|
| 4358 | - $overlap_color=true; //echo 'a'; |
|
| 4357 | + if ($final_overlap >= $threadhold1) { |
|
| 4358 | + $overlap_color = true; //echo 'a'; |
|
| 4359 | 4359 | } |
| 4360 | 4360 | //echo $excess.'-'.$threadhold2; |
| 4361 | - if ($final_excess<=$threadhold2) { |
|
| 4362 | - $excess_color=true; //echo 'b'; |
|
| 4361 | + if ($final_excess <= $threadhold2) { |
|
| 4362 | + $excess_color = true; //echo 'b'; |
|
| 4363 | 4363 | } |
| 4364 | 4364 | //echo '--------'.$missing.'-'.$threadhold3; |
| 4365 | - if ($final_missing<=$threadhold3) { |
|
| 4366 | - $missing_color=true; //echo 'c'; |
|
| 4365 | + if ($final_missing <= $threadhold3) { |
|
| 4366 | + $missing_color = true; //echo 'c'; |
|
| 4367 | 4367 | } |
| 4368 | 4368 | |
| 4369 | 4369 | // if pass |
@@ -4372,67 +4372,67 @@ discard block |
||
| 4372 | 4372 | $final_missing <= $threadhold3 && |
| 4373 | 4373 | $final_excess <= $threadhold2 |
| 4374 | 4374 | ) { |
| 4375 | - $next=1; //go to the oars |
|
| 4376 | - $result_comment=get_lang('Acceptable'); |
|
| 4377 | - $final_answer = 1; // do not update with update_exercise_attempt |
|
| 4375 | + $next = 1; //go to the oars |
|
| 4376 | + $result_comment = get_lang('Acceptable'); |
|
| 4377 | + $final_answer = 1; // do not update with update_exercise_attempt |
|
| 4378 | 4378 | } else { |
| 4379 | - $next=0; |
|
| 4380 | - $result_comment=get_lang('Unacceptable'); |
|
| 4381 | - $comment=$answerDestination=$objAnswerTmp->selectComment(1); |
|
| 4382 | - $answerDestination=$objAnswerTmp->selectDestination(1); |
|
| 4379 | + $next = 0; |
|
| 4380 | + $result_comment = get_lang('Unacceptable'); |
|
| 4381 | + $comment = $answerDestination = $objAnswerTmp->selectComment(1); |
|
| 4382 | + $answerDestination = $objAnswerTmp->selectDestination(1); |
|
| 4383 | 4383 | //checking the destination parameters parsing the "@@" |
| 4384 | - $destination_items= explode('@@', $answerDestination); |
|
| 4384 | + $destination_items = explode('@@', $answerDestination); |
|
| 4385 | 4385 | } |
| 4386 | - } elseif($answerId>1) { |
|
| 4386 | + } elseif ($answerId > 1) { |
|
| 4387 | 4387 | if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') { |
| 4388 | - if ($debug>0) { |
|
| 4389 | - error_log(__LINE__.' - answerId is of type noerror',0); |
|
| 4388 | + if ($debug > 0) { |
|
| 4389 | + error_log(__LINE__.' - answerId is of type noerror', 0); |
|
| 4390 | 4390 | } |
| 4391 | 4391 | //type no error shouldn't be treated |
| 4392 | 4392 | $next = 1; |
| 4393 | 4393 | continue; |
| 4394 | 4394 | } |
| 4395 | - if ($debug>0) { |
|
| 4396 | - error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR',0); |
|
| 4395 | + if ($debug > 0) { |
|
| 4396 | + error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR', 0); |
|
| 4397 | 4397 | } |
| 4398 | 4398 | //check the intersection between the oar and the user |
| 4399 | 4399 | //echo 'user'; print_r($x_user_list); print_r($y_user_list); |
| 4400 | 4400 | //echo 'official';print_r($x_list);print_r($y_list); |
| 4401 | 4401 | //$result = get_intersection_data($x_list,$y_list,$x_user_list,$y_user_list); |
| 4402 | - $inter= $result['success']; |
|
| 4402 | + $inter = $result['success']; |
|
| 4403 | 4403 | |
| 4404 | 4404 | //$delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId); |
| 4405 | - $delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId); |
|
| 4405 | + $delineation_cord = $objAnswerTmp->selectHotspotCoordinates($answerId); |
|
| 4406 | 4406 | |
| 4407 | - $poly_answer = convert_coordinates($delineation_cord,'|'); |
|
| 4408 | - $max_coord = poly_get_max($poly_user,$poly_answer); |
|
| 4409 | - $poly_answer_compiled = poly_compile($poly_answer,$max_coord); |
|
| 4410 | - $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled,$max_coord); |
|
| 4407 | + $poly_answer = convert_coordinates($delineation_cord, '|'); |
|
| 4408 | + $max_coord = poly_get_max($poly_user, $poly_answer); |
|
| 4409 | + $poly_answer_compiled = poly_compile($poly_answer, $max_coord); |
|
| 4410 | + $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled, $max_coord); |
|
| 4411 | 4411 | |
| 4412 | 4412 | if ($overlap == false) { |
| 4413 | 4413 | //all good, no overlap |
| 4414 | 4414 | $next = 1; |
| 4415 | 4415 | continue; |
| 4416 | 4416 | } else { |
| 4417 | - if ($debug>0) { |
|
| 4418 | - error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit',0); |
|
| 4417 | + if ($debug > 0) { |
|
| 4418 | + error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit', 0); |
|
| 4419 | 4419 | } |
| 4420 | 4420 | $organs_at_risk_hit++; |
| 4421 | 4421 | //show the feedback |
| 4422 | - $next=0; |
|
| 4423 | - $comment=$answerDestination=$objAnswerTmp->selectComment($answerId); |
|
| 4424 | - $answerDestination=$objAnswerTmp->selectDestination($answerId); |
|
| 4425 | - |
|
| 4426 | - $destination_items= explode('@@', $answerDestination); |
|
| 4427 | - $try_hotspot=$destination_items[1]; |
|
| 4428 | - $lp_hotspot=$destination_items[2]; |
|
| 4429 | - $select_question_hotspot=$destination_items[3]; |
|
| 4430 | - $url_hotspot=$destination_items[4]; |
|
| 4422 | + $next = 0; |
|
| 4423 | + $comment = $answerDestination = $objAnswerTmp->selectComment($answerId); |
|
| 4424 | + $answerDestination = $objAnswerTmp->selectDestination($answerId); |
|
| 4425 | + |
|
| 4426 | + $destination_items = explode('@@', $answerDestination); |
|
| 4427 | + $try_hotspot = $destination_items[1]; |
|
| 4428 | + $lp_hotspot = $destination_items[2]; |
|
| 4429 | + $select_question_hotspot = $destination_items[3]; |
|
| 4430 | + $url_hotspot = $destination_items[4]; |
|
| 4431 | 4431 | } |
| 4432 | 4432 | } |
| 4433 | 4433 | } else { // the first delineation feedback |
| 4434 | - if ($debug>0) { |
|
| 4435 | - error_log(__LINE__.' first',0); |
|
| 4434 | + if ($debug > 0) { |
|
| 4435 | + error_log(__LINE__.' first', 0); |
|
| 4436 | 4436 | } |
| 4437 | 4437 | } |
| 4438 | 4438 | } elseif (in_array($answerType, [MATCHING, MATCHING_DRAGGABLE])) { |
@@ -4440,7 +4440,7 @@ discard block |
||
| 4440 | 4440 | echo Display::tag('td', $answerMatching[$answerId]); |
| 4441 | 4441 | echo Display::tag( |
| 4442 | 4442 | 'td', |
| 4443 | - "$user_answer / " . Display::tag( |
|
| 4443 | + "$user_answer / ".Display::tag( |
|
| 4444 | 4444 | 'strong', |
| 4445 | 4445 | $answerMatching[$answerCorrect], |
| 4446 | 4446 | ['style' => 'color: #008000; font-weight: bold;'] |
@@ -4592,7 +4592,7 @@ discard block |
||
| 4592 | 4592 | $questionId, |
| 4593 | 4593 | $nano, |
| 4594 | 4594 | $results_disabled |
| 4595 | - ) . '</td> |
|
| 4595 | + ).'</td> |
|
| 4596 | 4596 | </tr> |
| 4597 | 4597 | </table>'; |
| 4598 | 4598 | break; |
@@ -4652,7 +4652,7 @@ discard block |
||
| 4652 | 4652 | |
| 4653 | 4653 | //$overlap = round(polygons_overlap($poly_answer,$poly_user)); //this is an area in pixels |
| 4654 | 4654 | if ($debug > 0) { |
| 4655 | - error_log(__LINE__ . ' - Polygons results are ' . print_r($poly_results, 1), 0); |
|
| 4655 | + error_log(__LINE__.' - Polygons results are '.print_r($poly_results, 1), 0); |
|
| 4656 | 4656 | } |
| 4657 | 4657 | if ($overlap < 1) { |
| 4658 | 4658 | //shortcut to avoid complicated calculations |
@@ -4663,17 +4663,17 @@ discard block |
||
| 4663 | 4663 | // the final overlap is the percentage of the initial polygon that is overlapped by the user's polygon |
| 4664 | 4664 | $final_overlap = round(((float) $overlap / (float) $poly_answer_area) * 100); |
| 4665 | 4665 | if ($debug > 1) { |
| 4666 | - error_log(__LINE__ . ' - Final overlap is ' . $final_overlap, 0); |
|
| 4666 | + error_log(__LINE__.' - Final overlap is '.$final_overlap, 0); |
|
| 4667 | 4667 | } |
| 4668 | 4668 | // the final missing area is the percentage of the initial polygon that is not overlapped by the user's polygon |
| 4669 | 4669 | $final_missing = 100 - $final_overlap; |
| 4670 | 4670 | if ($debug > 1) { |
| 4671 | - error_log(__LINE__ . ' - Final missing is ' . $final_missing, 0); |
|
| 4671 | + error_log(__LINE__.' - Final missing is '.$final_missing, 0); |
|
| 4672 | 4672 | } |
| 4673 | 4673 | // the final excess area is the percentage of the initial polygon's size that is covered by the user's polygon outside of the initial polygon |
| 4674 | 4674 | $final_excess = round((((float) $poly_user_area - (float) $overlap) / (float) $poly_answer_area) * 100); |
| 4675 | 4675 | if ($debug > 1) { |
| 4676 | - error_log(__LINE__ . ' - Final excess is ' . $final_excess, 0); |
|
| 4676 | + error_log(__LINE__.' - Final excess is '.$final_excess, 0); |
|
| 4677 | 4677 | } |
| 4678 | 4678 | } |
| 4679 | 4679 | |
@@ -4683,7 +4683,7 @@ discard block |
||
| 4683 | 4683 | $threadhold_items = explode(';', $threadhold_total); |
| 4684 | 4684 | $threadhold1 = $threadhold_items[0]; // overlap |
| 4685 | 4685 | $threadhold2 = $threadhold_items[1]; // excess |
| 4686 | - $threadhold3 = $threadhold_items[2]; //missing |
|
| 4686 | + $threadhold3 = $threadhold_items[2]; //missing |
|
| 4687 | 4687 | // if is delineation |
| 4688 | 4688 | if ($answerId === 1) { |
| 4689 | 4689 | //setting colors |
@@ -4715,14 +4715,14 @@ discard block |
||
| 4715 | 4715 | } elseif ($answerId > 1) { |
| 4716 | 4716 | if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') { |
| 4717 | 4717 | if ($debug > 0) { |
| 4718 | - error_log(__LINE__ . ' - answerId is of type noerror', 0); |
|
| 4718 | + error_log(__LINE__.' - answerId is of type noerror', 0); |
|
| 4719 | 4719 | } |
| 4720 | 4720 | //type no error shouldn't be treated |
| 4721 | 4721 | $next = 1; |
| 4722 | 4722 | continue; |
| 4723 | 4723 | } |
| 4724 | 4724 | if ($debug > 0) { |
| 4725 | - error_log(__LINE__ . ' - answerId is >1 so we\'re probably in OAR', 0); |
|
| 4725 | + error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR', 0); |
|
| 4726 | 4726 | } |
| 4727 | 4727 | //check the intersection between the oar and the user |
| 4728 | 4728 | //echo 'user'; print_r($x_user_list); print_r($y_user_list); |
@@ -4736,7 +4736,7 @@ discard block |
||
| 4736 | 4736 | $poly_answer = convert_coordinates($delineation_cord, '|'); |
| 4737 | 4737 | $max_coord = poly_get_max($poly_user, $poly_answer); |
| 4738 | 4738 | $poly_answer_compiled = poly_compile($poly_answer, $max_coord); |
| 4739 | - $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled,$max_coord); |
|
| 4739 | + $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled, $max_coord); |
|
| 4740 | 4740 | |
| 4741 | 4741 | if ($overlap == false) { |
| 4742 | 4742 | //all good, no overlap |
@@ -4744,7 +4744,7 @@ discard block |
||
| 4744 | 4744 | continue; |
| 4745 | 4745 | } else { |
| 4746 | 4746 | if ($debug > 0) { |
| 4747 | - error_log(__LINE__ . ' - Overlap is ' . $overlap . ': OAR hit', 0); |
|
| 4747 | + error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit', 0); |
|
| 4748 | 4748 | } |
| 4749 | 4749 | $organs_at_risk_hit++; |
| 4750 | 4750 | //show the feedback |
@@ -4756,12 +4756,12 @@ discard block |
||
| 4756 | 4756 | $try_hotspot = $destination_items[1]; |
| 4757 | 4757 | $lp_hotspot = $destination_items[2]; |
| 4758 | 4758 | $select_question_hotspot = $destination_items[3]; |
| 4759 | - $url_hotspot=$destination_items[4]; |
|
| 4759 | + $url_hotspot = $destination_items[4]; |
|
| 4760 | 4760 | } |
| 4761 | 4761 | } |
| 4762 | 4762 | } else { // the first delineation feedback |
| 4763 | 4763 | if ($debug > 0) { |
| 4764 | - error_log(__LINE__ . ' first', 0); |
|
| 4764 | + error_log(__LINE__.' first', 0); |
|
| 4765 | 4765 | } |
| 4766 | 4766 | } |
| 4767 | 4767 | break; |
@@ -4783,7 +4783,7 @@ discard block |
||
| 4783 | 4783 | echo Display::tag('td', $answerMatching[$answerId]); |
| 4784 | 4784 | echo Display::tag( |
| 4785 | 4785 | 'td', |
| 4786 | - "$user_answer / " . Display::tag( |
|
| 4786 | + "$user_answer / ".Display::tag( |
|
| 4787 | 4787 | 'strong', |
| 4788 | 4788 | $answerMatching[$answerCorrect], |
| 4789 | 4789 | ['style' => 'color: #008000; font-weight: bold;'] |
@@ -4869,7 +4869,7 @@ discard block |
||
| 4869 | 4869 | // we use the results from the session (from_db=0) |
| 4870 | 4870 | // TODO Change this, because it is wrong to show the user |
| 4871 | 4871 | // some results that haven't been stored in the database yet |
| 4872 | - if ($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER || $answerType == HOT_SPOT_DELINEATION ) { |
|
| 4872 | + if ($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER || $answerType == HOT_SPOT_DELINEATION) { |
|
| 4873 | 4873 | |
| 4874 | 4874 | if ($debug) error_log('$from AND this is a hotspot kind of question '); |
| 4875 | 4875 | |
@@ -4878,19 +4878,19 @@ discard block |
||
| 4878 | 4878 | if ($answerType == HOT_SPOT_DELINEATION) { |
| 4879 | 4879 | if (0) { |
| 4880 | 4880 | if ($overlap_color) { |
| 4881 | - $overlap_color='green'; |
|
| 4881 | + $overlap_color = 'green'; |
|
| 4882 | 4882 | } else { |
| 4883 | - $overlap_color='red'; |
|
| 4883 | + $overlap_color = 'red'; |
|
| 4884 | 4884 | } |
| 4885 | 4885 | if ($missing_color) { |
| 4886 | - $missing_color='green'; |
|
| 4886 | + $missing_color = 'green'; |
|
| 4887 | 4887 | } else { |
| 4888 | - $missing_color='red'; |
|
| 4888 | + $missing_color = 'red'; |
|
| 4889 | 4889 | } |
| 4890 | 4890 | if ($excess_color) { |
| 4891 | - $excess_color='green'; |
|
| 4891 | + $excess_color = 'green'; |
|
| 4892 | 4892 | } else { |
| 4893 | - $excess_color='red'; |
|
| 4893 | + $excess_color = 'red'; |
|
| 4894 | 4894 | } |
| 4895 | 4895 | if (!is_numeric($final_overlap)) { |
| 4896 | 4896 | $final_overlap = 0; |
@@ -4902,33 +4902,33 @@ discard block |
||
| 4902 | 4902 | $final_excess = 0; |
| 4903 | 4903 | } |
| 4904 | 4904 | |
| 4905 | - if ($final_overlap>100) { |
|
| 4905 | + if ($final_overlap > 100) { |
|
| 4906 | 4906 | $final_overlap = 100; |
| 4907 | 4907 | } |
| 4908 | 4908 | |
| 4909 | - $table_resume='<table class="data_table"> |
|
| 4909 | + $table_resume = '<table class="data_table"> |
|
| 4910 | 4910 | <tr class="row_odd" > |
| 4911 | 4911 | <td></td> |
| 4912 | - <td ><b>' . get_lang('Requirements') . '</b></td> |
|
| 4913 | - <td><b>' . get_lang('YourAnswer') . '</b></td> |
|
| 4912 | + <td ><b>' . get_lang('Requirements').'</b></td> |
|
| 4913 | + <td><b>' . get_lang('YourAnswer').'</b></td> |
|
| 4914 | 4914 | </tr> |
| 4915 | 4915 | <tr class="row_even"> |
| 4916 | - <td><b>' . get_lang('Overlap') . '</b></td> |
|
| 4917 | - <td>' . get_lang('Min') . ' ' . $threadhold1 . '</td> |
|
| 4918 | - <td><div style="color:' . $overlap_color . '">' |
|
| 4919 | - . (($final_overlap < 0) ? 0 : intval($final_overlap)) . '</div></td> |
|
| 4916 | + <td><b>' . get_lang('Overlap').'</b></td> |
|
| 4917 | + <td>' . get_lang('Min').' '.$threadhold1.'</td> |
|
| 4918 | + <td><div style="color:' . $overlap_color.'">' |
|
| 4919 | + . (($final_overlap < 0) ? 0 : intval($final_overlap)).'</div></td> |
|
| 4920 | 4920 | </tr> |
| 4921 | 4921 | <tr> |
| 4922 | - <td><b>' . get_lang('Excess') . '</b></td> |
|
| 4923 | - <td>' . get_lang('Max') . ' ' . $threadhold2 . '</td> |
|
| 4924 | - <td><div style="color:' . $excess_color . '">' |
|
| 4925 | - . (($final_excess < 0) ? 0 : intval($final_excess)) . '</div></td> |
|
| 4922 | + <td><b>' . get_lang('Excess').'</b></td> |
|
| 4923 | + <td>' . get_lang('Max').' '.$threadhold2.'</td> |
|
| 4924 | + <td><div style="color:' . $excess_color.'">' |
|
| 4925 | + . (($final_excess < 0) ? 0 : intval($final_excess)).'</div></td> |
|
| 4926 | 4926 | </tr> |
| 4927 | 4927 | <tr class="row_even"> |
| 4928 | - <td><b>' . get_lang('Missing') . '</b></td> |
|
| 4929 | - <td>' . get_lang('Max') . ' ' . $threadhold3 . '</td> |
|
| 4930 | - <td><div style="color:' . $missing_color . '">' |
|
| 4931 | - . (($final_missing < 0) ? 0 : intval($final_missing)) . '</div></td> |
|
| 4928 | + <td><b>' . get_lang('Missing').'</b></td> |
|
| 4929 | + <td>' . get_lang('Max').' '.$threadhold3.'</td> |
|
| 4930 | + <td><div style="color:' . $missing_color.'">' |
|
| 4931 | + . (($final_missing < 0) ? 0 : intval($final_missing)).'</div></td> |
|
| 4932 | 4932 | </tr> |
| 4933 | 4933 | </table>'; |
| 4934 | 4934 | if ($next == 0) { |
@@ -4943,20 +4943,20 @@ discard block |
||
| 4943 | 4943 | $answerDestination = $objAnswerTmp->selectDestination($nbrAnswers); |
| 4944 | 4944 | } |
| 4945 | 4945 | |
| 4946 | - echo '<h1><div style="color:#333;">' . get_lang('Feedback') . '</div></h1> |
|
| 4946 | + echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1> |
|
| 4947 | 4947 | <p style="text-align:center">'; |
| 4948 | 4948 | |
| 4949 | - $message = '<p>' . get_lang('YourDelineation') . '</p>'; |
|
| 4949 | + $message = '<p>'.get_lang('YourDelineation').'</p>'; |
|
| 4950 | 4950 | $message .= $table_resume; |
| 4951 | - $message .= '<br />' . get_lang('ResultIs') . ' ' . $result_comment . '<br />'; |
|
| 4951 | + $message .= '<br />'.get_lang('ResultIs').' '.$result_comment.'<br />'; |
|
| 4952 | 4952 | if ($organs_at_risk_hit > 0) { |
| 4953 | - $message .= '<p><b>' . get_lang('OARHit') . '</b></p>'; |
|
| 4953 | + $message .= '<p><b>'.get_lang('OARHit').'</b></p>'; |
|
| 4954 | 4954 | } |
| 4955 | - $message .='<p>' . $comment . '</p>'; |
|
| 4955 | + $message .= '<p>'.$comment.'</p>'; |
|
| 4956 | 4956 | echo $message; |
| 4957 | 4957 | } else { |
| 4958 | 4958 | echo $hotspot_delineation_result[0]; //prints message |
| 4959 | - $from_database = 1; // the hotspot_solution.swf needs this variable |
|
| 4959 | + $from_database = 1; // the hotspot_solution.swf needs this variable |
|
| 4960 | 4960 | } |
| 4961 | 4961 | |
| 4962 | 4962 | //save the score attempts |
@@ -4978,20 +4978,20 @@ discard block |
||
| 4978 | 4978 | $exerciseResultCoordinates[$quesId] |
| 4979 | 4979 | ); |
| 4980 | 4980 | } else { |
| 4981 | - if ($final_answer==0) { |
|
| 4981 | + if ($final_answer == 0) { |
|
| 4982 | 4982 | $questionScore = 0; |
| 4983 | - $answer=0; |
|
| 4983 | + $answer = 0; |
|
| 4984 | 4984 | Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0); |
| 4985 | 4985 | if (is_array($exerciseResultCoordinates[$quesId])) { |
| 4986 | - foreach($exerciseResultCoordinates[$quesId] as $idx => $val) { |
|
| 4987 | - Event::saveExerciseAttemptHotspot($exeId,$quesId,$idx,0,$val); |
|
| 4986 | + foreach ($exerciseResultCoordinates[$quesId] as $idx => $val) { |
|
| 4987 | + Event::saveExerciseAttemptHotspot($exeId, $quesId, $idx, 0, $val); |
|
| 4988 | 4988 | } |
| 4989 | 4989 | } |
| 4990 | 4990 | } else { |
| 4991 | 4991 | Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0); |
| 4992 | 4992 | if (is_array($exerciseResultCoordinates[$quesId])) { |
| 4993 | - foreach($exerciseResultCoordinates[$quesId] as $idx => $val) { |
|
| 4994 | - Event::saveExerciseAttemptHotspot($exeId,$quesId,$idx,$choice[$idx],$val); |
|
| 4993 | + foreach ($exerciseResultCoordinates[$quesId] as $idx => $val) { |
|
| 4994 | + Event::saveExerciseAttemptHotspot($exeId, $quesId, $idx, $choice[$idx], $val); |
|
| 4995 | 4995 | } |
| 4996 | 4996 | } |
| 4997 | 4997 | } |
@@ -5010,7 +5010,7 @@ discard block |
||
| 5010 | 5010 | echo " |
| 5011 | 5011 | <tr> |
| 5012 | 5012 | <td colspan=\"2\"> |
| 5013 | - <p><em>" . get_lang('HotSpot') . "</em></p> |
|
| 5013 | + <p><em>" . get_lang('HotSpot')."</em></p> |
|
| 5014 | 5014 | |
| 5015 | 5015 | <div id=\"hotspot-solution-$questionId\"></div> |
| 5016 | 5016 | |
@@ -5048,7 +5048,7 @@ discard block |
||
| 5048 | 5048 | |
| 5049 | 5049 | if ($saved_results) { |
| 5050 | 5050 | if ($debug) error_log("Save question results $saved_results"); |
| 5051 | - if ($debug) error_log(print_r($choice ,1 )); |
|
| 5051 | + if ($debug) error_log(print_r($choice, 1)); |
|
| 5052 | 5052 | |
| 5053 | 5053 | if (empty($choice)) { |
| 5054 | 5054 | $choice = 0; |
@@ -5060,14 +5060,14 @@ discard block |
||
| 5060 | 5060 | $ans = $reply[$i]; |
| 5061 | 5061 | Event::saveQuestionAttempt( |
| 5062 | 5062 | $questionScore, |
| 5063 | - $ans . ':' . $choice[$ans], |
|
| 5063 | + $ans.':'.$choice[$ans], |
|
| 5064 | 5064 | $quesId, |
| 5065 | 5065 | $exeId, |
| 5066 | 5066 | $i, |
| 5067 | 5067 | $this->id |
| 5068 | 5068 | ); |
| 5069 | 5069 | if ($debug) { |
| 5070 | - error_log('result =>' . $questionScore . ' ' . $ans . ':' . $choice[$ans]); |
|
| 5070 | + error_log('result =>'.$questionScore.' '.$ans.':'.$choice[$ans]); |
|
| 5071 | 5071 | } |
| 5072 | 5072 | } |
| 5073 | 5073 | } else { |
@@ -5078,7 +5078,7 @@ discard block |
||
| 5078 | 5078 | $reply = array_keys($choice); |
| 5079 | 5079 | |
| 5080 | 5080 | if ($debug) { |
| 5081 | - error_log("reply " . print_r($reply, 1) . ""); |
|
| 5081 | + error_log("reply ".print_r($reply, 1).""); |
|
| 5082 | 5082 | } |
| 5083 | 5083 | for ($i = 0; $i < sizeof($reply); $i++) { |
| 5084 | 5084 | $ans = $reply[$i]; |
@@ -5137,7 +5137,7 @@ discard block |
||
| 5137 | 5137 | |
| 5138 | 5138 | Event::saveQuestionAttempt($questionScore, implode('|', $answer), $quesId, $exeId, 0, $this->id); |
| 5139 | 5139 | } else { |
| 5140 | - Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0,$this->id); |
|
| 5140 | + Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id); |
|
| 5141 | 5141 | } |
| 5142 | 5142 | } |
| 5143 | 5143 | |
@@ -5147,8 +5147,8 @@ discard block |
||
| 5147 | 5147 | |
| 5148 | 5148 | if ($saved_results) { |
| 5149 | 5149 | $stat_table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
| 5150 | - $sql = 'UPDATE ' . $stat_table . ' SET |
|
| 5151 | - exe_result = exe_result + ' . floatval($questionScore) . ' |
|
| 5150 | + $sql = 'UPDATE '.$stat_table.' SET |
|
| 5151 | + exe_result = exe_result + ' . floatval($questionScore).' |
|
| 5152 | 5152 | WHERE exe_id = ' . $exeId; |
| 5153 | 5153 | if ($debug) error_log($sql); |
| 5154 | 5154 | Database::query($sql); |
@@ -5172,7 +5172,7 @@ discard block |
||
| 5172 | 5172 | */ |
| 5173 | 5173 | public function send_mail_notification_for_exam($question_list_answers, $origin, $exe_id) |
| 5174 | 5174 | { |
| 5175 | - if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) { |
|
| 5175 | + if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1) { |
|
| 5176 | 5176 | return null; |
| 5177 | 5177 | } |
| 5178 | 5178 | // Email configuration settings |
@@ -5223,7 +5223,7 @@ discard block |
||
| 5223 | 5223 | $msg = str_replace("#course#", $courseInfo['name'], $msg1); |
| 5224 | 5224 | |
| 5225 | 5225 | if ($origin != 'learnpath') { |
| 5226 | - $msg.= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>'; |
|
| 5226 | + $msg .= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>'; |
|
| 5227 | 5227 | } |
| 5228 | 5228 | $msg1 = str_replace("#url#", $url_email, $msg); |
| 5229 | 5229 | $mail_content = $msg1; |
@@ -5252,7 +5252,7 @@ discard block |
||
| 5252 | 5252 | */ |
| 5253 | 5253 | function send_notification_for_open_questions($question_list_answers, $origin, $exe_id) |
| 5254 | 5254 | { |
| 5255 | - if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) { |
|
| 5255 | + if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1) { |
|
| 5256 | 5256 | return null; |
| 5257 | 5257 | } |
| 5258 | 5258 | // Email configuration settings |
@@ -5315,11 +5315,11 @@ discard block |
||
| 5315 | 5315 | $msg .= '</table><br />'; |
| 5316 | 5316 | |
| 5317 | 5317 | |
| 5318 | - $msg1 = str_replace("#exercise#", $this->exercise, $msg); |
|
| 5319 | - $msg = str_replace("#firstName#", $user_info['firstname'],$msg1); |
|
| 5320 | - $msg1 = str_replace("#lastName#", $user_info['lastname'],$msg); |
|
| 5321 | - $msg = str_replace("#mail#", $user_info['email'],$msg1); |
|
| 5322 | - $msg = str_replace("#course#", $course_info['name'],$msg1); |
|
| 5318 | + $msg1 = str_replace("#exercise#", $this->exercise, $msg); |
|
| 5319 | + $msg = str_replace("#firstName#", $user_info['firstname'], $msg1); |
|
| 5320 | + $msg1 = str_replace("#lastName#", $user_info['lastname'], $msg); |
|
| 5321 | + $msg = str_replace("#mail#", $user_info['email'], $msg1); |
|
| 5322 | + $msg = str_replace("#course#", $course_info['name'], $msg1); |
|
| 5323 | 5323 | |
| 5324 | 5324 | if ($origin != 'learnpath') { |
| 5325 | 5325 | $msg .= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>'; |
@@ -5348,7 +5348,7 @@ discard block |
||
| 5348 | 5348 | |
| 5349 | 5349 | function send_notification_for_oral_questions($question_list_answers, $origin, $exe_id) |
| 5350 | 5350 | { |
| 5351 | - if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) { |
|
| 5351 | + if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1) { |
|
| 5352 | 5352 | return null; |
| 5353 | 5353 | } |
| 5354 | 5354 | // Email configuration settings |
@@ -5372,7 +5372,7 @@ discard block |
||
| 5372 | 5372 | $answer_type = $item['answer_type']; |
| 5373 | 5373 | |
| 5374 | 5374 | if (!empty($question) && !empty($answer) && $answer_type == ORAL_EXPRESSION) { |
| 5375 | - $oral_question_list.='<br /><table width="730" height="136" border="0" cellpadding="3" cellspacing="3">' |
|
| 5375 | + $oral_question_list .= '<br /><table width="730" height="136" border="0" cellpadding="3" cellspacing="3">' |
|
| 5376 | 5376 | .'<tr>' |
| 5377 | 5377 | .'<td width="220" valign="top" bgcolor="#E5EDF8"> '.get_lang('Question').'</td>' |
| 5378 | 5378 | .'<td width="473" valign="top" bgcolor="#F3F3F3">'.$question.'</td>' |
@@ -5405,7 +5405,7 @@ discard block |
||
| 5405 | 5405 | .'<td> #mail#</td>' |
| 5406 | 5406 | .'</tr>' |
| 5407 | 5407 | .'</table>'; |
| 5408 | - $msg .= '<br />'.sprintf(get_lang('OralQuestionsAttemptedAreX'),$oral_question_list).'<br />'; |
|
| 5408 | + $msg .= '<br />'.sprintf(get_lang('OralQuestionsAttemptedAreX'), $oral_question_list).'<br />'; |
|
| 5409 | 5409 | $msg1 = str_replace("#exercise#", $this->exercise, $msg); |
| 5410 | 5410 | $msg = str_replace("#firstName#", $user_info['firstname'], $msg1); |
| 5411 | 5411 | $msg1 = str_replace("#lastName#", $user_info['lastname'], $msg); |
@@ -5413,7 +5413,7 @@ discard block |
||
| 5413 | 5413 | $msg = str_replace("#course#", $course_info['name'], $msg1); |
| 5414 | 5414 | |
| 5415 | 5415 | if ($origin != 'learnpath') { |
| 5416 | - $msg.= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>'; |
|
| 5416 | + $msg .= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>'; |
|
| 5417 | 5417 | } |
| 5418 | 5418 | $msg1 = str_replace("#url#", $url_email, $msg); |
| 5419 | 5419 | $mail_content = $msg1; |
@@ -5479,10 +5479,10 @@ discard block |
||
| 5479 | 5479 | } |
| 5480 | 5480 | $html = '<div class="question-result">'; |
| 5481 | 5481 | $html .= Display::page_header( |
| 5482 | - Display::return_icon('test-quiz.png', get_lang('Result'),null, ICON_SIZE_MEDIUM).' '.$this->exercise.' : '.get_lang('Result') |
|
| 5482 | + Display::return_icon('test-quiz.png', get_lang('Result'), null, ICON_SIZE_MEDIUM).' '.$this->exercise.' : '.get_lang('Result') |
|
| 5483 | 5483 | ); |
| 5484 | 5484 | $html .= Display::description($array); |
| 5485 | - $html .="</div>"; |
|
| 5485 | + $html .= "</div>"; |
|
| 5486 | 5486 | return $html; |
| 5487 | 5487 | } |
| 5488 | 5488 | |
@@ -5599,7 +5599,7 @@ discard block |
||
| 5599 | 5599 | false, |
| 5600 | 5600 | $objExercise->selectPropagateNeg() |
| 5601 | 5601 | ); |
| 5602 | - $totalScore += $question_result['score']; |
|
| 5602 | + $totalScore += $question_result['score']; |
|
| 5603 | 5603 | } |
| 5604 | 5604 | |
| 5605 | 5605 | if ($objExercise->selectPropagateNeg() == 0 && $totalScore < 0) { |
@@ -5805,7 +5805,7 @@ discard block |
||
| 5805 | 5805 | } |
| 5806 | 5806 | |
| 5807 | 5807 | $rawMessage = ""; |
| 5808 | - if (!empty($message)){ |
|
| 5808 | + if (!empty($message)) { |
|
| 5809 | 5809 | $rawMessage = $message; |
| 5810 | 5810 | $message = Display::return_message($message, 'warning', false); |
| 5811 | 5811 | } |
@@ -5821,7 +5821,7 @@ discard block |
||
| 5821 | 5821 | { |
| 5822 | 5822 | $TBL_LP_ITEM = Database::get_course_table(TABLE_LP_ITEM); |
| 5823 | 5823 | $sql = "SELECT max_score FROM $TBL_LP_ITEM |
| 5824 | - WHERE c_id = {$this->course_id} AND item_type = '" . TOOL_QUIZ . "' AND path = '{$this->id}'"; |
|
| 5824 | + WHERE c_id = {$this->course_id} AND item_type = '".TOOL_QUIZ."' AND path = '{$this->id}'"; |
|
| 5825 | 5825 | $result = Database::query($sql); |
| 5826 | 5826 | if (Database::num_rows($result) > 0) { |
| 5827 | 5827 | return true; |
@@ -6149,7 +6149,7 @@ discard block |
||
| 6149 | 6149 | $sql_track = "SELECT * FROM $track_exercises WHERE exe_id = $exe_id "; |
| 6150 | 6150 | $result = Database::query($sql_track); |
| 6151 | 6151 | $new_array = array(); |
| 6152 | - if (Database::num_rows($result) > 0 ) { |
|
| 6152 | + if (Database::num_rows($result) > 0) { |
|
| 6153 | 6153 | $new_array = Database::fetch_array($result, 'ASSOC'); |
| 6154 | 6154 | |
| 6155 | 6155 | $new_array['duration'] = null; |
@@ -6161,11 +6161,11 @@ discard block |
||
| 6161 | 6161 | $start_date = api_strtotime($start_date, 'UTC'); |
| 6162 | 6162 | $end_date = api_strtotime($end_date, 'UTC'); |
| 6163 | 6163 | if ($start_date && $end_date) { |
| 6164 | - $mytime = $end_date- $start_date; |
|
| 6164 | + $mytime = $end_date - $start_date; |
|
| 6165 | 6165 | $new_learnpath_item = new learnpathItem(null); |
| 6166 | 6166 | $time_attemp = $new_learnpath_item->get_scorm_time('js', $mytime); |
| 6167 | 6167 | $h = get_lang('h'); |
| 6168 | - $time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp); |
|
| 6168 | + $time_attemp = str_replace('NaN', '00'.$h.'00\'00"', $time_attemp); |
|
| 6169 | 6169 | $new_array['duration'] = $time_attemp; |
| 6170 | 6170 | } |
| 6171 | 6171 | } |
@@ -6187,7 +6187,7 @@ discard block |
||
| 6187 | 6187 | $result = Database::query($sql); |
| 6188 | 6188 | } |
| 6189 | 6189 | } else { |
| 6190 | - $remind_list = explode(',',$exercise_info['questions_to_check']); |
|
| 6190 | + $remind_list = explode(',', $exercise_info['questions_to_check']); |
|
| 6191 | 6191 | |
| 6192 | 6192 | $remind_list_string = ''; |
| 6193 | 6193 | if ($action == 'add') { |
@@ -6199,7 +6199,7 @@ discard block |
||
| 6199 | 6199 | } |
| 6200 | 6200 | $remind_list_string = implode(',', $remind_list); |
| 6201 | 6201 | } |
| 6202 | - } elseif ($action == 'delete') { |
|
| 6202 | + } elseif ($action == 'delete') { |
|
| 6203 | 6203 | if (!empty($remind_list)) { |
| 6204 | 6204 | if (in_array($question_id, $remind_list)) { |
| 6205 | 6205 | $remind_list = array_flip($remind_list); |
@@ -6441,7 +6441,7 @@ discard block |
||
| 6441 | 6441 | true |
| 6442 | 6442 | ); |
| 6443 | 6443 | |
| 6444 | - $counter += count($mediaQuestions[$questionId]) - 1 ; |
|
| 6444 | + $counter += count($mediaQuestions[$questionId]) - 1; |
|
| 6445 | 6445 | $before = count($questionList); |
| 6446 | 6446 | $wasMedia = true; |
| 6447 | 6447 | $nextValue += count($questionList); |
@@ -6520,7 +6520,7 @@ discard block |
||
| 6520 | 6520 | // If it was already seen, then merge the previous with |
| 6521 | 6521 | // the current category |
| 6522 | 6522 | $oldQuestionList = $newCategoryList[$rootElement]['question_list']; |
| 6523 | - $category['question_list'] = array_merge($oldQuestionList , $category['question_list']); |
|
| 6523 | + $category['question_list'] = array_merge($oldQuestionList, $category['question_list']); |
|
| 6524 | 6524 | $newCategoryList[$rootElement] = $category; |
| 6525 | 6525 | } |
| 6526 | 6526 | } |
@@ -6546,7 +6546,7 @@ discard block |
||
| 6546 | 6546 | |
| 6547 | 6547 | if ($useRootAsCategoryTitle) { |
| 6548 | 6548 | if (isset($category['parent_info'])) { |
| 6549 | - $categoryName = $category['parent_info']['title']; |
|
| 6549 | + $categoryName = $category['parent_info']['title']; |
|
| 6550 | 6550 | } |
| 6551 | 6551 | } |
| 6552 | 6552 | $html .= '<div class="row">'; |
@@ -6688,7 +6688,7 @@ discard block |
||
| 6688 | 6688 | // end foreach() |
| 6689 | 6689 | |
| 6690 | 6690 | if ($this->type == ALL_ON_ONE_PAGE) { |
| 6691 | - $exercise_actions = $this->show_button($questionId, $currentQuestion); |
|
| 6691 | + $exercise_actions = $this->show_button($questionId, $currentQuestion); |
|
| 6692 | 6692 | echo Display::div($exercise_actions, array('class'=>'exercise_actions')); |
| 6693 | 6693 | } |
| 6694 | 6694 | } |
@@ -6774,7 +6774,7 @@ discard block |
||
| 6774 | 6774 | |
| 6775 | 6775 | // Showing the question |
| 6776 | 6776 | |
| 6777 | - $exercise_actions = null; |
|
| 6777 | + $exercise_actions = null; |
|
| 6778 | 6778 | |
| 6779 | 6779 | echo '<a id="questionanchor'.$questionId.'"></a><br />'; |
| 6780 | 6780 | echo '<div id="question_div_'.$questionId.'" class="main_question '.$remind_highlight.'" >'; |
@@ -7042,7 +7042,7 @@ discard block |
||
| 7042 | 7042 | $header .= Display::tag('th', get_lang('Feedback')); |
| 7043 | 7043 | } |
| 7044 | 7044 | $s .= '<table class="data_table">'; |
| 7045 | - $s.= Display::tag('tr', $header, array('style' => 'text-align:left;')); |
|
| 7045 | + $s .= Display::tag('tr', $header, array('style' => 'text-align:left;')); |
|
| 7046 | 7046 | } |
| 7047 | 7047 | } |
| 7048 | 7048 | |
@@ -7142,7 +7142,7 @@ discard block |
||
| 7142 | 7142 | $s .= '<td>'; |
| 7143 | 7143 | $s .= $comment; |
| 7144 | 7144 | $s .= '</td>'; |
| 7145 | - $s .='</tr>'; |
|
| 7145 | + $s .= '</tr>'; |
|
| 7146 | 7146 | } else { |
| 7147 | 7147 | $s .= $answer_input; |
| 7148 | 7148 | } |
@@ -7156,7 +7156,7 @@ discard block |
||
| 7156 | 7156 | } |
| 7157 | 7157 | } |
| 7158 | 7158 | |
| 7159 | - $s .='<tr>'; |
|
| 7159 | + $s .= '<tr>'; |
|
| 7160 | 7160 | $s .= Display::tag('td', $answer); |
| 7161 | 7161 | |
| 7162 | 7162 | if (!empty($quiz_question_options)) { |
@@ -7183,7 +7183,7 @@ discard block |
||
| 7183 | 7183 | $s .= $comment; |
| 7184 | 7184 | $s .= '</td>'; |
| 7185 | 7185 | } |
| 7186 | - $s.='</tr>'; |
|
| 7186 | + $s .= '</tr>'; |
|
| 7187 | 7187 | } |
| 7188 | 7188 | |
| 7189 | 7189 | } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION) { |
@@ -7212,16 +7212,16 @@ discard block |
||
| 7212 | 7212 | $answer_input .= '</label>'; |
| 7213 | 7213 | |
| 7214 | 7214 | if ($show_comment) { |
| 7215 | - $s.= '<tr>'; |
|
| 7215 | + $s .= '<tr>'; |
|
| 7216 | 7216 | $s .= '<td>'; |
| 7217 | - $s.= $answer_input; |
|
| 7217 | + $s .= $answer_input; |
|
| 7218 | 7218 | $s .= '</td>'; |
| 7219 | 7219 | $s .= '<td>'; |
| 7220 | 7220 | $s .= $comment; |
| 7221 | 7221 | $s .= '</td>'; |
| 7222 | - $s.= '</tr>'; |
|
| 7222 | + $s .= '</tr>'; |
|
| 7223 | 7223 | } else { |
| 7224 | - $s.= $answer_input; |
|
| 7224 | + $s .= $answer_input; |
|
| 7225 | 7225 | } |
| 7226 | 7226 | } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) { |
| 7227 | 7227 | $s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />'; |
@@ -7234,7 +7234,7 @@ discard block |
||
| 7234 | 7234 | } |
| 7235 | 7235 | } |
| 7236 | 7236 | $answer = Security::remove_XSS($answer); |
| 7237 | - $s .='<tr>'; |
|
| 7237 | + $s .= '<tr>'; |
|
| 7238 | 7238 | $s .= Display::tag('td', $answer); |
| 7239 | 7239 | |
| 7240 | 7240 | foreach ($objQuestionTmp->options as $key => $item) { |
@@ -7258,7 +7258,7 @@ discard block |
||
| 7258 | 7258 | $s .= $comment; |
| 7259 | 7259 | $s .= '</td>'; |
| 7260 | 7260 | } |
| 7261 | - $s.='</tr>'; |
|
| 7261 | + $s .= '</tr>'; |
|
| 7262 | 7262 | } elseif ($answerType == FILL_IN_BLANKS) { |
| 7263 | 7263 | list($answer) = explode('::', $answer); |
| 7264 | 7264 | |
@@ -7292,7 +7292,7 @@ discard block |
||
| 7292 | 7292 | $value = str_replace(' ', '', trim($value[0])); |
| 7293 | 7293 | } |
| 7294 | 7294 | $correct_item = preg_quote($correct_item); |
| 7295 | - $correct_item = api_preg_replace('|/|', '\/', $correct_item); // to prevent error if there is a / in the text to find |
|
| 7295 | + $correct_item = api_preg_replace('|/|', '\/', $correct_item); // to prevent error if there is a / in the text to find |
|
| 7296 | 7296 | $answer = api_preg_replace('/'.$correct_item.'/', Display::input('text', "choice[$questionId][]", $value), $answer, 1); |
| 7297 | 7297 | } |
| 7298 | 7298 | $i++; |
@@ -7349,7 +7349,7 @@ discard block |
||
| 7349 | 7349 | } |
| 7350 | 7350 | |
| 7351 | 7351 | if (!empty($answerCorrect) && !empty($selectedValue)) { |
| 7352 | - $s.= '<script> |
|
| 7352 | + $s .= '<script> |
|
| 7353 | 7353 | jsPlumb.ready(function() { |
| 7354 | 7354 | jsPlumb.connect({ |
| 7355 | 7355 | source: "window_'.$windowId.'", |
@@ -7364,14 +7364,14 @@ discard block |
||
| 7364 | 7364 | } |
| 7365 | 7365 | $s .= '</select></div></td>'; |
| 7366 | 7366 | |
| 7367 | - $s.='<td width="45%" valign="top" >'; |
|
| 7367 | + $s .= '<td width="45%" valign="top" >'; |
|
| 7368 | 7368 | |
| 7369 | 7369 | if (isset($select_items[$lines_count])) { |
| 7370 | - $s.= '<div id="window_'.$windowId.'_answer" class="window window_right_question"> |
|
| 7370 | + $s .= '<div id="window_'.$windowId.'_answer" class="window window_right_question"> |
|
| 7371 | 7371 | <b>'.$select_items[$lines_count]['letter'].'.</b> '.$select_items[$lines_count]['answer'].' |
| 7372 | 7372 | </div>'; |
| 7373 | 7373 | } else { |
| 7374 | - $s.=' '; |
|
| 7374 | + $s .= ' '; |
|
| 7375 | 7375 | } |
| 7376 | 7376 | |
| 7377 | 7377 | $s .= '</td>'; |
@@ -7385,16 +7385,16 @@ discard block |
||
| 7385 | 7385 | $s .= '<tr> |
| 7386 | 7386 | <td colspan="2"></td> |
| 7387 | 7387 | <td valign="top">'; |
| 7388 | - $s.='<b>'.$select_items[$lines_count]['letter'].'.</b>'; |
|
| 7388 | + $s .= '<b>'.$select_items[$lines_count]['letter'].'.</b>'; |
|
| 7389 | 7389 | $s .= $select_items[$lines_count]['answer']; |
| 7390 | - $s.="</td> |
|
| 7390 | + $s .= "</td> |
|
| 7391 | 7391 | </tr>"; |
| 7392 | 7392 | $lines_count++; |
| 7393 | 7393 | } // end while() |
| 7394 | 7394 | } // end if() |
| 7395 | 7395 | $matching_correct_answer++; |
| 7396 | 7396 | } |
| 7397 | - } elseif ($answerType == DRAGGABLE) { |
|
| 7397 | + } elseif ($answerType == DRAGGABLE) { |
|
| 7398 | 7398 | // matching type, showing suggestions and answers |
| 7399 | 7399 | // TODO: replace $answerId by $numAnswer |
| 7400 | 7400 | |
@@ -7436,7 +7436,7 @@ discard block |
||
| 7436 | 7436 | $s .= '</select>'; |
| 7437 | 7437 | |
| 7438 | 7438 | if (!empty($answerCorrect) && !empty($selectedValue)) { |
| 7439 | - $s.= '<script> |
|
| 7439 | + $s .= '<script> |
|
| 7440 | 7440 | $(function() { |
| 7441 | 7441 | deleteItem($("#'.$questionId.'_'.$selectedValue.'"), $("#drop_'.$windowId.'")); |
| 7442 | 7442 | }); |
@@ -7444,11 +7444,11 @@ discard block |
||
| 7444 | 7444 | } |
| 7445 | 7445 | |
| 7446 | 7446 | if (isset($select_items[$lines_count])) { |
| 7447 | - $s.= '<div id="window_'.$windowId.'_answer" class=""> |
|
| 7447 | + $s .= '<div id="window_'.$windowId.'_answer" class=""> |
|
| 7448 | 7448 | <b>'.$select_items[$lines_count]['letter'].'.</b> '.$select_items[$lines_count]['answer'].' |
| 7449 | 7449 | </div>'; |
| 7450 | 7450 | } else { |
| 7451 | - $s.=' '; |
|
| 7451 | + $s .= ' '; |
|
| 7452 | 7452 | } |
| 7453 | 7453 | $lines_count++; |
| 7454 | 7454 | //if the left side of the "matching" has been completely |
@@ -7457,7 +7457,7 @@ discard block |
||
| 7457 | 7457 | if (($lines_count - 1) == $num_suggestions) { |
| 7458 | 7458 | // if it remains answers to shown at the right side |
| 7459 | 7459 | while (isset($select_items[$lines_count])) { |
| 7460 | - $s.='<b>'.$select_items[$lines_count]['letter'].'.</b>'; |
|
| 7460 | + $s .= '<b>'.$select_items[$lines_count]['letter'].'.</b>'; |
|
| 7461 | 7461 | $s .= $select_items[$lines_count]['answer']; |
| 7462 | 7462 | $lines_count++; |
| 7463 | 7463 | } |
@@ -7560,9 +7560,9 @@ discard block |
||
| 7560 | 7560 | |
| 7561 | 7561 | if (!$only_questions) { |
| 7562 | 7562 | if ($show_title) { |
| 7563 | - $html .= TestCategory::getCategoryNamesForQuestion($objQuestionTmp->id); |
|
| 7564 | - $html .= '<div class="question_title">'.$current_item.'. '.$questionName.'</div>'; |
|
| 7565 | - $html .= $questionDescription; |
|
| 7563 | + $html .= TestCategory::getCategoryNamesForQuestion($objQuestionTmp->id); |
|
| 7564 | + $html .= '<div class="question_title">'.$current_item.'. '.$questionName.'</div>'; |
|
| 7565 | + $html .= $questionDescription; |
|
| 7566 | 7566 | } else { |
| 7567 | 7567 | $html .= '<div class="media">'; |
| 7568 | 7568 | $html .= '<div class="pull-left">'; |
@@ -7578,11 +7578,11 @@ discard block |
||
| 7578 | 7578 | $html .= '</div>'; |
| 7579 | 7579 | } |
| 7580 | 7580 | //@todo I need to the get the feedback type |
| 7581 | - $html .= '<input type="hidden" name="hidden_hotspot_id" value="'.$questionId.'" />'; |
|
| 7582 | - $html .= '<table class="exercise_questions"> |
|
| 7581 | + $html .= '<input type="hidden" name="hidden_hotspot_id" value="'.$questionId.'" />'; |
|
| 7582 | + $html .= '<table class="exercise_questions"> |
|
| 7583 | 7583 | <tr> |
| 7584 | 7584 | <td valign="top" colspan="2">'; |
| 7585 | - $html .= '</td></tr>'; |
|
| 7585 | + $html .= '</td></tr>'; |
|
| 7586 | 7586 | } |
| 7587 | 7587 | |
| 7588 | 7588 | $canClick = isset($_GET['editQuestion']) ? '0' : (isset($_GET['modifyAnswers']) ? '0' : '1'); |
@@ -1267,10 +1267,11 @@ discard block |
||
| 1267 | 1267 | */ |
| 1268 | 1268 | public function isInList($questionId) |
| 1269 | 1269 | { |
| 1270 | - if (is_array($this->questionList)) |
|
| 1271 | - return in_array($questionId,$this->questionList); |
|
| 1272 | - else |
|
| 1273 | - return false; |
|
| 1270 | + if (is_array($this->questionList)) { |
|
| 1271 | + return in_array($questionId,$this->questionList); |
|
| 1272 | + } else { |
|
| 1273 | + return false; |
|
| 1274 | + } |
|
| 1274 | 1275 | } |
| 1275 | 1276 | |
| 1276 | 1277 | /** |
@@ -2207,10 +2208,11 @@ discard block |
||
| 2207 | 2208 | |
| 2208 | 2209 | $var = Exercise::selectTimeLimit(); |
| 2209 | 2210 | |
| 2210 | - if (($this->start_time != '0000-00-00 00:00:00')) |
|
| 2211 | - $form->addElement('html','<div id="start_date_div" style="display:block;">'); |
|
| 2212 | - else |
|
| 2213 | - $form->addElement('html','<div id="start_date_div" style="display:none;">'); |
|
| 2211 | + if (($this->start_time != '0000-00-00 00:00:00')) { |
|
| 2212 | + $form->addElement('html','<div id="start_date_div" style="display:block;">'); |
|
| 2213 | + } else { |
|
| 2214 | + $form->addElement('html','<div id="start_date_div" style="display:none;">'); |
|
| 2215 | + } |
|
| 2214 | 2216 | |
| 2215 | 2217 | $form->addElement('date_time_picker', 'start_time'); |
| 2216 | 2218 | |
@@ -2218,10 +2220,11 @@ discard block |
||
| 2218 | 2220 | |
| 2219 | 2221 | $form->addElement('checkbox', 'activate_end_date_check', null , get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()')); |
| 2220 | 2222 | |
| 2221 | - if (($this->end_time != '0000-00-00 00:00:00')) |
|
| 2222 | - $form->addElement('html','<div id="end_date_div" style="display:block;">'); |
|
| 2223 | - else |
|
| 2224 | - $form->addElement('html','<div id="end_date_div" style="display:none;">'); |
|
| 2223 | + if (($this->end_time != '0000-00-00 00:00:00')) { |
|
| 2224 | + $form->addElement('html','<div id="end_date_div" style="display:block;">'); |
|
| 2225 | + } else { |
|
| 2226 | + $form->addElement('html','<div id="end_date_div" style="display:none;">'); |
|
| 2227 | + } |
|
| 2225 | 2228 | |
| 2226 | 2229 | $form->addElement('date_time_picker', 'end_time'); |
| 2227 | 2230 | $form->addElement('html','</div>'); |
@@ -3278,7 +3281,9 @@ discard block |
||
| 3278 | 3281 | $organs_at_risk_hit = 0; |
| 3279 | 3282 | $questionScore = 0; |
| 3280 | 3283 | |
| 3281 | - if ($debug) error_log('Start answer loop '); |
|
| 3284 | + if ($debug) { |
|
| 3285 | + error_log('Start answer loop '); |
|
| 3286 | + } |
|
| 3282 | 3287 | |
| 3283 | 3288 | $orderedHotspots = []; |
| 3284 | 3289 | |
@@ -3402,7 +3407,9 @@ discard block |
||
| 3402 | 3407 | } |
| 3403 | 3408 | $totalScore += $answerWeighting; |
| 3404 | 3409 | |
| 3405 | - if ($debug) error_log("studentChoice: $studentChoice"); |
|
| 3410 | + if ($debug) { |
|
| 3411 | + error_log("studentChoice: $studentChoice"); |
|
| 3412 | + } |
|
| 3406 | 3413 | break; |
| 3407 | 3414 | case GLOBAL_MULTIPLE_ANSWER: |
| 3408 | 3415 | if ($from_database) { |
@@ -3427,7 +3434,9 @@ discard block |
||
| 3427 | 3434 | $real_answers[$answerId] = (bool)$studentChoice; |
| 3428 | 3435 | } |
| 3429 | 3436 | $totalScore += $answerWeighting; |
| 3430 | - if ($debug) error_log("studentChoice: $studentChoice"); |
|
| 3437 | + if ($debug) { |
|
| 3438 | + error_log("studentChoice: $studentChoice"); |
|
| 3439 | + } |
|
| 3431 | 3440 | break; |
| 3432 | 3441 | case MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE: |
| 3433 | 3442 | if ($from_database) { |
@@ -4153,7 +4162,9 @@ discard block |
||
| 4153 | 4162 | } // end switch Answertype |
| 4154 | 4163 | |
| 4155 | 4164 | if ($show_result) { |
| 4156 | - if ($debug) error_log('Showing questions $from '.$from); |
|
| 4165 | + if ($debug) { |
|
| 4166 | + error_log('Showing questions $from '.$from); |
|
| 4167 | + } |
|
| 4157 | 4168 | if ($from == 'exercise_result') { |
| 4158 | 4169 | // display answers (if not matching type, or if the answer is correct) |
| 4159 | 4170 | if ( |
@@ -4450,7 +4461,9 @@ discard block |
||
| 4450 | 4461 | } |
| 4451 | 4462 | } |
| 4452 | 4463 | } else { |
| 4453 | - if ($debug) error_log('Showing questions $from '.$from); |
|
| 4464 | + if ($debug) { |
|
| 4465 | + error_log('Showing questions $from '.$from); |
|
| 4466 | + } |
|
| 4454 | 4467 | |
| 4455 | 4468 | switch ($answerType) { |
| 4456 | 4469 | case UNIQUE_ANSWER: |
@@ -4795,10 +4808,14 @@ discard block |
||
| 4795 | 4808 | } |
| 4796 | 4809 | } |
| 4797 | 4810 | } |
| 4798 | - if ($debug) error_log(' ------ '); |
|
| 4811 | + if ($debug) { |
|
| 4812 | + error_log(' ------ '); |
|
| 4813 | + } |
|
| 4799 | 4814 | } // end for that loops over all answers of the current question |
| 4800 | 4815 | |
| 4801 | - if ($debug) error_log('-- end answer loop --'); |
|
| 4816 | + if ($debug) { |
|
| 4817 | + error_log('-- end answer loop --'); |
|
| 4818 | + } |
|
| 4802 | 4819 | |
| 4803 | 4820 | $final_answer = true; |
| 4804 | 4821 | |
@@ -4871,7 +4888,9 @@ discard block |
||
| 4871 | 4888 | // some results that haven't been stored in the database yet |
| 4872 | 4889 | if ($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER || $answerType == HOT_SPOT_DELINEATION ) { |
| 4873 | 4890 | |
| 4874 | - if ($debug) error_log('$from AND this is a hotspot kind of question '); |
|
| 4891 | + if ($debug) { |
|
| 4892 | + error_log('$from AND this is a hotspot kind of question '); |
|
| 4893 | + } |
|
| 4875 | 4894 | |
| 4876 | 4895 | $my_exe_id = 0; |
| 4877 | 4896 | $from_database = 0; |
@@ -5047,8 +5066,12 @@ discard block |
||
| 5047 | 5066 | // stored by exercise_results.php (using the session) |
| 5048 | 5067 | |
| 5049 | 5068 | if ($saved_results) { |
| 5050 | - if ($debug) error_log("Save question results $saved_results"); |
|
| 5051 | - if ($debug) error_log(print_r($choice ,1 )); |
|
| 5069 | + if ($debug) { |
|
| 5070 | + error_log("Save question results $saved_results"); |
|
| 5071 | + } |
|
| 5072 | + if ($debug) { |
|
| 5073 | + error_log(print_r($choice ,1 )); |
|
| 5074 | + } |
|
| 5052 | 5075 | |
| 5053 | 5076 | if (empty($choice)) { |
| 5054 | 5077 | $choice = 0; |
@@ -5150,7 +5173,9 @@ discard block |
||
| 5150 | 5173 | $sql = 'UPDATE ' . $stat_table . ' SET |
| 5151 | 5174 | exe_result = exe_result + ' . floatval($questionScore) . ' |
| 5152 | 5175 | WHERE exe_id = ' . $exeId; |
| 5153 | - if ($debug) error_log($sql); |
|
| 5176 | + if ($debug) { |
|
| 5177 | + error_log($sql); |
|
| 5178 | + } |
|
| 5154 | 5179 | Database::query($sql); |
| 5155 | 5180 | } |
| 5156 | 5181 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $locked = api_resource_is_locked_by_gradebook($exercise_id, LINK_EXERCISE); |
| 93 | 93 | |
| 94 | 94 | if (empty($objExercise)) { |
| 95 | - $objExercise = new Exercise(); |
|
| 95 | + $objExercise = new Exercise(); |
|
| 96 | 96 | $objExercise->read($exercise_id); |
| 97 | 97 | } |
| 98 | 98 | $feedback_type = $objExercise->feedback_type; |
@@ -100,16 +100,16 @@ discard block |
||
| 100 | 100 | //Only users can see their own results |
| 101 | 101 | if (!$is_allowedToEdit) { |
| 102 | 102 | if ($student_id != $current_user_id) { |
| 103 | - api_not_allowed(true); |
|
| 103 | + api_not_allowed(true); |
|
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | if (isset($_SESSION['gradebook'])) { |
| 108 | - $gradebook= Security::remove_XSS($_SESSION['gradebook']); |
|
| 108 | + $gradebook= Security::remove_XSS($_SESSION['gradebook']); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | if (!empty($gradebook) && $gradebook=='view') { |
| 112 | - $interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'],'name' => get_lang('ToolGradebook')); |
|
| 112 | + $interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'],'name' => get_lang('ToolGradebook')); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | $fromlink = ''; |
@@ -124,14 +124,14 @@ discard block |
||
| 124 | 124 | $htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/js/hotspot.js"></script>'; |
| 125 | 125 | |
| 126 | 126 | if ($origin != 'learnpath') { |
| 127 | - Display::display_header(''); |
|
| 127 | + Display::display_header(''); |
|
| 128 | 128 | } else { |
| 129 | 129 | $htmlHeadXtra[] = " |
| 130 | 130 | <style> |
| 131 | 131 | body { background: none;} |
| 132 | 132 | </style> |
| 133 | 133 | "; |
| 134 | - Display::display_reduced_header(); |
|
| 134 | + Display::display_reduced_header(); |
|
| 135 | 135 | } |
| 136 | 136 | ?> |
| 137 | 137 | <script> |
@@ -232,12 +232,12 @@ discard block |
||
| 232 | 232 | } |
| 233 | 233 | } |
| 234 | 234 | } else { |
| 235 | - Display::display_warning_message(get_lang('CantViewResults')); |
|
| 236 | - $show_results = false; |
|
| 235 | + Display::display_warning_message(get_lang('CantViewResults')); |
|
| 236 | + $show_results = false; |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | if ($origin == 'learnpath' && !isset($_GET['fb_type']) ) { |
| 240 | - $show_results = false; |
|
| 240 | + $show_results = false; |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | if ($show_results || $show_only_total_score || $showTotalScoreAndUserChoices) { |
@@ -285,13 +285,13 @@ discard block |
||
| 285 | 285 | $exerciseResult = array(); |
| 286 | 286 | |
| 287 | 287 | while ($row = Database::fetch_array($result)) { |
| 288 | - $question_list_from_database[] = $row['question_id']; |
|
| 289 | - $exerciseResult[$row['question_id']] = $row['answer']; |
|
| 288 | + $question_list_from_database[] = $row['question_id']; |
|
| 289 | + $exerciseResult[$row['question_id']] = $row['answer']; |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | //Fixing #2073 Fixing order of questions |
| 293 | 293 | if (!empty($track_exercise_info['data_tracking'])) { |
| 294 | - $temp_question_list = explode(',', $track_exercise_info['data_tracking']); |
|
| 294 | + $temp_question_list = explode(',', $track_exercise_info['data_tracking']); |
|
| 295 | 295 | |
| 296 | 296 | // Getting question list from data_tracking |
| 297 | 297 | if (!empty($temp_question_list)) { |
@@ -330,21 +330,21 @@ discard block |
||
| 330 | 330 | |
| 331 | 331 | foreach ($questionList as $questionId) { |
| 332 | 332 | |
| 333 | - $choice = $exerciseResult[$questionId]; |
|
| 334 | - // destruction of the Question object |
|
| 335 | - unset($objQuestionTmp); |
|
| 333 | + $choice = $exerciseResult[$questionId]; |
|
| 334 | + // destruction of the Question object |
|
| 335 | + unset($objQuestionTmp); |
|
| 336 | 336 | |
| 337 | 337 | // creates a temporary Question object |
| 338 | 338 | $objQuestionTmp = Question::read($questionId); |
| 339 | 339 | $questionWeighting = $objQuestionTmp->selectWeighting(); |
| 340 | 340 | $answerType = $objQuestionTmp->selectType(); |
| 341 | 341 | |
| 342 | - // Start buffer |
|
| 342 | + // Start buffer |
|
| 343 | 343 | ob_start(); |
| 344 | 344 | |
| 345 | 345 | // Use switch |
| 346 | 346 | |
| 347 | - if ($answerType == MULTIPLE_ANSWER || $answerType == MULTIPLE_ANSWER_TRUE_FALSE) { |
|
| 347 | + if ($answerType == MULTIPLE_ANSWER || $answerType == MULTIPLE_ANSWER_TRUE_FALSE) { |
|
| 348 | 348 | $question_result = $objExercise->manage_answer( |
| 349 | 349 | $id, |
| 350 | 350 | $questionId, |
@@ -490,12 +490,12 @@ discard block |
||
| 490 | 490 | ); |
| 491 | 491 | $questionScore = $question_result['score']; |
| 492 | 492 | $totalScore += $question_result['score']; |
| 493 | - } elseif ($answerType == HOT_SPOT) { |
|
| 494 | - if ($show_results || $showTotalScoreAndUserChoices) { |
|
| 495 | - echo '<table width="500" border="0"><tr> |
|
| 493 | + } elseif ($answerType == HOT_SPOT) { |
|
| 494 | + if ($show_results || $showTotalScoreAndUserChoices) { |
|
| 495 | + echo '<table width="500" border="0"><tr> |
|
| 496 | 496 | <td valign="top" align="center" style="padding-left:0px;" > |
| 497 | 497 | <table border="1" bordercolor="#A4A4A4" style="border-collapse: collapse;" width="552">'; |
| 498 | - } |
|
| 498 | + } |
|
| 499 | 499 | $question_result = $objExercise->manage_answer( |
| 500 | 500 | $id, |
| 501 | 501 | $questionId, |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | <br> |
| 537 | 537 | "; |
| 538 | 538 | } |
| 539 | - } else if($answerType == HOT_SPOT_DELINEATION) { |
|
| 539 | + } else if($answerType == HOT_SPOT_DELINEATION) { |
|
| 540 | 540 | |
| 541 | 541 | $question_result = $objExercise->manage_answer( |
| 542 | 542 | $id, |
@@ -693,15 +693,15 @@ discard block |
||
| 693 | 693 | </table> |
| 694 | 694 | "; |
| 695 | 695 | } |
| 696 | - } |
|
| 696 | + } |
|
| 697 | 697 | |
| 698 | - if ($show_results) { |
|
| 699 | - if ($answerType != HOT_SPOT) { |
|
| 700 | - echo '</table>'; |
|
| 701 | - } |
|
| 702 | - } |
|
| 698 | + if ($show_results) { |
|
| 699 | + if ($answerType != HOT_SPOT) { |
|
| 700 | + echo '</table>'; |
|
| 701 | + } |
|
| 702 | + } |
|
| 703 | 703 | |
| 704 | - $comnt = null; |
|
| 704 | + $comnt = null; |
|
| 705 | 705 | |
| 706 | 706 | if ($show_results) { |
| 707 | 707 | if ( |
@@ -718,18 +718,18 @@ discard block |
||
| 718 | 718 | |
| 719 | 719 | $marksname = ''; |
| 720 | 720 | |
| 721 | - if ($isFeedbackAllowed) { |
|
| 722 | - $name = "fckdiv".$questionId; |
|
| 723 | - $marksname = "marksName".$questionId; |
|
| 724 | - if (in_array($answerType, array(FREE_ANSWER, ORAL_EXPRESSION))) { |
|
| 725 | - $url_name = get_lang('EditCommentsAndMarks'); |
|
| 726 | - } else { |
|
| 727 | - if ($action=='edit') { |
|
| 728 | - $url_name = get_lang('EditIndividualComment'); |
|
| 729 | - } else { |
|
| 730 | - $url_name = get_lang('AddComments'); |
|
| 731 | - } |
|
| 732 | - } |
|
| 721 | + if ($isFeedbackAllowed) { |
|
| 722 | + $name = "fckdiv".$questionId; |
|
| 723 | + $marksname = "marksName".$questionId; |
|
| 724 | + if (in_array($answerType, array(FREE_ANSWER, ORAL_EXPRESSION))) { |
|
| 725 | + $url_name = get_lang('EditCommentsAndMarks'); |
|
| 726 | + } else { |
|
| 727 | + if ($action=='edit') { |
|
| 728 | + $url_name = get_lang('EditIndividualComment'); |
|
| 729 | + } else { |
|
| 730 | + $url_name = get_lang('AddComments'); |
|
| 731 | + } |
|
| 732 | + } |
|
| 733 | 733 | echo '<br />'; |
| 734 | 734 | echo Display::url( |
| 735 | 735 | $url_name, |
@@ -738,26 +738,26 @@ discard block |
||
| 738 | 738 | 'class' => 'btn btn-default', |
| 739 | 739 | 'onclick' => "showfck('".$name."', '".$marksname."');") |
| 740 | 740 | ); |
| 741 | - echo '<br />'; |
|
| 741 | + echo '<br />'; |
|
| 742 | 742 | |
| 743 | 743 | echo '<div id="feedback_'.$name.'" style="width:100%">'; |
| 744 | - $comnt = trim(Event::get_comments($id, $questionId)); |
|
| 745 | - if (empty($comnt)) { |
|
| 746 | - echo '<br />'; |
|
| 747 | - } else { |
|
| 748 | - echo '<div id="question_feedback">'.$comnt.'</div>'; |
|
| 749 | - } |
|
| 750 | - echo '</div>'; |
|
| 744 | + $comnt = trim(Event::get_comments($id, $questionId)); |
|
| 745 | + if (empty($comnt)) { |
|
| 746 | + echo '<br />'; |
|
| 747 | + } else { |
|
| 748 | + echo '<div id="question_feedback">'.$comnt.'</div>'; |
|
| 749 | + } |
|
| 750 | + echo '</div>'; |
|
| 751 | 751 | |
| 752 | 752 | echo '<div id="'.$name.'" style="display:none">'; |
| 753 | - $arrid[] = $questionId; |
|
| 754 | - $feedback_form = new FormValidator('frmcomments'.$questionId,'post',''); |
|
| 755 | - $feedback_form->addElement('html','<br>'); |
|
| 756 | - $renderer =& $feedback_form->defaultRenderer(); |
|
| 757 | - $renderer->setFormTemplate('<form{attributes}><div align="left">{content}</div></form>'); |
|
| 758 | - $renderer->setCustomElementTemplate('<div align="left">{element}</div>'); |
|
| 759 | - $comnt = Event::get_comments($id, $questionId); |
|
| 760 | - $default = array('comments_'.$questionId => $comnt); |
|
| 753 | + $arrid[] = $questionId; |
|
| 754 | + $feedback_form = new FormValidator('frmcomments'.$questionId,'post',''); |
|
| 755 | + $feedback_form->addElement('html','<br>'); |
|
| 756 | + $renderer =& $feedback_form->defaultRenderer(); |
|
| 757 | + $renderer->setFormTemplate('<form{attributes}><div align="left">{content}</div></form>'); |
|
| 758 | + $renderer->setCustomElementTemplate('<div align="left">{element}</div>'); |
|
| 759 | + $comnt = Event::get_comments($id, $questionId); |
|
| 760 | + $default = array('comments_'.$questionId => $comnt); |
|
| 761 | 761 | |
| 762 | 762 | if ($useAdvancedEditor) { |
| 763 | 763 | $feedback_form->addElement( |
@@ -774,52 +774,52 @@ discard block |
||
| 774 | 774 | } else { |
| 775 | 775 | $feedback_form->addElement('textarea', 'comments_' . $questionId); |
| 776 | 776 | } |
| 777 | - $feedback_form->addElement('html','<br>'); |
|
| 778 | - $feedback_form->setDefaults($default); |
|
| 779 | - $feedback_form->display(); |
|
| 780 | - echo '</div>'; |
|
| 781 | - |
|
| 782 | - } else { |
|
| 783 | - $comnt = Event::get_comments($id, $questionId); |
|
| 784 | - echo '<br />'; |
|
| 785 | - if (!empty($comnt)) { |
|
| 786 | - echo '<b>'.get_lang('Feedback').'</b>'; |
|
| 787 | - echo '<div id="question_feedback">'.$comnt.'</div>'; |
|
| 788 | - } |
|
| 789 | - } |
|
| 790 | - |
|
| 791 | - if ($is_allowedToEdit && $isFeedbackAllowed) { |
|
| 792 | - if (in_array($answerType, array(FREE_ANSWER, ORAL_EXPRESSION))) { |
|
| 793 | - $marksname = "marksName".$questionId; |
|
| 777 | + $feedback_form->addElement('html','<br>'); |
|
| 778 | + $feedback_form->setDefaults($default); |
|
| 779 | + $feedback_form->display(); |
|
| 780 | + echo '</div>'; |
|
| 781 | + |
|
| 782 | + } else { |
|
| 783 | + $comnt = Event::get_comments($id, $questionId); |
|
| 784 | + echo '<br />'; |
|
| 785 | + if (!empty($comnt)) { |
|
| 786 | + echo '<b>'.get_lang('Feedback').'</b>'; |
|
| 787 | + echo '<div id="question_feedback">'.$comnt.'</div>'; |
|
| 788 | + } |
|
| 789 | + } |
|
| 790 | + |
|
| 791 | + if ($is_allowedToEdit && $isFeedbackAllowed) { |
|
| 792 | + if (in_array($answerType, array(FREE_ANSWER, ORAL_EXPRESSION))) { |
|
| 793 | + $marksname = "marksName".$questionId; |
|
| 794 | 794 | echo '<div id="'.$marksname.'" style="display:none">'; |
| 795 | 795 | echo '<form name="marksform_'.$questionId.'" method="post" action="">'; |
| 796 | - $arrmarks[] = $questionId; |
|
| 797 | - echo get_lang("AssignMarks"); |
|
| 798 | - echo " <select name='marks' id='marks'>"; |
|
| 799 | - for ($i=0;$i<=$questionWeighting;$i++) { |
|
| 800 | - echo '<option '.(($i==$questionScore)?"selected='selected'":'').'>'.$i.'</option>'; |
|
| 801 | - } |
|
| 802 | - echo '</select>'; |
|
| 803 | - echo '</form><br /></div>'; |
|
| 804 | - |
|
| 805 | - if ($questionScore == -1 ) { |
|
| 806 | - $questionScore = 0; |
|
| 807 | - echo Display::return_message(get_lang('notCorrectedYet')); |
|
| 808 | - } |
|
| 809 | - } else { |
|
| 810 | - $arrmarks[] = $questionId; |
|
| 811 | - echo '<div id="'.$marksname.'" style="display:none"><form name="marksform_'.$questionId.'" method="post" action=""> |
|
| 796 | + $arrmarks[] = $questionId; |
|
| 797 | + echo get_lang("AssignMarks"); |
|
| 798 | + echo " <select name='marks' id='marks'>"; |
|
| 799 | + for ($i=0;$i<=$questionWeighting;$i++) { |
|
| 800 | + echo '<option '.(($i==$questionScore)?"selected='selected'":'').'>'.$i.'</option>'; |
|
| 801 | + } |
|
| 802 | + echo '</select>'; |
|
| 803 | + echo '</form><br /></div>'; |
|
| 804 | + |
|
| 805 | + if ($questionScore == -1 ) { |
|
| 806 | + $questionScore = 0; |
|
| 807 | + echo Display::return_message(get_lang('notCorrectedYet')); |
|
| 808 | + } |
|
| 809 | + } else { |
|
| 810 | + $arrmarks[] = $questionId; |
|
| 811 | + echo '<div id="'.$marksname.'" style="display:none"><form name="marksform_'.$questionId.'" method="post" action=""> |
|
| 812 | 812 | <select name="marks" id="marks" style="display:none;"><option>'.$questionScore.'</option></select></form><br/ ></div>'; |
| 813 | - } |
|
| 814 | - } else { |
|
| 815 | - if ($questionScore == -1) { |
|
| 816 | - $questionScore = 0; |
|
| 817 | - } |
|
| 818 | - } |
|
| 819 | - } |
|
| 813 | + } |
|
| 814 | + } else { |
|
| 815 | + if ($questionScore == -1) { |
|
| 816 | + $questionScore = 0; |
|
| 817 | + } |
|
| 818 | + } |
|
| 819 | + } |
|
| 820 | 820 | |
| 821 | 821 | $my_total_score = $questionScore; |
| 822 | - $my_total_weight = $questionWeighting; |
|
| 822 | + $my_total_weight = $questionWeighting; |
|
| 823 | 823 | $totalWeighting += $questionWeighting; |
| 824 | 824 | $category_was_added_for_this_test = false; |
| 825 | 825 | |
@@ -865,7 +865,7 @@ discard block |
||
| 865 | 865 | |
| 866 | 866 | $score = array(); |
| 867 | 867 | if ($show_results) { |
| 868 | - $score['result'] = get_lang('Score')." : ".ExerciseLib::show_score($my_total_score, $my_total_weight, false, false); |
|
| 868 | + $score['result'] = get_lang('Score')." : ".ExerciseLib::show_score($my_total_score, $my_total_weight, false, false); |
|
| 869 | 869 | $score['pass'] = $my_total_score >= $my_total_weight ? true : false; |
| 870 | 870 | $score['type'] = $answerType; |
| 871 | 871 | $score['score'] = $my_total_score; |
@@ -873,16 +873,16 @@ discard block |
||
| 873 | 873 | $score['comments'] = isset($comnt) ? $comnt : null; |
| 874 | 874 | } |
| 875 | 875 | |
| 876 | - unset($objAnswerTmp); |
|
| 877 | - $i++; |
|
| 876 | + unset($objAnswerTmp); |
|
| 877 | + $i++; |
|
| 878 | 878 | |
| 879 | 879 | $contents = ob_get_clean(); |
| 880 | 880 | $question_content = '<div class="question_row">'; |
| 881 | - if ($show_results) { |
|
| 881 | + if ($show_results) { |
|
| 882 | 882 | // Shows question title an description |
| 883 | - $question_content .= $objQuestionTmp->return_header(null, $counter, $score); |
|
| 884 | - } |
|
| 885 | - $counter++; |
|
| 883 | + $question_content .= $objQuestionTmp->return_header(null, $counter, $score); |
|
| 884 | + } |
|
| 885 | + $counter++; |
|
| 886 | 886 | $question_content .= $contents; |
| 887 | 887 | $question_content .= '</div>'; |
| 888 | 888 | $exercise_content .= $question_content; |
@@ -892,12 +892,12 @@ discard block |
||
| 892 | 892 | |
| 893 | 893 | //Total score |
| 894 | 894 | if ($origin!='learnpath' || ($origin == 'learnpath' && isset($_GET['fb_type']))) { |
| 895 | - if ($show_results || $show_only_total_score || $showTotalScoreAndUserChoices) { |
|
| 895 | + if ($show_results || $show_only_total_score || $showTotalScoreAndUserChoices) { |
|
| 896 | 896 | $total_score_text .= '<div class="question_row">'; |
| 897 | 897 | $my_total_score_temp = $totalScore; |
| 898 | - if ($objExercise->selectPropagateNeg() == 0 && $my_total_score_temp < 0) { |
|
| 899 | - $my_total_score_temp = 0; |
|
| 900 | - } |
|
| 898 | + if ($objExercise->selectPropagateNeg() == 0 && $my_total_score_temp < 0) { |
|
| 899 | + $my_total_score_temp = 0; |
|
| 900 | + } |
|
| 901 | 901 | $total_score_text .= ExerciseLib::get_question_ribbon( |
| 902 | 902 | $objExercise, |
| 903 | 903 | $my_total_score_temp, |
@@ -905,7 +905,7 @@ discard block |
||
| 905 | 905 | true |
| 906 | 906 | ); |
| 907 | 907 | $total_score_text .= '</div>'; |
| 908 | - } |
|
| 908 | + } |
|
| 909 | 909 | } |
| 910 | 910 | |
| 911 | 911 | if (!empty($category_list) && ($show_results || $show_only_total_score || $showTotalScoreAndUserChoices)) { |
@@ -929,26 +929,26 @@ discard block |
||
| 929 | 929 | } |
| 930 | 930 | |
| 931 | 931 | if ($isFeedbackAllowed) { |
| 932 | - if (in_array($origin, array('tracking_course','user_course','correct_exercise_in_lp'))) { |
|
| 933 | - echo '<form name="myform" id="myform" action="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'&filter=2&comments=update&exeid='.$id.'&origin='.$origin.'&details=true&course='.Security::remove_XSS($_GET['cidReq']).$fromlink.'" method="post">'; |
|
| 934 | - echo '<input type = "hidden" name="lp_item_id" value="'.$learnpath_id.'">'; |
|
| 935 | - echo '<input type = "hidden" name="lp_item_view_id" value="'.$lp_item_view_id.'">'; |
|
| 936 | - echo '<input type = "hidden" name="student_id" value="'.$student_id.'">'; |
|
| 937 | - echo '<input type = "hidden" name="total_score" value="'.$totalScore.'"> '; |
|
| 938 | - echo '<input type = "hidden" name="my_exe_exo_id" value="'.$exercise_id.'"> '; |
|
| 939 | - } else { |
|
| 940 | - echo ' <form name="myform" id="myform" action="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'&filter=1&comments=update&exeid='.$id.'" method="post">'; |
|
| 941 | - } |
|
| 942 | - if ($origin !='learnpath' && $origin!='student_progress') { |
|
| 932 | + if (in_array($origin, array('tracking_course','user_course','correct_exercise_in_lp'))) { |
|
| 933 | + echo '<form name="myform" id="myform" action="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'&filter=2&comments=update&exeid='.$id.'&origin='.$origin.'&details=true&course='.Security::remove_XSS($_GET['cidReq']).$fromlink.'" method="post">'; |
|
| 934 | + echo '<input type = "hidden" name="lp_item_id" value="'.$learnpath_id.'">'; |
|
| 935 | + echo '<input type = "hidden" name="lp_item_view_id" value="'.$lp_item_view_id.'">'; |
|
| 936 | + echo '<input type = "hidden" name="student_id" value="'.$student_id.'">'; |
|
| 937 | + echo '<input type = "hidden" name="total_score" value="'.$totalScore.'"> '; |
|
| 938 | + echo '<input type = "hidden" name="my_exe_exo_id" value="'.$exercise_id.'"> '; |
|
| 939 | + } else { |
|
| 940 | + echo ' <form name="myform" id="myform" action="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'&filter=1&comments=update&exeid='.$id.'" method="post">'; |
|
| 941 | + } |
|
| 942 | + if ($origin !='learnpath' && $origin!='student_progress') { |
|
| 943 | 943 | echo '<label><input type= "checkbox" name="send_notification"> '.get_lang('SendEmail').'</label>'; |
| 944 | - ?> |
|
| 944 | + ?> |
|
| 945 | 945 | <br /> |
| 946 | 946 | <button type="submit" class="btn btn-primary" value="<?php echo get_lang('Ok'); ?>" onclick="getFCK('<?php echo $strids; ?>','<?php echo $marksid; ?>');"> |
| 947 | 947 | <?php echo get_lang('CorrectTest'); ?> |
| 948 | 948 | </button> |
| 949 | 949 | </form> |
| 950 | 950 | <?php |
| 951 | - } |
|
| 951 | + } |
|
| 952 | 952 | } |
| 953 | 953 | |
| 954 | 954 | //Came from lpstats in a lp |
@@ -965,21 +965,21 @@ discard block |
||
| 965 | 965 | } |
| 966 | 966 | |
| 967 | 967 | if ($origin != 'learnpath') { |
| 968 | - //we are not in learnpath tool |
|
| 969 | - Display::display_footer(); |
|
| 968 | + //we are not in learnpath tool |
|
| 969 | + Display::display_footer(); |
|
| 970 | 970 | } else { |
| 971 | - if (!isset($_GET['fb_type'])) { |
|
| 972 | - $lp_mode = $_SESSION['lp_mode']; |
|
| 973 | - $url = '../newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exeId.'&fb_type='.$feedback_type; |
|
| 974 | - $href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'" '; |
|
| 975 | - echo '<script type="text/javascript">'.$href.'</script>'; |
|
| 976 | - // Record the results in the learning path, using the SCORM interface (API) |
|
| 977 | - echo "<script>window.parent.API.void_save_asset('$totalScore', '$totalWeighting', 0, 'completed'); </script>"; |
|
| 978 | - echo '</body></html>'; |
|
| 979 | - } else { |
|
| 980 | - Display::display_normal_message(get_lang('ExerciseFinished').' '.get_lang('ToContinueUseMenu')); |
|
| 971 | + if (!isset($_GET['fb_type'])) { |
|
| 972 | + $lp_mode = $_SESSION['lp_mode']; |
|
| 973 | + $url = '../newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exeId.'&fb_type='.$feedback_type; |
|
| 974 | + $href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'" '; |
|
| 975 | + echo '<script type="text/javascript">'.$href.'</script>'; |
|
| 976 | + // Record the results in the learning path, using the SCORM interface (API) |
|
| 977 | + echo "<script>window.parent.API.void_save_asset('$totalScore', '$totalWeighting', 0, 'completed'); </script>"; |
|
| 978 | + echo '</body></html>'; |
|
| 979 | + } else { |
|
| 980 | + Display::display_normal_message(get_lang('ExerciseFinished').' '.get_lang('ToContinueUseMenu')); |
|
| 981 | 981 | echo '<br />'; |
| 982 | - } |
|
| 982 | + } |
|
| 983 | 983 | } |
| 984 | 984 | |
| 985 | 985 | // Destroying the session |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | require_once '../inc/global.inc.php'; |
| 18 | 18 | $debug = false; |
| 19 | -if (empty($origin) ) { |
|
| 19 | +if (empty($origin)) { |
|
| 20 | 20 | $origin = isset($_REQUEST['origin']) ? $_REQUEST['origin'] : null; |
| 21 | 21 | } |
| 22 | 22 | |
@@ -33,18 +33,18 @@ discard block |
||
| 33 | 33 | $TBL_TRACK_ATTEMPT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); |
| 34 | 34 | |
| 35 | 35 | // General parameters passed via POST/GET |
| 36 | -if ($debug) { error_log('Entered exercise_result.php: '.print_r($_POST,1)); } |
|
| 36 | +if ($debug) { error_log('Entered exercise_result.php: '.print_r($_POST, 1)); } |
|
| 37 | 37 | |
| 38 | 38 | if (empty($formSent)) { $formSent = isset($_REQUEST['formSent']) ? $_REQUEST['formSent'] : null; } |
| 39 | 39 | if (empty($exerciseResult)) { $exerciseResult = isset($_SESSION['exerciseResult']) ? $_SESSION['exerciseResult'] : null; } |
| 40 | -if (empty($questionId)) { $questionId = isset($_REQUEST['questionId']) ? $_REQUEST['questionId'] : null;} |
|
| 41 | -if (empty($choice)) { $choice = isset($_REQUEST['choice']) ? $_REQUEST['choice'] : null;} |
|
| 42 | -if (empty($questionNum)) { $questionNum = isset($_REQUEST['num']) ? $_REQUEST['num'] : null;} |
|
| 43 | -if (empty($nbrQuestions)) { $nbrQuestions = isset($_REQUEST['nbrQuestions']) ? $_REQUEST['nbrQuestions'] : null;} |
|
| 44 | -if (empty($questionList)) { $questionList = isset($_SESSION['questionList']) ? $_SESSION['questionList'] : null;} |
|
| 45 | -if (empty($objExercise)) { $objExercise = isset($_SESSION['objExercise']) ? $_SESSION['objExercise'] : null;} |
|
| 46 | -if (empty($exeId)) { $exeId = isset($_REQUEST['id']) ? $_REQUEST['id'] : null;} |
|
| 47 | -if (empty($action)) { $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;} |
|
| 40 | +if (empty($questionId)) { $questionId = isset($_REQUEST['questionId']) ? $_REQUEST['questionId'] : null; } |
|
| 41 | +if (empty($choice)) { $choice = isset($_REQUEST['choice']) ? $_REQUEST['choice'] : null; } |
|
| 42 | +if (empty($questionNum)) { $questionNum = isset($_REQUEST['num']) ? $_REQUEST['num'] : null; } |
|
| 43 | +if (empty($nbrQuestions)) { $nbrQuestions = isset($_REQUEST['nbrQuestions']) ? $_REQUEST['nbrQuestions'] : null; } |
|
| 44 | +if (empty($questionList)) { $questionList = isset($_SESSION['questionList']) ? $_SESSION['questionList'] : null; } |
|
| 45 | +if (empty($objExercise)) { $objExercise = isset($_SESSION['objExercise']) ? $_SESSION['objExercise'] : null; } |
|
| 46 | +if (empty($exeId)) { $exeId = isset($_REQUEST['id']) ? $_REQUEST['id'] : null; } |
|
| 47 | +if (empty($action)) { $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null; } |
|
| 48 | 48 | |
| 49 | 49 | $id = intval($_REQUEST['id']); //exe id |
| 50 | 50 | |
@@ -105,23 +105,23 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | if (isset($_SESSION['gradebook'])) { |
| 108 | - $gradebook= Security::remove_XSS($_SESSION['gradebook']); |
|
| 108 | + $gradebook = Security::remove_XSS($_SESSION['gradebook']); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | -if (!empty($gradebook) && $gradebook=='view') { |
|
| 112 | - $interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'],'name' => get_lang('ToolGradebook')); |
|
| 111 | +if (!empty($gradebook) && $gradebook == 'view') { |
|
| 112 | + $interbreadcrumb[] = array('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('ToolGradebook')); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | $fromlink = ''; |
| 116 | 116 | |
| 117 | -$interbreadcrumb[]= array("url" => "exercise.php?".api_get_cidreq(),"name" => get_lang('Exercises')); |
|
| 118 | -$interbreadcrumb[]= array("url" => "overview.php?exerciseId=".$exercise_id.'&'.api_get_cidreq(),"name" => $objExercise->name); |
|
| 119 | -$interbreadcrumb[]= array("url" => "#", "name" => get_lang('Result')); |
|
| 117 | +$interbreadcrumb[] = array("url" => "exercise.php?".api_get_cidreq(), "name" => get_lang('Exercises')); |
|
| 118 | +$interbreadcrumb[] = array("url" => "overview.php?exerciseId=".$exercise_id.'&'.api_get_cidreq(), "name" => $objExercise->name); |
|
| 119 | +$interbreadcrumb[] = array("url" => "#", "name" => get_lang('Result')); |
|
| 120 | 120 | |
| 121 | 121 | $this_section = SECTION_COURSES; |
| 122 | 122 | |
| 123 | -$htmlHeadXtra[] = '<link rel="stylesheet" href="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/css/hotspot.css">'; |
|
| 124 | -$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/js/hotspot.js"></script>'; |
|
| 123 | +$htmlHeadXtra[] = '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/css/hotspot.css">'; |
|
| 124 | +$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/js/hotspot.js"></script>'; |
|
| 125 | 125 | |
| 126 | 126 | if ($origin != 'learnpath') { |
| 127 | 127 | Display::display_header(''); |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | $show_results = false; |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | -if ($origin == 'learnpath' && !isset($_GET['fb_type']) ) { |
|
| 239 | +if ($origin == 'learnpath' && !isset($_GET['fb_type'])) { |
|
| 240 | 240 | $show_results = false; |
| 241 | 241 | } |
| 242 | 242 | |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | $arrques = array(); |
| 262 | 262 | $arrans = array(); |
| 263 | 263 | |
| 264 | -$user_restriction = $is_allowedToEdit ? '' : "AND user_id=".intval($student_id)." "; |
|
| 264 | +$user_restriction = $is_allowedToEdit ? '' : "AND user_id=".intval($student_id)." "; |
|
| 265 | 265 | $sql = "SELECT attempts.question_id, answer |
| 266 | 266 | FROM $TBL_TRACK_ATTEMPT as attempts |
| 267 | 267 | INNER JOIN ".$TBL_TRACK_EXERCISES." AS stats_exercises |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | $total_weighting = 0; |
| 317 | 317 | foreach ($questionList as $questionId) { |
| 318 | 318 | $objQuestionTmp = Question::read($questionId); |
| 319 | - $total_weighting +=$objQuestionTmp->selectWeighting(); |
|
| 319 | + $total_weighting += $objQuestionTmp->selectWeighting(); |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | $counter = 1; |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | <br> |
| 537 | 537 | "; |
| 538 | 538 | } |
| 539 | - } else if($answerType == HOT_SPOT_DELINEATION) { |
|
| 539 | + } else if ($answerType == HOT_SPOT_DELINEATION) { |
|
| 540 | 540 | |
| 541 | 541 | $question_result = $objExercise->manage_answer( |
| 542 | 542 | $id, |
@@ -571,20 +571,20 @@ discard block |
||
| 571 | 571 | if ($show_results) { |
| 572 | 572 | |
| 573 | 573 | if ($overlap_color) { |
| 574 | - $overlap_color='green'; |
|
| 574 | + $overlap_color = 'green'; |
|
| 575 | 575 | } else { |
| 576 | - $overlap_color='red'; |
|
| 576 | + $overlap_color = 'red'; |
|
| 577 | 577 | } |
| 578 | 578 | |
| 579 | 579 | if ($missing_color) { |
| 580 | - $missing_color='green'; |
|
| 580 | + $missing_color = 'green'; |
|
| 581 | 581 | } else { |
| 582 | - $missing_color='red'; |
|
| 582 | + $missing_color = 'red'; |
|
| 583 | 583 | } |
| 584 | 584 | if ($excess_color) { |
| 585 | - $excess_color='green'; |
|
| 585 | + $excess_color = 'green'; |
|
| 586 | 586 | } else { |
| 587 | - $excess_color='red'; |
|
| 587 | + $excess_color = 'red'; |
|
| 588 | 588 | } |
| 589 | 589 | |
| 590 | 590 | if (!is_numeric($final_overlap)) { |
@@ -598,11 +598,11 @@ discard block |
||
| 598 | 598 | $final_excess = 0; |
| 599 | 599 | } |
| 600 | 600 | |
| 601 | - if ($final_excess>100) { |
|
| 601 | + if ($final_excess > 100) { |
|
| 602 | 602 | $final_excess = 100; |
| 603 | 603 | } |
| 604 | 604 | |
| 605 | - $table_resume='<table class="data_table"> |
|
| 605 | + $table_resume = '<table class="data_table"> |
|
| 606 | 606 | <tr class="row_odd" > |
| 607 | 607 | <td></td> |
| 608 | 608 | <td ><b>'.get_lang('Requirements').'</b></td> |
@@ -612,38 +612,38 @@ discard block |
||
| 612 | 612 | <tr class="row_even"> |
| 613 | 613 | <td><b>'.get_lang('Overlap').'</b></td> |
| 614 | 614 | <td>'.get_lang('Min').' '.$threadhold1.'</td> |
| 615 | - <td><div style="color:'.$overlap_color.'">'.(($final_overlap < 0)?0:intval($final_overlap)).'</div></td> |
|
| 615 | + <td><div style="color:'.$overlap_color.'">'.(($final_overlap < 0) ? 0 : intval($final_overlap)).'</div></td> |
|
| 616 | 616 | </tr> |
| 617 | 617 | |
| 618 | 618 | <tr> |
| 619 | 619 | <td><b>'.get_lang('Excess').'</b></td> |
| 620 | 620 | <td>'.get_lang('Max').' '.$threadhold2.'</td> |
| 621 | - <td><div style="color:'.$excess_color.'">'.(($final_excess < 0)?0:intval($final_excess)).'</div></td> |
|
| 621 | + <td><div style="color:'.$excess_color.'">'.(($final_excess < 0) ? 0 : intval($final_excess)).'</div></td> |
|
| 622 | 622 | </tr> |
| 623 | 623 | |
| 624 | 624 | <tr class="row_even"> |
| 625 | 625 | <td><b>'.get_lang('Missing').'</b></td> |
| 626 | 626 | <td>'.get_lang('Max').' '.$threadhold3.'</td> |
| 627 | - <td><div style="color:'.$missing_color.'">'.(($final_missing < 0)?0:intval($final_missing)).'</div></td> |
|
| 627 | + <td><div style="color:'.$missing_color.'">'.(($final_missing < 0) ? 0 : intval($final_missing)).'</div></td> |
|
| 628 | 628 | </tr></table>'; |
| 629 | 629 | |
| 630 | - if ($answerType!= HOT_SPOT_DELINEATION) { |
|
| 631 | - $item_list = explode('@@',$destination); |
|
| 630 | + if ($answerType != HOT_SPOT_DELINEATION) { |
|
| 631 | + $item_list = explode('@@', $destination); |
|
| 632 | 632 | |
| 633 | 633 | $try = $item_list[0]; |
| 634 | 634 | $lp = $item_list[1]; |
| 635 | 635 | $destinationid = $item_list[2]; |
| 636 | 636 | $url = $item_list[3]; |
| 637 | - $table_resume=''; |
|
| 637 | + $table_resume = ''; |
|
| 638 | 638 | } else { |
| 639 | - if ($next==0) { |
|
| 639 | + if ($next == 0) { |
|
| 640 | 640 | $try = $try_hotspot; |
| 641 | 641 | $lp = $lp_hotspot; |
| 642 | - $destinationid= $select_question_hotspot; |
|
| 643 | - $url=$url_hotspot; |
|
| 642 | + $destinationid = $select_question_hotspot; |
|
| 643 | + $url = $url_hotspot; |
|
| 644 | 644 | } else { |
| 645 | 645 | //show if no error |
| 646 | - $comment=$answerComment = $objAnswerTmp->selectComment($nbrAnswers); |
|
| 646 | + $comment = $answerComment = $objAnswerTmp->selectComment($nbrAnswers); |
|
| 647 | 647 | $answerDestination = $objAnswerTmp->selectDestination($nbrAnswers); |
| 648 | 648 | } |
| 649 | 649 | } |
@@ -651,14 +651,14 @@ discard block |
||
| 651 | 651 | echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>'; |
| 652 | 652 | if ($answerType == HOT_SPOT_DELINEATION) { |
| 653 | 653 | if ($organs_at_risk_hit > 0) { |
| 654 | - $message='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />'; |
|
| 655 | - $message.='<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>'; |
|
| 654 | + $message = '<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />'; |
|
| 655 | + $message .= '<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>'; |
|
| 656 | 656 | } else { |
| 657 | - $message='<p>'.get_lang('YourDelineation').'</p>'; |
|
| 658 | - $message.=$table_resume; |
|
| 659 | - $message.='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />'; |
|
| 657 | + $message = '<p>'.get_lang('YourDelineation').'</p>'; |
|
| 658 | + $message .= $table_resume; |
|
| 659 | + $message .= '<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />'; |
|
| 660 | 660 | } |
| 661 | - $message.='<p>'.$comment.'</p>'; |
|
| 661 | + $message .= '<p>'.$comment.'</p>'; |
|
| 662 | 662 | echo $message; |
| 663 | 663 | } else { |
| 664 | 664 | echo '<p>'.$comment.'</p>'; |
@@ -668,8 +668,8 @@ discard block |
||
| 668 | 668 | $queryfree = "SELECT marks FROM ".$TBL_TRACK_ATTEMPT." |
| 669 | 669 | WHERE exe_id = ".intval($id)." and question_id= ".intval($questionId).""; |
| 670 | 670 | $resfree = Database::query($queryfree); |
| 671 | - $questionScore= Database::result($resfree,0,"marks"); |
|
| 672 | - $totalScore+=$questionScore; |
|
| 671 | + $questionScore = Database::result($resfree, 0, "marks"); |
|
| 672 | + $totalScore += $questionScore; |
|
| 673 | 673 | $relPath = api_get_path(REL_PATH); |
| 674 | 674 | echo '</table></td></tr>'; |
| 675 | 675 | |
@@ -724,7 +724,7 @@ discard block |
||
| 724 | 724 | if (in_array($answerType, array(FREE_ANSWER, ORAL_EXPRESSION))) { |
| 725 | 725 | $url_name = get_lang('EditCommentsAndMarks'); |
| 726 | 726 | } else { |
| 727 | - if ($action=='edit') { |
|
| 727 | + if ($action == 'edit') { |
|
| 728 | 728 | $url_name = get_lang('EditIndividualComment'); |
| 729 | 729 | } else { |
| 730 | 730 | $url_name = get_lang('AddComments'); |
@@ -751,9 +751,9 @@ discard block |
||
| 751 | 751 | |
| 752 | 752 | echo '<div id="'.$name.'" style="display:none">'; |
| 753 | 753 | $arrid[] = $questionId; |
| 754 | - $feedback_form = new FormValidator('frmcomments'.$questionId,'post',''); |
|
| 755 | - $feedback_form->addElement('html','<br>'); |
|
| 756 | - $renderer =& $feedback_form->defaultRenderer(); |
|
| 754 | + $feedback_form = new FormValidator('frmcomments'.$questionId, 'post', ''); |
|
| 755 | + $feedback_form->addElement('html', '<br>'); |
|
| 756 | + $renderer = & $feedback_form->defaultRenderer(); |
|
| 757 | 757 | $renderer->setFormTemplate('<form{attributes}><div align="left">{content}</div></form>'); |
| 758 | 758 | $renderer->setCustomElementTemplate('<div align="left">{element}</div>'); |
| 759 | 759 | $comnt = Event::get_comments($id, $questionId); |
@@ -762,7 +762,7 @@ discard block |
||
| 762 | 762 | if ($useAdvancedEditor) { |
| 763 | 763 | $feedback_form->addElement( |
| 764 | 764 | 'html_editor', |
| 765 | - 'comments_' . $questionId, |
|
| 765 | + 'comments_'.$questionId, |
|
| 766 | 766 | null, |
| 767 | 767 | null, |
| 768 | 768 | array( |
@@ -772,9 +772,9 @@ discard block |
||
| 772 | 772 | ) |
| 773 | 773 | ); |
| 774 | 774 | } else { |
| 775 | - $feedback_form->addElement('textarea', 'comments_' . $questionId); |
|
| 775 | + $feedback_form->addElement('textarea', 'comments_'.$questionId); |
|
| 776 | 776 | } |
| 777 | - $feedback_form->addElement('html','<br>'); |
|
| 777 | + $feedback_form->addElement('html', '<br>'); |
|
| 778 | 778 | $feedback_form->setDefaults($default); |
| 779 | 779 | $feedback_form->display(); |
| 780 | 780 | echo '</div>'; |
@@ -796,13 +796,13 @@ discard block |
||
| 796 | 796 | $arrmarks[] = $questionId; |
| 797 | 797 | echo get_lang("AssignMarks"); |
| 798 | 798 | echo " <select name='marks' id='marks'>"; |
| 799 | - for ($i=0;$i<=$questionWeighting;$i++) { |
|
| 800 | - echo '<option '.(($i==$questionScore)?"selected='selected'":'').'>'.$i.'</option>'; |
|
| 799 | + for ($i = 0; $i <= $questionWeighting; $i++) { |
|
| 800 | + echo '<option '.(($i == $questionScore) ? "selected='selected'" : '').'>'.$i.'</option>'; |
|
| 801 | 801 | } |
| 802 | 802 | echo '</select>'; |
| 803 | 803 | echo '</form><br /></div>'; |
| 804 | 804 | |
| 805 | - if ($questionScore == -1 ) { |
|
| 805 | + if ($questionScore == -1) { |
|
| 806 | 806 | $questionScore = 0; |
| 807 | 807 | echo Display::return_message(get_lang('notCorrectedYet')); |
| 808 | 808 | } |
@@ -838,7 +838,7 @@ discard block |
||
| 838 | 838 | } |
| 839 | 839 | |
| 840 | 840 | if (isset($objQuestionTmp->category_list) && !empty($objQuestionTmp->category_list)) { |
| 841 | - foreach($objQuestionTmp->category_list as $category_id) { |
|
| 841 | + foreach ($objQuestionTmp->category_list as $category_id) { |
|
| 842 | 842 | $category_list[$category_id]['score'] += $my_total_score; |
| 843 | 843 | $category_list[$category_id]['total'] += $my_total_weight; |
| 844 | 844 | $category_was_added_for_this_test = true; |
@@ -891,7 +891,7 @@ discard block |
||
| 891 | 891 | $total_score_text = null; |
| 892 | 892 | |
| 893 | 893 | //Total score |
| 894 | -if ($origin!='learnpath' || ($origin == 'learnpath' && isset($_GET['fb_type']))) { |
|
| 894 | +if ($origin != 'learnpath' || ($origin == 'learnpath' && isset($_GET['fb_type']))) { |
|
| 895 | 895 | if ($show_results || $show_only_total_score || $showTotalScoreAndUserChoices) { |
| 896 | 896 | $total_score_text .= '<div class="question_row">'; |
| 897 | 897 | $my_total_score_temp = $totalScore; |
@@ -923,13 +923,13 @@ discard block |
||
| 923 | 923 | |
| 924 | 924 | if ($isFeedbackAllowed) { |
| 925 | 925 | if (is_array($arrid) && is_array($arrmarks)) { |
| 926 | - $strids = implode(",",$arrid); |
|
| 927 | - $marksid = implode(",",$arrmarks); |
|
| 926 | + $strids = implode(",", $arrid); |
|
| 927 | + $marksid = implode(",", $arrmarks); |
|
| 928 | 928 | } |
| 929 | 929 | } |
| 930 | 930 | |
| 931 | 931 | if ($isFeedbackAllowed) { |
| 932 | - if (in_array($origin, array('tracking_course','user_course','correct_exercise_in_lp'))) { |
|
| 932 | + if (in_array($origin, array('tracking_course', 'user_course', 'correct_exercise_in_lp'))) { |
|
| 933 | 933 | echo '<form name="myform" id="myform" action="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'&filter=2&comments=update&exeid='.$id.'&origin='.$origin.'&details=true&course='.Security::remove_XSS($_GET['cidReq']).$fromlink.'" method="post">'; |
| 934 | 934 | echo '<input type = "hidden" name="lp_item_id" value="'.$learnpath_id.'">'; |
| 935 | 935 | echo '<input type = "hidden" name="lp_item_view_id" value="'.$lp_item_view_id.'">'; |
@@ -939,7 +939,7 @@ discard block |
||
| 939 | 939 | } else { |
| 940 | 940 | echo ' <form name="myform" id="myform" action="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'&filter=1&comments=update&exeid='.$id.'" method="post">'; |
| 941 | 941 | } |
| 942 | - if ($origin !='learnpath' && $origin!='student_progress') { |
|
| 942 | + if ($origin != 'learnpath' && $origin != 'student_progress') { |
|
| 943 | 943 | echo '<label><input type= "checkbox" name="send_notification"> '.get_lang('SendEmail').'</label>'; |
| 944 | 944 | ?> |
| 945 | 945 | <br /> |
@@ -952,14 +952,14 @@ discard block |
||
| 952 | 952 | } |
| 953 | 953 | |
| 954 | 954 | //Came from lpstats in a lp |
| 955 | -if ($origin =='student_progress') { ?> |
|
| 955 | +if ($origin == 'student_progress') { ?> |
|
| 956 | 956 | <button type="button" class="back" onclick="window.history.go(-1);" value="<?php echo get_lang('Back'); ?>" > |
| 957 | - <?php echo get_lang('Back');?></button> |
|
| 957 | + <?php echo get_lang('Back'); ?></button> |
|
| 958 | 958 | <?php |
| 959 | -} else if($origin=='myprogress') { |
|
| 959 | +} else if ($origin == 'myprogress') { |
|
| 960 | 960 | ?> |
| 961 | 961 | <button type="button" class="save" onclick="top.location.href='../auth/my_progress.php?course=<?php echo api_get_course_id()?>'" value="<?php echo get_lang('Finish'); ?>" > |
| 962 | - <?php echo get_lang('Finish');?> |
|
| 962 | + <?php echo get_lang('Finish'); ?> |
|
| 963 | 963 | </button> |
| 964 | 964 | <?php |
| 965 | 965 | } |
@@ -969,9 +969,9 @@ discard block |
||
| 969 | 969 | Display::display_footer(); |
| 970 | 970 | } else { |
| 971 | 971 | if (!isset($_GET['fb_type'])) { |
| 972 | - $lp_mode = $_SESSION['lp_mode']; |
|
| 972 | + $lp_mode = $_SESSION['lp_mode']; |
|
| 973 | 973 | $url = '../newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exeId.'&fb_type='.$feedback_type; |
| 974 | - $href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'" '; |
|
| 974 | + $href = ($lp_mode == 'fullscreen') ? ' window.opener.location.href="'.$url.'" ' : ' top.location.href="'.$url.'" '; |
|
| 975 | 975 | echo '<script type="text/javascript">'.$href.'</script>'; |
| 976 | 976 | // Record the results in the learning path, using the SCORM interface (API) |
| 977 | 977 | echo "<script>window.parent.API.void_save_asset('$totalScore', '$totalWeighting', 0, 'completed'); </script>"; |