Improve survey report BT#15553

pull/2913/head
Julio Montoya 6 years ago
parent ccd2f31789
commit 2d548727a0
  1. 18
      main/survey/survey.lib.php
  2. 420
      main/survey/surveyUtil.class.php

@ -2411,9 +2411,9 @@ class SurveyManager
$content = '';
if (empty($answered)) {
$content .= Display::page_subheader(get_lang('Answered'));
} else {
$content .= Display::page_subheader(get_lang('Unanswered'));
} else {
$content .= Display::page_subheader(get_lang('Answered'));
}
if (!empty($invitations)) {
@ -2448,8 +2448,22 @@ class SurveyManager
$sessionInfo = api_get_session_info($sessionId);
$courseInfo['name'] .= ' ('.$sessionInfo['name'].')';
}
$surveyData = SurveyManager::get_survey($survey->getSurveyId(), 0, $courseInfo['code']);
$table->setCellContents($row, 0, $title);
$table->setCellContents($row, 1, $courseInfo['name']);
if (!empty($answered) && $surveyData['anonymous'] == 0) {
$answers = SurveyUtil::displayCompleteReport(
$surveyData,
$userId,
false,
false
);
$table->setCellContents(++$row, 0, $answers);
$table->setCellContents(++$row, 1, '');
}
$row++;
}
$content .= $table->toHtml();

