当前位置: 首页>>代码示例>>PHP>>正文


PHP activate_item函数代码示例

本文整理汇总了PHP中activate_item函数的典型用法代码示例。如果您正苦于以下问题:PHP activate_item函数的具体用法?PHP activate_item怎么用?PHP activate_item使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了activate_item函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: DBend

    }
    $result = DBend($result);
    if (hasRequest('add')) {
        show_messages($result, _('Item prototype added'), _('Cannot add item prototype'));
    } else {
        show_messages($result, _('Item prototype updated'), _('Cannot update item prototype'));
    }
    if ($result) {
        unset($_REQUEST['itemid'], $_REQUEST['form']);
        uncheckTableRows(getRequest('parent_discoveryid'));
    }
} elseif (hasRequest('action') && str_in_array(getRequest('action'), ['itemprototype.massenable', 'itemprototype.massdisable']) && hasRequest('group_itemid')) {
    $groupItemId = getRequest('group_itemid');
    $enable = getRequest('action') == 'itemprototype.massenable';
    DBstart();
    $result = $enable ? activate_item($groupItemId) : disable_item($groupItemId);
    $result = DBend($result);
    $updated = count($groupItemId);
    $messageSuccess = $enable ? _n('Item prototype enabled', 'Item prototypes enabled', $updated) : _n('Item prototype disabled', 'Item prototypes disabled', $updated);
    $messageFailed = $enable ? _n('Cannot enable item prototype', 'Cannot enable item prototypes', $updated) : _n('Cannot disable item prototype', 'Cannot disable item prototypes', $updated);
    if ($result) {
        uncheckTableRows(getRequest('parent_discoveryid'));
    }
    show_messages($result, $messageSuccess, $messageFailed);
} elseif (hasRequest('action') && getRequest('action') == 'itemprototype.massdelete' && hasRequest('group_itemid')) {
    DBstart();
    $result = API::Itemprototype()->delete(getRequest('group_itemid'));
    $result = DBend($result);
    if ($result) {
        uncheckTableRows(getRequest('parent_discoveryid'));
    }
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:31,代码来源:disc_prototypes.php

示例2: DBend

        $result = API::DiscoveryRule()->update($item);
        $result = DBend($result);
        show_messages($result, _('Discovery rule updated'), _('Cannot update discovery rule'));
    } else {
        $result = API::DiscoveryRule()->create(array($item));
        show_messages($result, _('Discovery rule created'), _('Cannot add discovery rule'));
    }
    if ($result) {
        unset($_REQUEST['itemid'], $_REQUEST['form']);
        clearCookies($result, $_REQUEST['hostid']);
    }
} elseif (str_in_array(getRequest('go'), array('activate', 'disable')) && hasRequest('g_hostdruleid')) {
    $groupHostDiscoveryRuleId = getRequest('g_hostdruleid');
    $enable = getRequest('go') == 'activate';
    DBstart();
    $result = $enable ? activate_item($groupHostDiscoveryRuleId) : disable_item($groupHostDiscoveryRuleId);
    $result = DBend($result);
    $updated = count($groupHostDiscoveryRuleId);
    $messageSuccess = $enable ? _n('Discovery rule enabled', 'Discovery rules enabled', $updated) : _n('Discovery rule disabled', 'Discovery rules disabled', $updated);
    $messageFailed = $enable ? _n('Cannot enable discovery rules', 'Cannot enable discovery rules', $updated) : _n('Cannot disable discovery rules', 'Cannot disable discovery rules', $updated);
    show_messages($result, $messageSuccess, $messageFailed);
    clearCookies($result, getRequest('hostid'));
} elseif ($_REQUEST['go'] == 'delete' && isset($_REQUEST['g_hostdruleid'])) {
    $goResult = API::DiscoveryRule()->delete($_REQUEST['g_hostdruleid']);
    show_messages($goResult, _('Discovery rules deleted'), _('Cannot delete discovery rules'));
    clearCookies($goResult, $_REQUEST['hostid']);
}
/*
 * Display
 */
