2012-03-20 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php: now the function "html_print_input_text_extended" accept a script code as string for event "keyup" or as array where the index is string for each event where you want add javascript code. And make more pretty the page of report and cleaned source code style. * include/functions_reporting.php, godmode/reporting/reporting_builder.list_items.php, godmode/reporting/reporting_builder.php: changed the old method to order items in a report for the method with checks and move the block of items. * godmode/reporting/reporting_builder.preview.php: removed this file, now it use the html view in operation. Merged from the branch pandora_4.0 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5796 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
e2a1aa207f
commit
4b0b2ebecd
|
@ -1,3 +1,21 @@
|
||||||
|
2012-03-20 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* include/functions_html.php: now the function
|
||||||
|
"html_print_input_text_extended" accept a script code as string for event
|
||||||
|
"keyup" or as array where the index is string for each event where you want
|
||||||
|
add javascript code. And make more pretty the page of report and cleaned
|
||||||
|
source code style.
|
||||||
|
|
||||||
|
* include/functions_reporting.php,
|
||||||
|
godmode/reporting/reporting_builder.list_items.php,
|
||||||
|
godmode/reporting/reporting_builder.php: changed the old method to order
|
||||||
|
items in a report for the method with checks and move the block of items.
|
||||||
|
|
||||||
|
* godmode/reporting/reporting_builder.preview.php: removed this file, now
|
||||||
|
it use the html view in operation.
|
||||||
|
|
||||||
|
Merged from the branch pandora_4.0
|
||||||
|
|
||||||
2012-03-20 Sergio Martin <sergio.martin@artica.es>
|
2012-03-20 Sergio Martin <sergio.martin@artica.es>
|
||||||
|
|
||||||
* godmode/reporting/visual_console_builder.elements.php: Added
|
* godmode/reporting/visual_console_builder.elements.php: Added
|
||||||
|
|
|
@ -67,16 +67,16 @@ else {
|
||||||
WHERE t4.id_report = ' . $idReport);
|
WHERE t4.id_report = ' . $idReport);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($rows === false) {
|
if ($rows === false) {
|
||||||
$rows = array();
|
$rows = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$agents = array();
|
$agents = array();
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
$agents[$row['id_agente']] = $row['nombre'];
|
$agents[$row['id_agente']] = $row['nombre'];
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($config['dbtype']){
|
switch ($config['dbtype']){
|
||||||
case "mysql":
|
case "mysql":
|
||||||
case "postgresql":
|
case "postgresql":
|
||||||
|
@ -99,12 +99,12 @@ else {
|
||||||
if ($rows === false) {
|
if ($rows === false) {
|
||||||
$rows = array();
|
$rows = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$modules = array();
|
$modules = array();
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
$modules[$row['id_agent_module']] = $row['nombre'];
|
$modules[$row['id_agent_module']] = $row['nombre'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$rows = db_get_all_rows_sql('
|
$rows = db_get_all_rows_sql('
|
||||||
SELECT DISTINCT(type)
|
SELECT DISTINCT(type)
|
||||||
FROM treport_content
|
FROM treport_content
|
||||||
|
@ -112,7 +112,7 @@ else {
|
||||||
if ($rows === false) {
|
if ($rows === false) {
|
||||||
$rows = array();
|
$rows = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$types = array();
|
$types = array();
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
$types[$row['type']] = get_report_name($row['type']);
|
$types[$row['type']] = get_report_name($row['type']);
|
||||||
|
@ -134,7 +134,7 @@ $urlFilter = '&agent_filter=' . $agentFilter . '&module_filter=' . $moduleFilter
|
||||||
echo '<a href="javascript: toggleFormFilter();"><b>'.__('Items filter').'</b> ' . html_print_image("images/down.png", true, array("title" => __('Toggle filter(s)'), "id" => 'image_form_filter')) . '</a>';
|
echo '<a href="javascript: toggleFormFilter();"><b>'.__('Items filter').'</b> ' . html_print_image("images/down.png", true, array("title" => __('Toggle filter(s)'), "id" => 'image_form_filter')) . '</a>';
|
||||||
|
|
||||||
$table = null;
|
$table = null;
|
||||||
$table->width = '98%';
|
$table->width = '100%';
|
||||||
$table->data[0][0] = __('Agents');
|
$table->data[0][0] = __('Agents');
|
||||||
$table->data[0][1] = html_print_select($agents, 'agent_filter', $agentFilter, '', __('All'), 0, true);
|
$table->data[0][1] = html_print_select($agents, 'agent_filter', $agentFilter, '', __('All'), 0, true);
|
||||||
$table->data[0][2] = __('Modules');
|
$table->data[0][2] = __('Modules');
|
||||||
|
@ -143,7 +143,7 @@ $table->data[1][0] = __('Type');
|
||||||
$table->data[1][1] = html_print_select($types, 'type_filter', $typeFilter, '', __('All'), 0, true);
|
$table->data[1][1] = html_print_select($types, 'type_filter', $typeFilter, '', __('All'), 0, true);
|
||||||
|
|
||||||
echo '<div id="form_filter" style="display: none;">';
|
echo '<div id="form_filter" style="display: none;">';
|
||||||
echo '<form method="post" action ="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=filter&&id_report=' . $idReport . '">';
|
echo '<form method="post" action ="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=filter&id_report=' . $idReport . '">';
|
||||||
|
|
||||||
html_print_table ($table);
|
html_print_table ($table);
|
||||||
|
|
||||||
|
@ -196,23 +196,32 @@ switch ($config["dbtype"]) {
|
||||||
$countItems = db_get_sql('SELECT COUNT(id_rc) FROM treport_content WHERE ' . $where . ' AND id_report = ' . $idReport);
|
$countItems = db_get_sql('SELECT COUNT(id_rc) FROM treport_content WHERE ' . $where . ' AND id_report = ' . $idReport);
|
||||||
$table = null;
|
$table = null;
|
||||||
|
|
||||||
if ($items){
|
$table->style[0] = 'text-align: right;';
|
||||||
|
|
||||||
|
if ($items) {
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
$table->head[0] = '<span title="' . __('Sort') . '">' . __('S.') . '</span>';
|
|
||||||
|
$table->size = array();
|
||||||
|
$table->size[0] = '5px';
|
||||||
|
$table->size[1] = '15%';
|
||||||
|
$table->size[4] = '8%';
|
||||||
|
$table->size[6] = '65px';
|
||||||
|
|
||||||
|
$table->head[0] = '<span title="' . __('Position') . '">' . __('P.') . '</span>';
|
||||||
$table->head[1] = __('Type');
|
$table->head[1] = __('Type');
|
||||||
if (!$filterEnable) {
|
if (!$filterEnable) {
|
||||||
$table->head[1] .= ' <a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=order&dir=up&field=type&id_report=' . $idReport . $urlFilter . '">' . html_print_image("images/sort_up.png", true, array("title" => __('Ascendent'))) . '</a>' .
|
$table->head[1] .= ' <a onclick="return message_check_sort_items();" href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=order&dir=up&field=type&id_report=' . $idReport . $urlFilter . '">' . html_print_image("images/sort_up.png", true, array("title" => __('Ascendent'))) . '</a>' .
|
||||||
'<a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=order&dir=down&field=type&id_report=' . $idReport . $urlFilter . '">' . html_print_image("images/sort_down.png", true, array("title" => __('Descent'))) . '</a>';
|
'<a onclick="return message_check_sort_items();" href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=order&dir=down&field=type&id_report=' . $idReport . $urlFilter . '">' . html_print_image("images/sort_down.png", true, array("title" => __('Descent'))) . '</a>';
|
||||||
}
|
}
|
||||||
$table->head[2] = __('Agent');
|
$table->head[2] = __('Agent');
|
||||||
if (!$filterEnable) {
|
if (!$filterEnable) {
|
||||||
$table->head[2] .= ' <a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=order&dir=up&field=agent&id_report=' . $idReport . $urlFilter . '">' . html_print_image("images/sort_up.png", true, array("title" => __('Ascendent'))) . '</a>' .
|
$table->head[2] .= ' <a onclick="return message_check_sort_items();" href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=order&dir=up&field=agent&id_report=' . $idReport . $urlFilter . '">' . html_print_image("images/sort_up.png", true, array("title" => __('Ascendent'))) . '</a>' .
|
||||||
'<a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=order&dir=down&field=agent&id_report=' . $idReport . $urlFilter . '">' . html_print_image("images/sort_down.png", true, array("title" => __('Descent'))) . '</a>';
|
'<a onclick="return message_check_sort_items();" href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=order&dir=down&field=agent&id_report=' . $idReport . $urlFilter . '">' . html_print_image("images/sort_down.png", true, array("title" => __('Descent'))) . '</a>';
|
||||||
}
|
}
|
||||||
$table->head[3] = __('Module');
|
$table->head[3] = __('Module');
|
||||||
if (!$filterEnable) {
|
if (!$filterEnable) {
|
||||||
$table->head[3] .= ' <a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=order&dir=up&field=module&id_report=' . $idReport . $urlFilter . '">' . html_print_image("images/sort_up.png", true, array("title" => __('Ascendent'))) . '</a>' .
|
$table->head[3] .= ' <a onclick="return message_check_sort_items();" href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=order&dir=up&field=module&id_report=' . $idReport . $urlFilter . '">' . html_print_image("images/sort_up.png", true, array("title" => __('Ascendent'))) . '</a>' .
|
||||||
'<a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=order&dir=down&field=module&id_report=' . $idReport . $urlFilter . '">' . html_print_image("images/sort_down.png", true, array("title" => __('Descent'))) . '</a>';
|
'<a onclick="return message_check_sort_items();" href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=order&dir=down&field=module&id_report=' . $idReport . $urlFilter . '">' . html_print_image("images/sort_down.png", true, array("title" => __('Descent'))) . '</a>';
|
||||||
}
|
}
|
||||||
$table->head[4] = __('Period');
|
$table->head[4] = __('Period');
|
||||||
$table->head[5] = __('Description');
|
$table->head[5] = __('Description');
|
||||||
|
@ -236,6 +245,7 @@ if ($items === false) {
|
||||||
$items = array();
|
$items = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$count = 0;
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
if ($rowPair)
|
if ($rowPair)
|
||||||
$table->rowclass[$count] = 'rowPair';
|
$table->rowclass[$count] = 'rowPair';
|
||||||
|
@ -245,19 +255,7 @@ foreach ($items as $item) {
|
||||||
|
|
||||||
$row = array();
|
$row = array();
|
||||||
|
|
||||||
if ((reset($items) == $item) && ($offset == 0)) {
|
$row[0] = $count + $offset + 1; //The 1 is for do not start in 0.
|
||||||
$row[0] = '<span style="display: block; float: left; width: 16px;"> </span>';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$row[0] = '<a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=order&dir=up&id_report=' . $idReport . '&id_item=' . $item['id_rc'] . $urlFilter . '">' . html_print_image("images/up.png", true, array("title" => __('Move to up'))) . '</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((end($items) == $item) && $lastPage) {
|
|
||||||
$row[0] .= '<span style="width: 16px;"> </span>';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$row[0] .= '<a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=order&dir=down&id_report=' . $idReport . '&id_item=' . $item['id_rc'] . $urlFilter . '">' . html_print_image("images/down.png", true, array("title" => __('Move to down'))) . '</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($filterEnable) {
|
if ($filterEnable) {
|
||||||
$row[0] = '';
|
$row[0] = '';
|
||||||
|
@ -282,18 +280,18 @@ foreach ($items as $item) {
|
||||||
$row[3] = '-';
|
$row[3] = '-';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$row[2] = ui_print_truncate_text(agents_get_name(agents_get_module_id($item['id_agent_module'])), 20);
|
$row[2] = ui_print_truncate_text(agents_get_name(agents_get_module_id($item['id_agent_module'])), 35);
|
||||||
$row[3] = ui_print_truncate_text(db_get_value_filter('nombre', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module'])), 20);
|
$row[3] = ui_print_truncate_text(db_get_value_filter('nombre', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module'])), 35);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$row[2] = ui_print_truncate_text(agents_get_name($item['id_agent']), 20);
|
$row[2] = ui_print_truncate_text(agents_get_name($item['id_agent']), 35);
|
||||||
|
|
||||||
if ($item['id_agent_module'] == '') {
|
if ($item['id_agent_module'] == '') {
|
||||||
$row [3] = '-';
|
$row [3] = '-';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$row[3] = ui_print_truncate_text(db_get_value_filter('nombre', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module'])),20);
|
$row[3] = ui_print_truncate_text(db_get_value_filter('nombre', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module'])),35);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,10 +301,15 @@ foreach ($items as $item) {
|
||||||
$row[5] = '-';
|
$row[5] = '-';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$row[5] = ui_print_truncate_text($item['description'], 25, true, true);
|
$row[5] = ui_print_truncate_text($item['description'], 40, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$row[6] = '<a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&tab=item_editor&action=edit&id_report=' . $idReport . '&id_item=' . $item['id_rc'] . '">' . html_print_image("images/wrench_orange.png", true, array("title" => __('Edit'))) . '</a>';
|
$row[6] = '';
|
||||||
|
//You can sort the items if the filter is not enable.
|
||||||
|
if (!$filterEnable) {
|
||||||
|
$row[6] .= html_print_checkbox_extended('sorted_items[]', $item['id_rc'], false, false, '', 'class="selected_check"', true);
|
||||||
|
}
|
||||||
|
$row[6] .= '<a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&tab=item_editor&action=edit&id_report=' . $idReport . '&id_item=' . $item['id_rc'] . '">' . html_print_image("images/wrench_orange.png", true, array("title" => __('Edit'))) . '</a>';
|
||||||
$row[6] .= ' ';
|
$row[6] .= ' ';
|
||||||
$row[6] .= '<a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=delete&id_report=' . $idReport . '&id_item=' . $item['id_rc'] . $urlFilter . '">' . html_print_image("images/cross.png", true, array("title" => __('Delete'))) .'</a>';
|
$row[6] .= '<a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=delete&id_report=' . $idReport . '&id_item=' . $item['id_rc'] . $urlFilter . '">' . html_print_image("images/cross.png", true, array("title" => __('Delete'))) .'</a>';
|
||||||
|
|
||||||
|
@ -320,6 +323,24 @@ foreach ($items as $item) {
|
||||||
ui_pagination ($countItems, 'index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=edit&id_report=' . $idReport . $urlFilter);
|
ui_pagination ($countItems, 'index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=edit&id_report=' . $idReport . $urlFilter);
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
ui_pagination ($countItems, 'index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=edit&id_report=' . $idReport . $urlFilter);
|
ui_pagination ($countItems, 'index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=edit&id_report=' . $idReport . $urlFilter);
|
||||||
|
|
||||||
|
$table = null;
|
||||||
|
$table->width = '60%';
|
||||||
|
$table->colspan[0][0] = 3;
|
||||||
|
$table->data[0][0] = "<b>". __("Sort items") . "</b>";
|
||||||
|
$table->data[1][0] = __('Sort selected items from position: ');
|
||||||
|
$table->data[1][1] = html_print_select_style(
|
||||||
|
array('before' => __('Move before to'), 'after' => __('Move after to')), 'move_to',
|
||||||
|
'', '', '', '', 0, true);
|
||||||
|
$table->data[1][2] = html_print_input_text_extended('position_to_sort', 1,
|
||||||
|
'text-position_to_sort', '', 3, 10, false, "only_numbers('position_to_sort');", '', true);
|
||||||
|
$table->data[1][2] .= html_print_input_hidden('ids_items_to_sort', '', true);
|
||||||
|
$table->data[1][3] = html_print_submit_button(__('Sort'), 'sort_submit', false, 'class="sub upd"', true);
|
||||||
|
|
||||||
|
echo "<form action='index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=sort_items&id_report=" . $idReport . "'
|
||||||
|
method='post' onsubmit='return added_ids_sorted_items_to_hidden_input();'>";
|
||||||
|
html_print_table($table);
|
||||||
|
echo "</form>";
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function toggleFormFilter() {
|
function toggleFormFilter() {
|
||||||
|
@ -332,4 +353,52 @@ function toggleFormFilter() {
|
||||||
$("#form_filter").css('display','none');
|
$("#form_filter").css('display','none');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function message_check_sort_items() {
|
||||||
|
var return_value = false;
|
||||||
|
|
||||||
|
return_value = confirm("<?php echo __("Are you sure to sort the items into the report?\\n" .
|
||||||
|
"This action change the sorting of items into data base."); ?>");
|
||||||
|
|
||||||
|
return return_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function added_ids_sorted_items_to_hidden_input() {
|
||||||
|
var ids = '';
|
||||||
|
var first = true;
|
||||||
|
|
||||||
|
$("input.selected_check:checked").each(function(i, val) {
|
||||||
|
if (!first)
|
||||||
|
ids = ids + '|';
|
||||||
|
first = false;
|
||||||
|
|
||||||
|
ids = ids + $(val).val();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("input[name='ids_items_to_sort']").val(ids);
|
||||||
|
|
||||||
|
console.log(ids);
|
||||||
|
|
||||||
|
if (ids == '') {
|
||||||
|
alert("<?php echo __("Please select any item to order");?>");
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function only_numbers(name) {
|
||||||
|
var value = $("input[name='" + name + "']").val();
|
||||||
|
|
||||||
|
value = parseInt(value);
|
||||||
|
|
||||||
|
if (isNaN(value)) {
|
||||||
|
value = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$("input[name='" + name + "']").val(value);
|
||||||
|
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -40,6 +40,99 @@ $offset = get_parameter('offset', 0);
|
||||||
$idItem = get_parameter('id_item', 0);
|
$idItem = get_parameter('id_item', 0);
|
||||||
|
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
|
case 'sort_items':
|
||||||
|
switch ($activeTab) {
|
||||||
|
case 'list_items':
|
||||||
|
//NO FUNCIONA
|
||||||
|
|
||||||
|
$resultOperationDB = null;
|
||||||
|
$position_to_sort = (int)get_parameter('position_to_sort', 1);
|
||||||
|
$ids_serialize = (string)get_parameter('ids_items_to_sort', '');
|
||||||
|
$move_to = (string)get_parameter('move_to', 'after');
|
||||||
|
|
||||||
|
$countItems = db_get_sql('SELECT COUNT(id_rc)
|
||||||
|
FROM treport_content WHERE id_report = ' . $idReport);
|
||||||
|
|
||||||
|
if (($countItems < $position_to_sort) || ($position_to_sort < 1)) {
|
||||||
|
$resultOperationDB = false;
|
||||||
|
}
|
||||||
|
else if (!empty($ids_serialize)) {
|
||||||
|
$ids = explode('|', $ids_serialize);
|
||||||
|
|
||||||
|
switch ($config["dbtype"]) {
|
||||||
|
case "mysql":
|
||||||
|
$items = db_get_all_rows_sql('SELECT id_rc, `order`
|
||||||
|
FROM treport_content
|
||||||
|
WHERE id_report = ' . $idReport . '
|
||||||
|
ORDER BY `order`');
|
||||||
|
break;
|
||||||
|
case "oracle":
|
||||||
|
case "postgresql":
|
||||||
|
$items = db_get_all_rows_sql('SELECT id_rc, "order"
|
||||||
|
FROM treport_content
|
||||||
|
WHERE id_report = ' . $idReport . '
|
||||||
|
ORDER BY "order"');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($items === false) $items = array();
|
||||||
|
|
||||||
|
|
||||||
|
$temp = array();
|
||||||
|
|
||||||
|
$temp = array();
|
||||||
|
foreach ($items as $item) {
|
||||||
|
//Remove the contents from the block to sort
|
||||||
|
if (array_search($item['id_rc'], $ids) === false) {
|
||||||
|
$temp[$item['order']] = $item['id_rc'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$items = $temp;
|
||||||
|
|
||||||
|
$sorted_items = array();
|
||||||
|
foreach ($items as $pos => $id_unsort) {
|
||||||
|
if ($pos == $position_to_sort) {
|
||||||
|
if ($move_to == 'after') {
|
||||||
|
$sorted_items[] = $id_unsort;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($ids as $id) {
|
||||||
|
$sorted_items[] = $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($move_to != 'after') {
|
||||||
|
$sorted_items[] = $id_unsort;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$sorted_items[] = $id_unsort;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$items = $sorted_items;
|
||||||
|
|
||||||
|
foreach ($items as $order => $id) {
|
||||||
|
switch ($config["dbtype"]) {
|
||||||
|
case "mysql":
|
||||||
|
db_process_sql_update('treport_content',
|
||||||
|
array('`order`' => ($order + 1)), array('id_rc' => $id));
|
||||||
|
break;
|
||||||
|
case "postgresql":
|
||||||
|
case "oracle":
|
||||||
|
db_process_sql_update('treport_content',
|
||||||
|
array('"order"' => ($order + 1)), array('id_rc' => $id));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$resultOperationDB = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$resultOperationDB = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 'delete_report':
|
case 'delete_report':
|
||||||
case 'list':
|
case 'list':
|
||||||
$buttons = array(
|
$buttons = array(
|
||||||
|
@ -104,7 +197,7 @@ switch ($action) {
|
||||||
$table->size[4] = '60px';
|
$table->size[4] = '60px';
|
||||||
|
|
||||||
foreach ($reports as $report) {
|
foreach ($reports as $report) {
|
||||||
|
|
||||||
if (!is_user_admin ($config["id_user"])){
|
if (!is_user_admin ($config["id_user"])){
|
||||||
if ($report["private"] && $report["id_user"] != $config['id_user'])
|
if ($report["private"] && $report["id_user"] != $config['id_user'])
|
||||||
if (!check_acl ($config["id_user"], $report["id_group"], "AW"))
|
if (!check_acl ($config["id_user"], $report["id_group"], "AW"))
|
||||||
|
@ -112,7 +205,7 @@ switch ($action) {
|
||||||
if (!check_acl ($config["id_user"], $report["id_group"], "AW"))
|
if (!check_acl ($config["id_user"], $report["id_group"], "AW"))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = array ();
|
$data = array ();
|
||||||
$data[0] = '<a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&action=edit&id_report='.
|
$data[0] = '<a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&action=edit&id_report='.
|
||||||
$report['id_report'].'">'.$report['name'].'</a>';
|
$report['id_report'].'">'.$report['name'].'</a>';
|
||||||
|
@ -315,7 +408,7 @@ switch ($action) {
|
||||||
$style['show_in_two_columns'] = get_parameter('show_in_two_columns', 0);
|
$style['show_in_two_columns'] = get_parameter('show_in_two_columns', 0);
|
||||||
$style['show_in_landscape'] = get_parameter('show_in_landscape', 0);
|
$style['show_in_landscape'] = get_parameter('show_in_landscape', 0);
|
||||||
$values['style'] = io_safe_input(json_encode($style));
|
$values['style'] = io_safe_input(json_encode($style));
|
||||||
|
|
||||||
if ($good_format){
|
if ($good_format){
|
||||||
$resultOperationDB = db_process_sql_update('treport_content', $values, array('id_rc' => $idItem));
|
$resultOperationDB = db_process_sql_update('treport_content', $values, array('id_rc' => $idItem));
|
||||||
}
|
}
|
||||||
|
@ -422,8 +515,9 @@ switch ($action) {
|
||||||
$values['server_name'] = substr ($server_name, 1, strlen($server_name));
|
$values['server_name'] = substr ($server_name, 1, strlen($server_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($values['type'] == 'sql') OR ($values['type'] == 'sql_graph_hbar')OR ($values['type'] == 'sql_graph_vbar') OR ($values['type'] == 'sql_graph_pie')) {
|
if (($values['type'] == 'sql') OR ($values['type'] == 'sql_graph_hbar')
|
||||||
|
OR ($values['type'] == 'sql_graph_vbar') OR ($values['type'] == 'sql_graph_pie')) {
|
||||||
|
|
||||||
$values['treport_custom_sql_id'] = get_parameter('id_custom');
|
$values['treport_custom_sql_id'] = get_parameter('id_custom');
|
||||||
if ($values['treport_custom_sql_id'] == 0) {
|
if ($values['treport_custom_sql_id'] == 0) {
|
||||||
$values['external_source'] = get_parameter('sql');
|
$values['external_source'] = get_parameter('sql');
|
||||||
|
@ -444,7 +538,7 @@ switch ($action) {
|
||||||
$style['show_in_two_columns'] = get_parameter('show_in_two_columns', 0);
|
$style['show_in_two_columns'] = get_parameter('show_in_two_columns', 0);
|
||||||
$style['show_in_landscape'] = get_parameter('show_in_landscape', 0);
|
$style['show_in_landscape'] = get_parameter('show_in_landscape', 0);
|
||||||
$values['style'] = io_safe_input(json_encode($style));
|
$values['style'] = io_safe_input(json_encode($style));
|
||||||
|
|
||||||
if ($good_format){
|
if ($good_format){
|
||||||
$result = db_process_sql_insert('treport_content', $values);
|
$result = db_process_sql_insert('treport_content', $values);
|
||||||
|
|
||||||
|
@ -710,7 +804,7 @@ if ($enterpriseEnable) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$buttons['preview'] = array('active' => false,
|
$buttons['preview'] = array('active' => false,
|
||||||
'text' => '<a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&tab=preview&action=edit&id_report=' . $idReport . '">' .
|
'text' => '<a href="index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id=' . $idReport . '">' .
|
||||||
html_print_image("images/reporting.png", true, array ("title" => __('Preview'))) .'</a>');
|
html_print_image("images/reporting.png", true, array ("title" => __('Preview'))) .'</a>');
|
||||||
|
|
||||||
$buttons[$activeTab]['active'] = true;
|
$buttons[$activeTab]['active'] = true;
|
||||||
|
@ -742,9 +836,6 @@ switch ($activeTab) {
|
||||||
case 'item_editor':
|
case 'item_editor':
|
||||||
require_once('godmode/reporting/reporting_builder.item_editor.php');
|
require_once('godmode/reporting/reporting_builder.item_editor.php');
|
||||||
break;
|
break;
|
||||||
case 'preview':
|
|
||||||
require_once('godmode/reporting/reporting_builder.preview.php');
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
reporting_enterprise_select_tab($activeTab);
|
reporting_enterprise_select_tab($activeTab);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,253 +0,0 @@
|
||||||
<?php
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
|
||||||
// ==================================================
|
|
||||||
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
|
||||||
// Please see http://pandorafms.org for full contribution list
|
|
||||||
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation for version 2.
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
|
|
||||||
// Login check
|
|
||||||
global $config;
|
|
||||||
|
|
||||||
check_login();
|
|
||||||
|
|
||||||
$id_report = (int) get_parameter ('id_report');
|
|
||||||
|
|
||||||
// Get Report record (to get id_group)
|
|
||||||
$report = db_get_row ('treport', 'id_report', $id_report);
|
|
||||||
|
|
||||||
// Check ACL on the report to see if user has access to the report.
|
|
||||||
if (! check_acl ($config['id_user'], $report['id_group'], "AR")) {
|
|
||||||
db_pandora_audit("ACL Violation","Trying to access graph reader");
|
|
||||||
include ("general/noaccess.php");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Include with the functions to calculate each kind of report.
|
|
||||||
require_once ("include/functions_reporting.php");
|
|
||||||
require_once ('include/functions_modules.php');
|
|
||||||
|
|
||||||
// Check if the report is a private report.
|
|
||||||
if ($report['private'] && ($report['id_user'] != $config['id_user'] && ! is_user_admin ($config['id_user']))) {
|
|
||||||
include ("general/noaccess.php");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get different date to search the report.
|
|
||||||
$date = (string) get_parameter ('date', date ('Y-m-j'));
|
|
||||||
$time = (string) get_parameter ('time', date ('h:iA'));
|
|
||||||
|
|
||||||
$datetime = strtotime ($date.' '.$time);
|
|
||||||
$report["datetime"] = $datetime;
|
|
||||||
|
|
||||||
// Calculations in order to modify init date of the report
|
|
||||||
$date_init_less = strtotime(date ('Y-m-j')) - 86400; //TODO: Ohh! a magic number like as pink unicorn.
|
|
||||||
$date_init = get_parameter('date_init', date ('Y-m-j', $date_init_less));
|
|
||||||
$time_init = get_parameter('time_init', date ('h:iA'));
|
|
||||||
$datetime_init = strtotime ($date_init.' '.$time_init);
|
|
||||||
$enable_init_date = get_parameter('enable_init_date', 0);
|
|
||||||
|
|
||||||
// Standard header
|
|
||||||
|
|
||||||
$url = "index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id=$id_report&date=$date&time=$time";
|
|
||||||
|
|
||||||
if ($config["pure"] == 0) {
|
|
||||||
$options[] = "<a href='$url&pure=1'>"
|
|
||||||
. html_print_image ("images/fullscreen.png", true, array ("title" => __('Full screen mode')))
|
|
||||||
. "</a>";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$options[] = "<a href='$url&pure=0'>"
|
|
||||||
. html_print_image ("images/normalscreen.png", true, array ("title" => __('Back to normal mode')))
|
|
||||||
. "</a>";
|
|
||||||
}
|
|
||||||
|
|
||||||
$table->width = '99%';
|
|
||||||
$table->class = 'databox';
|
|
||||||
$table->style = array ();
|
|
||||||
$table->style[0] = 'font-weight: bold';
|
|
||||||
// Set initial conditions for these controls, later will be modified by javascript
|
|
||||||
if (!$enable_init_date){
|
|
||||||
$table->style[3] = 'display: none';
|
|
||||||
$table->style[4] = 'display: none';
|
|
||||||
$table->style[5] = 'width: 380.583px';
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$table->style[3] = 'display: ""';
|
|
||||||
$table->style[4] = 'display: ""';
|
|
||||||
$table->style[5] = 'display: none';
|
|
||||||
}
|
|
||||||
|
|
||||||
$table->size = array ();
|
|
||||||
$table->size[0] = '50px';
|
|
||||||
$table->colspan[0][1] = 4;
|
|
||||||
$table->data = array ();
|
|
||||||
$table->data[0][0] = html_print_image("images/reporting.png", true, array("width" => '32', "height" => '32'));
|
|
||||||
if ($report['description'] != '') {
|
|
||||||
$table->data[0][1] = $report['description'];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$table->data[0][1] = $report['name'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$table->data[1][0] = __('Date');
|
|
||||||
$table->data[1][1] = html_print_input_text ('date', $date, '', 12, 10, true). ' ';
|
|
||||||
$table->data[1][1] .= html_print_input_text ('time', $time, '', 7, 7, true). ' ';
|
|
||||||
$table->data[1][1] .= html_print_submit_button (__('Update'), 'date_submit', false, 'class="sub next"', true);
|
|
||||||
$html_enterprise = enterprise_hook('reporting_print_button_PDF', array($id_report));
|
|
||||||
if ($html_enterprise !== ENTERPRISE_NOT_HOOK) {
|
|
||||||
$table->data[1][1] .= $html_enterprise;
|
|
||||||
}
|
|
||||||
$table->data[1][2] = __('Set initial date of all reports') . html_print_checkbox('enable_init_date', 1, $enable_init_date, true);
|
|
||||||
$table->data[1][3] = '<b>' . __('Date') . '</b>' . ui_print_help_tip(__('This is the begin date for all reports'), true);
|
|
||||||
$table->data[1][4] = html_print_input_text ('date_init', $date_init, '', 12, 10, true). ' ';
|
|
||||||
$table->data[1][4] .= html_print_input_text ('time_init', $time_init, '', 7, 7, true). ' ';
|
|
||||||
$table->data[1][4] .= html_print_submit_button (__('Update'), 'date_submit_init', false, 'class="sub next"', true);
|
|
||||||
$table->data[1][5] = '';
|
|
||||||
|
|
||||||
echo '<form method="post" action="">';
|
|
||||||
html_print_table ($table);
|
|
||||||
html_print_input_hidden ('id_report', $id_report);
|
|
||||||
echo '</form>';
|
|
||||||
|
|
||||||
echo '<div id="loading">';
|
|
||||||
echo html_print_image("images/wait.gif", true, array("border" => '0')) . '<br />';
|
|
||||||
echo '<strong>'.__('Loading').'...</strong>';
|
|
||||||
echo '</div>';
|
|
||||||
|
|
||||||
/* We must add javascript here. Otherwise, the date picker won't
|
|
||||||
work if the date is not correct because php is returning. */
|
|
||||||
|
|
||||||
ui_require_jquery_file ('timeentry');
|
|
||||||
?>
|
|
||||||
<script language="javascript" type="text/javascript">
|
|
||||||
|
|
||||||
$(document).ready (function () {
|
|
||||||
$("#loading").slideUp ();
|
|
||||||
$("#text-time").timeEntry ({spinnerImage: 'images/time-entry.png', spinnerSize: [20, 20, 0]});
|
|
||||||
$("#text-date").datepicker ();
|
|
||||||
|
|
||||||
$('[id^=text-date_init]').datepicker ();
|
|
||||||
$('[id^=text-time_init]').timeEntry ({spinnerImage: 'images/time-entry.png', spinnerSize: [20, 20, 0]});
|
|
||||||
|
|
||||||
$.datepicker.regional["<?php echo $config['language']; ?>"];
|
|
||||||
|
|
||||||
/* Show/hide begin date reports controls */
|
|
||||||
$("#checkbox-enable_init_date").click(function() {
|
|
||||||
flag = $("#checkbox-enable_init_date").is(':checked');
|
|
||||||
if (flag == true) {
|
|
||||||
$("#table1-1-3").css("display", "");
|
|
||||||
$("#table1-1-4").css("display", "");
|
|
||||||
$("#table1-1-5").css("display", "none");
|
|
||||||
$("#submit-date_submit").css("display", "none");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$("#table1-1-3").css("display", "none");
|
|
||||||
$("#table1-1-4").css("display", "none");
|
|
||||||
$("#table1-1-5").css("display", "");
|
|
||||||
$("#submit-date_submit").css("display", "");
|
|
||||||
$("#table1-1-5").css("width", "380.583px");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
if ($datetime === false || $datetime == -1) {
|
|
||||||
echo '<h3 class="error">'.__('Invalid date selected').'</h3>';
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Evaluate if it's better to render blocks when are calculated
|
|
||||||
// (enabling realtime flush) or if it's better to wait report to be finished
|
|
||||||
// before showing anything (this could break the execution by overflowing the
|
|
||||||
// running PHP memory on HUGE reports).
|
|
||||||
|
|
||||||
|
|
||||||
$table->size = array ();
|
|
||||||
$table->style = array ();
|
|
||||||
$table->width = '99%';
|
|
||||||
$table->class = 'databox report_table';
|
|
||||||
$table->rowclass = array ();
|
|
||||||
$table->rowclass[0] = 'datos3';
|
|
||||||
|
|
||||||
$report["group_name"] = groups_get_name ($report['id_group']);
|
|
||||||
|
|
||||||
switch ($config["dbtype"]) {
|
|
||||||
case "mysql":
|
|
||||||
$contents = db_get_all_rows_field_filter ("treport_content", "id_report", $id_report, "`order`");
|
|
||||||
break;
|
|
||||||
case "postgresql":
|
|
||||||
case "oracle":
|
|
||||||
$contents = db_get_all_rows_field_filter ("treport_content", "id_report", $id_report, '"order"');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($contents === false) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
foreach($contents as $content) {
|
|
||||||
$id_report = $content['id_rc'];
|
|
||||||
switch ($content['type']) {
|
|
||||||
case 'SLA':
|
|
||||||
$sql = "SELECT * FROM treport_content_sla_combined WHERE id_report_content=$id_report";
|
|
||||||
$items_sla = db_get_all_rows_sql($sql);
|
|
||||||
if ($items_sla === false) {
|
|
||||||
$items_sla = array();
|
|
||||||
}
|
|
||||||
foreach($items_sla as $item) {
|
|
||||||
$delete_pending = db_get_value('delete_pending', 'tagente_modulo', 'id_agente_modulo', $item['id_agent_module']);
|
|
||||||
if ($delete_pending) {
|
|
||||||
$result = db_process_sql_delete('treport_content_sla_combined', array('id'=>$item['id']));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
$sql = "SELECT * FROM treport_content_item WHERE id_report_content=$id_report";
|
|
||||||
$items = db_get_all_rows_sql($sql);
|
|
||||||
if ($items === false) {
|
|
||||||
$items = array();
|
|
||||||
}
|
|
||||||
foreach($items as $item) {
|
|
||||||
$delete_pending = db_get_value('delete_pending', 'tagente_modulo', 'id_agente_modulo', $item['id_agent_module']);
|
|
||||||
if ($delete_pending) {
|
|
||||||
$result = db_process_sql_delete('treport_content_item', array('id'=>$item['id']));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($contents as $content) {
|
|
||||||
$table->data = array ();
|
|
||||||
$table->head = array ();
|
|
||||||
$table->style = array ();
|
|
||||||
$table->colspan = array ();
|
|
||||||
$table->rowstyle = array ();
|
|
||||||
|
|
||||||
// Calculate new inteval for all reports
|
|
||||||
if ($enable_init_date) {
|
|
||||||
$datetime_init = strtotime ($date_init.' '.$time_init);
|
|
||||||
$new_interval = $report['datetime'] - $datetime_init;
|
|
||||||
$content['period'] = $new_interval;
|
|
||||||
}
|
|
||||||
|
|
||||||
reporting_render_report_html_item ($content, $table, $report);
|
|
||||||
echo '<div style = "overflow:auto;">';
|
|
||||||
html_print_table ($table);
|
|
||||||
echo "</div>";
|
|
||||||
flush ();
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
|
@ -479,7 +479,7 @@ function html_print_extended_select_for_time ($name, $selected = '', $script = '
|
||||||
* @param int $size Size of the input.
|
* @param int $size Size of the input.
|
||||||
* @param int $maxlength Maximum length allowed.
|
* @param int $maxlength Maximum length allowed.
|
||||||
* @param bool $disabled Disable the button (optional, button enabled by default).
|
* @param bool $disabled Disable the button (optional, button enabled by default).
|
||||||
* @param string $script JavaScript to attach to this . (TODO This parameter don't use...and I don't know reason)
|
* @param mixed $script JavaScript to attach to this. It is array the index is event to set a script, it is only string for "onkeyup" event.
|
||||||
* @param mixed $attributes Attributes to add to this tag. Should be an array for correction.
|
* @param mixed $attributes Attributes to add to this tag. Should be an array for correction.
|
||||||
* @param bool $return Whether to return an output string or echo now (optional, echo by default).
|
* @param bool $return Whether to return an output string or echo now (optional, echo by default).
|
||||||
* @param bool $password Whether it is a password input or not. Not password by default.
|
* @param bool $password Whether it is a password input or not. Not password by default.
|
||||||
|
@ -547,7 +547,19 @@ function html_print_input_text_extended ($name, $value, $id, $alt, $size, $maxle
|
||||||
$output .= $attribute.'="'.$default.'" ';
|
$output .= $attribute.'="'.$default.'" ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($script)) {
|
||||||
|
if (is_string($script)) {
|
||||||
|
$code = $script;
|
||||||
|
$script = array();
|
||||||
|
$script["onkeyup"] = $code;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($script as $event => $code) {
|
||||||
|
$output .= ' ' . $event . '="'.$code.'" ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$output .= '/>';
|
$output .= '/>';
|
||||||
|
|
||||||
if (!$return)
|
if (!$return)
|
||||||
|
|
|
@ -2140,11 +2140,17 @@ function header_content($mini, $content, $report, &$table, $title = false, $name
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
|
|
||||||
if ($title !== false)
|
$count_empty = 0;
|
||||||
$data[] = $sizh . $title . $sizhfin;
|
|
||||||
|
|
||||||
if ($name !== false)
|
if ($title !== false) {
|
||||||
|
$data[] = $sizh . $title . $sizhfin;
|
||||||
|
}
|
||||||
|
else $count_empty++;
|
||||||
|
|
||||||
|
if ($name !== false) {
|
||||||
$data[] = $sizh . $name . $sizhfin;
|
$data[] = $sizh . $name . $sizhfin;
|
||||||
|
}
|
||||||
|
else $count_empty++;
|
||||||
|
|
||||||
if ($period !== false)
|
if ($period !== false)
|
||||||
$data[] = $sizh . $period . $sizhfin;
|
$data[] = $sizh . $period . $sizhfin;
|
||||||
|
@ -2156,7 +2162,7 @@ function header_content($mini, $content, $report, &$table, $title = false, $name
|
||||||
$sizhfin . "</div>";
|
$sizhfin . "</div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
//$table->style[$count]
|
$table->colspan[0][2 - $count_empty] = 1 + $count_empty;
|
||||||
|
|
||||||
array_push ($table->data, $data);
|
array_push ($table->data, $data);
|
||||||
}
|
}
|
||||||
|
@ -2306,7 +2312,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
|
|
||||||
if ($value === false) {
|
if ($value === false) {
|
||||||
$value = __('Unknown');
|
$value = __('Unknown');
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$value = date ('d M Y H:i:s', $value);
|
$value = date ('d M Y H:i:s', $value);
|
||||||
}
|
}
|
||||||
$data[0] = '<p style="font: bold '.$sizem.'em Arial, Sans-serif; color: #000000;">'.$value.'</p>';
|
$data[0] = '<p style="font: bold '.$sizem.'em Arial, Sans-serif; color: #000000;">'.$value.'</p>';
|
||||||
|
@ -2440,12 +2447,12 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
$table1->head[3] = __('SLA Limit');
|
$table1->head[3] = __('SLA Limit');
|
||||||
$table1->head[4] = __('Value');
|
$table1->head[4] = __('Value');
|
||||||
$table1->head[5] = __('Status');
|
$table1->head[5] = __('Status');
|
||||||
$table1->style[0] = 'text-align: center';
|
$table1->style[0] = 'text-align: left';
|
||||||
$table1->style[1] = 'text-align: center';
|
$table1->style[1] = 'text-align: left';
|
||||||
$table1->style[2] = 'text-align: center';
|
$table1->style[2] = 'text-align: right';
|
||||||
$table1->style[3] = 'text-align: center';
|
$table1->style[3] = 'text-align: right';
|
||||||
$table1->style[4] = 'text-align: center';
|
$table1->style[4] = 'text-align: right';
|
||||||
$table1->style[5] = 'text-align: center';
|
$table1->style[5] = 'text-align: right';
|
||||||
}
|
}
|
||||||
|
|
||||||
$data_graph = array ();
|
$data_graph = array ();
|
||||||
|
@ -2461,6 +2468,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
$data_horin_graph[__('Unknown')]['g'] = 0;
|
$data_horin_graph[__('Unknown')]['g'] = 0;
|
||||||
|
|
||||||
$sla_failed = false;
|
$sla_failed = false;
|
||||||
|
$total_SLA = 0;
|
||||||
|
$total_result_SLA = 'ok';
|
||||||
foreach ($slas as $sla) {
|
foreach ($slas as $sla) {
|
||||||
$server_name = $sla ['server_name'];
|
$server_name = $sla ['server_name'];
|
||||||
//Metaconsole connection
|
//Metaconsole connection
|
||||||
|
@ -2471,12 +2480,24 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Get the sla_value in % and store it on $sla_value
|
//Get the sla_value in % and store it on $sla_value
|
||||||
$sla_value = reporting_get_agentmodule_sla ($sla['id_agent_module'], $content['period'],
|
$sla_value = reporting_get_agentmodule_sla ($sla['id_agent_module'], $content['period'],
|
||||||
$sla['sla_min'], $sla['sla_max'], $report["datetime"], $content, $content['time_from'],
|
$sla['sla_min'], $sla['sla_max'], $report["datetime"], $content, $content['time_from'],
|
||||||
$content['time_to']);
|
$content['time_to']);
|
||||||
|
|
||||||
|
if ($sla_value === false) {
|
||||||
|
if ($total_result_SLA != 'fail')
|
||||||
|
$total_result_SLA = 'unknown';
|
||||||
|
}
|
||||||
|
else if ($sla_value >= $sla['sla_limit']) {
|
||||||
|
if ($total_result_SLA == 'ok')
|
||||||
|
$total_result_SLA = 'ok';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$total_result_SLA = 'fail';
|
||||||
|
}
|
||||||
|
|
||||||
//Fill the array data_graph for the pie graph
|
//Fill the array data_graph for the pie graph
|
||||||
if ($sla_value === false) {
|
if ($sla_value === false) {
|
||||||
$data_graph[__('Unknown')]++;
|
$data_graph[__('Unknown')]++;
|
||||||
|
@ -2494,10 +2515,12 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
$data_graph[__('Out of limits')]++;
|
$data_graph[__('Out of limits')]++;
|
||||||
$data_horin_graph[__('Out of limits')]['g']++;
|
$data_horin_graph[__('Out of limits')]['g']++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Do not show right modules if 'only_display_wrong' is active
|
//Do not show right modules if 'only_display_wrong' is active
|
||||||
if ($content['only_display_wrong'] == 1 && $sla_value >= $sla['sla_limit']) continue;
|
if ($content['only_display_wrong'] == 1 && $sla_value >= $sla['sla_limit']) continue;
|
||||||
|
|
||||||
|
$total_SLA += $sla_value;
|
||||||
|
|
||||||
if ($show_graph == 0 || $show_graph == 1) {
|
if ($show_graph == 0 || $show_graph == 1) {
|
||||||
$data = array ();
|
$data = array ();
|
||||||
$data[0] = modules_get_agentmodule_agent_name ($sla['id_agent_module']);
|
$data[0] = modules_get_agentmodule_agent_name ($sla['id_agent_module']);
|
||||||
|
@ -2505,11 +2528,12 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
$data[2] = $sla['sla_max'].'/';
|
$data[2] = $sla['sla_max'].'/';
|
||||||
$data[2] .= $sla['sla_min'];
|
$data[2] .= $sla['sla_min'];
|
||||||
$data[3] = $sla['sla_limit'];
|
$data[3] = $sla['sla_limit'];
|
||||||
|
|
||||||
if ($sla_value === false) {
|
if ($sla_value === false) {
|
||||||
$data[4] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #0000FF;">';
|
$data[4] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #0000FF;">';
|
||||||
$data[5] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #736F6E;">'.__('Unknown').'</span>';
|
$data[5] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #736F6E;">'.__('Unknown').'</span>';
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if ($sla_value >= $sla['sla_limit']) {
|
if ($sla_value >= $sla['sla_limit']) {
|
||||||
$data[4] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #000000;">';
|
$data[4] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #000000;">';
|
||||||
$data[5] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #000000;">'.__('OK').'</span>';
|
$data[5] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #000000;">'.__('OK').'</span>';
|
||||||
|
@ -2554,13 +2578,37 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
array_push ($table->data, $data);
|
array_push ($table->data, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->colspan[3][0] = 3;
|
$table->colspan[3][0] = 2;
|
||||||
$data = array();
|
$data = array();
|
||||||
$data_pie_graph = json_encode ($data_graph);
|
$data_pie_graph = json_encode ($data_graph);
|
||||||
if (($show_graph == 1 || $show_graph == 2) && !empty($slas)) {
|
if (($show_graph == 1 || $show_graph == 2) && !empty($slas)) {
|
||||||
$data[0] = pie3d_graph(false, $data_graph,
|
$data[0] = pie3d_graph(false, $data_graph,
|
||||||
500, 150, __("other"), "", $config['homedir'] . "/images/logo_vertical_water.png",
|
500, 150, __("other"), "", $config['homedir'] . "/images/logo_vertical_water.png",
|
||||||
$config['fontpath'], $config['font_size']);
|
$config['fontpath'], $config['font_size']);
|
||||||
|
|
||||||
|
|
||||||
|
//Print resume
|
||||||
|
$table_resume = null;
|
||||||
|
$table_resume->head[0] = __('Resume Value');
|
||||||
|
$table_resume->head[1] = __('Status');
|
||||||
|
if ($total_result_SLA == 'ok') {
|
||||||
|
$table_resume->data[0][0] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #000000;">';
|
||||||
|
$table_resume->data[0][1] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #000000;">'.__('OK').'</span>';
|
||||||
|
}
|
||||||
|
if ($total_result_SLA == 'fail') {
|
||||||
|
$table_resume->data[0][0] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #ff0000;">';
|
||||||
|
$table_resume->data[0][1] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #ff0000;">'.__('Fail').'</span>';
|
||||||
|
}
|
||||||
|
if ($total_result_SLA == 'unknown') {
|
||||||
|
$table_resume->data[0][0] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #0000FF;">';
|
||||||
|
$table_resume->data[0][1] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #736F6E;">'.__('Unknown').'</span>';
|
||||||
|
}
|
||||||
|
$table_resume->data[0][0] .= (int)($total_SLA / count($slas));
|
||||||
|
$table_resume->data[0][0] .= "%</span>";
|
||||||
|
|
||||||
|
$data[1] = html_print_table($table_resume, true);
|
||||||
|
|
||||||
|
|
||||||
array_push ($table->data, $data);
|
array_push ($table->data, $data);
|
||||||
|
|
||||||
//Display horizontal bar graphs
|
//Display horizontal bar graphs
|
||||||
|
@ -2640,12 +2688,13 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
|
|
||||||
$data = array ();
|
$data = array ();
|
||||||
$table->colspan[2][0] = 3;
|
$table->colspan[2][0] = 3;
|
||||||
|
$unit = db_get_value('unit', 'tagente_modulo', 'id_agente_modulo', $content['id_agent_module']);
|
||||||
$value = reporting_get_agentmodule_data_average ($content['id_agent_module'], $content['period'], $report["datetime"]);
|
$value = reporting_get_agentmodule_data_average ($content['id_agent_module'], $content['period'], $report["datetime"]);
|
||||||
if ($value === false) {
|
if ($value === false) {
|
||||||
$value = __('Unknown');
|
$value = __('Unknown');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$value = format_numeric ($value);
|
$value = format_for_graph($value, 2) . " " . $unit;
|
||||||
}
|
}
|
||||||
$data[0] = '<p style="font: bold '.$sizem.'em Arial, Sans-serif; color: #000000;">'.$value.'</p>';
|
$data[0] = '<p style="font: bold '.$sizem.'em Arial, Sans-serif; color: #000000;">'.$value.'</p>';
|
||||||
array_push ($table->data, $data);
|
array_push ($table->data, $data);
|
||||||
|
@ -2669,7 +2718,9 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
$data = array ();
|
$data = array ();
|
||||||
$table->colspan[2][0] = 3;
|
$table->colspan[2][0] = 3;
|
||||||
$value = format_numeric (reporting_get_agentmodule_data_max ($content['id_agent_module'], $content['period'], $report["datetime"]));
|
$value = format_numeric (reporting_get_agentmodule_data_max ($content['id_agent_module'], $content['period'], $report["datetime"]));
|
||||||
$data[0] = '<p style="font: bold '.$sizem.'em Arial, Sans-serif; color: #000000;">'.$value.'</p>';
|
$unit = db_get_value('unit', 'tagente_modulo', 'id_agente_modulo', $content ['id_agent_module']);
|
||||||
|
$data[0] = '<p style="font: bold '.$sizem.'em Arial, Sans-serif; color: #000000;">' .
|
||||||
|
format_for_graph($value, 2) . " " . $unit .'</p>';
|
||||||
array_push ($table->data, $data);
|
array_push ($table->data, $data);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -2691,10 +2742,12 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
$data = array ();
|
$data = array ();
|
||||||
$table->colspan[1][0] = 2;
|
$table->colspan[1][0] = 2;
|
||||||
$value = reporting_get_agentmodule_data_min ($content['id_agent_module'], $content['period'], $report["datetime"]);
|
$value = reporting_get_agentmodule_data_min ($content['id_agent_module'], $content['period'], $report["datetime"]);
|
||||||
|
$unit = db_get_value('unit', 'tagente_modulo', 'id_agente_modulo', $content ['id_agent_module']);
|
||||||
if ($value === false) {
|
if ($value === false) {
|
||||||
$value = __('Unknown');
|
$value = __('Unknown');
|
||||||
} else {
|
}
|
||||||
$value = format_numeric ($value);
|
else {
|
||||||
|
$value = format_for_graph($value, 2) . " " . $unit;
|
||||||
}
|
}
|
||||||
$data[0] = '<p style="font: bold '.$sizem.'em Arial, Sans-serif; color: #000000;">'.$value.'</p>';
|
$data[0] = '<p style="font: bold '.$sizem.'em Arial, Sans-serif; color: #000000;">'.$value.'</p>';
|
||||||
array_push ($table->data, $data);
|
array_push ($table->data, $data);
|
||||||
|
@ -2717,13 +2770,16 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
|
|
||||||
$data = array ();
|
$data = array ();
|
||||||
$table->colspan[1][0] = 2;
|
$table->colspan[1][0] = 2;
|
||||||
|
$unit = db_get_value('unit', 'tagente_modulo', 'id_agente_modulo', $content['id_agent_module']);
|
||||||
|
|
||||||
$value = reporting_get_agentmodule_data_sum ($content['id_agent_module'], $content['period'], $report["datetime"]);
|
$value = reporting_get_agentmodule_data_sum ($content['id_agent_module'], $content['period'], $report["datetime"]);
|
||||||
if ($value === false) {
|
if ($value === false) {
|
||||||
$value = __('Unknown');
|
$value = __('Unknown');
|
||||||
} else {
|
|
||||||
$value = format_numeric ($value);
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$value = format_for_graph($value, 2) . " " . $unit;
|
||||||
|
}
|
||||||
|
|
||||||
$data[0] = '<p style="font: bold '.$sizem.'em Arial, Sans-serif; color: #000000;">'.$value.'</p>';
|
$data[0] = '<p style="font: bold '.$sizem.'em Arial, Sans-serif; color: #000000;">'.$value.'</p>';
|
||||||
array_push ($table->data, $data);
|
array_push ($table->data, $data);
|
||||||
|
|
||||||
|
@ -3113,7 +3169,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
array_push ($table->data, $data);
|
array_push ($table->data, $data);
|
||||||
break;
|
break;
|
||||||
case 'group_report':
|
case 'group_report':
|
||||||
$group_name = groups_get_name($content['id_group']);
|
$group_name = groups_get_name($content['id_group'], true);
|
||||||
$group_stats = reporting_get_group_stats($content['id_group']);
|
$group_stats = reporting_get_group_stats($content['id_group']);
|
||||||
// Get events of the last 8 hours
|
// Get events of the last 8 hours
|
||||||
$events = events_get_group_events ($content['id_group'], 28800, $report['datetime']);
|
$events = events_get_group_events ($content['id_group'], 28800, $report['datetime']);
|
||||||
|
@ -3208,8 +3264,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
//0 means not group by agent
|
//0 means not group by agent
|
||||||
case 0:
|
case 0:
|
||||||
$sql = sprintf("select id_agent_module, server_name from treport_content_item
|
$sql = sprintf("select id_agent_module, server_name from treport_content_item
|
||||||
where id_report_content = %d", $content['id_rc']);
|
where id_report_content = %d", $content['id_rc']);
|
||||||
|
|
||||||
$generals = db_process_sql ($sql);
|
$generals = db_process_sql ($sql);
|
||||||
if ($generals === false) {
|
if ($generals === false) {
|
||||||
$data = array ();
|
$data = array ();
|
||||||
|
@ -3225,9 +3281,9 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
$table1->head[0] = __('Agent');
|
$table1->head[0] = __('Agent');
|
||||||
$table1->head[1] = __('Module');
|
$table1->head[1] = __('Module');
|
||||||
$table1->head[2] = __('Value');
|
$table1->head[2] = __('Value');
|
||||||
$table1->style[0] = 'text-align: center';
|
$table1->style[0] = 'text-align: left';
|
||||||
$table1->style[1] = 'text-align: center';
|
$table1->style[1] = 'text-align: left';
|
||||||
$table1->style[2] = 'text-align: center';
|
$table1->style[2] = 'text-align: right';
|
||||||
|
|
||||||
$data_avg = array();
|
$data_avg = array();
|
||||||
foreach ($generals as $key => $row) {
|
foreach ($generals as $key => $row) {
|
||||||
|
@ -3243,11 +3299,13 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
|
|
||||||
$mod_name = modules_get_agentmodule_name ($row['id_agent_module']);
|
$mod_name = modules_get_agentmodule_name ($row['id_agent_module']);
|
||||||
$ag_name = modules_get_agentmodule_agent_name ($row['id_agent_module']);
|
$ag_name = modules_get_agentmodule_agent_name ($row['id_agent_module']);
|
||||||
|
$unit = db_get_value('unit', 'tagente_modulo', 'id_agente_modulo', $row ['id_agent_module']);
|
||||||
|
|
||||||
$data_avg[$key] = reporting_get_agentmodule_data_average ($row['id_agent_module'], $content['period']);
|
$data_avg[$key] = reporting_get_agentmodule_data_average ($row['id_agent_module'], $content['period']);
|
||||||
$id_agent_module[$key] = $row['id_agent_module'];
|
$id_agent_module[$key] = $row['id_agent_module'];
|
||||||
$agent_name[$key] = $ag_name;
|
$agent_name[$key] = $ag_name;
|
||||||
$module_name[$key] = $mod_name;
|
$module_name[$key] = $mod_name;
|
||||||
|
$units[$key] = $unit;
|
||||||
|
|
||||||
//Restore dbconnection
|
//Restore dbconnection
|
||||||
if (($config ['metaconsole'] == 1) && $server_name != '') {
|
if (($config ['metaconsole'] == 1) && $server_name != '') {
|
||||||
|
@ -3271,7 +3329,12 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
$data = array();
|
$data = array();
|
||||||
$data[0] = $agent_name[$i];
|
$data[0] = $agent_name[$i];
|
||||||
$data[1] = $module_name[$i];
|
$data[1] = $module_name[$i];
|
||||||
$d === false ? $data[2] = '--':$data[2] = $d;
|
if ($d === false) {
|
||||||
|
$data[2] = '--';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$data[2] = format_for_graph($d, 2) . " " . $units[$i];
|
||||||
|
}
|
||||||
array_push ($table1->data, $data);
|
array_push ($table1->data, $data);
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
@ -3284,7 +3347,12 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
$data = array();
|
$data = array();
|
||||||
$data[0] = $agent_name[$i];
|
$data[0] = $agent_name[$i];
|
||||||
$data[1] = $module_name[$i];
|
$data[1] = $module_name[$i];
|
||||||
$data_avg[$i] === false ? $data[2] = '--':$data[2] = $data_avg[$i];
|
if ($data_avg[$i] === false) {
|
||||||
|
$data[2] = '--';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$data[2] = format_for_graph($data_avg[$i], 2) . " " . $units[$i];
|
||||||
|
}
|
||||||
array_push ($table1->data, $data);
|
array_push ($table1->data, $data);
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
@ -3299,7 +3367,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
case 1:
|
case 1:
|
||||||
//Get the data
|
//Get the data
|
||||||
$sql_data = sprintf("select id_agent_module, server_name from treport_content_item
|
$sql_data = sprintf("select id_agent_module, server_name from treport_content_item
|
||||||
where id_report_content = %d", $content['id_rc']);
|
where id_report_content = %d", $content['id_rc']);
|
||||||
$generals = db_process_sql ($sql_data);
|
$generals = db_process_sql ($sql_data);
|
||||||
|
|
||||||
if ($generals === false) {
|
if ($generals === false) {
|
||||||
|
@ -3370,6 +3438,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
|
|
||||||
$agent_name = modules_get_agentmodule_agent_name ($g['id_agent_module']);
|
$agent_name = modules_get_agentmodule_agent_name ($g['id_agent_module']);
|
||||||
$module_name = modules_get_agentmodule_name ($g['id_agent_module']);
|
$module_name = modules_get_agentmodule_name ($g['id_agent_module']);
|
||||||
|
$unit = db_get_value('unit', 'tagente_modulo', 'id_agente_modulo', $g['id_agent_module']);
|
||||||
$found = false;
|
$found = false;
|
||||||
if (strcmp($a, $agent_name) == 0 && strcmp($m, $module_name) == 0) {
|
if (strcmp($a, $agent_name) == 0 && strcmp($m, $module_name) == 0) {
|
||||||
$value_avg = reporting_get_agentmodule_data_average($g['id_agent_module'], $content['period']);
|
$value_avg = reporting_get_agentmodule_data_average($g['id_agent_module'], $content['period']);
|
||||||
|
@ -3377,7 +3446,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
if ($value_avg === false) {
|
if ($value_avg === false) {
|
||||||
$data[$i] = '--';
|
$data[$i] = '--';
|
||||||
} else {
|
} else {
|
||||||
$data[$i] = $value_avg;
|
$data[$i] = format_for_graph($value_avg, 2) . " " . $unit;
|
||||||
}
|
}
|
||||||
$found = true;
|
$found = true;
|
||||||
}
|
}
|
||||||
|
@ -3473,19 +3542,20 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
unset($table_summary);
|
unset($table_summary);
|
||||||
|
|
||||||
$table_summary->width = '99%';
|
$table_summary->width = '99%';
|
||||||
|
|
||||||
$table_summary->data = array ();
|
$table_summary->data = array ();
|
||||||
$table_summary->head = array ();
|
$table_summary->head = array ();
|
||||||
$table_summary->head[0] = __('Min Value');
|
$table_summary->head[0] = __('Min Value');
|
||||||
$table_summary->head[1] = __('Average Value');
|
$table_summary->head[1] = __('Average Value');
|
||||||
$table_summary->head[2] = __('Max Value');
|
$table_summary->head[2] = __('Max Value');
|
||||||
|
|
||||||
$table_summary->data[0][0] = round($min,2);
|
$table_summary->data[0][0] = format_for_graph($min,2);
|
||||||
$table_summary->data[0][1] = round($avg,2);
|
$table_summary->data[0][1] = format_for_graph($avg,2);
|
||||||
$table_summary->data[0][2] = round($max,2);
|
$table_summary->data[0][2] = format_for_graph($max,2);
|
||||||
|
|
||||||
$table->colspan[5][0] = 2;
|
$table->colspan[3][0] = 3;
|
||||||
array_push ($table->data, array('<b>'.__('Summary').'</b>'));
|
array_push ($table->data, array('<b>'.__('Summary').'</b>'));
|
||||||
$table->colspan[6][0] = 2;
|
$table->colspan[4][0] = 3;
|
||||||
array_push ($table->data, array(html_print_table($table_summary, true)));
|
array_push ($table->data, array(html_print_table($table_summary, true)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -3499,10 +3569,6 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
|
|
||||||
$table->style[0] = 'padding: 8px 5px 8px 5px;';
|
$table->style[0] = 'padding: 8px 5px 8px 5px;';
|
||||||
$table->style[1] = 'text-align: right';
|
$table->style[1] = 'text-align: right';
|
||||||
$data = array ();
|
|
||||||
$data[0] = $sizh.__('Top').' '.$content['top_n_value'].$sizhfin;
|
|
||||||
$data[1] = $sizh.human_time_description_raw ($content['period']).$sizhfin;
|
|
||||||
array_push ($table->data, $data);
|
|
||||||
|
|
||||||
// Put description at the end of the module (if exists)
|
// Put description at the end of the module (if exists)
|
||||||
$table->colspan[1][0] = 3;
|
$table->colspan[1][0] = 3;
|
||||||
|
@ -3512,8 +3578,9 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
array_push ($table->data, $data_desc);
|
array_push ($table->data, $data_desc);
|
||||||
}
|
}
|
||||||
//Get all the related data
|
//Get all the related data
|
||||||
$sql = sprintf("select id_agent_module, server_name from treport_content_item
|
$sql = sprintf("select id_agent_module, server_name
|
||||||
where id_report_content = %d", $content['id_rc']);
|
from treport_content_item
|
||||||
|
where id_report_content = %d", $content['id_rc']);
|
||||||
|
|
||||||
$tops = db_process_sql ($sql);
|
$tops = db_process_sql ($sql);
|
||||||
|
|
||||||
|
@ -3524,7 +3591,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
array_push ($table->data, $data);
|
array_push ($table->data, $data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($show_graph == 0 || $show_graph == 1) {
|
if ($show_graph == 0 || $show_graph == 1) {
|
||||||
$table1->width = '99%';
|
$table1->width = '99%';
|
||||||
$table1->data = array ();
|
$table1->data = array ();
|
||||||
|
@ -3549,9 +3616,11 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$ag_name = modules_get_agentmodule_agent_name($row ['id_agent_module']);
|
$ag_name = modules_get_agentmodule_agent_name($row ['id_agent_module']);
|
||||||
$mod_name = modules_get_agentmodule_name ($row ['id_agent_module']);
|
$mod_name = modules_get_agentmodule_name ($row ['id_agent_module']);
|
||||||
|
$unit = db_get_value('unit', 'tagente_modulo', 'id_agente_modulo', $row ['id_agent_module']);
|
||||||
|
|
||||||
|
|
||||||
switch ($top_n) {
|
switch ($top_n) {
|
||||||
//Max
|
//Max
|
||||||
|
@ -3575,6 +3644,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
$id_agent_module[$key] = $row['id_agent_module'];
|
$id_agent_module[$key] = $row['id_agent_module'];
|
||||||
$agent_name[$key] = $ag_name;
|
$agent_name[$key] = $ag_name;
|
||||||
$module_name[$key] = $mod_name;
|
$module_name[$key] = $mod_name;
|
||||||
|
$units[$key] = $unit;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Restore dbconnection
|
//Restore dbconnection
|
||||||
|
@ -3610,7 +3680,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
$data_top_values['agent_name'] = $agent_name;
|
$data_top_values['agent_name'] = $agent_name;
|
||||||
$data_top_values['module_name'] = $module_name;
|
$data_top_values['module_name'] = $module_name;
|
||||||
$data_top_values['id_agent_module'] = $id_agent_module;
|
$data_top_values['id_agent_module'] = $id_agent_module;
|
||||||
|
|
||||||
array_splice ($data_top, $top_n_value);
|
array_splice ($data_top, $top_n_value);
|
||||||
array_splice ($agent_name, $top_n_value);
|
array_splice ($agent_name, $top_n_value);
|
||||||
array_splice ($module_name, $top_n_value);
|
array_splice ($module_name, $top_n_value);
|
||||||
|
@ -3634,7 +3704,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
|
|
||||||
// Define truncate size depends the graph width
|
// Define truncate size depends the graph width
|
||||||
$truncate_size = $sizgraph_w / (4 * ($config['font_size']))-1;
|
$truncate_size = $sizgraph_w / (4 * ($config['font_size']))-1;
|
||||||
|
|
||||||
if ($order_uptodown == 1 || $order_uptodown == 2) {
|
if ($order_uptodown == 1 || $order_uptodown == 2) {
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$data_pie_graph = array();
|
$data_pie_graph = array();
|
||||||
|
@ -3653,8 +3723,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
$data = array();
|
$data = array();
|
||||||
$data[0] = $agent_name[$i];
|
$data[0] = $agent_name[$i];
|
||||||
$data[1] = $module_name[$i];
|
$data[1] = $module_name[$i];
|
||||||
|
|
||||||
$data[2] = round($dt,2);
|
$data[2] = format_for_graph($dt,2) . " " . $units[$i];
|
||||||
array_push ($table1->data, $data);
|
array_push ($table1->data, $data);
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
|
@ -3676,9 +3746,9 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
$data_hbar[$item_name]['g'] = $data_top[$i];
|
$data_hbar[$item_name]['g'] = $data_top[$i];
|
||||||
if ($show_graph == 0 || $show_graph == 1) {
|
if ($show_graph == 0 || $show_graph == 1) {
|
||||||
$data = array();
|
$data = array();
|
||||||
$data[0] = printSmallFont($an);
|
$data[0] = $an;
|
||||||
$data[1] = printSmallFont($module_name[$i]);
|
$data[1] = $module_name[$i];
|
||||||
$data[2] = $data_top[$i];
|
$data[2] = format_for_graph($data_top[$i],2) . " " . $units[$i];
|
||||||
array_push ($table1->data, $data);
|
array_push ($table1->data, $data);
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
|
@ -3709,7 +3779,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
$height = count($data_pie_graph)*20+35;
|
$height = count($data_pie_graph)*20+35;
|
||||||
$data = array();
|
$data = array();
|
||||||
$data[0] = hbar_graph(false, $data_hbar, $sizgraph_w, $height, array(), array(), "", "", true, "", $config['homedir'] . "/images/logo_vertical_water.png", $config['fontpath'], $config['font_size'], true, 1, true);
|
$data[0] = hbar_graph(false, $data_hbar, $sizgraph_w, $height, array(), array(), "", "", true, "", $config['homedir'] . "/images/logo_vertical_water.png", $config['fontpath'], $config['font_size'], true, 1, true);
|
||||||
|
|
||||||
array_push ($table->data, $data);
|
array_push ($table->data, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3723,7 +3793,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
while ($min === false && $i < count($data_top_values));
|
while ($min === false && $i < count($data_top_values));
|
||||||
$max = $min;
|
$max = $min;
|
||||||
$avg = 0;
|
$avg = 0;
|
||||||
|
|
||||||
$i=0;
|
$i=0;
|
||||||
foreach ($data_top_values['data_top'] as $key => $dtv) {
|
foreach ($data_top_values['data_top'] as $key => $dtv) {
|
||||||
if ($dtv < $min) $min = $dtv;
|
if ($dtv < $min) $min = $dtv;
|
||||||
|
@ -3742,13 +3812,13 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
$table_summary->head[1] = __('Average Value');
|
$table_summary->head[1] = __('Average Value');
|
||||||
$table_summary->head[2] = __('Max Value');
|
$table_summary->head[2] = __('Max Value');
|
||||||
|
|
||||||
$table_summary->data[0][0] = round($min,2);
|
$table_summary->data[0][0] = format_for_graph($min, 2);
|
||||||
$table_summary->data[0][1] = round($avg,2);
|
$table_summary->data[0][1] = format_for_graph($avg, 2);
|
||||||
$table_summary->data[0][2] = round($max,2);
|
$table_summary->data[0][2] = format_for_graph($max, 2);
|
||||||
|
|
||||||
$table->colspan[5][0] = 2;
|
$table->colspan[5][0] = 3;
|
||||||
array_push ($table->data, array('<b>'.__('Summary').'</b>'));
|
array_push ($table->data, array('<b>'.__('Summary').'</b>'));
|
||||||
$table->colspan[6][0] = 2;
|
$table->colspan[6][0] = 3;
|
||||||
array_push ($table->data, array(html_print_table($table_summary, true)));
|
array_push ($table->data, array(html_print_table($table_summary, true)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -3799,7 +3869,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
array_push ($table->data, $data);
|
array_push ($table->data, $data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($show_graph == 0 || $show_graph == 1) {
|
if ($show_graph == 0 || $show_graph == 1) {
|
||||||
$table1->width = '99%';
|
$table1->width = '99%';
|
||||||
$table1->data = array ();
|
$table1->data = array ();
|
||||||
|
@ -3807,9 +3877,9 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
$table1->head[0] = __('Agent');
|
$table1->head[0] = __('Agent');
|
||||||
$table1->head[1] = __('Module');
|
$table1->head[1] = __('Module');
|
||||||
$table1->head[2] = __('Value');
|
$table1->head[2] = __('Value');
|
||||||
$table1->style[0] = 'text-align: center';
|
$table1->style[0] = 'text-align: left';
|
||||||
$table1->style[1] = 'text-align: center';
|
$table1->style[1] = 'text-align: left';
|
||||||
$table1->style[2] = 'text-align: center';
|
$table1->style[2] = 'text-align: right';
|
||||||
}
|
}
|
||||||
|
|
||||||
//Get the very first not null value
|
//Get the very first not null value
|
||||||
|
@ -3850,6 +3920,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
|
|
||||||
$ag_name = modules_get_agentmodule_agent_name ($exc ['id_agent_module']);
|
$ag_name = modules_get_agentmodule_agent_name ($exc ['id_agent_module']);
|
||||||
$mod_name = modules_get_agentmodule_name ($exc ['id_agent_module']);
|
$mod_name = modules_get_agentmodule_name ($exc ['id_agent_module']);
|
||||||
|
$unit = db_get_value('unit', 'tagente_modulo', 'id_agente_modulo', $exc ['id_agent_module']);
|
||||||
|
|
||||||
$value = reporting_get_agentmodule_data_average ($exc['id_agent_module'], $content['period']);
|
$value = reporting_get_agentmodule_data_average ($exc['id_agent_module'], $content['period']);
|
||||||
if ($value !== false) {
|
if ($value !== false) {
|
||||||
|
@ -3894,6 +3965,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
$id_agent_module[] = $exc['id_agent_module'];
|
$id_agent_module[] = $exc['id_agent_module'];
|
||||||
$agent_name[] = $ag_name;
|
$agent_name[] = $ag_name;
|
||||||
$module_name[] = $mod_name;
|
$module_name[] = $mod_name;
|
||||||
|
$units[] = $unit;
|
||||||
}
|
}
|
||||||
//Restore dbconnection
|
//Restore dbconnection
|
||||||
if (($config ['metaconsole'] == 1) && $server_name != '') {
|
if (($config ['metaconsole'] == 1) && $server_name != '') {
|
||||||
|
@ -3928,7 +4000,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
//$i > 0 means that there is at least one row on the table
|
//$i > 0 means that there is at least one row on the table
|
||||||
elseif ($i > 0) {
|
elseif ($i > 0) {
|
||||||
$avg = $avg / $i;
|
$avg = $avg / $i;
|
||||||
|
|
||||||
switch ($order_uptodown) {
|
switch ($order_uptodown) {
|
||||||
//Order descending
|
//Order descending
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -3944,7 +4016,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
array_multisort($agent_name, SORT_ASC, $data_exceptions, SORT_ASC, $module_name, SORT_ASC, $id_agent_module, SORT_ASC);
|
array_multisort($agent_name, SORT_ASC, $data_exceptions, SORT_ASC, $module_name, SORT_ASC, $id_agent_module, SORT_ASC);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($order_uptodown == 1 || $order_uptodown == 2) {
|
if ($order_uptodown == 1 || $order_uptodown == 2) {
|
||||||
$j=0;
|
$j=0;
|
||||||
$data_pie_graph = array();
|
$data_pie_graph = array();
|
||||||
|
@ -3956,7 +4028,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
$data = array();
|
$data = array();
|
||||||
$data[0] = $agent_name[$j];
|
$data[0] = $agent_name[$j];
|
||||||
$data[1] = $module_name[$j];
|
$data[1] = $module_name[$j];
|
||||||
$data[2] = $dex;
|
$data[2] = format_for_graph($dex, 2) . " " . $units[$j];
|
||||||
array_push ($table1->data, $data);
|
array_push ($table1->data, $data);
|
||||||
}
|
}
|
||||||
$j++;
|
$j++;
|
||||||
|
@ -3973,7 +4045,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
$data = array();
|
$data = array();
|
||||||
$data[0] = $an;
|
$data[0] = $an;
|
||||||
$data[1] = $module_name[$j];
|
$data[1] = $module_name[$j];
|
||||||
$data[2] = $data_exceptions[$j];
|
$data[2] = format_for_graph($data_exceptions[$j], 2) . " " . $units[$j];
|
||||||
array_push ($table1->data, $data);
|
array_push ($table1->data, $data);
|
||||||
}
|
}
|
||||||
$j++;
|
$j++;
|
||||||
|
@ -3989,7 +4061,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->colspan[3][0] = 3;
|
$table->colspan[3][0] = 3;
|
||||||
$table->style[0] .= 'text-align: center';
|
|
||||||
$data = array();
|
$data = array();
|
||||||
if ($show_graph == 1 || $show_graph == 2) {
|
if ($show_graph == 1 || $show_graph == 2) {
|
||||||
$data[0] = pie3d_graph(false, $data_pie_graph,
|
$data[0] = pie3d_graph(false, $data_pie_graph,
|
||||||
|
@ -4016,13 +4088,13 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
$table_summary->head[1] = __('Average Value');
|
$table_summary->head[1] = __('Average Value');
|
||||||
$table_summary->head[2] = __('Max Value');
|
$table_summary->head[2] = __('Max Value');
|
||||||
|
|
||||||
$table_summary->data[0][0] = round($min,2);
|
$table_summary->data[0][0] = format_for_graph($min,2);
|
||||||
$table_summary->data[0][1] = round($avg,2);
|
$table_summary->data[0][1] = format_for_graph($avg,2);
|
||||||
$table_summary->data[0][2] = round($max,2);
|
$table_summary->data[0][2] = format_for_graph($max,2);
|
||||||
|
|
||||||
$table->colspan[5][0] = 2;
|
$table->colspan[5][0] = 3;
|
||||||
array_push ($table->data, array('<b>'.__('Summary').'</b>'));
|
array_push ($table->data, array('<b>'.__('Summary').'</b>'));
|
||||||
$table->colspan[6][0] = 2;
|
$table->colspan[6][0] = 3;
|
||||||
array_push ($table->data, array(html_print_table($table_summary, true)));
|
array_push ($table->data, array(html_print_table($table_summary, true)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue