Пример #1
0
 private static function item($action, $params)
 {
     CItem::$error = array();
     switch ($action) {
         case 'add':
             $result = CItem::add($params);
             break;
         case 'get':
             $result = CItem::get($params);
             break;
         case 'getById':
             $result = CItem::getById($params);
             break;
         case 'getId':
             $result = CItem::getId($params);
             break;
         case 'update':
             $result = CItem::update($params);
             break;
         case 'delete':
             $result = CItem::delete($params);
             break;
         default:
             self::$result = array('error' => ZBX_API_ERROR_NO_METHOD, 'data' => 'Method: "' . $action . '" doesn\'t exist.');
             return;
             //exit function
     }
     if ($result !== false) {
         self::$result = array('result' => $result);
     } else {
         self::$result = CItem::$error;
     }
 }
Пример #2
0
                                                        if ($item['templateid'] != ITEM_TYPE_ZABBIX) {
                                                            unset($group_itemid[$item['itemid']]);
                                                            error(S_ITEM . SPACE . "'" . $item['host'] . ':' . item_description($item) . "'" . SPACE . S_CANNOT_DELETE_ITEM . SPACE . '(' . S_TEMPLATED_ITEM . ')');
                                                            continue;
                                                        } else {
                                                            if ($item['type'] == ITEM_TYPE_HTTPTEST) {
                                                                unset($group_itemid[$item['itemid']]);
                                                                error(S_ITEM . SPACE . "'" . $item['host'] . ':' . item_description($item) . "'" . SPACE . S_CANNOT_DELETE_ITEM . SPACE . '(' . S_WEB_ITEM . ')');
                                                                continue;
                                                            }
                                                        }
                                                        add_audit(AUDIT_ACTION_DELETE, AUDIT_RESOURCE_ITEM, S_ITEM . ' [' . $item['key_'] . '] [' . $item['itemid'] . '] ' . S_HOST . ' [' . $item['host'] . ']');
                                                    }
                                                    $go_result &= !empty($group_itemid);
                                                    if ($go_result) {
                                                        $go_result = CItem::delete($group_itemid);
                                                    }
                                                    show_messages($go_result, S_ITEMS_DELETED, S_CANNOT_DELETE_ITEMS);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}