if (isset($_REQUEST['form'])) {
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:31,代码来源:host_discovery.php

示例3: DBend

        $item['itemid'] = $id;
        $result = API::Item()->update($item);
        if (!$result) {
            break;
        }
    }
    $result = DBend($result);
    show_messages($result, _('Items updated'), _('Cannot update items'));
    if ($result) {
        unset($_REQUEST['group_itemid'], $_REQUEST['massupdate'], $_REQUEST['update'], $_REQUEST['form']);
    }
} elseif ($_REQUEST['go'] == 'activate' && isset($_REQUEST['group_itemid'])) {
    global $USER_DETAILS;
    $group_itemid = $_REQUEST['group_itemid'];
    DBstart();
    $go_result = activate_item($group_itemid);
    $go_result = DBend($go_result);
    show_messages($go_result, _('Items activated'), null);
} elseif ($_REQUEST['go'] == 'disable' && isset($_REQUEST['group_itemid'])) {
    global $USER_DETAILS;
    $group_itemid = $_REQUEST['group_itemid'];
    DBstart();
    $go_result = disable_item($group_itemid);
    $go_result = DBend($go_result);
    show_messages($go_result, _('Items disabled'), null);
} elseif ($_REQUEST['go'] == 'copy_to' && isset($_REQUEST['copy']) && isset($_REQUEST['group_itemid'])) {
    if (isset($_REQUEST['copy_targetid']) && $_REQUEST['copy_targetid'] > 0 && isset($_REQUEST['copy_type'])) {
        // host
        if ($_REQUEST['copy_type'] == 0) {
            $hosts_ids = $_REQUEST['copy_targetid'];
        } else {
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:31,代码来源:items.php

示例4: DBend

        $deleted++;
    }
    $result = DBend($result);
    if ($result) {
        uncheckTableRows($pageFilter->hostid);
    }
    show_messages($result, _n('Application deleted', 'Applications deleted', $deleted), _n('Cannot delete application', 'Cannot delete applications', $deleted));
} elseif (hasRequest('applications') && str_in_array(getRequest('action'), array('application.massenable', 'application.massdisable'))) {
    $enableApplicationItems = getRequest('action') === 'application.massenable';
    $applications = API::Application()->get(array('output' => array(), 'applicationids' => getRequest('applications', array()), 'selectItems' => array('itemid'), 'hostids' => $pageFilter->hostid > 0 ? $pageFilter->hostid : null));
    $actionSuccessful = true;
    $updatedItemCount = 0;
    DBstart();
    foreach ($applications as $application) {
        foreach ($application['items'] as $item) {
            $actionSuccessful &= $enableApplicationItems ? activate_item($item['itemid']) : disable_item($item['itemid']);
            $updatedItemCount++;
        }
    }
    $actionSuccessful = DBend($actionSuccessful);
    if ($actionSuccessful) {
        uncheckTableRows($pageFilter->hostid);
    }
    $messageSuccess = $enableApplicationItems ? _n('Item enabled', 'Items enabled', $updatedItemCount) : _n('Item disabled', 'Items disabled', $updatedItemCount);
    $messageFailed = $enableApplicationItems ? _n('Cannot enable item', 'Cannot enable items', $updatedItemCount) : _n('Cannot disable item', 'Cannot disable items', $updatedItemCount);
    show_messages($actionSuccessful, $messageSuccess, $messageFailed);
}
/*
 * Display
 */
if (isset($_REQUEST['form'])) {
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:31,代码来源:applications.php

示例5: activate_item

function activate_item($itemids)
{
    zbx_value2array($itemids);
    // first update status for child items
    $child_items = array();
    $db_items = DBselect('SELECT i.itemid,i.hostid FROM items i WHERE ' . dbConditionInt('i.templateid', $itemids));
    while ($item = DBfetch($db_items)) {
        $child_items[$item['itemid']] = $item['itemid'];
    }
    if (!empty($child_items)) {
        activate_item($child_items);
        // Recursion !!!
    }
    return update_item_status($itemids, ITEM_STATUS_ACTIVE);
}
开发者ID:hujingguang,项目名称:work,代码行数:15,代码来源:items.inc.php

示例6: DBend

         $result = DBend($result);
         show_messages(true, S_APPLICATION_DELETED, NULL);
     }
     unset($_REQUEST['delete']);
 } else {
     if ($_REQUEST['config'] == 4 && (isset($_REQUEST['activate']) || isset($_REQUEST['disable']))) {
         /* group operations */
         $result = true;
         $applications = get_request('applications', array());
         DBstart();
         foreach ($applications as $id => $appid) {
             $sql = 'SELECT ia.itemid,i.hostid,i.key_' . ' FROM items_applications ia ' . ' LEFT JOIN items i ON ia.itemid=i.itemid ' . ' WHERE ia.applicationid=' . $appid . ' AND i.hostid=' . $_REQUEST['hostid'] . ' AND ' . DBin_node('ia.applicationid');
             $res_items = DBselect($sql);
             while ($item = DBfetch($res_items)) {
                 if (isset($_REQUEST['activate'])) {
                     if ($result &= activate_item($item['itemid'])) {
                         /*							$host = get_host_by_hostid($item['hostid']);
                         							add_audit(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_ITEM,S_ITEM.' ['.$item['key_'].'] ['.$id.'] '.S_HOST.' ['.$host['host'].'] '.S_ITEMS_ACTIVATED);*/
                     }
                 } else {
                     if ($result &= disable_item($item['itemid'])) {
                         /*							$host = get_host_by_hostid($item['hostid']);
                         							add_audit(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_ITEM,S_ITEM.' ['.$item['key_'].'] ['.$id.'] '.S_HOST.' ['.$host['host'].'] '.S_ITEMS_DISABLED);*/
                     }
                 }
             }
         }
         $result = DBend($result);
         isset($_REQUEST['activate']) ? show_messages($result, S_ITEMS_ACTIVATED, null) : show_messages($result, S_ITEMS_DISABLED, null);
     } else {
         if ($_REQUEST['config'] == 5 && isset($_REQUEST['save'])) {
开发者ID:rennhak,项目名称:zabbix,代码行数:31,代码来源:hosts.php

示例7: show_messages

        }
        $item['itemid'] = $_REQUEST['itemid'];
        $result = API::Itemprototype()->update($item);
        show_messages($result, _('Item updated'), _('Cannot update item'));
    } else {
        $result = API::Itemprototype()->create($item);
        show_messages($result, _('Item added'), _('Cannot add item'));
    }
    $result = DBend($result);
    if ($result) {
        unset($_REQUEST['itemid'], $_REQUEST['form']);
    }
} elseif (($_REQUEST['go'] == 'activate' || $_REQUEST['go'] == 'disable') && isset($_REQUEST['group_itemid'])) {
    $group_itemid = $_REQUEST['group_itemid'];
    DBstart();
    $go_result = $_REQUEST['go'] == 'activate' ? activate_item($group_itemid) : disable_item($group_itemid);
    $go_result = DBend($go_result);
    show_messages($go_result, $_REQUEST['go'] == 'activate' ? _('Items activated') : _('Items disabled'), null);
} elseif ($_REQUEST['go'] == 'delete' && isset($_REQUEST['group_itemid'])) {
    $group_itemid = $_REQUEST['group_itemid'];
    DBstart();
    $go_result = API::Itemprototype()->delete($group_itemid);
    $go_result = DBend($go_result);
    show_messages($go_result, _('Items deleted'), _('Cannot delete items'));
}
if ($_REQUEST['go'] != 'none' && isset($go_result) && $go_result) {
    $url = new CUrl();
    $path = $url->getPath();
    insert_js('cookie.eraseArray("' . $path . '")');
}
/*
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:31,代码来源:disc_prototypes.php

示例8: DBend

        }
        $item['itemid'] = $_REQUEST['itemid'];
        $result = API::DiscoveryRule()->update($item);
        $result = DBend($result);
        show_messages($result, _('Discovery rule updated'), _('Cannot update discovery rule'));
    } else {
        $result = API::DiscoveryRule()->create(array($item));
        show_messages($result, _('Discovery rule created'), _('Cannot add discovery rule'));
    }
    if ($result) {
        unset($_REQUEST['itemid'], $_REQUEST['form']);
    }
} elseif (($_REQUEST['go'] == 'activate' || $_REQUEST['go'] == 'disable') && isset($_REQUEST['g_hostdruleid'])) {
    $groupHostDiscoveryRuleId = $_REQUEST['g_hostdruleid'];
    DBstart();
    $go_result = $_REQUEST['go'] == 'activate' ? activate_item($groupHostDiscoveryRuleId) : disable_item($groupHostDiscoveryRuleId);
    $go_result = DBend($go_result);
    show_messages($go_result, $_REQUEST['go'] == 'activate' ? _('Discovery rules activated') : _('Discovery rules disabled'), null);
} elseif ($_REQUEST['go'] == 'delete' && isset($_REQUEST['g_hostdruleid'])) {
    $go_result = API::DiscoveryRule()->delete($_REQUEST['g_hostdruleid']);
    show_messages($go_result, _('Discovery rules deleted'), _('Cannot delete discovery rules'));
}
if ($_REQUEST['go'] != 'none' && isset($go_result) && $go_result) {
    $url = new CUrl();
    $path = $url->getPath();
    insert_js('cookie.eraseArray("' . $path . '")');
}
/*
 * Display
 */
