🎨 Device tiles setting
This commit is contained in:
43
front/php/components/tile_cards.php
Executable file
43
front/php/components/tile_cards.php
Executable file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
function renderInfobox($params) {
|
||||
$onclickEvent = isset($params['onclickEvent']) ? $params['onclickEvent'] : '';
|
||||
$color = isset($params['color']) ? $params['color'] : '';
|
||||
$title = isset($params['title']) ? $params['title'] : '';
|
||||
$label = isset($params['label']) ? $params['label'] : '';
|
||||
$icon = isset($params['icon']) ? $params['icon'] : '';
|
||||
|
||||
return '
|
||||
<div class="tile col-lg-2 col-sm-4 col-xs-6">
|
||||
<a href="#" onclick="javascript: ' . htmlspecialchars($onclickEvent) . ';">
|
||||
<div class="small-box ' . htmlspecialchars($color) . '">
|
||||
<div class="inner">
|
||||
<h3>' . htmlspecialchars($title) . '</h3>
|
||||
<p class="infobox_label">' . htmlspecialchars($label) . '</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fa ' . htmlspecialchars($icon) . ' text-aqua-40"></i>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>';
|
||||
}
|
||||
|
||||
// Load default data from JSON file
|
||||
$defaultDataFile = 'tile_cards_defaults.json';
|
||||
$defaultData = file_exists($defaultDataFile) ? json_decode(file_get_contents($defaultDataFile), true) : [];
|
||||
|
||||
// Check if 'items' parameter exists and is valid JSON
|
||||
$items = isset($_POST['items']) ? json_decode($_POST['items'], true) : [];
|
||||
|
||||
// Use default data if 'items' is not provided or cannot be decoded
|
||||
if (empty($items)) {
|
||||
$items = $defaultData;
|
||||
}
|
||||
|
||||
$html = '';
|
||||
foreach ($items as $item) {
|
||||
$html .= renderInfobox($item);
|
||||
}
|
||||
echo $html;
|
||||
exit();
|
||||
?>
|
||||
17
front/php/components/tile_cards_defaults.json
Executable file
17
front/php/components/tile_cards_defaults.json
Executable file
@@ -0,0 +1,17 @@
|
||||
[
|
||||
{
|
||||
"onclickEvent": "handleClick(1)",
|
||||
"color": "bg-primary",
|
||||
"title": "Default Infobox 1",
|
||||
"label": "Default label for Infobox 1",
|
||||
"icon": "fa-bell"
|
||||
},
|
||||
{
|
||||
"onclickEvent": "handleClick(2)",
|
||||
"color": "bg-success",
|
||||
"title": "Default Infobox 2",
|
||||
"label": "Default label for Infobox 2",
|
||||
"icon": "fa-envelope"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<!-- Default to the left -->
|
||||
|
||||
<!-- NetAlertX footer with url -->
|
||||
<a href="https://github.com/jokob-sk/NetAlertX" target="_blank">Net <b>Alert</b><sup>x</sup></a>
|
||||
<a href="https://github.com/jokob-sk/NetAlertX" target="_blank">Net<b>Alert</b><sup>x</sup></a>
|
||||
|
||||
|
||||
<!-- To the right -->
|
||||
|
||||
@@ -282,6 +282,7 @@
|
||||
"Gen_Action": "Action",
|
||||
"Gen_Add": "",
|
||||
"Gen_Add_All": "",
|
||||
"Gen_All_Devices": "",
|
||||
"Gen_AreYouSure": "Sind Sie sich sicher?",
|
||||
"Gen_Backup": "Sichern",
|
||||
"Gen_Cancel": "Abbrechen",
|
||||
|
||||
@@ -270,6 +270,7 @@
|
||||
"Gen_Action": "Action",
|
||||
"Gen_Add": "Add",
|
||||
"Gen_Add_All": "Add all",
|
||||
"Gen_All_Devices": "All Devices",
|
||||
"Gen_AreYouSure": "Are you sure?",
|
||||
"Gen_Backup": "Run Backup",
|
||||
"Gen_Cancel": "Cancel",
|
||||
|
||||
@@ -280,6 +280,7 @@
|
||||
"Gen_Action": "Acción",
|
||||
"Gen_Add": "Añadir",
|
||||
"Gen_Add_All": "Añadir todo",
|
||||
"Gen_All_Devices": "",
|
||||
"Gen_AreYouSure": "¿Estás seguro?",
|
||||
"Gen_Backup": "Ejecutar copia de seguridad",
|
||||
"Gen_Cancel": "Cancelar",
|
||||
|
||||
@@ -270,6 +270,7 @@
|
||||
"Gen_Action": "Action",
|
||||
"Gen_Add": "",
|
||||
"Gen_Add_All": "",
|
||||
"Gen_All_Devices": "",
|
||||
"Gen_AreYouSure": "",
|
||||
"Gen_Backup": "",
|
||||
"Gen_Cancel": "Annuler",
|
||||
|
||||
@@ -270,6 +270,7 @@
|
||||
"Gen_Action": "Azione",
|
||||
"Gen_Add": "Aggiungi",
|
||||
"Gen_Add_All": "Aggiungi tutti",
|
||||
"Gen_All_Devices": "",
|
||||
"Gen_AreYouSure": "Sei sicuro?",
|
||||
"Gen_Backup": "Esegui backup",
|
||||
"Gen_Cancel": "Annulla",
|
||||
|
||||
@@ -270,6 +270,7 @@
|
||||
"Gen_Action": "Handling",
|
||||
"Gen_Add": "Legg til",
|
||||
"Gen_Add_All": "Legg til alle",
|
||||
"Gen_All_Devices": "",
|
||||
"Gen_AreYouSure": "Er du sikker?",
|
||||
"Gen_Backup": "Kjør sikkerhetskopiering",
|
||||
"Gen_Cancel": "Avbryt",
|
||||
|
||||
@@ -270,6 +270,7 @@
|
||||
"Gen_Action": "Akcja",
|
||||
"Gen_Add": "Dodaj",
|
||||
"Gen_Add_All": "Dodaj wszystko",
|
||||
"Gen_All_Devices": "",
|
||||
"Gen_AreYouSure": "Jesteś pewien?",
|
||||
"Gen_Backup": "Wykonaj Kopie Zapasową",
|
||||
"Gen_Cancel": "Anuluj",
|
||||
|
||||
@@ -270,6 +270,7 @@
|
||||
"Gen_Action": "",
|
||||
"Gen_Add": "",
|
||||
"Gen_Add_All": "",
|
||||
"Gen_All_Devices": "",
|
||||
"Gen_AreYouSure": "",
|
||||
"Gen_Backup": "",
|
||||
"Gen_Cancel": "",
|
||||
|
||||
@@ -270,6 +270,7 @@
|
||||
"Gen_Action": "Действия",
|
||||
"Gen_Add": "Добавить",
|
||||
"Gen_Add_All": "Добавить все",
|
||||
"Gen_All_Devices": "",
|
||||
"Gen_AreYouSure": "Вы уверены?",
|
||||
"Gen_Backup": "Запустить резервное копирование",
|
||||
"Gen_Cancel": "Отмена",
|
||||
|
||||
@@ -270,6 +270,7 @@
|
||||
"Gen_Action": "",
|
||||
"Gen_Add": "",
|
||||
"Gen_Add_All": "",
|
||||
"Gen_All_Devices": "",
|
||||
"Gen_AreYouSure": "",
|
||||
"Gen_Backup": "",
|
||||
"Gen_Cancel": "",
|
||||
|
||||
@@ -270,6 +270,7 @@
|
||||
"Gen_Action": "",
|
||||
"Gen_Add": "",
|
||||
"Gen_Add_All": "",
|
||||
"Gen_All_Devices": "",
|
||||
"Gen_AreYouSure": "",
|
||||
"Gen_Backup": "",
|
||||
"Gen_Cancel": "",
|
||||
|
||||
Reference in New Issue
Block a user