Guillaume Viguier 15 gadi atpakaļ
vecāks
revīzija
dcc7053697

+ 2 - 1
main/survey/fillsurvey.php

@@ -1205,7 +1205,8 @@ if(isset($questions) && is_array($questions))
 {
 	foreach ($questions as $key=>$question)
 	{
-		$display = new $question['type'];
+		$ch_type = 'ch_'.$question['type'];
+		$display = new $ch_type;
 		$display->render_question($question);
 	}
 }

+ 3 - 2
main/survey/preview.php

@@ -186,7 +186,8 @@ if (api_is_course_admin() || (api_is_course_admin() && $_GET['isStudentView']=='
 	{
 		foreach ($questions as $key=>$question)
 		{
-			$display = new $question['type'];
+			$ch_type = 'ch_'.$question['type'];
+			$display = new $ch_type;
 			$display->render_question($question);
 		}
 	}
@@ -208,4 +209,4 @@ if (api_is_course_admin() || (api_is_course_admin() && $_GET['isStudentView']=='
 }
 
 // Footer
-Display :: display_footer();
+Display :: display_footer();

+ 3 - 2
main/survey/question.php

@@ -140,7 +140,8 @@ if (empty($_POST['save_question']) && in_array($_GET['type'],$possible_types)) {
 			}
 		}
 	}
-	$form = new $_GET['type'];
+	$ch_type = 'ch_'.$_GET['type'];
+	$form = new $ch_type;
 
 	// The defaults values for the form
 	$form_content['answers'] = array('', '');
@@ -192,7 +193,7 @@ if (empty($_POST['save_question']) && in_array($_GET['type'],$possible_types)) {
 	$form->render_form();
 } else {
 	$form_content = $_POST;
-	$form = new question();
+	$form = new survey_question();
 	$form->handle_action($form_content);
 }
 

+ 12 - 11
main/survey/survey.lib.php

@@ -1327,7 +1327,7 @@ class survey_manager
 }
 
 
-class question
+class survey_question
 {
 	// the html code of the form
 	public $html;
@@ -1617,7 +1617,7 @@ class question
 	}
 }
 
-class yesno extends question
+class ch_yesno extends survey_question
 {
 	/**
 	 * This function creates the form elements for the yesno questions
@@ -1718,7 +1718,7 @@ class yesno extends question
 
 }
 
-class multiplechoice extends question
+class ch_multiplechoice extends survey_question
 {
 	/**
 	 * This function creates the form elements for the multiple choice questions
@@ -1807,7 +1807,7 @@ class multiplechoice extends question
 }
 
 
-class personality extends question
+class ch_personality extends survey_question
 {
 	/**
 	 * This function creates the form elements for the multiple response questions
@@ -1911,7 +1911,7 @@ class personality extends question
 
 
 
-class multipleresponse extends question
+class ch_multipleresponse extends survey_question
 {
 	/**
 	 * This function creates the form elements for the multiple response questions
@@ -2020,7 +2020,7 @@ class multipleresponse extends question
 	}
 }
 
-class dropdown extends question
+class ch_dropdown extends survey_question
 {
 	/**
 	 * This function creates the form elements for the dropdown questions
@@ -2108,7 +2108,7 @@ class dropdown extends question
 }
 
 
-class open extends question
+class ch_open extends survey_question
 {
 	/**
 	 * This function creates the form elements for the open questions
@@ -2151,7 +2151,8 @@ class open extends question
 	}
 }
 
-class comment extends question
+
+class ch_comment extends survey_question
 {
 	/**
 	 * This function creates the form elements for a comment.
@@ -2185,7 +2186,7 @@ class comment extends question
 	}
 }
 
-class pagebreak extends question
+class ch_pagebreak extends survey_question
 {
 	/**
 	 * This function creates the form elements for a comment.
@@ -2202,7 +2203,7 @@ class pagebreak extends question
 	}
 }
 
-class percentage extends question
+class ch_percentage extends survey_question
 {
 	function create_form($form_content)
 	{
@@ -2236,7 +2237,7 @@ class percentage extends question
 }
 
 
-class score extends question
+class ch_score extends survey_question
 {
 	function create_form($form_content)
 	{