if (isset($_REQUEST['form'])) {
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:31,代码来源:host_discovery.php

示例9: DBend

                }
            }
            $go_result = DBend($go_result);
            show_messages($go_result, S_APPLICATION_DELETED, S_CANNOT_DELETE_APPLICATION);
        } else {
            if (str_in_array($_REQUEST['go'], array('activate', 'disable'))) {
                /* group operations */
                $go_result = true;
                $applications = get_request('applications', array());
                DBstart();
                foreach ($applications as $id => $appid) {
                    $sql = 'SELECT ia.itemid,i.hostid,i.key_' . ' FROM items_applications ia ' . ' LEFT JOIN items i ON ia.itemid=i.itemid ' . ' WHERE ia.applicationid=' . $appid . ' AND i.hostid=' . $_REQUEST['hostid'] . ' AND i.type<>9' . ' AND ' . DBin_node('ia.applicationid');
                    $res_items = DBselect($sql);
                    while ($item = DBfetch($res_items)) {
                        if ($_REQUEST['go'] == 'activate') {
                            $go_result &= activate_item($item['itemid']);
                        } else {
                            $go_result &= disable_item($item['itemid']);
                        }
                    }
                }
                $go_result = DBend($go_result);
                if ($_REQUEST['go'] == 'activate') {
                    show_messages($go_result, S_ITEMS_ACTIVATED, null);
                } else {
                    show_messages($go_result, S_ITEMS_DISABLED, null);
                }
            }
        }
    }
}
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:applications.php

