Skip to content

Commit

Permalink
BUGFIX: Fix a table nesting problem with multiple-column multiplechoi…
Browse files Browse the repository at this point in the history
…ce questions. provided by C Scott Ananian / Verified Voting

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/trunk/unstable@1247 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
jcleeland committed Oct 17, 2004
1 parent 2e08ff4 commit cc04020
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions qanda.php
Expand Up @@ -1213,12 +1213,14 @@ function do_multiplechoice($ia)
$answer .= "\t\t\t\t\t<input type='hidden' name='MULTI$ia[1]' value='$anscount'>\n";
$divider="";
$maxrows=0;
$closetable=false;
if ($dcols >0 && $anscount > $dcols) //Break into columns
{
$width=sprintf("%0d", 100/$dcols);
$maxrows=ceil(100*($anscount/$dcols)/100); //Always rounds up to nearest whole number
$answer .= "<table class='question'><tr>\n <td valign='top' width='$width%' nowrap>";
$divider=" </td>\n <td valign='top' width='$width%' nowrap>";
$closetable=true;
}
$fn = 1;
if (!isset($multifields)) {$multifields="";}
Expand Down Expand Up @@ -1251,6 +1253,7 @@ function do_multiplechoice($ia)
$anscount++;
if ($rowcounter==$maxrows) {$answer .= $divider; $rowcounter=0;}
}
if ($closetable) $answer.="</td></tr></table>\n";
$answer .= "\t\t\t\t\t</td>\n";
if ($dcols <1)
{ //This just makes a single column look a bit nicer
Expand Down

0 comments on commit cc04020

Please sign in to comment.