Navigation Menu

Skip to content

Commit

Permalink
Numerious fixes, including special support for Gender type, and yes/n…
Browse files Browse the repository at this point in the history
…o type.

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/phpsurveyor@2577 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
David Olivier committed Mar 13, 2007
1 parent 239c1ff commit 7c51a4a
Showing 1 changed file with 47 additions and 3 deletions.
50 changes: 47 additions & 3 deletions admin/spss.php
Expand Up @@ -45,7 +45,7 @@
header("Content-Disposition: ".
(strpos($_SERVER["HTTP_USER_AGENT"],"MSIE 5.5")?""
:"attachment; ").
"filename=survey.sps");
"filename=survey_".$surveyid.".sps");

// Get Base Language:

Expand Down Expand Up @@ -144,6 +144,18 @@
{
$teststring .= "1";
}
if ($val_row[$fieldname] == "F")
{
$teststring .= "1";
}
if ($val_row[$fieldname] == "M")
{
$teststring .= "2";
}
if ($val_row[$fieldname] == "N")
{
$teststring .= "2";
}
else if ($val_row[$fieldname] != "-oth-")
{
$teststring .= $val_row[$fieldname];
Expand Down Expand Up @@ -178,7 +190,7 @@
$fgid=$fielddata['gid'];
$code=$fielddata['aid'];
}
$tempArray=array($fieldno++ =>array("id"=>"d".$fieldno,"name"=>substr($fieldname, 0, 8),"qid"=>$qid, "code"=>$code, "type"=>"$fieldtype", "ftype"=>"$ftype","sql_name"=>$row["Field"]));
$tempArray=array($fieldno++ =>array("id"=>"d".$fieldno,"name"=>substr($fieldname, 0, 8),"qid"=>$qid, "code"=>$code, "type"=>"$fieldtype", "ftype"=>"$ftype","sql_name"=>$row["Field"],"size"=>$val_size));
$fields = $fields + $tempArray;
}

Expand Down Expand Up @@ -267,6 +279,26 @@
#convert mysql datestamp (yyyy-mm-dd hh:mm:ss) to SPSS datetime (dd-mmm-yyyy hh:mm:ss) format
list( $year, $month, $day, $hour, $minute, $second ) = split( '([^0-9])', $row[$fieldno] );
echo "'".date("d-m-Y H:i:s", mktime( $hour, $minute, $second, $month, $day, $year ) )."' ";
} else if ($fields[$fieldno]["ftype"] == "Y")
{
if ($row[$fieldno] == "Y")
{
echo "'1' ";
} else if ($row[$fieldno] == "N"){
echo "'2' ";
} else {
echo "'0' ";
}
} else if ($fields[$fieldno]["ftype"] == "G")
{
if ($row[$fieldno] == "F")
{
echo "'1' ";
} else if ($row[$fieldno] == "M"){
echo "'2' ";
} else {
echo "'0' ";
}
} else if ($fields[$fieldno]["ftype"] == "M")
{
if ($fields[$fieldno]["code"] == "other")
Expand Down Expand Up @@ -434,7 +466,7 @@
}
}
}
if ($field['ftype'] == "M" && $field['code'] != "other")
if ($field['ftype'] == "M" && $field['code'] != "other" && $field['size'] > 0)
{
echo "VALUE LABELS ".$field["id"]."\n";
echo "1 \"".$clang->gT("Yes")."\"\n";
Expand All @@ -446,6 +478,18 @@
echo "1 \"".$clang->gT("Yes")."\"\n";
echo "2 \"".$clang->gT("No")."\".\n";
}
if ($field['ftype'] == "G" && $field['size'] > 0)
{
echo "VALUE LABELS ".$field["id"]."\n";
echo "1 \"".$clang->gT("Female")."\"\n";
echo "2 \"".$clang->gT("Male")."\".\n";
}
if ($field['ftype'] == "Y" && $field['size'] > 0)
{
echo "VALUE LABELS ".$field["id"]."\n";
echo "1 \"".$clang->gT("Yes")."\"\n";
echo "2 \"".$clang->gT("No")."\".\n";
}
}
}
?>

0 comments on commit 7c51a4a

Please sign in to comment.