diff --git a/lib/general.php b/lib/general.php index 953943c..7def8e2 100644 --- a/lib/general.php +++ b/lib/general.php @@ -1013,6 +1013,18 @@ function sloodle_clean_for_output($str) return sloodle_strip_new_lines(strip_tags(stripcslashes(@html_entity_decode($str, ENT_QUOTES, 'UTF-8')))); } + /** + * Returns the src of the first tag found in the html + * @param string str The string to clean. + * @return string + */ + function sloodle_extract_first_image_url($html) { + if (preg_match("/layout, $pagelist); foreach ($pagequestions as $i) { + $options = quiz_get_renderoptions($quiz->review, $states[$i]); // Print the question // var_dump($questions[$i]); @@ -433,7 +434,8 @@ $q->maxgrade, $q->single, $shuffleanswers, - 0 //$deferred // This variable doesn't seem to be mentioned anywhere else in the file + 0, //$deferred // This variable doesn't seem to be mentioned anywhere else in the file + sloodle_extract_first_image_url($q->questiontext) ); // Create an output array for our options (available answers) so that we can shuffle them later if necessary @@ -451,7 +453,9 @@ $ov->question, sloodle_clean_for_output($ov->answer), $ov->fraction, - sloodle_clean_for_output($ov->feedback) + sloodle_clean_for_output($ov->feedback), + sloodle_extract_first_image_url($ov->answer), + sloodle_extract_first_image_url($ov->feedback) ); } } @@ -466,6 +470,7 @@ $number += $questions[$i]->length; } + $secondsleft = ($quiz->timeclose ? $quiz->timeclose : 999999999999) - time(); //if ($isteacher) { // // For teachers ignore the quiz closing time