$asset_object = unserialize($_SESSION['asset_detail'][$group_id]); if (!is_object($asset_object)) { throw new Exception(_('Error retrieving the asset data from memory')); } // Get the hosts from another groups if ($asset_type == 'othergroups') { $where = " id NOT IN (SELECT host_id FROM host_group_reference WHERE host_group_id = UNHEX('" . $group_id . "')) "; $filters['where'] = !empty($filters['where']) ? $where . ' AND ' . $filters['where'] : $where; list($host_list, $total) = Asset_host::get_list($conn, '', $filters, $cache); } else { list($host_list, $total) = $asset_object->get_hosts($conn, $filters, FALSE); } // DATA $data = array(); foreach ($host_list as $host_id => $host_data) { $devices = Asset_host_devices::get_devices_to_string($conn, $host_id); // Asset Group details format if ($asset_type == 'group') { try { $asset_object->can_i_edit($conn); $asset_object->can_delete_host($conn); $delete_link = '<a href="javascript:;" onclick="del_asset_from_group(\'' . $host_id . '\');return false">'; $delete_link .= '<img class="delete_small tipinfo" txt="' . _('Remove this asset from group') . '" src="/ossim/pixmaps/delete.png" border="0"/>'; $delete_link .= '</a>'; } catch (Exception $e) { $title = $e->getMessage(); $delete_link = '<img class="delete_small img_disabled tipinfo" txt="' . $title . '" src="/ossim/pixmaps/delete.png" border="0"/>'; } $data[] = array($host_data['name'], $host_data['ips'], $host_data['fqdns'], $devices, Util::utf8_encode2($host_data['descr']), $delete_link); } elseif ($asset_type == 'net') { $data[] = array($host_data['name'], $host_data['ips'], $host_data['fqdns'], $devices, Util::utf8_encode2($host_data['descr']));
try { list($assets, $total) = Asset_host::get_full_list($conn, $tables, $filters); } catch (Exception $e) { $response = array(); $response['sEcho'] = $sec; $response['iTotalRecords'] = 0; $response['iTotalDisplayRecords'] = 0; $response['aaData'] = array(); $response['iDisplayStart'] = 0; echo json_encode($response); exit; } $detail = ''; $results = array(); foreach ($assets as $_id => $asset_data) { $d_types = Asset_host_devices::get_devices_to_string($conn, $_id); if (preg_match('/<br\\/>/', $d_types)) { $d_types = preg_replace('/<br\\/>.*/', '', $d_types) . '...'; } // COLUMNS $_res = array(); $_res['DT_RowId'] = $_id; $_res[] = ''; //Checkbox $_res[] = Util::htmlentities($asset_data['name']); //Hostname $_res[] = Util::htmlentities(Asset::format_to_print($asset_data['ips'])); //IP $_res[] = $d_types; //Device Type $_res[] = $asset_data['os'];