Fixed Into survey when not have nothing quiz show a warning into reports DT#5496

skala
Arthur Portugal 16 years ago
parent c354130aa1
commit 09b4613083
  1. 84
      main/survey/survey.lib.php

@ -2860,31 +2860,32 @@ class SurveyUtil {
// displaying the table: the content // displaying the table: the content
foreach ($options as $key=>$value) if(is_array($options)){
{ foreach ($options as $key=>$value)
$absolute_number = $data[$value['question_option_id']]['total'];
if($number_of_answers == 0)
{
$answers_number = 0;
}
else
{ {
$answers_number = $absolute_number/$number_of_answers*100; $absolute_number = $data[$value['question_option_id']]['total'];
} if($number_of_answers == 0)
echo ' <tr>'; {
echo ' <td>'.$value['option_text'].'</td>'; $answers_number = 0;
echo ' <td align="right"><a href="reporting.php?action='.Security::remove_XSS($_GET['action']).'&amp;survey_id='.Security::remove_XSS($_GET['survey_id']).'&amp;question='.Security::remove_XSS($offset).'&amp;viewoption='.$value['question_option_id'].'">'.$absolute_number.'</a></td>'; }
echo ' <td align="right">'.round($answers_number, 2).' %</td>'; else
echo ' <td align="right">'; {
$size = $answers_number*2; $answers_number = $absolute_number/$number_of_answers*100;
if ($size > 0) }
{ echo ' <tr>';
echo '<div style="border:1px solid #264269; background-color:#aecaf4; height:10px; width:'.$size.'px">&nbsp;</div>'; echo ' <td>'.$value['option_text'].'</td>';
echo ' <td align="right"><a href="reporting.php?action='.Security::remove_XSS($_GET['action']).'&amp;survey_id='.Security::remove_XSS($_GET['survey_id']).'&amp;question='.Security::remove_XSS($offset).'&amp;viewoption='.$value['question_option_id'].'">'.$absolute_number.'</a></td>';
echo ' <td align="right">'.round($answers_number, 2).' %</td>';
echo ' <td align="right">';
$size = $answers_number*2;
if ($size > 0)
{
echo '<div style="border:1px solid #264269; background-color:#aecaf4; height:10px; width:'.$size.'px">&nbsp;</div>';
}
echo ' </td>';
echo ' </tr>';
} }
echo ' </td>';
echo ' </tr>';
} }
// displaying the table: footer (totals) // displaying the table: footer (totals)
echo ' <tr>'; echo ' <tr>';
echo ' <td style="border-top:1px solid black;"><b>'.get_lang('Total').'</b></td>'; echo ' <td style="border-top:1px solid black;"><b>'.get_lang('Total').'</b></td>';
@ -3211,34 +3212,35 @@ class SurveyUtil {
echo '<td align="center">'.$value.'</td>'; echo '<td align="center">'.$value.'</td>';
} }
} }
if(is_array($possible_options)) {
foreach ($possible_options as $question_id=>$possible_option) foreach ($possible_options as $question_id=>$possible_option)
{
if ($questions[$question_id]['type'] == 'open')
{
echo '<td align="center">';
echo $answers_of_user[$question_id]['0']['option_id'];
echo '</td>';
}
else
{ {
foreach ($possible_option as $option_id=>$value) if ($questions[$question_id]['type'] == 'open')
{ {
echo '<td align="center">'; echo '<td align="center">';
if (!empty($answers_of_user[$question_id][$option_id])) echo $answers_of_user[$question_id]['0']['option_id'];
echo '</td>';
}
else
{
foreach ($possible_option as $option_id=>$value)
{ {
if ($answers_of_user[$question_id][$option_id]['value']<>0) echo '<td align="center">';
if (!empty($answers_of_user[$question_id][$option_id]))
{ {
echo $answers_of_user[$question_id][$option_id]['value']; if ($answers_of_user[$question_id][$option_id]['value']<>0)
} {
else echo $answers_of_user[$question_id][$option_id]['value'];
{ }
echo 'v'; else
{
echo 'v';
}
} }
} }
} }
} }
} }
echo '</tr>'; echo '</tr>';
} }

Loading…
Cancel
Save