@@ -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])) { |
@@ -341,8 +341,7 @@ |
||
341 | 341 | case '1': // coming from Agenda |
342 | 342 | if ($action == 'edit') { |
343 | 343 | $url = "../calendar/agenda.php?action=edit&id=49&originalresource=$originalresource"; |
344 | - } |
|
345 | - elseif ($action == 'add') { |
|
344 | + } elseif ($action == 'add') { |
|
346 | 345 | $url = "../calendar/agenda.php?action=add&originalresource=$originalresource"; |
347 | 346 | } else { |
348 | 347 | $url = "../calendar/agenda.php?action=add"; |
@@ -459,11 +459,12 @@ discard block |
||
459 | 459 | } |
460 | 460 | } |
461 | 461 | |
462 | - if ($package_type == '' || !$mandatory) |
|
463 | - // && defined('CHECK_FOR_AICC') && CHECK_FOR_AICC) |
|
462 | + if ($package_type == '' || !$mandatory) { |
|
463 | + // && defined('CHECK_FOR_AICC') && CHECK_FOR_AICC) |
|
464 | 464 | { |
465 | 465 | return api_failure::set_failure('not_aicc_content'); |
466 | 466 | } |
467 | + } |
|
467 | 468 | |
468 | 469 | if (!enough_size($realFileSize, $course_sys_dir, $maxFilledSpace)) { |
469 | 470 | return api_failure::set_failure('not_enough_space'); |
@@ -511,7 +512,9 @@ discard block |
||
511 | 512 | if ($file != '.' && $file != '..') { |
512 | 513 | $filetype = 'file'; |
513 | 514 | |
514 | - if (is_dir($course_sys_dir.$new_dir.$file)) $filetype = 'folder'; |
|
515 | + if (is_dir($course_sys_dir.$new_dir.$file)) { |
|
516 | + $filetype = 'folder'; |
|
517 | + } |
|
515 | 518 | |
516 | 519 | // TODO: RENAMING FILES CAN BE VERY DANGEROUS AICC-WISE, avoid that as much as possible! |
517 | 520 | //$safe_file = api_replace_dangerous_char($file, 'strict'); |
@@ -910,37 +913,43 @@ discard block |
||
910 | 913 | if ($enclosed && $data{$i+1} == $enclosure) { |
911 | 914 | $fldval .= $chr; |
912 | 915 | ++$i; // Skip the next character. |
913 | - } else |
|
914 | - $enclosed = !$enclosed; |
|
916 | + } else { |
|
917 | + $enclosed = !$enclosed; |
|
918 | + } |
|
915 | 919 | break; |
916 | 920 | case $delim: |
917 | 921 | if (!$enclosed) { |
918 | 922 | $ret_array[$linecount][$fldcount++] = $fldval; |
919 | 923 | $fldval = ''; |
920 | - } else |
|
921 | - $fldval .= $chr; |
|
924 | + } else { |
|
925 | + $fldval .= $chr; |
|
926 | + } |
|
922 | 927 | break; |
923 | 928 | case "\r": |
924 | - if (!$enclosed&&$data{$i+1} == "\n") |
|
925 | - continue; |
|
929 | + if (!$enclosed&&$data{$i+1} == "\n") { |
|
930 | + continue; |
|
931 | + } |
|
926 | 932 | case "\n": |
927 | 933 | if (!$enclosed) { |
928 | 934 | $ret_array[$linecount++][$fldcount] = $fldval; |
929 | 935 | $fldcount = 0; |
930 | 936 | $fldval = ''; |
931 | - } else |
|
932 | - $fldval .= $chr; |
|
937 | + } else { |
|
938 | + $fldval .= $chr; |
|
939 | + } |
|
933 | 940 | break; |
934 | 941 | case "\\r": |
935 | - if (!$enclosed&&$data{$i+1} == "\\n") |
|
936 | - continue; |
|
942 | + if (!$enclosed&&$data{$i+1} == "\\n") { |
|
943 | + continue; |
|
944 | + } |
|
937 | 945 | case "\\n": |
938 | 946 | if (!$enclosed) { |
939 | 947 | $ret_array[$linecount++][$fldcount] = $fldval; |
940 | 948 | $fldcount = 0; |
941 | 949 | $fldval = ''; |
942 | - } else |
|
943 | - $fldval .= $chr; |
|
950 | + } else { |
|
951 | + $fldval .= $chr; |
|
952 | + } |
|
944 | 953 | break; |
945 | 954 | default: |
946 | 955 | $fldval .= $chr; |
@@ -48,7 +48,9 @@ discard block |
||
48 | 48 | foreach ($dashboard_blocks as $block) { |
49 | 49 | |
50 | 50 | // display only user blocks |
51 | - if (!in_array($block['id'], $user_blocks_id)) continue; |
|
51 | + if (!in_array($block['id'], $user_blocks_id)) { |
|
52 | + continue; |
|
53 | + } |
|
52 | 54 | |
53 | 55 | $path = $block['path']; |
54 | 56 | $controller_class = $block['controller']; |
@@ -61,7 +63,9 @@ discard block |
||
61 | 63 | // check if user is allowed to see the block |
62 | 64 | if (method_exists($obj, 'is_block_visible_for_user')) { |
63 | 65 | $is_block_visible_for_user = $obj->is_block_visible_for_user($user_id); |
64 | - if (!$is_block_visible_for_user) continue; |
|
66 | + if (!$is_block_visible_for_user) { |
|
67 | + continue; |
|
68 | + } |
|
65 | 69 | } |
66 | 70 | |
67 | 71 | $data_block[$path] = $obj->get_block(); |
@@ -40,7 +40,9 @@ |
||
40 | 40 | //if the rewrite rule asks for a directory, we redirect to the course view |
41 | 41 | if (is_dir($full_file_name)) { |
42 | 42 | //remove last slash if present |
43 | - while ($doc_url{$dul = strlen($doc_url)-1}=='/') $doc_url = substr($doc_url,0,$dul); |
|
43 | + while ($doc_url{$dul = strlen($doc_url)-1}=='/') { |
|
44 | + $doc_url = substr($doc_url,0,$dul); |
|
45 | + } |
|
44 | 46 | //create the path |
45 | 47 | $document_explorer = api_get_path(WEB_COURSE_PATH).api_get_course_path(); // home course path |
46 | 48 | //redirect |
@@ -379,9 +379,10 @@ discard block |
||
379 | 379 | $result = Database::query($sql); |
380 | 380 | $row = Database::fetch_array($result); |
381 | 381 | |
382 | - if ($row['number'] == 1) |
|
383 | - $user_task = true; |
|
384 | -} |
|
382 | + if ($row['number'] == 1) { |
|
383 | + $user_task = true; |
|
384 | + } |
|
385 | + } |
|
385 | 386 | |
386 | 387 | switch ($action) { |
387 | 388 | case 'new_post': |
@@ -468,16 +469,17 @@ discard block |
||
468 | 469 | echo '<br /><br />'; |
469 | 470 | Blog :: display_assigned_task_list($blog_id); |
470 | 471 | echo '<br /><br />'; |
472 | + } else { |
|
473 | + api_not_allowed(); |
|
471 | 474 | } |
472 | - else |
|
473 | - api_not_allowed(); |
|
474 | 475 | |
475 | 476 | break; |
476 | 477 | case 'execute_task' : |
477 | - if (isset ($_GET['post_id'])) |
|
478 | - Blog :: display_post($blog_id, intval($_GET['post_id'])); |
|
479 | - else |
|
480 | - Blog :: display_select_task_post($blog_id, intval($_GET['task_id'])); |
|
478 | + if (isset ($_GET['post_id'])) { |
|
479 | + Blog :: display_post($blog_id, intval($_GET['post_id'])); |
|
480 | + } else { |
|
481 | + Blog :: display_select_task_post($blog_id, intval($_GET['task_id'])); |
|
482 | + } |
|
481 | 483 | |
482 | 484 | break; |
483 | 485 | case 'view_search_result' : |
@@ -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 |
@@ -538,10 +538,11 @@ discard block |
||
538 | 538 | */ |
539 | 539 | public function isInList($questionId) |
540 | 540 | { |
541 | - if (is_array($this->questionList)) |
|
542 | - return in_array($questionId,$this->questionList); |
|
543 | - else |
|
544 | - return false; |
|
541 | + if (is_array($this->questionList)) { |
|
542 | + return in_array($questionId,$this->questionList); |
|
543 | + } else { |
|
544 | + return false; |
|
545 | + } |
|
545 | 546 | } |
546 | 547 | |
547 | 548 | /** |
@@ -1227,10 +1228,11 @@ discard block |
||
1227 | 1228 | |
1228 | 1229 | $var = Exercise::selectTimeLimit(); |
1229 | 1230 | |
1230 | - if (($this->start_time != '0000-00-00 00:00:00')) |
|
1231 | - $form->addElement('html','<div id="start_date_div" style="display:block;">'); |
|
1232 | - else |
|
1233 | - $form->addElement('html','<div id="start_date_div" style="display:none;">'); |
|
1231 | + if (($this->start_time != '0000-00-00 00:00:00')) { |
|
1232 | + $form->addElement('html','<div id="start_date_div" style="display:block;">'); |
|
1233 | + } else { |
|
1234 | + $form->addElement('html','<div id="start_date_div" style="display:none;">'); |
|
1235 | + } |
|
1234 | 1236 | |
1235 | 1237 | $form->addElement('date_time_picker', 'start_time'); |
1236 | 1238 | |
@@ -1238,10 +1240,11 @@ discard block |
||
1238 | 1240 | |
1239 | 1241 | $form->addElement('checkbox', 'activate_end_date_check', null , get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()')); |
1240 | 1242 | |
1241 | - if (($this->end_time != '0000-00-00 00:00:00')) |
|
1242 | - $form->addElement('html','<div id="end_date_div" style="display:block;">'); |
|
1243 | - else |
|
1244 | - $form->addElement('html','<div id="end_date_div" style="display:none;">'); |
|
1243 | + if (($this->end_time != '0000-00-00 00:00:00')) { |
|
1244 | + $form->addElement('html','<div id="end_date_div" style="display:block;">'); |
|
1245 | + } else { |
|
1246 | + $form->addElement('html','<div id="end_date_div" style="display:none;">'); |
|
1247 | + } |
|
1245 | 1248 | |
1246 | 1249 | $form->addElement('date_time_picker', 'end_time'); |
1247 | 1250 | $form->addElement('html','</div>'); |
@@ -2268,7 +2271,9 @@ discard block |
||
2268 | 2271 | $organs_at_risk_hit = 0; |
2269 | 2272 | $questionScore = 0; |
2270 | 2273 | |
2271 | - if ($debug) error_log('Start answer loop '); |
|
2274 | + if ($debug) { |
|
2275 | + error_log('Start answer loop '); |
|
2276 | + } |
|
2272 | 2277 | |
2273 | 2278 | $answer_correct_array = array(); |
2274 | 2279 | |
@@ -2383,7 +2388,9 @@ discard block |
||
2383 | 2388 | } |
2384 | 2389 | $totalScore += $answerWeighting; |
2385 | 2390 | |
2386 | - if ($debug) error_log("studentChoice: $studentChoice"); |
|
2391 | + if ($debug) { |
|
2392 | + error_log("studentChoice: $studentChoice"); |
|
2393 | + } |
|
2387 | 2394 | break; |
2388 | 2395 | case GLOBAL_MULTIPLE_ANSWER: |
2389 | 2396 | if ($from_database) { |
@@ -2408,7 +2415,9 @@ discard block |
||
2408 | 2415 | $real_answers[$answerId] = (bool)$studentChoice; |
2409 | 2416 | } |
2410 | 2417 | $totalScore += $answerWeighting; |
2411 | - if ($debug) error_log("studentChoice: $studentChoice"); |
|
2418 | + if ($debug) { |
|
2419 | + error_log("studentChoice: $studentChoice"); |
|
2420 | + } |
|
2412 | 2421 | break; |
2413 | 2422 | case MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE: |
2414 | 2423 | if ($from_database) { |
@@ -3125,9 +3134,13 @@ discard block |
||
3125 | 3134 | } // end switch Answertype |
3126 | 3135 | |
3127 | 3136 | if ($show_result) { |
3128 | - if ($debug) error_log('show result '.$show_result); |
|
3137 | + if ($debug) { |
|
3138 | + error_log('show result '.$show_result); |
|
3139 | + } |
|
3129 | 3140 | if ($from == 'exercise_result') { |
3130 | - if ($debug) error_log('Showing questions $from '.$from); |
|
3141 | + if ($debug) { |
|
3142 | + error_log('Showing questions $from '.$from); |
|
3143 | + } |
|
3131 | 3144 | //display answers (if not matching type, or if the answer is correct) |
3132 | 3145 | if ( |
3133 | 3146 | !in_array( |
@@ -3415,7 +3428,9 @@ discard block |
||
3415 | 3428 | } |
3416 | 3429 | } |
3417 | 3430 | } else { |
3418 | - if ($debug) error_log('Showing questions $from '.$from); |
|
3431 | + if ($debug) { |
|
3432 | + error_log('Showing questions $from '.$from); |
|
3433 | + } |
|
3419 | 3434 | |
3420 | 3435 | switch ($answerType) { |
3421 | 3436 | case UNIQUE_ANSWER: |
@@ -3747,10 +3762,14 @@ discard block |
||
3747 | 3762 | } |
3748 | 3763 | } |
3749 | 3764 | } |
3750 | - if ($debug) error_log(' ------ '); |
|
3765 | + if ($debug) { |
|
3766 | + error_log(' ------ '); |
|
3767 | + } |
|
3751 | 3768 | } // end for that loops over all answers of the current question |
3752 | 3769 | |
3753 | - if ($debug) error_log('-- end answer loop --'); |
|
3770 | + if ($debug) { |
|
3771 | + error_log('-- end answer loop --'); |
|
3772 | + } |
|
3754 | 3773 | |
3755 | 3774 | $final_answer = true; |
3756 | 3775 | |
@@ -3823,7 +3842,9 @@ discard block |
||
3823 | 3842 | // some results that haven't been stored in the database yet |
3824 | 3843 | if ($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER || $answerType == HOT_SPOT_DELINEATION ) { |
3825 | 3844 | |
3826 | - if ($debug) error_log('$from AND this is a hotspot kind of question '); |
|
3845 | + if ($debug) { |
|
3846 | + error_log('$from AND this is a hotspot kind of question '); |
|
3847 | + } |
|
3827 | 3848 | |
3828 | 3849 | $my_exe_id = 0; |
3829 | 3850 | $from_database = 0; |
@@ -3999,8 +4020,12 @@ discard block |
||
3999 | 4020 | // stored by exercise_results.php (using the session) |
4000 | 4021 | |
4001 | 4022 | if ($saved_results) { |
4002 | - if ($debug) error_log("Save question results $saved_results"); |
|
4003 | - if ($debug) error_log(print_r($choice ,1 )); |
|
4023 | + if ($debug) { |
|
4024 | + error_log("Save question results $saved_results"); |
|
4025 | + } |
|
4026 | + if ($debug) { |
|
4027 | + error_log(print_r($choice ,1 )); |
|
4028 | + } |
|
4004 | 4029 | |
4005 | 4030 | if (empty($choice)) { |
4006 | 4031 | $choice = 0; |
@@ -4102,7 +4127,9 @@ discard block |
||
4102 | 4127 | $sql = 'UPDATE ' . $stat_table . ' SET |
4103 | 4128 | exe_result = exe_result + ' . floatval($questionScore) . ' |
4104 | 4129 | WHERE exe_id = ' . $exeId; |
4105 | - if ($debug) error_log($sql); |
|
4130 | + if ($debug) { |
|
4131 | + error_log($sql); |
|
4132 | + } |
|
4106 | 4133 | Database::query($sql); |
4107 | 4134 | } |
4108 | 4135 |
@@ -250,8 +250,7 @@ |
||
250 | 250 | case RESULT_DISABLE_SHOW_SCORE_ONLY: |
251 | 251 | if ($objExercise->feedback_type != EXERCISE_FEEDBACK_TYPE_END) { |
252 | 252 | $header_names = array(get_lang('Attempt'), get_lang('StartDate'), get_lang('IP'), get_lang('Score')); |
253 | - } |
|
254 | - else { |
|
253 | + } else { |
|
255 | 254 | $header_names = array(get_lang('Attempt'), get_lang('StartDate'), get_lang('IP'), get_lang('Score'), get_lang('Details')); |
256 | 255 | } |
257 | 256 | break; |