/** * Determins if there is an interactive question (e.g. image hotspot, labelling, * area) on a particular screen of a paper. Speeds system up if not loading * unnecessary HTML5/Flash include files. * @param array $screen_data Array of screen/question information * @param array $screen The screen number to check * @return bool True = HTML5 or Flash neeed, False=no interactive questions found. */ function need_interactiveQ($screen_data, $screen, $db) { $interactive = false; $checktypes = array('hotspot', 'labelling', 'area'); if (isset($screen_data[$screen])) { foreach ($screen_data[$screen] as $question_part) { if (in_array($question_part[0], $checktypes)) { $interactive = true; } else { if ($question_part[0] == 'random') { $options = QuestionUtils::get_options_text($question_part[1], $db); $types = array(); foreach ($options as $opt) { $qtype = QuestionUtils::get_question_type($opt, $db); $types[] = $qtype; } foreach ($types as $t) { if (in_array($t, $checktypes)) { $interactive = true; break; } } } else { if ($question_part[0] == 'keyword_based') { $options = QuestionUtils::get_options_text($question_part[1], $db); foreach ($options as $opt) { $keywords = keyword_utils::get_keyword_questions($opt, $db); $types = array(); foreach ($keywords as $key) { $qtype = QuestionUtils::get_question_type($key, $db); $types[] = $qtype; } } foreach ($types as $t) { if (in_array($t, $checktypes)) { $interactive = true; break; } } } } } } } return $interactive; }