From 28a09ed13e41ddbe5e30d63e92a1f5fb3395ef89 Mon Sep 17 00:00:00 2001 From: osmiy Date: Mon, 23 Oct 2006 07:34:27 +0000 Subject: - developed group permission system (Eugene) git-svn-id: svn://svn.zabbix.com/trunk@3371 97f52cf1-0a1b-0410-bd0e-c28be96e8082 --- frontends/php/chart2.php | 129 +++++++++++++++++++++++++---------------------- 1 file changed, 69 insertions(+), 60 deletions(-) (limited to 'frontends/php/chart2.php') diff --git a/frontends/php/chart2.php b/frontends/php/chart2.php index b3875b51..fb564cfa 100644 --- a/frontends/php/chart2.php +++ b/frontends/php/chart2.php @@ -19,78 +19,87 @@ **/ ?> setPeriod($_REQUEST["period"]); - } - if(isset($_REQUEST["from"])) - { - $graph->setFrom($_REQUEST["from"]); - } - if(isset($_REQUEST["stime"])) - { - $graph->setSTime($_REQUEST["stime"]); - } - if(isset($_REQUEST["border"])) +?> + array(T_ZBX_INT, O_MAND, P_SYS, DB_ID, null), + "period"=> array(T_ZBX_INT, O_OPT, P_NZERO, BETWEEN(3600,12*31*24*3600), null), + "from"=> array(T_ZBX_INT, O_OPT, P_NZERO, null, null), + "stime"=> array(T_ZBX_INT, O_OPT, P_NZERO, null, null), + "border"=> array(T_ZBX_INT, O_OPT, P_NZERO, IN('0,1'), null), + "width"=> array(T_ZBX_INT, O_OPT, P_NZERO, '{}>0', null), + "height"=> array(T_ZBX_INT, O_OPT, P_NZERO, '{}>0', null), + ); + + check_fields($fields); +?> +setBorder(0); + access_deny(); } - $db_hosts = get_hosts_by_graphid($_REQUEST["graphid"]); - $name=$row["name"]; + $graph = new Graph($db_data["graphtype"]); - $db_host = DBfetch($db_hosts); - if($db_host) - { - $name = $db_host["host"].":".$name; - } - if(isset($_REQUEST["width"])&&$_REQUEST["width"]>0) - { - $width=$_REQUEST["width"]; - } - else - { - $width=$row["width"]; - } - if(isset($_REQUEST["height"])&&$_REQUEST["height"]>0) - { - $height=$_REQUEST["height"]; - } - else - { - $height=$row["height"]; - } + if(isset($_REQUEST["period"])) $graph->SetPeriod($_REQUEST["period"]); + if(isset($_REQUEST["from"])) $graph->SetFrom($_REQUEST["from"]); + if(isset($_REQUEST["stime"])) $graph->SetSTime($_REQUEST["stime"]); + if(isset($_REQUEST["border"])) $graph->SetBorder(0); - $graph->ShowWorkPeriod($row["show_work_period"]); - $graph->ShowTriggers($row["show_triggers"]); + $width = get_request("width", 0); - $graph->setWidth($width); - $graph->setHeight($height); - $graph->setHeader($name); - $graph->setYAxisType($row["yaxistype"]); - $graph->setYAxisMin($row["yaxismin"]); - $graph->setYAxisMax($row["yaxismax"]); + if($width <= 0) $width = $db_data["width"]; - $result=DBselect("select gi.*,i.description,h.host,gi.drawtype from graphs_items gi,items i,hosts h where gi.itemid=i.itemid and gi.graphid=".$_REQUEST["graphid"]." and i.hostid=h.hostid order by gi.sortorder"); + $height = get_request("height", 0); + if($height <= 0) $height = $db_data["height"]; - while($row=DBfetch($result)) + $graph->ShowWorkPeriod($db_data["show_work_period"]); + $graph->ShowTriggers($db_data["show_triggers"]); + + $graph->SetWidth($width); + $graph->SetHeight($height); + $graph->SetHeader($db_data["host"].":".$db_data['name']); + $graph->SetYAxisType($db_data["yaxistype"]); + $graph->SetYAxisMin($db_data["yaxismin"]); + $graph->SetYAxisMax($db_data["yaxismax"]); + + $result = DBselect("select gi.* from graphs_items gi ". + " where gi.graphid=".$db_data["graphid"]. + " order by gi.sortorder, gi.itemid desc"); + + while($db_data=DBfetch($result)) { - $graph->addItem( - $row["itemid"], - $row["yaxisside"], - $row["calc_fnc"], - $row["color"], - $row["drawtype"], - $row["type"], - $row["periods_cnt"] + $graph->AddItem( + $db_data["itemid"], + $db_data["yaxisside"], + $db_data["calc_fnc"], + $db_data["color"], + $db_data["drawtype"], + $db_data["type"], + $db_data["periods_cnt"] ); } $graph->Draw(); ?> + -- cgit