diff --git a/public/main/exercise/Annotation.php b/public/main/exercise/Annotation.php index 3bb834d77a..5ca9e0391c 100644 --- a/public/main/exercise/Annotation.php +++ b/public/main/exercise/Annotation.php @@ -1,4 +1,5 @@ - '. sprintf(get_lang('Incorrect answers: %s'), $nbResponsesInc).' - '. sprintf(get_lang('Ignorance: %s'), $nbResponsesIng).' - '. sprintf(get_lang('Correct answers: %s'), $nbResponsesCor).' @@ -1147,8 +1146,8 @@ class MultipleAnswerTrueFalseDegreeCertainty extends Question $tblAnswerOption = Database::get_course_table(TABLE_QUIZ_QUESTION_OPTION); $courseId = api_get_course_int_id(); $optionId = (int) $optionId; - $sql = "SELECT position - FROM $tblAnswerOption + $sql = "SELECT position + FROM $tblAnswerOption WHERE c_id = $courseId AND id = $optionId"; $res = Database::query($sql); @@ -1232,7 +1231,7 @@ class MultipleAnswerTrueFalseDegreeCertainty extends Question $tableTrackEExercise = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); $exeId = (int) $exeId; - $sql = "SELECT exe_exo_id + $sql = "SELECT exe_exo_id FROM $tableTrackEExercise WHERE exe_id=".$exeId; $res = Database::query($sql); diff --git a/public/main/exercise/ReadingComprehension.php b/public/main/exercise/ReadingComprehension.php index 669585acc3..5df7b7b2f7 100644 --- a/public/main/exercise/ReadingComprehension.php +++ b/public/main/exercise/ReadingComprehension.php @@ -1,4 +1,5 @@ 'btn btn-secondary', 'icon' => 'fa fa-pen'] + ['class' => 'btn btn-secondary', 'icon' => 'fa fa-pen', 'title' => get_lang('Edit')] ); $myRowAction->setRouteParameters( diff --git a/public/main/exercise/exercise_admin.php b/public/main/exercise/exercise_admin.php index eec5ffc26e..98f73e4898 100644 --- a/public/main/exercise/exercise_admin.php +++ b/public/main/exercise/exercise_admin.php @@ -200,7 +200,7 @@ if ($form->validate()) { Display::return_icon('back.png', get_lang("Back to").' '.get_lang('Learning paths'), '', ICON_SIZE_MEDIUM).""; } else { echo ''. - Display::return_icon('back.png', get_lang('Back toTestsList'), '', ICON_SIZE_MEDIUM). + Display::return_icon('back.png', get_lang('Back to test list'), '', ICON_SIZE_MEDIUM). ''; } } diff --git a/public/main/exercise/fill_blanks.class.php b/public/main/exercise/fill_blanks.class.php index 5096ee97da..6beb3c9c47 100644 --- a/public/main/exercise/fill_blanks.class.php +++ b/public/main/exercise/fill_blanks.class.php @@ -1,4 +1,5 @@ - var firstTime = true; - var originalOrder = new Array(); + echo ''; // answer @@ -889,15 +890,15 @@ class FillBlanks extends Question // we got the less recent attempt first $sql = 'SELECT * FROM '.$tblTrackEAttempt.' tea LEFT JOIN '.$tblTrackEExercise.' tee - ON - tee.exe_id = tea.exe_id AND - tea.c_id = '.$courseId.' AND - exe_exo_id = '.$testId.' - WHERE - tee.c_id = '.$courseId.' AND - question_id = '.$questionId.' AND - tea.user_id IN ('.implode(',', $studentsIdList).') AND - tea.tms >= "'.$startDate.'" AND + ON + tee.exe_id = tea.exe_id AND + tea.c_id = '.$courseId.' AND + exe_exo_id = '.$testId.' + WHERE + tee.c_id = '.$courseId.' AND + question_id = '.$questionId.' AND + tea.user_id IN ('.implode(',', $studentsIdList).') AND + tea.tms >= "'.$startDate.'" AND tea.tms <= "'.$endDate.'" ORDER BY user_id, tea.exe_id; '; @@ -1256,8 +1257,8 @@ class FillBlanks extends Question } if ($hideExpectedAnswer) { - $correctAnswerHtml = ""; } diff --git a/public/main/exercise/freeanswer.class.php b/public/main/exercise/freeanswer.class.php index fd2724a6dd..b33bf5125f 100644 --- a/public/main/exercise/freeanswer.class.php +++ b/public/main/exercise/freeanswer.class.php @@ -1,4 +1,5 @@ 0) { @@ -911,8 +911,8 @@ abstract class Question $sql = "UPDATE $table SET question_order = question_order-1 WHERE - c_id = $courseId AND - exercice_id = $exerciseId AND + c_id = $courseId AND + exercice_id = $exerciseId AND question_order > ".$row['question_order']; Database::query($sql); } @@ -920,8 +920,8 @@ abstract class Question $sql = "DELETE FROM $table WHERE - c_id = $courseId AND - question_id = $id AND + c_id = $courseId AND + question_id = $id AND exercice_id = $exerciseId"; Database::query($sql); @@ -962,7 +962,7 @@ abstract class Question // if the question must be removed from all exercises if (!$deleteFromEx) { //update the question_order of each question to avoid inconsistencies - $sql = "SELECT exercice_id, question_order + $sql = "SELECT exercice_id, question_order FROM $TBL_EXERCISE_QUESTION WHERE c_id = $courseId AND question_id = ".$id; @@ -973,8 +973,8 @@ abstract class Question $sql = "UPDATE $TBL_EXERCISE_QUESTION SET question_order = question_order-1 WHERE - c_id = $courseId AND - exercice_id = ".intval($row['exercice_id'])." AND + c_id = $courseId AND + exercice_id = ".intval($row['exercice_id'])." AND question_order > ".$row['question_order']; Database::query($sql); } @@ -995,8 +995,8 @@ abstract class Question // remove the category of this question in the question_rel_category table $sql = "DELETE FROM $TBL_QUIZ_QUESTION_REL_CATEGORY - WHERE - c_id = $courseId AND + WHERE + c_id = $courseId AND question_id = ".$id; Database::query($sql); @@ -1098,7 +1098,7 @@ abstract class Question $newQuestionId = Database::insert($questionTable, $params); if ($newQuestionId) { - $sql = "UPDATE $questionTable + $sql = "UPDATE $questionTable SET id = iid WHERE iid = $newQuestionId"; Database::query($sql); @@ -1112,7 +1112,7 @@ abstract class Question unset($item['iid']); $id = Database::insert($TBL_QUESTION_OPTIONS, $item); if ($id) { - $sql = "UPDATE $TBL_QUESTION_OPTIONS + $sql = "UPDATE $TBL_QUESTION_OPTIONS SET id = iid WHERE iid = $id"; Database::query($sql); @@ -1760,7 +1760,7 @@ abstract class Question // Get the max position $sql = "SELECT max(position) as max_position - FROM $tbl_quiz_question q + FROM $tbl_quiz_question q INNER JOIN $tbl_quiz_rel_question r ON q.id = r.question_id AND @@ -1783,7 +1783,7 @@ abstract class Question $question_id = Database::insert($tbl_quiz_question, $params); if ($question_id) { - $sql = "UPDATE $tbl_quiz_question + $sql = "UPDATE $tbl_quiz_question SET id = iid WHERE iid = $question_id"; Database::query($sql); @@ -1816,7 +1816,7 @@ abstract class Question */ public function getExplanation() { - return $this->explanationLangVar; + return get_lang($this->explanationLangVar); } /** @@ -2059,10 +2059,10 @@ abstract class Question $result = $em ->createQuery(' - SELECT e + SELECT e FROM ChamiloCourseBundle:CQuizRelQuestion qq - JOIN ChamiloCourseBundle:CQuiz e - WHERE e.iid = qq.exerciceId AND qq.questionId = :id + JOIN ChamiloCourseBundle:CQuiz e + WHERE e.iid = qq.exerciceId AND qq.questionId = :id ') ->setParameters(['id' => (int) $this->id]) ->getResult(); diff --git a/public/main/exercise/question_admin.inc.php b/public/main/exercise/question_admin.inc.php index b30d724ae2..0855faae8b 100644 --- a/public/main/exercise/question_admin.inc.php +++ b/public/main/exercise/question_admin.inc.php @@ -1,4 +1,5 @@ getQuestionForTeacher($start, $length); $paginator = new Knp\Component\Pager\Paginator(); $pagination = $paginator->paginate([]); - $pagination->setTotalItemCount($nbrQuestions); $pagination->setItemNumberPerPage($length); $pagination->setCurrentPageNumber($page); @@ -305,18 +302,17 @@ if (!$inATest) { '.$move.' '.cut($title, 42).' '; - // Question type - $typeImg = $objQuestionTmp->getTypePicture(); - $typeExpl = $objQuestionTmp->getExplanation(); - - $questionType = Display::return_icon($typeImg, $typeExpl); + $questionType = Display::return_icon( + $objQuestionTmp->getTypePicture(), + $objQuestionTmp->getExplanation() + ); // Question category - $txtQuestionCat = Security::remove_XSS( + $questionCategory = Security::remove_XSS( TestCategory::getCategoryNameForQuestion($objQuestionTmp->id) ); - if (empty($txtQuestionCat)) { - $txtQuestionCat = '-'; + if (empty($questionCategory)) { + $questionCategory = '-'; } // Question level @@ -340,9 +336,9 @@ if (!$inATest) { '.get_lang('Type').' ' .$questionType.' -
+
'.get_lang('Category').' ' - .cut($txtQuestionCat, 42).' + .cut($questionCategory, 42).'
'.get_lang('Difficulty').' ' diff --git a/public/main/exercise/unique_answer.class.php b/public/main/exercise/unique_answer.class.php index 3c791750f4..269483d04a 100644 --- a/public/main/exercise/unique_answer.class.php +++ b/public/main/exercise/unique_answer.class.php @@ -18,7 +18,7 @@ use ChamiloSession as Session; class UniqueAnswer extends Question { public $typePicture = 'mcua.png'; - public $explanationLangVar = 'UniqueSelect'; + public $explanationLangVar = 'Multiple choice'; /** * Constructor. diff --git a/public/main/exercise/unique_answer_no_option.class.php b/public/main/exercise/unique_answer_no_option.class.php index 3987332f42..9b12e8b3ce 100644 --- a/public/main/exercise/unique_answer_no_option.class.php +++ b/public/main/exercise/unique_answer_no_option.class.php @@ -1,4 +1,5 @@