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:
@@ -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)));
|
||||
|
||||
Reference in New Issue
Block a user