From f9b0b71de85f154edc8026b27585799fc916c48a Mon Sep 17 00:00:00 2001 From: Jason Cleeland Date: Sun, 12 Sep 2004 07:10:46 +0000 Subject: [PATCH] TWEAK: List type questions will now split into columns if there are more the $repeatheading entries ($repeatheading in config.php defaults to 25) git-svn-id: file:///Users/Shitiz/Downloads/lssvn/trunk/unstable@1176 b72ed6b6-b9f8-46b5-92b4-906544132732 --- admin/printablesurvey.php | 60 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 3 deletions(-) diff --git a/admin/printablesurvey.php b/admin/printablesurvey.php index b9f2559a41a..1323cab75b2 100644 --- a/admin/printablesurvey.php +++ b/admin/printablesurvey.php @@ -280,6 +280,33 @@ echo "\t\t\t$setfont"._PS_CHOOSEONE."
\n"; $deaquery = "SELECT * FROM {$dbprefix}answers WHERE qid={$deqrow['qid']} ORDER BY sortorder, answer"; $dearesult = mysql_query($deaquery); + $deacount=mysql_num_rows($dearesult); + if ($deqrow['other'] == "Y") {$deacount++;} + if ($deacount > $repeatheadings) + { + $columns=$deacount/$repeatheadings; + $spacing=sprintf("%02d", 100/$columns); + $upto=0; + echo "
$setfont\n"; + while ($dearow = mysql_fetch_array($dearesult)) + { + if ($upto == $repeatheadings) + { + echo "$setfont"; + $upto=0; + } + echo "\t\t\t{$dearow['answer']}
\n"; + $upto++; + } + if ($deqrow['other'] == "Y") + { + echo "\t\t\t"._OTHER."
\n"; + } + echo "
\n"; + //Let's break the presentation into columns. + } + else + { while ($dearow = mysql_fetch_array($dearesult)) { echo "\t\t\t{$dearow['answer']}
\n"; @@ -315,13 +342,40 @@ echo "\t\t\t$setfont"._PS_CHOOSEANY."
\n"; $meaquery = "SELECT * FROM {$dbprefix}answers WHERE qid={$deqrow['qid']} ORDER BY sortorder, answer"; $mearesult = mysql_query($meaquery); + $meacount = mysql_num_rows($mearesult); + if ($deqrow['other'] == "Y") {$meacount++;} + if ($meacount > $repeatheadings) + { + $columns=$deacount/$repeatheadings; + $spacing=sprintf("%02d", 100/$columns); + $upto=0; + echo "
$setfont\n"; while ($mearow = mysql_fetch_array($mearesult)) { - echo "\t\t\t{$mearow['answer']}
\n"; + if ($upto == $repeatheadings) + { + echo "
$setfont"; + $upto=0; + } + echo "\t\t\t{$mearow['answer']}
\n"; + $upto++; + } + if ($deqrow['other'] == "Y") + { + echo "\t\t\t"._OTHER.": \n"; + } + echo "
\n"; } - if ($deqrow['other'] == "Y") + else { - echo "\t\t\t"._OTHER.": \n"; + while ($mearow = mysql_fetch_array($mearesult)) + { + echo "\t\t\t{$mearow['answer']}
\n"; + } + if ($deqrow['other'] == "Y") + { + echo "\t\t\t"._OTHER.": \n"; + } } break; case "P": //MULTIPLE OPTIONS WITH COMMENTS