Пример #1
0
 public function executeXportRRA(sfWebRequest $request)
 {
     $etva_network = EtvaNetworkPeer::retrieveByPK($request->getParameter('id'));
     if (!$etva_network) {
         $error = array('success' => false, 'agent' => sfConfig::get('config_acronym'), 'error' => 'Network not found');
         $error = $this->setJsonError($error);
         return $this->renderText($error);
     }
     $etva_server = $etva_network->getEtvaServer();
     $etva_node = $etva_server->getEtvaNode();
     $graph_start = $request->getParameter('graph_start');
     $graph_end = $request->getParameter('graph_end');
     $step = $request->getParameter('step');
     $mac_strip = str_replace(':', '', $etva_network->getMac());
     try {
         $network_rra = new ServerNetworkRRA($etva_node->getUuid(), $etva_server->getUuid(), $mac_strip);
         $this->getResponse()->setContentType('text/xml');
         $this->getResponse()->setHttpHeader('Content-Type', 'text/xml', TRUE);
         $this->getResponse()->sendHttpHeaders();
         $this->getResponse()->setContent($network_rra->xportData($graph_start, $graph_end, $step));
         return sfView::HEADER_ONLY;
     } catch (sfException $e) {
         $error = array('success' => false, 'error' => $e->getMessage());
         $error = $this->setJsonError($error);
         return $this->renderText($error);
     }
 }