2011-11-08 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* operation/reporting/reporting_viewer.php: Added begin date control to this view. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5125 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
3c5dd8b8ef
commit
f72b4ebbff
|
@ -1,3 +1,8 @@
|
|||
2011-11-08 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
||||
|
||||
* operation/reporting/reporting_viewer.php: Added begin date control
|
||||
to this view.
|
||||
|
||||
2011-11-08 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
||||
|
||||
* godmode/agentes/module_manager_editor.php: Fixed a typo.
|
||||
|
|
|
@ -51,6 +51,16 @@ 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'));
|
||||
|
||||
$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;
|
||||
$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";
|
||||
|
@ -70,9 +80,23 @@ ui_print_page_header (__('Reporting'). " » ". __('Custom reporting'). " -
|
|||
$table->width = '99%';
|
||||
$table->class = 'databox';
|
||||
$table->style = array ();
|
||||
|
||||
// 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->style[0] = 'font-weight: bold';
|
||||
$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'] != '') {
|
||||
|
@ -84,6 +108,12 @@ $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);
|
||||
|
@ -114,8 +144,6 @@ $(document).ready (function () {
|
|||
</script>
|
||||
|
||||
<?php
|
||||
$datetime = strtotime ($date.' '.$time);
|
||||
$report["datetime"] = $datetime;
|
||||
|
||||
if ($datetime === false || $datetime == -1) {
|
||||
echo '<h3 class="error">'.__('Invalid date selected').'</h3>';
|
||||
|
@ -156,9 +184,46 @@ 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);
|
||||
|
||||
html_print_table ($table);
|
||||
flush ();
|
||||
}
|
||||
?>
|
||||
|
||||
<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");
|
||||
}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>
|
||||
|
|
Loading…
Reference in New Issue