You are here

public function CourseObjectQuiz::getWarnings in Course 6

Same name and namespace in other branches
  1. 7.2 modules/course_quiz/course_quiz.classes.inc \CourseObjectQuiz::getWarnings()
  2. 7 modules/course_quiz/course_quiz.classes.inc \CourseObjectQuiz::getWarnings()

Let the user know if they have a Quiz without questions.

Overrides CourseObjectNode::getWarnings

File

modules/course_quiz/course_quiz.classes.inc, line 83

Class

CourseObjectQuiz

Code

public function getWarnings() {
  $warnings = parent::getWarnings();
  if ($this
    ->getInstanceId()) {
    if (!quiz_get_number_of_questions($this->node->vid)) {
      $warnings[] = t('This Quiz does not have any questions. Please !link.', array(
        '!link' => l('add questions', "node/{$this->getInstanceId()}/questions"),
      ));
    }
  }
  return $warnings;
}