Merge branch '851-new-report-type-max+min+avg-dev' into 'develop'
851 new report type max+min+avg dev See merge request !463
This commit is contained in:
commit
2ec69160e3
|
@ -120,6 +120,7 @@ switch ($action) {
|
||||||
$description = null;
|
$description = null;
|
||||||
$sql = null;
|
$sql = null;
|
||||||
$show_in_two_columns = 0;
|
$show_in_two_columns = 0;
|
||||||
|
$show_in_same_row = 0;
|
||||||
$show_in_landscape = 0;
|
$show_in_landscape = 0;
|
||||||
$hide_notinit_agents = 0;
|
$hide_notinit_agents = 0;
|
||||||
$server_name = '';
|
$server_name = '';
|
||||||
|
@ -158,6 +159,7 @@ switch ($action) {
|
||||||
$description = null;
|
$description = null;
|
||||||
$sql = null;
|
$sql = null;
|
||||||
$show_in_two_columns = 0;
|
$show_in_two_columns = 0;
|
||||||
|
$show_in_same_row = 0;
|
||||||
$show_in_landscape = 0;
|
$show_in_landscape = 0;
|
||||||
$hide_notinit_agents = 0;
|
$hide_notinit_agents = 0;
|
||||||
$server_name = '';
|
$server_name = '';
|
||||||
|
@ -182,6 +184,7 @@ switch ($action) {
|
||||||
|
|
||||||
$style = json_decode(io_safe_output($item['style']), true);
|
$style = json_decode(io_safe_output($item['style']), true);
|
||||||
|
|
||||||
|
$show_in_same_row = $style['show_in_same_row'];
|
||||||
$show_in_two_columns = $style['show_in_two_columns'];
|
$show_in_two_columns = $style['show_in_two_columns'];
|
||||||
$show_in_landscape = $style['show_in_landscape'];
|
$show_in_landscape = $style['show_in_landscape'];
|
||||||
$hide_notinit_agents = $style['hide_notinit_agents'];
|
$hide_notinit_agents = $style['hide_notinit_agents'];
|
||||||
|
@ -1480,6 +1483,20 @@ You can of course remove the warnings, that's why we include the source and do n
|
||||||
<td style="font-weight:bold;"><?php echo __('Show in two columns');?></td>
|
<td style="font-weight:bold;"><?php echo __('Show in two columns');?></td>
|
||||||
<td><?php html_print_checkbox('show_in_two_columns', 1, $show_in_two_columns);?></td>
|
<td><?php html_print_checkbox('show_in_two_columns', 1, $show_in_two_columns);?></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr id="row_show_in_same_row" style="" class="datos">
|
||||||
|
<td style="font-weight:bold;" class="datos">
|
||||||
|
<?php
|
||||||
|
echo __('Show in the same row');
|
||||||
|
ui_print_help_tip(__('Show one module per row with all its operations'));
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
<td style="">
|
||||||
|
<?php
|
||||||
|
html_print_checkbox('show_in_same_row', '1', $show_in_same_row, false, false, '');
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr id="row_sort" style="" class="datos">
|
<tr id="row_sort" style="" class="datos">
|
||||||
<td style="font-weight:bold;"><?php echo __('Order') . ui_print_help_tip(__('SLA items sorted by fulfillment value'), true);?></td>
|
<td style="font-weight:bold;"><?php echo __('Order') . ui_print_help_tip(__('SLA items sorted by fulfillment value'), true);?></td>
|
||||||
|
@ -2591,6 +2608,7 @@ function chooseType() {
|
||||||
$("#row_exception_condition_value").hide();
|
$("#row_exception_condition_value").hide();
|
||||||
$("#row_exception_condition").hide();
|
$("#row_exception_condition").hide();
|
||||||
$("#row_show_in_two_columns").hide();
|
$("#row_show_in_two_columns").hide();
|
||||||
|
$("#row_show_in_same_row").hide();
|
||||||
$("#row_historical_db_check").hide();
|
$("#row_historical_db_check").hide();
|
||||||
$("#row_show_in_landscape").hide();
|
$("#row_show_in_landscape").hide();
|
||||||
$('#row_hide_notinit_agents').hide();
|
$('#row_hide_notinit_agents').hide();
|
||||||
|
@ -3025,6 +3043,7 @@ function chooseType() {
|
||||||
$("#row_order_uptodown").show();
|
$("#row_order_uptodown").show();
|
||||||
$("#row_show_resume").show();
|
$("#row_show_resume").show();
|
||||||
$("#row_show_in_two_columns").show();
|
$("#row_show_in_two_columns").show();
|
||||||
|
$("#row_show_in_same_row").show();
|
||||||
|
|
||||||
var checked = $("input[name='last_value']").prop("checked");
|
var checked = $("input[name='last_value']").prop("checked");
|
||||||
|
|
||||||
|
|
|
@ -1140,6 +1140,7 @@ switch ($action) {
|
||||||
|
|
||||||
$style = array();
|
$style = array();
|
||||||
$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_same_row'] = get_parameter('show_in_same_row', 0);
|
||||||
$style['show_in_landscape'] = get_parameter('show_in_landscape', 0);
|
$style['show_in_landscape'] = get_parameter('show_in_landscape', 0);
|
||||||
$style['hide_notinit_agents'] = get_parameter('hide_notinit_agents', 0);
|
$style['hide_notinit_agents'] = get_parameter('hide_notinit_agents', 0);
|
||||||
|
|
||||||
|
@ -1461,6 +1462,7 @@ switch ($action) {
|
||||||
|
|
||||||
$style = array();
|
$style = array();
|
||||||
$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_same_row'] = get_parameter('show_in_same_row', 0);
|
||||||
$style['show_in_landscape'] = get_parameter('show_in_landscape', 0);
|
$style['show_in_landscape'] = get_parameter('show_in_landscape', 0);
|
||||||
$style['hide_notinit_agents'] = get_parameter('hide_notinit_agents', 0);
|
$style['hide_notinit_agents'] = get_parameter('hide_notinit_agents', 0);
|
||||||
|
|
||||||
|
|
|
@ -5473,9 +5473,8 @@ function reporting_availability_graph($report, $content, $pdf=false) {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function reporting_general($report, $content) {
|
function reporting_general($report, $content) {
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$return = array();
|
$return = array();
|
||||||
$return['type'] = 'general';
|
$return['type'] = 'general';
|
||||||
$return['subtype'] = $content['group_by_agent'];
|
$return['subtype'] = $content['group_by_agent'];
|
||||||
|
@ -5503,6 +5502,7 @@ function reporting_general($report, $content) {
|
||||||
$return["max"]["formated_value"] = null;
|
$return["max"]["formated_value"] = null;
|
||||||
$return["max"]["agent"] = null;
|
$return["max"]["agent"] = null;
|
||||||
$return["max"]["module"] = null;
|
$return["max"]["module"] = null;
|
||||||
|
$return["show_in_same_row"] = $content['style']['show_in_same_row'];
|
||||||
|
|
||||||
if (empty($content['subitems'])) {
|
if (empty($content['subitems'])) {
|
||||||
$generals = db_get_all_rows_filter(
|
$generals = db_get_all_rows_filter(
|
||||||
|
@ -5696,8 +5696,9 @@ function reporting_general($report, $content) {
|
||||||
$data = array();
|
$data = array();
|
||||||
$data['agent'] = $agent_name[$i];
|
$data['agent'] = $agent_name[$i];
|
||||||
$data['module'] = $module_name[$i];
|
$data['module'] = $module_name[$i];
|
||||||
|
$data['id_agent_module'] = $id_agent_module[$i];
|
||||||
|
$data['id_agent'] = agents_get_agent_id_by_module_id($id_agent_module[$i]);
|
||||||
|
|
||||||
$data['operator'] = "";
|
$data['operator'] = "";
|
||||||
if ($content['period'] != 0) {
|
if ($content['period'] != 0) {
|
||||||
switch ($operations[$i]) {
|
switch ($operations[$i]) {
|
||||||
|
|
|
@ -2578,46 +2578,85 @@ function get_agent_first_time ($agent_name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function reporting_html_general(&$table, $item) {
|
function reporting_html_general(&$table, $item) {
|
||||||
|
|
||||||
if (!empty($item["data"])) {
|
if (!empty($item["data"])) {
|
||||||
|
$data_in_same_row = $item['show_in_same_row'];
|
||||||
switch ($item['subtype']) {
|
switch ($item['subtype']) {
|
||||||
case REPORT_GENERAL_NOT_GROUP_BY_AGENT:
|
case REPORT_GENERAL_NOT_GROUP_BY_AGENT:
|
||||||
$table1 = new stdClass();
|
if (!$data_in_same_row) {
|
||||||
$table1->width = '99%';
|
$table1 = new stdClass();
|
||||||
$table1->data = array ();
|
$table1->width = '99%';
|
||||||
$table1->head = array ();
|
$table1->data = array ();
|
||||||
$table1->head[0] = __('Agent');
|
$table1->head = array ();
|
||||||
$table1->head[1] = __('Module');
|
$table1->head[0] = __('Agent');
|
||||||
if ($item['date']['period'] != 0) {
|
$table1->head[1] = __('Module');
|
||||||
$table1->head[2] = __('Operation');
|
|
||||||
}
|
|
||||||
$table1->head[3] = __('Value');
|
|
||||||
|
|
||||||
/* Begin - Order by agent */
|
|
||||||
|
|
||||||
foreach ($item['data'] as $key => $row) {
|
|
||||||
$aux[$key] = $row['agent'];
|
|
||||||
}
|
|
||||||
|
|
||||||
array_multisort($aux, SORT_ASC, $item['data']);
|
|
||||||
|
|
||||||
/* End - Order by agent */
|
|
||||||
|
|
||||||
foreach ($item['data'] as $row) {
|
|
||||||
if ($item['date']['period'] != 0) {
|
if ($item['date']['period'] != 0) {
|
||||||
$table1->data[] = array(
|
$table1->head[2] = __('Operation');
|
||||||
$row['agent'],
|
|
||||||
$row['module'],
|
|
||||||
$row['operator'],
|
|
||||||
$row['formated_value']);
|
|
||||||
}
|
}
|
||||||
else {
|
$table1->head[3] = __('Value');
|
||||||
$table1->data[] = array(
|
$table1->style[0] = 'text-align: left';
|
||||||
$row['agent'],
|
$table1->style[1] = 'text-align: left';
|
||||||
$row['module'],
|
$table1->style[2] = 'text-align: left';
|
||||||
$row['formated_value']);
|
$table1->style[3] = 'text-align: left';
|
||||||
|
|
||||||
|
/* Begin - Order by agent */
|
||||||
|
|
||||||
|
foreach ($item['data'] as $key => $row) {
|
||||||
|
$aux[$key] = $row['agent'];
|
||||||
|
}
|
||||||
|
|
||||||
|
array_multisort($aux, SORT_ASC, $item['data']);
|
||||||
|
|
||||||
|
/* End - Order by agent */
|
||||||
|
|
||||||
|
foreach ($item['data'] as $row) {
|
||||||
|
if ($item['date']['period'] != 0) {
|
||||||
|
$table1->data[] = array(
|
||||||
|
$row['agent'],
|
||||||
|
$row['module'],
|
||||||
|
$row['operator'],
|
||||||
|
$row['formated_value']);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$table1->data[] = array(
|
||||||
|
$row['agent'],
|
||||||
|
$row['module'],
|
||||||
|
$row['formated_value']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$order_data = array();
|
||||||
|
foreach ($item['data'] as $row) {
|
||||||
|
$order_data[$row['id_agent']][$row['id_agent_module']][$row['operator']] = $row['formated_value'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$table1 = new stdClass();
|
||||||
|
$table1->width = '99%';
|
||||||
|
$table1->data = array ();
|
||||||
|
$table1->head = array ();
|
||||||
|
$table1->head[0] = __('Agent');
|
||||||
|
$table1->head[1] = __('Module');
|
||||||
|
$table1->head[2] = __('Avg');
|
||||||
|
$table1->head[3] = __('Max');
|
||||||
|
$table1->head[4] = __('Min');
|
||||||
|
$table1->style[0] = 'text-align: center';
|
||||||
|
$table1->style[1] = 'text-align: center';
|
||||||
|
$table1->style[2] = 'text-align: center';
|
||||||
|
$table1->style[3] = 'text-align: center';
|
||||||
|
$table1->style[4] = 'text-align: center';
|
||||||
|
|
||||||
|
foreach ($order_data as $id_agent => $row) {
|
||||||
|
foreach ($row as $id_module => $row2) {
|
||||||
|
$table1->data[] = array(
|
||||||
|
agents_get_alias($id_agent),
|
||||||
|
modules_get_agentmodule_name($id_module),
|
||||||
|
$row2['Rate'],
|
||||||
|
$row2['Maximum'],
|
||||||
|
$row2['Minimum']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case REPORT_GENERAL_GROUP_BY_AGENT:
|
case REPORT_GENERAL_GROUP_BY_AGENT:
|
||||||
$list_modules = array();
|
$list_modules = array();
|
||||||
|
@ -2635,9 +2674,9 @@ function reporting_html_general(&$table, $item) {
|
||||||
$row = array();
|
$row = array();
|
||||||
|
|
||||||
$row['agent'] = $agent;
|
$row['agent'] = $agent;
|
||||||
$table1->style['agent'] = 'text-align: left;';
|
$table1->style['agent'] = 'text-align: center;';
|
||||||
foreach ($list_modules as $name) {
|
foreach ($list_modules as $name) {
|
||||||
$table1->style[$name] = 'text-align: right;';
|
$table1->style[$name] = 'text-align: center;';
|
||||||
if (isset($modules[$name])) {
|
if (isset($modules[$name])) {
|
||||||
$row[$name] = $modules[$name];
|
$row[$name] = $modules[$name];
|
||||||
}
|
}
|
||||||
|
@ -3866,4 +3905,4 @@ function reporting_html_planned_downtimes_table ($planned_downtimes) {
|
||||||
return $downtimes_table;
|
return $downtimes_table;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
Reference in New Issue