diff --git a/mod/choice/backuplib.php b/mod/choice/backuplib.php
index b9abb98d23b..7dfcdfb2e73 100644
--- a/mod/choice/backuplib.php
+++ b/mod/choice/backuplib.php
@@ -45,6 +45,7 @@
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
diff --git a/mod/choice/db/mysql.php b/mod/choice/db/mysql.php
index d8a021fc560..abf13bf7e5d 100644
--- a/mod/choice/db/mysql.php
+++ b/mod/choice/db/mysql.php
@@ -21,6 +21,11 @@ function choice_upgrade($oldversion) {
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;
}
diff --git a/mod/choice/db/mysql.sql b/mod/choice/db/mysql.sql
index 74de9de72b2..c513fcbf158 100755
--- a/mod/choice/db/mysql.sql
+++ b/mod/choice/db/mysql.sql
@@ -27,6 +27,7 @@ CREATE TABLE prefix_choice (
answer5 varchar(255) default NULL,
answer6 varchar(255) default NULL,
publish tinyint(2) unsigned NOT NULL default '0',
+ showunanswered tinyint(2) unsigned NOT NULL default '0',
timemodified int(10) unsigned NOT NULL default '0',
PRIMARY KEY (id),
UNIQUE KEY id (id)
diff --git a/mod/choice/db/postgres7.php b/mod/choice/db/postgres7.php
index ea4ef82dc13..66f37a7e9fc 100644
--- a/mod/choice/db/postgres7.php
+++ b/mod/choice/db/postgres7.php
@@ -8,6 +8,9 @@ function choice_upgrade($oldversion) {
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;
}
diff --git a/mod/choice/db/postgres7.sql b/mod/choice/db/postgres7.sql
index f7ba955adca..3fcc386d966 100755
--- a/mod/choice/db/postgres7.sql
+++ b/mod/choice/db/postgres7.sql
@@ -26,6 +26,7 @@ CREATE TABLE prefix_choice (
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'
);
diff --git a/mod/choice/mod.html b/mod/choice/mod.html
index 2db776ee343..0dce24aad3b 100644
--- a/mod/choice/mod.html
+++ b/mod/choice/mod.html
@@ -6,7 +6,7 @@
$form->text = "";
}
if (empty($form->format)) {
- $form->format = "";
+ $form->format = 0;
}
if (empty($form->answer1)) {
$form->answer1 = get_string("yes");
@@ -27,7 +27,10 @@
$form->answer6 = "";
}
if (empty($form->publish)) {
- $form->publish = "";
+ $form->publish = 0;
+ }
+ if (empty($form->showunanswered)) {
+ $form->showunanswered = 0;
}
if ($usehtmleditor = can_use_richtext_editor()) {
@@ -138,6 +141,17 @@
+
:
| "; - } else { + } else if ($choice->showunanswered) { echo " | body\" width=\"$tablewidth%\">"; + } else { + continue; } echo choice_get_answer($choice, $key); echo " | "; @@ -195,6 +200,9 @@ $maxcolumn = 0; foreach ($useranswer as $key => $answer) { + if (!$key and !$choice->showunanswered) { + continue; + } $column[$key] = count($answer); if ($column[$key] > $maxcolumn) { $maxcolumn = $column[$key]; @@ -203,14 +211,21 @@ echo "
|---|
";
- echo "![]() | ";
+ echo "
| ".$column[$key]." | "; } echo "