alert("HI");'; */ //split up results to extend statistics -> NOT WORKING YET! DO NOT ENABLE THIS! $showcombinedresults = 0; /* * this variable is used in the function shortencode() which cuts off a question/answer title * after $maxchars and shows the rest as tooltip */ $maxchars = 50; include_once("login_check.php"); //some includes, the progressbar is used to show a progressbar while generating the graphs //include_once("login_check.php"); require_once('classes/core/class.progressbar.php'); //we collect all the output within this variable $statisticsoutput =''; //output for chosing questions to cross query $cr_statisticsoutput = ''; // This gets all the 'to be shown questions' from the POST and puts these into an array $summary=returnglobal('summary'); $statlang=returnglobal('statlang'); //if $summary isn't an array we create one if (isset($summary) && !is_array($summary)) { $summary = explode("+", $summary); } //no survey ID? -> come and get one if (!isset($surveyid)) {$surveyid=returnglobal('sid');} //still no survey ID -> error if (!$surveyid) { //need to have a survey id $statisticsoutput .= "
You have not selected a survey!
"; exit; } // Set language for questions and answers to base language of this survey $language = GetBaseLanguageFromSurveyID($surveyid); //pick the best font file if font setting is 'auto' if ($chartfontfile=='auto') { $chartfontfile='vera.ttf'; if ( $language=='ar') { $chartfontfile='KacstOffice.ttf'; } elseif ($language=='fa' ) { $chartfontfile='KacstFarsi.ttf'; } elseif ($language=='el' ) { $chartfontfile='DejaVuLGCSans.ttf'; } elseif ($language=='zh-Hant-HK' || $language=='zh-Hant-TW' || $language=='zh-Hans') { $chartfontfile='fireflysung.ttf'; } } //$statisticsoutput .= " //"; //hide/show the filter //filtersettings by default aren't shown when showing the results $statisticsoutput .= ''; //headline with all icons for available statistic options //Get the menubar $statisticsoutput .= browsemenubar($clang->gT("Quick statistics")) //we need a form which can pass the selected data later ."
\n"; //Select public language file $query = "SELECT datestamp FROM {$dbprefix}surveys WHERE sid=$surveyid"; $result = db_execute_assoc($query) or safe_die("Error selecting language:
".$query."
".$connect->ErrorMsg()); /* * check if there is a datestamp available for this survey * yes -> $datestamp="Y" * no -> $datestamp="N" */ while ($row=$result->FetchRow()) {$datestamp=$row['datestamp'];} // 1: Get list of questions from survey /* * We want to have the following data * a) "questions" -> all table namens, e.g. * qid * sid * gid * type * title * question * preg * help * other * mandatory * lid * lid1 * question_order * language * * b) "groups" -> group_name + group_order * */ $query = "SELECT questions.*, groups.group_name, groups.group_order\n" ." FROM ".db_table_name("questions") ." as questions, ".db_table_name("groups")." as groups\n" ." WHERE groups.gid=questions.gid\n" ." AND groups.language='".$language."'\n" ." AND questions.language='".$language."'\n" ." AND questions.parent_qid=0\n" ." AND questions.sid=$surveyid"; $result = db_execute_assoc($query) or safe_die("Couldn't do it!
$query
".$connect->ErrorMsg()); //store all the data in $rows $rows = $result->GetRows(); //SORT IN NATURAL ORDER! usort($rows, 'GroupOrderThenQuestionOrder'); //put the question information into the filter array foreach ($rows as $row) { //store some column names in $filters array $filters[]=array($row['qid'], $row['gid'], $row['type'], $row['title'], $row['group_name'], FlattenText($row['question'])); } //var_dump($filters); // SHOW ID FIELD $statisticsoutput .= "
".$clang->gT("General filters")."
"; $grapherror=''; if (!function_exists("gd_info")) { $grapherror.='
'.$clang->gT('You do not have the GD Library installed. Showing charts requires the GD library to function properly.'); $grapherror.='
'.$clang->gT('visit http://us2.php.net/manual/en/ref.image.php for more information').'
'; } elseif (!function_exists("imageftbbox")) { $grapherror.='
'.$clang->gT('You do not have the Freetype Library installed. Showing charts requires the Freetype library to function properly.'); $grapherror.='
'.$clang->gT('visit http://us2.php.net/manual/en/ref.image.php for more information').'
'; } if ($grapherror!='') { unset($_POST['usegraph']); } //pre-selection of filter forms if (incompleteAnsFilterstate() == "filter") { $selecthide="selected='selected'"; $selectshow=""; $selectinc=""; } elseif (incompleteAnsFilterstate() == "inc") { $selecthide=""; $selectshow=""; $selectinc="selected='selected'"; } else { $selecthide=""; $selectshow="selected='selected'"; $selectinc=""; } $statisticsoutput .="
".$clang->gT("Data selection")."
    "; $statisticsoutput .="
  • \n"; $quexsfilterstate = questionnaireSampleFilterstate(); //queXS Addition include_once("../quexs.php"); $statisticsoutput .= "
  • \n"; $statisticsoutput .= "
  • gT("Count stats for each question based only on the total number of responses for which the question was displayed")."'>".$clang->gT("Subtotals based on displayed questions")." \n"; } $statisticsoutput .="
  • " . "
  • \n"; $statisticsoutput.="\n
