diff --git a/admin/statistics.php b/admin/statistics.php index 805c8862cad..776be9d7158 100644 --- a/admin/statistics.php +++ b/admin/statistics.php @@ -65,7 +65,7 @@ echo "$setfontFilter Settings\n"; echo "\t
\n"; // 1: Get list of questions with predefined answers from survey -$query = "SELECT qid, questions.gid, type, title, group_name, question FROM questions, groups WHERE questions.gid=groups.gid AND questions.sid='$sid' AND type IN ('5', 'G', 'L', 'O', 'M', 'P', 'Y', 'A', 'B', 'C') ORDER BY group_name, title"; +$query = "SELECT qid, questions.gid, type, title, group_name, question FROM questions, groups WHERE questions.gid=groups.gid AND questions.sid='$sid' ORDER BY group_name, title"; $result = mysql_query($query) or die("Couldn't do it!
$query
".mysql_error()); while ($row=mysql_fetch_row($result)) { @@ -88,7 +88,7 @@ //echo $flt[2]; //debugging line if ($counter == 4) {echo "\t\t\t\t\n\t\t\t\t";} $myfield = "{$sid}X{$flt[1]}X{$flt[0]}"; - if ($flt[2] != "A" && $flt[2] != "B" && $flt[2] != "C") //Have to make an exception for these types! + if ($flt[2] != "A" && $flt[2] != "B" && $flt[2] != "C" && $flt[2] != "T" && $flt[2] != "S" && $flt[2] != "D") //Have to make an exception for these types! { echo "\t\t\t\t"; echo "$setfont$flt[3] "; //Heading (Question No) @@ -105,6 +105,36 @@ echo "\t\t\t\t\t\n"; switch ($flt[2]) { + case "T": // Long free text + + $myfield2="T$myfield"; + + echo "\t\t\t\t$setfont$flt[3]"; //heading + echo " $flt[5] [$row[1]]"; + echo "
\n"; + echo "\t\t\t\t\tResponses containing:
\n"; + echo "\t\t\t\t\t"; + break; + case "S": // Short free text + + $myfield2="T$myfield"; + + echo "\t\t\t\t$setfont$flt[3]"; //heading + echo " $flt[5] [$row[1]]"; + echo "
\n"; + echo "\t\t\t\t\tResponses containing:
\n"; + echo "\t\t\t\t\t"; + break; + case "D": // Date + $myfield2="D$myfield"; + echo "\t\t\t\t$setfont$flt[3]"; //heading + echo " $flt[5] [$row[1]]"; + echo "
\n"; + echo "\t\t\t\t\tDate (YYYY-MM-DD) equals:
\n"; + echo "\t\t\t\t\t
\n"; + echo "\t\t\t\t\t  OR between:
\n"; + echo "\t\t\t\t\t & \n"; + break; case "5": // 5 point choice for ($i=1; $i<=5; $i++) { @@ -225,9 +255,9 @@ echo ">$row[1]\n"; } } - if ($flt[2] != "A" && $flt[2] != "B" && $flt[2] != "C") //Have to make an exception for these types! + if ($flt[2] != "A" && $flt[2] != "B" && $flt[2] != "C" && $flt[2] != "T" && $flt[2] != "S" && $flt[2] != "D") //Have to make an exception for these types! { - echo "\t\t\t\t\n\t\t\t\t\n"; + echo "\n\t\t\t\t\n"; } $currentgroup=$flt[1]; $counter++; @@ -253,7 +283,8 @@ for (reset($_POST); $key=key($_POST); next($_POST)) { $postvars[]=$key;} // creates array of post variable names foreach ($postvars as $pv) { - if ($pv != "sid" && $pv != "display" && substr($pv, 0, 1) != "M" && $pv != "summary") //pull out just the fieldnames + $firstletter=substr($pv,0,1); + if ($pv != "sid" && $pv != "display" && $firstletter != "M" && $firstletter != "T" && $pv != "summary") //pull out just the fieldnames { $thisquestion = "$pv IN ("; foreach ($$pv as $condition) @@ -282,6 +313,10 @@ $selects[]="($thismulti)"; } } + elseif (substr($pv, 0, 1) == "T" && $_POST[$pv] != "") + { + $selects[]=substr($pv, 1, strlen($pv))." like '%".$_POST[$pv]."%'"; + } } // 2: Do SQL query $query = "SELECT count(*) FROM survey_$sid";