Commit f43296e4a730e9b8f773e9d3b700cf60262c914e

Authored by Bruno Menezes
1 parent 984b172c
Exists in master and in 1 other branch 3.1

módulo força coleta por máquina

src/Cacic/CommonBundle/Controller/ComputadorController.php
... ... @@ -148,6 +148,48 @@ class ComputadorController extends Controller
148 148 );
149 149 }
150 150  
  151 + public function coletarAction(Request $request)
  152 + {
  153 + $form = $this->createForm( new ComputadorConsultaType() );
  154 + if ( $request->isMethod('POST') )
  155 + {
  156 + $form->bind( $request );
  157 + $data = $form->getData();
  158 +
  159 +
  160 + $computadores = $this->getDoctrine()->getRepository( 'CacicCommonBundle:Computador')
  161 + ->selectIp($data['teIpComputador'],$data['nmComputador'],$data['teNodeAddress'],$data['idComputador'] );
  162 +
  163 + }
  164 +
  165 + return $this->render( 'CacicCommonBundle:Computador:coletar.html.twig',
  166 + array(
  167 + 'form' => $form->createView(),
  168 + 'computadores' => $computadores));
  169 +
  170 + }
  171 +
  172 + /**
  173 + * @param int $idComputador
  174 + */
  175 + public function updateAction( Request $request, $idComputador)
  176 + {
  177 + $computador = $this->getDoctrine()->getRepository( 'CacicCommonBundle:Computador' )->find( $idComputador );
  178 + if ( !$computador )
  179 + throw $this->createNotFoundException( 'Computador não encontrado' );
  180 + else
  181 + {
  182 + $computador->setForcaColeta('S');
  183 + $this->getDoctrine()->getManager()->persist( $computador );
  184 + $this->getDoctrine()->getManager()->flush();
  185 +
  186 + throw $this->createNotFoundException( 'Computador não encontrado' );
  187 +
  188 + return $this->redirect($this->generateUrl('cacic_computador_coletar') );
  189 + }
  190 +
  191 + }
  192 +
151 193 /**
152 194 *
153 195 * [AJAX][jqTree] Carrega as subredes, do local informado, com computadores monitorados
... ...