diff --git a/src/Cacic/CommonBundle/Controller/AgenteController.php b/src/Cacic/CommonBundle/Controller/AgenteController.php
index efb7865..fa843d6 100644
--- a/src/Cacic/CommonBundle/Controller/AgenteController.php
+++ b/src/Cacic/CommonBundle/Controller/AgenteController.php
@@ -115,7 +115,7 @@ class AgenteController extends Controller {
$current = @basename(@readlink($windowsDir."current"));
$saida['windows']['live_version'] = $current;
- $logger->debug("4444444444444444444444444444444444 ".print_r($saida, true));
+ //$logger->debug("4444444444444444444444444444444444 ".print_r($saida, true));
if ( $request->isMethod('POST') )
{
diff --git a/src/Cacic/CommonBundle/Controller/TipoSoController.php b/src/Cacic/CommonBundle/Controller/TipoSoController.php
new file mode 100644
index 0000000..cbd0262
--- /dev/null
+++ b/src/Cacic/CommonBundle/Controller/TipoSoController.php
@@ -0,0 +1,95 @@
+getDoctrine()->getRepository( 'CacicCommonBundle:TipoSo' )->paginar( $this->get( 'knp_paginator' ), $page );
+ return $this->render( 'CacicCommonBundle:TipoSo:index.html.twig', array( 'So' => $arrso ) );
+
+ }
+ public function cadastrarAction(Request $request)
+ {
+ $so = new TipoSo();
+ $form = $this->createForm(new TipoSoType(), $so);
+
+ if ( $request->isMethod('POST') )
+ {
+ $form->bind( $request );
+ if ( $form->isValid() )
+ {
+ $this->getDoctrine()->getManager()->persist( $so );
+ $this->getDoctrine()->getManager()->flush(); //Persiste os dados do sistema operacional
+
+ $this->get('session')->getFlashBag()->add('success', 'Dados salvos com sucesso!');
+
+ return $this->redirect( $this->generateUrl( 'cacic_sistemaoperacional_index') );
+ }
+ }
+
+ return $this->render( 'CacicCommonBundle:So:cadastrar.html.twig', array( 'form' => $form->createView() ) );
+ }
+ /**
+ * Página de editar dados do sistema operacional
+ * @param int $idSo
+ */
+ public function editarAction( $idTipoSo, Request $request )
+ {
+ $so = $this->getDoctrine()->getRepository('CacicCommonBundle:TipoSo')->find( $idTipoSo );
+ if ( ! $so )
+ throw $this->createNotFoundException( 'Tipo de sistema operacional não encontrado' );
+ $form = $this->createForm( new TipoSoType(), $so);
+
+ if ( $request->isMethod('POST') )
+ {
+ $form->bind( $request );
+
+ if ( $form->isValid() )
+ {
+ $this->getDoctrine()->getManager()->persist( $so );
+ $this->getDoctrine()->getManager()->flush();// Efetuar a edição do sistema operacional
+
+
+ $this->get('session')->getFlashBag()->add('success', 'Dados salvos com sucesso!');
+
+ return $this->redirect($this->generateUrl('cacic_tiposo_editar', array( 'idTipoSo' => $so->getIdTipoSo() ) ) );
+ }
+ }
+
+ return $this->render( 'CacicCommonBundle:TipoSo:cadastrar.html.twig', array( 'form' => $form->createView() ) );
+ }
+
+ /**
+ *
+ * [AJAX] Exclusão de tipo de sistema operacional já cadastrado
+ * @param integer $idTipoSo
+ */
+ public function excluirAction( Request $request )
+ {
+ if ( ! $request->isXmlHttpRequest() ) // Verifica se se trata de uma requisição AJAX
+ throw $this->createNotFoundException( 'Página não encontrada' );
+
+ $So = $this->getDoctrine()->getRepository('CacicCommonBundle:TipoSo')->find( $request->get('id') );
+ if ( ! $So )
+ throw $this->createNotFoundException( 'Tipo de sistema operacional não encontrado' );
+
+ $em = $this->getDoctrine()->getManager();
+ $em->remove( $So );
+ $em->flush();
+
+ $response = new Response( json_encode( array('status' => 'ok') ) );
+ $response->headers->set('Content-Type', 'application/json');
+
+ return $response;
+ }
+
+}
\ No newline at end of file
diff --git a/src/Cacic/CommonBundle/Entity/RedeRepository.php b/src/Cacic/CommonBundle/Entity/RedeRepository.php
index eafc107..da7222a 100644
--- a/src/Cacic/CommonBundle/Entity/RedeRepository.php
+++ b/src/Cacic/CommonBundle/Entity/RedeRepository.php
@@ -224,6 +224,12 @@ class RedeRepository extends EntityRepository
return $qb->getQuery()->execute();
}
+ /**
+ * Computadores por subredes
+ *
+ * @return mixed
+ */
+
public function computadoresSubredes(){
$rsm = new ResultSetMapping();
@@ -256,4 +262,18 @@ class RedeRepository extends EntityRepository
return $query->execute();
}
+
+ /**
+ * Retorna lista de servidores de atualização
+ *
+ * @return \Doctrine\ORM\QueryBuilder
+ */
+
+ public function getServUpdateList() {
+
+ $qb = $this->createQueryBuilder('rede')
+ ->select('DISTINCT (rede.teServUpdates) as teServUpdates');
+
+ return $qb;
+ }
}
\ No newline at end of file
diff --git a/src/Cacic/CommonBundle/Entity/So.php b/src/Cacic/CommonBundle/Entity/So.php
index 5cb1694..ffc98dd 100644
--- a/src/Cacic/CommonBundle/Entity/So.php
+++ b/src/Cacic/CommonBundle/Entity/So.php
@@ -158,4 +158,32 @@ class So
{
return $this->teDescSo . ' ('. $this->sgSo .')';
}
-}
\ No newline at end of file
+ /**
+ * @var \Cacic\CommonBundle\Entity\TipoSo
+ */
+ private $tipo;
+
+
+ /**
+ * Set tipo
+ *
+ * @param \Cacic\CommonBundle\Entity\TipoSo $tipo
+ * @return So
+ */
+ public function setTipo(\Cacic\CommonBundle\Entity\TipoSo $tipo = null)
+ {
+ $this->tipo = $tipo;
+
+ return $this;
+ }
+
+ /**
+ * Get tipo
+ *
+ * @return \Cacic\CommonBundle\Entity\TipoSo
+ */
+ public function getTipo()
+ {
+ return $this->tipo;
+ }
+}
diff --git a/src/Cacic/CommonBundle/Entity/TipoSo.php b/src/Cacic/CommonBundle/Entity/TipoSo.php
new file mode 100644
index 0000000..ebf1e7e
--- /dev/null
+++ b/src/Cacic/CommonBundle/Entity/TipoSo.php
@@ -0,0 +1,100 @@
+idTipoSo;
+ }
+
+ /**
+ * Set tipo
+ *
+ * @param string $tipo
+ * @return TipoSo
+ */
+ public function setTipo($tipo)
+ {
+ $this->tipo = $tipo;
+
+ return $this;
+ }
+
+ /**
+ * Get tipo
+ *
+ * @return string
+ */
+ public function getTipo()
+ {
+ return $this->tipo;
+ }
+ /**
+ * @var \Doctrine\Common\Collections\Collection
+ */
+ private $so;
+
+ /**
+ * Constructor
+ */
+ public function __construct()
+ {
+ $this->so = new \Doctrine\Common\Collections\ArrayCollection();
+ }
+
+ /**
+ * Add so
+ *
+ * @param \Cacic\CommonBundle\Entity\So $so
+ * @return TipoSo
+ */
+ public function addSo(\Cacic\CommonBundle\Entity\So $so)
+ {
+ $this->so[] = $so;
+
+ return $this;
+ }
+
+ /**
+ * Remove so
+ *
+ * @param \Cacic\CommonBundle\Entity\So $so
+ */
+ public function removeSo(\Cacic\CommonBundle\Entity\So $so)
+ {
+ $this->so->removeElement($so);
+ }
+
+ /**
+ * Get so
+ *
+ * @return \Doctrine\Common\Collections\Collection
+ */
+ public function getSo()
+ {
+ return $this->so;
+ }
+}
diff --git a/src/Cacic/CommonBundle/Entity/TipoSoRepository.php b/src/Cacic/CommonBundle/Entity/TipoSoRepository.php
new file mode 100644
index 0000000..05d896d
--- /dev/null
+++ b/src/Cacic/CommonBundle/Entity/TipoSoRepository.php
@@ -0,0 +1,75 @@
+paginate(
+ $this->getEntityManager()->createQuery( $_dql ),
+ $page,
+ 10
+ );
+ }
+
+ /**
+ *
+ * Método de listagem dos Tipo de Software cadastrados e respectivas informações
+ */
+ public function listar()
+ {
+ $_dql = "SELECT s
+ FROM CacicCommonBundle:TipoSo s
+ ORDER BY s.tipo";
+
+ return $this->getEntityManager()->createQuery( $_dql )->getArrayResult();
+ }
+
+ /**
+ * Insere tipo de SO
+ *
+ * @param $te_so
+ * @return TipoSo|null|object
+ */
+
+ public function createIfNotExist( $te_so )
+ {
+ $so = $this->findOneBy( array ( 'tipo' => $te_so ) );
+
+ if( empty( $so ) )
+ {
+ $so = new TipoSo();
+
+ $so->setTipo($te_so);
+ $this->getEntityManager()->persist( $so );
+ $this->getEntityManager()->flush();
+
+ }
+
+ return $so;
+
+ }
+
+}
diff --git a/src/Cacic/CommonBundle/Entity/TipoSoftware.php b/src/Cacic/CommonBundle/Entity/TipoSoftware.php
index c449568..c05696c 100644
--- a/src/Cacic/CommonBundle/Entity/TipoSoftware.php
+++ b/src/Cacic/CommonBundle/Entity/TipoSoftware.php
@@ -62,4 +62,4 @@ class TipoSoftware
{
return $this->getTeDescricaoTipoSoftware();
}
-}
\ No newline at end of file
+}
diff --git a/src/Cacic/CommonBundle/Form/Type/SoType.php b/src/Cacic/CommonBundle/Form/Type/SoType.php
index 951d717..34c7b5e 100644
--- a/src/Cacic/CommonBundle/Form/Type/SoType.php
+++ b/src/Cacic/CommonBundle/Form/Type/SoType.php
@@ -48,6 +48,15 @@ class SoType extends AbstractType
'label'=>'Sistema Operacional MS-Windows'
)
);
+ $builder->add(
+ 'tipo',
+ 'entity',
+ array(
+ 'label' => 'Tipo de Sistema Operacional',
+ 'class' => 'CacicCommonBundle:TipoSo',
+ 'property' => 'tipo'
+ )
+ );
}
/**
diff --git a/src/Cacic/CommonBundle/Form/Type/TipoSoType.php b/src/Cacic/CommonBundle/Form/Type/TipoSoType.php
new file mode 100644
index 0000000..a0c1156
--- /dev/null
+++ b/src/Cacic/CommonBundle/Form/Type/TipoSoType.php
@@ -0,0 +1,41 @@
+add(
+ 'tipo',
+ null,
+ array( 'label'=>'Tipo de SO' )
+ );
+ }
+
+ /**
+ * (non-PHPdoc)
+ * @see Symfony\Component\Form.FormTypeInterface::getName()
+ */
+ public function getName()
+ {
+ return 'TipoSo';
+ }
+
+}
\ No newline at end of file
diff --git a/src/Cacic/CommonBundle/Resources/config/doctrine/So.orm.yml b/src/Cacic/CommonBundle/Resources/config/doctrine/So.orm.yml
index 950e60d..0b075bd 100644
--- a/src/Cacic/CommonBundle/Resources/config/doctrine/So.orm.yml
+++ b/src/Cacic/CommonBundle/Resources/config/doctrine/So.orm.yml
@@ -31,4 +31,15 @@ Cacic\CommonBundle\Entity\So:
fixed: true
nullable: false
column: in_mswindows
+ manyToOne:
+ tipo:
+ targetEntity: TipoSo
+ cascade: { }
+ mappedBy: null
+ inversedBy: null
+ nullable: true
+ joinColumns:
+ id_tipo_so:
+ referencedColumnName: id_tipo_so
+ orphanRemoval: false
lifecycleCallbacks: { }
diff --git a/src/Cacic/CommonBundle/Resources/config/doctrine/TipoSo.orm.yml b/src/Cacic/CommonBundle/Resources/config/doctrine/TipoSo.orm.yml
new file mode 100644
index 0000000..6b07905
--- /dev/null
+++ b/src/Cacic/CommonBundle/Resources/config/doctrine/TipoSo.orm.yml
@@ -0,0 +1,23 @@
+Cacic\CommonBundle\Entity\TipoSo:
+ type: entity
+ table: tipo_so
+ repositoryClass: Cacic\CommonBundle\Entity\TipoSoRepository
+ fields:
+ idTipoSo:
+ id: true
+ type: integer
+ unsigned: false
+ nullable: false
+ column: id_tipo_so
+ generator:
+ strategy: IDENTITY
+ tipo:
+ type: text
+ fixed: false
+ nullable: true
+ column: tipo
+ oneToMany:
+ so:
+ targetEntity: So
+ mappedBy: tipo
+ lifecycleCallbacks: { }
diff --git a/src/Cacic/CommonBundle/Resources/config/routing.yml b/src/Cacic/CommonBundle/Resources/config/routing.yml
index 1cc4d2a..61867d1 100644
--- a/src/Cacic/CommonBundle/Resources/config/routing.yml
+++ b/src/Cacic/CommonBundle/Resources/config/routing.yml
@@ -300,10 +300,6 @@ cacic_grupo_usuario_excluir:
pattern: /admin/grupousuario/excluir
defaults: { _controller: CacicCommonBundle:GrupoUsuario:excluir}
-cacic_ateste:
- pattern: /admin/ateste/
- defaults: { _controller: CacicCommonBundle:Ateste:index }
-
cacic_agente:
pattern: /admin/agente/
defaults: { _controller: CacicCommonBundle:Agente:index }
@@ -329,6 +325,10 @@ cacic_atualizacao_subredes:
# INÍCIO: Usuário com perfil manutenção
############################################
+cacic_ateste:
+ pattern: /manutencao/ateste/
+ defaults: { _controller: CacicCommonBundle:Ateste:index }
+
cacic_aplicativo_index:
pattern: /manutencao/aplicativo/{page}
defaults: {_controller: CacicCommonBundle:Aplicativo:index, page: 1 }
@@ -370,6 +370,8 @@ cacic_tiposoftware_excluir:
pattern: /manutencao/tiposoftware/excluir
defaults: { _controller: CacicCommonBundle:TipoSoftware:excluir}
+# Sistemas Operacionais
+
cacic_sistemaoperacional_index:
pattern: /manutencao/sistemaoperacional/{page}
defaults: {_controller: CacicCommonBundle:So:index, page: 1 }
@@ -390,6 +392,28 @@ cacic_sistemaoperacional_excluir:
pattern: /manutencao/sistemaoperacional/excluir
defaults: { _controller: CacicCommonBundle:So:excluir}
+
+cacic_tiposo_index:
+ pattern: /manutencao/tiposo/{page}
+ defaults: {_controller: CacicCommonBundle:TipoSo:index, page: 1 }
+ requirements:
+ page: \d+
+
+cacic_tiposo_cadastrar:
+ pattern: /manutencao/tiposo/cadastrar
+ defaults: { _controller: CacicCommonBundle:TipoSo:cadastrar}
+
+cacic_tiposo_editar:
+ pattern: /manutencao/tiposo/editar/{idTipoSo}
+ defaults: { _controller: CacicCommonBundle:TipoSo:editar}
+ requirements:
+ idTipoSo: \d+
+
+cacic_tiposo_excluir:
+ pattern: /manutencao/tiposo/excluir
+ defaults: { _controller: CacicCommonBundle:TipoSo:excluir}
+
+
cacic_software_index:
pattern: /manutencao/software/{page}
defaults: {_controller: CacicCommonBundle:Software:index, page: 1 }
diff --git a/src/Cacic/CommonBundle/Resources/views/So/index.html.twig b/src/Cacic/CommonBundle/Resources/views/So/index.html.twig
index c152bad..9862b74 100644
--- a/src/Cacic/CommonBundle/Resources/views/So/index.html.twig
+++ b/src/Cacic/CommonBundle/Resources/views/So/index.html.twig
@@ -22,11 +22,12 @@
@@ -41,6 +42,11 @@
{{ "Descrição"|trans }}
- MS-Windows?
+ MS-Windows?
{{ "ID Interna"|trans }}
- {{ "ID Externa"|trans }}
+ {{ "ID Externa"|trans }}
{{ "Sigla"|trans }}
{{ "Total de Máquinas"|trans }}
+ {{ "Tipo de SO"|trans }}
{{ "Ações"|trans }}
+ {{ "Os itens destacados em"|trans }} {{ "vermelho"|trans }} {{ "são de preenchimento obrigatório"|trans }}. +
+{{ "Neste módulo deverão ser cadastrados os Tipos de Sistema Operacional"|trans }}
+{{ "Tipo"|trans }} | +{{ "Ações"|trans }} | +
---|---|
{{ so.tipo }} | ++ + + + + + + + | +
{{ "NENHUM REGISTRO ENCONTRADO!"|trans }} | +