/** * @param $type * @param $id * @param $data * @param $num **/ function plugin_ocsinventoryng_giveItem($type, $id, $data, $num) { global $CFG_GLPI, $DB; $searchopt =& Search::getOptions($type); $table = $searchopt[$id]["table"]; $field = $searchopt[$id]["field"]; switch ("{$table}.{$field}") { case "glpi_plugin_ocsinventoryng_details.action": $detail = new PluginOcsinventoryngDetail(); return $detail->giveActionNameByActionID($data["ITEM_{$num}"]); case "glpi_plugin_ocsinventoryng_details.computers_id": $comp = new Computer(); $comp->getFromDB($data["ITEM_{$num}"]); return "<a href='" . Toolbox::getItemTypeFormURL('Computer') . "?id=" . $data["ITEM_{$num}"] . "'>" . $comp->getName() . "</a>"; case "glpi_plugin_ocsinventoryng_details.plugin_ocsinventoryng_ocsservers_id": $ocs = new PluginOcsinventoryngOcsServer(); $ocs->getFromDB($data["ITEM_{$num}"]); return "<a href='" . Toolbox::getItemTypeFormURL('PluginOcsinventoryngOcsServer') . "?id=" . $data["ITEM_{$num}"] . "'>" . $ocs->getName() . "</a>"; case "glpi_plugin_ocsinventoryng_details.rules_id": $detail = new PluginOcsinventoryngDetail(); $detail->getFromDB($data['id']); return PluginOcsinventoryngNotimportedcomputer::getRuleMatchedMessage($detail->fields['rules_id']); case "glpi_plugin_ocsinventoryng_notimportedcomputers.reason": return PluginOcsinventoryngNotimportedcomputer::getReason($data["ITEM_{$num}"]); } return ''; }