diff --git a/application/helpers/common_helper.php b/application/helpers/common_helper.php index 73d887c0ede..6c8ece1ee97 100644 --- a/application/helpers/common_helper.php +++ b/application/helpers/common_helper.php @@ -3088,6 +3088,17 @@ function questionAttributes($returnByName=false) "help"=>$clang->gT("Enter the code(s) of Multiple choice question(s) (separated by semicolons) to exclude the matching answer options in this question."), "caption"=>$clang->gT('Array filter exclusion')); + $qattributes["array_filter_style"]=array( + "types"=>"1ABCEF:;MPLKQ", + 'category'=>$clang->gT('Logic'), + 'sortorder'=>100, + 'inputtype'=>'singleselect', + 'options'=>array(0=>$clang->gT('Hidden'), + 1=>$clang->gT('Disabled')), + 'default'=>0, + "help"=>$clang->gT("Specify how array-filtered sub-questions should be displayed"), + "caption"=>$clang->gT('Array filter style')); + $qattributes["assessment_value"]=array( "types"=>"MP", 'category'=>$clang->gT('Logic'), diff --git a/application/helpers/expressions/em_manager_helper.php b/application/helpers/expressions/em_manager_helper.php index 5b5e39eafe6..b2ca1084664 100644 --- a/application/helpers/expressions/em_manager_helper.php +++ b/application/helpers/expressions/em_manager_helper.php @@ -5831,12 +5831,23 @@ static function GetRelevanceAndTailoringJavaScript() //////////////////////////////////////////////////////////////////////// // Do all sub-question filtering (e..g array_filter) + /** + * $afHide - if true, then use jQuery.show(). If false, then disable/enable the row + */ + $afHide = (isset($LEM->qattr[$arg['qid']]['array_filter_style']) ? ($LEM->qattr[$arg['qid']]['array_filter_style'] == '0') : true); foreach ($subqParts as $sq) { $rowdividList[$sq['rowdivid']] = $sq['result']; $relParts[] = " if ( " . $sq['relevancejs'] . " ) {\n"; - $relParts[] = " $('#javatbd" . $sq['rowdivid'] . "').show();\n"; + if ($afHide) + { + $relParts[] = " $('#javatbd" . $sq['rowdivid'] . "').show();\n"; + } + else + { + $relParts[] = " $('#javatbd" . $sq['rowdivid'] . " :input:not(:hidden)').removeAttr('disabled');\n"; + } if ($sq['isExclusiveJS'] != '') { $relParts[] = " if ( " . $sq['isExclusiveJS'] . " ) {\n"; @@ -5858,7 +5869,14 @@ static function GetRelevanceAndTailoringJavaScript() $relParts[] = " }\n"; $relParts[] = " else {\n"; $relParts[] = " $('#javatbd" . $sq['rowdivid'] . " :input:not(:hidden)').removeAttr('disabled');\n"; - $relParts[] = " $('#javatbd" . $sq['rowdivid'] . "').hide();\n"; + if ($afHide) + { + $relParts[] = " $('#javatbd" . $sq['rowdivid'] . "').hide();\n"; + } + else + { + $relParts[] = " $('#javatbd" . $sq['rowdivid'] . " :input:not(:hidden)').attr('disabled','disabled');\n"; + } $relParts[] = " }\n"; } else @@ -5868,7 +5886,14 @@ static function GetRelevanceAndTailoringJavaScript() } else { - $relParts[] = " $('#javatbd" . $sq['rowdivid'] . "').hide();\n"; + if ($afHide) + { + $relParts[] = " $('#javatbd" . $sq['rowdivid'] . "').hide();\n"; + } + else + { + $relParts[] = " $('#javatbd" . $sq['rowdivid'] . " :input:not(:hidden)').attr('disabled','disabled');\n"; + } } $relParts[] = " relChange" . $arg['qid'] . "=true;\n"; $relParts[] = " $('#relevance" . $sq['rowdivid'] . "').val('');\n";