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

Updated Limesurvey to revision 11354

This commit is contained in:
azammitdcarf
2011-11-11 01:59:29 +00:00
parent 82a45813b4
commit a4935b7f08
27 changed files with 23399 additions and 20008 deletions

View File

@@ -79,8 +79,19 @@ class queXMLPDF extends TCPDF {
*
* @var bool Defaults to 138.
* @since 2010-09-20
* @deprecated
* @see $barcodeMarginX
*/
protected $barcodeX = 138;
//protected $barcodeX = 138;
/**
* The distance between the right hand page border and
* the end of the barcode in MM
*
* @var bool Defaults to 23.
* @since 2011-10-25
*/
protected $barcodeMarginX = 23;
/**
* Y position of barcode in mm
@@ -173,7 +184,7 @@ class queXMLPDF extends TCPDF {
protected $style = "<style>
td.questionTitle {font-weight:bold; font-size:12pt;}
td.questionText {font-weight:bold; font-size:12pt;}
td.vasLabel {font-weright:bold; font-size:10pt; text-align:center;}
td.vasLabel {font-weight:bold; font-size:10pt; text-align:center;}
td.questionHelp {font-weight:normal; text-align:right; font-style:italic; font-size:8pt;}
td.questionHelpAfter {text-align:center; font-weight:bold; font-size:10pt;}
td.responseAboveText {font-weight:normal; font-style:normal; text-align:left; font-size:12pt;}
@@ -300,16 +311,38 @@ class queXMLPDF extends TCPDF {
*
* @var mixed Defaults to 24.
* @since 2010-09-20
* @deprecated
* @see $textResponseMarginX
*/
protected $textResponsesPerLine = 24;
//protected $textResponsesPerLine = 24;
/**
* The left hand margin of text responses to auto calculate responses
* per line (mm)
*
* @var mixed Defaults to 13.
* @since 2011-10-25
*/
protected $textResponseMarginX = 13;
/**
* Maximum number of text responses boxes where the label should appear on the same line
*
* @var mixed Defaults to 16.
* @since 2010-09-20
* @deprecated
* @see $labelTextResponsesSameLineMarginX
*/
protected $labelTextResponsesSameLine = 16;
//protected $labelTextResponsesSameLine = 16;
/**
* The left hand margin of text responses to auto calculated responses
* per line where the label should appear on the same line (mm)
*
* @var mixed Defaults to 62.
* @since 2011-10-25
*/
protected $labelTextResponsesSameLineMarginX = 62;
/**
* The gap between multi line text responses
@@ -1551,11 +1584,15 @@ class queXMLPDF extends TCPDF {
{
$this->SetDrawColor($this->lineColour[0],$this->lineColour[1],$this->lineColour[2]);
//calculate text responses per line
$textResponsesPerLine = round(($this->getMainPageWidth() - $this->skipColumnWidth - $this->textResponseMarginX) / ($this->textResponseWidth + $this->textResponseBorder));
$labelTextResponsesSameLine = round(($this->getMainPageWidth() - $this->skipColumnWidth - $this->labelTextResponsesSameLineMarginX) / ($this->textResponseWidth + $this->textResponseBorder));
//draw boxes - can draw up to $textResponsesPerLine for each line
$lines = ceil($width / $this->textResponsesPerLine);
$lines = ceil($width / $textResponsesPerLine);
//draw the text label on the top of this box
if ($width > $this->labelTextResponsesSameLine && !empty($text))
if ($width > $labelTextResponsesSameLine && !empty($text))
{
$this->setBackground('question');
$html = "<table><tr><td width=\"{$this->questionTitleWidth}mm\"></td><td width=\"" . ($this->getMainPageWidth() - $this->skipColumnWidth - $this->questionTitleWidth) . "mm\" class=\"responseAboveText\">$text</td><td></td></tr></table>";
@@ -1567,8 +1604,8 @@ class queXMLPDF extends TCPDF {
for ($i = 0; $i < $lines; $i++)
{
if ($lines == 1) $cells = $width; //one line only
else if (($i + 1 == $lines)) $cells = ($width - ($this->textResponsesPerLine * $i)); //last line
else $cells = $this->textResponsesPerLine; //middle line
else if (($i + 1 == $lines)) $cells = ($width - ($textResponsesPerLine * $i)); //last line
else $cells = $textResponsesPerLine; //middle line
$textwidth = ($this->getMainPageWidth() - $this->skipColumnWidth) - (($this->textResponseWidth + $this->textResponseBorder ) * $cells);
@@ -1579,7 +1616,7 @@ class queXMLPDF extends TCPDF {
$this->setBackground('question');
$this->writeHTMLCell($this->getMainPageWidth(), $this->textResponseHeight, $this->getMainPageX(), $this->GetY() , $this->style . $html,0,1,true,false);
if ($lines == 1 && $cells <= $this->labelTextResponsesSameLine && !empty($text))
if ($lines == 1 && $cells <= $labelTextResponsesSameLine && !empty($text))
{
$this->setDefaultFont($this->responseTextFontSize);
@@ -1652,8 +1689,10 @@ class queXMLPDF extends TCPDF {
//Add the box to the layout scheme
$this->addBox($this->GetX(),$this->GetY(),$this->GetX() + $this->textResponseWidth,$this->GetY() + $this->textResponseHeight);
//Draw the box
$this->Cell($this->textResponseWidth,$this->textResponseHeight,'',$border,0,'',true,'',0,false,'T','C');
}
//add some spacing for the bottom border
@@ -2074,8 +2113,11 @@ class queXMLPDF extends TCPDF {
$barcodeValue = str_pad($this->questionnaireId,$this->idLength,"0",STR_PAD_LEFT) . str_pad($this->getPage(),$this->pageLength,"0",STR_PAD_LEFT);
$this->write1DBarcode($barcodeValue, $this->barcodeType, $this->barcodeX, $this->barcodeY, $this->barcodeW, $this->barcodeH,'', $barcodeStyle, 'N');
//Calc X position of barcode from page width
$barcodeX = $width - ($this->barcodeMarginX + $this->barcodeW);
$this->write1DBarcode($barcodeValue, $this->barcodeType, $barcodeX, $this->barcodeY, $this->barcodeW, $this->barcodeH,'', $barcodeStyle, 'N');
//Add this page to the layout system
$b = $this->cornerBorder + ($this->cornerWidth / 2.0); //temp calc for middle of line
$this->layout[$barcodeValue] = array( 'id' => $barcodeValue,

View File

@@ -183,6 +183,12 @@ class MyPDF extends TCPDF
else{$fill=0;}
for($b=0;$b<sizeof($array[$a]);$b++)
{
$bEndOfCell=0;
if ($b==sizeof($array[$a])-1)
{
$bEndOfCell=1;
}
if($a==0)
{
$oldStyle = $this->FontStyle;
@@ -190,7 +196,7 @@ class MyPDF extends TCPDF
if ($maxwidth[$b] > 140) $maxwidth[$b]=130;
if ($maxwidth[$b] < 20) $maxwidth[$b]=20;
$this->MultiCell($maxwidth[$b],6,$this->delete_html($array[$a][$b]),0,'L',1,0);
$this->MultiCell($maxwidth[$b],6,$this->delete_html($array[$a][$b]),0,'L',1,$bEndOfCell);
$this->SetFont($this->FontFamily, $oldStyle, $this->FontSizePt);
}
@@ -205,16 +211,15 @@ class MyPDF extends TCPDF
if ($maxwidth[$b] > 140) $maxwidth[$b]=130;
if ($b==0)
{
$iLines=$this->MultiCell($maxwidth[$b],6,$this->delete_html($array[$a][$b]),0,'L',$fill,0);
$iLines=$this->MultiCell($maxwidth[$b],6,$this->delete_html($array[$a][$b]),0,'L',$fill,$bEndOfCell);
}
else
{
$this->MultiCell($maxwidth[$b],$iLines,$this->delete_html($array[$a][$b]),0,'L',$fill,0);
$this->MultiCell($maxwidth[$b],$iLines,$this->delete_html($array[$a][$b]),0,'L',$fill,$bEndOfCell);
}
}
}
$this->ln();
}
$this->ln(5);
}

View File

@@ -19,33 +19,15 @@
* @param $string
* @return $string
*/
function strip_tags_full($string, $is_csv=false ) {
function strip_tags_full($string) {
$string=html_entity_decode($string, ENT_QUOTES, "UTF-8");
//combining these into one mb_ereg_replace call ought to speed things up
//$string = str_replace(array("\r\n","\r","\n",'-oth-'), '', $string);
//The backslashes must be escaped twice, once for php, and again for the regexp
//$string = str_replace("'|\\\\'", "&apos;", $string);
if($is_csv==true)
return FlattenText($string,true);
else
return FlattenText($string);
}
/**
* Strips html tags
*
* @param $string
* @return $string
*/
function strip_tags_full_save_newline($string) {
$string=html_entity_decode($string, ENT_QUOTES, "UTF-8");
//combining these into one mb_ereg_replace call ought to speed things up
//$string = str_replace(array("\r\n","\r","\n",'-oth-'), '', $string);
//The backslashes must be escaped twice, once for php, and again for the regexp
//$string = str_replace("'|\\\\'", "&apos;", $string);
return FlattenTextWithNewline($string);
}
/**
* Returns true if passed $value is numeric
*
@@ -64,7 +46,7 @@ function my_is_numeric($value) {
return ($eng_or_world);
}
function spss_export_data ($na = null, $is_csv = false) {
function spss_export_data ($na = null) {
global $length_data;
// Build array that has to be returned
@@ -156,19 +138,9 @@ function spss_export_data ($na = null, $is_csv = false) {
echo("'0'");
}
} elseif (!$field['hide']) {
if($is_csv == true) {
$strTmp=mb_substr(strip_tags_full($row[$fieldno],true), 0, $length_data);
}
else {
$strTmp=mb_substr(strip_tags_full($row[$fieldno]), 0, $length_data);
}
if (trim($strTmp) != ''){
if($is_csv == true) {
$strTemp=str_replace(array("'"),array("''"),trim($strTmp));
}
else {
$strTemp=str_replace(array("'","\n","\r"),array("''",' ',' '),trim($strTmp));
}
/*
* Temp quick fix for replacing decimal dots with comma's
if (my_is_numeric($strTemp)) {

View File

@@ -148,7 +148,7 @@ if ($subaction=='dldata')
header("Pragma: public");
$na=""; //change to empty string instead of two double quotes to fix warnings on NA
spss_export_data($na, true); // this true indicates that the format is .csv
spss_export_data($na);
exit;
}

View File

@@ -26,6 +26,7 @@ if (isset($surveyprintlang) && !empty($surveyprintlang))
else
$quexmllang=GetBaseLanguageFromSurveyID($surveyid);
$qlang = new limesurvey_lang($quexmllang);
if (!$surveyid)
{
@@ -119,7 +120,7 @@ function skipto($qid,$value,$cfieldname = "")
global $connect ;
global $dbprefix ;
global $surveyid ;
global $clang ;
global $qlang ;
$zeros = $connect->qstr("0000000000");
@@ -172,19 +173,19 @@ function skipto($qid,$value,$cfieldname = "")
return $Row['title'];
}
else
return $clang->gT("End");
return $qlang->gT("End");
}
function create_fixed($qid,$rotate=false,$labels=true,$scale=0,$other=false)
function create_fixed($qid,$rotate=false,$labels=true,$scale=0,$other=false,$varname="")
{
global $dom;
global $connect ;
global $dbprefix ;
global $quexmllang;
global $clang;
global $qlang;
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
@@ -230,17 +231,11 @@ function create_fixed($qid,$rotate=false,$labels=true,$scale=0,$other=false)
$category = $dom->create_element("category");
$label = $dom->create_element("label");
$label->set_content(get_length($qid,"other_replace_text","Other"));
$label->set_content(get_length($qid,"other_replace_text",$qlang->gT("Other")));
$value= $dom->create_element("value");
//Get next code
if (is_numeric($nextcode))
$nextcode++;
else if (is_string($nextcode))
$nextcode = chr(ord($nextcode) + 1);
$value->set_content($nextcode);
$value->set_content('-oth-');
$category->append_child($label);
$category->append_child($value);
@@ -249,10 +244,11 @@ function create_fixed($qid,$rotate=false,$labels=true,$scale=0,$other=false)
$length = $dom->create_element("length");
$text = $dom->create_element("text");
$text->set_content($clang->gT("Please specify"));
$text->set_content(get_length($qid,"other_replace_text",$qlang->gT("Other")));
$length->set_content(24);
$contingentQuestion->append_child($text);
$contingentQuestion->append_child($length);
$contingentQuestion->set_attribute("varName",$varname . 'other');
$category->append_child($contingentQuestion);
@@ -291,7 +287,7 @@ function create_multi(&$question,$qid,$varname,$scale_id = false,$free = false,$
global $connect ;
global $quexmllang ;
global $surveyid;
global $clang;
global $qlang;
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
@@ -350,7 +346,7 @@ function create_multi(&$question,$qid,$varname,$scale_id = false,$free = false,$
$category = $dom->create_element("category");
$label = $dom->create_element("label");
$label->set_content(get_length($qid,"other_replace_text","Other"));
$label->set_content(get_length($qid,"other_replace_text",$qlang->gT("Other")));
$value= $dom->create_element("value");
@@ -369,10 +365,11 @@ function create_multi(&$question,$qid,$varname,$scale_id = false,$free = false,$
$length = $dom->create_element("length");
$text = $dom->create_element("text");
$text->set_content($clang->gT("Please specify"));
$text->set_content(get_length($qid,"other_replace_text",$qlang->gT("Other")));
$length->set_content(24);
$contingentQuestion->append_child($text);
$contingentQuestion->append_child($length);
$contingentQuestion->set_attribute("varName",$varname . 'other');
$category->append_child($contingentQuestion);
@@ -574,7 +571,8 @@ while ($Row = $QueryResult->FetchRow())
}
$response = $dom->create_element("response");
$response->set_attribute("varName",cleanup($RowQ['title']));
$sgq = $surveyid . "X" . $gid . "X" . $qid;
$response->set_attribute("varName",$sgq);
switch ($type)
{
@@ -590,20 +588,20 @@ while ($Row = $QueryResult->FetchRow())
$question->append_child($response);
break;
case "L": //LIST drop-down/radio-button list
$response->append_child(create_fixed($qid,false,false,0,$other));
$response->append_child(create_fixed($qid,false,false,0,$other,$sgq));
$question->append_child($response);
break;
case "!": //List - dropdown
$response->append_child(create_fixed($qid,false,false,0,$other));
$response->append_child(create_fixed($qid,false,false,0,$other,$sgq));
$question->append_child($response);
break;
case "O": //LIST WITH COMMENT drop-down/radio-button list + textarea
$response->append_child(create_fixed($qid,false,false,0,$other));
$response->append_child(create_fixed($qid,false,false,0,$other,$sgq));
$question->append_child($response);
//no comment - this should be a separate question
break;
case "R": //RANKING STYLE
create_subQuestions($question,$qid,$RowQ['title'],true);
create_subQuestions($question,$qid,$sgq,true);
$Query = "SELECT COUNT(*) as sc FROM {$dbprefix}answers WHERE qid = $qid AND language='$quexmllang' ";
$QRE = db_execute_assoc($Query);
//$QRE = mysql_query($Query) or die ("ERROR: $QRE<br />".mysql_error());
@@ -613,20 +611,20 @@ while ($Row = $QueryResult->FetchRow())
$question->append_child($response);
break;
case "M": //Multiple choice checkbox
create_multi($question,$qid,$RowQ['title'],false,false,$other);
create_multi($question,$qid,$sgq,false,false,$other);
break;
case "P": //Multiple choice with comments checkbox + text
//Not yet implemented
create_multi($question,$qid,$RowQ['title'],false,false,$other);
create_multi($question,$qid,$sgq,false,false,$other);
//no comments added
break;
case "Q": //MULTIPLE SHORT TEXT
create_subQuestions($question,$qid,$RowQ['title']);
create_subQuestions($question,$qid,$sgq);
$response->append_child(create_free("text",get_length($qid,"maximum_chars","10"),""));
$question->append_child($response);
break;
case "K": //MULTIPLE NUMERICAL
create_subQuestions($question,$qid,$RowQ['title']);
create_subQuestions($question,$qid,$sgq);
$response->append_child(create_free("integer",get_length($qid,"maximum_chars","10"),""));
$question->append_child($response);
break;
@@ -647,73 +645,73 @@ while ($Row = $QueryResult->FetchRow())
$question->append_child($response);
break;
case "Y": //YES/NO radio-buttons
$response->append_child(fixed_array(array("Yes" => 1,"No" => 2)));
$response->append_child(fixed_array(array($qlang->gT("Yes") => 'Y',$qlang->gT("No") => 'N')));
$question->append_child($response);
break;
case "G": //GENDER drop-down list
$response->append_child(fixed_array(array("Female" => 1,"Male" => 2)));
$response->append_child(fixed_array(array($qlang->gT("Female") => 'F',$qlang->gT("Male") => 'M')));
$question->append_child($response);
break;
case "A": //ARRAY (5 POINT CHOICE) radio-buttons
create_subQuestions($question,$qid,$RowQ['title']);
create_subQuestions($question,$qid,$sgq);
$response->append_child(fixed_array(array("1" => 1,"2" => 2,"3" => 3,"4" => 4,"5" => 5)));
$question->append_child($response);
break;
case "B": //ARRAY (10 POINT CHOICE) radio-buttons
create_subQuestions($question,$qid,$RowQ['title']);
create_subQuestions($question,$qid,$sgq);
$response->append_child(fixed_array(array("1" => 1,"2" => 2,"3" => 3,"4" => 4,"5" => 5,"6" => 6,"7" => 7,"8" => 8,"9" => 9,"10" => 10)));
$question->append_child($response);
break;
case "C": //ARRAY (YES/UNCERTAIN/NO) radio-buttons
create_subQuestions($question,$qid,$RowQ['title']);
$response->append_child(fixed_array(array("Yes" => 1,"Uncertain" => 2,"No" => 3)));
create_subQuestions($question,$qid,$sgq);
$response->append_child(fixed_array(array($qlang->gT("Yes") => 'Y',$qlang->gT("Uncertain") => 'U',$qlang->gT("No") => 'N')));
$question->append_child($response);
break;
case "E": //ARRAY (Increase/Same/Decrease) radio-buttons
create_subQuestions($question,$qid,$RowQ['title']);
$response->append_child(fixed_array(array("Increase" => 1,"Same" => 2,"Decrease" => 3)));
create_subQuestions($question,$qid,$sgq);
$response->append_child(fixed_array(array($qlang->gT("Increase") => 'I',$qlang->gT("Same") => 'S',$qlang->gT("Decrease") => 'D')));
$question->append_child($response);
break;
case "F": //ARRAY (Flexible) - Row Format
//select subQuestions from answers table where QID
create_subQuestions($question,$qid,$RowQ['title']);
$response->append_child(create_fixed($qid,false,false,0,$other));
create_subQuestions($question,$qid,$sgq);
$response->append_child(create_fixed($qid,false,false,0,$other,$sgq));
$question->append_child($response);
//select fixed responses from
break;
case "H": //ARRAY (Flexible) - Column Format
create_subQuestions($question,$RowQ['qid'],$RowQ['title']);
$response->append_child(create_fixed($qid,true,false,0,$other));
create_subQuestions($question,$RowQ['qid'],$sgq);
$response->append_child(create_fixed($qid,true,false,0,$other,$sgq));
$question->append_child($response);
break;
case "1": //Dualscale multi-flexi array
//select subQuestions from answers table where QID
create_subQuestions($question,$qid,$RowQ['title']);
create_subQuestions($question,$qid,$sgq);
$response = $dom->create_element("response");
$response->append_child(create_fixed($qid,false,false,0,$other));
$response->append_child(create_fixed($qid,false,false,0,$other,$sgq));
$response2 = $dom->create_element("response");
$response2->set_attribute("varName",cleanup($RowQ['title']) . "_2");
$response2->append_child(create_fixed($qid,false,false,1,$other));
$response2->set_attribute("varName",cleanup($sgq) . "_2");
$response2->append_child(create_fixed($qid,false,false,1,$other,$sgq));
$question->append_child($response);
$question->append_child($response2);
break;
case ":": //multi-flexi array numbers
create_subQuestions($question,$qid,$RowQ['title']);
create_subQuestions($question,$qid,$sgq);
//get multiflexible_checkbox - if set then each box is a checkbox (single fixed response)
$mcb = get_length($qid,'multiflexible_checkbox',-1);
if ($mcb != -1)
create_multi($question,$qid,$RowQ['title'],1);
create_multi($question,$qid,$sgq,1);
else
{
//get multiflexible_max - if set then make boxes of max this width
$mcm = strlen(get_length($qid,'multiflexible_max',1));
create_multi($question,$qid,$RowQ['title'],1,array('f' => 'integer', 'len' => $mcm, 'lab' => ''));
create_multi($question,$qid,$sgq,1,array('f' => 'integer', 'len' => $mcm, 'lab' => ''));
}
break;
case ";": //multi-flexi array text
create_subQuestions($question,$qid,$RowQ['title']);
create_subQuestions($question,$qid,$sgq);
//foreach question where scale_id = 1 this is a textbox
create_multi($question,$qid,$RowQ['title'],1,array('f' => 'text', 'len' => 10, 'lab' => ''));
create_multi($question,$qid,$sgq,1,array('f' => 'text', 'len' => 10, 'lab' => ''));
break;
case "^": //SLIDER CONTROL - not supported
$response->append_child(fixed_array(array("NOT SUPPORTED:$type" => 1)));

View File

@@ -676,7 +676,7 @@ if ($answers == "short") //Nice and easy. Just dump the data straight
$rowcounter++;
if ($type == "csv")
{
$exportoutput .= "\"".implode("\"$separator\"", str_replace("\"", "\"\"", str_replace("\r\n", " ", $drow))) . "\"\n"; //create dump from each row
$exportoutput .= "\"".implode("\"$separator\"", str_replace("\"", "\"\"", $drow)) . "\"\n";
}
elseif ($type == "xls")
{
@@ -1130,11 +1130,6 @@ exit;
function strip_tags_full($string) {
$string=html_entity_decode($string, ENT_QUOTES, "UTF-8");
mb_regex_encoding('utf-8');
$pattern = array('\r', '\n', '-oth-');
for ($i=0; $i<sizeof($pattern); $i++) {
$string = mb_ereg_replace($pattern[$i], '', $string);
}
return strip_tags($string);
$string=str_replace('-oth-','',$string);
return FlattenText($string,true,'UTF-8',false);
}

View File

@@ -376,12 +376,12 @@ $action!='vvimport' && $action!='vvexport' && $action!='exportresults')
if (count(GetAdditionalLanguagesFromSurveyID($surveyid)) == 0)
{
$surveysummary .= "<li><a href='{$scriptname}?action=showprintablesurvey&amp;sid={$surveyid}'>"
$surveysummary .= "<li><a target='_blank' href='{$scriptname}?action=showprintablesurvey&amp;sid={$surveyid}'>"
. "<img src='{$imageurl}/print_30.png' name='ShowPrintableSurvey' /> ".$clang->gT("Printable version")."</a></li>";
}
else
{
$surveysummary .= "<li><a href='{$scriptname}?action=showprintablesurvey&amp;sid={$surveyid}'>"
$surveysummary .= "<li><a target='_blank' href='{$scriptname}?action=showprintablesurvey&amp;sid={$surveyid}'>"
. "<img src='{$imageurl}/print_30.png' name='ShowPrintableSurvey' /> ".$clang->gT("Printable version")."</a><ul>";
$tmp_survlangs = GetAdditionalLanguagesFromSurveyID($surveyid);
$baselang = GetBaseLanguageFromSurveyID($surveyid);
@@ -389,7 +389,7 @@ $action!='vvimport' && $action!='vvexport' && $action!='exportresults')
rsort($tmp_survlangs);
foreach ($tmp_survlangs as $tmp_lang)
{
$surveysummary .= "<li><a href='{$scriptname}?action=showprintablesurvey&amp;sid={$surveyid}&amp;lang={$tmp_lang}'><img src='{$imageurl}/print_30.png' /> ".getLanguageNameFromCode($tmp_lang,false)."</a></li>";
$surveysummary .= "<li><a target='_blank' href='{$scriptname}?action=showprintablesurvey&amp;sid={$surveyid}&amp;lang={$tmp_lang}'><img src='{$imageurl}/print_30.png' /> ".getLanguageNameFromCode($tmp_lang,false)."</a></li>";
}
$surveysummary.='</ul></li>';
}

View File

@@ -710,6 +710,7 @@ function XMLImportQuestion($sFullFilepath, $newsid, $newgid)
if ($xml->LimeSurveyDocType!='Question') safe_die('This is not a valid LimeSurvey question structure XML file.');
$dbversion = (int) $xml->DBVersion;
$aQIDReplacements=array();
$aSQIDReplacements=array(0=>0);
$results['defaultvalues']=0;
$results['answers']=0;
$results['question_attributes']=0;

View File

@@ -54,7 +54,7 @@ if ($subaction=='unfinalizeanswers')
$updateqr = "UPDATE $surveytable SET submitdate=NULL, lastpage=NULL;\n";
$updateres = $connect->Execute($updateqr) or safe_die("UnFinilize answers failed:<br />\n" . $connect->ErrorMsg() . "<br />$updateqr");
// Finally, reset the token completed and sent status
$updateqr="UPDATE ".db_table_name("tokens_$surveyid")." SET sent='N', remindersent='N', remindercount=0, completed='N'";
$updateqr="UPDATE ".db_table_name("tokens_$surveyid")." SET sent='N', remindersent='N', remindercount=0, completed='N', usesleft=1";
$updateres=$connect->Execute($updateqr) or safe_die ("Couldn't reset token completed state<br />$updateqr<br />".$connect->ErrorMsg());
$iteratesurveyoutput .= "<br />\n";
$iteratesurveyoutput .= "<div class='header ui-widget-header'>".$clang->gT("Iterate survey")."</div>\n";

View File

@@ -21,7 +21,7 @@ sendcacheheaders();
if (!isset($surveyid)) {$surveyid=returnglobal('sid');}
if (!isset($column)) {$column=returnglobal('column');}
if (!isset($order)) {$order=returnglobal('order');}
if (!isset($sql)) {$sql=returnglobal('sql');}
if (!isset($sql)) {$sql=$_SESSION['sql'];}
if (!$surveyid)
{
@@ -33,6 +33,8 @@ if (!$column)
//NOCOLUMN
exit;
}
$aColumnNames=$connect->MetaColumnNames("{$dbprefix}survey_{$surveyid}");
if (!isset($aColumnNames[strtoupper($column)])) safe_die('Invalid column name');
if ($connect->databaseType == 'odbc_mssql' || $connect->databaseType == 'odbtp' || $connect->databaseType == 'mssql_n' || $connect->databaseType == 'mssqlnative')
{ $query = "SELECT id, ".db_quote_id($column)." FROM {$dbprefix}survey_$surveyid WHERE (".db_quote_id($column)." NOT LIKE '')"; }
@@ -59,6 +61,10 @@ if ($order == "alpha")
{
$query .= " ORDER BY ".db_quote_id($column);
}
else
{
$query .= " ORDER BY id";
}
$result=db_execute_assoc($query) or safe_die("Error with query: ".$query."<br />".$connect->ErrorMsg());
$listcolumnoutput= "<table width='98%' class='statisticstable' border='1' cellpadding='2' cellspacing='0'>\n";

View File

@@ -623,6 +623,9 @@ while ($degrow = $degresult->FetchRow())
{
$conditions[]=$ansrow['answer'];
}
if($conrow['value'] == "-oth-") {
$conditions[]=$clang->gT("Other");
}
$conditions = array_unique($conditions);
break;
case "M":

View File

@@ -538,9 +538,9 @@ function generate_statistics($surveyid, $allfields, $q2show='all', $usegraph=0,
//$_POST['sql'] is a post field that is sent from the statistics script to the export script in order
// to export just those results filtered by this statistics script. It can also be passed to the statistics
// script to filter from external scripts.
elseif (!empty($_POST['sql']) && !isset($_POST['id=']))
elseif (isset($_SESSION['sql']) && $_SESSION['sql']!='NULL' && !isset($_POST['id=']))
{
$newsql=substr($_POST['sql'], strpos($_POST['sql'], "WHERE")+5, strlen($_POST['sql']));
$newsql=substr($_SESSION['sql'], strpos($_SESSION['sql'], "WHERE")+5, strlen($_SESSION['sql']));
//for debugging only
//$query = $_POST['sql'];
@@ -638,12 +638,12 @@ function generate_statistics($surveyid, $allfields, $q2show='all', $usegraph=0,
{
if($outputType=='html' && $browse === true)
{
$_SESSION['sql']=$sql;
//add a buttons to browse results
$statisticsoutput .= "<form action='$scriptname?action=browse' method='post' target='_blank'>\n"
."\t\t<p>"
."\t\t\t<input type='submit' value='".$statlang->gT("Browse")."' />\n"
."\t\t\t<input type='hidden' name='sid' value='$surveyid' />\n"
."\t\t\t<input type='hidden' name='sql' value=\"$sql\" />\n"
."\t\t\t<input type='hidden' name='subaction' value='all' />\n"
."\t\t</p>"
."\t\t</form>\n";
@@ -2121,7 +2121,7 @@ function generate_statistics($surveyid, $allfields, $q2show='all', $usegraph=0,
$TotalCompleted -=$row[0];
}
$fname="$al[1]";
if ($browse===true) $fname .= " <input type='button' value='".$statlang->gT("Browse")."' onclick=\"window.open('admin.php?action=listcolumn&amp;sid=$surveyid&amp;column=$ColumnName_RM&amp;sql=".urlencode($sql)."', 'results', 'width=460, height=500, left=50, top=50, resizable=yes, scrollbars=yes, menubar=no, status=no, location=no, toolbar=no')\" />";
if ($browse===true) $fname .= " <input type='button' value='".$statlang->gT("Browse")."' onclick=\"window.open('admin.php?action=listcolumn&amp;sid={$surveyid}&amp;column={$ColumnName_RM}', 'results', 'width=460, height=500, left=50, top=50, resizable=yes, scrollbars=yes, menubar=no, status=no, location=no, toolbar=no')\" />";
}
/*
@@ -2142,8 +2142,7 @@ function generate_statistics($surveyid, $allfields, $q2show='all', $usegraph=0,
{
$fname= "$al[1]";
if ($browse===true) $fname .= " <input type='submit' value='"
. $statlang->gT("Browse")."' onclick=\"window.open('admin.php?action=listcolumn&sid=$surveyid&amp;column=$al[2]&amp;sql="
. urlencode($sql)."', 'results', 'width=460, height=500, left=50, top=50, resizable=yes, scrollbars=yes, menubar=no, status=no, location=no, toolbar=no')\" />";
. $statlang->gT("Browse")."' onclick=\"window.open('admin.php?action=listcolumn&sid=$surveyid&amp;column=$al[2]', 'results', 'width=460, height=500, left=50, top=50, resizable=yes, scrollbars=yes, menubar=no, status=no, location=no, toolbar=no')\" />";
}
elseif ($al[0] == "NoAnswer")
{

View File

@@ -106,14 +106,19 @@ $tokenoutput = "";
if ($subaction == "export" && ( bHasSurveyPermission($surveyid, 'tokens', 'export')) )//EXPORT FEATURE SUBMITTED BY PIETERJAN HEYSE
{
header("Content-Disposition: attachment; filename=tokens_".$surveyid.".csv");
header("Content-type: text/comma-separated-values; charset=UTF-8");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: cache");
$bquery = "SELECT * FROM ".db_table_name("tokens_$surveyid").' where 1=1';
$bquery = "SELECT * FROM ".db_table_name("tokens_$surveyid").' t';
if ($_POST['tokenstatus']==3 && $thissurvey['anonymized']=='N')
{
$bquery .= " JOIN ".db_table_name("survey_$surveyid")." s on t.token=s.token ";
}
if ($_POST['tokenstatus']==2 && $thissurvey['anonymized']=='N')
{
$bquery .= " LEFT JOIN ".db_table_name("survey_$surveyid")." s on t.token=s.token ";
}
$bquery.=' where 1=1';
if (trim($_POST['filteremail'])!='')
{
if ($databasetype=='odbc_mssql' || $databasetype=='odbtp' || $databasetype=='mssql_n' || $connect->databaseType == 'mssqlnative')
@@ -134,14 +139,13 @@ if ($subaction == "export" && ( bHasSurveyPermission($surveyid, 'tokens', 'expor
$bquery .= " and completed='N'";
if ($thissurvey['anonymized']=='N')
{
$bquery .=" and token not in (select token from ".db_table_name("survey_$surveyid")." group by token)";
$bquery .=" and s.token is null ";
}
}
if ($_POST['tokenstatus']==3 && $thissurvey['anonymized']=='N')
{
$bquery .= " and completed='N' and token in (select token from ".db_table_name("survey_$surveyid")." group by token)";
$bquery .= " and completed='N' and s.token is not null";
}
if ($_POST['invitationstatus']==1)
{
$bquery .= " and sent<>'N'";
@@ -166,6 +170,11 @@ if ($subaction == "export" && ( bHasSurveyPermission($surveyid, 'tokens', 'expor
}
$bquery .= " ORDER BY tid";
header("Content-Disposition: attachment; filename=tokens_".$surveyid.".csv");
header("Content-type: text/comma-separated-values; charset=UTF-8");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: cache");
$bresult = db_execute_assoc($bquery) or die ("$bquery<br />".htmlspecialchars($connect->ErrorMsg()));
$bfieldcount=$bresult->FieldCount();
// Export UTF8 WITH BOM
@@ -1557,7 +1566,12 @@ if ($subaction == "email" && bHasSurveyPermission($surveyid, 'tokens','update'))
while ($emrow = $emresult->FetchRow())
{
unset($fieldsarray);
$to = $emrow['firstname']." ".$emrow['lastname']." <".$emrow['email'].">";
$to=array();
$aEmailaddresses=explode(';',$emrow['email']);
foreach($aEmailaddresses as $sEmailaddress)
{
$to[]=$emrow['firstname']." ".$emrow['lastname']." <{$sEmailaddress}>";
}
$fieldsarray["{EMAIL}"]=$emrow['email'];
$fieldsarray["{FIRSTNAME}"]=$emrow['firstname'];
$fieldsarray["{LASTNAME}"]=$emrow['lastname'];
@@ -1578,7 +1592,6 @@ if ($subaction == "email" && bHasSurveyPermission($surveyid, 'tokens','update'))
$from = $_POST['from_'.$emrow['language']];
if ($ishtml === false)
{
$fieldsarray["{OPTOUTURL}"]="$publicurl/optout.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}";
@@ -1628,7 +1641,7 @@ if ($subaction == "email" && bHasSurveyPermission($surveyid, 'tokens','update'))
."SET sent='$today' WHERE tid={$emrow['tid']}";
//
$uderesult = $connect->Execute($udequery) or safe_die ("Could not update tokens<br />$udequery<br />".$connect->ErrorMsg());
$tokenoutput .= $clang->gT("Invitation sent to:")." {$emrow['firstname']} {$emrow['lastname']} ($to)<br />\n";
$tokenoutput .= $clang->gT("Invitation sent to:")." {$emrow['firstname']} {$emrow['lastname']} (".htmlspecialchars(implode(',',$to)).")<br />\n";
if ($emailsmtpdebug==2)
{
$tokenoutput .=$maildebug;
@@ -1885,7 +1898,12 @@ if ($subaction == "remind" && bHasSurveyPermission($surveyid, 'tokens','update')
while ($emrow = $emresult->FetchRow())
{
unset($fieldsarray);
$to = $emrow['firstname']." ".$emrow['lastname']." <".$emrow['email'].">";
$to=array();
$aEmailaddresses=explode(';',$emrow['email']);
foreach($aEmailaddresses as $sEmailaddress)
{
$to[]=$emrow['firstname']." ".$emrow['lastname']." <{$sEmailaddress}>";
}
$fieldsarray["{EMAIL}"]=$emrow['email'];
$fieldsarray["{FIRSTNAME}"]=$emrow['firstname'];
$fieldsarray["{LASTNAME}"]=$emrow['lastname'];
@@ -3268,4 +3286,4 @@ function getLine($file)
return $buffer;
}
?>
?>

View File

@@ -89,7 +89,7 @@ function upgrade_survey_table145()
$oLanguage = new limesurvey_lang($aSurveyRow['surveyls_language']);
$aDefaultTexts=aTemplateDefaultTexts($oLanguage,'unescaped');
unset($oLanguage);
$aDefaultTexts['admin_detailed_notification_subject']=$aDefaultTexts['admin_detailed_notification'].$aDefaultTexts['admin_detailed_notification_css'];
$aDefaultTexts['admin_detailed_notification']=$aDefaultTexts['admin_detailed_notification'].$aDefaultTexts['admin_detailed_notification_css'];
$aDefaultTexts=array_map('db_quoteall',$aDefaultTexts);
$sSurveyUpdateQuery= "update ".db_table_name('surveys_languagesettings')." set
email_admin_responses_subj={$aDefaultTexts['admin_detailed_notification_subject']},