fwrite ($bf,full_tag("ANSWER4",4,false,$choice->answer4));
fwrite ($bf,full_tag("ANSWER5",4,false,$choice->answer5));
fwrite ($bf,full_tag("ANSWER6",4,false,$choice->answer6));
+ fwrite ($bf,full_tag("SHOWUNANSWERED",4,false,$choice->showunanswered));
fwrite ($bf,full_tag("PUBLISH",4,false,$choice->publish));
fwrite ($bf,full_tag("TIMEMODIFIED",4,false,$choice->timemodified));
//if we've selected to backup users info, then execute backup_choice_answers
execute_sql(" ALTER TABLE `choice` ADD `format` TINYINT(2) UNSIGNED DEFAULT '0' NOT NULL AFTER `text` ");
execute_sql(" ALTER TABLE `choice` ADD `publish` TINYINT(2) UNSIGNED DEFAULT '0' NOT NULL AFTER `answer6` ");
}
+
+ if ($oldversion < 2004010100) {
+ table_column("choice", "", "showunanswered", "integer", "4", "unsigned", "0", "", "publish");
+ }
+
return true;
}
answer5 varchar(255) default NULL,\r
answer6 varchar(255) default NULL,\r
publish tinyint(2) unsigned NOT NULL default '0',\r
+ showunanswered tinyint(2) unsigned NOT NULL default '0',\r
timemodified int(10) unsigned NOT NULL default '0',\r
PRIMARY KEY (id),\r
UNIQUE KEY id (id)\r
execute_sql(" ALTER TABLE `choice` ADD `format` INTEGER DEFAULT '0' NOT NULL AFTER `text` ");
execute_sql(" ALTER TABLE `choice` ADD `publish` INTEGER DEFAULT '0' NOT NULL AFTER `answer6` ");
}
+ if ($oldversion < 2004010100) {
+ table_column("choice", "", "showunanswered", "integer", "4", "unsigned", "0", "", "publish");
+ }
return true;
}
answer4 varchar(255) default NULL,
answer5 varchar(255) default NULL,
answer6 varchar(255) default NULL,
+ showunanswered integer NOT NULL default '0',
publish integer NOT NULL default '0',
timemodified integer NOT NULL default '0'
);
$form->text = "";
}
if (empty($form->format)) {
- $form->format = "";
+ $form->format = 0;
}
if (empty($form->answer1)) {
$form->answer1 = get_string("yes");
$form->answer6 = "";
}
if (empty($form->publish)) {
- $form->publish = "";
+ $form->publish = 0;
+ }
+ if (empty($form->showunanswered)) {
+ $form->showunanswered = 0;
}
if ($usehtmleditor = can_use_richtext_editor()) {
<br \>
</td>
</tr>
+<tr valign=top>
+ <td align=right><P><B><?php print_string("showunanswered","choice") ?>:</b></p></td>
+ <td>
+ <?php
+ $options[0] = get_string("no");
+ $options[1] = get_string("yes");
+ choose_from_menu($options, "showunanswered", "$form->showunanswered", "");
+ ?>
+ <br \>
+ </td>
+</tr>
</table>
$choice->answer4 = backup_todb($info['MOD']['#']['ANSWER4']['0']['#']);
$choice->answer5 = backup_todb($info['MOD']['#']['ANSWER5']['0']['#']);
$choice->answer6 = backup_todb($info['MOD']['#']['ANSWER6']['0']['#']);
+ $choice->showunanswered = backup_todb($info['MOD']['#']['SHOWUNANSWERED']['0']['#']);
$choice->publish = backup_todb($info['MOD']['#']['PUBLISH']['0']['#']);
$choice->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
-$module->version = 2003010100;
+$module->version = 2004010100;
$module->cron = 0;
?>
$answer = $answers[$user->id];
$useranswer[(int)$answer->answer][] = $user;
} else {
- $answer = "";
- $useranswer[(int)$answer->answer][] = $user;
+ $useranswer[0][] = $user;
}
}
foreach ($choice->answer as $key => $answer) {
foreach ($useranswer as $key => $answer) {
if ($key) {
echo "<th width=\"$tablewidth%\">";
+ } else if ($choice->showunanswered) {
+ echo "<th bgcolor=\"$THEME->body\" width=\"$tablewidth%\">";
} else {
- echo "<th bgcolor=\"$theme->body\" width=\"$tablewidth%\">";
+ continue;
}
echo choice_get_answer($choice, $key);
echo "</th>";
foreach ($useranswer as $key => $answer) {
if ($key) {
echo "<td width=\"$tablewidth%\" valign=top nowrap bgcolor=\"$theme->cellcontent\">";
- } else {
+ } else if ($choice->showunanswered) {
echo "<td width=\"$tablewidth%\" valign=top nowrap bgcolor=\"$theme->body\">";
+ } else {
+ continue;
}
echo "<table width=100%>";
foreach ($useranswer as $key => $answer) {
if ($key) {
echo "<th width=\"$tablewidth%\">";
- } else {
+ } else if ($choice->showunanswered) {
echo "<th bgcolor=\"$THEME->body\" width=\"$tablewidth%\">";
+ } else {
+ continue;
}
echo choice_get_answer($choice, $key);
echo "</th>";
$maxcolumn = 0;
foreach ($useranswer as $key => $answer) {
+ if (!$key and !$choice->showunanswered) {
+ continue;
+ }
$column[$key] = count($answer);
if ($column[$key] > $maxcolumn) {
$maxcolumn = $column[$key];
echo "<tr>";
foreach ($useranswer as $key => $answer) {
+ if (!$key and !$choice->showunanswered) {
+ continue;
+ }
$height = $COLUMN_HEIGHT * ((float)$column[$key] / (float)$maxcolumn);
echo "<td valign=\"bottom\" align=\"center\">";
- echo "<img src=\"column.png\" height=\"$height\" width=\"49\"></td>";
+ echo "<img src=\"column.png\" height=\"$height\" width=\"49\">";
+ echo "</td>";
}
echo "</tr>";
echo "<tr>";
foreach ($useranswer as $key => $answer) {
+ if (!$key and !$choice->showunanswered) {
+ continue;
+ }
echo "<td align=\"center\">".$column[$key]."</td>";
}
echo "</tr></table>";