2013-04-04 19:44:07 +02:00
|
|
|
<?php
|
|
|
|
// Pandora FMS - http://pandorafms.com
|
|
|
|
// ==================================================
|
|
|
|
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
|
|
|
// Please see http://pandorafms.org for full contribution list
|
|
|
|
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation for version 2.
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
|
|
|
class ModuleGraph {
|
|
|
|
private $correct_acl = false;
|
|
|
|
private $acl = "AR";
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
private $id = 0;
|
2013-07-03 Miguel de Dios <miguel.dedios@artica.es>
* mobile/operation/events.php, mobile/operation/module_graph.php,
mobile/operation/modules.php, mobile/operation/networkmaps.php,
mobile/operation/groups.php, mobile/operation/agents.php,
mobile/operation/tactical.php, mobile/operation/networkmap.php,
mobile/operation/alerts.php, mobile/operation/agent.php,
mobile/include/ui.class.php: added the back button in the head and
impoved the source code style to make more easy the merges with
the last branch.
* include/functions_graph.php: fixed PHP notices.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8468 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-07-03 15:59:38 +02:00
|
|
|
private $id_agent = 0;
|
2013-04-04 19:44:07 +02:00
|
|
|
private $graph_type = "sparse";
|
|
|
|
private $period = SECONDS_1DAY;
|
|
|
|
private $draw_events = 0;
|
|
|
|
private $width = 0;
|
|
|
|
private $height = 0;
|
|
|
|
private $draw_alerts = 0;
|
|
|
|
private $start_date = 0;
|
|
|
|
private $time_compare_separated = 0;
|
|
|
|
private $time_compare_overlapped = 0;
|
|
|
|
private $unknown_graph = 1;
|
|
|
|
private $zoom = 1;
|
|
|
|
private $baseline = 0;
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
private $module = null;
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
function __construct() {
|
|
|
|
$system = System::getInstance();
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
$this->start_date = date("Y-m-d");
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
if ($system->checkACL($this->acl)) {
|
|
|
|
$this->correct_acl = true;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$this->correct_acl = false;
|
|
|
|
}
|
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
private function getFilters() {
|
|
|
|
$system = System::getInstance();
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
$this->id = (int)$system->getRequest('id', 0);
|
2013-07-03 Miguel de Dios <miguel.dedios@artica.es>
* mobile/operation/events.php, mobile/operation/module_graph.php,
mobile/operation/modules.php, mobile/operation/networkmaps.php,
mobile/operation/groups.php, mobile/operation/agents.php,
mobile/operation/tactical.php, mobile/operation/networkmap.php,
mobile/operation/alerts.php, mobile/operation/agent.php,
mobile/include/ui.class.php: added the back button in the head and
impoved the source code style to make more easy the merges with
the last branch.
* include/functions_graph.php: fixed PHP notices.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8468 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-07-03 15:59:38 +02:00
|
|
|
$this->id_agent = (int)$system->getRequest('id_agent', 0);
|
2013-04-04 19:44:07 +02:00
|
|
|
$this->module = modules_get_agentmodule($this->id);
|
|
|
|
$this->graph_type = return_graphtype($this->module["id_tipo_modulo"]);
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
$period_hours = $system->getRequest('period_hours', false);
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-12-05 15:35:27 +01:00
|
|
|
if ($period_hours == false) {
|
2013-04-04 19:44:07 +02:00
|
|
|
$this->period = SECONDS_1DAY;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$this->period = $period_hours * SECONDS_1HOUR;
|
|
|
|
}
|
|
|
|
$this->draw_events = (int)$system->getRequest('draw_events', 0);
|
|
|
|
$this->draw_alerts = (int)$system->getRequest('draw_alerts', 0);
|
|
|
|
$this->start_date = $system->getRequest('start_date', false);
|
|
|
|
if ($this->start_date === false) {
|
|
|
|
$this->start_date = date("Y-m-d");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$this->start_date = date("Y-m-d", strtotime($this->start_date));
|
|
|
|
}
|
|
|
|
$this->time_compare_separated = (int)$system->getRequest('time_compare_separated', 0);
|
|
|
|
$this->time_compare_overlapped = (int)$system->getRequest('time_compare_overlapped', 0);
|
|
|
|
$this->unknown_graph = (int)$system->getRequest('unknown_graph', 0);
|
|
|
|
$this->zoom = (int)$system->getRequest('zoom', 1);
|
|
|
|
$this->baseline = (int)$system->getRequest('baseline', 0);
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
$this->width = (int)$system->getRequest('width', 0);
|
|
|
|
$this->width -= 20; //Correct the width
|
|
|
|
$this->height = (int)$system->getRequest('height', 0);
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
//Sancho says "put the height to 1/2 for to make more beautyful"
|
2017-02-13 16:06:17 +01:00
|
|
|
$this->height = $this->height / 1.5;
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
$this->height -= 80; //Correct the height
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-07-04 15:41:47 +02:00
|
|
|
//For to avoid fucking IPHONES when they are in horizontal.
|
|
|
|
if ($this->height < 140) {
|
|
|
|
$this->height = 140;
|
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
public function ajax($parameter2 = false) {
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-12-05 15:35:27 +01:00
|
|
|
global $config;
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
$system = System::getInstance();
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
if (!$this->correct_acl) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
switch ($parameter2) {
|
|
|
|
case 'get_graph':
|
|
|
|
$this->getFilters();
|
|
|
|
$correct = 0;
|
|
|
|
$graph = '';
|
|
|
|
$correct = 1;
|
|
|
|
$label = $this->module["nombre"];
|
|
|
|
$unit = db_get_value('unit', 'tagente_modulo',
|
|
|
|
'id_agente_modulo', $this->id);
|
|
|
|
$utime = get_system_time ();
|
|
|
|
$current = date("Y-m-d", $utime);
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
if ($this->start_date != $current)
|
|
|
|
$date = strtotime($this->start_date);
|
|
|
|
else
|
|
|
|
$date = $utime;
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
$urlImage = ui_get_full_url(false);
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-22 17:51:37 +02:00
|
|
|
$time_compare = false;
|
2013-04-04 19:44:07 +02:00
|
|
|
if ($this->time_compare_separated) {
|
|
|
|
$time_compare = 'separated';
|
|
|
|
}
|
|
|
|
else if ($this->time_compare_overlapped) {
|
|
|
|
$time_compare = 'overlapped';
|
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
ob_start();
|
|
|
|
switch ($this->graph_type) {
|
|
|
|
case 'boolean':
|
|
|
|
case 'sparse':
|
2018-05-30 17:45:17 +02:00
|
|
|
case 'string':
|
2018-05-28 17:47:40 +02:00
|
|
|
$params =array(
|
|
|
|
'agent_module_id' => $this->id,
|
|
|
|
'period' => $this->period,
|
|
|
|
'show_events' => $this->draw_events,
|
|
|
|
'width' => $this->width,
|
|
|
|
'height' => $this->height,
|
|
|
|
'show_alerts' => $this->draw_alerts,
|
|
|
|
'date' => $date,
|
|
|
|
'unit' => $unit,
|
|
|
|
'baseline' => $this->baseline,
|
|
|
|
'homeurl' => $urlImage,
|
|
|
|
'adapt_key' => 'adapter_' . $this->graph_type,
|
|
|
|
'compare' => $time_compare,
|
|
|
|
'show_unknown' => $this->unknown_graph,
|
|
|
|
'menu' => false,
|
2018-06-06 11:18:39 +02:00
|
|
|
'type_graph' => $config['type_module_charts'],
|
|
|
|
'vconsole' => true
|
2018-05-28 17:47:40 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
$graph = grafico_modulo_sparse($params);
|
2013-04-24 14:36:32 +02:00
|
|
|
if ($this->draw_events) {
|
2013-04-04 19:44:07 +02:00
|
|
|
$graph .= '<br>';
|
|
|
|
$graph .= graphic_module_events($this->id,
|
|
|
|
$this->width, $this->height,
|
|
|
|
$this->period, $config['homeurl'],
|
|
|
|
$this->zoom, 'adapted_'.$this->graph_type, $date);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$graph .= fs_error_image ('../images');
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
$graph = ob_get_clean() . $graph;
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
echo json_encode(array('correct' => $correct, 'graph' => $graph));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
public function show() {
|
|
|
|
if (!$this->correct_acl) {
|
|
|
|
$this->show_fail_acl();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$this->getFilters();
|
|
|
|
$this->showModuleGraph();
|
|
|
|
}
|
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
private function show_fail_acl() {
|
2014-10-15 18:12:51 +02:00
|
|
|
$error['type'] = 'onStart';
|
2013-04-24 14:36:32 +02:00
|
|
|
$error['title_text'] = __('You don\'t have access to this page');
|
2018-05-11 14:24:26 +02:00
|
|
|
$error['content_text'] = System::getDefaultACLFailText();
|
2014-10-15 18:12:51 +02:00
|
|
|
if (class_exists("HomeEnterprise"))
|
|
|
|
$home = new HomeEnterprise();
|
|
|
|
else
|
|
|
|
$home = new Home();
|
2013-04-24 14:36:32 +02:00
|
|
|
$home->show($error);
|
2013-04-04 19:44:07 +02:00
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
private function javascript_code() {
|
|
|
|
ob_start();
|
2018-10-19 11:31:06 +02:00
|
|
|
|
2018-05-17 16:43:31 +02:00
|
|
|
global $config;
|
2018-10-19 11:31:06 +02:00
|
|
|
|
|
|
|
echo include_javascript_dependencies_flot_graph(true);
|
|
|
|
ui_require_javascript_file('pandora', 'include/javascript/',true);
|
2018-05-17 16:43:31 +02:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
?>
|
|
|
|
<script type="text/javascript">
|
2017-02-13 16:06:17 +01:00
|
|
|
$(document).ready(function() {
|
2014-02-10 12:54:39 +01:00
|
|
|
function load_graph() {
|
2014-02-10 18:03:08 +01:00
|
|
|
$("#loading_graph").show();
|
2018-02-27 16:28:00 +01:00
|
|
|
|
|
|
|
var heigth = $(document).height()
|
2014-02-10 12:54:39 +01:00
|
|
|
- $(".ui-header").height()
|
|
|
|
- $(".ui-collapsible").height()
|
2017-02-13 16:06:17 +01:00
|
|
|
- 55;
|
|
|
|
var width = $(document).width() - 25;
|
|
|
|
ajax_get_graph($("#id_module").val(), heigth, width);
|
2014-02-10 12:54:39 +01:00
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2014-02-10 12:54:39 +01:00
|
|
|
load_graph();
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2014-02-10 18:03:08 +01:00
|
|
|
// Detect orientation change to refresh dinamic content
|
2017-02-13 16:06:17 +01:00
|
|
|
window.addEventListener("resize", function() {
|
|
|
|
// Reload dinamic content
|
|
|
|
load_graph();
|
2014-02-10 12:54:39 +01:00
|
|
|
});
|
2013-04-04 19:44:07 +02:00
|
|
|
});
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2017-02-13 16:06:17 +01:00
|
|
|
function ajax_get_graph(id, heigth_graph, width_graph) {
|
2013-04-04 19:44:07 +02:00
|
|
|
postvars = {};
|
|
|
|
postvars["action"] = "ajax";
|
|
|
|
postvars["parameter1"] = "module_graph";
|
|
|
|
postvars["parameter2"] = "get_graph";
|
2017-02-13 16:06:17 +01:00
|
|
|
postvars["width"] = width_graph;
|
|
|
|
postvars["height"] = heigth_graph;
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
postvars["draw_alerts"] = ($("input[name = 'draw_alerts']").is(":checked"))?1:0;
|
|
|
|
postvars["draw_events"] = ($("input[name = 'draw_events']").is(":checked"))?1:0;
|
|
|
|
postvars["time_compare_separated"] = ($("input[name = 'time_compare_separated']").is(":checked"))?1:0;
|
|
|
|
postvars["time_compare_overlapped"] = ($("input[name = 'time_compare_overlapped']").is(":checked"))?1:0;
|
|
|
|
postvars["unknown_graph"] = ($("input[name = 'unknown_graph']").is(":checked"))?1:0;;
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
postvars["period_hours"] = $("input[name = 'period_hours']").val();
|
|
|
|
postvars["zoom"] = $("input[name = 'zoom']").val();
|
|
|
|
postvars["start_date"] = $("input[name = 'start_date']").val();
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
postvars["id"] = id;
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
$.ajax ({
|
|
|
|
type: "POST",
|
|
|
|
url: "index.php",
|
|
|
|
dataType: "json",
|
|
|
|
data: postvars,
|
|
|
|
success:
|
|
|
|
function (data) {
|
|
|
|
$("#loading_graph").hide();
|
|
|
|
if (data.correct) {
|
|
|
|
$("#graph_content").show();
|
|
|
|
$("#graph_content").html(data.graph);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$("#error_graph").show();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
error:
|
|
|
|
function (jqXHR, textStatus, errorThrown) {
|
|
|
|
$("#loading_graph").hide();
|
|
|
|
$("#error_graph").show();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<?php
|
|
|
|
$javascript_code = ob_get_clean();
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
return $javascript_code;
|
|
|
|
}
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
private function showModuleGraph() {
|
2017-02-22 13:50:06 +01:00
|
|
|
$agent_alias = agents_get_alias($this->module['id_agente']);
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
$ui = Ui::getInstance();
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
$ui->createPage();
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-07-03 Miguel de Dios <miguel.dedios@artica.es>
* mobile/operation/events.php, mobile/operation/module_graph.php,
mobile/operation/modules.php, mobile/operation/networkmaps.php,
mobile/operation/groups.php, mobile/operation/agents.php,
mobile/operation/tactical.php, mobile/operation/networkmap.php,
mobile/operation/alerts.php, mobile/operation/agent.php,
mobile/include/ui.class.php: added the back button in the head and
impoved the source code style to make more easy the merges with
the last branch.
* include/functions_graph.php: fixed PHP notices.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8468 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-07-03 15:59:38 +02:00
|
|
|
if ($this->id_agent) {
|
|
|
|
$ui->createDefaultHeader(
|
2018-05-11 14:24:26 +02:00
|
|
|
sprintf(__("%s: %s"), get_product_name(), $this->module["nombre"]),
|
2013-07-03 Miguel de Dios <miguel.dedios@artica.es>
* mobile/operation/events.php, mobile/operation/module_graph.php,
mobile/operation/modules.php, mobile/operation/networkmaps.php,
mobile/operation/groups.php, mobile/operation/agents.php,
mobile/operation/tactical.php, mobile/operation/networkmap.php,
mobile/operation/alerts.php, mobile/operation/agent.php,
mobile/include/ui.class.php: added the back button in the head and
impoved the source code style to make more easy the merges with
the last branch.
* include/functions_graph.php: fixed PHP notices.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8468 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-07-03 15:59:38 +02:00
|
|
|
$ui->createHeaderButton(
|
|
|
|
array('icon' => 'back',
|
|
|
|
'pos' => 'left',
|
|
|
|
'text' => __('Back'),
|
|
|
|
'href' => 'index.php?page=agent&id=' . $this->id_agent)));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$ui->createDefaultHeader(
|
2018-05-11 14:24:26 +02:00
|
|
|
sprintf(__("%s: %s"), get_product_name(), $this->module["nombre"]),
|
2013-07-03 Miguel de Dios <miguel.dedios@artica.es>
* mobile/operation/events.php, mobile/operation/module_graph.php,
mobile/operation/modules.php, mobile/operation/networkmaps.php,
mobile/operation/groups.php, mobile/operation/agents.php,
mobile/operation/tactical.php, mobile/operation/networkmap.php,
mobile/operation/alerts.php, mobile/operation/agent.php,
mobile/include/ui.class.php: added the back button in the head and
impoved the source code style to make more easy the merges with
the last branch.
* include/functions_graph.php: fixed PHP notices.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8468 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-07-03 15:59:38 +02:00
|
|
|
$ui->createHeaderButton(
|
|
|
|
array('icon' => 'back',
|
|
|
|
'pos' => 'left',
|
|
|
|
'text' => __('Back'),
|
|
|
|
'href' => 'index.php?page=modules')));
|
|
|
|
}
|
2013-04-04 19:44:07 +02:00
|
|
|
$ui->showFooter(false);
|
|
|
|
$ui->beginContent();
|
|
|
|
$ui->contentAddHtml($ui->getInput(array(
|
|
|
|
'id' => 'id_module',
|
|
|
|
'value' => $this->id,
|
|
|
|
'type' => 'hidden'
|
|
|
|
)));
|
2017-02-22 13:50:06 +01:00
|
|
|
$title = sprintf(__('Options for %s : %s'), $agent_alias, $this->module["nombre"]);
|
2013-04-24 14:36:32 +02:00
|
|
|
$ui->contentBeginCollapsible($title);
|
2013-04-04 19:44:07 +02:00
|
|
|
$ui->beginForm("index.php?page=module_graph&id=" . $this->id);
|
|
|
|
$options = array(
|
|
|
|
'name' => 'draw_alerts',
|
|
|
|
'value' => 1,
|
|
|
|
'checked' => (bool)$this->draw_alerts,
|
|
|
|
'label' => __('Show Alerts')
|
|
|
|
);
|
|
|
|
$ui->formAddCheckbox($options);
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
$options = array(
|
|
|
|
'name' => 'draw_events',
|
|
|
|
'value' => 1,
|
|
|
|
'checked' => (bool)$this->draw_events,
|
|
|
|
'label' => __('Show Events')
|
|
|
|
);
|
|
|
|
$ui->formAddCheckbox($options);
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
$options = array(
|
|
|
|
'name' => 'time_compare_separated',
|
|
|
|
'value' => 1,
|
|
|
|
'checked' => (bool)$this->time_compare_separated,
|
|
|
|
'label' => __('Time compare (Separated)')
|
|
|
|
);
|
|
|
|
$ui->formAddCheckbox($options);
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
$options = array(
|
|
|
|
'name' => 'time_compare_overlapped',
|
|
|
|
'value' => 1,
|
|
|
|
'checked' => (bool)$this->time_compare_overlapped,
|
|
|
|
'label' => __('Time compare (Overlapped)')
|
|
|
|
);
|
|
|
|
$ui->formAddCheckbox($options);
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
$options = array(
|
|
|
|
'name' => 'unknown_graph',
|
|
|
|
'value' => 1,
|
|
|
|
'checked' => (bool)$this->unknown_graph,
|
|
|
|
'label' => __('Show unknown graph')
|
|
|
|
);
|
|
|
|
$ui->formAddCheckbox($options);
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
$options = array(
|
|
|
|
'label' => __('Time range (hours)'),
|
|
|
|
'name' => 'period_hours',
|
|
|
|
'value' => ($this->period / SECONDS_1HOUR),
|
|
|
|
'min' => 0,
|
|
|
|
'max' => 24 * 30,
|
|
|
|
'step' => 4
|
|
|
|
);
|
|
|
|
$ui->formAddSlider($options);
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
$options = array(
|
|
|
|
'name' => 'start_date',
|
|
|
|
'value' => $this->start_date,
|
|
|
|
'label' => __('Begin date')
|
|
|
|
);
|
|
|
|
$ui->formAddInpuDate($options);
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
$options = array(
|
|
|
|
'icon' => 'refresh',
|
|
|
|
'icon_pos' => 'right',
|
|
|
|
'text' => __('Update graph')
|
|
|
|
);
|
|
|
|
$ui->formAddSubmitButton($options);
|
2018-02-27 16:28:00 +01:00
|
|
|
|
2013-04-04 19:44:07 +02:00
|
|
|
$html = $ui->getEndForm();
|
|
|
|
$ui->contentCollapsibleAddItem($html);
|
|
|
|
$ui->contentEndCollapsible();
|
2014-02-10 18:03:08 +01:00
|
|
|
$ui->contentAddHtml('<div id="graph_content" style="display: none; width: 100%; height: 100%; text-align: center;"></div>
|
2013-04-04 19:44:07 +02:00
|
|
|
<div id="loading_graph" style="width: 100%; text-align: center;">' . __('Loading...') . '<br /><img src="images/ajax-loader.gif" /></div>
|
|
|
|
<div id="error_graph" style="display: none; color: red; width: 100%; text-align: center;">' . __('Error get the graph') . '</div>');
|
|
|
|
$ui->contentAddHtml($this->javascript_code());
|
|
|
|
$ui->endContent();
|
|
|
|
$ui->showPage();
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
*/
|
2013-12-05 15:35:27 +01:00
|
|
|
}
|