@@ -146,15 +146,17 @@ discard block |
||
146 | 146 | $list_dest = $item_list[2]; |
147 | 147 | $url = $item_list[3]; |
148 | 148 | |
149 | - if ($try == 0) |
|
150 | - $try_result = 0; |
|
151 | - else |
|
152 | - $try_result = 1; |
|
149 | + if ($try == 0) { |
|
150 | + $try_result = 0; |
|
151 | + } else { |
|
152 | + $try_result = 1; |
|
153 | + } |
|
153 | 154 | |
154 | - if ($url == 0) |
|
155 | - $url_result = ''; |
|
156 | - else |
|
157 | - $url_result = $url; |
|
155 | + if ($url == 0) { |
|
156 | + $url_result = ''; |
|
157 | + } else { |
|
158 | + $url_result = $url; |
|
159 | + } |
|
158 | 160 | |
159 | 161 | $temp_scenario['url' . $i] = $url_result; |
160 | 162 | $temp_scenario['try' . $i] = $try_result; |
@@ -343,8 +345,9 @@ discard block |
||
343 | 345 | } |
344 | 346 | } |
345 | 347 | |
346 | - if (empty($try)) |
|
347 | - $try=0; |
|
348 | + if (empty($try)) { |
|
349 | + $try=0; |
|
350 | + } |
|
348 | 351 | |
349 | 352 | if (empty($lp)) { |
350 | 353 | $lp=0; |
@@ -18,10 +18,11 @@ |
||
18 | 18 | $lang = urldecode($_GET['lang']); |
19 | 19 | if (preg_match('/^[a-zA-Z0-9\._-]+$/', $lang)) { |
20 | 20 | //$lang = str_replace($search,$replace,urldecode($_GET['lang'])); |
21 | - if(file_exists($hotspot_lang_file . $lang . '/hotspot.inc.php')) |
|
22 | - $hotspot_lang_file .= $lang . '/hotspot.inc.php'; |
|
23 | - else |
|
24 | - $hotspot_lang_file .= 'english/hotspot.inc.php'; |
|
21 | + if(file_exists($hotspot_lang_file . $lang . '/hotspot.inc.php')) { |
|
22 | + $hotspot_lang_file .= $lang . '/hotspot.inc.php'; |
|
23 | + } else { |
|
24 | + $hotspot_lang_file .= 'english/hotspot.inc.php'; |
|
25 | + } |
|
25 | 26 | } else { |
26 | 27 | $hotspot_lang_file .= 'english/hotspot.inc.php'; |
27 | 28 | } |
@@ -400,8 +400,9 @@ |
||
400 | 400 | $extra .= $form->return_form(); |
401 | 401 | $extra .= '</div>'; |
402 | 402 | |
403 | -if ($is_allowedToEdit) |
|
403 | +if ($is_allowedToEdit) { |
|
404 | 404 | echo $extra; |
405 | +} |
|
405 | 406 | |
406 | 407 | echo $actions; |
407 | 408 |
@@ -7,7 +7,9 @@ |
||
7 | 7 | * @package chamilo.exercise |
8 | 8 | */ |
9 | 9 | |
10 | -if ( count( get_included_files() ) == 1 ) die( '---' ); |
|
10 | +if ( count( get_included_files() ) == 1 ) { |
|
11 | + die( '---' ); |
|
12 | +} |
|
11 | 13 | |
12 | 14 | if (!function_exists('mime_content_type')) { |
13 | 15 | function mime_content_type($filename) { |
@@ -10,8 +10,9 @@ discard block |
||
10 | 10 | /** |
11 | 11 | * Security check |
12 | 12 | */ |
13 | -if (count(get_included_files()) == 1) |
|
13 | +if (count(get_included_files()) == 1) { |
|
14 | 14 | die('---'); |
15 | +} |
|
15 | 16 | |
16 | 17 | /** |
17 | 18 | * Creates a temporary directory |
@@ -21,8 +22,9 @@ discard block |
||
21 | 22 | * @return string |
22 | 23 | */ |
23 | 24 | function tempdir($dir, $prefix = 'tmp', $mode = 0777) { |
24 | - if (substr($dir, -1) != '/') |
|
25 | - $dir .= '/'; |
|
25 | + if (substr($dir, -1) != '/') { |
|
26 | + $dir .= '/'; |
|
27 | + } |
|
26 | 28 | |
27 | 29 | do { |
28 | 30 | $path = $dir . $prefix . mt_rand(0, 9999999); |
@@ -104,7 +104,11 @@ |
||
104 | 104 | { |
105 | 105 | $this->answerList = $this->getAnswersList(true); |
106 | 106 | $type = $this->getQuestionType(); |
107 | - if ($type == MCMA) $cardinality = 'multiple'; else $cardinality = 'single'; |
|
107 | + if ($type == MCMA) { |
|
108 | + $cardinality = 'multiple'; |
|
109 | + } else { |
|
110 | + $cardinality = 'single'; |
|
111 | + } |
|
108 | 112 | |
109 | 113 | $out = ' <responseDeclaration identifier="' . $questionIdent . '" cardinality="' . $cardinality . '" baseType="identifier">' . "\n"; |
110 | 114 |
@@ -3243,7 +3243,9 @@ discard block |
||
3243 | 3243 | $organs_at_risk_hit = 0; |
3244 | 3244 | $questionScore = 0; |
3245 | 3245 | |
3246 | - if ($debug) error_log('Start answer loop '); |
|
3246 | + if ($debug) { |
|
3247 | + error_log('Start answer loop '); |
|
3248 | + } |
|
3247 | 3249 | |
3248 | 3250 | $answer_correct_array = array(); |
3249 | 3251 | |
@@ -3372,7 +3374,9 @@ discard block |
||
3372 | 3374 | } |
3373 | 3375 | $totalScore += $answerWeighting; |
3374 | 3376 | |
3375 | - if ($debug) error_log("studentChoice: $studentChoice"); |
|
3377 | + if ($debug) { |
|
3378 | + error_log("studentChoice: $studentChoice"); |
|
3379 | + } |
|
3376 | 3380 | break; |
3377 | 3381 | case GLOBAL_MULTIPLE_ANSWER: |
3378 | 3382 | if ($from_database) { |
@@ -3397,7 +3401,9 @@ discard block |
||
3397 | 3401 | $real_answers[$answerId] = (bool)$studentChoice; |
3398 | 3402 | } |
3399 | 3403 | $totalScore += $answerWeighting; |
3400 | - if ($debug) error_log("studentChoice: $studentChoice"); |
|
3404 | + if ($debug) { |
|
3405 | + error_log("studentChoice: $studentChoice"); |
|
3406 | + } |
|
3401 | 3407 | break; |
3402 | 3408 | case MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE: |
3403 | 3409 | if ($from_database) { |
@@ -4143,7 +4149,9 @@ discard block |
||
4143 | 4149 | } // end switch Answertype |
4144 | 4150 | |
4145 | 4151 | if ($show_result) { |
4146 | - if ($debug) error_log('Showing questions $from '.$from); |
|
4152 | + if ($debug) { |
|
4153 | + error_log('Showing questions $from '.$from); |
|
4154 | + } |
|
4147 | 4155 | if ($from == 'exercise_result') { |
4148 | 4156 | //display answers (if not matching type, or if the answer is correct) |
4149 | 4157 | if ( |
@@ -4440,7 +4448,9 @@ discard block |
||
4440 | 4448 | } |
4441 | 4449 | } |
4442 | 4450 | } else { |
4443 | - if ($debug) error_log('Showing questions $from '.$from); |
|
4451 | + if ($debug) { |
|
4452 | + error_log('Showing questions $from '.$from); |
|
4453 | + } |
|
4444 | 4454 | |
4445 | 4455 | switch ($answerType) { |
4446 | 4456 | case UNIQUE_ANSWER: |
@@ -4786,10 +4796,14 @@ discard block |
||
4786 | 4796 | } |
4787 | 4797 | } |
4788 | 4798 | } |
4789 | - if ($debug) error_log(' ------ '); |
|
4799 | + if ($debug) { |
|
4800 | + error_log(' ------ '); |
|
4801 | + } |
|
4790 | 4802 | } // end for that loops over all answers of the current question |
4791 | 4803 | |
4792 | - if ($debug) error_log('-- end answer loop --'); |
|
4804 | + if ($debug) { |
|
4805 | + error_log('-- end answer loop --'); |
|
4806 | + } |
|
4793 | 4807 | |
4794 | 4808 | $final_answer = true; |
4795 | 4809 | |
@@ -4862,7 +4876,9 @@ discard block |
||
4862 | 4876 | // some results that haven't been stored in the database yet |
4863 | 4877 | if ($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER || $answerType == HOT_SPOT_DELINEATION ) { |
4864 | 4878 | |
4865 | - if ($debug) error_log('$from AND this is a hotspot kind of question '); |
|
4879 | + if ($debug) { |
|
4880 | + error_log('$from AND this is a hotspot kind of question '); |
|
4881 | + } |
|
4866 | 4882 | |
4867 | 4883 | $my_exe_id = 0; |
4868 | 4884 | $from_database = 0; |
@@ -5038,8 +5054,12 @@ discard block |
||
5038 | 5054 | // stored by exercise_results.php (using the session) |
5039 | 5055 | |
5040 | 5056 | if ($saved_results) { |
5041 | - if ($debug) error_log("Save question results $saved_results"); |
|
5042 | - if ($debug) error_log(print_r($choice ,1 )); |
|
5057 | + if ($debug) { |
|
5058 | + error_log("Save question results $saved_results"); |
|
5059 | + } |
|
5060 | + if ($debug) { |
|
5061 | + error_log(print_r($choice ,1 )); |
|
5062 | + } |
|
5043 | 5063 | |
5044 | 5064 | if (empty($choice)) { |
5045 | 5065 | $choice = 0; |
@@ -269,7 +269,9 @@ discard block |
||
269 | 269 | $clock_expired_time = null; |
270 | 270 | |
271 | 271 | if (empty($exercise_stat_info)) { |
272 | - if ($debug) error_log('5 $exercise_stat_info is empty '); |
|
272 | + if ($debug) { |
|
273 | + error_log('5 $exercise_stat_info is empty '); |
|
274 | + } |
|
273 | 275 | $total_weight = 0; |
274 | 276 | $questionList = $objExercise->get_validated_question_list(); |
275 | 277 | foreach ($questionListUncompressed as $question_id) { |
@@ -280,11 +282,17 @@ discard block |
||
280 | 282 | if ($time_control) { |
281 | 283 | $expected_time = $current_timestamp + $total_seconds; |
282 | 284 | |
283 | - if ($debug) error_log('5.1. $current_timestamp '.$current_timestamp); |
|
284 | - if ($debug) error_log('5.2. $expected_time '.$expected_time); |
|
285 | + if ($debug) { |
|
286 | + error_log('5.1. $current_timestamp '.$current_timestamp); |
|
287 | + } |
|
288 | + if ($debug) { |
|
289 | + error_log('5.2. $expected_time '.$expected_time); |
|
290 | + } |
|
285 | 291 | |
286 | 292 | $clock_expired_time = api_get_utc_datetime($expected_time); |
287 | - if ($debug) error_log('5.3. $expected_time '.$clock_expired_time); |
|
293 | + if ($debug) { |
|
294 | + error_log('5.3. $expected_time '.$clock_expired_time); |
|
295 | + } |
|
288 | 296 | |
289 | 297 | //Sessions that contain the expired time |
290 | 298 | $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time; |
@@ -304,8 +312,10 @@ discard block |
||
304 | 312 | $learnpath_item_id, |
305 | 313 | $learnpath_item_view_id |
306 | 314 | ); |
307 | - if ($debug) error_log("5.5 exercise_stat_info[] exists getting exe_id $exe_id"); |
|
308 | -} else { |
|
315 | + if ($debug) { |
|
316 | + error_log("5.5 exercise_stat_info[] exists getting exe_id $exe_id"); |
|
317 | + } |
|
318 | + } else { |
|
309 | 319 | $exe_id = $exercise_stat_info['exe_id']; |
310 | 320 | // Remember last question id position. |
311 | 321 | $isFirstTime = Session::read('firstTime'); |
@@ -327,8 +337,10 @@ discard block |
||
327 | 337 | } |
328 | 338 | } |
329 | 339 | |
330 | - if ($debug) error_log("5 exercise_stat_info[] exists getting exe_id $exe_id "); |
|
331 | -} |
|
340 | + if ($debug) { |
|
341 | + error_log("5 exercise_stat_info[] exists getting exe_id $exe_id "); |
|
342 | + } |
|
343 | + } |
|
332 | 344 | |
333 | 345 | $questionListInSession = Session::read('questionList'); |
334 | 346 | |
@@ -384,9 +396,15 @@ discard block |
||
384 | 396 | * If the expired time is major that zero(0) then the expired time is compute on this time. |
385 | 397 | */ |
386 | 398 | if ($time_control) { |
387 | - if ($debug) error_log('7.1. Time control is enabled'); |
|
388 | - if ($debug) error_log('7.2. $current_expired_time_key '.$current_expired_time_key); |
|
389 | - if ($debug) error_log('7.3. $_SESSION[expired_time][$current_expired_time_key] '.$_SESSION['expired_time'][$current_expired_time_key]); |
|
399 | + if ($debug) { |
|
400 | + error_log('7.1. Time control is enabled'); |
|
401 | + } |
|
402 | + if ($debug) { |
|
403 | + error_log('7.2. $current_expired_time_key '.$current_expired_time_key); |
|
404 | + } |
|
405 | + if ($debug) { |
|
406 | + error_log('7.3. $_SESSION[expired_time][$current_expired_time_key] '.$_SESSION['expired_time'][$current_expired_time_key]); |
|
407 | + } |
|
390 | 408 | |
391 | 409 | if (!isset($_SESSION['expired_time'][$current_expired_time_key])) { |
392 | 410 | //Timer - Get expired_time for a student |
@@ -473,7 +491,9 @@ discard block |
||
473 | 491 | } |
474 | 492 | } |
475 | 493 | |
476 | -if ($debug) error_log('8. Question list loaded '.print_r($questionList, 1)); |
|
494 | +if ($debug) { |
|
495 | + error_log('8. Question list loaded '.print_r($questionList, 1)); |
|
496 | +} |
|
477 | 497 | |
478 | 498 | //Real question count |
479 | 499 | $question_count = 0; |
@@ -171,10 +171,11 @@ |
||
171 | 171 | } |
172 | 172 | echo '</div>'; |
173 | 173 | |
174 | - if ($objExercise->feedback_type == 1) |
|
175 | - Display::display_normal_message( |
|
174 | + if ($objExercise->feedback_type == 1) { |
|
175 | + Display::display_normal_message( |
|
176 | 176 | get_lang('DirectFeedbackCantModifyTypeQuestion') |
177 | 177 | ); |
178 | + } |
|
178 | 179 | |
179 | 180 | if (api_get_setting('search_enabled')=='true' && !extension_loaded('xapian')) { |
180 | 181 | Display::display_error_message(get_lang('SearchXapianModuleNotInstalled')); |