@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $locked = api_resource_is_locked_by_gradebook($exercise_id, LINK_EXERCISE); |
| 93 | 93 | |
| 94 | 94 | if (empty($objExercise)) { |
| 95 | - $objExercise = new Exercise(); |
|
| 95 | + $objExercise = new Exercise(); |
|
| 96 | 96 | $objExercise->read($exercise_id); |
| 97 | 97 | } |
| 98 | 98 | $feedback_type = $objExercise->feedback_type; |
@@ -100,16 +100,16 @@ discard block |
||
| 100 | 100 | //Only users can see their own results |
| 101 | 101 | if (!$is_allowedToEdit) { |
| 102 | 102 | if ($student_id != $current_user_id) { |
| 103 | - api_not_allowed(true); |
|
| 103 | + api_not_allowed(true); |
|
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | if (isset($_SESSION['gradebook'])) { |
| 108 | - $gradebook= Security::remove_XSS($_SESSION['gradebook']); |
|
| 108 | + $gradebook= Security::remove_XSS($_SESSION['gradebook']); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | if (!empty($gradebook) && $gradebook=='view') { |
| 112 | - $interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'],'name' => get_lang('ToolGradebook')); |
|
| 112 | + $interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'],'name' => get_lang('ToolGradebook')); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | $fromlink = ''; |
@@ -124,14 +124,14 @@ discard block |
||
| 124 | 124 | $htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/js/hotspot.js"></script>'; |
| 125 | 125 | |
| 126 | 126 | if ($origin != 'learnpath') { |
| 127 | - Display::display_header(''); |
|
| 127 | + Display::display_header(''); |
|
| 128 | 128 | } else { |
| 129 | 129 | $htmlHeadXtra[] = " |
| 130 | 130 | <style> |
| 131 | 131 | body { background: none;} |
| 132 | 132 | </style> |
| 133 | 133 | "; |
| 134 | - Display::display_reduced_header(); |
|
| 134 | + Display::display_reduced_header(); |
|
| 135 | 135 | } |
| 136 | 136 | ?> |
| 137 | 137 | <script> |
@@ -210,12 +210,12 @@ discard block |
||
| 210 | 210 | } |
| 211 | 211 | } |
| 212 | 212 | } else { |
| 213 | - Display::display_warning_message(get_lang('CantViewResults')); |
|
| 214 | - $show_results = false; |
|
| 213 | + Display::display_warning_message(get_lang('CantViewResults')); |
|
| 214 | + $show_results = false; |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | if ($origin == 'learnpath' && !isset($_GET['fb_type']) ) { |
| 218 | - $show_results = false; |
|
| 218 | + $show_results = false; |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | if ($show_results || $show_only_total_score) { |
@@ -263,13 +263,13 @@ discard block |
||
| 263 | 263 | $exerciseResult = array(); |
| 264 | 264 | |
| 265 | 265 | while ($row = Database::fetch_array($result)) { |
| 266 | - $question_list_from_database[] = $row['question_id']; |
|
| 267 | - $exerciseResult[$row['question_id']] = $row['answer']; |
|
| 266 | + $question_list_from_database[] = $row['question_id']; |
|
| 267 | + $exerciseResult[$row['question_id']] = $row['answer']; |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | //Fixing #2073 Fixing order of questions |
| 271 | 271 | if (!empty($track_exercise_info['data_tracking'])) { |
| 272 | - $temp_question_list = explode(',', $track_exercise_info['data_tracking']); |
|
| 272 | + $temp_question_list = explode(',', $track_exercise_info['data_tracking']); |
|
| 273 | 273 | |
| 274 | 274 | // Getting question list from data_tracking |
| 275 | 275 | if (!empty($temp_question_list)) { |
@@ -308,23 +308,23 @@ discard block |
||
| 308 | 308 | |
| 309 | 309 | foreach ($questionList as $questionId) { |
| 310 | 310 | |
| 311 | - $choice = $exerciseResult[$questionId]; |
|
| 312 | - // destruction of the Question object |
|
| 313 | - unset($objQuestionTmp); |
|
| 311 | + $choice = $exerciseResult[$questionId]; |
|
| 312 | + // destruction of the Question object |
|
| 313 | + unset($objQuestionTmp); |
|
| 314 | 314 | |
| 315 | 315 | // creates a temporary Question object |
| 316 | 316 | $objQuestionTmp = Question::read($questionId); |
| 317 | 317 | $questionWeighting = $objQuestionTmp->selectWeighting(); |
| 318 | 318 | $answerType = $objQuestionTmp->selectType(); |
| 319 | 319 | |
| 320 | - // Start buffer |
|
| 320 | + // Start buffer |
|
| 321 | 321 | ob_start(); |
| 322 | 322 | |
| 323 | 323 | /* Use switch |
| 324 | 324 | switch ($answerType) { |
| 325 | 325 | }*/ |
| 326 | 326 | |
| 327 | - if ($answerType == MULTIPLE_ANSWER || $answerType == MULTIPLE_ANSWER_TRUE_FALSE) { |
|
| 327 | + if ($answerType == MULTIPLE_ANSWER || $answerType == MULTIPLE_ANSWER_TRUE_FALSE) { |
|
| 328 | 328 | $question_result = $objExercise->manage_answer( |
| 329 | 329 | $id, |
| 330 | 330 | $questionId, |
@@ -452,12 +452,12 @@ discard block |
||
| 452 | 452 | ); |
| 453 | 453 | $questionScore = $question_result['score']; |
| 454 | 454 | $totalScore += $question_result['score']; |
| 455 | - } elseif ($answerType == HOT_SPOT) { |
|
| 456 | - if ($show_results) { |
|
| 457 | - echo '<table width="500" border="0"><tr> |
|
| 455 | + } elseif ($answerType == HOT_SPOT) { |
|
| 456 | + if ($show_results) { |
|
| 457 | + echo '<table width="500" border="0"><tr> |
|
| 458 | 458 | <td valign="top" align="center" style="padding-left:0px;" > |
| 459 | 459 | <table border="1" bordercolor="#A4A4A4" style="border-collapse: collapse;" width="552">'; |
| 460 | - } |
|
| 460 | + } |
|
| 461 | 461 | $question_result = $objExercise->manage_answer( |
| 462 | 462 | $id, |
| 463 | 463 | $questionId, |
@@ -496,7 +496,7 @@ discard block |
||
| 496 | 496 | <br> |
| 497 | 497 | "; |
| 498 | 498 | } |
| 499 | - } else if($answerType == HOT_SPOT_DELINEATION) { |
|
| 499 | + } else if($answerType == HOT_SPOT_DELINEATION) { |
|
| 500 | 500 | |
| 501 | 501 | $question_result = $objExercise->manage_answer( |
| 502 | 502 | $id, |
@@ -651,15 +651,15 @@ discard block |
||
| 651 | 651 | </table> |
| 652 | 652 | "; |
| 653 | 653 | } |
| 654 | - } |
|
| 654 | + } |
|
| 655 | 655 | |
| 656 | - if ($show_results) { |
|
| 657 | - if ($answerType != HOT_SPOT) { |
|
| 658 | - echo '</table>'; |
|
| 659 | - } |
|
| 660 | - } |
|
| 656 | + if ($show_results) { |
|
| 657 | + if ($answerType != HOT_SPOT) { |
|
| 658 | + echo '</table>'; |
|
| 659 | + } |
|
| 660 | + } |
|
| 661 | 661 | |
| 662 | - $comnt = null; |
|
| 662 | + $comnt = null; |
|
| 663 | 663 | |
| 664 | 664 | if ($show_results) { |
| 665 | 665 | if ( |
@@ -676,18 +676,18 @@ discard block |
||
| 676 | 676 | |
| 677 | 677 | $marksname = ''; |
| 678 | 678 | |
| 679 | - if ($isFeedbackAllowed) { |
|
| 680 | - $name = "fckdiv".$questionId; |
|
| 681 | - $marksname = "marksName".$questionId; |
|
| 682 | - if (in_array($answerType, array(FREE_ANSWER, ORAL_EXPRESSION))) { |
|
| 683 | - $url_name = get_lang('EditCommentsAndMarks'); |
|
| 684 | - } else { |
|
| 685 | - if ($action=='edit') { |
|
| 686 | - $url_name = get_lang('EditIndividualComment'); |
|
| 687 | - } else { |
|
| 688 | - $url_name = get_lang('AddComments'); |
|
| 689 | - } |
|
| 690 | - } |
|
| 679 | + if ($isFeedbackAllowed) { |
|
| 680 | + $name = "fckdiv".$questionId; |
|
| 681 | + $marksname = "marksName".$questionId; |
|
| 682 | + if (in_array($answerType, array(FREE_ANSWER, ORAL_EXPRESSION))) { |
|
| 683 | + $url_name = get_lang('EditCommentsAndMarks'); |
|
| 684 | + } else { |
|
| 685 | + if ($action=='edit') { |
|
| 686 | + $url_name = get_lang('EditIndividualComment'); |
|
| 687 | + } else { |
|
| 688 | + $url_name = get_lang('AddComments'); |
|
| 689 | + } |
|
| 690 | + } |
|
| 691 | 691 | echo '<br />'; |
| 692 | 692 | echo Display::url( |
| 693 | 693 | $url_name, |
@@ -696,26 +696,26 @@ discard block |
||
| 696 | 696 | 'class' => 'btn btn-default', |
| 697 | 697 | 'onclick' => "showfck('".$name."', '".$marksname."');") |
| 698 | 698 | ); |
| 699 | - echo '<br />'; |
|
| 699 | + echo '<br />'; |
|
| 700 | 700 | |
| 701 | 701 | echo '<div id="feedback_'.$name.'" style="width:100%">'; |
| 702 | - $comnt = trim(Event::get_comments($id, $questionId)); |
|
| 703 | - if (empty($comnt)) { |
|
| 704 | - echo '<br />'; |
|
| 705 | - } else { |
|
| 706 | - echo '<div id="question_feedback">'.$comnt.'</div>'; |
|
| 707 | - } |
|
| 708 | - echo '</div>'; |
|
| 702 | + $comnt = trim(Event::get_comments($id, $questionId)); |
|
| 703 | + if (empty($comnt)) { |
|
| 704 | + echo '<br />'; |
|
| 705 | + } else { |
|
| 706 | + echo '<div id="question_feedback">'.$comnt.'</div>'; |
|
| 707 | + } |
|
| 708 | + echo '</div>'; |
|
| 709 | 709 | |
| 710 | 710 | echo '<div id="'.$name.'" style="display:none">'; |
| 711 | - $arrid[] = $questionId; |
|
| 712 | - $feedback_form = new FormValidator('frmcomments'.$questionId,'post',''); |
|
| 713 | - $feedback_form->addElement('html','<br>'); |
|
| 714 | - $renderer =& $feedback_form->defaultRenderer(); |
|
| 715 | - $renderer->setFormTemplate('<form{attributes}><div align="left">{content}</div></form>'); |
|
| 716 | - $renderer->setCustomElementTemplate('<div align="left">{element}</div>'); |
|
| 717 | - $comnt = Event::get_comments($id, $questionId); |
|
| 718 | - $default = array('comments_'.$questionId => $comnt); |
|
| 711 | + $arrid[] = $questionId; |
|
| 712 | + $feedback_form = new FormValidator('frmcomments'.$questionId,'post',''); |
|
| 713 | + $feedback_form->addElement('html','<br>'); |
|
| 714 | + $renderer =& $feedback_form->defaultRenderer(); |
|
| 715 | + $renderer->setFormTemplate('<form{attributes}><div align="left">{content}</div></form>'); |
|
| 716 | + $renderer->setCustomElementTemplate('<div align="left">{element}</div>'); |
|
| 717 | + $comnt = Event::get_comments($id, $questionId); |
|
| 718 | + $default = array('comments_'.$questionId => $comnt); |
|
| 719 | 719 | |
| 720 | 720 | if ($useAdvancedEditor) { |
| 721 | 721 | $feedback_form->addElement( |
@@ -732,52 +732,52 @@ discard block |
||
| 732 | 732 | } else { |
| 733 | 733 | $feedback_form->addElement('textarea', 'comments_' . $questionId); |
| 734 | 734 | } |
| 735 | - $feedback_form->addElement('html','<br>'); |
|
| 736 | - $feedback_form->setDefaults($default); |
|
| 737 | - $feedback_form->display(); |
|
| 738 | - echo '</div>'; |
|
| 739 | - |
|
| 740 | - } else { |
|
| 741 | - $comnt = Event::get_comments($id, $questionId); |
|
| 742 | - echo '<br />'; |
|
| 743 | - if (!empty($comnt)) { |
|
| 744 | - echo '<b>'.get_lang('Feedback').'</b>'; |
|
| 745 | - echo '<div id="question_feedback">'.$comnt.'</div>'; |
|
| 746 | - } |
|
| 747 | - } |
|
| 748 | - |
|
| 749 | - if ($is_allowedToEdit && $isFeedbackAllowed) { |
|
| 750 | - if (in_array($answerType, array(FREE_ANSWER, ORAL_EXPRESSION))) { |
|
| 751 | - $marksname = "marksName".$questionId; |
|
| 735 | + $feedback_form->addElement('html','<br>'); |
|
| 736 | + $feedback_form->setDefaults($default); |
|
| 737 | + $feedback_form->display(); |
|
| 738 | + echo '</div>'; |
|
| 739 | + |
|
| 740 | + } else { |
|
| 741 | + $comnt = Event::get_comments($id, $questionId); |
|
| 742 | + echo '<br />'; |
|
| 743 | + if (!empty($comnt)) { |
|
| 744 | + echo '<b>'.get_lang('Feedback').'</b>'; |
|
| 745 | + echo '<div id="question_feedback">'.$comnt.'</div>'; |
|
| 746 | + } |
|
| 747 | + } |
|
| 748 | + |
|
| 749 | + if ($is_allowedToEdit && $isFeedbackAllowed) { |
|
| 750 | + if (in_array($answerType, array(FREE_ANSWER, ORAL_EXPRESSION))) { |
|
| 751 | + $marksname = "marksName".$questionId; |
|
| 752 | 752 | echo '<div id="'.$marksname.'" style="display:none">'; |
| 753 | 753 | echo '<form name="marksform_'.$questionId.'" method="post" action="">'; |
| 754 | - $arrmarks[] = $questionId; |
|
| 755 | - echo get_lang("AssignMarks"); |
|
| 756 | - echo " <select name='marks' id='marks'>"; |
|
| 757 | - for ($i=0;$i<=$questionWeighting;$i++) { |
|
| 758 | - echo '<option '.(($i==$questionScore)?"selected='selected'":'').'>'.$i.'</option>'; |
|
| 759 | - } |
|
| 760 | - echo '</select>'; |
|
| 761 | - echo '</form><br /></div>'; |
|
| 762 | - |
|
| 763 | - if ($questionScore == -1 ) { |
|
| 764 | - $questionScore = 0; |
|
| 765 | - echo Display::return_message(get_lang('notCorrectedYet')); |
|
| 766 | - } |
|
| 767 | - } else { |
|
| 768 | - $arrmarks[] = $questionId; |
|
| 769 | - echo '<div id="'.$marksname.'" style="display:none"><form name="marksform_'.$questionId.'" method="post" action=""> |
|
| 754 | + $arrmarks[] = $questionId; |
|
| 755 | + echo get_lang("AssignMarks"); |
|
| 756 | + echo " <select name='marks' id='marks'>"; |
|
| 757 | + for ($i=0;$i<=$questionWeighting;$i++) { |
|
| 758 | + echo '<option '.(($i==$questionScore)?"selected='selected'":'').'>'.$i.'</option>'; |
|
| 759 | + } |
|
| 760 | + echo '</select>'; |
|
| 761 | + echo '</form><br /></div>'; |
|
| 762 | + |
|
| 763 | + if ($questionScore == -1 ) { |
|
| 764 | + $questionScore = 0; |
|
| 765 | + echo Display::return_message(get_lang('notCorrectedYet')); |
|
| 766 | + } |
|
| 767 | + } else { |
|
| 768 | + $arrmarks[] = $questionId; |
|
| 769 | + echo '<div id="'.$marksname.'" style="display:none"><form name="marksform_'.$questionId.'" method="post" action=""> |
|
| 770 | 770 | <select name="marks" id="marks" style="display:none;"><option>'.$questionScore.'</option></select></form><br/ ></div>'; |
| 771 | - } |
|
| 772 | - } else { |
|
| 773 | - if ($questionScore == -1) { |
|
| 774 | - $questionScore = 0; |
|
| 775 | - } |
|
| 776 | - } |
|
| 777 | - } |
|
| 771 | + } |
|
| 772 | + } else { |
|
| 773 | + if ($questionScore == -1) { |
|
| 774 | + $questionScore = 0; |
|
| 775 | + } |
|
| 776 | + } |
|
| 777 | + } |
|
| 778 | 778 | |
| 779 | 779 | $my_total_score = $questionScore; |
| 780 | - $my_total_weight = $questionWeighting; |
|
| 780 | + $my_total_weight = $questionWeighting; |
|
| 781 | 781 | $totalWeighting += $questionWeighting; |
| 782 | 782 | $category_was_added_for_this_test = false; |
| 783 | 783 | |
@@ -823,7 +823,7 @@ discard block |
||
| 823 | 823 | |
| 824 | 824 | $score = array(); |
| 825 | 825 | if ($show_results) { |
| 826 | - $score['result'] = get_lang('Score')." : ".ExerciseLib::show_score($my_total_score, $my_total_weight, false, false); |
|
| 826 | + $score['result'] = get_lang('Score')." : ".ExerciseLib::show_score($my_total_score, $my_total_weight, false, false); |
|
| 827 | 827 | $score['pass'] = $my_total_score >= $my_total_weight ? true : false; |
| 828 | 828 | $score['type'] = $answerType; |
| 829 | 829 | $score['score'] = $my_total_score; |
@@ -831,16 +831,16 @@ discard block |
||
| 831 | 831 | $score['comments'] = isset($comnt) ? $comnt : null; |
| 832 | 832 | } |
| 833 | 833 | |
| 834 | - unset($objAnswerTmp); |
|
| 835 | - $i++; |
|
| 834 | + unset($objAnswerTmp); |
|
| 835 | + $i++; |
|
| 836 | 836 | |
| 837 | 837 | $contents = ob_get_clean(); |
| 838 | 838 | $question_content = '<div class="question_row">'; |
| 839 | - if ($show_results) { |
|
| 839 | + if ($show_results) { |
|
| 840 | 840 | // Shows question title an description |
| 841 | - $question_content .= $objQuestionTmp->return_header(null, $counter, $score); |
|
| 842 | - } |
|
| 843 | - $counter++; |
|
| 841 | + $question_content .= $objQuestionTmp->return_header(null, $counter, $score); |
|
| 842 | + } |
|
| 843 | + $counter++; |
|
| 844 | 844 | $question_content .= $contents; |
| 845 | 845 | $question_content .= '</div>'; |
| 846 | 846 | $exercise_content .= $question_content; |
@@ -850,12 +850,12 @@ discard block |
||
| 850 | 850 | |
| 851 | 851 | //Total score |
| 852 | 852 | if ($origin!='learnpath' || ($origin == 'learnpath' && isset($_GET['fb_type']))) { |
| 853 | - if ($show_results || $show_only_total_score) { |
|
| 853 | + if ($show_results || $show_only_total_score) { |
|
| 854 | 854 | $total_score_text .= '<div class="question_row">'; |
| 855 | 855 | $my_total_score_temp = $totalScore; |
| 856 | - if ($objExercise->selectPropagateNeg() == 0 && $my_total_score_temp < 0) { |
|
| 857 | - $my_total_score_temp = 0; |
|
| 858 | - } |
|
| 856 | + if ($objExercise->selectPropagateNeg() == 0 && $my_total_score_temp < 0) { |
|
| 857 | + $my_total_score_temp = 0; |
|
| 858 | + } |
|
| 859 | 859 | $total_score_text .= ExerciseLib::get_question_ribbon( |
| 860 | 860 | $objExercise, |
| 861 | 861 | $my_total_score_temp, |
@@ -863,7 +863,7 @@ discard block |
||
| 863 | 863 | true |
| 864 | 864 | ); |
| 865 | 865 | $total_score_text .= '</div>'; |
| 866 | - } |
|
| 866 | + } |
|
| 867 | 867 | } |
| 868 | 868 | |
| 869 | 869 | if (!empty($category_list) && ($show_results || $show_only_total_score)) { |
@@ -887,26 +887,26 @@ discard block |
||
| 887 | 887 | } |
| 888 | 888 | |
| 889 | 889 | if ($isFeedbackAllowed) { |
| 890 | - if (in_array($origin, array('tracking_course','user_course','correct_exercise_in_lp'))) { |
|
| 891 | - echo '<form name="myform" id="myform" action="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'&filter=2&comments=update&exeid='.$id.'&origin='.$origin.'&details=true&course='.Security::remove_XSS($_GET['cidReq']).$fromlink.'" method="post">'; |
|
| 892 | - echo '<input type = "hidden" name="lp_item_id" value="'.$learnpath_id.'">'; |
|
| 893 | - echo '<input type = "hidden" name="lp_item_view_id" value="'.$lp_item_view_id.'">'; |
|
| 894 | - echo '<input type = "hidden" name="student_id" value="'.$student_id.'">'; |
|
| 895 | - echo '<input type = "hidden" name="total_score" value="'.$totalScore.'"> '; |
|
| 896 | - echo '<input type = "hidden" name="my_exe_exo_id" value="'.$exercise_id.'"> '; |
|
| 897 | - } else { |
|
| 898 | - echo ' <form name="myform" id="myform" action="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'&filter=1&comments=update&exeid='.$id.'" method="post">'; |
|
| 899 | - } |
|
| 900 | - if ($origin !='learnpath' && $origin!='student_progress') { |
|
| 890 | + if (in_array($origin, array('tracking_course','user_course','correct_exercise_in_lp'))) { |
|
| 891 | + echo '<form name="myform" id="myform" action="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'&filter=2&comments=update&exeid='.$id.'&origin='.$origin.'&details=true&course='.Security::remove_XSS($_GET['cidReq']).$fromlink.'" method="post">'; |
|
| 892 | + echo '<input type = "hidden" name="lp_item_id" value="'.$learnpath_id.'">'; |
|
| 893 | + echo '<input type = "hidden" name="lp_item_view_id" value="'.$lp_item_view_id.'">'; |
|
| 894 | + echo '<input type = "hidden" name="student_id" value="'.$student_id.'">'; |
|
| 895 | + echo '<input type = "hidden" name="total_score" value="'.$totalScore.'"> '; |
|
| 896 | + echo '<input type = "hidden" name="my_exe_exo_id" value="'.$exercise_id.'"> '; |
|
| 897 | + } else { |
|
| 898 | + echo ' <form name="myform" id="myform" action="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'&filter=1&comments=update&exeid='.$id.'" method="post">'; |
|
| 899 | + } |
|
| 900 | + if ($origin !='learnpath' && $origin!='student_progress') { |
|
| 901 | 901 | echo '<label><input type= "checkbox" name="send_notification"> '.get_lang('SendEmail').'</label>'; |
| 902 | - ?> |
|
| 902 | + ?> |
|
| 903 | 903 | <br /> |
| 904 | 904 | <button type="submit" class="btn btn-primary" value="<?php echo get_lang('Ok'); ?>" onclick="getFCK('<?php echo $strids; ?>','<?php echo $marksid; ?>');"> |
| 905 | 905 | <?php echo get_lang('CorrectTest'); ?> |
| 906 | 906 | </button> |
| 907 | 907 | </form> |
| 908 | 908 | <?php |
| 909 | - } |
|
| 909 | + } |
|
| 910 | 910 | } |
| 911 | 911 | |
| 912 | 912 | //Came from lpstats in a lp |
@@ -923,21 +923,21 @@ discard block |
||
| 923 | 923 | } |
| 924 | 924 | |
| 925 | 925 | if ($origin != 'learnpath') { |
| 926 | - //we are not in learnpath tool |
|
| 927 | - Display::display_footer(); |
|
| 926 | + //we are not in learnpath tool |
|
| 927 | + Display::display_footer(); |
|
| 928 | 928 | } else { |
| 929 | - if (!isset($_GET['fb_type'])) { |
|
| 930 | - $lp_mode = $_SESSION['lp_mode']; |
|
| 931 | - $url = '../newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exeId.'&fb_type='.$feedback_type; |
|
| 932 | - $href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'" '; |
|
| 933 | - echo '<script type="text/javascript">'.$href.'</script>'; |
|
| 934 | - // Record the results in the learning path, using the SCORM interface (API) |
|
| 935 | - echo "<script>window.parent.API.void_save_asset('$totalScore', '$totalWeighting', 0, 'completed'); </script>"; |
|
| 936 | - echo '</body></html>'; |
|
| 937 | - } else { |
|
| 938 | - Display::display_normal_message(get_lang('ExerciseFinished').' '.get_lang('ToContinueUseMenu')); |
|
| 929 | + if (!isset($_GET['fb_type'])) { |
|
| 930 | + $lp_mode = $_SESSION['lp_mode']; |
|
| 931 | + $url = '../newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exeId.'&fb_type='.$feedback_type; |
|
| 932 | + $href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'" '; |
|
| 933 | + echo '<script type="text/javascript">'.$href.'</script>'; |
|
| 934 | + // Record the results in the learning path, using the SCORM interface (API) |
|
| 935 | + echo "<script>window.parent.API.void_save_asset('$totalScore', '$totalWeighting', 0, 'completed'); </script>"; |
|
| 936 | + echo '</body></html>'; |
|
| 937 | + } else { |
|
| 938 | + Display::display_normal_message(get_lang('ExerciseFinished').' '.get_lang('ToContinueUseMenu')); |
|
| 939 | 939 | echo '<br />'; |
| 940 | - } |
|
| 940 | + } |
|
| 941 | 941 | } |
| 942 | 942 | |
| 943 | 943 | // Destroying the session |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | require_once '../inc/global.inc.php'; |
| 18 | 18 | $debug = false; |
| 19 | -if (empty($origin) ) { |
|
| 19 | +if (empty($origin)) { |
|
| 20 | 20 | $origin = isset($_REQUEST['origin']) ? $_REQUEST['origin'] : null; |
| 21 | 21 | } |
| 22 | 22 | |
@@ -33,18 +33,18 @@ discard block |
||
| 33 | 33 | $TBL_TRACK_ATTEMPT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); |
| 34 | 34 | |
| 35 | 35 | // General parameters passed via POST/GET |
| 36 | -if ($debug) { error_log('Entered exercise_result.php: '.print_r($_POST,1)); } |
|
| 36 | +if ($debug) { error_log('Entered exercise_result.php: '.print_r($_POST, 1)); } |
|
| 37 | 37 | |
| 38 | 38 | if (empty($formSent)) { $formSent = isset($_REQUEST['formSent']) ? $_REQUEST['formSent'] : null; } |
| 39 | 39 | if (empty($exerciseResult)) { $exerciseResult = isset($_SESSION['exerciseResult']) ? $_SESSION['exerciseResult'] : null; } |
| 40 | -if (empty($questionId)) { $questionId = isset($_REQUEST['questionId']) ? $_REQUEST['questionId'] : null;} |
|
| 41 | -if (empty($choice)) { $choice = isset($_REQUEST['choice']) ? $_REQUEST['choice'] : null;} |
|
| 42 | -if (empty($questionNum)) { $questionNum = isset($_REQUEST['num']) ? $_REQUEST['num'] : null;} |
|
| 43 | -if (empty($nbrQuestions)) { $nbrQuestions = isset($_REQUEST['nbrQuestions']) ? $_REQUEST['nbrQuestions'] : null;} |
|
| 44 | -if (empty($questionList)) { $questionList = isset($_SESSION['questionList']) ? $_SESSION['questionList'] : null;} |
|
| 45 | -if (empty($objExercise)) { $objExercise = isset($_SESSION['objExercise']) ? $_SESSION['objExercise'] : null;} |
|
| 46 | -if (empty($exeId)) { $exeId = isset($_REQUEST['id']) ? $_REQUEST['id'] : null;} |
|
| 47 | -if (empty($action)) { $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;} |
|
| 40 | +if (empty($questionId)) { $questionId = isset($_REQUEST['questionId']) ? $_REQUEST['questionId'] : null; } |
|
| 41 | +if (empty($choice)) { $choice = isset($_REQUEST['choice']) ? $_REQUEST['choice'] : null; } |
|
| 42 | +if (empty($questionNum)) { $questionNum = isset($_REQUEST['num']) ? $_REQUEST['num'] : null; } |
|
| 43 | +if (empty($nbrQuestions)) { $nbrQuestions = isset($_REQUEST['nbrQuestions']) ? $_REQUEST['nbrQuestions'] : null; } |
|
| 44 | +if (empty($questionList)) { $questionList = isset($_SESSION['questionList']) ? $_SESSION['questionList'] : null; } |
|
| 45 | +if (empty($objExercise)) { $objExercise = isset($_SESSION['objExercise']) ? $_SESSION['objExercise'] : null; } |
|
| 46 | +if (empty($exeId)) { $exeId = isset($_REQUEST['id']) ? $_REQUEST['id'] : null; } |
|
| 47 | +if (empty($action)) { $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null; } |
|
| 48 | 48 | |
| 49 | 49 | $id = intval($_REQUEST['id']); //exe id |
| 50 | 50 | |
@@ -105,23 +105,23 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | if (isset($_SESSION['gradebook'])) { |
| 108 | - $gradebook= Security::remove_XSS($_SESSION['gradebook']); |
|
| 108 | + $gradebook = Security::remove_XSS($_SESSION['gradebook']); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | -if (!empty($gradebook) && $gradebook=='view') { |
|
| 112 | - $interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'],'name' => get_lang('ToolGradebook')); |
|
| 111 | +if (!empty($gradebook) && $gradebook == 'view') { |
|
| 112 | + $interbreadcrumb[] = array('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('ToolGradebook')); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | $fromlink = ''; |
| 116 | 116 | |
| 117 | -$interbreadcrumb[]= array("url" => "exercise.php?".api_get_cidreq(),"name" => get_lang('Exercises')); |
|
| 118 | -$interbreadcrumb[]= array("url" => "overview.php?exerciseId=".$exercise_id.'&'.api_get_cidreq(),"name" => $objExercise->name); |
|
| 119 | -$interbreadcrumb[]= array("url" => "#", "name" => get_lang('Result')); |
|
| 117 | +$interbreadcrumb[] = array("url" => "exercise.php?".api_get_cidreq(), "name" => get_lang('Exercises')); |
|
| 118 | +$interbreadcrumb[] = array("url" => "overview.php?exerciseId=".$exercise_id.'&'.api_get_cidreq(), "name" => $objExercise->name); |
|
| 119 | +$interbreadcrumb[] = array("url" => "#", "name" => get_lang('Result')); |
|
| 120 | 120 | |
| 121 | 121 | $this_section = SECTION_COURSES; |
| 122 | 122 | |
| 123 | -$htmlHeadXtra[] = '<link rel="stylesheet" href="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/css/hotspot.css">'; |
|
| 124 | -$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/js/hotspot.js"></script>'; |
|
| 123 | +$htmlHeadXtra[] = '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/css/hotspot.css">'; |
|
| 124 | +$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/js/hotspot.js"></script>'; |
|
| 125 | 125 | |
| 126 | 126 | if ($origin != 'learnpath') { |
| 127 | 127 | Display::display_header(''); |
@@ -178,9 +178,9 @@ discard block |
||
| 178 | 178 | // Avoiding the "Score 0/0" message when the exe_id is not set |
| 179 | 179 | if (!empty($track_exercise_info)) { |
| 180 | 180 | // if the results_disabled of the Quiz is 1 when block the script |
| 181 | - $result_disabled = $track_exercise_info['results_disabled']; |
|
| 181 | + $result_disabled = $track_exercise_info['results_disabled']; |
|
| 182 | 182 | |
| 183 | - if (!(api_is_platform_admin() || api_is_course_admin() || api_is_course_coach()) ) { |
|
| 183 | + if (!(api_is_platform_admin() || api_is_course_admin() || api_is_course_coach())) { |
|
| 184 | 184 | if ($result_disabled == 1) { |
| 185 | 185 | $show_results = false; |
| 186 | 186 | if ($origin != 'learnpath') { |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | $show_results = false; |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | -if ($origin == 'learnpath' && !isset($_GET['fb_type']) ) { |
|
| 217 | +if ($origin == 'learnpath' && !isset($_GET['fb_type'])) { |
|
| 218 | 218 | $show_results = false; |
| 219 | 219 | } |
| 220 | 220 | |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | $arrques = array(); |
| 240 | 240 | $arrans = array(); |
| 241 | 241 | |
| 242 | -$user_restriction = $is_allowedToEdit ? '' : "AND user_id=".intval($student_id)." "; |
|
| 242 | +$user_restriction = $is_allowedToEdit ? '' : "AND user_id=".intval($student_id)." "; |
|
| 243 | 243 | $sql = "SELECT attempts.question_id, answer |
| 244 | 244 | FROM $TBL_TRACK_ATTEMPT as attempts |
| 245 | 245 | INNER JOIN ".$TBL_TRACK_EXERCISES." AS stats_exercises |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | $total_weighting = 0; |
| 295 | 295 | foreach ($questionList as $questionId) { |
| 296 | 296 | $objQuestionTmp = Question::read($questionId); |
| 297 | - $total_weighting +=$objQuestionTmp->selectWeighting(); |
|
| 297 | + $total_weighting += $objQuestionTmp->selectWeighting(); |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | $counter = 1; |
@@ -496,7 +496,7 @@ discard block |
||
| 496 | 496 | <br> |
| 497 | 497 | "; |
| 498 | 498 | } |
| 499 | - } else if($answerType == HOT_SPOT_DELINEATION) { |
|
| 499 | + } else if ($answerType == HOT_SPOT_DELINEATION) { |
|
| 500 | 500 | |
| 501 | 501 | $question_result = $objExercise->manage_answer( |
| 502 | 502 | $id, |
@@ -529,20 +529,20 @@ discard block |
||
| 529 | 529 | if ($show_results) { |
| 530 | 530 | |
| 531 | 531 | if ($overlap_color) { |
| 532 | - $overlap_color='green'; |
|
| 532 | + $overlap_color = 'green'; |
|
| 533 | 533 | } else { |
| 534 | - $overlap_color='red'; |
|
| 534 | + $overlap_color = 'red'; |
|
| 535 | 535 | } |
| 536 | 536 | |
| 537 | 537 | if ($missing_color) { |
| 538 | - $missing_color='green'; |
|
| 538 | + $missing_color = 'green'; |
|
| 539 | 539 | } else { |
| 540 | - $missing_color='red'; |
|
| 540 | + $missing_color = 'red'; |
|
| 541 | 541 | } |
| 542 | 542 | if ($excess_color) { |
| 543 | - $excess_color='green'; |
|
| 543 | + $excess_color = 'green'; |
|
| 544 | 544 | } else { |
| 545 | - $excess_color='red'; |
|
| 545 | + $excess_color = 'red'; |
|
| 546 | 546 | } |
| 547 | 547 | |
| 548 | 548 | if (!is_numeric($final_overlap)) { |
@@ -556,11 +556,11 @@ discard block |
||
| 556 | 556 | $final_excess = 0; |
| 557 | 557 | } |
| 558 | 558 | |
| 559 | - if ($final_excess>100) { |
|
| 559 | + if ($final_excess > 100) { |
|
| 560 | 560 | $final_excess = 100; |
| 561 | 561 | } |
| 562 | 562 | |
| 563 | - $table_resume='<table class="data_table"> |
|
| 563 | + $table_resume = '<table class="data_table"> |
|
| 564 | 564 | <tr class="row_odd" > |
| 565 | 565 | <td></td> |
| 566 | 566 | <td ><b>'.get_lang('Requirements').'</b></td> |
@@ -570,38 +570,38 @@ discard block |
||
| 570 | 570 | <tr class="row_even"> |
| 571 | 571 | <td><b>'.get_lang('Overlap').'</b></td> |
| 572 | 572 | <td>'.get_lang('Min').' '.$threadhold1.'</td> |
| 573 | - <td><div style="color:'.$overlap_color.'">'.(($final_overlap < 0)?0:intval($final_overlap)).'</div></td> |
|
| 573 | + <td><div style="color:'.$overlap_color.'">'.(($final_overlap < 0) ? 0 : intval($final_overlap)).'</div></td> |
|
| 574 | 574 | </tr> |
| 575 | 575 | |
| 576 | 576 | <tr> |
| 577 | 577 | <td><b>'.get_lang('Excess').'</b></td> |
| 578 | 578 | <td>'.get_lang('Max').' '.$threadhold2.'</td> |
| 579 | - <td><div style="color:'.$excess_color.'">'.(($final_excess < 0)?0:intval($final_excess)).'</div></td> |
|
| 579 | + <td><div style="color:'.$excess_color.'">'.(($final_excess < 0) ? 0 : intval($final_excess)).'</div></td> |
|
| 580 | 580 | </tr> |
| 581 | 581 | |
| 582 | 582 | <tr class="row_even"> |
| 583 | 583 | <td><b>'.get_lang('Missing').'</b></td> |
| 584 | 584 | <td>'.get_lang('Max').' '.$threadhold3.'</td> |
| 585 | - <td><div style="color:'.$missing_color.'">'.(($final_missing < 0)?0:intval($final_missing)).'</div></td> |
|
| 585 | + <td><div style="color:'.$missing_color.'">'.(($final_missing < 0) ? 0 : intval($final_missing)).'</div></td> |
|
| 586 | 586 | </tr></table>'; |
| 587 | 587 | |
| 588 | - if ($answerType!= HOT_SPOT_DELINEATION) { |
|
| 589 | - $item_list = explode('@@',$destination); |
|
| 588 | + if ($answerType != HOT_SPOT_DELINEATION) { |
|
| 589 | + $item_list = explode('@@', $destination); |
|
| 590 | 590 | |
| 591 | 591 | $try = $item_list[0]; |
| 592 | 592 | $lp = $item_list[1]; |
| 593 | 593 | $destinationid = $item_list[2]; |
| 594 | 594 | $url = $item_list[3]; |
| 595 | - $table_resume=''; |
|
| 595 | + $table_resume = ''; |
|
| 596 | 596 | } else { |
| 597 | - if ($next==0) { |
|
| 597 | + if ($next == 0) { |
|
| 598 | 598 | $try = $try_hotspot; |
| 599 | 599 | $lp = $lp_hotspot; |
| 600 | - $destinationid= $select_question_hotspot; |
|
| 601 | - $url=$url_hotspot; |
|
| 600 | + $destinationid = $select_question_hotspot; |
|
| 601 | + $url = $url_hotspot; |
|
| 602 | 602 | } else { |
| 603 | 603 | //show if no error |
| 604 | - $comment=$answerComment = $objAnswerTmp->selectComment($nbrAnswers); |
|
| 604 | + $comment = $answerComment = $objAnswerTmp->selectComment($nbrAnswers); |
|
| 605 | 605 | $answerDestination = $objAnswerTmp->selectDestination($nbrAnswers); |
| 606 | 606 | } |
| 607 | 607 | } |
@@ -609,14 +609,14 @@ discard block |
||
| 609 | 609 | echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>'; |
| 610 | 610 | if ($answerType == HOT_SPOT_DELINEATION) { |
| 611 | 611 | if ($organs_at_risk_hit > 0) { |
| 612 | - $message='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />'; |
|
| 613 | - $message.='<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>'; |
|
| 612 | + $message = '<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />'; |
|
| 613 | + $message .= '<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>'; |
|
| 614 | 614 | } else { |
| 615 | - $message='<p>'.get_lang('YourDelineation').'</p>'; |
|
| 616 | - $message.=$table_resume; |
|
| 617 | - $message.='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />'; |
|
| 615 | + $message = '<p>'.get_lang('YourDelineation').'</p>'; |
|
| 616 | + $message .= $table_resume; |
|
| 617 | + $message .= '<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />'; |
|
| 618 | 618 | } |
| 619 | - $message.='<p>'.$comment.'</p>'; |
|
| 619 | + $message .= '<p>'.$comment.'</p>'; |
|
| 620 | 620 | echo $message; |
| 621 | 621 | } else { |
| 622 | 622 | echo '<p>'.$comment.'</p>'; |
@@ -626,8 +626,8 @@ discard block |
||
| 626 | 626 | $queryfree = "SELECT marks FROM ".$TBL_TRACK_ATTEMPT." |
| 627 | 627 | WHERE exe_id = ".intval($id)." and question_id= ".intval($questionId).""; |
| 628 | 628 | $resfree = Database::query($queryfree); |
| 629 | - $questionScore= Database::result($resfree,0,"marks"); |
|
| 630 | - $totalScore+=$questionScore; |
|
| 629 | + $questionScore = Database::result($resfree, 0, "marks"); |
|
| 630 | + $totalScore += $questionScore; |
|
| 631 | 631 | $relPath = api_get_path(REL_PATH); |
| 632 | 632 | echo '</table></td></tr>'; |
| 633 | 633 | |
@@ -682,7 +682,7 @@ discard block |
||
| 682 | 682 | if (in_array($answerType, array(FREE_ANSWER, ORAL_EXPRESSION))) { |
| 683 | 683 | $url_name = get_lang('EditCommentsAndMarks'); |
| 684 | 684 | } else { |
| 685 | - if ($action=='edit') { |
|
| 685 | + if ($action == 'edit') { |
|
| 686 | 686 | $url_name = get_lang('EditIndividualComment'); |
| 687 | 687 | } else { |
| 688 | 688 | $url_name = get_lang('AddComments'); |
@@ -709,9 +709,9 @@ discard block |
||
| 709 | 709 | |
| 710 | 710 | echo '<div id="'.$name.'" style="display:none">'; |
| 711 | 711 | $arrid[] = $questionId; |
| 712 | - $feedback_form = new FormValidator('frmcomments'.$questionId,'post',''); |
|
| 713 | - $feedback_form->addElement('html','<br>'); |
|
| 714 | - $renderer =& $feedback_form->defaultRenderer(); |
|
| 712 | + $feedback_form = new FormValidator('frmcomments'.$questionId, 'post', ''); |
|
| 713 | + $feedback_form->addElement('html', '<br>'); |
|
| 714 | + $renderer = & $feedback_form->defaultRenderer(); |
|
| 715 | 715 | $renderer->setFormTemplate('<form{attributes}><div align="left">{content}</div></form>'); |
| 716 | 716 | $renderer->setCustomElementTemplate('<div align="left">{element}</div>'); |
| 717 | 717 | $comnt = Event::get_comments($id, $questionId); |
@@ -720,7 +720,7 @@ discard block |
||
| 720 | 720 | if ($useAdvancedEditor) { |
| 721 | 721 | $feedback_form->addElement( |
| 722 | 722 | 'html_editor', |
| 723 | - 'comments_' . $questionId, |
|
| 723 | + 'comments_'.$questionId, |
|
| 724 | 724 | null, |
| 725 | 725 | null, |
| 726 | 726 | array( |
@@ -730,9 +730,9 @@ discard block |
||
| 730 | 730 | ) |
| 731 | 731 | ); |
| 732 | 732 | } else { |
| 733 | - $feedback_form->addElement('textarea', 'comments_' . $questionId); |
|
| 733 | + $feedback_form->addElement('textarea', 'comments_'.$questionId); |
|
| 734 | 734 | } |
| 735 | - $feedback_form->addElement('html','<br>'); |
|
| 735 | + $feedback_form->addElement('html', '<br>'); |
|
| 736 | 736 | $feedback_form->setDefaults($default); |
| 737 | 737 | $feedback_form->display(); |
| 738 | 738 | echo '</div>'; |
@@ -754,13 +754,13 @@ discard block |
||
| 754 | 754 | $arrmarks[] = $questionId; |
| 755 | 755 | echo get_lang("AssignMarks"); |
| 756 | 756 | echo " <select name='marks' id='marks'>"; |
| 757 | - for ($i=0;$i<=$questionWeighting;$i++) { |
|
| 758 | - echo '<option '.(($i==$questionScore)?"selected='selected'":'').'>'.$i.'</option>'; |
|
| 757 | + for ($i = 0; $i <= $questionWeighting; $i++) { |
|
| 758 | + echo '<option '.(($i == $questionScore) ? "selected='selected'" : '').'>'.$i.'</option>'; |
|
| 759 | 759 | } |
| 760 | 760 | echo '</select>'; |
| 761 | 761 | echo '</form><br /></div>'; |
| 762 | 762 | |
| 763 | - if ($questionScore == -1 ) { |
|
| 763 | + if ($questionScore == -1) { |
|
| 764 | 764 | $questionScore = 0; |
| 765 | 765 | echo Display::return_message(get_lang('notCorrectedYet')); |
| 766 | 766 | } |
@@ -796,7 +796,7 @@ discard block |
||
| 796 | 796 | } |
| 797 | 797 | |
| 798 | 798 | if (isset($objQuestionTmp->category_list) && !empty($objQuestionTmp->category_list)) { |
| 799 | - foreach($objQuestionTmp->category_list as $category_id) { |
|
| 799 | + foreach ($objQuestionTmp->category_list as $category_id) { |
|
| 800 | 800 | $category_list[$category_id]['score'] += $my_total_score; |
| 801 | 801 | $category_list[$category_id]['total'] += $my_total_weight; |
| 802 | 802 | $category_was_added_for_this_test = true; |
@@ -849,7 +849,7 @@ discard block |
||
| 849 | 849 | $total_score_text = null; |
| 850 | 850 | |
| 851 | 851 | //Total score |
| 852 | -if ($origin!='learnpath' || ($origin == 'learnpath' && isset($_GET['fb_type']))) { |
|
| 852 | +if ($origin != 'learnpath' || ($origin == 'learnpath' && isset($_GET['fb_type']))) { |
|
| 853 | 853 | if ($show_results || $show_only_total_score) { |
| 854 | 854 | $total_score_text .= '<div class="question_row">'; |
| 855 | 855 | $my_total_score_temp = $totalScore; |
@@ -881,13 +881,13 @@ discard block |
||
| 881 | 881 | |
| 882 | 882 | if ($isFeedbackAllowed) { |
| 883 | 883 | if (is_array($arrid) && is_array($arrmarks)) { |
| 884 | - $strids = implode(",",$arrid); |
|
| 885 | - $marksid = implode(",",$arrmarks); |
|
| 884 | + $strids = implode(",", $arrid); |
|
| 885 | + $marksid = implode(",", $arrmarks); |
|
| 886 | 886 | } |
| 887 | 887 | } |
| 888 | 888 | |
| 889 | 889 | if ($isFeedbackAllowed) { |
| 890 | - if (in_array($origin, array('tracking_course','user_course','correct_exercise_in_lp'))) { |
|
| 890 | + if (in_array($origin, array('tracking_course', 'user_course', 'correct_exercise_in_lp'))) { |
|
| 891 | 891 | echo '<form name="myform" id="myform" action="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'&filter=2&comments=update&exeid='.$id.'&origin='.$origin.'&details=true&course='.Security::remove_XSS($_GET['cidReq']).$fromlink.'" method="post">'; |
| 892 | 892 | echo '<input type = "hidden" name="lp_item_id" value="'.$learnpath_id.'">'; |
| 893 | 893 | echo '<input type = "hidden" name="lp_item_view_id" value="'.$lp_item_view_id.'">'; |
@@ -897,7 +897,7 @@ discard block |
||
| 897 | 897 | } else { |
| 898 | 898 | echo ' <form name="myform" id="myform" action="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'&filter=1&comments=update&exeid='.$id.'" method="post">'; |
| 899 | 899 | } |
| 900 | - if ($origin !='learnpath' && $origin!='student_progress') { |
|
| 900 | + if ($origin != 'learnpath' && $origin != 'student_progress') { |
|
| 901 | 901 | echo '<label><input type= "checkbox" name="send_notification"> '.get_lang('SendEmail').'</label>'; |
| 902 | 902 | ?> |
| 903 | 903 | <br /> |
@@ -910,14 +910,14 @@ discard block |
||
| 910 | 910 | } |
| 911 | 911 | |
| 912 | 912 | //Came from lpstats in a lp |
| 913 | -if ($origin =='student_progress') { ?> |
|
| 913 | +if ($origin == 'student_progress') { ?> |
|
| 914 | 914 | <button type="button" class="back" onclick="window.history.go(-1);" value="<?php echo get_lang('Back'); ?>" > |
| 915 | - <?php echo get_lang('Back');?></button> |
|
| 915 | + <?php echo get_lang('Back'); ?></button> |
|
| 916 | 916 | <?php |
| 917 | -} else if($origin=='myprogress') { |
|
| 917 | +} else if ($origin == 'myprogress') { |
|
| 918 | 918 | ?> |
| 919 | 919 | <button type="button" class="save" onclick="top.location.href='../auth/my_progress.php?course=<?php echo api_get_course_id()?>'" value="<?php echo get_lang('Finish'); ?>" > |
| 920 | - <?php echo get_lang('Finish');?> |
|
| 920 | + <?php echo get_lang('Finish'); ?> |
|
| 921 | 921 | </button> |
| 922 | 922 | <?php |
| 923 | 923 | } |
@@ -927,9 +927,9 @@ discard block |
||
| 927 | 927 | Display::display_footer(); |
| 928 | 928 | } else { |
| 929 | 929 | if (!isset($_GET['fb_type'])) { |
| 930 | - $lp_mode = $_SESSION['lp_mode']; |
|
| 930 | + $lp_mode = $_SESSION['lp_mode']; |
|
| 931 | 931 | $url = '../newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exeId.'&fb_type='.$feedback_type; |
| 932 | - $href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'" '; |
|
| 932 | + $href = ($lp_mode == 'fullscreen') ? ' window.opener.location.href="'.$url.'" ' : ' top.location.href="'.$url.'" '; |
|
| 933 | 933 | echo '<script type="text/javascript">'.$href.'</script>'; |
| 934 | 934 | // Record the results in the learning path, using the SCORM interface (API) |
| 935 | 935 | echo "<script>window.parent.API.void_save_asset('$totalScore', '$totalWeighting', 0, 'completed'); </script>"; |
@@ -59,9 +59,9 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | $gradebook = ''; |
| 61 | 61 | if (isset($_SESSION['gradebook'])) { |
| 62 | - $gradebook= $_SESSION['gradebook']; |
|
| 62 | + $gradebook = $_SESSION['gradebook']; |
|
| 63 | 63 | } |
| 64 | -if (!empty($gradebook) && $gradebook=='view') { |
|
| 64 | +if (!empty($gradebook) && $gradebook == 'view') { |
|
| 65 | 65 | $interbreadcrumb[] = array( |
| 66 | 66 | 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], |
| 67 | 67 | 'name' => get_lang('ToolGradebook'), |
@@ -75,8 +75,8 @@ discard block |
||
| 75 | 75 | "name" => get_lang('Exercises'), |
| 76 | 76 | ); |
| 77 | 77 | |
| 78 | -$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/js/hotspot.js"></script>'; |
|
| 79 | -$htmlHeadXtra[] = '<link rel="stylesheet" href="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/css/hotspot.css">'; |
|
| 78 | +$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/js/hotspot.js"></script>'; |
|
| 79 | +$htmlHeadXtra[] = '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/css/hotspot.css">'; |
|
| 80 | 80 | |
| 81 | 81 | if ($origin != 'learnpath') { |
| 82 | 82 | // So we are not in learnpath tool |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | $max_score = $objExercise->get_max_score(); |
| 156 | 156 | |
| 157 | -Display::display_normal_message(get_lang('Saved').'<br />',false); |
|
| 157 | +Display::display_normal_message(get_lang('Saved').'<br />', false); |
|
| 158 | 158 | |
| 159 | 159 | // Display and save questions |
| 160 | 160 | ExerciseLib::display_question_list_by_attempt($objExercise, $exe_id, true); |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | } else { |
| 187 | 187 | $lp_mode = isset($_SESSION['lp_mode']) ? $_SESSION['lp_mode'] : null; |
| 188 | 188 | $url = '../newscorm/lp_controller.php?cidReq='.api_get_course_id().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exercise_stat_info['exe_id'].'&fb_type='.$objExercise->feedback_type; |
| 189 | - $href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'"'; |
|
| 189 | + $href = ($lp_mode == 'fullscreen') ? ' window.opener.location.href="'.$url.'" ' : ' top.location.href="'.$url.'"'; |
|
| 190 | 190 | |
| 191 | 191 | if (api_is_allowed_to_session_edit()) { |
| 192 | 192 | Session::erase('objExercise'); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | public $feedback_type; |
| 30 | 30 | public $end_time; |
| 31 | 31 | public $start_time; |
| 32 | - public $questionList; // array with the list of this exercise's questions |
|
| 32 | + public $questionList; // array with the list of this exercise's questions |
|
| 33 | 33 | /* including question list of the media */ |
| 34 | 34 | public $questionListUncompressed; |
| 35 | 35 | public $results_disabled; |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | $TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST); |
| 133 | 133 | $table_lp_item = Database::get_course_table(TABLE_LP_ITEM); |
| 134 | 134 | |
| 135 | - $id = intval($id); |
|
| 135 | + $id = intval($id); |
|
| 136 | 136 | if (empty($this->course_id)) { |
| 137 | 137 | |
| 138 | 138 | return false; |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | */ |
| 479 | 479 | public function isRandom() |
| 480 | 480 | { |
| 481 | - if($this->random > 0 || $this->random == -1) { |
|
| 481 | + if ($this->random > 0 || $this->random == -1) { |
|
| 482 | 482 | return true; |
| 483 | 483 | } else { |
| 484 | 484 | return false; |
@@ -639,7 +639,7 @@ discard block |
||
| 639 | 639 | $question_media = null; |
| 640 | 640 | if (!empty($objQuestionTmp->parent_id)) { |
| 641 | 641 | $objQuestionMedia = Question::read($objQuestionTmp->parent_id); |
| 642 | - $question_media = Question::getMediaLabel($objQuestionMedia->question); |
|
| 642 | + $question_media = Question::getMediaLabel($objQuestionMedia->question); |
|
| 643 | 643 | } |
| 644 | 644 | |
| 645 | 645 | $questionType = Display::tag('div', Display::return_icon($typeImg, $typeExpl, array(), ICON_SIZE_MEDIUM).$question_media); |
@@ -1032,7 +1032,7 @@ discard block |
||
| 1032 | 1032 | |
| 1033 | 1033 | foreach ($questions_by_category as $categoryId => $questionList) { |
| 1034 | 1034 | $cat = new TestCategory($categoryId); |
| 1035 | - $cat = (array)$cat; |
|
| 1035 | + $cat = (array) $cat; |
|
| 1036 | 1036 | $cat['iid'] = $cat['id']; |
| 1037 | 1037 | //*$cat['name'] = $cat['name']; |
| 1038 | 1038 | |
@@ -1097,7 +1097,7 @@ discard block |
||
| 1097 | 1097 | { |
| 1098 | 1098 | if ($this->specialCategoryOrders == false) { |
| 1099 | 1099 | if ($from_db && !empty($this->id)) { |
| 1100 | - $TBL_EXERCISE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); |
|
| 1100 | + $TBL_EXERCISE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); |
|
| 1101 | 1101 | $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION); |
| 1102 | 1102 | |
| 1103 | 1103 | $sql = "SELECT DISTINCT e.question_order |
@@ -1124,7 +1124,7 @@ discard block |
||
| 1124 | 1124 | $question_list = array(); |
| 1125 | 1125 | |
| 1126 | 1126 | while ($new_object = Database::fetch_object($result)) { |
| 1127 | - $question_list[$new_object->question_order]= $new_object->question_id; |
|
| 1127 | + $question_list[$new_object->question_order] = $new_object->question_id; |
|
| 1128 | 1128 | $temp_question_list[$counter] = $new_object->question_id; |
| 1129 | 1129 | $counter++; |
| 1130 | 1130 | } |
@@ -1268,7 +1268,7 @@ discard block |
||
| 1268 | 1268 | public function isInList($questionId) |
| 1269 | 1269 | { |
| 1270 | 1270 | if (is_array($this->questionList)) |
| 1271 | - return in_array($questionId,$this->questionList); |
|
| 1271 | + return in_array($questionId, $this->questionList); |
|
| 1272 | 1272 | else |
| 1273 | 1273 | return false; |
| 1274 | 1274 | } |
@@ -1281,7 +1281,7 @@ discard block |
||
| 1281 | 1281 | */ |
| 1282 | 1282 | public function updateTitle($title) |
| 1283 | 1283 | { |
| 1284 | - $this->exercise=$title; |
|
| 1284 | + $this->exercise = $title; |
|
| 1285 | 1285 | } |
| 1286 | 1286 | |
| 1287 | 1287 | /** |
@@ -1291,7 +1291,7 @@ discard block |
||
| 1291 | 1291 | */ |
| 1292 | 1292 | public function updateAttempts($attempts) |
| 1293 | 1293 | { |
| 1294 | - $this->attempts=$attempts; |
|
| 1294 | + $this->attempts = $attempts; |
|
| 1295 | 1295 | } |
| 1296 | 1296 | |
| 1297 | 1297 | /** |
@@ -1301,7 +1301,7 @@ discard block |
||
| 1301 | 1301 | */ |
| 1302 | 1302 | public function updateFeedbackType($feedback_type) |
| 1303 | 1303 | { |
| 1304 | - $this->feedback_type=$feedback_type; |
|
| 1304 | + $this->feedback_type = $feedback_type; |
|
| 1305 | 1305 | } |
| 1306 | 1306 | |
| 1307 | 1307 | /** |
@@ -1312,7 +1312,7 @@ discard block |
||
| 1312 | 1312 | */ |
| 1313 | 1313 | public function updateDescription($description) |
| 1314 | 1314 | { |
| 1315 | - $this->description=$description; |
|
| 1315 | + $this->description = $description; |
|
| 1316 | 1316 | } |
| 1317 | 1317 | |
| 1318 | 1318 | /** |
@@ -1442,23 +1442,23 @@ discard block |
||
| 1442 | 1442 | * @param string $sound - exercise sound file |
| 1443 | 1443 | * @param string $delete - ask to delete the file |
| 1444 | 1444 | */ |
| 1445 | - public function updateSound($sound,$delete) |
|
| 1445 | + public function updateSound($sound, $delete) |
|
| 1446 | 1446 | { |
| 1447 | 1447 | global $audioPath, $documentPath; |
| 1448 | 1448 | $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT); |
| 1449 | 1449 | |
| 1450 | - if ($sound['size'] && (strstr($sound['type'],'audio') || strstr($sound['type'],'video'))) { |
|
| 1451 | - $this->sound=$sound['name']; |
|
| 1450 | + if ($sound['size'] && (strstr($sound['type'], 'audio') || strstr($sound['type'], 'video'))) { |
|
| 1451 | + $this->sound = $sound['name']; |
|
| 1452 | 1452 | |
| 1453 | - if (@move_uploaded_file($sound['tmp_name'],$audioPath.'/'.$this->sound)) { |
|
| 1453 | + if (@move_uploaded_file($sound['tmp_name'], $audioPath.'/'.$this->sound)) { |
|
| 1454 | 1454 | $query = "SELECT 1 FROM $TBL_DOCUMENT |
| 1455 | - WHERE c_id = ".$this->course_id." AND path='".str_replace($documentPath,'',$audioPath).'/'.$this->sound."'"; |
|
| 1456 | - $result=Database::query($query); |
|
| 1455 | + WHERE c_id = ".$this->course_id." AND path='".str_replace($documentPath, '', $audioPath).'/'.$this->sound."'"; |
|
| 1456 | + $result = Database::query($query); |
|
| 1457 | 1457 | |
| 1458 | 1458 | if (!Database::num_rows($result)) { |
| 1459 | 1459 | $id = add_document( |
| 1460 | 1460 | $this->course, |
| 1461 | - str_replace($documentPath,'',$audioPath).'/'.$this->sound, |
|
| 1461 | + str_replace($documentPath, '', $audioPath).'/'.$this->sound, |
|
| 1462 | 1462 | 'file', |
| 1463 | 1463 | $sound['size'], |
| 1464 | 1464 | $sound['name'] |
@@ -1477,8 +1477,8 @@ discard block |
||
| 1477 | 1477 | ); |
| 1478 | 1478 | } |
| 1479 | 1479 | } |
| 1480 | - } elseif($delete && is_file($audioPath.'/'.$this->sound)) { |
|
| 1481 | - $this->sound=''; |
|
| 1480 | + } elseif ($delete && is_file($audioPath.'/'.$this->sound)) { |
|
| 1481 | + $this->sound = ''; |
|
| 1482 | 1482 | } |
| 1483 | 1483 | } |
| 1484 | 1484 | |
@@ -1490,7 +1490,7 @@ discard block |
||
| 1490 | 1490 | */ |
| 1491 | 1491 | public function updateType($type) |
| 1492 | 1492 | { |
| 1493 | - $this->type=$type; |
|
| 1493 | + $this->type = $type; |
|
| 1494 | 1494 | } |
| 1495 | 1495 | |
| 1496 | 1496 | /** |
@@ -1526,7 +1526,7 @@ discard block |
||
| 1526 | 1526 | */ |
| 1527 | 1527 | public function enable() |
| 1528 | 1528 | { |
| 1529 | - $this->active=1; |
|
| 1529 | + $this->active = 1; |
|
| 1530 | 1530 | } |
| 1531 | 1531 | |
| 1532 | 1532 | /** |
@@ -1536,7 +1536,7 @@ discard block |
||
| 1536 | 1536 | */ |
| 1537 | 1537 | public function disable() |
| 1538 | 1538 | { |
| 1539 | - $this->active=0; |
|
| 1539 | + $this->active = 0; |
|
| 1540 | 1540 | } |
| 1541 | 1541 | |
| 1542 | 1542 | /** |
@@ -1664,7 +1664,7 @@ discard block |
||
| 1664 | 1664 | api_get_user_id() |
| 1665 | 1665 | ); |
| 1666 | 1666 | |
| 1667 | - if (api_get_setting('search_enabled')=='true') { |
|
| 1667 | + if (api_get_setting('search_enabled') == 'true') { |
|
| 1668 | 1668 | $this->search_engine_edit(); |
| 1669 | 1669 | } |
| 1670 | 1670 | } else { |
@@ -1812,7 +1812,7 @@ discard block |
||
| 1812 | 1812 | public function removeFromList($questionId) |
| 1813 | 1813 | { |
| 1814 | 1814 | // searches the position of the question ID in the list |
| 1815 | - $pos = array_search($questionId,$this->questionList); |
|
| 1815 | + $pos = array_search($questionId, $this->questionList); |
|
| 1816 | 1816 | |
| 1817 | 1817 | // question not found |
| 1818 | 1818 | if ($pos === false) { |
@@ -1847,7 +1847,7 @@ discard block |
||
| 1847 | 1847 | api_item_property_update($this->course, TOOL_QUIZ, $this->id, 'QuizDeleted', api_get_user_id()); |
| 1848 | 1848 | api_item_property_update($this->course, TOOL_QUIZ, $this->id, 'delete', api_get_user_id()); |
| 1849 | 1849 | |
| 1850 | - if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian') ) { |
|
| 1850 | + if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) { |
|
| 1851 | 1851 | $this->search_engine_delete(); |
| 1852 | 1852 | } |
| 1853 | 1853 | } |
@@ -1856,7 +1856,7 @@ discard block |
||
| 1856 | 1856 | * Creates the form to create / edit an exercise |
| 1857 | 1857 | * @param FormValidator $form |
| 1858 | 1858 | */ |
| 1859 | - public function createForm($form, $type='full') |
|
| 1859 | + public function createForm($form, $type = 'full') |
|
| 1860 | 1860 | { |
| 1861 | 1861 | if (empty($type)) { |
| 1862 | 1862 | $type = 'full'; |
@@ -1887,7 +1887,7 @@ discard block |
||
| 1887 | 1887 | 'Width' => '100%', |
| 1888 | 1888 | 'Height' => '150', |
| 1889 | 1889 | ); |
| 1890 | - if (is_array($type)){ |
|
| 1890 | + if (is_array($type)) { |
|
| 1891 | 1891 | $editor_config = array_merge($editor_config, $type); |
| 1892 | 1892 | } |
| 1893 | 1893 | |
@@ -1941,7 +1941,7 @@ discard block |
||
| 1941 | 1941 | '2', |
| 1942 | 1942 | array('id' => 'exerciseType_2') |
| 1943 | 1943 | ); |
| 1944 | - $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'),get_lang('FeedbackDisplayOptions')), ''); |
|
| 1944 | + $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'), get_lang('FeedbackDisplayOptions')), ''); |
|
| 1945 | 1945 | |
| 1946 | 1946 | // Type of results display on the final page |
| 1947 | 1947 | $radios_results_disabled = array(); |
@@ -1985,8 +1985,8 @@ discard block |
||
| 1985 | 1985 | // Type of questions disposition on page |
| 1986 | 1986 | $radios = array(); |
| 1987 | 1987 | |
| 1988 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all')); |
|
| 1989 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'),'2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one')); |
|
| 1988 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all')); |
|
| 1989 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'), '2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one')); |
|
| 1990 | 1990 | |
| 1991 | 1991 | $form->addGroup($radios, null, get_lang('QuestionsPerPage'), ''); |
| 1992 | 1992 | |
@@ -1996,33 +1996,33 @@ discard block |
||
| 1996 | 1996 | |
| 1997 | 1997 | // feedback type |
| 1998 | 1998 | $radios_feedback = array(); |
| 1999 | - $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('ExerciseAtTheEndOfTheTest'),'0',array('id' =>'exerciseType_0', 'onclick' => 'check_feedback()')); |
|
| 1999 | + $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('ExerciseAtTheEndOfTheTest'), '0', array('id' =>'exerciseType_0', 'onclick' => 'check_feedback()')); |
|
| 2000 | 2000 | |
| 2001 | 2001 | if (api_get_setting('enable_quiz_scenario') == 'true') { |
| 2002 | - $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('DirectFeedback'), '1', array('id' =>'exerciseType_1' , 'onclick' => 'check_direct_feedback()')); |
|
| 2002 | + $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('DirectFeedback'), '1', array('id' =>'exerciseType_1', 'onclick' => 'check_direct_feedback()')); |
|
| 2003 | 2003 | } |
| 2004 | - $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('NoFeedback'),'2',array('id' =>'exerciseType_2')); |
|
| 2005 | - $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'),get_lang('FeedbackDisplayOptions'))); |
|
| 2004 | + $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('NoFeedback'), '2', array('id' =>'exerciseType_2')); |
|
| 2005 | + $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'), get_lang('FeedbackDisplayOptions'))); |
|
| 2006 | 2006 | |
| 2007 | 2007 | //$form->addElement('select', 'exerciseFeedbackType',get_lang('FeedbackType'),$feedback_option,'onchange="javascript:feedbackselection()"'); |
| 2008 | 2008 | $radios_results_disabled = array(); |
| 2009 | 2009 | $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('ShowScoreAndRightAnswer'), '0', array('id'=>'result_disabled_0')); |
| 2010 | - $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1',array('id'=>'result_disabled_1','onclick' => 'check_results_disabled()')); |
|
| 2011 | - $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2',array('id'=>'result_disabled_2','onclick' => 'check_results_disabled()')); |
|
| 2012 | - $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'),''); |
|
| 2010 | + $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1', array('id'=>'result_disabled_1', 'onclick' => 'check_results_disabled()')); |
|
| 2011 | + $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2', array('id'=>'result_disabled_2', 'onclick' => 'check_results_disabled()')); |
|
| 2012 | + $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'), ''); |
|
| 2013 | 2013 | |
| 2014 | 2014 | // Type of questions disposition on page |
| 2015 | 2015 | $radios = array(); |
| 2016 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1'); |
|
| 2017 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'),'2'); |
|
| 2016 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1'); |
|
| 2017 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'), '2'); |
|
| 2018 | 2018 | $form->addGroup($radios, null, get_lang('ExerciseType')); |
| 2019 | 2019 | |
| 2020 | 2020 | } else { |
| 2021 | 2021 | //Show options freeze |
| 2022 | 2022 | $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('ShowScoreAndRightAnswer'), '0', array('id'=>'result_disabled_0')); |
| 2023 | - $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1',array('id'=>'result_disabled_1','onclick' => 'check_results_disabled()')); |
|
| 2024 | - $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2',array('id'=>'result_disabled_2','onclick' => 'check_results_disabled()')); |
|
| 2025 | - $result_disable_group = $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'),''); |
|
| 2023 | + $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1', array('id'=>'result_disabled_1', 'onclick' => 'check_results_disabled()')); |
|
| 2024 | + $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2', array('id'=>'result_disabled_2', 'onclick' => 'check_results_disabled()')); |
|
| 2025 | + $result_disable_group = $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'), ''); |
|
| 2026 | 2026 | $result_disable_group->freeze(); |
| 2027 | 2027 | |
| 2028 | 2028 | //we force the options to the DirectFeedback exercisetype |
@@ -2030,8 +2030,8 @@ discard block |
||
| 2030 | 2030 | $form->addElement('hidden', 'exerciseType', ONE_PER_PAGE); |
| 2031 | 2031 | |
| 2032 | 2032 | // Type of questions disposition on page |
| 2033 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all')); |
|
| 2034 | - $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'),'2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one')); |
|
| 2033 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all')); |
|
| 2034 | + $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'), '2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one')); |
|
| 2035 | 2035 | |
| 2036 | 2036 | $type_group = $form->addGroup($radios, null, get_lang('QuestionsPerPage'), ''); |
| 2037 | 2037 | $type_group->freeze(); |
@@ -2163,26 +2163,26 @@ discard block |
||
| 2163 | 2163 | |
| 2164 | 2164 | // number of random question |
| 2165 | 2165 | |
| 2166 | - $max = ($this->id > 0) ? $this->selectNbrQuestions() : 10 ; |
|
| 2166 | + $max = ($this->id > 0) ? $this->selectNbrQuestions() : 10; |
|
| 2167 | 2167 | $option = range(0, $max); |
| 2168 | 2168 | $option[0] = get_lang('No'); |
| 2169 | 2169 | $option[-1] = get_lang('AllQuestionsShort'); |
| 2170 | - $form->addElement('select', 'randomQuestions',array(get_lang('RandomQuestions'), get_lang('RandomQuestionsHelp')), $option, array('id'=>'randomQuestions')); |
|
| 2170 | + $form->addElement('select', 'randomQuestions', array(get_lang('RandomQuestions'), get_lang('RandomQuestionsHelp')), $option, array('id'=>'randomQuestions')); |
|
| 2171 | 2171 | |
| 2172 | 2172 | // Random answers |
| 2173 | 2173 | $radios_random_answers = array(); |
| 2174 | - $radios_random_answers[] = $form->createElement('radio', 'randomAnswers', null, get_lang('Yes'),'1'); |
|
| 2175 | - $radios_random_answers[] = $form->createElement('radio', 'randomAnswers', null, get_lang('No'),'0'); |
|
| 2174 | + $radios_random_answers[] = $form->createElement('radio', 'randomAnswers', null, get_lang('Yes'), '1'); |
|
| 2175 | + $radios_random_answers[] = $form->createElement('radio', 'randomAnswers', null, get_lang('No'), '0'); |
|
| 2176 | 2176 | $form->addGroup($radios_random_answers, null, get_lang('RandomAnswers'), ''); |
| 2177 | 2177 | |
| 2178 | 2178 | // Random by category |
| 2179 | - $form->addElement('html','<div class="clear"> </div>'); |
|
| 2179 | + $form->addElement('html', '<div class="clear"> </div>'); |
|
| 2180 | 2180 | $radiocat = array(); |
| 2181 | - $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('YesWithCategoriesShuffled'),'1'); |
|
| 2182 | - $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('YesWithCategoriesSorted'),'2'); |
|
| 2183 | - $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('No'),'0'); |
|
| 2181 | + $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('YesWithCategoriesShuffled'), '1'); |
|
| 2182 | + $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('YesWithCategoriesSorted'), '2'); |
|
| 2183 | + $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('No'), '0'); |
|
| 2184 | 2184 | $radioCatGroup = $form->addGroup($radiocat, null, get_lang('RandomQuestionByCategory'), ''); |
| 2185 | - $form->addElement('html','<div class="clear"> </div>'); |
|
| 2185 | + $form->addElement('html', '<div class="clear"> </div>'); |
|
| 2186 | 2186 | |
| 2187 | 2187 | // add the radio display the category name for student |
| 2188 | 2188 | $radio_display_cat_name = array(); |
@@ -2203,36 +2203,36 @@ discard block |
||
| 2203 | 2203 | ); |
| 2204 | 2204 | |
| 2205 | 2205 | // Exercise time limit |
| 2206 | - $form->addElement('checkbox', 'activate_start_date_check',null, get_lang('EnableStartTime'), array('onclick' => 'activate_start_date()')); |
|
| 2206 | + $form->addElement('checkbox', 'activate_start_date_check', null, get_lang('EnableStartTime'), array('onclick' => 'activate_start_date()')); |
|
| 2207 | 2207 | |
| 2208 | 2208 | $var = Exercise::selectTimeLimit(); |
| 2209 | 2209 | |
| 2210 | 2210 | if (($this->start_time != '0000-00-00 00:00:00')) |
| 2211 | - $form->addElement('html','<div id="start_date_div" style="display:block;">'); |
|
| 2211 | + $form->addElement('html', '<div id="start_date_div" style="display:block;">'); |
|
| 2212 | 2212 | else |
| 2213 | - $form->addElement('html','<div id="start_date_div" style="display:none;">'); |
|
| 2213 | + $form->addElement('html', '<div id="start_date_div" style="display:none;">'); |
|
| 2214 | 2214 | |
| 2215 | 2215 | $form->addElement('date_time_picker', 'start_time'); |
| 2216 | 2216 | |
| 2217 | - $form->addElement('html','</div>'); |
|
| 2217 | + $form->addElement('html', '</div>'); |
|
| 2218 | 2218 | |
| 2219 | - $form->addElement('checkbox', 'activate_end_date_check', null , get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()')); |
|
| 2219 | + $form->addElement('checkbox', 'activate_end_date_check', null, get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()')); |
|
| 2220 | 2220 | |
| 2221 | 2221 | if (($this->end_time != '0000-00-00 00:00:00')) |
| 2222 | - $form->addElement('html','<div id="end_date_div" style="display:block;">'); |
|
| 2222 | + $form->addElement('html', '<div id="end_date_div" style="display:block;">'); |
|
| 2223 | 2223 | else |
| 2224 | - $form->addElement('html','<div id="end_date_div" style="display:none;">'); |
|
| 2224 | + $form->addElement('html', '<div id="end_date_div" style="display:none;">'); |
|
| 2225 | 2225 | |
| 2226 | 2226 | $form->addElement('date_time_picker', 'end_time'); |
| 2227 | - $form->addElement('html','</div>'); |
|
| 2227 | + $form->addElement('html', '</div>'); |
|
| 2228 | 2228 | |
| 2229 | 2229 | //$check_option=$this->selectType(); |
| 2230 | 2230 | $diplay = 'block'; |
| 2231 | 2231 | $form->addElement('checkbox', 'propagate_neg', null, get_lang('PropagateNegativeResults')); |
| 2232 | - $form->addElement('html','<div class="clear"> </div>'); |
|
| 2232 | + $form->addElement('html', '<div class="clear"> </div>'); |
|
| 2233 | 2233 | $form->addElement('checkbox', 'review_answers', null, get_lang('ReviewAnswers')); |
| 2234 | 2234 | |
| 2235 | - $form->addElement('html','<div id="divtimecontrol" style="display:'.$diplay.';">'); |
|
| 2235 | + $form->addElement('html', '<div id="divtimecontrol" style="display:'.$diplay.';">'); |
|
| 2236 | 2236 | |
| 2237 | 2237 | //Timer control |
| 2238 | 2238 | //$time_hours_option = range(0,12); |
@@ -2248,12 +2248,12 @@ discard block |
||
| 2248 | 2248 | 'onload' => 'check_load_time()', |
| 2249 | 2249 | ) |
| 2250 | 2250 | ); |
| 2251 | - $expired_date = (int)$this->selectExpiredTime(); |
|
| 2251 | + $expired_date = (int) $this->selectExpiredTime(); |
|
| 2252 | 2252 | |
| 2253 | - if (($expired_date!='0')) { |
|
| 2254 | - $form->addElement('html','<div id="timercontrol" style="display:block;">'); |
|
| 2253 | + if (($expired_date != '0')) { |
|
| 2254 | + $form->addElement('html', '<div id="timercontrol" style="display:block;">'); |
|
| 2255 | 2255 | } else { |
| 2256 | - $form->addElement('html','<div id="timercontrol" style="display:none;">'); |
|
| 2256 | + $form->addElement('html', '<div id="timercontrol" style="display:none;">'); |
|
| 2257 | 2257 | } |
| 2258 | 2258 | $form->addText( |
| 2259 | 2259 | 'enabletimercontroltotalminutes', |
@@ -2264,7 +2264,7 @@ discard block |
||
| 2264 | 2264 | 'cols-size' => [2, 2, 8] |
| 2265 | 2265 | ] |
| 2266 | 2266 | ); |
| 2267 | - $form->addElement('html','</div>'); |
|
| 2267 | + $form->addElement('html', '</div>'); |
|
| 2268 | 2268 | |
| 2269 | 2269 | $form->addElement( |
| 2270 | 2270 | 'text', |
@@ -2288,23 +2288,23 @@ discard block |
||
| 2288 | 2288 | $defaults = array(); |
| 2289 | 2289 | |
| 2290 | 2290 | if (api_get_setting('search_enabled') === 'true') { |
| 2291 | - require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'; |
|
| 2291 | + require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
|
| 2292 | 2292 | |
| 2293 | - $form->addElement ('checkbox', 'index_document','', get_lang('SearchFeatureDoIndexDocument')); |
|
| 2294 | - $form->addElement ('select_language', 'language', get_lang('SearchFeatureDocumentLanguage')); |
|
| 2293 | + $form->addElement('checkbox', 'index_document', '', get_lang('SearchFeatureDoIndexDocument')); |
|
| 2294 | + $form->addElement('select_language', 'language', get_lang('SearchFeatureDocumentLanguage')); |
|
| 2295 | 2295 | |
| 2296 | 2296 | $specific_fields = get_specific_field_list(); |
| 2297 | 2297 | |
| 2298 | 2298 | foreach ($specific_fields as $specific_field) { |
| 2299 | - $form->addElement ('text', $specific_field['code'], $specific_field['name']); |
|
| 2299 | + $form->addElement('text', $specific_field['code'], $specific_field['name']); |
|
| 2300 | 2300 | $filter = array( |
| 2301 | 2301 | 'c_id' => api_get_course_int_id(), |
| 2302 | 2302 | 'field_id' => $specific_field['id'], |
| 2303 | 2303 | 'ref_id' => $this->id, |
| 2304 | - 'tool_id' => "'" . TOOL_QUIZ . "'" |
|
| 2304 | + 'tool_id' => "'".TOOL_QUIZ."'" |
|
| 2305 | 2305 | ); |
| 2306 | 2306 | $values = get_specific_field_values_list($filter, array('value')); |
| 2307 | - if ( !empty($values) ) { |
|
| 2307 | + if (!empty($values)) { |
|
| 2308 | 2308 | $arr_str_values = array(); |
| 2309 | 2309 | foreach ($values as $value) { |
| 2310 | 2310 | $arr_str_values[] = $value['value']; |
@@ -2315,8 +2315,8 @@ discard block |
||
| 2315 | 2315 | //$form->addElement ('html','</div>'); |
| 2316 | 2316 | } |
| 2317 | 2317 | |
| 2318 | - $form->addElement('html','</div>'); //End advanced setting |
|
| 2319 | - $form->addElement('html','</div>'); |
|
| 2318 | + $form->addElement('html', '</div>'); //End advanced setting |
|
| 2319 | + $form->addElement('html', '</div>'); |
|
| 2320 | 2320 | } |
| 2321 | 2321 | |
| 2322 | 2322 | // submit |
@@ -2336,10 +2336,10 @@ discard block |
||
| 2336 | 2336 | } |
| 2337 | 2337 | |
| 2338 | 2338 | // defaults |
| 2339 | - if ($type=='full') { |
|
| 2339 | + if ($type == 'full') { |
|
| 2340 | 2340 | if ($this->id > 0) { |
| 2341 | 2341 | if ($this->random > $this->selectNbrQuestions()) { |
| 2342 | - $defaults['randomQuestions'] = $this->selectNbrQuestions(); |
|
| 2342 | + $defaults['randomQuestions'] = $this->selectNbrQuestions(); |
|
| 2343 | 2343 | } else { |
| 2344 | 2344 | $defaults['randomQuestions'] = $this->random; |
| 2345 | 2345 | } |
@@ -2366,8 +2366,8 @@ discard block |
||
| 2366 | 2366 | $defaults['activate_end_date_check'] = 1; |
| 2367 | 2367 | } |
| 2368 | 2368 | |
| 2369 | - $defaults['start_time'] = ($this->start_time!='0000-00-00 00:00:00') ? api_get_local_time($this->start_time) : date('Y-m-d 12:00:00'); |
|
| 2370 | - $defaults['end_time'] = ($this->end_time!='0000-00-00 00:00:00') ? api_get_local_time($this->end_time) : date('Y-m-d 12:00:00', time()+84600); |
|
| 2369 | + $defaults['start_time'] = ($this->start_time != '0000-00-00 00:00:00') ? api_get_local_time($this->start_time) : date('Y-m-d 12:00:00'); |
|
| 2370 | + $defaults['end_time'] = ($this->end_time != '0000-00-00 00:00:00') ? api_get_local_time($this->end_time) : date('Y-m-d 12:00:00', time() + 84600); |
|
| 2371 | 2371 | |
| 2372 | 2372 | // Get expired time |
| 2373 | 2373 | if ($this->expired_time != '0') { |
@@ -2388,7 +2388,7 @@ discard block |
||
| 2388 | 2388 | $defaults['text_when_finished'] = ""; |
| 2389 | 2389 | $defaults['start_time'] = date('Y-m-d 12:00:00'); |
| 2390 | 2390 | $defaults['display_category_name'] = 1; |
| 2391 | - $defaults['end_time'] = date('Y-m-d 12:00:00', time()+84600); |
|
| 2391 | + $defaults['end_time'] = date('Y-m-d 12:00:00', time() + 84600); |
|
| 2392 | 2392 | $defaults['pass_percentage'] = ''; |
| 2393 | 2393 | $defaults['end_button'] = $this->selectEndButton(); |
| 2394 | 2394 | $defaults['question_selection_type'] = 1; |
@@ -2474,7 +2474,7 @@ discard block |
||
| 2474 | 2474 | $end_time = $form->getSubmitValue('end_time'); |
| 2475 | 2475 | $this->end_time = api_get_utc_datetime($end_time); |
| 2476 | 2476 | } else { |
| 2477 | - $this->end_time = '0000-00-00 00:00:00'; |
|
| 2477 | + $this->end_time = '0000-00-00 00:00:00'; |
|
| 2478 | 2478 | } |
| 2479 | 2479 | |
| 2480 | 2480 | if ($form->getSubmitValue('enabletimercontrol') == 1) { |
@@ -2487,9 +2487,9 @@ discard block |
||
| 2487 | 2487 | } |
| 2488 | 2488 | |
| 2489 | 2489 | if ($form->getSubmitValue('randomAnswers') == 1) { |
| 2490 | - $this->random_answers=1; |
|
| 2490 | + $this->random_answers = 1; |
|
| 2491 | 2491 | } else { |
| 2492 | - $this->random_answers=0; |
|
| 2492 | + $this->random_answers = 0; |
|
| 2493 | 2493 | } |
| 2494 | 2494 | $this->save($type); |
| 2495 | 2495 | } |
@@ -2501,9 +2501,9 @@ discard block |
||
| 2501 | 2501 | } |
| 2502 | 2502 | $course_id = api_get_course_id(); |
| 2503 | 2503 | |
| 2504 | - require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php'; |
|
| 2505 | - require_once api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php'; |
|
| 2506 | - require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'; |
|
| 2504 | + require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'; |
|
| 2505 | + require_once api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php'; |
|
| 2506 | + require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
|
| 2507 | 2507 | |
| 2508 | 2508 | $specific_fields = get_specific_field_list(); |
| 2509 | 2509 | $ic_slide = new IndexableChunk(); |
@@ -2513,7 +2513,7 @@ discard block |
||
| 2513 | 2513 | if (isset($_REQUEST[$specific_field['code']])) { |
| 2514 | 2514 | $sterms = trim($_REQUEST[$specific_field['code']]); |
| 2515 | 2515 | if (!empty($sterms)) { |
| 2516 | - $all_specific_terms .= ' '. $sterms; |
|
| 2516 | + $all_specific_terms .= ' '.$sterms; |
|
| 2517 | 2517 | $sterms = explode(',', $sterms); |
| 2518 | 2518 | foreach ($sterms as $sterm) { |
| 2519 | 2519 | $ic_slide->addTerm(trim($sterm), $specific_field['code']); |
@@ -2530,15 +2530,15 @@ discard block |
||
| 2530 | 2530 | $xapian_data = array( |
| 2531 | 2531 | SE_COURSE_ID => $course_id, |
| 2532 | 2532 | SE_TOOL_ID => TOOL_QUIZ, |
| 2533 | - SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int)$this->id), |
|
| 2534 | - SE_USER => (int)api_get_user_id(), |
|
| 2533 | + SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int) $this->id), |
|
| 2534 | + SE_USER => (int) api_get_user_id(), |
|
| 2535 | 2535 | ); |
| 2536 | 2536 | $ic_slide->xapian_data = serialize($xapian_data); |
| 2537 | - $exercise_description = $all_specific_terms .' '. $this->description; |
|
| 2537 | + $exercise_description = $all_specific_terms.' '.$this->description; |
|
| 2538 | 2538 | $ic_slide->addValue("content", $exercise_description); |
| 2539 | 2539 | |
| 2540 | 2540 | $di = new ChamiloIndexer(); |
| 2541 | - isset($_POST['language'])? $lang=Database::escape_string($_POST['language']): $lang = 'english'; |
|
| 2541 | + isset($_POST['language']) ? $lang = Database::escape_string($_POST['language']) : $lang = 'english'; |
|
| 2542 | 2542 | $di->connectDb(NULL, NULL, $lang); |
| 2543 | 2543 | $di->addChunk($ic_slide); |
| 2544 | 2544 | |
@@ -2557,7 +2557,7 @@ discard block |
||
| 2557 | 2557 | function search_engine_edit() |
| 2558 | 2558 | { |
| 2559 | 2559 | // update search enchine and its values table if enabled |
| 2560 | - if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian')) { |
|
| 2560 | + if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) { |
|
| 2561 | 2561 | $course_id = api_get_course_id(); |
| 2562 | 2562 | |
| 2563 | 2563 | // actually, it consists on delete terms from db, |
@@ -2569,9 +2569,9 @@ discard block |
||
| 2569 | 2569 | $res = Database::query($sql); |
| 2570 | 2570 | |
| 2571 | 2571 | if (Database::num_rows($res) > 0) { |
| 2572 | - require_once(api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php'); |
|
| 2573 | - require_once(api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php'); |
|
| 2574 | - require_once(api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'); |
|
| 2572 | + require_once(api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'); |
|
| 2573 | + require_once(api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php'); |
|
| 2574 | + require_once(api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'); |
|
| 2575 | 2575 | |
| 2576 | 2576 | $se_ref = Database::fetch_array($res); |
| 2577 | 2577 | $specific_fields = get_specific_field_list(); |
@@ -2582,7 +2582,7 @@ discard block |
||
| 2582 | 2582 | delete_all_specific_field_value($course_id, $specific_field['id'], TOOL_QUIZ, $this->id); |
| 2583 | 2583 | if (isset($_REQUEST[$specific_field['code']])) { |
| 2584 | 2584 | $sterms = trim($_REQUEST[$specific_field['code']]); |
| 2585 | - $all_specific_terms .= ' '. $sterms; |
|
| 2585 | + $all_specific_terms .= ' '.$sterms; |
|
| 2586 | 2586 | $sterms = explode(',', $sterms); |
| 2587 | 2587 | foreach ($sterms as $sterm) { |
| 2588 | 2588 | $ic_slide->addTerm(trim($sterm), $specific_field['code']); |
@@ -2598,17 +2598,17 @@ discard block |
||
| 2598 | 2598 | $xapian_data = array( |
| 2599 | 2599 | SE_COURSE_ID => $course_id, |
| 2600 | 2600 | SE_TOOL_ID => TOOL_QUIZ, |
| 2601 | - SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int)$this->id), |
|
| 2602 | - SE_USER => (int)api_get_user_id(), |
|
| 2601 | + SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int) $this->id), |
|
| 2602 | + SE_USER => (int) api_get_user_id(), |
|
| 2603 | 2603 | ); |
| 2604 | 2604 | $ic_slide->xapian_data = serialize($xapian_data); |
| 2605 | - $exercise_description = $all_specific_terms .' '. $this->description; |
|
| 2605 | + $exercise_description = $all_specific_terms.' '.$this->description; |
|
| 2606 | 2606 | $ic_slide->addValue("content", $exercise_description); |
| 2607 | 2607 | |
| 2608 | 2608 | $di = new ChamiloIndexer(); |
| 2609 | - isset($_POST['language'])? $lang=Database::escape_string($_POST['language']): $lang = 'english'; |
|
| 2609 | + isset($_POST['language']) ? $lang = Database::escape_string($_POST['language']) : $lang = 'english'; |
|
| 2610 | 2610 | $di->connectDb(NULL, NULL, $lang); |
| 2611 | - $di->remove_document((int)$se_ref['search_did']); |
|
| 2611 | + $di->remove_document((int) $se_ref['search_did']); |
|
| 2612 | 2612 | $di->addChunk($ic_slide); |
| 2613 | 2613 | |
| 2614 | 2614 | //index and return search engine document id |
@@ -2633,7 +2633,7 @@ discard block |
||
| 2633 | 2633 | function search_engine_delete() |
| 2634 | 2634 | { |
| 2635 | 2635 | // remove from search engine if enabled |
| 2636 | - if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian') ) { |
|
| 2636 | + if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) { |
|
| 2637 | 2637 | $course_id = api_get_course_id(); |
| 2638 | 2638 | $tbl_se_ref = Database::get_main_table(TABLE_MAIN_SEARCH_ENGINE_REF); |
| 2639 | 2639 | $sql = 'SELECT * FROM %s WHERE course_code=\'%s\' AND tool_id=\'%s\' AND ref_id_high_level=%s AND ref_id_second_level IS NULL LIMIT 1'; |
@@ -2641,19 +2641,19 @@ discard block |
||
| 2641 | 2641 | $res = Database::query($sql); |
| 2642 | 2642 | if (Database::num_rows($res) > 0) { |
| 2643 | 2643 | $row = Database::fetch_array($res); |
| 2644 | - require_once(api_get_path(LIBRARY_PATH) .'search/ChamiloIndexer.class.php'); |
|
| 2644 | + require_once(api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'); |
|
| 2645 | 2645 | $di = new ChamiloIndexer(); |
| 2646 | - $di->remove_document((int)$row['search_did']); |
|
| 2646 | + $di->remove_document((int) $row['search_did']); |
|
| 2647 | 2647 | unset($di); |
| 2648 | 2648 | $tbl_quiz_question = Database::get_course_table(TABLE_QUIZ_QUESTION); |
| 2649 | - foreach ( $this->questionList as $question_i) { |
|
| 2649 | + foreach ($this->questionList as $question_i) { |
|
| 2650 | 2650 | $sql = 'SELECT type FROM %s WHERE id=%s'; |
| 2651 | 2651 | $sql = sprintf($sql, $tbl_quiz_question, $question_i); |
| 2652 | 2652 | $qres = Database::query($sql); |
| 2653 | 2653 | if (Database::num_rows($qres) > 0) { |
| 2654 | 2654 | $qrow = Database::fetch_array($qres); |
| 2655 | 2655 | $objQuestion = Question::getInstance($qrow['type']); |
| 2656 | - $objQuestion = Question::read((int)$question_i); |
|
| 2656 | + $objQuestion = Question::read((int) $question_i); |
|
| 2657 | 2657 | $objQuestion->search_engine_edit($this->id, FALSE, TRUE); |
| 2658 | 2658 | unset($objQuestion); |
| 2659 | 2659 | } |
@@ -2664,7 +2664,7 @@ discard block |
||
| 2664 | 2664 | Database::query($sql); |
| 2665 | 2665 | |
| 2666 | 2666 | // remove terms from db |
| 2667 | - require_once api_get_path(LIBRARY_PATH) .'specific_fields_manager.lib.php'; |
|
| 2667 | + require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
|
| 2668 | 2668 | delete_all_values_for_item($course_id, TOOL_QUIZ, $this->id); |
| 2669 | 2669 | } |
| 2670 | 2670 | } |
@@ -2759,7 +2759,7 @@ discard block |
||
| 2759 | 2759 | */ |
| 2760 | 2760 | public function copy_exercise() |
| 2761 | 2761 | { |
| 2762 | - $exercise_obj= new Exercise(); |
|
| 2762 | + $exercise_obj = new Exercise(); |
|
| 2763 | 2763 | $exercise_obj = $this; |
| 2764 | 2764 | |
| 2765 | 2765 | // force the creation of a new exercise |
@@ -2831,25 +2831,25 @@ discard block |
||
| 2831 | 2831 | $lp_id = 0; |
| 2832 | 2832 | } |
| 2833 | 2833 | if (empty($lp_item_id)) { |
| 2834 | - $lp_item_id = 0; |
|
| 2834 | + $lp_item_id = 0; |
|
| 2835 | 2835 | } |
| 2836 | 2836 | if (empty($lp_item_view_id)) { |
| 2837 | 2837 | $lp_item_view_id = 0; |
| 2838 | 2838 | } |
| 2839 | - $condition = ' WHERE exe_exo_id = ' . "'" . $this->id . "'" .' AND |
|
| 2840 | - exe_user_id = ' . "'" . api_get_user_id() . "'" . ' AND |
|
| 2841 | - c_id = ' . api_get_course_int_id() . ' AND |
|
| 2842 | - status = ' . "'" . Database::escape_string($status). "'" . ' AND |
|
| 2843 | - orig_lp_id = ' . "'" . $lp_id . "'" . ' AND |
|
| 2844 | - orig_lp_item_id = ' . "'" . $lp_item_id . "'" . ' AND |
|
| 2845 | - orig_lp_item_view_id = ' . "'" . $lp_item_view_id . "'" . ' AND |
|
| 2846 | - session_id = ' . "'" . api_get_session_id() . "' LIMIT 1"; //Adding limit 1 just in case |
|
| 2839 | + $condition = ' WHERE exe_exo_id = '."'".$this->id."'".' AND |
|
| 2840 | + exe_user_id = ' . "'".api_get_user_id()."'".' AND |
|
| 2841 | + c_id = ' . api_get_course_int_id().' AND |
|
| 2842 | + status = ' . "'".Database::escape_string($status)."'".' AND |
|
| 2843 | + orig_lp_id = ' . "'".$lp_id."'".' AND |
|
| 2844 | + orig_lp_item_id = ' . "'".$lp_item_id."'".' AND |
|
| 2845 | + orig_lp_item_view_id = ' . "'".$lp_item_view_id."'".' AND |
|
| 2846 | + session_id = ' . "'".api_get_session_id()."' LIMIT 1"; //Adding limit 1 just in case |
|
| 2847 | 2847 | |
| 2848 | 2848 | $sql_track = 'SELECT * FROM '.$track_exercises.$condition; |
| 2849 | 2849 | |
| 2850 | 2850 | $result = Database::query($sql_track); |
| 2851 | 2851 | $new_array = array(); |
| 2852 | - if (Database::num_rows($result) > 0 ) { |
|
| 2852 | + if (Database::num_rows($result) > 0) { |
|
| 2853 | 2853 | $new_array = Database::fetch_array($result, 'ASSOC'); |
| 2854 | 2854 | $new_array['num_exe'] = Database::num_rows($result); |
| 2855 | 2855 | } |
@@ -2892,12 +2892,12 @@ discard block |
||
| 2892 | 2892 | $questionList = array_map('intval', $questionList); |
| 2893 | 2893 | |
| 2894 | 2894 | $params = array( |
| 2895 | - 'exe_exo_id' => $this->id , |
|
| 2895 | + 'exe_exo_id' => $this->id, |
|
| 2896 | 2896 | 'exe_user_id' => api_get_user_id(), |
| 2897 | 2897 | 'c_id' => api_get_course_int_id(), |
| 2898 | 2898 | 'status' => 'incomplete', |
| 2899 | 2899 | 'session_id' => api_get_session_id(), |
| 2900 | - 'data_tracking' => implode(',', $questionList) , |
|
| 2900 | + 'data_tracking' => implode(',', $questionList), |
|
| 2901 | 2901 | 'start_date' => api_get_utc_datetime(), |
| 2902 | 2902 | 'orig_lp_id' => $safe_lp_id, |
| 2903 | 2903 | 'orig_lp_item_id' => $safe_lp_item_id, |
@@ -2929,7 +2929,7 @@ discard block |
||
| 2929 | 2929 | $nbrQuestions = $this->get_count_question_list(); |
| 2930 | 2930 | |
| 2931 | 2931 | $all_button = $html = $label = ''; |
| 2932 | - $hotspot_get = isset($_POST['hotspot']) ? Security::remove_XSS($_POST['hotspot']):null; |
|
| 2932 | + $hotspot_get = isset($_POST['hotspot']) ? Security::remove_XSS($_POST['hotspot']) : null; |
|
| 2933 | 2933 | |
| 2934 | 2934 | if ($this->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT && $this->type == ONE_PER_PAGE) { |
| 2935 | 2935 | $urlTitle = get_lang('ContinueTest'); |
@@ -2940,7 +2940,7 @@ discard block |
||
| 2940 | 2940 | |
| 2941 | 2941 | $html .= Display::url( |
| 2942 | 2942 | $urlTitle, |
| 2943 | - 'exercise_submit_modal.php?' . http_build_query([ |
|
| 2943 | + 'exercise_submit_modal.php?'.http_build_query([ |
|
| 2944 | 2944 | 'learnpath_id' => $safe_lp_id, |
| 2945 | 2945 | 'learnpath_item_id' => $safe_lp_item_id, |
| 2946 | 2946 | 'learnpath_item_view_id' => $safe_lp_item_view_id, |
@@ -2957,7 +2957,7 @@ discard block |
||
| 2957 | 2957 | 'data-size' => 'md' |
| 2958 | 2958 | ] |
| 2959 | 2959 | ); |
| 2960 | - $html .='<br />'; |
|
| 2960 | + $html .= '<br />'; |
|
| 2961 | 2961 | } else { |
| 2962 | 2962 | // User |
| 2963 | 2963 | if (api_is_allowed_to_session_edit()) { |
@@ -2982,7 +2982,7 @@ discard block |
||
| 2982 | 2982 | |
| 2983 | 2983 | //Next question |
| 2984 | 2984 | if (!empty($questions_in_media)) { |
| 2985 | - $questions_in_media = "['".implode("','",$questions_in_media)."']"; |
|
| 2985 | + $questions_in_media = "['".implode("','", $questions_in_media)."']"; |
|
| 2986 | 2986 | $all_button .= ' <a href="javascript://" class="'.$class.'" onclick="save_question_list('.$questions_in_media.'); ">'.$label.'</a>'; |
| 2987 | 2987 | } else { |
| 2988 | 2988 | $all_button .= ' <a href="javascript://" class="'.$class.'" onclick="save_now('.$question_id.', \'\', \''.$currentAnswer.'\'); ">'.$label.'</a>'; |
@@ -3000,7 +3000,7 @@ discard block |
||
| 3000 | 3000 | } |
| 3001 | 3001 | $class .= ' question-validate-btn'; // used to select it with jquery |
| 3002 | 3002 | $all_button = ' <a href="javascript://" class="'.$class.'" onclick="validate_all(); ">'.$all_label.'</a>'; |
| 3003 | - $all_button .= ' ' . Display::span(null, ['id' => 'save_all_reponse']); |
|
| 3003 | + $all_button .= ' '.Display::span(null, ['id' => 'save_all_reponse']); |
|
| 3004 | 3004 | $html .= $all_button; |
| 3005 | 3005 | } |
| 3006 | 3006 | } |
@@ -3242,8 +3242,8 @@ discard block |
||
| 3242 | 3242 | $params = array(); |
| 3243 | 3243 | $params['course_id'] = $course_id; |
| 3244 | 3244 | $params['session_id'] = api_get_session_id(); |
| 3245 | - $params['user_id'] = isset($exe_info['exe_user_id'])? $exe_info['exe_user_id'] : api_get_user_id(); |
|
| 3246 | - $params['exercise_id'] = isset($exe_info['exe_exo_id'])? $exe_info['exe_exo_id'] : $this->id; |
|
| 3245 | + $params['user_id'] = isset($exe_info['exe_user_id']) ? $exe_info['exe_user_id'] : api_get_user_id(); |
|
| 3246 | + $params['exercise_id'] = isset($exe_info['exe_exo_id']) ? $exe_info['exe_exo_id'] : $this->id; |
|
| 3247 | 3247 | $params['question_id'] = $questionId; |
| 3248 | 3248 | $params['exe_id'] = isset($exe_info['exe_id']) ? $exe_info['exe_id'] : $exeId; |
| 3249 | 3249 | |
@@ -3297,10 +3297,10 @@ discard block |
||
| 3297 | 3297 | $answer = $objAnswerTmp->selectAnswer($answerId); |
| 3298 | 3298 | $answerComment = $objAnswerTmp->selectComment($answerId); |
| 3299 | 3299 | $answerCorrect = $objAnswerTmp->isCorrect($answerId); |
| 3300 | - $answerWeighting = (float)$objAnswerTmp->selectWeighting($answerId); |
|
| 3300 | + $answerWeighting = (float) $objAnswerTmp->selectWeighting($answerId); |
|
| 3301 | 3301 | $answerAutoId = $objAnswerTmp->selectAutoId($answerId); |
| 3302 | 3302 | |
| 3303 | - $answer_correct_array[$answerId] = (bool)$answerCorrect; |
|
| 3303 | + $answer_correct_array[$answerId] = (bool) $answerCorrect; |
|
| 3304 | 3304 | |
| 3305 | 3305 | if ($debug) { |
| 3306 | 3306 | error_log("answer auto id: $answerAutoId "); |
@@ -3309,7 +3309,7 @@ discard block |
||
| 3309 | 3309 | |
| 3310 | 3310 | // Delineation |
| 3311 | 3311 | $delineation_cord = $objAnswerTmp->selectHotspotCoordinates(1); |
| 3312 | - $answer_delineation_destination=$objAnswerTmp->selectDestination(1); |
|
| 3312 | + $answer_delineation_destination = $objAnswerTmp->selectDestination(1); |
|
| 3313 | 3313 | |
| 3314 | 3314 | switch ($answerType) { |
| 3315 | 3315 | // for unique answer |
@@ -3322,7 +3322,7 @@ discard block |
||
| 3322 | 3322 | exe_id = '".$exeId."' AND |
| 3323 | 3323 | question_id= '".$questionId."'"; |
| 3324 | 3324 | $result = Database::query($sql); |
| 3325 | - $choice = Database::result($result,0,"answer"); |
|
| 3325 | + $choice = Database::result($result, 0, "answer"); |
|
| 3326 | 3326 | |
| 3327 | 3327 | $studentChoice = $choice == $answerAutoId ? 1 : 0; |
| 3328 | 3328 | if ($studentChoice) { |
@@ -3373,7 +3373,7 @@ discard block |
||
| 3373 | 3373 | } else { |
| 3374 | 3374 | // If no result then the user just hit don't know |
| 3375 | 3375 | $studentChoice = 3; |
| 3376 | - $questionScore += $doubt_score; |
|
| 3376 | + $questionScore += $doubt_score; |
|
| 3377 | 3377 | } |
| 3378 | 3378 | $totalScore = $questionScore; |
| 3379 | 3379 | break; |
@@ -3389,17 +3389,17 @@ discard block |
||
| 3389 | 3389 | } |
| 3390 | 3390 | |
| 3391 | 3391 | $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null; |
| 3392 | - $real_answers[$answerId] = (bool)$studentChoice; |
|
| 3392 | + $real_answers[$answerId] = (bool) $studentChoice; |
|
| 3393 | 3393 | |
| 3394 | 3394 | if ($studentChoice) { |
| 3395 | - $questionScore +=$answerWeighting; |
|
| 3395 | + $questionScore += $answerWeighting; |
|
| 3396 | 3396 | } |
| 3397 | 3397 | } else { |
| 3398 | 3398 | $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null; |
| 3399 | - $real_answers[$answerId] = (bool)$studentChoice; |
|
| 3399 | + $real_answers[$answerId] = (bool) $studentChoice; |
|
| 3400 | 3400 | |
| 3401 | 3401 | if (isset($studentChoice)) { |
| 3402 | - $questionScore += $answerWeighting; |
|
| 3402 | + $questionScore += $answerWeighting; |
|
| 3403 | 3403 | } |
| 3404 | 3404 | } |
| 3405 | 3405 | $totalScore += $answerWeighting; |
@@ -3417,16 +3417,16 @@ discard block |
||
| 3417 | 3417 | $choice[$ind] = 1; |
| 3418 | 3418 | } |
| 3419 | 3419 | $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null; |
| 3420 | - $real_answers[$answerId] = (bool)$studentChoice; |
|
| 3420 | + $real_answers[$answerId] = (bool) $studentChoice; |
|
| 3421 | 3421 | if ($studentChoice) { |
| 3422 | - $questionScore +=$answerWeighting; |
|
| 3422 | + $questionScore += $answerWeighting; |
|
| 3423 | 3423 | } |
| 3424 | 3424 | } else { |
| 3425 | 3425 | $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null; |
| 3426 | 3426 | if (isset($studentChoice)) { |
| 3427 | 3427 | $questionScore += $answerWeighting; |
| 3428 | 3428 | } |
| 3429 | - $real_answers[$answerId] = (bool)$studentChoice; |
|
| 3429 | + $real_answers[$answerId] = (bool) $studentChoice; |
|
| 3430 | 3430 | } |
| 3431 | 3431 | $totalScore += $answerWeighting; |
| 3432 | 3432 | if ($debug) error_log("studentChoice: $studentChoice"); |
@@ -3438,7 +3438,7 @@ discard block |
||
| 3438 | 3438 | $resultans = Database::query($sql); |
| 3439 | 3439 | while ($row = Database::fetch_array($resultans)) { |
| 3440 | 3440 | $ind = $row['answer']; |
| 3441 | - $result = explode(':',$ind); |
|
| 3441 | + $result = explode(':', $ind); |
|
| 3442 | 3442 | if (isset($result[0])) { |
| 3443 | 3443 | $my_answer_id = isset($result[0]) ? $result[0] : ''; |
| 3444 | 3444 | $option = isset($result[1]) ? $result[1] : ''; |
@@ -3559,10 +3559,10 @@ discard block |
||
| 3559 | 3559 | } |
| 3560 | 3560 | // adds the piece of text that is before the blank |
| 3561 | 3561 | //and ends with '[' into a general storage array |
| 3562 | - $real_text[] = api_substr($temp, 0, $pos +1); |
|
| 3563 | - $answer .= api_substr($temp, 0, $pos +1); |
|
| 3562 | + $real_text[] = api_substr($temp, 0, $pos + 1); |
|
| 3563 | + $answer .= api_substr($temp, 0, $pos + 1); |
|
| 3564 | 3564 | //take the string remaining (after the last "[" we found) |
| 3565 | - $temp = api_substr($temp, $pos +1); |
|
| 3565 | + $temp = api_substr($temp, $pos + 1); |
|
| 3566 | 3566 | // quit the loop if there are no more blanks, and update $pos to the position of next ']' |
| 3567 | 3567 | if (($pos = api_strpos($temp, ']')) === false) { |
| 3568 | 3568 | // adds the end of the text |
@@ -3598,7 +3598,7 @@ discard block |
||
| 3598 | 3598 | //put the contents of the [] answer tag into correct_tags[] |
| 3599 | 3599 | $correct_tags[] = api_substr($temp, 0, $pos); |
| 3600 | 3600 | $j++; |
| 3601 | - $temp = api_substr($temp, $pos +1); |
|
| 3601 | + $temp = api_substr($temp, $pos + 1); |
|
| 3602 | 3602 | } |
| 3603 | 3603 | $answer = ''; |
| 3604 | 3604 | $real_correct_tags = $correct_tags; |
@@ -3621,7 +3621,7 @@ discard block |
||
| 3621 | 3621 | } elseif (!empty($user_tags[$i])) { |
| 3622 | 3622 | // else if the word entered by the student IS NOT the same as the one defined by the professor |
| 3623 | 3623 | // adds the word in red at the end of the string, and strikes it |
| 3624 | - $answer .= '<font color="red"><s>' . $user_tags[$i] . '</s></font>'; |
|
| 3624 | + $answer .= '<font color="red"><s>'.$user_tags[$i].'</s></font>'; |
|
| 3625 | 3625 | } else { |
| 3626 | 3626 | // adds a tabulation if no word has been typed by the student |
| 3627 | 3627 | $answer .= ''; // remove that causes issue |
@@ -3640,17 +3640,17 @@ discard block |
||
| 3640 | 3640 | } elseif (!empty ($user_tags[$i])) { |
| 3641 | 3641 | // else if the word entered by the student IS NOT the same as the one defined by the professor |
| 3642 | 3642 | // adds the word in red at the end of the string, and strikes it |
| 3643 | - $answer .= '<font color="red"><s>' . $user_tags[$i] . '</s></font>'; |
|
| 3643 | + $answer .= '<font color="red"><s>'.$user_tags[$i].'</s></font>'; |
|
| 3644 | 3644 | } else { |
| 3645 | 3645 | // adds a tabulation if no word has been typed by the student |
| 3646 | - $answer .= ''; // remove that causes issue |
|
| 3646 | + $answer .= ''; // remove that causes issue |
|
| 3647 | 3647 | } |
| 3648 | 3648 | } |
| 3649 | 3649 | |
| 3650 | 3650 | // adds the correct word, followed by ] to close the blank |
| 3651 | - $answer .= ' / <font color="green"><b>' . $real_correct_tags[$i] . '</b></font>]'; |
|
| 3652 | - if (isset($real_text[$i +1])) { |
|
| 3653 | - $answer .= $real_text[$i +1]; |
|
| 3651 | + $answer .= ' / <font color="green"><b>'.$real_correct_tags[$i].'</b></font>]'; |
|
| 3652 | + if (isset($real_text[$i + 1])) { |
|
| 3653 | + $answer .= $real_text[$i + 1]; |
|
| 3654 | 3654 | } |
| 3655 | 3655 | } |
| 3656 | 3656 | } else { |
@@ -3791,10 +3791,10 @@ discard block |
||
| 3791 | 3791 | } |
| 3792 | 3792 | // adds the piece of text that is before the blank |
| 3793 | 3793 | //and ends with '[' into a general storage array |
| 3794 | - $realText[] = api_substr($temp, 0, $pos +1); |
|
| 3795 | - $answer .= api_substr($temp, 0, $pos +1); |
|
| 3794 | + $realText[] = api_substr($temp, 0, $pos + 1); |
|
| 3795 | + $answer .= api_substr($temp, 0, $pos + 1); |
|
| 3796 | 3796 | //take the string remaining (after the last "[" we found) |
| 3797 | - $temp = api_substr($temp, $pos +1); |
|
| 3797 | + $temp = api_substr($temp, $pos + 1); |
|
| 3798 | 3798 | // quit the loop if there are no more blanks, and update $pos to the position of next ']' |
| 3799 | 3799 | if (($pos = api_strpos($temp, ']')) === false) { |
| 3800 | 3800 | // adds the end of the text |
@@ -3828,7 +3828,7 @@ discard block |
||
| 3828 | 3828 | //put the contents of the [] answer tag into correct_tags[] |
| 3829 | 3829 | $correctTags[] = api_substr($temp, 0, $pos); |
| 3830 | 3830 | $j++; |
| 3831 | - $temp = api_substr($temp, $pos +1); |
|
| 3831 | + $temp = api_substr($temp, $pos + 1); |
|
| 3832 | 3832 | } |
| 3833 | 3833 | $answer = ''; |
| 3834 | 3834 | $realCorrectTags = $correctTags; |
@@ -3858,22 +3858,22 @@ discard block |
||
| 3858 | 3858 | } elseif (!empty($userTags[$i])) { |
| 3859 | 3859 | // else if the word entered by the student IS NOT the same as the one defined by the professor |
| 3860 | 3860 | // adds the word in red at the end of the string, and strikes it |
| 3861 | - $answer .= '<font color="red"><s>' . $userTags[$i] . '</s></font>'; |
|
| 3861 | + $answer .= '<font color="red"><s>'.$userTags[$i].'</s></font>'; |
|
| 3862 | 3862 | } else { |
| 3863 | 3863 | // adds a tabulation if no word has been typed by the student |
| 3864 | 3864 | $answer .= ''; // remove that causes issue |
| 3865 | 3865 | } |
| 3866 | 3866 | // adds the correct word, followed by ] to close the blank |
| 3867 | - $answer .= ' / <font color="green"><b>' . $realCorrectTags[$i] . '</b></font>]'; |
|
| 3868 | - if (isset($realText[$i +1])) { |
|
| 3869 | - $answer .= $realText[$i +1]; |
|
| 3867 | + $answer .= ' / <font color="green"><b>'.$realCorrectTags[$i].'</b></font>]'; |
|
| 3868 | + if (isset($realText[$i + 1])) { |
|
| 3869 | + $answer .= $realText[$i + 1]; |
|
| 3870 | 3870 | } |
| 3871 | 3871 | } |
| 3872 | 3872 | break; |
| 3873 | 3873 | // for free answer |
| 3874 | 3874 | case FREE_ANSWER: |
| 3875 | 3875 | if ($from_database) { |
| 3876 | - $query = "SELECT answer, marks FROM ".$TBL_TRACK_ATTEMPT." |
|
| 3876 | + $query = "SELECT answer, marks FROM ".$TBL_TRACK_ATTEMPT." |
|
| 3877 | 3877 | WHERE exe_id = '".$exeId."' AND question_id= '".$questionId."'"; |
| 3878 | 3878 | $resq = Database::query($query); |
| 3879 | 3879 | $data = Database::fetch_array($resq); |
@@ -3884,9 +3884,9 @@ discard block |
||
| 3884 | 3884 | $questionScore = $data['marks']; |
| 3885 | 3885 | |
| 3886 | 3886 | if ($questionScore == -1) { |
| 3887 | - $totalScore+= 0; |
|
| 3887 | + $totalScore += 0; |
|
| 3888 | 3888 | } else { |
| 3889 | - $totalScore+= $questionScore; |
|
| 3889 | + $totalScore += $questionScore; |
|
| 3890 | 3890 | } |
| 3891 | 3891 | if ($questionScore == '') { |
| 3892 | 3892 | $questionScore = 0; |
@@ -3907,14 +3907,14 @@ discard block |
||
| 3907 | 3907 | $query = "SELECT answer, marks FROM ".$TBL_TRACK_ATTEMPT." |
| 3908 | 3908 | WHERE exe_id = '".$exeId."' AND question_id= '".$questionId."'"; |
| 3909 | 3909 | $resq = Database::query($query); |
| 3910 | - $choice = Database::result($resq,0,'answer'); |
|
| 3910 | + $choice = Database::result($resq, 0, 'answer'); |
|
| 3911 | 3911 | $choice = str_replace('\r\n', '', $choice); |
| 3912 | 3912 | $choice = stripslashes($choice); |
| 3913 | - $questionScore = Database::result($resq,0,"marks"); |
|
| 3914 | - if ($questionScore==-1) { |
|
| 3915 | - $totalScore+=0; |
|
| 3913 | + $questionScore = Database::result($resq, 0, "marks"); |
|
| 3914 | + if ($questionScore == -1) { |
|
| 3915 | + $totalScore += 0; |
|
| 3916 | 3916 | } else { |
| 3917 | - $totalScore+=$questionScore; |
|
| 3917 | + $totalScore += $questionScore; |
|
| 3918 | 3918 | } |
| 3919 | 3919 | $arrques = $questionName; |
| 3920 | 3920 | $arrans = $choice; |
@@ -3959,7 +3959,7 @@ discard block |
||
| 3959 | 3959 | |
| 3960 | 3960 | while ($a_answers = Database::fetch_array($res_answers)) { |
| 3961 | 3961 | $i_answer_id = $a_answers['id']; //3 |
| 3962 | - $s_answer_label = $a_answers['answer']; // your daddy - your mother |
|
| 3962 | + $s_answer_label = $a_answers['answer']; // your daddy - your mother |
|
| 3963 | 3963 | $i_answer_correct_answer = $a_answers['correct']; //1 - 2 |
| 3964 | 3964 | $i_answer_id_auto = $a_answers['id_auto']; // 3 - 4 |
| 3965 | 3965 | |
@@ -4011,8 +4011,8 @@ discard block |
||
| 4011 | 4011 | |
| 4012 | 4012 | if ($show_result) { |
| 4013 | 4013 | echo '<tr>'; |
| 4014 | - echo '<td>' . $s_answer_label . '</td>'; |
|
| 4015 | - echo '<td>' . $user_answer; |
|
| 4014 | + echo '<td>'.$s_answer_label.'</td>'; |
|
| 4015 | + echo '<td>'.$user_answer; |
|
| 4016 | 4016 | |
| 4017 | 4017 | if (in_array($answerType, [MATCHING, MATCHING_DRAGGABLE])) { |
| 4018 | 4018 | if (isset($real_list[$i_answer_correct_answer])) { |
@@ -4121,7 +4121,7 @@ discard block |
||
| 4121 | 4121 | if ($from_database) { |
| 4122 | 4122 | // getting the user answer |
| 4123 | 4123 | $TBL_TRACK_HOTSPOT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT); |
| 4124 | - $query = "SELECT hotspot_correct, hotspot_coordinate |
|
| 4124 | + $query = "SELECT hotspot_correct, hotspot_coordinate |
|
| 4125 | 4125 | FROM $TBL_TRACK_HOTSPOT |
| 4126 | 4126 | WHERE |
| 4127 | 4127 | hotspot_exe_id = '".$exeId."' AND |
@@ -4129,20 +4129,20 @@ discard block |
||
| 4129 | 4129 | hotspot_answer_id='1'"; |
| 4130 | 4130 | //by default we take 1 because it's a delineation |
| 4131 | 4131 | $resq = Database::query($query); |
| 4132 | - $row = Database::fetch_array($resq,'ASSOC'); |
|
| 4132 | + $row = Database::fetch_array($resq, 'ASSOC'); |
|
| 4133 | 4133 | |
| 4134 | 4134 | $choice = $row['hotspot_correct']; |
| 4135 | 4135 | $user_answer = $row['hotspot_coordinate']; |
| 4136 | 4136 | |
| 4137 | 4137 | // THIS is very important otherwise the poly_compile will throw an error!! |
| 4138 | 4138 | // round-up the coordinates |
| 4139 | - $coords = explode('/',$user_answer); |
|
| 4139 | + $coords = explode('/', $user_answer); |
|
| 4140 | 4140 | $user_array = ''; |
| 4141 | 4141 | foreach ($coords as $coord) { |
| 4142 | - list($x,$y) = explode(';',$coord); |
|
| 4142 | + list($x, $y) = explode(';', $coord); |
|
| 4143 | 4143 | $user_array .= round($x).';'.round($y).'/'; |
| 4144 | 4144 | } |
| 4145 | - $user_array = substr($user_array,0,-1); |
|
| 4145 | + $user_array = substr($user_array, 0, -1); |
|
| 4146 | 4146 | } else { |
| 4147 | 4147 | if (!empty($studentChoice)) { |
| 4148 | 4148 | $newquestionList[] = $questionId; |
@@ -4152,13 +4152,13 @@ discard block |
||
| 4152 | 4152 | $studentChoice = $choice[$answerId]; |
| 4153 | 4153 | $questionScore += $answerWeighting; |
| 4154 | 4154 | |
| 4155 | - if ($hotspot_delineation_result[1]==1) { |
|
| 4155 | + if ($hotspot_delineation_result[1] == 1) { |
|
| 4156 | 4156 | $totalScore += $answerWeighting; //adding the total |
| 4157 | 4157 | } |
| 4158 | 4158 | } |
| 4159 | 4159 | } |
| 4160 | - $_SESSION['hotspot_coord'][1] = $delineation_cord; |
|
| 4161 | - $_SESSION['hotspot_dest'][1] = $answer_delineation_destination; |
|
| 4160 | + $_SESSION['hotspot_coord'][1] = $delineation_cord; |
|
| 4161 | + $_SESSION['hotspot_dest'][1] = $answer_delineation_destination; |
|
| 4162 | 4162 | break; |
| 4163 | 4163 | } // end switch Answertype |
| 4164 | 4164 | |
@@ -4216,7 +4216,7 @@ discard block |
||
| 4216 | 4216 | $results_disabled |
| 4217 | 4217 | ); |
| 4218 | 4218 | //} |
| 4219 | - } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE ) { |
|
| 4219 | + } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) { |
|
| 4220 | 4220 | // if ($origin!='learnpath') { |
| 4221 | 4221 | ExerciseShowFunctions::display_multiple_answer_combination_true_false( |
| 4222 | 4222 | $feedback_type, |
@@ -4233,11 +4233,11 @@ discard block |
||
| 4233 | 4233 | //} |
| 4234 | 4234 | } elseif ($answerType == FILL_IN_BLANKS) { |
| 4235 | 4235 | //if ($origin!='learnpath') { |
| 4236 | - ExerciseShowFunctions::display_fill_in_blanks_answer($feedback_type, $answer,0,0, $results_disabled); |
|
| 4236 | + ExerciseShowFunctions::display_fill_in_blanks_answer($feedback_type, $answer, 0, 0, $results_disabled); |
|
| 4237 | 4237 | // } |
| 4238 | 4238 | } elseif ($answerType == CALCULATED_ANSWER) { |
| 4239 | 4239 | //if ($origin!='learnpath') { |
| 4240 | - ExerciseShowFunctions::display_calculated_answer($feedback_type, $answer,0,0); |
|
| 4240 | + ExerciseShowFunctions::display_calculated_answer($feedback_type, $answer, 0, 0); |
|
| 4241 | 4241 | // } |
| 4242 | 4242 | } elseif ($answerType == FREE_ANSWER) { |
| 4243 | 4243 | //if($origin != 'learnpath') { |
@@ -4291,13 +4291,13 @@ discard block |
||
| 4291 | 4291 | $user_answer = $_SESSION['exerciseResultCoordinates'][$questionId]; |
| 4292 | 4292 | |
| 4293 | 4293 | //round-up the coordinates |
| 4294 | - $coords = explode('/',$user_answer); |
|
| 4294 | + $coords = explode('/', $user_answer); |
|
| 4295 | 4295 | $user_array = ''; |
| 4296 | 4296 | foreach ($coords as $coord) { |
| 4297 | - list($x,$y) = explode(';',$coord); |
|
| 4297 | + list($x, $y) = explode(';', $coord); |
|
| 4298 | 4298 | $user_array .= round($x).';'.round($y).'/'; |
| 4299 | 4299 | } |
| 4300 | - $user_array = substr($user_array,0,-1); |
|
| 4300 | + $user_array = substr($user_array, 0, -1); |
|
| 4301 | 4301 | |
| 4302 | 4302 | if ($next) { |
| 4303 | 4303 | |
@@ -4324,7 +4324,7 @@ discard block |
||
| 4324 | 4324 | //$overlap = round(polygons_overlap($poly_answer,$poly_user)); |
| 4325 | 4325 | // //this is an area in pixels |
| 4326 | 4326 | if ($debug > 0) { |
| 4327 | - error_log(__LINE__ . ' - Polygons results are ' . print_r($poly_results, 1), 0); |
|
| 4327 | + error_log(__LINE__.' - Polygons results are '.print_r($poly_results, 1), 0); |
|
| 4328 | 4328 | } |
| 4329 | 4329 | |
| 4330 | 4330 | if ($overlap < 1) { |
@@ -4337,43 +4337,43 @@ discard block |
||
| 4337 | 4337 | // that is overlapped by the user's polygon |
| 4338 | 4338 | $final_overlap = round(((float) $overlap / (float) $poly_answer_area) * 100); |
| 4339 | 4339 | if ($debug > 1) { |
| 4340 | - error_log(__LINE__ . ' - Final overlap is ' . $final_overlap, 0); |
|
| 4340 | + error_log(__LINE__.' - Final overlap is '.$final_overlap, 0); |
|
| 4341 | 4341 | } |
| 4342 | 4342 | // the final missing area is the percentage of the initial polygon |
| 4343 | 4343 | // that is not overlapped by the user's polygon |
| 4344 | 4344 | $final_missing = 100 - $final_overlap; |
| 4345 | 4345 | if ($debug > 1) { |
| 4346 | - error_log(__LINE__ . ' - Final missing is ' . $final_missing, 0); |
|
| 4346 | + error_log(__LINE__.' - Final missing is '.$final_missing, 0); |
|
| 4347 | 4347 | } |
| 4348 | 4348 | // the final excess area is the percentage of the initial polygon's size |
| 4349 | 4349 | // that is covered by the user's polygon outside of the initial polygon |
| 4350 | 4350 | $final_excess = round((((float) $poly_user_area - (float) $overlap) / (float) $poly_answer_area) * 100); |
| 4351 | 4351 | if ($debug > 1) { |
| 4352 | - error_log(__LINE__ . ' - Final excess is ' . $final_excess, 0); |
|
| 4352 | + error_log(__LINE__.' - Final excess is '.$final_excess, 0); |
|
| 4353 | 4353 | } |
| 4354 | 4354 | } |
| 4355 | 4355 | |
| 4356 | 4356 | //checking the destination parameters parsing the "@@" |
| 4357 | - $destination_items= explode('@@', $answerDestination); |
|
| 4357 | + $destination_items = explode('@@', $answerDestination); |
|
| 4358 | 4358 | $threadhold_total = $destination_items[0]; |
| 4359 | - $threadhold_items=explode(';',$threadhold_total); |
|
| 4359 | + $threadhold_items = explode(';', $threadhold_total); |
|
| 4360 | 4360 | $threadhold1 = $threadhold_items[0]; // overlap |
| 4361 | 4361 | $threadhold2 = $threadhold_items[1]; // excess |
| 4362 | - $threadhold3 = $threadhold_items[2]; //missing |
|
| 4362 | + $threadhold3 = $threadhold_items[2]; //missing |
|
| 4363 | 4363 | |
| 4364 | 4364 | // if is delineation |
| 4365 | - if ($answerId===1) { |
|
| 4365 | + if ($answerId === 1) { |
|
| 4366 | 4366 | //setting colors |
| 4367 | - if ($final_overlap>=$threadhold1) { |
|
| 4368 | - $overlap_color=true; //echo 'a'; |
|
| 4367 | + if ($final_overlap >= $threadhold1) { |
|
| 4368 | + $overlap_color = true; //echo 'a'; |
|
| 4369 | 4369 | } |
| 4370 | 4370 | //echo $excess.'-'.$threadhold2; |
| 4371 | - if ($final_excess<=$threadhold2) { |
|
| 4372 | - $excess_color=true; //echo 'b'; |
|
| 4371 | + if ($final_excess <= $threadhold2) { |
|
| 4372 | + $excess_color = true; //echo 'b'; |
|
| 4373 | 4373 | } |
| 4374 | 4374 | //echo '--------'.$missing.'-'.$threadhold3; |
| 4375 | - if ($final_missing<=$threadhold3) { |
|
| 4376 | - $missing_color=true; //echo 'c'; |
|
| 4375 | + if ($final_missing <= $threadhold3) { |
|
| 4376 | + $missing_color = true; //echo 'c'; |
|
| 4377 | 4377 | } |
| 4378 | 4378 | |
| 4379 | 4379 | // if pass |
@@ -4382,67 +4382,67 @@ discard block |
||
| 4382 | 4382 | $final_missing <= $threadhold3 && |
| 4383 | 4383 | $final_excess <= $threadhold2 |
| 4384 | 4384 | ) { |
| 4385 | - $next=1; //go to the oars |
|
| 4386 | - $result_comment=get_lang('Acceptable'); |
|
| 4387 | - $final_answer = 1; // do not update with update_exercise_attempt |
|
| 4385 | + $next = 1; //go to the oars |
|
| 4386 | + $result_comment = get_lang('Acceptable'); |
|
| 4387 | + $final_answer = 1; // do not update with update_exercise_attempt |
|
| 4388 | 4388 | } else { |
| 4389 | - $next=0; |
|
| 4390 | - $result_comment=get_lang('Unacceptable'); |
|
| 4391 | - $comment=$answerDestination=$objAnswerTmp->selectComment(1); |
|
| 4392 | - $answerDestination=$objAnswerTmp->selectDestination(1); |
|
| 4389 | + $next = 0; |
|
| 4390 | + $result_comment = get_lang('Unacceptable'); |
|
| 4391 | + $comment = $answerDestination = $objAnswerTmp->selectComment(1); |
|
| 4392 | + $answerDestination = $objAnswerTmp->selectDestination(1); |
|
| 4393 | 4393 | //checking the destination parameters parsing the "@@" |
| 4394 | - $destination_items= explode('@@', $answerDestination); |
|
| 4394 | + $destination_items = explode('@@', $answerDestination); |
|
| 4395 | 4395 | } |
| 4396 | - } elseif($answerId>1) { |
|
| 4396 | + } elseif ($answerId > 1) { |
|
| 4397 | 4397 | if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') { |
| 4398 | - if ($debug>0) { |
|
| 4399 | - error_log(__LINE__.' - answerId is of type noerror',0); |
|
| 4398 | + if ($debug > 0) { |
|
| 4399 | + error_log(__LINE__.' - answerId is of type noerror', 0); |
|
| 4400 | 4400 | } |
| 4401 | 4401 | //type no error shouldn't be treated |
| 4402 | 4402 | $next = 1; |
| 4403 | 4403 | continue; |
| 4404 | 4404 | } |
| 4405 | - if ($debug>0) { |
|
| 4406 | - error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR',0); |
|
| 4405 | + if ($debug > 0) { |
|
| 4406 | + error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR', 0); |
|
| 4407 | 4407 | } |
| 4408 | 4408 | //check the intersection between the oar and the user |
| 4409 | 4409 | //echo 'user'; print_r($x_user_list); print_r($y_user_list); |
| 4410 | 4410 | //echo 'official';print_r($x_list);print_r($y_list); |
| 4411 | 4411 | //$result = get_intersection_data($x_list,$y_list,$x_user_list,$y_user_list); |
| 4412 | - $inter= $result['success']; |
|
| 4412 | + $inter = $result['success']; |
|
| 4413 | 4413 | |
| 4414 | 4414 | //$delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId); |
| 4415 | - $delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId); |
|
| 4415 | + $delineation_cord = $objAnswerTmp->selectHotspotCoordinates($answerId); |
|
| 4416 | 4416 | |
| 4417 | - $poly_answer = convert_coordinates($delineation_cord,'|'); |
|
| 4418 | - $max_coord = poly_get_max($poly_user,$poly_answer); |
|
| 4419 | - $poly_answer_compiled = poly_compile($poly_answer,$max_coord); |
|
| 4420 | - $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled,$max_coord); |
|
| 4417 | + $poly_answer = convert_coordinates($delineation_cord, '|'); |
|
| 4418 | + $max_coord = poly_get_max($poly_user, $poly_answer); |
|
| 4419 | + $poly_answer_compiled = poly_compile($poly_answer, $max_coord); |
|
| 4420 | + $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled, $max_coord); |
|
| 4421 | 4421 | |
| 4422 | 4422 | if ($overlap == false) { |
| 4423 | 4423 | //all good, no overlap |
| 4424 | 4424 | $next = 1; |
| 4425 | 4425 | continue; |
| 4426 | 4426 | } else { |
| 4427 | - if ($debug>0) { |
|
| 4428 | - error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit',0); |
|
| 4427 | + if ($debug > 0) { |
|
| 4428 | + error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit', 0); |
|
| 4429 | 4429 | } |
| 4430 | 4430 | $organs_at_risk_hit++; |
| 4431 | 4431 | //show the feedback |
| 4432 | - $next=0; |
|
| 4433 | - $comment=$answerDestination=$objAnswerTmp->selectComment($answerId); |
|
| 4434 | - $answerDestination=$objAnswerTmp->selectDestination($answerId); |
|
| 4435 | - |
|
| 4436 | - $destination_items= explode('@@', $answerDestination); |
|
| 4437 | - $try_hotspot=$destination_items[1]; |
|
| 4438 | - $lp_hotspot=$destination_items[2]; |
|
| 4439 | - $select_question_hotspot=$destination_items[3]; |
|
| 4440 | - $url_hotspot=$destination_items[4]; |
|
| 4432 | + $next = 0; |
|
| 4433 | + $comment = $answerDestination = $objAnswerTmp->selectComment($answerId); |
|
| 4434 | + $answerDestination = $objAnswerTmp->selectDestination($answerId); |
|
| 4435 | + |
|
| 4436 | + $destination_items = explode('@@', $answerDestination); |
|
| 4437 | + $try_hotspot = $destination_items[1]; |
|
| 4438 | + $lp_hotspot = $destination_items[2]; |
|
| 4439 | + $select_question_hotspot = $destination_items[3]; |
|
| 4440 | + $url_hotspot = $destination_items[4]; |
|
| 4441 | 4441 | } |
| 4442 | 4442 | } |
| 4443 | 4443 | } else { // the first delineation feedback |
| 4444 | - if ($debug>0) { |
|
| 4445 | - error_log(__LINE__.' first',0); |
|
| 4444 | + if ($debug > 0) { |
|
| 4445 | + error_log(__LINE__.' first', 0); |
|
| 4446 | 4446 | } |
| 4447 | 4447 | } |
| 4448 | 4448 | } elseif (in_array($answerType, [MATCHING, MATCHING_DRAGGABLE])) { |
@@ -4450,7 +4450,7 @@ discard block |
||
| 4450 | 4450 | echo Display::tag('td', $answerMatching[$answerId]); |
| 4451 | 4451 | echo Display::tag( |
| 4452 | 4452 | 'td', |
| 4453 | - "$user_answer / " . Display::tag( |
|
| 4453 | + "$user_answer / ".Display::tag( |
|
| 4454 | 4454 | 'strong', |
| 4455 | 4455 | $answerMatching[$answerCorrect], |
| 4456 | 4456 | ['style' => 'color: #008000; font-weight: bold;'] |
@@ -4590,7 +4590,7 @@ discard block |
||
| 4590 | 4590 | $exeId, |
| 4591 | 4591 | $questionId, |
| 4592 | 4592 | $nano |
| 4593 | - ) . '</td> |
|
| 4593 | + ).'</td> |
|
| 4594 | 4594 | </tr> |
| 4595 | 4595 | </table>'; |
| 4596 | 4596 | break; |
@@ -4649,7 +4649,7 @@ discard block |
||
| 4649 | 4649 | |
| 4650 | 4650 | //$overlap = round(polygons_overlap($poly_answer,$poly_user)); //this is an area in pixels |
| 4651 | 4651 | if ($debug > 0) { |
| 4652 | - error_log(__LINE__ . ' - Polygons results are ' . print_r($poly_results, 1), 0); |
|
| 4652 | + error_log(__LINE__.' - Polygons results are '.print_r($poly_results, 1), 0); |
|
| 4653 | 4653 | } |
| 4654 | 4654 | if ($overlap < 1) { |
| 4655 | 4655 | //shortcut to avoid complicated calculations |
@@ -4660,17 +4660,17 @@ discard block |
||
| 4660 | 4660 | // the final overlap is the percentage of the initial polygon that is overlapped by the user's polygon |
| 4661 | 4661 | $final_overlap = round(((float) $overlap / (float) $poly_answer_area) * 100); |
| 4662 | 4662 | if ($debug > 1) { |
| 4663 | - error_log(__LINE__ . ' - Final overlap is ' . $final_overlap, 0); |
|
| 4663 | + error_log(__LINE__.' - Final overlap is '.$final_overlap, 0); |
|
| 4664 | 4664 | } |
| 4665 | 4665 | // the final missing area is the percentage of the initial polygon that is not overlapped by the user's polygon |
| 4666 | 4666 | $final_missing = 100 - $final_overlap; |
| 4667 | 4667 | if ($debug > 1) { |
| 4668 | - error_log(__LINE__ . ' - Final missing is ' . $final_missing, 0); |
|
| 4668 | + error_log(__LINE__.' - Final missing is '.$final_missing, 0); |
|
| 4669 | 4669 | } |
| 4670 | 4670 | // the final excess area is the percentage of the initial polygon's size that is covered by the user's polygon outside of the initial polygon |
| 4671 | 4671 | $final_excess = round((((float) $poly_user_area - (float) $overlap) / (float) $poly_answer_area) * 100); |
| 4672 | 4672 | if ($debug > 1) { |
| 4673 | - error_log(__LINE__ . ' - Final excess is ' . $final_excess, 0); |
|
| 4673 | + error_log(__LINE__.' - Final excess is '.$final_excess, 0); |
|
| 4674 | 4674 | } |
| 4675 | 4675 | } |
| 4676 | 4676 | |
@@ -4680,7 +4680,7 @@ discard block |
||
| 4680 | 4680 | $threadhold_items = explode(';', $threadhold_total); |
| 4681 | 4681 | $threadhold1 = $threadhold_items[0]; // overlap |
| 4682 | 4682 | $threadhold2 = $threadhold_items[1]; // excess |
| 4683 | - $threadhold3 = $threadhold_items[2]; //missing |
|
| 4683 | + $threadhold3 = $threadhold_items[2]; //missing |
|
| 4684 | 4684 | // if is delineation |
| 4685 | 4685 | if ($answerId === 1) { |
| 4686 | 4686 | //setting colors |
@@ -4712,14 +4712,14 @@ discard block |
||
| 4712 | 4712 | } elseif ($answerId > 1) { |
| 4713 | 4713 | if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') { |
| 4714 | 4714 | if ($debug > 0) { |
| 4715 | - error_log(__LINE__ . ' - answerId is of type noerror', 0); |
|
| 4715 | + error_log(__LINE__.' - answerId is of type noerror', 0); |
|
| 4716 | 4716 | } |
| 4717 | 4717 | //type no error shouldn't be treated |
| 4718 | 4718 | $next = 1; |
| 4719 | 4719 | continue; |
| 4720 | 4720 | } |
| 4721 | 4721 | if ($debug > 0) { |
| 4722 | - error_log(__LINE__ . ' - answerId is >1 so we\'re probably in OAR', 0); |
|
| 4722 | + error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR', 0); |
|
| 4723 | 4723 | } |
| 4724 | 4724 | //check the intersection between the oar and the user |
| 4725 | 4725 | //echo 'user'; print_r($x_user_list); print_r($y_user_list); |
@@ -4733,7 +4733,7 @@ discard block |
||
| 4733 | 4733 | $poly_answer = convert_coordinates($delineation_cord, '|'); |
| 4734 | 4734 | $max_coord = poly_get_max($poly_user, $poly_answer); |
| 4735 | 4735 | $poly_answer_compiled = poly_compile($poly_answer, $max_coord); |
| 4736 | - $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled,$max_coord); |
|
| 4736 | + $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled, $max_coord); |
|
| 4737 | 4737 | |
| 4738 | 4738 | if ($overlap == false) { |
| 4739 | 4739 | //all good, no overlap |
@@ -4741,7 +4741,7 @@ discard block |
||
| 4741 | 4741 | continue; |
| 4742 | 4742 | } else { |
| 4743 | 4743 | if ($debug > 0) { |
| 4744 | - error_log(__LINE__ . ' - Overlap is ' . $overlap . ': OAR hit', 0); |
|
| 4744 | + error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit', 0); |
|
| 4745 | 4745 | } |
| 4746 | 4746 | $organs_at_risk_hit++; |
| 4747 | 4747 | //show the feedback |
@@ -4753,12 +4753,12 @@ discard block |
||
| 4753 | 4753 | $try_hotspot = $destination_items[1]; |
| 4754 | 4754 | $lp_hotspot = $destination_items[2]; |
| 4755 | 4755 | $select_question_hotspot = $destination_items[3]; |
| 4756 | - $url_hotspot=$destination_items[4]; |
|
| 4756 | + $url_hotspot = $destination_items[4]; |
|
| 4757 | 4757 | } |
| 4758 | 4758 | } |
| 4759 | 4759 | } else { // the first delineation feedback |
| 4760 | 4760 | if ($debug > 0) { |
| 4761 | - error_log(__LINE__ . ' first', 0); |
|
| 4761 | + error_log(__LINE__.' first', 0); |
|
| 4762 | 4762 | } |
| 4763 | 4763 | } |
| 4764 | 4764 | break; |
@@ -4780,7 +4780,7 @@ discard block |
||
| 4780 | 4780 | echo Display::tag('td', $answerMatching[$answerId]); |
| 4781 | 4781 | echo Display::tag( |
| 4782 | 4782 | 'td', |
| 4783 | - "$user_answer / " . Display::tag( |
|
| 4783 | + "$user_answer / ".Display::tag( |
|
| 4784 | 4784 | 'strong', |
| 4785 | 4785 | $answerMatching[$answerCorrect], |
| 4786 | 4786 | ['style' => 'color: #008000; font-weight: bold;'] |
@@ -4866,7 +4866,7 @@ discard block |
||
| 4866 | 4866 | // we use the results from the session (from_db=0) |
| 4867 | 4867 | // TODO Change this, because it is wrong to show the user |
| 4868 | 4868 | // some results that haven't been stored in the database yet |
| 4869 | - if ($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER || $answerType == HOT_SPOT_DELINEATION ) { |
|
| 4869 | + if ($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER || $answerType == HOT_SPOT_DELINEATION) { |
|
| 4870 | 4870 | |
| 4871 | 4871 | if ($debug) error_log('$from AND this is a hotspot kind of question '); |
| 4872 | 4872 | |
@@ -4875,19 +4875,19 @@ discard block |
||
| 4875 | 4875 | if ($answerType == HOT_SPOT_DELINEATION) { |
| 4876 | 4876 | if (0) { |
| 4877 | 4877 | if ($overlap_color) { |
| 4878 | - $overlap_color='green'; |
|
| 4878 | + $overlap_color = 'green'; |
|
| 4879 | 4879 | } else { |
| 4880 | - $overlap_color='red'; |
|
| 4880 | + $overlap_color = 'red'; |
|
| 4881 | 4881 | } |
| 4882 | 4882 | if ($missing_color) { |
| 4883 | - $missing_color='green'; |
|
| 4883 | + $missing_color = 'green'; |
|
| 4884 | 4884 | } else { |
| 4885 | - $missing_color='red'; |
|
| 4885 | + $missing_color = 'red'; |
|
| 4886 | 4886 | } |
| 4887 | 4887 | if ($excess_color) { |
| 4888 | - $excess_color='green'; |
|
| 4888 | + $excess_color = 'green'; |
|
| 4889 | 4889 | } else { |
| 4890 | - $excess_color='red'; |
|
| 4890 | + $excess_color = 'red'; |
|
| 4891 | 4891 | } |
| 4892 | 4892 | if (!is_numeric($final_overlap)) { |
| 4893 | 4893 | $final_overlap = 0; |
@@ -4899,33 +4899,33 @@ discard block |
||
| 4899 | 4899 | $final_excess = 0; |
| 4900 | 4900 | } |
| 4901 | 4901 | |
| 4902 | - if ($final_overlap>100) { |
|
| 4902 | + if ($final_overlap > 100) { |
|
| 4903 | 4903 | $final_overlap = 100; |
| 4904 | 4904 | } |
| 4905 | 4905 | |
| 4906 | - $table_resume='<table class="data_table"> |
|
| 4906 | + $table_resume = '<table class="data_table"> |
|
| 4907 | 4907 | <tr class="row_odd" > |
| 4908 | 4908 | <td></td> |
| 4909 | - <td ><b>' . get_lang('Requirements') . '</b></td> |
|
| 4910 | - <td><b>' . get_lang('YourAnswer') . '</b></td> |
|
| 4909 | + <td ><b>' . get_lang('Requirements').'</b></td> |
|
| 4910 | + <td><b>' . get_lang('YourAnswer').'</b></td> |
|
| 4911 | 4911 | </tr> |
| 4912 | 4912 | <tr class="row_even"> |
| 4913 | - <td><b>' . get_lang('Overlap') . '</b></td> |
|
| 4914 | - <td>' . get_lang('Min') . ' ' . $threadhold1 . '</td> |
|
| 4915 | - <td><div style="color:' . $overlap_color . '">' |
|
| 4916 | - . (($final_overlap < 0) ? 0 : intval($final_overlap)) . '</div></td> |
|
| 4913 | + <td><b>' . get_lang('Overlap').'</b></td> |
|
| 4914 | + <td>' . get_lang('Min').' '.$threadhold1.'</td> |
|
| 4915 | + <td><div style="color:' . $overlap_color.'">' |
|
| 4916 | + . (($final_overlap < 0) ? 0 : intval($final_overlap)).'</div></td> |
|
| 4917 | 4917 | </tr> |
| 4918 | 4918 | <tr> |
| 4919 | - <td><b>' . get_lang('Excess') . '</b></td> |
|
| 4920 | - <td>' . get_lang('Max') . ' ' . $threadhold2 . '</td> |
|
| 4921 | - <td><div style="color:' . $excess_color . '">' |
|
| 4922 | - . (($final_excess < 0) ? 0 : intval($final_excess)) . '</div></td> |
|
| 4919 | + <td><b>' . get_lang('Excess').'</b></td> |
|
| 4920 | + <td>' . get_lang('Max').' '.$threadhold2.'</td> |
|
| 4921 | + <td><div style="color:' . $excess_color.'">' |
|
| 4922 | + . (($final_excess < 0) ? 0 : intval($final_excess)).'</div></td> |
|
| 4923 | 4923 | </tr> |
| 4924 | 4924 | <tr class="row_even"> |
| 4925 | - <td><b>' . get_lang('Missing') . '</b></td> |
|
| 4926 | - <td>' . get_lang('Max') . ' ' . $threadhold3 . '</td> |
|
| 4927 | - <td><div style="color:' . $missing_color . '">' |
|
| 4928 | - . (($final_missing < 0) ? 0 : intval($final_missing)) . '</div></td> |
|
| 4925 | + <td><b>' . get_lang('Missing').'</b></td> |
|
| 4926 | + <td>' . get_lang('Max').' '.$threadhold3.'</td> |
|
| 4927 | + <td><div style="color:' . $missing_color.'">' |
|
| 4928 | + . (($final_missing < 0) ? 0 : intval($final_missing)).'</div></td> |
|
| 4929 | 4929 | </tr> |
| 4930 | 4930 | </table>'; |
| 4931 | 4931 | if ($next == 0) { |
@@ -4940,20 +4940,20 @@ discard block |
||
| 4940 | 4940 | $answerDestination = $objAnswerTmp->selectDestination($nbrAnswers); |
| 4941 | 4941 | } |
| 4942 | 4942 | |
| 4943 | - echo '<h1><div style="color:#333;">' . get_lang('Feedback') . '</div></h1> |
|
| 4943 | + echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1> |
|
| 4944 | 4944 | <p style="text-align:center">'; |
| 4945 | 4945 | |
| 4946 | - $message = '<p>' . get_lang('YourDelineation') . '</p>'; |
|
| 4946 | + $message = '<p>'.get_lang('YourDelineation').'</p>'; |
|
| 4947 | 4947 | $message .= $table_resume; |
| 4948 | - $message .= '<br />' . get_lang('ResultIs') . ' ' . $result_comment . '<br />'; |
|
| 4948 | + $message .= '<br />'.get_lang('ResultIs').' '.$result_comment.'<br />'; |
|
| 4949 | 4949 | if ($organs_at_risk_hit > 0) { |
| 4950 | - $message .= '<p><b>' . get_lang('OARHit') . '</b></p>'; |
|
| 4950 | + $message .= '<p><b>'.get_lang('OARHit').'</b></p>'; |
|
| 4951 | 4951 | } |
| 4952 | - $message .='<p>' . $comment . '</p>'; |
|
| 4952 | + $message .= '<p>'.$comment.'</p>'; |
|
| 4953 | 4953 | echo $message; |
| 4954 | 4954 | } else { |
| 4955 | 4955 | echo $hotspot_delineation_result[0]; //prints message |
| 4956 | - $from_database = 1; // the hotspot_solution.swf needs this variable |
|
| 4956 | + $from_database = 1; // the hotspot_solution.swf needs this variable |
|
| 4957 | 4957 | } |
| 4958 | 4958 | |
| 4959 | 4959 | //save the score attempts |
@@ -4975,20 +4975,20 @@ discard block |
||
| 4975 | 4975 | $exerciseResultCoordinates[$quesId] |
| 4976 | 4976 | ); |
| 4977 | 4977 | } else { |
| 4978 | - if ($final_answer==0) { |
|
| 4978 | + if ($final_answer == 0) { |
|
| 4979 | 4979 | $questionScore = 0; |
| 4980 | - $answer=0; |
|
| 4980 | + $answer = 0; |
|
| 4981 | 4981 | Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0); |
| 4982 | 4982 | if (is_array($exerciseResultCoordinates[$quesId])) { |
| 4983 | - foreach($exerciseResultCoordinates[$quesId] as $idx => $val) { |
|
| 4984 | - Event::saveExerciseAttemptHotspot($exeId,$quesId,$idx,0,$val); |
|
| 4983 | + foreach ($exerciseResultCoordinates[$quesId] as $idx => $val) { |
|
| 4984 | + Event::saveExerciseAttemptHotspot($exeId, $quesId, $idx, 0, $val); |
|
| 4985 | 4985 | } |
| 4986 | 4986 | } |
| 4987 | 4987 | } else { |
| 4988 | 4988 | Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0); |
| 4989 | 4989 | if (is_array($exerciseResultCoordinates[$quesId])) { |
| 4990 | - foreach($exerciseResultCoordinates[$quesId] as $idx => $val) { |
|
| 4991 | - Event::saveExerciseAttemptHotspot($exeId,$quesId,$idx,$choice[$idx],$val); |
|
| 4990 | + foreach ($exerciseResultCoordinates[$quesId] as $idx => $val) { |
|
| 4991 | + Event::saveExerciseAttemptHotspot($exeId, $quesId, $idx, $choice[$idx], $val); |
|
| 4992 | 4992 | } |
| 4993 | 4993 | } |
| 4994 | 4994 | } |
@@ -5007,7 +5007,7 @@ discard block |
||
| 5007 | 5007 | echo " |
| 5008 | 5008 | <tr> |
| 5009 | 5009 | <td colspan=\"2\"> |
| 5010 | - <p><em>" . get_lang('HotSpot') . "</em></p> |
|
| 5010 | + <p><em>" . get_lang('HotSpot')."</em></p> |
|
| 5011 | 5011 | |
| 5012 | 5012 | <div id=\"hotspot-solution-$questionId\"></div> |
| 5013 | 5013 | |
@@ -5045,7 +5045,7 @@ discard block |
||
| 5045 | 5045 | |
| 5046 | 5046 | if ($saved_results) { |
| 5047 | 5047 | if ($debug) error_log("Save question results $saved_results"); |
| 5048 | - if ($debug) error_log(print_r($choice ,1 )); |
|
| 5048 | + if ($debug) error_log(print_r($choice, 1)); |
|
| 5049 | 5049 | |
| 5050 | 5050 | if (empty($choice)) { |
| 5051 | 5051 | $choice = 0; |
@@ -5057,14 +5057,14 @@ discard block |
||
| 5057 | 5057 | $ans = $reply[$i]; |
| 5058 | 5058 | Event::saveQuestionAttempt( |
| 5059 | 5059 | $questionScore, |
| 5060 | - $ans . ':' . $choice[$ans], |
|
| 5060 | + $ans.':'.$choice[$ans], |
|
| 5061 | 5061 | $quesId, |
| 5062 | 5062 | $exeId, |
| 5063 | 5063 | $i, |
| 5064 | 5064 | $this->id |
| 5065 | 5065 | ); |
| 5066 | 5066 | if ($debug) { |
| 5067 | - error_log('result =>' . $questionScore . ' ' . $ans . ':' . $choice[$ans]); |
|
| 5067 | + error_log('result =>'.$questionScore.' '.$ans.':'.$choice[$ans]); |
|
| 5068 | 5068 | } |
| 5069 | 5069 | } |
| 5070 | 5070 | } else { |
@@ -5075,7 +5075,7 @@ discard block |
||
| 5075 | 5075 | $reply = array_keys($choice); |
| 5076 | 5076 | |
| 5077 | 5077 | if ($debug) { |
| 5078 | - error_log("reply " . print_r($reply, 1) . ""); |
|
| 5078 | + error_log("reply ".print_r($reply, 1).""); |
|
| 5079 | 5079 | } |
| 5080 | 5080 | for ($i = 0; $i < sizeof($reply); $i++) { |
| 5081 | 5081 | $ans = $reply[$i]; |
@@ -5134,7 +5134,7 @@ discard block |
||
| 5134 | 5134 | |
| 5135 | 5135 | Event::saveQuestionAttempt($questionScore, implode('|', $answer), $quesId, $exeId, 0, $this->id); |
| 5136 | 5136 | } else { |
| 5137 | - Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0,$this->id); |
|
| 5137 | + Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id); |
|
| 5138 | 5138 | } |
| 5139 | 5139 | } |
| 5140 | 5140 | |
@@ -5144,8 +5144,8 @@ discard block |
||
| 5144 | 5144 | |
| 5145 | 5145 | if ($saved_results) { |
| 5146 | 5146 | $stat_table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
| 5147 | - $sql = 'UPDATE ' . $stat_table . ' SET |
|
| 5148 | - exe_result = exe_result + ' . floatval($questionScore) . ' |
|
| 5147 | + $sql = 'UPDATE '.$stat_table.' SET |
|
| 5148 | + exe_result = exe_result + ' . floatval($questionScore).' |
|
| 5149 | 5149 | WHERE exe_id = ' . $exeId; |
| 5150 | 5150 | if ($debug) error_log($sql); |
| 5151 | 5151 | Database::query($sql); |
@@ -5169,7 +5169,7 @@ discard block |
||
| 5169 | 5169 | */ |
| 5170 | 5170 | public function send_mail_notification_for_exam($question_list_answers, $origin, $exe_id) |
| 5171 | 5171 | { |
| 5172 | - if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) { |
|
| 5172 | + if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1) { |
|
| 5173 | 5173 | return null; |
| 5174 | 5174 | } |
| 5175 | 5175 | // Email configuration settings |
@@ -5220,7 +5220,7 @@ discard block |
||
| 5220 | 5220 | $msg = str_replace("#course#", $courseInfo['name'], $msg1); |
| 5221 | 5221 | |
| 5222 | 5222 | if ($origin != 'learnpath') { |
| 5223 | - $msg.= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>'; |
|
| 5223 | + $msg .= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>'; |
|
| 5224 | 5224 | } |
| 5225 | 5225 | $msg1 = str_replace("#url#", $url_email, $msg); |
| 5226 | 5226 | $mail_content = $msg1; |
@@ -5249,7 +5249,7 @@ discard block |
||
| 5249 | 5249 | */ |
| 5250 | 5250 | function send_notification_for_open_questions($question_list_answers, $origin, $exe_id) |
| 5251 | 5251 | { |
| 5252 | - if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) { |
|
| 5252 | + if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1) { |
|
| 5253 | 5253 | return null; |
| 5254 | 5254 | } |
| 5255 | 5255 | // Email configuration settings |
@@ -5312,11 +5312,11 @@ discard block |
||
| 5312 | 5312 | $msg .= '</table><br />'; |
| 5313 | 5313 | |
| 5314 | 5314 | |
| 5315 | - $msg1 = str_replace("#exercise#", $this->exercise, $msg); |
|
| 5316 | - $msg = str_replace("#firstName#", $user_info['firstname'],$msg1); |
|
| 5317 | - $msg1 = str_replace("#lastName#", $user_info['lastname'],$msg); |
|
| 5318 | - $msg = str_replace("#mail#", $user_info['email'],$msg1); |
|
| 5319 | - $msg = str_replace("#course#", $course_info['name'],$msg1); |
|
| 5315 | + $msg1 = str_replace("#exercise#", $this->exercise, $msg); |
|
| 5316 | + $msg = str_replace("#firstName#", $user_info['firstname'], $msg1); |
|
| 5317 | + $msg1 = str_replace("#lastName#", $user_info['lastname'], $msg); |
|
| 5318 | + $msg = str_replace("#mail#", $user_info['email'], $msg1); |
|
| 5319 | + $msg = str_replace("#course#", $course_info['name'], $msg1); |
|
| 5320 | 5320 | |
| 5321 | 5321 | if ($origin != 'learnpath') { |
| 5322 | 5322 | $msg .= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>'; |
@@ -5345,7 +5345,7 @@ discard block |
||
| 5345 | 5345 | |
| 5346 | 5346 | function send_notification_for_oral_questions($question_list_answers, $origin, $exe_id) |
| 5347 | 5347 | { |
| 5348 | - if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) { |
|
| 5348 | + if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1) { |
|
| 5349 | 5349 | return null; |
| 5350 | 5350 | } |
| 5351 | 5351 | // Email configuration settings |
@@ -5369,7 +5369,7 @@ discard block |
||
| 5369 | 5369 | $answer_type = $item['answer_type']; |
| 5370 | 5370 | |
| 5371 | 5371 | if (!empty($question) && !empty($answer) && $answer_type == ORAL_EXPRESSION) { |
| 5372 | - $oral_question_list.='<br /><table width="730" height="136" border="0" cellpadding="3" cellspacing="3">' |
|
| 5372 | + $oral_question_list .= '<br /><table width="730" height="136" border="0" cellpadding="3" cellspacing="3">' |
|
| 5373 | 5373 | .'<tr>' |
| 5374 | 5374 | .'<td width="220" valign="top" bgcolor="#E5EDF8"> '.get_lang('Question').'</td>' |
| 5375 | 5375 | .'<td width="473" valign="top" bgcolor="#F3F3F3">'.$question.'</td>' |
@@ -5402,7 +5402,7 @@ discard block |
||
| 5402 | 5402 | .'<td> #mail#</td>' |
| 5403 | 5403 | .'</tr>' |
| 5404 | 5404 | .'</table>'; |
| 5405 | - $msg .= '<br />'.sprintf(get_lang('OralQuestionsAttemptedAreX'),$oral_question_list).'<br />'; |
|
| 5405 | + $msg .= '<br />'.sprintf(get_lang('OralQuestionsAttemptedAreX'), $oral_question_list).'<br />'; |
|
| 5406 | 5406 | $msg1 = str_replace("#exercise#", $this->exercise, $msg); |
| 5407 | 5407 | $msg = str_replace("#firstName#", $user_info['firstname'], $msg1); |
| 5408 | 5408 | $msg1 = str_replace("#lastName#", $user_info['lastname'], $msg); |
@@ -5410,7 +5410,7 @@ discard block |
||
| 5410 | 5410 | $msg = str_replace("#course#", $course_info['name'], $msg1); |
| 5411 | 5411 | |
| 5412 | 5412 | if ($origin != 'learnpath') { |
| 5413 | - $msg.= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>'; |
|
| 5413 | + $msg .= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>'; |
|
| 5414 | 5414 | } |
| 5415 | 5415 | $msg1 = str_replace("#url#", $url_email, $msg); |
| 5416 | 5416 | $mail_content = $msg1; |
@@ -5476,10 +5476,10 @@ discard block |
||
| 5476 | 5476 | } |
| 5477 | 5477 | $html = '<div class="question-result">'; |
| 5478 | 5478 | $html .= Display::page_header( |
| 5479 | - Display::return_icon('test-quiz.png', get_lang('Result'),null, ICON_SIZE_MEDIUM).' '.$this->exercise.' : '.get_lang('Result') |
|
| 5479 | + Display::return_icon('test-quiz.png', get_lang('Result'), null, ICON_SIZE_MEDIUM).' '.$this->exercise.' : '.get_lang('Result') |
|
| 5480 | 5480 | ); |
| 5481 | 5481 | $html .= Display::description($array); |
| 5482 | - $html .="</div>"; |
|
| 5482 | + $html .= "</div>"; |
|
| 5483 | 5483 | return $html; |
| 5484 | 5484 | } |
| 5485 | 5485 | |
@@ -5596,7 +5596,7 @@ discard block |
||
| 5596 | 5596 | false, |
| 5597 | 5597 | $objExercise->selectPropagateNeg() |
| 5598 | 5598 | ); |
| 5599 | - $totalScore += $question_result['score']; |
|
| 5599 | + $totalScore += $question_result['score']; |
|
| 5600 | 5600 | } |
| 5601 | 5601 | |
| 5602 | 5602 | if ($objExercise->selectPropagateNeg() == 0 && $totalScore < 0) { |
@@ -5802,7 +5802,7 @@ discard block |
||
| 5802 | 5802 | } |
| 5803 | 5803 | |
| 5804 | 5804 | $rawMessage = ""; |
| 5805 | - if (!empty($message)){ |
|
| 5805 | + if (!empty($message)) { |
|
| 5806 | 5806 | $rawMessage = $message; |
| 5807 | 5807 | $message = Display::return_message($message, 'warning', false); |
| 5808 | 5808 | } |
@@ -5818,7 +5818,7 @@ discard block |
||
| 5818 | 5818 | { |
| 5819 | 5819 | $TBL_LP_ITEM = Database::get_course_table(TABLE_LP_ITEM); |
| 5820 | 5820 | $sql = "SELECT max_score FROM $TBL_LP_ITEM |
| 5821 | - WHERE c_id = {$this->course_id} AND item_type = '" . TOOL_QUIZ . "' AND path = '{$this->id}'"; |
|
| 5821 | + WHERE c_id = {$this->course_id} AND item_type = '".TOOL_QUIZ."' AND path = '{$this->id}'"; |
|
| 5822 | 5822 | $result = Database::query($sql); |
| 5823 | 5823 | if (Database::num_rows($result) > 0) { |
| 5824 | 5824 | return true; |
@@ -6146,7 +6146,7 @@ discard block |
||
| 6146 | 6146 | $sql_track = "SELECT * FROM $track_exercises WHERE exe_id = $exe_id "; |
| 6147 | 6147 | $result = Database::query($sql_track); |
| 6148 | 6148 | $new_array = array(); |
| 6149 | - if (Database::num_rows($result) > 0 ) { |
|
| 6149 | + if (Database::num_rows($result) > 0) { |
|
| 6150 | 6150 | $new_array = Database::fetch_array($result, 'ASSOC'); |
| 6151 | 6151 | |
| 6152 | 6152 | $new_array['duration'] = null; |
@@ -6158,11 +6158,11 @@ discard block |
||
| 6158 | 6158 | $start_date = api_strtotime($start_date, 'UTC'); |
| 6159 | 6159 | $end_date = api_strtotime($end_date, 'UTC'); |
| 6160 | 6160 | if ($start_date && $end_date) { |
| 6161 | - $mytime = $end_date- $start_date; |
|
| 6161 | + $mytime = $end_date - $start_date; |
|
| 6162 | 6162 | $new_learnpath_item = new learnpathItem(null); |
| 6163 | 6163 | $time_attemp = $new_learnpath_item->get_scorm_time('js', $mytime); |
| 6164 | 6164 | $h = get_lang('h'); |
| 6165 | - $time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp); |
|
| 6165 | + $time_attemp = str_replace('NaN', '00'.$h.'00\'00"', $time_attemp); |
|
| 6166 | 6166 | $new_array['duration'] = $time_attemp; |
| 6167 | 6167 | } |
| 6168 | 6168 | } |
@@ -6184,7 +6184,7 @@ discard block |
||
| 6184 | 6184 | $result = Database::query($sql); |
| 6185 | 6185 | } |
| 6186 | 6186 | } else { |
| 6187 | - $remind_list = explode(',',$exercise_info['questions_to_check']); |
|
| 6187 | + $remind_list = explode(',', $exercise_info['questions_to_check']); |
|
| 6188 | 6188 | |
| 6189 | 6189 | $remind_list_string = ''; |
| 6190 | 6190 | if ($action == 'add') { |
@@ -6196,7 +6196,7 @@ discard block |
||
| 6196 | 6196 | } |
| 6197 | 6197 | $remind_list_string = implode(',', $remind_list); |
| 6198 | 6198 | } |
| 6199 | - } elseif ($action == 'delete') { |
|
| 6199 | + } elseif ($action == 'delete') { |
|
| 6200 | 6200 | if (!empty($remind_list)) { |
| 6201 | 6201 | if (in_array($question_id, $remind_list)) { |
| 6202 | 6202 | $remind_list = array_flip($remind_list); |
@@ -6438,7 +6438,7 @@ discard block |
||
| 6438 | 6438 | true |
| 6439 | 6439 | ); |
| 6440 | 6440 | |
| 6441 | - $counter += count($mediaQuestions[$questionId]) - 1 ; |
|
| 6441 | + $counter += count($mediaQuestions[$questionId]) - 1; |
|
| 6442 | 6442 | $before = count($questionList); |
| 6443 | 6443 | $wasMedia = true; |
| 6444 | 6444 | $nextValue += count($questionList); |
@@ -6517,7 +6517,7 @@ discard block |
||
| 6517 | 6517 | // If it was already seen, then merge the previous with |
| 6518 | 6518 | // the current category |
| 6519 | 6519 | $oldQuestionList = $newCategoryList[$rootElement]['question_list']; |
| 6520 | - $category['question_list'] = array_merge($oldQuestionList , $category['question_list']); |
|
| 6520 | + $category['question_list'] = array_merge($oldQuestionList, $category['question_list']); |
|
| 6521 | 6521 | $newCategoryList[$rootElement] = $category; |
| 6522 | 6522 | } |
| 6523 | 6523 | } |
@@ -6543,7 +6543,7 @@ discard block |
||
| 6543 | 6543 | |
| 6544 | 6544 | if ($useRootAsCategoryTitle) { |
| 6545 | 6545 | if (isset($category['parent_info'])) { |
| 6546 | - $categoryName = $category['parent_info']['title']; |
|
| 6546 | + $categoryName = $category['parent_info']['title']; |
|
| 6547 | 6547 | } |
| 6548 | 6548 | } |
| 6549 | 6549 | $html .= '<div class="row">'; |
@@ -6686,7 +6686,7 @@ discard block |
||
| 6686 | 6686 | // end foreach() |
| 6687 | 6687 | |
| 6688 | 6688 | if ($this->type == ALL_ON_ONE_PAGE) { |
| 6689 | - $exercise_actions = $this->show_button($questionId, $currentQuestion); |
|
| 6689 | + $exercise_actions = $this->show_button($questionId, $currentQuestion); |
|
| 6690 | 6690 | echo Display::div($exercise_actions, array('class'=>'exercise_actions')); |
| 6691 | 6691 | } |
| 6692 | 6692 | } |
@@ -6772,7 +6772,7 @@ discard block |
||
| 6772 | 6772 | |
| 6773 | 6773 | // Showing the question |
| 6774 | 6774 | |
| 6775 | - $exercise_actions = null; |
|
| 6775 | + $exercise_actions = null; |
|
| 6776 | 6776 | |
| 6777 | 6777 | echo '<a id="questionanchor'.$questionId.'"></a><br />'; |
| 6778 | 6778 | echo '<div id="question_div_'.$questionId.'" class="main_question '.$remind_highlight.'" >'; |
@@ -7040,7 +7040,7 @@ discard block |
||
| 7040 | 7040 | $header .= Display::tag('th', get_lang('Feedback')); |
| 7041 | 7041 | } |
| 7042 | 7042 | $s .= '<table class="data_table">'; |
| 7043 | - $s.= Display::tag('tr', $header, array('style' => 'text-align:left;')); |
|
| 7043 | + $s .= Display::tag('tr', $header, array('style' => 'text-align:left;')); |
|
| 7044 | 7044 | } |
| 7045 | 7045 | } |
| 7046 | 7046 | |
@@ -7140,7 +7140,7 @@ discard block |
||
| 7140 | 7140 | $s .= '<td>'; |
| 7141 | 7141 | $s .= $comment; |
| 7142 | 7142 | $s .= '</td>'; |
| 7143 | - $s .='</tr>'; |
|
| 7143 | + $s .= '</tr>'; |
|
| 7144 | 7144 | } else { |
| 7145 | 7145 | $s .= $answer_input; |
| 7146 | 7146 | } |
@@ -7154,7 +7154,7 @@ discard block |
||
| 7154 | 7154 | } |
| 7155 | 7155 | } |
| 7156 | 7156 | |
| 7157 | - $s .='<tr>'; |
|
| 7157 | + $s .= '<tr>'; |
|
| 7158 | 7158 | $s .= Display::tag('td', $answer); |
| 7159 | 7159 | |
| 7160 | 7160 | if (!empty($quiz_question_options)) { |
@@ -7181,7 +7181,7 @@ discard block |
||
| 7181 | 7181 | $s .= $comment; |
| 7182 | 7182 | $s .= '</td>'; |
| 7183 | 7183 | } |
| 7184 | - $s.='</tr>'; |
|
| 7184 | + $s .= '</tr>'; |
|
| 7185 | 7185 | } |
| 7186 | 7186 | |
| 7187 | 7187 | } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION) { |
@@ -7210,16 +7210,16 @@ discard block |
||
| 7210 | 7210 | $answer_input .= '</label>'; |
| 7211 | 7211 | |
| 7212 | 7212 | if ($show_comment) { |
| 7213 | - $s.= '<tr>'; |
|
| 7213 | + $s .= '<tr>'; |
|
| 7214 | 7214 | $s .= '<td>'; |
| 7215 | - $s.= $answer_input; |
|
| 7215 | + $s .= $answer_input; |
|
| 7216 | 7216 | $s .= '</td>'; |
| 7217 | 7217 | $s .= '<td>'; |
| 7218 | 7218 | $s .= $comment; |
| 7219 | 7219 | $s .= '</td>'; |
| 7220 | - $s.= '</tr>'; |
|
| 7220 | + $s .= '</tr>'; |
|
| 7221 | 7221 | } else { |
| 7222 | - $s.= $answer_input; |
|
| 7222 | + $s .= $answer_input; |
|
| 7223 | 7223 | } |
| 7224 | 7224 | } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) { |
| 7225 | 7225 | $s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />'; |
@@ -7232,7 +7232,7 @@ discard block |
||
| 7232 | 7232 | } |
| 7233 | 7233 | } |
| 7234 | 7234 | $answer = Security::remove_XSS($answer); |
| 7235 | - $s .='<tr>'; |
|
| 7235 | + $s .= '<tr>'; |
|
| 7236 | 7236 | $s .= Display::tag('td', $answer); |
| 7237 | 7237 | |
| 7238 | 7238 | foreach ($objQuestionTmp->options as $key => $item) { |
@@ -7256,7 +7256,7 @@ discard block |
||
| 7256 | 7256 | $s .= $comment; |
| 7257 | 7257 | $s .= '</td>'; |
| 7258 | 7258 | } |
| 7259 | - $s.='</tr>'; |
|
| 7259 | + $s .= '</tr>'; |
|
| 7260 | 7260 | } elseif ($answerType == FILL_IN_BLANKS) { |
| 7261 | 7261 | list($answer) = explode('::', $answer); |
| 7262 | 7262 | |
@@ -7290,7 +7290,7 @@ discard block |
||
| 7290 | 7290 | $value = str_replace(' ', '', trim($value[0])); |
| 7291 | 7291 | } |
| 7292 | 7292 | $correct_item = preg_quote($correct_item); |
| 7293 | - $correct_item = api_preg_replace('|/|', '\/', $correct_item); // to prevent error if there is a / in the text to find |
|
| 7293 | + $correct_item = api_preg_replace('|/|', '\/', $correct_item); // to prevent error if there is a / in the text to find |
|
| 7294 | 7294 | $answer = api_preg_replace('/'.$correct_item.'/', Display::input('text', "choice[$questionId][]", $value), $answer, 1); |
| 7295 | 7295 | } |
| 7296 | 7296 | $i++; |
@@ -7347,7 +7347,7 @@ discard block |
||
| 7347 | 7347 | } |
| 7348 | 7348 | |
| 7349 | 7349 | if (!empty($answerCorrect) && !empty($selectedValue)) { |
| 7350 | - $s.= '<script> |
|
| 7350 | + $s .= '<script> |
|
| 7351 | 7351 | jsPlumb.ready(function() { |
| 7352 | 7352 | jsPlumb.connect({ |
| 7353 | 7353 | source: "window_'.$windowId.'", |
@@ -7362,14 +7362,14 @@ discard block |
||
| 7362 | 7362 | } |
| 7363 | 7363 | $s .= '</select></div></td>'; |
| 7364 | 7364 | |
| 7365 | - $s.='<td width="45%" valign="top" >'; |
|
| 7365 | + $s .= '<td width="45%" valign="top" >'; |
|
| 7366 | 7366 | |
| 7367 | 7367 | if (isset($select_items[$lines_count])) { |
| 7368 | - $s.= '<div id="window_'.$windowId.'_answer" class="window window_right_question"> |
|
| 7368 | + $s .= '<div id="window_'.$windowId.'_answer" class="window window_right_question"> |
|
| 7369 | 7369 | <b>'.$select_items[$lines_count]['letter'].'.</b> '.$select_items[$lines_count]['answer'].' |
| 7370 | 7370 | </div>'; |
| 7371 | 7371 | } else { |
| 7372 | - $s.=' '; |
|
| 7372 | + $s .= ' '; |
|
| 7373 | 7373 | } |
| 7374 | 7374 | |
| 7375 | 7375 | $s .= '</td>'; |
@@ -7383,16 +7383,16 @@ discard block |
||
| 7383 | 7383 | $s .= '<tr> |
| 7384 | 7384 | <td colspan="2"></td> |
| 7385 | 7385 | <td valign="top">'; |
| 7386 | - $s.='<b>'.$select_items[$lines_count]['letter'].'.</b>'; |
|
| 7386 | + $s .= '<b>'.$select_items[$lines_count]['letter'].'.</b>'; |
|
| 7387 | 7387 | $s .= $select_items[$lines_count]['answer']; |
| 7388 | - $s.="</td> |
|
| 7388 | + $s .= "</td> |
|
| 7389 | 7389 | </tr>"; |
| 7390 | 7390 | $lines_count++; |
| 7391 | 7391 | } // end while() |
| 7392 | 7392 | } // end if() |
| 7393 | 7393 | $matching_correct_answer++; |
| 7394 | 7394 | } |
| 7395 | - } elseif ($answerType == DRAGGABLE) { |
|
| 7395 | + } elseif ($answerType == DRAGGABLE) { |
|
| 7396 | 7396 | // matching type, showing suggestions and answers |
| 7397 | 7397 | // TODO: replace $answerId by $numAnswer |
| 7398 | 7398 | |
@@ -7435,7 +7435,7 @@ discard block |
||
| 7435 | 7435 | $s .= '</select>'; |
| 7436 | 7436 | |
| 7437 | 7437 | if (!empty($answerCorrect) && !empty($selectedValue)) { |
| 7438 | - $s.= '<script> |
|
| 7438 | + $s .= '<script> |
|
| 7439 | 7439 | $(function() { |
| 7440 | 7440 | deleteItem($("#'.$questionId.'_'.$selectedValue.'"), $("#drop_'.$windowId.'")); |
| 7441 | 7441 | }); |
@@ -7444,11 +7444,11 @@ discard block |
||
| 7444 | 7444 | |
| 7445 | 7445 | |
| 7446 | 7446 | if (isset($select_items[$lines_count])) { |
| 7447 | - $s.= '<div id="window_'.$windowId.'_answer" class=""> |
|
| 7447 | + $s .= '<div id="window_'.$windowId.'_answer" class=""> |
|
| 7448 | 7448 | <b>'.$select_items[$lines_count]['letter'].'.</b> '.$select_items[$lines_count]['answer'].' |
| 7449 | 7449 | </div>'; |
| 7450 | 7450 | } else { |
| 7451 | - $s.=' '; |
|
| 7451 | + $s .= ' '; |
|
| 7452 | 7452 | } |
| 7453 | 7453 | $lines_count++; |
| 7454 | 7454 | //if the left side of the "matching" has been completely |
@@ -7457,7 +7457,7 @@ discard block |
||
| 7457 | 7457 | if (($lines_count - 1) == $num_suggestions) { |
| 7458 | 7458 | // if it remains answers to shown at the right side |
| 7459 | 7459 | while (isset($select_items[$lines_count])) { |
| 7460 | - $s.='<b>'.$select_items[$lines_count]['letter'].'.</b>'; |
|
| 7460 | + $s .= '<b>'.$select_items[$lines_count]['letter'].'.</b>'; |
|
| 7461 | 7461 | $s .= $select_items[$lines_count]['answer']; |
| 7462 | 7462 | $lines_count++; |
| 7463 | 7463 | } |
@@ -7560,9 +7560,9 @@ discard block |
||
| 7560 | 7560 | |
| 7561 | 7561 | if (!$only_questions) { |
| 7562 | 7562 | if ($show_title) { |
| 7563 | - $html .= TestCategory::getCategoryNamesForQuestion($objQuestionTmp->id); |
|
| 7564 | - $html .= '<div class="question_title">'.$current_item.'. '.$questionName.'</div>'; |
|
| 7565 | - $html .= $questionDescription; |
|
| 7563 | + $html .= TestCategory::getCategoryNamesForQuestion($objQuestionTmp->id); |
|
| 7564 | + $html .= '<div class="question_title">'.$current_item.'. '.$questionName.'</div>'; |
|
| 7565 | + $html .= $questionDescription; |
|
| 7566 | 7566 | } else { |
| 7567 | 7567 | $html .= '<div class="media">'; |
| 7568 | 7568 | $html .= '<div class="pull-left">'; |
@@ -7578,11 +7578,11 @@ discard block |
||
| 7578 | 7578 | $html .= '</div>'; |
| 7579 | 7579 | } |
| 7580 | 7580 | //@todo I need to the get the feedback type |
| 7581 | - $html .= '<input type="hidden" name="hidden_hotspot_id" value="'.$questionId.'" />'; |
|
| 7582 | - $html .= '<table class="exercise_questions"> |
|
| 7581 | + $html .= '<input type="hidden" name="hidden_hotspot_id" value="'.$questionId.'" />'; |
|
| 7582 | + $html .= '<table class="exercise_questions"> |
|
| 7583 | 7583 | <tr> |
| 7584 | 7584 | <td valign="top" colspan="2">'; |
| 7585 | - $html .= '</td></tr>'; |
|
| 7585 | + $html .= '</td></tr>'; |
|
| 7586 | 7586 | } |
| 7587 | 7587 | |
| 7588 | 7588 | $canClick = isset($_GET['editQuestion']) ? '0' : (isset($_GET['modifyAnswers']) ? '0' : '1'); |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | if ($show_title) { |
| 66 | 66 | TestCategory::displayCategoryAndTitle($objQuestionTmp->id); |
| 67 | 67 | echo Display::div( |
| 68 | - $current_item . '. ' . $objQuestionTmp->selectTitle(), |
|
| 68 | + $current_item.'. '.$objQuestionTmp->selectTitle(), |
|
| 69 | 69 | array('class' => 'question_title') |
| 70 | 70 | ); |
| 71 | 71 | } |
@@ -161,8 +161,8 @@ discard block |
||
| 161 | 161 | $config = array( |
| 162 | 162 | 'ToolbarSet' => 'TestFreeAnswer' |
| 163 | 163 | ); |
| 164 | - $form->addHtmlEditor("choice[" . $questionId . "]", null, false, false, $config); |
|
| 165 | - $form->setDefaults(array("choice[" . $questionId . "]" => $fck_content)); |
|
| 164 | + $form->addHtmlEditor("choice[".$questionId."]", null, false, false, $config); |
|
| 165 | + $form->setDefaults(array("choice[".$questionId."]" => $fck_content)); |
|
| 166 | 166 | $s .= $form->returnForm(); |
| 167 | 167 | } elseif ($answerType == ORAL_EXPRESSION) { |
| 168 | 168 | // Add nanog |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | $config = array( |
| 192 | 192 | 'ToolbarSet' => 'TestFreeAnswer' |
| 193 | 193 | ); |
| 194 | - $form->addHtmlEditor("choice[" . $questionId . "]", null, false, false, $config); |
|
| 194 | + $form->addHtmlEditor("choice[".$questionId."]", null, false, false, $config); |
|
| 195 | 195 | //$form->setDefaults(array("choice[" . $questionId . "]" => $fck_content)); |
| 196 | 196 | $s .= $form->returnForm(); |
| 197 | 197 | } |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | |
| 273 | 273 | // Unique answer |
| 274 | 274 | if (in_array($answerType, [UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION, UNIQUE_ANSWER_IMAGE])) { |
| 275 | - $input_id = 'choice-' . $questionId . '-' . $answerId; |
|
| 275 | + $input_id = 'choice-'.$questionId.'-'.$answerId; |
|
| 276 | 276 | if (isset($user_choice[0]['answer']) && $user_choice[0]['answer'] == $numAnswer) { |
| 277 | 277 | $attributes = array( |
| 278 | 278 | 'id' => $input_id, |
@@ -297,14 +297,14 @@ discard block |
||
| 297 | 297 | if ($answerType == UNIQUE_ANSWER_IMAGE) { |
| 298 | 298 | if ($show_comment) { |
| 299 | 299 | if (empty($comment)) { |
| 300 | - $s .= '<div id="answer' . $questionId . $numAnswer . '" ' |
|
| 300 | + $s .= '<div id="answer'.$questionId.$numAnswer.'" ' |
|
| 301 | 301 | . 'class="exercise-unique-answer-image" style="text-align: center">'; |
| 302 | 302 | } else { |
| 303 | - $s .= '<div id="answer' . $questionId . $numAnswer . '" ' |
|
| 303 | + $s .= '<div id="answer'.$questionId.$numAnswer.'" ' |
|
| 304 | 304 | . 'class="exercise-unique-answer-image col-xs-6 col-sm-12" style="text-align: center">'; |
| 305 | 305 | } |
| 306 | 306 | } else { |
| 307 | - $s .= '<div id="answer' . $questionId . $numAnswer . '" ' |
|
| 307 | + $s .= '<div id="answer'.$questionId.$numAnswer.'" ' |
|
| 308 | 308 | . 'class="exercise-unique-answer-image col-xs-6 col-md-3" style="text-align: center">'; |
| 309 | 309 | } |
| 310 | 310 | } |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | $answer = Security::remove_XSS($answer, STUDENT); |
| 313 | 313 | $s .= Display::input( |
| 314 | 314 | 'hidden', |
| 315 | - 'choice2[' . $questionId . ']', |
|
| 315 | + 'choice2['.$questionId.']', |
|
| 316 | 316 | '0' |
| 317 | 317 | ); |
| 318 | 318 | |
@@ -320,13 +320,13 @@ discard block |
||
| 320 | 320 | |
| 321 | 321 | if ($answerType == UNIQUE_ANSWER_IMAGE) { |
| 322 | 322 | $attributes['style'] = 'display: none;'; |
| 323 | - $answer = '<div class="thumbnail">' . $answer . '</div>'; |
|
| 323 | + $answer = '<div class="thumbnail">'.$answer.'</div>'; |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | $answer_input .= '<label class="radio">'; |
| 327 | 327 | $answer_input .= Display::input( |
| 328 | 328 | 'radio', |
| 329 | - 'choice[' . $questionId . ']', |
|
| 329 | + 'choice['.$questionId.']', |
|
| 330 | 330 | $numAnswer, |
| 331 | 331 | $attributes |
| 332 | 332 | ); |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | $answerType == MULTIPLE_ANSWER_TRUE_FALSE || |
| 354 | 354 | $answerType == GLOBAL_MULTIPLE_ANSWER |
| 355 | 355 | ) { |
| 356 | - $input_id = 'choice-' . $questionId . '-' . $answerId; |
|
| 356 | + $input_id = 'choice-'.$questionId.'-'.$answerId; |
|
| 357 | 357 | $answer = Security::remove_XSS($answer, STUDENT); |
| 358 | 358 | |
| 359 | 359 | if (in_array($numAnswer, $user_choice_array)) { |
@@ -374,12 +374,12 @@ discard block |
||
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | if ($answerType == MULTIPLE_ANSWER || $answerType == GLOBAL_MULTIPLE_ANSWER) { |
| 377 | - $s .= '<input type="hidden" name="choice2[' . $questionId . ']" value="0" />'; |
|
| 377 | + $s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />'; |
|
| 378 | 378 | |
| 379 | 379 | $answer_input = '<label class="checkbox">'; |
| 380 | 380 | $answer_input .= Display::input( |
| 381 | 381 | 'checkbox', |
| 382 | - 'choice[' . $questionId . '][' . $numAnswer . ']', |
|
| 382 | + 'choice['.$questionId.']['.$numAnswer.']', |
|
| 383 | 383 | $numAnswer, |
| 384 | 384 | $attributes |
| 385 | 385 | ); |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | 'td', |
| 433 | 433 | Display::input( |
| 434 | 434 | 'radio', |
| 435 | - 'choice[' . $questionId . '][' . $numAnswer . ']', |
|
| 435 | + 'choice['.$questionId.']['.$numAnswer.']', |
|
| 436 | 436 | $id, |
| 437 | 437 | $attributes |
| 438 | 438 | ), |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | } |
| 451 | 451 | } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION) { |
| 452 | 452 | // multiple answers |
| 453 | - $input_id = 'choice-' . $questionId . '-' . $answerId; |
|
| 453 | + $input_id = 'choice-'.$questionId.'-'.$answerId; |
|
| 454 | 454 | |
| 455 | 455 | if (in_array($numAnswer, $user_choice_array)) { |
| 456 | 456 | $attributes = array( |
@@ -470,11 +470,11 @@ discard block |
||
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | $answer = Security::remove_XSS($answer, STUDENT); |
| 473 | - $answer_input = '<input type="hidden" name="choice2[' . $questionId . ']" value="0" />'; |
|
| 473 | + $answer_input = '<input type="hidden" name="choice2['.$questionId.']" value="0" />'; |
|
| 474 | 474 | $answer_input .= '<label class="checkbox">'; |
| 475 | 475 | $answer_input .= Display::input( |
| 476 | 476 | 'checkbox', |
| 477 | - 'choice[' . $questionId . '][' . $numAnswer . ']', |
|
| 477 | + 'choice['.$questionId.']['.$numAnswer.']', |
|
| 478 | 478 | 1, |
| 479 | 479 | $attributes |
| 480 | 480 | ); |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) { |
| 498 | - $s .= '<input type="hidden" name="choice2[' . $questionId . ']" value="0" />'; |
|
| 498 | + $s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />'; |
|
| 499 | 499 | |
| 500 | 500 | $my_choice = array(); |
| 501 | 501 | if (!empty($user_choice_array)) { |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | 'td', |
| 531 | 531 | Display::input( |
| 532 | 532 | 'radio', |
| 533 | - 'choice[' . $questionId . '][' . $numAnswer . ']', |
|
| 533 | + 'choice['.$questionId.']['.$numAnswer.']', |
|
| 534 | 534 | $key, |
| 535 | 535 | $attributes |
| 536 | 536 | ) |
@@ -626,8 +626,8 @@ discard block |
||
| 626 | 626 | $trackAttempts = Database::get_main_table( |
| 627 | 627 | TABLE_STATISTIC_TRACK_E_ATTEMPT |
| 628 | 628 | ); |
| 629 | - $sql = 'SELECT answer FROM ' . $trackAttempts . ' |
|
| 630 | - WHERE exe_id=' . $exe_id . ' AND question_id=' . $questionId; |
|
| 629 | + $sql = 'SELECT answer FROM '.$trackAttempts.' |
|
| 630 | + WHERE exe_id=' . $exe_id.' AND question_id='.$questionId; |
|
| 631 | 631 | $rsLastAttempt = Database::query($sql); |
| 632 | 632 | $rowLastAttempt = Database::fetch_array($rsLastAttempt); |
| 633 | 633 | $answer = $rowLastAttempt['answer']; |
@@ -697,7 +697,7 @@ discard block |
||
| 697 | 697 | '', |
| 698 | 698 | $answerCorrected |
| 699 | 699 | ); |
| 700 | - $answerCorrected = '[' . $answerCorrected . ']'; |
|
| 700 | + $answerCorrected = '['.$answerCorrected.']'; |
|
| 701 | 701 | $studentAnswerList[] = $answerCorrected; |
| 702 | 702 | } |
| 703 | 703 | } |
@@ -718,7 +718,7 @@ discard block |
||
| 718 | 718 | */ |
| 719 | 719 | $tabComments = api_preg_split( |
| 720 | 720 | '/\[[^]]+\]/', |
| 721 | - ' ' . $answer . ' ' |
|
| 721 | + ' '.$answer.' ' |
|
| 722 | 722 | ); |
| 723 | 723 | if (!empty($correctAnswerList) && !empty($studentAnswerList)) { |
| 724 | 724 | $answer = ""; |
@@ -735,7 +735,7 @@ discard block |
||
| 735 | 735 | $size |
| 736 | 736 | ); |
| 737 | 737 | |
| 738 | - $answer .= $tabComments[$i] . |
|
| 738 | + $answer .= $tabComments[$i]. |
|
| 739 | 739 | Display::input( |
| 740 | 740 | 'text', |
| 741 | 741 | "choice[$questionId][]", |
@@ -781,12 +781,12 @@ discard block |
||
| 781 | 781 | $s .= '<tr><td width="45%" valign="top">'; |
| 782 | 782 | $parsed_answer = $answer; |
| 783 | 783 | //left part questions |
| 784 | - $s .= '<p class="indent">' . $lines_count . '. ' . $parsed_answer . '</p></td>'; |
|
| 784 | + $s .= '<p class="indent">'.$lines_count.'. '.$parsed_answer.'</p></td>'; |
|
| 785 | 785 | //middle part (matches selects) |
| 786 | 786 | |
| 787 | 787 | $s .= '<td width="10%" valign="top" align="center" > |
| 788 | 788 | <div class="select-matching"> |
| 789 | - <select name="choice[' . $questionId . '][' . $numAnswer . ']">'; |
|
| 789 | + <select name="choice[' . $questionId.']['.$numAnswer.']">'; |
|
| 790 | 790 | |
| 791 | 791 | // fills the list-box |
| 792 | 792 | foreach ($select_items as $key => $val) { |
@@ -802,14 +802,14 @@ discard block |
||
| 802 | 802 | if (isset($user_choice_array_position[$numAnswer]) && $val['id'] == $user_choice_array_position[$numAnswer]) { |
| 803 | 803 | $selected = 'selected="selected"'; |
| 804 | 804 | } |
| 805 | - $s .= '<option value="' . $val['id'] . '" ' . $selected . '>' . $val['letter'] . '</option>'; |
|
| 805 | + $s .= '<option value="'.$val['id'].'" '.$selected.'>'.$val['letter'].'</option>'; |
|
| 806 | 806 | |
| 807 | 807 | } // end foreach() |
| 808 | 808 | |
| 809 | 809 | $s .= '</select></div></td><td width="5%" class="separate"> </td>'; |
| 810 | 810 | $s .= '<td width="40%" valign="top" >'; |
| 811 | 811 | if (isset($select_items[$lines_count])) { |
| 812 | - $s .= '<div class="text-right"><p class="indent">' . $select_items[$lines_count]['letter'].'. '. $select_items[$lines_count]['answer'].'</p></div>'; |
|
| 812 | + $s .= '<div class="text-right"><p class="indent">'.$select_items[$lines_count]['letter'].'. '.$select_items[$lines_count]['answer'].'</p></div>'; |
|
| 813 | 813 | } else { |
| 814 | 814 | $s .= ' '; |
| 815 | 815 | } |
@@ -824,7 +824,7 @@ discard block |
||
| 824 | 824 | $s .= '<tr> |
| 825 | 825 | <td colspan="2"></td> |
| 826 | 826 | <td valign="top">'; |
| 827 | - $s .= '<b>' . $select_items[$lines_count]['letter'] . '.</b> ' . $select_items[$lines_count]['answer']; |
|
| 827 | + $s .= '<b>'.$select_items[$lines_count]['letter'].'.</b> '.$select_items[$lines_count]['answer']; |
|
| 828 | 828 | $s .= "</td> |
| 829 | 829 | </tr>"; |
| 830 | 830 | $lines_count++; |
@@ -840,9 +840,9 @@ discard block |
||
| 840 | 840 | $data = $objAnswerTmp->getAnswerByAutoId($data['correct']); |
| 841 | 841 | $lines_count = $data['answer'];*/ |
| 842 | 842 | |
| 843 | - $windowId = $questionId . '_' . $lines_count; |
|
| 843 | + $windowId = $questionId.'_'.$lines_count; |
|
| 844 | 844 | |
| 845 | - $s .= '<li class="touch-items" id="' . $windowId . '">'; |
|
| 845 | + $s .= '<li class="touch-items" id="'.$windowId.'">'; |
|
| 846 | 846 | $s .= Display::div( |
| 847 | 847 | $parsed_answer, |
| 848 | 848 | [ |
@@ -900,7 +900,7 @@ discard block |
||
| 900 | 900 | Display::tag( |
| 901 | 901 | 'b', |
| 902 | 902 | $select_items[$lines_count]['letter'] |
| 903 | - ) . $select_items[$lines_count]['answer'], |
|
| 903 | + ).$select_items[$lines_count]['answer'], |
|
| 904 | 904 | [ |
| 905 | 905 | 'id' => "window_{$windowId}_answer", |
| 906 | 906 | 'style' => 'display: none;' |
@@ -1044,7 +1044,7 @@ discard block |
||
| 1044 | 1044 | |
| 1045 | 1045 | if ($show_comment) { |
| 1046 | 1046 | $s .= '</table>'; |
| 1047 | - } elseif( |
|
| 1047 | + } elseif ( |
|
| 1048 | 1048 | in_array( |
| 1049 | 1049 | $answerType, |
| 1050 | 1050 | [ |
@@ -1069,7 +1069,7 @@ discard block |
||
| 1069 | 1069 | |
| 1070 | 1070 | for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) { |
| 1071 | 1071 | $answerCorrect = $objAnswerTmp->isCorrect($answerId); |
| 1072 | - $windowId = $questionId . '_' . $counterAnswer; |
|
| 1072 | + $windowId = $questionId.'_'.$counterAnswer; |
|
| 1073 | 1073 | |
| 1074 | 1074 | if ($answerCorrect) { |
| 1075 | 1075 | $s .= Display::div( |
@@ -1114,7 +1114,7 @@ discard block |
||
| 1114 | 1114 | $course = api_get_course_info(); |
| 1115 | 1115 | $doc_id = DocumentManager::get_document_id( |
| 1116 | 1116 | $course, |
| 1117 | - '/images/' . $pictureName |
|
| 1117 | + '/images/'.$pictureName |
|
| 1118 | 1118 | ); |
| 1119 | 1119 | if (is_numeric($doc_id)) { |
| 1120 | 1120 | $images_folder_visibility = api_get_item_visibility( |
@@ -1139,7 +1139,7 @@ discard block |
||
| 1139 | 1139 | echo " |
| 1140 | 1140 | <script> |
| 1141 | 1141 | $(document).on('ready', function () { |
| 1142 | - new " . ($answerType == HOT_SPOT ? "HotspotQuestion" : "DelineationQuestion" ) . "({ |
|
| 1142 | + new " . ($answerType == HOT_SPOT ? "HotspotQuestion" : "DelineationQuestion")."({ |
|
| 1143 | 1143 | questionId: $questionId, |
| 1144 | 1144 | exerciseId: $exerciseId, |
| 1145 | 1145 | selector: '#hotspot-preview-$questionId', |
@@ -1173,7 +1173,7 @@ discard block |
||
| 1173 | 1173 | if ($answerType != HOT_SPOT_DELINEATION) { |
| 1174 | 1174 | $answerList = ' |
| 1175 | 1175 | <div class="well well-sm"> |
| 1176 | - <h5 class="page-header">' . get_lang('HotspotZones') . '</h5> |
|
| 1176 | + <h5 class="page-header">' . get_lang('HotspotZones').'</h5> |
|
| 1177 | 1177 | <ol> |
| 1178 | 1178 | '; |
| 1179 | 1179 | |
@@ -1198,7 +1198,7 @@ discard block |
||
| 1198 | 1198 | if (!$only_questions) { |
| 1199 | 1199 | if ($show_title) { |
| 1200 | 1200 | TestCategory::displayCategoryAndTitle($objQuestionTmp->id); |
| 1201 | - echo '<div class="question_title">' . $current_item . '. ' . $questionName . '</div>'; |
|
| 1201 | + echo '<div class="question_title">'.$current_item.'. '.$questionName.'</div>'; |
|
| 1202 | 1202 | } |
| 1203 | 1203 | //@todo I need to the get the feedback type |
| 1204 | 1204 | echo <<<HOTSPOT |
@@ -1216,7 +1216,7 @@ discard block |
||
| 1216 | 1216 | <div class=\"hotspot-image\"></div> |
| 1217 | 1217 | <script> |
| 1218 | 1218 | $(document).on('ready', function () { |
| 1219 | - new " . ($answerType == HOT_SPOT_DELINEATION ? 'DelineationQuestion' : 'HotspotQuestion') . "({ |
|
| 1219 | + new " . ($answerType == HOT_SPOT_DELINEATION ? 'DelineationQuestion' : 'HotspotQuestion')."({ |
|
| 1220 | 1220 | questionId: $questionId, |
| 1221 | 1221 | exerciseId: $exe_id, |
| 1222 | 1222 | selector: '#question_div_' + $questionId + ' .hotspot-image', |
@@ -1335,11 +1335,11 @@ discard block |
||
| 1335 | 1335 | $lp_id = intval($lp_id); |
| 1336 | 1336 | $lp_item_id = intval($lp_item_id); |
| 1337 | 1337 | return |
| 1338 | - api_get_course_int_id() . '_' . |
|
| 1339 | - api_get_session_id() . '_' . |
|
| 1340 | - $exercise_id . '_' . |
|
| 1341 | - api_get_user_id() . '_' . |
|
| 1342 | - $lp_id . '_' . |
|
| 1338 | + api_get_course_int_id().'_'. |
|
| 1339 | + api_get_session_id().'_'. |
|
| 1340 | + $exercise_id.'_'. |
|
| 1341 | + api_get_user_id().'_'. |
|
| 1342 | + $lp_id.'_'. |
|
| 1343 | 1343 | $lp_item_id; |
| 1344 | 1344 | } |
| 1345 | 1345 | |
@@ -1451,14 +1451,14 @@ discard block |
||
| 1451 | 1451 | $res = Database::query($sql); |
| 1452 | 1452 | $result = array(); |
| 1453 | 1453 | $apiIsAllowedToEdit = api_is_allowed_to_edit(); |
| 1454 | - $urlBase = api_get_path(WEB_CODE_PATH) . |
|
| 1455 | - 'exercice/hotpotatoes_exercise_report.php?action=delete&' . |
|
| 1456 | - api_get_cidreq() . '&id='; |
|
| 1454 | + $urlBase = api_get_path(WEB_CODE_PATH). |
|
| 1455 | + 'exercice/hotpotatoes_exercise_report.php?action=delete&'. |
|
| 1456 | + api_get_cidreq().'&id='; |
|
| 1457 | 1457 | while ($data = Database::fetch_array($res)) { |
| 1458 | 1458 | $actions = null; |
| 1459 | 1459 | |
| 1460 | 1460 | if ($apiIsAllowedToEdit) { |
| 1461 | - $url = $urlBase . $data['id'] . '&path=' . $data['exe_name']; |
|
| 1461 | + $url = $urlBase.$data['id'].'&path='.$data['exe_name']; |
|
| 1462 | 1462 | $actions = Display::url( |
| 1463 | 1463 | Display::return_icon('delete.png', get_lang('Delete')), |
| 1464 | 1464 | $url |
@@ -1474,7 +1474,7 @@ discard block |
||
| 1474 | 1474 | GroupManager::get_user_group_name($data['user_id']) |
| 1475 | 1475 | ), |
| 1476 | 1476 | 'exe_date' => $data['exe_date'], |
| 1477 | - 'score' => $data['exe_result'] . ' / ' . $data['exe_weighting'], |
|
| 1477 | + 'score' => $data['exe_result'].' / '.$data['exe_weighting'], |
|
| 1478 | 1478 | 'actions' => $actions, |
| 1479 | 1479 | ); |
| 1480 | 1480 | } |
@@ -1557,18 +1557,18 @@ discard block |
||
| 1557 | 1557 | $TBL_TRACK_HOTPOTATOES = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES); |
| 1558 | 1558 | $TBL_TRACK_ATTEMPT_RECORDING = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING); |
| 1559 | 1559 | |
| 1560 | - $session_id_and = ' AND te.session_id = ' . $sessionId . ' '; |
|
| 1560 | + $session_id_and = ' AND te.session_id = '.$sessionId.' '; |
|
| 1561 | 1561 | $exercise_id = intval($exercise_id); |
| 1562 | 1562 | |
| 1563 | 1563 | $exercise_where = ''; |
| 1564 | 1564 | if (!empty($exercise_id)) { |
| 1565 | - $exercise_where .= ' AND te.exe_exo_id = ' . $exercise_id . ' '; |
|
| 1565 | + $exercise_where .= ' AND te.exe_exo_id = '.$exercise_id.' '; |
|
| 1566 | 1566 | } |
| 1567 | 1567 | |
| 1568 | 1568 | $hotpotatoe_where = ''; |
| 1569 | 1569 | if (!empty($_GET['path'])) { |
| 1570 | 1570 | $hotpotatoe_path = Database::escape_string($_GET['path']); |
| 1571 | - $hotpotatoe_where .= ' AND exe_name = "' . $hotpotatoe_path . '" '; |
|
| 1571 | + $hotpotatoe_where .= ' AND exe_name = "'.$hotpotatoe_path.'" '; |
|
| 1572 | 1572 | } |
| 1573 | 1573 | |
| 1574 | 1574 | // sql for chamilo-type tests for teacher / tutor view |
@@ -1580,7 +1580,7 @@ discard block |
||
| 1580 | 1580 | WHERE |
| 1581 | 1581 | c_id = $course_id AND |
| 1582 | 1582 | exe_exo_id = $exercise_id AND |
| 1583 | - ttte.session_id = " . $sessionId . " |
|
| 1583 | + ttte.session_id = ".$sessionId." |
|
| 1584 | 1584 | )"; |
| 1585 | 1585 | |
| 1586 | 1586 | if ($is_allowedToEdit) { |
@@ -1603,9 +1603,9 @@ discard block |
||
| 1603 | 1603 | g.id as group_id |
| 1604 | 1604 | FROM $TBL_USER u |
| 1605 | 1605 | INNER JOIN $TBL_GROUP_REL_USER gru |
| 1606 | - ON (gru.user_id = u.user_id AND gru.c_id=" . $course_id . ") |
|
| 1606 | + ON (gru.user_id = u.user_id AND gru.c_id=".$course_id.") |
|
| 1607 | 1607 | INNER JOIN $TBL_GROUP g |
| 1608 | - ON (gru.group_id = g.id AND g.c_id=" . $course_id . ") |
|
| 1608 | + ON (gru.group_id = g.id AND g.c_id=".$course_id.") |
|
| 1609 | 1609 | )"; |
| 1610 | 1610 | } |
| 1611 | 1611 | |
@@ -1667,9 +1667,9 @@ discard block |
||
| 1667 | 1667 | g.id as group_id |
| 1668 | 1668 | FROM $TBL_USER u |
| 1669 | 1669 | LEFT OUTER JOIN $TBL_GROUP_REL_USER gru |
| 1670 | - ON ( gru.user_id = u.user_id AND gru.c_id=" . $course_id . " ) |
|
| 1670 | + ON ( gru.user_id = u.user_id AND gru.c_id=".$course_id." ) |
|
| 1671 | 1671 | LEFT OUTER JOIN $TBL_GROUP g |
| 1672 | - ON (gru.group_id = g.id AND g.c_id = " . $course_id . ") |
|
| 1672 | + ON (gru.group_id = g.id AND g.c_id = ".$course_id.") |
|
| 1673 | 1673 | )"; |
| 1674 | 1674 | } |
| 1675 | 1675 | |
@@ -1682,12 +1682,12 @@ discard block |
||
| 1682 | 1682 | ( |
| 1683 | 1683 | SELECT u.user_id, firstname, lastname, email, username, ' ' as group_name, '' as group_id, official_code |
| 1684 | 1684 | FROM $TBL_USER u |
| 1685 | - WHERE u.status NOT IN(" . api_get_users_status_ignored_in_reports('string') . ") |
|
| 1685 | + WHERE u.status NOT IN(".api_get_users_status_ignored_in_reports('string').") |
|
| 1686 | 1686 | )"; |
| 1687 | 1687 | } |
| 1688 | 1688 | |
| 1689 | 1689 | $sqlFromOption = " , $TBL_GROUP_REL_USER AS gru "; |
| 1690 | - $sqlWhereOption = " AND gru.c_id = " . $course_id ." AND gru.user_id = user.user_id "; |
|
| 1690 | + $sqlWhereOption = " AND gru.c_id = ".$course_id." AND gru.user_id = user.user_id "; |
|
| 1691 | 1691 | $first_and_last_name = api_is_western_name_order() ? "firstname, lastname" : "lastname, firstname"; |
| 1692 | 1692 | |
| 1693 | 1693 | if ($get_count) { |
@@ -1724,8 +1724,8 @@ discard block |
||
| 1724 | 1724 | ON (user.user_id = exe_user_id) |
| 1725 | 1725 | WHERE |
| 1726 | 1726 | te.status != 'incomplete' AND |
| 1727 | - te.c_id = " . $course_id . " $session_id_and AND |
|
| 1728 | - ce.active <>-1 AND ce.c_id = " . $course_id . " |
|
| 1727 | + te.c_id = ".$course_id." $session_id_and AND |
|
| 1728 | + ce.active <>-1 AND ce.c_id = ".$course_id." |
|
| 1729 | 1729 | $exercise_where |
| 1730 | 1730 | $extra_where_conditions |
| 1731 | 1731 | "; |
@@ -1752,12 +1752,12 @@ discard block |
||
| 1752 | 1752 | $sqlFromOption |
| 1753 | 1753 | WHERE |
| 1754 | 1754 | user.user_id=tth.exe_user_id |
| 1755 | - AND tth.c_id = " . $course_id . " |
|
| 1755 | + AND tth.c_id = ".$course_id." |
|
| 1756 | 1756 | $hotpotatoe_where |
| 1757 | 1757 | $sqlWhereOption |
| 1758 | - AND user.status NOT IN(" . api_get_users_status_ignored_in_reports( |
|
| 1758 | + AND user.status NOT IN(".api_get_users_status_ignored_in_reports( |
|
| 1759 | 1759 | 'string' |
| 1760 | - ) . ") |
|
| 1760 | + ).") |
|
| 1761 | 1761 | ORDER BY |
| 1762 | 1762 | tth.c_id ASC, |
| 1763 | 1763 | tth.exe_date DESC"; |
@@ -1830,12 +1830,12 @@ discard block |
||
| 1830 | 1830 | |
| 1831 | 1831 | if ($from_gradebook && ($is_allowedToEdit)) { |
| 1832 | 1832 | if (in_array( |
| 1833 | - $results[$i]['username'] . $results[$i]['firstname'] . $results[$i]['lastname'], |
|
| 1833 | + $results[$i]['username'].$results[$i]['firstname'].$results[$i]['lastname'], |
|
| 1834 | 1834 | $users_array_id |
| 1835 | 1835 | )) { |
| 1836 | 1836 | continue; |
| 1837 | 1837 | } |
| 1838 | - $users_array_id[] = $results[$i]['username'] . $results[$i]['firstname'] . $results[$i]['lastname']; |
|
| 1838 | + $users_array_id[] = $results[$i]['username'].$results[$i]['firstname'].$results[$i]['lastname']; |
|
| 1839 | 1839 | } |
| 1840 | 1840 | |
| 1841 | 1841 | $lp_obj = isset($results[$i]['orig_lp_id']) && isset($lp_list[$results[$i]['orig_lp_id']]) ? $lp_list[$results[$i]['orig_lp_id']] : null; |
@@ -1844,8 +1844,8 @@ discard block |
||
| 1844 | 1844 | if ($lp_obj) { |
| 1845 | 1845 | $url = api_get_path( |
| 1846 | 1846 | WEB_CODE_PATH |
| 1847 | - ) . 'newscorm/lp_controller.php?' . api_get_cidreq( |
|
| 1848 | - ) . '&action=view&lp_id=' . $results[$i]['orig_lp_id']; |
|
| 1847 | + ).'newscorm/lp_controller.php?'.api_get_cidreq( |
|
| 1848 | + ).'&action=view&lp_id='.$results[$i]['orig_lp_id']; |
|
| 1849 | 1849 | $lp_name = Display::url( |
| 1850 | 1850 | $lp_obj['lp_name'], |
| 1851 | 1851 | $url, |
@@ -1863,7 +1863,7 @@ discard block |
||
| 1863 | 1863 | ); |
| 1864 | 1864 | |
| 1865 | 1865 | foreach ($group_list as $id) { |
| 1866 | - $group_name_list .= $clean_group_list[$id] . '<br/>'; |
|
| 1866 | + $group_name_list .= $clean_group_list[$id].'<br/>'; |
|
| 1867 | 1867 | } |
| 1868 | 1868 | $results[$i]['group_name'] = $group_name_list; |
| 1869 | 1869 | } |
@@ -1919,8 +1919,8 @@ discard block |
||
| 1919 | 1919 | } |
| 1920 | 1920 | } |
| 1921 | 1921 | if ($revised) { |
| 1922 | - $actions .= "<a href='exercise_show.php?" . api_get_cidreq( |
|
| 1923 | - ) . "&action=edit&id=$id'>" . |
|
| 1922 | + $actions .= "<a href='exercise_show.php?".api_get_cidreq( |
|
| 1923 | + )."&action=edit&id=$id'>". |
|
| 1924 | 1924 | Display:: return_icon( |
| 1925 | 1925 | 'edit.png', |
| 1926 | 1926 | get_lang('Edit'), |
@@ -1929,8 +1929,8 @@ discard block |
||
| 1929 | 1929 | ); |
| 1930 | 1930 | $actions .= ' '; |
| 1931 | 1931 | } else { |
| 1932 | - $actions .= "<a href='exercise_show.php?" . api_get_cidreq( |
|
| 1933 | - ) . "&action=qualify&id=$id'>" . |
|
| 1932 | + $actions .= "<a href='exercise_show.php?".api_get_cidreq( |
|
| 1933 | + )."&action=qualify&id=$id'>". |
|
| 1934 | 1934 | Display:: return_icon( |
| 1935 | 1935 | 'quiz.gif', |
| 1936 | 1936 | get_lang('Qualify') |
@@ -1940,12 +1940,12 @@ discard block |
||
| 1940 | 1940 | $actions .= "</a>"; |
| 1941 | 1941 | |
| 1942 | 1942 | if ($filter == 2) { |
| 1943 | - $actions .= ' <a href="exercise_history.php?' . api_get_cidreq( |
|
| 1944 | - ) . '&exe_id=' . $id . '">' . |
|
| 1943 | + $actions .= ' <a href="exercise_history.php?'.api_get_cidreq( |
|
| 1944 | + ).'&exe_id='.$id.'">'. |
|
| 1945 | 1945 | Display:: return_icon( |
| 1946 | 1946 | 'history.gif', |
| 1947 | 1947 | get_lang('ViewHistoryChange') |
| 1948 | - ) . '</a>'; |
|
| 1948 | + ).'</a>'; |
|
| 1949 | 1949 | } |
| 1950 | 1950 | |
| 1951 | 1951 | //Admin can always delete the attempt |
@@ -1957,32 +1957,32 @@ discard block |
||
| 1957 | 1957 | date('Y-m-d h:i:s'), |
| 1958 | 1958 | false |
| 1959 | 1959 | ); |
| 1960 | - $actions .= '<a href="http://www.whatsmyip.org/ip-geo-location/?ip=' . $ip . '" target="_blank"> |
|
| 1960 | + $actions .= '<a href="http://www.whatsmyip.org/ip-geo-location/?ip='.$ip.'" target="_blank"> |
|
| 1961 | 1961 | '.Display::return_icon('info.png', $ip).' |
| 1962 | 1962 | </a>'; |
| 1963 | 1963 | |
| 1964 | - $delete_link = '<a href="exercise_report.php?' . api_get_cidreq() . '&filter_by_user=' . intval($_GET['filter_by_user']) . '&filter=' . $filter . '&exerciseId=' . $exercise_id . '&delete=delete&did=' . $id . '" |
|
| 1964 | + $delete_link = '<a href="exercise_report.php?'.api_get_cidreq().'&filter_by_user='.intval($_GET['filter_by_user']).'&filter='.$filter.'&exerciseId='.$exercise_id.'&delete=delete&did='.$id.'" |
|
| 1965 | 1965 | onclick="javascript:if(!confirm(\'' . sprintf( |
| 1966 | 1966 | get_lang('DeleteAttempt'), |
| 1967 | 1967 | $results[$i]['username'], |
| 1968 | 1968 | $dt |
| 1969 | - ) . '\')) return false;">' . Display:: return_icon( |
|
| 1969 | + ).'\')) return false;">'.Display:: return_icon( |
|
| 1970 | 1970 | 'delete.png', |
| 1971 | 1971 | get_lang('Delete') |
| 1972 | - ) . '</a>'; |
|
| 1972 | + ).'</a>'; |
|
| 1973 | 1973 | $delete_link = utf8_encode($delete_link); |
| 1974 | 1974 | |
| 1975 | 1975 | if (api_is_drh() && !api_is_platform_admin()) { |
| 1976 | 1976 | $delete_link = null; |
| 1977 | 1977 | } |
| 1978 | - $actions .= $delete_link . ' '; |
|
| 1978 | + $actions .= $delete_link.' '; |
|
| 1979 | 1979 | } |
| 1980 | 1980 | |
| 1981 | 1981 | } else { |
| 1982 | 1982 | $attempt_url = api_get_path( |
| 1983 | 1983 | WEB_CODE_PATH |
| 1984 | - ) . 'exercice/result.php?' . api_get_cidreq( |
|
| 1985 | - ) . '&id=' . $results[$i]['exe_id'] . '&id_session=' . $sessionId; |
|
| 1984 | + ).'exercice/result.php?'.api_get_cidreq( |
|
| 1985 | + ).'&id='.$results[$i]['exe_id'].'&id_session='.$sessionId; |
|
| 1986 | 1986 | $attempt_link = Display::url( |
| 1987 | 1987 | get_lang('Show'), |
| 1988 | 1988 | $attempt_url, |
@@ -2039,7 +2039,7 @@ discard block |
||
| 2039 | 2039 | $hp_result = round( |
| 2040 | 2040 | ($hpresults[$i][4] / ($hpresults[$i][5] != 0 ? $hpresults[$i][5] : 1)) * 100, |
| 2041 | 2041 | 2 |
| 2042 | - ) . '% (' . $hpresults[$i][4] . ' / ' . $hpresults[$i][5] . ')'; |
|
| 2042 | + ).'% ('.$hpresults[$i][4].' / '.$hpresults[$i][5].')'; |
|
| 2043 | 2043 | if ($is_allowedToEdit) { |
| 2044 | 2044 | $list_info[] = array( |
| 2045 | 2045 | $hpresults[$i][0], |
@@ -2112,13 +2112,13 @@ discard block |
||
| 2112 | 2112 | |
| 2113 | 2113 | $html = null; |
| 2114 | 2114 | if ($show_percentage) { |
| 2115 | - $parent = '(' . $score . ' / ' . $weight . ')'; |
|
| 2116 | - $html = $percentage . "% $parent"; |
|
| 2115 | + $parent = '('.$score.' / '.$weight.')'; |
|
| 2116 | + $html = $percentage."% $parent"; |
|
| 2117 | 2117 | if ($show_only_percentage) { |
| 2118 | - $html = $percentage . "% "; |
|
| 2118 | + $html = $percentage."% "; |
|
| 2119 | 2119 | } |
| 2120 | 2120 | } else { |
| 2121 | - $html = $score . ' / ' . $weight; |
|
| 2121 | + $html = $score.' / '.$weight; |
|
| 2122 | 2122 | } |
| 2123 | 2123 | $html = Display::span($html, array('class' => 'score_exercise')); |
| 2124 | 2124 | |
@@ -2212,7 +2212,7 @@ discard block |
||
| 2212 | 2212 | { |
| 2213 | 2213 | $return = '-'; |
| 2214 | 2214 | if ($value != '') { |
| 2215 | - $return = float_format($value * 100, 1) . ' %'; |
|
| 2215 | + $return = float_format($value * 100, 1).' %'; |
|
| 2216 | 2216 | } |
| 2217 | 2217 | return $return; |
| 2218 | 2218 | } |
@@ -2290,7 +2290,7 @@ discard block |
||
| 2290 | 2290 | } |
| 2291 | 2291 | |
| 2292 | 2292 | $needle_where = !empty($search) ? " AND title LIKE '?' " : ''; |
| 2293 | - $needle = !empty($search) ? "%" . $search . "%" : ''; |
|
| 2293 | + $needle = !empty($search) ? "%".$search."%" : ''; |
|
| 2294 | 2294 | |
| 2295 | 2295 | // Show courses by active status |
| 2296 | 2296 | $active_sql = ''; |
@@ -2305,7 +2305,7 @@ discard block |
||
| 2305 | 2305 | if ($search_all_sessions == true) { |
| 2306 | 2306 | $conditions = array( |
| 2307 | 2307 | 'where' => array( |
| 2308 | - $active_sql . ' c_id = ? ' . $needle_where . $time_conditions => array( |
|
| 2308 | + $active_sql.' c_id = ? '.$needle_where.$time_conditions => array( |
|
| 2309 | 2309 | $course_id, |
| 2310 | 2310 | $needle |
| 2311 | 2311 | ) |
@@ -2316,7 +2316,7 @@ discard block |
||
| 2316 | 2316 | if ($session_id == 0) { |
| 2317 | 2317 | $conditions = array( |
| 2318 | 2318 | 'where' => array( |
| 2319 | - $active_sql . ' session_id = ? AND c_id = ? ' . $needle_where . $time_conditions => array( |
|
| 2319 | + $active_sql.' session_id = ? AND c_id = ? '.$needle_where.$time_conditions => array( |
|
| 2320 | 2320 | $session_id, |
| 2321 | 2321 | $course_id, |
| 2322 | 2322 | $needle |
@@ -2327,7 +2327,7 @@ discard block |
||
| 2327 | 2327 | } else { |
| 2328 | 2328 | $conditions = array( |
| 2329 | 2329 | 'where' => array( |
| 2330 | - $active_sql . ' (session_id = 0 OR session_id = ? ) AND c_id = ? ' . $needle_where . $time_conditions => array( |
|
| 2330 | + $active_sql.' (session_id = 0 OR session_id = ? ) AND c_id = ? '.$needle_where.$time_conditions => array( |
|
| 2331 | 2331 | $session_id, |
| 2332 | 2332 | $course_id, |
| 2333 | 2333 | $needle |
@@ -2506,7 +2506,7 @@ discard block |
||
| 2506 | 2506 | |
| 2507 | 2507 | if ($return_string) { |
| 2508 | 2508 | if (!empty($position) && !empty($my_ranking)) { |
| 2509 | - $return_value = $position . '/' . count($my_ranking); |
|
| 2509 | + $return_value = $position.'/'.count($my_ranking); |
|
| 2510 | 2510 | } else { |
| 2511 | 2511 | $return_value = '-'; |
| 2512 | 2512 | } |
@@ -2586,7 +2586,7 @@ discard block |
||
| 2586 | 2586 | |
| 2587 | 2587 | if ($return_string) { |
| 2588 | 2588 | if (!empty($position) && !empty($my_ranking)) { |
| 2589 | - return $position . '/' . count($my_ranking); |
|
| 2589 | + return $position.'/'.count($my_ranking); |
|
| 2590 | 2590 | } |
| 2591 | 2591 | } |
| 2592 | 2592 | return $return_value; |
@@ -2986,7 +2986,7 @@ discard block |
||
| 2986 | 2986 | $courseCondition = " |
| 2987 | 2987 | INNER JOIN $courseUser cu |
| 2988 | 2988 | ON cu.c_id = c.id AND cu.user_id = exe_user_id"; |
| 2989 | - $courseConditionWhere = " AND relation_type <> 2 AND cu.status = " . STUDENT; |
|
| 2989 | + $courseConditionWhere = " AND relation_type <> 2 AND cu.status = ".STUDENT; |
|
| 2990 | 2990 | } else { |
| 2991 | 2991 | $courseCondition = " |
| 2992 | 2992 | INNER JOIN $courseUserSession cu |
@@ -3061,7 +3061,7 @@ discard block |
||
| 3061 | 3061 | $courseCondition = " |
| 3062 | 3062 | INNER JOIN $courseUser cu |
| 3063 | 3063 | ON cu.c_id = c.id AND cu.user_id = exe_user_id"; |
| 3064 | - $courseConditionWhere = " AND relation_type <> 2 AND cu.status = " . STUDENT; |
|
| 3064 | + $courseConditionWhere = " AND relation_type <> 2 AND cu.status = ".STUDENT; |
|
| 3065 | 3065 | } else { |
| 3066 | 3066 | $courseCondition = " |
| 3067 | 3067 | INNER JOIN $courseUserSession cu |
@@ -3153,7 +3153,7 @@ discard block |
||
| 3153 | 3153 | $courseCondition = " |
| 3154 | 3154 | INNER JOIN $courseUser cu |
| 3155 | 3155 | ON cu.c_id = c.id AND cu.user_id = exe_user_id"; |
| 3156 | - $courseConditionWhere = " AND relation_type <> 2 AND cu.status = " . STUDENT; |
|
| 3156 | + $courseConditionWhere = " AND relation_type <> 2 AND cu.status = ".STUDENT; |
|
| 3157 | 3157 | } else { |
| 3158 | 3158 | $courseCondition = " |
| 3159 | 3159 | INNER JOIN $courseUserSession cu |
@@ -3335,7 +3335,7 @@ discard block |
||
| 3335 | 3335 | } |
| 3336 | 3336 | } |
| 3337 | 3337 | // adds the correct word, followed by ] to close the blank |
| 3338 | - $answer .= ' / <font color="green"><b>' . $real_correct_tags[$i] . '</b></font>]'; |
|
| 3338 | + $answer .= ' / <font color="green"><b>'.$real_correct_tags[$i].'</b></font>]'; |
|
| 3339 | 3339 | if (isset ($real_text[$i + 1])) { |
| 3340 | 3340 | $answer .= $real_text[$i + 1]; |
| 3341 | 3341 | } |
@@ -3394,13 +3394,13 @@ discard block |
||
| 3394 | 3394 | // check the default value of option |
| 3395 | 3395 | $tabSelected = array($in_default => " selected='selected' "); |
| 3396 | 3396 | $res = ""; |
| 3397 | - $res .= "<select name='$in_name' id='$in_name' onchange='" . $in_onchange . "' >"; |
|
| 3398 | - $res .= "<option value='-1'" . $tabSelected["-1"] . ">-- " . get_lang( |
|
| 3397 | + $res .= "<select name='$in_name' id='$in_name' onchange='".$in_onchange."' >"; |
|
| 3398 | + $res .= "<option value='-1'".$tabSelected["-1"].">-- ".get_lang( |
|
| 3399 | 3399 | 'AllGroups' |
| 3400 | - ) . " --</option>"; |
|
| 3401 | - $res .= "<option value='0'" . $tabSelected["0"] . ">- " . get_lang( |
|
| 3400 | + )." --</option>"; |
|
| 3401 | + $res .= "<option value='0'".$tabSelected["0"].">- ".get_lang( |
|
| 3402 | 3402 | 'NotInAGroup' |
| 3403 | - ) . " -</option>"; |
|
| 3403 | + )." -</option>"; |
|
| 3404 | 3404 | $tabGroups = GroupManager::get_group_list(); |
| 3405 | 3405 | $currentCatId = 0; |
| 3406 | 3406 | for ($i = 0; $i < count($tabGroups); $i++) { |
@@ -3408,10 +3408,10 @@ discard block |
||
| 3408 | 3408 | $tabGroups[$i]["id"] |
| 3409 | 3409 | ); |
| 3410 | 3410 | if ($tabCategory["id"] != $currentCatId) { |
| 3411 | - $res .= "<option value='-1' disabled='disabled'>" . $tabCategory["title"] . "</option>"; |
|
| 3411 | + $res .= "<option value='-1' disabled='disabled'>".$tabCategory["title"]."</option>"; |
|
| 3412 | 3412 | $currentCatId = $tabCategory["id"]; |
| 3413 | 3413 | } |
| 3414 | - $res .= "<option " . $tabSelected[$tabGroups[$i]["id"]] . "style='margin-left:40px' value='" . $tabGroups[$i]["id"] . "'>" . $tabGroups[$i]["name"] . "</option>"; |
|
| 3414 | + $res .= "<option ".$tabSelected[$tabGroups[$i]["id"]]."style='margin-left:40px' value='".$tabGroups[$i]["id"]."'>".$tabGroups[$i]["name"]."</option>"; |
|
| 3415 | 3415 | } |
| 3416 | 3416 | $res .= "</select>"; |
| 3417 | 3417 | return $res; |
@@ -3643,14 +3643,14 @@ discard block |
||
| 3643 | 3643 | if ($show_results) { |
| 3644 | 3644 | $comnt = Event::get_comments($exe_id, $questionId); |
| 3645 | 3645 | if (!empty($comnt)) { |
| 3646 | - echo '<b>' . get_lang('Feedback') . '</b>'; |
|
| 3647 | - echo '<div id="question_feedback">' . $comnt . '</div>'; |
|
| 3646 | + echo '<b>'.get_lang('Feedback').'</b>'; |
|
| 3647 | + echo '<div id="question_feedback">'.$comnt.'</div>'; |
|
| 3648 | 3648 | } |
| 3649 | 3649 | } |
| 3650 | 3650 | |
| 3651 | 3651 | if ($show_results) { |
| 3652 | 3652 | $score = array( |
| 3653 | - 'result' => get_lang('Score') . " : " . self::show_score( |
|
| 3653 | + 'result' => get_lang('Score')." : ".self::show_score( |
|
| 3654 | 3654 | $my_total_score, |
| 3655 | 3655 | $my_total_weight, |
| 3656 | 3656 | false, |
@@ -3724,13 +3724,13 @@ discard block |
||
| 3724 | 3724 | } |
| 3725 | 3725 | |
| 3726 | 3726 | if ($show_all_but_expected_answer) { |
| 3727 | - $exercise_content .= "<div class='normal-message'>" . get_lang( |
|
| 3727 | + $exercise_content .= "<div class='normal-message'>".get_lang( |
|
| 3728 | 3728 | "ExerciseWithFeedbackWithoutCorrectionComment" |
| 3729 | - ) . "</div>"; |
|
| 3729 | + )."</div>"; |
|
| 3730 | 3730 | } |
| 3731 | 3731 | // Remove audio auto play from questions on results page - refs BT#7939 |
| 3732 | 3732 | $exercise_content = preg_replace( |
| 3733 | - ['/autoplay[\=\".+\"]+/','/autostart[\=\".+\"]+/'], |
|
| 3733 | + ['/autoplay[\=\".+\"]+/', '/autostart[\=\".+\"]+/'], |
|
| 3734 | 3734 | '', |
| 3735 | 3735 | $exercise_content |
| 3736 | 3736 | ); |
@@ -3824,11 +3824,11 @@ discard block |
||
| 3824 | 3824 | $ribbon_total_success_or_error = ' ribbon-total-error'; |
| 3825 | 3825 | } |
| 3826 | 3826 | } |
| 3827 | - $ribbon .= '<div class="total ' . $ribbon_total_success_or_error . '">'; |
|
| 3827 | + $ribbon .= '<div class="total '.$ribbon_total_success_or_error.'">'; |
|
| 3828 | 3828 | } else { |
| 3829 | 3829 | $ribbon .= '<div class="total">'; |
| 3830 | 3830 | } |
| 3831 | - $ribbon .= '<h3>' . get_lang('YourTotalScore') . ": "; |
|
| 3831 | + $ribbon .= '<h3>'.get_lang('YourTotalScore').": "; |
|
| 3832 | 3832 | $ribbon .= self::show_score($score, $weight, false, true); |
| 3833 | 3833 | $ribbon .= '</h3>'; |
| 3834 | 3834 | $ribbon .= '</div>'; |
@@ -30,10 +30,10 @@ discard block |
||
| 30 | 30 | $exercise_id = intval($_GET['exercise_id']); |
| 31 | 31 | $page = intval($_REQUEST['page']); //page |
| 32 | 32 | $limit = intval($_REQUEST['rows']); //quantity of rows |
| 33 | - $sidx = $_REQUEST['sidx']; //index to filter |
|
| 34 | - $sord = $_REQUEST['sord']; //asc or desc |
|
| 33 | + $sidx = $_REQUEST['sidx']; //index to filter |
|
| 34 | + $sord = $_REQUEST['sord']; //asc or desc |
|
| 35 | 35 | |
| 36 | - if (!in_array($sord, array('asc','desc'))) { |
|
| 36 | + if (!in_array($sord, array('asc', 'desc'))) { |
|
| 37 | 37 | $sord = 'desc'; |
| 38 | 38 | } |
| 39 | 39 | // get index row - i.e. user click to sort $sord = $_GET['sord']; |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $total_pages = 0; |
| 63 | 63 | if ($count > 0) { |
| 64 | 64 | if (!empty($limit)) { |
| 65 | - $total_pages = ceil($count/$limit); |
|
| 65 | + $total_pages = ceil($count / $limit); |
|
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | $response->page = $page; |
| 125 | 125 | $response->total = $total_pages; |
| 126 | 126 | $response->records = $count; |
| 127 | - $i=0; |
|
| 127 | + $i = 0; |
|
| 128 | 128 | |
| 129 | 129 | if (!empty($results)) { |
| 130 | 130 | foreach ($results as $row) { |
@@ -138,22 +138,22 @@ discard block |
||
| 138 | 138 | GROUP by question_id |
| 139 | 139 | ) as count_table"; |
| 140 | 140 | $result_count = Database::query($sql); |
| 141 | - $count_questions = Database::fetch_array($result_count,'ASSOC'); |
|
| 141 | + $count_questions = Database::fetch_array($result_count, 'ASSOC'); |
|
| 142 | 142 | $count_questions = $count_questions['count_question_id']; |
| 143 | 143 | |
| 144 | 144 | $row['count_questions'] = $count_questions; |
| 145 | 145 | |
| 146 | 146 | $response->rows[$i]['id'] = $row['exe_id']; |
| 147 | - $remaining = strtotime($row['start_date'])+($oExe->expired_time*60) - strtotime(api_get_utc_datetime(time())); |
|
| 148 | - $h = floor($remaining/3600); |
|
| 149 | - $m = floor(($remaining - ($h*3600))/60); |
|
| 150 | - $s = ($remaining - ($h*3600) - ($m*60)); |
|
| 147 | + $remaining = strtotime($row['start_date']) + ($oExe->expired_time * 60) - strtotime(api_get_utc_datetime(time())); |
|
| 148 | + $h = floor($remaining / 3600); |
|
| 149 | + $m = floor(($remaining - ($h * 3600)) / 60); |
|
| 150 | + $s = ($remaining - ($h * 3600) - ($m * 60)); |
|
| 151 | 151 | $array = array( |
| 152 | 152 | $row['firstname'], |
| 153 | 153 | $row['lastname'], |
| 154 | - api_format_date($row['start_date'], DATE_TIME_FORMAT_LONG).' ['.($h>0?$h.':':'').sprintf("%02d",$m).':'.sprintf("%02d",$s).']', |
|
| 154 | + api_format_date($row['start_date'], DATE_TIME_FORMAT_LONG).' ['.($h > 0 ? $h.':' : '').sprintf("%02d", $m).':'.sprintf("%02d", $s).']', |
|
| 155 | 155 | $row['count_questions'], |
| 156 | - round($row['score']*100).'%' |
|
| 156 | + round($row['score'] * 100).'%' |
|
| 157 | 157 | ); |
| 158 | 158 | $response->rows[$i]['cell'] = $array; |
| 159 | 159 | $i++; |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | break; |
| 210 | 210 | case 'add_question_to_reminder': |
| 211 | 211 | /** @var Exercise $objExercise */ |
| 212 | - $objExercise = $_SESSION['objExercise']; |
|
| 212 | + $objExercise = $_SESSION['objExercise']; |
|
| 213 | 213 | if (empty($objExercise)) { |
| 214 | 214 | echo 0; |
| 215 | 215 | exit; |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | |
| 363 | 363 | // Getting free choice data. |
| 364 | 364 | if ($objQuestionTmp->type == FREE_ANSWER && $type == 'all') { |
| 365 | - $my_choice = isset($_REQUEST['free_choice'][$my_question_id]) && !empty($_REQUEST['free_choice'][$my_question_id]) ? $_REQUEST['free_choice'][$my_question_id]: null; |
|
| 365 | + $my_choice = isset($_REQUEST['free_choice'][$my_question_id]) && !empty($_REQUEST['free_choice'][$my_question_id]) ? $_REQUEST['free_choice'][$my_question_id] : null; |
|
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | if ($type == 'all') { |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | $session_id, |
| 407 | 407 | $my_question_id |
| 408 | 408 | ); |
| 409 | - if ($objQuestionTmp->type == HOT_SPOT) { |
|
| 409 | + if ($objQuestionTmp->type == HOT_SPOT) { |
|
| 410 | 410 | Event::delete_attempt_hotspot( |
| 411 | 411 | $exe_id, |
| 412 | 412 | api_get_user_id(), |