This commit is contained in:
Daniel Maya 2021-12-21 15:22:22 +01:00
parent ae0e4e2826
commit 7767e9aae2
1 changed files with 20 additions and 15 deletions

View File

@ -334,12 +334,12 @@ if ($view_graph) {
} }
$period_label = human_time_description_raw($period); $period_label = human_time_description_raw($period);
echo "<form method='POST' action='index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id=$id_graph'>"; echo '<form method="POST" action="index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id=$id_graph">';
echo "<table class='databox filters w100p' cellpadding='4' cellspacing='4'>"; echo "<table class='databox filters w100p' cellpadding='4' cellspacing='4'>";
echo '<tr>'; echo '<tr>';
echo '<td>'; echo '<td>';
echo '<b>'.__('Date').'</b>'.' '; echo '<b>'.__('Date').'</b>';
echo '</td>'; echo '</td>';
echo '<td>'; echo '<td>';
@ -396,16 +396,18 @@ if ($view_graph) {
echo '</tr>'; echo '</tr>';
echo '</table>'; echo '</table>';
echo '</form>'; echo '</form>';
/* /*
We must add javascript here. Otherwise, the date picker won't We must add javascript here. Otherwise, the date picker won't
work if the date is not correct because php is returning. */ work if the date is not correct because php is returning.
*/
ui_include_time_picker(); ui_include_time_picker();
ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript/i18n/'); ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript/i18n/');
ui_require_jquery_file(''); ui_require_jquery_file('');
?> ?>
<script language="javascript" type="text/javascript"> <script language="javascript" type="text/javascript">
$(document).ready (function () { $(document).ready (function () {
$("#spinner_loading").hide(); $("#spinner_loading").hide();
$("#loading").slideUp (); $("#loading").slideUp ();
@ -419,9 +421,9 @@ if ($view_graph) {
secondText: '<?php echo __('Second'); ?>', secondText: '<?php echo __('Second'); ?>',
currentText: '<?php echo __('Now'); ?>', currentText: '<?php echo __('Now'); ?>',
closeText: '<?php echo __('Close'); ?>'}); closeText: '<?php echo __('Close'); ?>'});
$.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]); $.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
$("#text-date").datepicker({ $("#text-date").datepicker({
dateFormat: "<?php echo DATE_FORMAT_JS; ?>", dateFormat: "<?php echo DATE_FORMAT_JS; ?>",
changeMonth: true, changeMonth: true,
@ -434,19 +436,22 @@ if ($view_graph) {
$("#thresholdDiv").hide(); $("#thresholdDiv").hide();
} }
$("#submit-refresh").click(function(e){ $("#submit-refresh").click(function(e) {
e.preventDefault(); e.preventDefault();
$("#spinner_loading").show(); $("#spinner_loading").show();
var data = { var data = {
page: "operation/reporting/graph_viewer", page: "operation/reporting/graph_viewer",
view_graph: 1, view_graph: 1,
id: '<?php echo $id_graph; ?>', id: '<?php echo $id_graph; ?>',
zoom: '<?php echo $zoom; ?>', zoom: $('#zoom').val(),
date: '<?php echo $date; ?>', date: $('#text-date').val(),
time: '<?php echo $time; ?>', time: $('#text-time').val(),
period: '<?php echo $period; ?>', period: $('select[id^=period][id$=select]').val(),
stacked: '<?php echo $stacked; ?>', stacked: $('#stacked').val(),
threshold: '<?php echo $check; ?>', }
if (data['stacked'] == 4 && $('#checkbox-threshold').is(':checked')) {
data['threshold'] = 1;
} }
$.ajax({ $.ajax({
@ -479,7 +484,7 @@ if ($view_graph) {
} }
}); });
</script> </script>
<?php <?php
$datetime = strtotime($date.' '.$time); $datetime = strtotime($date.' '.$time);
$report['datetime'] = $datetime; $report['datetime'] = $datetime;
@ -492,7 +497,7 @@ if ($view_graph) {
return; return;
} }
// Header // Header.
ui_print_page_header(__('Reporting').' &raquo; '.__('Custom graph viewer'), 'images/op_reporting.png', false, '', false, ''); ui_print_page_header(__('Reporting').' &raquo; '.__('Custom graph viewer'), 'images/op_reporting.png', false, '', false, '');