Added the possibility to use a global array parameter, that is going to be displayed for every parameter count.

This commit is contained in:
teromene@teromene.fr 2016-02-11 15:24:40 +00:00
parent 541ba9116a
commit f8b9470622

View file

@ -56,8 +56,28 @@ CARD;
} }
$hasGlobalParameter = array_key_exists("global", $bridgeElement->parameters);
if($hasGlobalParameter) {
$globalParameters = json_decode($bridgeElement->parameters['global'], true);
}
foreach($bridgeElement->parameters as $parameterName => $parameter) foreach($bridgeElement->parameters as $parameterName => $parameter)
{ {
$parameter = json_decode($parameter, true);
if(!is_numeric($parameterName) && $parameterName == "global") {
continue;
}
if($hasGlobalParameter) {
$parameter = array_merge($parameter, $globalParameters);
}
if(!is_numeric($parameterName)) { if(!is_numeric($parameterName)) {
$card .= '<h5>'.$parameterName.'</h5>' . PHP_EOL; $card .= '<h5>'.$parameterName.'</h5>' . PHP_EOL;
} }
@ -65,7 +85,6 @@ CARD;
<input type="hidden" name="action" value="display" /> <input type="hidden" name="action" value="display" />
<input type="hidden" name="bridge" value="' . $bridgeName . '" />' . PHP_EOL; <input type="hidden" name="bridge" value="' . $bridgeName . '" />' . PHP_EOL;
$parameter = json_decode($parameter, true);
foreach($parameter as $inputEntry) { foreach($parameter as $inputEntry) {