mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-09-25 10:59:15 +02:00
fixed styles
This commit is contained in:
parent
ace79d3ac1
commit
27e13c26c6
@ -814,6 +814,10 @@ function get_data_basic_info_sql($params, $count=false)
|
|||||||
$where .= sprintf(' AND id_agente = %d', $params['id_agent']);
|
$where .= sprintf(' AND id_agente = %d', $params['id_agent']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($params['id_group'] > 0) {
|
||||||
|
$where .= sprintf(' AND id_grupo = %d', $params['id_group']);
|
||||||
|
}
|
||||||
|
|
||||||
if ($params['search'] > 0) {
|
if ($params['search'] > 0) {
|
||||||
$where .= sprintf(
|
$where .= sprintf(
|
||||||
' AND ( alias LIKE "%%%s%%" )',
|
' AND ( alias LIKE "%%%s%%" )',
|
||||||
|
@ -109,44 +109,93 @@ $utimestampSelectValues = array_reduce(
|
|||||||
// Inventory module select.
|
// Inventory module select.
|
||||||
$table = new stdClass();
|
$table = new stdClass();
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
$table->class = 'databox filters';
|
|
||||||
$table->size = [];
|
$table->size = [];
|
||||||
$table->data = [];
|
$table->size[0] = '33%';
|
||||||
|
$table->size[1] = '33%';
|
||||||
|
$table->size[2] = '33%';
|
||||||
|
$table->class = 'filter-table-adv';
|
||||||
|
|
||||||
$table->data[0][0] = __('Module');
|
$table->data[0][0] = html_print_label_input_block(
|
||||||
$table->data[0][1] = html_print_select_from_sql(
|
__('Module'),
|
||||||
|
html_print_select_from_sql(
|
||||||
$sqlModuleInventoryAgentView,
|
$sqlModuleInventoryAgentView,
|
||||||
'module_inventory_agent_view',
|
'module_inventory_agent_view',
|
||||||
$module,
|
$module,
|
||||||
'javascript:this.form.submit();',
|
'javascript:this.form.submit();',
|
||||||
__('All'),
|
__('All'),
|
||||||
0,
|
0,
|
||||||
true
|
true,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
'width:100%;'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$table->data[0][2] = __('Date');
|
$table->data[0][1] = html_print_label_input_block(
|
||||||
$table->data[0][3] = html_print_select(
|
__('Date'),
|
||||||
|
html_print_select(
|
||||||
$utimestampSelectValues,
|
$utimestampSelectValues,
|
||||||
'utimestamp',
|
'utimestamp',
|
||||||
$utimestamp,
|
$utimestamp,
|
||||||
'javascript:this.form.submit();',
|
'javascript:this.form.submit();',
|
||||||
__('Now'),
|
__('Now'),
|
||||||
0,
|
0,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'width:100%;'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$table->data[0][2] = html_print_label_input_block(
|
||||||
|
__('Search'),
|
||||||
|
html_print_input_text(
|
||||||
|
'search_string',
|
||||||
|
$search_string,
|
||||||
|
'',
|
||||||
|
25,
|
||||||
|
0,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$buttons = html_print_submit_button(
|
||||||
|
__('Filter'),
|
||||||
|
'search_button',
|
||||||
|
false,
|
||||||
|
[
|
||||||
|
'icon' => 'search',
|
||||||
|
'mode' => 'mini',
|
||||||
|
],
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
$table->data[0][4] = __('Search');
|
$searchForm = '<form method="post" action="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=inventory&id_agente='.$id_agente.'">';
|
||||||
$table->data[0][5] = html_print_input_text('search_string', $search_string, '', 25, 0, true);
|
$searchForm .= html_print_table($table, true);
|
||||||
$table->data[0][6] = html_print_submit_button(__('Search'), 'search_button', false, 'class="sub wand"', true);
|
$searchForm .= html_print_div(
|
||||||
|
[
|
||||||
|
'class' => 'action-buttons',
|
||||||
|
'content' => $buttons,
|
||||||
|
],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$searchForm .= '</form>';
|
||||||
|
|
||||||
// Show filters table.
|
ui_toggle(
|
||||||
echo sprintf(
|
$searchForm,
|
||||||
'<form method="post" action="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=inventory&id_agente=%s">%s</form>',
|
'<span class="subsection_header_title">'.__('Filters').'</span>',
|
||||||
$id_agente,
|
'filter_form',
|
||||||
html_print_table($table, true)
|
'',
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'white-box-content',
|
||||||
|
'box-flat white_table_graph fixed_filter_bar'
|
||||||
);
|
);
|
||||||
|
|
||||||
unset($table);
|
|
||||||
|
|
||||||
$idModuleInventory = null;
|
$idModuleInventory = null;
|
||||||
$rowTable = 1;
|
$rowTable = 1;
|
||||||
@ -181,7 +230,7 @@ foreach ($rows as $row) {
|
|||||||
$table->align = [];
|
$table->align = [];
|
||||||
$table->cellpadding = 4;
|
$table->cellpadding = 4;
|
||||||
$table->cellspacing = 4;
|
$table->cellspacing = 4;
|
||||||
$table->class = 'databox filters';
|
$table->class = 'info_table';
|
||||||
$table->head = [];
|
$table->head = [];
|
||||||
$table->head[0] = $row['name'].' - ('.date($config['date_format'], $row['utimestamp']).')';
|
$table->head[0] = $row['name'].' - ('.date($config['date_format'], $row['utimestamp']).')';
|
||||||
|
|
||||||
@ -210,7 +259,7 @@ foreach ($rows as $row) {
|
|||||||
|
|
||||||
foreach ($subHeadTitles as $titleData) {
|
foreach ($subHeadTitles as $titleData) {
|
||||||
$table->data[0][$iterator] = $titleData;
|
$table->data[0][$iterator] = $titleData;
|
||||||
$table->cellstyle[0][$iterator] = 'background: #373737; color: #FFF;';
|
$table->cellstyle[0][$iterator] = 'background: var(--primary-color); color: #FFF;';
|
||||||
|
|
||||||
$iterator++;
|
$iterator++;
|
||||||
}
|
}
|
||||||
|
@ -119,6 +119,7 @@ if (is_ajax() === true) {
|
|||||||
$length = (int) get_parameter('length', $config['block_size']);
|
$length = (int) get_parameter('length', $config['block_size']);
|
||||||
$order = get_datatable_order();
|
$order = get_datatable_order();
|
||||||
$id_agent = (int) get_parameter('id_agent', 0);
|
$id_agent = (int) get_parameter('id_agent', 0);
|
||||||
|
$id_group = (int) get_parameter('id_group', 0);
|
||||||
|
|
||||||
$params = [
|
$params = [
|
||||||
'search' => $filter['value'],
|
'search' => $filter['value'],
|
||||||
@ -126,6 +127,7 @@ if (is_ajax() === true) {
|
|||||||
'length' => $length,
|
'length' => $length,
|
||||||
'order' => $order,
|
'order' => $order,
|
||||||
'id_agent' => $id_agent,
|
'id_agent' => $id_agent,
|
||||||
|
'id_group' => $id_group,
|
||||||
];
|
];
|
||||||
|
|
||||||
$data = get_data_basic_info_sql($params);
|
$data = get_data_basic_info_sql($params);
|
||||||
@ -753,295 +755,8 @@ if (is_metaconsole() === true) {
|
|||||||
$filteringFunction = '';
|
$filteringFunction = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($is_metaconsole === false) {
|
|
||||||
// Single agent selected.
|
|
||||||
if ($inventory_id_agent > 0 && isset($agents[$inventory_id_agent]) === true) {
|
|
||||||
$agents = [$inventory_id_agent => $agents[$inventory_id_agent]];
|
|
||||||
}
|
|
||||||
|
|
||||||
$agents_ids = array_keys($agents);
|
|
||||||
if (count($agents_ids) > 0) {
|
|
||||||
$rows = inventory_get_datatable(
|
|
||||||
$agents_ids,
|
|
||||||
$inventory_module,
|
|
||||||
$utimestamp,
|
|
||||||
$inventory_search_string,
|
|
||||||
$export,
|
|
||||||
false,
|
|
||||||
$order_by_agent
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (count($agents_ids) === 0 || (int) $rows === ERR_NODATA) {
|
|
||||||
ui_print_info_message(['no_close' => true, 'message' => __('No data found.') ]);
|
|
||||||
echo ' </td></tr><tr><td>';
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "<div id='loading_url' style='display: none; width: ".$table->width."; text-align: right;'>".html_print_image('images/spinner.gif', true).'</div>';
|
|
||||||
?>
|
|
||||||
<script type="text/javascript">
|
|
||||||
function get_csv_url(module, id_group, search_string, utimestamp, agent, order_by_agent) {
|
|
||||||
$("#url_csv").hide();
|
|
||||||
$("#loading_url").show();
|
|
||||||
$.ajax ({
|
|
||||||
method:'GET',
|
|
||||||
url:'ajax.php',
|
|
||||||
datatype:'html',
|
|
||||||
data:{
|
|
||||||
"page" : "operation/inventory/inventory",
|
|
||||||
"get_csv_url" : 1,
|
|
||||||
"module" : module,
|
|
||||||
"id_group" : id_group,
|
|
||||||
"search_string" : search_string,
|
|
||||||
"utimestamp" : utimestamp,
|
|
||||||
"agent" : agent,
|
|
||||||
"export": true,
|
|
||||||
"order_by_agent": order_by_agent
|
|
||||||
},
|
|
||||||
success: function (data, status) {
|
|
||||||
$("#url_csv").html(data);
|
|
||||||
$("#loading_url").hide();
|
|
||||||
$("#url_csv").show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<?php
|
|
||||||
if ($inventory_module !== 'basic') {
|
|
||||||
if ($order_by_agent === true) {
|
|
||||||
foreach ($rows as $agent_rows) {
|
|
||||||
$data = [];
|
|
||||||
$modules = '';
|
|
||||||
foreach ($agent_rows['row'] as $key_row => $row) {
|
|
||||||
$columns = explode(';', io_safe_output($row['data_format']));
|
|
||||||
array_push($columns, 'Timestamp');
|
|
||||||
|
|
||||||
$data_rows = explode(PHP_EOL, $row['data']);
|
|
||||||
foreach ($data_rows as $data_row) {
|
|
||||||
// Exclude results don't match filter.
|
|
||||||
if ($inventory_search_string && preg_match('/'.io_safe_output($inventory_search_string).'/', ($data_row)) == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$column_data = explode(';', io_safe_output($data_row));
|
|
||||||
|
|
||||||
if ($column_data[0] !== '') {
|
|
||||||
$row_tmp = [];
|
|
||||||
foreach ($column_data as $key => $value) {
|
|
||||||
$row_tmp[$columns[$key]] = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
$row_tmp['Timestamp'] = $row['timestamp'];
|
|
||||||
array_push($data, (object) $row_tmp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$id_table = 'id_'.$key_row.'_'.$row['id_module_inventory'].'_'.$row['id_agente'];
|
|
||||||
|
|
||||||
$table = ui_print_datatable(
|
|
||||||
[
|
|
||||||
'id' => $id_table,
|
|
||||||
'class' => 'info_table w100p',
|
|
||||||
'style' => 'width: 99%',
|
|
||||||
'columns' => $columns,
|
|
||||||
'column_names' => $columns,
|
|
||||||
'no_sortable_columns' => [],
|
|
||||||
'data_element' => $data,
|
|
||||||
'searching' => true,
|
|
||||||
'dom_elements' => 'ftip',
|
|
||||||
'order' => [
|
|
||||||
'field' => $columns[0],
|
|
||||||
'direction' => 'asc',
|
|
||||||
],
|
|
||||||
'zeroRecords' => __('No inventory found'),
|
|
||||||
'emptyTable' => __('No inventory found'),
|
|
||||||
'return' => true,
|
|
||||||
'default_pagination' => 10,
|
|
||||||
'no_sortable_columns' => [-1],
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
$modules .= ui_toggle(
|
|
||||||
$table,
|
|
||||||
'<span class="title-blue">'.$row['name'].'</span>',
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
'',
|
|
||||||
'white-box-content w100p',
|
|
||||||
'box-shadow white_table_graph w100p',
|
|
||||||
'images/arrow_down_green.png',
|
|
||||||
'images/arrow_right_green.png',
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
false,
|
|
||||||
$id_table
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
ui_toggle(
|
|
||||||
$modules,
|
|
||||||
$agent_rows['agent'],
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$count_rows = count($rows);
|
|
||||||
foreach ($rows as $module_rows) {
|
|
||||||
$agent = '';
|
|
||||||
$data = [];
|
|
||||||
|
|
||||||
foreach ($module_rows as $row) {
|
|
||||||
$columns = explode(';', io_safe_output($row['data_format']));
|
|
||||||
array_push($columns, 'Timestamp');
|
|
||||||
array_push($columns, 'Agent');
|
|
||||||
|
|
||||||
// Exclude results don't match filter.
|
|
||||||
if ($inventory_search_string && preg_match('/'.io_safe_output($inventory_search_string).'/', ($row['data'])) == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$data_tmp = [];
|
|
||||||
if ($row['data'] !== '') {
|
|
||||||
$values_explode = explode(';', io_safe_output($row['data']));
|
|
||||||
|
|
||||||
foreach ($values_explode as $key => $value) {
|
|
||||||
$data_tmp[$columns[$key]] = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
$data_tmp['Timestamp'] = $row['timestamp'];
|
|
||||||
$data_tmp['Agent'] = $row['name_agent'];
|
|
||||||
array_push($data, $data_tmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$id_table = 'id_'.$row['id_module_inventory'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$table = ui_print_datatable(
|
|
||||||
[
|
|
||||||
'id' => $id_table,
|
|
||||||
'class' => 'info_table w100p',
|
|
||||||
'style' => 'width: 99%',
|
|
||||||
'columns' => $columns,
|
|
||||||
'column_names' => $columns,
|
|
||||||
'no_sortable_columns' => [],
|
|
||||||
'data_element' => $data,
|
|
||||||
'searching' => true,
|
|
||||||
'dom_elements' => 'ftip',
|
|
||||||
'order' => [
|
|
||||||
'field' => $columns[0],
|
|
||||||
'direction' => 'asc',
|
|
||||||
],
|
|
||||||
'zeroRecords' => __('No inventory found'),
|
|
||||||
'emptyTable' => __('No inventory found'),
|
|
||||||
'return' => true,
|
|
||||||
'no_sortable_columns' => [],
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($count_rows > 1) {
|
|
||||||
ui_toggle(
|
|
||||||
$table,
|
|
||||||
array_shift($module_rows)['name'],
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
echo $table;
|
|
||||||
|
|
||||||
html_print_action_buttons(
|
|
||||||
'',
|
|
||||||
['type' => 'form_action']
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$id_agente = $inventory_id_agent;
|
|
||||||
$agentes = [];
|
|
||||||
$data = [];
|
|
||||||
$class = 'info_table';
|
|
||||||
$style = 'width: 99%';
|
|
||||||
$ordering = true;
|
|
||||||
$searching = false;
|
|
||||||
|
|
||||||
$columns = [
|
|
||||||
'alias',
|
|
||||||
'ip',
|
|
||||||
'secondoaryIp',
|
|
||||||
'group',
|
|
||||||
'secondaryGroups',
|
|
||||||
'description',
|
|
||||||
'os',
|
|
||||||
'interval',
|
|
||||||
'lastContact',
|
|
||||||
'lastStatusChange',
|
|
||||||
'customFields',
|
|
||||||
'valuesCustomFields',
|
|
||||||
];
|
|
||||||
|
|
||||||
$columns_names = [
|
|
||||||
__('Alias'),
|
|
||||||
__('IP'),
|
|
||||||
__('Secondary IP'),
|
|
||||||
__('Group'),
|
|
||||||
__('Secondary groups'),
|
|
||||||
__('Description'),
|
|
||||||
__('OS'),
|
|
||||||
__('Interval'),
|
|
||||||
__('Last contact'),
|
|
||||||
__('Last status change'),
|
|
||||||
__('Custom fields'),
|
|
||||||
__('Values Custom Fields'),
|
|
||||||
];
|
|
||||||
|
|
||||||
ui_print_datatable(
|
|
||||||
[
|
|
||||||
'id' => 'basic_info',
|
|
||||||
'class' => $class,
|
|
||||||
'style' => $style,
|
|
||||||
'columns' => $columns,
|
|
||||||
'column_names' => $columns_names,
|
|
||||||
'ordering' => $ordering,
|
|
||||||
'searching' => $searching,
|
|
||||||
'order' => [
|
|
||||||
'field' => $columns[0],
|
|
||||||
'direction' => 'asc',
|
|
||||||
],
|
|
||||||
'ajax_url' => 'operation/inventory/inventory',
|
|
||||||
'ajax_data' => [
|
|
||||||
'get_data_basic_info' => 1,
|
|
||||||
'id_agent' => $id_agente,
|
|
||||||
],
|
|
||||||
'zeroRecords' => __('Agent info not found'),
|
|
||||||
'emptyTable' => __('Agent info not found'),
|
|
||||||
'return' => false,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
html_print_action_buttons(
|
|
||||||
'',
|
|
||||||
['type' => 'form_action']
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Metaconsole.
|
|
||||||
if ($inventory_module !== 'basic') {
|
if ($inventory_module !== 'basic') {
|
||||||
|
if (is_metaconsole() === true) {
|
||||||
if ($order_by_agent === true) {
|
if ($order_by_agent === true) {
|
||||||
$count_nodos_tmp = [];
|
$count_nodos_tmp = [];
|
||||||
foreach ($nodos as $count_value) {
|
foreach ($nodos as $count_value) {
|
||||||
@ -1265,6 +980,226 @@ if ($is_metaconsole === false) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Single agent selected.
|
||||||
|
if ($inventory_id_agent > 0 && isset($agents[$inventory_id_agent]) === true) {
|
||||||
|
$agents = [$inventory_id_agent => $agents[$inventory_id_agent]];
|
||||||
|
}
|
||||||
|
|
||||||
|
$agents_ids = array_keys($agents);
|
||||||
|
if (count($agents_ids) > 0) {
|
||||||
|
$rows = inventory_get_datatable(
|
||||||
|
$agents_ids,
|
||||||
|
$inventory_module,
|
||||||
|
$utimestamp,
|
||||||
|
$inventory_search_string,
|
||||||
|
$export,
|
||||||
|
false,
|
||||||
|
$order_by_agent
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($agents_ids) === 0 || (int) $rows === ERR_NODATA) {
|
||||||
|
ui_print_info_message(
|
||||||
|
[
|
||||||
|
'no_close' => true,
|
||||||
|
'message' => __('No data found.'),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<div id='loading_url' style='display: none; width: ".$table->width."; text-align: right;'>".html_print_image('images/spinner.gif', true).'</div>';
|
||||||
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function get_csv_url(module, id_group, search_string, utimestamp, agent, order_by_agent) {
|
||||||
|
$("#url_csv").hide();
|
||||||
|
$("#loading_url").show();
|
||||||
|
$.ajax ({
|
||||||
|
method:'GET',
|
||||||
|
url:'ajax.php',
|
||||||
|
datatype:'html',
|
||||||
|
data:{
|
||||||
|
"page" : "operation/inventory/inventory",
|
||||||
|
"get_csv_url" : 1,
|
||||||
|
"module" : module,
|
||||||
|
"id_group" : id_group,
|
||||||
|
"search_string" : search_string,
|
||||||
|
"utimestamp" : utimestamp,
|
||||||
|
"agent" : agent,
|
||||||
|
"export": true,
|
||||||
|
"order_by_agent": order_by_agent
|
||||||
|
},
|
||||||
|
success: function (data, status) {
|
||||||
|
$("#url_csv").html(data);
|
||||||
|
$("#loading_url").hide();
|
||||||
|
$("#url_csv").show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
|
if ($order_by_agent === true) {
|
||||||
|
foreach ($rows as $agent_rows) {
|
||||||
|
$data = [];
|
||||||
|
$modules = '';
|
||||||
|
foreach ($agent_rows['row'] as $key_row => $row) {
|
||||||
|
$columns = explode(';', io_safe_output($row['data_format']));
|
||||||
|
array_push($columns, 'Timestamp');
|
||||||
|
|
||||||
|
$data_rows = explode(PHP_EOL, $row['data']);
|
||||||
|
foreach ($data_rows as $data_row) {
|
||||||
|
// Exclude results don't match filter.
|
||||||
|
if ($inventory_search_string && preg_match('/'.io_safe_output($inventory_search_string).'/', ($data_row)) == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$column_data = explode(';', io_safe_output($data_row));
|
||||||
|
|
||||||
|
if ($column_data[0] !== '') {
|
||||||
|
$row_tmp = [];
|
||||||
|
foreach ($column_data as $key => $value) {
|
||||||
|
$row_tmp[$columns[$key]] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
$row_tmp['Timestamp'] = $row['timestamp'];
|
||||||
|
array_push($data, (object) $row_tmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$id_table = 'id_'.$key_row.'_'.$row['id_module_inventory'].'_'.$row['id_agente'];
|
||||||
|
|
||||||
|
$table = ui_print_datatable(
|
||||||
|
[
|
||||||
|
'id' => $id_table,
|
||||||
|
'class' => 'info_table w100p',
|
||||||
|
'style' => 'width: 99%',
|
||||||
|
'columns' => $columns,
|
||||||
|
'column_names' => $columns,
|
||||||
|
'no_sortable_columns' => [],
|
||||||
|
'data_element' => $data,
|
||||||
|
'searching' => true,
|
||||||
|
'dom_elements' => 'ftip',
|
||||||
|
'order' => [
|
||||||
|
'field' => $columns[0],
|
||||||
|
'direction' => 'asc',
|
||||||
|
],
|
||||||
|
'zeroRecords' => __('No inventory found'),
|
||||||
|
'emptyTable' => __('No inventory found'),
|
||||||
|
'return' => true,
|
||||||
|
'default_pagination' => 10,
|
||||||
|
'no_sortable_columns' => [-1],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$modules .= ui_toggle(
|
||||||
|
$table,
|
||||||
|
'<span class="title-blue">'.$row['name'].'</span>',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
'white-box-content w100p',
|
||||||
|
'box-shadow white_table_graph w100p',
|
||||||
|
'images/arrow_down_green.png',
|
||||||
|
'images/arrow_right_green.png',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
false,
|
||||||
|
$id_table
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui_toggle(
|
||||||
|
$modules,
|
||||||
|
$agent_rows['agent'],
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$count_rows = count($rows);
|
||||||
|
foreach ($rows as $module_rows) {
|
||||||
|
$agent = '';
|
||||||
|
$data = [];
|
||||||
|
|
||||||
|
foreach ($module_rows as $row) {
|
||||||
|
$columns = explode(';', io_safe_output($row['data_format']));
|
||||||
|
array_push($columns, 'Timestamp');
|
||||||
|
array_push($columns, 'Agent');
|
||||||
|
|
||||||
|
// Exclude results don't match filter.
|
||||||
|
if ($inventory_search_string && preg_match('/'.io_safe_output($inventory_search_string).'/', ($row['data'])) == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data_tmp = [];
|
||||||
|
if ($row['data'] !== '') {
|
||||||
|
$values_explode = explode(';', io_safe_output($row['data']));
|
||||||
|
|
||||||
|
foreach ($values_explode as $key => $value) {
|
||||||
|
$data_tmp[$columns[$key]] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data_tmp['Timestamp'] = $row['timestamp'];
|
||||||
|
$data_tmp['Agent'] = $row['name_agent'];
|
||||||
|
array_push($data, $data_tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$id_table = 'id_'.$row['id_module_inventory'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$table = ui_print_datatable(
|
||||||
|
[
|
||||||
|
'id' => $id_table,
|
||||||
|
'class' => 'info_table w100p',
|
||||||
|
'style' => 'width: 99%',
|
||||||
|
'columns' => $columns,
|
||||||
|
'column_names' => $columns,
|
||||||
|
'no_sortable_columns' => [],
|
||||||
|
'data_element' => $data,
|
||||||
|
'searching' => true,
|
||||||
|
'dom_elements' => 'ftip',
|
||||||
|
'order' => [
|
||||||
|
'field' => $columns[0],
|
||||||
|
'direction' => 'asc',
|
||||||
|
],
|
||||||
|
'zeroRecords' => __('No inventory found'),
|
||||||
|
'emptyTable' => __('No inventory found'),
|
||||||
|
'return' => true,
|
||||||
|
'no_sortable_columns' => [],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($count_rows > 1) {
|
||||||
|
ui_toggle(
|
||||||
|
$table,
|
||||||
|
array_shift($module_rows)['name'],
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
echo $table;
|
||||||
|
|
||||||
|
html_print_action_buttons(
|
||||||
|
'',
|
||||||
|
['type' => 'form_action']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$id_agente = $inventory_id_agent;
|
$id_agente = $inventory_id_agent;
|
||||||
$agentes = [];
|
$agentes = [];
|
||||||
@ -1321,6 +1256,7 @@ if ($is_metaconsole === false) {
|
|||||||
'ajax_data' => [
|
'ajax_data' => [
|
||||||
'get_data_basic_info' => 1,
|
'get_data_basic_info' => 1,
|
||||||
'id_agent' => $id_agente,
|
'id_agent' => $id_agente,
|
||||||
|
'id_group' => $inventory_id_group,
|
||||||
],
|
],
|
||||||
'zeroRecords' => __('Agent info not found'),
|
'zeroRecords' => __('Agent info not found'),
|
||||||
'emptyTable' => __('Agent info not found'),
|
'emptyTable' => __('Agent info not found'),
|
||||||
@ -1333,7 +1269,6 @@ if ($is_metaconsole === false) {
|
|||||||
['type' => 'form_action']
|
['type' => 'form_action']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ui_require_jquery_file('pandora.controls');
|
ui_require_jquery_file('pandora.controls');
|
||||||
ui_require_jquery_file('ajaxqueue');
|
ui_require_jquery_file('ajaxqueue');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user