query("SELECT * FROM Settings");
// array
$settingKeyOfLists = array();
$settingCoreGroups = array('General', 'NewDeviceDefaults', 'Email', 'Webhooks', 'Apprise', 'NTFY', 'PUSHSAFER', 'MQTT', 'DynDNS', 'PiHole', 'Pholus', 'Nmap', 'API');
$settings = array();
while ($row = $result -> fetchArray (SQLITE3_ASSOC)) {
// Push row data
$settings[] = array( 'Code_Name' => $row['Code_Name'],
'Display_Name' => $row['Display_Name'],
'Description' => $row['Description'],
'Type' => $row['Type'],
'Options' => $row['Options'],
'RegEx' => $row['RegEx'],
'Value' => $row['Value'],
'Group' => $row['Group'],
'Events' => $row['Events']
);
}
?>
) ';
$isPlugin = TRUE;
}
$html = $html.'
'.lang($group.'_icon')." ".lang($group.'_display_name').$settingGroupTypeHtml.'
';
$isIn = ' '; // open the first panel only by default on page load
if($isPlugin)
{
$html = $html.
'
';
}
// populate settings for each group
foreach ($settings as $set)
{
if($set["Group"] == $group)
{
$html = $html.
'
';
$html = $html.'
'.$set['Code_Name'].'
';
$html = $html.
'
';
$html = $html.getString ($set['Code_Name'].'_description', $set['Description']);
$html = $html.
'
';
// render different input types based on the settings type
$input = "";
// text - textbox
if($set['Type'] == 'text' || $set['Type'] == 'string' || $set['Type'] == 'date-time' )
{
$input = '
';
}
// password - hidden text
elseif ($set['Type'] == 'password')
{
$input = '
';
}
// readonly
elseif ($set['Type'] == 'readonly')
{
$input = '
';
}
// boolean - checkbox
elseif ($set['Type'] == 'boolean' || $set['Type'] == 'integer.checkbox')
{
$checked = "";
if ($set['Value'] == "True" || $set['Value'] == "1") { $checked = "checked";};
$input = '
';
}
// integer - number input
elseif ($set['Type'] == 'integer')
{
$input = '
';
}
// text.select - dropdown
elseif ($set['Type'] == 'text.select')
{
$input = '
';
}
// integer.select - dropdown
elseif ($set['Type'] == 'integer.select')
{
$input = '
';
}
// text.multiselect
elseif ($set['Type'] == 'text.multiselect')
{
$input = '
';
}
// subnets
elseif ($set['Type'] == 'subnets')
{
$input = $input.
'
';
// list all interfaces as options
$input = $input.'
';
// Remove all interfaces button
$input = $input.'
';
}
// list
elseif ($set['Type'] == 'list')
{
$settingKeyOfLists[] = $set['Code_Name'];
$input = $input.
'
';
// list all interfaces as options
$input = $input.'
';
// Remove all interfaces button
$input = $input.'
';
}
$html = $html.$input;
// render any buttons or additional actions if specified
$eventsHtml = "";
// if available get all the events associated with this setting
$eventsList = createArray($set['Events']);
// icon map for the events
// $iconMap = [
// "test" => [lang("settings_event_tooltip"),""]
// ];
if(count($eventsList) > 0)
{
foreach ($eventsList as $event) {
$eventsHtml = $eventsHtml.'
';
}
}
$html = $html.$eventsHtml.'
';
}
}
$html = $html.'
';
}
echo $html;
?>