You are here

function qformat_default::count_questions in Quiz 6.5

Same name and namespace in other branches
  1. 6.6 includes/moodle/question/format.php \qformat_default::count_questions()

Count all non-category questions in the questions array.

Parameters

array questions An array of question objects.:

Return value

int The count.

1 call to qformat_default::count_questions()
qformat_default::importprocess in includes/moodle/question/format.php
Process the file This method should not normally be overidden

File

includes/moodle/question/format.php, line 351

Class

qformat_default
Base class for question import and export formats.

Code

function count_questions($questions) {
  $count = 0;
  if (!is_array($questions)) {
    return $count;
  }
  foreach ($questions as $question) {
    if (!is_object($question) || !isset($question->qtype) || $question->qtype == 'category') {
      continue;
    }
    $count++;
  }
  return $count;
}