You are here

public function CourseObjectQuiz::getWarnings in Course 7

Same name and namespace in other branches
  1. 6 modules/course_quiz/course_quiz.classes.inc \CourseObjectQuiz::getWarnings()
  2. 7.2 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 92

Class

CourseObjectQuiz

Code

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