fix for MDL-11692. There were notices about subquestions not being defined. This seems to indicate that there is a problem elsewhere that somehow matching questions without subquestions are in the site db. But suppressed the notice by testing to see if subquestions is set before looping through the questions.

This commit is contained in:
jamiesensei 2007-10-10 15:23:24 +00:00
parent ba4418ad4e
commit 6f9ce92696

View File

@ -650,15 +650,18 @@ class question_match_qtype extends default_questiontype {
function find_file_links($question, $courseid){
// find links in the question_match_sub table.
$urls = array();
foreach ($question->options->subquestions as $subquestion) {
$urls += question_find_file_links_from_html($subquestion->questiontext, $courseid);
}
if (isset($question->options->subquestions)){
foreach ($question->options->subquestions as $subquestion) {
$urls += question_find_file_links_from_html($subquestion->questiontext, $courseid);
}
//set all the values of the array to the question object
if ($urls){
$urls = array_combine(array_keys($urls), array_fill(0, count($urls), array($question->id)));
//set all the values of the array to the question object
if ($urls){
$urls = array_combine(array_keys($urls), array_fill(0, count($urls), array($question->id)));
}
}
$urls = array_merge_recursive($urls, parent::find_file_links($question, $courseid));
return $urls;
}