I needed a N/A option for the questionnaire to be on the left,
and the numbering to start at 0. I hacked the code to do this.
I indicated left n/a by putting a -1 instead of 1 in the precision control,
and zero-based numbering by the negative of the number of entries
in the 'length' control.
The only problem is the results page doesn't display the graphs properly...
Below are the modifications I made. Any suggestions for improvement?
phpESP/admin/include/function/survey_render.inc :
I've included the code for the ranking rendering only... I didn't have
the original questionnaire.zip, so couldn't make a diff.
case '8': // ranking
?>
<table border="0" cellspacing="1" cellpadding="0">
<tbody>
<tr>
<td></td>
<?php
$bg = '#eeeeee';
# additions by JRR to allow 0-based rating and N/A on the left side
# if size is negative, labels will be 0 through size-1.
$limit=abs($size);
if ($prec < 0) {
?>
<td width="40" align="center" bgcolor="<?php echo($bg); ?>"><?php echo(_('N/A')); ?></td>
<?php $bg = '#dddddd';
}
for ($j = 0; $j < $limit; $j++) {
?>
<td width="40" align="center" bgcolor="<?php echo($bg); ?>"><?php echo (( $size < 0 )?$j:$j+1); ?></td>
<?php
if ($bg == '#eeeeee') $bg = '#dddddd';
else $bg = '#eeeeee';
}
if ($prec > 0) {
?>
<td width="40" align="center" bgcolor="<?php echo($bg); ?>"><?php echo(_('N/A')); ?></td>
<?php
}
?>
</tr>
<?php
foreach ($choices_result as $choice) {
$choice = (array)$choice;
$cid = $choice['id'];
$str = "${qid}_$cid";
?>
<tr>
<td align="right"><?php echo($choice['content']); ?></td>
<?php
$bg = '#eeeeee';
if ($prec < 0) {
?>
<td width="40" align="center" bgcolor="<?php echo($bg); ?>"><?php echo(mkradio($str,'N/A')); ?></td>
<?php $bg = '#dddddd';
}
for ($j = 0; $j < $limit; $j++) {
?>
<td width="40" align="center" bgcolor="<?php echo($bg); ?>"><?php echo(mkradio($str,$j)); ?></td>
<?php
if ($bg == '#eeeeee') $bg = '#dddddd';
else $bg = '#eeeeee';
}
if ($prec > 0) {
?>
<td width="40" align="center" bgcolor="<?php echo($bg); ?>"><?php echo(mkradio($str,'N/A')); ?></td>
<?php
}
?>
</tr>
<?php } ?>
</tbody>
</table>
<?php
break;
Questionnaire (plugin)
Questionnaire Module - a wishlist
This discussion has been locked so you can no longer reply to it.