@ -250,13 +250,13 @@ class SurveyUtil
self::display_question_report($survey_data);
break;
case 'userreport':
self::display_user_report($people_filled, $survey_data);
self::displayUserReport($survey_data, $people_filled);
break;
case 'comparativereport':
self::display_comparative_report();
break;
case 'completereport':
self::display_complete_report($survey_data);
echo self::displayCompleteReport($survey_data);
break;
case 'deleteuserreport':
self::delete_user_report($_GET['survey_id'], $_GET['user']);
@ -313,58 +313,18 @@ class SurveyUtil
}
/**
* This function displays the user report which is basically nothing more
* than a one-page display of all the questions
* of the survey that is filled with the answers of the person who filled the survey.
*
* @return string html code of the one-page survey with the answers of the selected user
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @param array $survey_data
* @param array $people_filled
*
* @version February 2007 - Updated March 2008
* @return string
*/
public static function display_user_report($people_filled, $survey_data)
public static function displayUserReportForm($survey_data, $people_filled)
{
// Database table definitions
$table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
$table_survey_question_option = Database::get_course_table(TABLE_SURVEY_QUESTION_OPTION);
$table_survey_answer = Database::get_course_table(TABLE_SURVEY_ANSWER);
$surveyId = isset($_GET['survey_id']) ? (int) $_GET['survey_id'] : 0;
$surveyId = $survey_data['survey_id'];
// Actions bar
echo '<div class="actions">';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.$surveyId.'&'.api_get_cidreq().'">'.
Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('ReportingOverview'), '', ICON_SIZE_MEDIUM)
.'</a>';
if (isset($_GET['user'])) {
if (api_is_allowed_to_edit()) {
// The delete link
echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=deleteuserreport&survey_id='
.$surveyId.'&'.api_get_cidreq().'&user='.Security::remove_XSS($_GET['user']).'" >'.
Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_MEDIUM).'</a>';
}
// Export the user report
echo '<a href="javascript: void(0);" onclick="document.form1a.submit();">'
.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a> ';
echo '<a href="javascript: void(0);" onclick="document.form1b.submit();">'
.Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM).'</a> ';
echo '<form id="form1a" name="form1a" method="post" action="'.api_get_self().'?action='
.Security::remove_XSS($_GET['action']).'&survey_id='.$surveyId.'&'.api_get_cidreq().'&user_id='
.Security::remove_XSS($_GET['user']).'">';
echo '<input type="hidden" name="export_report" value="export_report">';
echo '<input type="hidden" name="export_format" value="csv">';
echo '</form>';
echo '<form id="form1b" name="form1b" method="post" action="'.api_get_self().'?action='
.Security::remove_XSS($_GET['action']).'&survey_id='.$surveyId.'&'.api_get_cidreq().'&user_id='
.Security::remove_XSS($_GET['user']).'">';
echo '<input type="hidden" name="export_report" value="export_report">';
echo '<input type="hidden" name="export_format" value="xls">';
echo '</form>';
echo '<form id="form2" name="form2" method="post" action="'.api_get_self().'?action='
.Security::remove_XSS($_GET['action']).'&survey_id='.$surveyId.'&'.api_get_cidreq().'">';
if (empty($people_filled) || empty($survey_data)) {
return '';
}
echo '</div>';
// Step 1: selection of the user
echo "<script>
@ -374,7 +334,6 @@ class SurveyUtil
}
</script>";
echo get_lang('SelectUserWhoFilledSurvey').'<br />';
echo '<select name="user" onchange="jumpMenu(\'parent\',this,0)">';
echo '<option value="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='
.Security::remove_XSS($_GET['action']).'&survey_id='.$surveyId.'&'.api_get_cidreq().'">'
@ -401,15 +360,33 @@ class SurveyUtil
echo '>'.$name.'</option>';
}
echo '</select>';
}
$course_id = api_get_course_int_id();
/**
* @param int $userId
* @param array $survey_data
* @param bool $addMessage
*/
public static function displayUserReportAnswers($userId, $survey_data, $addMessage = true)
{
// Database table definitions
$table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
$table_survey_question_option = Database::get_course_table(TABLE_SURVEY_QUESTION_OPTION);
$table_survey_answer = Database::get_course_table(TABLE_SURVEY_ANSWER);
$course_id = (int) $survey_data['c_id'];
$surveyId = (int) $survey_data['survey_id'];
$userId = Database::escape_string($userId);
$content = '';
// Step 2: displaying the survey and the answer of the selected users
if (isset($_GET['user'])) {
echo Display::return_message(
get_lang('AllQuestionsOnOnePage'),
'normal',
false
);
if (!empty($userId)) {
if ($addMessage) {
$content .= Display::return_message(
get_lang('AllQuestionsOnOnePage'),
'normal',
false
);
}
// Getting all the questions and options
$sql = "SELECT
@ -451,7 +428,7 @@ class SurveyUtil
WHERE
c_id = $course_id AND
survey_id = '".$surveyId."' AND
user = '".Database::escape_string($_GET['user'])."'";
user = '".$userId."'";
$result = Database::query($sql);
while ($row = Database::fetch_array($result, 'ASSOC')) {
$answers[$row['question_id']][] = $row['option_id'];
@ -459,7 +436,6 @@ class SurveyUtil
}
// Displaying all the questions
foreach ($questions as &$question) {
// If the question type is a scoring then we have to format the answers differently
switch ($question['type']) {
@ -495,10 +471,79 @@ class SurveyUtil
$form->addHtml($question['survey_question']);
$display->render($form, $question, $finalAnswer);
$form->addHtml('</div></div>');
$form->display();
$content .= $form->returnForm();
}
}
}
return $content;
}
/**
* This function displays the user report which is basically nothing more
* than a one-page display of all the questions
* of the survey that is filled with the answers of the person who filled the survey.
*
* @return string html code of the one-page survey with the answers of the selected user
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
*
* @version February 2007 - Updated March 2008
*/
public static function displayUserReport($survey_data, $people_filled, $addActionBar = true)
{
if (empty($survey_data)) {
return '';
}
$surveyId = $survey_data['survey_id'];
$reportingUrl = api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.$surveyId.'&'.api_get_cidreq();
// Actions bar
if ($addActionBar) {
echo '<div class="actions">';
echo '<a href="'.$reportingUrl.'">'.
Display::return_icon(
'back.png',
get_lang('BackTo').' '.get_lang('ReportingOverview'),
'',
ICON_SIZE_MEDIUM
)
.'</a>';
if (isset($_GET['user'])) {
if (api_is_allowed_to_edit()) {
// The delete link
echo '<a href="'.$reportingUrl.'&action=deleteuserreport&user='.Security::remove_XSS($_GET['user']).'" >'.
Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_MEDIUM).'</a>';
}
// Export the user report
echo '<a href="javascript: void(0);" onclick="document.form1a.submit();">'
.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a> ';
echo '<a href="javascript: void(0);" onclick="document.form1b.submit();">'
.Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM).'</a> ';
echo '<form id="form1a" name="form1a" method="post" action="'.api_get_self().'?action='
.Security::remove_XSS($_GET['action']).'&survey_id='.$surveyId.'&'.api_get_cidreq().'&user_id='
.Security::remove_XSS($_GET['user']).'">';
echo '<input type="hidden" name="export_report" value="export_report">';
echo '<input type="hidden" name="export_format" value="csv">';
echo '</form>';
echo '<form id="form1b" name="form1b" method="post" action="'.api_get_self().'?action='
.Security::remove_XSS($_GET['action']).'&survey_id='.$surveyId.'&'.api_get_cidreq().'&user_id='
.Security::remove_XSS($_GET['user']).'">';
echo '<input type="hidden" name="export_report" value="export_report">';
echo '<input type="hidden" name="export_format" value="xls">';
echo '</form>';
echo '<form id="form2" name="form2" method="post" action="'.api_get_self().'?action='
.Security::remove_XSS($_GET['action']).'&survey_id='.$surveyId.'&'.api_get_cidreq().'">';
}
echo '</div>';
}
self::displayUserReportForm($survey_data, $people_filled);
if (isset($_GET['user'])) {
echo self::displayUserReportAnswers($_GET['user'], $survey_data);
}
}
/**
@ -864,69 +909,85 @@ class SurveyUtil
/**
* This functions displays the complete reporting.
*
* @return string HTML code
*
* @todo open questions are not in the complete report yet.
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @param array $survey_data
* @param int $userId
* @param bool $addActionBar
* @param bool $addFilters
*
* @version February 2007
* @return string
*/
public static function display_complete_report($survey_data)
public static function displayCompleteReport($survey_data, $userId = 0, $addActionBar = true, $addFilters = true)
{
// Database table definitions
$table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
$table_survey_question_option = Database::get_course_table(TABLE_SURVEY_QUESTION_OPTION);
$table_survey_answer = Database::get_course_table(TABLE_SURVEY_ANSWER);
$course_id = api_get_course_int_id();
$surveyId = isset($_GET['survey_id']) ? (int) $_GET['survey_id'] : 0;
$action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : '';
// Actions bar
echo '<div class="actions">';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.$surveyId.'&'.api_get_cidreq().'">'
.Display::return_icon(
'back.png',
get_lang('BackTo').' '.get_lang('ReportingOverview'),
[],
ICON_SIZE_MEDIUM
)
.'</a>';
echo '<a class="survey_export_link" href="javascript: void(0);" onclick="document.form1a.submit();">'
.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a>';
echo '<a class="survey_export_link" href="javascript: void(0);" onclick="document.form1b.submit();">'
.Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
$surveyId = (int) $survey_data['survey_id'];
$course_id = (int) $survey_data['c_id'];
// The form
echo '<form id="form1a" name="form1a" method="post" action="'.api_get_self().'?action='.$action.'&survey_id='
.$surveyId.'&'.api_get_cidreq().'">';
echo '<input type="hidden" name="export_report" value="export_report">';
echo '<input type="hidden" name="export_format" value="csv">';
echo '</form>';
echo '<form id="form1b" name="form1b" method="post" action="'.api_get_self().'?action='.$action.'&survey_id='
.$surveyId.'&'.api_get_cidreq().'">';
echo '<input type="hidden" name="export_report" value="export_report">';
echo '<input type="hidden" name="export_format" value="xls">';
echo '</form>';
if (empty($surveyId) || empty($course_id)) {
return '';
}
echo '<form id="form2" name="form2" method="post" action="'.api_get_self().'?action='.$action.'&survey_id='
$action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : '';
$content = '';
if ($addActionBar) {
$content .= '<div class="actions">';
$content .= '<a
href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.$surveyId.'&'.api_get_cidreq().'">'
.Display::return_icon(
'back.png',
get_lang('BackTo').' '.get_lang('ReportingOverview'),
[],
ICON_SIZE_MEDIUM
)
.'</a>';
$content .= '<a class="survey_export_link" href="javascript: void(0);" onclick="document.form1a.submit();">'
.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a>';
$content .= '<a class="survey_export_link" href="javascript: void(0);" onclick="document.form1b.submit();">'
.Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM).'</a>';
$content .= '</div>';
// The form
$content .= '<form id="form1a" name="form1a" method="post" action="'.api_get_self(
).'?action='.$action.'&survey_id='
.$surveyId.'&'.api_get_cidreq().'">';
$content .= '<input type="hidden" name="export_report" value="export_report">';
$content .= '<input type="hidden" name="export_format" value="csv">';
$content .= '</form>';
$content .= '<form id="form1b" name="form1b" method="post" action="'.api_get_self(
).'?action='.$action.'&survey_id='
.$surveyId.'&'.api_get_cidreq().'">';
$content .= '<input type="hidden" name="export_report" value="export_report">';
$content .= '<input type="hidden" name="export_format" value="xls">';
$content .= '</form>';
}
$content .= '<form id="form2" name="form2" method="post" action="'.api_get_self().'?action='.$action.'&survey_id='
.$surveyId.'&'.api_get_cidreq().'">';
// The table
echo '<br /><table class="data_table" border="1">';
$content .= '<br /><table class="data_table" border="1">';
// Getting the number of options per question
echo ' <tr>';
echo ' <th>';
if ((isset($_POST['submit_question_filter']) && $_POST['submit_question_filter']) ||
(isset($_POST['export_report']) && $_POST['export_report'])
) {
echo '<button class="cancel" type="submit" name="reset_question_filter" value="'
.get_lang('ResetQuestionFilter').'">'.get_lang('ResetQuestionFilter').'</button>';
$content .= ' <tr>';
$content .= ' <th>';
if ($addFilters) {
if ((isset($_POST['submit_question_filter']) && $_POST['submit_question_filter']) ||
(isset($_POST['export_report']) && $_POST['export_report'])
) {
$content .= '<button class="cancel"
type="submit"
name="reset_question_filter" value="'.get_lang('ResetQuestionFilter').'">'.
get_lang('ResetQuestionFilter').'</button>';
}
$content .= '<button
class = "save"
type="submit" name="submit_question_filter" value="'.get_lang('SubmitQuestionFilter').'">'.
get_lang('SubmitQuestionFilter').'</button>';
$content .= '</th>';
}
echo '<button class="save" type="submit" name="submit_question_filter" value="'.get_lang('SubmitQuestionFilter')
.'">'.get_lang('SubmitQuestionFilter').'</button>';
echo '</th>';
$display_extra_user_fields = false;
if (!(isset($_POST['submit_question_filter']) && $_POST['submit_question_filter'] ||
@ -944,11 +1005,14 @@ class SurveyUtil
);
$num = count($extra_user_fields);
if ($num > 0) {
echo '<th '.($num > 0 ? ' colspan="'.$num.'"' : '').'>';
echo '<label><input type="checkbox" name="fields_filter" value="1" checked="checked"/> ';
echo get_lang('UserFields');
echo '</label>';
echo '</th>';
$content .= '<th '.($num > 0 ? ' colspan="'.$num.'"' : '').'>';
$content .= '<label>';
if ($addFilters) {
$content .= '<input type="checkbox" name="fields_filter" value="1" checked="checked"/> ';
}
$content .= get_lang('UserFields');
$content .= '</label>';
$content .= '</th>';
$display_extra_user_fields = true;
}
}
@ -974,36 +1038,41 @@ class SurveyUtil
// 1. there is no question filter and the export button has not been clicked
// 2. there is a quesiton filter but the question is selected for display
if (!(isset($_POST['submit_question_filter']) && $_POST['submit_question_filter']) ||
(is_array($_POST['questions_filter']) && in_array($row['question_id'], $_POST['questions_filter']))
(is_array($_POST['questions_filter']) &&
in_array($row['question_id'], $_POST['questions_filter']))
) {
// We do not show comment and pagebreak question types
if ($row['type'] != 'pagebreak') {
echo ' <th';
$content .= ' <th';
if ($row['number_of_options'] > 0 && $row['type'] != 'percentage') {
echo ' colspan="'.$row['number_of_options'].'"';
$content .= ' colspan="'.$row['number_of_options'].'"';
}
echo '>';
echo '<label><input type="checkbox" name="questions_filter[]" value="'.$row['question_id']
.'" checked="checked"/> ';
echo $row['survey_question'];
echo '</label>';
echo '</th>';
$content .= '>';
$content .= '<label>';
if ($addFilters) {
$content .= '<input
type="checkbox"
name="questions_filter[]" value="'.$row['question_id'].'" checked="checked"/>';
}
$content .= $row['survey_question'];
$content .= '</label>';
$content .= '</th>';
}
// No column at all if it's not a question
}
$questions[$row['question_id']] = $row;
}
echo ' </tr>';
// Getting all the questions and options
echo ' <tr>';
echo ' <th>&nbsp;</th>'; // the user column
$content .= ' </tr>';
// Getting all the questions and options
$content .= ' <tr>';
$content .= ' <th>&nbsp;</th>'; // the user column
if (!(isset($_POST['submit_question_filter']) && $_POST['submit_question_filter'] ||
isset($_POST['export_report']) && $_POST['export_report']) || !empty($_POST['fields_filter'])
) {
//show the fields names for user fields
foreach ($extra_user_fields as &$field) {
echo '<th>'.$field[3].'</th>';
$content .= '<th>'.$field[3].'</th>';
}
}
@ -1040,26 +1109,32 @@ class SurveyUtil
) {
// we do not show comment and pagebreak question types
if ($row['type'] == 'open' || $row['type'] == 'comment') {
echo '<th>&nbsp;-&nbsp;</th>';
$content .= '<th>&nbsp;-&nbsp;</th>';
$possible_answers[$row['question_id']][$row['question_option_id']] = $row['question_option_id'];
$display_percentage_header = 1;
} elseif ($row['type'] == 'percentage' && $display_percentage_header) {
echo '<th>&nbsp;%&nbsp;</th>';
$content .= '<th>&nbsp;%&nbsp;</th>';
$possible_answers[$row['question_id']][$row['question_option_id']] = $row['question_option_id'];
$display_percentage_header = 0;
} elseif ($row['type'] == 'percentage') {
$possible_answers[$row['question_id']][$row['question_option_id']] = $row['question_option_id'];
} elseif ($row['type'] != 'pagebreak' && $row['type'] != 'percentage') {
echo '<th>';
echo $row['option_text'];
echo '</th>';
$content .= '<th>';
$content .= $row['option_text'];
$content .= '</th>';
$possible_answers[$row['question_id']][$row['question_option_id']] = $row['question_option_id'];
$display_percentage_header = 1;
}
}
}
echo ' </tr>';
$content .= ' </tr>';
$userCondition = '';
if (!empty($userId)) {
$userId = (int) $userId;
$userCondition = " AND user = $userId ";
}
// Getting all the answers of the users
$old_user = '';
@ -1067,7 +1142,8 @@ class SurveyUtil
$sql = "SELECT * FROM $table_survey_answer
WHERE
c_id = $course_id AND
survey_id='".$surveyId."'
survey_id = $surveyId
$userCondition
ORDER BY answer_id, user ASC";
$result = Database::query($sql);
$i = 1;
@ -1078,7 +1154,7 @@ class SurveyUtil
$userParam = $i;
$i++;
}
self::display_complete_report_row(
$content .= self::display_complete_report_row(
$survey_data,
$possible_answers,
$answers_of_user,
@ -1098,12 +1174,14 @@ class SurveyUtil
}
$old_user = $row['user'];
}
$userParam = $old_user;
if ($survey_data['anonymous'] != 0) {
$userParam = $i;
$i++;
}
self::display_complete_report_row(
$content .= self::display_complete_report_row(
$survey_data,
$possible_answers,
$answers_of_user,
@ -1111,23 +1189,25 @@ class SurveyUtil
$questions,
$display_extra_user_fields
);
// This is to display the last user
echo '</table>';
echo '</form>';
$content .= '</table>';
$content .= '</form>';
return $content;
}
/**
* This function displays a row (= a user and his/her answers) in the table of the complete report.
* Return user answers in a row
*
* @param array $survey_data
* @param array Possible options
* @param array User answers
* @param mixed User ID or user details string
* @param bool Whether to show extra user fields or not
* @param $survey_data
* @param $possible_options
* @param $answers_of_user
* @param $user
* @param $questions
* @param bool $display_extra_user_fields
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
*
* @version February 2007 - Updated March 2008
* @return string
*/
public static function display_complete_report_row(
$survey_data,
@ -1138,24 +1218,31 @@ class SurveyUtil
$display_extra_user_fields = false
) {
$user = Security::remove_XSS($user);
echo '<tr>';
$surveyId = (int) $survey_data['survey_id'];
if (empty($surveyId)) {
return '';
}
$content = '<tr>';
$url = api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.$surveyId.'&'.api_get_cidreq();
if ($survey_data['anonymous'] == 0) {
if (intval($user) !== 0) {
$userInfo = api_get_user_info($user);
$user_displayed = '-';
if (!empty($userInfo)) {
$user_displayed = $userInfo['complete_name_with_username'];
} else {
$user_displayed = '-';
}
echo '<th>
<a href="'.api_get_self().'?action=userreport&survey_id='.intval($_GET['survey_id']).'&user='.$user.'">'
$content .= '<th>
<a href="'.$url.'&action=userreport&user='.$user.'">'
.$user_displayed.'</a>
</th>'; // the user column
} else {
echo '<th>'.$user.'</th>'; // the user column
$content .= '<th>'.$user.'</th>'; // the user column
}
} else {
echo '<th>'.get_lang('Anonymous').' '.$user.'</th>';
$content .= '<th>'.get_lang('Anonymous').' '.$user.'</th>';
}
if ($display_extra_user_fields) {
@ -1168,33 +1255,33 @@ class SurveyUtil
true
);
foreach ($user_fields_values as &$value) {
echo '<td align="center">'.$value.'</td>';
$content .= '<td align="center">'.$value.'</td>';
}
}
if (is_array($possible_options)) {
foreach ($possible_options as $question_id => &$possible_option) {
if ($questions[$question_id]['type'] == 'open' || $questions[$question_id]['type'] == 'comment') {
echo '<td align="center">';
$content .= '<td align="center">';
if (isset($answers_of_user[$question_id]) && isset($answers_of_user[$question_id]['0'])) {
echo $answers_of_user[$question_id]['0']['option_id'];
$content .= $answers_of_user[$question_id]['0']['option_id'];
}
echo '</td>';
$content .= '</td>';
} else {
foreach ($possible_option as $option_id => &$value) {
if ($questions[$question_id]['type'] == 'percentage') {
if (!empty($answers_of_user[$question_id][$option_id])) {
echo "<td align='center'>";
echo $answers_of_user[$question_id][$option_id]['value'];
echo "</td>";
$content .= "<td align='center'>";
$content .= $answers_of_user[$question_id][$option_id]['value'];
$content .= "</td>";
}
} else {
echo '<td align="center">';
$content .= '<td align="center">';
if (!empty($answers_of_user[$question_id][$option_id])) {
if ($answers_of_user[$question_id][$option_id]['value'] != 0) {
echo $answers_of_user[$question_id][$option_id]['value'];
$content .= $answers_of_user[$question_id][$option_id]['value'];
} else {
echo 'v';
$content .= 'v';
}
}
}
@ -1202,7 +1289,10 @@ class SurveyUtil
}
}
}
echo '</tr>';
$content .= '</tr>';
return $content;
}
/**

Loading…
Cancel
Save