Index: group.php =================================================================== --- group.php (revision 8796) +++ group.php (working copy) @@ -326,9 +326,13 @@ $qtypesarray = array(); +$qnumber = 0; + foreach ($_SESSION['fieldarray'] as $ia) { $qtypesarray[$ia[1]] = $ia[4]; + ++$qnumber; + $ia[9] = $qnumber; // incremental question count; if ($ia[5] == $gid) { Index: question.php =================================================================== --- question.php (revision 8796) +++ question.php (working copy) @@ -109,7 +109,7 @@ else {$currentquestion=$_SESSION['step']-1;} $ia=$_SESSION['fieldarray'][$currentquestion]; - +$ia[]=$_SESSION['step']; list($newgroup, $gid, $groupname, $groupdescription, $gl)=checkIfNewGroup($ia); // MANAGE CONDITIONAL QUESTIONS AND HIDDEN QUESTIONS Index: config-defaults.php =================================================================== --- config-defaults.php (revision 8796) +++ config-defaults.php (working copy) @@ -76,7 +76,7 @@ // has not been answered. 1=Allow, 0=Deny $deletenonvalues = 1; // By default, LimeSurvey does not save responses to conditional questions that haven't been answered/shown. To have LimeSurvey save these responses change this value to 0. $printanswershonorsconditions = 1; // Set to 1 if you want the participant printanswers feature to show only the questions that were displayed survey branching-logic -$shownoanswer = 1; // Show 'no answer' for non mandatory questions +$shownoanswer = 1; // Show 'no answer' for non mandatory questions ( 0 = no , 1 = yes , 2 = survey admin can choose ) $admintheme = 'default'; // This setting specifys the directory where the admin finds it theme/css style files, e.g. setting 'default' points to /admin/styles/default $defaulttemplate = 'default'; // This setting specifys the default theme used for the 'public list' of surveys @@ -425,6 +425,41 @@ $updatecheckperiod=7; +/** + * @var $showXquestions string allows you to control whether or not + * {THEREAREXQUESTIONS} is displayed (if it is included in a template) + * hide = always hide {THEREAREXQUESTIONS} + * show = always show {THEREAREXQUESTIONS} + * choose = allow survey admins to choose + */ +$showXquestions = 'choose'; + + +/** + * @var $showgroupinfo string allows you to control whether or not + * {GROUPNAME} and/or {GROUPDESCRIPTION} are displayed (if they are + * included in a template) + * none = always hide both title and description + * name = always {GROUPNAME} only + * description = always show {GROUPDESCRIPTION} only + * both = always show both {GROUPNAME} and {GROUPDESCRIPTION} + * choose = allow survey admins to choose + */ +$showgroupinfo = 'choose'; + + +/** + * @var $showqnumcode string allows you to control whether or not + * {QUESTION_NUMBER} and/or {QUESTION_CODE} are displayed (if they + * are included in a template) + * none = always hide both {QUESTION_NUMBER} and {QUESTION_CODE} + * code = always show {QUESTION_CODE} only + * number = always show {QUESTION_NUMBER} only + * both = always show both {QUESTION_NUMBER} and {QUESTION_CODE} + * choose = allow survey admins to choose + */ +$showqnumcode = 'choose'; + //DO NOT EVER CHANGE THE FOLLOWING LINE --------------- require_once(dirname(__FILE__).'/config.php'); //----------------------------------------------------- Index: qanda.php =================================================================== --- qanda.php (revision 8796) +++ qanda.php (working copy) @@ -34,6 +34,7 @@ * $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 @@ -46,6 +47,15 @@ * $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); +}; + function retrieveConditionInfo($ia) { //This function returns an array containing all related conditions @@ -474,7 +484,7 @@ function retrieveAnswers($ia, $notanswered=null, $notvalidated=null) { //globalise required config variables - global $dbprefix, $shownoanswer, $clang; //These are from the config-defaults.php file + global $dbprefix, $clang; //These are from the config-defaults.php file global $thissurvey, $gl; //These are set by index.php global $connect; @@ -513,6 +523,8 @@ $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' => $ia[9] ,'help' => '' ,'mandatory' => '' ,'man_message' => '' @@ -1414,7 +1426,7 @@ // --------------------------------------------------------------- function do_5pointchoice($ia) { - global $shownoanswer, $clang; + global $clang; if ($ia[8] == 'Y') { @@ -1436,7 +1448,7 @@ $answer .= " onclick=\"$checkconditionFunction(this.value, this.name, this.type)\" />\n\n\t\n"; } - if ($ia[6] != "Y" && $shownoanswer == 1) // Add "No Answer" option if question is not mandatory + if ($ia[6] != "Y" && SHOW_NO_ANSWER == 1) // Add "No Answer" option if question is not mandatory { $answer .= "\t
  • \n'.$othertext."\n"; } - if ((isset($_SESSION[$ia[1]]) || $_SESSION[$ia[1]] != '') && (!isset($defexists) || !$defexists) && $ia[6] != 'Y' && $shownoanswer == 1) + if ((isset($_SESSION[$ia[1]]) || $_SESSION[$ia[1]] != '') && (!isset($defexists) || !$defexists) && $ia[6] != 'Y' && SHOW_NO_ANSWER == 1) { $answer .= '\n"; } @@ -1953,7 +1965,7 @@ function do_list_radio($ia) { global $dbprefix, $dropdownthreshold, $lwcdropdowns, $connect, $clang; - global $shownoanswer, $thissurvey; + global $thissurvey; if ($ia[8] == 'Y') @@ -2015,7 +2027,7 @@ } if (isset($other) && $other=='Y') {$anscount++;} //Count up for the Other answer - if ($ia[6] != 'Y' && $shownoanswer == 1) {$anscount++;} //Count up if "No answer" is showing + if ($ia[6] != 'Y' && SHOW_NO_ANSWER == 1) {$anscount++;} //Count up if "No answer" is showing $wrapper = setup_columns($dcols , $anscount); $answer = $wrapper['whole-start']; @@ -2139,7 +2151,7 @@ } } - if ($ia[6] != 'Y' && $shownoanswer == 1) + if ($ia[6] != 'Y' && SHOW_NO_ANSWER == 1) { if (((!isset($_SESSION[$ia[1]]) || $_SESSION[$ia[1]] == '') && (!isset($defexists) || !$defexists)) || ($_SESSION[$ia[1]] == ' ' && (!isset($defexists) || !$defexists))) { @@ -2212,7 +2224,7 @@ function do_listwithcomment($ia) { global $maxoptionsize, $dbprefix, $dropdownthreshold, $lwcdropdowns; - global $shownoanswer, $clang; + global $clang; if ($ia[8] == 'Y') { @@ -2274,7 +2286,7 @@ '; } - if ($ia[6] != 'Y' && $shownoanswer == 1) + if ($ia[6] != 'Y' && SHOW_NO_ANSWER == 1) { if (((!isset($_SESSION[$ia[1]]) || $_SESSION[$ia[1]] == '') && (!isset($defexists) || !$defexists)) ||($_SESSION[$ia[1]] == ' ' && (!isset($defexists) || !$defexists))) { @@ -2344,7 +2356,7 @@ $maxoptionsize = strlen($ansrow['answer']); } } - if ($ia[6] != 'Y' && $shownoanswer == 1) + if ($ia[6] != 'Y' && SHOW_NO_ANSWER == 1) { if (((!isset($_SESSION[$ia[1]]) || $_SESSION[$ia[1]] == '') && (!isset($defexists) || !$defexists)) ||($_SESSION[$ia[1]] == ' ' && (!isset($defexists) || !$defexists))) { @@ -4519,7 +4531,7 @@ // --------------------------------------------------------------- function do_yesno($ia) { - global $shownoanswer, $clang; + global $clang; if ($ia[8] == 'Y') { @@ -4550,7 +4562,7 @@ $answer .= " onclick=\"$checkconditionFunction(this.value, this.name, this.type)\" />\n\n\t
  • \n"; // --> END NEW FEATURE - SAVE - if ($ia[6] != 'Y' && $shownoanswer == 1) + if ($ia[6] != 'Y' && SHOW_NO_ANSWER == 1) { $answer .= "\t
  • \n\n\n\t
  • \n"; - if ($ia[6] != 'Y' && $shownoanswer == 1) + if ($ia[6] != 'Y' && SHOW_NO_ANSWER == 1) { /* columns now done by CSS if ($dcols > 2) @@ -4648,7 +4660,7 @@ */ function do_array_5point($ia) { - global $dbprefix, $shownoanswer, $notanswered, $thissurvey, $clang; + global $dbprefix, $notanswered, $thissurvey, $clang; if ($ia[8] == 'Y') { @@ -4672,7 +4684,7 @@ } $cellwidth = 5; // number of columns - if ($ia[6] != 'Y' && $shownoanswer == 1) //Question is not mandatory + if ($ia[6] != 'Y' && SHOW_NO_ANSWER == 1) //Question is not mandatory { ++$cellwidth; // add another column } @@ -4707,7 +4719,7 @@ $odd_even = alternation($odd_even); $answer .= "\n"; } - if ($ia[6] != 'Y' && $shownoanswer == 1) //Question is not mandatory + if ($ia[6] != 'Y' && SHOW_NO_ANSWER == 1) //Question is not mandatory { $odd_even = alternation($odd_even); $answer .= "\n"; @@ -4720,7 +4732,7 @@ $answer .= "\t$xc\n"; } if ($right_exists) {$answer .= "\t \n";} - if ($ia[6] != 'Y' && $shownoanswer == 1) //Question is not mandatory + if ($ia[6] != 'Y' && SHOW_NO_ANSWER == 1) //Question is not mandatory { $answer .= "\t".$clang->gT('No answer')."\n"; } @@ -4783,7 +4795,7 @@ } - if ($ia[6] != 'Y' && $shownoanswer == 1) + if ($ia[6] != 'Y' && SHOW_NO_ANSWER == 1) //Question is not mandatory { $answer_t_content .= "\t\n