2024-08-13 19:46:56 +00:00
< ? php
// render config variables array
2024-08-25 10:24:48 +00:00
function renderConfig ( $config , $indent , $platform = false ) {
global $app_root ;
if ( isset ( $platform ) && $platform === true ) {
?>
< div class = " border bg-light " style = " padding-left: <?= $indent ?>px; padding-bottom: 20px; padding-top: 20px; " >
< ? php } else {
2024-08-19 10:25:09 +00:00
?>
< div style = " padding-left: <?= $indent ?>px; padding-bottom: 20px; " >
< ? php
2024-08-25 10:24:48 +00:00
}
foreach ( $config as $config_item => $config_value ) {
2024-08-19 10:25:09 +00:00
?>
< div class = " row mb-1 " style = " padding-left: <?= $indent ?>px; " >
< div class = " col-md-4 text-end " >
< ? = htmlspecialchars ( $config_item ) ?> :
</ div >
< ? php
2024-08-25 10:24:48 +00:00
if ( isset ( $platform ) && $platform === true ) { ?>
< div class = " col-md-8 text-start " >
< a class = " btn btn-secondary " style = " padding: 2px; " href = " <?= $app_root ?>?platform=<?= htmlspecialchars( $config_item ) ?>&page=config&action=edit " > edit </ a >
2024-08-19 10:25:09 +00:00
< ? php
2024-08-25 10:24:48 +00:00
// we don't delete the last platform
if ( count ( $config ) <= 1 ) { ?>
< span class = " btn btn-light " style = " padding: 2px; " href = " # " data - toggle = " tooltip " data - placement = " right " data - offset = " 30.0 " title = " can't delete the last platform " > delete </ span >
< ? php } else { ?>
< a class = " btn btn-danger " style = " padding: 2px; " href = " <?= $app_root ?>?platform=<?= htmlspecialchars( $config_item ) ?>&page=config&action=delete " > delete </ a >
< ? php } ?>
</ div >
< ? php }
if ( is_array ( $config_value )) {
if ( $config_item === 'platforms' ) {
$platform = true ;
} else {
$platform = false ;
}
// here we render recursively nested arrays
$indent = $indent + 50 ;
renderConfig ( $config_value , $indent , $platform );
$indent = 0 ;
} else {
// if it's not array, just display it
2024-08-19 10:25:09 +00:00
?>
< div class = " border col-md-8 text-start " >
< ? = htmlspecialchars ( $config_value ? ? '' ) ?>
2024-08-25 10:24:48 +00:00
< ? = $platform ?>
2024-08-19 10:25:09 +00:00
</ div >
< ? php
2024-08-25 10:24:48 +00:00
}
2024-08-19 10:25:09 +00:00
?>
</ div >
< ? php
2024-08-25 10:24:48 +00:00
}
echo '</div>' ;
2024-08-13 19:46:56 +00:00
}
?>