Hi Mike,
Thanks for the great work on this questionnaire module.
I figured out a hack for adding labels to the rating columns.
In questionnaire.class.php lines 958 - 990ish I added a row to the table for displaying a rated question. With css I added background pictures to each corresponding cell.
And I gave the numbers a tiny font with the background color (additional class for css added). In MSIE the numbers have disappeared, in Firefox they are still visible, but marginally.
With different css-files I am able to create different labels on top of the columns and the number of rated columns can be adjusted through css as well.
OLD CODE
function rate_survey_display($data) {
if (!isset($data->{'q'.$this->id}) || !is_array($data->{'q'.$this->id})) {
$data->{'q'.$this->id} = array();
}
echo '<table border="0" cellspacing="1" cellpadding="0">'."\n";
echo ' <tbody>'."\n";
echo ' <tr>'."\n";
echo ' <td></td>'."\n";
$bg = '#eeeeee';
for ($j = 0; $j < $this->length; $j++) {
echo ' <td width="40" align="center" bgcolor="'.$bg.'">'.($j+1).'</td>'."\n";
if ($bg == '#eeeeee') {
$bg = '#dddddd';
} else {
$bg = '#eeeeee';
}
}
if ($this->precise) {
echo ' <td width="40" align="center" bgcolor="'.$bg.'">N/A</td>'."\n";
}
echo ' </tr>'."\n";
HACK
function rate_survey_display($data) {
if (!isset($data->{'q'.$this->id}) || !is_array($data->{'q'.$this->id})) {
$data->{'q'.$this->id} = array();
}
echo '<table border="0" width="100%" cellspacing="1" cellpadding="0">'."\n";
echo ' <tbody>'."\n";
echo ' <tr><td></td>'."\n";
echo ' <td class="label1"> </td>'."\n";
echo ' <td class="label2"> </td>'."\n";
echo ' <td class="label3"> </td>'."\n";
echo ' <td class="label4"> </td>'."\n";
echo ' <td class="label5"> </td>'."\n";
echo ' <td class="label6"> </td>'."\n";
echo ' </tr>'."\n";
echo ' <tr><td align="left"></td>'."\n";
$bg = '#eeeeee';
for ($j = 0; $j < $this->length; $j++) {
echo ' <td class="lebel" width="60" align="center" bgcolor="'.$bg.'">'.($j+1).'</td>'."\n";
if ($bg == '#eeeeee') {
$bg = '#dddddd';
} else {
$bg = '#eeeeee';
}
}
if ($this->precise) {
echo ' <td width="60" align="center" bgcolor="'.$bg.'">N/A</td>'."\n";
}
echo ' </tr>'."\n";
And this is what it looks like now:
CSS for a background picture:
.label1 {
width: 60px;
height: 40px;
background: #fff url(images/gedrag_niet_zichtbaar.gif) top;
background-repeat: no-repeat;
}
Questionnaire (plugin)
Rplace ratings with text labels?
This discussion has been locked so you can no longer reply to it.