diff --git a/common_functions.php b/common_functions.php
index 668166d3ee8..ad30c7ff362 100644
--- a/common_functions.php
+++ b/common_functions.php
@@ -7582,15 +7582,26 @@ function aGetFullResponseTable($iSurveyID, $iResponseID, $sLanguageCode, $bHonor
if ($oldgid !== $fname['gid'])
{
$oldgid = $fname['gid'];
- $aResultTable['gid_'.$fname['gid']]=array($fname['group_name']);
+ if (!$bHonorConditions || checkgroupfordisplay($fname['gid']))
+ {
+ $aResultTable['gid_'.$fname['gid']]=array($fname['group_name']);
+ }
}
}
if (isset($fname['qid']) && !empty($fname['qid']))
{
+ if ($bHonorConditions)
+ {
+ $isQuestionVisible=checkquestionfordisplay($fname['qid'],null);
+ }
+ else
+ {
+ $isQuestionVisible=true;
+ }
if ($oldqid !== $fname['qid'])
{
$oldqid = $fname['qid'];
- if (($bHonorConditions && checkquestionfordisplay($fname['qid'],null)) || !$bHonorConditions)
+ if ($isQuestionVisible)
{
if (isset($fname['subquestion']) || isset($fname['subquestion1']) || isset($fname['subquestion2']))
{
@@ -7625,9 +7636,12 @@ function aGetFullResponseTable($iSurveyID, $iResponseID, $sLanguageCode, $bHonor
if (isset($fname['subquestion2']))
$subquestion .= "[{$fname['subquestion2']}]";
+ if ($isQuestionVisible)
+ {
+ $answer=getextendedanswer($fname['fieldname'], $idrow[$fname['fieldname']]);
+ $aResultTable[$fname['fieldname']]=array('',$subquestion,$answer);
+ }
- $answer=getextendedanswer($fname['fieldname'], $idrow[$fname['fieldname']]);
- $aResultTable[$fname['fieldname']]=array('',$subquestion,$answer);
}
return $aResultTable;
}
@@ -7809,4 +7823,63 @@ function fixSubquestions()
}
+function checkgroupfordisplay($gid)
+{
+ //This function checks all the questions in a group to see if they have
+ //conditions, and if the do - to see if the conditions are met.
+ //If none of the questions in the group are set to display, then
+ //the function will return false, to indicate that the whole group
+ //should not display at all.
+ global $dbprefix, $connect;
+ $countQuestionsInThisGroup=0;
+ $countConditionalQuestionsInThisGroup=0;
+ foreach ($_SESSION['fieldarray'] as $ia) //Run through all the questions
+
+ {
+ if ($ia[5] == $gid) //If the question is in the group we are checking:
+
+ {
+ // Check if this question is hidden
+ $qidattributes=getQuestionAttributes($ia[0]);
+ if ($qidattributes!==false && $qidattributes['hidden']==0)
+ {
+ $countQuestionsInThisGroup++;
+ if ($ia[7] == "Y") //This question is conditional
+
+ {
+ $countConditionalQuestionsInThisGroup++;
+ $QuestionsWithConditions[]=$ia; //Create an array containing all the conditional questions
+ }
+ }
+ }
+ }
+ if ($countQuestionsInThisGroup===0)
+ {
+ return false;
+ }
+ elseif ($countQuestionsInThisGroup != $countConditionalQuestionsInThisGroup || !isset($QuestionsWithConditions) )
+ {
+ //One of the questions in this group is NOT conditional, therefore
+ //the group MUST be displayed
+ return true;
+ }
+ else
+ {
+ //All of the questions in this group are conditional. Now we must
+ //check every question, to see if the condition for each has been met.
+ //If 1 or more have their conditions met, then the group should
+ //be displayed.
+ foreach ($QuestionsWithConditions as $cc)
+ {
+ if (checkquestionfordisplay($cc[0], $gid) === true)
+ {
+ return true;
+ }
+ }
+ //Since we made it this far, there mustn't have been any conditions met.
+ //Therefore the group should not be displayed.
+ return false;
+ }
+}
+
// Closing PHP tag intentionally omitted - yes, it is okay
diff --git a/index.php b/index.php
index 6fbe4374829..2e221855694 100644
--- a/index.php
+++ b/index.php
@@ -1173,64 +1173,6 @@ function makelanguagechanger()
}
-function checkgroupfordisplay($gid)
-{
- //This function checks all the questions in a group to see if they have
- //conditions, and if the do - to see if the conditions are met.
- //If none of the questions in the group are set to display, then
- //the function will return false, to indicate that the whole group
- //should not display at all.
- global $dbprefix, $connect;
- $countQuestionsInThisGroup=0;
- $countConditionalQuestionsInThisGroup=0;
- foreach ($_SESSION['fieldarray'] as $ia) //Run through all the questions
-
- {
- if ($ia[5] == $gid) //If the question is in the group we are checking:
-
- {
- // Check if this question is hidden
- $qidattributes=getQuestionAttributes($ia[0]);
- if ($qidattributes!==false && $qidattributes['hidden']==0)
- {
- $countQuestionsInThisGroup++;
- if ($ia[7] == "Y") //This question is conditional
-
- {
- $countConditionalQuestionsInThisGroup++;
- $QuestionsWithConditions[]=$ia; //Create an array containing all the conditional questions
- }
- }
- }
- }
- if ($countQuestionsInThisGroup===0)
- {
- return false;
- }
- elseif ($countQuestionsInThisGroup != $countConditionalQuestionsInThisGroup || !isset($QuestionsWithConditions) )
- {
- //One of the questions in this group is NOT conditional, therefore
- //the group MUST be displayed
- return true;
- }
- else
- {
- //All of the questions in this group are conditional. Now we must
- //check every question, to see if the condition for each has been met.
- //If 1 or more have their conditions met, then the group should
- //be displayed.
- foreach ($QuestionsWithConditions as $cc)
- {
- if (checkquestionfordisplay($cc[0], $gid) === true)
- {
- return true;
- }
- }
- //Since we made it this far, there mustn't have been any conditions met.
- //Therefore the group should not be displayed.
- return false;
- }
-}
function checkconfield($value)
{
diff --git a/qanda.php b/qanda.php
index d3369c28aa1..1d3ded033e3 100644
--- a/qanda.php
+++ b/qanda.php
@@ -1,17 +1,17 @@
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*
- */
+* Let's explain what this strange $ia var means
+*
+* The $ia string comes from the $_SESSION['insertarray'] variable which is built at the commencement of the survey.
+* See index.php, function "buildsurveysession()"
+* One $ia array exists for every question in the survey. The $_SESSION['insertarray']
+* string is an array of $ia arrays.
+*
+* $ia[0] => 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')
{
@@ -127,7 +127,7 @@ function retrieveConditionInfo($ia)
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
+ // 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];
@@ -157,7 +157,7 @@ function retrieveJSidname($cd,$currentgid=null)
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
+ // placeholder
return "NoJSidname";
}
//preg_match("/^[0-9]+X([0-9]+)X([0-9]+)$/",$cd[2],$matchFields);
@@ -177,12 +177,12 @@ function retrieveJSidname($cd,$currentgid=null)
{
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_".$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]";
+ $idname="java$cd[2]";
}
}
elseif ($cd[4] == "5" ||
@@ -219,11 +219,11 @@ function retrieveJSidname($cd,$currentgid=null)
{
if (!isset($currentgid) || $questiongid == $currentgid)
{ // if question is on same page then field is answerXXXX
- $idname="answer$cd[2]";
+ $idname="answer$cd[2]";
}
else
{ // If question is on another page then field if javaXXXX
- $idname="java$cd[2]";
+ $idname="java$cd[2]";
}
}
else
@@ -355,20 +355,20 @@ function setman_questionandcode($ia)
/**
- * 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
- */
+* 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)
{
@@ -377,12 +377,12 @@ function setman_multiflex($ia)
$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";
+ 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";
+ 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())
@@ -453,29 +453,29 @@ function setman_questionandcode_multiscale($ia)
// Get Subquestions
$subquery="SELECT * "
- ."FROM {$dbprefix}questions "
- ."WHERE parent_qid={$ia[0]} "
- ."AND language='".$_SESSION['s_lang']."' "
- ."ORDER BY question_order";
+ ."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";
+ ."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";
+ ."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();
@@ -515,16 +515,16 @@ function setman_questionandcode_multiscale($ia)
}
/**
- * 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
- */
+* 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
@@ -561,7 +561,7 @@ function retrieveAnswers($ia, $notanswered=null, $notvalidated=null, $filenotval
$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)
+ 'all' => '' // All has been added for backwards compatibility with templates that use question_start.pstpl (now redundant)
,'text' => $qtitle
,'code' => $ia[2]
,'number' => $number
@@ -942,7 +942,7 @@ function validation_message($ia)
$help=' '.$helprow['help'].'';
}
$qtitle .= ' '.$clang->gT('This question must be answered correctly').'.'.$help.'
-';
+ ';
}
}
@@ -960,7 +960,7 @@ function file_validation_message($ia)
foreach ($filenotvalidated as $k => $v)
{
if ($ia[1] == $k || strpos($k, "_") && $ia[1] == substr(0, strpos($k, "_") - 1));
- $qtitle .= ' '.$clang->gT($filenotvalidated[$k]).' ';
+ $qtitle .= ' '.$clang->gT($filenotvalidated[$k]).' ';
}
}
return $qtitle;
@@ -979,16 +979,16 @@ function mandatory_popup($ia, $notanswered=null)
if (!isset($mandatorypopup) && ($ia[4] == 'T' || $ia[4] == 'S' || $ia[4] == 'U'))
{
$popup="\n";
+ \n
+ \n";
$mandatorypopup="Y";
}else
{
$popup="\n";
+ \n
+ \n";
$mandatorypopup="Y";
}
return array($mandatorypopup, $popup);
@@ -1013,9 +1013,9 @@ function validation_popup($ia, $notvalidated=null)
if (!isset($validationpopup))
{
$vpopup="\n";
+ \n
+ \n";
$validationpopup="Y";
}
return array($validationpopup, $vpopup);
@@ -1037,9 +1037,9 @@ function file_validation_popup($ia, $filenotvalidated = null)
if (!isset($filevalidationpopup))
{
$fpopup="\n";
+ \n
+ \n";
$filevalidationpopup = "Y";
}
return array($filevalidationpopup, $fpopup);
@@ -1052,7 +1052,7 @@ function return_timer_script($qidattributes, $ia, $disable=null) {
global $thissurvey, $clang;
/* The following lines cover for previewing questions, because no $_SESSION['fieldarray'] exists.
- This just stops error messages occuring */
+ This just stops error messages occuring */
if(!isset($_SESSION['fieldarray']))
{
$_SESSION['fieldarray'] = array();
@@ -1092,84 +1092,84 @@ function return_timer_script($qidattributes, $ia, $disable=null) {
$time_limit_warning_2_message=str_replace("{TIME}", "
\n\n";
@@ -1352,18 +1352,18 @@ function countdown(questionid,timer,action,warning,warning2,warninghide,warning2
$output .= "\n\n";
//Call the countdown script
$output .= "\n\n";
+ $(document).ready(function() {
+ countdown(".$ia[0].", ".$time_limit.", ".$time_limit_action.", ".$time_limit_warning.", ".$time_limit_warning_2.", ".$time_limit_warning_display_time.", ".$time_limit_warning_2_display_time.", '".$disable."');
+ });
+ \n\n";
return $output;
}
function return_array_filter_selected($ia, $qidattributes, $thissurvey, $ansrow, $rowname, $trbc='', $valuename, $method="tbody", $class=null)
// function which returns TRUE if the given $ansrow contains a row which is selected, ie, not filtered out in previous answer
{
- $filter_select = TRUE;
- if
+ $filter_select = TRUE;
+ if
(
(trim($qidattributes['array_filter'])!='' && // The array filter attribute is set
$thissurvey['format'] == 'S' // and the survey is being presented in question-by-question mode
@@ -1378,17 +1378,17 @@ function return_array_filter_selected($ia, $qidattributes, $thissurvey, $ansrow,
if (isset($ansrow['code'])) $ansrow['title'] = $ansrow['code'];
if (!empty($selected) && !in_array($ansrow['title'],$selected))
{
- $filter_select = FALSE;
- }
- else
- {
- $filter_select = TRUE;
- }
- }
+ $filter_select = FALSE;
+ }
+ else
+ {
+ $filter_select = TRUE;
+ }
+ }
- if
+ if
(isset($qidattributes['array_filter_exclude']) &&
- (
+ (
(trim($qidattributes['array_filter_exclude'])!='' &&
$thissurvey['format'] == 'S'
) ||
@@ -1396,21 +1396,21 @@ function return_array_filter_selected($ia, $qidattributes, $thissurvey, $ansrow,
$thissurvey['format'] == 'G' &&
getArrayFiltersExcludesOutGroup($ia[0]) == true
)
- )
+ )
)
{
$selected = getArrayFilterExcludesForQuestion($ia[0]);
if (isset($ansrow['code'])) $ansrow['title'] = $ansrow['code'];
if (!empty($selected) && !in_array($ansrow['title'],$selected))
{
- $filter_select = TRUE;
- }
- else
- {
- $filter_select = FALSE;
- }
- }
- return $filter_select;
+ $filter_select = TRUE;
+ }
+ else
+ {
+ $filter_select = FALSE;
+ }
+ }
+ return $filter_select;
}
function return_array_filter_strings($ia, $qidattributes, $thissurvey, $ansrow, $rowname, $trbc='', $valuename, $method="tbody", $class=null) {
@@ -1425,11 +1425,11 @@ function return_array_filter_strings($ia, $qidattributes, $thissurvey, $ansrow,
function return_array_filter_include_strings($ia, $qidattributes, $thissurvey, $ansrow, $rowname, $trbc='', $valuename, $method="tbody", $class=null) {
/* DO ARRAY_FILTER ATTRIBUTE
- We set the $hiddenfield for each answer, and the value of this is available to java to let javascripts
- know whether each answer is currently being displayed. $htmltbody2 determines whether the answer row
- should be displayed initially. If no answers for the source question have been selected then the whole
- answer row should start in the display-off position for array_filter or the display-on position
- for array_filter_exclude. */
+ We set the $hiddenfield for each answer, and the value of this is available to java to let javascripts
+ know whether each answer is currently being displayed. $htmltbody2 determines whether the answer row
+ should be displayed initially. If no answers for the source question have been selected then the whole
+ answer row should start in the display-off position for array_filter or the display-on position
+ for array_filter_exclude. */
//Are we doing array_filter, or array_filter_exclude. Where a conflict occurs, do array_filter
@@ -1449,32 +1449,32 @@ function return_array_filter_include_strings($ia, $qidattributes, $thissurvey, $
$htmltbody2 .= ($class !== null) ? " class='$class'": "";
$htmltbody2 .= ">\n";
if($ia[4]=="1") {
- //This is an array dual scale question and we have to massage the tbidpslay rowname
+ //This is an array dual scale question and we have to massage the tbidpslay rowname
$hiddenfield = "\n";
$hiddenfield .= "\n";
} else {
$hiddenfield = "\n";
}
} else if
- (
- (trim($qidattributes['array_filter'])!='' && // The array filter attribute is set
- $thissurvey['format'] == 'S' // and the survey is being presented in question-by-question mode
- ) || // OR
- (trim($qidattributes['array_filter'])!='' && // The array filter attribute is set
- $thissurvey['format'] == 'G' && // and the survey is being presented in group-by-group mode
- getArrayFiltersOutGroup($ia[0]) == true // and the source question for the array filter is in a different group than this question
- )
- )
- {
- $selected = getArrayFiltersForQuestion($ia[0]);
- if (isset($ansrow['code'])) $ansrow['title'] = $ansrow['code'];
- if (!empty($selected) && !in_array($ansrow['title'],$selected))
+ (
+ (trim($qidattributes['array_filter'])!='' && // The array filter attribute is set
+ $thissurvey['format'] == 'S' // and the survey is being presented in question-by-question mode
+ ) || // OR
+ (trim($qidattributes['array_filter'])!='' && // The array filter attribute is set
+ $thissurvey['format'] == 'G' && // and the survey is being presented in group-by-group mode
+ getArrayFiltersOutGroup($ia[0]) == true // and the source question for the array filter is in a different group than this question
+ )
+ )
+ {
+ $selected = getArrayFiltersForQuestion($ia[0]);
+ if (isset($ansrow['code'])) $ansrow['title'] = $ansrow['code'];
+ if (!empty($selected) && !in_array($ansrow['title'],$selected))
{
$htmltbody2 = "\n\n\t<$method id='javatbd$rowname' style='display: none'";
$htmltbody2 .= ($class !== null) ? " class='$class'": "";
$htmltbody2 .= ">\n";
if($ia[4]=="1") {
- //This is an array dual scale question and we have to massage the tbidpslay rowname
+ //This is an array dual scale question and we have to massage the tbidpslay rowname
$hiddenfield = "\n";
$hiddenfield .= "\n";
} else {
@@ -1488,21 +1488,21 @@ function return_array_filter_include_strings($ia, $qidattributes, $thissurvey, $
$htmltbody2 .= ($class !== null) ? " class='$class'": "";
$htmltbody2 .= ">";
if($ia[4]=="1") {
- //This is an array dual scale question and we have to massage the tbidpslay rowname
+ //This is an array dual scale question and we have to massage the tbidpslay rowname
$hiddenfield = "\n";
$hiddenfield .= "\n";
} else {
$hiddenfield = "\n";
+ }
}
}
- }
else
{
$htmltbody2 = "\n\n\t<$method id='javatbd$rowname'";
$htmltbody2 .= ($class !== null) ? " class='$class'": "";
$htmltbody2 .= ">\n";
if($ia[4]=="1") {
- //This is an array dual scale question and we have to massage the tbidpslay rowname
+ //This is an array dual scale question and we have to massage the tbidpslay rowname
$hiddenfield = "\n";
$hiddenfield .= "\n";
} else {
@@ -1517,10 +1517,10 @@ function return_array_filter_include_strings($ia, $qidattributes, $thissurvey, $
function return_array_filter_exclude_strings($ia, $qidattributes, $thissurvey, $ansrow, $rowname, $trbc='', $valuename, $method="tbody", $class=null) {
/* DO ARRAY_FILTER_EXCLUDE ATTRIBUTE
- We set the $hiddenfield for each answer, and the value of this is available to java to let javascripts
- know whether each answer is currently being displayed. $htmltbody2 determines whether the answer row
- should be displayed initially. If no answers for the source question have been selected then the whole
- answer row should start in the display-on position. */
+ We set the $hiddenfield for each answer, and the value of this is available to java to let javascripts
+ know whether each answer is currently being displayed. $htmltbody2 determines whether the answer row
+ should be displayed initially. If no answers for the source question have been selected then the whole
+ answer row should start in the display-on position. */
$htmltbody2 = '';
$hiddenfield= '';
@@ -1540,22 +1540,22 @@ function return_array_filter_exclude_strings($ia, $qidattributes, $thissurvey, $
$hiddenfield = "\n";
$hiddenfield .= "\n";
} else {
- $hiddenfield = "\n";
+ $hiddenfield = "\n";
}
} else if
- (
- (trim($qidattributes['array_filter_exclude'])!='' &&
- $thissurvey['format'] == 'S'
- ) ||
- (trim($qidattributes['array_filter_exclude'])!='' &&
- $thissurvey['format'] == 'G' &&
- getArrayFiltersExcludesOutGroup($ia[0]) == true
- )
- )
- {
- $selected = getArrayFilterExcludesForQuestion($ia[0]);
- if (isset($ansrow['code'])) $ansrow['title'] = $ansrow['code'];
- if (!empty($selected) && !in_array($ansrow['title'],$selected))
+ (
+ (trim($qidattributes['array_filter_exclude'])!='' &&
+ $thissurvey['format'] == 'S'
+ ) ||
+ (trim($qidattributes['array_filter_exclude'])!='' &&
+ $thissurvey['format'] == 'G' &&
+ getArrayFiltersExcludesOutGroup($ia[0]) == true
+ )
+ )
+ {
+ $selected = getArrayFilterExcludesForQuestion($ia[0]);
+ if (isset($ansrow['code'])) $ansrow['title'] = $ansrow['code'];
+ if (!empty($selected) && !in_array($ansrow['title'],$selected))
{
$htmltbody2 = "\n\n\t<$method id='javatbd$rowname'>\n";
if($ia[4]=="1") {
@@ -1563,8 +1563,8 @@ function return_array_filter_exclude_strings($ia, $qidattributes, $thissurvey, $
$hiddenfield = "\n";
$hiddenfield .= "\n";
} else {
- $hiddenfield="";
- }
+ $hiddenfield="";
+ }
}
else
{
@@ -1574,7 +1574,7 @@ function return_array_filter_exclude_strings($ia, $qidattributes, $thissurvey, $
$hiddenfield = "\n";
$hiddenfield .= "\n";
} else {
- $hiddenfield="\n";
+ $hiddenfield="\n";
}
$_SESSION[$valuename]=''; //Remove any saved results for this since it is no longer being displayed
}
@@ -1587,8 +1587,8 @@ function return_array_filter_exclude_strings($ia, $qidattributes, $thissurvey, $
$hiddenfield = "\n";
$hiddenfield .= "\n";
} else {
- $hiddenfield = "";
- }
+ $hiddenfield = "";
+ }
}
//End of array_filter attribute
@@ -1626,7 +1626,7 @@ function do_boilerplate($ia)
function do_5pointchoice($ia)
{
global $clang, $imageurl;
- global $js_header_includes, $css_header_includes;
+ global $js_header_includes, $css_header_includes;
if ($ia[8] == 'Y')
{
@@ -1638,7 +1638,7 @@ function do_5pointchoice($ia)
}
$qidattributes=getQuestionAttributes($ia[0],$ia[4]);
//print_r($qidattributes);
- $id = 'slider'.time().rand(0,100);
+ $id = 'slider'.time().rand(0,100);
$answer = "\n
\n";
for ($fp=1; $fp<=5; $fp++)
{
@@ -1663,83 +1663,83 @@ function do_5pointchoice($ia)
$answer .= "
"
- .sprintf($clang->ngT("Please rank at least %d item for question \"%s\"","Please rank at least %d items for question \"%s\".",$minansw),$minansw, trim(str_replace(array("\n", "\r"), "", $ia[3])))."
";
+ .sprintf($clang->ngT("Please rank at least %d item for question \"%s\"","Please rank at least %d items for question \"%s\".",$minansw),$minansw, trim(str_replace(array("\n", "\r"), "", $ia[3])))."";
}
$minanswscript = "\n";
+ }
+ return max;
+ }
+ }
+ //-->
+ \n";
$answer = $maxanswscript . $answer;
}
@@ -3341,7 +3341,7 @@ function excludeAllOthers$ia[1](value, doconditioncheck)
if ( $minansw > 0 )
{
$minanswscript .=
- "\tif (count < {$minansw} && document.getElementById('display{$ia[0]}').value == 'on'){\n"
+ "\tif (count < {$minansw} && document.getElementById('display{$ia[0]}').value == 'on'){\n"
. "alert('".sprintf($clang->gT("Please choose at least %d answer(s) for question \"%s\"","js"),
$minansw, trim(javascript_escape(str_replace(array("\n", "\r"), "",$ia[3]),true,true)))."');\n"
. "return false;\n"
@@ -3391,18 +3391,18 @@ function excludeAllOthers$ia[1](value, doconditioncheck)
if (count($excludeallothers)>0)
{
$excludeallotherscript .= "
- if (document.getElementById(value).checked)
- {
- $excludeallotherscripton
- }
- else
- {
- $excludeallotherscriptoff
- }
- }
- //-->
- ";
- $answer = $excludeallotherscript . $answer;
+ if (document.getElementById(value).checked)
+ {
+ $excludeallotherscripton
+ }
+ else
+ {
+ $excludeallotherscriptoff
+ }
+ }
+ //-->
+ ";
+ $answer = $excludeallotherscript . $answer;
}
$answer .= $postrow;
return array($answer, $inputnames);
@@ -3507,17 +3507,17 @@ function do_multiplechoice_withcomments($ia)
}
$qquery = "SELECT other FROM {$dbprefix}questions
- WHERE qid=".$ia[0]." AND language='".$_SESSION['s_lang']."' and parent_qid=0";
+ 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'];}
if ($qidattributes['random_order']==1) {
$ansquery = "SELECT * FROM {$dbprefix}questions
- WHERE parent_qid=$ia[0] AND language='".$_SESSION['s_lang']."'
- ORDER BY ".db_random();
+ WHERE parent_qid=$ia[0] AND language='".$_SESSION['s_lang']."'
+ ORDER BY ".db_random();
} else {
$ansquery = "SELECT * FROM {$dbprefix}questions
- WHERE parent_qid=$ia[0] AND language='".$_SESSION['s_lang']."'
- ORDER BY question_order";
+ WHERE parent_qid=$ia[0] AND language='".$_SESSION['s_lang']."'
+ ORDER BY question_order";
}
$ansresult = db_execute_assoc($ansquery); //Checked
$anscount = $ansresult->RecordCount()*2;
@@ -3608,7 +3608,7 @@ function do_multiplechoice_withcomments($ia)
$answer_main .= " $callmaxanswscriptother />\n\t\n\n"
. "\n\t