@@ -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; |
@@ -401,8 +401,7 @@ |
||
401 | 401 | $nbQuestionInThisCat = TestCategory::getNumberOfQuestionsInCategoryForTest($exerciseId, $tabcatid[$i]); |
402 | 402 | if ($nbQuestionInThisCat > $in_nbrandom) { |
403 | 403 | $nbquestionresult += $in_nbrandom; |
404 | - } |
|
405 | - else { |
|
404 | + } else { |
|
406 | 405 | $nbquestionresult += $nbQuestionInThisCat; |
407 | 406 | } |
408 | 407 | } |
@@ -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 | } |
@@ -15,12 +15,13 @@ |
||
15 | 15 | $exerciseId = $objExcercise->selectId(); |
16 | 16 | // Save clicking order |
17 | 17 | $answerOrderId = count($_SESSION['exerciseResult'][$questionId]['ids'])+1; |
18 | -if ($_GET['answerId'] == "0") // click is NOT on a hotspot |
|
18 | +if ($_GET['answerId'] == "0") { |
|
19 | + // click is NOT on a hotspot |
|
19 | 20 | { |
20 | 21 | $hit = 0; |
21 | - $answerId = NULL; |
|
22 | 22 | } |
23 | -else // user clicked ON a hotspot |
|
23 | + $answerId = NULL; |
|
24 | +} else // user clicked ON a hotspot |
|
24 | 25 | { |
25 | 26 | $hit = 1; |
26 | 27 | $answerId = api_substr($_GET['answerId'],22,2); |
@@ -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')); |