summaryrefslogtreecommitdiffstats
path: root/frontends/php/include/triggers.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/triggers.inc.php
parentedf199a4f93b92945ef8a0f0a92730e4ec4f378e (diff)
- developed multitemplate system (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@3388 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/triggers.inc.php')
-rw-r--r--frontends/php/include/triggers.inc.php23
1 files changed, 17 insertions, 6 deletions
diff --git a/frontends/php/include/triggers.inc.php b/frontends/php/include/triggers.inc.php
index 7f079310..26a9edac 100644
--- a/frontends/php/include/triggers.inc.php
+++ b/frontends/php/include/triggers.inc.php
@@ -1014,7 +1014,7 @@
return strcmp($expr1,$trig2["expression"]);
}
- function delete_template_triggers($hostid, $templateid = null, $unlink_mode = false)
+ function delete_template_triggers($hostid, $templateid = null /* array format 'arr[id]=name' */, $unlink_mode = false)
{
$triggers = get_triggers_by_hostid($hostid);
while($trigger = DBfetch($triggers))
@@ -1023,9 +1023,14 @@
if($templateid != null)
{
- $db_tmp_hosts = get_hostis_by_triggerid($trigger["templateid"]);
+ $db_tmp_hosts = get_hosts_by_triggerid($trigger["templateid"]);
$tmp_host = DBfetch($db_tmp_hosts);
- if($tmp_host["hostid"] != $templateid)
+ if(is_array($templateid))
+ {
+ if(!isset($templateid[$tmp_host["hostid"]]))
+ continue;
+ }
+ elseif($tmp_host["hostid"] != $templateid)
continue;
}
@@ -1045,12 +1050,18 @@
return TRUE;
}
- function copy_template_triggers($hostid, $templateid = null, $copy_mode = false)
+ function copy_template_triggers($hostid, $templateid = null /* array format 'arr[id]=name' */, $copy_mode = false)
{
if(null == $templateid)
{
- $host = get_host_by_hostid($hostid);
- $templateid = $host["templateid"];
+ $templateid = get_templates_by_hostid($hostid);;
+ }
+
+ if(is_array($templateid))
+ {
+ foreach($templateid as $id => $name)
+ copy_template_triggers($hostid, $id, $copy_mode); // attention recursion
+ return;
}
$triggers = get_triggers_by_hostid($templateid);