Browse Source

Fixed In survey when not there quiz show in a preview a warning DT#5496

Arthur Portugal 15 years ago
parent
commit
3ddabf3c6b
1 changed files with 5 additions and 7 deletions
  1. 5 7
      main/survey/preview.php

+ 5 - 7
main/survey/preview.php

@@ -114,6 +114,7 @@ if (api_is_course_admin() || (api_is_course_admin() && $_GET['isStudentView']=='
 		// Getting all the questions for this page and add them to a multidimensional array where the first index is the page.
 		// as long as there is no pagebreak fount we keep adding questions to the page
 		$questions_displayed = array();
+		$paged_questions = array();
 		$counter = 0;
 		$sql = "SELECT * FROM $table_survey_question
 			WHERE survey_id = '".Database::escape_string($survey_id)."'
@@ -122,17 +123,14 @@ if (api_is_course_admin() || (api_is_course_admin() && $_GET['isStudentView']=='
 
 		while ($row = Database::fetch_array($result))
 		{
-			if($row['type'] == 'pagebreak')
-			{
+			if($row['type'] == 'pagebreak') {
 				$counter++;
-			}
-			else
-			{
+			} else {
 				$paged_questions[$counter][] = $row['question_id'];
-			}
+					}
 		}
 
-		if (key_exists($_GET['show'],$paged_questions))
+		if (array_key_exists($_GET['show'], $paged_questions))
 		{
 			$sql = "SELECT 	survey_question.question_id, survey_question.survey_id, survey_question.survey_question, survey_question.display, survey_question.sort, survey_question.type, survey_question.max_value,
 							survey_question_option.question_option_id, survey_question_option.option_text, survey_question_option.sort as option_sort