diff --git a/main/exercise/exercise.class.php b/main/exercise/exercise.class.php index 4e61021174..ad02b271ce 100755 --- a/main/exercise/exercise.class.php +++ b/main/exercise/exercise.class.php @@ -6921,885 +6921,6 @@ class Exercise } } - /** - * Shows a question - * @param Question $objQuestionTmp - * @param bool $only_questions if true only show the questions, no exercise title - * @param bool $origin origin i.e = learnpath - * @param string $current_item current item from the list of questions - * @param bool $show_title - * @param bool $freeze - * @param array $user_choice - * @param bool $show_comment - * @param null $exercise_feedback - * @param bool $show_answers - * @param null $modelType - * @param bool $categoryMinusOne - * @return bool|null|string - */ - public function showQuestion( - Question $objQuestionTmp, - $only_questions = false, - $origin = false, - $current_item = '', - $show_title = true, - $freeze = false, - $user_choice = array(), - $show_comment = false, - $exercise_feedback = null, - $show_answers = false, - $modelType = null, - $categoryMinusOne = true - ) { - // Text direction for the current language - // Change false to true in the following line to enable answer hinting - $debug_mark_answer = $show_answers; //api_is_allowed_to_edit() && false; - // Reads question information - if (!$objQuestionTmp) { - // Question not found - return false; - } - - $html = null; - $questionId = $objQuestionTmp->id; - if ($exercise_feedback != EXERCISE_FEEDBACK_TYPE_END) { - $show_comment = false; - } - - $answerType = $objQuestionTmp->selectType(); - $pictureName = $objQuestionTmp->selectPicture(); - - $s = null; - $form = new FormValidator('question'); - $renderer = $form->defaultRenderer(); - $form_template = '{content}'; - $renderer->setFormTemplate($form_template); - - if ($answerType != HOT_SPOT && $answerType != HOT_SPOT_DELINEATION) { - // Question is not a hotspot - if (!$only_questions) { - $questionDescription = $objQuestionTmp->selectDescription(); - if ($show_title) { - $categoryName = TestCategory::getCategoryNamesForQuestion($objQuestionTmp->id, null, true, $categoryMinusOne); - $html .= $categoryName; - $html .= Display::div($current_item.'. '.$objQuestionTmp->selectTitle(), array('class' => 'question_title')); - if (!empty($questionDescription)) { - $html .= Display::div($questionDescription, array('class' => 'question_description')); - } - } else { - $html .= '
| '; - $s .= $answer_input; - $s .= ' | '; - $s .= ''; - $s .= $comment; - $s .= ' | '; - $s .= '|
| '; - $s .= $answer_input; - $s .= ' | '; - $s .= ''; - $s .= $comment; - $s .= ' | '; - $s .='|
| '; - $s .= $comment; - $s .= ' | '; - } - $s.='||
| '; - $s.= $answer_input; - $s .= ' | '; - $s .= ''; - $s .= $comment; - $s .= ' | '; - $s.= '|
| '; - $s .= $comment; - $s .= ' | '; - } - $s.='||
| ';
- $parsed_answer = $answer;
- $windowId = $questionId.'_'.$lines_count;
- // Left part questions
- $s .= '
- '.$lines_count.'. '.$parsed_answer.'
-
- | ';
- // Middle part (matches selects)
- $s .= ' ';
- $s .= ' ';
- $s .= ' | ';
- $s.='';
- if (isset($select_items[$lines_count])) {
- $s.= '
- '.$select_items[$lines_count]['letter'].'. '.$select_items[$lines_count]['answer'].'
- ';
- } else {
- $s.=' ';
- }
-
- $s .= ' | ';
- $s .= '
| - | '; - $s.=''.$select_items[$lines_count]['letter'].'.'; - $s .= $select_items[$lines_count]['answer']; - $s.=" | -';
- $parsed_answer = $answer;
- $windowId = $questionId.'_'.$numAnswer; //67_293 - 67_294
-
- //left part questions
- $s .= '
- '.$parsed_answer.'
- ';
-
- $s .= '';
- $s .= '';
-
- if (!empty($answerCorrect) && !empty($selectedValue)) {
- $s.= '';
- }
-
- if (isset($select_items[$lines_count])) {
- $s.= ' ';
- $matching_correct_answer++;
- $s .= '
- '.$select_items[$lines_count]['letter'].'. '.$select_items[$lines_count]['answer'].'
- ';
- } else {
- $s.=' ';
- }
- $lines_count++;
- //if the left side of the "matching" has been completely
- // shown but the right side still has values to show...
-
- if (($lines_count - 1) == $num_suggestions) {
- // if it remains answers to shown at the right side
- while (isset($select_items[$lines_count])) {
- $s.=''.$select_items[$lines_count]['letter'].'.';
- $s .= $select_items[$lines_count]['answer'];
- $lines_count++;
- }
- }
- $s .= ' |
| '; - $html .= ' | |||
| |||