示例10: show_messages

        $result = API::Itemprototype()->update($item);
        show_messages($result, _('Item prototype updated'), _('Cannot update item prototype'));
    } else {
        $result = API::Itemprototype()->create($item);
        show_messages($result, _('Item prototype added'), _('Cannot add item prototype'));
    }
    $result = DBend($result);
    if ($result) {
        unset($_REQUEST['itemid'], $_REQUEST['form']);
        clearCookies($result, getRequest('parent_discoveryid'));
    }
} elseif (str_in_array(getRequest('go'), array('activate', 'disable')) && hasRequest('group_itemid')) {
    $itemId = getRequest('group_itemid');
    DBstart();
    $isActivated = getRequest('go') == 'activate';
    $result = $isActivated ? activate_item($itemId) : disable_item($itemId);
    $result = DBend($result);
    show_messages($result, $isActivated ? _('Item prototypes activated') : _('Item prototypes disabled'));
    clearCookies($result, getRequest('parent_discoveryid'));
} elseif (getRequest('go') == 'delete' && hasRequest('group_itemid')) {
    DBstart();
    $result = API::Itemprototype()->delete(getRequest('group_itemid'));
    $result = DBend($result);
    show_messages($result, _('Item prototypes deleted'), _('Cannot delete item prototypes'));
    clearCookies($result, getRequest('parent_discoveryid'));
}
/*
 * Display
 */
if (isset($_REQUEST['form'])) {
    $data = getItemFormData();
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:31,代码来源:disc_prototypes.php

示例11: add_audit

            add_audit(AUDIT_ACTION_DELETE, AUDIT_RESOURCE_APPLICATION, 'Application [' . $dbApplication['name'] . '] from host [' . $host['host'] . ']');
        }
    }
    $goResult = DBend($goResult);
    show_messages($goResult, _('Application deleted'), _('Cannot delete application'));
    clearCookies($goResult, $_REQUEST['hostid']);
} elseif (str_in_array(getRequest('go'), array('activate', 'disable'))) {
    $result = true;
    $hostId = getRequest('hostid');
    $enable = getRequest('go') == 'activate';
    $updated = 0;
    DBstart();
    foreach (getRequest('applications') as $id => $appid) {
        $dbItems = DBselect('SELECT ia.itemid,i.hostid,i.key_' . ' FROM items_applications ia' . ' LEFT JOIN items i ON ia.itemid=i.itemid' . ' WHERE ia.applicationid=' . zbx_dbstr($appid) . ' AND i.hostid=' . zbx_dbstr($hostId) . ' AND i.type<>' . ITEM_TYPE_HTTPTEST . andDbNode('ia.applicationid'));
        while ($item = DBfetch($dbItems)) {
            $result &= $enable ? activate_item($item['itemid']) : disable_item($item['itemid']);
            $updated++;
        }
    }
    $result = DBend($result);
    $messageSuccess = $enable ? _n('Item enabled', 'Items enabled', $updated) : _n('Item disabled', 'Items disabled', $updated);
    $messageFailed = $enable ? _n('Cannot enable item', 'Cannot enable items', $updated) : _n('Cannot disable item', 'Cannot disable items', $updated);
    show_messages($result, $messageSuccess, $messageFailed);
    clearCookies($result, $hostId);
}
/*
 * Display
 */
if (isset($_REQUEST['form'])) {
    $data = array('applicationid' => get_request('applicationid'), 'groupid' => get_request('groupid', 0), 'form' => get_request('form'), 'form_refresh' => get_request('form_refresh', 0));
    if (isset($data['applicationid']) && !isset($_REQUEST['form_refresh'])) {
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:31,代码来源:applications.php


注:本文中的activate_item函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。