connessione con hardware in assets

This commit is contained in:
test
2026-08-07 14:27:33 +02:00
parent 7c6e244155
commit f575d8cb05
33 changed files with 3489 additions and 1608 deletions
+43
View File
@@ -0,0 +1,43 @@
<?php
declare(strict_types=1);
/**
* AJAX endpoint providing the asset dropdown for the "Hardware host"
* field of the UrBackup server form.
*
* Called through Ajax::updateItemOnSelectEvent when the host itemtype
* selection changes. GET only, no state changes are performed.
*/
use GlpiPlugin\Urbackup\Config;
if (!defined('GLPI_ROOT')) {
define('GLPI_ROOT', dirname(__DIR__, 4));
}
include_once GLPI_ROOT . '/inc/includes.php';
Html::header_nocache();
Session::checkLoginUser();
if (($_SERVER['REQUEST_METHOD'] ?? '') !== 'GET') {
http_response_code(405);
exit;
}
$itemtype = (string) ($_GET['itemtype'] ?? '');
if ($itemtype === '' || !class_exists($itemtype) || !Config::isItemtypeEnabled($itemtype)) {
exit;
}
$value = (int) ($_GET['value'] ?? 0);
Dropdown::show($itemtype, [
'name' => 'host_items_id',
'value' => $value,
'entity' => Session::getActiveEntities(),
'display_emptychoice' => true,
]);