View Issue Details

IDProjectCategoryView StatusLast Update
03488Development Survey Designpublic2009-11-18 15:09
ReportermdekkerAssigned Tolemeur 
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version1.85+ 
Target VersionFixed in Version1.87 
Summary03488: Improve conditions designer
Description

I was playing with the conditions designer and noticed there is some room for improvement:

  • Boilerplate questions should not be displayed as there is no point making a condition on them

  • For array questions (at least the dual I tried) the answer that the condition applies to is put AFTER the question text. In case of long questions this makes it impossible to see what answer you are selecting. When the answercode is put in front of the question text (after the question code) then it would be easier to select the right line.

When I tried conditions, I noticed that for the dual scale array I cannot see what combination of answers we are talking about so if this is the only way, I think it needs a little improvement. I noticed the answer_x / answer_y combination is after the question. In my case I have a very long question, so even when I hover and see the popup title I don't see all information (might be browser related don't know).
If not only the questioncode but also the anser_x/answer_y would be prepended to the question text it would help me out a lot!

Also I think boilerplate question should be left out of the conditions dialog.

TagsNo tags attached.

Activities

mdekker

mdekker

2009-07-17 10:21

reporter   ~08876

The attached file is not production ready!

I removed the boilerplate question, and changed the output. The most important thing is around line 738. For me this is the best readable format, but this should ofcourse be judged by more people than just me.

Also changed output for other questions but that is without strip tags and maybe the format is wrong so be careful.

lemeur

lemeur

2009-07-24 18:19

developer   ~08922

Thanks for the report.
What you says seems ok to me, though I hadn't time to check the fix.
The best way would be to provide a Diff file instead of a full file (use TortoiseSVN on Windows to generate such file, or the diff command on Linux).

I won't be able to cope with this untill my holiday ends, so this will wait some times, unless someone in the team wants to review and commit the fix: this shouldn't be toot tricky as it should only touch the display.

mdekker

mdekker

2009-07-27 08:45

reporter   ~08958

I made some refinements to the submitted code already. I will check my code and submit a diff file later. I'll see if I can check it against the sample survey so I can see what it does for all questions.

2009-07-27 09:31

 

