question id
* $ia[1] => fieldname
* $ia[2] => title
* $ia[3] => question text
* $ia[4] => type -- text, radio, select, array, etc
* $ia[5] => group id
* $ia[6] => mandatory Y || N
* $ia[7] => conditions exist for this question
* $ia[8] => other questions have conditions which rely on this question (including array_filter and array_filter_exclude attributes)
* $ia[9] => incremental question count (used by {QUESTION_NUMBER})
*
* $conditions element structure
* $condition[n][0] => qid = question id
* $condition[n][1] => cqid = question id of the target question, or 0 for TokenAttr leftOperand
* $condition[n][2] => field name of element [1] (Except for type M or P)
* $condition[n][3] => value to be evaluated on answers labeled.
* $condition[n][4] => type of question
* $condition[n][5] => SGQ code of element [1] (sub-part of [2])
* $condition[n][6] => method used to evaluate
* $condition[n][7] => scenario *NEW BY R.L.J. van den Burg*
*/
if($shownoanswer > 0 && $thissurvey['shownoanswer'] != 'N')
{
define('SHOW_NO_ANSWER',1);
}
else
{
define('SHOW_NO_ANSWER',0);
};
//queXS addition
function quexs_submit_on_click($do = true)
{
include_once(dirname(__FILE__) . '/quexs.php');
$r = "; $('.submit').css('display', ''); ";
if (LIME_AUTO_ADVANCE && $do)
{
$r .= " document.limesurvey.move.value = '";
if (isset($_SESSION['step']) && $_SESSION['step'] && ($_SESSION['step'] == $_SESSION['totalsteps']))
$r .= "movesubmit";
else
$r .= "movenext";
$r .= "'; document.limesurvey.submit(); ";
}
return $r;
}
function quexs_appointment($do)
{
include_once(dirname(__FILE__) . '/quexs.php');
$r = "";
if ($do)
{
$r = "; $('.submit').css('display', 'none'); parent.poptastic('" . QUEXS_URL . "appointment.php'); ";
}
return $r;
}
function quexs_outcome($outcome)
{
include_once(dirname(__FILE__) . '/quexs.php');
$r = "";
if (is_numeric($outcome) && $outcome != 0)
{
$r = "; $('.submit').css('display', 'none'); parent.poptastic('" . QUEXS_URL . "call.php?defaultoutcome=$outcome'); ";
}
return $r;
}
function retrieveConditionInfo($ia)
{
//This function returns an array containing all related conditions
//for a question - the array contains the fields from the conditions table
global $dbprefix, $connect;
if ($ia[7] == "Y")
{ //DEVELOP CONDITIONS ARRAY FOR THIS QUESTION
$cquery = "SELECT {$dbprefix}conditions.qid, "
."{$dbprefix}conditions.scenario, "
."{$dbprefix}conditions.cqid, "
."{$dbprefix}conditions.cfieldname, "
."{$dbprefix}conditions.value, "
."{$dbprefix}questions.type, "
."{$dbprefix}questions.sid, "
."{$dbprefix}questions.gid, "
."{$dbprefix}conditions.method, "
."questionssrc.gid as srcgid "
."FROM {$dbprefix}conditions, "
."{$dbprefix}questions ,"
."{$dbprefix}questions as questionssrc "
."WHERE {$dbprefix}conditions.cqid={$dbprefix}questions.qid "
."AND {$dbprefix}conditions.qid=questionssrc.qid "
."AND {$dbprefix}conditions.qid=$ia[0] "
."AND {$dbprefix}questions.language='".$_SESSION['s_lang']."' "
."AND {$dbprefix}conditions.cfieldname NOT LIKE '{%' "
."ORDER BY {$dbprefix}conditions.scenario, "
."{$dbprefix}conditions.cqid, "
."{$dbprefix}conditions.cfieldname";
$cresult = db_execute_assoc($cquery) or safe_die ("OOPS $cquery ".$connect->ErrorMsg()); //Checked
$cquerytoken = "SELECT c.qid, c.scenario, c.cqid, c.cfieldname, c.value, '' as type, 0 as sid, 0 as gid, c.method, q.gid as srcgid "
."FROM {$dbprefix}conditions c, {$dbprefix}questions q "
."WHERE c.qid=q.qid "
."AND c.qid=$ia[0] "
."AND c.cfieldname LIKE '{%' "
."ORDER BY c.scenario, c.cqid, c.cfieldname";
$cresulttoken = db_execute_assoc($cquerytoken) or safe_die ("OOPS $cquerytoken ".$connect->ErrorMsg()); //Checked
while ($tempcrow = $cresulttoken->FetchRow())
{
$aAllConditions[] = $tempcrow;
}
while ($tempcrow = $cresult->FetchRow())
{
$aAllConditions[] = $tempcrow;
}
// while ($crow = $cresult->FetchRow())
foreach ($aAllConditions as $crow)
{
if (preg_match("/^\+(.*)$/",$crow['cfieldname'],$cfieldnamematch))
{ // this condition uses a single checkbox as source
$crow['type'] = "+".$crow['type'];
$crow['cfieldname'] = $cfieldnamematch[1];
}
$conditions[] = array ($crow['qid'],
$crow['cqid'],
$crow['cfieldname'],
$crow['value'],
$crow['type'],
$crow['sid']."X".$crow['gid']."X".$crow['cqid'],
$crow['method'],
$crow['scenario'],
$crow['srcgid']);
}
foreach ($conditions as $condkey => $condarr)
{ // We need to sort the merged array by Ascending scenario, cqid, then cfieldname
// otherwise condition evaluations of Tokens in Scenarii won't work in "live" Javascript eval
$scenariolist[$condkey] = $condarr[7];
$cqidlist[$condkey] = $condarr[1];
$cfieldnamelist[$condkey] = $condarr[2];
}
array_multisort($scenariolist,SORT_ASC,$cqidlist,SORT_ASC,$cfieldnamelist,SORT_ASC,$conditions);
return $conditions;
}
else
{
return null;
}
}
// returns the Javascript IdName of a question used in conditions
// $cd = Array (
// 0 => Unused
// 1 => qid of the question
// 2 => fieldname of the question
// 3 => value used in comparison (only usd for type M and P egals 'Y', optionnal for other types)
// 4 => type of the question
// 5 => SGQ code corresponding to the fieldname
// if $currentgid is not null (Group by group survey), the fieldname depends on the groupId
function retrieveJSidname($cd,$currentgid=null)
{
global $dbprefix, $connect, $dropdownthreshold;
if (preg_match("/^\+{0,1}[0-9]+X([0-9]+)X(.*)$/",$cd[2]) == 0)
{ // This is not a true fieldname (for instance a {TOKEN:ATTR..}
// placeholder
return "NoJSidname";
}
//preg_match("/^[0-9]+X([0-9]+)X([0-9]+)$/",$cd[2],$matchFields);
//^^^^^does not seem to work, explode below should
$matchFields = explode('X', $cd[2], 3);
$questiongid=$matchFields[1];
$questionFieldpart=$matchFields[2];
if ($cd[4] == "L")
{
$cccquery="SELECT code FROM {$dbprefix}answers WHERE qid={$cd[1]} AND language='".$_SESSION['s_lang']."'";
$cccresult=$connect->Execute($cccquery); // Checked
$cccount=$cccresult->RecordCount();
}
if ($cd[4] == "R")
{
if (!isset($currentgid) || $questiongid == $currentgid)
{ // if question is on same page then field is fvalue_XXXX
//$idname="fvalue_".$cd[1].substr($cd[2], strlen($cd[2])-1,1); // broken when ranking more than 9 items
$idname="fvalue_".$questionFieldpart;
}
else
{ // If question is on another page then field if javaXXXX
$idname="java$cd[2]";
}
}
elseif ($cd[4] == "5" ||
$cd[4] == "A" ||
$cd[4] == "B" ||
$cd[4] == "C" ||
$cd[4] == "E" ||
$cd[4] == "F" ||
$cd[4] == "H" ||
$cd[4] == "G" ||
$cd[4] == "Y" ||
$cd[4] == "1" ||
($cd[4] == "L" && $cccount <= $dropdownthreshold))
{
$idname="java$cd[2]";
}
elseif ($cd[4] == "M" ||
$cd[4] == "P")
{
$idname="java$cd[5]$cd[3]";
}
elseif ($cd[4] == "+M" ||
$cd[4] == "+P")
{
$idname="java$cd[2]";
}
elseif ($cd[4] == "D" ||
$cd[4] == "N" ||
$cd[4] == "S" ||
$cd[4] == "T" ||
$cd[4] == "U" ||
$cd[4] == "Q" ||
$cd[4] == "K" )
{
if (!isset($currentgid) || $questiongid == $currentgid)
{ // if question is on same page then field is answerXXXX
$idname="answer$cd[2]";
}
else
{ // If question is on another page then field if javaXXXX
$idname="java$cd[2]";
}
}
else
{
$idname="java".$cd[2];
}
return $idname;
}
function create_mandatorylist($ia)
{
//Checks current question and returns required mandatory arrays if required
if ($ia[6] == 'Y')
{
switch($ia[4])
{
case 'R':
$thismandatory = setman_ranking($ia);
break;
case 'M':
$thismandatory = setman_questionandcode($ia);
break;
case 'J':
case 'P':
case 'Q':
case 'K':
case 'A':
case 'B':
case 'C':
case 'E':
case 'F':
case 'H':
$thismandatory = setman_questionandcode($ia);
break;
case ':':
case ';':
$thismandatory = setman_multiflex($ia);
break;
case '1':
$thismandatory = setman_questionandcode_multiscale($ia);
break;
case 'X':
//Do nothing - boilerplate questions CANNOT be mandatory
break;
default:
$thismandatory = setman_normal($ia);
}
if ($ia[7] != 'Y' && isset($thismandatory)) //Question is not conditional - addto mandatory arrays
{
$mandatory=$thismandatory;
}
if ($ia[7] == 'Y' && isset($thismandatory)) //Question IS conditional - add to conmandatory arrays
{
$conmandatory=$thismandatory;
}
}
if (isset($mandatory))
{
return array($mandatory, null);
}
elseif (isset($conmandatory))
{
return array(null, $conmandatory);
}
else
{
return array(null, null);
}
}
function setman_normal($ia)
{
$mandatorys[]=$ia[1];
$mandatoryfns[]=$ia[1];
return array($mandatorys, $mandatoryfns);
}
function setman_ranking($ia)
{
global $dbprefix, $connect;
$ansquery = "SELECT * FROM {$dbprefix}answers WHERE qid={$ia[0]} AND language='".$_SESSION['s_lang']."' ORDER BY sortorder, answer";
$ansresult = $connect->Execute($ansquery); //Checked
$anscount = $ansresult->RecordCount();
$qidattributes=getQuestionAttributes($ia[0],$ia[4]);
if (trim($qidattributes['max_answers'])!='') {
$max_answers = $qidattributes['max_answers'];
}
else
{
$max_answers = $anscount;
}
for ($i=1; $i<=$max_answers; $i++)
{
$mandatorys[]=$ia[1].$i;
$mandatoryfns[]=$ia[1];
}
return array($mandatorys, $mandatoryfns);
}
function setman_questionandcode($ia)
{
global $dbprefix, $connect;
$qquery = "SELECT other FROM {$dbprefix}questions WHERE qid=".$ia[0]." AND language='".$_SESSION['s_lang']."' and parent_qid=0";
$qresult = db_execute_assoc($qquery); //Checked
while ($qrow = $qresult->FetchRow()) {$other = $qrow['other'];}
$subquestionquery = "SELECT title FROM {$dbprefix}questions WHERE parent_qid={$ia[0]} AND language='".$_SESSION['s_lang']."' ORDER BY question_order";
$sqresult = db_execute_assoc($subquestionquery); //Checked
while ($subquestionrow = $sqresult->FetchRow())
{
$mandatorys[]=$ia[1].$subquestionrow['title'];
$mandatoryfns[]=$ia[1];
}
if ($other == "Y" and ($ia[4]=="!" or $ia[4]=="L" or $ia[4]=="M" or $ia[4]=="P"))
{
$mandatorys[]=$ia[1]."other";
$mandatoryfns[]=$ia[1];
}
return array($mandatorys, $mandatoryfns);
}
/**
* The point of these functions (setman) is to return an array containing two arrays.
* The first ($mandatorys) is an array containing question, so they can all be checked
* The second ($mandatoryfns) is an arry containing the fieldnames of every question
* What's the difference? The difference arises from multiple option questions, and came
* about when trying to distinguish between answering just one option (which satisfies
* the mandatory requirement, and answering them all). The "mandatorys" input contains the
* actual specific response items that could be filled in.. ie: in a multiple option
* question, there will be a unique one for every possible answer. The "mandatoryfns" array
* contains the generic question fieldname for the question as a whole (it will be repeated
* for multiple option qeustions, but won't contain unique items.
*
* @param mixed $ia
* @return array See explanation above
*/
function setman_multiflex($ia)
{
global $dbprefix, $connect;
$mandatorys=array();
$mandatoryfns=array();
$ansquery = "SELECT * FROM {$dbprefix}questions
WHERE parent_qid={$ia[0]} AND language='".$_SESSION['s_lang']."' and scale_id=0
ORDER BY question_order, title";
$ansresult = db_execute_assoc($ansquery);
$ans2query = "SELECT * FROM {$dbprefix}questions
WHERE parent_qid={$ia[0]} AND language='".$_SESSION['s_lang']."' and scale_id=1
ORDER BY question_order, title";
$ans2result = db_execute_assoc($ans2query);
while ($ans2row=$ans2result->FetchRow())
{
$lset[]=$ans2row;
}
$qidattributes=getQuestionAttributes($ia[0],$ia[4]);
while ($ansrow = $ansresult->FetchRow())
{
//Don't add to mandatory list if the row is filtered out with the array_filter option
if (trim($qidattributes['array_filter'])!='')
{
//This particular one may not be mandatory if it's hidden
$selected = getArrayFiltersForQuestion($ia[0]);
if (!in_array($ansrow['title'],$selected))
{
//This one's hidden, so don't add it to the mandatory list
}
else
{
//This one's not hidden. so add it to the mandatory list
foreach($lset as $ls)
{
$mandatorys[]=$ia[1].$ansrow['title']."_".$ls['title'];
$mandatoryfns[]=$ia[1];
}
}
}
elseif (trim($qidattributes['array_filter_exclude'])!='')
{
//This particular one may not be mandatory if it's hidden
$selected = getArrayFilterExcludesForQuestion($ia[0]);
if ($selected!=false && in_array($ansrow['title'],$selected))
{
//This one's hidden, so don't add it to the mandatory list
}
else
{
//This one's not hidden. so add it to the mandatory list
foreach($lset as $ls)
{
$mandatorys[]=$ia[1].$ansrow['title']."_".$ls['title'];
$mandatoryfns[]=$ia[1];
}
}
} else { //There is no array_filter option, so we should definitely add to the mandatory list here!
foreach($lset as $ls)
{
$mandatorys[]=$ia[1].$ansrow['title']."_".$ls['title'];
$mandatoryfns[]=$ia[1];
}
}
}
return array($mandatorys, $mandatoryfns);
}
function setman_questionandcode_multiscale($ia)
{
global $dbprefix, $connect;
$qquery = "SELECT other FROM {$dbprefix}questions WHERE qid=".$ia[0]." AND language='".$_SESSION['s_lang']."'";
$qresult = db_execute_assoc($qquery); //Checked
while ($qrow = $qresult->FetchRow())
{
$other = $qrow['other'];
}
// Get Subquestions
$subquery="SELECT * "
."FROM {$dbprefix}questions "
."WHERE parent_qid={$ia[0]} "
."AND language='".$_SESSION['s_lang']."' "
."ORDER BY question_order";
$subresult = db_execute_assoc($subquery); //Checked
// Get Answer Scale 1
$ans1query="SELECT qid "
."FROM {$dbprefix}answers "
."WHERE qid={$ia[0]} "
."AND scale_id=0 "
."AND language='".$_SESSION['s_lang']."' "
."ORDER BY sortorder";
$ans1result = db_execute_assoc($ans1query); //Checked
$ans1count = $ans1result->RowCount();
// Get Answer Scale 2
$ans2query="SELECT qid "
."FROM {$dbprefix}answers "
."WHERE qid={$ia[0]} "
."AND scale_id=1 "
."AND language='".$_SESSION['s_lang']."' "
."ORDER BY sortorder";
$ans2result = db_execute_assoc($ans2query); //Checked
$ans2count = $ans2result->RowCount();
while ($subrow = $subresult->FetchRow())
{
// first answer set
if ($ans1count > 0)
{
$mandatorys[]=$ia[1].$subrow['title']."#0";
$mandatoryfns[]=$ia[1];
}
else
{
$mandatorys[]=$ia[1].$subrow['title'];
$mandatoryfns[]=$ia[1];
}
// second answer set
if ($ans2count > 0)
{
$mandatorys[]=$ia[1].$subrow['title']."#1";
$mandatoryfns[]=$ia[1];
}
else
{
$mandatorys[]=$ia[1].$subrow['title'];
$mandatoryfns[]=$ia[1];
}
}
if ($other == "Y" and ($ia[4]=="!" or $ia[4]=="L" or $ia[4]=="M" or $ia[4]=="P" or $ia[4]=="1"))
{
$mandatorys[]=$ia[1]."other";
$mandatoryfns[]=$ia[1];
}
return array($mandatorys, $mandatoryfns);
}
/**
* This function returns an array containing the "question/answer" html display
* and a list of the question/answer fieldnames associated. It is called from
* question.php, group.php or survey.php
*
* @param mixed $ia
* @param mixed $notanswered
* @param mixed $notvalidated
* @param mixed $filenotvalidated
* @return mixed
*/
function retrieveAnswers($ia, $notanswered=null, $notvalidated=null, $filenotvalidated=null)
{
//globalise required config variables
global $dbprefix, $clang; //These are from the config-defaults.php file
global $thissurvey, $gl; //These are set by index.php
global $connect;
//DISPLAY
$display = $ia[7];
//QUESTION NAME
$name = $ia[0];
$qtitle=$ia[3];
//Replace INSERTANS statements with previously provided answers;
$qtitle=dTexts::run($qtitle);
//GET HELP
$hquery="SELECT help FROM {$dbprefix}questions WHERE qid=$ia[0] AND language='".$_SESSION['s_lang']."'";
$hresult=db_execute_num($hquery) or safe_die($connect->ErrorMsg()); //Checked
$help="";
while ($hrow=$hresult->FetchRow()) {$help=$hrow[0];}
//A bit of housekeeping to stop PHP Notices
$answer = "";
if (!isset($_SESSION[$ia[1]])) {$_SESSION[$ia[1]] = "";}
$qidattributes=getQuestionAttributes($ia[0],$ia[4]);
//echo "
";print_r($qidattributes);echo "
";
//Create the question/answer html
// Previously in limesurvey, it was virtually impossible to control how the start of questions were formatted.
// this is an attempt to allow users (or rather system admins) some control over how the starting text is formatted.
$number = isset($ia[9]) ? $ia[9] : '';
$question_text = array(
'all' => '' // All has been added for backwards compatibility with templates that use question_start.pstpl (now redundant)
,'text' => $qtitle
,'code' => $ia[2]
,'number' => $number
,'help' => ''
,'mandatory' => ''
,'man_message' => ''
,'valid_message' => ''
,'file_valid_message' => ''
,'class' => ''
,'man_class' => ''
,'input_error_class' => ''// provides a class.
,'essentials' => ''
);
switch ($ia[4])
{
case 'X': //BOILERPLATE QUESTION
$values = do_boilerplate($ia);
break;
case '5': //5 POINT CHOICE radio-buttons
$values = do_5pointchoice($ia);
break;
case 'D': //DATE
$values = do_date($ia);
break;
case 'L': //LIST drop-down/radio-button list
$values = do_list_radio($ia);
if ($qidattributes['hide_tip']==0)
{
$qtitle .= " \n"
. $clang->gT('Choose one of the following answers').'';
$question_text['help'] = $clang->gT('Choose one of the following answers');
}
break;
case '!': //List - dropdown
$values=do_list_dropdown($ia);
if ($qidattributes['hide_tip']==0)
{
$qtitle .= " \n"
. $clang->gT('Choose one of the following answers').'';
$question_text['help'] = $clang->gT('Choose one of the following answers');
}
break;
case 'O': //LIST WITH COMMENT drop-down/radio-button list + textarea
$values=do_listwithcomment($ia);
if (count($values[1]) > 1 && $qidattributes['hide_tip']==0)
{
$qtitle .= " \n"
. $clang->gT('Choose one of the following answers').'';
$question_text['help'] = $clang->gT('Choose one of the following answers');
}
break;
case 'R': //RANKING STYLE
$values=do_ranking($ia);
if (count($values[1]) > 1 && $qidattributes['hide_tip']==0)
{
$question_text['help'] = $clang->gT("Click on an item in the list on the left, starting with your highest ranking item, moving through to your lowest ranking item.");
if (trim($qidattributes['min_answers'])!='')
{
$qtitle .= " \n"
. sprintf($clang->ngT("Check at least %d item","Check at least %d items",$qidattributes['min_answers']),$qidattributes['min_answers'])."";
$question_text['help'] .=' '.sprintf($clang->ngT("Check at least %d item","Check at least %d items",$qidattributes['min_answers']),$qidattributes['min_answers']);
}
}
break;
case 'M': //Multiple choice checkbox
$values=do_multiplechoice($ia);
if (count($values[1]) > 1 && $qidattributes['hide_tip']==0)
{
$maxansw=trim($qidattributes['max_answers']);
$minansw=trim($qidattributes['min_answers']);
if (!($maxansw || $minansw))
{
$qtitle .= " \n"
. $clang->gT('Check any that apply').'';
$question_text['help'] = $clang->gT('Check any that apply');
}
else
{
if ($maxansw && $minansw)
{
$qtitle .= " \n"
. sprintf($clang->gT("Check between %d and %d answers"), $minansw, $maxansw)."";
$question_text['help'] = sprintf($clang->gT("Check between %d and %d answers"), $minansw, $maxansw);
} elseif ($maxansw)
{
$qtitle .= " \n"
. sprintf($clang->gT("Check at most %d answers"), $maxansw)."";
$question_text['help'] = sprintf($clang->gT("Check at most %d answers"), $maxansw);
} else
{
$qtitle .= " \n"
. sprintf($clang->ngT("Check at least %d answer","Check at least %d answers",$minansw),$minansw)."";
$question_text['help'] = sprintf($clang->ngT("Check at least %d answer","Check at least %d answers",$minansw),$minansw);
}
}
}
break;
case 'I': //Language Question
$values=do_language($ia);
if (count($values[1]) > 1)
{
$qtitle .= " \n"
. $clang->gT('Choose your language').'';
$question_text['help'] = $clang->gT('Choose your language');
}
break;
case 'P': //Multiple choice with comments checkbox + text
$values=do_multiplechoice_withcomments($ia);
if (count($values[1]) > 1 && $qidattributes['hide_tip']==0)
{
$maxansw=trim($qidattributes["max_answers"]);
$minansw=trim($qidattributes["min_answers"]);
if (!($maxansw || $minansw))
{
$qtitle .= " \n"
. $clang->gT('Check any that apply').'';
$question_text['help'] = $clang->gT('Check any that apply');
}
else
{
if ($maxansw && $minansw)
{
$qtitle .= " \n"
. sprintf($clang->gT("Check between %d and %d answers"), $minansw, $maxansw)."";
$question_text['help'] = sprintf($clang->gT("Check between %d and %d answers"), $minansw, $maxansw);
} elseif ($maxansw)
{
$qtitle .= " \n"
. sprintf($clang->gT("Check at most %d answers"), $maxansw)."";
$question_text['help'] = sprintf($clang->gT("Check at most %d answers"), $maxansw);
} else
{
$qtitle .= " \n"
. sprintf($clang->gT("Check at least %d answers"), $minansw)."";
$question_text['help'] = sprintf($clang->gT("Check at least %d answers"), $minansw);
}
}
}
break;
case '|': //File Upload
$values=do_file_upload($ia);
if ($qidattributes['min_num_of_files'] != 0)
{
if (trim($qidattributes['min_num_of_files']) != 0)
{
$qtitle .= " \n"
.sprintf($clang->gT("At least %d files must be uploaded for this question"), $qidattributes['min_num_of_files'])."";
$question_text['help'] .= ' '.sprintf($clang->gT("At least %d files must be uploaded for this question"), $qidattributes['min_num_of_files']);
}
}
break;
case 'Q': //MULTIPLE SHORT TEXT
$values=do_multipleshorttext($ia);
break;
case 'K': //MULTIPLE NUMERICAL QUESTION
$values=do_multiplenumeric($ia);
break;
case 'N': //NUMERICAL QUESTION TYPE
$values=do_numerical($ia);
break;
case 'S': //SHORT FREE TEXT
$values=do_shortfreetext($ia);
break;
case 'T': //LONG FREE TEXT
$values=do_longfreetext($ia);
break;
case 'U': //HUGE FREE TEXT
$values=do_hugefreetext($ia);
break;
case 'Y': //YES/NO radio-buttons
$values=do_yesno($ia);
break;
case 'G': //GENDER drop-down list
$values=do_gender($ia);
break;
case 'A': //ARRAY (5 POINT CHOICE) radio-buttons
$values=do_array_5point($ia);
break;
case 'B': //ARRAY (10 POINT CHOICE) radio-buttons
$values=do_array_10point($ia);
break;
case 'C': //ARRAY (YES/UNCERTAIN/NO) radio-buttons
$values=do_array_yesnouncertain($ia);
break;
case 'E': //ARRAY (Increase/Same/Decrease) radio-buttons
$values=do_array_increasesamedecrease($ia);
break;
case 'F': //ARRAY (Flexible) - Row Format
$values=do_array($ia);
break;
case 'H': //ARRAY (Flexible) - Column Format
$values=do_arraycolumns($ia);
break;
case ':': //ARRAY (Multi Flexi) 1 to 10
$values=do_array_multiflexi($ia);
break;
case ';': //ARRAY (Multi Flexi) Text
$values=do_array_multitext($ia); //It's like the "5th element" movie, come to life
break;
case '1': //Array (Flexible Labels) dual scale
$values=do_array_dual($ia);
break;
} //End Switch
if (isset($values)) //Break apart $values array returned from switch
{
//$answer is the html code to be printed
//$inputnames is an array containing the names of each input field
list($answer, $inputnames)=$values;
}
$answer .= "\n\t'.$clang->gT('*').''.$qtitle;
$question_text['mandatory'] = $clang->gT('*');
}
//If this question is mandatory but wasn't answered in the last page
//add a message HIGHLIGHTING the question
$qtitle .= mandatory_message($ia);
$question_text['man_message'] = mandatory_message($ia);
$qtitle .= validation_message($ia);
$question_text['valid_message'] = validation_message($ia);
$qtitle .= $ia[4] == "|" ? file_validation_message($ia) : "";
$question_text['file_valid_message'] = $ia[4] == "|" ? file_validation_message($ia) : "";
if(!empty($question_text['man_message']) || !empty($question_text['valid_message']) || !empty($question_text['file_valid_message']))
{
$question_text['input_error_class'] = ' input-error';// provides a class to style question wrapper differently if there is some kind of user input error;
}
// =====================================================
// START: legacy question_start.pstpl code
// The following section adds to the templating system by allowing
// templaters to control where the various parts of the question text
// are put.
if(is_file('templates/'.validate_templatedir($thissurvey['template']).'/question_start.pstpl'))
{
$qtitle_custom = '';
$replace=array();
foreach($question_text as $key => $value)
{
$find[] = '{QUESTION_'.strtoupper($key).'}'; // Match key words from template
$replace[] = $value; // substitue text
};
if(!defined('QUESTION_START'))
{
define('QUESTION_START' , file_get_contents(sGetTemplatePath($thissurvey['template']).'/question_start.pstpl' , true));
};
$qtitle_custom = str_replace( $find , $replace , QUESTION_START);
$c = 1;
// START: