$input = array(); $input['plugin_monitoring_hosts_id'] = $hosts_id; $input['plugin_monitoring_contacts_id'] = $data['plugin_monitoring_contacts_id']; $pmHost_Contact->add($input); } } if (isset($_POST['is_template']) and $_POST['is_template'] == "1") { Html::redirect($_SERVER['HTTP_REFERER'] . "&id=" . $hosts_id); } } Html::back(); } else { if (isset($_POST["update"])) { if ($_POST['parenttype'] == '0' or $_POST['parenttype'] == '2') { $_POST['parents'] = ""; } $pmHost->update($_POST); Html::back(); } else { if (isset($_POST["delete"])) { $pmHost->delete($_POST, 1); Html::back(); } } } if (isset($_GET["id"])) { $pmHost->showForm($_GET["id"]); } else { $pmHost->showForm(""); } Html::footer();
function post_purgeItem() { global $DB; $query = "SELECT * FROM `glpi_plugin_monitoring_componentscatalogs_hosts`\n WHERE `itemtype`='" . $this->fields['itemtype'] . "'\n AND `items_id`='" . $this->fields['items_id'] . "'\n LIMIT 1"; $result = $DB->query($query); if ($DB->numrows($result) == 0) { $queryH = "SELECT * FROM `glpi_plugin_monitoring_hosts`\n WHERE `itemtype`='" . $this->fields['itemtype'] . "'\n AND `items_id`='" . $this->fields['items_id'] . "'\n LIMIT 1"; $resultH = $DB->query($queryH); if ($DB->numrows($resultH) == 1) { $dataH = $DB->fetch_assoc($resultH); $pmHost = new PluginMonitoringHost(); $pmHost->delete($dataH); } } }