浏览代码

[svn r14910] Fixed bug not ordering questions correctly in survey export (see FS#2466)

Yannick Warnier 17 年之前
父节点
当前提交
d517cde6c7
共有 2 个文件被更改,包括 8 次插入5 次删除
  1. 1 1
      documentation/changelog.html
  2. 7 4
      main/survey/survey.lib.php

+ 1 - 1
documentation/changelog.html

@@ -44,7 +44,7 @@
 	<li>Prerequisites management in learning paths fixed (includes quizzes, hotpotatoes and SCORM)</li>
 	<li>Various minor bugs fixed in the learning path tool (scoring, copy, re-ordering)</li>
 	<li>Various minor bugs fixed in the session handling</li>
-	<li>Fixes to the survey tool (date management)</li>
+	<li>Fixes to the survey tool (date management, questions order in export)</li>
 	<li>Fixes to the calendar tool (access by students)</li>
 	<li>Fixes to the announcement tool (access by students)</li>
 	<li>Fixes to the group tool (default group settings)</li>

+ 7 - 4
main/survey/survey.lib.php

@@ -23,7 +23,7 @@ $config['survey']['debug'] = false;
 /**
 *	@package dokeos.survey
 * 	@author Patrick Cool <patrick.cool@UGent.be>, Ghent University: cleanup, refactoring and rewriting large parts (if not all) of the code
-* 	@version $Id: survey.lib.php 14822 2008-04-10 04:44:54Z yannoo $
+* 	@version $Id: survey.lib.php 14910 2008-04-15 21:36:21Z yannoo $
 *
 * 	@todo move this file to inc/lib
 * 	@todo use consistent naming for the functions (save vs store for instance)
@@ -2462,7 +2462,8 @@ class SurveyUtil {
 				ON questions.question_id = options.question_id
 				WHERE questions.question_id = options.question_id
 				AND questions.survey_id = '".Database::escape_string($_GET['survey_id'])."'
-				GROUP BY questions.question_id";
+				GROUP BY questions.question_id 
+				ORDER BY questions.sort ASC";
 		$result = api_sql_query($sql, __FILE__, __LINE__);
 		while ($row = Database::fetch_array($result))
 		{
@@ -2678,7 +2679,8 @@ class SurveyUtil {
 				FROM $table_survey_question questions LEFT JOIN $table_survey_question_option options
 				ON questions.question_id = options.question_id "
 				." AND questions.survey_id = '".Database::escape_string($_GET['survey_id'])."'
-				GROUP BY questions.question_id";
+				GROUP BY questions.question_id "
+				." ORDER BY questions.sort ASC";
 		$result = api_sql_query($sql, __FILE__, __LINE__);
 		while ($row = Database::fetch_array($result))
 		{
@@ -2871,7 +2873,8 @@ class SurveyUtil {
 				FROM $table_survey_question questions LEFT JOIN $table_survey_question_option options
 				ON questions.question_id = options.question_id "
 				." AND questions.survey_id = '".Database::escape_string($_GET['survey_id'])."'
-				GROUP BY questions.question_id";
+				GROUP BY questions.question_id "
+				." ORDER BY questions.sort ASC";
 		$result = api_sql_query($sql, __FILE__, __LINE__);
 		while ($row = Database::fetch_array($result))
 		{