@@ -260,10 +260,10 @@ discard block |
||
260 | 260 | ['id' => 'answer', 'onkeyup' => "javascript: updateBlanks(this);"], |
261 | 261 | array('ToolbarSet' => 'TestQuestionDescription') |
262 | 262 | ); |
263 | - $form->addRule('answer',get_lang('GiveText'),'required'); |
|
263 | + $form->addRule('answer', get_lang('GiveText'), 'required'); |
|
264 | 264 | |
265 | 265 | //added multiple answers |
266 | - $form->addElement('checkbox','multiple_answer','', get_lang('FillInBlankSwitchable')); |
|
266 | + $form->addElement('checkbox', 'multiple_answer', '', get_lang('FillInBlankSwitchable')); |
|
267 | 267 | $form->addElement( |
268 | 268 | 'select', |
269 | 269 | 'select_separator', |
@@ -276,11 +276,11 @@ discard block |
||
276 | 276 | null, |
277 | 277 | '<input type="button" onclick="updateBlanks()" value="'.get_lang('RefreshBlanks').'" class="btn btn-default" />' |
278 | 278 | ); |
279 | - $form->addElement('html','<div id="blanks_weighting"></div>'); |
|
279 | + $form->addElement('html', '<div id="blanks_weighting"></div>'); |
|
280 | 280 | |
281 | 281 | global $text; |
282 | 282 | // setting the save button here and not in the question class.php |
283 | - $form->addElement('html','<div id="defineoneblank" style="color:#D04A66; margin-left:160px">'.get_lang('DefineBlanks').'</div>'); |
|
283 | + $form->addElement('html', '<div id="defineoneblank" style="color:#D04A66; margin-left:160px">'.get_lang('DefineBlanks').'</div>'); |
|
284 | 284 | $form->addButtonSave($text, 'submitQuestion'); |
285 | 285 | |
286 | 286 | if (!empty($this->id)) { |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | // remove spaces at the beginning and the end of text in square brackets |
321 | 321 | $answer = preg_replace_callback( |
322 | 322 | "/".$blankStartSeparatorRegexp."[^]]+".$blankEndSeparatorRegexp."/", |
323 | - function ($matches) use ($blankStartSeparator, $blankEndSeparator) { |
|
323 | + function($matches) use ($blankStartSeparator, $blankEndSeparator) { |
|
324 | 324 | $matchingResult = $matches[0]; |
325 | 325 | $matchingResult = trim($matchingResult, $blankStartSeparator); |
326 | 326 | $matchingResult = trim($matchingResult, $blankEndSeparator); |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | if ($nb > 0) { |
366 | 366 | $answer .= '::'; |
367 | 367 | // weighting |
368 | - for ($i=0; $i < $nb; ++$i) { |
|
368 | + for ($i = 0; $i < $nb; ++$i) { |
|
369 | 369 | // enter the weighting of word $i |
370 | 370 | $answer .= $form->getSubmitValue('weighting['.$i.']'); |
371 | 371 | // not the last word, add "," |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | |
379 | 379 | // input width |
380 | 380 | $answer .= ":"; |
381 | - for ($i=0; $i < $nb; ++$i) { |
|
381 | + for ($i = 0; $i < $nb; ++$i) { |
|
382 | 382 | // enter the width of input for word $i |
383 | 383 | $answer .= $form->getSubmitValue('sizeofinput['.$i.']'); |
384 | 384 | // not the last word, add "," |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | |
404 | 404 | // Allow answers order switches |
405 | 405 | $is_multiple = $form -> getSubmitValue('multiple_answer'); |
406 | - $answer.= '@'.$is_multiple; |
|
406 | + $answer .= '@'.$is_multiple; |
|
407 | 407 | |
408 | 408 | $this->save(); |
409 | 409 | $objAnswer = new Answer($this->id); |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | public function return_header($feedback_type = null, $counter = null, $score = null) |
421 | 421 | { |
422 | 422 | $header = parent::return_header($feedback_type, $counter, $score); |
423 | - $header .= '<table class="'.$this->question_table_class .'"> |
|
423 | + $header .= '<table class="'.$this->question_table_class.'"> |
|
424 | 424 | <tr> |
425 | 425 | <th>'.get_lang("Answer").'</th> |
426 | 426 | </tr>'; |
@@ -464,13 +464,13 @@ discard block |
||
464 | 464 | // if display for student, shuffle the correct answer menu |
465 | 465 | $listMenu = self::getFillTheBlankMenuAnswers($inTeacherSolution, $displayForStudent); |
466 | 466 | $result .= '<select name="choice['.$questionId.'][]">'; |
467 | - for ($k=0; $k < count($listMenu); $k++) { |
|
467 | + for ($k = 0; $k < count($listMenu); $k++) { |
|
468 | 468 | $selected = ""; |
469 | 469 | if ($correctItem == $listMenu[$k]) { |
470 | 470 | $selected = " selected=selected "; |
471 | 471 | } |
472 | 472 | // if in teacher view, display the first item by default, which is the right answer |
473 | - if ($k==0 && !$displayForStudent) { |
|
473 | + if ($k == 0 && !$displayForStudent) { |
|
474 | 474 | $selected = " selected=selected "; |
475 | 475 | } |
476 | 476 | $optionMenu .= '<option '.$selected.' value="'.$listMenu[$k].'">'.$listMenu[$k].'</option>'; |
@@ -642,10 +642,10 @@ discard block |
||
642 | 642 | if (count($listDetails) < 3) { |
643 | 643 | $listWeightings = explode(',', $listDetails[0]); |
644 | 644 | $listSizeOfInput = array(); |
645 | - for ($i=0; $i < count($listWeightings); $i++) { |
|
645 | + for ($i = 0; $i < count($listWeightings); $i++) { |
|
646 | 646 | $listSizeOfInput[] = 200; |
647 | 647 | } |
648 | - $blankSeparatorNumber = 0; // 0 is [...] |
|
648 | + $blankSeparatorNumber = 0; // 0 is [...] |
|
649 | 649 | } else { |
650 | 650 | $listWeightings = explode(',', $listDetails[0]); |
651 | 651 | $listSizeOfInput = explode(',', $listDetails[1]); |
@@ -677,9 +677,9 @@ discard block |
||
677 | 677 | // remove [ and ] in string |
678 | 678 | array_walk( |
679 | 679 | $listWords[0], |
680 | - function (&$value, $key, $tabBlankChar) { |
|
680 | + function(&$value, $key, $tabBlankChar) { |
|
681 | 681 | $trimChars = ""; |
682 | - for ($i=0; $i < count($tabBlankChar); $i++) { |
|
682 | + for ($i = 0; $i < count($tabBlankChar); $i++) { |
|
683 | 683 | $trimChars .= $tabBlankChar[$i]; |
684 | 684 | } |
685 | 685 | $value = trim($value, $trimChars); |
@@ -699,18 +699,18 @@ discard block |
||
699 | 699 | // if student answer, the second [] is the student answer, |
700 | 700 | // the third is if student scored or not |
701 | 701 | $listBrackets = array(); |
702 | - $listWords = array(); |
|
702 | + $listWords = array(); |
|
703 | 703 | |
704 | 704 | if ($isStudentAnswer) { |
705 | - for ($i=0; $i < count($listAnswerResults['tabwords']); $i++) { |
|
705 | + for ($i = 0; $i < count($listAnswerResults['tabwords']); $i++) { |
|
706 | 706 | $listBrackets[] = $listAnswerResults['tabwordsbracket'][$i]; |
707 | 707 | $listWords[] = $listAnswerResults['tabwords'][$i]; |
708 | - if ($i+1 < count($listAnswerResults['tabwords'])) { |
|
708 | + if ($i + 1 < count($listAnswerResults['tabwords'])) { |
|
709 | 709 | // should always be |
710 | 710 | $i++; |
711 | 711 | } |
712 | 712 | $listAnswerResults['studentanswer'][] = $listAnswerResults['tabwords'][$i]; |
713 | - if ($i+1 < count($listAnswerResults['tabwords'])) { |
|
713 | + if ($i + 1 < count($listAnswerResults['tabwords'])) { |
|
714 | 714 | // should always be |
715 | 715 | $i++; |
716 | 716 | } |
@@ -802,9 +802,9 @@ discard block |
||
802 | 802 | break; |
803 | 803 | default : |
804 | 804 | if (FillBlanks::isGoodStudentAnswer($tabAnswer['studentanswer'][$bracketNumber], $tabAnswer['tabwords'][$bracketNumber])) { |
805 | - $tabUserResult[$data['user_id']][$bracketNumber] = 0; // right answer |
|
805 | + $tabUserResult[$data['user_id']][$bracketNumber] = 0; // right answer |
|
806 | 806 | } else { |
807 | - $tabUserResult[$data['user_id']][$bracketNumber] = -1; // wrong answer |
|
807 | + $tabUserResult[$data['user_id']][$bracketNumber] = -1; // wrong answer |
|
808 | 808 | } |
809 | 809 | } |
810 | 810 | } else { |
@@ -812,11 +812,11 @@ discard block |
||
812 | 812 | if ($useLastAnswerredAttempt) { |
813 | 813 | // if we take into account the last answered attempt |
814 | 814 | if (!isset($tabUserResult[$data['user_id']][$bracketNumber])) { |
815 | - $tabUserResult[$data['user_id']][$bracketNumber] = -2; // not answered |
|
815 | + $tabUserResult[$data['user_id']][$bracketNumber] = -2; // not answered |
|
816 | 816 | } |
817 | 817 | } else { |
818 | 818 | // we take the last attempt, even if the student answer the question before |
819 | - $tabUserResult[$data['user_id']][$bracketNumber] = -2; // not answered |
|
819 | + $tabUserResult[$data['user_id']][$bracketNumber] = -2; // not answered |
|
820 | 820 | } |
821 | 821 | } |
822 | 822 | } |
@@ -837,10 +837,10 @@ discard block |
||
837 | 837 | { |
838 | 838 | $outRes = 0; |
839 | 839 | // for each student in group |
840 | - foreach($resultList as $userId => $tabValue) { |
|
840 | + foreach ($resultList as $userId => $tabValue) { |
|
841 | 841 | $trouve = false; |
842 | 842 | // for each bracket, if student has at leat one answer ( choice > -2) then he pass the question |
843 | - foreach($tabValue as $i => $choice) { |
|
843 | + foreach ($tabValue as $i => $choice) { |
|
844 | 844 | if ($choice > -2 && !$trouve) { |
845 | 845 | $outRes++; |
846 | 846 | $trouve = true; |
@@ -862,7 +862,7 @@ discard block |
||
862 | 862 | $separatorEnd = $listWithStudentAnswer['blankseparatorend']; |
863 | 863 | // lets rebuild the sentence with [correct answer][student answer][answer is correct] |
864 | 864 | $result = ""; |
865 | - for ($i=0; $i < count($listWithStudentAnswer['commonwords']) - 1; $i++) { |
|
865 | + for ($i = 0; $i < count($listWithStudentAnswer['commonwords']) - 1; $i++) { |
|
866 | 866 | $result .= $listWithStudentAnswer['commonwords'][$i]; |
867 | 867 | $result .= $listWithStudentAnswer['tabwordsbracket'][$i]; |
868 | 868 | $result .= $separatorStart.$listWithStudentAnswer['studentanswer'][$i].$separatorEnd; |
@@ -944,7 +944,7 @@ discard block |
||
944 | 944 | ")", |
945 | 945 | ]; |
946 | 946 | $result = $text; |
947 | - for ($i=0; $i < count($listRegexpCharacters); $i++) { |
|
947 | + for ($i = 0; $i < count($listRegexpCharacters); $i++) { |
|
948 | 948 | $result = str_replace($listRegexpCharacters[$i], "\\".$listRegexpCharacters[$i], $result); |
949 | 949 | } |
950 | 950 | |
@@ -1006,7 +1006,7 @@ discard block |
||
1006 | 1006 | { |
1007 | 1007 | $listResults = array(); |
1008 | 1008 | $fillBlanksAllowedSeparator = self::getAllowedSeparator(); |
1009 | - for ($i=0; $i < count($fillBlanksAllowedSeparator); $i++) { |
|
1009 | + for ($i = 0; $i < count($fillBlanksAllowedSeparator); $i++) { |
|
1010 | 1010 | $listResults[] = $fillBlanksAllowedSeparator[$i][0]."...".$fillBlanksAllowedSeparator[$i][1]; |
1011 | 1011 | } |
1012 | 1012 | |
@@ -1024,7 +1024,7 @@ discard block |
||
1024 | 1024 | { |
1025 | 1025 | $listSeparators = self::getAllowedSeparator(); |
1026 | 1026 | $result = 0; |
1027 | - for ($i=0; $i < count($listSeparators); $i++) { |
|
1027 | + for ($i = 0; $i < count($listSeparators); $i++) { |
|
1028 | 1028 | if ($listSeparators[$i][0] == $startSeparator && |
1029 | 1029 | $listSeparators[$i][1] == $endSeparator |
1030 | 1030 | ) { |
@@ -1049,7 +1049,7 @@ discard block |
||
1049 | 1049 | |
1050 | 1050 | // rebuild the answer with good HTML style |
1051 | 1051 | // this is the student answer, right or wrong |
1052 | - for ($i=0; $i < count($listStudentAnswerInfo['studentanswer']); $i++) { |
|
1052 | + for ($i = 0; $i < count($listStudentAnswerInfo['studentanswer']); $i++) { |
|
1053 | 1053 | if ($listStudentAnswerInfo['studentscore'][$i] == 1) { |
1054 | 1054 | $listStudentAnswerInfo['studentanswer'][$i] = self::getHtmlRightAnswer( |
1055 | 1055 | $listStudentAnswerInfo['studentanswer'][$i], |
@@ -1067,7 +1067,7 @@ discard block |
||
1067 | 1067 | |
1068 | 1068 | |
1069 | 1069 | // rebuild the sentence with student answer inserted |
1070 | - for ($i=0; $i < count($listStudentAnswerInfo['commonwords']); $i++) { |
|
1070 | + for ($i = 0; $i < count($listStudentAnswerInfo['commonwords']); $i++) { |
|
1071 | 1071 | $result .= isset($listStudentAnswerInfo['commonwords'][$i]) ? $listStudentAnswerInfo['commonwords'][$i] : ''; |
1072 | 1072 | $result .= isset($listStudentAnswerInfo['studentanswer'][$i]) ? $listStudentAnswerInfo['studentanswer'][$i] : ''; |
1073 | 1073 | } |
@@ -1100,7 +1100,7 @@ discard block |
||
1100 | 1100 | $listPossibleAnswers = FillBlanks::getFillTheBlankMenuAnswers($correct, false); |
1101 | 1101 | $correctAnswerHtml .= "<span style='color: green'>".$listPossibleAnswers[0]."</span>"; |
1102 | 1102 | $correctAnswerHtml .= " <span style='font-weight:normal'>("; |
1103 | - for ($i=1; $i < count($listPossibleAnswers); $i++) { |
|
1103 | + for ($i = 1; $i < count($listPossibleAnswers); $i++) { |
|
1104 | 1104 | $correctAnswerHtml .= $listPossibleAnswers[$i]; |
1105 | 1105 | if ($i != count($listPossibleAnswers) - 1) { |
1106 | 1106 | $correctAnswerHtml .= " | "; |
@@ -728,43 +728,43 @@ discard block |
||
728 | 728 | } |
729 | 729 | |
730 | 730 | /** |
731 | - * Return an array of student state answers for fill the blank questions |
|
732 | - * for each students that answered the question |
|
733 | - * -2 : didn't answer |
|
734 | - * -1 : student answer is wrong |
|
735 | - * 0 : student answer is correct |
|
736 | - * >0 : for fill the blank question with choice menu, is the index of the student answer (right answer indice is 0) |
|
737 | - * |
|
738 | - * @param integer $testId |
|
739 | - * @param integer $questionId |
|
740 | - * @param $studentsIdList |
|
741 | - * @param string $startDate |
|
742 | - * @param string $endDate |
|
743 | - * @param bool $useLastAnswerredAttempt |
|
744 | - * @return array |
|
745 | - * ( |
|
746 | - * [student_id] => Array |
|
747 | - * ( |
|
748 | - * [first fill the blank for question] => -1 |
|
749 | - * [second fill the blank for question] => 2 |
|
750 | - * [third fill the blank for question] => -1 |
|
751 | - * ) |
|
752 | - * ) |
|
753 | - */ |
|
731 | + * Return an array of student state answers for fill the blank questions |
|
732 | + * for each students that answered the question |
|
733 | + * -2 : didn't answer |
|
734 | + * -1 : student answer is wrong |
|
735 | + * 0 : student answer is correct |
|
736 | + * >0 : for fill the blank question with choice menu, is the index of the student answer (right answer indice is 0) |
|
737 | + * |
|
738 | + * @param integer $testId |
|
739 | + * @param integer $questionId |
|
740 | + * @param $studentsIdList |
|
741 | + * @param string $startDate |
|
742 | + * @param string $endDate |
|
743 | + * @param bool $useLastAnswerredAttempt |
|
744 | + * @return array |
|
745 | + * ( |
|
746 | + * [student_id] => Array |
|
747 | + * ( |
|
748 | + * [first fill the blank for question] => -1 |
|
749 | + * [second fill the blank for question] => 2 |
|
750 | + * [third fill the blank for question] => -1 |
|
751 | + * ) |
|
752 | + * ) |
|
753 | + */ |
|
754 | 754 | public static function getFillTheBlankTabResult($testId, $questionId, $studentsIdList, $startDate, $endDate, $useLastAnswerredAttempt = true) { |
755 | 755 | |
756 | - $tblTrackEAttempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); |
|
757 | - $tblTrackEExercise = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
758 | - $courseId = api_get_course_int_id(); |
|
756 | + $tblTrackEAttempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); |
|
757 | + $tblTrackEExercise = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
758 | + $courseId = api_get_course_int_id(); |
|
759 | 759 | |
760 | - require_once api_get_path(SYS_PATH).'main/exercice/fill_blanks.class.php'; |
|
760 | + require_once api_get_path(SYS_PATH).'main/exercice/fill_blanks.class.php'; |
|
761 | 761 | |
762 | - // request to have all the answers of student for this question |
|
763 | - // student may have doing it several time |
|
764 | - // student may have not answered the bracket id, in this case, is result of the answer is empty |
|
762 | + // request to have all the answers of student for this question |
|
763 | + // student may have doing it several time |
|
764 | + // student may have not answered the bracket id, in this case, is result of the answer is empty |
|
765 | 765 | |
766 | - // we got the less recent attempt first |
|
767 | - $sql = ' |
|
766 | + // we got the less recent attempt first |
|
767 | + $sql = ' |
|
768 | 768 | SELECT * FROM '.$tblTrackEAttempt.' tea |
769 | 769 | |
770 | 770 | LEFT JOIN '.$tblTrackEExercise.' tee |
@@ -780,49 +780,49 @@ discard block |
||
780 | 780 | ORDER BY user_id, tea.exe_id; |
781 | 781 | '; |
782 | 782 | |
783 | - $res = Database::query($sql); |
|
784 | - $tabUserResult = array(); |
|
785 | - $bracketNumber = 0; |
|
786 | - // foreach attempts for all students starting with his older attempt |
|
787 | - while ($data = Database::fetch_array($res)) { |
|
788 | - $tabAnswer = FillBlanks::getAnswerInfo($data['answer'], true); |
|
783 | + $res = Database::query($sql); |
|
784 | + $tabUserResult = array(); |
|
785 | + $bracketNumber = 0; |
|
786 | + // foreach attempts for all students starting with his older attempt |
|
787 | + while ($data = Database::fetch_array($res)) { |
|
788 | + $tabAnswer = FillBlanks::getAnswerInfo($data['answer'], true); |
|
789 | 789 | |
790 | - // for each bracket to find in this question |
|
791 | - foreach ($tabAnswer['studentanswer'] as $bracketNumber => $studentAnswer) { |
|
790 | + // for each bracket to find in this question |
|
791 | + foreach ($tabAnswer['studentanswer'] as $bracketNumber => $studentAnswer) { |
|
792 | 792 | |
793 | - if ($tabAnswer['studentanswer'][$bracketNumber] != '') { |
|
794 | - // student has answered this bracket, cool |
|
795 | - switch (FillBlanks::getFillTheBlankAnswerType($tabAnswer['tabwords'][$bracketNumber])) { |
|
796 | - case self::FILL_THE_BLANK_MENU : |
|
793 | + if ($tabAnswer['studentanswer'][$bracketNumber] != '') { |
|
794 | + // student has answered this bracket, cool |
|
795 | + switch (FillBlanks::getFillTheBlankAnswerType($tabAnswer['tabwords'][$bracketNumber])) { |
|
796 | + case self::FILL_THE_BLANK_MENU : |
|
797 | 797 | // get the indice of the choosen answer in the menu |
798 | 798 | // we know that the right answer is the first entry of the menu, ie 0 |
799 | 799 | // (remember, menu entries are shuffled when taking the test) |
800 | 800 | $tabUserResult[$data['user_id']][$bracketNumber] = FillBlanks::getFillTheBlankMenuAnswerNum($tabAnswer['tabwords'][$bracketNumber], $tabAnswer['studentanswer'][$bracketNumber]); |
801 | - break; |
|
802 | - default : |
|
801 | + break; |
|
802 | + default : |
|
803 | 803 | if (FillBlanks::isGoodStudentAnswer($tabAnswer['studentanswer'][$bracketNumber], $tabAnswer['tabwords'][$bracketNumber])) { |
804 | - $tabUserResult[$data['user_id']][$bracketNumber] = 0; // right answer |
|
805 | - } else { |
|
806 | - $tabUserResult[$data['user_id']][$bracketNumber] = -1; // wrong answer |
|
807 | - } |
|
808 | - } |
|
809 | - } else { |
|
810 | - // student didn't answer this bracket |
|
811 | - if ($useLastAnswerredAttempt) { |
|
812 | - // if we take into account the last answered attempt |
|
813 | - if (!isset($tabUserResult[$data['user_id']][$bracketNumber])) { |
|
814 | - $tabUserResult[$data['user_id']][$bracketNumber] = -2; // not answered |
|
815 | - } |
|
816 | - } else { |
|
817 | - // we take the last attempt, even if the student answer the question before |
|
818 | - $tabUserResult[$data['user_id']][$bracketNumber] = -2; // not answered |
|
819 | - } |
|
820 | - } |
|
821 | - } |
|
822 | - |
|
823 | - |
|
824 | - } |
|
825 | - return $tabUserResult; |
|
804 | + $tabUserResult[$data['user_id']][$bracketNumber] = 0; // right answer |
|
805 | + } else { |
|
806 | + $tabUserResult[$data['user_id']][$bracketNumber] = -1; // wrong answer |
|
807 | + } |
|
808 | + } |
|
809 | + } else { |
|
810 | + // student didn't answer this bracket |
|
811 | + if ($useLastAnswerredAttempt) { |
|
812 | + // if we take into account the last answered attempt |
|
813 | + if (!isset($tabUserResult[$data['user_id']][$bracketNumber])) { |
|
814 | + $tabUserResult[$data['user_id']][$bracketNumber] = -2; // not answered |
|
815 | + } |
|
816 | + } else { |
|
817 | + // we take the last attempt, even if the student answer the question before |
|
818 | + $tabUserResult[$data['user_id']][$bracketNumber] = -2; // not answered |
|
819 | + } |
|
820 | + } |
|
821 | + } |
|
822 | + |
|
823 | + |
|
824 | + } |
|
825 | + return $tabUserResult; |
|
826 | 826 | } |
827 | 827 | |
828 | 828 |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | if (!empty($gradebook) && $gradebook == 'view') { |
110 | 110 | $interbreadcrumb[] = array( |
111 | - 'url' => '../gradebook/' . $_SESSION['gradebook_dest'], |
|
111 | + 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], |
|
112 | 112 | 'name' => get_lang('ToolGradebook') |
113 | 113 | ); |
114 | 114 | } |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | ); |
699 | 699 | |
700 | 700 | // Exercise results |
701 | - $actions .='<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'. |
|
701 | + $actions .= '<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'. |
|
702 | 702 | Display :: return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>'; |
703 | 703 | |
704 | 704 | // Export |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | } |
763 | 763 | } |
764 | 764 | |
765 | - $actions .='<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'. |
|
765 | + $actions .= '<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'. |
|
766 | 766 | Display :: return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>'; |
767 | 767 | $actions .= Display::url(Display::return_icon('cd.gif', get_lang('CopyExercise')), '', array('onclick' => "javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('AreYouSureToCopy'), ENT_QUOTES, $charset))." ".addslashes($row['title'])."?"."')) return false;", 'href' => 'exercise.php?'.api_get_cidreq().'&choice=copy_exercise&sec_token='.$token.'&exerciseId='.$row['id'])); |
768 | 768 | } |
@@ -952,7 +952,7 @@ discard block |
||
952 | 952 | $item .= Display::tag('td', $actions, array('class' => 'td_actions')); |
953 | 953 | } else { |
954 | 954 | if ($isDrhOfCourse) { |
955 | - $actions ='<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'. |
|
955 | + $actions = '<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'. |
|
956 | 956 | Display :: return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>'; |
957 | 957 | $item .= Display::tag('td', $actions, array('class' => 'td_actions')); |
958 | 958 | } |
@@ -962,7 +962,7 @@ discard block |
||
962 | 962 | 'tr', |
963 | 963 | $item, |
964 | 964 | array( |
965 | - 'id' => 'exercise_list_' . $my_exercise_id, |
|
965 | + 'id' => 'exercise_list_'.$my_exercise_id, |
|
966 | 966 | ) |
967 | 967 | ); |
968 | 968 | |
@@ -1033,7 +1033,7 @@ discard block |
||
1033 | 1033 | 'adminhp.php?'.api_get_cidreq().'&hotpotatoesName='.$path |
1034 | 1034 | ); |
1035 | 1035 | |
1036 | - $actions .='<a href="hotpotatoes_exercise_report.php?'.api_get_cidreq().'&path='.$path.'">'. |
|
1036 | + $actions .= '<a href="hotpotatoes_exercise_report.php?'.api_get_cidreq().'&path='.$path.'">'. |
|
1037 | 1037 | Display :: return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>'; |
1038 | 1038 | |
1039 | 1039 | // if active |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | $actions .= ' <a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=disable&page='.$page.'&file='.$path.'">'. |
1043 | 1043 | Display::return_icon('visible.png', get_lang('Deactivate'), '', ICON_SIZE_SMALL).'</a>'; |
1044 | 1044 | } else { // else if not active |
1045 | - $actions .=' <a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=enable&page='.$page.'&file='.$path.'">'. |
|
1045 | + $actions .= ' <a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=enable&page='.$page.'&file='.$path.'">'. |
|
1046 | 1046 | Display::return_icon('invisible.png', get_lang('Activate'), '', ICON_SIZE_SMALL).'</a>'; |
1047 | 1047 | } |
1048 | 1048 | $actions .= '<a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=delete&file='.$path.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('AreYouSureToDeleteJS'), ENT_QUOTES, $charset).' '.$title."?").'\')) return false;">'. |
@@ -1075,7 +1075,7 @@ discard block |
||
1075 | 1075 | $item .= Display::tag('td', $attemptText); |
1076 | 1076 | |
1077 | 1077 | if ($isDrhOfCourse) { |
1078 | - $actions ='<a href="hotpotatoes_exercise_report.php?'.api_get_cidreq().'&path='.$path.'">'. |
|
1078 | + $actions = '<a href="hotpotatoes_exercise_report.php?'.api_get_cidreq().'&path='.$path.'">'. |
|
1079 | 1079 | Display :: return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>'; |
1080 | 1080 | |
1081 | 1081 | $item .= Display::tag('td', $actions, array('class' => 'td_actions')); |
@@ -63,13 +63,13 @@ discard block |
||
63 | 63 | for ($i = 1; $i <= $answer->nbrAnswers; $i++) { |
64 | 64 | if ($answer->isCorrect($i)) { |
65 | 65 | $nb_matches++; |
66 | - $defaults['answer[' . $nb_matches . ']'] = $answer->selectAnswer($i); |
|
67 | - $defaults['weighting[' . $nb_matches . ']'] = float_format($answer->selectWeighting($i), 1); |
|
66 | + $defaults['answer['.$nb_matches.']'] = $answer->selectAnswer($i); |
|
67 | + $defaults['weighting['.$nb_matches.']'] = float_format($answer->selectWeighting($i), 1); |
|
68 | 68 | $answerInfo = $answer->getAnswerByAutoId($answer->correct[$i]); |
69 | - $defaults['matches[' . $nb_matches . ']'] = isset($answerInfo['answer']) ? $answerInfo['answer'] : ''; |
|
69 | + $defaults['matches['.$nb_matches.']'] = isset($answerInfo['answer']) ? $answerInfo['answer'] : ''; |
|
70 | 70 | } else { |
71 | 71 | $nb_options++; |
72 | - $defaults['option[' . $nb_options . ']'] = $answer->selectAnswer($i); |
|
72 | + $defaults['option['.$nb_options.']'] = $answer->selectAnswer($i); |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | } |
@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | $html = '<table class="table table-striped table-hover"> |
93 | 93 | <thead> |
94 | 94 | <tr> |
95 | - <th width="85%">' . get_lang('Answer') . '</th> |
|
96 | - <th width="15%">' . get_lang('MatchesTo') . '</th> |
|
97 | - <th width="10">' . get_lang('Weighting') . '</th> |
|
95 | + <th width="85%">' . get_lang('Answer').'</th> |
|
96 | + <th width="15%">' . get_lang('MatchesTo').'</th> |
|
97 | + <th width="10">' . get_lang('Weighting').'</th> |
|
98 | 98 | </tr> |
99 | 99 | </thead> |
100 | 100 | <tbody>'; |
@@ -189,9 +189,9 @@ discard block |
||
189 | 189 | for ($i = 1; $i <= $nb_matches; ++$i) { |
190 | 190 | $position++; |
191 | 191 | |
192 | - $answer = $form->getSubmitValue('answer[' . $i . ']'); |
|
193 | - $matches = $form->getSubmitValue('matches[' . $i . ']'); |
|
194 | - $weighting = $form->getSubmitValue('weighting[' . $i . ']'); |
|
192 | + $answer = $form->getSubmitValue('answer['.$i.']'); |
|
193 | + $matches = $form->getSubmitValue('matches['.$i.']'); |
|
194 | + $weighting = $form->getSubmitValue('weighting['.$i.']'); |
|
195 | 195 | $this->weighting += $weighting; |
196 | 196 | $objAnswer->createAnswer( |
197 | 197 | $answer, |
@@ -216,10 +216,10 @@ discard block |
||
216 | 216 | public function return_header($feedback_type = null, $counter = null, $score = null) |
217 | 217 | { |
218 | 218 | $header = parent::return_header($feedback_type, $counter, $score); |
219 | - $header .= '<table class="' . $this->question_table_class . '"> |
|
219 | + $header .= '<table class="'.$this->question_table_class.'"> |
|
220 | 220 | <tr> |
221 | - <th>' . get_lang('ElementList') . '</th> |
|
222 | - <th>' . get_lang('Status') . '</th> |
|
221 | + <th>' . get_lang('ElementList').'</th> |
|
222 | + <th>' . get_lang('Status').'</th> |
|
223 | 223 | </tr>'; |
224 | 224 | |
225 | 225 | return $header; |
@@ -171,10 +171,11 @@ |
||
171 | 171 | } |
172 | 172 | echo '</div>'; |
173 | 173 | |
174 | - if ($objExercise->feedback_type == 1) |
|
175 | - Display::display_normal_message( |
|
174 | + if ($objExercise->feedback_type == 1) { |
|
175 | + Display::display_normal_message( |
|
176 | 176 | get_lang('DirectFeedbackCantModifyTypeQuestion') |
177 | 177 | ); |
178 | + } |
|
178 | 179 | |
179 | 180 | if (api_get_setting('search_enabled')=='true' && !extension_loaded('xapian')) { |
180 | 181 | Display::display_error_message(get_lang('SearchXapianModuleNotInstalled')); |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | require_once '../inc/global.inc.php'; |
14 | 14 | $this_section = SECTION_COURSES; |
15 | 15 | |
16 | -if (!api_is_allowed_to_edit(null,true)) { |
|
16 | +if (!api_is_allowed_to_edit(null, true)) { |
|
17 | 17 | api_not_allowed(true); |
18 | 18 | } |
19 | 19 | |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | $gradebook = $_SESSION['gradebook']; |
167 | 167 | } |
168 | 168 | |
169 | - if (!empty($gradebook) && $gradebook=='view') { |
|
170 | - $interbreadcrumb[]= array ( |
|
169 | + if (!empty($gradebook) && $gradebook == 'view') { |
|
170 | + $interbreadcrumb[] = array( |
|
171 | 171 | 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], |
172 | 172 | 'name' => get_lang('ToolGradebook') |
173 | 173 | ); |
@@ -187,19 +187,19 @@ discard block |
||
187 | 187 | echo '<div class="actions">'; |
188 | 188 | |
189 | 189 | if ($objExercise->id != 0) { |
190 | - echo '<a href="admin.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'">' . |
|
190 | + echo '<a href="admin.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'">'. |
|
191 | 191 | Display :: return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).'</a>'; |
192 | 192 | } else { |
193 | - if (!empty($_GET['lp_id']) || !empty($_POST['lp_id'])){ |
|
194 | - if (!empty($_POST['lp_id'])){ |
|
193 | + if (!empty($_GET['lp_id']) || !empty($_POST['lp_id'])) { |
|
194 | + if (!empty($_POST['lp_id'])) { |
|
195 | 195 | $lp_id = intval($_POST['lp_id']); |
196 | 196 | //TODO:this remains to be implemented after press the first post |
197 | 197 | } else { |
198 | 198 | $lp_id = intval($_GET['lp_id']); |
199 | 199 | } |
200 | - echo "<a href=\"../newscorm/lp_controller.php?".api_get_cidreq()."&gradebook=&action=add_item&type=step&lp_id=".$lp_id."#resource_tab-2\">".Display::return_icon('back.png', get_lang("BackTo").' '.get_lang("LearningPaths"),'',ICON_SIZE_MEDIUM)."</a>"; |
|
200 | + echo "<a href=\"../newscorm/lp_controller.php?".api_get_cidreq()."&gradebook=&action=add_item&type=step&lp_id=".$lp_id."#resource_tab-2\">".Display::return_icon('back.png', get_lang("BackTo").' '.get_lang("LearningPaths"), '', ICON_SIZE_MEDIUM)."</a>"; |
|
201 | 201 | } else { |
202 | - echo '<a href="exercise.php?'.api_get_cidreq().'">' . |
|
202 | + echo '<a href="exercise.php?'.api_get_cidreq().'">'. |
|
203 | 203 | Display :: return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM). |
204 | 204 | '</a>'; |
205 | 205 | } |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | get_lang('DirectFeedbackCantModifyTypeQuestion') |
212 | 212 | ); |
213 | 213 | |
214 | - if (api_get_setting('search_enabled')=='true' && !extension_loaded('xapian')) { |
|
214 | + if (api_get_setting('search_enabled') == 'true' && !extension_loaded('xapian')) { |
|
215 | 215 | Display::display_error_message(get_lang('SearchXapianModuleNotInstalled')); |
216 | 216 | } |
217 | 217 |
@@ -223,10 +223,10 @@ |
||
223 | 223 | |
224 | 224 | $counter++; |
225 | 225 | if ($objExercise->type == ONE_PER_PAGE) { |
226 | - $question_title = Display::url($counter.'. '.cut($objQuestionTmp->selectTitle(), 40), $url); |
|
227 | - $question_title = $counter.'. '.cut($objQuestionTmp->selectTitle(), 40); |
|
226 | + $question_title = Display::url($counter.'. '.cut($objQuestionTmp->selectTitle(), 40), $url); |
|
227 | + $question_title = $counter.'. '.cut($objQuestionTmp->selectTitle(), 40); |
|
228 | 228 | } else { |
229 | - $question_title = $counter.'. '.cut($objQuestionTmp->selectTitle(), 40); |
|
229 | + $question_title = $counter.'. '.cut($objQuestionTmp->selectTitle(), 40); |
|
230 | 230 | } |
231 | 231 | //Check if the question doesn't have an answer |
232 | 232 | if (!in_array($questionId, $exercise_result)) { |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | // notice for unauthorized people. |
15 | 15 | api_protect_course_script(true); |
16 | 16 | |
17 | -if ($debug>0) { |
|
17 | +if ($debug > 0) { |
|
18 | 18 | error_log('Entered exercise_result.php: '.print_r($_POST, 1)); |
19 | 19 | } |
20 | 20 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | if (isset($_SESSION['exe_id'])) { |
94 | 94 | $exe_id = intval($_SESSION['exe_id']); |
95 | 95 | } |
96 | -$exercise_stat_info = $objExercise->get_stat_track_exercise_info_by_exe_id($exe_id); |
|
96 | +$exercise_stat_info = $objExercise->get_stat_track_exercise_info_by_exe_id($exe_id); |
|
97 | 97 | if (!empty($exercise_stat_info['data_tracking'])) { |
98 | 98 | $question_list = explode(',', $exercise_stat_info['data_tracking']); |
99 | 99 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | $remind_list = $exercise_stat_info['questions_to_check']; |
174 | 174 | $remind_list = explode(',', $remind_list); |
175 | 175 | |
176 | -$exercise_result = array(); |
|
176 | +$exercise_result = array(); |
|
177 | 177 | |
178 | 178 | foreach ($attempt_list as $question_id => $options) { |
179 | 179 | foreach ($options as $item) { |
@@ -204,10 +204,10 @@ discard block |
||
204 | 204 | unset($objQuestionTmp); |
205 | 205 | |
206 | 206 | // creates a temporary Question object |
207 | - $objQuestionTmp = Question :: read($questionId); |
|
207 | + $objQuestionTmp = Question :: read($questionId); |
|
208 | 208 | |
209 | 209 | $quesId = $objQuestionTmp->selectId(); |
210 | - $check_id = 'remind_list['.$questionId.']'; |
|
210 | + $check_id = 'remind_list['.$questionId.']'; |
|
211 | 211 | $attributes = array('id'=>$check_id, 'onclick'=>"save_remind_item(this, '$questionId');"); |
212 | 212 | |
213 | 213 | if (in_array($questionId, $remind_list)) { |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | echo Display::div($table, array('class'=>'span10')); |
240 | 240 | |
241 | 241 | $exercise_actions = Display::url(get_lang('EndTest'), 'javascript://', array('onclick'=>'final_submit();', 'class'=>'btn btn-warning')); |
242 | -$exercise_actions .= ' '.Display::url(get_lang('ReviewQuestions'), 'javascript://', array('onclick'=>'review_questions();','class'=>'btn btn-success')); |
|
242 | +$exercise_actions .= ' '.Display::url(get_lang('ReviewQuestions'), 'javascript://', array('onclick'=>'review_questions();', 'class'=>'btn btn-success')); |
|
243 | 243 | |
244 | 244 | echo Display::div('', array('class'=>'clear')); |
245 | 245 | echo Display::div($exercise_actions, array('class'=>'form-actions')); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | $gradebook = ''; |
61 | 61 | if (isset($_SESSION['gradebook'])) { |
62 | - $gradebook= $_SESSION['gradebook']; |
|
62 | + $gradebook= $_SESSION['gradebook']; |
|
63 | 63 | } |
64 | 64 | if (!empty($gradebook) && $gradebook=='view') { |
65 | 65 | $interbreadcrumb[] = array( |
@@ -79,8 +79,8 @@ discard block |
||
79 | 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 | - // So we are not in learnpath tool |
|
83 | - Display::display_header($nameTools, get_lang('Exercise')); |
|
82 | + // So we are not in learnpath tool |
|
83 | + Display::display_header($nameTools, get_lang('Exercise')); |
|
84 | 84 | } else { |
85 | 85 | $htmlHeadXtra[] = " |
86 | 86 | <style> |
@@ -94,19 +94,19 @@ discard block |
||
94 | 94 | |
95 | 95 | // I'm in a preview mode as course admin. Display the action menu. |
96 | 96 | if (api_is_course_admin() && $origin != 'learnpath') { |
97 | - echo '<div class="actions">'; |
|
98 | - echo '<a href="admin.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'">'. |
|
97 | + echo '<div class="actions">'; |
|
98 | + echo '<a href="admin.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'">'. |
|
99 | 99 | Display::return_icon('back.png', get_lang('GoBackToQuestionList'), array(), 32).'</a>'; |
100 | - echo '<a href="exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$objExercise->id.'">'. |
|
100 | + echo '<a href="exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$objExercise->id.'">'. |
|
101 | 101 | Display::return_icon('edit.png', get_lang('ModifyExercise'), array(), 32).'</a>'; |
102 | - echo '</div>'; |
|
102 | + echo '</div>'; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | $feedback_type = $objExercise->feedback_type; |
106 | 106 | $exercise_stat_info = $objExercise->get_stat_track_exercise_info_by_exe_id($exe_id); |
107 | 107 | |
108 | 108 | if (!empty($exercise_stat_info['data_tracking'])) { |
109 | - $question_list = explode(',', $exercise_stat_info['data_tracking']); |
|
109 | + $question_list = explode(',', $exercise_stat_info['data_tracking']); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | $learnpath_id = $exercise_stat_info['orig_lp_id']; |
@@ -180,19 +180,19 @@ discard block |
||
180 | 180 | Session::erase('exe_id'); |
181 | 181 | } |
182 | 182 | |
183 | - Display::display_footer(); |
|
183 | + Display::display_footer(); |
|
184 | 184 | } else { |
185 | - $lp_mode = isset($_SESSION['lp_mode']) ? $_SESSION['lp_mode'] : null; |
|
186 | - $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; |
|
187 | - $href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'"'; |
|
185 | + $lp_mode = isset($_SESSION['lp_mode']) ? $_SESSION['lp_mode'] : null; |
|
186 | + $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; |
|
187 | + $href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'"'; |
|
188 | 188 | |
189 | 189 | if (api_is_allowed_to_session_edit()) { |
190 | 190 | Session::erase('objExercise'); |
191 | 191 | Session::erase('exe_id'); |
192 | 192 | } |
193 | 193 | |
194 | - // Record the results in the learning path, using the SCORM interface (API) |
|
195 | - echo "<script>window.parent.API.void_save_asset('$total_score', '$max_score', 0, 'completed');</script>"; |
|
194 | + // Record the results in the learning path, using the SCORM interface (API) |
|
195 | + echo "<script>window.parent.API.void_save_asset('$total_score', '$max_score', 0, 'completed');</script>"; |
|
196 | 196 | echo '<script type="text/javascript">'.$href.'</script>'; |
197 | - echo '</body></html>'; |
|
197 | + echo '</body></html>'; |
|
198 | 198 | } |
@@ -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'); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | */ |
10 | 10 | class ExerciseResult |
11 | 11 | { |
12 | - private $results = array(); |
|
12 | + private $results = array(); |
|
13 | 13 | public $includeAllUsers = false; |
14 | 14 | public $onlyBestAttempts = false; |
15 | 15 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $exercise_id = 0, |
47 | 47 | $hotpotato_name = null |
48 | 48 | ) { |
49 | - $return = array(); |
|
49 | + $return = array(); |
|
50 | 50 | |
51 | 51 | $TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST); |
52 | 52 | $TBL_TABLE_LP_MAIN = Database::get_course_table(TABLE_LP_MAIN); |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | $session_id_and .= " AND exe_exo_id = $exercise_id "; |
67 | 67 | } |
68 | 68 | |
69 | - if (empty($user_id)) { |
|
69 | + if (empty($user_id)) { |
|
70 | 70 | $user_id_and = null; |
71 | - $sql = "SELECT ".(api_is_western_name_order() ? "firstname as userpart1, lastname userpart2" : "lastname as userpart1, firstname as userpart2").", |
|
71 | + $sql = "SELECT ".(api_is_western_name_order() ? "firstname as userpart1, lastname userpart2" : "lastname as userpart1, firstname as userpart2").", |
|
72 | 72 | official_code, |
73 | 73 | ce.title as extitle, |
74 | 74 | te.exe_result as exresult , |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | te.status != 'incomplete' AND |
92 | 92 | te.c_id = ce.c_id $user_id_and $session_id_and AND |
93 | 93 | ce.active <>-1"; |
94 | - } else { |
|
94 | + } else { |
|
95 | 95 | $user_id_and = ' AND te.exe_user_id = ' . api_get_user_id() . ' '; |
96 | - // get only this user's results |
|
96 | + // get only this user's results |
|
97 | 97 | $sql="SELECT ".(api_is_western_name_order() ? "firstname as userpart1, lastname userpart2" : "lastname as userpart1, firstname as userpart2").", |
98 | 98 | official_code, |
99 | 99 | ce.title as extitle, |
@@ -119,12 +119,12 @@ discard block |
||
119 | 119 | te.c_id = ce.c_id $user_id_and $session_id_and AND |
120 | 120 | ce.active <>-1 AND |
121 | 121 | ORDER BY userpart2, te.c_id ASC, ce.title ASC, te.exe_date DESC"; |
122 | - } |
|
122 | + } |
|
123 | 123 | |
124 | - $results = array(); |
|
125 | - $resx = Database::query($sql); |
|
124 | + $results = array(); |
|
125 | + $resx = Database::query($sql); |
|
126 | 126 | $bestAttemptPerUser = array(); |
127 | - while ($rowx = Database::fetch_array($resx,'ASSOC')) { |
|
127 | + while ($rowx = Database::fetch_array($resx,'ASSOC')) { |
|
128 | 128 | if ($this->onlyBestAttempts) { |
129 | 129 | if (!isset($bestAttemptPerUser[$rowx['excruid']])) { |
130 | 130 | $bestAttemptPerUser[$rowx['excruid']] = $rowx; |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | } else { |
137 | 137 | $results[] = $rowx; |
138 | 138 | } |
139 | - } |
|
139 | + } |
|
140 | 140 | |
141 | 141 | if ($this->onlyBestAttempts) { |
142 | 142 | $results = $bestAttemptPerUser; |
@@ -190,8 +190,8 @@ discard block |
||
190 | 190 | continue; |
191 | 191 | } |
192 | 192 | |
193 | - $return[$i] = array(); |
|
194 | - if (empty($user_id)) { |
|
193 | + $return[$i] = array(); |
|
194 | + if (empty($user_id)) { |
|
195 | 195 | $return[$i]['official_code'] = $result['official_code']; |
196 | 196 | if (api_is_western_name_order()) { |
197 | 197 | $return[$i]['first_name'] = $results[$i]['userpart1']; |
@@ -200,15 +200,15 @@ discard block |
||
200 | 200 | $return[$i]['first_name'] = $results[$i]['userpart2']; |
201 | 201 | $return[$i]['last_name'] = $results[$i]['userpart1']; |
202 | 202 | } |
203 | - $return[$i]['user_id'] = $results[$i]['excruid']; |
|
204 | - $return[$i]['email'] = $results[$i]['exemail']; |
|
205 | - } |
|
206 | - $return[$i]['title'] = $result['extitle']; |
|
207 | - $return[$i]['start_date'] = api_get_local_time($result['exstart']); |
|
203 | + $return[$i]['user_id'] = $results[$i]['excruid']; |
|
204 | + $return[$i]['email'] = $results[$i]['exemail']; |
|
205 | + } |
|
206 | + $return[$i]['title'] = $result['extitle']; |
|
207 | + $return[$i]['start_date'] = api_get_local_time($result['exstart']); |
|
208 | 208 | $return[$i]['end_date'] = api_get_local_time($result['exdate']); |
209 | 209 | $return[$i]['duration'] = $result['duration']; |
210 | - $return[$i]['result'] = $result['exresult']; |
|
211 | - $return[$i]['max'] = $result['exweight']; |
|
210 | + $return[$i]['result'] = $result['exresult']; |
|
211 | + $return[$i]['max'] = $result['exweight']; |
|
212 | 212 | $return[$i]['status'] = $revised ? get_lang('Validated') : get_lang('NotValidated'); |
213 | 213 | $return[$i]['lp_id'] = $result['orig_lp_id']; |
214 | 214 | $return[$i]['lp_name'] = $result['lp_name']; |
@@ -221,8 +221,8 @@ discard block |
||
221 | 221 | |
222 | 222 | $userWithResults[$result['excruid']] = 1; |
223 | 223 | $i++; |
224 | - } |
|
225 | - } |
|
224 | + } |
|
225 | + } |
|
226 | 226 | |
227 | 227 | if ($this->includeAllUsers) { |
228 | 228 | $latestId = count($return); |
@@ -265,18 +265,18 @@ discard block |
||
265 | 265 | } |
266 | 266 | } |
267 | 267 | |
268 | - $this->results = $return; |
|
268 | + $this->results = $return; |
|
269 | 269 | |
270 | - return true; |
|
271 | - } |
|
270 | + return true; |
|
271 | + } |
|
272 | 272 | |
273 | - /** |
|
274 | - * Exports the complete report as a CSV file |
|
275 | - * @param string Document path inside the document tool |
|
276 | - * @param integer Optional user ID |
|
277 | - * @param boolean Whether to include user fields or not |
|
278 | - * @return boolean False on error |
|
279 | - */ |
|
273 | + /** |
|
274 | + * Exports the complete report as a CSV file |
|
275 | + * @param string Document path inside the document tool |
|
276 | + * @param integer Optional user ID |
|
277 | + * @param boolean Whether to include user fields or not |
|
278 | + * @return boolean False on error |
|
279 | + */ |
|
280 | 280 | public function exportCompleteReportCSV( |
281 | 281 | $document_path = '', |
282 | 282 | $user_id = null, |
@@ -285,14 +285,14 @@ discard block |
||
285 | 285 | $exercise_id = 0, |
286 | 286 | $hotpotato_name = null |
287 | 287 | ) { |
288 | - global $charset; |
|
289 | - $this->getExercisesReporting($document_path, $user_id, $export_filter, $exercise_id, $hotpotato_name); |
|
290 | - |
|
291 | - $filename = 'exercise_results_'.date('YmdGis').'.csv'; |
|
292 | - if(!empty($user_id)) { |
|
293 | - $filename = 'exercise_results_user_'.$user_id.'_'.date('YmdGis').'.csv'; |
|
294 | - } |
|
295 | - $data = ''; |
|
288 | + global $charset; |
|
289 | + $this->getExercisesReporting($document_path, $user_id, $export_filter, $exercise_id, $hotpotato_name); |
|
290 | + |
|
291 | + $filename = 'exercise_results_'.date('YmdGis').'.csv'; |
|
292 | + if(!empty($user_id)) { |
|
293 | + $filename = 'exercise_results_user_'.$user_id.'_'.date('YmdGis').'.csv'; |
|
294 | + } |
|
295 | + $data = ''; |
|
296 | 296 | if (api_is_western_name_order()) { |
297 | 297 | if(!empty($this->results[0]['first_name'])) { |
298 | 298 | $data .= get_lang('FirstName').';'; |
@@ -316,28 +316,28 @@ discard block |
||
316 | 316 | $data .= get_lang('Email').';'; |
317 | 317 | $data .= get_lang('Groups').';'; |
318 | 318 | |
319 | - if ($export_user_fields) { |
|
320 | - //show user fields section with a big th colspan that spans over all fields |
|
321 | - $extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1); |
|
322 | - $num = count($extra_user_fields); |
|
323 | - foreach($extra_user_fields as $field) { |
|
324 | - $data .= '"'.str_replace("\r\n",' ',api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset)).'";'; |
|
325 | - } |
|
326 | - } |
|
327 | - |
|
328 | - $data .= get_lang('Title').';'; |
|
329 | - $data .= get_lang('StartDate').';'; |
|
319 | + if ($export_user_fields) { |
|
320 | + //show user fields section with a big th colspan that spans over all fields |
|
321 | + $extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1); |
|
322 | + $num = count($extra_user_fields); |
|
323 | + foreach($extra_user_fields as $field) { |
|
324 | + $data .= '"'.str_replace("\r\n",' ',api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset)).'";'; |
|
325 | + } |
|
326 | + } |
|
327 | + |
|
328 | + $data .= get_lang('Title').';'; |
|
329 | + $data .= get_lang('StartDate').';'; |
|
330 | 330 | $data .= get_lang('EndDate').';'; |
331 | 331 | $data .= get_lang('Duration'). ' ('.get_lang('MinMinutes').') ;'; |
332 | - $data .= get_lang('Score').';'; |
|
333 | - $data .= get_lang('Total').';'; |
|
332 | + $data .= get_lang('Score').';'; |
|
333 | + $data .= get_lang('Total').';'; |
|
334 | 334 | $data .= get_lang('Status').';'; |
335 | 335 | $data .= get_lang('ToolLearnpath').';'; |
336 | 336 | $data .= get_lang('UserIsCurrentlySubscribed').';'; |
337 | - $data .= "\n"; |
|
337 | + $data .= "\n"; |
|
338 | 338 | |
339 | - //results |
|
340 | - foreach ($this->results as $row) { |
|
339 | + //results |
|
340 | + foreach ($this->results as $row) { |
|
341 | 341 | |
342 | 342 | if (api_is_western_name_order()) { |
343 | 343 | $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
@@ -354,51 +354,51 @@ discard block |
||
354 | 354 | $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)).';'; |
355 | 355 | $data .= str_replace("\r\n",' ',implode(", ", GroupManager :: get_user_group_name($row['user_id']))).';'; |
356 | 356 | |
357 | - if ($export_user_fields) { |
|
358 | - //show user fields data, if any, for this user |
|
359 | - $user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true); |
|
360 | - foreach($user_fields_values as $value) { |
|
361 | - $data .= '"'.str_replace('"','""',api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)).'";'; |
|
362 | - } |
|
363 | - } |
|
357 | + if ($export_user_fields) { |
|
358 | + //show user fields data, if any, for this user |
|
359 | + $user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true); |
|
360 | + foreach($user_fields_values as $value) { |
|
361 | + $data .= '"'.str_replace('"','""',api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)).'";'; |
|
362 | + } |
|
363 | + } |
|
364 | 364 | |
365 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';'; |
|
366 | - $data .= str_replace("\r\n",' ',$row['start_date']).';'; |
|
365 | + $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';'; |
|
366 | + $data .= str_replace("\r\n",' ',$row['start_date']).';'; |
|
367 | 367 | $data .= str_replace("\r\n",' ',$row['end_date']).';'; |
368 | 368 | $data .= str_replace("\r\n",' ',$row['duration']).';'; |
369 | - $data .= str_replace("\r\n",' ',$row['result']).';'; |
|
370 | - $data .= str_replace("\r\n",' ',$row['max']).';'; |
|
369 | + $data .= str_replace("\r\n",' ',$row['result']).';'; |
|
370 | + $data .= str_replace("\r\n",' ',$row['max']).';'; |
|
371 | 371 | $data .= str_replace("\r\n",' ',$row['status']).';'; |
372 | 372 | $data .= str_replace("\r\n",' ',$row['lp_name']).';'; |
373 | 373 | $data .= str_replace("\r\n",' ',$row['is_user_subscribed']).';'; |
374 | - $data .= "\n"; |
|
375 | - } |
|
376 | - |
|
377 | - //output the results |
|
378 | - $len = strlen($data); |
|
379 | - header('Content-type: application/octet-stream'); |
|
380 | - header('Content-Type: application/force-download'); |
|
381 | - header('Content-length: '.$len); |
|
382 | - if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) { |
|
383 | - header('Content-Disposition: filename= '.$filename); |
|
384 | - } else { |
|
385 | - header('Content-Disposition: attachment; filename= '.$filename); |
|
386 | - } |
|
387 | - if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) { |
|
388 | - header('Pragma: '); |
|
389 | - header('Cache-Control: '); |
|
390 | - header('Cache-Control: public'); // IE cannot download from sessions without a cache |
|
391 | - } |
|
392 | - header('Content-Description: '.$filename); |
|
393 | - header('Content-transfer-encoding: binary'); |
|
394 | - echo $data; |
|
395 | - return true; |
|
396 | - } |
|
397 | - |
|
398 | - /** |
|
399 | - * Exports the complete report as an XLS file |
|
400 | - * @return boolean False on error |
|
401 | - */ |
|
374 | + $data .= "\n"; |
|
375 | + } |
|
376 | + |
|
377 | + //output the results |
|
378 | + $len = strlen($data); |
|
379 | + header('Content-type: application/octet-stream'); |
|
380 | + header('Content-Type: application/force-download'); |
|
381 | + header('Content-length: '.$len); |
|
382 | + if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) { |
|
383 | + header('Content-Disposition: filename= '.$filename); |
|
384 | + } else { |
|
385 | + header('Content-Disposition: attachment; filename= '.$filename); |
|
386 | + } |
|
387 | + if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) { |
|
388 | + header('Pragma: '); |
|
389 | + header('Cache-Control: '); |
|
390 | + header('Cache-Control: public'); // IE cannot download from sessions without a cache |
|
391 | + } |
|
392 | + header('Content-Description: '.$filename); |
|
393 | + header('Content-transfer-encoding: binary'); |
|
394 | + echo $data; |
|
395 | + return true; |
|
396 | + } |
|
397 | + |
|
398 | + /** |
|
399 | + * Exports the complete report as an XLS file |
|
400 | + * @return boolean False on error |
|
401 | + */ |
|
402 | 402 | public function exportCompleteReportXLS( |
403 | 403 | $document_path = '', |
404 | 404 | $user_id = null, |
@@ -407,35 +407,35 @@ discard block |
||
407 | 407 | $exercise_id = 0, |
408 | 408 | $hotpotato_name = null |
409 | 409 | ) { |
410 | - global $charset; |
|
411 | - $this->getExercisesReporting($document_path, $user_id, $export_filter, $exercise_id, $hotpotato_name); |
|
412 | - $filename = 'exercise_results_'.api_get_local_time().'.xls'; |
|
413 | - if (!empty($user_id)) { |
|
414 | - $filename = 'exercise_results_user_'.$user_id.'_'.api_get_local_time().'.xls'; |
|
415 | - } |
|
410 | + global $charset; |
|
411 | + $this->getExercisesReporting($document_path, $user_id, $export_filter, $exercise_id, $hotpotato_name); |
|
412 | + $filename = 'exercise_results_'.api_get_local_time().'.xls'; |
|
413 | + if (!empty($user_id)) { |
|
414 | + $filename = 'exercise_results_user_'.$user_id.'_'.api_get_local_time().'.xls'; |
|
415 | + } |
|
416 | 416 | |
417 | 417 | $spreadsheet = new PHPExcel(); |
418 | 418 | $spreadsheet->setActiveSheetIndex(0); |
419 | 419 | $worksheet = $spreadsheet->getActiveSheet(); |
420 | 420 | |
421 | - $line = 0; |
|
422 | - $column = 0; //skip the first column (row titles) |
|
421 | + $line = 0; |
|
422 | + $column = 0; //skip the first column (row titles) |
|
423 | 423 | |
424 | - // check if exists column 'user' |
|
425 | - $with_column_user = false; |
|
426 | - foreach ($this->results as $result) { |
|
427 | - if (!empty($result['last_name']) && !empty($result['first_name'])) { |
|
428 | - $with_column_user = true; |
|
429 | - break; |
|
430 | - } |
|
431 | - } |
|
424 | + // check if exists column 'user' |
|
425 | + $with_column_user = false; |
|
426 | + foreach ($this->results as $result) { |
|
427 | + if (!empty($result['last_name']) && !empty($result['first_name'])) { |
|
428 | + $with_column_user = true; |
|
429 | + break; |
|
430 | + } |
|
431 | + } |
|
432 | 432 | |
433 | 433 | $officialCodeInList = api_get_setting('show_official_code_exercise_result_list'); |
434 | 434 | |
435 | - if ($with_column_user) { |
|
435 | + if ($with_column_user) { |
|
436 | 436 | if (api_is_western_name_order()) { |
437 | - $worksheet->SetCellValueByColumnAndRow($line, $column,get_lang('FirstName')); |
|
438 | - $column++; |
|
437 | + $worksheet->SetCellValueByColumnAndRow($line, $column,get_lang('FirstName')); |
|
438 | + $column++; |
|
439 | 439 | $worksheet->SetCellValueByColumnAndRow($line, $column,get_lang('LastName')); |
440 | 440 | $column++; |
441 | 441 | } else { |
@@ -451,43 +451,43 @@ discard block |
||
451 | 451 | } |
452 | 452 | |
453 | 453 | $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Email')); |
454 | - $column++; |
|
455 | - } |
|
454 | + $column++; |
|
455 | + } |
|
456 | 456 | $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Groups')); |
457 | - $column++; |
|
458 | - |
|
459 | - if ($export_user_fields) { |
|
460 | - //show user fields section with a big th colspan that spans over all fields |
|
461 | - $extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1); |
|
462 | - |
|
463 | - //show the fields names for user fields |
|
464 | - foreach ($extra_user_fields as $field) { |
|
465 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset)); |
|
466 | - $column++; |
|
467 | - } |
|
468 | - } |
|
469 | - |
|
470 | - $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Title')); |
|
471 | - $column++; |
|
472 | - $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('StartDate')); |
|
457 | + $column++; |
|
458 | + |
|
459 | + if ($export_user_fields) { |
|
460 | + //show user fields section with a big th colspan that spans over all fields |
|
461 | + $extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1); |
|
462 | + |
|
463 | + //show the fields names for user fields |
|
464 | + foreach ($extra_user_fields as $field) { |
|
465 | + $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset)); |
|
466 | + $column++; |
|
467 | + } |
|
468 | + } |
|
469 | + |
|
470 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Title')); |
|
471 | + $column++; |
|
472 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('StartDate')); |
|
473 | 473 | $column++; |
474 | 474 | $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('EndDate')); |
475 | 475 | $column++; |
476 | 476 | $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Duration').' ('.get_lang('MinMinutes').')'); |
477 | - $column++; |
|
478 | - $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Score')); |
|
479 | - $column++; |
|
480 | - $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Total')); |
|
481 | - $column++; |
|
477 | + $column++; |
|
478 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Score')); |
|
479 | + $column++; |
|
480 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Total')); |
|
481 | + $column++; |
|
482 | 482 | $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Status')); |
483 | - $column++; |
|
483 | + $column++; |
|
484 | 484 | $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('ToolLearnpath')); |
485 | 485 | $column++; |
486 | 486 | $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('UserIsCurrentlySubscribed')); |
487 | - $line++; |
|
487 | + $line++; |
|
488 | 488 | |
489 | - foreach ($this->results as $row) { |
|
490 | - $column = 0; |
|
489 | + foreach ($this->results as $row) { |
|
490 | + $column = 0; |
|
491 | 491 | |
492 | 492 | if ($with_column_user) { |
493 | 493 | if (api_is_western_name_order()) { |
@@ -509,22 +509,22 @@ discard block |
||
509 | 509 | |
510 | 510 | $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)); |
511 | 511 | $column++; |
512 | - } |
|
512 | + } |
|
513 | 513 | |
514 | 514 | $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags(implode(", ", GroupManager :: get_user_group_name($row['user_id']))), ENT_QUOTES, $charset)); |
515 | 515 | $column++; |
516 | 516 | |
517 | - if ($export_user_fields) { |
|
518 | - //show user fields data, if any, for this user |
|
519 | - $user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true); |
|
520 | - foreach($user_fields_values as $value) { |
|
521 | - $worksheet->SetCellValueByColumnAndRow($line,$column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)); |
|
522 | - $column++; |
|
523 | - } |
|
524 | - } |
|
525 | - |
|
526 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)); |
|
527 | - $column++; |
|
517 | + if ($export_user_fields) { |
|
518 | + //show user fields data, if any, for this user |
|
519 | + $user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true); |
|
520 | + foreach($user_fields_values as $value) { |
|
521 | + $worksheet->SetCellValueByColumnAndRow($line,$column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)); |
|
522 | + $column++; |
|
523 | + } |
|
524 | + } |
|
525 | + |
|
526 | + $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)); |
|
527 | + $column++; |
|
528 | 528 | $worksheet->SetCellValueByColumnAndRow($line, $column, $row['start_date']); |
529 | 529 | $column++; |
530 | 530 | $worksheet->SetCellValueByColumnAndRow($line, $column, $row['end_date']); |
@@ -540,14 +540,14 @@ discard block |
||
540 | 540 | $worksheet->SetCellValueByColumnAndRow($line, $column, $row['lp_name']); |
541 | 541 | $column++; |
542 | 542 | $worksheet->SetCellValueByColumnAndRow($line, $column, $row['is_user_subscribed']); |
543 | - $line++; |
|
544 | - } |
|
543 | + $line++; |
|
544 | + } |
|
545 | 545 | |
546 | 546 | $file = api_get_path(SYS_ARCHIVE_PATH).api_replace_dangerous_char($filename); |
547 | 547 | $writer = new PHPExcel_Writer_Excel2007($spreadsheet); |
548 | 548 | $writer->save($file); |
549 | 549 | DocumentManager::file_send_for_download($file, true, $filename); |
550 | 550 | |
551 | - return true; |
|
552 | - } |
|
551 | + return true; |
|
552 | + } |
|
553 | 553 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $course_id = api_get_course_int_id(); |
60 | 60 | $user_id = intval($user_id); |
61 | 61 | $sessionId = api_get_session_id(); |
62 | - $session_id_and = ' AND te.session_id = ' . $sessionId . ' '; |
|
62 | + $session_id_and = ' AND te.session_id = '.$sessionId.' '; |
|
63 | 63 | $exercise_id = intval($exercise_id); |
64 | 64 | |
65 | 65 | if (!empty($exercise_id)) { |
@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | te.c_id = ce.c_id $user_id_and $session_id_and AND |
93 | 93 | ce.active <>-1"; |
94 | 94 | } else { |
95 | - $user_id_and = ' AND te.exe_user_id = ' . api_get_user_id() . ' '; |
|
95 | + $user_id_and = ' AND te.exe_user_id = '.api_get_user_id().' '; |
|
96 | 96 | // get only this user's results |
97 | - $sql="SELECT ".(api_is_western_name_order() ? "firstname as userpart1, lastname userpart2" : "lastname as userpart1, firstname as userpart2").", |
|
97 | + $sql = "SELECT ".(api_is_western_name_order() ? "firstname as userpart1, lastname userpart2" : "lastname as userpart1, firstname as userpart2").", |
|
98 | 98 | official_code, |
99 | 99 | ce.title as extitle, |
100 | 100 | te.exe_result as exresult, |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $results = array(); |
125 | 125 | $resx = Database::query($sql); |
126 | 126 | $bestAttemptPerUser = array(); |
127 | - while ($rowx = Database::fetch_array($resx,'ASSOC')) { |
|
127 | + while ($rowx = Database::fetch_array($resx, 'ASSOC')) { |
|
128 | 128 | if ($this->onlyBestAttempts) { |
129 | 129 | if (!isset($bestAttemptPerUser[$rowx['excruid']])) { |
130 | 130 | $bestAttemptPerUser[$rowx['excruid']] = $rowx; |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | |
193 | 193 | $return[$i] = array(); |
194 | 194 | if (empty($user_id)) { |
195 | - $return[$i]['official_code'] = $result['official_code']; |
|
195 | + $return[$i]['official_code'] = $result['official_code']; |
|
196 | 196 | if (api_is_western_name_order()) { |
197 | 197 | $return[$i]['first_name'] = $results[$i]['userpart1']; |
198 | 198 | $return[$i]['last_name'] = $results[$i]['userpart2']; |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | $isWestern = api_is_western_name_order(); |
237 | 237 | |
238 | 238 | if (empty($user_id)) { |
239 | - $return[$i]['official_code'] = $student['official_code']; |
|
239 | + $return[$i]['official_code'] = $student['official_code']; |
|
240 | 240 | if ($isWestern) { |
241 | 241 | $return[$i]['first_name'] = $student['firstname']; |
242 | 242 | $return[$i]['last_name'] = $student['lastname']; |
@@ -289,22 +289,22 @@ discard block |
||
289 | 289 | $this->getExercisesReporting($document_path, $user_id, $export_filter, $exercise_id, $hotpotato_name); |
290 | 290 | |
291 | 291 | $filename = 'exercise_results_'.date('YmdGis').'.csv'; |
292 | - if(!empty($user_id)) { |
|
292 | + if (!empty($user_id)) { |
|
293 | 293 | $filename = 'exercise_results_user_'.$user_id.'_'.date('YmdGis').'.csv'; |
294 | 294 | } |
295 | 295 | $data = ''; |
296 | 296 | if (api_is_western_name_order()) { |
297 | - if(!empty($this->results[0]['first_name'])) { |
|
297 | + if (!empty($this->results[0]['first_name'])) { |
|
298 | 298 | $data .= get_lang('FirstName').';'; |
299 | 299 | } |
300 | - if(!empty($this->results[0]['last_name'])) { |
|
300 | + if (!empty($this->results[0]['last_name'])) { |
|
301 | 301 | $data .= get_lang('LastName').';'; |
302 | 302 | } |
303 | 303 | } else { |
304 | - if(!empty($this->results[0]['last_name'])) { |
|
304 | + if (!empty($this->results[0]['last_name'])) { |
|
305 | 305 | $data .= get_lang('LastName').';'; |
306 | 306 | } |
307 | - if(!empty($this->results[0]['first_name'])) { |
|
307 | + if (!empty($this->results[0]['first_name'])) { |
|
308 | 308 | $data .= get_lang('FirstName').';'; |
309 | 309 | } |
310 | 310 | } |
@@ -318,17 +318,17 @@ discard block |
||
318 | 318 | |
319 | 319 | if ($export_user_fields) { |
320 | 320 | //show user fields section with a big th colspan that spans over all fields |
321 | - $extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1); |
|
321 | + $extra_user_fields = UserManager::get_extra_fields(0, 1000, 5, 'ASC', false, 1); |
|
322 | 322 | $num = count($extra_user_fields); |
323 | - foreach($extra_user_fields as $field) { |
|
324 | - $data .= '"'.str_replace("\r\n",' ',api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset)).'";'; |
|
323 | + foreach ($extra_user_fields as $field) { |
|
324 | + $data .= '"'.str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset)).'";'; |
|
325 | 325 | } |
326 | 326 | } |
327 | 327 | |
328 | 328 | $data .= get_lang('Title').';'; |
329 | 329 | $data .= get_lang('StartDate').';'; |
330 | 330 | $data .= get_lang('EndDate').';'; |
331 | - $data .= get_lang('Duration'). ' ('.get_lang('MinMinutes').') ;'; |
|
331 | + $data .= get_lang('Duration').' ('.get_lang('MinMinutes').') ;'; |
|
332 | 332 | $data .= get_lang('Score').';'; |
333 | 333 | $data .= get_lang('Total').';'; |
334 | 334 | $data .= get_lang('Status').';'; |
@@ -340,37 +340,37 @@ discard block |
||
340 | 340 | foreach ($this->results as $row) { |
341 | 341 | |
342 | 342 | if (api_is_western_name_order()) { |
343 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
|
344 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; |
|
343 | + $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
|
344 | + $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; |
|
345 | 345 | } else { |
346 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; |
|
347 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
|
346 | + $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; |
|
347 | + $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | if ($officialCodeInList) { |
351 | 351 | $data .= $row['official_code'].';'; |
352 | 352 | } |
353 | 353 | |
354 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)).';'; |
|
355 | - $data .= str_replace("\r\n",' ',implode(", ", GroupManager :: get_user_group_name($row['user_id']))).';'; |
|
354 | + $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)).';'; |
|
355 | + $data .= str_replace("\r\n", ' ', implode(", ", GroupManager :: get_user_group_name($row['user_id']))).';'; |
|
356 | 356 | |
357 | 357 | if ($export_user_fields) { |
358 | 358 | //show user fields data, if any, for this user |
359 | - $user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true); |
|
360 | - foreach($user_fields_values as $value) { |
|
361 | - $data .= '"'.str_replace('"','""',api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)).'";'; |
|
359 | + $user_fields_values = UserManager::get_extra_user_data($row['user_id'], false, false, false, true); |
|
360 | + foreach ($user_fields_values as $value) { |
|
361 | + $data .= '"'.str_replace('"', '""', api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)).'";'; |
|
362 | 362 | } |
363 | 363 | } |
364 | 364 | |
365 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';'; |
|
366 | - $data .= str_replace("\r\n",' ',$row['start_date']).';'; |
|
367 | - $data .= str_replace("\r\n",' ',$row['end_date']).';'; |
|
368 | - $data .= str_replace("\r\n",' ',$row['duration']).';'; |
|
369 | - $data .= str_replace("\r\n",' ',$row['result']).';'; |
|
370 | - $data .= str_replace("\r\n",' ',$row['max']).';'; |
|
371 | - $data .= str_replace("\r\n",' ',$row['status']).';'; |
|
372 | - $data .= str_replace("\r\n",' ',$row['lp_name']).';'; |
|
373 | - $data .= str_replace("\r\n",' ',$row['is_user_subscribed']).';'; |
|
365 | + $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';'; |
|
366 | + $data .= str_replace("\r\n", ' ', $row['start_date']).';'; |
|
367 | + $data .= str_replace("\r\n", ' ', $row['end_date']).';'; |
|
368 | + $data .= str_replace("\r\n", ' ', $row['duration']).';'; |
|
369 | + $data .= str_replace("\r\n", ' ', $row['result']).';'; |
|
370 | + $data .= str_replace("\r\n", ' ', $row['max']).';'; |
|
371 | + $data .= str_replace("\r\n", ' ', $row['status']).';'; |
|
372 | + $data .= str_replace("\r\n", ' ', $row['lp_name']).';'; |
|
373 | + $data .= str_replace("\r\n", ' ', $row['is_user_subscribed']).';'; |
|
374 | 374 | $data .= "\n"; |
375 | 375 | } |
376 | 376 | |
@@ -434,14 +434,14 @@ discard block |
||
434 | 434 | |
435 | 435 | if ($with_column_user) { |
436 | 436 | if (api_is_western_name_order()) { |
437 | - $worksheet->SetCellValueByColumnAndRow($line, $column,get_lang('FirstName')); |
|
437 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('FirstName')); |
|
438 | 438 | $column++; |
439 | - $worksheet->SetCellValueByColumnAndRow($line, $column,get_lang('LastName')); |
|
439 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('LastName')); |
|
440 | 440 | $column++; |
441 | 441 | } else { |
442 | - $worksheet->SetCellValueByColumnAndRow($line, $column,get_lang('LastName')); |
|
442 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('LastName')); |
|
443 | 443 | $column++; |
444 | - $worksheet->SetCellValueByColumnAndRow($line, $column,get_lang('FirstName')); |
|
444 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('FirstName')); |
|
445 | 445 | $column++; |
446 | 446 | } |
447 | 447 | |
@@ -458,11 +458,11 @@ discard block |
||
458 | 458 | |
459 | 459 | if ($export_user_fields) { |
460 | 460 | //show user fields section with a big th colspan that spans over all fields |
461 | - $extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1); |
|
461 | + $extra_user_fields = UserManager::get_extra_fields(0, 1000, 5, 'ASC', false, 1); |
|
462 | 462 | |
463 | 463 | //show the fields names for user fields |
464 | 464 | foreach ($extra_user_fields as $field) { |
465 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset)); |
|
465 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset)); |
|
466 | 466 | $column++; |
467 | 467 | } |
468 | 468 | } |
@@ -491,39 +491,39 @@ discard block |
||
491 | 491 | |
492 | 492 | if ($with_column_user) { |
493 | 493 | if (api_is_western_name_order()) { |
494 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)); |
|
494 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)); |
|
495 | 495 | $column++; |
496 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)); |
|
496 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)); |
|
497 | 497 | $column++; |
498 | 498 | } else { |
499 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)); |
|
499 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)); |
|
500 | 500 | $column++; |
501 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)); |
|
501 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)); |
|
502 | 502 | $column++; |
503 | 503 | } |
504 | 504 | |
505 | 505 | if ($officialCodeInList === 'true') { |
506 | - $worksheet->SetCellValueByColumnAndRow($line, $column,api_html_entity_decode(strip_tags($row['official_code']), ENT_QUOTES, $charset)); |
|
506 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['official_code']), ENT_QUOTES, $charset)); |
|
507 | 507 | $column++; |
508 | 508 | } |
509 | 509 | |
510 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)); |
|
510 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)); |
|
511 | 511 | $column++; |
512 | 512 | } |
513 | 513 | |
514 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags(implode(", ", GroupManager :: get_user_group_name($row['user_id']))), ENT_QUOTES, $charset)); |
|
514 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags(implode(", ", GroupManager :: get_user_group_name($row['user_id']))), ENT_QUOTES, $charset)); |
|
515 | 515 | $column++; |
516 | 516 | |
517 | 517 | if ($export_user_fields) { |
518 | 518 | //show user fields data, if any, for this user |
519 | - $user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true); |
|
520 | - foreach($user_fields_values as $value) { |
|
521 | - $worksheet->SetCellValueByColumnAndRow($line,$column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)); |
|
519 | + $user_fields_values = UserManager::get_extra_user_data($row['user_id'], false, false, false, true); |
|
520 | + foreach ($user_fields_values as $value) { |
|
521 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)); |
|
522 | 522 | $column++; |
523 | 523 | } |
524 | 524 | } |
525 | 525 | |
526 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)); |
|
526 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)); |
|
527 | 527 | $column++; |
528 | 528 | $worksheet->SetCellValueByColumnAndRow($line, $column, $row['start_date']); |
529 | 529 | $column++; |
@@ -51,24 +51,24 @@ discard block |
||
51 | 51 | $objExercise = $_SESSION['objExercise']; |
52 | 52 | } |
53 | 53 | $exercise_id = intval($_GET['exercise_id']); |
54 | -$is_allowedToEdit=$is_courseAdmin; |
|
54 | +$is_allowedToEdit = $is_courseAdmin; |
|
55 | 55 | |
56 | -if (isset($_SESSION['gradebook'])){ |
|
57 | - $gradebook= $_SESSION['gradebook']; |
|
56 | +if (isset($_SESSION['gradebook'])) { |
|
57 | + $gradebook = $_SESSION['gradebook']; |
|
58 | 58 | } |
59 | 59 | |
60 | -if (!empty($gradebook) && $gradebook=='view') { |
|
61 | - $interbreadcrumb[]= array ( |
|
60 | +if (!empty($gradebook) && $gradebook == 'view') { |
|
61 | + $interbreadcrumb[] = array( |
|
62 | 62 | 'url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']), |
63 | 63 | 'name' => get_lang('ToolGradebook') |
64 | 64 | ); |
65 | 65 | } |
66 | -$nameTools=get_lang('Exercises'); |
|
66 | +$nameTools = get_lang('Exercises'); |
|
67 | 67 | $interbreadcrumb[] = array( |
68 | 68 | "url" => "exercise.php", |
69 | 69 | "name" => get_lang('Exercises'), |
70 | 70 | ); |
71 | -Display::display_header($nameTools,"Exercises"); |
|
71 | +Display::display_header($nameTools, "Exercises"); |
|
72 | 72 | |
73 | 73 | if (isset($_POST['ok'])) { |
74 | 74 | $message = get_lang('TestLimitsAdded'); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | */ |
141 | 141 | if (isset($_POST['ok'])) { |
142 | 142 | $exercise_id = intval($_POST['exe_id']); |
143 | - if ($_POST['limit']==1) { |
|
143 | + if ($_POST['limit'] == 1) { |
|
144 | 144 | $minutes = intval($_POST['minutes']); |
145 | 145 | $query = "UPDATE ".$TBL_EXERCISES." SET ques_time_limit= $minutes WHERE id= $exercise_id"; |
146 | 146 | Database::query($query); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | Database::query($query); |
150 | 150 | } |
151 | 151 | |
152 | - if ($_POST['attempt']==1) { |
|
152 | + if ($_POST['attempt'] == 1) { |
|
153 | 153 | $attempts = intval($_POST['attempts']); |
154 | 154 | $query = "UPDATE ".$TBL_EXERCISES." SET num_attempts = $attempts WHERE id= $exercise_id"; |
155 | 155 | Database::query($query); |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | $is_allowedToEdit=$is_courseAdmin; |
55 | 55 | |
56 | 56 | if (isset($_SESSION['gradebook'])){ |
57 | - $gradebook= $_SESSION['gradebook']; |
|
57 | + $gradebook= $_SESSION['gradebook']; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | if (!empty($gradebook) && $gradebook=='view') { |
61 | - $interbreadcrumb[]= array ( |
|
62 | - 'url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']), |
|
63 | - 'name' => get_lang('ToolGradebook') |
|
64 | - ); |
|
61 | + $interbreadcrumb[]= array ( |
|
62 | + 'url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']), |
|
63 | + 'name' => get_lang('ToolGradebook') |
|
64 | + ); |
|
65 | 65 | } |
66 | 66 | $nameTools=get_lang('Exercises'); |
67 | 67 | $interbreadcrumb[] = array( |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | Display::display_header($nameTools,"Exercises"); |
72 | 72 | |
73 | 73 | if (isset($_POST['ok'])) { |
74 | - $message = get_lang('TestLimitsAdded'); |
|
75 | - Display::display_normal_message($message); |
|
74 | + $message = get_lang('TestLimitsAdded'); |
|
75 | + Display::display_normal_message($message); |
|
76 | 76 | } |
77 | 77 | ?> |
78 | 78 | <script type="text/javascript"> |
@@ -139,22 +139,22 @@ discard block |
||
139 | 139 | * @todo shouldn't this be moved to the part above (around line 111: action handling) |
140 | 140 | */ |
141 | 141 | if (isset($_POST['ok'])) { |
142 | - $exercise_id = intval($_POST['exe_id']); |
|
143 | - if ($_POST['limit']==1) { |
|
144 | - $minutes = intval($_POST['minutes']); |
|
145 | - $query = "UPDATE ".$TBL_EXERCISES." SET ques_time_limit= $minutes WHERE id= $exercise_id"; |
|
146 | - Database::query($query); |
|
147 | - } else { |
|
148 | - $query = "UPDATE ".$TBL_EXERCISES." SET ques_time_limit= 0 WHERE id= $exercise_id"; |
|
149 | - Database::query($query); |
|
150 | - } |
|
142 | + $exercise_id = intval($_POST['exe_id']); |
|
143 | + if ($_POST['limit']==1) { |
|
144 | + $minutes = intval($_POST['minutes']); |
|
145 | + $query = "UPDATE ".$TBL_EXERCISES." SET ques_time_limit= $minutes WHERE id= $exercise_id"; |
|
146 | + Database::query($query); |
|
147 | + } else { |
|
148 | + $query = "UPDATE ".$TBL_EXERCISES." SET ques_time_limit= 0 WHERE id= $exercise_id"; |
|
149 | + Database::query($query); |
|
150 | + } |
|
151 | 151 | |
152 | - if ($_POST['attempt']==1) { |
|
153 | - $attempts = intval($_POST['attempts']); |
|
154 | - $query = "UPDATE ".$TBL_EXERCISES." SET num_attempts = $attempts WHERE id= $exercise_id"; |
|
155 | - Database::query($query); |
|
156 | - } else { |
|
157 | - $query = "UPDATE ".$TBL_EXERCISES." SET num_attempts = 0 WHERE id= $exercise_id"; |
|
158 | - Database::query($query); |
|
159 | - } |
|
152 | + if ($_POST['attempt']==1) { |
|
153 | + $attempts = intval($_POST['attempts']); |
|
154 | + $query = "UPDATE ".$TBL_EXERCISES." SET num_attempts = $attempts WHERE id= $exercise_id"; |
|
155 | + Database::query($query); |
|
156 | + } else { |
|
157 | + $query = "UPDATE ".$TBL_EXERCISES." SET num_attempts = 0 WHERE id= $exercise_id"; |
|
158 | + Database::query($query); |
|
159 | + } |
|
160 | 160 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | require_once '../inc/global.inc.php'; |
16 | 16 | |
17 | -require_once api_get_path(LIBRARY_PATH) . 'pear/excelreader/reader.php'; |
|
17 | +require_once api_get_path(LIBRARY_PATH).'pear/excelreader/reader.php'; |
|
18 | 18 | |
19 | 19 | // Security check |
20 | 20 | $is_allowed_to_edit = api_is_allowed_to_edit(null, true); |
@@ -59,14 +59,14 @@ discard block |
||
59 | 59 | function lp_upload_quiz_actions() |
60 | 60 | { |
61 | 61 | $return = '<a href="exercise.php?'.api_get_cidReq().'">'. |
62 | - Display::return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
62 | + Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
63 | 63 | return $return; |
64 | 64 | } |
65 | 65 | |
66 | 66 | function lp_upload_quiz_secondary_actions() |
67 | 67 | { |
68 | - $return = '<a href="exercise_report.php?' . api_get_cidreq() . '">' . |
|
69 | - Display :: return_icon('reporting32.png', get_lang('Tracking')) . get_lang('Tracking') . '</a>'; |
|
68 | + $return = '<a href="exercise_report.php?'.api_get_cidreq().'">'. |
|
69 | + Display :: return_icon('reporting32.png', get_lang('Tracking')).get_lang('Tracking').'</a>'; |
|
70 | 70 | return $return; |
71 | 71 | } |
72 | 72 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $table->setHeaderContents(0, 1, '#'); |
105 | 105 | |
106 | 106 | $row = 1; |
107 | - foreach ($tableList as $key => $label ) { |
|
107 | + foreach ($tableList as $key => $label) { |
|
108 | 108 | $table->setCellContents($row, 0, $label); |
109 | 109 | $table->setCellContents($row, 1, $key); |
110 | 110 | $row++; |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | $comment = $feedback_true_list[$i][2]; |
444 | 444 | } else { |
445 | 445 | $comment = $feedback_false_list[$i][2]; |
446 | - $floatVal = (float)$answer_data[3]; |
|
446 | + $floatVal = (float) $answer_data[3]; |
|
447 | 447 | if (is_numeric($floatVal)) { |
448 | 448 | $score = $answer_data[3]; |
449 | 449 | } |