diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-08-29 10:06:42 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-08-29 10:06:42 +0000 |
| commit | 450bedfbd08dbb30b3a6fa47abe411e2bc689024 (patch) | |
| tree | b2a57904c928e0d63785109b7d8db93723e8e365 /frontends/php/include/graphs.inc.php | |
| parent | 2ce640571ab5c0db1a26858f96ba804e36f1fb37 (diff) | |
| download | zabbix-450bedfbd08dbb30b3a6fa47abe411e2bc689024.tar.gz zabbix-450bedfbd08dbb30b3a6fa47abe411e2bc689024.tar.xz zabbix-450bedfbd08dbb30b3a6fa47abe411e2bc689024.zip | |
- misc fixes for host-templates linkage (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@2009 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/graphs.inc.php')
| -rw-r--r-- | frontends/php/include/graphs.inc.php | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/frontends/php/include/graphs.inc.php b/frontends/php/include/graphs.inc.php index 7b07bdb3..3589032d 100644 --- a/frontends/php/include/graphs.inc.php +++ b/frontends/php/include/graphs.inc.php @@ -111,7 +111,7 @@ return $result; } - function add_graph_item_to_templates($gitemid) + function add_graph_item_to_linked_hosts($gitemid,$hostid=0) { if($gitemid<=0) { @@ -122,7 +122,14 @@ $graph=get_graph_by_graphid($graph_item["graphid"]); $item=get_item_by_itemid($graph_item["itemid"]); - $sql="select hostid,templateid,graphs from hosts_templates where templateid=".$item["hostid"]; + if($hostid==0) + { + $sql="select hostid,templateid,graphs from hosts_templates where templateid=".$item["hostid"]; + } + else + { + $sql="select hostid,templateid,graphs from hosts_templates where hostid=$hostid and templateid=".$item["hostid"]; + } $result=DBselect($sql); while($row=DBfetch($result)) { @@ -136,7 +143,7 @@ $sql="select distinct g.graphid from graphs g,graphs_items gi,items i where i.itemid=gi.itemid and i.hostid=".$row["hostid"]." and g.graphid=gi.graphid and g.name='".addslashes($graph["name"])."'"; $result2=DBselect($sql); - $host=get_host_by_hostid($result["hostid"]); + $host=get_host_by_hostid($row["hostid"]); while($row2=DBfetch($result2)) { add_item_to_graph($row2["graphid"],$itemid,$graph_item["color"],$graph_item["drawtype"],$graph_item["sortorder"]); |
