diff --git a/admin/questionhandling.php b/admin/questionhandling.php index 23f8cd664b9..303025622d2 100644 --- a/admin/questionhandling.php +++ b/admin/questionhandling.php @@ -479,7 +479,7 @@ $qattributes=questionAttributes(); $editquestion .= "\t - ".$clang->gT("Question Attributes:")." + ".$clang->gT("Question Attributes:")." \n"; @@ -504,9 +504,9 @@ $editquestion .= "\t\t\t
-
+
- + @@ -525,7 +525,7 @@ { $editquestion .= "\t\t\t
".$clang->gT("Question Attributes:")."".$clang->gT("Question Attributes:")."
" ."
" - ."" + ."" ."
" .$attributetranslations[$qa['attribute']]['caption']." \n \n" ."\t\t\t
-
+
" . "\t\n" diff --git a/common.php b/common.php index 3cbaeb9377a..35b864b3791 100644 --- a/common.php +++ b/common.php @@ -3388,6 +3388,20 @@ function questionAttributes($returnByName=false) "help"=>$clang->gT('Show statistics of a certain question to the user'), "caption"=>$clang->gT('Show in public statistics')); + $qattributes["max_num_value_sgqa"]=array( + "types"=>"K", + "help"=>$clang->gT('SGQA identifier to use total of previous question as maximum for this question'), + "caption"=>$clang->gT('Max value from SQGA')); + + $qattributes["min_num_value_sgqa"]=array( + "types"=>"K", + "help"=>$clang->gT('SGQA identifier to use total of previous question as minimum for this question'), + "caption"=>$clang->gT('Min value from SQGA')); + + $qattributes["num_value_equals_sgqa"]=array( + "types"=>"K", + "help"=>$clang->gT('SGQA identifier to use total of previous question as total for this question'), + "caption"=>$clang->gT('Value equals SQGA')); /* -- > Commented out since not yet used $qattributes[]=array("name"=>"default_value", diff --git a/qanda.php b/qanda.php index 9f8b4d37a03..08c9120f760 100644 --- a/qanda.php +++ b/qanda.php @@ -2929,34 +2929,55 @@ function do_multiplenumeric($ia) $maxsize = 255; } + //EQUALS VALUE if ($equalvalue=arraySearchByKey('equals_num_value', $qidattributes, 'attribute', 1)) { $equals_num_value=$equalvalue['value']; $numbersonlyonblur[]='calculateValue'.$ia[1].'(3)'; $calculateValue[]=3; } + elseif ($equalvalue=arraySearchByKey('num_value_equals_sgqa', $qidattributes, 'attribute', 1)) + { + $equals_num_value=$_SESSION[$equalvalue['value']]; + $numbersonlyonblur[]='calculateValue'.$ia[1].'(3)'; + $calculateValue[]=3; + } else { $equals_num_value[]=0; } + //MIN VALUE if ($minvalue=arraySearchByKey('min_num_value', $qidattributes, 'attribute', 1)) { $min_num_value=$minvalue['value']; $numbersonlyonblur[]='calculateValue'.$ia[1].'(2)'; $calculateValue[]=2; } + elseif ($minvalue=arraySearchByKey('min_num_value_sgqa', $qidattributes, 'attribute', 1)) + { + $min_num_value=$_SESSION[$minvalue['value']]; + $numbersonlyonblur[]='calculateValue'.$ia[1].'(2)'; + $calculateValue[]=2; + } else { $min_num_value=0; } + //MAX VALUE if ($maxvalue=arraySearchByKey('max_num_value', $qidattributes, 'attribute', 1)) { $max_num_value = $maxvalue['value']; $numbersonlyonblur[]='calculateValue'.$ia[1].'(1)'; $calculateValue[]=1; } + elseif ($maxvalue=arraySearchByKey('max_num_value_sgqa', $qidattributes, 'attribute', 1)) + { + $max_num_value = $_SESSION[$maxvalue['value']]; + $numbersonlyonblur[]='calculateValue'.$ia[1].'(1)'; + $calculateValue[]=1; + } else { $max_num_value = 0; @@ -3048,7 +3069,6 @@ function do_multiplenumeric($ia) { $slider_layout = false; } - if ($hidetip=arraySearchByKey('hide_tip', $qidattributes, 'attribute', 1)) { $hidetip=$hidetip['value']; @@ -3061,7 +3081,6 @@ function do_multiplenumeric($ia) { $hidetip=0; } - if (arraySearchByKey('random_order', $qidattributes, 'attribute', 1)) { $ansquery = "SELECT * FROM {$dbprefix}answers WHERE qid=$ia[0] AND language='".$_SESSION['s_lang']."' ORDER BY ".db_random();