diff --git a/index.php b/index.php index ff38ac3..3cc0120 100644 --- a/index.php +++ b/index.php @@ -119,6 +119,18 @@ function getHelperButtonFormat($value, $name){ return ''; } +function getHelperButtonsFormat($formats){ + $buttons = ''; + foreach( $formats as $name => $infos ) + { + if ( isset($infos['name']) ) + { + $buttons .= getHelperButtonFormat($name, $infos['name']) . PHP_EOL; + } + } + return $buttons; +} + function displayBridgeCard($bridgeReference, $bridgeInformations, $formats, $isActive = true) { $name = isset($bridgeInformations['homepage']) ? ''.$bridgeInformations['name'].'' : $bridgeInformations['name']; @@ -146,15 +158,11 @@ CARD; $card .= '' . PHP_EOL; } + $card .= '
'; + if ($isActive) { - foreach( $formats as $name => $infos ) - { - if ( isset($infos['name']) ) - { - $card .= getHelperButtonFormat($name, $infos['name']) . PHP_EOL; - } - } + $card .= getHelperButtonsFormat($formats); } else { @@ -170,12 +178,14 @@ CARD; $card .= '
' . PHP_EOL; - foreach ($formats as $name => $infos) + + if ($isActive) { - if (isset($infos['name']) ) - { - $card .= getHelperButtonFormat($name, $infos['name']) . PHP_EOL; - } + $card .= getHelperButtonsFormat($formats); + } + else + { + $card .= 'Inactive'; } $card .= '
' . PHP_EOL; }