示例#1
0
 private static function graph($action, $params)
 {
     CGraph::$error = array();
     switch ($action) {
         case 'add':
             $result = CGraph::add($params);
             break;
         case 'get':
             $result = CGraph::get($params);
             break;
         case 'getById':
             $result = CGraph::getById($params);
             break;
         case 'getId':
             $result = CGraph::getId($params);
             break;
         case 'update':
             $result = CGraph::update($params);
             break;
         case 'addItems':
             $result = CGraph::addItems($params);
             break;
         case 'deleteItems':
             $result = CGraph::deleteItems($params);
             break;
         case 'delete':
             $result = CGraph::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 = CGraph::$error;
     }
 }
示例#2
0
 /**
  * Delete graphs
  *
  * @static
  * @param array $graphids
  * @return boolean
  */
 public static function delete($graphids)
 {
     $result = delete_graph($graphids);
     if ($result) {
         return true;
     } else {
         self::$error = array('error' => ZBX_API_ERROR_INTERNAL, 'data' => 'Internal zabbix error');
         return false;
     }
 }
 private static function graph($action, $params)
 {
     CGraph::$error = array();
     switch ($action) {
         default:
             $result = call_user_func(array('CGraph', $action), $params);
     }
     self::$result = $result;
 }