View Issue Details

This issue affects 1 person(s).
 8
IDProjectCategoryView StatusLast Update
05402Bug reportsPrint Viewpublic2011-08-24 15:32
Reporterronvdburg Assigned Toc_schmitz  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version1.91+ 
Summary05402: Actually hide questions in Printable Survey if they have attribute 'hidden'
Description

Using the ShowPrintableSurvey (admin/printablesurvey.php) shows you all questions.

I modified printablesurvey.php to hide questions that have attribute 'hidden'.

Steps To Reproduce

Change a question to have attribute 'hidden'. Go to survey admin and select the 'Printable version'.

Additional Information

You may use my patch to incorporate it in the next version.
If you want, I may add an extra boolean for config.php.
If so, please give me a sensible variable name and I will upload new patches that hide if wanted by configuration.

TagsNo tags attached.
Attached Files
printablesurvey.php.diff-u.v2.txt (1,308 bytes)   
--- printablesurvey.php.org	2011-07-05 07:46:51.000000000 +0200
+++ printablesurvey.php.donated	2011-08-18 11:31:56.000000000 +0200
@@ -389,6 +389,9 @@
     ,'QUESTIONS' => '' // templated formatted content if $question is appended to this at the end of processing each question.
     );
 
+    // A group can have only hidden questions. In that case you don't want to see the group's header/description either.
+    $group_has_visible_questions = 0;
+
 
     if(isset($_POST['printableexport'])){$pdf->titleintopdf($degrow['group_name'],$degrow['description']);}
 
@@ -413,6 +416,8 @@
             {
                 continue;
             }
+            $group_has_visible_questions = 1;
+
             //GET ANY CONDITIONS THAT APPLY TO THIS QUESTION
 
             $printablesurveyoutput = '';
@@ -1829,7 +1834,10 @@
             $group['QUESTIONS'] .= populate_template( 'question' , $question);
 
         }
-        $survey_output['GROUPS'] .= populate_template( 'group' , $group );
+        if ($group_has_visible_questions)
+        {
+            $survey_output['GROUPS'] .= populate_template( 'group' , $group );
+        }
 }
 
 $survey_output['THEREAREXQUESTIONS'] =  str_replace( '{NUMBEROFQUESTIONS}' , $total_questions , $clang->gT('There are {NUMBEROFQUESTIONS} questions in this survey'));
printablesurvey.php.svn-diff.txt (1,349 bytes)   
Index: printablesurvey.php
===================================================================
--- printablesurvey.php	(revision 10834)
+++ printablesurvey.php	(working copy)
@@ -389,6 +389,8 @@
     ,'QUESTIONS' => '' // templated formatted content if $question is appended to this at the end of processing each question.
     );
 
+    // A group can have only hidden questions. In that case you don't want to see the group's header/description either.
+    $group_has_visible_questions = 0;
 
     if(isset($_POST['printableexport'])){$pdf->titleintopdf($degrow['group_name'],$degrow['description']);}
 
@@ -413,6 +415,8 @@
             {
                 continue;
             }
+            $group_has_visible_questions = 1;
+
             //GET ANY CONDITIONS THAT APPLY TO THIS QUESTION
 
             $printablesurveyoutput = '';
@@ -1829,7 +1833,10 @@
             $group['QUESTIONS'] .= populate_template( 'question' , $question);
 
         }
-        $survey_output['GROUPS'] .= populate_template( 'group' , $group );
+        if ($group_has_visible_questions)
+        {
+            $survey_output['GROUPS'] .= populate_template( 'group' , $group );
+        }
 }
 
 $survey_output['THEREAREXQUESTIONS'] =  str_replace( '{NUMBEROFQUESTIONS}' , $total_questions , $clang->gT('There are {NUMBEROFQUESTIONS} questions in this survey'));
Bug heat8
Complete LimeSurvey version number (& build)10746
I will donate to the project if issue is resolvedNo
Browser
Database type & versionmysql 14.12
Server OS (if known)Centos 2.2.3 (Linux version 2.6.18-194.3.1.el5)
Webserver software & version (if known)Apache/2.2.3 (CentOS)
PHP Version5.1.6
Git branch / Pull Request URL

Users monitoring this issue

ronvdburg

Activities

mot

mot

2011-08-17 18:48

reporter   ~16086

Thanks for providing the patch, I could quickly take a look.

I stumbled over the variable naming, "This" and "Something" is not saying much and the camel-case is a bit out of line with the surrounding code.

Probably

$show_group

or

$group_has_visible_questions

is better a better choice.

ronvdburg

ronvdburg

2011-08-18 11:34

reporter   ~16089

Excellent suggestion mot, see the attached version 2 of the patch file containing your suggestions.

Thanks,

Ron

c_schmitz

c_schmitz

2011-08-23 18:33

administrator   ~16121

ronvdburg, is it possible to provide a patch created with subversion?
The provided diff format is very cumbersome.

c_schmitz

c_schmitz

2011-08-24 15:32

administrator   ~16135

Thank you! Will be fixed in next 1.91+ release!

Issue History

Date Modified Username Field Change
2011-08-17 17:40 ronvdburg New Issue
2011-08-17 17:52 ronvdburg Issue Monitored: ronvdburg
2011-08-17 17:55 ronvdburg File Added: printablesurvey.php.diff-u
2011-08-17 18:48 mot Note Added: 16086
2011-08-18 11:32 ronvdburg File Added: printablesurvey.php.diff-u.v2.txt
2011-08-18 11:34 ronvdburg Note Added: 16089
2011-08-18 13:03 c_schmitz Assigned To => c_schmitz
2011-08-18 13:03 c_schmitz Status new => assigned
2011-08-23 18:28 c_schmitz File Deleted: printablesurvey.php.diff-u
2011-08-23 18:33 c_schmitz Note Added: 16121
2011-08-24 15:06 ronvdburg File Added: printablesurvey.php.svn-diff.txt
2011-08-24 15:32 c_schmitz Note Added: 16135
2011-08-24 15:32 c_schmitz Status assigned => closed
2021-08-03 05:14 guest Bug heat 6 => 8
2026-10-25 16:41 c_schmitz Resolution open => fixed