diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-03-05 13:34:23 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-03-05 13:34:23 +0000 |
| commit | f43e1b47aad7e6cc56213417e43909d7dd4a2e7e (patch) | |
| tree | bd2773a3b4a9926ffc82a9601b9b37e2e5de1d49 /frontends/php/include/graphs.inc.php | |
| parent | 793897861b7e8218f1a74e718e8e4aebfed64471 (diff) | |
| download | zabbix-f43e1b47aad7e6cc56213417e43909d7dd4a2e7e.tar.gz zabbix-f43e1b47aad7e6cc56213417e43909d7dd4a2e7e.tar.xz zabbix-f43e1b47aad7e6cc56213417e43909d7dd4a2e7e.zip | |
- added frontends/php/include/triggers.inc.php (Alexei)
- added frontends/php/include/graphs.inc.php (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@1689 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/graphs.inc.php')
| -rw-r--r-- | frontends/php/include/graphs.inc.php | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/frontends/php/include/graphs.inc.php b/frontends/php/include/graphs.inc.php new file mode 100644 index 00000000..0c2da7dd --- /dev/null +++ b/frontends/php/include/graphs.inc.php @@ -0,0 +1,120 @@ +<?php +/* +** Zabbix +** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev +** +** 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; either version 2 of the License, or +** (at your option) any later version. +** +** 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. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +**/ +?> +<?php + # Add Graph + + function add_graph($name,$width,$height,$yaxistype,$yaxismin,$yaxismax) + { + global $ERROR_MSG; + + if(!check_right("Graph","A",0)) + { + $ERROR_MSG="Insufficient permissions"; + return 0; + } + + $sql="insert into graphs (name,width,height,yaxistype,yaxismin,yaxismax) values ('$name',$width,$height,$yaxistype,$yaxismin,$yaxismax)"; + $result=DBexecute($sql); + return DBinsert_id($result,"graphs","graphid"); + } + + function update_graph_item($gitemid,$itemid,$color,$drawtype,$sortorder) + { + $sql="update graphs_items set itemid=$itemid,color='$color',drawtype=$drawtype,sortorder=$sortorder where gitemid=$gitemid"; + return DBexecute($sql); + } + + function add_item_to_graph($graphid,$itemid,$color,$drawtype,$sortorder) + { + $sql="insert into graphs_items (graphid,itemid,color,drawtype,sortorder) values ($graphid,$itemid,'$color',$drawtype,$sortorder)"; + return DBexecute($sql); + } + + # Update Graph + + function update_graph($graphid,$name,$width,$height,$yaxistype,$yaxismin,$yaxismax) + { + global $ERROR_MSG; + + if(!check_right("Graph","U",0)) + { + $ERROR_MSG="Insufficient permissions"; + return 0; + } + + $sql="update graphs set name='$name',width=$width,height=$height,yaxistype=$yaxistype,yaxismin=$yaxismin,yaxismax=$yaxismax where graphid=$graphid"; + return DBexecute($sql); + } + + function delete_graphs_item($gitemid) + { + $sql="delete from graphs_items where gitemid=$gitemid"; + return DBexecute($sql); + } + + # Delete Graph + + function delete_graph($graphid) + { + $sql="delete from graphs_items where graphid=$graphid"; + $result=DBexecute($sql); + if(!$result) + { + return $result; + } + $sql="delete from graphs where graphid=$graphid"; + return DBexecute($sql); + } + + function get_graphitem_by_gitemid($gitemid) + { + global $ERROR_MSG; + + $sql="select * from graphs_items where gitemid=$gitemid"; + $result=DBselect($sql); + if(DBnum_rows($result) == 1) + { + return DBfetch($result); + } + else + { + $ERROR_MSG="No graph item with gitemid=[$gitemid]"; + } + return $result; + } + + function get_graph_by_graphid($graphid) + { + global $ERROR_MSG; + + $sql="select * from graphs where graphid=$graphid"; + $result=DBselect($sql); + if(DBnum_rows($result) == 1) + { + return DBfetch($result); + } + else + { + $ERROR_MSG="No graph with graphid=[$graphid]"; + } + return $result; + } +?> |
