2011-11-03 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_reporting.php godmode/reporting/reporting_builder.preview.php: Changed begin date function in order to make it global for all items of a report. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5106 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
e24daa4aef
commit
3666da18c7
|
@ -1,3 +1,9 @@
|
|||
2011-11-03 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
||||
|
||||
* include/functions_reporting.php
|
||||
godmode/reporting/reporting_builder.preview.php: Changed begin date
|
||||
function in order to make it global for all items of a report.
|
||||
|
||||
2011-11-03 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
||||
|
||||
* include/functions_graph.php
|
||||
|
|
|
@ -43,6 +43,17 @@ if ($report['private'] && ($report['id_user'] != $config['id_user'] && ! is_user
|
|||
$date = (string) get_parameter ('date', date ('Y-m-j'));
|
||||
$time = (string) get_parameter ('time', date ('h:iA'));
|
||||
|
||||
// Calculations in order to modify init date of the report
|
||||
$date_init_less = strtotime(date ('Y-m-j')) - 86400;
|
||||
$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);
|
||||
$new_interval = $report['datetime'] - $datetime_init;
|
||||
if ($new_interval != $content['period']) {
|
||||
$content['period'] = $new_interval;
|
||||
}
|
||||
|
||||
// Standard header
|
||||
|
||||
$url = "index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id=$id_report&date=$date&time=$time";
|
||||
|
@ -61,8 +72,21 @@ $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'] != '') {
|
||||
|
@ -70,14 +94,22 @@ if ($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);
|
||||
$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 />';
|
||||
|
@ -94,15 +126,30 @@ ui_require_jquery_file ('timeentry');
|
|||
?>
|
||||
<script language="javascript" type="text/javascript">
|
||||
|
||||
$(document).ready (function () {
|
||||
$(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]});
|
||||
$('[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");
|
||||
}else{
|
||||
$("#table1-1-3").css("display", "none");
|
||||
$("#table1-1-4").css("display", "none");
|
||||
$("#table1-1-5").css("display", "");
|
||||
$("#table1-1-5").css("width", "380.583px");
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -148,11 +195,18 @@ foreach ($contents as $content) {
|
|||
$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 ();
|
||||
}
|
||||
echo '</form>';
|
||||
|
||||
?>
|
||||
|
|
|
@ -2068,15 +2068,6 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
$agent_name = agents_get_name($content['id_agent']);
|
||||
}
|
||||
|
||||
// Calculations in order to modify init date of the report
|
||||
$date_init = get_parameter('date_init_' . $content['id_rc'], date ('Y-m-j',$report['datetime'] - $content['period']));
|
||||
$time_init = get_parameter('time_init_' . $content['id_rc'], date ('h:iA',$report['datetime'] - $content['period']));
|
||||
$datetime_init = strtotime ($date_init.' '.$time_init);
|
||||
$new_interval = $report['datetime'] - $datetime_init;
|
||||
if ($new_interval != $content['period']) {
|
||||
$content['period'] = $new_interval;
|
||||
}
|
||||
|
||||
switch ($content["type"]) {
|
||||
case 1:
|
||||
case 'simple_graph':
|
||||
|
@ -2401,7 +2392,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
//html_debug_print($table1->data);
|
||||
|
||||
// SLA items sorted descending ()
|
||||
if ($content['top_n'] == 2){
|
||||
usort($table1->data, "sla_value_desc_cmp");
|
||||
|
@ -2410,7 +2401,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
else if ($content['top_n'] == 1){
|
||||
usort($table1->data, "sla_value_asc_cmp");
|
||||
}
|
||||
//html_debug_print($table1->data);
|
||||
|
||||
// Delete temporary column used to sort SLA data
|
||||
for ($i=0; $i < count($table1->data); $i++) {
|
||||
unset($table1->data[$i][6]);
|
||||
|
@ -4012,20 +4003,6 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
if (($config ['metaconsole'] == 1) && $server_name != '') {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
// Adds date/time control to update initial interval report
|
||||
$table->colspan[3][0] = 3;
|
||||
// $table->data[3][0] = '<form method="post" action="">';
|
||||
$table->data[3][0] .= '<b>' . __('Date') . '</b>' . ui_print_help_tip(__('This is the report start date'), true) . ' ';
|
||||
$table->data[3][0] .= html_print_input_text ('date_init_' . $content['id_rc'], $date_init, '', 12, 10, true). ' ';
|
||||
$table->data[3][0] .= html_print_input_text ('time_init_' . $content['id_rc'], $time_init, '', 7, 7, true). ' ';
|
||||
$table->data[3][0] .= html_print_submit_button (__('Update'), 'date_submit_init', false, 'class="sub next"', true);
|
||||
$table->data[3][0] .= html_print_input_hidden ('id_report_content_' . $content['id_rc'], 1, true);
|
||||
|
||||
/* if (!isset(get_parameter('id_rc_list')){
|
||||
$table->data[3][0] .= html_print_input_hidden ('id_rc_list', $id_rc_list . ',' . $content['id_rc'], true);
|
||||
}*/
|
||||
// $table->data[3][0] .= '</form>';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue