2011-01-26 Javier Lanz <javier.lanz@artica.es>
* include/functions_custom_graphs.php: Added 'date' parameter * operation/reporting/reporting_viewer.php: Longer text box * operation/reporting/graph_viewer.php: Added date control * godmode/reporting/reporting_builder.preview.php: Longer text box * godmode/reporting/graph_builder.preview.php: Added bottom controls Pending task: #3137696 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3773 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
dc2bb9e544
commit
369a7f8561
|
@ -1,3 +1,14 @@
|
|||
2011-01-26 Javier Lanz <javier.lanz@artica.es>
|
||||
|
||||
* include/functions_custom_graphs.php: Added 'date' parameter
|
||||
* operation/reporting/reporting_viewer.php: Longer text box
|
||||
* operation/reporting/graph_viewer.php: Added date control
|
||||
* godmode/reporting/reporting_builder.preview.php: Longer text box
|
||||
* godmode/reporting/graph_builder.preview.php: Added bottom controls
|
||||
|
||||
Pending task: #3137696
|
||||
|
||||
|
||||
2011-01-25 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* operation/search_results.php: added the tab to show search list for
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
global $config;
|
||||
|
||||
require_once ('include/functions_custom_graphs.php');
|
||||
|
||||
if (is_ajax ()) {
|
||||
$search_agents = (bool) get_parameter ('search_agents');
|
||||
|
||||
|
@ -58,6 +60,56 @@ if (! give_acl ($config['id_user'], 0, "IW")) {
|
|||
}
|
||||
|
||||
$id = (integer) get_parameter('id');
|
||||
|
||||
$sql="SELECT * FROM tgraph_source WHERE id_graph = $id_graph";
|
||||
$sources = get_db_all_rows_sql($sql);
|
||||
|
||||
$sql="SELECT * FROM tgraph WHERE id_graph = $id_graph";
|
||||
$graph = get_db_row_sql($sql);
|
||||
|
||||
$id_user = $graph["id_user"];
|
||||
$private = $graph["private"];
|
||||
$width = $graph["width"];
|
||||
$height = $graph["height"] + count($sources) * 10;
|
||||
|
||||
$zoom = (int) get_parameter ('zoom', 0);
|
||||
//Increase the height to fix the leyend rise
|
||||
if ($zoom > 0) {
|
||||
switch ($zoom) {
|
||||
case 1:
|
||||
$width = 500;
|
||||
$height = 200 + count($sources) * 15;
|
||||
break;
|
||||
case 2:
|
||||
$width = 650;
|
||||
$height = 300 + count($sources) * 10;
|
||||
break;
|
||||
case 3:
|
||||
$width = 770;
|
||||
$height = 400 + count($sources) * 5;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Get different date to search the report.
|
||||
$date = (string) get_parameter ('date', date ('Y-m-j'));
|
||||
$time = (string) get_parameter ('time', date ('h:iA'));
|
||||
$unixdate = strtotime ($date.' '.$time);
|
||||
|
||||
$period = (int) get_parameter ('period');
|
||||
if (! $period)
|
||||
$period = $graph["period"];
|
||||
else
|
||||
$period = 3600 * $period;
|
||||
|
||||
$events = $graph["events"];
|
||||
$description = $graph["description"];
|
||||
$stacked = (int) get_parameter ('stacked', -1);
|
||||
if ($stacked == -1)
|
||||
$stacked = $graph["stacked"];
|
||||
|
||||
$name = $graph["name"];
|
||||
|
||||
$graphRows = get_db_all_rows_sql("SELECT t1.*,
|
||||
(SELECT t3.nombre
|
||||
FROM tagente AS t3
|
||||
|
@ -82,31 +134,97 @@ foreach ($graphRows as $graphRow) {
|
|||
$agent_array[] = $graphRow['agent_name'];
|
||||
}
|
||||
|
||||
$graphInTgraph = get_db_row_sql("SELECT * FROM tgraph WHERE id_graph = " . $id);
|
||||
$stacked = $graphInTgraph['stacked'];
|
||||
$events = $graphInTgraph['events'];
|
||||
$period = $graphInTgraph['period'];
|
||||
|
||||
$modules = implode(',', $module_array);
|
||||
$weights = implode(',', $weight_array);
|
||||
|
||||
echo "<table class='databox'>";
|
||||
echo "<tr><td>";
|
||||
|
||||
$graph_width = get_db_sql ("SELECT width FROM tgraph WHERE id_graph = ".$id);
|
||||
$graph_height= get_db_sql ("SELECT height FROM tgraph WHERE id_graph = ".$id);
|
||||
|
||||
if(!empty($modules)) {
|
||||
if ($config['flash_charts']) {
|
||||
echo graphic_combined_module (explode (',', $modules), explode (',', $weights), $period, $graph_width, $graph_height,
|
||||
'Combined%20Sample%20Graph', '', $events, 0, 0, $stacked);
|
||||
} else {
|
||||
echo "<img src='include/fgraph.php?tipo=combined&id=$modules&weight_l=$weights&label=" . base64_encode ("Combined%20Sample%20Graph") . "&height=$graph_height&width=$graph_width&stacked=$stacked&period=$period' border=1 alt=''>";
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo "<div class='nf'>".__('Empty graph')."</div>";
|
||||
}
|
||||
echo "<table class='databox_frame' cellpadding='0' cellspacing='0'>";
|
||||
echo "<tr><td>";
|
||||
|
||||
echo "</td></tr></table>";
|
||||
if(!empty($modules)) {
|
||||
if ($config['flash_charts']) {
|
||||
echo graphic_combined_module (explode (',', $modules), explode (',', $weights), $period, $width, $height,
|
||||
'Combined%20Sample%20Graph', '', $events, 0, 0, $stacked, $unixdate);
|
||||
} else {
|
||||
echo "<img src='include/fgraph.php?tipo=combined&id=$modules&weight_l=$weights&label=" . base64_encode ("Combined%20Sample%20Graph") . "&height=$height&width=$width&stacked=$stacked&period=$period&date=$unixdate' border=1 alt=''>";
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo "<div class='nf'>".__('Empty graph')."</div>";
|
||||
}
|
||||
|
||||
echo "</td></tr></table>";
|
||||
|
||||
echo "<form method = 'POST' action='index.php?sec=greporting&sec2=godmode/reporting/graph_builder&tab=preview&edit_graph=1&id=$id_graph'>";
|
||||
echo "<table class='databox_frame' cellpadding='4' cellspacing='4'>";
|
||||
echo "<tr>";
|
||||
echo "<td>";
|
||||
echo "<b>".__('Date')."</b>"." ";
|
||||
echo "</td>";
|
||||
echo "<td>";
|
||||
echo print_input_text ('date', $date, '', 12, 10, true). ' ';
|
||||
echo "</td>";
|
||||
echo "<td>";
|
||||
echo print_input_text ('time', $time, '', 7, 7, true). ' ';
|
||||
echo "</td>";
|
||||
echo "<td class='datos'>";
|
||||
echo "<b>".__('Period')."</b>";
|
||||
echo "</td>";
|
||||
echo "<td class='datos'>";
|
||||
|
||||
print_select (get_custom_graph_periods (), 'period', intval ($period / 3600),
|
||||
'', '', 0, false, false, false);
|
||||
|
||||
echo "</td>";
|
||||
echo "<td class='datos'>";
|
||||
$stackeds = array ();
|
||||
$stackeds[0] = __('Graph defined');
|
||||
$stackeds[0] = __('Area');
|
||||
$stackeds[1] = __('Stacked area');
|
||||
$stackeds[2] = __('Line');
|
||||
$stackeds[3] = __('Stacked line');
|
||||
print_select ($stackeds, 'stacked', $stacked , '', '', -1, false, false);
|
||||
|
||||
echo "</td>";
|
||||
echo "<td class='datos'>";
|
||||
$zooms = array();
|
||||
$zooms[0] = __('Graph defined');
|
||||
$zooms[1] = __('Zoom x1');
|
||||
$zooms[2] = __('Zoom x2');
|
||||
$zooms[3] = __('Zoom x3');
|
||||
print_select ($zooms, 'zoom', $zoom , '', '', 0);
|
||||
|
||||
echo "</td>";
|
||||
echo "<td class='datos'>";
|
||||
echo "<input type=submit value='".__('Update')."' class='sub upd'>";
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
/* We must add javascript here. Otherwise, the date picker won't
|
||||
work if the date is not correct because php is returning. */
|
||||
|
||||
require_css_file ('datepicker');
|
||||
require_jquery_file ('ui.core');
|
||||
require_jquery_file ('ui.datepicker');
|
||||
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 ();
|
||||
$.datepicker.regional["<?php echo $config['language']; ?>"];
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
$datetime = strtotime ($date.' '.$time);
|
||||
$report["datetime"] = $datetime;
|
||||
|
||||
if ($datetime === false || $datetime == -1) {
|
||||
echo '<h3 class="error">'.__('Invalid date selected').'</h3>';
|
||||
return;
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -70,7 +70,7 @@ if ($report['description'] != '') {
|
|||
$table->data[0][1] = $report['name'];
|
||||
}
|
||||
$table->data[1][0] = __('Date');
|
||||
$table->data[1][1] = print_input_text ('date', $date, '', 10, 10, true). ' ';
|
||||
$table->data[1][1] = print_input_text ('date', $date, '', 12, 10, true). ' ';
|
||||
$table->data[1][1] .= print_input_text ('time', $time, '', 7, 7, true). ' ';
|
||||
$table->data[1][1] .= print_submit_button (__('Update'), 'date_submit', false, 'class="sub next"', true);
|
||||
|
||||
|
|
|
@ -82,8 +82,9 @@ function get_user_custom_graphs ($id_user = 0, $only_names = false) {
|
|||
* @param $period Period of time to get data in seconds.
|
||||
* @param $stacked Wheter the graph is stacked or not.
|
||||
* @param $return Whether to return an output string or echo now (optional, echo by default).
|
||||
* @param $date Date to start printing the graph
|
||||
*/
|
||||
function print_custom_graph ($id_graph, $height, $width, $period, $stacked, $return = false) {
|
||||
function print_custom_graph ($id_graph, $height, $width, $period, $stacked, $return = false, $date = 0) {
|
||||
global $config;
|
||||
|
||||
$sources = get_db_all_rows_field_filter ('tgraph_source', 'id_graph', $id_graph);
|
||||
|
@ -102,11 +103,11 @@ function print_custom_graph ($id_graph, $height, $width, $period, $stacked, $ret
|
|||
|
||||
if ($config['flash_charts']) {
|
||||
$output = graphic_combined_module ($modules, $weights, $period, $width, $height,
|
||||
'', '', 0, 0, 0, $stacked);
|
||||
'', '', 0, 0, 0, $stacked, $date);
|
||||
} else {
|
||||
$modules = implode (',', $modules);
|
||||
$weights = implode (',', $weights);
|
||||
$output = '<img src="include/fgraph.php?tipo=combined&height='.$height.'&width='.$width.'&id='.$modules.'&period='.$period.'&weight_l='.$weights.'&stacked='.$stacked.'">';
|
||||
$output = '<img src="include/fgraph.php?tipo=combined&height='.$height.'&width='.$width.'&id='.$modules.'&period='.$period.'&weight_l='.$weights.'&stacked='.$stacked.'&date='.$date.'">';
|
||||
}
|
||||
|
||||
if ($return)
|
||||
|
|
|
@ -76,6 +76,12 @@ if ($view_graph) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Get different date to search the report.
|
||||
$date = (string) get_parameter ('date', date ('Y-m-j'));
|
||||
$time = (string) get_parameter ('time', date ('h:iA'));
|
||||
$unixdate = strtotime ($date.' '.$time);
|
||||
|
||||
$period = (int) get_parameter ('period');
|
||||
if (! $period)
|
||||
$period = $graph["period"];
|
||||
|
@ -111,12 +117,22 @@ if ($view_graph) {
|
|||
|
||||
echo "<table class='databox_frame' cellpadding='0' cellspacing='0'>";
|
||||
echo "<tr><td>";
|
||||
print_custom_graph ($id_graph, $height, $width, $period, $stacked);
|
||||
print_custom_graph ($id_graph, $height, $width, $period, $stacked, false, $unixdate);
|
||||
echo "</td></tr></table>";
|
||||
$period_label = human_time_description ($period);
|
||||
echo "<form method='POST' action='index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id=$id_graph'>";
|
||||
echo "<table class='databox_frame' cellpadding='4' cellspacing='4'>";
|
||||
echo "<tr><td class='datos'>";
|
||||
echo "<tr>";
|
||||
echo "<td>";
|
||||
echo "<b>".__('Date')."</b>"." ";
|
||||
echo "</td>";
|
||||
echo "<td>";
|
||||
echo print_input_text ('date', $date, '', 12, 10, true). ' ';
|
||||
echo "</td>";
|
||||
echo "<td>";
|
||||
echo print_input_text ('time', $time, '', 7, 7, true). ' ';
|
||||
echo "</td>";
|
||||
echo "<td class='datos'>";
|
||||
echo "<b>".__('Period')."</b>";
|
||||
echo "</td>";
|
||||
echo "<td class='datos'>";
|
||||
|
@ -150,6 +166,32 @@ if ($view_graph) {
|
|||
echo "</tr>";
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
/* We must add javascript here. Otherwise, the date picker won't
|
||||
work if the date is not correct because php is returning. */
|
||||
|
||||
require_css_file ('datepicker');
|
||||
require_jquery_file ('ui.core');
|
||||
require_jquery_file ('ui.datepicker');
|
||||
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 ();
|
||||
$.datepicker.regional["<?php echo $config['language']; ?>"];
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
$datetime = strtotime ($date.' '.$time);
|
||||
$report["datetime"] = $datetime;
|
||||
|
||||
if ($datetime === false || $datetime == -1) {
|
||||
echo '<h3 class="error">'.__('Invalid date selected').'</h3>';
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ if ($report['description'] != '') {
|
|||
$table->data[0][1] = $report['name'];
|
||||
}
|
||||
$table->data[1][0] = __('Date');
|
||||
$table->data[1][1] = print_input_text ('date', $date, '', 10, 10, true). ' ';
|
||||
$table->data[1][1] = print_input_text ('date', $date, '', 12, 10, true). ' ';
|
||||
$table->data[1][1] .= print_input_text ('time', $time, '', 7, 7, true). ' ';
|
||||
$table->data[1][1] .= print_submit_button (__('Update'), 'date_submit', false, 'class="sub next"', true);
|
||||
|
||||
|
|
Loading…
Reference in New Issue