diff options
Diffstat (limited to 'admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository')
16 files changed, 1371 insertions, 0 deletions
diff --git a/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/ClientRepository.php b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/ClientRepository.php new file mode 100644 index 00000000..2e4d2c10 --- /dev/null +++ b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/ClientRepository.php @@ -0,0 +1,99 @@ +<?php + +/* + * This file is part of the Opengnsys Project package. + * + * Created by Miguel Angel de Vega Alcantara on 01/10/18. <miguelangel.devega@sic.uhu.es> + * Copyright (c) 2015 Opengnsys. All rights reserved. + * + */ + +namespace Opengnsys\ServerBundle\Repository; + +use Opengnsys\CoreBundle\Repository\BaseRepository; + +/** + * ClientRepository + * + * This class was generated by the Doctrine ORM. Add your own custom + * repository methods below. + */ +class ClientRepository extends BaseRepository +{ + + public function searchStatus($clients , $ou){ + $qb = $this->createQueryBuilder('o'); + + $qb->select('o.id, o.status'); + + if($ou){ + $qb->andWhere("o.organizationalUnit = :organizationalUnit")->setParameter("organizationalUnit", $ou); + } + + if($clients){ + $qb->andWhere("o.id in (:clients)")->setParameter("clients", $clients); + } + + try { + $objects = $qb->getQuery()->getScalarResult(); + } catch (NoResultException $e) { + $message = sprintf('Unable to find an objects'); + throw new NotFoundHttpException($message, null, 0, $e); + } + return $objects; + } + + public function findByObservable($term = "", $limit = null, $offset = null, $ordered = array(), $selects = array(), $searchs = array(), $matching = array()) + { + $qb = $this->createQueryBuilder('o'); + + if(count($selects) > 0){ + $qb = $this->createSelect($qb, $selects); + }else{ + $qb->select("DISTINCT o.createdAt, o.updatedAt, o.notes, o.name, o.serialno, o.netiface, o.netdriver, o.mac, o.ip, o.status, o.cache, o.idproautoexec, o.oglive, o.id"); + } + + if($term != ""){ + if(count($searchs) > 0){ + $qb = $this->createSearch($qb, $term, $searchs); + }else{ + $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.name LIKE :term OR o.serialno LIKE :term OR o.netiface LIKE :term OR o.netdriver LIKE :term OR o.mac LIKE :term OR o.ip LIKE :term OR o.status LIKE :term OR o.cache LIKE :term OR o.idproautoexec LIKE :term OR o.oglive LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%'); + } + } + + $qb = $this->createMaching($qb, $matching); + + $qb = $this->createOrdered($qb, $ordered); + + if($limit != null){ + $qb->setMaxResults($limit); + } + + if($offset){ + $qb->setFirstResult($offset); + } + + $entities = $qb->getQuery()->getScalarResult(); + return $entities; + } + + public function countFiltered($term = "", $searchs = array(), $matching = array()) + { + $qb = $this->createQueryBuilder('o'); + + $qb->select("count(DISTINCT o.id)"); + + if($term != ""){ + if(count($searchs) > 0){ + $qb = $this->createSearch($qb, $term, $searchs); + }else{ + $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.name LIKE :term OR o.serialno LIKE :term OR o.netiface LIKE :term OR o.netdriver LIKE :term OR o.mac LIKE :term OR o.ip LIKE :term OR o.status LIKE :term OR o.cache LIKE :term OR o.idproautoexec LIKE :term OR o.oglive LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%'); + } + } + + $qb = $this->createMaching($qb, $matching); + + $count = $qb->getQuery()->getSingleScalarResult(); + return $count; + } +} diff --git a/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/CommandRepository.php b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/CommandRepository.php new file mode 100644 index 00000000..410f51a3 --- /dev/null +++ b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/CommandRepository.php @@ -0,0 +1,76 @@ +<?php + +/* + * This file is part of the Opengnsys Project package. + * + * Created by Miguel Angel de Vega Alcantara on 01/10/18. <miguelangel.devega@sic.uhu.es> + * Copyright (c) 2015 Opengnsys. All rights reserved. + * + */ + +namespace Opengnsys\ServerBundle\Repository; + +use Opengnsys\CoreBundle\Repository\BaseRepository; + +/** + * CommandRepository + * + * This class was generated by the Doctrine ORM. Add your own custom + * repository methods below. + */ +class CommandRepository extends BaseRepository +{ + public function findByObservable($term = "", $limit = null, $offset = null, $ordered = array(), $selects = array(), $searchs = array(), $matching = array()) + { + $qb = $this->createQueryBuilder('o'); + + if(count($selects) > 0){ + $qb = $this->createSelect($qb, $selects); + }else{ + $qb->select("DISTINCT o.createdAt, o.updatedAt, o.notes, o.title, o.type, o.script, o.parameters, o.id"); + } + + if($term != ""){ + if(count($searchs) > 0){ + $qb = $this->createSearch($qb, $term, $searchs); + }else{ + $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.title LIKE :term OR o.type LIKE :term OR o.script LIKE :term OR o.parameters LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%'); + } + } + + $qb = $this->createMaching($qb, $matching); + + $qb = $this->createOrdered($qb, $ordered); + + if($limit != null){ + $qb->setMaxResults($limit); + } + + if($offset){ + $qb->setFirstResult($offset); + } + + $entities = $qb->getQuery()->getScalarResult(); + return $entities; + } + + public function countFiltered($term = "", $searchs = array(), $matching = array()) + { + $qb = $this->createQueryBuilder('o'); + + $qb->select("count(DISTINCT o.id)"); + + if($term != ""){ + if(count($searchs) > 0){ + $qb = $this->createSearch($qb, $term, $searchs); + }else{ + $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.title LIKE :term OR o.type LIKE :term OR o.script LIKE :term OR o.parameters LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%'); + } + } + + $qb = $this->createMaching($qb, $matching); + + $count = $qb->getQuery()->getSingleScalarResult(); + return $count; + } +} diff --git a/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/HardwareProfileRepository.php b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/HardwareProfileRepository.php new file mode 100644 index 00000000..d26ade38 --- /dev/null +++ b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/HardwareProfileRepository.php @@ -0,0 +1,76 @@ +<?php + +/* + * This file is part of the Opengnsys Project package. + * + * Created by Miguel Angel de Vega Alcantara on 01/10/18. <miguelangel.devega@sic.uhu.es> + * Copyright (c) 2015 Opengnsys. All rights reserved. + * + */ + +namespace Opengnsys\ServerBundle\Repository; + +use Opengnsys\CoreBundle\Repository\BaseRepository; + +/** + * HardwareProfileRepository + * + * This class was generated by the Doctrine ORM. Add your own custom + * repository methods below. + */ +class HardwareProfileRepository extends BaseRepository +{ + public function findByObservable($term = "", $limit = null, $offset = null, $ordered = array(), $selects = array(), $searchs = array(), $matching = array()) + { + $qb = $this->createQueryBuilder('o'); + + if(count($selects) > 0){ + $qb = $this->createSelect($qb, $selects); + }else{ + $qb->select("DISTINCT o.createdAt, o.updatedAt, o.notes, o.description, o.comments, o.id"); + } + + if($term != ""){ + if(count($searchs) > 0){ + $qb = $this->createSearch($qb, $term, $searchs); + }else{ + $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.description LIKE :term OR o.comments LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%'); + } + } + + $qb = $this->createMaching($qb, $matching); + + $qb = $this->createOrdered($qb, $ordered); + + if($limit != null){ + $qb->setMaxResults($limit); + } + + if($offset){ + $qb->setFirstResult($offset); + } + + $entities = $qb->getQuery()->getScalarResult(); + return $entities; + } + + public function countFiltered($term = "", $searchs = array(), $matching = array()) + { + $qb = $this->createQueryBuilder('o'); + + $qb->select("count(DISTINCT o.id)"); + + if($term != ""){ + if(count($searchs) > 0){ + $qb = $this->createSearch($qb, $term, $searchs); + }else{ + $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.description LIKE :term OR o.comments LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%'); + } + } + + $qb = $this->createMaching($qb, $matching); + + $count = $qb->getQuery()->getSingleScalarResult(); + return $count; + } +} diff --git a/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/HardwareRepository.php b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/HardwareRepository.php new file mode 100644 index 00000000..e37dee3f --- /dev/null +++ b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/HardwareRepository.php @@ -0,0 +1,76 @@ +<?php + +/* + * This file is part of the Opengnsys Project package. + * + * Created by Miguel Angel de Vega Alcantara on 01/10/18. <miguelangel.devega@sic.uhu.es> + * Copyright (c) 2015 Opengnsys. All rights reserved. + * + */ + +namespace Opengnsys\ServerBundle\Repository; + +use Opengnsys\CoreBundle\Repository\BaseRepository; + +/** + * HardwareRepository + * + * This class was generated by the Doctrine ORM. Add your own custom + * repository methods below. + */ +class HardwareRepository extends BaseRepository +{ + public function findByObservable($term = "", $limit = null, $offset = null, $ordered = array(), $selects = array(), $searchs = array(), $matching = array()) + { + $qb = $this->createQueryBuilder('o'); + + if(count($selects) > 0){ + $qb = $this->createSelect($qb, $selects); + }else{ + $qb->select("DISTINCT o.createdAt, o.updatedAt, o.notes, o.description, o.type, o.id"); + } + + if($term != ""){ + if(count($searchs) > 0){ + $qb = $this->createSearch($qb, $term, $searchs); + }else{ + $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.description LIKE :term OR o.type LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%'); + } + } + + $qb = $this->createMaching($qb, $matching); + + $qb = $this->createOrdered($qb, $ordered); + + if($limit != null){ + $qb->setMaxResults($limit); + } + + if($offset){ + $qb->setFirstResult($offset); + } + + $entities = $qb->getQuery()->getScalarResult(); + return $entities; + } + + public function countFiltered($term = "", $searchs = array(), $matching = array()) + { + $qb = $this->createQueryBuilder('o'); + + $qb->select("count(DISTINCT o.id)"); + + if($term != ""){ + if(count($searchs) > 0){ + $qb = $this->createSearch($qb, $term, $searchs); + }else{ + $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.description LIKE :term OR o.type LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%'); + } + } + + $qb = $this->createMaching($qb, $matching); + + $count = $qb->getQuery()->getSingleScalarResult(); + return $count; + } +} diff --git a/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/ImageRepository.php b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/ImageRepository.php new file mode 100644 index 00000000..e2620db6 --- /dev/null +++ b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/ImageRepository.php @@ -0,0 +1,76 @@ +<?php + +/* + * This file is part of the Opengnsys Project package. + * + * Created by Miguel Angel de Vega Alcantara on 01/10/18. <miguelangel.devega@sic.uhu.es> + * Copyright (c) 2015 Opengnsys. All rights reserved. + * + */ + +namespace Opengnsys\ServerBundle\Repository; + +use Opengnsys\CoreBundle\Repository\BaseRepository; + +/** + * ImageRepository + * + * This class was generated by the Doctrine ORM. Add your own custom + * repository methods below. + */ +class ImageRepository extends BaseRepository +{ + public function findByObservable($term = "", $limit = null, $offset = null, $ordered = array(), $selects = array(), $searchs = array(), $matching = array()) + { + $qb = $this->createQueryBuilder('o'); + + if(count($selects) > 0){ + $qb = $this->createSelect($qb, $selects); + }else{ + $qb->select("DISTINCT o.createdAt, o.updatedAt, o.notes, o.canonicalName, o.description, o.comments, o.path, o.type, o.revision, o.partitionInfo, o.fileSize, o.id"); + } + + if($term != ""){ + if(count($searchs) > 0){ + $qb = $this->createSearch($qb, $term, $searchs); + }else{ + $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.canonicalName LIKE :term OR o.description LIKE :term OR o.comments LIKE :term OR o.path LIKE :term OR o.type LIKE :term OR o.revision LIKE :term OR o.partitionInfo LIKE :term OR o.fileSize LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%'); + } + } + + $qb = $this->createMaching($qb, $matching); + + $qb = $this->createOrdered($qb, $ordered); + + if($limit != null){ + $qb->setMaxResults($limit); + } + + if($offset){ + $qb->setFirstResult($offset); + } + + $entities = $qb->getQuery()->getScalarResult(); + return $entities; + } + + public function countFiltered($term = "", $searchs = array(), $matching = array()) + { + $qb = $this->createQueryBuilder('o'); + + $qb->select("count(DISTINCT o.id)"); + + if($term != ""){ + if(count($searchs) > 0){ + $qb = $this->createSearch($qb, $term, $searchs); + }else{ + $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.canonicalName LIKE :term OR o.description LIKE :term OR o.comments LIKE :term OR o.path LIKE :term OR o.type LIKE :term OR o.revision LIKE :term OR o.partitionInfo LIKE :term OR o.fileSize LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%'); + } + } + + $qb = $this->createMaching($qb, $matching); + + $count = $qb->getQuery()->getSingleScalarResult(); + return $count; + } +} diff --git a/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/MenuRepository.php b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/MenuRepository.php new file mode 100644 index 00000000..bc07141d --- /dev/null +++ b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/MenuRepository.php @@ -0,0 +1,76 @@ +<?php + +/* + * This file is part of the Opengnsys Project package. + * + * Created by Miguel Angel de Vega Alcantara on 01/10/18. <miguelangel.devega@sic.uhu.es> + * Copyright (c) 2015 Opengnsys. All rights reserved. + * + */ + +namespace Opengnsys\ServerBundle\Repository; + +use Opengnsys\CoreBundle\Repository\BaseRepository; + +/** + * MenuRepository + * + * This class was generated by the Doctrine ORM. Add your own custom + * repository methods below. + */ +class MenuRepository extends BaseRepository +{ + public function findByObservable($term = "", $limit = null, $offset = null, $ordered = array(), $selects = array(), $searchs = array(), $matching = array()) + { + $qb = $this->createQueryBuilder('o'); + + if(count($selects) > 0){ + $qb = $this->createSelect($qb, $selects); + }else{ + $qb->select("DISTINCT o.createdAt, o.updatedAt, o.notes, o.description, o.idurlimg, o.title, o.publicxcoordinate, o.publicycoordinate, o.publicmode, o.privatexcoordinate, o.privateycoordinate, o.privatemode, o.comments, o.publicmenuhtml, o.privatemenuhtml, o.resolution, o.id"); + } + + if($term != ""){ + if(count($searchs) > 0){ + $qb = $this->createSearch($qb, $term, $searchs); + }else{ + $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.description LIKE :term OR o.idurlimg LIKE :term OR o.title LIKE :term OR o.publicxcoordinate LIKE :term OR o.publicycoordinate LIKE :term OR o.publicmode LIKE :term OR o.privatexcoordinate LIKE :term OR o.privateycoordinate LIKE :term OR o.privatemode LIKE :term OR o.comments LIKE :term OR o.publicmenuhtml LIKE :term OR o.privatemenuhtml LIKE :term OR o.resolution LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%'); + } + } + + $qb = $this->createMaching($qb, $matching); + + $qb = $this->createOrdered($qb, $ordered); + + if($limit != null){ + $qb->setMaxResults($limit); + } + + if($offset){ + $qb->setFirstResult($offset); + } + + $entities = $qb->getQuery()->getScalarResult(); + return $entities; + } + + public function countFiltered($term = "", $searchs = array(), $matching = array()) + { + $qb = $this->createQueryBuilder('o'); + + $qb->select("count(DISTINCT o.id)"); + + if($term != ""){ + if(count($searchs) > 0){ + $qb = $this->createSearch($qb, $term, $searchs); + }else{ + $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.description LIKE :term OR o.idurlimg LIKE :term OR o.title LIKE :term OR o.publicxcoordinate LIKE :term OR o.publicycoordinate LIKE :term OR o.publicmode LIKE :term OR o.privatexcoordinate LIKE :term OR o.privateycoordinate LIKE :term OR o.privatemode LIKE :term OR o.comments LIKE :term OR o.publicmenuhtml LIKE :term OR o.privatemenuhtml LIKE :term OR o.resolution LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%'); + } + } + + $qb = $this->createMaching($qb, $matching); + + $count = $qb->getQuery()->getSingleScalarResult(); + return $count; + } +} diff --git a/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/NetbootRepository.php b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/NetbootRepository.php new file mode 100644 index 00000000..8bb424dc --- /dev/null +++ b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/NetbootRepository.php @@ -0,0 +1,76 @@ +<?php + +/* + * This file is part of the Opengnsys Project package. + * + * Created by Miguel Angel de Vega Alcantara on 01/10/18. <miguelangel.devega@sic.uhu.es> + * Copyright (c) 2015 Opengnsys. All rights reserved. + * + */ + +namespace Opengnsys\ServerBundle\Repository; + +use Opengnsys\CoreBundle\Repository\BaseRepository; + +/** + * NetbootRepository + * + * This class was generated by the Doctrine ORM. Add your own custom + * repository methods below. + */ +class NetbootRepository extends BaseRepository +{ + public function findByObservable($term = "", $limit = null, $offset = null, $ordered = array(), $selects = array(), $searchs = array(), $matching = array()) + { + $qb = $this->createQueryBuilder('o'); + + if(count($selects) > 0){ + $qb = $this->createSelect($qb, $selects); + }else{ + $qb->select("DISTINCT o.createdAt, o.updatedAt, o.notes, o.name, o.filename, o.template, o.id"); + } + + if($term != ""){ + if(count($searchs) > 0){ + $qb = $this->createSearch($qb, $term, $searchs); + }else{ + $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.name LIKE :term OR o.filename LIKE :term OR o.template LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%'); + } + } + + $qb = $this->createMaching($qb, $matching); + + $qb = $this->createOrdered($qb, $ordered); + + if($limit != null){ + $qb->setMaxResults($limit); + } + + if($offset){ + $qb->setFirstResult($offset); + } + + $entities = $qb->getQuery()->getScalarResult(); + return $entities; + } + + public function countFiltered($term = "", $searchs = array(), $matching = array()) + { + $qb = $this->createQueryBuilder('o'); + + $qb->select("count(DISTINCT o.id)"); + + if($term != ""){ + if(count($searchs) > 0){ + $qb = $this->createSearch($qb, $term, $searchs); + }else{ + $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.name LIKE :term OR o.filename LIKE :term OR o.template LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%'); + } + } + + $qb = $this->createMaching($qb, $matching); + + $count = $qb->getQuery()->getSingleScalarResult(); + return $count; + } +} diff --git a/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/NetworkSettingsRepository.php b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/NetworkSettingsRepository.php new file mode 100644 index 00000000..7e2db0ee --- /dev/null +++ b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/NetworkSettingsRepository.php @@ -0,0 +1,76 @@ +<?php + +/* + * This file is part of the Opengnsys Project package. + * + * Created by Miguel Angel de Vega Alcantara on 01/10/18. <miguelangel.devega@sic.uhu.es> + * Copyright (c) 2015 Opengnsys. All rights reserved. + * + */ + +namespace Opengnsys\ServerBundle\Repository; + +use Opengnsys\CoreBundle\Repository\BaseRepository; + +/** + * NetworkSettingsRepository + * + * This class was generated by the Doctrine ORM. Add your own custom + * repository methods below. + */ +class NetworkSettingsRepository extends BaseRepository +{ + public function findByObservable($term = "", $limit = null, $offset = null, $ordered = array(), $selects = array(), $searchs = array(), $matching = array()) + { + $qb = $this->createQueryBuilder('o'); + + if(count($selects) > 0){ + $qb = $this->createSelect($qb, $selects); + }else{ + $qb->select("DISTINCT o.createdAt, o.updatedAt, o.notes, o.proxy, o.dns, o.netmask, o.router, o.ntp, o.p2pTime, o.p2pMode, o.mcastIp, o.mcastSpeed, o.mcastPort, o.mcastMode, o.id"); + } + + if($term != ""){ + if(count($searchs) > 0){ + $qb = $this->createSearch($qb, $term, $searchs); + }else{ + $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.proxy LIKE :term OR o.dns LIKE :term OR o.netmask LIKE :term OR o.router LIKE :term OR o.ntp LIKE :term OR o.p2pTime LIKE :term OR o.p2pMode LIKE :term OR o.mcastIp LIKE :term OR o.mcastSpeed LIKE :term OR o.mcastPort LIKE :term OR o.mcastMode LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%'); + } + } + + $qb = $this->createMaching($qb, $matching); + + $qb = $this->createOrdered($qb, $ordered); + + if($limit != null){ + $qb->setMaxResults($limit); + } + + if($offset){ + $qb->setFirstResult($offset); + } + + $entities = $qb->getQuery()->getScalarResult(); + return $entities; + } + + public function countFiltered($term = "", $searchs = array(), $matching = array()) + { + $qb = $this->createQueryBuilder('o'); + + $qb->select("count(DISTINCT o.id)"); + + if($term != ""){ + if(count($searchs) > 0){ + $qb = $this->createSearch($qb, $term, $searchs); + }else{ + $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.proxy LIKE :term OR o.dns LIKE :term OR o.netmask LIKE :term OR o.router LIKE :term OR o.ntp LIKE :term OR o.p2pTime LIKE :term OR o.p2pMode LIKE :term OR o.mcastIp LIKE :term OR o.mcastSpeed LIKE :term OR o.mcastPort LIKE :term OR o.mcastMode LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%'); + } + } + + $qb = $this->createMaching($qb, $matching); + + $count = $qb->getQuery()->getSingleScalarResult(); + return $count; + } +} diff --git a/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/OrganizationalUnitRepository.php b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/OrganizationalUnitRepository.php new file mode 100644 index 00000000..c63ee2a8 --- /dev/null +++ b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/OrganizationalUnitRepository.php @@ -0,0 +1,121 @@ +<?php + +/* + * This file is part of the Opengnsys Project package. + * + * Created by Miguel Angel de Vega Alcantara on 01/10/18. <miguelangel.devega@sic.uhu.es> + * Copyright (c) 2015 Opengnsys. All rights reserved. + * + */ + +namespace Opengnsys\ServerBundle\Repository; + +use Opengnsys\CoreBundle\Repository\BaseRepository; + +/** + * OrganizationalUnitRepository + * + * This class was generated by the Doctrine ORM. Add your own custom + * repository methods below. + */ +class OrganizationalUnitRepository extends BaseRepository +{ + + + public function findByObservable($term = "", $limit = null, $offset = null, $ordered = array(), $selects = array(), $searchs = array(), $matching = array()) + { + $qb = $this->createQueryBuilder('o'); + + if(count($selects) > 0){ + $qb = $this->createSelect($qb, $selects); + }else{ + $qb->select("DISTINCT o.createdAt, o.updatedAt, o.notes, o.name, o.description, o.comments, o.id"); + } + + if($term != ""){ + if(count($searchs) > 0){ + $qb = $this->createSearch($qb, $term, $searchs); + }else{ + $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.name LIKE :term OR o.description LIKE :term OR o.comments LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%'); + } + } + + $qb = $this->createMaching($qb, $matching); + + $qb = $this->createOrdered($qb, $ordered); + + if($limit != null){ + $qb->setMaxResults($limit); + } + + if($offset){ + $qb->setFirstResult($offset); + } + + $entities = $qb->getQuery()->getScalarResult(); + return $entities; + } + + public function countFiltered($term = "", $searchs = array(), $matching = array()) + { + $qb = $this->createQueryBuilder('o'); + + $qb->select("count(DISTINCT o.id)"); + + if($term != ""){ + if(count($searchs) > 0){ + $qb = $this->createSearch($qb, $term, $searchs); + }else{ + $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.name LIKE :term OR o.description LIKE :term OR o.comments LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%'); + } + } + + $qb = $this->createMaching($qb, $matching); + + $count = $qb->getQuery()->getSingleScalarResult(); + return $count; + } + + + /* + public function allBy($limit , $offset, $hierarchical, $leaf) + { + + $qb = $this->createQueryBuilder('o'); + + + + if($limit != null){ + $qb->setMaxResults($limit); + } + if($offset != null){ + $qb->setFirstResult($offset); + } + + try { + $objects = $qb->getQuery()->getResult(); + } catch (NoResultException $e) { + $message = sprintf('Unable to find an objects'); + throw new NotFoundHttpException($message, null, 0, $e); + } + return $objects; + } + */ + + + protected function createMaching($qb, $matching) + { + + if($matching['hierarchical']){ + $qb->andWhere("o.parent is null"); + }else if($matching['leaf']){ + $qb->andWhere("o.children is empty"); + } + + unset($matching['hierarchical']); + unset($matching['leaf']); + $qb = parent::createMaching($qb, $matching); + + return $qb; + } +} diff --git a/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/PartitionRepository.php b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/PartitionRepository.php new file mode 100644 index 00000000..5f7e0f2e --- /dev/null +++ b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/PartitionRepository.php @@ -0,0 +1,76 @@ +<?php + +/* + * This file is part of the Opengnsys Project package. + * + * Created by Miguel Angel de Vega Alcantara on 01/10/18. <miguelangel.devega@sic.uhu.es> + * Copyright (c) 2015 Opengnsys. All rights reserved. + * + */ + +namespace Opengnsys\ServerBundle\Repository; + +use Opengnsys\CoreBundle\Repository\BaseRepository; + +/** + * PartitionRepository + * + * This class was generated by the Doctrine ORM. Add your own custom + * repository methods below. + */ +class PartitionRepository extends BaseRepository +{ + public function findByObservable($term = "", $limit = null, $offset = null, $ordered = array(), $selects = array(), $searchs = array(), $matching = array()) + { + $qb = $this->createQueryBuilder('o'); + + if(count($selects) > 0){ + $qb = $this->createSelect($qb, $selects); + }else{ + $qb->select("DISTINCT o.createdAt, o.updatedAt, o.notes, o.numDisk, o.numPartition, o.size, o.usage, o.cacheContent, o.filesystem, o.partitionCode, o.osName, o.id"); + } + + if($term != ""){ + if(count($searchs) > 0){ + $qb = $this->createSearch($qb, $term, $searchs); + }else{ + $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.numDisk LIKE :term OR o.numPartition LIKE :term OR o.size LIKE :term OR o.usage LIKE :term OR o.cacheContent LIKE :term OR o.filesystem LIKE :term OR o.partitionCode LIKE :term OR o.osName LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%'); + } + } + + $qb = $this->createMaching($qb, $matching); + + $qb = $this->createOrdered($qb, $ordered); + + if($limit != null){ + $qb->setMaxResults($limit); + } + + if($offset){ + $qb->setFirstResult($offset); + } + + $entities = $qb->getQuery()->getScalarResult(); + return $entities; + } + + public function countFiltered($term = "", $searchs = array(), $matching = array()) + { + $qb = $this->createQueryBuilder('o'); + + $qb->select("count(DISTINCT o.id)"); + + if($term != ""){ + if(count($searchs) > 0){ + $qb = $this->createSearch($qb, $term, $searchs); + }else{ + $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.numDisk LIKE :term OR o.numPartition LIKE :term OR o.size LIKE :term OR o.usage LIKE :term OR o.cacheContent LIKE :term OR o.filesystem LIKE :term OR o.partitionCode LIKE :term OR o.osName LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%'); + } + } + + $qb = $this->createMaching($qb, $matching); + + $count = $qb->getQuery()->getSingleScalarResult(); + return $count; + } +} diff --git a/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/RepositoryRepository.php b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/RepositoryRepository.php new file mode 100644 index 00000000..ff8a0c3b --- /dev/null +++ b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/RepositoryRepository.php @@ -0,0 +1,115 @@ +<?php + +/* + * This file is part of the Opengnsys Project package. + * + * Created by Miguel Angel de Vega Alcantara on 01/10/18. <miguelangel.devega@sic.uhu.es> + * Copyright (c) 2015 Opengnsys. All rights reserved. + * + */ + +namespace Opengnsys\ServerBundle\Repository; + +use Opengnsys\CoreBundle\Repository\BaseRepository; + +/** + * RepositoryRepository + * + * This class was generated by the Doctrine ORM. Add your own custom + * repository methods below. + */ +class RepositoryRepository extends BaseRepository +{ + + /* + + public function allBy($limit , $offset, $organizationalUnit, $recursive) + { + + $qb = $this->createQueryBuilder('o'); + + if($organizationalUnit){ + $qb->andWhere("o.organizationalUnit = :organizationalUnit")->setParameter("organizationalUnit", $organizationalUnit); + } + + + if($hierarchical){ + $qb->andWhere("o.parent is null"); + }else if($leaf){ + $qb->andWhere("o.children is empty"); + } + + + if($limit != null){ + $qb->setMaxResults($limit); + } + if($offset != null){ + $qb->setFirstResult($offset); + } + + try { + $objects = $qb->getQuery()->getResult(); + } catch (NoResultException $e) { + $message = sprintf('Unable to find an objects'); + throw new NotFoundHttpException($message, null, 0, $e); + } + return $objects; + } + + + */ + + public function findByObservable($term = "", $limit = null, $offset = null, $ordered = array(), $selects = array(), $searchs = array(), $matching = array()) + { + $qb = $this->createQueryBuilder('o'); + + if(count($selects) > 0){ + $qb = $this->createSelect($qb, $selects); + }else{ + $qb->select("DISTINCT o.createdAt, o.updatedAt, o.notes, o.name, o.ip, o.password, o.configurationpath, o.adminpath, o.pxepath, o.port, o.description, o.id"); + } + + if($term != ""){ + if(count($searchs) > 0){ + $qb = $this->createSearch($qb, $term, $searchs); + }else{ + $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.name LIKE :term OR o.ip LIKE :term OR o.password LIKE :term OR o.configurationpath LIKE :term OR o.adminpath LIKE :term OR o.pxepath LIKE :term OR o.port LIKE :term OR o.description LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%'); + } + } + + $qb = $this->createMaching($qb, $matching); + + $qb = $this->createOrdered($qb, $ordered); + + if($limit != null){ + $qb->setMaxResults($limit); + } + + if($offset){ + $qb->setFirstResult($offset); + } + + $entities = $qb->getQuery()->getScalarResult(); + return $entities; + } + + public function countFiltered($term = "", $searchs = array(), $matching = array()) + { + $qb = $this->createQueryBuilder('o'); + + $qb->select("count(DISTINCT o.id)"); + + if($term != ""){ + if(count($searchs) > 0){ + $qb = $this->createSearch($qb, $term, $searchs); + }else{ + $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.name LIKE :term OR o.ip LIKE :term OR o.password LIKE :term OR o.configurationpath LIKE :term OR o.adminpath LIKE :term OR o.pxepath LIKE :term OR o.port LIKE :term OR o.description LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%'); + } + } + + $qb = $this->createMaching($qb, $matching); + + $count = $qb->getQuery()->getSingleScalarResult(); + return $count; + } +} diff --git a/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/SoftwareProfileRepository.php b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/SoftwareProfileRepository.php new file mode 100644 index 00000000..feefdc49 --- /dev/null +++ b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/SoftwareProfileRepository.php @@ -0,0 +1,76 @@ +<?php + +/* + * This file is part of the Opengnsys Project package. + * + * Created by Miguel Angel de Vega Alcantara on 01/10/18. <miguelangel.devega@sic.uhu.es> + * Copyright (c) 2015 Opengnsys. All rights reserved. + * + */ + +namespace Opengnsys\ServerBundle\Repository; + +use Opengnsys\CoreBundle\Repository\BaseRepository; + +/** + * SoftwareProfileRepository + * + * This class was generated by the Doctrine ORM. Add your own custom + * repository methods below. + */ +class SoftwareProfileRepository extends BaseRepository +{ + public function findByObservable($term = "", $limit = null, $offset = null, $ordered = array(), $selects = array(), $searchs = array(), $matching = array()) + { + $qb = $this->createQueryBuilder('o'); + + if(count($selects) > 0){ + $qb = $this->createSelect($qb, $selects); + }else{ + $qb->select("DISTINCT o.createdAt, o.updatedAt, o.notes, o.description, o.comments, o.id"); + } + + if($term != ""){ + if(count($searchs) > 0){ + $qb = $this->createSearch($qb, $term, $searchs); + }else{ + $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.description LIKE :term OR o.comments LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%'); + } + } + + $qb = $this->createMaching($qb, $matching); + + $qb = $this->createOrdered($qb, $ordered); + + if($limit != null){ + $qb->setMaxResults($limit); + } + + if($offset){ + $qb->setFirstResult($offset); + } + + $entities = $qb->getQuery()->getScalarResult(); + return $entities; + } + + public function countFiltered($term = "", $searchs = array(), $matching = array()) + { + $qb = $this->createQueryBuilder('o'); + + $qb->select("count(DISTINCT o.id)"); + + if($term != ""){ + if(count($searchs) > 0){ + $qb = $this->createSearch($qb, $term, $searchs); + }else{ + $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.description LIKE :term OR o.comments LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%'); + } + } + + $qb = $this->createMaching($qb, $matching); + + $count = $qb->getQuery()->getSingleScalarResult(); + return $count; + } +} diff --git a/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/SoftwareRepository.php b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/SoftwareRepository.php new file mode 100644 index 00000000..912a3c52 --- /dev/null +++ b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/SoftwareRepository.php @@ -0,0 +1,76 @@ +<?php + +/* + * This file is part of the Opengnsys Project package. + * + * Created by Miguel Angel de Vega Alcantara on 01/10/18. <miguelangel.devega@sic.uhu.es> + * Copyright (c) 2015 Opengnsys. All rights reserved. + * + */ + +namespace Opengnsys\ServerBundle\Repository; + +use Opengnsys\CoreBundle\Repository\BaseRepository; + +/** + * SoftwareRepository + * + * This class was generated by the Doctrine ORM. Add your own custom + * repository methods below. + */ +class SoftwareRepository extends BaseRepository +{ + public function findByObservable($term = "", $limit = null, $offset = null, $ordered = array(), $selects = array(), $searchs = array(), $matching = array()) + { + $qb = $this->createQueryBuilder('o'); + + if(count($selects) > 0){ + $qb = $this->createSelect($qb, $selects); + }else{ + $qb->select("DISTINCT o.createdAt, o.updatedAt, o.notes, o.description, o.type, o.id"); + } + + if($term != ""){ + if(count($searchs) > 0){ + $qb = $this->createSearch($qb, $term, $searchs); + }else{ + $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.description LIKE :term OR OR o.type LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%'); + } + } + + $qb = $this->createMaching($qb, $matching); + + $qb = $this->createOrdered($qb, $ordered); + + if($limit != null){ + $qb->setMaxResults($limit); + } + + if($offset){ + $qb->setFirstResult($offset); + } + + $entities = $qb->getQuery()->getScalarResult(); + return $entities; + } + + public function countFiltered($term = "", $searchs = array(), $matching = array()) + { + $qb = $this->createQueryBuilder('o'); + + $qb->select("count(DISTINCT o.id)"); + + if($term != ""){ + if(count($searchs) > 0){ + $qb = $this->createSearch($qb, $term, $searchs); + }else{ + $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.description LIKE :term OR o.type LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%'); + } + } + + $qb = $this->createMaching($qb, $matching); + + $count = $qb->getQuery()->getSingleScalarResult(); + return $count; + } +} diff --git a/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/TaskRepository.php b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/TaskRepository.php new file mode 100644 index 00000000..cd25e7c1 --- /dev/null +++ b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/TaskRepository.php @@ -0,0 +1,76 @@ +<?php + +/* + * This file is part of the Opengnsys Project package. + * + * Created by Miguel Angel de Vega Alcantara on 01/10/18. <miguelangel.devega@sic.uhu.es> + * Copyright (c) 2015 Opengnsys. All rights reserved. + * + */ + +namespace Opengnsys\ServerBundle\Repository; + +use Opengnsys\CoreBundle\Repository\BaseRepository; + +/** + * TaskRepository + * + * This class was generated by the Doctrine ORM. Add your own custom + * repository methods below. + */ +class TaskRepository extends BaseRepository +{ + public function findByObservable($term = "", $limit = null, $offset = null, $ordered = array(), $selects = array(), $searchs = array(), $matching = array()) + { + $qb = $this->createQueryBuilder('o'); + + if(count($selects) > 0){ + $qb = $this->createSelect($qb, $selects); + }else{ + $qb->select("DISTINCT o.createdAt, o.updatedAt, o.notes, o.command, o.script, o.data, o.id"); + } + + if($term != ""){ + if(count($searchs) > 0){ + $qb = $this->createSearch($qb, $term, $searchs); + }else{ + $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.command LIKE :term OR o.script LIKE :term OR o.data LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%'); + } + } + + $qb = $this->createMaching($qb, $matching); + + $qb = $this->createOrdered($qb, $ordered); + + if($limit != null){ + $qb->setMaxResults($limit); + } + + if($offset){ + $qb->setFirstResult($offset); + } + + $entities = $qb->getQuery()->getScalarResult(); + return $entities; + } + + public function countFiltered($term = "", $searchs = array(), $matching = array()) + { + $qb = $this->createQueryBuilder('o'); + + $qb->select("count(DISTINCT o.id)"); + + if($term != ""){ + if(count($searchs) > 0){ + $qb = $this->createSearch($qb, $term, $searchs); + }else{ + $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.command LIKE :term OR o.script LIKE :term OR o.data LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%'); + } + } + + $qb = $this->createMaching($qb, $matching); + + $count = $qb->getQuery()->getSingleScalarResult(); + return $count; + } +} diff --git a/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/TraceRepository.php b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/TraceRepository.php new file mode 100644 index 00000000..ddd2d717 --- /dev/null +++ b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/TraceRepository.php @@ -0,0 +1,124 @@ +<?php + +/* + * This file is part of the Opengnsys Project package. + * + * Created by Miguel Angel de Vega Alcantara on 01/10/18. <miguelangel.devega@sic.uhu.es> + * Copyright (c) 2015 Opengnsys. All rights reserved. + * + */ + +namespace Opengnsys\ServerBundle\Repository; + +use Opengnsys\CoreBundle\Repository\BaseRepository; + +/** + * TraceRepository + * + * This class was generated by the Doctrine ORM. Add your own custom + * repository methods below. + */ +class TraceRepository extends BaseRepository +{ + public function searchStatus($clients , $ou){ + $qb = $this->createQueryBuilder('o'); + + $qb->select('o.id, o.status'); + + if($ou){ + $qb->andWhere("o.organizationalUnit = :organizationalUnit")->setParameter("organizationalUnit", $ou); + } + + if($clients){ + $qb->andWhere("o.id in (:clients)")->setParameter("clients", $clients); + } + + try { + $objects = $qb->getQuery()->getScalarResult(); + } catch (NoResultException $e) { + $message = sprintf('Unable to find an objects'); + throw new NotFoundHttpException($message, null, 0, $e); + } + return $objects; + } + + public function findByObservable($term = "", $limit = null, $offset = null, $ordered = array(), $selects = array(), $searchs = array(), $matching = array()) + { + $qb = $this->createQueryBuilder('o'); + + if(count($selects) > 0){ + $qb = $this->createSelect($qb, $selects); + }else{ + $qb->select("DISTINCT o.createdAt, o.updatedAt, o.notes, o.title, o.commandType, o.script, o.status, o.output, o.error, o.executedAt, o.finishedAt, o.id"); + } + + if($term != ""){ + if(count($searchs) > 0){ + $qb = $this->createSearch($qb, $term, $searchs); + }else{ + $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.title LIKE :term OR o.commandType LIKE :term OR o.script LIKE :term OR o.status LIKE :term OR o.output LIKE :term OR o.error LIKE :term OR o.executedAt LIKE :term OR o.finishedAt LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%'); + } + } + + $qb = $this->createMaching($qb, $matching); + + $qb = $this->createOrdered($qb, $ordered); + + if($limit != null){ + $qb->setMaxResults($limit); + } + + if($offset){ + $qb->setFirstResult($offset); + } + + $entities = $qb->getQuery()->getScalarResult(); + return $entities; + } + + public function countFiltered($term = "", $searchs = array(), $matching = array()) + { + $qb = $this->createQueryBuilder('o'); + + $qb->select("count(DISTINCT o.id)"); + + if($term != ""){ + if(count($searchs) > 0){ + $qb = $this->createSearch($qb, $term, $searchs); + }else{ + $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.title LIKE :term OR o.commandType LIKE :term OR o.script LIKE :term OR o.status LIKE :term OR o.output LIKE :term OR o.error LIKE :term OR o.executedAt LIKE :term OR o.finishedAt LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%'); + } + } + + $qb = $this->createMaching($qb, $matching); + + $count = $qb->getQuery()->getSingleScalarResult(); + return $count; + } + + protected function createMaching($qb, $matching) + { + if(array_key_exists('finished', $matching) && $matching['finished'] != null){ + if($matching['finished']){ + $qb->andWhere("o.status is not null"); + }else{ + $qb->andWhere("o.status is null"); + } + unset($matching['finished']); + } + + if(array_key_exists("fromDate", $matching) && $matching['fromDate'] != null){ + $qb->andWhere("o.executedAt >= :fromDate")->setParameter("fromDate", $matching['fromDate']); + } + unset($matching['fromDate']); + + if(array_key_exists("toDate", $matching) && $matching['toDate'] != null){ + $qb->andWhere("o.executedAt <= :toDate")->setParameter("toDate", $matching['toDate']); + } + unset($matching['toDate']); + + $qb = parent::createMaching($qb, $matching); + + return $qb; + } +} diff --git a/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/ViewRepository.php b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/ViewRepository.php new file mode 100644 index 00000000..78f61c70 --- /dev/null +++ b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/ViewRepository.php @@ -0,0 +1,76 @@ +<?php + +/* + * This file is part of the Opengnsys Project package. + * + * Created by Miguel Angel de Vega Alcantara on 01/10/18. <miguelangel.devega@sic.uhu.es> + * Copyright (c) 2015 Opengnsys. All rights reserved. + * + */ + +namespace Opengnsys\ServerBundle\Repository; + +use Opengnsys\CoreBundle\Repository\BaseRepository; + +/** + * ViewRepository + * + * This class was generated by the Doctrine ORM. Add your own custom + * repository methods below. + */ +class ViewRepository extends BaseRepository +{ + public function findByObservable($term = "", $limit = null, $offset = null, $ordered = array(), $selects = array(), $searchs = array(), $matching = array()) + { + $qb = $this->createQueryBuilder('o'); + + if(count($selects) > 0){ + $qb = $this->createSelect($qb, $selects); + }else{ + $qb->select("DISTINCT o.createdAt, o.updatedAt, o.notes, o.name, o.comments, o.id"); + } + + if($term != ""){ + if(count($searchs) > 0){ + $qb = $this->createSearch($qb, $term, $searchs); + }else{ + $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.name LIKE :term OR o.comments LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%'); + } + } + + $qb = $this->createMaching($qb, $matching); + + $qb = $this->createOrdered($qb, $ordered); + + if($limit != null){ + $qb->setMaxResults($limit); + } + + if($offset){ + $qb->setFirstResult($offset); + } + + $entities = $qb->getQuery()->getScalarResult(); + return $entities; + } + + public function countFiltered($term = "", $searchs = array(), $matching = array()) + { + $qb = $this->createQueryBuilder('o'); + + $qb->select("count(DISTINCT o.id)"); + + if($term != ""){ + if(count($searchs) > 0){ + $qb = $this->createSearch($qb, $term, $searchs); + }else{ + $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.name LIKE :term OR o.comments LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%'); + } + } + + $qb = $this->createMaching($qb, $matching); + + $count = $qb->getQuery()->getSingleScalarResult(); + return $count; + } +} |