function qformat_learnwise::readquestions in Quiz 6.5
Same name and namespace in other branches
- 6.6 includes/moodle/question/format/learnwise/format.php \qformat_learnwise::readquestions()
Parses an array of lines into an array of questions, where each item is a question object as defined by readquestion(). Questions are defined as anything between blank lines.
If your format does not use blank lines as a delimiter then you will need to override this method. Even then try to use readquestion for each question
Parameters
array lines array of lines from readdata:
Return value
array array of question objects
Overrides qformat_default::readquestions
File
- includes/
moodle/ question/ format/ learnwise/ format.php, line 19
Class
- qformat_learnwise
- @package questionbank @subpackage importexport
Code
function readquestions($lines) {
$questions = array();
$currentquestion = array();
foreach ($lines as $line) {
$line = trim($line);
$currentquestion[] = $line;
if ($question = $this
->readquestion($currentquestion)) {
$questions[] = $question;
$currentquestion = array();
}
}
return $questions;
}