From 1ee38bed4178024a9bd46eaddf3cfe4d4219b4de Mon Sep 17 00:00:00 2001 From: gbateson Date: Wed, 21 Sep 2005 11:51:07 +0000 Subject: [PATCH] when adding a "chain" of HotPots, check quiz specified in "Next" button has not already been added --- mod/hotpot/lib.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mod/hotpot/lib.php b/mod/hotpot/lib.php index fd7c675fa7f..862925588ce 100644 --- a/mod/hotpot/lib.php +++ b/mod/hotpot/lib.php @@ -403,6 +403,12 @@ function hotpot_add_chain(&$hp) { if ($hp->nextexercise) { $filepath = $xml_quiz->fileroot.'/'.$xml_quiz->filesubdir.$hp->nextexercise; + + // check file is not already in chain + $file = substr($filepath, $filerootlength); + if (in_array($file, $hp->files)) { + $filepath = ''; + } } else { $filepath = ''; } @@ -412,7 +418,7 @@ function hotpot_add_chain(&$hp) { $xml_quiz->filepath = false; // finish while loop } } // end while - + } else { $ok = false; $hp->errors['reference'] = get_string('error_notfileorfolder', 'hotpot', $hp->reference); @@ -624,7 +630,7 @@ function hotpot_get_titles_and_next_ex(&$hp, $filepath, $get_next=false) { $i = 0; while (($div="[$i]") && $xml_tree->xml_value($tags, $div)) { - + $id = $xml_tree->xml_value($tags, $div."['@']['id']"); if (isset($id) && $id=='TopNavBar') { @@ -641,7 +647,6 @@ function hotpot_get_titles_and_next_ex(&$hp, $filepath, $get_next=false) { } $i++; // increment DIV index } - } else if ($xml_tree->filetype=='xml') { $include = $xml_tree->xml_value('hotpot-config-file,global,include-next-ex');