diff --git a/main/exercise/ReadingComprehension.php b/main/exercise/ReadingComprehension.php index 633c85754c..df8ca67356 100755 --- a/main/exercise/ReadingComprehension.php +++ b/main/exercise/ReadingComprehension.php @@ -113,4 +113,13 @@ class ReadingComprehension extends UniqueAnswer $this->displayReading($this->wordsCount, $turns, $text); } + /** + * Returns total count of words of the text to read + * @return int + */ + public function getWordsCount() { + $words = str_word_count($this->selectDescription(), 2, '0..9'); + $this->wordsCount = count($words); + return $this->wordsCount; + } } diff --git a/main/exercise/question.class.php b/main/exercise/question.class.php index da34aa04da..86156e8fda 100755 --- a/main/exercise/question.class.php +++ b/main/exercise/question.class.php @@ -1913,11 +1913,11 @@ abstract class Question $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); + $message = Display::div(sprintf(get_lang('ReadingQuestionCongratsSpeedXReachedForYWords'), $this->speeds[$this->level], $this->getWordsCount())); } else { - $message = Display::div(get_lang('ReadingQuestionCongratsSpeedXNotReachedForYWords'), $this->speeds[$this->level], $this->wordsCount); + $message = Display::div(sprintf(get_lang('ReadingQuestionCongratsSpeedXNotReachedForYWords'), $this->speeds[$this->level], $this->getWordsCount())); } - $header .= $message; + $header .= $message.'
'; } return $header;