Exemple #1
0
function copy_template_triggers($hostid, $templateid = null, $copy_mode = false)
{
    if (null == $templateid) {
        $templateid = array_keys(get_templates_by_hostid($hostid));
    }
    if (is_array($templateid)) {
        foreach ($templateid as $id) {
            copy_template_triggers($hostid, $id, $copy_mode);
        }
        // attention recursion
        return;
    }
    $triggers = get_triggers_by_hostid($templateid);
    while ($trigger = DBfetch($triggers)) {
        copy_trigger_to_host($trigger["triggerid"], $hostid, $copy_mode);
    }
    update_template_dependencies_for_host($hostid);
}
function copy_template_elements($hostid, $templateid = null, $copy_mode = false)
{
    $result = true;
    copy_template_applications($hostid, $templateid, $copy_mode);
    copy_template_items($hostid, $templateid, $copy_mode);
    copy_template_triggers($hostid, $templateid, $copy_mode);
    // razvilka $copy
    if ($copy_mode) {
        copy_template_graphs($hostid, $templateid, $copy_mode);
    } else {
        $result = CGraph::syncTemplates(array('hostids' => $hostid, 'templateids' => $templateid));
    }
    return $result;
}
Exemple #3
0
function copy_template_elements($hostid, $templateid = null, $copy_mode = false)
{
    copy_template_applications($hostid, $templateid, $copy_mode);
    copy_template_items($hostid, $templateid, $copy_mode);
    copy_template_triggers($hostid, $templateid, $copy_mode);
    copy_template_graphs($hostid, $templateid, $copy_mode);
}