\n"; $statisticsoutput .= "
".$clang->gT("Response ID")."
  • " ."\n" ."
  • \n" ."
\n"; $statisticsoutput .= ""; $statisticsoutput .= ""; //if the survey contains timestamps you can filter by timestamp, too if (isset($datestamp) && $datestamp == "Y") { $statisticsoutput .= "

" ."\n" ."\n" ."

"; //second row below options -> filter settings headline $statisticsoutput.="
" ."" .$clang->gT("Response filters") ."
\n"; $filterchoice_state=returnglobal('filterchoice_state'); $statisticsoutput.="\n"; $statisticsoutput .="" //use current groupname and groupid as heading ."$flt[4] (".$clang->gT("Question group")." $flt[1])\n\t\t" ."\n"; } //complete output $statisticsoutput .= "\n\t\t\t\t\n"; //add last lines to filter forms $statisticsoutput .= "\t\t\t
\n" ."
\n"; //counter which is used to adapt layout depending on counter # $counter=0; } //we don't want more than 4 questions in a row //and we need a new row after each multiple/array question if (isset($counter) && $counter == 4 || ($previousquestiontype == "1" || $previousquestiontype == "A" || $previousquestiontype == "B" || $previousquestiontype == "C" || $previousquestiontype == "E" || $previousquestiontype == "F" || $previousquestiontype == "H" || $previousquestiontype == "K" || $previousquestiontype == "Q" || $previousquestiontype == "R" || $previousquestiontype == ":" || $previousquestiontype == ";")) { $statisticsoutput .= "\t\t\t\t\n\t\t\t\t"; $counter=0; } /* * remember: $flt is structured like this * ['qid'], ['gid'], ['type'], ['title'], ['group_name'], ['question'], ['lid'], ['lid1']); */ //SGQ identifier $myfield = "{$surveyid}X{$flt[1]}X{$flt[0]}"; //full question title $niceqtext = FlattenText($flt[5]); /* * Check question type: This question types will be used (all others are separated in the if clause) * 5 - 5 Point Choice G - Gender I - Language Switch L - List (Radio) M - Multiple choice N - Numerical Input | - File Upload O - List With Comment P - Multiple choice with comments Y - Yes/No ! - List (Dropdown) ) */ if ($flt[2]=='M' || $flt[2]=='P' || $flt[2]=='N' || $flt[2]=='L' || $flt[2]=='5' || $flt[2]=='G' || $flt[2]=='I' || $flt[2]=='O' || $flt[2]=='Y' || $flt[2]=='!') //Have to make an exception for these types! { $statisticsoutput .= "\t\t\t\t\n\t\t\t\t\t\n"; //get answers $query = "SELECT title as code, question as answer FROM ".db_table_name("questions")." WHERE parent_qid='$flt[0]' AND language = '{$language}' ORDER BY question_order"; $result = db_execute_num($query) or safe_die ("Couldn't get answers!
$query
".$connect->ErrorMsg()); //counter is used for layout $counter2=0; //go through all the (multiple) answers while ($row=$result->FetchRow()) { /* * filter form for numerical input * - checkbox * - greater than * - less than */ $myfield1="K".$myfield.$row[0]; $myfield2="K{$myfield}".$row[0]."G"; $myfield3="K{$myfield}".$row[0]."L"; if ($counter2 == 4) {$statisticsoutput .= "\t\t\t\t\n\t\t\t\t\n"; $counter2=0;} //start new TD $statisticsoutput .= "\t\t\t\t\n\t\t\t\t\n"; //get subqestions $query = "SELECT title as code, question as answer FROM ".db_table_name("questions")." WHERE parent_qid='$flt[0]' AND language='{$language}' ORDER BY question_order"; $result = db_execute_num($query) or safe_die ("Couldn't get answers!
$query
".$connect->ErrorMsg()); $counter2=0; //loop through all answers 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\n\t\t\t\t\n"; $counter2=0;} $statisticsoutput .= "\t\t\t\t\n"; $counter2++; } $statisticsoutput .= "\t\t\t\t\n\t\t\t\t\n"; $counter=0; break; /* * all "free text" types (T, U, S) get the same prefix ("T") */ case "T": // Long free text case "U": // Huge free text $myfield2="T$myfield"; $statisticsoutput .= "\t\t\t\t\n"; break; case "S": // Short free text $myfield2="T$myfield"; $statisticsoutput .= "\t\t\t\t\n"; break; case "N": // Numerical //textfields for greater and less than X $myfield2="{$myfield}G"; $myfield3="{$myfield}L"; $statisticsoutput .= "\t\t\t\t\t".$clang->gT("Number greater than").":
\n" ."\t\t\t\t\t
\n" ."\t\t\t\t\t".$clang->gT("Number less than").":
\n" ."\t\t\t\t\t
\n"; //put field names into array break; case "|": // File Upload // Number of files uploaded for greater and less than X $myfield2 = "{$myfield}G"; $myfield3 = "{$myfield}L"; $statisticsoutput .= "\t\t\t\t\t".$clang->gT("Number of files greater than").":
\n" ."\t\t\t\t\t
\n" ."\t\t\t\t\t".$clang->gT("Number of files less than").":
\n" ."\t\t\t\t\t
\n"; //put field names into array break; /* * DON'T show any statistics for date questions * because there aren't any statistics implemented yet! * * Only filtering by date is possible. * * See bug report #2539 and * feature request #2620 */ case "D": // Date /* * - input name * - date equals * - date less than * - date greater than */ $myfield2="D$myfield"; $myfield3="$myfield2="; $myfield4="$myfield2<"; $myfield5="$myfield2>"; $statisticsoutput .= "\t\t\t\t\n"; break; case "Y": // Yes\No $statisticsoutput .= "\t\t\t\t\t\n" ."\t\t\t\t\t\n"; break; case "I": // Language $survlangs = GetAdditionalLanguagesFromSurveyID($surveyid); $survlangs[] = GetBaseLanguageFromSurveyID($surveyid); foreach ($survlangs as $availlang) { $statisticsoutput .= "\t\t\t\t\t\n\t\t\t\t\n"; //get answers $query = "SELECT title, question FROM ".db_table_name("questions")." WHERE parent_qid='$flt[0]' AND language='{$language}' ORDER BY question_order"; $result = db_execute_num($query) or safe_die ("Couldn't get answers!
$query
".$connect->ErrorMsg()); $counter2=0; //check all the results while ($row=$result->FetchRow()) { $myfield2 = $myfield.$row[0]; $statisticsoutput .= "\n"; if ($counter2 == 4) {$statisticsoutput .= "\t\t\t\t\n\t\t\t\t\n"; $counter2=0;} $statisticsoutput .= "\t\t\t\t\n\t\t\t\t\n"; $counter2=0;} $statisticsoutput .= "\t\t\t\t\n\t\t\t\t\n"; //get answers $query = "SELECT title, question FROM ".db_table_name("questions")." WHERE parent_qid='$flt[0]' AND language='{$language}' ORDER BY question_order"; $result = db_execute_num($query) or safe_die ("Couldn't get answers!
$query
".$connect->ErrorMsg()); $counter2=0; //loop answers while ($row=$result->FetchRow()) { $myfield2 = $myfield . "$row[0]"; $statisticsoutput .= "\n"; if ($counter2 == 4) {$statisticsoutput .= "\t\t\t\t\n\t\t\t\t\n"; $counter2=0;} $statisticsoutput .= "\t\t\t\t\n"; $counter2++; //add to array } $statisticsoutput .= "\t\t\t\t\n\t\t\t\t\n"; $counter=0; break; //similiar to the above one case "E": // ARRAY OF Increase/Same/Decrease QUESTIONS $statisticsoutput .= "\t\t\t\t\n\t\t\t\t\n"; $query = "SELECT title, question FROM ".db_table_name("questions")." WHERE parent_qid='$flt[0]' AND language='{$language}' ORDER BY question_order"; $result = db_execute_num($query) or safe_die ("Couldn't get answers!
$query
".$connect->ErrorMsg()); $counter2=0; while ($row=$result->FetchRow()) { $myfield2 = $myfield . "$row[0]"; $statisticsoutput .= "\n"; if ($counter2 == 4) {$statisticsoutput .= "\t\t\t\t\n\t\t\t\t\n"; $counter2=0;} $statisticsoutput .= "\t\t\t\t\n"; $counter2++; } $statisticsoutput .= "\t\t\t\t\n\t\t\t\t\n"; $counter=0; break; case ";": //ARRAY (Multi Flex) (Text) $statisticsoutput .= "\t\t\t\t\n\t\t\t\t\n"; $query = "SELECT title, question FROM ".db_table_name("questions")." WHERE parent_qid='$flt[0]' AND language='{$language}' AND scale_id=0 ORDER BY question_order"; $result = db_execute_num($query) or die ("Couldn't get answers!
$query
".$connect->ErrorMsg()); $counter2=0; while ($row=$result->FetchRow()) { $fquery = "SELECT title, question FROM ".db_table_name("questions")." WHERE parent_qid='$flt[0]' AND language='{$language}' AND scale_id=1 ORDER BY question_order"; $fresult = db_execute_assoc($fquery); while ($frow = $fresult->FetchRow()) { $myfield2 = "T".$myfield . $row[0] . "_" . $frow['title']; $statisticsoutput .= "\n"; if ($counter2 == 4) {$statisticsoutput .= "\t\t\t\t\n\t\t\t\t\n"; $counter2=0;} $statisticsoutput .= "\t\t\t\t\n"; $counter2++; } } $statisticsoutput .= "\t\t\t\t\n\t\t\t\t\n"; $query = "SELECT title, question FROM ".db_table_name("questions")." WHERE parent_qid='$flt[0]' AND language = '{$language}' AND scale_id=0 ORDER BY question_order"; $result = db_execute_num($query) or die ("Couldn't get answers!
$query
".$connect->ErrorMsg()); $counter2=0; //Get qidattributes for this question $qidattributes=getQuestionAttributes($flt[0]); if (trim($qidattributes['multiflexible_max'])!='' && trim($qidattributes['multiflexible_min']) ==''){ $maxvalue=$qidattributes['multiflexible_max']; $minvalue=1; } if (trim($qidattributes['multiflexible_min'])!='' && trim($qidattributes['multiflexible_max']) ==''){ $minvalue=$qidattributes['multiflexible_min']; $maxvalue=$qidattributes['multiflexible_min'] + 10; } if (trim($qidattributes['multiflexible_min'])=='' && trim($qidattributes['multiflexible_max']) ==''){ $minvalue=1; $maxvalue=10; } if (trim($qidattributes['multiflexible_min']) !='' && trim($qidattributes['multiflexible_max']) !=''){ if($qidattributes['multiflexible_min'] < $qidattributes['multiflexible_max']){ $minvalue=$qidattributes['multiflexible_min']; $maxvalue=$qidattributes['multiflexible_max']; } } if (trim($qidattributes['multiflexible_step'])!='') { $stepvalue=$qidattributes['multiflexible_step']; } else { $stepvalue=1; } if ($qidattributes['multiflexible_checkbox']!=0) { $minvalue=0; $maxvalue=1; $stepvalue=1; } while ($row=$result->FetchRow()) { $fquery = "SELECT * FROM ".db_table_name("questions")." WHERE parent_qid={$flt[0]} AND language='{$language}' AND scale_id=1 ORDER BY question_order, title"; $fresult = db_execute_assoc($fquery); while ($frow = $fresult->FetchRow()) { $myfield2 = $myfield . $row[0] . "_" . $frow['title']; $statisticsoutput .= "\n"; if ($counter2 == 4) {$statisticsoutput .= "\t\t\t\t\n\t\t\t\t\n"; $counter2=0;} $statisticsoutput .= "\t\t\t\t\n\t\t\t\t\n"; $counter2=0; } $statisticsoutput .= "\t\t\t\t\n"; $counter2++; //add fields to main array } //$statisticsoutput .= "\t\t\t\t\n\t\t\t\t\n"; //get some answers $query = "SELECT code, answer FROM ".db_table_name("answers")." WHERE qid='$flt[0]' AND language='{$language}' ORDER BY sortorder, answer"; $result = db_execute_assoc($query) or safe_die ("Couldn't get answers!
$query
".$connect->ErrorMsg()); //get number of answers $count = $result->RecordCount(); //lets put the answer code and text into the answers array while ($row = $result->FetchRow()) { $answers[]=array($row['code'], $row['answer']); } $counter2=0; //loop through all answers. if there are 3 items to rate there will be 3 statistics for ($i=1; $i<=$count; $i++) { //adjust layout depending on counter if ($counter2 == 4) {$statisticsoutput .= "\t\t\t\t\n\t\t\t\t\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); $myfield3 = $myfield . $i; $statisticsoutput .= "\n" ."\t\t\t\t\n\t\t\t\t\n"; $counter=0; unset($answers); break; //Boilerplate questions are only used to put some text between other questions -> no analysis needed case "X": //This is a boilerplate question and it has no business in this script $statisticsoutput .= "\t\t\t\t"; break; case "1": // MULTI SCALE $statisticsoutput .= "\t\t\t\t\n\t\t\t\t\n"; //special dual scale counter $counter2=0; //get answers $query = "SELECT title, question FROM ".db_table_name("questions")." WHERE parent_qid='$flt[0]' AND language='{$language}' ORDER BY question_order"; $result = db_execute_num($query) or safe_die ("Couldn't get answers!
$query
".$connect->ErrorMsg()); //loop through answers while ($row=$result->FetchRow()) { //----------------- LABEL 1 --------------------- //myfield2 = answer code. $myfield2 = $myfield . "$row[0]#0"; //3 lines of debugging output $statisticsoutput .= "\n"; //some layout adaptions -> new line after 4 entries if ($counter2 == 4) { $statisticsoutput .= "\t\t\t\t\n\t\t\t\t\n"; $counter2=0; } //output checkbox and question/label text $statisticsoutput .= "\t\t\t\t\n"; $counter2++; //----------------- LABEL 2 --------------------- //myfield2 = answer code $myfield2 = $myfield . "$row[0]#1"; //3 lines of debugging output $statisticsoutput .= "\n"; //some layout adaptions -> new line after 4 entries if ($counter2 == 4) { $statisticsoutput .= "\t\t\t\t\n\t\t\t\t\n"; $counter2=0; } //output checkbox and question/label text $statisticsoutput .= "\t\t\t\t\n"; $counter2++; } //end WHILE -> loop through all answers $statisticsoutput .= "\t\t\t\t\n"; break; /* * This question types use the default settings: * L - List (Radio) O - List With Comment P - Multiple choice with comments ! - List (Dropdown) */ default: //get answers $query = "SELECT code, answer FROM ".db_table_name("answers")." WHERE qid='$flt[0]' AND language='{$language}' ORDER BY sortorder, answer"; $result = db_execute_num($query) or safe_die("Couldn't get answers!
$query
".$connect->ErrorMsg()); //loop through answers while ($row=$result->FetchRow()) { $statisticsoutput .= "\t\t\t\t\t\t\n\t\t\t
"; //Multiple choice: if ($flt[2] == "M") {$myfield = "M$myfield";} if ($flt[2] == "P") {$myfield = "P$myfield";} // 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 .= "
\n"; //numerical question type -> add some HTML to the output //if ($flt[2] == "N") {$statisticsoutput .= "";} //removed to correct font error if ($flt[2] != "N" && $flt[2] != "|") {$statisticsoutput .= "\t\t\t\t
"; //checkbox $statisticsoutput .= " 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 .= " /> "; //show speaker $statisticsoutput .= showSpeaker($flt[3]." - ".FlattenText($row[1]))."
\n"; //input fields $statisticsoutput .= "\t\t\t\t\t".$clang->gT("Number greater than").":
\n" ."\t\t\t\t\t
\n" ."\t\t\t\t\t".$clang->gT("Number less than").":
\n" ."\t\t\t\t\t
\n"; //we added 1 form -> increase counter $counter2++; } break; case "Q": // Multiple Short Text //new section $statisticsoutput .= "\t\t\t\t
"; $statisticsoutput .= "\n" ."\t\t\t\t\t".$clang->gT("Responses containing").":
\n" ."\t\t\t\t\t" ."\t\t\t\t
\n"; $statisticsoutput .= "\t\t\t\t\t\n" ."\t\t\t\t\t".$clang->gT("Responses containing").":
\n" ."\t\t\t\t\t\n" ."\t\t\t\t
"; $statisticsoutput .= "\n" ."\t\t\t\t\t".$clang->gT("Responses containing").":
\n" ."\t\t\t\t\t"; $statisticsoutput .= "\t\t\t\t
"; $statisticsoutput .= "\n" ."\t\t\t\t\t".$clang->gT("Date (YYYY-MM-DD) equals").":
\n" ."\t\t\t\t\t
\n" ."\t\t\t\t\t  ".$clang->gT("Date is")." >=
\n" ."\t\t\t\t\t
" .$clang->gT("AND/OR Date is")." <=
\n"; break; case "5": // 5 point choice //we need a list of 5 entries for ($i=1; $i<=5; $i++) { $statisticsoutput .= "\t\t\t\t\t\n"; $statisticsoutput .= "\t\t\t\t\t\n\t\t\t\t\n"; $statisticsoutput .= "\t\t\t\t
" ."\n" ."\t\t\t\t
"; //heading $statisticsoutput .= "\n" ."\t\t\t\t
" ."
\n" ."\t\t\t\t\n\t\t\t\t
" ."
\n" ."\t\t\t\t\n\t\t\t\t
" ."
\n"; //$statisticsoutput .= $fquery; $statisticsoutput .= "\t\t\t\t\t".$clang->gT("Responses containing").":
\n"; $statisticsoutput .= "\t\t\t\t\n\t\t\t\t
\n"; $counter=0; break; case ":": //ARRAY (Multi Flex) (Numbers) $statisticsoutput .= "\t\t\t\t
" ."
\n"; //$statisticsoutput .= $fquery; $statisticsoutput .= "\t\t\t\t
" ."
\n"; /* * when hoovering the speaker symbol we show the whole question * * flt[6] is the label ID * * table "labels" contains * - lid * - code * - title * - sortorder * - language */ $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\n\t\t\t\t
\n"; $counter=0; break; case "R": //RANKING $statisticsoutput .= "\t\t\t\t
" ."
\n" ."\t\t\t\t" // ."
"; $statisticsoutput .= "$dshquery
".$connect->ErrorMsg()); //get header while($dshrow=$dshresult->FetchRow()) { $dualscaleheadera = $dshrow[0]; } if(isset($dualscaleheadera) && $dualscaleheadera != "") { $labeltitle = $dualscaleheadera; } else { $labeltitle=''; } $statisticsoutput .= " /> " .showSpeaker($niceqtext." [".str_replace("'", "`", $row[1])."] - ".$clang->gT("Label").": ".$labeltitle) ."
\n"; /* get labels * table "labels" contains * - lid * - code * - title * - 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); //this is for debugging only //$statisticsoutput .= $fquery; $statisticsoutput .= "\t\t\t\t\n\t\t\t\t
"; $statisticsoutput .= "$dshquery2
".$connect->ErrorMsg()); //get header while($dshrow2=$dshresult2->FetchRow()) { $dualscaleheaderb = $dshrow2[0]; } if(isset($dualscaleheaderb) && $dualscaleheaderb != "") { $labeltitle2 = $dualscaleheaderb; } else { //get label text $labeltitle2 = ''; } $statisticsoutput .= " /> " .showSpeaker($niceqtext." [".str_replace("'", "`", $row[1])."] - ".$clang->gT("Label").": ".$labeltitle2) ."
\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); //this is for debugging only //$statisticsoutput .= $fquery; $statisticsoutput .= "\t\t\t\t\n\t\t\t\t
\n"; $counter=0; break; case "P": //P - Multiple choice with comments case "M": //M - Multiple choice //get answers $query = "SELECT title, question FROM ".db_table_name("questions")." WHERE parent_qid='$flt[0]' AND language='{$language}' ORDER BY question_order"; $result = db_execute_num($query) or safe_die("Couldn't get answers!
$query
".$connect->ErrorMsg()); //loop through answers while ($row=$result->FetchRow()) { $statisticsoutput .= "\t\t\t\t\t\t
\n" ."\t\t\n"; //add line to separate the the filters from the other options $statisticsoutput .= ""; $statisticsoutput .= ""; //very last lines of output $statisticsoutput .= "\t\t

\n" ."\t\t\t\n" ."\t\t\t\n" ."\t\t\n" ."\t\t\n" ."\t\t

\n" ."\t

\n"; // ----------------------------------- END FILTER FORM --------------------------------------- //Show Summary results if (isset($summary) && $summary) { if(isset($_POST['usegraph'])) { $usegraph = 1; } else { $usegraph = 0; } include_once("statistics_function.php"); $outputType = $_POST['outputtype']; switch($outputType){ case 'html': $statisticsoutput .= generate_statistics($surveyid,$summary,$summary,$usegraph,$outputType,'DD',$statlang); break; case 'pdf': generate_statistics($surveyid,$summary,$summary,$usegraph,$outputType,'I',$statlang); exit; break; case 'xls': generate_statistics($surveyid,$summary,$summary,$usegraph,$outputType,'DD',$statlang); exit; break; default: break; } //print_r($summary); exit; } //end if -> show summary results function showSpeaker($hinttext) { global $clang, $imageurl, $maxchars; if(!isset($maxchars)) { $maxchars = 100; } $htmlhinttext=str_replace("'",''',$hinttext); //the string is already HTML except for single quotes so we just replace these only $jshinttext=javascript_escape($hinttext,true,true); if(strlen($hinttext) > ($maxchars)) { $shortstring = FlattenText($hinttext); $shortstring = htmlspecialchars(mb_strcut(html_entity_decode($shortstring,ENT_QUOTES,'UTF-8'), 0, $maxchars, 'UTF-8')); //output with hoover effect $reshtml= "gT("Question","js").": $jshinttext')\">" ." \"$shortstring...\" " ."$htmlhinttextgT("Question","js").": $jshinttext')\" />"; } else { $reshtml= " \"$htmlhinttext\""; } return $reshtml; } ////simple function to square a value //function square($number) //{ // if($number == 0) // { // $squarenumber = 0; // } // else // { // $squarenumber = $number * $number; // } // // return $squarenumber; //} ?>