Hide question description in results of READING_COMPREHENSION question type and fix issue not showing results table - refs #1896

pull/2487/head
Yannick Warnier 8 years ago
parent 5886dc436d
commit abfea6f87a
  1. 7
      main/exercise/ReadingComprehension.php
  2. 3
      main/exercise/exercise.class.php
  3. 2
      main/exercise/exercise_show.php
  4. 13
      main/exercise/question.class.php

@ -34,7 +34,7 @@ class ReadingComprehension extends UniqueAnswer
* text to read)
* @var int $wordsCount
*/
private $wordsCount = 0;
public $wordsCount = 0;
/**
* Number of words expected to show per refresh
* @var int
@ -86,9 +86,10 @@ class ReadingComprehension extends UniqueAnswer
$tagEnd = '</span>';
$tagStart = $tagEnd.'<span class="text-highlight blur">';
$this->wordsCount = count($words);
$turns = ceil(
count($words) / $this->expectedWordsPerRefresh
$this->wordsCount / $this->expectedWordsPerRefresh
);
$firstIndex = $indexes[0];
@ -110,6 +111,6 @@ class ReadingComprehension extends UniqueAnswer
$text = substr_replace($text, '', $pos, strlen($tagEnd));
$text .= $tagEnd;
$this->displayReading(count($words), $turns, $text);
$this->displayReading($this->wordsCount, $turns, $text);
}
}

@ -4205,7 +4205,8 @@ class Exercise
UNIQUE_ANSWER_NO_OPTION,
MULTIPLE_ANSWER,
MULTIPLE_ANSWER_COMBINATION,
GLOBAL_MULTIPLE_ANSWER
GLOBAL_MULTIPLE_ANSWER,
READING_COMPREHENSION,
)
)
) {

@ -396,6 +396,8 @@ foreach ($questionList as $questionId) {
//no break
case DRAGGABLE:
//no break
case READING_COMPREHENSION:
//no break
case MATCHING_DRAGGABLE:
$question_result = $objExercise->manage_answer(
$id,

@ -1869,6 +1869,7 @@ abstract class Question
* @param string $feedback_type
* @param int $counter
* @param float $score
* @return string HTML string with the header of the question (before the answers table)
*/
function return_header($feedback_type = null, $counter = null, $score = null)
{
@ -1907,7 +1908,17 @@ abstract class Question
"<div class=\"rib rib-$class\"><h3>$score_label</h3></div> <h4>{$score['result']}</h4>",
array('class' => 'ribbon')
);
$header .= Display::div($this->description, array('class' => 'question_description'));
if ($this->type != READING_COMPREHENSION) {
// Do not show the description (the text to read) if the question is of type READING_COMPREHENSION
$header .= Display::div($this->description, array('class' => 'question_description'));
} else {
if ($score['pass'] == true) {
$message = Display::div(get_lang('ReadingQuestionCongratsSpeedXReachedForYWords'), $this->speeds[$this->level], $this->wordsCount);
} else {
$message = Display::div(get_lang('ReadingQuestionCongratsSpeedXNotReachedForYWords'), $this->speeds[$this->level], $this->wordsCount);
}
$header .= $message;
}
return $header;
}

Loading…
Cancel
Save