2
0
mirror of https://github.com/ACSPRI/queXS synced 2024-04-02 12:12:16 +00:00

Updated to Limesurvey 1.91+ Revision 11132

This commit is contained in:
azammitdcarf
2011-10-10 01:32:52 +00:00
parent 859396b9d0
commit 4e93b2e0ca
18 changed files with 290 additions and 202 deletions

View File

@@ -61,8 +61,7 @@ $maxchars = 50;
//don't call this script directly!
if (isset($_REQUEST['homedir'])) {die('You cannot start this script directly');}
include_once("login_check.php");
//some includes, the progressbar is used to show a progressbar while generating the graphs
//include_once("login_check.php");
@@ -409,7 +408,7 @@ foreach ($filters as $flt)
}
$statisticsoutput .= "\t\t<tr><td><div class='header ui-widget-header'>\n"
."<input type=\"checkbox\" id='btn_$flt[1]' onclick=\"selectCheckboxes('grp_$flt[1]', 'summary[]', 'btn_$flt[1]');\" />"
//use current groupname and groupid as heading
@@ -484,7 +483,7 @@ foreach ($filters as $flt)
// File Upload will need special filters in future, hence the special treatment
if ($flt[2] == "|") {$myfield = "|$myfield";}
//numerical input will get special treatment (arihtmetic mean, standard derivation, ...)
if ($flt[2] == "N") {$myfield = "N$myfield";}
$statisticsoutput .= "<input type='checkbox' id='filter$myfield' name='summary[]' value='$myfield'";
@@ -500,9 +499,9 @@ foreach ($filters as $flt)
*
* Auto-check the question types mentioned above
*/
if (isset($summary) && (array_search("{$surveyid}X{$flt[1]}X{$flt[0]}", $summary) !== FALSE
|| array_search("M{$surveyid}X{$flt[1]}X{$flt[0]}", $summary) !== FALSE
|| array_search("P{$surveyid}X{$flt[1]}X{$flt[0]}", $summary) !== FALSE
if (isset($summary) && (array_search("{$surveyid}X{$flt[1]}X{$flt[0]}", $summary) !== FALSE
|| array_search("M{$surveyid}X{$flt[1]}X{$flt[0]}", $summary) !== FALSE
|| array_search("P{$surveyid}X{$flt[1]}X{$flt[0]}", $summary) !== FALSE
|| array_search("N{$surveyid}X{$flt[1]}X{$flt[0]}", $summary) !== FALSE))
{$statisticsoutput .= " checked='checked'";}
@@ -554,18 +553,18 @@ foreach ($filters as $flt)
$myfield2="K{$myfield}".$row[0]."G";
$myfield3="K{$myfield}".$row[0]."L";
if ($counter2 == 4) {$statisticsoutput .= "\t\t\t\t</tr>\n\t\t\t\t<tr>\n"; $counter2=0;}
//start new TD
$statisticsoutput .= "\t\t\t\t<td align='center' valign='top'>";
//checkbox
$statisticsoutput .= "<input type='checkbox' name='summary[]' value='$myfield1'";
//check SGQA -> do we want to pre-check the checkbox?
if (isset($summary) && (array_search("K{$surveyid}X{$flt[1]}X{$flt[0]}{$row[0]}", $summary) !== FALSE))
{$statisticsoutput .= " checked='checked'";}
$statisticsoutput .= " />&nbsp;";
//show speaker
$statisticsoutput .= showSpeaker($flt[3]." - ".FlattenText($row[1]))."<br />\n";
@@ -580,10 +579,10 @@ foreach ($filters as $flt)
."\t\t\t\t\t<input type='text' name='$myfield3' value='";
if (isset($_POST[$myfield3])) {$statisticsoutput .= $_POST[$myfield3];}
$statisticsoutput .= "' onkeypress=\"return goodchars(event,'0123456789.,')\" /><br />\n";
//we added 1 form -> increase counter
$counter2++;
}
break;
@@ -603,16 +602,16 @@ foreach ($filters as $flt)
while ($row = $result->FetchRow())
{
//collecting data for output, for details see above (question type "N")
//we have one input field for each answer
$myfield2 = "Q".$myfield."$row[0]";
if ($counter2 == 4) {$statisticsoutput .= "\t\t\t\t</tr>\n\t\t\t\t<tr>\n"; $counter2=0;}
$statisticsoutput .= "\t\t\t\t<td align='center' valign='top'>";
$statisticsoutput .= "<input type='checkbox' name='summary[]' value='$myfield2'";
if (isset($summary) && (array_search("Q{$surveyid}X{$flt[1]}X{$flt[0]}{$row[0]}", $summary) !== FALSE))
{$statisticsoutput .= " checked='checked'";}
$statisticsoutput .= " />&nbsp;";
$statisticsoutput .= showSpeaker($flt[3]." - ".FlattenText($row[1]))
."<br />\n"
@@ -620,7 +619,7 @@ foreach ($filters as $flt)
."\t\t\t\t\t<input type='text' name='$myfield2' value='";
if (isset($_POST[$myfield2]))
{$statisticsoutput .= $_POST[$myfield2];}
$statisticsoutput .= "' />"
."\t\t\t\t</td>\n";
$counter2++;
@@ -759,7 +758,7 @@ foreach ($filters as $flt)
$statisticsoutput .= " /><strong>";
$statisticsoutput .= showSpeaker($niceqtext)
."<br />\n"
."\t\t\t\t\t<font size='1'>".$clang->gT("Date (YYYY-MM-DD) equals").":<br />\n"
."\t\t\t\t\t<input name='$myfield3' type='text' value='";
@@ -787,11 +786,11 @@ foreach ($filters as $flt)
for ($i=1; $i<=5; $i++)
{
$statisticsoutput .= "\t\t\t\t\t<option value='$i'";
//pre-select values which were marked before
if (isset($_POST[$myfield]) && is_array($_POST[$myfield]) && in_array($i, $_POST[$myfield]))
{$statisticsoutput .= " selected";}
$statisticsoutput .= ">$i</option>\n";
}
@@ -842,7 +841,7 @@ foreach ($filters as $flt)
foreach ($survlangs as $availlang)
{
$statisticsoutput .= "\t\t\t\t\t<option value='".$availlang."'";
//pre-select values which were marked before
if (isset($_POST[$myfield]) && is_array($_POST[$myfield]) && in_array($availlang, $_POST[$myfield]))
{$statisticsoutput .= " selected";}
@@ -869,24 +868,24 @@ foreach ($filters as $flt)
{
$myfield2 = $myfield.$row[0];
$statisticsoutput .= "<!-- $myfield2 - ";
if (isset($_POST[$myfield2])) {$statisticsoutput .= $_POST[$myfield2];}
$statisticsoutput .= " -->\n";
if ($counter2 == 4) {$statisticsoutput .= "\t\t\t\t</tr>\n\t\t\t\t<tr>\n"; $counter2=0;}
$statisticsoutput .= "\t\t\t\t<td align='center'>"
."<input type='checkbox' name='summary[]' value='$myfield2'";
//pre-check
if (isset($summary) && array_search($myfield2, $summary)!== FALSE) {$statisticsoutput .= " checked='checked'";}
$statisticsoutput .= " />&nbsp;"
.showSpeaker($niceqtext." ".str_replace("'", "`", $row[1])." - # ".$flt[3])
."<br />\n"
."\t\t\t\t<select name='{$surveyid}X{$flt[1]}X{$flt[0]}{$row[0]}[]' multiple='multiple'>\n";
//there are always exactly 5 values which have to be listed
for ($i=1; $i<=5; $i++)
{
@@ -898,10 +897,10 @@ foreach ($filters as $flt)
$statisticsoutput .= ">$i</option>\n";
}
$statisticsoutput .= "\t\t\t\t</select>\n\t\t\t\t</td>\n";
$counter2++;
//add this to all the other fields
}
@@ -921,23 +920,23 @@ foreach ($filters as $flt)
{
$myfield2 = $myfield . "$row[0]";
$statisticsoutput .= "<!-- $myfield2 - ";
if (isset($_POST[$myfield2])) {$statisticsoutput .= $_POST[$myfield2];}
$statisticsoutput .= " -->\n";
if ($counter2 == 4) {$statisticsoutput .= "\t\t\t\t</tr>\n\t\t\t\t<tr>\n"; $counter2=0;}
$statisticsoutput .= "\t\t\t\t<td align='center'>"; //heading
$statisticsoutput .= "<input type='checkbox' name='summary[]' value='$myfield2'";
if (isset($summary) && array_search($myfield2, $summary)!== FALSE) {$statisticsoutput .= " checked='checked'";}
$statisticsoutput .= " />&nbsp;"
.showSpeaker($niceqtext." ".str_replace("'", "`", $row[1])." - # ".$flt[3])
."<br />\n"
."\t\t\t\t<select name='{$surveyid}X{$flt[1]}X{$flt[0]}{$row[0]}[]' multiple='multiple'>\n";
//here wo loop through 10 entries to create a larger output form
for ($i=1; $i<=10; $i++)
{
@@ -946,7 +945,7 @@ foreach ($filters as $flt)
if (isset($_POST[$myfield2]) && $_POST[$myfield2] == $i) {$statisticsoutput .= " selected";}
$statisticsoutput .= ">$i</option>\n";
}
$statisticsoutput .= "\t\t\t\t</select>\n\t\t\t\t</td>\n";
$counter2++;
}
@@ -970,44 +969,44 @@ foreach ($filters as $flt)
{
$myfield2 = $myfield . "$row[0]";
$statisticsoutput .= "<!-- $myfield2 - ";
if (isset($_POST[$myfield2])) {$statisticsoutput .= $_POST[$myfield2];}
$statisticsoutput .= " -->\n";
if ($counter2 == 4) {$statisticsoutput .= "\t\t\t\t</tr>\n\t\t\t\t<tr>\n"; $counter2=0;}
$statisticsoutput .= "\t\t\t\t<td align='center'>"
."<input type='checkbox' name='summary[]' value='$myfield2'";
if (isset($summary) && array_search($myfield2, $summary)!== FALSE)
{$statisticsoutput .= " checked='checked'";}
$statisticsoutput .= " />&nbsp;<strong>"
.showSpeaker($niceqtext." ".str_replace("'", "`", $row[1])." - # ".$flt[3])
."</strong><br />\n"
."\t\t\t\t<select name='{$surveyid}X{$flt[1]}X{$flt[0]}{$row[0]}[]' multiple='multiple'>\n"
."\t\t\t\t\t<option value='Y'";
//pre-select "yes"
if (isset($_POST[$myfield2]) && is_array($_POST[$myfield2]) && in_array("Y", $_POST[$myfield2])) {$statisticsoutput .= " selected";}
$statisticsoutput .= ">".$clang->gT("Yes")."</option>\n"
."\t\t\t\t\t<option value='U'";
//pre-select "uncertain"
if (isset($_POST[$myfield2]) && is_array($_POST[$myfield2]) && in_array("U", $_POST[$myfield2])) {$statisticsoutput .= " selected";}
$statisticsoutput .= ">".$clang->gT("Uncertain")."</option>\n"
."\t\t\t\t\t<option value='N'";
//pre-select "no"
if (isset($_POST[$myfield2]) && is_array($_POST[$myfield2]) && in_array("N", $_POST[$myfield2])) {$statisticsoutput .= " selected";}
$statisticsoutput .= ">".$clang->gT("No")."</option>\n"
."\t\t\t\t</select>\n\t\t\t\t</td>\n";
$counter2++;
//add to array
}
@@ -1028,36 +1027,36 @@ foreach ($filters as $flt)
{
$myfield2 = $myfield . "$row[0]";
$statisticsoutput .= "<!-- $myfield2 - ";
if (isset($_POST[$myfield2])) {$statisticsoutput .= $_POST[$myfield2];}
$statisticsoutput .= " -->\n";
if ($counter2 == 4) {$statisticsoutput .= "\t\t\t\t</tr>\n\t\t\t\t<tr>\n"; $counter2=0;}
$statisticsoutput .= "\t\t\t\t<td align='center'>"
."<input type='checkbox' name='summary[]' value='$myfield2'";
if (isset($summary) && array_search($myfield2, $summary)!== FALSE) {$statisticsoutput .= " checked='checked'";}
$statisticsoutput .= " />&nbsp;<strong>"
.showSpeaker($niceqtext." ".str_replace("'", "`", $row[1])." - # ".$flt[3])
."</strong><br />\n"
."\t\t\t\t<select name='{$surveyid}X{$flt[1]}X{$flt[0]}{$row[0]}[]' multiple='multiple'>\n"
."\t\t\t\t\t<option value='I'";
if (isset($_POST[$myfield2]) && is_array($_POST[$myfield2]) && in_array("I", $_POST[$myfield2])) {$statisticsoutput .= " selected";}
$statisticsoutput .= ">".$clang->gT("Increase")."</option>\n"
."\t\t\t\t\t<option value='S'";
if (isset($_POST[$myfield]) && is_array($_POST[$myfield2]) && in_array("S", $_POST[$myfield2])) {$statisticsoutput .= " selected";}
$statisticsoutput .= ">".$clang->gT("Same")."</option>\n"
."\t\t\t\t\t<option value='D'";
if (isset($_POST[$myfield]) && is_array($_POST[$myfield2]) && in_array("D", $_POST[$myfield2])) {$statisticsoutput .= " selected";}
$statisticsoutput .= ">".$clang->gT("Decrease")."</option>\n"
."\t\t\t\t</select>\n\t\t\t\t</td>\n";
$counter2++;
@@ -1189,26 +1188,26 @@ foreach ($filters as $flt)
{
$myfield2 = $myfield . "$row[0]";
$statisticsoutput .= "<!-- $myfield2 - ";
if (isset($_POST[$myfield2])) {$statisticsoutput .= $_POST[$myfield2];}
$statisticsoutput .= " -->\n";
if ($counter2 == 4)
{
$statisticsoutput .= "\t\t\t\t</tr>\n\t\t\t\t<tr>\n";
$counter2=0;
}
$statisticsoutput .= "\t\t\t\t<td align='center'>"
."<input type='checkbox' name='summary[]' value='$myfield2'";
if (isset($summary) && array_search($myfield2, $summary)!== FALSE) {$statisticsoutput .= " checked='checked'";}
$statisticsoutput .= " />&nbsp;<strong>"
.showSpeaker($niceqtext." ".str_replace("'", "`", $row[1])." - # ".$flt[3])
."</strong><br />\n";
/*
* when hoovering the speaker symbol we show the whole question
*
@@ -1223,13 +1222,13 @@ foreach ($filters as $flt)
*/
$fquery = "SELECT * FROM ".db_table_name("answers")." WHERE qid={$flt[0]} AND language='{$language}' ORDER BY sortorder, code";
$fresult = db_execute_assoc($fquery);
//for debugging only:
//$statisticsoutput .= $fquery;
//creating form
$statisticsoutput .= "\t\t\t\t<select name='{$surveyid}X{$flt[1]}X{$flt[0]}{$row[0]}[]' multiple='multiple'>\n";
//loop through all possible answers
while ($frow = $fresult->FetchRow())
{
@@ -1240,10 +1239,10 @@ foreach ($filters as $flt)
$statisticsoutput .= ">({$frow['code']}) ".FlattenText($frow['answer'])."</option>\n";
}
$statisticsoutput .= "\t\t\t\t</select>\n\t\t\t\t</td>\n";
$counter2++;
//add fields to main array
}
@@ -1277,7 +1276,7 @@ foreach ($filters as $flt)
{
//adjust layout depending on counter
if ($counter2 == 4) {$statisticsoutput .= "\t\t\t\t</tr>\n\t\t\t\t<tr>\n"; $counter=0;}
//myfield is the SGQ identifier
//myfield2 is just used as comment in HTML like "R40X34X1721-1"
$myfield2 = "R" . $myfield . $i . "-" . strlen($i);
@@ -1285,19 +1284,19 @@ foreach ($filters as $flt)
$statisticsoutput .= "<!-- $myfield2 - ";
if (isset($_POST[$myfield2])) {$statisticsoutput .= $_POST[$myfield2];}
$statisticsoutput .= " -->\n"
."\t\t\t\t<td align='center'>"
."<input type='checkbox' name='summary[]' value='$myfield2'";
//pre-check
if (isset($summary) && array_search($myfield2, $summary) !== FALSE) {$statisticsoutput .= " checked='checked'";}
$statisticsoutput .= " />&nbsp;<strong>"
.showSpeaker($niceqtext." ".str_replace("'", "`", $row[1])." - # ".$flt[3])
."</strong><br />\n"
."\t\t\t\t<select name='{$surveyid}X{$flt[1]}X{$flt[0]}{$i}[]' multiple='multiple'>\n";
//output lists of ranking items
foreach ($answers as $ans)
{
@@ -1308,10 +1307,10 @@ foreach ($filters as $flt)
$statisticsoutput .= ">$ans[1]</option>\n";
}
$statisticsoutput .= "\t\t\t\t</select>\n\t\t\t\t</td>\n";
$counter2++;
//add averything to main array
}
@@ -1374,7 +1373,7 @@ foreach ($filters as $flt)
//check if there is a dualscale_headerA/B
$dshquery = "SELECT value FROM ".db_table_name("question_attributes")." WHERE qid={$flt[0]} AND attribute='dualscale_headerA'";
$dshresult = db_execute_num($dshquery) or safe_die ("Couldn't get dualscale header!<br />$dshquery<br />".$connect->ErrorMsg());
//get header
while($dshrow=$dshresult->FetchRow())
{
@@ -1393,7 +1392,7 @@ foreach ($filters as $flt)
$statisticsoutput .= " />&nbsp;<strong>"
.showSpeaker($niceqtext." [".str_replace("'", "`", $row[1])."] - ".$clang->gT("Label").": ".$labeltitle)
."</strong><br />\n";
/* get labels
* table "labels" contains
* - lid
@@ -1402,7 +1401,7 @@ foreach ($filters as $flt)
* - sortorder
* - language
*/
$fquery = "SELECT * FROM ".db_table_name("answers")." WHERE qid={$flt[0]} AND language='{$language}' and scale_id=0 ORDER BY sortorder, code";
$fresult = db_execute_assoc($fquery);
@@ -1430,7 +1429,7 @@ foreach ($filters as $flt)
//----------------- LABEL 2 ---------------------
//myfield2 = answer code
$myfield2 = $myfield . "$row[0]#1";
@@ -1460,7 +1459,7 @@ foreach ($filters as $flt)
//check if there is a dualsclae_headerA/B
$dshquery2 = "SELECT value FROM ".db_table_name("question_attributes")." WHERE qid={$flt[0]} AND attribute='dualscale_headerB'";
$dshresult2 = db_execute_num($dshquery2) or safe_die ("Couldn't get dualscale header!<br />$dshquery2<br />".$connect->ErrorMsg());
//get header
while($dshrow2=$dshresult2->FetchRow())
{
@@ -1481,7 +1480,7 @@ foreach ($filters as $flt)
$statisticsoutput .= " />&nbsp;<strong>"
.showSpeaker($niceqtext." [".str_replace("'", "`", $row[1])."] - ".$clang->gT("Label").": ".$labeltitle2)
."</strong><br />\n";
$fquery = "SELECT * FROM ".db_table_name("answers")." WHERE qid={$flt[0]} AND language='{$language}' and scale_id=1 ORDER BY sortorder, code";
$fresult = db_execute_assoc($fquery);
@@ -1552,10 +1551,10 @@ foreach ($filters as $flt)
while ($row=$result->FetchRow())
{
$statisticsoutput .= "\t\t\t\t\t\t<option value='{$row[0]}'";
//pre-check
if (isset($_POST[$myfield]) && is_array($_POST[$myfield]) && in_array($row[0], $_POST[$myfield])) {$statisticsoutput .= " selected";}
$statisticsoutput .= '>'.FlattenText($row[1])."</option>\n";
}