/** * Update a node * * @param array $params The parameters for create a node */ public static function update($params) { if (isset($params['object_id'])) { $poller_id = $params['object_id']; } else { $poller_id = $params['poller_id']; } $result = PollerRepository::getNode($poller_id); if (!isset($result['node_id'])) { throw new Exception(sprintf('Could not find node id from poller id %s', $poller_id)); } $nodeId = $result['node_id']; $nodeParams = array(); if (isset($params['name'])) { $nodeParams['name'] = $params['name']; } if (isset($params['ip_address'])) { $nodeParams['ip_address'] = $params['ip_address']; } if (isset($params['enable'])) { $nodeParams['enable'] = $params['enable']; } Node::update($nodeId, $nodeParams); }
/** * Get the node information * * @return array */ public static function getNode($pollerId) { $poller = Poller::get($pollerId); return Node::get($poller['node_id']); }
/** * Update a poller * * @method get * @route /poller/[i:id] */ public function editAction() { $params = $this->getParams(); $poller = PollerModel::get($params['id']); $node = NodeModel::get($poller['node_id']); $this->tpl->addJs('poller-template.js', 'bottom', 'centreon-configuration'); parent::editAction(array(), array('ip_address' => $node['ip_address'])); }