summaryrefslogtreecommitdiffstats
path: root/frontends/php/include/items.inc.php
diff options
context:
space:
mode:
authorartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-11-29 09:17:03 +0000
committerartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-11-29 09:17:03 +0000
commit25fe20d517ee1553fd569fba2f6c33ee5a9a446a (patch)
tree74c7002f7eb1c9bd518128352a2711d1723dfa2c /frontends/php/include/items.inc.php
parent4df0316c5b609a2a609d9c6a6cd539ded33351d6 (diff)
downloadzabbix-25fe20d517ee1553fd569fba2f6c33ee5a9a446a.tar.gz
zabbix-25fe20d517ee1553fd569fba2f6c33ee5a9a446a.tar.xz
zabbix-25fe20d517ee1553fd569fba2f6c33ee5a9a446a.zip
- [DEV-55] Screen elements('graph','simple graph','plain text') are extended, added new field in DB,table 'screens_items' 'dynamic' (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5116 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/items.inc.php')
-rw-r--r--frontends/php/include/items.inc.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/frontends/php/include/items.inc.php b/frontends/php/include/items.inc.php
index d0d0dd96..e2c4365b 100644
--- a/frontends/php/include/items.inc.php
+++ b/frontends/php/include/items.inc.php
@@ -724,6 +724,52 @@
error("No item with itemid=[$itemid]");
return FALSE;
}
+
+/*
+ * Function: get_same_items_for_host
+ *
+ * Description:
+ * Replace items for specified host
+ *
+ * Author:
+ * Aly
+ *
+ * Comments:
+ * $error= true : rise Error if item doesn't exists(error generated), false: special processing (NO error generated)
+ */
+ function get_same_item_for_host($item,$dest_hostid, $error=true){
+
+ if(!is_array($item)){
+ $itemid = $item;
+ }
+ else if(isset($item['itemid'])){
+ $itemid = $item['itemid'];
+ }
+
+ if(isset($itemid)){
+ $sql = 'SELECT src.itemid '.
+ ' FROM items src, items dest '.
+ ' WHERE dest.itemid='.zbx_dbstr($itemid).
+ ' AND src.key_=dest.key_ '.
+ ' AND src.hostid='.$dest_hostid;
+
+ $db_item = DBfetch(DBselect($sql));
+ if (!$db_item && $error){
+ $item = get_item_by_itemid($db_item['itemid']);
+ $host = get_host_by_hostid($dest_hostid);
+ error('Missed key "'.$item['key_'].'" for host "'.$host['host'].'"');
+ }
+ else{
+ if(is_array($item)){
+ return get_item_by_itemid($db_item['itemid']);
+ }
+ else{
+ return $db_item['itemid'];
+ }
+ }
+ }
+ return false;
+ }
/******************************************************************************
* *