@@ -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')); |
@@ -45,8 +45,9 @@ discard block |
||
45 | 45 | } |
46 | 46 | break; |
47 | 47 | case "stackgetall": |
48 | - if (storage_can_set($_REQUEST['svuser'])) |
|
49 | - print storage_stack_getall($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']); |
|
48 | + if (storage_can_set($_REQUEST['svuser'])) { |
|
49 | + print storage_stack_getall($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']); |
|
50 | + } |
|
50 | 51 | break; |
51 | 52 | case "getposition": |
52 | 53 | print storage_get_position($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svasc']); |
@@ -87,8 +88,7 @@ discard block |
||
87 | 88 | } else { |
88 | 89 | return $row['sv_value']; |
89 | 90 | } |
90 | - } |
|
91 | - else { |
|
91 | + } else { |
|
92 | 92 | return null; |
93 | 93 | } |
94 | 94 | } |
@@ -144,8 +144,7 @@ discard block |
||
144 | 144 | if (Database::num_rows($res) > 0) { |
145 | 145 | $row = Database::fetch_assoc($res); |
146 | 146 | return $row['position']; |
147 | - } |
|
148 | - else { |
|
147 | + } else { |
|
149 | 148 | return null; |
150 | 149 | } |
151 | 150 | } |
@@ -198,8 +197,7 @@ discard block |
||
198 | 197 | if ($resorder && $resinsert) { |
199 | 198 | Database::query("commit"); |
200 | 199 | return 1; |
201 | - } |
|
202 | - else { |
|
200 | + } else { |
|
203 | 201 | Database::query("rollback"); |
204 | 202 | return 0; |
205 | 203 | } |
@@ -119,8 +119,9 @@ |
||
119 | 119 | |
120 | 120 | for ($i = 0; $i<count($matches[0]); $i++) { |
121 | 121 | |
122 | - if (empty($matches[1][$i])) |
|
123 | - continue; |
|
122 | + if (empty($matches[1][$i])) { |
|
123 | + continue; |
|
124 | + } |
|
124 | 125 | |
125 | 126 | $content = api_strstr($content, $matches[0][$i]); |
126 | 127 | if ($i + 1 !== count($matches[0])) { |
@@ -81,7 +81,7 @@ |
||
81 | 81 | //just showing the src in a iframe ... |
82 | 82 | $html .= '<h2>'.$toc['title'].'</h2>'; |
83 | 83 | $html .= '<iframe border="0" frameborder="0" style="width:100%;height:600px" src="' . $src . '"></iframe>'; |
84 | - }else{ |
|
84 | + } else{ |
|
85 | 85 | $html .= "<div class='impress-title'>"; |
86 | 86 | $html .= '<h1>'.$toc['title'].'</h1>'; |
87 | 87 | $html .= "</div>"; |