@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | * @param null $feedback_type |
416 | 416 | * @param null $counter |
417 | 417 | * @param null $score |
418 | - * @return null|string |
|
418 | + * @return string |
|
419 | 419 | */ |
420 | 420 | public function return_header($feedback_type = null, $counter = null, $score = null) |
421 | 421 | { |
@@ -429,15 +429,16 @@ discard block |
||
429 | 429 | } |
430 | 430 | |
431 | 431 | /** |
432 | - * @param $separatorStartRegexp |
|
433 | - * @param $separatorEndRegexp |
|
434 | - * @param $correctItemRegexp |
|
435 | - * @param $questionId |
|
432 | + * @param string $separatorStartRegexp |
|
433 | + * @param string $separatorEndRegexp |
|
434 | + * @param string $correctItemRegexp |
|
435 | + * @param integer $questionId |
|
436 | 436 | * @param $correctItem |
437 | 437 | * @param $attributes |
438 | - * @param $answer |
|
438 | + * @param string $answer |
|
439 | 439 | * @param $listAnswersInfo |
440 | - * @param $displayForStudent |
|
440 | + * @param boolean $displayForStudent |
|
441 | + * @param integer $inBlankNumber |
|
441 | 442 | * @return string |
442 | 443 | */ |
443 | 444 | public static function getFillTheBlankHtml( |
@@ -736,11 +737,11 @@ discard block |
||
736 | 737 | * 0 : student answer is correct |
737 | 738 | * >0 : for fill the blank question with choice menu, is the index of the student answer (right answer indice is 0) |
738 | 739 | * |
739 | - * @param $testId |
|
740 | - * @param $questionId |
|
740 | + * @param integer $testId |
|
741 | + * @param integer $questionId |
|
741 | 742 | * @param $studentsIdList |
742 | - * @param $startDate |
|
743 | - * @param $endDate |
|
743 | + * @param string $startDate |
|
744 | + * @param string $endDate |
|
744 | 745 | * @param bool $useLastAnswerredAttempt |
745 | 746 | * @return array |
746 | 747 | * ( |
@@ -917,7 +918,7 @@ discard block |
||
917 | 918 | * return $text protected for use in regexp |
918 | 919 | * @param string $text |
919 | 920 | * |
920 | - * @return mixed |
|
921 | + * @return string |
|
921 | 922 | */ |
922 | 923 | public static function getRegexpProtected($text) |
923 | 924 | { |
@@ -975,7 +976,7 @@ discard block |
||
975 | 976 | * return the start separator for answer |
976 | 977 | * @param string $number |
977 | 978 | * |
978 | - * @return mixed |
|
979 | + * @return string |
|
979 | 980 | */ |
980 | 981 | public static function getStartSeparator($number) |
981 | 982 | { |
@@ -988,7 +989,7 @@ discard block |
||
988 | 989 | * return the end separator for answer |
989 | 990 | * @param string $number |
990 | 991 | * |
991 | - * @return mixed |
|
992 | + * @return string |
|
992 | 993 | */ |
993 | 994 | public static function getEndSeparator($number) |
994 | 995 | { |
@@ -729,43 +729,43 @@ discard block |
||
729 | 729 | } |
730 | 730 | |
731 | 731 | /** |
732 | - * Return an array of student state answers for fill the blank questions |
|
733 | - * for each students that answered the question |
|
734 | - * -2 : didn't answer |
|
735 | - * -1 : student answer is wrong |
|
736 | - * 0 : student answer is correct |
|
737 | - * >0 : for fill the blank question with choice menu, is the index of the student answer (right answer indice is 0) |
|
738 | - * |
|
739 | - * @param $testId |
|
740 | - * @param $questionId |
|
741 | - * @param $studentsIdList |
|
742 | - * @param $startDate |
|
743 | - * @param $endDate |
|
744 | - * @param bool $useLastAnswerredAttempt |
|
745 | - * @return array |
|
746 | - * ( |
|
747 | - * [student_id] => Array |
|
748 | - * ( |
|
749 | - * [first fill the blank for question] => -1 |
|
750 | - * [second fill the blank for question] => 2 |
|
751 | - * [third fill the blank for question] => -1 |
|
752 | - * ) |
|
753 | - * ) |
|
754 | - */ |
|
732 | + * Return an array of student state answers for fill the blank questions |
|
733 | + * for each students that answered the question |
|
734 | + * -2 : didn't answer |
|
735 | + * -1 : student answer is wrong |
|
736 | + * 0 : student answer is correct |
|
737 | + * >0 : for fill the blank question with choice menu, is the index of the student answer (right answer indice is 0) |
|
738 | + * |
|
739 | + * @param $testId |
|
740 | + * @param $questionId |
|
741 | + * @param $studentsIdList |
|
742 | + * @param $startDate |
|
743 | + * @param $endDate |
|
744 | + * @param bool $useLastAnswerredAttempt |
|
745 | + * @return array |
|
746 | + * ( |
|
747 | + * [student_id] => Array |
|
748 | + * ( |
|
749 | + * [first fill the blank for question] => -1 |
|
750 | + * [second fill the blank for question] => 2 |
|
751 | + * [third fill the blank for question] => -1 |
|
752 | + * ) |
|
753 | + * ) |
|
754 | + */ |
|
755 | 755 | public static function getFillTheBlankTabResult($testId, $questionId, $studentsIdList, $startDate, $endDate, $useLastAnswerredAttempt = true) { |
756 | 756 | |
757 | - $tblTrackEAttempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); |
|
758 | - $tblTrackEExercise = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
759 | - $courseId = api_get_course_int_id(); |
|
757 | + $tblTrackEAttempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); |
|
758 | + $tblTrackEExercise = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
759 | + $courseId = api_get_course_int_id(); |
|
760 | 760 | |
761 | - require_once api_get_path(SYS_PATH).'main/exercice/fill_blanks.class.php'; |
|
761 | + require_once api_get_path(SYS_PATH).'main/exercice/fill_blanks.class.php'; |
|
762 | 762 | |
763 | - // request to have all the answers of student for this question |
|
764 | - // student may have doing it several time |
|
765 | - // student may have not answered the bracket id, in this case, is result of the answer is empty |
|
763 | + // request to have all the answers of student for this question |
|
764 | + // student may have doing it several time |
|
765 | + // student may have not answered the bracket id, in this case, is result of the answer is empty |
|
766 | 766 | |
767 | - // we got the less recent attempt first |
|
768 | - $sql = ' |
|
767 | + // we got the less recent attempt first |
|
768 | + $sql = ' |
|
769 | 769 | SELECT * FROM '.$tblTrackEAttempt.' tea |
770 | 770 | |
771 | 771 | LEFT JOIN '.$tblTrackEExercise.' tee |
@@ -781,49 +781,49 @@ discard block |
||
781 | 781 | ORDER BY user_id, tea.exe_id; |
782 | 782 | '; |
783 | 783 | |
784 | - $res = Database::query($sql); |
|
785 | - $tabUserResult = array(); |
|
786 | - $bracketNumber = 0; |
|
787 | - // foreach attempts for all students starting with his older attempt |
|
788 | - while ($data = Database::fetch_array($res)) { |
|
789 | - $tabAnswer = FillBlanks::getAnswerInfo($data['answer'], true); |
|
784 | + $res = Database::query($sql); |
|
785 | + $tabUserResult = array(); |
|
786 | + $bracketNumber = 0; |
|
787 | + // foreach attempts for all students starting with his older attempt |
|
788 | + while ($data = Database::fetch_array($res)) { |
|
789 | + $tabAnswer = FillBlanks::getAnswerInfo($data['answer'], true); |
|
790 | 790 | |
791 | - // for each bracket to find in this question |
|
792 | - foreach ($tabAnswer['studentanswer'] as $bracketNumber => $studentAnswer) { |
|
791 | + // for each bracket to find in this question |
|
792 | + foreach ($tabAnswer['studentanswer'] as $bracketNumber => $studentAnswer) { |
|
793 | 793 | |
794 | - if ($tabAnswer['studentanswer'][$bracketNumber] != '') { |
|
795 | - // student has answered this bracket, cool |
|
796 | - switch (FillBlanks::getFillTheBlankAnswerType($tabAnswer['tabwords'][$bracketNumber])) { |
|
797 | - case self::FILL_THE_BLANK_MENU : |
|
794 | + if ($tabAnswer['studentanswer'][$bracketNumber] != '') { |
|
795 | + // student has answered this bracket, cool |
|
796 | + switch (FillBlanks::getFillTheBlankAnswerType($tabAnswer['tabwords'][$bracketNumber])) { |
|
797 | + case self::FILL_THE_BLANK_MENU : |
|
798 | 798 | // get the indice of the choosen answer in the menu |
799 | 799 | // we know that the right answer is the first entry of the menu, ie 0 |
800 | 800 | // (remember, menu entries are shuffled when taking the test) |
801 | 801 | $tabUserResult[$data['user_id']][$bracketNumber] = FillBlanks::getFillTheBlankMenuAnswerNum($tabAnswer['tabwords'][$bracketNumber], $tabAnswer['studentanswer'][$bracketNumber]); |
802 | - break; |
|
803 | - default : |
|
802 | + break; |
|
803 | + default : |
|
804 | 804 | if (FillBlanks::isGoodStudentAnswer($tabAnswer['studentanswer'][$bracketNumber], $tabAnswer['tabwords'][$bracketNumber])) { |
805 | - $tabUserResult[$data['user_id']][$bracketNumber] = 0; // right answer |
|
806 | - } else { |
|
807 | - $tabUserResult[$data['user_id']][$bracketNumber] = -1; // wrong answer |
|
808 | - } |
|
809 | - } |
|
810 | - } else { |
|
811 | - // student didn't answer this bracket |
|
812 | - if ($useLastAnswerredAttempt) { |
|
813 | - // if we take into account the last answered attempt |
|
814 | - if (!isset($tabUserResult[$data['user_id']][$bracketNumber])) { |
|
815 | - $tabUserResult[$data['user_id']][$bracketNumber] = -2; // not answered |
|
816 | - } |
|
817 | - } else { |
|
818 | - // we take the last attempt, even if the student answer the question before |
|
819 | - $tabUserResult[$data['user_id']][$bracketNumber] = -2; // not answered |
|
820 | - } |
|
821 | - } |
|
822 | - } |
|
823 | - |
|
824 | - |
|
825 | - } |
|
826 | - return $tabUserResult; |
|
805 | + $tabUserResult[$data['user_id']][$bracketNumber] = 0; // right answer |
|
806 | + } else { |
|
807 | + $tabUserResult[$data['user_id']][$bracketNumber] = -1; // wrong answer |
|
808 | + } |
|
809 | + } |
|
810 | + } else { |
|
811 | + // student didn't answer this bracket |
|
812 | + if ($useLastAnswerredAttempt) { |
|
813 | + // if we take into account the last answered attempt |
|
814 | + if (!isset($tabUserResult[$data['user_id']][$bracketNumber])) { |
|
815 | + $tabUserResult[$data['user_id']][$bracketNumber] = -2; // not answered |
|
816 | + } |
|
817 | + } else { |
|
818 | + // we take the last attempt, even if the student answer the question before |
|
819 | + $tabUserResult[$data['user_id']][$bracketNumber] = -2; // not answered |
|
820 | + } |
|
821 | + } |
|
822 | + } |
|
823 | + |
|
824 | + |
|
825 | + } |
|
826 | + return $tabUserResult; |
|
827 | 827 | } |
828 | 828 | |
829 | 829 |
@@ -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 .= " | "; |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * Sets the comment in the database for a particular path. |
95 | 95 | * @param string File path |
96 | 96 | * @param string Comment to set |
97 | - * @return string Result of the database operation (Database::query will output some message directly on error anyway) |
|
97 | + * @return Doctrine\DBAL\Driver\Statement|null Result of the database operation (Database::query will output some message directly on error anyway) |
|
98 | 98 | */ |
99 | 99 | function SetComment($path, $comment) |
100 | 100 | { |
@@ -112,6 +112,7 @@ discard block |
||
112 | 112 | /** |
113 | 113 | * Reads the file contents into a string. |
114 | 114 | * @param string Urlencoded path |
115 | + * @param string $full_file_path |
|
115 | 116 | * @return string The file contents or false on security error |
116 | 117 | */ |
117 | 118 | function ReadFileCont($full_file_path) |
@@ -257,6 +258,7 @@ discard block |
||
257 | 258 | * Searches for a node in the given array. |
258 | 259 | * @param reference Reference to the array to search |
259 | 260 | * @param string Node we are looking for in the array |
261 | + * @param string $node |
|
260 | 262 | * @return mixed Node name or false if not found |
261 | 263 | */ |
262 | 264 | function myarraysearch(&$array, $node) |
@@ -316,6 +318,8 @@ discard block |
||
316 | 318 | * Fills the folder name up to a certain length with "0". |
317 | 319 | * @param string Original folder name |
318 | 320 | * @param integer Length to reach |
321 | + * @param integer $name |
|
322 | + * @param integer $nsize |
|
319 | 323 | * @return string Modified folder name |
320 | 324 | */ |
321 | 325 | function FillFolderName($name, $nsize) |
@@ -344,7 +344,7 @@ |
||
344 | 344 | if (is_dir($full_name)) { |
345 | 345 | $filelist[] = $file; |
346 | 346 | } |
347 | - } |
|
347 | + } |
|
348 | 348 | } |
349 | 349 | } |
350 | 350 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | if ($title == '') { |
67 | 67 | $title = basename($fname); |
68 | 68 | } |
69 | - return (string)$title; |
|
69 | + return (string) $title; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | if ($src == '') { |
177 | 177 | return ''; |
178 | 178 | } else { |
179 | - $tmp_src = basename($src) ; |
|
179 | + $tmp_src = basename($src); |
|
180 | 180 | if ($tmp_src == '') { |
181 | 181 | return $src; |
182 | 182 | } else { |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | { |
199 | 199 | // Select src tag from img tag. |
200 | 200 | $match = array(); |
201 | - preg_match("|(src=\".*\" )|U", $imgtag, $match); //src |
|
201 | + preg_match("|(src=\".*\" )|U", $imgtag, $match); //src |
|
202 | 202 | list($key, $srctag) = each($match); |
203 | 203 | $src = substr($srctag, 5, (strlen($srctag) - 7)); |
204 | 204 | if (stristr($src, 'http') === false) { |
@@ -230,8 +230,8 @@ discard block |
||
230 | 230 | while (list($key, $imgtag) = each($match)) { |
231 | 231 | $imgname = GetImgName($imgtag); |
232 | 232 | if ($imgname != '' && !in_array($imgname, $imgparams)) { |
233 | - array_push($imgparams, $imgname); // name (+ type) of the images in the html test |
|
234 | - $imgcount = $imgcount + 1; // number of images in the html test |
|
233 | + array_push($imgparams, $imgname); // name (+ type) of the images in the html test |
|
234 | + $imgcount = $imgcount + 1; // number of images in the html test |
|
235 | 235 | } |
236 | 236 | } |
237 | 237 | } |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | if ($file != '..') { |
405 | 405 | $full_name = $folder.'/'.$file; |
406 | 406 | if (is_dir($full_name)) { |
407 | - $dflag = 1; // first directory |
|
407 | + $dflag = 1; // first directory |
|
408 | 408 | } |
409 | 409 | } |
410 | 410 | } |
@@ -18,6 +18,7 @@ |
||
18 | 18 | * Gets the results of all students (or just one student if access is limited) |
19 | 19 | * @param string The document path (for HotPotatoes retrieval) |
20 | 20 | * @param integer User ID. Optional. If no user ID is provided, we take all the results. Defauts to null |
21 | + * @param string $document_path |
|
21 | 22 | */ |
22 | 23 | public function getExercisesReporting($document_path, $hotpotato_name) |
23 | 24 | { |
@@ -14,14 +14,14 @@ discard block |
||
14 | 14 | //stores the results |
15 | 15 | private $results = array(); |
16 | 16 | |
17 | - /** |
|
18 | - * Gets the results of all students (or just one student if access is limited) |
|
19 | - * @param string The document path (for HotPotatoes retrieval) |
|
20 | - * @param integer User ID. Optional. If no user ID is provided, we take all the results. Defauts to null |
|
21 | - */ |
|
22 | - public function getExercisesReporting($document_path, $hotpotato_name) |
|
17 | + /** |
|
18 | + * Gets the results of all students (or just one student if access is limited) |
|
19 | + * @param string The document path (for HotPotatoes retrieval) |
|
20 | + * @param integer User ID. Optional. If no user ID is provided, we take all the results. Defauts to null |
|
21 | + */ |
|
22 | + public function getExercisesReporting($document_path, $hotpotato_name) |
|
23 | 23 | { |
24 | - $return = array(); |
|
24 | + $return = array(); |
|
25 | 25 | $TBL_USER = Database::get_main_table(TABLE_MAIN_USER); |
26 | 26 | $TBL_TRACK_HOTPOTATOES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES); |
27 | 27 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $hotpotato_name = Database::escape_string($hotpotato_name); |
34 | 34 | |
35 | 35 | if (!empty($exercise_id)) { |
36 | - $session_id_and .= " AND exe_exo_id = $exercise_id "; |
|
36 | + $session_id_and .= " AND exe_exo_id = $exercise_id "; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | if (empty($user_id)) { |
@@ -110,25 +110,25 @@ discard block |
||
110 | 110 | $this->results = $return; |
111 | 111 | |
112 | 112 | return true; |
113 | - } |
|
113 | + } |
|
114 | 114 | |
115 | 115 | |
116 | - /** |
|
117 | - * Exports the complete report as a CSV file |
|
118 | - * @param string Document path inside the document tool |
|
119 | - * @param integer Optional user ID |
|
120 | - * @param boolean Whether to include user fields or not |
|
121 | - * @return boolean False on error |
|
122 | - */ |
|
123 | - public function exportCompleteReportCSV($document_path='', $hotpotato_name) |
|
116 | + /** |
|
117 | + * Exports the complete report as a CSV file |
|
118 | + * @param string Document path inside the document tool |
|
119 | + * @param integer Optional user ID |
|
120 | + * @param boolean Whether to include user fields or not |
|
121 | + * @return boolean False on error |
|
122 | + */ |
|
123 | + public function exportCompleteReportCSV($document_path='', $hotpotato_name) |
|
124 | 124 | { |
125 | - global $charset; |
|
126 | - $this->getExercisesReporting($document_path, $hotpotato_name); |
|
127 | - $filename = 'exercise_results_'.date('YmdGis').'.csv'; |
|
128 | - if (!empty($user_id)) { |
|
129 | - $filename = 'exercise_results_user_'.$user_id.'_'.date('YmdGis').'.csv'; |
|
130 | - } |
|
131 | - $data = ''; |
|
125 | + global $charset; |
|
126 | + $this->getExercisesReporting($document_path, $hotpotato_name); |
|
127 | + $filename = 'exercise_results_'.date('YmdGis').'.csv'; |
|
128 | + if (!empty($user_id)) { |
|
129 | + $filename = 'exercise_results_user_'.$user_id.'_'.date('YmdGis').'.csv'; |
|
130 | + } |
|
131 | + $data = ''; |
|
132 | 132 | |
133 | 133 | if (api_is_western_name_order()) { |
134 | 134 | if(!empty($this->results[0]['first_name'])) { |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | } |
148 | 148 | $data .= get_lang('Email').';'; |
149 | 149 | |
150 | - /*if ($export_user_fields) { |
|
150 | + /*if ($export_user_fields) { |
|
151 | 151 | //show user fields section with a big th colspan that spans over all fields |
152 | 152 | $extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1); |
153 | 153 | $num = count($extra_user_fields); |
@@ -156,25 +156,25 @@ discard block |
||
156 | 156 | } |
157 | 157 | }*/ |
158 | 158 | |
159 | - $data .= get_lang('Title').';'; |
|
160 | - $data .= get_lang('StartDate').';'; |
|
161 | - $data .= get_lang('Score').';'; |
|
162 | - $data .= get_lang('Total').';'; |
|
163 | - $data .= "\n"; |
|
159 | + $data .= get_lang('Title').';'; |
|
160 | + $data .= get_lang('StartDate').';'; |
|
161 | + $data .= get_lang('Score').';'; |
|
162 | + $data .= get_lang('Total').';'; |
|
163 | + $data .= "\n"; |
|
164 | 164 | |
165 | - //results |
|
166 | - foreach($this->results as $row) { |
|
165 | + //results |
|
166 | + foreach($this->results as $row) { |
|
167 | 167 | if (api_is_western_name_order()) { |
168 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
|
169 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; |
|
168 | + $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
|
169 | + $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; |
|
170 | 170 | } else { |
171 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; |
|
172 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
|
171 | + $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; |
|
172 | + $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)).';'; |
176 | 176 | |
177 | - /*if ($export_user_fields) { |
|
177 | + /*if ($export_user_fields) { |
|
178 | 178 | //show user fields data, if any, for this user |
179 | 179 | $user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true); |
180 | 180 | foreach($user_fields_values as $value) { |
@@ -182,40 +182,40 @@ discard block |
||
182 | 182 | } |
183 | 183 | }*/ |
184 | 184 | |
185 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';'; |
|
186 | - $data .= str_replace("\r\n",' ',$row['exe_date']).';'; |
|
187 | - $data .= str_replace("\r\n",' ',$row['result']).';'; |
|
188 | - $data .= str_replace("\r\n",' ',$row['max']).';'; |
|
189 | - $data .= "\n"; |
|
190 | - } |
|
191 | - |
|
192 | - //output the results |
|
193 | - $len = strlen($data); |
|
194 | - header('Content-type: application/octet-stream'); |
|
195 | - header('Content-Type: application/force-download'); |
|
196 | - header('Content-length: '.$len); |
|
197 | - if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) { |
|
198 | - header('Content-Disposition: filename= '.$filename); |
|
199 | - } else { |
|
200 | - header('Content-Disposition: attachment; filename= '.$filename); |
|
201 | - } |
|
202 | - if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) { |
|
203 | - header('Pragma: '); |
|
204 | - header('Cache-Control: '); |
|
205 | - header('Cache-Control: public'); // IE cannot download from sessions without a cache |
|
206 | - } |
|
207 | - header('Content-Description: '.$filename); |
|
208 | - header('Content-transfer-encoding: binary'); |
|
209 | - // @todo add this utf-8 header for all csv files |
|
210 | - echo "\xEF\xBB\xBF"; // force utf-8 header of csv file |
|
211 | - echo $data; |
|
212 | - return true; |
|
213 | - } |
|
214 | - |
|
215 | - /** |
|
216 | - * Exports the complete report as an XLS file |
|
217 | - * @return boolean False on error |
|
218 | - */ |
|
185 | + $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';'; |
|
186 | + $data .= str_replace("\r\n",' ',$row['exe_date']).';'; |
|
187 | + $data .= str_replace("\r\n",' ',$row['result']).';'; |
|
188 | + $data .= str_replace("\r\n",' ',$row['max']).';'; |
|
189 | + $data .= "\n"; |
|
190 | + } |
|
191 | + |
|
192 | + //output the results |
|
193 | + $len = strlen($data); |
|
194 | + header('Content-type: application/octet-stream'); |
|
195 | + header('Content-Type: application/force-download'); |
|
196 | + header('Content-length: '.$len); |
|
197 | + if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) { |
|
198 | + header('Content-Disposition: filename= '.$filename); |
|
199 | + } else { |
|
200 | + header('Content-Disposition: attachment; filename= '.$filename); |
|
201 | + } |
|
202 | + if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) { |
|
203 | + header('Pragma: '); |
|
204 | + header('Cache-Control: '); |
|
205 | + header('Cache-Control: public'); // IE cannot download from sessions without a cache |
|
206 | + } |
|
207 | + header('Content-Description: '.$filename); |
|
208 | + header('Content-transfer-encoding: binary'); |
|
209 | + // @todo add this utf-8 header for all csv files |
|
210 | + echo "\xEF\xBB\xBF"; // force utf-8 header of csv file |
|
211 | + echo $data; |
|
212 | + return true; |
|
213 | + } |
|
214 | + |
|
215 | + /** |
|
216 | + * Exports the complete report as an XLS file |
|
217 | + * @return boolean False on error |
|
218 | + */ |
|
219 | 219 | public function exportCompleteReportXLS( |
220 | 220 | $document_path = '', |
221 | 221 | $user_id = null, |
@@ -224,37 +224,37 @@ discard block |
||
224 | 224 | $exercise_id = 0, |
225 | 225 | $hotpotato_name = null |
226 | 226 | ) { |
227 | - global $charset; |
|
228 | - $this->getExercisesReporting($document_path, $user_id, $export_filter, $exercise_id, $hotpotato_name); |
|
229 | - $filename = 'exercise_results_'.api_get_local_time().'.xls'; |
|
230 | - if (!empty($user_id)) { |
|
231 | - $filename = 'exercise_results_user_'.$user_id.'_'.api_get_local_time().'.xls'; |
|
232 | - } |
|
227 | + global $charset; |
|
228 | + $this->getExercisesReporting($document_path, $user_id, $export_filter, $exercise_id, $hotpotato_name); |
|
229 | + $filename = 'exercise_results_'.api_get_local_time().'.xls'; |
|
230 | + if (!empty($user_id)) { |
|
231 | + $filename = 'exercise_results_user_'.$user_id.'_'.api_get_local_time().'.xls'; |
|
232 | + } |
|
233 | 233 | |
234 | 234 | $spreadsheet = new PHPExcel(); |
235 | 235 | $spreadsheet->setActiveSheetIndex(0); |
236 | 236 | $worksheet = $spreadsheet->getActiveSheet(); |
237 | 237 | |
238 | 238 | |
239 | - $line = 0; |
|
240 | - $column = 0; //skip the first column (row titles) |
|
239 | + $line = 0; |
|
240 | + $column = 0; //skip the first column (row titles) |
|
241 | 241 | |
242 | - // check if exists column 'user' |
|
243 | - $with_column_user = false; |
|
244 | - foreach ($this->results as $result) { |
|
245 | - if (!empty($result['last_name']) && !empty($result['first_name'])) { |
|
246 | - $with_column_user = true; |
|
247 | - break; |
|
248 | - } |
|
249 | - } |
|
242 | + // check if exists column 'user' |
|
243 | + $with_column_user = false; |
|
244 | + foreach ($this->results as $result) { |
|
245 | + if (!empty($result['last_name']) && !empty($result['first_name'])) { |
|
246 | + $with_column_user = true; |
|
247 | + break; |
|
248 | + } |
|
249 | + } |
|
250 | 250 | |
251 | - if ($with_column_user) { |
|
252 | - $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('Email')); |
|
253 | - $column++; |
|
251 | + if ($with_column_user) { |
|
252 | + $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('Email')); |
|
253 | + $column++; |
|
254 | 254 | |
255 | 255 | if (api_is_western_name_order()) { |
256 | - $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName')); |
|
257 | - $column++; |
|
256 | + $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName')); |
|
257 | + $column++; |
|
258 | 258 | $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('LastName')); |
259 | 259 | $column++; |
260 | 260 | } else { |
@@ -263,36 +263,36 @@ discard block |
||
263 | 263 | $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName')); |
264 | 264 | $column++; |
265 | 265 | } |
266 | - } |
|
266 | + } |
|
267 | 267 | |
268 | - if ($export_user_fields) { |
|
269 | - //show user fields section with a big th colspan that spans over all fields |
|
270 | - $extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1); |
|
268 | + if ($export_user_fields) { |
|
269 | + //show user fields section with a big th colspan that spans over all fields |
|
270 | + $extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1); |
|
271 | 271 | |
272 | - //show the fields names for user fields |
|
273 | - foreach ($extra_user_fields as $field) { |
|
274 | - $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset)); |
|
275 | - $column++; |
|
276 | - } |
|
277 | - } |
|
272 | + //show the fields names for user fields |
|
273 | + foreach ($extra_user_fields as $field) { |
|
274 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset)); |
|
275 | + $column++; |
|
276 | + } |
|
277 | + } |
|
278 | 278 | |
279 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Title')); |
|
280 | - $column++; |
|
281 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('StartDate')); |
|
279 | + $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Title')); |
|
280 | + $column++; |
|
281 | + $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('StartDate')); |
|
282 | 282 | $column++; |
283 | 283 | $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('EndDate')); |
284 | 284 | $column++; |
285 | 285 | $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Duration').' ('.get_lang('MinMinutes').')'); |
286 | - $column++; |
|
287 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Score')); |
|
288 | - $column++; |
|
289 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Total')); |
|
290 | - $column++; |
|
286 | + $column++; |
|
287 | + $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Score')); |
|
288 | + $column++; |
|
289 | + $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Total')); |
|
290 | + $column++; |
|
291 | 291 | $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Status')); |
292 | - $line++; |
|
292 | + $line++; |
|
293 | 293 | |
294 | - foreach ($this->results as $row) { |
|
295 | - $column = 0; |
|
294 | + foreach ($this->results as $row) { |
|
295 | + $column = 0; |
|
296 | 296 | |
297 | 297 | if ($with_column_user) { |
298 | 298 | $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)); |
@@ -309,38 +309,38 @@ discard block |
||
309 | 309 | $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)); |
310 | 310 | $column++; |
311 | 311 | } |
312 | - } |
|
312 | + } |
|
313 | 313 | |
314 | - if ($export_user_fields) { |
|
315 | - //show user fields data, if any, for this user |
|
316 | - $user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true); |
|
317 | - foreach($user_fields_values as $value) { |
|
318 | - $worksheet->SetCellValueByColumnAndRow($line,$column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)); |
|
319 | - $column++; |
|
320 | - } |
|
321 | - } |
|
314 | + if ($export_user_fields) { |
|
315 | + //show user fields data, if any, for this user |
|
316 | + $user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true); |
|
317 | + foreach($user_fields_values as $value) { |
|
318 | + $worksheet->SetCellValueByColumnAndRow($line,$column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)); |
|
319 | + $column++; |
|
320 | + } |
|
321 | + } |
|
322 | 322 | |
323 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)); |
|
324 | - $column++; |
|
325 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['start_date']); |
|
323 | + $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)); |
|
324 | + $column++; |
|
325 | + $worksheet->SetCellValueByColumnAndRow($line,$column,$row['start_date']); |
|
326 | 326 | $column++; |
327 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['end_date']); |
|
327 | + $worksheet->SetCellValueByColumnAndRow($line,$column,$row['end_date']); |
|
328 | + $column++; |
|
329 | + $worksheet->SetCellValueByColumnAndRow($line,$column,$row['duration']); |
|
330 | + $column++; |
|
331 | + $worksheet->SetCellValueByColumnAndRow($line,$column,$row['result']); |
|
332 | + $column++; |
|
333 | + $worksheet->SetCellValueByColumnAndRow($line,$column,$row['max']); |
|
328 | 334 | $column++; |
329 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['duration']); |
|
330 | - $column++; |
|
331 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['result']); |
|
332 | - $column++; |
|
333 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['max']); |
|
334 | - $column++; |
|
335 | 335 | $worksheet->SetCellValueByColumnAndRow($line,$column,$row['status']); |
336 | - $line++; |
|
337 | - } |
|
336 | + $line++; |
|
337 | + } |
|
338 | 338 | |
339 | 339 | $file = api_get_path(SYS_ARCHIVE_PATH).api_replace_dangerous_char($filename); |
340 | 340 | $writer = new PHPExcel_Writer_Excel2007($spreadsheet); |
341 | 341 | $writer->save($file); |
342 | 342 | DocumentManager::file_send_for_download($file, true, $filename); |
343 | 343 | |
344 | - return true; |
|
345 | - } |
|
344 | + return true; |
|
345 | + } |
|
346 | 346 | } |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | { |
24 | 24 | $return = array(); |
25 | 25 | $TBL_USER = Database::get_main_table(TABLE_MAIN_USER); |
26 | - $TBL_TRACK_HOTPOTATOES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES); |
|
26 | + $TBL_TRACK_HOTPOTATOES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES); |
|
27 | 27 | |
28 | 28 | $cid = api_get_course_id(); |
29 | 29 | $course_id = api_get_course_int_id(); |
30 | 30 | //$user_id = intval($user_id); |
31 | 31 | $user_id = null; |
32 | - $session_id_and = ' AND te.session_id = ' . api_get_session_id() . ' '; |
|
32 | + $session_id_and = ' AND te.session_id = '.api_get_session_id().' '; |
|
33 | 33 | $hotpotato_name = Database::escape_string($hotpotato_name); |
34 | 34 | |
35 | 35 | if (!empty($exercise_id)) { |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | } |
38 | 38 | |
39 | 39 | if (empty($user_id)) { |
40 | - $sql="SELECT firstname as userpart1, lastname as userpart2 , |
|
40 | + $sql = "SELECT firstname as userpart1, lastname as userpart2 , |
|
41 | 41 | email, |
42 | 42 | tth.exe_name, |
43 | 43 | tth.exe_result, |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | tth.exe_name = '$hotpotato_name' |
50 | 50 | ORDER BY tth.c_id ASC, tth.exe_date ASC"; |
51 | 51 | } else { |
52 | - $user_id_and = ' AND te.exe_user_id = ' . api_get_user_id() . ' '; |
|
52 | + $user_id_and = ' AND te.exe_user_id = '.api_get_user_id().' '; |
|
53 | 53 | // get only this user's results |
54 | 54 | |
55 | 55 | $sql = "SELECT '', exe_name, exe_result , exe_weighting, exe_date |
56 | 56 | FROM $TBL_TRACK_HOTPOTATOES |
57 | 57 | WHERE |
58 | - exe_user_id = '" . $user_id . "' AND |
|
58 | + exe_user_id = '".$user_id."' AND |
|
59 | 59 | c_id = $course_id AND |
60 | 60 | tth.exe_name = '$hotpotato_name' |
61 | 61 | ORDER BY c_id ASC, exe_date ASC"; |
@@ -64,13 +64,13 @@ discard block |
||
64 | 64 | $results = array(); |
65 | 65 | |
66 | 66 | $resx = Database::query($sql); |
67 | - while ($rowx = Database::fetch_array($resx,'ASSOC')) { |
|
67 | + while ($rowx = Database::fetch_array($resx, 'ASSOC')) { |
|
68 | 68 | $results[] = $rowx; |
69 | 69 | } |
70 | 70 | |
71 | 71 | $hpresults = array(); |
72 | 72 | $resx = Database::query($sql); |
73 | - while ($rowx = Database::fetch_array($resx,'ASSOC')) { |
|
73 | + while ($rowx = Database::fetch_array($resx, 'ASSOC')) { |
|
74 | 74 | $hpresults[] = $rowx; |
75 | 75 | } |
76 | 76 | |
@@ -89,19 +89,19 @@ discard block |
||
89 | 89 | |
90 | 90 | // Print the Result of Hotpotatoes Tests |
91 | 91 | if (is_array($hpresults)) { |
92 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
92 | + for ($i = 0; $i < sizeof($hpresults); $i++) { |
|
93 | 93 | $return[$i] = array(); |
94 | 94 | $title = GetQuizName($hpresults[$i]['exe_name'], $document_path); |
95 | - if ($title =='') { |
|
95 | + if ($title == '') { |
|
96 | 96 | $title = basename($hpresults[$i]['exe_name']); |
97 | 97 | } |
98 | - if(empty($user_id)) { |
|
98 | + if (empty($user_id)) { |
|
99 | 99 | $return[$i]['email'] = $hpresults[$i]['email']; |
100 | 100 | $return[$i]['first_name'] = $hpresults[$i]['userpart1']; |
101 | 101 | $return[$i]['last_name'] = $hpresults[$i]['userpart2']; |
102 | 102 | } |
103 | 103 | $return[$i]['title'] = $title; |
104 | - $return[$i]['exe_date'] = $hpresults[$i]['exe_date']; |
|
104 | + $return[$i]['exe_date'] = $hpresults[$i]['exe_date']; |
|
105 | 105 | |
106 | 106 | $return[$i]['result'] = $hpresults[$i]['exe_result']; |
107 | 107 | $return[$i]['max'] = $hpresults[$i]['exe_weighting']; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * @param boolean Whether to include user fields or not |
121 | 121 | * @return boolean False on error |
122 | 122 | */ |
123 | - public function exportCompleteReportCSV($document_path='', $hotpotato_name) |
|
123 | + public function exportCompleteReportCSV($document_path = '', $hotpotato_name) |
|
124 | 124 | { |
125 | 125 | global $charset; |
126 | 126 | $this->getExercisesReporting($document_path, $hotpotato_name); |
@@ -131,17 +131,17 @@ discard block |
||
131 | 131 | $data = ''; |
132 | 132 | |
133 | 133 | if (api_is_western_name_order()) { |
134 | - if(!empty($this->results[0]['first_name'])) { |
|
134 | + if (!empty($this->results[0]['first_name'])) { |
|
135 | 135 | $data .= get_lang('FirstName').';'; |
136 | 136 | } |
137 | - if(!empty($this->results[0]['last_name'])) { |
|
137 | + if (!empty($this->results[0]['last_name'])) { |
|
138 | 138 | $data .= get_lang('LastName').';'; |
139 | 139 | } |
140 | 140 | } else { |
141 | - if(!empty($this->results[0]['last_name'])) { |
|
141 | + if (!empty($this->results[0]['last_name'])) { |
|
142 | 142 | $data .= get_lang('LastName').';'; |
143 | 143 | } |
144 | - if(!empty($this->results[0]['first_name'])) { |
|
144 | + if (!empty($this->results[0]['first_name'])) { |
|
145 | 145 | $data .= get_lang('FirstName').';'; |
146 | 146 | } |
147 | 147 | } |
@@ -163,16 +163,16 @@ discard block |
||
163 | 163 | $data .= "\n"; |
164 | 164 | |
165 | 165 | //results |
166 | - foreach($this->results as $row) { |
|
166 | + foreach ($this->results as $row) { |
|
167 | 167 | if (api_is_western_name_order()) { |
168 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
|
169 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; |
|
168 | + $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
|
169 | + $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; |
|
170 | 170 | } else { |
171 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; |
|
172 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
|
171 | + $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; |
|
172 | + $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
|
173 | 173 | } |
174 | 174 | |
175 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)).';'; |
|
175 | + $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)).';'; |
|
176 | 176 | |
177 | 177 | /*if ($export_user_fields) { |
178 | 178 | //show user fields data, if any, for this user |
@@ -182,10 +182,10 @@ discard block |
||
182 | 182 | } |
183 | 183 | }*/ |
184 | 184 | |
185 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';'; |
|
186 | - $data .= str_replace("\r\n",' ',$row['exe_date']).';'; |
|
187 | - $data .= str_replace("\r\n",' ',$row['result']).';'; |
|
188 | - $data .= str_replace("\r\n",' ',$row['max']).';'; |
|
185 | + $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';'; |
|
186 | + $data .= str_replace("\r\n", ' ', $row['exe_date']).';'; |
|
187 | + $data .= str_replace("\r\n", ' ', $row['result']).';'; |
|
188 | + $data .= str_replace("\r\n", ' ', $row['max']).';'; |
|
189 | 189 | $data .= "\n"; |
190 | 190 | } |
191 | 191 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | header('Content-Description: '.$filename); |
208 | 208 | header('Content-transfer-encoding: binary'); |
209 | 209 | // @todo add this utf-8 header for all csv files |
210 | - echo "\xEF\xBB\xBF"; // force utf-8 header of csv file |
|
210 | + echo "\xEF\xBB\xBF"; // force utf-8 header of csv file |
|
211 | 211 | echo $data; |
212 | 212 | return true; |
213 | 213 | } |
@@ -249,25 +249,25 @@ discard block |
||
249 | 249 | } |
250 | 250 | |
251 | 251 | if ($with_column_user) { |
252 | - $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('Email')); |
|
252 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Email')); |
|
253 | 253 | $column++; |
254 | 254 | |
255 | 255 | if (api_is_western_name_order()) { |
256 | - $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName')); |
|
256 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('FirstName')); |
|
257 | 257 | $column++; |
258 | - $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('LastName')); |
|
258 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('LastName')); |
|
259 | 259 | $column++; |
260 | 260 | } else { |
261 | - $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('LastName')); |
|
261 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('LastName')); |
|
262 | 262 | $column++; |
263 | - $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName')); |
|
263 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('FirstName')); |
|
264 | 264 | $column++; |
265 | 265 | } |
266 | 266 | } |
267 | 267 | |
268 | 268 | if ($export_user_fields) { |
269 | 269 | //show user fields section with a big th colspan that spans over all fields |
270 | - $extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1); |
|
270 | + $extra_user_fields = UserManager::get_extra_fields(0, 1000, 5, 'ASC', false, 1); |
|
271 | 271 | |
272 | 272 | //show the fields names for user fields |
273 | 273 | foreach ($extra_user_fields as $field) { |
@@ -276,63 +276,63 @@ discard block |
||
276 | 276 | } |
277 | 277 | } |
278 | 278 | |
279 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Title')); |
|
279 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Title')); |
|
280 | 280 | $column++; |
281 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('StartDate')); |
|
281 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('StartDate')); |
|
282 | 282 | $column++; |
283 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('EndDate')); |
|
283 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('EndDate')); |
|
284 | 284 | $column++; |
285 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Duration').' ('.get_lang('MinMinutes').')'); |
|
285 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Duration').' ('.get_lang('MinMinutes').')'); |
|
286 | 286 | $column++; |
287 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Score')); |
|
287 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Score')); |
|
288 | 288 | $column++; |
289 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Total')); |
|
289 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Total')); |
|
290 | 290 | $column++; |
291 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Status')); |
|
291 | + $worksheet->SetCellValueByColumnAndRow($line, $column, get_lang('Status')); |
|
292 | 292 | $line++; |
293 | 293 | |
294 | 294 | foreach ($this->results as $row) { |
295 | 295 | $column = 0; |
296 | 296 | |
297 | 297 | if ($with_column_user) { |
298 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)); |
|
298 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)); |
|
299 | 299 | $column++; |
300 | 300 | |
301 | 301 | if (api_is_western_name_order()) { |
302 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)); |
|
302 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)); |
|
303 | 303 | $column++; |
304 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)); |
|
304 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)); |
|
305 | 305 | $column++; |
306 | 306 | } else { |
307 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)); |
|
307 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)); |
|
308 | 308 | $column++; |
309 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)); |
|
309 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)); |
|
310 | 310 | $column++; |
311 | 311 | } |
312 | 312 | } |
313 | 313 | |
314 | 314 | if ($export_user_fields) { |
315 | 315 | //show user fields data, if any, for this user |
316 | - $user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true); |
|
317 | - foreach($user_fields_values as $value) { |
|
318 | - $worksheet->SetCellValueByColumnAndRow($line,$column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)); |
|
316 | + $user_fields_values = UserManager::get_extra_user_data($row['user_id'], false, false, false, true); |
|
317 | + foreach ($user_fields_values as $value) { |
|
318 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)); |
|
319 | 319 | $column++; |
320 | 320 | } |
321 | 321 | } |
322 | 322 | |
323 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)); |
|
323 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)); |
|
324 | 324 | $column++; |
325 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['start_date']); |
|
325 | + $worksheet->SetCellValueByColumnAndRow($line, $column, $row['start_date']); |
|
326 | 326 | $column++; |
327 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['end_date']); |
|
327 | + $worksheet->SetCellValueByColumnAndRow($line, $column, $row['end_date']); |
|
328 | 328 | $column++; |
329 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['duration']); |
|
329 | + $worksheet->SetCellValueByColumnAndRow($line, $column, $row['duration']); |
|
330 | 330 | $column++; |
331 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['result']); |
|
331 | + $worksheet->SetCellValueByColumnAndRow($line, $column, $row['result']); |
|
332 | 332 | $column++; |
333 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['max']); |
|
333 | + $worksheet->SetCellValueByColumnAndRow($line, $column, $row['max']); |
|
334 | 334 | $column++; |
335 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['status']); |
|
335 | + $worksheet->SetCellValueByColumnAndRow($line, $column, $row['status']); |
|
336 | 336 | $line++; |
337 | 337 | } |
338 | 338 |
@@ -52,7 +52,7 @@ |
||
52 | 52 | /** |
53 | 53 | * @param FormValidator $form |
54 | 54 | * @param null $objExercise |
55 | - * @return bool |
|
55 | + * @return null|false |
|
56 | 56 | */ |
57 | 57 | public function processCreation($form, $objExercise = null) |
58 | 58 | { |
@@ -12,78 +12,78 @@ discard block |
||
12 | 12 | **/ |
13 | 13 | class HotSpot extends Question |
14 | 14 | { |
15 | - static $typePicture = 'hotspot.png'; |
|
16 | - static $explanationLangVar = 'HotSpot'; |
|
17 | - |
|
18 | - public function __construct() |
|
19 | - { |
|
20 | - parent::__construct(); |
|
21 | - $this -> type = HOT_SPOT; |
|
22 | - } |
|
23 | - |
|
24 | - public function display() |
|
25 | - { |
|
26 | - } |
|
27 | - |
|
28 | - /** |
|
29 | - * @param FormValidator $form |
|
30 | - * @param int $fck_config |
|
31 | - */ |
|
32 | - public function createForm (&$form, $fck_config=0) |
|
33 | - { |
|
34 | - parent::createForm($form, $fck_config); |
|
35 | - |
|
36 | - if (!isset($_GET['editQuestion'])) { |
|
37 | - $form->addElement('file','imageUpload',array('<img src="'.Display::return_icon('hotspot.png', null, null, ICON_SIZE_BIG, false, true).'" />', get_lang('UploadJpgPicture')) ); |
|
38 | - |
|
39 | - // setting the save button here and not in the question class.php |
|
40 | - // Saving a question |
|
41 | - $form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion'); |
|
42 | - //$form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion'); |
|
43 | - $form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array ('jpg', 'jpeg', 'png', 'gif')); |
|
44 | - $form->addRule('imageUpload', get_lang('NoImage'), 'uploadedfile'); |
|
45 | - } else { |
|
46 | - // setting the save button here and not in the question class.php |
|
47 | - // Editing a question |
|
48 | - $form->addButtonUpdate(get_lang('ModifyExercise'), 'submitQuestion'); |
|
49 | - } |
|
50 | - } |
|
51 | - |
|
52 | - /** |
|
53 | - * @param FormValidator $form |
|
54 | - * @param null $objExercise |
|
55 | - * @return bool |
|
56 | - */ |
|
57 | - public function processCreation($form, $objExercise = null) |
|
58 | - { |
|
59 | - $file_info = $form->getSubmitValue('imageUpload'); |
|
60 | - $_course = api_get_course_info(); |
|
61 | - parent::processCreation($form, $objExercise); |
|
62 | - |
|
63 | - if(!empty($file_info['tmp_name'])) { |
|
64 | - $this->uploadPicture($file_info['tmp_name'], $file_info['name']); |
|
65 | - $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
66 | - $picturePath = $documentPath.'/images'; |
|
67 | - |
|
68 | - // fixed width ang height |
|
69 | - if (file_exists($picturePath.'/'.$this->picture)) { |
|
70 | - $this->resizePicture('width', 800); |
|
71 | - $this->save(); |
|
72 | - } else { |
|
73 | - return false; |
|
74 | - } |
|
75 | - } |
|
76 | - } |
|
77 | - |
|
78 | - function createAnswersForm ($form) |
|
79 | - { |
|
80 | - // nothing |
|
81 | - } |
|
82 | - |
|
83 | - function processAnswersCreation ($form) |
|
84 | - { |
|
85 | - // nothing |
|
86 | - } |
|
15 | + static $typePicture = 'hotspot.png'; |
|
16 | + static $explanationLangVar = 'HotSpot'; |
|
17 | + |
|
18 | + public function __construct() |
|
19 | + { |
|
20 | + parent::__construct(); |
|
21 | + $this -> type = HOT_SPOT; |
|
22 | + } |
|
23 | + |
|
24 | + public function display() |
|
25 | + { |
|
26 | + } |
|
27 | + |
|
28 | + /** |
|
29 | + * @param FormValidator $form |
|
30 | + * @param int $fck_config |
|
31 | + */ |
|
32 | + public function createForm (&$form, $fck_config=0) |
|
33 | + { |
|
34 | + parent::createForm($form, $fck_config); |
|
35 | + |
|
36 | + if (!isset($_GET['editQuestion'])) { |
|
37 | + $form->addElement('file','imageUpload',array('<img src="'.Display::return_icon('hotspot.png', null, null, ICON_SIZE_BIG, false, true).'" />', get_lang('UploadJpgPicture')) ); |
|
38 | + |
|
39 | + // setting the save button here and not in the question class.php |
|
40 | + // Saving a question |
|
41 | + $form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion'); |
|
42 | + //$form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion'); |
|
43 | + $form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array ('jpg', 'jpeg', 'png', 'gif')); |
|
44 | + $form->addRule('imageUpload', get_lang('NoImage'), 'uploadedfile'); |
|
45 | + } else { |
|
46 | + // setting the save button here and not in the question class.php |
|
47 | + // Editing a question |
|
48 | + $form->addButtonUpdate(get_lang('ModifyExercise'), 'submitQuestion'); |
|
49 | + } |
|
50 | + } |
|
51 | + |
|
52 | + /** |
|
53 | + * @param FormValidator $form |
|
54 | + * @param null $objExercise |
|
55 | + * @return bool |
|
56 | + */ |
|
57 | + public function processCreation($form, $objExercise = null) |
|
58 | + { |
|
59 | + $file_info = $form->getSubmitValue('imageUpload'); |
|
60 | + $_course = api_get_course_info(); |
|
61 | + parent::processCreation($form, $objExercise); |
|
62 | + |
|
63 | + if(!empty($file_info['tmp_name'])) { |
|
64 | + $this->uploadPicture($file_info['tmp_name'], $file_info['name']); |
|
65 | + $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
66 | + $picturePath = $documentPath.'/images'; |
|
67 | + |
|
68 | + // fixed width ang height |
|
69 | + if (file_exists($picturePath.'/'.$this->picture)) { |
|
70 | + $this->resizePicture('width', 800); |
|
71 | + $this->save(); |
|
72 | + } else { |
|
73 | + return false; |
|
74 | + } |
|
75 | + } |
|
76 | + } |
|
77 | + |
|
78 | + function createAnswersForm ($form) |
|
79 | + { |
|
80 | + // nothing |
|
81 | + } |
|
82 | + |
|
83 | + function processAnswersCreation ($form) |
|
84 | + { |
|
85 | + // nothing |
|
86 | + } |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -91,35 +91,35 @@ discard block |
||
91 | 91 | */ |
92 | 92 | class HotSpotDelineation extends HotSpot |
93 | 93 | { |
94 | - static $typePicture = 'hotspot-delineation.png'; |
|
95 | - static $explanationLangVar = 'HotspotDelineation'; |
|
96 | - |
|
97 | - function __construct() |
|
98 | - { |
|
99 | - parent::__construct(); |
|
100 | - $this -> type = HOT_SPOT_DELINEATION; |
|
101 | - |
|
102 | - } |
|
103 | - |
|
104 | - function createForm (&$form, $fck_config=0) |
|
105 | - { |
|
106 | - parent::createForm ($form, $fck_config); |
|
107 | - } |
|
108 | - |
|
109 | - function processCreation ($form, $objExercise = null) |
|
110 | - { |
|
111 | - $file_info = $form -> getSubmitValue('imageUpload'); |
|
112 | - parent::processCreation ($form, $objExercise); |
|
113 | - } |
|
114 | - |
|
115 | - function createAnswersForm ($form) |
|
116 | - { |
|
117 | - parent::createAnswersForm ($form); |
|
118 | - } |
|
119 | - |
|
120 | - function processAnswersCreation ($form) |
|
121 | - { |
|
122 | - parent::processAnswersCreation ($form); |
|
123 | - } |
|
94 | + static $typePicture = 'hotspot-delineation.png'; |
|
95 | + static $explanationLangVar = 'HotspotDelineation'; |
|
96 | + |
|
97 | + function __construct() |
|
98 | + { |
|
99 | + parent::__construct(); |
|
100 | + $this -> type = HOT_SPOT_DELINEATION; |
|
101 | + |
|
102 | + } |
|
103 | + |
|
104 | + function createForm (&$form, $fck_config=0) |
|
105 | + { |
|
106 | + parent::createForm ($form, $fck_config); |
|
107 | + } |
|
108 | + |
|
109 | + function processCreation ($form, $objExercise = null) |
|
110 | + { |
|
111 | + $file_info = $form -> getSubmitValue('imageUpload'); |
|
112 | + parent::processCreation ($form, $objExercise); |
|
113 | + } |
|
114 | + |
|
115 | + function createAnswersForm ($form) |
|
116 | + { |
|
117 | + parent::createAnswersForm ($form); |
|
118 | + } |
|
119 | + |
|
120 | + function processAnswersCreation ($form) |
|
121 | + { |
|
122 | + parent::processAnswersCreation ($form); |
|
123 | + } |
|
124 | 124 | } |
125 | 125 |
@@ -29,18 +29,18 @@ discard block |
||
29 | 29 | * @param FormValidator $form |
30 | 30 | * @param int $fck_config |
31 | 31 | */ |
32 | - public function createForm (&$form, $fck_config=0) |
|
32 | + public function createForm(&$form, $fck_config = 0) |
|
33 | 33 | { |
34 | 34 | parent::createForm($form, $fck_config); |
35 | 35 | |
36 | 36 | if (!isset($_GET['editQuestion'])) { |
37 | - $form->addElement('file','imageUpload',array('<img src="'.Display::return_icon('hotspot.png', null, null, ICON_SIZE_BIG, false, true).'" />', get_lang('UploadJpgPicture')) ); |
|
37 | + $form->addElement('file', 'imageUpload', array('<img src="'.Display::return_icon('hotspot.png', null, null, ICON_SIZE_BIG, false, true).'" />', get_lang('UploadJpgPicture'))); |
|
38 | 38 | |
39 | 39 | // setting the save button here and not in the question class.php |
40 | 40 | // Saving a question |
41 | 41 | $form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion'); |
42 | 42 | //$form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion'); |
43 | - $form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array ('jpg', 'jpeg', 'png', 'gif')); |
|
43 | + $form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array('jpg', 'jpeg', 'png', 'gif')); |
|
44 | 44 | $form->addRule('imageUpload', get_lang('NoImage'), 'uploadedfile'); |
45 | 45 | } else { |
46 | 46 | // setting the save button here and not in the question class.php |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $_course = api_get_course_info(); |
61 | 61 | parent::processCreation($form, $objExercise); |
62 | 62 | |
63 | - if(!empty($file_info['tmp_name'])) { |
|
63 | + if (!empty($file_info['tmp_name'])) { |
|
64 | 64 | $this->uploadPicture($file_info['tmp_name'], $file_info['name']); |
65 | 65 | $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
66 | 66 | $picturePath = $documentPath.'/images'; |
@@ -75,12 +75,12 @@ discard block |
||
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
78 | - function createAnswersForm ($form) |
|
78 | + function createAnswersForm($form) |
|
79 | 79 | { |
80 | 80 | // nothing |
81 | 81 | } |
82 | 82 | |
83 | - function processAnswersCreation ($form) |
|
83 | + function processAnswersCreation($form) |
|
84 | 84 | { |
85 | 85 | // nothing |
86 | 86 | } |
@@ -101,25 +101,25 @@ discard block |
||
101 | 101 | |
102 | 102 | } |
103 | 103 | |
104 | - function createForm (&$form, $fck_config=0) |
|
104 | + function createForm(&$form, $fck_config = 0) |
|
105 | 105 | { |
106 | - parent::createForm ($form, $fck_config); |
|
106 | + parent::createForm($form, $fck_config); |
|
107 | 107 | } |
108 | 108 | |
109 | - function processCreation ($form, $objExercise = null) |
|
109 | + function processCreation($form, $objExercise = null) |
|
110 | 110 | { |
111 | 111 | $file_info = $form -> getSubmitValue('imageUpload'); |
112 | - parent::processCreation ($form, $objExercise); |
|
112 | + parent::processCreation($form, $objExercise); |
|
113 | 113 | } |
114 | 114 | |
115 | - function createAnswersForm ($form) |
|
115 | + function createAnswersForm($form) |
|
116 | 116 | { |
117 | - parent::createAnswersForm ($form); |
|
117 | + parent::createAnswersForm($form); |
|
118 | 118 | } |
119 | 119 | |
120 | - function processAnswersCreation ($form) |
|
120 | + function processAnswersCreation($form) |
|
121 | 121 | { |
122 | - parent::processAnswersCreation ($form); |
|
122 | + parent::processAnswersCreation($form); |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 |
@@ -58,7 +58,7 @@ |
||
58 | 58 | * @param null $feedback_type |
59 | 59 | * @param null $counter |
60 | 60 | * @param null $score |
61 | - * @return null|string |
|
61 | + * @return string |
|
62 | 62 | */ |
63 | 63 | function return_header($feedback_type = null, $counter = null, $score = null) |
64 | 64 | { |
@@ -31,7 +31,7 @@ |
||
31 | 31 | function createAnswersForm($form) |
32 | 32 | { |
33 | 33 | |
34 | - $form -> addElement('text','weighting', get_lang('Weighting'), array('class' => 'span1')); |
|
34 | + $form -> addElement('text', 'weighting', get_lang('Weighting'), array('class' => 'span1')); |
|
35 | 35 | global $text, $class; |
36 | 36 | // setting the save button here and not in the question class.php |
37 | 37 | $form->addButtonSave($text, 'submitQuestion'); |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | } |
266 | 266 | |
267 | 267 | /** |
268 | - * @return bool|string |
|
268 | + * @return string|false |
|
269 | 269 | */ |
270 | 270 | public function selectPicturePath() |
271 | 271 | { |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | * @param string $Dimension - Resizing happens proportional according to given dimension: height|width|any |
591 | 591 | * @param integer $Max - Maximum size |
592 | 592 | * |
593 | - * @return boolean - true if success, false if failed |
|
593 | + * @return boolean|null - true if success, false if failed |
|
594 | 594 | * |
595 | 595 | * @author Toon Keppens |
596 | 596 | */ |
@@ -751,6 +751,7 @@ discard block |
||
751 | 751 | |
752 | 752 | /** |
753 | 753 | * Sets extra info |
754 | + * @param string $extra |
|
754 | 755 | */ |
755 | 756 | public function setExtra($extra) |
756 | 757 | { |
@@ -1261,7 +1262,7 @@ discard block |
||
1261 | 1262 | * |
1262 | 1263 | * @author Olivier Brouckaert |
1263 | 1264 | * @param array Course info of the destination course |
1264 | - * @return int ID of the new question |
|
1265 | + * @return false|string ID of the new question |
|
1265 | 1266 | */ |
1266 | 1267 | public function duplicate($course_info = null) |
1267 | 1268 | { |
@@ -1636,7 +1637,7 @@ discard block |
||
1636 | 1637 | * @param string $name |
1637 | 1638 | * @param int $course_id |
1638 | 1639 | * @param int $position |
1639 | - * @return bool|int |
|
1640 | + * @return false|string |
|
1640 | 1641 | */ |
1641 | 1642 | static function saveQuestionOption($question_id, $name, $course_id, $position = 0) |
1642 | 1643 | { |
@@ -1775,6 +1776,7 @@ discard block |
||
1775 | 1776 | * @param int Maximum result for the question |
1776 | 1777 | * @param int Type of question (see constants at beginning of question.class.php) |
1777 | 1778 | * @param int Question level/category |
1779 | + * @param string $quiz_id |
|
1778 | 1780 | */ |
1779 | 1781 | public function create_question( |
1780 | 1782 | $quiz_id, |
@@ -1857,6 +1859,7 @@ discard block |
||
1857 | 1859 | /** |
1858 | 1860 | * Get course medias |
1859 | 1861 | * @param int course id |
1862 | + * @param integer $course_id |
|
1860 | 1863 | */ |
1861 | 1864 | static function get_course_medias( |
1862 | 1865 | $course_id, |
@@ -1922,7 +1925,7 @@ discard block |
||
1922 | 1925 | } |
1923 | 1926 | |
1924 | 1927 | /** |
1925 | - * @return array |
|
1928 | + * @return integer[] |
|
1926 | 1929 | */ |
1927 | 1930 | public static function get_default_levels() |
1928 | 1931 | { |
@@ -607,10 +607,11 @@ |
||
607 | 607 | $current_width = $current_image_size['width']; |
608 | 608 | $current_height = $current_image_size['height']; |
609 | 609 | |
610 | - if ($current_width < $Max && $current_height < $Max) |
|
611 | - return true; |
|
612 | - elseif ($current_height == "") |
|
613 | - return false; |
|
610 | + if ($current_width < $Max && $current_height < $Max) { |
|
611 | + return true; |
|
612 | + } elseif ($current_height == "") { |
|
613 | + return false; |
|
614 | + } |
|
614 | 615 | |
615 | 616 | // Resize according to height. |
616 | 617 | if ($Dimension == "height") { |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | public $type; |
23 | 23 | public $level; |
24 | 24 | public $picture; |
25 | - public $exerciseList; // array with the list of exercises which this question is in |
|
25 | + public $exerciseList; // array with the list of exercises which this question is in |
|
26 | 26 | public $category_list; |
27 | 27 | public $parent_id; |
28 | 28 | public $category; |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | 'multiple_answer_combination_true_false.class.php', |
48 | 48 | 'MultipleAnswerCombinationTrueFalse' |
49 | 49 | ), |
50 | - GLOBAL_MULTIPLE_ANSWER => array('global_multiple_answer.class.php' , 'GlobalMultipleAnswer'), |
|
51 | - CALCULATED_ANSWER => array('calculated_answer.class.php' , 'CalculatedAnswer'), |
|
50 | + GLOBAL_MULTIPLE_ANSWER => array('global_multiple_answer.class.php', 'GlobalMultipleAnswer'), |
|
51 | + CALCULATED_ANSWER => array('calculated_answer.class.php', 'CalculatedAnswer'), |
|
52 | 52 | UNIQUE_ANSWER_IMAGE => ['UniqueAnswerImage.php', 'UniqueAnswerImage'], |
53 | 53 | DRAGGABLE => ['Draggable.php', 'Draggable'], |
54 | 54 | MATCHING_DRAGGABLE => ['MatchingDraggable.php', 'MatchingDraggable'] |
@@ -107,14 +107,14 @@ discard block |
||
107 | 107 | $id = intval($id); |
108 | 108 | |
109 | 109 | if (!empty($course_id)) { |
110 | - $course_info = api_get_course_info_by_id($course_id); |
|
110 | + $course_info = api_get_course_info_by_id($course_id); |
|
111 | 111 | } else { |
112 | 112 | $course_info = api_get_course_info(); |
113 | 113 | } |
114 | 114 | |
115 | 115 | $course_id = $course_info['real_id']; |
116 | 116 | |
117 | - if (empty($course_id) || $course_id == -1 ) { |
|
117 | + if (empty($course_id) || $course_id == -1) { |
|
118 | 118 | |
119 | 119 | return false; |
120 | 120 | } |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | public function selectPicturePath() |
270 | 270 | { |
271 | 271 | if (!empty($this->picture)) { |
272 | - return api_get_path(WEB_COURSE_PATH) . $this->course['path'] . '/document/images/' . $this->picture; |
|
272 | + return api_get_path(WEB_COURSE_PATH).$this->course['path'].'/document/images/'.$this->picture; |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | return false; |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | */ |
307 | 307 | public function updateTitle($title) |
308 | 308 | { |
309 | - $this->question=$title; |
|
309 | + $this->question = $title; |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | /** |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | // DO nothing |
406 | 406 | } else { |
407 | 407 | $sql = "INSERT INTO $TBL_QUESTION_REL_CATEGORY (c_id, question_id, category_id) |
408 | - VALUES (" . api_get_course_int_id() . ", $question_id, $category_id)"; |
|
408 | + VALUES (".api_get_course_int_id().", $question_id, $category_id)"; |
|
409 | 409 | Database::query($sql); |
410 | 410 | } |
411 | 411 | } |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | $sql = "SELECT count(*) AS nb FROM $table |
433 | 433 | WHERE |
434 | 434 | question_id = $question_id AND |
435 | - c_id=" . api_get_course_int_id(); |
|
435 | + c_id=".api_get_course_int_id(); |
|
436 | 436 | $res = Database::query($sql); |
437 | 437 | $row = Database::fetch_array($res); |
438 | 438 | if ($row['nb'] > 0) { |
@@ -440,11 +440,11 @@ discard block |
||
440 | 440 | SET category_id = $category_id |
441 | 441 | WHERE |
442 | 442 | question_id = $question_id AND |
443 | - c_id = " . api_get_course_int_id(); |
|
443 | + c_id = ".api_get_course_int_id(); |
|
444 | 444 | Database::query($sql); |
445 | 445 | } else { |
446 | 446 | $sql = "INSERT INTO $table (c_id, question_id, category_id) |
447 | - VALUES (" . api_get_course_int_id().", $question_id, $category_id)"; |
|
447 | + VALUES (".api_get_course_int_id().", $question_id, $category_id)"; |
|
448 | 448 | Database::query($sql); |
449 | 449 | } |
450 | 450 | } |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | $sql = "DELETE FROM $table |
463 | 463 | WHERE |
464 | 464 | question_id = $question_id AND |
465 | - c_id = " . api_get_course_int_id(); |
|
465 | + c_id = ".api_get_course_int_id(); |
|
466 | 466 | Database::query($sql); |
467 | 467 | } |
468 | 468 | |
@@ -515,11 +515,11 @@ discard block |
||
515 | 515 | ) { |
516 | 516 | // removes old answers |
517 | 517 | $sql = "DELETE FROM $TBL_REPONSES |
518 | - WHERE c_id = $course_id AND question_id = " . intval($this->id); |
|
518 | + WHERE c_id = $course_id AND question_id = ".intval($this->id); |
|
519 | 519 | Database::query($sql); |
520 | 520 | } |
521 | 521 | |
522 | - $this->type=$type; |
|
522 | + $this->type = $type; |
|
523 | 523 | } |
524 | 524 | } |
525 | 525 | |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | if (!file_exists($picturePath)) { |
544 | 544 | if (mkdir($picturePath, api_get_permissions_for_new_directories())) { |
545 | 545 | // document path |
546 | - $documentPath = api_get_path(SYS_COURSE_PATH) . $this->course['path'] . "/document"; |
|
546 | + $documentPath = api_get_path(SYS_COURSE_PATH).$this->course['path']."/document"; |
|
547 | 547 | $path = str_replace($documentPath, '', $picturePath); |
548 | 548 | $title_path = basename($picturePath); |
549 | 549 | $doc_id = add_document($this->course, $path, 'folder', 0, $title_path); |
@@ -559,14 +559,14 @@ discard block |
||
559 | 559 | |
560 | 560 | // if the question has got an ID |
561 | 561 | if ($this->id) { |
562 | - $this->picture = 'quiz-' . $this->id . '.jpg'; |
|
562 | + $this->picture = 'quiz-'.$this->id.'.jpg'; |
|
563 | 563 | $o_img = new Image($Picture); |
564 | - $o_img->send_image($picturePath . '/' . $this->picture, -1, 'jpg'); |
|
564 | + $o_img->send_image($picturePath.'/'.$this->picture, -1, 'jpg'); |
|
565 | 565 | $document_id = add_document( |
566 | 566 | $this->course, |
567 | - '/images/' . $this->picture, |
|
567 | + '/images/'.$this->picture, |
|
568 | 568 | 'file', |
569 | - filesize($picturePath . '/' . $this->picture), |
|
569 | + filesize($picturePath.'/'.$this->picture), |
|
570 | 570 | $this->picture |
571 | 571 | ); |
572 | 572 | if ($document_id) { |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | // if the question has an ID |
601 | 601 | if ($this->id) { |
602 | 602 | // Get dimensions from current image. |
603 | - $my_image = new Image($picturePath . '/' . $this->picture); |
|
603 | + $my_image = new Image($picturePath.'/'.$this->picture); |
|
604 | 604 | |
605 | 605 | $current_image_size = $my_image->get_image_size(); |
606 | 606 | $current_width = $current_image_size['width']; |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | } |
641 | 641 | |
642 | 642 | $my_image->resize($new_width, $new_height); |
643 | - $result = $my_image->send_image($picturePath . '/' . $this->picture); |
|
643 | + $result = $my_image->send_image($picturePath.'/'.$this->picture); |
|
644 | 644 | |
645 | 645 | if ($result) { |
646 | 646 | return true; |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | $picture = $this->picture; |
666 | 666 | $this->picture = ''; |
667 | 667 | |
668 | - return @unlink($picturePath . '/' . $picture) ? true : false; |
|
668 | + return @unlink($picturePath.'/'.$picture) ? true : false; |
|
669 | 669 | } |
670 | 670 | |
671 | 671 | return false; |
@@ -682,27 +682,27 @@ discard block |
||
682 | 682 | { |
683 | 683 | $course_id = $course_info['real_id']; |
684 | 684 | $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION); |
685 | - $destination_path = api_get_path(SYS_COURSE_PATH) . $course_info['path'] . '/document/images'; |
|
686 | - $source_path = api_get_path(SYS_COURSE_PATH) . $this->course['path'] . '/document/images'; |
|
685 | + $destination_path = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document/images'; |
|
686 | + $source_path = api_get_path(SYS_COURSE_PATH).$this->course['path'].'/document/images'; |
|
687 | 687 | |
688 | 688 | // if the question has got an ID and if the picture exists |
689 | 689 | if ($this->id && !empty($this->picture)) { |
690 | 690 | $picture = explode('.', $this->picture); |
691 | 691 | $extension = $picture[sizeof($picture) - 1]; |
692 | - $picture = 'quiz-' . $questionId . '.' . $extension; |
|
693 | - $result = @copy($source_path . '/' . $this->picture, $destination_path . '/' . $picture) ? true : false; |
|
692 | + $picture = 'quiz-'.$questionId.'.'.$extension; |
|
693 | + $result = @copy($source_path.'/'.$this->picture, $destination_path.'/'.$picture) ? true : false; |
|
694 | 694 | // If copy was correct then add to the database |
695 | 695 | if ($result) { |
696 | 696 | $sql = "UPDATE $TBL_QUESTIONS SET |
697 | - picture = '" . Database::escape_string($picture) . "' |
|
698 | - WHERE c_id = $course_id AND id='" . intval($questionId) . "'"; |
|
697 | + picture = '".Database::escape_string($picture)."' |
|
698 | + WHERE c_id = $course_id AND id='".intval($questionId)."'"; |
|
699 | 699 | Database::query($sql); |
700 | 700 | |
701 | 701 | $document_id = add_document( |
702 | 702 | $course_info, |
703 | - '/images/' . $picture, |
|
703 | + '/images/'.$picture, |
|
704 | 704 | 'file', |
705 | - filesize($destination_path . '/' . $picture), |
|
705 | + filesize($destination_path.'/'.$picture), |
|
706 | 706 | $picture |
707 | 707 | ); |
708 | 708 | if ($document_id) { |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | $Extension = $PictureName[sizeof($PictureName) - 1]; |
738 | 738 | |
739 | 739 | // saves the picture into a temporary file |
740 | - @move_uploaded_file($Picture, $picturePath . '/tmp.' . $Extension); |
|
740 | + @move_uploaded_file($Picture, $picturePath.'/tmp.'.$Extension); |
|
741 | 741 | } |
742 | 742 | |
743 | 743 | /** |
@@ -770,15 +770,15 @@ discard block |
||
770 | 770 | |
771 | 771 | // if the question has got an ID and if the picture exists |
772 | 772 | if ($this->id) { |
773 | - if (file_exists($picturePath . '/tmp.jpg')) { |
|
773 | + if (file_exists($picturePath.'/tmp.jpg')) { |
|
774 | 774 | $Extension = 'jpg'; |
775 | - } elseif (file_exists($picturePath . '/tmp.gif')) { |
|
775 | + } elseif (file_exists($picturePath.'/tmp.gif')) { |
|
776 | 776 | $Extension = 'gif'; |
777 | - } elseif (file_exists($picturePath . '/tmp.png')) { |
|
777 | + } elseif (file_exists($picturePath.'/tmp.png')) { |
|
778 | 778 | $Extension = 'png'; |
779 | 779 | } |
780 | - $this->picture = 'quiz-' . $this->id . '.' . $Extension; |
|
781 | - return @rename($picturePath . '/tmp.' . $Extension, $picturePath . '/' . $this->picture) ? true : false; |
|
780 | + $this->picture = 'quiz-'.$this->id.'.'.$Extension; |
|
781 | + return @rename($picturePath.'/tmp.'.$Extension, $picturePath.'/'.$this->picture) ? true : false; |
|
782 | 782 | } |
783 | 783 | return false; |
784 | 784 | } |
@@ -808,7 +808,7 @@ discard block |
||
808 | 808 | $category = $this->category; |
809 | 809 | |
810 | 810 | // question already exists |
811 | - if(!empty($id)) { |
|
811 | + if (!empty($id)) { |
|
812 | 812 | |
813 | 813 | $params = [ |
814 | 814 | 'question' => $question, |
@@ -854,12 +854,12 @@ discard block |
||
854 | 854 | $TBL_EXERCISE_QUESTION as test_question |
855 | 855 | WHERE |
856 | 856 | question.id = test_question.question_id AND |
857 | - test_question.exercice_id = " . intval($exerciseId) . " AND |
|
857 | + test_question.exercice_id = ".intval($exerciseId)." AND |
|
858 | 858 | question.c_id = $c_id AND |
859 | 859 | test_question.c_id = $c_id "; |
860 | - $result = Database::query($sql); |
|
861 | - $current_position = Database::result($result,0,0); |
|
862 | - $this->updatePosition($current_position+1); |
|
860 | + $result = Database::query($sql); |
|
861 | + $current_position = Database::result($result, 0, 0); |
|
862 | + $this->updatePosition($current_position + 1); |
|
863 | 863 | $position = $this->position; |
864 | 864 | |
865 | 865 | $params = [ |
@@ -955,10 +955,10 @@ discard block |
||
955 | 955 | } |
956 | 956 | } |
957 | 957 | |
958 | - public function search_engine_edit($exerciseId, $addQs=false, $rmQs=false) |
|
958 | + public function search_engine_edit($exerciseId, $addQs = false, $rmQs = false) |
|
959 | 959 | { |
960 | 960 | // update search engine and its values table if enabled |
961 | - if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian')) { |
|
961 | + if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) { |
|
962 | 962 | $course_id = api_get_course_id(); |
963 | 963 | // get search_did |
964 | 964 | $tbl_se_ref = Database::get_main_table(TABLE_MAIN_SEARCH_ENGINE_REF); |
@@ -976,8 +976,8 @@ discard block |
||
976 | 976 | $res = Database::query($sql); |
977 | 977 | |
978 | 978 | if (Database::num_rows($res) > 0 || $addQs) { |
979 | - require_once(api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php'); |
|
980 | - require_once(api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php'); |
|
979 | + require_once(api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'); |
|
980 | + require_once(api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php'); |
|
981 | 981 | |
982 | 982 | $di = new ChamiloIndexer(); |
983 | 983 | if ($addQs) { |
@@ -990,7 +990,7 @@ discard block |
||
990 | 990 | |
991 | 991 | // retrieve others exercise ids |
992 | 992 | $se_ref = Database::fetch_array($res); |
993 | - $se_doc = $di->get_document((int)$se_ref['search_did']); |
|
993 | + $se_doc = $di->get_document((int) $se_ref['search_did']); |
|
994 | 994 | if ($se_doc !== FALSE) { |
995 | 995 | if (($se_doc_data = $di->get_document_data($se_doc)) !== FALSE) { |
996 | 996 | $se_doc_data = unserialize($se_doc_data); |
@@ -1028,16 +1028,16 @@ discard block |
||
1028 | 1028 | SE_DATA => array( |
1029 | 1029 | 'type' => SE_DOCTYPE_EXERCISE_QUESTION, |
1030 | 1030 | 'exercise_ids' => $question_exercises, |
1031 | - 'question_id' => (int)$this->id |
|
1031 | + 'question_id' => (int) $this->id |
|
1032 | 1032 | ), |
1033 | - SE_USER => (int)api_get_user_id(), |
|
1033 | + SE_USER => (int) api_get_user_id(), |
|
1034 | 1034 | ); |
1035 | 1035 | $ic_slide->xapian_data = serialize($xapian_data); |
1036 | 1036 | $ic_slide->addValue("content", $this->description); |
1037 | 1037 | |
1038 | 1038 | //TODO: index answers, see also form validation on question_admin.inc.php |
1039 | 1039 | |
1040 | - $di->remove_document((int)$se_ref['search_did']); |
|
1040 | + $di->remove_document((int) $se_ref['search_did']); |
|
1041 | 1041 | $di->addChunk($ic_slide); |
1042 | 1042 | |
1043 | 1043 | //index and return search engine document id |
@@ -1116,7 +1116,7 @@ discard block |
||
1116 | 1116 | $count = $new_exercise->selectNbrQuestions(); |
1117 | 1117 | $count++; |
1118 | 1118 | $sql = "INSERT INTO $exerciseRelQuestionTable (c_id, question_id, exercice_id, question_order) |
1119 | - VALUES ({$this->course['real_id']}, " . intval($id) . ", " . intval($exerciseId) . ", '$count')"; |
|
1119 | + VALUES ({$this->course['real_id']}, ".intval($id).", ".intval($exerciseId).", '$count')"; |
|
1120 | 1120 | Database::query($sql); |
1121 | 1121 | |
1122 | 1122 | // we do not want to reindex if we had just saved adnd indexed the question |
@@ -1145,7 +1145,7 @@ discard block |
||
1145 | 1145 | $course_id = api_get_course_int_id(); |
1146 | 1146 | |
1147 | 1147 | // exercise not found |
1148 | - if($pos === false) { |
|
1148 | + if ($pos === false) { |
|
1149 | 1149 | return false; |
1150 | 1150 | } else { |
1151 | 1151 | // deletes the position in the array containing the wanted exercise ID |
@@ -1155,17 +1155,17 @@ discard block |
||
1155 | 1155 | FROM $TBL_EXERCISE_QUESTION |
1156 | 1156 | WHERE |
1157 | 1157 | c_id = $course_id |
1158 | - AND question_id = " . intval($id) . " |
|
1158 | + AND question_id = ".intval($id)." |
|
1159 | 1159 | AND exercice_id = " . intval($exerciseId); |
1160 | 1160 | $res = Database::query($sql); |
1161 | - if (Database::num_rows($res)>0) { |
|
1161 | + if (Database::num_rows($res) > 0) { |
|
1162 | 1162 | $row = Database::fetch_array($res); |
1163 | 1163 | if (!empty($row['question_order'])) { |
1164 | 1164 | $sql = "UPDATE $TBL_EXERCISE_QUESTION |
1165 | 1165 | SET question_order = question_order-1 |
1166 | 1166 | WHERE |
1167 | 1167 | c_id = $course_id |
1168 | - AND exercice_id = " . intval($exerciseId) . " |
|
1168 | + AND exercice_id = ".intval($exerciseId)." |
|
1169 | 1169 | AND question_order > " . $row['question_order']; |
1170 | 1170 | Database::query($sql); |
1171 | 1171 | } |
@@ -1174,7 +1174,7 @@ discard block |
||
1174 | 1174 | $sql = "DELETE FROM $TBL_EXERCISE_QUESTION |
1175 | 1175 | WHERE |
1176 | 1176 | c_id = $course_id |
1177 | - AND question_id = " . intval($id) . " |
|
1177 | + AND question_id = ".intval($id)." |
|
1178 | 1178 | AND exercice_id = " . intval($exerciseId); |
1179 | 1179 | Database::query($sql); |
1180 | 1180 | |
@@ -1215,7 +1215,7 @@ discard block |
||
1215 | 1215 | SET question_order = question_order-1 |
1216 | 1216 | WHERE |
1217 | 1217 | c_id= $course_id |
1218 | - AND exercice_id = " . intval($row['exercice_id']) . " |
|
1218 | + AND exercice_id = ".intval($row['exercice_id'])." |
|
1219 | 1219 | AND question_order > " . $row['question_order']; |
1220 | 1220 | Database::query($sql); |
1221 | 1221 | } |
@@ -1223,22 +1223,22 @@ discard block |
||
1223 | 1223 | } |
1224 | 1224 | |
1225 | 1225 | $sql = "DELETE FROM $TBL_EXERCISE_QUESTION |
1226 | - WHERE c_id = $course_id AND question_id = " . $id; |
|
1226 | + WHERE c_id = $course_id AND question_id = ".$id; |
|
1227 | 1227 | Database::query($sql); |
1228 | 1228 | |
1229 | 1229 | $sql = "DELETE FROM $TBL_QUESTIONS |
1230 | - WHERE c_id = $course_id AND id = " . $id; |
|
1230 | + WHERE c_id = $course_id AND id = ".$id; |
|
1231 | 1231 | Database::query($sql); |
1232 | 1232 | |
1233 | 1233 | $sql = "DELETE FROM $TBL_REPONSES |
1234 | - WHERE c_id = $course_id AND question_id = " . $id; |
|
1234 | + WHERE c_id = $course_id AND question_id = ".$id; |
|
1235 | 1235 | Database::query($sql); |
1236 | 1236 | |
1237 | 1237 | // remove the category of this question in the question_rel_category table |
1238 | 1238 | $sql = "DELETE FROM $TBL_QUIZ_QUESTION_REL_CATEGORY |
1239 | 1239 | WHERE |
1240 | 1240 | c_id = $course_id AND |
1241 | - question_id = " . $id; |
|
1241 | + question_id = ".$id; |
|
1242 | 1242 | Database::query($sql); |
1243 | 1243 | |
1244 | 1244 | api_item_property_update( |
@@ -1407,7 +1407,7 @@ discard block |
||
1407 | 1407 | if (class_exists($class_name)) { |
1408 | 1408 | return new $class_name(); |
1409 | 1409 | } else { |
1410 | - echo 'Can\'t instanciate class ' . $class_name . ' of type ' . $type; |
|
1410 | + echo 'Can\'t instanciate class '.$class_name.' of type '.$type; |
|
1411 | 1411 | } |
1412 | 1412 | } |
1413 | 1413 | } |
@@ -1449,7 +1449,7 @@ discard block |
||
1449 | 1449 | |
1450 | 1450 | // Question type |
1451 | 1451 | $answerType = isset($_REQUEST['answerType']) ? intval($_REQUEST['answerType']) : null; |
1452 | - $form->addElement('hidden','answerType', $answerType); |
|
1452 | + $form->addElement('hidden', 'answerType', $answerType); |
|
1453 | 1453 | |
1454 | 1454 | // html editor |
1455 | 1455 | $editorConfig = array( |
@@ -1457,7 +1457,7 @@ discard block |
||
1457 | 1457 | 'Height' => '150' |
1458 | 1458 | ); |
1459 | 1459 | |
1460 | - if (!api_is_allowed_to_edit(null,true)) { |
|
1460 | + if (!api_is_allowed_to_edit(null, true)) { |
|
1461 | 1461 | $editorConfig['UserStatus'] = 'student'; |
1462 | 1462 | } |
1463 | 1463 | |
@@ -1594,7 +1594,7 @@ discard block |
||
1594 | 1594 | |
1595 | 1595 | if ($feedback_type == 1) { |
1596 | 1596 | //2. but if it is a feedback DIRECT we only show the UNIQUE_ANSWER type that is currently available |
1597 | - $question_type_custom_list = array ( |
|
1597 | + $question_type_custom_list = array( |
|
1598 | 1598 | UNIQUE_ANSWER => self::$questionTypes[UNIQUE_ANSWER], |
1599 | 1599 | HOT_SPOT_DELINEATION => self::$questionTypes[HOT_SPOT_DELINEATION] |
1600 | 1600 | ); |
@@ -1610,17 +1610,17 @@ discard block |
||
1610 | 1610 | require_once $a_type[0]; |
1611 | 1611 | // get the picture of the type and the langvar which describes it |
1612 | 1612 | $img = $explanation = ''; |
1613 | - eval('$img = ' . $a_type[1] . '::$typePicture;'); |
|
1614 | - eval('$explanation = get_lang(' . $a_type[1] . '::$explanationLangVar);'); |
|
1613 | + eval('$img = '.$a_type[1].'::$typePicture;'); |
|
1614 | + eval('$explanation = get_lang('.$a_type[1].'::$explanationLangVar);'); |
|
1615 | 1615 | echo '<li>'; |
1616 | 1616 | echo '<div class="icon-image">'; |
1617 | 1617 | if ($objExercise->exercise_was_added_in_lp == true) { |
1618 | 1618 | $img = pathinfo($img); |
1619 | - $img = $img['filename'] . '_na.' . $img['extension']; |
|
1619 | + $img = $img['filename'].'_na.'.$img['extension']; |
|
1620 | 1620 | echo Display::return_icon($img, $explanation, null, ICON_SIZE_BIG); |
1621 | 1621 | } else { |
1622 | - echo '<a href="admin.php?' . api_get_cidreq() . '&newQuestion=yes&answerType=' . $i . '">' . |
|
1623 | - Display::return_icon($img, $explanation, null, ICON_SIZE_BIG) . '</a>'; |
|
1622 | + echo '<a href="admin.php?'.api_get_cidreq().'&newQuestion=yes&answerType='.$i.'">'. |
|
1623 | + Display::return_icon($img, $explanation, null, ICON_SIZE_BIG).'</a>'; |
|
1624 | 1624 | } |
1625 | 1625 | echo '</div>'; |
1626 | 1626 | echo '</li>'; |
@@ -1632,9 +1632,9 @@ discard block |
||
1632 | 1632 | echo Display::return_icon('database_na.png', get_lang('GetExistingQuestion'), null, ICON_SIZE_BIG); |
1633 | 1633 | } else { |
1634 | 1634 | if ($feedback_type == 1) { |
1635 | - echo $url = "<a href=\"question_pool.php?" . api_get_cidreq() . "&type=1&fromExercise=$exerciseId\">"; |
|
1635 | + echo $url = "<a href=\"question_pool.php?".api_get_cidreq()."&type=1&fromExercise=$exerciseId\">"; |
|
1636 | 1636 | } else { |
1637 | - echo $url = '<a href="question_pool.php?' . api_get_cidreq() . '&fromExercise=' . $exerciseId . '">'; |
|
1637 | + echo $url = '<a href="question_pool.php?'.api_get_cidreq().'&fromExercise='.$exerciseId.'">'; |
|
1638 | 1638 | } |
1639 | 1639 | echo Display::return_icon('database.png', get_lang('GetExistingQuestion'), null, ICON_SIZE_BIG); |
1640 | 1640 | } |
@@ -1771,7 +1771,7 @@ discard block |
||
1771 | 1771 | $header .= $this->show_media_content(); |
1772 | 1772 | } |
1773 | 1773 | |
1774 | - $header .= Display::page_subheader2($counter_label . ". " . $question_title); |
|
1774 | + $header .= Display::page_subheader2($counter_label.". ".$question_title); |
|
1775 | 1775 | $header .= Display::div( |
1776 | 1776 | "<div class=\"rib rib-$class\"><h3>$score_label</h3></div> <h4>{$score['result']}</h4>", |
1777 | 1777 | array('class' => 'ribbon') |
@@ -1792,7 +1792,7 @@ discard block |
||
1792 | 1792 | public function create_question( |
1793 | 1793 | $quiz_id, |
1794 | 1794 | $question_name, |
1795 | - $question_description = "" , |
|
1795 | + $question_description = "", |
|
1796 | 1796 | $max_score = 0, |
1797 | 1797 | $type = 1, |
1798 | 1798 | $level = 1 |
@@ -1862,8 +1862,8 @@ discard block |
||
1862 | 1862 | require_once $tabQuestionList[$type][0]; |
1863 | 1863 | |
1864 | 1864 | $img = $explanation = null; |
1865 | - eval('$img = ' . $tabQuestionList[$type][1] . '::$typePicture;'); |
|
1866 | - eval('$explanation = get_lang(' . $tabQuestionList[$type][1] . '::$explanationLangVar);'); |
|
1865 | + eval('$img = '.$tabQuestionList[$type][1].'::$typePicture;'); |
|
1866 | + eval('$explanation = get_lang('.$tabQuestionList[$type][1].'::$explanationLangVar);'); |
|
1867 | 1867 | return array($img, $explanation); |
1868 | 1868 | } |
1869 | 1869 | |
@@ -1927,7 +1927,7 @@ discard block |
||
1927 | 1927 | $media_list[0] = get_lang('NoMedia'); |
1928 | 1928 | |
1929 | 1929 | if (!empty($medias)) { |
1930 | - foreach($medias as $media) { |
|
1930 | + foreach ($medias as $media) { |
|
1931 | 1931 | $media_list[$media['id']] = empty($media['question']) ? get_lang('Untitled') : $media['question']; |
1932 | 1932 | } |
1933 | 1933 | } |
@@ -417,8 +417,8 @@ |
||
417 | 417 | * @param int $question_id The question ID (to which the answer is attached) |
418 | 418 | * @param string $title The text of the answer |
419 | 419 | * @param string $comment The feedback for the answer |
420 | - * @param float|null $score The score you get when picking this answer |
|
421 | - * @param int|null $correct Whether this answer is considered *the* correct one (this is the unique answer type) |
|
420 | + * @param double $score The score you get when picking this answer |
|
421 | + * @param integer $correct Whether this answer is considered *the* correct one (this is the unique answer type) |
|
422 | 422 | */ |
423 | 423 | public function addAnswer( |
424 | 424 | $id, |
@@ -447,7 +447,7 @@ |
||
447 | 447 | $position = $row_max->max_position + 1; |
448 | 448 | |
449 | 449 | // Insert a new answer |
450 | - $params = [ |
|
450 | + $params = [ |
|
451 | 451 | 'c_id' => $course_id, |
452 | 452 | 'id' => $id, |
453 | 453 | 'question_id' => $question_id, |
@@ -59,21 +59,21 @@ discard block |
||
59 | 59 | |
60 | 60 | if ($obj_ex->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { |
61 | 61 | //Scenario |
62 | - $comment_title = '<th width="20%">' . get_lang('Comment') . '</th>'; |
|
63 | - $feedback_title = '<th width="20%">' . get_lang('Scenario') . '</th>'; |
|
62 | + $comment_title = '<th width="20%">'.get_lang('Comment').'</th>'; |
|
63 | + $feedback_title = '<th width="20%">'.get_lang('Scenario').'</th>'; |
|
64 | 64 | } else { |
65 | - $comment_title = '<th width="40%">' . get_lang('Comment') . '</th>'; |
|
65 | + $comment_title = '<th width="40%">'.get_lang('Comment').'</th>'; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | $html = '<table class="table table-striped table-hover"> |
69 | 69 | <thead> |
70 | 70 | <tr style="text-align: center;"> |
71 | - <th width="5%">' . get_lang('Number') . '</th> |
|
72 | - <th width="5%"> ' . get_lang('True') . '</th> |
|
73 | - <th width="40%">' . get_lang('Answer') . '</th> |
|
74 | - ' . $comment_title . ' |
|
75 | - ' . $feedback_title . ' |
|
76 | - <th width="10%">' . get_lang('Weighting') . '</th> |
|
71 | + <th width="5%">' . get_lang('Number').'</th> |
|
72 | + <th width="5%"> ' . get_lang('True').'</th> |
|
73 | + <th width="40%">' . get_lang('Answer').'</th> |
|
74 | + ' . $comment_title.' |
|
75 | + ' . $feedback_title.' |
|
76 | + <th width="10%">' . get_lang('Weighting').'</th> |
|
77 | 77 | </tr> |
78 | 78 | </thead> |
79 | 79 | <tbody>'; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | continue; |
104 | 104 | } |
105 | 105 | $question = Question::read($questionid); |
106 | - $select_question[$questionid] = 'Q' . $key . ' :' . cut( |
|
106 | + $select_question[$questionid] = 'Q'.$key.' :'.cut( |
|
107 | 107 | $question->selectTitle(), 20 |
108 | 108 | ); |
109 | 109 | } |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | if ($answer->correct[$i]) { |
135 | 135 | $correct = $i; |
136 | 136 | } |
137 | - $defaults['answer[' . $i . ']'] = $answer->answer[$i]; |
|
138 | - $defaults['comment[' . $i . ']'] = $answer->comment[$i]; |
|
139 | - $defaults['weighting[' . $i . ']'] = float_format( |
|
137 | + $defaults['answer['.$i.']'] = $answer->answer[$i]; |
|
138 | + $defaults['comment['.$i.']'] = $answer->comment[$i]; |
|
139 | + $defaults['weighting['.$i.']'] = float_format( |
|
140 | 140 | $answer->weighting[$i], |
141 | 141 | 1 |
142 | 142 | ); |
@@ -159,18 +159,18 @@ discard block |
||
159 | 159 | $url_result = $url; |
160 | 160 | } |
161 | 161 | |
162 | - $temp_scenario['url' . $i] = $url_result; |
|
163 | - $temp_scenario['try' . $i] = $try_result; |
|
164 | - $temp_scenario['lp' . $i] = $lp; |
|
165 | - $temp_scenario['destination' . $i] = $list_dest; |
|
162 | + $temp_scenario['url'.$i] = $url_result; |
|
163 | + $temp_scenario['try'.$i] = $try_result; |
|
164 | + $temp_scenario['lp'.$i] = $lp; |
|
165 | + $temp_scenario['destination'.$i] = $list_dest; |
|
166 | 166 | } else { |
167 | 167 | $defaults['answer[1]'] = get_lang('DefaultUniqueAnswer1'); |
168 | 168 | $defaults['weighting[1]'] = 10; |
169 | 169 | $defaults['answer[2]'] = get_lang('DefaultUniqueAnswer2'); |
170 | 170 | $defaults['weighting[2]'] = 0; |
171 | 171 | |
172 | - $temp_scenario['destination' . $i] = array('0'); |
|
173 | - $temp_scenario['lp' . $i] = array('0'); |
|
172 | + $temp_scenario['destination'.$i] = array('0'); |
|
173 | + $temp_scenario['lp'.$i] = array('0'); |
|
174 | 174 | } |
175 | 175 | $defaults['scenario'] = $temp_scenario; |
176 | 176 | |
@@ -182,62 +182,62 @@ discard block |
||
182 | 182 | ); |
183 | 183 | $renderer->setElementTemplate( |
184 | 184 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
185 | - 'counter[' . $i . ']' |
|
185 | + 'counter['.$i.']' |
|
186 | 186 | ); |
187 | 187 | $renderer->setElementTemplate( |
188 | 188 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
189 | - 'answer[' . $i . ']' |
|
189 | + 'answer['.$i.']' |
|
190 | 190 | ); |
191 | 191 | $renderer->setElementTemplate( |
192 | 192 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
193 | - 'comment[' . $i . ']' |
|
193 | + 'comment['.$i.']' |
|
194 | 194 | ); |
195 | 195 | $renderer->setElementTemplate( |
196 | 196 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
197 | - 'weighting[' . $i . ']' |
|
197 | + 'weighting['.$i.']' |
|
198 | 198 | ); |
199 | 199 | |
200 | 200 | $answer_number = $form->addElement( |
201 | - 'text', 'counter[' . $i . ']', null, ' value = "' . $i . '"' |
|
201 | + 'text', 'counter['.$i.']', null, ' value = "'.$i.'"' |
|
202 | 202 | ); |
203 | 203 | $answer_number->freeze(); |
204 | 204 | $form->addElement( |
205 | 205 | 'radio', 'correct', null, null, $i, 'class="checkbox"' |
206 | 206 | ); |
207 | 207 | |
208 | - $form->addHtmlEditor('answer[' . $i . ']', null, null, true, $editor_config); |
|
208 | + $form->addHtmlEditor('answer['.$i.']', null, null, true, $editor_config); |
|
209 | 209 | |
210 | 210 | $form->addRule( |
211 | - 'answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required' |
|
211 | + 'answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required' |
|
212 | 212 | ); |
213 | 213 | |
214 | 214 | if ($obj_ex->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { |
215 | - $form->addHtmlEditor('comment[' . $i . ']', null, null, false, $editor_config); |
|
215 | + $form->addHtmlEditor('comment['.$i.']', null, null, false, $editor_config); |
|
216 | 216 | // Direct feedback |
217 | 217 | //Adding extra feedback fields |
218 | 218 | $group = array(); |
219 | - $group['try' . $i] = $form->createElement( |
|
219 | + $group['try'.$i] = $form->createElement( |
|
220 | 220 | 'checkbox', |
221 | - 'try' . $i, |
|
221 | + 'try'.$i, |
|
222 | 222 | null, |
223 | 223 | get_lang('TryAgain') |
224 | 224 | ); |
225 | - $group['lp' . $i] = $form->createElement( |
|
225 | + $group['lp'.$i] = $form->createElement( |
|
226 | 226 | 'select', |
227 | - 'lp' . $i, |
|
228 | - get_lang('SeeTheory') . ': ', |
|
227 | + 'lp'.$i, |
|
228 | + get_lang('SeeTheory').': ', |
|
229 | 229 | $select_lp_id |
230 | 230 | ); |
231 | - $group['destination' . $i] = $form->createElement( |
|
231 | + $group['destination'.$i] = $form->createElement( |
|
232 | 232 | 'select', |
233 | - 'destination' . $i, |
|
234 | - get_lang('GoToQuestion') . ': ', |
|
233 | + 'destination'.$i, |
|
234 | + get_lang('GoToQuestion').': ', |
|
235 | 235 | $select_question |
236 | 236 | ); |
237 | - $group['url' . $i] = $form->createElement( |
|
237 | + $group['url'.$i] = $form->createElement( |
|
238 | 238 | 'text', |
239 | - 'url' . $i, |
|
240 | - get_lang('Other') . ': ', |
|
239 | + 'url'.$i, |
|
240 | + get_lang('Other').': ', |
|
241 | 241 | array( |
242 | 242 | 'class' => 'col-md-2', |
243 | 243 | 'placeholder' => get_lang('Other') |
@@ -250,9 +250,9 @@ discard block |
||
250 | 250 | 'scenario' |
251 | 251 | ); |
252 | 252 | } else { |
253 | - $form->addHtmlEditor('comment[' . $i . ']', null, null, false, $editor_config); |
|
253 | + $form->addHtmlEditor('comment['.$i.']', null, null, false, $editor_config); |
|
254 | 254 | } |
255 | - $form->addText('weighting[' . $i . ']', null, null, array('value' => '0')); |
|
255 | + $form->addText('weighting['.$i.']', null, null, array('value' => '0')); |
|
256 | 256 | $form->addHtml('</tr>'); |
257 | 257 | } |
258 | 258 | |
@@ -306,19 +306,19 @@ discard block |
||
306 | 306 | $nb_answers = $form->getSubmitValue('nb_answers'); |
307 | 307 | |
308 | 308 | for ($i = 1; $i <= $nb_answers; $i++) { |
309 | - $answer = trim($form->getSubmitValue('answer[' . $i . ']')); |
|
310 | - $comment = trim($form->getSubmitValue('comment[' . $i . ']')); |
|
311 | - $weighting = trim($form->getSubmitValue('weighting[' . $i . ']')); |
|
309 | + $answer = trim($form->getSubmitValue('answer['.$i.']')); |
|
310 | + $comment = trim($form->getSubmitValue('comment['.$i.']')); |
|
311 | + $weighting = trim($form->getSubmitValue('weighting['.$i.']')); |
|
312 | 312 | |
313 | 313 | $scenario = $form->getSubmitValue('scenario'); |
314 | 314 | |
315 | 315 | //$list_destination = $form -> getSubmitValue('destination'.$i); |
316 | 316 | //$destination_str = $form -> getSubmitValue('destination'.$i); |
317 | 317 | |
318 | - $try = $scenario['try' . $i]; |
|
319 | - $lp = $scenario['lp' . $i]; |
|
320 | - $destination = $scenario['destination' . $i]; |
|
321 | - $url = trim($scenario['url' . $i]); |
|
318 | + $try = $scenario['try'.$i]; |
|
319 | + $lp = $scenario['lp'.$i]; |
|
320 | + $destination = $scenario['destination'.$i]; |
|
321 | + $url = trim($scenario['url'.$i]); |
|
322 | 322 | |
323 | 323 | /* |
324 | 324 | How we are going to parse the destination value |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | } |
367 | 367 | |
368 | 368 | //1@@1;2;@@2;4;4;@@http://www.chamilo.org |
369 | - $dest = $try . '@@' . $lp . '@@' . $destination . '@@' . $url; |
|
369 | + $dest = $try.'@@'.$lp.'@@'.$destination.'@@'.$url; |
|
370 | 370 | $objAnswer->createAnswer( |
371 | 371 | $answer, |
372 | 372 | $goodAnswer, |
@@ -400,12 +400,12 @@ discard block |
||
400 | 400 | $score = null |
401 | 401 | ) { |
402 | 402 | $header = parent::return_header($feedback_type, $counter, $score); |
403 | - $header .= '<table class="' . $this->question_table_class . '"> |
|
403 | + $header .= '<table class="'.$this->question_table_class.'"> |
|
404 | 404 | <tr> |
405 | - <th>' . get_lang("Choice") . '</th> |
|
406 | - <th>' . get_lang("ExpectedChoice") . '</th> |
|
407 | - <th>' . get_lang("Answer") . '</th>'; |
|
408 | - $header .= '<th>' . get_lang("Comment") . '</th>'; |
|
405 | + <th>' . get_lang("Choice").'</th> |
|
406 | + <th>' . get_lang("ExpectedChoice").'</th> |
|
407 | + <th>' . get_lang("Answer").'</th>'; |
|
408 | + $header .= '<th>'.get_lang("Comment").'</th>'; |
|
409 | 409 | $header .= '</tr>'; |
410 | 410 | |
411 | 411 | return $header; |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | if ($correct) { |
470 | 470 | $sql = "UPDATE $tbl_quiz_question |
471 | 471 | SET ponderation = (ponderation + $score) |
472 | - WHERE c_id = $course_id AND id = " . $question_id; |
|
472 | + WHERE c_id = $course_id AND id = ".$question_id; |
|
473 | 473 | Database::query($sql); |
474 | 474 | } |
475 | 475 | } |
@@ -1058,7 +1058,7 @@ discard block |
||
1058 | 1058 | * an up and down icon except for the first (no up icon) and the last (no down icon) |
1059 | 1059 | * The key of this $list array is the id of the item. |
1060 | 1060 | * |
1061 | - * @return void HTML |
|
1061 | + * @return string HTML |
|
1062 | 1062 | **/ |
1063 | 1063 | function return_up_down_icon($content, $id, $list) |
1064 | 1064 | { |
@@ -2011,7 +2011,7 @@ discard block |
||
2011 | 2011 | * This function retrieves forum thread users details |
2012 | 2012 | * @param int Thread ID |
2013 | 2013 | * @param string Course DB name (optional) |
2014 | - * @return resource array Array of type ([user_id=>w,lastname=>x,firstname=>y,thread_id=>z],[]) |
|
2014 | + * @return Doctrine\DBAL\Driver\Statement|null array Array of type ([user_id=>w,lastname=>x,firstname=>y,thread_id=>z],[]) |
|
2015 | 2015 | * @author Christian Fasanando <[email protected]>, |
2016 | 2016 | * @todo this function need to be improved |
2017 | 2017 | * @version octubre 2008, dokeos 1.8 |
@@ -2066,7 +2066,7 @@ discard block |
||
2066 | 2066 | * This function retrieves forum thread users qualify |
2067 | 2067 | * @param int Thread ID |
2068 | 2068 | * @param string Course DB name (optional) |
2069 | - * @return array Array of type ([user_id=>w,lastname=>x,firstname=>y,thread_id=>z],[]) |
|
2069 | + * @return Doctrine\DBAL\Driver\Statement|null Array of type ([user_id=>w,lastname=>x,firstname=>y,thread_id=>z],[]) |
|
2070 | 2070 | * @author Jhon Hinojosa |
2071 | 2071 | * @todo this function need to be improved |
2072 | 2072 | */ |
@@ -2133,7 +2133,7 @@ discard block |
||
2133 | 2133 | * This function retrieves forum thread users not qualify |
2134 | 2134 | * @param int Thread ID |
2135 | 2135 | * @param string Course DB name (optional) |
2136 | - * @return array Array of type ([user_id=>w,lastname=>x,firstname=>y,thread_id=>z],[]) |
|
2136 | + * @return Doctrine\DBAL\Driver\Statement|null Array of type ([user_id=>w,lastname=>x,firstname=>y,thread_id=>z],[]) |
|
2137 | 2137 | * @author Jhon Hinojosa<[email protected]>, |
2138 | 2138 | * @version oct 2008, dokeos 1.8 |
2139 | 2139 | */ |
@@ -3163,6 +3163,10 @@ discard block |
||
3163 | 3163 | * @param integer contains the information the current user id |
3164 | 3164 | * @param integer contains the information the current thread id |
3165 | 3165 | * @param integer contains the information the current qualify |
3166 | + * @param string $option |
|
3167 | + * @param integer $course_id |
|
3168 | + * @param integer $user_id |
|
3169 | + * @param integer $thread_id |
|
3166 | 3170 | * @return void |
3167 | 3171 | * <code>$option=1 obtained the qualification of the current thread</code> |
3168 | 3172 | * @author Isaac Flores <[email protected]>, U.N.A.S University |
@@ -3722,6 +3726,8 @@ discard block |
||
3722 | 3726 | * |
3723 | 3727 | * @author Patrick Cool <[email protected]>, Ghent University |
3724 | 3728 | * @version february 2006, dokeos 1.8 |
3729 | + * @param string $last_post_id |
|
3730 | + * @param string $post_date |
|
3725 | 3731 | */ |
3726 | 3732 | function updateThreadInfo($thread_id, $last_post_id, $post_date) |
3727 | 3733 | { |
@@ -4025,6 +4031,8 @@ discard block |
||
4025 | 4031 | * |
4026 | 4032 | * @param string Content type (post, thread, forum, forum_category) |
4027 | 4033 | * @param int Item DB ID |
4034 | + * @param string $content |
|
4035 | + * @param integer $id |
|
4028 | 4036 | * @return string language variable |
4029 | 4037 | * @author Patrick Cool <[email protected]>, Ghent University |
4030 | 4038 | * @version february 2006, dokeos 1.8 |
@@ -4461,6 +4469,7 @@ discard block |
||
4461 | 4469 | /** |
4462 | 4470 | * Display the search results |
4463 | 4471 | * @param string |
4472 | + * @param string $search_term |
|
4464 | 4473 | * @return void display the results |
4465 | 4474 | * @author Patrick Cool <[email protected]>, Ghent University, Belgium |
4466 | 4475 | * @version march 2008, dokeos 1.8.5 |
@@ -4590,7 +4599,7 @@ discard block |
||
4590 | 4599 | * This function adds an attachment file into a forum |
4591 | 4600 | * @param string $file_comment a comment about file |
4592 | 4601 | * @param int $last_id from forum_post table |
4593 | - * @return int|bool |
|
4602 | + * @return false|null |
|
4594 | 4603 | */ |
4595 | 4604 | function add_forum_attachment_file($file_comment, $last_id) |
4596 | 4605 | { |
@@ -4801,7 +4810,7 @@ discard block |
||
4801 | 4810 | * @param post id |
4802 | 4811 | * @param int $id_attach |
4803 | 4812 | * @param bool $display to show or not result message |
4804 | - * @return void |
|
4813 | + * @return integer |
|
4805 | 4814 | * @author Julio Montoya Dokeos |
4806 | 4815 | * @version october 2014, chamilo 1.9.8 |
4807 | 4816 | */ |
@@ -5083,7 +5092,7 @@ discard block |
||
5083 | 5092 | * @param integer $forum_id the id of the forum |
5084 | 5093 | * @param integer $thread_id the id of the thread |
5085 | 5094 | * @param integer $post_id the id of the post |
5086 | - * @return bool |
|
5095 | + * @return false|null |
|
5087 | 5096 | * |
5088 | 5097 | * @author Patrick Cool <[email protected]>, Ghent University, Belgium |
5089 | 5098 | * @version May 2008, dokeos 1.8.5 |
@@ -63,10 +63,10 @@ discard block |
||
63 | 63 | var l = $(this); |
64 | 64 | var id = l.closest("tr").attr("id"); |
65 | 65 | var filename = l.closest("tr").find(".attachFilename").html(); |
66 | - if (confirm("' . get_lang('AreYouSureToDeleteJS') . '", filename)) { |
|
66 | + if (confirm("' . get_lang('AreYouSureToDeleteJS').'", filename)) { |
|
67 | 67 | $.ajax({ |
68 | 68 | type: "POST", |
69 | - url: "'.api_get_path(WEB_AJAX_PATH) . 'forum.ajax.php?'.api_get_cidreq().'&a=delete_file&attachId=" + id +"&thread='.$threadId .'&forum='.$forumId .'", |
|
69 | + url: "'.api_get_path(WEB_AJAX_PATH).'forum.ajax.php?'.api_get_cidreq().'&a=delete_file&attachId=" + id +"&thread='.$threadId.'&forum='.$forumId.'", |
|
70 | 70 | dataType: "json", |
71 | 71 | success: function(data) { |
72 | 72 | if (data.error == false) { |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | function show_add_forumcategory_form($inputvalues = array(), $lp_id) |
180 | 180 | { |
181 | 181 | // Initialize the object. |
182 | - $form = new FormValidator('forumcategory', 'post', 'index.php?' . api_get_cidreq()); |
|
182 | + $form = new FormValidator('forumcategory', 'post', 'index.php?'.api_get_cidreq()); |
|
183 | 183 | // hidden field if from learning path |
184 | 184 | |
185 | 185 | $form->addElement('hidden', 'lp_id', $lp_id); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | function show_add_forum_form($inputvalues = array(), $lp_id) |
230 | 230 | { |
231 | 231 | $_course = api_get_course_info(); |
232 | - $form = new FormValidator('forumcategory', 'post', 'index.php?' . api_get_cidreq()); |
|
232 | + $form = new FormValidator('forumcategory', 'post', 'index.php?'.api_get_cidreq()); |
|
233 | 233 | |
234 | 234 | // The header for the form |
235 | 235 | if (!empty($inputvalues)) { |
@@ -971,24 +971,24 @@ discard block |
||
971 | 971 | $html = ''; |
972 | 972 | $id = Security::remove_XSS($id); |
973 | 973 | if ($current_visibility_status == '1') { |
974 | - $html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&'; |
|
974 | + $html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&'; |
|
975 | 975 | if (is_array($additional_url_parameters)) { |
976 | 976 | foreach ($additional_url_parameters as $key => $value) { |
977 | - $html .= $key . '=' . $value . '&'; |
|
977 | + $html .= $key.'='.$value.'&'; |
|
978 | 978 | } |
979 | 979 | } |
980 | - $html.='action=invisible&content='.$content.'&id='.$id.'">'. |
|
980 | + $html .= 'action=invisible&content='.$content.'&id='.$id.'">'. |
|
981 | 981 | Display::return_icon('visible.png', get_lang('MakeInvisible'), array(), ICON_SIZE_SMALL).'</a>'; |
982 | 982 | } |
983 | 983 | if ($current_visibility_status == '0') { |
984 | - $html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&'; |
|
984 | + $html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&'; |
|
985 | 985 | if (is_array($additional_url_parameters)) { |
986 | 986 | foreach ($additional_url_parameters as $key => $value) { |
987 | - $html .= $key . '=' . $value . '&'; |
|
987 | + $html .= $key.'='.$value.'&'; |
|
988 | 988 | } |
989 | 989 | } |
990 | - $html .= 'action=visible&content=' . $content . '&id=' . $id . '">' . |
|
991 | - Display::return_icon('invisible.png', get_lang('MakeVisible'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
990 | + $html .= 'action=visible&content='.$content.'&id='.$id.'">'. |
|
991 | + Display::return_icon('invisible.png', get_lang('MakeVisible'), array(), ICON_SIZE_SMALL).'</a>'; |
|
992 | 992 | } |
993 | 993 | return $html; |
994 | 994 | } |
@@ -1016,21 +1016,21 @@ discard block |
||
1016 | 1016 | $html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&'; |
1017 | 1017 | if (is_array($additional_url_parameters)) { |
1018 | 1018 | foreach ($additional_url_parameters as $key => $value) { |
1019 | - $html .= $key . '=' . $value . '&'; |
|
1019 | + $html .= $key.'='.$value.'&'; |
|
1020 | 1020 | } |
1021 | 1021 | } |
1022 | - $html.= 'action=unlock&content='.$content.'&id='.$id.'">'. |
|
1022 | + $html .= 'action=unlock&content='.$content.'&id='.$id.'">'. |
|
1023 | 1023 | Display::return_icon('lock.png', get_lang('Unlock'), array(), ICON_SIZE_SMALL).'</a>'; |
1024 | 1024 | } |
1025 | 1025 | if ($current_lock_status == '0') { |
1026 | 1026 | $html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&'; |
1027 | 1027 | if (is_array($additional_url_parameters)) { |
1028 | 1028 | foreach ($additional_url_parameters as $key => $value) { |
1029 | - $html .= $key . '=' . $value . '&'; |
|
1029 | + $html .= $key.'='.$value.'&'; |
|
1030 | 1030 | } |
1031 | 1031 | } |
1032 | - $html .= 'action=lock&content=' . $content . '&id=' . $id . '">' . |
|
1033 | - Display::return_icon('unlock.png', get_lang('Lock'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
1032 | + $html .= 'action=lock&content='.$content.'&id='.$id.'">'. |
|
1033 | + Display::return_icon('unlock.png', get_lang('Lock'), array(), ICON_SIZE_SMALL).'</a>'; |
|
1034 | 1034 | } |
1035 | 1035 | return $html; |
1036 | 1036 | } |
@@ -1233,7 +1233,7 @@ discard block |
||
1233 | 1233 | forum_categories.c_id = $course_id AND |
1234 | 1234 | item_properties.c_id = $course_id AND |
1235 | 1235 | forum_categories.cat_id=item_properties.ref AND |
1236 | - item_properties.tool='" . TOOL_FORUM_CATEGORY . "' |
|
1236 | + item_properties.tool='".TOOL_FORUM_CATEGORY."' |
|
1237 | 1237 | ORDER BY forum_categories.cat_order $sort_direction"; |
1238 | 1238 | } |
1239 | 1239 | if ($content == 'forum') { |
@@ -1241,7 +1241,7 @@ discard block |
||
1241 | 1241 | FROM $table |
1242 | 1242 | WHERE |
1243 | 1243 | c_id = $course_id AND |
1244 | - forum_category='" . Database::escape_string($forum_category) . "' |
|
1244 | + forum_category='".Database::escape_string($forum_category)."' |
|
1245 | 1245 | ORDER BY forum_order $sort_direction"; |
1246 | 1246 | } |
1247 | 1247 | // Finding the items that need to be switched. |
@@ -1298,7 +1298,7 @@ discard block |
||
1298 | 1298 | { |
1299 | 1299 | $current_visibility_status = intval($current_visibility_status); |
1300 | 1300 | if ($current_visibility_status == 0) { |
1301 | - $status='invisible'; |
|
1301 | + $status = 'invisible'; |
|
1302 | 1302 | return $status; |
1303 | 1303 | } |
1304 | 1304 | } |
@@ -2205,7 +2205,7 @@ discard block |
||
2205 | 2205 | { |
2206 | 2206 | $table_forums = Database :: get_course_table(TABLE_FORUM); |
2207 | 2207 | $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
2208 | - $courseId = empty($courseId) ? api_get_course_int_id(): intval($courseId); |
|
2208 | + $courseId = empty($courseId) ? api_get_course_int_id() : intval($courseId); |
|
2209 | 2209 | $forum_id = intval($forum_id); |
2210 | 2210 | |
2211 | 2211 | $sql = "SELECT * |
@@ -2364,7 +2364,7 @@ discard block |
||
2364 | 2364 | */ |
2365 | 2365 | function store_thread($current_forum, $values, $courseInfo = array(), $showMessage = true) |
2366 | 2366 | { |
2367 | - $courseInfo = empty($courseInfo) ? api_get_course_info() : $courseInfo ; |
|
2367 | + $courseInfo = empty($courseInfo) ? api_get_course_info() : $courseInfo; |
|
2368 | 2368 | $_user = api_get_user_info(); |
2369 | 2369 | $course_id = $courseInfo['real_id']; |
2370 | 2370 | $courseCode = $courseInfo['code']; |
@@ -2608,11 +2608,11 @@ discard block |
||
2608 | 2608 | $form = new FormValidator( |
2609 | 2609 | 'thread', |
2610 | 2610 | 'post', |
2611 | - api_get_self() . '?' . http_build_query([ |
|
2611 | + api_get_self().'?'.http_build_query([ |
|
2612 | 2612 | 'forum' => $myForum, |
2613 | 2613 | 'gradebook' => $myGradebook, |
2614 | 2614 | 'thread' => $myThread, |
2615 | - ]) . '&' . api_get_cidreq() |
|
2615 | + ]).'&'.api_get_cidreq() |
|
2616 | 2616 | ); |
2617 | 2617 | |
2618 | 2618 | $form->addElement('header', get_lang('EditThread')); |
@@ -2675,7 +2675,7 @@ discard block |
||
2675 | 2675 | $form->addElement('html', '</div>'); |
2676 | 2676 | |
2677 | 2677 | if (!empty($formValues)) { |
2678 | - $defaults['thread_qualify_gradebook'] = ($formValues['threadQualifyMax'] > 0 && empty($_POST)) ? 1 : 0 ; |
|
2678 | + $defaults['thread_qualify_gradebook'] = ($formValues['threadQualifyMax'] > 0 && empty($_POST)) ? 1 : 0; |
|
2679 | 2679 | $defaults['thread_title'] = prepare4display($formValues['threadTitle']); |
2680 | 2680 | $defaults['thread_sticky'] = strval(intval($formValues['threadSticky'])); |
2681 | 2681 | $defaults['thread_peer_qualify'] = intval($formValues['threadPeerQualify']); |
@@ -2747,13 +2747,13 @@ discard block |
||
2747 | 2747 | $form = new FormValidator( |
2748 | 2748 | 'thread', |
2749 | 2749 | 'post', |
2750 | - api_get_self() . '?' . http_build_query([ |
|
2750 | + api_get_self().'?'.http_build_query([ |
|
2751 | 2751 | 'forum' => intval($my_forum), |
2752 | 2752 | 'gradebook' => $my_gradebook, |
2753 | 2753 | 'thread' => intval($myThread), |
2754 | 2754 | 'post' => intval($my_post), |
2755 | 2755 | 'action' => $action, |
2756 | - ]) . '&' . api_get_cidreq() |
|
2756 | + ]).'&'.api_get_cidreq() |
|
2757 | 2757 | ); |
2758 | 2758 | $form->setConstants(array('forum' => '5')); |
2759 | 2759 | |
@@ -3012,7 +3012,7 @@ discard block |
||
3012 | 3012 | |
3013 | 3013 | if ($row[0] == 0) { |
3014 | 3014 | $sql = "INSERT INTO $table_threads_qualify (c_id, user_id, thread_id,qualify,qualify_user_id,qualify_time,session_id) |
3015 | - VALUES (".$course_id.", '".$user_id."','".$thread_id."',".(float)$thread_qualify.", '".$currentUserId."','".$qualify_time."','".$session_id."')"; |
|
3015 | + VALUES (".$course_id.", '".$user_id."','".$thread_id."',".(float) $thread_qualify.", '".$currentUserId."','".$qualify_time."','".$session_id."')"; |
|
3016 | 3016 | Database::query($sql); |
3017 | 3017 | |
3018 | 3018 | $insertId = Database::insert_id(); |
@@ -4654,9 +4654,9 @@ discard block |
||
4654 | 4654 | continue; |
4655 | 4655 | } |
4656 | 4656 | |
4657 | - $course_dir = $_course['path'] . '/upload/forum'; |
|
4657 | + $course_dir = $_course['path'].'/upload/forum'; |
|
4658 | 4658 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
4659 | - $updir = $sys_course_path . $course_dir; |
|
4659 | + $updir = $sys_course_path.$course_dir; |
|
4660 | 4660 | |
4661 | 4661 | // Try to add an extension to the file if it hasn't one. |
4662 | 4662 | $new_file_name = add_ext_on_mime( |
@@ -4673,7 +4673,7 @@ discard block |
||
4673 | 4673 | } |
4674 | 4674 | |
4675 | 4675 | $new_file_name = uniqid(''); |
4676 | - $new_path = $updir . '/' . $new_file_name; |
|
4676 | + $new_path = $updir.'/'.$new_file_name; |
|
4677 | 4677 | $result = @move_uploaded_file($attachment['tmp_name'], $new_path); |
4678 | 4678 | $safe_file_comment = Database::escape_string($file_comment); |
4679 | 4679 | $safe_file_name = Database::escape_string($file_name); |
@@ -4838,16 +4838,16 @@ discard block |
||
4838 | 4838 | $forum_table_attachment = Database::get_course_table(TABLE_FORUM_ATTACHMENT); |
4839 | 4839 | $course_id = api_get_course_int_id(); |
4840 | 4840 | |
4841 | - $cond = (!empty($id_attach)) ? " iid = " . (int) $id_attach . "" : " post_id = " . (int) $post_id . ""; |
|
4841 | + $cond = (!empty($id_attach)) ? " iid = ".(int) $id_attach."" : " post_id = ".(int) $post_id.""; |
|
4842 | 4842 | $sql = "SELECT path FROM $forum_table_attachment WHERE c_id = $course_id AND $cond"; |
4843 | 4843 | $res = Database::query($sql); |
4844 | 4844 | $row = Database::fetch_array($res); |
4845 | 4845 | |
4846 | - $course_dir = $_course['path'] . '/upload/forum'; |
|
4846 | + $course_dir = $_course['path'].'/upload/forum'; |
|
4847 | 4847 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
4848 | - $updir = $sys_course_path . $course_dir; |
|
4848 | + $updir = $sys_course_path.$course_dir; |
|
4849 | 4849 | $my_path = isset($row['path']) ? $row['path'] : null; |
4850 | - $file = $updir . '/' . $my_path; |
|
4850 | + $file = $updir.'/'.$my_path; |
|
4851 | 4851 | if (Security::check_abs_path($file, $updir)) { |
4852 | 4852 | @unlink($file); |
4853 | 4853 | } |
@@ -5395,35 +5395,35 @@ discard block |
||
5395 | 5395 | $post_list = get_thread_user_post_limit($course_code, $thread['thread_id'], $user_id, 1); |
5396 | 5396 | $post_counter = count($post_list); |
5397 | 5397 | if (is_array($post_list) && count($post_list) > 0) { |
5398 | - $hand_forums.= '<div id="social-thread">'; |
|
5399 | - $hand_forums.= Display::return_icon('thread.png', get_lang('Thread'), '', ICON_SIZE_MEDIUM); |
|
5400 | - $hand_forums.= ' '.Security::remove_XSS($thread['thread_title'], STUDENT); |
|
5401 | - $hand_forums.= '</div>'; |
|
5398 | + $hand_forums .= '<div id="social-thread">'; |
|
5399 | + $hand_forums .= Display::return_icon('thread.png', get_lang('Thread'), '', ICON_SIZE_MEDIUM); |
|
5400 | + $hand_forums .= ' '.Security::remove_XSS($thread['thread_title'], STUDENT); |
|
5401 | + $hand_forums .= '</div>'; |
|
5402 | 5402 | |
5403 | 5403 | foreach ($post_list as $posts) { |
5404 | - $hand_forums.= '<div id="social-post">'; |
|
5405 | - $hand_forums.= '<strong>'.Security::remove_XSS($posts['post_title'], STUDENT).'</strong>'; |
|
5406 | - $hand_forums.= '<br / >'; |
|
5407 | - $hand_forums.= Security::remove_XSS($posts['post_text'], STUDENT); |
|
5408 | - $hand_forums.= '</div>'; |
|
5409 | - $hand_forums.= '<br / >'; |
|
5404 | + $hand_forums .= '<div id="social-post">'; |
|
5405 | + $hand_forums .= '<strong>'.Security::remove_XSS($posts['post_title'], STUDENT).'</strong>'; |
|
5406 | + $hand_forums .= '<br / >'; |
|
5407 | + $hand_forums .= Security::remove_XSS($posts['post_text'], STUDENT); |
|
5408 | + $hand_forums .= '</div>'; |
|
5409 | + $hand_forums .= '<br / >'; |
|
5410 | 5410 | } |
5411 | 5411 | } |
5412 | 5412 | } |
5413 | 5413 | $i++; |
5414 | 5414 | } |
5415 | - $forum_results .='<div id="social-forum">'; |
|
5416 | - $forum_results .='<div class="clear"></div><br />'; |
|
5417 | - $forum_results .='<div id="social-forum-title">'. |
|
5415 | + $forum_results .= '<div id="social-forum">'; |
|
5416 | + $forum_results .= '<div class="clear"></div><br />'; |
|
5417 | + $forum_results .= '<div id="social-forum-title">'. |
|
5418 | 5418 | Display::return_icon('forum.gif', get_lang('Forum')).' '.Security::remove_XSS($forum['forum_title'], STUDENT). |
5419 | 5419 | '<div style="float:right;margin-top:-35px"> |
5420 | 5420 | <a href="../forum/viewforum.php?cidReq='.$course_code.'&gidReq=&forum='.$forum['forum_id'].' " >'.get_lang('SeeForum').'</a> |
5421 | 5421 | </div></div>'; |
5422 | - $forum_results .='<br / >'; |
|
5422 | + $forum_results .= '<br / >'; |
|
5423 | 5423 | if ($post_counter > 0) { |
5424 | - $forum_results .=$hand_forums; |
|
5424 | + $forum_results .= $hand_forums; |
|
5425 | 5425 | } |
5426 | - $forum_results .='</div>'; |
|
5426 | + $forum_results .= '</div>'; |
|
5427 | 5427 | }$j++; |
5428 | 5428 | } |
5429 | 5429 | } |
@@ -5564,16 +5564,16 @@ discard block |
||
5564 | 5564 | $courseId = intval($courseId); |
5565 | 5565 | if (empty($courseId)) { |
5566 | 5566 | // $courseId can be null, use api method |
5567 | - $courseId= api_get_course_int_id(); |
|
5567 | + $courseId = api_get_course_int_id(); |
|
5568 | 5568 | } |
5569 | 5569 | /* |
5570 | 5570 | * Check if Attachment ID and Course ID are greater than zero |
5571 | 5571 | * and array of field values is not empty |
5572 | 5572 | */ |
5573 | 5573 | if ($id > 0 && $courseId > 0 && !empty($array) && is_array($array)) { |
5574 | - foreach($array as $key => &$item) { |
|
5574 | + foreach ($array as $key => &$item) { |
|
5575 | 5575 | $item = Database::escape_string($item); |
5576 | - $setString .= $key . ' = "' .$item . '", '; |
|
5576 | + $setString .= $key.' = "'.$item.'", '; |
|
5577 | 5577 | } |
5578 | 5578 | // Delete last comma |
5579 | 5579 | $setString = substr($setString, 0, strlen($setString) - 2); |
@@ -5619,7 +5619,7 @@ discard block |
||
5619 | 5619 | return ''; |
5620 | 5620 | } |
5621 | 5621 | |
5622 | - $url = api_get_path(WEB_AJAX_PATH).'forum.ajax.php?'.api_get_cidreq().'&forum=' . $forumId . '&thread=' . $threadId . '&postId=' . $postId . '&a=upload_file'; |
|
5622 | + $url = api_get_path(WEB_AJAX_PATH).'forum.ajax.php?'.api_get_cidreq().'&forum='.$forumId.'&thread='.$threadId.'&postId='.$postId.'&a=upload_file'; |
|
5623 | 5623 | |
5624 | 5624 | $multipleForm = new FormValidator('post'); |
5625 | 5625 | $multipleForm->addMultipleUpload($url); |
@@ -5660,10 +5660,10 @@ discard block |
||
5660 | 5660 | foreach ($uploadedFiles as $k => $uploadedFile) { |
5661 | 5661 | if (!empty($uploadedFile) && in_array($uploadedFile['id'], $attachIds)) { |
5662 | 5662 | // Buil html table including an input with attachmentID |
5663 | - $fileDataContent .= '<tr id="' . $uploadedFile['id'] . '" ><td>' . $uploadedFile['name'] . '</td><td>' . $uploadedFile['size'] . '</td><td> ' . $uploadedFile['result'] . |
|
5664 | - ' </td><td> <input style="width:90%;" type="text" value="' . $uploadedFile['comment'] . '" name="file_comments[]"> </td><td>' . |
|
5665 | - $uploadedFile['delete'] . '</td>' . |
|
5666 | - '<input type="hidden" value="' . $uploadedFile['id'] .'" name="file_ids[]">' . '</tr>'; |
|
5663 | + $fileDataContent .= '<tr id="'.$uploadedFile['id'].'" ><td>'.$uploadedFile['name'].'</td><td>'.$uploadedFile['size'].'</td><td> '.$uploadedFile['result']. |
|
5664 | + ' </td><td> <input style="width:90%;" type="text" value="'.$uploadedFile['comment'].'" name="file_comments[]"> </td><td>'. |
|
5665 | + $uploadedFile['delete'].'</td>'. |
|
5666 | + '<input type="hidden" value="'.$uploadedFile['id'].'" name="file_ids[]">'.'</tr>'; |
|
5667 | 5667 | } else { |
5668 | 5668 | /* |
5669 | 5669 | * If attachment data is empty, then delete it from $_SESSION |
@@ -5676,7 +5676,7 @@ discard block |
||
5676 | 5676 | $style = empty($fileDataContent) ? 'display: none;' : ''; |
5677 | 5677 | // Forum attachment Ajax table |
5678 | 5678 | $fileData = ' |
5679 | - <div class="control-group " style="'. $style . '"> |
|
5679 | + <div class="control-group " style="'. $style.'"> |
|
5680 | 5680 | <label class="control-label">'.get_lang('AttachmentList').'</label> |
5681 | 5681 | <div class="controls"> |
5682 | 5682 | <table id="attachmentFileList" class="files data_table span10"> |
@@ -5748,7 +5748,7 @@ discard block |
||
5748 | 5748 | // name contains an URL to download attachment file and its filename |
5749 | 5749 | $json['name'] = Display::url( |
5750 | 5750 | api_htmlentities($row['filename']), |
5751 | - api_get_path(WEB_CODE_PATH) . 'forum/download.php?file='.$row['path'].'&'.api_get_cidreq(), |
|
5751 | + api_get_path(WEB_CODE_PATH).'forum/download.php?file='.$row['path'].'&'.api_get_cidreq(), |
|
5752 | 5752 | array('target'=>'_blank', 'class' => 'attachFilename') |
5753 | 5753 | ); |
5754 | 5754 | $json['id'] = $row['iid']; |
@@ -5759,9 +5759,9 @@ discard block |
||
5759 | 5759 | if (!empty($row) && is_array($row)) { |
5760 | 5760 | // Set result as success and bring delete URL |
5761 | 5761 | $json['result'] = Display::return_icon('accept.png', get_lang('Uploaded')); |
5762 | - $url = api_get_path(WEB_CODE_PATH) . 'forum/viewthread.php?' . api_get_cidreq() . '&action=delete_attach&forum=' . $forumId . '&thread=' . $threadId.'&id_attach=' . $row['iid']; |
|
5762 | + $url = api_get_path(WEB_CODE_PATH).'forum/viewthread.php?'.api_get_cidreq().'&action=delete_attach&forum='.$forumId.'&thread='.$threadId.'&id_attach='.$row['iid']; |
|
5763 | 5763 | $json['delete'] = Display::url( |
5764 | - Display::return_icon('delete.png',get_lang('Delete'), array(), ICON_SIZE_SMALL), |
|
5764 | + Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL), |
|
5765 | 5765 | $url, |
5766 | 5766 | array('class' => 'deleteLink') |
5767 | 5767 | ); |
@@ -5850,7 +5850,7 @@ discard block |
||
5850 | 5850 | WHERE c_id = $courseId AND post_id = $postId"; |
5851 | 5851 | $result = Database::query($sql); |
5852 | 5852 | if ($result !== false && Database::num_rows($result) > 0) { |
5853 | - while ($row = Database::fetch_array($result,'ASSOC')) { |
|
5853 | + while ($row = Database::fetch_array($result, 'ASSOC')) { |
|
5854 | 5854 | $array[] = $row['id']; |
5855 | 5855 | } |
5856 | 5856 | } |
@@ -193,6 +193,9 @@ discard block |
||
193 | 193 | $this->visible = $visible; |
194 | 194 | } |
195 | 195 | |
196 | + /** |
|
197 | + * @param integer $id |
|
198 | + */ |
|
196 | 199 | public function set_session_id($id) |
197 | 200 | { |
198 | 201 | $this->session_id = $id; |
@@ -217,6 +220,12 @@ discard block |
||
217 | 220 | /** |
218 | 221 | * Retrieve links and return them as an array of extensions of AbstractLink. |
219 | 222 | * To keep consistency, do not call this method but LinkFactory::load instead. |
223 | + * @param integer $id |
|
224 | + * @param integer $type |
|
225 | + * @param integer $user_id |
|
226 | + * @param string $course_code |
|
227 | + * @param integer $category_id |
|
228 | + * @param integer $visible |
|
220 | 229 | */ |
221 | 230 | public static function load( |
222 | 231 | $id = null, |
@@ -288,7 +297,7 @@ discard block |
||
288 | 297 | } |
289 | 298 | |
290 | 299 | /** |
291 | - * @param $result |
|
300 | + * @param Doctrine\DBAL\Driver\Statement|null $result |
|
292 | 301 | * @return array |
293 | 302 | */ |
294 | 303 | private static function create_objects_from_sql_result($result) |
@@ -463,6 +472,7 @@ discard block |
||
463 | 472 | |
464 | 473 | /** |
465 | 474 | * Internal function used by get_target_categories() |
475 | + * @param integer $level |
|
466 | 476 | */ |
467 | 477 | private function add_target_subcategories($targets, $level, $catid) |
468 | 478 | { |
@@ -492,6 +502,7 @@ discard block |
||
492 | 502 | * Find links by name |
493 | 503 | * To keep consistency, do not call this method but LinkFactory::find_links instead. |
494 | 504 | * @todo can be written more efficiently using a new (but very complex) sql query |
505 | + * @param string $name_mask |
|
495 | 506 | */ |
496 | 507 | public function find_links ($name_mask,$selectcat) |
497 | 508 | { |
@@ -559,21 +570,21 @@ discard block |
||
559 | 570 | } |
560 | 571 | |
561 | 572 | /** |
562 | - * @param $name |
|
573 | + * @param string $name |
|
563 | 574 | */ |
564 | 575 | public function set_name($name) |
565 | 576 | { |
566 | 577 | } |
567 | 578 | |
568 | 579 | /** |
569 | - * @param $description |
|
580 | + * @param string $description |
|
570 | 581 | */ |
571 | 582 | public function set_description($description) |
572 | 583 | { |
573 | 584 | } |
574 | 585 | |
575 | 586 | /** |
576 | - * @param $max |
|
587 | + * @param integer $max |
|
577 | 588 | */ |
578 | 589 | public function set_max($max) |
579 | 590 | { |
@@ -138,22 +138,22 @@ discard block |
||
138 | 138 | return $this->visible; |
139 | 139 | } |
140 | 140 | |
141 | - public function set_id ($id) |
|
141 | + public function set_id($id) |
|
142 | 142 | { |
143 | 143 | $this->id = $id; |
144 | 144 | } |
145 | 145 | |
146 | - public function set_type ($type) |
|
146 | + public function set_type($type) |
|
147 | 147 | { |
148 | 148 | $this->type = $type; |
149 | 149 | } |
150 | 150 | |
151 | - public function set_ref_id ($ref_id) |
|
151 | + public function set_ref_id($ref_id) |
|
152 | 152 | { |
153 | 153 | $this->ref_id = $ref_id; |
154 | 154 | } |
155 | 155 | |
156 | - public function set_user_id ($user_id) |
|
156 | + public function set_user_id($user_id) |
|
157 | 157 | { |
158 | 158 | $this->user_id = $user_id; |
159 | 159 | } |
@@ -231,29 +231,29 @@ discard block |
||
231 | 231 | $sql = 'SELECT * FROM '.$tbl_grade_links; |
232 | 232 | $paramcount = 0; |
233 | 233 | if (isset ($id)) { |
234 | - $sql.= ' WHERE id = '.intval($id); |
|
235 | - $paramcount ++; |
|
234 | + $sql .= ' WHERE id = '.intval($id); |
|
235 | + $paramcount++; |
|
236 | 236 | } |
237 | 237 | if (isset ($type)) { |
238 | 238 | if ($paramcount != 0) $sql .= ' AND'; |
239 | 239 | else $sql .= ' WHERE'; |
240 | 240 | $sql .= ' type = '.intval($type); |
241 | - $paramcount ++; |
|
241 | + $paramcount++; |
|
242 | 242 | } |
243 | 243 | if (isset ($ref_id)) { |
244 | 244 | if ($paramcount != 0) $sql .= ' AND'; |
245 | 245 | else $sql .= ' WHERE'; |
246 | 246 | $sql .= ' ref_id = '.intval($ref_id); |
247 | - $paramcount ++; |
|
247 | + $paramcount++; |
|
248 | 248 | } |
249 | 249 | if (isset ($user_id)) { |
250 | 250 | if ($paramcount != 0) { |
251 | 251 | $sql .= ' AND'; |
252 | - }else { |
|
252 | + } else { |
|
253 | 253 | $sql .= ' WHERE'; |
254 | 254 | } |
255 | 255 | $sql .= ' user_id = '.intval($user_id); |
256 | - $paramcount ++; |
|
256 | + $paramcount++; |
|
257 | 257 | } |
258 | 258 | if (isset ($course_code)) { |
259 | 259 | if ($paramcount != 0) { |
@@ -262,16 +262,16 @@ discard block |
||
262 | 262 | $sql .= ' WHERE'; |
263 | 263 | } |
264 | 264 | $sql .= " course_code = '".Database::escape_string($course_code)."'"; |
265 | - $paramcount ++; |
|
265 | + $paramcount++; |
|
266 | 266 | } |
267 | 267 | if (isset ($category_id)) { |
268 | 268 | if ($paramcount != 0) { |
269 | 269 | $sql .= ' AND'; |
270 | - }else { |
|
270 | + } else { |
|
271 | 271 | $sql .= ' WHERE'; |
272 | 272 | } |
273 | 273 | $sql .= ' category_id = '.intval($category_id); |
274 | - $paramcount ++; |
|
274 | + $paramcount++; |
|
275 | 275 | } |
276 | 276 | if (isset ($visible)) { |
277 | 277 | if ($paramcount != 0) { |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | $session_id = api_get_session_id(); |
312 | 312 | |
313 | 313 | $link->set_session_id($session_id); |
314 | - $links[]=$link; |
|
314 | + $links[] = $link; |
|
315 | 315 | } |
316 | 316 | return $links; |
317 | 317 | } |
@@ -402,12 +402,12 @@ discard block |
||
402 | 402 | $dateobject = AbstractLink::load($idevaluation, null, null, null, null); |
403 | 403 | $current_date_server = api_get_utc_datetime(); |
404 | 404 | $arreval = get_object_vars($dateobject[0]); |
405 | - $description_log = isset($arreval['description']) ? $arreval['description']:''; |
|
405 | + $description_log = isset($arreval['description']) ? $arreval['description'] : ''; |
|
406 | 406 | if (empty($nameLog)) { |
407 | 407 | if (isset($_POST['name_link'])) { |
408 | 408 | $name_log = isset($_POST['name_link']) ? $_POST['name_link'] : $arreval['course_code']; |
409 | - } elseif (isset($_POST['link_' . $idevaluation]) && $_POST['link_' . $idevaluation]) { |
|
410 | - $name_log = $_POST['link_' . $idevaluation]; |
|
409 | + } elseif (isset($_POST['link_'.$idevaluation]) && $_POST['link_'.$idevaluation]) { |
|
410 | + $name_log = $_POST['link_'.$idevaluation]; |
|
411 | 411 | } else { |
412 | 412 | $name_log = $arreval['course_code']; |
413 | 413 | } |
@@ -452,10 +452,10 @@ discard block |
||
452 | 452 | $targets = array(); |
453 | 453 | $level = 0; |
454 | 454 | |
455 | - $crscats = Category::load(null,null,$this->get_course_code(),0); |
|
455 | + $crscats = Category::load(null, null, $this->get_course_code(), 0); |
|
456 | 456 | foreach ($crscats as $cat) { |
457 | - $targets[] = array($cat->get_id(), $cat->get_name(), $level+1); |
|
458 | - $targets = $this->add_target_subcategories($targets, $level+1, $cat->get_id()); |
|
457 | + $targets[] = array($cat->get_id(), $cat->get_name(), $level + 1); |
|
458 | + $targets = $this->add_target_subcategories($targets, $level + 1, $cat->get_id()); |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | return $targets; |
@@ -466,10 +466,10 @@ discard block |
||
466 | 466 | */ |
467 | 467 | private function add_target_subcategories($targets, $level, $catid) |
468 | 468 | { |
469 | - $subcats = Category::load(null,null,null,$catid); |
|
469 | + $subcats = Category::load(null, null, null, $catid); |
|
470 | 470 | foreach ($subcats as $cat) { |
471 | - $targets[] = array ($cat->get_id(), $cat->get_name(), $level+1); |
|
472 | - $targets = $this->add_target_subcategories($targets, $level+1, $cat->get_id()); |
|
471 | + $targets[] = array($cat->get_id(), $cat->get_name(), $level + 1); |
|
472 | + $targets = $this->add_target_subcategories($targets, $level + 1, $cat->get_id()); |
|
473 | 473 | } |
474 | 474 | return $targets; |
475 | 475 | } |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | * To keep consistency, do not call this method but LinkFactory::find_links instead. |
494 | 494 | * @todo can be written more efficiently using a new (but very complex) sql query |
495 | 495 | */ |
496 | - public function find_links ($name_mask,$selectcat) |
|
496 | + public function find_links($name_mask, $selectcat) |
|
497 | 497 | { |
498 | 498 | $rootcat = Category::load($selectcat); |
499 | 499 | $links = $rootcat[0]->get_links((api_is_allowed_to_edit() ? null : api_get_user_id()), true); |
@@ -235,21 +235,27 @@ discard block |
||
235 | 235 | $paramcount ++; |
236 | 236 | } |
237 | 237 | if (isset ($type)) { |
238 | - if ($paramcount != 0) $sql .= ' AND'; |
|
239 | - else $sql .= ' WHERE'; |
|
238 | + if ($paramcount != 0) { |
|
239 | + $sql .= ' AND'; |
|
240 | + } else { |
|
241 | + $sql .= ' WHERE'; |
|
242 | + } |
|
240 | 243 | $sql .= ' type = '.intval($type); |
241 | 244 | $paramcount ++; |
242 | 245 | } |
243 | 246 | if (isset ($ref_id)) { |
244 | - if ($paramcount != 0) $sql .= ' AND'; |
|
245 | - else $sql .= ' WHERE'; |
|
247 | + if ($paramcount != 0) { |
|
248 | + $sql .= ' AND'; |
|
249 | + } else { |
|
250 | + $sql .= ' WHERE'; |
|
251 | + } |
|
246 | 252 | $sql .= ' ref_id = '.intval($ref_id); |
247 | 253 | $paramcount ++; |
248 | 254 | } |
249 | 255 | if (isset ($user_id)) { |
250 | 256 | if ($paramcount != 0) { |
251 | 257 | $sql .= ' AND'; |
252 | - }else { |
|
258 | + } else { |
|
253 | 259 | $sql .= ' WHERE'; |
254 | 260 | } |
255 | 261 | $sql .= ' user_id = '.intval($user_id); |
@@ -267,7 +273,7 @@ discard block |
||
267 | 273 | if (isset ($category_id)) { |
268 | 274 | if ($paramcount != 0) { |
269 | 275 | $sql .= ' AND'; |
270 | - }else { |
|
276 | + } else { |
|
271 | 277 | $sql .= ' WHERE'; |
272 | 278 | } |
273 | 279 | $sql .= ' category_id = '.intval($category_id); |