Skip to content

Commit

Permalink
All array type questions now listen to the "shownoanswer" setting fro…
Browse files Browse the repository at this point in the history
…m config.php

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/trunk/unstable@982 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
jcleeland committed Apr 9, 2004
1 parent 8c3ff3a commit 1e8edc3
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions qanda.php
Expand Up @@ -1019,7 +1019,7 @@ function do_gender($ia)

function do_array_5point($ia)
{
global $dbprefix;
global $dbprefix, $shownoanswer;
$qquery = "SELECT other FROM {$dbprefix}questions WHERE qid=".$ia[0];
$qresult = mysql_query($qquery);
while($qrow = mysql_fetch_array($qresult)) {$other = $qrow['other'];}
Expand All @@ -1034,7 +1034,7 @@ function do_array_5point($ia)
{
$answer .= "\t\t\t\t\t<td align='center' class='array1'>$xc</td>\n";
}
if ($ia[6] != "Y") //Question is not mandatory
if ($ia[6] != "Y" && $shownoanswer == 1) //Question is not mandatory
{
$answer .= "\t\t\t\t\t<td align='center' class='array1'>"._NOTAPPLICABLE."</td>\n";
}
Expand All @@ -1051,7 +1051,7 @@ function do_array_5point($ia)
if (isset($_SESSION[$myfname]) && $_SESSION[$myfname] == $i) {$answer .= " checked";}
$answer .= " onClick='checkconditions(this.value, this.name, this.type)' /></td>\n";
}
if ($ia[6] != "Y")
if ($ia[6] != "Y" && $shownoanswer == 1)
{
$answer .= "\t\t\t\t\t<td align='center'><input class='radio' type='radio' name='$myfname' value=''";
if (!isset($_SESSION[$myfname]) || $_SESSION[$myfname] == "") {$answer .= " checked";}
Expand All @@ -1071,7 +1071,7 @@ function do_array_5point($ia)

function do_array_10point($ia)
{
global $dbprefix;
global $dbprefix, $shownoanswer;
$qquery = "SELECT other FROM {$dbprefix}questions WHERE qid=".$ia[0];
$qresult = mysql_query($qquery);
while($qrow = mysql_fetch_array($qresult)) {$other = $qrow['other'];}
Expand All @@ -1086,7 +1086,7 @@ function do_array_10point($ia)
{
$answer .= "\t\t\t\t\t<td align='center' class='array1'>$xc</td>\n";
}
if ($ia[6] != "Y") //Question is not mandatory
if ($ia[6] != "Y" && $shownoanswer == 1) //Question is not mandatory
{
$answer .= "\t\t\t\t\t<td align='center' class='array1'>"._NOTAPPLICABLE."</td>\n";
}
Expand All @@ -1103,7 +1103,7 @@ function do_array_10point($ia)
if (isset($_SESSION[$myfname]) && $_SESSION[$myfname] == $i) {$answer .= " checked";}
$answer .= " onClick='checkconditions(this.value, this.name, this.type)' /></td>\n";
}
if ($ia[6] != "Y")
if ($ia[6] != "Y" && $shownoanswer == 1)
{
$answer .= "\t\t\t\t\t<td align='center'><input class='radio' type='radio' name='$myfname' value=''";
if (!isset($_SESSION[$myfname]) || $_SESSION[$myfname] == "") {$answer .= " checked";}
Expand All @@ -1122,7 +1122,7 @@ function do_array_10point($ia)

function do_array_yesnouncertain($ia)
{
global $dbprefix;
global $dbprefix, $shownoanswer;
$qquery = "SELECT other FROM {$dbprefix}questions WHERE qid=".$ia[0];
$qresult = mysql_query($qquery);
while($qrow = mysql_fetch_array($qresult)) {$other = $qrow['other'];}
Expand All @@ -1136,7 +1136,7 @@ function do_array_yesnouncertain($ia)
. "\t\t\t\t\t<td align='center' class='array1'>"._YES."</td>\n"
. "\t\t\t\t\t<td align='center' class='array1'>"._UNCERTAIN."</td>\n"
. "\t\t\t\t\t<td align='center' class='array1'>"._NO."</td>\n";
if ($ia[6] != "Y") //Question is not mandatory
if ($ia[6] != "Y" && $shownoanswer == 1) //Question is not mandatory
{
$answer .= "\t\t\t\t\t<td align='center' class='array1'>"._NOTAPPLICABLE."</td>\n";
}
Expand All @@ -1156,7 +1156,7 @@ function do_array_yesnouncertain($ia)
. "\t\t\t\t\t\t<td align='center'><input class='radio' type='radio' name='$myfname' value='N'";
if (isset($_SESSION[$myfname]) && $_SESSION[$myfname] == "N") {$answer .= " checked";}
$answer .= " onClick='checkconditions(this.value, this.name, this.type)' /></td>\n";
if ($ia[6] != "Y")
if ($ia[6] != "Y" && $shownoanswer == 1)
{
$answer .= "\t\t\t\t\t<td align='center'><input class='radio' type='radio' name='$myfname' value=''";
if (!isset($_SESSION[$myfname]) || $_SESSION[$myfname] == "") {$answer .= " checked";}
Expand All @@ -1176,6 +1176,7 @@ function do_array_yesnouncertain($ia)
function do_array_increasesamedecrease($ia)
{
global $dbprefix;
global $shownoanswer;
$qquery = "SELECT other FROM {$dbprefix}questions WHERE qid=".$ia[0];
$qresult = mysql_query($qquery);
while($qrow = mysql_fetch_array($qresult)) {$other = $qrow['other'];}
Expand All @@ -1189,7 +1190,7 @@ function do_array_increasesamedecrease($ia)
. "\t\t\t\t\t<td align='center' class='array1'>"._INCREASE."</td>\n"
. "\t\t\t\t\t<td align='center' class='array1'>"._SAME."</td>\n"
. "\t\t\t\t\t<td align='center' class='array1'>"._DECREASE."</td>\n";
if ($ia[6] != "Y") //Question is not mandatory
if ($ia[6] != "Y" && $shownoanswer == 1) //Question is not mandatory
{
$answer .= "\t\t\t\t\t<td align='center' class='array1'>"._NOTAPPLICABLE."</td>\n";
}
Expand All @@ -1209,7 +1210,7 @@ function do_array_increasesamedecrease($ia)
. "\t\t\t\t\t\t<td align='center'><input class='radio' type='radio' name='$myfname' value='D'";
if (isset($_SESSION[$myfname]) && $_SESSION[$myfname] == "D") {$answer .= " checked";}
$answer .= " onClick='checkconditions(this.value, this.name, this.type)' /></td>\n";
if ($ia[6] != "Y")
if ($ia[6] != "Y" && $shownoanswer == 1)
{
$answer .= "\t\t\t\t\t<td align='center'><input class='radio' type='radio' name='$myfname' value=''";
if (!isset($_SESSION[$myfname]) || $_SESSION[$myfname] == "") {$answer .= " checked";}
Expand Down Expand Up @@ -1301,8 +1302,6 @@ function do_array_flexible($ia)
$fn++;
}
$answer .= "\t\t\t</table>\n";
unset($labelans);
unset($labelcode);
return array($answer, $inputnames);
}

Expand Down Expand Up @@ -1360,7 +1359,6 @@ function do_array_flexiblecolumns($ia)
$percwidth=100/($ansrowcount + 1);
foreach($labels as $ansrow)
{
//$myfname = $ia[1].$ansrow['code'];
$answer .= "\t\t\t\t<tr>\n"
. "\t\t\t\t\t<td align='right' class='array1' width='$percwidth%'>{$ansrow['answer']}</td>\n";
foreach ($anscode as $ld)
Expand All @@ -1375,6 +1373,7 @@ function do_array_flexiblecolumns($ia)
$answer .= "\t\t\t\t</tr>\n";
$fn++;
}

foreach($anscode as $ld)
{
$myfname=$ia[1].$ld;
Expand All @@ -1384,9 +1383,6 @@ function do_array_flexiblecolumns($ia)
$inputnames[]=$myfname;
}
$answer .= "\t\t\t</table>\n";
unset($labelans);
unset($labelcode);
unset($oldmyfname);
return array($answer, $inputnames);
}

Expand Down

0 comments on commit 1e8edc3

Please sign in to comment.