MDL-20636 Fix bug with starting an attempt. Now uses exceptions, so should not check return values.

This commit is contained in:
Tim Hunt 2011-02-12 00:40:43 +00:00
parent 2709ee45d3
commit a8a8ec51fc
2 changed files with 7 additions and 14 deletions

View File

@ -849,7 +849,6 @@ function question_load_questions($questionids, $extrafields = '', $join = '') {
*
* @param object $question the question to tidy.
* @param boolean $loadtags load the question tags from the tags table. Optional, default false.
* @return boolean true if successful, else false.
*/
function _tidy_question($question, $loadtags = false) {
global $CFG, $QTYPES;
@ -857,16 +856,14 @@ function _tidy_question($question, $loadtags = false) {
$question->qtype = 'missingtype';
$question->questiontext = '<p>' . get_string('warningmissingtype', 'quiz') . '</p>' . $question->questiontext;
}
if ($success = $QTYPES[$question->qtype]->get_question_options($question)) {
if (isset($question->_partiallyloaded)) {
unset($question->_partiallyloaded);
}
$QTYPES[$question->qtype]->get_question_options($question);
if (isset($question->_partiallyloaded)) {
unset($question->_partiallyloaded);
}
if ($loadtags && !empty($CFG->usetags)) {
require_once($CFG->dirroot . '/tag/lib.php');
$question->tags = tag_get_tags_array('question', $question->id);
}
return $success;
}
/**
@ -884,14 +881,12 @@ function _tidy_question($question, $loadtags = false) {
function get_question_options(&$questions, $loadtags = false) {
if (is_array($questions)) { // deal with an array of questions
foreach ($questions as $i => $notused) {
if (!_tidy_question($questions[$i], $loadtags)) {
return false;
}
_tidy_question($questions[$i], $loadtags);
}
return true;
} else { // deal with single question
return _tidy_question($questions, $loadtags);
_tidy_question($questions, $loadtags);
}
return true;
}
/**

View File

@ -151,9 +151,7 @@ class quiz {
$questionstoprocess[$id] = $this->questions[$id];
}
}
if (!get_question_options($questionstoprocess)) {
throw new moodle_quiz_exception($this, 'loadingquestionsfailed', implode(', ', $questionids));
}
get_question_options($questionstoprocess);
}
// Simple getters ======================================================================