New setting makes it optional to show column of people who didn't answer
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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'
|
||||
);
|
||||
|
||||
+16
-2
@@ -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 @@
|
||||
<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>
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
$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']['#']);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// This fragment is called by /admin/index.php
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
$module->version = 2003010100;
|
||||
$module->version = 2004010100;
|
||||
$module->cron = 0;
|
||||
|
||||
?>
|
||||
|
||||
+21
-6
@@ -123,8 +123,7 @@
|
||||
$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) {
|
||||
@@ -146,8 +145,10 @@
|
||||
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>";
|
||||
@@ -157,8 +158,10 @@
|
||||
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%>";
|
||||
@@ -185,8 +188,10 @@
|
||||
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>";
|
||||
@@ -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 "<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>";
|
||||
|
||||
Reference in New Issue
Block a user