Ejemplo n.º 1
0
 public function executeGraphPNG(sfWebRequest $request)
 {
     $etva_network = EtvaNetworkPeer::retrieveByPK($request->getParameter('id'));
     $etva_server = $etva_network->getEtvaServer();
     $etva_node = $etva_server->getEtvaNode();
     $graph_start = $request->getParameter('graph_start');
     $graph_end = $request->getParameter('graph_end');
     $mac_strip = str_replace(':', '', $etva_network->getMac());
     try {
         $network_rra = new ServerNetworkRRA($etva_node->getUuid(), $etva_server->getUuid(), $mac_strip);
         $title = sprintf("%s :: %s", $etva_server->getName(), $etva_network->getMac());
         $this->getResponse()->setContentType('image/png');
         $this->getResponse()->setHttpHeader('Content-Type', 'image/png', TRUE);
         $this->getResponse()->sendHttpHeaders();
         $this->getResponse()->setContent(print $network_rra->getGraphImg($title, $graph_start, $graph_end));
         return sfView::HEADER_ONLY;
     } catch (sfFileException $e) {
         $error = array('success' => false, 'error' => $e->getMessage());
         $error = $this->setJsonError($error);
         return $this->renderText($error);
     }
 }