summaryrefslogtreecommitdiffstats
path: root/frontends/php/include/items.inc.php
diff options
context:
space:
mode:
authorosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-10-27 13:38:50 +0000
committerosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-10-27 13:38:50 +0000
commitef76479c1aeefa6f7920473f8be38292dfdbc837 (patch)
treeea973e1f148d051ba0260099464d48efe7a37e1a /frontends/php/include/items.inc.php
parentedf199a4f93b92945ef8a0f0a92730e4ec4f378e (diff)
downloadzabbix-ef76479c1aeefa6f7920473f8be38292dfdbc837.tar.gz
zabbix-ef76479c1aeefa6f7920473f8be38292dfdbc837.tar.xz
zabbix-ef76479c1aeefa6f7920473f8be38292dfdbc837.zip
- developed multitemplate system (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@3388 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/items.inc.php')
-rw-r--r--frontends/php/include/items.inc.php31
1 files changed, 24 insertions, 7 deletions
diff --git a/frontends/php/include/items.inc.php b/frontends/php/include/items.inc.php
index 6875c831..271061f5 100644
--- a/frontends/php/include/items.inc.php
+++ b/frontends/php/include/items.inc.php
@@ -387,7 +387,7 @@
return $result;
}
- function delete_template_items($hostid, $templateid = null, $unlink_mode = false)
+ function delete_template_items($hostid, $templateid = null /* array format 'arr[id]=name' */, $unlink_mode = false)
{
$db_items = get_items_by_hostid($hostid);
while($db_item = DBfetch($db_items))
@@ -398,8 +398,15 @@
if($templateid != null)
{
$db_tmp_item = get_item_by_itemid($db_item["templateid"]);
- if($db_tmp_item["hostid"] != $templateid)
+ if(is_array($templateid))
+ {
+ if(!isset($templateid[$db_tmp_item["hostid"]]))
+ continue;
+ }
+ elseif($db_tmp_item["hostid"] != $templateid)
+ {
continue;
+ }
}
if($unlink_mode)
@@ -454,11 +461,21 @@
$copy_mode ? 0 : $db_tmp_item["itemid"]);
}
- function copy_template_items($hostid, $templateid = null, $copy_mode = false)
+ function copy_template_items($hostid, $templateid = null /* array format 'arr[id]=name' */, $copy_mode = false)
{
- $host = get_host_by_hostid($hostid);
+ if($templateid == null)
+ {
+ $templateid = get_templates_by_hostid($hostid);
+ }
+
+ if(is_array($templateid))
+ {
+ foreach($templateid as $id => $name)
+ copy_template_items($hostid, $id, $copy_mode); // attention recursion
+ return;
+ }
- $db_tmp_items = get_items_by_hostid($host["templateid"]);
+ $db_tmp_items = get_items_by_hostid($templateid);
while($db_tmp_item = DBfetch($db_tmp_items))
{
@@ -724,7 +741,7 @@ COpt::profiling_stop('prepare table');
function delete_history_by_itemid($itemid, $use_housekeeper=0)
{
- SDI('TODO: Correct housekeeper scheduling!'); /* TODO */ /* think about housekeeper scheduling, must be housekeeperid - unneeded */
+ SDI('TODO: Correct housekeeper scheduling [new elementid problem]!'); /* TODO */ /* think about housekeeper scheduling, must be housekeeperid - unneeded */
$result = delete_trends_by_itemid($itemid,$use_housekeeper);
if(!$result) return $result;
@@ -757,7 +774,7 @@ COpt::profiling_stop('prepare table');
function delete_trends_by_itemid($itemid, $use_housekeeper=0)
{
- SDI('TODO: Correct housekeeper scheduling!'); /* TODO */ /* think about housekeeper scheduling, must be housekeeperid - unneeded */
+ SDI('TODO: Correct housekeeper scheduling [new elementid problem]!'); /* TODO */ /* think about housekeeper scheduling, must be housekeeperid - unneeded */
if($use_housekeeper)
{