Skip to content

Commit

Permalink
Updated with 'array (flexible labels)' question type
Browse files Browse the repository at this point in the history
git-svn-id: file:///Users/Shitiz/Downloads/lssvn/trunk/unstable@555 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
jcleeland committed Jul 21, 2003
1 parent 3db6f56 commit ef3c075
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 3 deletions.
2 changes: 1 addition & 1 deletion group.php
Expand Up @@ -519,7 +519,7 @@
{
//WE ARE CREATING A SESSION VARIABLE FOR EVERY FIELD IN THE SURVEY
$fieldname = "{$arow['sid']}X{$arow['gid']}X{$arow['qid']}";
if ($arow['type'] == "M" || $arow['type'] == "A" || $arow['type'] == "B" || $arow['type'] == "C" || $arow['type'] == "E" || $arow['type'] == "P")
if ($arow['type'] == "M" || $arow['type'] == "A" || $arow['type'] == "B" || $arow['type'] == "C" || $arow['type'] == "E" || $arow['type'] == "F" || $arow['type'] == "P")
{
$abquery = "SELECT answers.*, questions.other FROM answers, questions WHERE answers.qid=questions.qid AND sid=$sid AND questions.qid={$arow['qid']} ORDER BY answers.code";
$abresult = mysql_query($abquery);
Expand Down
53 changes: 53 additions & 0 deletions qanda.php
Expand Up @@ -843,6 +843,59 @@
}
$answer .= "\t\t\t</table>\n";
break;
case "F": //ARRAY (Flexible)
$qquery = "SELECT other, lid FROM questions WHERE qid=".$ia[0];
$qresult = mysql_query($qquery);
while($qrow = mysql_fetch_array($qresult)) {$other = $qrow['other']; $lid = $qrow['lid'];}
$lquery = "SELECT * FROM labels WHERE lid=$lid ORDER BY sortorder, code";
//echo $lquery;
$lresult = mysql_query($lquery);
while ($lrow=mysql_fetch_array($lresult))
{
$labelans[]=$lrow['title'];
$labelcode[]=$lrow['code'];
}
$ansquery = "SELECT * FROM answers WHERE qid={$ia[0]} ORDER BY sortorder, answer";
$ansresult = mysql_query($ansquery);
$anscount = mysql_num_rows($ansresult);
$fn=1;
$answer .= "\t\t\t<table class='question'>\n";
$answer .= "\t\t\t\t<tr>\n";
$answer .= "\t\t\t\t\t<td></td>\n";
foreach ($labelans as $ld)
{
$answer .= "\t\t\t\t\t<td align='center' class='array1'><font size='1'>".$ld."</td>\n";
}
$answer .= "\t\t\t\t</tr>\n";
while ($ansrow = mysql_fetch_array($ansresult))
{
$myfname = $ia[1].$ansrow['code'];
if ($trbc == "array1" || !$trbc) {$trbc = "array2";} else {$trbc = "array1";}
$answer .= "\t\t\t\t<tr class='$trbc'>\n";
$answer .= "\t\t\t\t\t<td align='right'>{$ansrow['answer']}</td>\n";
foreach ($labelcode as $ld)
{
$answer .= "\t\t\t\t\t<td align='center'><input class='radio' type='radio' name='$myfname' value='$ld'";
if ($_SESSION[$myfname] == $ld['code']) {$answer .= " checked";}
$answer .= " onClick='checkconditions(this.value, this.name, this.type)' /></td>\n";
}
$answer .= "\t\t\t\t</tr>\n";
$answer .= "\t\t\t\t<input type='hidden' name='java$myfname' id='java$myfname' value='{$_SESSION[$myfname]}'>\n";
$inputnames[]=$myfname;
$fn++;
if ($ia[6] == "Y" && $ia[7] != "Y") //Question is mandatory. Add to mandatory array
{
$mandatorys[]=$myfname;
$mandatoryfns[]=$ia[1];
}
if ($ia[6] == "Y" && $ia[7] == "Y")
{
$conmandatorys[]=$myfname;
$conmandatoryfns[]=$ia[1];
}
}
$answer .= "\t\t\t</table>\n";
break;
}
$answer .= "\n\t\t\t<input type='hidden' name='display$ia[1]' id='display$ia[0]' value='";
if ($surveyformat == "S")
Expand Down
2 changes: 1 addition & 1 deletion question.php
Expand Up @@ -456,7 +456,7 @@
{
//WE ARE CREATING A SESSION VARIABLE FOR EVERY FIELD IN THE SURVEY
$fieldname = "{$arow['sid']}X{$arow['gid']}X{$arow['qid']}";
if ($arow['type'] == "M" || $arow['type'] == "A" || $arow['type'] == "B" || $arow['type'] == "C" || $arow['type'] == "E" || $arow['type'] == "P")
if ($arow['type'] == "M" || $arow['type'] == "A" || $arow['type'] == "B" || $arow['type'] == "C" || $arow['type'] == "E" || $arow['type'] == "F" || $arow['type'] == "P")
{
$abquery = "SELECT answers.*, questions.other FROM answers, questions WHERE answers.qid=questions.qid AND sid=$sid AND questions.qid={$arow['qid']} ORDER BY answers.code";
$abresult = mysql_query($abquery);
Expand Down
2 changes: 1 addition & 1 deletion survey.php
Expand Up @@ -521,7 +521,7 @@
{
//WE ARE CREATING A SESSION VARIABLE FOR EVERY FIELD IN THE SURVEY
$fieldname = "{$arow['sid']}X{$arow['gid']}X{$arow['qid']}";
if ($arow['type'] == "M" || $arow['type'] == "A" || $arow['type'] == "B" || $arow['type'] == "C" || $arow['type'] == "E" || $arow['type'] == "P")
if ($arow['type'] == "M" || $arow['type'] == "A" || $arow['type'] == "B" || $arow['type'] == "C" || $arow['type'] == "E" || $arow['type'] == "F" || $arow['type'] == "P")
{
$abquery = "SELECT answers.*, questions.other FROM answers, questions WHERE answers.qid=questions.qid AND sid=$sid AND questions.qid={$arow['qid']} ORDER BY answers.code";
$abresult = mysql_query($abquery);
Expand Down

0 comments on commit ef3c075

Please sign in to comment.