diff --git a/vmap/vas/rest/ws/cadastreV2/Adresse.class.inc b/vmap/vas/rest/ws/cadastreV2/Adresse.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..17b0c75c7d132185c96ea817dce146a5b9010cdd --- /dev/null +++ b/vmap/vas/rest/ws/cadastreV2/Adresse.class.inc @@ -0,0 +1,74 @@ +<?php + +require_once 'Cadastre.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; + +/** + * \file Adresse.class.inc + * \class Adresse + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the Adresse php class + * + * This class defines operation for one Adresse + * + */ +class Adresse extends Cadastre { + + public $oError; + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $bShortcut false to reinit variables + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { + parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); + $this->aSelectedFields = Array(id_par, 'id_com as ID_COM', 'id_par as ID_PAR', 'ccodep as CCODEP', 'ccodir as CCODIR', 'ccocom as CCOCOM', 'ccopre as CCOPRE', ' ccosec as CCOSEC', 'dnupla as DNUPLA', 'cenr as CENR', 'dcntpa as DCNTPA', 'dsrpar as DSRPAR', 'dnupro as DNUPRO', 'jdatat as JDATAT', 'dreflf as DREFLF', 'gpdl as GPDL', 'cprsecr as CPRSECR', 'ccosecr as CCOSECR', 'dnuplar as DNUPLAR', 'dnupdl as DNUPDL', 'gurbpa as GURBPA', 'dparpi as DPARPI', 'ccoarp as CCOARP', 'gparnf as GPARNF', 'gparbat as GPARBAT', 'ccovoi as CCOVOI', 'ccoriv as CCORIV', 'ccocif as CCOCIF', 'id_voie as ID_RIVOLI', 'id_dnupro as ID_DNUPRO', 'dnvoiri as DNVOIRI', 'dindic as DINDIC', 'l_nature_voie as L_NATURE_VOIE', 'dvoilib as DVOILIB'); + } + + /** + * @SWG\Get(path="/adresses/{ID_PAR}", + * tags={"Adresse"}, + * summary="Get Adresse", + * description="Request to get Adresse by id", + * operationId="GET", + * produces={"application/xml", "application/json", "application/x-vm-json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="ID_PAR", + * in="path", + * description="adresse id", + * required=true, + * type="integer", + * format="int32" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/adresse") + * ) + * ) + */ + + /** + * get informations about Adresse + */ + function GET() { + require __DIR__ . "/../vitis/" . $this->sRessourcesFile; + $this->aFields = $this->getFields($this->aProperties['schema_majic'], $this->aProperties['cadastre']['views']['adresse'], 'id_par'); + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/cadastreV2/Adresses.class.inc b/vmap/vas/rest/ws/cadastreV2/Adresses.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..fcece103af918ca061e714364e350c38fcb651e2 --- /dev/null +++ b/vmap/vas/rest/ws/cadastreV2/Adresses.class.inc @@ -0,0 +1,131 @@ +<?php + +/** + * \file Adresses.class.inc + * \class Adresses + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the Adresses php class + * + * This class defines Rest Api to Vmap Adresses + * + */ +require_once 'Cadastre.class.inc'; +require_once 'Adresse.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; + +class Adresses extends Cadastre { + /** + * @SWG\Definition( + * definition="/adresses", + * allOf={ + * @SWG\Schema(ref="#/definitions/adresses") + * } + * ) + * * @SWG\Tag( + * name="Adresses", + * description="Operations about Adresses" + * ) + */ + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $bShortcut false to reinit variables + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { + parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); + $this->aSelectedFields = Array(id_par, 'id_com as ID_COM', 'id_par as ID_PAR', 'ccodep as CCODEP', 'ccodir as CCODIR', 'ccocom as CCOCOM', 'ccopre as CCOPRE', 'ccosec as CCOSEC', 'dnupla as DNUPLA', 'cenr as CENR', 'dcntpa as DCNTPA', 'dsrpar as DSRPAR', ' dnupro as DNUPRO', 'jdata as JDATAT', 'dreflf as DREFLF', 'gpdl as GPDL', 'cprsecr as CPRSECR', 'ccosecr as CCOSECR', 'dnuplar as DNUPLAR', 'dnupdl as DNUPDL', 'gurbpa as GURBPA', 'dparpi as DPARPI', 'ccoarp as CCOARP', 'gparnf as GPARNF', 'gparbat as GPARBAT', 'ccovoi as CCOVOI', 'ccoriv as CCORIV', 'ccocif as CCOCIF', 'id_voie as ID_RIVOLI', 'id_dnupro as ID_DNUPRO', 'dnvoiri as DNVOIRI', 'dindic as DINDIC', 'l_nature_voie as L_NATURE_VOIE', 'dvoilib as DVOILIB'); + } + + /** + * @SWG\Get(path="/adresses", + * tags={"Adresse"}, + * summary="Get Adresses", + * description="Request to get Adresses", + * operationId="GET", + * produces={"application/xml", "application/json", "application/x-vm-json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="order_by", + * in="query", + * description="list of ordering fields", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="sort_order", + * in="query", + * description="sorted direction", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="limit", + * in="query", + * description="number of element", + * required=false, + * type="integer", + * default="4", + * format="int32" + * ), + * @SWG\Parameter( + * name="offset", + * in="query", + * description="index of first element", + * required=false, + * type="string", + * format="int32" + * ), + * @SWG\Parameter( + * name="attributs", + * in="query", + * description="list of attributs", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="filter", + * in="query", + * description="filter results", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="distinct", + * in="query", + * description="delete duplicates", + * required=false, + * type="boolean" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/adresses") + * ) + * ) + */ + + /** + * get Adresses + * @return Adresses + */ + function GET() { + $aReturn = $this->genericGet($this->aProperties['schema_majic'], $this->aProperties['cadastre']['views']['adresse'], 'id_par'); + return $aReturn['sMessage']; + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/cadastreV2/CHANGE_LOG.txt b/vmap/vas/rest/ws/cadastreV2/CHANGE_LOG.txt new file mode 100755 index 0000000000000000000000000000000000000000..ab4cb97e18b1c4504f42c020a7f3ad8d99909c2c --- /dev/null +++ b/vmap/vas/rest/ws/cadastreV2/CHANGE_LOG.txt @@ -0,0 +1,8 @@ + + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + + + + VEREMES - Web Service Cadastre (Modèle vMap) change log + + + + + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + diff --git a/vmap/vas/rest/ws/cadastreV2/Cadastre.class.inc b/vmap/vas/rest/ws/cadastreV2/Cadastre.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..1fa90641a457fc1a201b7171183087d49347e759 --- /dev/null +++ b/vmap/vas/rest/ws/cadastreV2/Cadastre.class.inc @@ -0,0 +1,36 @@ +<?php + +require_once __DIR__ . "/../../class/vitis_lib/DbClass.class.inc"; +require_once __DIR__ . '/../vmap/Vmap.class.inc'; + +class Cadastre extends Vmap { + + //Chemin du fichier de ressources contenant les requêtes SQL + var $sRessourcesFile = 'Vitis.class.sql.inc'; + + function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { + parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); + } + + /** + * Return true if the user have raghts on the "commune" else return false + * @param string $id_com + * @return boolean + */ + function haveCommuneRights($id_com) { + // Vérifie si on a les droits sur la commune + $aFilter = array( + 'column' => 'id_com', + 'compare_operator' => '=', + 'value' => $id_com + ); + $aCommunes = $this->vmapGet($this->aProperties['schema_cadastre'], $this->aProperties['cadastre']['views']['commune'], array('id_com'), $aFilter, array('limit' => 1)); + if (sizeOf($aCommunes) > 0) + return true; + else + return false; + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/cadastreV2/Commune.class.inc b/vmap/vas/rest/ws/cadastreV2/Commune.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..f5ba5ae12f14478fd369b5653796ac542723ee26 --- /dev/null +++ b/vmap/vas/rest/ws/cadastreV2/Commune.class.inc @@ -0,0 +1,74 @@ +<?php + +require_once 'Cadastre.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; + +/** + * \file Commune.class.inc + * \class Commune + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the Commune php class + * + * This class defines operation for one Commune + * + */ +class Commune extends Cadastre { + + public $oError; + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $bShortcut false to reinit variables + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { + parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); + $this->aSelectedFields = Array("id_com", "nom", "geom"); + } + + /** + * @SWG\Get(path="/communes/{id_com}", + * tags={"Commune"}, + * summary="Get Commune", + * description="Request to get Commune by id", + * operationId="GET", + * produces={"application/xml", "application/json", "application/x-vm-json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="id_com", + * in="path", + * description="commune id", + * required=true, + * type="integer", + * format="int32" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/commune") + * ) + * ) + */ + + /** + * get informations about Commune + */ + function GET() { + require __DIR__ . "/../vitis/" . $this->sRessourcesFile; + $this->aFields = $this->getFields($this->aProperties['schema_cadastre'], $this->aProperties['cadastre']['views']['commune'], 'id_com', 'vmap_cadastre_user', 'vmap_cadastre_user'); + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/cadastreV2/CommuneByGeom.class.inc b/vmap/vas/rest/ws/cadastreV2/CommuneByGeom.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..93c3b837b5cd17ae4466d8017296d8c2b66033a1 --- /dev/null +++ b/vmap/vas/rest/ws/cadastreV2/CommuneByGeom.class.inc @@ -0,0 +1,103 @@ +<?php + +require_once 'Cadastre.class.inc'; +require_once __DIR__ . '/../vitis/Vitis.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; + +/** + * \file communebygeom.class.inc + * \class CommuneByGeom + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the CommuneByGeom php class + * + * This class defines the rest api for communebygeom + * + */ +class CommuneByGeom extends Cadastre { + /** + * @SWG\Definition( + * definition="/communebygeom", + * allOf={ + * @SWG\Schema(ref="#/definitions/communebygeom") + * } + * ) + * * @SWG\Tag( + * name="CommuneByGeom", + * description="Operations about CommuneByGeom" + * ) + */ + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $bShortcut false to reinit variables + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { + parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); + $this->sSchema = $this->aProperties['schema_cadastre']; + $this->sTable = $this->aProperties['cadastre']['views']['commune']; + $this->aAttributs = Array("id_com", "texte", "geom"); + } + + /** + * @SWG\Get(path="/communebygeom", + * tags={"Commune"}, + * summary="Get the communebygeom whith a table", + * description="Request to get a element intersected", + * operationId="GET", + * produces={"application/json", "application/x-vm-json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="geom", + * in="query", + * description="wkt geometry to intersect with", + * required=false, + * default="POINT(739845.6672146925 6246677.620524088)", + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="CommuneByGeom Response", + * @SWG\Schema(ref="#/definitions/communebygeom") + * ) + * ) + */ + + /** + * Get function to generate a token + * @return the token + */ + function GET() { + + if (!in_array('vmap_cadastre_user', $this->oConnection->aPrivileges)) { + $oError = new VitisError(0, 'INSUFFICIENT_PRIVILEGES'); + $aXmlRacineAttribute['status'] = 0; + $sMessage = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); + return $sMessage; + } + + $sSchema = $this->sSchema; + $sTable = $this->sTable; + $aAttributs = $this->aAttributs; + $geom = $this->aValues['geom']; + + $aResult = $this->vmapIntersectGet($sSchema, $sTable, $geom, $aAttributs); + + return json_encode($aResult); + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/cadastreV2/Communes.class.inc b/vmap/vas/rest/ws/cadastreV2/Communes.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..8f3093d4d5daeae93ffd48dc43f76ba3d24cece6 --- /dev/null +++ b/vmap/vas/rest/ws/cadastreV2/Communes.class.inc @@ -0,0 +1,131 @@ +<?php + +/** + * \file Communes.class.inc + * \class Communes + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the Communes php class + * + * This class defines Rest Api to Vmap Communes + * + */ +require_once 'Cadastre.class.inc'; +require_once 'Commune.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; + +class Communes extends Cadastre { + /** + * @SWG\Definition( + * definition="/communes", + * allOf={ + * @SWG\Schema(ref="#/definitions/communes") + * } + * ) + * * @SWG\Tag( + * name="Communes", + * description="Operations about Communes" + * ) + */ + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $bShortcut false to reinit variables + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { + parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); + $this->aSelectedFields = Array("id_com", " substring (id_com, 3, 3) as code_com", "nom", "geom"); + } + + /** + * @SWG\Get(path="/communes", + * tags={"Commune"}, + * summary="Get Communes", + * description="Request to get Communes", + * operationId="GET", + * produces={"application/xml", "application/json", "application/x-vm-json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="order_by", + * in="query", + * description="list of ordering fields", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="sort_order", + * in="query", + * description="sorted direction", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="limit", + * in="query", + * description="number of element", + * required=false, + * type="integer", + * default="4", + * format="int32" + * ), + * @SWG\Parameter( + * name="offset", + * in="query", + * description="index of first element", + * required=false, + * type="string", + * format="int32" + * ), + * @SWG\Parameter( + * name="attributs", + * in="query", + * description="list of attributs", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="filter", + * in="query", + * description="filter results", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="distinct", + * in="query", + * description="delete duplicates", + * required=false, + * type="boolean" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/communes") + * ) + * ) + */ + + /** + * get Communes + * @return Communes + */ + function GET() { + $aReturn = $this->genericGet($this->aProperties['schema_cadastre'], $this->aProperties['cadastre']['views']['commune'], 'id_com'); + return $aReturn['sMessage']; + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/cadastreV2/DescriptionParcelle.class.inc b/vmap/vas/rest/ws/cadastreV2/DescriptionParcelle.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..3bcf56fca669b67b7462886ecd201daf30fc8686 --- /dev/null +++ b/vmap/vas/rest/ws/cadastreV2/DescriptionParcelle.class.inc @@ -0,0 +1,74 @@ +<?php + +require_once 'Cadastre.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; + +/** + * \file DescriptionParcelle.class.inc + * \class DescriptionParcelle + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the DescriptionParcelle php class + * + * This class defines operation for one DescriptionParcelle + * + */ +class DescriptionParcelle extends Cadastre { + + public $oError; + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $bShortcut false to reinit variables + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { + parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); + $this->aSelectedFields = Array('id_par', 'id_com as ID_COM', 'id_par as ID_PAR', 'ccodep as CCODEP', 'ccodir as CCODIR', 'ccocom as CCOCOM', 'ccopre as CCOPRE', 'ccosec as CCOSEC', 'dnupla as DNUPLA', 'cenr as CENR', 'dcntpa as DCNTPA', 'dsrpar as DSRPAR', ' dnupro as DNUPRO', 'jdata as JDATAT', 'dreflf as DREFLF', 'gpdl as GPDL', 'cprsecr as CPRSECR', 'ccosecr as CCOSECR', 'dnuplar as DNUPLAR', 'dnupdl as DNUPDL', 'gurbpa as GURBPA', 'dparpi as DPARPI', 'ccoarp as CCOARP', 'gparnf as GPARNF', 'gparbat as GPARBAT', 'ccovoi as CCOVOI', 'ccoriv as CCORIV', 'ccocif as CCOCIF', 'id_voie as ID_RIVOLI', 'id_dnupro as ID_DNUPRO', 'dnvoiri as DNVOIRI', 'dindic as DINDIC', 'l_nature_voie as L_NATURE_VOIE', 'dvoilib as DVOILIB'); + } + + /** + * @SWG\Get(path="/descriptionparcelles/{ID_PAR}", + * tags={"Parcelle"}, + * summary="Get DescriptionParcelle", + * description="Request to get DescriptionParcelle by id", + * operationId="GET", + * produces={"application/xml", "application/json", "application/x-vm-json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="ID_PAR", + * in="path", + * description="descriptionparcelle id", + * required=true, + * type="integer", + * format="int32" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/descriptionparcelle") + * ) + * ) + */ + + /** + * get informations about DescriptionParcelle + */ + function GET() { + require __DIR__ . "/../vitis/" . $this->sRessourcesFile; + $this->aFields = $this->getFields($this->aProperties['schema_majic'], $this->aProperties['cadastre']['views']['description_parcelle'], 'ID_PAR', 'vmap_cadastre_user', 'vmap_cadastre_user'); + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/cadastreV2/DescriptionParcelles.class.inc b/vmap/vas/rest/ws/cadastreV2/DescriptionParcelles.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..d7778ce60882c2116a6a422db929c18c6b7638cf --- /dev/null +++ b/vmap/vas/rest/ws/cadastreV2/DescriptionParcelles.class.inc @@ -0,0 +1,131 @@ +<?php + +/** + * \file DescriptionParcelles.class.inc + * \class DescriptionParcelles + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the DescriptionParcelles php class + * + * This class defines Rest Api to Vmap DescriptionParcelles + * + */ +require_once 'Cadastre.class.inc'; +require_once 'DescriptionParcelle.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; + +class DescriptionParcelles extends Cadastre { + /** + * @SWG\Definition( + * definition="/descriptionparcelles", + * allOf={ + * @SWG\Schema(ref="#/definitions/descriptionparcelles") + * } + * ) + * * @SWG\Tag( + * name="DescriptionParcelles", + * description="Operations about DescriptionParcelles" + * ) + */ + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $bShortcut false to reinit variables + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { + parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); + $this->aSelectedFields = Array('id_par', 'id_com as ID_COM', 'id_par as ID_PAR', 'ccodep as CCODEP', 'ccodir as CCODIR', 'ccocom as CCOCOM', 'ccopre as CCOPRE', 'ccosec as CCOSEC', 'dnupla as DNUPLA', 'cenr as CENR', 'dcntpa as DCNTPA', 'dsrpar as DSRPAR', ' dnupro as DNUPRO', 'jdata as JDATAT', 'dreflf as DREFLF', 'gpdl as GPDL', 'cprsecr as CPRSECR', 'ccosecr as CCOSECR', 'dnuplar as DNUPLAR', 'dnupdl as DNUPDL', 'gurbpa as GURBPA', 'dparpi as DPARPI', 'ccoarp as CCOARP', 'gparnf as GPARNF', 'gparbat as GPARBAT', 'ccovoi as CCOVOI', 'ccoriv as CCORIV', 'ccocif as CCOCIF', 'id_voie as ID_RIVOLI', 'id_dnupro as ID_DNUPRO', 'dnvoiri as DNVOIRI', 'dindic as DINDIC', 'l_nature_voie as L_NATURE_VOIE', 'dvoilib as DVOILIB'); + } + + /** + * @SWG\Get(path="/descriptionparcelles", + * tags={"Parcelle"}, + * summary="Get DescriptionParcelles", + * description="Request to get DescriptionParcelles", + * operationId="GET", + * produces={"application/xml", "application/json", "application/x-vm-json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="order_by", + * in="query", + * description="list of ordering fields", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="sort_order", + * in="query", + * description="sorted direction", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="limit", + * in="query", + * description="number of element", + * required=false, + * type="integer", + * default="4", + * format="int32" + * ), + * @SWG\Parameter( + * name="offset", + * in="query", + * description="index of first element", + * required=false, + * type="string", + * format="int32" + * ), + * @SWG\Parameter( + * name="attributs", + * in="query", + * description="list of attributs", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="filter", + * in="query", + * description="filter results", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="distinct", + * in="query", + * description="delete duplicates", + * required=false, + * type="boolean" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/descriptionparcelles") + * ) + * ) + */ + + /** + * get DescriptionParcelles + * @return DescriptionParcelles + */ + function GET() { + $aReturn = $this->genericGet($this->aProperties['schema_majic'], $this->aProperties['cadastre']['views']['description_parcelle'], 'ID_PAR'); + return $aReturn['sMessage']; + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/cadastreV2/DownloadRapport.class.inc b/vmap/vas/rest/ws/cadastreV2/DownloadRapport.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..668371f1ff7e55d8da9e269e9c38157c6c1fe27d --- /dev/null +++ b/vmap/vas/rest/ws/cadastreV2/DownloadRapport.class.inc @@ -0,0 +1,130 @@ +<?php + +require_once 'Cadastre.class.inc'; +require_once __DIR__ . '/../vitis/Vitis.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; + +/** + * \file downloadrapport.class.inc + * \class DownloadRapport + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the DownloadRapport php class + * + * This class defines the rest api for downloadrapport + * + */ +class DownloadRapport extends Cadastre { + /** + * @SWG\Definition( + * definition="/downloadrapport", + * allOf={ + * @SWG\Schema(ref="#/definitions/downloadrapport") + * } + * ) + * * @SWG\Tag( + * name="DownloadRapport", + * description="Operations about DownloadRapport" + * ) + */ + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $bShortcut false to reinit variables + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { + parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); + } + + /** + * @SWG\Get(path="/downloadrapport", + * tags={"ReleveDePropriete"}, + * summary="Create the releve de propriete sheet", + * description="Request to get the element", + * operationId="GET", + * produces={"application/json"}, + * @SWG\Parameter( + * name="sYear", + * in="query", + * description="year folder name (ex: 2013)", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="sType", + * in="query", + * description="type folder name", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="sFileName", + * in="query", + * description="file name (includes the extension)", + * required=true, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="DownloadRapport Response", + * @SWG\Schema(ref="#/definitions/downloadrapport") + * ) + * ) + */ + function GET() { + if (!in_array('vmap_cadastre_user', $this->oConnection->aPrivileges)) { + $oError = new VitisError(0, 'INSUFFICIENT_PRIVILEGES'); + $aXmlRacineAttribute['status'] = 0; + $sMessage = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); + return $sMessage; + } + + if ($this->oConnection->oError == null) { + if (!empty($this->aValues['sFileName'])) { + $aRestriction = explode('|', $_SESSION['ses_restriction']); + if (strpos($this->aValues['sFileName'], "../") === false) { + $sFile = $this->aProperties["cadastre"]["rp"]["rp_dir"] . "/" . $this->aValues['sYear'] . '/' . $this->aValues['sType'] . '/' . $this->aValues['sFileName']; + if (is_file($sFile)) { + switch (pathinfo($sFile, PATHINFO_EXTENSION)) { + case 'pdf': + if (file_exists($sFile)) { + header('Content-Type: application/pdf'); + } + break; + case 'xls': + if (file_exists($sFile)) { + header('Content-Type: application/vnd.ms-excel'); + } + break; + default: + http_response_code(403); + //echo (json_encode(array("status" => "0", "sMessage" => "forbidden"))); + exit; + break; + } + header('Expires: 0'); + header('Cache-Control: must-revalidate'); + header('Pragma: public'); + header('Content-Length: ' . filesize($sFile)); + readfile($sFile); + } else { + return 'Une erreur est survenue lors de la génération du rapport'; + } + } else { + http_response_code(403); + } + } + } else { + http_response_code(403); + } + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/cadastreV2/FicheDescriptiveInvariant.class.inc b/vmap/vas/rest/ws/cadastreV2/FicheDescriptiveInvariant.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..dba04017276986127734bcbfd5221fe3784d5562 --- /dev/null +++ b/vmap/vas/rest/ws/cadastreV2/FicheDescriptiveInvariant.class.inc @@ -0,0 +1,150 @@ +<?php + +require_once 'Cadastre.class.inc'; +require_once __DIR__ . '/../vitis/Vitis.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; + +/** + * \file fichedescriptiveinvariant.class.inc + * \class FicheDescriptiveInvariant + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the FicheDescriptiveInvariant php class + * + * This class defines the rest api for fichedescriptiveinvariant + * + */ +class FicheDescriptiveInvariant extends Cadastre { + /** + * @SWG\Definition( + * definition="/fichedescriptiveinvariant", + * allOf={ + * @SWG\Schema(ref="#/definitions/fichedescriptiveinvariant") + * } + * ) + * * @SWG\Tag( + * name="FicheDescriptiveInvariant", + * description="Operations about FicheDescriptiveInvariant" + * ) + */ + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $bShortcut false to reinit variables + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { + parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); + } + + /** + * @SWG\Get(path="/fichedescriptiveinvariant/{ID_BAT}", + * tags={"Invariant"}, + * summary="Get the fichedescriptiveinvariant whith a table", + * description="Request to get a element intersected", + * operationId="GET", + * produces={"application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="ID_BAT", + * in="path", + * description="ID_BAT", + * required=true, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="FicheDescriptiveInvariant Response", + * @SWG\Schema(ref="#/definitions/fichedescriptiveinvariant") + * ) + * ) + */ + + /** + * Get function to generate a token + * @return the token + */ + function GET() { + + if (!in_array('vmap_cadastre_user', $this->oConnection->aPrivileges)) { + $oError = new VitisError(0, 'INSUFFICIENT_PRIVILEGES'); + $aXmlRacineAttribute['status'] = 0; + $sMessage = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); + return $sMessage; + } + + // Infos sur l'invariant + $ID_BAT = $this->aPath[2]; + $sSchema = $this->aProperties['schema_majic']; + $sTable = 'v_vmap_maj_fiche_inv_descr'; +// $sFilter = "\"id_local\" = '" . $ID_BAT . "'"; + $aFilter = array( + 'column' => 'id_local', + 'compare_operator' => '=', + 'value' => $ID_BAT + ); + $aAttributs = Array('id_local as "ID_BAT"', 'dvoilib as "DVOILIB"', 'libcom as "LIBCOM"', 'id_com as "ID_COM"', 'l_dteloc as "L_DTELOC"', 'l_cconlc as "L_CCONLC"', 'l_dnatlc as "L_DNATLC"', 'jdatat as "JDATAT"', 'jannat as "JANNAT"', 'cchpr as "CCHPR"', 'bipevla1 as "BIPEVLA1"', 'dnbniv as "DNBNIV"', 'dnubat as "DNUBAT"', '"desc" as "DESC"', 'dniv as "DNIV"', 'dvltrt as "DVLTRT"', 'invar as "INVAR"'); + + $oInvariantInfos['data'] = $this->vmapGet($sSchema, $sTable, $aAttributs, $aFilter)[0]; + + // Infos sur le P.E.V + $sSchema = $this->aProperties['schema_majic']; + $sTable = 'v_vmap_maj_fiche_inv_pev'; + $aAttributs = Array('id_local as "ID_BAT"', 'dnupev as "DNUPEV"', 'l_ccoaff as "L_CCOAFF"', 'dcapec as "DCAPEC"', 'ccostb as "CCOSTB"', 'dnuref as "DNUREF"', 'bipevla1 as "BIPEVLA1"', 'vlbaia1 as "VLBAIA1"'); + + $oInvariantInfos['data']['PEV'] = $this->vmapGet($sSchema, $sTable, $aAttributs, $aFilter); + + // Infos sur les habitations + $sSchema = $this->aProperties['schema_majic']; + $sTable = 'v_vmap_maj_fiche_inv_hab'; + $aAttributs = Array('id_local as "ID_BAT"', 'dnupev as "DNUPEV"', 'geaulc as "GEAULC"', 'gelelc as "GELELC"', 'gchclc as "GCHCLC"', 'gteglc as "GTEGLC"', 'dnbbai as "DNBBAI"', 'dnbdou as "DNBDOU"', 'dnblav as "DNBLAV"', 'dnbwc as "DNBWC"', 'deqdha as "DEQDHA"', 'dnbppr as "DNBPPR"', 'dnbpdc as "DNBPDC"', + 'dsupdc as "DSUPDC"', 'l_dmatgm as "L_DMATGM"', 'l_dmatto as "L_DMATTO"', 'jannat as "JANNAT"', 'l_detent as "L_DETENT"', 'dnbniv as "DNBNIV"', 'dnbsam as "DNBSAM"', 'dnbcha as "DNBCHA"', 'dnbcu8 as "DNBCU8"', 'dnbcu9 as "DNBCU9"', 'dnbsea as "DNBSEA"', 'dnbann as "DNBANN"', 'cconad1 as "CCONAD1"', + 'l_cconad1 as "L_CCONAD1"', 'dsueic1 as "DSUEIC1"', 'cconad2 as "CCONAD2"', 'l_cconad2 as "L_CCONAD2"', 'dsueic2 as "DSUEIC2"', 'cconad3 as "CCONAD3"', 'l_cconad3 as "L_CCONAD3"', 'dsueic3 as "DSUEIC3"', 'cconad4 as "CCONAD4"', 'l_cconad4 as "L_CCONAD4"', 'dsueic4 as "DSUEIC4"'); + + $oInvariantInfos['data']['habitations'] = $this->vmapGet($sSchema, $sTable, $aAttributs, $aFilter); + + // Infos sur les locaux pros + $sSchema = $this->aProperties['schema_majic']; + $sTable = 'v_vmap_maj_fiche_inv_local_pro'; + $aAttributs = Array('id_local as "ID_BAT"', 'dnupev as "DNUPEV"', 'dnudes as "DNUDES"', 'vsurzt as "VSURZT"'); + + $oInvariantInfos['data']['locauxPros'] = $this->vmapGet($sSchema, $sTable, $aAttributs, $aFilter); + + // Infos sur les dépendances + $sSchema = $this->aProperties['schema_majic']; + $sTable = 'v_vmap_maj_fiche_inv_dep'; + $aAttributs = Array('id_local as "ID_BAT"', 'dnupev as "DNUPEV"', 'dsudep as "DSUDEP"', 'geaulc as "GEAULC"', 'gelelc as "GELELC"', 'gchclc as "GCHCLC"', 'dnbbai as "DNBBAI"', 'dnbdou as "DNBDOU"', 'dnblav as "DNBLAV"', 'dnbwc as "DNBWC"', 'l_dmagtm as "L_DMATGM"', 'l_dmatto as "L_DMATTO"', 'l_detent as "L_DETENT"', 'l_cconad as "L_CCONAD"'); + + $oInvariantInfos['data']['dependances'] = $this->vmapGet($sSchema, $sTable, $aAttributs, $aFilter); + + // Infos sur les propriétaires + $sSchema = $this->aProperties['schema_majic']; + $sTable = 'v_vmap_maj_fiche_inv_prop'; + $aAttributs = Array('id_local as "ID_BAT"', 'dqualp as "DQUALP"', 'ddenom as "DDENOM"', 'jdatnss as "JDATNSS"', 'dldnss as "DLDNSS"', 'dlign3 as "DLIGN3"', 'dlign4 as "DLIGN4"', 'dlign6 as "DLIGN6"', 'l_ccodem as "L_CCODEM"', 'l_ccodro as "L_CCODRO"'); + + $oInvariantInfos['data']['proprietaires'] = $this->vmapGet($sSchema, $sTable, $aAttributs, $aFilter); + + // Infos sur les lots + $sSchema = $this->aProperties['schema_majic']; + $sTable = 'v_vmap_maj_fiche_inv_lot'; + $aAttributs = Array('id_local as "ID_BAT"', 'klot as "KLOT"', 'dnumql as "DNUMQL"', 'ddenql as "DDENQL"'); + + $oInvariantInfos['data']['lots'] = $this->vmapGet($sSchema, $sTable, $aAttributs, $aFilter); + + return json_encode($oInvariantInfos); + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/cadastreV2/FicheDescriptiveParcelle.class.inc b/vmap/vas/rest/ws/cadastreV2/FicheDescriptiveParcelle.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..fe349bf2b43f19e99f091767202511d51869f263 --- /dev/null +++ b/vmap/vas/rest/ws/cadastreV2/FicheDescriptiveParcelle.class.inc @@ -0,0 +1,210 @@ +<?php + +require_once 'Cadastre.class.inc'; +require_once __DIR__ . '/../vitis/Vitis.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; + +/** + * \file fichedescriptiveparcelle.class.inc + * \class FicheDescriptiveParcelle + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the FicheDescriptiveParcelle php class + * + * This class defines the rest api for fichedescriptiveparcelle + * + */ +class FicheDescriptiveParcelle extends Cadastre { + /** + * @SWG\Definition( + * definition="/fichedescriptiveparcelle", + * allOf={ + * @SWG\Schema(ref="#/definitions/fichedescriptiveparcelle") + * } + * ) + * * @SWG\Tag( + * name="FicheDescriptiveParcelle", + * description="Operations about FicheDescriptiveParcelle" + * ) + */ + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $bShortcut false to reinit variables + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { + parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); + } + + /** + * @SWG\Get(path="/fichedescriptiveparcelle/{ID_PAR}", + * tags={"Parcelle"}, + * summary="Get the fichedescriptiveparcelle whith a table", + * description="Request to get a element intersected", + * operationId="GET", + * produces={"application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="ID_PAR", + * in="path", + * description="ID_PAR", + * required=true, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="FicheDescriptiveParcelle Response", + * @SWG\Schema(ref="#/definitions/fichedescriptiveparcelle") + * ) + * ) + */ + + /** + * Get function to generate a token + * @return the token + */ + function GET() { + + $ID_PAR = $this->aPath[2]; + + if (!in_array('vmap_cadastre_user', $this->oConnection->aPrivileges) && !in_array('vmap_cadastre_light_user', $this->oConnection->aPrivileges)) { + $oError = new VitisError(0, 'INSUFFICIENT_PRIVILEGES'); + $aXmlRacineAttribute['status'] = 0; + $sMessage = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); + return $sMessage; + } + + // Vérifie les droits de d'utilisateur sur la commune + if ($this->haveCommuneRights(substr($ID_PAR, 0, 5)) == false) { + http_response_code(403); + $aReturn['error']['errorMessage'] .= "L'utilisateur n'a pas les droits sur la commune"; + return json_encode($aReturn); + } + + // Infos sur la parcelle + $sSchema = $this->aProperties['schema_majic']; + $sTable = 'v_vmap_maj_fiche_prc_descr'; + $aFilter = array( + 'column' => 'id_par', + 'compare_operator' => '=', + 'value' => $ID_PAR + ); + $aAttributs = Array('id_par as "ID_PAR"', 'id_com as "ID_COM"', 'parcelle', 'commune', 'sup_fiscale', 'dcntpa as "DCNTPA"', 'dnvoiri as "DNVOIRI"', 'dindic as "DINDIC"', 'l_nature_voie as "L_NATURE_VOIE"', 'dvoilib as "DVOILIB"', 'ccoriv as "CCORIV"', 'gparbat as "GPARBAT"', 'gurbpa as "GURBPA"'); + + $oParcelleInfos['data'] = $this->vmapGet($sSchema, $sTable, $aAttributs, $aFilter)[0]; + + // Infos sur le proprietaire + $sSchemaProp = $this->aProperties['schema_majic']; + $sTableProp = 'v_vmap_maj_fiche_prc_prop'; + $aFilterProp = array( + 'column' => 'id_par', + 'compare_operator' => '=', + 'value' => $ID_PAR + ); + $aAttributsProp = Array('id_par as "ID_PAR"', 'dqualp as "DQUALP"', 'dnupro as "DNUPRO"', 'ddenom as "DDENOM"', 'jdatnss as "JDATNSS"', 'dldnss as "DLDNSS"', 'dlign3 as "DLIGN3"', 'dlign6 as "DLIGN6"', 'l_ccodem as "L_CCODEM"', 'l_ccodro as "L_CCODRO"', 'gdesip as "GDESIP"', 'dlign4 as "DLIGN4"'); + + $oParcelleInfos['data']['aProprietaires'] = $this->vmapGet($sSchemaProp, $sTableProp, $aAttributsProp, $aFilterProp); + + // infos sur la subdivision fiscale + $sSchemaSub = $this->aProperties['schema_majic']; + $sTableSub = 'v_vmap_maj_fiche_prc_suf'; + $aFilterSub = array( + 'column' => 'id_par', + 'compare_operator' => '=', + 'value' => $ID_PAR + ); + $aAttributsSub = Array('id_par as "ID_PAR"', 'ccosub as "CCOSUB"', 'dsgrpf as "DSGRPF"', 'cnatsp as "CNATSP"', 'l_dsgrpf as "L_DSGRPF"', 'dclssf as "DCLSSF"', 'dcntsf as "DCNTSF"', 'drcsuba as "DRCSUBA"', 'drcsub as "DRCSUB"'); + + $oParcelleInfos['data']['aSubdivisionFiscale'] = $this->vmapGet($sSchemaSub, $sTableSub, $aAttributsSub, $aFilterSub); + + // Infos sur le bâti + $sSchemaBatis = $this->aProperties['schema_majic']; + $sTableBatis = 'v_vmap_maj_fiche_prc_bat'; + $aFilterBatis = array( + 'column' => 'id_par', + 'compare_operator' => '=', + 'value' => $ID_PAR + ); + $aAttributsBatis = Array('id_local as "ID_BAT"', 'id_par as "ID_PAR"', 'invar as "INVAR"', 'id_local as "ID_BAT"', 'l_dteloc as "L_DTELOC"', 'l_cconlc as "L_CCONLC"', 'l_dnatlc as "L_DNATLC"', 'jdatat as "JDATAT"', 'jannat as "JANNAT"', 'ddenom as "DDENOM"'); + + $oParcelleInfos['data']['aBatis'] = $this->vmapGet($sSchemaBatis, $sTableBatis, $aAttributsBatis, $aFilterBatis); + + + // Infos complémentaires (paramétrées par l'administrateur) + $iTolerance = $this->aProperties["cadastre"]["descr_parcel"]["intersect"]["tolerance"]; + $aIntersectionViews = $this->aProperties['cadastre']['descr_parcel']['intersect']['views']; + + // Récupère la géométrie de la parcelle + $sSchema = $this->aProperties['schema_cadastre']; + $sTable = $this->aProperties['cadastre']['views']['parcelle']; + $aFilter = array( + 'column' => 'id_par', + 'compare_operator' => '=', + 'value' => $ID_PAR + ); + $aAttributs = Array('ST_AsEWKT(geom) as geom'); + $parcelleGeom = $this->vmapGet($sSchema, $sTable, $aAttributs, $aFilter)[0]['geom']; + + // Récupère les intersections + $oParcelleInfos['data']['aIntersections'] = array(); + + foreach ($aIntersectionViews as $key => $value) { + + if (strpos($key, ".") === false) { + $sSchema = "public"; + $sTable = $key; + } else { + $aTmp = explode(".", $key); + $sSchema = $aTmp[0]; + $sTable = $aTmp[1]; + } + $aAttributs = Array(); + + foreach ($value as $key2 => $value2) { + if ($key2 != 'title' && $key2 != 'type' && $key2 != 'intersect' && $key2 != 'geom_column') { + array_push($aAttributs, $key2); + } + } + + if (!empty($value['geom_column'])) { + $sGeomColumn = $value['geom_column']; + } else { + $sGeomColumn = 'geom'; + } + + if (!empty($value['type'])) { + $sGeomType = $value['type']; + } else { + $sGeomType = 'POLYGON'; + } + + $aIntersect = $this->vmapIntersectGet($sSchema, $sTable, $parcelleGeom, $aAttributs, $iTolerance, $sGeomColumn, $sGeomType); + + $value['data'] = $aIntersect; + if (isset($value['data'][0]) && !empty($value['data'][0])) { + $value['aFields'] = array_keys($value['data'][0]); + } else { + $value['aFields'] = array(); + } + + array_push($oParcelleInfos['data']['aIntersections'], $value); + } + + return json_encode($oParcelleInfos); + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/cadastreV2/FicheUrbanisme.class.inc b/vmap/vas/rest/ws/cadastreV2/FicheUrbanisme.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..0151bf5d8b8debc22f7eed3d4ef11717d8663ba0 --- /dev/null +++ b/vmap/vas/rest/ws/cadastreV2/FicheUrbanisme.class.inc @@ -0,0 +1,204 @@ +<?php + +require_once 'Cadastre.class.inc'; +require_once __DIR__ . '/../vitis/Vitis.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; + +/** + * \file ficheurbanisme.class.inc + * \class FicheUrbanisme + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the FicheUrbanisme php class + * + * This class defines the rest api for ficheurbanisme + * + */ +class FicheUrbanisme extends Cadastre { + /** + * @SWG\Definition( + * definition="/ficheurbanisme", + * allOf={ + * @SWG\Schema(ref="#/definitions/ficheurbanisme") + * } + * ) + * * @SWG\Tag( + * name="FicheUrbanisme", + * description="Operations about FicheUrbanisme" + * ) + */ + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $bShortcut false to reinit variables + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { + parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); + } + + /** + * @SWG\Get(path="/ficheurbanisme/{ID_PAR}", + * tags={"Parcelle"}, + * summary="Get the ficheurbanisme whith a table", + * description="Request to get a element intersected", + * operationId="GET", + * produces={"application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="ID_PAR", + * in="path", + * description="ID_PAR", + * required=true, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="FicheUrbanisme Response", + * @SWG\Schema(ref="#/definitions/ficheurbanisme") + * ) + * ) + */ + + /** + * Get function to generate a token + * @return the token + */ + function GET() { + + $ID_PAR = $this->aPath[2]; + + if (!in_array('vmap_cadastre_user', $this->oConnection->aPrivileges)) { + $oError = new VitisError(0, 'INSUFFICIENT_PRIVILEGES'); + $aXmlRacineAttribute['status'] = 0; + $sMessage = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); + return $sMessage; + } + + // Vérifie les droits de d'utilisateur sur la commune + if ($this->haveCommuneRights(substr($ID_PAR, 0, 5)) == false) { + http_response_code(403); + $aReturn['error']['errorMessage'] .= "L'utilisateur n'a pas les droits sur la commune"; + return json_encode($aReturn); + } + + // Infos sur la parcelle + $sSchema = $this->aProperties['schema_majic']; + $sTable = 'v_vmap_maj_fiche_urb'; + // $sFilter = "\"id_par\" = '" . $ID_PAR . "'"; + $aFilter = array( + 'column' => 'id_par', + 'compare_operator' => '=', + 'value' => $ID_PAR + ); + $aAttributs = Array('id_par as "ID_PAR"', 'libdep as "LIBDEP"', 'libcom as "LIBCOM"', 'dnupla as "DNUPLA"', 'ccosec as "CCOSEC"', 'dcntpa as "DCNTPA"', 'ddenom as "DDENOM"', 'dlign3 as "DLIGN3"', 'dlign4 as "DLIGN4"', 'dlign6 as "DLIGN6"', 'l_dsgrpf as "DSGRPF"', '"dnvoiri" || "dindic" || \' \' || "cconvo" || \' \' || "dvoilib" as "ADRESSE"'); + + $oParcelleInfos['data'] = $this->vmapGet($sSchema, $sTable, $aAttributs, $aFilter); + // Géométrie + $sSchema = $this->aProperties['schema_cadastre']; + $sTable = $this->aProperties['cadastre']['views']['parcelle']; + // $sFilter = "id_par = '" . $ID_PAR . "'"; + $aFilter = array( + 'column' => 'id_par', + 'compare_operator' => '=', + 'value' => $ID_PAR + ); + if (!empty($this->aValues['result_srid'])) + $aAttributs = Array('ST_AsEWKT(ST_Transform(geom, ' . $this->aValues['result_srid'] . ')) as geom'); + else + $aAttributs = Array('ST_AsEWKT(geom) as geom'); + + $aRecords = $this->vmapGet($sSchema, $sTable, $aAttributs, $aFilter); + $oParcelleInfos['data']['geometry'] = $aRecords[0]; + + // Récupère la géométrie de la parcelle + $parcelleGeom = $aRecords[0]['geom']; + + // Récupère les intersections + $oParcelleInfos['data']['aIntersections'] = array(); + $oParcelleInfos['data']['aIntersectionsArray'] = array(); + + // Infos complémentaires (paramétrées par l'administrateur) + $aIntersectionViews = $this->aProperties['cadastre']['fiche_urb']['intersect']['views']; + $iTolerance = $this->aProperties["cadastre"]["fiche_urb"]["intersect"]["tolerance"]; + if (is_array($aIntersectionViews)) { + foreach ($aIntersectionViews as $key => $value) { + if (strpos($key, ".") === false) { + $sSchema = "public"; + $sTable = $key; + } else { + $aTmp = explode(".", $key); + $sSchema = $aTmp[0]; + $sTable = $aTmp[1]; + } + $aAttributs = Array(); + $aOrderedKeys = Array(); + foreach ($value as $key2 => $value2) { + array_push($aOrderedKeys, $key2); + if ($key2 != 'title' && $key2 != 'type' && $key2 != 'intersect' && $key2 != 'geom_column') { + array_push($aAttributs, $key2); + } + } + + if (!empty($value['geom_column'])) { + $sGeomColumn = $value['geom_column']; + } else { + $sGeomColumn = 'geom'; + } + + if (!empty($value['type'])) { + $sGeomType = $value['type']; + } else { + $sGeomType = 'POLYGON'; + } + + $aIntersect = $this->vmapIntersectGet($sSchema, $sTable, $parcelleGeom, $aAttributs, $iTolerance, $sGeomColumn, $sGeomType); + + $value['data'] = $aIntersect; + $value['attributs'] = $aOrderedKeys; + + array_push($oParcelleInfos['data']['aIntersections'], $value); + } + } + $aIntersectionArrayViews = $this->aProperties['cadastre']['fiche_urb']['intersect']['array_views']; + if (is_array($aIntersectionArrayViews)) { + for ($i = 0; $i < count($aIntersectionArrayViews); $i++) { + foreach ($aIntersectionArrayViews[$i] as $key => $value) { + if (strpos($key, ".") === false) { + $sSchema = "public"; + $sTable = $key; + } else { + $aTmp = explode(".", $key); + $sSchema = $aTmp[0]; + $sTable = $aTmp[1]; + } + $aAttributs = Array(); + foreach ($value as $key2 => $value2) { + if ($key2 != 'title' && $key2 != 'type' && $key2 != 'intersect') { + array_push($aAttributs, $key2); + } + } + $oIntersect = $this->vmapIntersectGet($sSchema, $sTable, $parcelleGeom, $aAttributs, $iTolerance); + $value['data'] = $oIntersect; + array_push($oParcelleInfos['data']['aIntersectionsArray'], $value); + } + } + } + + return json_encode($oParcelleInfos); + } + +} + +?> diff --git a/vmap/vas/rest/ws/cadastreV2/Invariant.class.inc b/vmap/vas/rest/ws/cadastreV2/Invariant.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..cbb8b1a62f5d4bbc2b0b1735a7dd7934333a7488 --- /dev/null +++ b/vmap/vas/rest/ws/cadastreV2/Invariant.class.inc @@ -0,0 +1,74 @@ +<?php + +require_once 'Cadastre.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; + +/** + * \file Invariant.class.inc + * \class Invariant + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the Invariant php class + * + * This class defines operation for one Invariant + * + */ +class Invariant extends Cadastre { + + public $oError; + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $bShortcut false to reinit variables + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { + parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); + $this->aSelectedFields = Array('id_local', 'id_local as ID_BAT', 'id_com as ID_COM', 'invar as INVAR', 'dnupro as DNUPRO', 'id_par as ID_PAR', 'ccosec as CCOSEC', 'dnupla as DNUPLA'); + } + + /** + * @SWG\Get(path="/invariants/{ID_BAT}", + * tags={"Invariant"}, + * summary="Get Invariant", + * description="Request to get Invariant by id", + * operationId="GET", + * produces={"application/xml", "application/json", "application/x-vm-json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="ID_BAT", + * in="path", + * description="invariant id", + * required=true, + * type="integer", + * format="int32" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/invariant") + * ) + * ) + */ + + /** + * get informations about Invariant + */ + function GET() { + require __DIR__ . "/../vitis/" . $this->sRessourcesFile; + $this->aFields = $this->getFields($this->aProperties['schema_majic'], $this->aProperties['cadastre']['views']['invariant'], 'id_local', 'vmap_cadastre_user', 'vmap_cadastre_user'); + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/cadastreV2/Invariants.class.inc b/vmap/vas/rest/ws/cadastreV2/Invariants.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..b84e50e412cf6c3790eb0d314a66cff1c6417d9b --- /dev/null +++ b/vmap/vas/rest/ws/cadastreV2/Invariants.class.inc @@ -0,0 +1,131 @@ +<?php + +/** + * \file Invariants.class.inc + * \class Invariants + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the Invariants php class + * + * This class defines Rest Api to Vmap Invariants + * + */ +require_once 'Cadastre.class.inc'; +require_once 'Invariant.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; + +class Invariants extends Vmap { + /** + * @SWG\Definition( + * definition="/invariants", + * allOf={ + * @SWG\Schema(ref="#/definitions/invariants") + * } + * ) + * * @SWG\Tag( + * name="Invariants", + * description="Operations about Invariants" + * ) + */ + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $bShortcut false to reinit variables + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { + parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); + $this->aSelectedFields = Array('id_local', 'id_com as ID_COM', 'invar as INVAR', 'dnupro as DNUPRO', 'id_par as ID_PAR', 'ccosec as CCOSEC', 'dnupla as DNUPLA'); + } + + /** + * @SWG\Get(path="/invariants", + * tags={"Invariant"}, + * summary="Get Invariants", + * description="Request to get Invariants", + * operationId="GET", + * produces={"application/xml", "application/json", "application/x-vm-json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="order_by", + * in="query", + * description="list of ordering fields", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="sort_order", + * in="query", + * description="sorted direction", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="limit", + * in="query", + * description="number of element", + * required=false, + * type="integer", + * default="4", + * format="int32" + * ), + * @SWG\Parameter( + * name="offset", + * in="query", + * description="index of first element", + * required=false, + * type="string", + * format="int32" + * ), + * @SWG\Parameter( + * name="attributs", + * in="query", + * description="list of attributs", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="filter", + * in="query", + * description="filter results", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="distinct", + * in="query", + * description="delete duplicates", + * required=false, + * type="boolean" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/invariants") + * ) + * ) + */ + + /** + * get Invariants + * @return Invariants + */ + function GET() { + $aReturn = $this->genericGet($this->aProperties['schema_majic'], $this->aProperties['cadastre']['views']['invariant'], 'id_local'); + return $aReturn['sMessage']; + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/cadastreV2/LieuDit.class.inc b/vmap/vas/rest/ws/cadastreV2/LieuDit.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..94b22aca7fd0d82b46f719531ec542dc5c240a70 --- /dev/null +++ b/vmap/vas/rest/ws/cadastreV2/LieuDit.class.inc @@ -0,0 +1,33 @@ +<?php + +require_once 'Cadastre.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; + +/** + * \file LieuDit.class.inc + * \class LieuDit + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the LieuDit php class + * + * This class defines operation for one LieuDit + * + */ +class LieuDit extends Cadastre { + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $bShortcut false to reinit variables + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { + //parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/cadastreV2/LieuDitByGeom.class.inc b/vmap/vas/rest/ws/cadastreV2/LieuDitByGeom.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..4c95b0fd815db067171f27e6e1d081d3864f45d1 --- /dev/null +++ b/vmap/vas/rest/ws/cadastreV2/LieuDitByGeom.class.inc @@ -0,0 +1,96 @@ +<?php + +require_once 'Cadastre.class.inc'; +require_once __DIR__ . '/../vitis/Vitis.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; + +/** + * \file lieuditbygeom.class.inc + * \class LieuDitByGeom + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the LieuDitByGeom php class + * + * This class defines the rest api for lieuditbygeom + * + */ +class LieuDitByGeom extends Cadastre { + /** + * @SWG\Definition( + * definition="/lieuditbyGeom", + * allOf={ + * @SWG\Schema(ref="#/definitions/lieuditbyGeom") + * } + * ) + * * @SWG\Tag( + * name="LieuDitByGeom", + * description="Operations about LieuDitByGeom" + * ) + */ + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $bShortcut false to reinit variables + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { + parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); + $this->sSchema = $this->aProperties['schema_cadastre']; + $this->sTable = 'v_lieudit'; + $this->aAttributs = Array("id", "id_com", "section", "pre", "texte", "geom"); + } + + /** + * @SWG\Get(path="/lieuditbygeom", + * tags={"LieuDit"}, + * summary="Get the lieuditbygeom whith a table", + * description="Request to get a element intersected", + * operationId="GET", + * produces={"application/json", "application/x-vm-json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="geom", + * in="query", + * description="wkt geometry to intersect with", + * required=false, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="LieuDitByGeom Response", + * @SWG\Schema(ref="#/definitions/lieuditbyGeom") + * ) + * ) + */ + + /** + * Get function to generate a token + * @return the token + */ + function GET() { + + $sSchema = $this->sSchema; + $sTable = $this->sTable; + $aAttributs = $this->aAttributs; + $geom = $this->aValues['geom']; + + $aResult = $this->vmapIntersectGet($sSchema, $sTable, $geom, $aAttributs); + + + return json_encode($aResult); + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/cadastreV2/LieuDits.class.inc b/vmap/vas/rest/ws/cadastreV2/LieuDits.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..8a26e16850e199cb5d28f1e29d4948619357c208 --- /dev/null +++ b/vmap/vas/rest/ws/cadastreV2/LieuDits.class.inc @@ -0,0 +1,131 @@ +<?php + +/** + * \file LieuDits.class.inc + * \class LieuDits + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the LieuDits php class + * + * This class defines Rest Api to Vmap LieuDits + * + */ +require_once 'Cadastre.class.inc'; +require_once 'LieuDit.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; + +class LieuDits extends Cadastre { + /** + * @SWG\Definition( + * definition="/lieudits", + * allOf={ + * @SWG\Schema(ref="#/definitions/lieudits") + * } + * ) + * * @SWG\Tag( + * name="LieuDits", + * description="Operations about LieuDits" + * ) + */ + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $bShortcut false to reinit variables + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { + parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); + $this->aSelectedFields = Array("id", "id_com", "substring (id_com, 3, 3) as code_com", "section", "pre", "texte as tex", "geom", "oid"); + } + + /** + * @SWG\Get(path="/lieudits", + * tags={"LieuDit"}, + * summary="Get LieuDits", + * description="Request to get LieuDits", + * operationId="GET", + * produces={"application/xml", "application/json", "application/x-vm-json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="order_by", + * in="query", + * description="list of ordering fields", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="sort_order", + * in="query", + * description="sorted direction", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="limit", + * in="query", + * description="number of element", + * required=false, + * type="integer", + * default="4", + * format="int32" + * ), + * @SWG\Parameter( + * name="offset", + * in="query", + * description="index of first element", + * required=false, + * type="string", + * format="int32" + * ), + * @SWG\Parameter( + * name="attributs", + * in="query", + * description="list of attributs", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="filter", + * in="query", + * description="filter results", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="distinct", + * in="query", + * description="delete duplicates", + * required=false, + * type="boolean" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/lieudits") + * ) + * ) + */ + + /** + * get LieuDits + * @return LieuDits + */ + function GET() { + $aReturn = $this->genericGet($this->aProperties['schema_cadastre'], $this->aProperties['cadastre']['views']['lieu_dit'], 'id'); + return $aReturn['sMessage']; + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/cadastreV2/Parcelle.class.inc b/vmap/vas/rest/ws/cadastreV2/Parcelle.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..7d1b99f335c927b2e5c47031f01b553cae8f1238 --- /dev/null +++ b/vmap/vas/rest/ws/cadastreV2/Parcelle.class.inc @@ -0,0 +1,74 @@ +<?php + +require_once 'Cadastre.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; + +/** + * \file Parcelle.class.inc + * \class Parcelle + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the Parcelle php class + * + * This class defines operation for one Parcelle + * + */ +class Parcelle extends Cadastre { + + public $oError; + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $bShortcut false to reinit variables + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { + parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); + $this->aSelectedFields = Array("id_com", "id_sec", "code_com", "commune", "parcelle", "section", "pre", "coar", "indp", "idu", "id_par", "sup_fiscale", "numero", "feuille", "geom"); + } + + /** + * @SWG\Get(path="/parcelles/{id_par}", + * tags={"Parcelle"}, + * summary="Get Parcelle", + * description="Request to get Parcelle by id", + * operationId="GET", + * produces={"application/xml", "application/json", "application/x-vm-json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="id_par", + * in="path", + * description="parcelle id", + * required=true, + * type="integer", + * format="int32" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/parcelle") + * ) + * ) + */ + + /** + * get informations about Parcelle + */ + function GET() { + require __DIR__ . "/../vitis/" . $this->sRessourcesFile; + $this->aFields = $this->getFields($this->aProperties['schema_cadastre'], $this->aProperties['cadastre']['views']['parcelle'], 'id_par', 'vmap_cadastre_user', 'vmap_cadastre_user'); + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/cadastreV2/ParcelleByGeom.class.inc b/vmap/vas/rest/ws/cadastreV2/ParcelleByGeom.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..244f07d70358647ba63faa21dca0473cefb5e30a --- /dev/null +++ b/vmap/vas/rest/ws/cadastreV2/ParcelleByGeom.class.inc @@ -0,0 +1,103 @@ +<?php + +require_once 'Cadastre.class.inc'; +require_once __DIR__ . '/../vitis/Vitis.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; + +/** + * \file parcellebygeom.class.inc + * \class ParcelleByGeom + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the ParcelleByGeom php class + * + * This class defines the rest api for parcellebygeom + * + */ +class ParcelleByGeom extends Cadastre { + /** + * @SWG\Definition( + * definition="/parcellebygeom", + * allOf={ + * @SWG\Schema(ref="#/definitions/parcellebygeom") + * } + * ) + * * @SWG\Tag( + * name="ParcelleByGeom", + * description="Operations about ParcelleByGeom" + * ) + */ + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $bShortcut false to reinit variables + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { + parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); + $this->sSchema = $this->aProperties['schema_cadastre']; + $this->sTable = $this->aProperties['cadastre']['views']['parcelle']; + $this->aAttributs = Array("id_com", "code_com", "parcelle", "section", "pre", "coar", "codm", "indp", "idu", "ID_PAR", "sup_fiscale", "numero", "feuille", "geom"); + } + + /** + * @SWG\Get(path="/parcellebygeom", + * tags={"Parcelle"}, + * summary="Get the parcellebygeom whith a table", + * description="Request to get a element intersected", + * operationId="GET", + * produces={"application/json", "application/x-vm-json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="geom", + * in="query", + * description="wkt geometry to intersect with", + * required=false, + * default="POINT(739845.6672146925 6246677.620524088)", + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="ParcelleByGeom Response", + * @SWG\Schema(ref="#/definitions/parcellebygeom") + * ) + * ) + */ + + /** + * Get function to generate a token + * @return the token + */ + function GET() { + + if (!in_array('vmap_cadastre_user', $this->oConnection->aPrivileges)) { + $oError = new VitisError(0, 'INSUFFICIENT_PRIVILEGES'); + $aXmlRacineAttribute['status'] = 0; + $sMessage = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); + return $sMessage; + } + + $sSchema = $this->sSchema; + $sTable = $this->sTable; + $aAttributs = $this->aAttributs; + $geom = $this->aValues['geom']; + + $aResult = $this->vmapIntersectGet($sSchema, $sTable, $geom, $aAttributs); + + return json_encode($aResult); + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/cadastreV2/Parcelles.class.inc b/vmap/vas/rest/ws/cadastreV2/Parcelles.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..c85ec3afed368c6db5a847b66c66342980310b82 --- /dev/null +++ b/vmap/vas/rest/ws/cadastreV2/Parcelles.class.inc @@ -0,0 +1,131 @@ +<?php + +/** + * \file Parcelles.class.inc + * \class Parcelles + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the Parcelles php class + * + * This class defines Rest Api to Vmap Parcelles + * + */ +require_once 'Cadastre.class.inc'; +require_once 'Parcelle.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; + +class Parcelles extends Cadastre { + /** + * @SWG\Definition( + * definition="/parcelles", + * allOf={ + * @SWG\Schema(ref="#/definitions/parcelles") + * } + * ) + * * @SWG\Tag( + * name="Parcelles", + * description="Operations about Parcelles" + * ) + */ + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $bShortcut false to reinit variables + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { + parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); + $this->aSelectedFields = Array("id_com", "id_sec", "substring (id_com, 3, 3) as code_com", "commune", "parcelle", "section", "pre", "coar", "indp", "substring (id_par, 3, 12) as idu", "id_par", "sup_fiscale", "numero", "feuille", "geom"); + } + + /** + * @SWG\Get(path="/parcelles", + * tags={"Parcelle"}, + * summary="Get Parcelles", + * description="Request to get Parcelles", + * operationId="GET", + * produces={"application/xml", "application/json", "application/x-vm-json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="order_by", + * in="query", + * description="list of ordering fields", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="sort_order", + * in="query", + * description="sorted direction", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="limit", + * in="query", + * description="number of element", + * required=false, + * type="integer", + * default="4", + * format="int32" + * ), + * @SWG\Parameter( + * name="offset", + * in="query", + * description="index of first element", + * required=false, + * type="string", + * format="int32" + * ), + * @SWG\Parameter( + * name="attributs", + * in="query", + * description="list of attributs", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="filter", + * in="query", + * description="filter results", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="distinct", + * in="query", + * description="delete duplicates", + * required=false, + * type="boolean" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/parcelles") + * ) + * ) + */ + + /** + * get Parcelles + * @return Parcelles + */ + function GET() { + $aReturn = $this->genericGet($this->aProperties['schema_cadastre'], $this->aProperties['cadastre']['views']['parcelle'], 'id_par'); + return $aReturn['sMessage']; + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/cadastreV2/Proprietaire.class.inc b/vmap/vas/rest/ws/cadastreV2/Proprietaire.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..26f6c9b63af13b327437a031445465a3a99f3dc3 --- /dev/null +++ b/vmap/vas/rest/ws/cadastreV2/Proprietaire.class.inc @@ -0,0 +1,33 @@ +<?php + +require_once 'Cadastre.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; + +/** + * \file Proprietaire.class.inc + * \class Proprietaire + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the Proprietaire php class + * + * This class defines operation for one Proprietaire + * + */ +class Proprietaire extends Cadastre { + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $bShortcut false to reinit variables + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { + //parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/cadastreV2/Proprietaires.class.inc b/vmap/vas/rest/ws/cadastreV2/Proprietaires.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..dbe9c3c1889c08fcfc25673a89d54c69f29b0bfd --- /dev/null +++ b/vmap/vas/rest/ws/cadastreV2/Proprietaires.class.inc @@ -0,0 +1,131 @@ +<?php + +/** + * \file Proprietaires.class.inc + * \class Proprietaires + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the Proprietaires php class + * + * This class defines Rest Api to Vmap Proprietaires + * + */ +require_once 'Cadastre.class.inc'; +require_once 'Proprietaire.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; + +class Proprietaires extends Cadastre { + /** + * @SWG\Definition( + * definition="/proprietaires", + * allOf={ + * @SWG\Schema(ref="#/definitions/proprietaires") + * } + * ) + * * @SWG\Tag( + * name="proprietaires", + * description="Operations about proprietaires" + * ) + */ + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $bShortcut false to reinit variables + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { + parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); + $this->aSelectedFields = Array('id', 'id_com as ID_COM', 'ddenom as DDENOM', 'dnupro as DNUPRO', 'commune as COMMUNE'); + } + + /** + * @SWG\Get(path="/proprietaires", + * tags={"Proprietaire"}, + * summary="Get Proprietaires", + * description="Request to get Proprietaires", + * operationId="GET", + * produces={"application/xml", "application/json", "application/x-vm-json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="order_by", + * in="query", + * description="list of ordering fields", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="sort_order", + * in="query", + * description="sorted direction", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="limit", + * in="query", + * description="number of element", + * required=false, + * type="integer", + * default="4", + * format="int32" + * ), + * @SWG\Parameter( + * name="offset", + * in="query", + * description="index of first element", + * required=false, + * type="string", + * format="int32" + * ), + * @SWG\Parameter( + * name="attributs", + * in="query", + * description="list of attributs", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="filter", + * in="query", + * description="filter results", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="distinct", + * in="query", + * description="delete duplicates", + * required=false, + * type="boolean" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/proprietaires") + * ) + * ) + */ + + /** + * get Proprietaires + * @return Proprietaires + */ + function GET() { + $aReturn = $this->genericGet($this->aProperties['schema_majic'], $this->aProperties['cadastre']['views']['proprietaire'], 'id'); + return $aReturn['sMessage']; + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/cadastreV2/RapportsCadastreParcelle.class.inc b/vmap/vas/rest/ws/cadastreV2/RapportsCadastreParcelle.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..b79394fcd52f511a036ed577dd572d95ecbb4519 --- /dev/null +++ b/vmap/vas/rest/ws/cadastreV2/RapportsCadastreParcelle.class.inc @@ -0,0 +1,269 @@ +<?php + +require_once 'Cadastre.class.inc'; +require_once __DIR__ . '/../vitis/Vitis.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; + +/** + * \file rapportscadastreparcelle.class.inc + * \class RapportsCadastreParcelle + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the RapportsCadastreParcelle php class + * + * This class defines the rest api for rapportscadastreparcelle + * + */ +class RapportsCadastreParcelle extends Cadastre { + /** + * @SWG\Definition( + * definition="/rapportscadastreparcelle", + * allOf={ + * @SWG\Schema(ref="#/definitions/rapportscadastreparcelle") + * } + * ) + * * @SWG\Tag( + * name="RapportsCadastreParcelle", + * description="Operations about RapportsCadastreParcelle" + * ) + */ + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $bShortcut false to reinit variables + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { + parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); + } + + /** + * @SWG\Get(path="/rapportscadastreparcelle", + * tags={"RapportsCadastreParcelle"}, + * summary="Create the releve de propriete sheet", + * description="Request to get the element", + * operationId="GET", + * produces={"application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="parcelles", + * in="query", + * description="id_par des parcelles (ex: 340039000AI0166|340332000AC0005)", + * required=true, + * default="", + * type="string" + * ), + * @SWG\Parameter( + * name="rapport_type", + * in="query", + * description="type de rapport: ToutesInfos, BatieNonBatie, Proprietaire, SubdivisionFiscale, EmprisePosPlu, Locaux, ProprietaireLocaux", + * required=true, + * default="", + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="RapportsCadastreParcelle Response", + * @SWG\Schema(ref="#/definitions/rapportscadastreparcelle") + * ) + * ) + */ + function GET() { + + if (!in_array('vmap_cadastre_user', $this->oConnection->aPrivileges)) { + $oError = new VitisError(0, 'INSUFFICIENT_PRIVILEGES'); + $aXmlRacineAttribute['status'] = 0; + $sMessage = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); + return $sMessage; + } + + /** + * Tableau contenant les id_par des parcelles à utiliser + * @type array + */ + $aParcelles = explode("|", $this->aValues["parcelles"]); + + /** + * Type de rapport + * @type string + */ + $rapportType = $this->aValues['rapport_type']; + + /** + * Properties + * @type array + */ + $properties = $this->aProperties; + + /** + * Objet BD + * @type object + */ + //$oBd = new BD($properties["cadastre"]["rp"]["login"], $properties["cadastre"]["rp"]["pass"], $properties["database"], $properties["server"], $properties["port"], $properties["sgbd"], $properties["page_encoding"]); + + /** + * Returned array + * @type array + */ + $aReturn = Array(); + // Met à jour la connexion + $oBd = $this->oConnection->oBd; + //$oBd = new BD($properties["cadastre"]["rp"]["login"], $properties["cadastre"]["rp"]["pass"], $properties["database"], $properties["server"], $properties["port"], $properties["sgbd"], $properties["page_encoding"]); + // Mémorise la date de début + $iDebutPdf = (date("G") * 60) * 60 + (date("i") * 60) + date("s"); + $DebutPdf = date("G") . 'h ' . date("i") . 'min ' . date("s") . 's'; + + // Récupère l'année + $sYear = $this->vmapGet($this->aProperties['schema_majic'], 'v_vmap_annee', array('annee'), array(), array('limit' => 1))[0]['annee']; + + // Patch pour décoder les properties UTF-8 parce que les rapports sont générés en ISO + if (is_array($properties["cadastre"]["fiche_urb"]["intersect"]["views"])) { + $properties["cadastre"]["fiche_urb"]["intersect"]["views"] = $this->decodeUtf8Array($properties["cadastre"]["fiche_urb"]["intersect"]["views"]); + } + + // Charge les données + if ($rapportType != 'Locaux' && $rapportType != 'ProprietaireLocaux') { + require_once(__DIR__ . "/../../class/majic_libV2/Mj_Compte_Communal_Parcelles.class.inc"); + $oRapport = new Mj_Compte_Communal_Parcelles($aParcelles, $oBd, $properties, "polygon"); + } else { + require_once(__DIR__ . "/../../class/majic_libV2/Mj_Bati_Parcelles.class.inc"); + $oRapport = new Mj_Bati_Parcelles($aParcelles, $oBd, $properties); + } + + if (!file_exists($properties["cadastre"]["rp"]["rp_dir"])) { + mkdir($properties["cadastre"]["rp"]["rp_dir"]); + } + // Crée les dossiers correspondants + if (!file_exists($properties["cadastre"]["rp"]["rp_dir"] . "/" . $sYear)) { + @mkdir($properties["cadastre"]["rp"]["rp_dir"] . "/" . $sYear); + } + if (!file_exists($properties["cadastre"]["rp"]["rp_dir"] . "/" . $sYear . "/Rapport_Parcelle_" . $rapportType)) { + @mkdir($properties["cadastre"]["rp"]["rp_dir"] . "/" . $sYear . "/Rapport_Parcelle_" . $rapportType); + } + // Crée les XML + if ($oRapport->isError()) { + http_response_code(500); + writeToErrorLog('Erreur lors de l\'extraction des données avec la librairie majic : ' . $oRapport->sMessage); + $aReturn['error']['errorMessage'] = "Erreur lors de la génération du rapport."; + return json_encode($aReturn); + } else { + // Création du fichier XML. + $sFile = hash('sha256', UniqFileName()); + + $sXmlFileName = $properties["cadastre"]["rp"]["rp_dir"] . "/" . $sYear . "/Rapport_Parcelle_" . $rapportType . "/" . $sFile . ".xml"; + + if ($rapportType === 'ToutesInfos') { + $sXslFileName = __DIR__ . "/../../class/majic_libV2/xsl/Mj_Rapport.xsl"; + } else { + $sXslFileName = __DIR__ . "/../../class/majic_libV2/xsl/Mj_Rapport_Parcelle_" . $rapportType . ".xsl"; + } + if (!file_exists($sXmlFileName)) { + $oRapport->asXMLFile("", $sXmlFileName, "Rapport_Parcelle", "UTF-8", "ISO-8859-1"); + } + } + + // Crée les PDF et XSL + if ($rapportType === 'ToutesInfos') { + // Chemin vers le fichier + $filePath = $properties["cadastre"]["rp"]["rp_dir"] . "/" . $sYear . "/Rapport_Parcelle_" . $rapportType . "/" . $sFile . ".pdf"; + if (!file_exists($filePath)) { + + // Pour faire du pdf + $sPdfFileName = $properties["cadastre"]["rp"]["rp_dir"] . "/" . $sYear . "/Rapport_Parcelle_" . $rapportType . "/" . $sFile . ".pdf"; + + // Création du fichier PDF. + $sCommandLine = $properties["fop_root_dir"] . "/fop -xsl " . $sXslFileName . " -xml " . $sXmlFileName . " -pdf " . $sPdfFileName; + exec($sCommandLine, $aCommand, $iResult); + + if ($iResult) { + http_response_code(500); + $aReturn['error']['errorMessage'] .= "Erreur lors de la génération du rapport."; + writeToErrorLog("Erreur lors de la génération d'un rapport au format PDF."); + writeToErrorLog("Ligne de commande : " . $sCommandLine); + } + } + + $downloadFilePath = $properties['web_server_name'] . '/' . $properties['services_alias'] . '/cadastreV2/downloadrapport?sYear=' . $sYear . '&sType=Rapport_Parcelle_' . $rapportType . '&sFileName=' . urlencode($sFile) . '.pdf'; + } else { + + // Pour faire de l'excel + $sFileName = $properties["cadastre"]["rp"]["rp_dir"] . "/" . $sYear . "/Rapport_Parcelle_" . $rapportType . "/transform.xml"; + + // Chemin vers le fichier + $filePath = $properties["cadastre"]["rp"]["rp_dir"] . "/" . $sYear . "/Rapport_Parcelle_" . $rapportType . "/" . $sFile . ".xls"; + + if (!file_exists($filePath)) { + $doc = new DOMDocument(); + $xsl = new XSLTProcessor(); + if (file_exists($sXslFileName)) { + $doc->load($sXslFileName); + $xsl->importStyleSheet($doc); + $doc->load($sXmlFileName); + $oHandle = fopen($sFileName, 'w'); + if ($oHandle == false) { + http_response_code(500); + $aReturn['error']['errorMessage'] .= "Impossible de créer le fichier " . $sFileName . ". Impossible de générer le rapport."; + } else { + fwrite($oHandle, $xsl->transformToXML($doc)); + fclose($oHandle); + $sRapportCree = $properties["cadastre"]["rp"]["rp_dir"] . "/" . $sYear . "/Rapport_Parcelle_" . $rapportType . "/" . $sFile . ".xls"; + // copie du fichier pour créer le fichier excel + if (!copy($sFileName, $sRapportCree)) { + http_response_code(500); + $aReturn['error']['errorMessage'] .= "La copie du fichier '" . $sFileName . "' vers '" . $sRapportCree . "' n'a pas réussi. Impossible de générer le rapport."; + } + } + } else { + writeToErrorLog("Le fichier " . $sXslFileName . " n'existe pas."); + } + } else { + $aReturn['data']['alreadyExists'] = true; + } + + $downloadFilePath = $properties['web_server_name'] . '/' . $properties['services_alias'] . '/cadastreV2/downloadrapport?sYear=' . $sYear . '&sType=Rapport_Parcelle_' . $rapportType . '&sFileName=' . urlencode($sFile) . '.xls'; + } + + $iFinPdf = (date("G") * 60) * 60 + (date("i") * 60) + date("s"); + $FinPdf = date("G") . 'h ' . date("i") . 'min ' . date("s") . 's'; + + $aReturn['data']['rapport'] = $downloadFilePath; + $aReturn['data']['format'] = pathinfo($filePath, PATHINFO_EXTENSION); + $aReturn['data']['debut'] = $DebutPdf; + $aReturn['data']['fin'] = $FinPdf; + $aReturn['data']['temps'] = $iFinPdf - $iDebutPdf . 's'; + + return json_encode($aReturn); + } + + /** + * Fonction permettant de décoder un tableau multidimensionnel UTF8 en ISO. + * /param $s Tableau à décoder. + */ + function decodeUtf8Array($s) { + if (is_array($s)) { + $result = array(); + foreach ($s as $id => $value) { + if (is_array($value)) + $result[$id] = $this->decodeUtf8Array($value); + else + $result[$id] = utf8_decode($value); + } + return $result; + } else + return $s; + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/cadastreV2/ReleveDePropriete.class.inc b/vmap/vas/rest/ws/cadastreV2/ReleveDePropriete.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..0394b34663290d65cef0e27011a511433791e4b4 --- /dev/null +++ b/vmap/vas/rest/ws/cadastreV2/ReleveDePropriete.class.inc @@ -0,0 +1,248 @@ +<?php + +require_once 'Cadastre.class.inc'; +require_once __DIR__ . '/../vitis/Vitis.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; + +/** + * \file relevedepropriete.class.inc + * \class ReleveDePropriete + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the ReleveDePropriete php class + * + * This class defines the rest api for relevedepropriete + * + */ +class ReleveDePropriete extends Cadastre { + /** + * @SWG\Definition( + * definition="/relevedepropriete", + * allOf={ + * @SWG\Schema(ref="#/definitions/relevedepropriete") + * } + * ) + * * @SWG\Tag( + * name="ReleveDePropriete", + * description="Operations about ReleveDePropriete" + * ) + */ + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $bShortcut false to reinit variables + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { + parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); + } + + /** + * @SWG\Get(path="/relevedepropriete", + * tags={"ReleveDePropriete"}, + * summary="Create the releve de propriete sheet", + * description="Request to get the element", + * operationId="GET", + * produces={"application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="type", + * in="query", + * description="standard / tiers / parcelle", + * required=true, + * default="parcelle", + * type="string" + * ), + * @SWG\Parameter( + * name="id_dnupro", + * in="query", + * description="concaténation entre ID_COM et DNUPRO", + * required=false, + * default="L00048", + * type="string" + * ), + * @SWG\Parameter( + * name="id_par", + * in="query", + * description="id_par", + * required=false, + * default="340039000AI0166", + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="ReleveDePropriete Response", + * @SWG\Schema(ref="#/definitions/relevedepropriete") + * ) + * ) + */ + function GET() { + + if (!in_array('vmap_cadastre_user', $this->oConnection->aPrivileges)) { + $oError = new VitisError(0, 'INSUFFICIENT_PRIVILEGES'); + $aXmlRacineAttribute['status'] = 0; + $sMessage = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); + return $sMessage; + } + + $ID_PAR = $this->aValues['ID_PAR']; + $IDDNUPRO = $this->aValues['IDDNUPRO']; + $sType = $this->aValues['type']; + $properties = $this->aProperties; + //$oBD = new BD($properties["cadastre"]["rp"]["login"], $properties["cadastre"]["rp"]["pass"], $properties["database"], $properties["server"], $properties["port"], $properties["sgbd"], $properties["page_encoding"]); + $oBD = $this->oConnection->oBd; + $aReturn = Array(); + // Vérifie que l'utilisateur a les droits sur la commune + $communeRights = false; + if ($ID_PAR != '') + $communeRights = $this->haveCommuneRights(substr($ID_PAR, 0, 5)); + if ($IDDNUPRO != '') + $communeRights = $this->haveCommuneRights(substr($IDDNUPRO, 0, 5)); + + if ($communeRights == false) { + http_response_code(403); + writeToErrorLog("L'utilisateur n'a pas les droits sur la commune"); + $aReturn['error']['errorMessage'] = "Erreur lors de la génération du fichier PDF de relevé de propriété."; + return json_encode($aReturn); + } + + // Récupère l'année + $sYear = $this->vmapGet($this->aProperties['schema_majic'], 'v_vmap_annee', array('annee'), array(), array('limit' => 1))[0]['annee']; + + if (strlen($sYear) < 1) { + http_response_code(500); + writeToErrorLog("Impossible de récupérer l'année de référence dans le schema Majic"); + $aReturn['error']['errorMessage'] = "Erreur lors de la génération du fichier PDF de relevé de propriété."; + return json_encode($aReturn); + } + + // Récupère le chemin du fichier + switch ($sType) { + case "tiers" : + case "standard" : + $fileName = $IDDNUPRO; + break; + + case "parcelle" : + $fileName = $ID_PAR; + break; + } + + $filePath = $properties["cadastre"]["rp"]["rp_dir"] . "/" . $sYear . '/' . $sType . '/' . $fileName . ".pdf"; + if (!file_exists($properties["cadastre"]["rp"]["rp_dir"])) { + mkdir($properties["cadastre"]["rp"]["rp_dir"]); + } + if (!file_exists($properties["cadastre"]["rp"]["rp_dir"] . "/" . $sYear)) + @mkdir($properties["cadastre"]["rp"]["rp_dir"] . "/" . $sYear); + if (!file_exists($properties["cadastre"]["rp"]["rp_dir"] . "/" . $sYear . '/' . $sType)) + @mkdir($properties["cadastre"]["rp"]["rp_dir"] . "/" . $sYear . '/' . $sType); + + if (file_exists($filePath)) { + + $aReturn['data']['releveDePropriete'] = $properties['web_server_name'] . '/' . $properties['services_alias'] . '/cadastreV2/downloadrapport?sYear=' . $sYear . '&sType=' . $sType . '&sFileName=' . urlencode($fileName) . '.pdf'; + + $aReturn['data']['alreadyExists'] = true; + } else { + if (!file_exists($properties["cadastre"]["rp"]["rp_dir"])) { + mkdir($properties["cadastre"]["rp"]["rp_dir"]); + } + if (!file_exists($properties["cadastre"]["rp"]["rp_dir"] . "/" . $sYear)) { + if (mkdir($properties["cadastre"]["rp"]["rp_dir"] . "/" . $sYear)) { + mkdir($properties["cadastre"]["rp"]["rp_dir"] . "/" . $sYear . "/standard"); + mkdir($properties["cadastre"]["rp"]["rp_dir"] . "/" . $sYear . "/tiers"); + mkdir($properties["cadastre"]["rp"]["rp_dir"] . "/" . $sYear . "/parcelle"); + } else { + http_response_code(500); + writeToErrorLog("Erreur lors de la création des répertoires de l'année courante pour les relevés de propriété."); + $aReturn['error']['errorMessage'] = "Erreur lors de la génération du fichier PDF de relevé de propriété."; + return json_encode($aReturn); + } + } + + // Création d'un nouvel objet Relevé de Propriété + switch ($sType) { + case "tiers" : + case "standard" : + require_once __DIR__ . '/../../class/majic_libV2/Mj_Compte_Communal.class.inc'; + $oRP = new Mj_Compte_Communal($IDDNUPRO, $oBD, $properties); + if ($oRP->isError()) { + http_response_code(500); + writeToErrorLog("Erreur lors de l'extraction des données Majic."); + $aReturn['error']['errorMessage'] = "Erreur lors de la génération du fichier PDF de relevé de propriété."; + return json_encode($aReturn); + } else { + $sDir = $sYear . "/standard/"; + if ($sType === "tiers") + $sDir = $sYear . "/tiers/"; + $sFile = str_replace("*", "~", $IDDNUPRO); + } + break; + + case "parcelle" : + require_once __DIR__ . '/../../class/majic_libV2/Mj_Compte_Communal_Parcelle.class.inc'; + $oRP = new Mj_Compte_Communal_Parcelle('', $ID_PAR, $oBD, $properties); + if ($oRP->isError()) { + http_response_code(500); + writeToErrorLog("Erreur lors de l'extraction des données Majic."); + $aReturn['error']['errorMessage'] = "Erreur lors de la génération du fichier PDF de relevé de propriété."; + return json_encode($aReturn); + } else { + $sDir = $sYear . "/parcelle/"; + + $sFile = str_replace("*", "~", $ID_PAR); + } + break; + } + if (!$bError) { + $sXMLFile = $properties["cadastre"]["rp"]["rp_dir"] . "/" . $sDir . $sFile . ".xml"; + if ($sType === "tiers") { + $sXSLFile = __DIR__ . '/../../class/majic_libV2/xsl/Mj_fo_tiers.xsl'; + } else { + $sXSLFile = __DIR__ . '/../../class/majic_libV2/xsl/Mj_fo.xsl'; + } + $sPDFFile = $properties["cadastre"]["rp"]["rp_dir"] . "/" . $sDir . $sFile . ".pdf"; + + if (!file_exists($sPDFFile)) { + $oRP->asXMLFile("", $sXMLFile, "Mj"); + } + + $sCommand = $properties["fop_root_dir"] . "/fop -xml " . $sXMLFile . " -xsl " . $sXSLFile . " -pdf " . $sPDFFile; + + + exec($sCommand, $aCommand, $iResult); + + + if (!$iResult) { + $aReturn['data']['releveDePropriete'] = $properties['web_server_name'] . '/' . $properties['services_alias'] . '/cadastreV2/downloadrapport?sYear=' . $sYear . '&sType=' . $sType . '&sFileName=' . urlencode($sFile) . '.pdf'; + } else { + writeToErrorLog("Erreur lors de la génération du fichier PDF de relevé de propriété :"); + writeToErrorLog("Ligne de commande : " . $sCommand); + writeToErrorLog("Message d'erreur : "); + foreach ($aCommand as $sValeur) { + writeToErrorLog($sValeur); + } + http_response_code(500); + writeToErrorLog("Erreur lors de la génération du fichier PDF de relevé de propriété."); + $aReturn['error']['errorMessage'] = "Erreur lors de la génération du fichier PDF de relevé de propriété."; + return json_encode($aReturn); + } + } + } + + return json_encode($aReturn); + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/cadastreV2/Section.class.inc b/vmap/vas/rest/ws/cadastreV2/Section.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..de149b159b570388d14fe18d627a0f2405815a1f --- /dev/null +++ b/vmap/vas/rest/ws/cadastreV2/Section.class.inc @@ -0,0 +1,74 @@ +<?php + +require_once 'Cadastre.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; + +/** + * \file Section.class.inc + * \class Section + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the Section php class + * + * This class defines operation for one Section + * + */ +class Section extends Cadastre { + + public $oError; + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $bShortcut false to reinit variables + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { + parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); + $this->aSelectedFields = Array("id_com", "id_sec", "code_com", "commune", "section", "pre", "idu", "texte", "geom"); + } + + /** + * @SWG\Get(path="/sections/{id_sec}", + * tags={"Section"}, + * summary="Get Section", + * description="Request to get Section by id", + * operationId="GET", + * produces={"application/xml", "application/json", "application/x-vm-json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="id_sec", + * in="path", + * description="section id", + * required=true, + * type="integer", + * format="int32" + * ), + * @SWG\Response( + * response=200, + * description="Section Response", + * @SWG\Schema(ref="#/definitions/section") + * ) + * ) + */ + + /** + * get informations about Section + */ + function GET() { + require __DIR__ . "/../vitis/" . $this->sRessourcesFile; + $this->aFields = $this->getFields($this->aProperties['schema_cadastre'], $this->aProperties['cadastre']['views']['section'], 'id_sec', 'vmap_cadastre_user', 'vmap_cadastre_user'); + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/cadastreV2/SectionByGeom.class.inc b/vmap/vas/rest/ws/cadastreV2/SectionByGeom.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..89f26a1aed928a77a576812ca666ed24cdabc107 --- /dev/null +++ b/vmap/vas/rest/ws/cadastreV2/SectionByGeom.class.inc @@ -0,0 +1,103 @@ +<?php + +require_once 'Cadastre.class.inc'; +require_once __DIR__ . '/../vitis/Vitis.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; + +/** + * \file sectionbygeom.class.inc + * \class SectionByGeom + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the SectionByGeom php class + * + * This class defines the rest api for sectionbygeom + * + */ +class SectionByGeom extends Cadastre { + /** + * @SWG\Definition( + * definition="/sectionbygeom", + * allOf={ + * @SWG\Schema(ref="#/definitions/sectionbygeom") + * } + * ) + * * @SWG\Tag( + * name="SectionByGeom", + * description="Operations about SectionByGeom" + * ) + */ + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $bShortcut false to reinit variables + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { + parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); + $this->sSchema = $this->aProperties['schema_cadastre']; + $this->sTable = 'v_vmap_section_cadastrale'; + $this->aAttributs = Array("id_com", "id_sec", "code_com", "section", "pre", "idu", "texte", "geom"); + } + + /** + * @SWG\Get(path="/sectionbygeom", + * tags={"Section"}, + * summary="Get the sectionbygeom whith a table", + * description="Request to get a element intersected", + * operationId="GET", + * produces={"application/json", "application/x-vm-json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="geom", + * in="query", + * description="wkt geometry to intersect with", + * required=false, + * default="POINT(739845.6672146925 6246677.620524088)", + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="SectionByGeom Response", + * @SWG\Schema(ref="#/definitions/sectionbygeom") + * ) + * ) + */ + + /** + * Get function to generate a token + * @return the token + */ + function GET() { + + if (!in_array('vmap_cadastre_user', $this->oConnection->aPrivileges)) { + $oError = new VitisError(0, 'INSUFFICIENT_PRIVILEGES'); + $aXmlRacineAttribute['status'] = 0; + $sMessage = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); + return $sMessage; + } + + $sSchema = $this->sSchema; + $sTable = $this->sTable; + $aAttributs = $this->aAttributs; + $geom = $this->aValues['geom']; + + $aResult = $this->vmapIntersectGet($sSchema, $sTable, $geom, $aAttributs); + + return json_encode($aResult); + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/cadastreV2/Sections.class.inc b/vmap/vas/rest/ws/cadastreV2/Sections.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..5e32d1942fcba271be2ec11c8d1671d90a0d9c33 --- /dev/null +++ b/vmap/vas/rest/ws/cadastreV2/Sections.class.inc @@ -0,0 +1,132 @@ +<?php + +/** + * \file Sections.class.inc + * \class Sections + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the Sections php class + * + * This class defines Rest Api to Vmap Sections + * + */ +require_once 'Cadastre.class.inc'; +require_once 'Section.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; + +class Sections extends Cadastre { + /** + * @SWG\Definition( + * definition="/sections", + * allOf={ + * @SWG\Schema(ref="#/definitions/sections") + * } + * ) + * * @SWG\Tag( + * name="Sections", + * description="Operations about Sections" + * ) + */ + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $bShortcut false to reinit variables + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { + parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); + $this->aSelectedFields = Array("id_com", "id_sec", "substring (id_com, 3, 3) as code_com", "commune", "replace(pre, '000', '')||replace(section, '0', '') as section", "pre", "substring (id_sec, 3, 8) as idu", "replace(section, '0', '0') as tex", "section as texte", "geom"); + } + + //(pre, '000', '')||replace(section, '0', '') as section + /** + * @SWG\Get(path="/sections", + * tags={"Section"}, + * summary="Get Sections", + * description="Request to get Sections", + * operationId="GET", + * produces={"application/xml", "application/json", "application/x-vm-json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="order_by", + * in="query", + * description="list of ordering fields", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="sort_order", + * in="query", + * description="sorted direction", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="limit", + * in="query", + * description="number of element", + * required=false, + * type="integer", + * default="4", + * format="int32" + * ), + * @SWG\Parameter( + * name="offset", + * in="query", + * description="index of first element", + * required=false, + * type="string", + * format="int32" + * ), + * @SWG\Parameter( + * name="attributs", + * in="query", + * description="list of attributs", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="filter", + * in="query", + * description="filter results", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="distinct", + * in="query", + * description="delete duplicates", + * required=false, + * type="boolean" + * ), + * @SWG\Response( + * response=200, + * description="Sections Response", + * @SWG\Schema(ref="#/definitions/sections") + * ) + * ) + */ + + /** + * get Sections + * @return Sections + */ + function GET() { + $aReturn = $this->genericGet($this->aProperties['schema_cadastre'], $this->aProperties['cadastre']['views']['section'], 'id_sec'); + return $aReturn['sMessage']; + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/cadastreV2/Versions.class.inc b/vmap/vas/rest/ws/cadastreV2/Versions.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..e357a74840f32744e02efa853784114d2dd8a9c7 --- /dev/null +++ b/vmap/vas/rest/ws/cadastreV2/Versions.class.inc @@ -0,0 +1,79 @@ +<?php + +require_once 'Cadastre.class.inc'; + +/** + * \file versions.class.inc + * \class Versions + * + * \author Yoann Perollet <yoann.perollet@veremes.com>. + * + * \brief This file contains the Versions php class + * + * This class defines the rest api for versions + * + */ +class Versions extends Vmap { + /** + * @SWG\Definition( + * definition="/Versions", + * allOf={ + * @SWG\Schema(ref="#/definitions/Versions") + * } + * ) + * @SWG\Tag( + * name="Versions", + * description="Operations about Versions" + * ) + */ + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $versions ptroperties + */ + function __construct($aPath, $aValues, $properties) { + $this->aValues = $aValues; + $this->aPath = $aPath; + $this->aProperties = $properties; + } + + /** + * @SWG\Get(path="/Versions", + * tags={"Versions"}, + * summary="Get versions", + * description="Request to get versions", + * operationId="GET", + * produces={"application/xml", "application/json", "application/x-vm-json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/Versions") + * ) + * ) + */ + + /** + * + * @return versions + */ + function GET() { + $this->getVersion("cadastreV2"); + //$this->aFields = $this->aVersions; + // + $aXmlRacineAttribute['status'] = 1; + $sMessage = $this->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); + return $sMessage; + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/cadastreV2/Voie.class.inc b/vmap/vas/rest/ws/cadastreV2/Voie.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..e490d1fa730687f43ea0864024a8ed99837f520d --- /dev/null +++ b/vmap/vas/rest/ws/cadastreV2/Voie.class.inc @@ -0,0 +1,74 @@ +<?php + +require_once 'Cadastre.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; + +/** + * \file Voie.class.inc + * \class Voie + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the Voie php class + * + * This class defines operation for one Voie + * + */ +class Voie extends Cadastre { + + public $oError; + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $bShortcut false to reinit variables + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { + parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); + $this->aSelectedFields = Array('libcom as LIBCOM1', 'id_com as ID_COM', 'id_voie as ID_RIVOLI', 'ccodep as CCODEP', 'ccodir as CCODIR', 'ccocom as CCOCOM', 'rivoli as RIVOLI', 'clerivoli as CLERIVOLI', 'libvoie as LIBVOIE', 'typcom as TYPCOM', 'rur as RUR', 'carvoie as CARVOIE', 'annulation as ANNULATION', 'dateannul as DATEANNUL', 'datecrea as DATECREA', 'majic2 as MAJIC2', 'typevoie as TYPEVOIE', 'indic as INDIC', 'motclass as MOTCLASS', 'nature as NATURE', 'l_nature_voie as L_NATURE_VOIE'); + } + + /** + * @SWG\Get(path="/voies/{ID_RIVOLI}", + * tags={"Voie"}, + * summary="Get Voie", + * description="Request to get Voie by id", + * operationId="GET", + * produces={"application/xml", "application/json", "application/x-vm-json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="ID_RIVOLI", + * in="path", + * description="voie id", + * required=true, + * type="integer", + * format="int32" + * ), + * @SWG\Response( + * response=200, + * description="Voie Response", + * @SWG\Schema(ref="#/definitions/voie") + * ) + * ) + */ + + /** + * get informations about Voie + */ + function GET() { + require __DIR__ . "/../vitis/" . $this->sRessourcesFile; + $this->aFields = $this->getFields($this->aProperties['schema_majic'], $this->aProperties['cadastre']['views']['voie'], 'id_voie'); + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/cadastreV2/Voies.class.inc b/vmap/vas/rest/ws/cadastreV2/Voies.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..dd5b099c967879b265a0033829f362566780c2b5 --- /dev/null +++ b/vmap/vas/rest/ws/cadastreV2/Voies.class.inc @@ -0,0 +1,133 @@ +<?php + +/** + * \file Voies.class.inc + * \class Voies + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the Voies php class + * + * This class defines Rest Api to Vmap Voies + * + */ +require_once 'Cadastre.class.inc'; +require_once 'Voie.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; +require_once __DIR__ . '/../../class/vmlib/BdDataAccess.inc'; + +class Voies extends Cadastre { + /** + * @SWG\Definition( + * definition="/voies", + * allOf={ + * @SWG\Schema(ref="#/definitions/voies") + * } + * ) + * * @SWG\Tag( + * name="Voies", + * description="Operations about Voies" + * ) + */ + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $bShortcut false to reinit variables + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) { + parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection); + $this->aSelectedFields = Array('id_voie as ID_RIVOLI', 'l_nature_voie as L_NATURE_VOIE', 'dvoilib as DVOILIB'); + } + + /** + * @SWG\Get(path="/voies", + * tags={"Voie"}, + * summary="Get Voies", + * description="Request to get Voies", + * operationId="GET", + * produces={"application/xml", "application/json", "application/x-vm-json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="order_by", + * in="query", + * description="list of ordering fields", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="sort_order", + * in="query", + * description="sorted direction", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="limit", + * in="query", + * description="number of element", + * required=false, + * type="integer", + * default="4", + * format="int32" + * ), + * @SWG\Parameter( + * name="offset", + * in="query", + * description="index of first element", + * required=false, + * type="string", + * format="int32" + * ), + * @SWG\Parameter( + * name="attributs", + * in="query", + * description="list of attributs", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="filter", + * in="query", + * description="filter results", + * required=false, + * type="string" + * ), + * @SWG\Parameter( + * name="distinct", + * in="query", + * description="delete duplicates", + * required=false, + * type="boolean" + * ), + * @SWG\Response( + * response=200, + * description="Voies Response", + * @SWG\Schema(ref="#/definitions/voies") + * ) + * ) + */ + + /** + * get Voies + * @return Voies + */ + function GET() { + $this->aValues['filter'] = str_replace("id_rivoli", "id_voie", $this->aValues['filter']); + $this->aValues['filter'] = str_replace("ID_COM", "id_com", $this->aValues['filter']); + $aReturn = $this->genericGet($this->aProperties['schema_majic'], $this->aProperties['cadastre']['views']['voie'], 'id_voie'); + return $aReturn['sMessage']; + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/cadastreV2/overview.phtml b/vmap/vas/rest/ws/cadastreV2/overview.phtml new file mode 100755 index 0000000000000000000000000000000000000000..3f338bed787924d2e7d8a9502ba8ad40b211d1f4 --- /dev/null +++ b/vmap/vas/rest/ws/cadastreV2/overview.phtml @@ -0,0 +1,24 @@ +<?php +/** + * @SWG\Swagger( + * basePath="/[service_alias]/cadastreV2", + * host="[server]", + * schemes={"[protocol]"}, + * produces={ + * "application/json", + "application/xml", + "text/html" + * }, + * @SWG\Info( + * version="1.0.0", + * title="Cadastre Test Rest", + * description="All features to access server operation for cadastre", + * ) + * ) + */ +?> + +<h1 class="titleOverview">Service Cadastre Version 2 </h1> +<p> + <a class="linkOverview" href="javascript:sService='cadastreV2';LoadApi()">CadastreV2</a>: this is the most comprehensive service which should be used as a preference when developing applications communicating with Cadastre. Those services allow you to administrate Cadastre applications. +</p> \ No newline at end of file