本文整理汇总了PHP中disable_item函数的典型用法代码示例。如果您正苦于以下问题:PHP disable_item函数的具体用法?PHP disable_item怎么用?PHP disable_item使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了disable_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'));
}
示例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'])) {
示例3: show_messages
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 {
$hosts_ids = array();
$group_ids = $_REQUEST['copy_targetid'];
$db_hosts = DBselect('SELECT DISTINCT h.hostid' . ' FROM hosts h,hosts_groups hg' . ' WHERE h.hostid=hg.hostid' . ' AND ' . dbConditionInt('hg.groupid', $group_ids));
while ($db_host = DBfetch($db_hosts)) {
$hosts_ids[] = $db_host['hostid'];
}
}
示例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'])) {
示例5: disable_item
function disable_item($itemids)
{
zbx_value2array($itemids);
// first update status for child items
$chd_items = array();
$db_tmp_items = DBselect('SELECT i.itemid,i.hostid FROM items i WHERE ' . dbConditionInt('i.templateid', $itemids));
while ($db_tmp_item = DBfetch($db_tmp_items)) {
$chd_items[$db_tmp_item['itemid']] = $db_tmp_item['itemid'];
}
if (!empty($chd_items)) {
disable_item($chd_items);
// Recursion !!!
}
return update_item_status($itemids, ITEM_STATUS_DISABLED);
}
示例6: get_request
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'])) {
$result = true;
$hosts = get_request('hosts', array());
DBstart();
if (isset($_REQUEST['hostid'])) {
$result = update_proxy($_REQUEST['hostid'], $_REQUEST['host'], $hosts);
示例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 . '")');
}
/*
示例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'])) {
示例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);
}
}
}
}
}
if ($_REQUEST['go'] != 'none' && isset($go_result) && $go_result) {
$url = new CUrl();
示例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();
示例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'])) {