@@ -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); |
@@ -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) { |
@@ -327,8 +327,7 @@ discard block |
||
327 | 327 | if($this->response == 'TRUE') |
328 | 328 | { |
329 | 329 | $js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array(\'true\');'."\n"; |
330 | - } |
|
331 | - else |
|
330 | + } else |
|
332 | 331 | { |
333 | 332 | $js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array(\'false\');'."\n"; |
334 | 333 | } |
@@ -471,8 +470,11 @@ discard block |
||
471 | 470 | |
472 | 471 | $s.='</select> </td>'."\n"; |
473 | 472 | $s.='<td width="40%" valign="top">'; |
474 | - if(isset($Select[$cpt2])) $s.='<b>'.$Select[$cpt2]['Lettre'].'.</b> '.$Select[$cpt2]['Reponse']; |
|
475 | - else $s.=' '; |
|
473 | + if(isset($Select[$cpt2])) { |
|
474 | + $s.='<b>'.$Select[$cpt2]['Lettre'].'.</b> '.$Select[$cpt2]['Reponse']; |
|
475 | + } else { |
|
476 | + $s.=' '; |
|
477 | + } |
|
476 | 478 | $s.="</td>\n</tr>\n"; |
477 | 479 | |
478 | 480 | $jstmpc .= '['.$answerCorrect.','.$cpt2.'],'; |
@@ -577,8 +579,7 @@ discard block |
||
577 | 579 | $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n"; |
578 | 580 | $jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][1] = 0;'.";\n"; |
579 | 581 | $header .= $jstmpw; |
580 | - } |
|
581 | - else |
|
582 | + } else |
|
582 | 583 | { |
583 | 584 | $header = ''; |
584 | 585 | $header .= 'questions_answers['.$this->questionJSId.'] = new Array();'."\n"; |
@@ -885,8 +886,7 @@ discard block |
||
885 | 886 | . $this->end_body() |
886 | 887 | . $this->end_page(); |
887 | 888 | return $res; |
888 | - } |
|
889 | - else |
|
889 | + } else |
|
890 | 890 | { |
891 | 891 | return array($js,$html); |
892 | 892 | } |
@@ -607,10 +607,11 @@ |
||
607 | 607 | $current_width = $current_image_size['width']; |
608 | 608 | $current_height = $current_image_size['height']; |
609 | 609 | |
610 | - if ($current_width < $Max && $current_height < $Max) |
|
611 | - return true; |
|
612 | - elseif ($current_height == "") |
|
613 | - return false; |
|
610 | + if ($current_width < $Max && $current_height < $Max) { |
|
611 | + return true; |
|
612 | + } elseif ($current_height == "") { |
|
613 | + return false; |
|
614 | + } |
|
614 | 615 | |
615 | 616 | // Resize according to height. |
616 | 617 | if ($Dimension == "height") { |
@@ -239,8 +239,9 @@ discard block |
||
239 | 239 | } |
240 | 240 | |
241 | 241 | echo $attempt_html; |
242 | - if ($origin != 'learnpath') |
|
243 | - Display :: display_footer(); |
|
242 | + if ($origin != 'learnpath') { |
|
243 | + Display :: display_footer(); |
|
244 | + } |
|
244 | 245 | exit; |
245 | 246 | } |
246 | 247 | } |
@@ -260,7 +261,9 @@ discard block |
||
260 | 261 | $clock_expired_time = null; |
261 | 262 | |
262 | 263 | if (empty($exercise_stat_info)) { |
263 | - if ($debug) error_log('5 $exercise_stat_info is empty '); |
|
264 | + if ($debug) { |
|
265 | + error_log('5 $exercise_stat_info is empty '); |
|
266 | + } |
|
264 | 267 | $total_weight = 0; |
265 | 268 | $questionList = $objExercise->get_validated_question_list(); |
266 | 269 | foreach ($questionList as $question_id) { |
@@ -271,11 +274,17 @@ discard block |
||
271 | 274 | if ($time_control) { |
272 | 275 | $expected_time = $current_timestamp + $total_seconds; |
273 | 276 | |
274 | - if ($debug) error_log('5.1. $current_timestamp '.$current_timestamp); |
|
275 | - if ($debug) error_log('5.2. $expected_time '.$expected_time); |
|
277 | + if ($debug) { |
|
278 | + error_log('5.1. $current_timestamp '.$current_timestamp); |
|
279 | + } |
|
280 | + if ($debug) { |
|
281 | + error_log('5.2. $expected_time '.$expected_time); |
|
282 | + } |
|
276 | 283 | |
277 | 284 | $clock_expired_time = api_get_utc_datetime($expected_time); |
278 | - if ($debug) error_log('5.3. $expected_time '.$clock_expired_time); |
|
285 | + if ($debug) { |
|
286 | + error_log('5.3. $expected_time '.$clock_expired_time); |
|
287 | + } |
|
279 | 288 | |
280 | 289 | //Sessions that contain the expired time |
281 | 290 | $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time; |
@@ -295,8 +304,10 @@ discard block |
||
295 | 304 | $learnpath_item_id, |
296 | 305 | $learnpath_item_view_id |
297 | 306 | ); |
298 | - if ($debug) error_log("5.5 exercise_stat_info[] exists getting exe_id $exe_id"); |
|
299 | -} else { |
|
307 | + if ($debug) { |
|
308 | + error_log("5.5 exercise_stat_info[] exists getting exe_id $exe_id"); |
|
309 | + } |
|
310 | + } else { |
|
300 | 311 | $exe_id = $exercise_stat_info['exe_id']; |
301 | 312 | // Remember last question id position. |
302 | 313 | $isFirstTime = Session::read('firstTime'); |
@@ -318,8 +329,10 @@ discard block |
||
318 | 329 | } |
319 | 330 | } |
320 | 331 | |
321 | - if ($debug) error_log("5 exercise_stat_info[] exists getting exe_id $exe_id "); |
|
322 | -} |
|
332 | + if ($debug) { |
|
333 | + error_log("5 exercise_stat_info[] exists getting exe_id $exe_id "); |
|
334 | + } |
|
335 | + } |
|
323 | 336 | |
324 | 337 | // Array to check in order to block the chat |
325 | 338 | ExerciseLib::create_chat_exercise_session($exe_id); |
@@ -346,9 +359,15 @@ discard block |
||
346 | 359 | * If the expired time is major that zero(0) then the expired time is compute on this time. |
347 | 360 | */ |
348 | 361 | if ($time_control) { |
349 | - if ($debug) error_log('7.1. Time control is enabled'); |
|
350 | - if ($debug) error_log('7.2. $current_expired_time_key '.$current_expired_time_key); |
|
351 | - if ($debug) error_log('7.3. $_SESSION[expired_time][$current_expired_time_key] '.$_SESSION['expired_time'][$current_expired_time_key]); |
|
362 | + if ($debug) { |
|
363 | + error_log('7.1. Time control is enabled'); |
|
364 | + } |
|
365 | + if ($debug) { |
|
366 | + error_log('7.2. $current_expired_time_key '.$current_expired_time_key); |
|
367 | + } |
|
368 | + if ($debug) { |
|
369 | + error_log('7.3. $_SESSION[expired_time][$current_expired_time_key] '.$_SESSION['expired_time'][$current_expired_time_key]); |
|
370 | + } |
|
352 | 371 | |
353 | 372 | if (!isset($_SESSION['expired_time'][$current_expired_time_key])) { |
354 | 373 | //Timer - Get expired_time for a student |
@@ -436,7 +455,9 @@ discard block |
||
436 | 455 | } |
437 | 456 | } |
438 | 457 | |
439 | -if ($debug) error_log('8. Question list loaded '.print_r($questionList, 1)); |
|
458 | +if ($debug) { |
|
459 | + error_log('8. Question list loaded '.print_r($questionList, 1)); |
|
460 | +} |
|
440 | 461 | |
441 | 462 | //Real question count |
442 | 463 | $question_count = 0; |
@@ -362,9 +362,10 @@ |
||
362 | 362 | |
363 | 363 | if ($inATest) { |
364 | 364 | echo '<div class="actions">'; |
365 | - if (isset($_GET['hotspotadmin']) || isset($_GET['newQuestion']) || isset($_GET['myid'])) |
|
366 | - echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/admin.php?exerciseId='.$exerciseId.'&'.api_get_cidReq().'">'. |
|
365 | + if (isset($_GET['hotspotadmin']) || isset($_GET['newQuestion']) || isset($_GET['myid'])) { |
|
366 | + echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/admin.php?exerciseId='.$exerciseId.'&'.api_get_cidReq().'">'. |
|
367 | 367 | Display::return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>'; |
368 | + } |
|
368 | 369 | |
369 | 370 | if (!isset($_GET['hotspotadmin']) && !isset($_GET['newQuestion']) && !isset($_GET['myid']) && !isset($_GET['editQuestion'])) { |
370 | 371 | echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/exercise.php?'.api_get_cidReq().'">'. |
@@ -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; |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | GradebookUtils::block_students(); |
228 | 228 | if (isset ($_GET['set_visible'])) { |
229 | 229 | $visibility_command= 1; |
230 | - }else { |
|
230 | + } else { |
|
231 | 231 | $visibility_command= 0; |
232 | 232 | } |
233 | 233 | $link= LinkFactory :: load($_GET['visiblelink']); |
@@ -281,8 +281,7 @@ discard block |
||
281 | 281 | if ($number_of_selected_items == '0') { |
282 | 282 | $warning_message = get_lang('NoItemsSelected'); |
283 | 283 | $filter_warning_msg = false; |
284 | - } |
|
285 | - else { |
|
284 | + } else { |
|
286 | 285 | switch ($_POST['action']) { |
287 | 286 | case 'deleted' : |
288 | 287 | $number_of_deleted_categories= 0; |
@@ -39,7 +39,9 @@ |
||
39 | 39 | $res->set_evaluation_id($values['evaluation_id']); |
40 | 40 | $res->set_user_id(key($scores)); |
41 | 41 | //if no scores are given, don't set the score |
42 | - if ((!empty ($row)) || ($row == '0')) $res->set_score($row); |
|
42 | + if ((!empty ($row)) || ($row == '0')) { |
|
43 | + $res->set_score($row); |
|
44 | + } |
|
43 | 45 | $res->add(); |
44 | 46 | next($scores); |
45 | 47 | } |