diff options
| author | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-07-05 09:22:34 +0000 |
|---|---|---|
| committer | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-07-05 09:22:34 +0000 |
| commit | 0f93047219d365318ef9feb7005403b1c3155bfa (patch) | |
| tree | fa08172aad7936d7ab9834f8252432e5f5e59d94 /frontends/php/include/graphs.inc.php | |
| parent | 51edf7af1a0eee6ddfe22e62d846abeb8c43bcc3 (diff) | |
- added frontend-side support of quotes and triger expression validation (Eugene)
- merged rev. 4305:4307 [improved trigger expression syntax and validation]
- merged rev. 4329:4331 [more support for quotes in key parameters]
- merged rev. 4344:4346 [minor improovments]
- merged rev. 4431:4432 [added availability of using ":," character for key]
git-svn-id: svn://svn.zabbix.com/trunk@4437 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/graphs.inc.php')
| -rw-r--r-- | frontends/php/include/graphs.inc.php | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/frontends/php/include/graphs.inc.php b/frontends/php/include/graphs.inc.php index ce1596fe..85e9ac8e 100644 --- a/frontends/php/include/graphs.inc.php +++ b/frontends/php/include/graphs.inc.php @@ -80,13 +80,13 @@ } - function get_graphs_by_hostid($hostid) + function &get_graphs_by_hostid($hostid) { return DBselect("select distinct g.* from graphs g, graphs_items gi, items i". " where g.graphid=gi.graphid and gi.itemid=i.itemid and i.hostid=$hostid"); } - function get_realhosts_by_graphid($graphid) + function &get_realhosts_by_graphid($graphid) { $graph = get_graph_by_graphid($graphid); if($graph["templateid"] != 0) @@ -95,13 +95,13 @@ return get_hosts_by_graphid($graphid); } - function get_hosts_by_graphid($graphid) + function &get_hosts_by_graphid($graphid) { return DBselect("select distinct h.* from graphs_items gi, items i, hosts h". " where h.hostid=i.hostid and gi.itemid=i.itemid and gi.graphid=$graphid"); } - function get_graphitems_by_graphid($graphid) + function &get_graphitems_by_graphid($graphid) { return DBselect("select * from graphs_items where graphid=$graphid". " order by itemid,drawtype,sortorder,color,yaxisside"); @@ -143,7 +143,7 @@ return false; } - function get_graphs_by_templateid($templateid) + function &get_graphs_by_templateid($templateid) { return DBselect("select * from graphs where templateid=$templateid"); } @@ -446,7 +446,7 @@ * Comments: !!! Don't forget sync code with C !!! * * * ******************************************************************************/ - function delete_template_graphs($hostid, $templateid = null /* array format 'arr[id]=name' */, $unlink_mode = false) + function delete_template_graphs($hostid, $templateid = null, $unlink_mode = false) { $db_graphs = get_graphs_by_hostid($hostid); while($db_graph = DBfetch($db_graphs)) @@ -454,16 +454,13 @@ if($db_graph["templateid"] == 0) continue; - if($templateid != null) + if( !is_null($templateid) ) { - $hosts = get_hosts_by_graphid($db_graph["templateid"]); - $tmp_host = DBfetch($hosts); - if(is_array($templateid)) - { - if(!isset($templateid[$tmp_host["hostid"]])) - continue; - } - elseif($tmp_host["hostid"] != $templateid) + if( !is_array($templateid) ) $templateid=array($templateid); + + $tmp_host = DBfetch(get_hosts_by_graphid($db_graph["templateid"])); + + if( !in_array($tmp_host["hostid"], $templateid)) continue; } @@ -486,16 +483,16 @@ * Comments: !!! Don't forget sync code with C !!! * * * ******************************************************************************/ - function copy_template_graphs($hostid, $templateid = null /* array format 'arr[id]=name' */, $copy_mode = false) + function copy_template_graphs($hostid, $templateid = null, $copy_mode = false) { if($templateid == null) { - $templateid = get_templates_by_hostid($hostid); + $templateid = array_keys(get_templates_by_hostid($hostid)); } if(is_array($templateid)) { - foreach($templateid as $id => $name) + foreach($templateid as $id) copy_template_graphs($hostid, $id, $copy_mode); // attention recursion return; } |
