Commit 5a3b27f3f59539a0b7e1de5fbf0b99a36f4b5977
1 parent
e877e0a9
Exists in
master
Relatório de usuário logado
Showing
1 changed file
with
33 additions
and
0 deletions
Show diff stats
src/Cacic/CommonBundle/Controller/LogController.php
| @@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
| 2 | 2 | ||
| 3 | namespace Cacic\CommonBundle\Controller; | 3 | namespace Cacic\CommonBundle\Controller; |
| 4 | 4 | ||
| 5 | +use Cacic\CommonBundle\Entity\LogUserLogado; | ||
| 5 | use Doctrine\Common\Util\Debug; | 6 | use Doctrine\Common\Util\Debug; |
| 6 | use Symfony\Component\HttpFoundation\Request; | 7 | use Symfony\Component\HttpFoundation\Request; |
| 7 | use Symfony\Component\HttpFoundation\Response; | 8 | use Symfony\Component\HttpFoundation\Response; |
| @@ -11,6 +12,8 @@ use Cacic\CommonBundle\Entity\Log; | @@ -11,6 +12,8 @@ use Cacic\CommonBundle\Entity\Log; | ||
| 11 | use Cacic\CommonBundle\Form\Type\LogPesquisaType; | 12 | use Cacic\CommonBundle\Form\Type\LogPesquisaType; |
| 12 | use Cacic\CommonBundle\Form\Type\InsucessoInstalacaoPesquisaType; | 13 | use Cacic\CommonBundle\Form\Type\InsucessoInstalacaoPesquisaType; |
| 13 | use Cacic\CommonBundle\Form\Type\SrcacicConexaoPesquisaType; | 14 | use Cacic\CommonBundle\Form\Type\SrcacicConexaoPesquisaType; |
| 15 | +use Cacic\CommonBundle\Form\Type\LogUserLogadoType; | ||
| 16 | + | ||
| 14 | 17 | ||
| 15 | /** | 18 | /** |
| 16 | * | 19 | * |
| @@ -218,4 +221,34 @@ class LogController extends Controller | @@ -218,4 +221,34 @@ class LogController extends Controller | ||
| 218 | ) | 221 | ) |
| 219 | ); | 222 | ); |
| 220 | } | 223 | } |
| 224 | + | ||
| 225 | + /** | ||
| 226 | + * | ||
| 227 | + * Página de log dos usuários logados nas estações | ||
| 228 | + * @param Symfony\Component\HttpFoundation\Request $request | ||
| 229 | + */ | ||
| 230 | + public function usuarioAction( Request $request ) | ||
| 231 | + { | ||
| 232 | + $form = $this->createForm( new LogUserLogadoType() ); | ||
| 233 | + | ||
| 234 | + if ( $request->isMethod('POST') ) | ||
| 235 | + { | ||
| 236 | + $form->bind( $request ); | ||
| 237 | + $data = $form->getData(); | ||
| 238 | + $locale = $request->getLocale(); | ||
| 239 | + $filtroLocais = array(); // Inicializa array com locais a pesquisar | ||
| 240 | + foreach ( $data['idLocal'] as $locais ) | ||
| 241 | + array_push( $filtroLocais, $locais->getIdLocal() ); | ||
| 242 | + $computadores = $this->getDoctrine()->getRepository( 'CacicCommonBundle:LogUserLogado') | ||
| 243 | + ->selectUserLogado($data['teIpComputador'],$data['nmComputador'] ,$data['usuario'],$data['dtHrInclusao'],$data['dtHrInclusaoFim'] ); | ||
| 244 | + } | ||
| 245 | + | ||
| 246 | + return $this->render( 'CacicCommonBundle:Log:usuario.html.twig', | ||
| 247 | + array( | ||
| 248 | + 'local'=>$locale , | ||
| 249 | + 'form' => $form->createView(), | ||
| 250 | + 'computadores' => ( $computadores ) | ||
| 251 | + ) | ||
| 252 | + ); | ||
| 253 | + } | ||
| 221 | } | 254 | } |