Skip to content

Commit

Permalink
Fix reporting.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontoyaa committed Mar 12, 2015
1 parent b540f82 commit 391fa4f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions main/survey/survey.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -849,11 +849,12 @@ public static function get_questions($survey_id, $course_id = '')
$tbl_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION);
$table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION);

if (empty($course_id))
{
if (empty($course_id)) {
$course_id = api_get_course_int_id();
}

$return = array();

// Getting the information of the question
$sql = "SELECT * FROM $tbl_survey_question
WHERE c_id = $course_id AND survey_id='".intval($survey_id)."'";
Expand All @@ -872,7 +873,6 @@ public static function get_questions($survey_id, $course_id = '')
$sql = "SELECT * FROM $table_survey_question_option
WHERE c_id = $course_id AND survey_id='".intval($survey_id)."'";
$result = Database::query($sql);
$return = array();
while ($row = Database::fetch_array($result, 'ASSOC')) {
$return[$row['question_id']]['answers'][] = $row['option_text'];
}
Expand Down Expand Up @@ -2640,8 +2640,9 @@ public static function handle_reporting_actions($survey_data, $people_filled)
$temp_questions_data = survey_manager::get_questions($_GET['survey_id']);

// Sorting like they should be displayed and removing the non-answer question types (comment and pagebreak)
$my_temp_questions_data = ($temp_questions_data==null) ? array() : $temp_questions_data;
$my_temp_questions_data = $temp_questions_data == null ? array() : $temp_questions_data;
$questions_data = array();

foreach ($my_temp_questions_data as $key => & $value) {
if ($value['type'] != 'comment' && $value['type'] != 'pagebreak') {
$questions_data[$value['sort']] = $value;
Expand Down

0 comments on commit 391fa4f

Please sign in to comment.