patch_conditionhandling.patch (6,000 bytes)
Index: conditionshandling.php
===================================================================
--- conditionshandling.php	(revision 7350)
+++ conditionshandling.php	(working copy)
@@ -634,11 +634,10 @@
 
 			while ($arows = $aresult->FetchRow())
 			{
-				$shortanswer = strip_tags($arows['answer']);
+				$shortanswer = "{$arows['code']}: [" . strip_tags($arows['answer']) . "]";
+				$shortquestion=$rows['title'].":$shortanswer ".strip_tags($rows['question']);
+				$cquestions[]=array($shortquestion, $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']);
 
-				$shortanswer .= " [{$arows['code']}]";
-				$cquestions[]=array("$shortquestion [$shortanswer]", $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']);
-
 				switch ($rows['type'])
 				{
 					case "A": //Array 5 buttons
@@ -729,12 +728,10 @@
 
 			while ($arows = $aresult->FetchRow())
 			{
-				$shortanswer = strip_tags($arows['answer']);
-
-				$shortanswer .= " [{$arows['code']}]";
 				foreach($lids as $key=>$val) 
 				{
-				    $cquestions[]=array("$shortquestion [$shortanswer [$val]] ", $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']."_".$key);
+					$shortquestion=$rows['title'].":{$arows['code']}:$key: [".strip_tags($arows['answer']). "][" .strip_tags($val). "] " . strip_tags($rows['question']);
+				    $cquestions[]=array($shortquestion, $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']."_".$key);
 				if ($rows['type'] == ":")
 				{
 					for($ii=$minvalue; $ii<=$maxvalue; $ii+=$stepvalue) 
@@ -758,13 +755,13 @@
 
 			while ($arows = $aresult->FetchRow())
 			{
-				$shortanswer = strip_tags($arows['answer']);
-				$shortanswer .= "[[Label 1]{$arows['code']}]";
-				$cquestions[]=array("$shortquestion [$shortanswer]", $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']."#0");
+				$shortanswer = "{$arows['code']}: [" . strip_tags($arows['answer']) . "][Label1]";
+				$shortquestion=$rows['title'].":$shortanswer ".strip_tags($rows['question']);
+				$cquestions[]=array($shortquestion, $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']."#0");
 
-				$shortanswer = strip_tags($arows['answer']);            
-				$shortanswer .= "[[Label 2]{$arows['code']}]";
-				$cquestions[]=array("$shortquestion [$shortanswer]", $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']."#1");
+				$shortanswer = "{$arows['code']}: [" . strip_tags($arows['answer']) . "][Label2]";
+				$shortquestion=$rows['title'].":$shortanswer ".strip_tags($rows['question']);
+				$cquestions[]=array($shortquestion, $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']."#1");
 
 				// first label
 				$lquery="SELECT * "
@@ -812,9 +809,9 @@
 
 			while ($arows = $aresult->FetchRow())
 			{
-				$shortanswer = strip_tags($arows['answer']);
-				$shortanswer .= "[{$arows['code']}]";
-				$cquestions[]=array("$shortquestion [$shortanswer]", $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']);
+				$shortanswer = "{$arows['code']}: [" . strip_tags($arows['answer']) . "]";
+				$shortquestion=$rows['title'].":$shortanswer ".strip_tags($rows['question']);
+				$cquestions[]=array($shortquestion, $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']);
 
 				// Only Show No-Answer if question is not mandatory
 				if ($rows['mandatory'] != 'Y')
@@ -840,7 +837,7 @@
 			}
 			for ($i=1; $i<=$acount; $i++)
 			{
-				$cquestions[]=array("$shortquestion [RANK $i]", $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$i);
+				$cquestions[]=array("{$rows['title']}: [RANK $i] ".strip_tags($rows['question']), $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$i);
 				foreach ($quicky as $qck)
 				{
 					$canswers[]=array($rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$i, $qck[0], $qck[1]);
@@ -855,7 +852,9 @@
 		} // End if type R
 		elseif($rows['type'] == "M" || $rows['type'] == "P")
 		{
-			$cquestions[]=array("$shortquestion [".$clang->gT("Group of checkboxes")."]", $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid']);
+			$shortanswer = " [".$clang->gT("Group of checkboxes")."]";
+			$shortquestion=$rows['title'].":$shortanswer ".strip_tags($rows['question']);
+			$cquestions[]=array($shortquestion, $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid']);
 			$aquery="SELECT * "
 				."FROM {$dbprefix}answers "
 				."WHERE qid={$rows['qid']} "
@@ -869,13 +868,18 @@
 				$theanswer = addcslashes($arows['answer'], "'");
 				$canswers[]=array($rows['sid'].$X.$rows['gid'].$X.$rows['qid'], $arows['code'], $theanswer);
 
-				$shortanswer = strip_tags($arows['answer']);
-				$shortanswer .= "[{$arows['code']}]";
-				$cquestions[]=array("$shortquestion ($shortanswer) [".$clang->gT("Single checkbox")."]", $rows['qid'], $rows['type'], "+".$rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']);
+				$shortanswer = "{$arows['code']}: [" . strip_tags($arows['answer']) . "]";
+				$shortanswer .= "[".$clang->gT("Single checkbox")."]";
+				$shortquestion=$rows['title'].":$shortanswer ".strip_tags($rows['question']);				
+				$cquestions[]=array($shortquestion, $rows['qid'], $rows['type'], "+".$rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']);
 				$canswers[]=array("+".$rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code'], 'Y', 'checked');
 				$canswers[]=array("+".$rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code'], '', 'not checked');
 			}
 		}
+		elseif($rows['type'] == "X") //Boilerplate question
+		{
+			//Just ignore this questiontype
+		}
 		else
 		{
 			$cquestions[]=array($shortquestion, $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid']);
mdekker

mdekker

2009-07-27 09:34

reporter   ~08961

Just attached the patch. I think I changed all that was necessary. The format is now:

question_code:answercode:second_answercode: [answerlabel][second answerlabel] question_text

2009-07-27 10:08

 

patch2_conditionhandling.patch (6,225 bytes)
Index: conditionshandling.php
===================================================================
--- conditionshandling.php	(revision 7350)
+++ conditionshandling.php	(working copy)
@@ -634,11 +634,10 @@
 
 			while ($arows = $aresult->FetchRow())
 			{
-				$shortanswer = strip_tags($arows['answer']);
+				$shortanswer = "{$arows['code']}: [" . strip_tags($arows['answer']) . "]";
+				$shortquestion=$rows['title'].":$shortanswer ".strip_tags($rows['question']);
+				$cquestions[]=array($shortquestion, $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']);
 
-				$shortanswer .= " [{$arows['code']}]";
-				$cquestions[]=array("$shortquestion [$shortanswer]", $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']);
-
 				switch ($rows['type'])
 				{
 					case "A": //Array 5 buttons
@@ -729,12 +728,10 @@
 
 			while ($arows = $aresult->FetchRow())
 			{
-				$shortanswer = strip_tags($arows['answer']);
-
-				$shortanswer .= " [{$arows['code']}]";
 				foreach($lids as $key=>$val) 
 				{
-				    $cquestions[]=array("$shortquestion [$shortanswer [$val]] ", $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']."_".$key);
+					$shortquestion=$rows['title'].":{$arows['code']}:$key: [".strip_tags($arows['answer']). "][" .strip_tags($val). "] " . strip_tags($rows['question']);
+				    $cquestions[]=array($shortquestion, $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']."_".$key);
 				if ($rows['type'] == ":")
 				{
 					for($ii=$minvalue; $ii<=$maxvalue; $ii+=$stepvalue) 
@@ -758,13 +755,16 @@
 
 			while ($arows = $aresult->FetchRow())
 			{
-				$shortanswer = strip_tags($arows['answer']);
-				$shortanswer .= "[[Label 1]{$arows['code']}]";
-				$cquestions[]=array("$shortquestion [$shortanswer]", $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']."#0");
+				$attr = getQAttributes($rows['qid']);
+				$label1 = isset($attr['dualscale_headerA']) ? $attr['dualscale_headerA'] : 'Label1';
+				$label2 = isset($attr['dualscale_headerB']) ? $attr['dualscale_headerB'] : 'Label2';
+				$shortanswer = "{$arows['code']}: [" . strip_tags($arows['answer']) . "][$label1]";
+				$shortquestion=$rows['title'].":$shortanswer ".strip_tags($rows['question']);
+				$cquestions[]=array($shortquestion, $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']."#0");
 
-				$shortanswer = strip_tags($arows['answer']);            
-				$shortanswer .= "[[Label 2]{$arows['code']}]";
-				$cquestions[]=array("$shortquestion [$shortanswer]", $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']."#1");
+				$shortanswer = "{$arows['code']}: [" . strip_tags($arows['answer']) . "][$label2]";
+				$shortquestion=$rows['title'].":$shortanswer ".strip_tags($rows['question']);
+				$cquestions[]=array($shortquestion, $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']."#1");
 
 				// first label
 				$lquery="SELECT * "
@@ -812,9 +812,9 @@
 
 			while ($arows = $aresult->FetchRow())
 			{
-				$shortanswer = strip_tags($arows['answer']);
-				$shortanswer .= "[{$arows['code']}]";
-				$cquestions[]=array("$shortquestion [$shortanswer]", $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']);
+				$shortanswer = "{$arows['code']}: [" . strip_tags($arows['answer']) . "]";
+				$shortquestion=$rows['title'].":$shortanswer ".strip_tags($rows['question']);
+				$cquestions[]=array($shortquestion, $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']);
 
 				// Only Show No-Answer if question is not mandatory
 				if ($rows['mandatory'] != 'Y')
@@ -840,7 +840,7 @@
 			}
 			for ($i=1; $i<=$acount; $i++)
 			{
-				$cquestions[]=array("$shortquestion [RANK $i]", $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$i);
+				$cquestions[]=array("{$rows['title']}: [RANK $i] ".strip_tags($rows['question']), $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$i);
 				foreach ($quicky as $qck)
 				{
 					$canswers[]=array($rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$i, $qck[0], $qck[1]);
@@ -855,7 +855,9 @@
 		} // End if type R
 		elseif($rows['type'] == "M" || $rows['type'] == "P")
 		{
-			$cquestions[]=array("$shortquestion [".$clang->gT("Group of checkboxes")."]", $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid']);
+			$shortanswer = " [".$clang->gT("Group of checkboxes")."]";
+			$shortquestion=$rows['title'].":$shortanswer ".strip_tags($rows['question']);
+			$cquestions[]=array($shortquestion, $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid']);
 			$aquery="SELECT * "
 				."FROM {$dbprefix}answers "
 				."WHERE qid={$rows['qid']} "
@@ -869,13 +871,18 @@
 				$theanswer = addcslashes($arows['answer'], "'");
 				$canswers[]=array($rows['sid'].$X.$rows['gid'].$X.$rows['qid'], $arows['code'], $theanswer);
 
-				$shortanswer = strip_tags($arows['answer']);
-				$shortanswer .= "[{$arows['code']}]";
-				$cquestions[]=array("$shortquestion ($shortanswer) [".$clang->gT("Single checkbox")."]", $rows['qid'], $rows['type'], "+".$rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']);
+				$shortanswer = "{$arows['code']}: [" . strip_tags($arows['answer']) . "]";
+				$shortanswer .= "[".$clang->gT("Single checkbox")."]";
+				$shortquestion=$rows['title'].":$shortanswer ".strip_tags($rows['question']);				
+				$cquestions[]=array($shortquestion, $rows['qid'], $rows['type'], "+".$rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']);
 				$canswers[]=array("+".$rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code'], 'Y', 'checked');
 				$canswers[]=array("+".$rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code'], '', 'not checked');
 			}
 		}
+		elseif($rows['type'] == "X") //Boilerplate question
+		{
+			//Just ignore this questiontype
+		}
 		else
 		{
 			$cquestions[]=array($shortquestion, $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid']);
mdekker

mdekker

2009-07-27 10:09

reporter   ~08962

Attached patch2, I noticed the array dual scale question had label1 / label2 so I changed that to display the real labels.

user659

2009-07-29 02:40

  ~08977

I think you mean there is no point in making a condition like 'if boilerplate = xyz then show some question'. That's fine, but just in case: I've used conditions to show different boilerplate statements depending on the answer to another question.

mdekker

mdekker

2009-07-29 08:39

reporter   ~08978

Last edited: 2009-07-29 08:45

I didn't think of that... I think it is designed to show all questions in both windows... so to make conditions and to attach them to. I will have a look to see if I didn't break the conditions to display a boilerplate. If I did I will leave the boilerplate in if it is to difficult to fix.

-->UPDATE<-- I checked and I can assign conditions to the boilerplate, but make conditions based on a boilerplate so all is fine.

mdekker

mdekker

2009-08-18 15:07

reporter   ~09155

I found a problem in the existing code that I fix in the patch I will attach now... in the multi flexi part (: and ; question codes) a $lids array is created but it is never unset... sometimes this gives unexpected results when different labelset have been used on different questions and they get mixed.

2009-08-18 15:12

 

patch3_conditionhandling.patch (6,810 bytes)
Index: conditionshandling.php
===================================================================
--- conditionshandling.php	(revision 7464)
+++ conditionshandling.php	(working copy)
@@ -634,11 +634,10 @@
 
 			while ($arows = $aresult->FetchRow())
 			{
-				$shortanswer = strip_tags($arows['answer']);
+				$shortanswer = "{$arows['code']}: [" . strip_tags($arows['answer']) . "]";
+				$shortquestion=$rows['title'].":$shortanswer ".strip_tags($rows['question']);
+				$cquestions[]=array($shortquestion, $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']);
 
-				$shortanswer .= " [{$arows['code']}]";
-				$cquestions[]=array("$shortquestion [$shortanswer]", $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']);
-
 				switch ($rows['type'])
 				{
 					case "A": //Array 5 buttons
@@ -702,11 +701,11 @@
         	} else {
         		$stepvalue=1;
         	}
-		if (arraySearchByKey("multiflexible_checkbox", $qidattributes, "attribute", 1)) {
-			$minvalue=0;
-			$maxvalue=1;
-			$stepvalue=1;
-		}
+			if (arraySearchByKey("multiflexible_checkbox", $qidattributes, "attribute", 1)) {
+				$minvalue=0;
+				$maxvalue=1;
+				$stepvalue=1;
+			}
 			//Get the LIDs
 		    $fquery = "SELECT * "
 						."FROM {$dbprefix}labels "
@@ -729,12 +728,10 @@
 
 			while ($arows = $aresult->FetchRow())
 			{
-				$shortanswer = strip_tags($arows['answer']);
-
-				$shortanswer .= " [{$arows['code']}]";
 				foreach($lids as $key=>$val) 
 				{
-				    $cquestions[]=array("$shortquestion [$shortanswer [$val]] ", $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']."_".$key);
+					$shortquestion=$rows['title'].":{$arows['code']}:$key: [".strip_tags($arows['answer']). "][" .strip_tags($val). "] " . strip_tags($rows['question']);
+				    $cquestions[]=array($shortquestion, $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']."_".$key);
 				if ($rows['type'] == ":")
 				{
 					for($ii=$minvalue; $ii<=$maxvalue; $ii+=$stepvalue) 
@@ -744,7 +741,7 @@
 				}
 				}
 			}
-
+			unset($lids);
 		} //if A,B,C,E,F,H
 		elseif ($rows['type'] == "1") //Multi Scale
 		{
@@ -758,13 +755,16 @@
 
 			while ($arows = $aresult->FetchRow())
 			{
-				$shortanswer = strip_tags($arows['answer']);
-				$shortanswer .= "[[Label 1]{$arows['code']}]";
-				$cquestions[]=array("$shortquestion [$shortanswer]", $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']."#0");
+				$attr = getQAttributes($rows['qid']);
+				$label1 = isset($attr['dualscale_headerA']) ? $attr['dualscale_headerA'] : 'Label1';
+				$label2 = isset($attr['dualscale_headerB']) ? $attr['dualscale_headerB'] : 'Label2';
+				$shortanswer = "{$arows['code']}: [" . strip_tags($arows['answer']) . "][$label1]";
+				$shortquestion=$rows['title'].":$shortanswer ".strip_tags($rows['question']);
+				$cquestions[]=array($shortquestion, $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']."#0");
 
-				$shortanswer = strip_tags($arows['answer']);            
-				$shortanswer .= "[[Label 2]{$arows['code']}]";
-				$cquestions[]=array("$shortquestion [$shortanswer]", $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']."#1");
+				$shortanswer = "{$arows['code']}: [" . strip_tags($arows['answer']) . "][$label2]";
+				$shortquestion=$rows['title'].":$shortanswer ".strip_tags($rows['question']);
+				$cquestions[]=array($shortquestion, $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']."#1");
 
 				// first label
 				$lquery="SELECT * "
@@ -812,9 +812,9 @@
 
 			while ($arows = $aresult->FetchRow())
 			{
-				$shortanswer = strip_tags($arows['answer']);
-				$shortanswer .= "[{$arows['code']}]";
-				$cquestions[]=array("$shortquestion [$shortanswer]", $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']);
+				$shortanswer = "{$arows['code']}: [" . strip_tags($arows['answer']) . "]";
+				$shortquestion=$rows['title'].":$shortanswer ".strip_tags($rows['question']);
+				$cquestions[]=array($shortquestion, $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']);
 
 				// Only Show No-Answer if question is not mandatory
 				if ($rows['mandatory'] != 'Y')
@@ -840,7 +840,7 @@
 			}
 			for ($i=1; $i<=$acount; $i++)
 			{
-				$cquestions[]=array("$shortquestion [RANK $i]", $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$i);
+				$cquestions[]=array("{$rows['title']}: [RANK $i] ".strip_tags($rows['question']), $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$i);
 				foreach ($quicky as $qck)
 				{
 					$canswers[]=array($rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$i, $qck[0], $qck[1]);
@@ -855,7 +855,9 @@
 		} // End if type R
 		elseif($rows['type'] == "M" || $rows['type'] == "P")
 		{
-			$cquestions[]=array("$shortquestion [".$clang->gT("Group of checkboxes")."]", $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid']);
+			$shortanswer = " [".$clang->gT("Group of checkboxes")."]";
+			$shortquestion=$rows['title'].":$shortanswer ".strip_tags($rows['question']);
+			$cquestions[]=array($shortquestion, $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid']);
 			$aquery="SELECT * "
 				."FROM {$dbprefix}answers "
 				."WHERE qid={$rows['qid']} "
@@ -869,13 +871,18 @@
 				$theanswer = addcslashes($arows['answer'], "'");
 				$canswers[]=array($rows['sid'].$X.$rows['gid'].$X.$rows['qid'], $arows['code'], $theanswer);
 
-				$shortanswer = strip_tags($arows['answer']);
-				$shortanswer .= "[{$arows['code']}]";
-				$cquestions[]=array("$shortquestion ($shortanswer) [".$clang->gT("Single checkbox")."]", $rows['qid'], $rows['type'], "+".$rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']);
+				$shortanswer = "{$arows['code']}: [" . strip_tags($arows['answer']) . "]";
+				$shortanswer .= "[".$clang->gT("Single checkbox")."]";
+				$shortquestion=$rows['title'].":$shortanswer ".strip_tags($rows['question']);				
+				$cquestions[]=array($shortquestion, $rows['qid'], $rows['type'], "+".$rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']);
 				$canswers[]=array("+".$rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code'], 'Y', 'checked');
 				$canswers[]=array("+".$rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code'], '', 'not checked');
 			}
 		}
+		elseif($rows['type'] == "X") //Boilerplate question
+		{
+			//Just ignore this questiontype
+		}
 		else
 		{
 			$cquestions[]=array($shortquestion, $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid']);

user1692

2009-08-25 13:19

  ~09209

Well, this is just really a quick thought on the subject. It might seem stupid to be able to base a condition on the "result" of a boilerplate question. But I have actually done something similar.

I had a survey where I wanted to do some statistics based on things I already knew of the respondents. Since you cannot access token attribute fields when doing statistics (sadly), I created questions which the respondents couldn't fill out since they were hidden by an impossible condition. Instead I filled these questions for them with the correct values (for example the size of the organisation for which the answers was about) which greatly improved the statistics I could generate. My impossible conditions are not really impossible, just really really improbable (having more than 999999999 scheduled activities in one week). Basing them upon a boilerplate question on the other hand would have made them really impossible. So while it is a fringe use, I could see where it might be nice.

Of course, one perhaps could accomplish this using other kinds of conditions?

c_schmitz

c_schmitz

2009-09-08 17:07

administrator   ~09470

Thibault, please change these things only in dev-version

lemeur

lemeur

2009-09-08 21:32

developer   ~09473

k

lemeur

lemeur

2009-10-10 23:17

developer   ~09765

Many thanks for this, it is now implemented in rev 7749.

Issue History

Date Modified Username Field Change
2009-07-17 09:32 mdekker New Issue
2009-07-17 09:32 mdekker Status new => assigned
2009-07-17 09:32 mdekker Assigned To => user372
2009-07-17 09:32 mdekker Database & DB-Version => dna
2009-07-17 09:32 mdekker Operating System (Server) => dna
2009-07-17 09:32 mdekker Webserver => dna
2009-07-17 09:32 mdekker PHP Version => dna
2009-07-17 09:53 user372 Assigned To user372 => lemeur
2009-07-17 10:19 mdekker File Added: conditionshandling.php
2009-07-17 10:21 mdekker Note Added: 08876
2009-07-24 18:19 lemeur Note Added: 08922
2009-07-24 23:09 Mazi Status assigned => feedback
2009-07-27 08:45 mdekker Note Added: 08958
2009-07-27 09:31 mdekker File Deleted: conditionshandling.php
2009-07-27 09:31 mdekker File Added: patch_conditionhandling.patch
2009-07-27 09:34 mdekker Note Added: 08961
2009-07-27 10:08 mdekker File Added: patch2_conditionhandling.patch
2009-07-27 10:09 mdekker Note Added: 08962
2009-07-29 02:40 user659 Note Added: 08977
2009-07-29 08:39 mdekker Note Added: 08978
2009-07-29 08:45 mdekker Note Edited: 08978
2009-08-18 15:07 mdekker Note Added: 09155
2009-08-18 15:12 mdekker File Added: patch3_conditionhandling.patch
2009-08-25 13:19 user1692 Note Added: 09209
2009-09-08 17:07 c_schmitz Note Added: 09470
2009-09-08 21:23 lemeur Status feedback => assigned
2009-09-08 21:23 lemeur Assigned To lemeur => c_schmitz
2009-09-08 21:24 lemeur Assigned To c_schmitz => lemeur
2009-09-08 21:32 lemeur Note Added: 09473
2009-09-22 02:05 c_schmitz Project Bug reports => Development
2009-10-10 23:17 lemeur Note Added: 09765
2009-10-10 23:17 lemeur Status assigned => resolved
2009-10-10 23:17 lemeur Fixed in Version => 1.87
2009-10-10 23:17 lemeur Resolution open => fixed
2009-11-18 15:09 c_schmitz Status resolved => closed