From 38151d11045b784371c7c2e6acee9b44b168f4dc Mon Sep 17 00:00:00 2001 From: ArmandBahi <armand.bahi@veremes.com> Date: Tue, 25 Sep 2018 10:35:27 +0200 Subject: [PATCH] Add 'vmap/vas/rest/ws/cadastre/' from commit '40766c0744b334aa5e042a032f9d80bbe46c9678' git-subtree-dir: vmap/vas/rest/ws/cadastre git-subtree-mainline: 29fba9ee233159b2d8508bdea54ce5b01ac5ec47 git-subtree-split: 40766c0744b334aa5e042a032f9d80bbe46c9678 --- vas/rest/ws/cadastre/Adresse.class.inc | 74 +++++ vas/rest/ws/cadastre/Adresses.class.inc | 131 ++++++++ vas/rest/ws/cadastre/CHANGE_LOG.txt | 8 + vas/rest/ws/cadastre/Cadastre.class.inc | 36 +++ .../ws/cadastre/CadastreProperties.class.inc | 74 +++++ vas/rest/ws/cadastre/Commune.class.inc | 75 +++++ vas/rest/ws/cadastre/Communes.class.inc | 131 ++++++++ .../ws/cadastre/DescriptionParcelle.class.inc | 74 +++++ .../cadastre/DescriptionParcelles.class.inc | 132 ++++++++ .../ws/cadastre/DownloadRapport.class.inc | 131 ++++++++ .../FicheDescriptiveInvariant.class.inc | 142 +++++++++ .../FicheDescriptiveParcelle.class.inc | 214 +++++++++++++ vas/rest/ws/cadastre/FicheUrbanisme.class.inc | 187 ++++++++++++ vas/rest/ws/cadastre/Invariant.class.inc | 74 +++++ vas/rest/ws/cadastre/Invariants.class.inc | 131 ++++++++ vas/rest/ws/cadastre/LieuDit.class.inc | 33 ++ vas/rest/ws/cadastre/LieuDits.class.inc | 131 ++++++++ vas/rest/ws/cadastre/Parcelle.class.inc | 74 +++++ vas/rest/ws/cadastre/Parcelles.class.inc | 131 ++++++++ vas/rest/ws/cadastre/Proprietaire.class.inc | 33 ++ vas/rest/ws/cadastre/Proprietaires.class.inc | 131 ++++++++ .../RapportsCadastreParcelle.class.inc | 283 ++++++++++++++++++ .../ws/cadastre/ReleveDePropriete.class.inc | 259 ++++++++++++++++ vas/rest/ws/cadastre/Section.class.inc | 75 +++++ vas/rest/ws/cadastre/Sections.class.inc | 132 ++++++++ vas/rest/ws/cadastre/Versions.class.inc | 77 +++++ vas/rest/ws/cadastre/Voie.class.inc | 74 +++++ vas/rest/ws/cadastre/Voies.class.inc | 131 ++++++++ vas/rest/ws/cadastre/overview.phtml | 24 ++ 29 files changed, 3202 insertions(+) create mode 100755 vas/rest/ws/cadastre/Adresse.class.inc create mode 100755 vas/rest/ws/cadastre/Adresses.class.inc create mode 100755 vas/rest/ws/cadastre/CHANGE_LOG.txt create mode 100755 vas/rest/ws/cadastre/Cadastre.class.inc create mode 100755 vas/rest/ws/cadastre/CadastreProperties.class.inc create mode 100755 vas/rest/ws/cadastre/Commune.class.inc create mode 100755 vas/rest/ws/cadastre/Communes.class.inc create mode 100755 vas/rest/ws/cadastre/DescriptionParcelle.class.inc create mode 100755 vas/rest/ws/cadastre/DescriptionParcelles.class.inc create mode 100755 vas/rest/ws/cadastre/DownloadRapport.class.inc create mode 100755 vas/rest/ws/cadastre/FicheDescriptiveInvariant.class.inc create mode 100755 vas/rest/ws/cadastre/FicheDescriptiveParcelle.class.inc create mode 100755 vas/rest/ws/cadastre/FicheUrbanisme.class.inc create mode 100755 vas/rest/ws/cadastre/Invariant.class.inc create mode 100755 vas/rest/ws/cadastre/Invariants.class.inc create mode 100755 vas/rest/ws/cadastre/LieuDit.class.inc create mode 100755 vas/rest/ws/cadastre/LieuDits.class.inc create mode 100755 vas/rest/ws/cadastre/Parcelle.class.inc create mode 100755 vas/rest/ws/cadastre/Parcelles.class.inc create mode 100755 vas/rest/ws/cadastre/Proprietaire.class.inc create mode 100755 vas/rest/ws/cadastre/Proprietaires.class.inc create mode 100755 vas/rest/ws/cadastre/RapportsCadastreParcelle.class.inc create mode 100755 vas/rest/ws/cadastre/ReleveDePropriete.class.inc create mode 100755 vas/rest/ws/cadastre/Section.class.inc create mode 100755 vas/rest/ws/cadastre/Sections.class.inc create mode 100755 vas/rest/ws/cadastre/Versions.class.inc create mode 100755 vas/rest/ws/cadastre/Voie.class.inc create mode 100755 vas/rest/ws/cadastre/Voies.class.inc create mode 100755 vas/rest/ws/cadastre/overview.phtml diff --git a/vas/rest/ws/cadastre/Adresse.class.inc b/vas/rest/ws/cadastre/Adresse.class.inc new file mode 100755 index 00000000..3cff3396 --- /dev/null +++ b/vas/rest/ws/cadastre/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(oid, 'ID_COM', 'IDU_', 'ID_PAR', 'CCODEP', 'CCODIR', 'CCOCOM', 'CCOPRE', 'CCOSEC', 'DNUPLA', 'CENR', 'DCNTPA', 'DSRPAR', 'DNUPRO', 'JDATAT', 'DREFLF', 'GPDL', 'CPRSECR', 'CCOSECR', 'DNUPLAR', 'DNUPDL', 'GURBPA', 'DPARPI', 'CCOARP', 'GPARNF', 'GPARBAT', 'CCOVOI', 'CCORIV', 'CCOCIF', 'CODE_INSEE', 'ID_RIVOLI', 'ID_DNUPRO', 'DNVOIRI', 'DINDIC', 'L_NATURE_VOIE', '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/adresses") + * ) + * ) + */ + + /** + * get informations about Adresse + */ + function GET() { + require __DIR__ . "/../vitis/" . $this->sRessourcesFile; + $this->aFields = $this->getFields('public', $this->aProperties['cadastre']['views']['adresse'], 'ID_PAR'); + } + +} + +?> \ No newline at end of file diff --git a/vas/rest/ws/cadastre/Adresses.class.inc b/vas/rest/ws/cadastre/Adresses.class.inc new file mode 100755 index 00000000..38dea19d --- /dev/null +++ b/vas/rest/ws/cadastre/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 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); + $this->aSelectedFields = Array(oid, 'ID_COM', 'IDU_', 'ID_PAR', 'CCODEP', 'CCODIR', 'CCOCOM', 'CCOPRE', 'CCOSEC', 'DNUPLA', 'CENR', 'DCNTPA', 'DSRPAR', 'DNUPRO', 'JDATAT', 'DREFLF', 'GPDL', 'CPRSECR', 'CCOSECR', 'DNUPLAR', 'DNUPDL', 'GURBPA', 'DPARPI', 'CCOARP', 'GPARNF', 'GPARBAT', 'CCOVOI', 'CCORIV', 'CCOCIF', 'CODE_INSEE', 'ID_RIVOLI', 'ID_DNUPRO', 'DNVOIRI', 'DINDIC', 'L_NATURE_VOIE', '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="sort order", + * 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('public', $this->aProperties['cadastre']['views']['adresse'], 'ID_PAR'); + return $aReturn['sMessage']; + } + +} + +?> \ No newline at end of file diff --git a/vas/rest/ws/cadastre/CHANGE_LOG.txt b/vas/rest/ws/cadastre/CHANGE_LOG.txt new file mode 100755 index 00000000..73f8e2a1 --- /dev/null +++ b/vas/rest/ws/cadastre/CHANGE_LOG.txt @@ -0,0 +1,8 @@ + + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + + + + VEREMES - Web Service Cadastre (Modèle Veremap) change log + + + + + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + diff --git a/vas/rest/ws/cadastre/Cadastre.class.inc b/vas/rest/ws/cadastre/Cadastre.class.inc new file mode 100755 index 00000000..ce60eb55 --- /dev/null +++ b/vas/rest/ws/cadastre/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('public', $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/vas/rest/ws/cadastre/CadastreProperties.class.inc b/vas/rest/ws/cadastre/CadastreProperties.class.inc new file mode 100755 index 00000000..9946176f --- /dev/null +++ b/vas/rest/ws/cadastre/CadastreProperties.class.inc @@ -0,0 +1,74 @@ +<?php + +require_once __DIR__ . '/../vitis/Vitis.class.inc'; + +/** + * \file cadastreproperties.class.inc + * \class CadatsreProperties + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the Properties php class + * + * This class defines the rest api for properties + * + */ +class CadastreProperties extends Vitis { + /** + * @SWG\Definition( + * definition="/cadastreproperties", + * allOf={ + * @SWG\Schema(ref="#/definitions/cadastreproperties") + * } + * ) + * * @SWG\Tag( + * name="properties", + * description="Operations about properties" + * ) + */ + + /** + * 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 properties($aPath, $aValues, $properties, $bShortcut = false) { + $this->aValues = $aValues; + $this->aPath = $aPath; + $this->aProperties = (object) $properties; + } + + /** + * @SWG\Get(path="/cadastreproperties", + * tags={"Properties"}, + * summary="Get the cadastre properties", + * description="Request to get properties", + * operationId="GET", + * produces={"application/json", "application/x-vm-json"}, + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitionscadastre/properties") + * ) + * ) + */ + + /** + * + * @return properties + */ + function GET() { + + $this->aFields['data'] = $this->aProperties->cadastre; + $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/vas/rest/ws/cadastre/Commune.class.inc b/vas/rest/ws/cadastre/Commune.class.inc new file mode 100755 index 00000000..9aec3ee2 --- /dev/null +++ b/vas/rest/ws/cadastre/Commune.class.inc @@ -0,0 +1,75 @@ +<?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 + * @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", "code_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/communes") + * ) + * ) + */ + + /** + * get informations about Commune + */ + function GET() { + require __DIR__ . "/../vitis/" . $this->sRessourcesFile; + $this->aFields = $this->getFields('public', $this->aProperties['cadastre']['views']['commune'], 'id_com'); + } + +} + +?> \ No newline at end of file diff --git a/vas/rest/ws/cadastre/Communes.class.inc b/vas/rest/ws/cadastre/Communes.class.inc new file mode 100755 index 00000000..a3b21489 --- /dev/null +++ b/vas/rest/ws/cadastre/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 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); + $this->aSelectedFields = Array("id_com", "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="sort order", + * 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('public', $this->aProperties['cadastre']['views']['commune'], 'id_com'); + return $aReturn['sMessage']; + } + +} + +?> \ No newline at end of file diff --git a/vas/rest/ws/cadastre/DescriptionParcelle.class.inc b/vas/rest/ws/cadastre/DescriptionParcelle.class.inc new file mode 100755 index 00000000..7fe77be3 --- /dev/null +++ b/vas/rest/ws/cadastre/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(oid, 'ID_COM', 'IDU_', 'ID_PAR', 'CCODEP', 'CCODIR', 'CCOCOM', 'CCOPRE', 'CCOSEC', 'DNUPLA', 'CENR', 'DCNTPA', 'DSRPAR', 'DNUPRO', 'JDATAT', 'DREFLF', 'GPDL', 'CPRSECR', 'CCOSECR', 'DNUPLAR', 'DNUPDL', 'GURBPA', 'DPARPI', 'CCOARP', 'GPARNF', 'GPARBAT', 'CCOVOI', 'CCORIV', 'CCOCIF', 'CODE_INSEE', 'ID_RIVOLI', 'ID_DNUPRO', 'DNVOIRI', 'DINDIC', 'L_NATURE_VOIE', '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/descriptionparcelles") + * ) + * ) + */ + + /** + * get informations about DescriptionParcelle + */ + function GET() { + require __DIR__ . "/../vitis/" . $this->sRessourcesFile; + $this->aFields = $this->getFields('public', $this->aProperties['cadastre']['views']['description_parcelle'], 'ID_PAR'); + } + +} + +?> \ No newline at end of file diff --git a/vas/rest/ws/cadastre/DescriptionParcelles.class.inc b/vas/rest/ws/cadastre/DescriptionParcelles.class.inc new file mode 100755 index 00000000..a0beaf77 --- /dev/null +++ b/vas/rest/ws/cadastre/DescriptionParcelles.class.inc @@ -0,0 +1,132 @@ +<?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(oid, 'ID_COM', 'IDU_', 'ID_PAR', 'CCODEP', 'CCODIR', 'CCOCOM', 'CCOPRE', 'CCOSEC', 'DNUPLA', 'CENR', 'DCNTPA', 'DSRPAR', 'DNUPRO', 'JDATAT', 'DREFLF', 'GPDL', 'CPRSECR', 'CCOSECR', 'DNUPLAR', 'DNUPDL', 'GURBPA', 'DPARPI', 'CCOARP', 'GPARNF', 'GPARBAT', 'CCOVOI', 'CCORIV', 'CCOCIF', 'CODE_INSEE', 'ID_RIVOLI', 'ID_DNUPRO', 'DNVOIRI', 'DINDIC', 'L_NATURE_VOIE', '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="sort order", + * 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() { + $this->aValues['filter'] = str_replace("id_par", "ID_PAR", $this->aValues['filter']); + $aReturn = $this->genericGet('public', $this->aProperties['cadastre']['views']['description_parcelle'], 'ID_PAR'); + return $aReturn['sMessage']; + } + +} + +?> \ No newline at end of file diff --git a/vas/rest/ws/cadastre/DownloadRapport.class.inc b/vas/rest/ws/cadastre/DownloadRapport.class.inc new file mode 100755 index 00000000..07ac4813 --- /dev/null +++ b/vas/rest/ws/cadastre/DownloadRapport.class.inc @@ -0,0 +1,131 @@ +<?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 && ($_SESSION['ses_restriction'] == "%" || in_array(substr($this->aValues['sFileName'], 0, 5), $aRestriction))) { + $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/vas/rest/ws/cadastre/FicheDescriptiveInvariant.class.inc b/vas/rest/ws/cadastre/FicheDescriptiveInvariant.class.inc new file mode 100755 index 00000000..96887da2 --- /dev/null +++ b/vas/rest/ws/cadastre/FicheDescriptiveInvariant.class.inc @@ -0,0 +1,142 @@ +<?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 = 'public'; + $sTable = 'v_maj_fiche_inv_descr'; +// $sFilter = "\"ID_BAT\" = '" . $ID_BAT . "'"; + $aFilter = array( + 'column' => 'ID_BAT', + 'compare_operator' => '=', + 'value' => $ID_BAT + ); + $aAttributs = Array('ID_BAT', 'DVOILIB', 'LIBCOM', 'ID_COM', 'L_DTELOC', 'L_CCONLC', 'L_DNATLC', 'JDATAT', 'JANNAT', 'CCHPR', 'BIPEVLA1', 'DNBNIV', 'DNUBAT', 'DESC', 'DNIV', 'DVLTRT', 'INVAR'); + + $oInvariantInfos['data'] = $this->vmapGet($sSchema, $sTable, $aAttributs, $aFilter)[0]; + + // Infos sur le P.E.V + $sTable = 'v_maj_fiche_inv_pev'; + $aAttributs = Array('ID_BAT', 'DNUPEV', 'L_CCOAFF', 'DCAPEC', 'CCOSTB', 'DNUREF', 'BIPEVLA1', 'VLBAIA1'); + + $oInvariantInfos['data']['PEV'] = $this->vmapGet($sSchema, $sTable, $aAttributs, $aFilter); + + // Infos sur les habitations + $sTable = 'v_maj_fiche_inv_hab'; + $aAttributs = Array('ID_BAT', 'DNUPEV', 'GEAULC', 'GELELC', 'GCHCLC', 'GTEGLC', 'DNBBAI', 'DNBDOU', 'DNBLAV', 'DNBWC', 'DEQDHA', 'DNBPPR', 'DNBPDC', 'DSUPDC', 'L_DMATGM', 'L_DMATTO', 'JANNAT', 'L_DETENT', 'DNBNIV', 'DNBSAM', 'DNBCHA', 'DNBCU8', 'DNBCU9', 'DNBSEA', 'DNBANN', 'CCONAD1', 'L_CCONAD1', 'DSUEIC1', 'CCONAD2', 'L_CCONAD2', 'DSUEIC2', 'CCONAD3', 'L_CCONAD3', 'DSUEIC3', 'CCONAD4', 'L_CCONAD4', 'DSUEIC4'); + + $oInvariantInfos['data']['habitations'] = $this->vmapGet($sSchema, $sTable, $aAttributs, $aFilter); + + // Infos sur les locaux pros + $sTable = 'v_maj_fiche_inv_local_pro'; + $aAttributs = Array('ID_BAT', 'DNUPEV', 'DNUDES', 'VSURZT'); + + $oInvariantInfos['data']['locauxPros'] = $this->vmapGet($sSchema, $sTable, $aAttributs, $aFilter); + + // Infos sur les dépendances + $sTable = 'v_maj_fiche_inv_dep'; + $aAttributs = Array('ID_BAT', 'DNUPEV', 'DSUDEP', 'GEAULC', 'GELELC', 'GCHCLC', 'DNBBAI', 'DNBDOU', 'DNBLAV', 'DNBWC', 'L_DMATGM', 'L_DMATTO', 'L_DETENT', 'L_CCONAD'); + + $oInvariantInfos['data']['dependances'] = $this->vmapGet($sSchema, $sTable, $aAttributs, $aFilter); + + // Infos sur les propriétaires + $sTable = 'v_maj_fiche_inv_prop'; + $aAttributs = Array('ID_BAT', 'DQUALP', 'DDENOM', 'JDATNSS', 'DLDNSS', 'DLIGN3', 'DLIGN4', 'DLIGN6', 'L_CCODEM', 'L_CCODRO'); + + $oInvariantInfos['data']['proprietaires'] = $this->vmapGet($sSchema, $sTable, $aAttributs, $aFilter); + + // Infos sur les lots + $sTable = 'v_maj_fiche_inv_lot'; + $aAttributs = Array('ID_BAT', 'KLOT', 'DNUMQL', 'DDENQL'); + + $oInvariantInfos['data']['lots'] = $this->vmapGet($sSchema, $sTable, $aAttributs, $aFilter); + + return json_encode($oInvariantInfos); + } + +} + +?> \ No newline at end of file diff --git a/vas/rest/ws/cadastre/FicheDescriptiveParcelle.class.inc b/vas/rest/ws/cadastre/FicheDescriptiveParcelle.class.inc new file mode 100755 index 00000000..b6bd6567 --- /dev/null +++ b/vas/rest/ws/cadastre/FicheDescriptiveParcelle.class.inc @@ -0,0 +1,214 @@ +<?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, 6)) == 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 = 'public'; + $sTable = 'v_maj_fiche_prc_descr'; +// $sFilter = "\"ID_PAR\" = '" . $ID_PAR . "'"; + $aFilter = array( + 'column' => 'ID_PAR', + 'compare_operator' => '=', + 'value' => $ID_PAR + ); + $aAttributs = Array('ID_PAR', 'ID_COM', 'parcelle', 'commune', 'sup_fiscale', 'DCNTPA', 'DNVOIRI', 'DINDIC', 'L_NATURE_VOIE', 'DVOILIB', 'CCORIV', 'GPARBAT', 'GURBPA'); + + $oParcelleInfos['data'] = $this->vmapGet($sSchema, $sTable, $aAttributs, $aFilter)[0]; + + // Infos sur le proprietaire + $sSchemaProp = 'public'; + $sTableProp = 'v_maj_fiche_prc_prop'; +// $sFilterProp = "\"ID_PAR\" = '" . $ID_PAR . "'"; + $aFilterProp = array( + 'column' => 'ID_PAR', + 'compare_operator' => '=', + 'value' => $ID_PAR + ); + $aAttributsProp = Array('ID_PAR', 'DQUALP', 'DNUPRO', 'DDENOM', 'JDATNSS', 'DLDNSS', 'DLIGN3', 'DLIGN6', 'L_CCODEM', 'L_CCODRO', 'GDESIP', 'DLIGN4'); + + $oParcelleInfos['data']['aProprietaires'] = $this->vmapGet($sSchemaProp, $sTableProp, $aAttributsProp, $aFilterProp); + + // infos sur la subdivision fiscale + $sSchemaSub = 'public'; + $sTableSub = 'v_maj_fiche_prc_suf'; +// $sFilterSub = "\"ID_PAR\" = '" . $ID_PAR . "'"; + $aFilterSub = array( + 'column' => 'ID_PAR', + 'compare_operator' => '=', + 'value' => $ID_PAR + ); + $aAttributsSub = Array('ID_PAR', 'CCOSUB', 'DSGRPF', 'CNATSP', 'L_DSGRPF', 'DCLSSF', 'DCNTSF', 'DRCSUBA', 'DRCSUB'); + + $oParcelleInfos['data']['aSubdivisionFiscale'] = $this->vmapGet($sSchemaSub, $sTableSub, $aAttributsSub, $aFilterSub); + + // Infos sur le bâti + $sSchemaBatis = 'public'; + $sTableBatis = 'v_maj_fiche_prc_bat'; +// $sFilterBatis = "\"ID_PAR\" = '" . $ID_PAR . "'"; + $aFilterBatis = array( + 'column' => 'ID_PAR', + 'compare_operator' => '=', + 'value' => $ID_PAR + ); + $aAttributsBatis = Array('ID_BAT', 'ID_PAR', 'INVAR', 'ID_BAT', 'L_DTELOC', 'L_CCONLC', 'L_DNATLC', 'JDATAT', 'JANNAT', '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 = 'public'; + $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/vas/rest/ws/cadastre/FicheUrbanisme.class.inc b/vas/rest/ws/cadastre/FicheUrbanisme.class.inc new file mode 100755 index 00000000..aaa0c4e2 --- /dev/null +++ b/vas/rest/ws/cadastre/FicheUrbanisme.class.inc @@ -0,0 +1,187 @@ +<?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() { + + 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->aPath[2]; + + // Vérifie les droits de d'utilisateur sur la commune + if ($this->haveCommuneRights(substr($ID_PAR, 0, 6)) == 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 = 'public'; + $sTable = 'v_maj_fiche_urb_vmap'; + // $sFilter = "\"ID_PAR\" = '" . $ID_PAR . "'"; + $aFilter = array( + 'column' => 'ID_PAR', + 'compare_operator' => '=', + 'value' => $ID_PAR + ); + $aAttributs = Array('ID_PAR', 'LIBDEP', 'LIBCOM', 'DNUPLA', 'CCOSEC', 'DCNTPA', 'DDENOM', 'DLIGN3', 'DLIGN4', 'DLIGN6', '"DNVOIRI" || "DINDIC" || \' \' || "CCONVO" || \' \' || "DVOILIB" as "ADRESSE"', 'l_dsgrpf as "DSGRPF"'); + + $oParcelleInfos['data'] = $this->vmapGet($sSchema, $sTable, $aAttributs, $aFilter); + + // Géométrie + $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'); + + $oParcelleInfos['data']['geometry'] = $this->vmapGet($sSchema, $sTable, $aAttributs, $aFilter)[0]; + + // Récupère la géométrie de la parcelle + $sSchema = 'public'; + $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'); + $parcelleGeom = $this->vmapGet($sSchema, $sTable, $aAttributs, $aFilter)[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) { + + $sTable = $key; + $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']['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) { + $sTable = $key; + $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); + } + +} + +?> \ No newline at end of file diff --git a/vas/rest/ws/cadastre/Invariant.class.inc b/vas/rest/ws/cadastre/Invariant.class.inc new file mode 100755 index 00000000..4c901af7 --- /dev/null +++ b/vas/rest/ws/cadastre/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('oid', 'ID_BAT', 'ID_COM', 'INVAR', 'DNUPRO', 'ID_PAR', 'CCOSEC', '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/invariants") + * ) + * ) + */ + + /** + * get informations about Invariant + */ + function GET() { + require __DIR__ . "/../vitis/" . $this->sRessourcesFile; + $this->aFields = $this->getFields('public', $this->aProperties['cadastre']['views']['invariant'], 'ID_BAT'); + } + +} + +?> \ No newline at end of file diff --git a/vas/rest/ws/cadastre/Invariants.class.inc b/vas/rest/ws/cadastre/Invariants.class.inc new file mode 100755 index 00000000..13c9beff --- /dev/null +++ b/vas/rest/ws/cadastre/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('oid', 'ID_BAT', 'ID_COM', 'INVAR', 'DNUPRO', 'ID_PAR', 'CCOSEC', '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="sort order", + * 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('public', $this->aProperties['cadastre']['views']['invariant'], 'ID_BAT'); + return $aReturn['sMessage']; + } + +} + +?> \ No newline at end of file diff --git a/vas/rest/ws/cadastre/LieuDit.class.inc b/vas/rest/ws/cadastre/LieuDit.class.inc new file mode 100755 index 00000000..992c02e9 --- /dev/null +++ b/vas/rest/ws/cadastre/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) { + + } + +} + +?> \ No newline at end of file diff --git a/vas/rest/ws/cadastre/LieuDits.class.inc b/vas/rest/ws/cadastre/LieuDits.class.inc new file mode 100755 index 00000000..13db1fe7 --- /dev/null +++ b/vas/rest/ws/cadastre/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("oid", "id_com", "code_com", "section", "pre", "texte", "tex", "tex2", "tex3", "tex4", "tex5", "tex6", "tex7", "tex8", "tex9", "tex10", "geom"); + } + + /** + * @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="sort order", + * 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('public', $this->aProperties['cadastre']['views']['lieu_dit'], 'oid'); + return $aReturn['sMessage']; + } + +} + +?> \ No newline at end of file diff --git a/vas/rest/ws/cadastre/Parcelle.class.inc b/vas/rest/ws/cadastre/Parcelle.class.inc new file mode 100755 index 00000000..de1fee3c --- /dev/null +++ b/vas/rest/ws/cadastre/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", "codm", "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/parcelles") + * ) + * ) + */ + + /** + * get informations about Parcelle + */ + function GET() { + require __DIR__ . "/../vitis/" . $this->sRessourcesFile; + $this->aFields = $this->getFields('public', $this->aProperties['cadastre']['views']['parcelle'], 'id_par'); + } + +} + +?> \ No newline at end of file diff --git a/vas/rest/ws/cadastre/Parcelles.class.inc b/vas/rest/ws/cadastre/Parcelles.class.inc new file mode 100755 index 00000000..797ab424 --- /dev/null +++ b/vas/rest/ws/cadastre/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", "code_com", "commune", "parcelle", "section", "pre", "coar", "codm", "indp", "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="sort order", + * 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('public', $this->aProperties['cadastre']['views']['parcelle'], 'id_par'); + return $aReturn['sMessage']; + } + +} + +?> \ No newline at end of file diff --git a/vas/rest/ws/cadastre/Proprietaire.class.inc b/vas/rest/ws/cadastre/Proprietaire.class.inc new file mode 100755 index 00000000..6c52fdf2 --- /dev/null +++ b/vas/rest/ws/cadastre/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) { + + } + +} + +?> \ No newline at end of file diff --git a/vas/rest/ws/cadastre/Proprietaires.class.inc b/vas/rest/ws/cadastre/Proprietaires.class.inc new file mode 100755 index 00000000..ebf25726 --- /dev/null +++ b/vas/rest/ws/cadastre/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('oid', 'ID_COM', 'DDENOM', 'DNUPRO', '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="sort order", + * 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('public', $this->aProperties['cadastre']['views']['proprietaire'], 'oid'); + return $aReturn['sMessage']; + } + +} + +?> \ No newline at end of file diff --git a/vas/rest/ws/cadastre/RapportsCadastreParcelle.class.inc b/vas/rest/ws/cadastre/RapportsCadastreParcelle.class.inc new file mode 100755 index 00000000..b50102df --- /dev/null +++ b/vas/rest/ws/cadastre/RapportsCadastreParcelle.class.inc @@ -0,0 +1,283 @@ +<?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']; + + /** + * Objet BD + * @type object + */ + $oBD = new BD($this->aProperties["cadastre"]["rp"]["login"], $this->aProperties["cadastre"]["rp"]["pass"], $this->aProperties["database"], $this->aProperties["server"], $this->aProperties["port"], $this->aProperties["sgbd"], $this->aProperties["page_encoding"]); + $this->oConnection->oBd = $oBD; + /** + * Properties + * @type array + */ + $properties = $this->aProperties; + + /** + * Returned array + * @type array + */ + $aReturn = Array(); + + + // 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'; + + // Connexion avec uVitis pour récupérer les données majic + + $oBD = new BD($properties["cadastre"]["rp"]["login"], $properties["cadastre"]["rp"]["pass"], $properties["database"], $properties["server"], $properties["port"], $properties["sgbd"], $properties["page_encoding"]); + $this->oConnection->oBd = $oBD; + + // Récupère l'année + $sYear = $this->vmapGet('majic', '"ANNEE_REFERENCE"', array('ANNEE'), '', 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 = ""; + foreach ($aParcelles as $parcelle) { + $sFile .= $parcelle; + } + if (count($aParcelles) > 2) { + $sFile = UniqFileName(); + } + + $sXmlFileName = $properties["cadastre"]["rp"]["rp_dir"] . "/" . $sYear . "/Rapport_Parcelle_" . $rapportType . "/" . $sFile . ".xml"; + + if ($rapportType === 'ToutesInfos') + $sXslFileName = __DIR__ . "/../../class/majic_lib/xsl/Mj_Rapport.xsl"; + else + $sXslFileName = __DIR__ . "/../../class/majic_lib/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'] . '/cadastre/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'] . '/cadastre/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/vas/rest/ws/cadastre/ReleveDePropriete.class.inc b/vas/rest/ws/cadastre/ReleveDePropriete.class.inc new file mode 100755 index 00000000..667891e9 --- /dev/null +++ b/vas/rest/ws/cadastre/ReleveDePropriete.class.inc @@ -0,0 +1,259 @@ +<?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="IDDNUPRO", + * 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; + $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, 6)); + if ($IDDNUPRO != '') + $communeRights = $this->haveCommuneRights(substr($IDDNUPRO, 0, 6)); + + // Vérifie les droits sur la commune + 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); + } + + // Vérifie la validité des informations passées en properties + if (!is_dir($properties["fop_root_dir"])) { + http_response_code(500); + writeToErrorLog("Dossier fop introuvable: " . $properties["fop_root_dir"]); + $aReturn['error']['errorMessage'] = "Erreur lors de la génération du fichier PDF de relevé de propriété."; + return json_encode($aReturn); + } + if (!is_dir(__DIR__ . '/../../class/majic_lib')) { + http_response_code(500); + writeToErrorLog("Dossier majic_lib introuvable"); + $aReturn['error']['errorMessage'] = "Erreur lors de la génération du fichier PDF de relevé de propriété."; + return json_encode($aReturn); + } + + $oBD = new BD($properties["cadastre"]["rp"]["login"], $properties["cadastre"]["rp"]["pass"], $properties["database"], $properties["server"], $properties["port"], $properties["sgbd"], $properties["page_encoding"]); + $this->oConnection->oBd = $oBD; + + // Récupère l'année + $sYear = $this->vmapGet('majic', '"ANNEE_REFERENCE"', array('ANNEE'), '', 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'] . '/cadastre/downloadrapport?sYear=' . $sYear . '&sType=' . $sType . '&sFileName=' . urlencode($fileName) . '.pdf'; + $aReturn['data']['alreadyExists'] = true; + } else { + 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_lib/Mj_Compte_Communal.class.inc'; + $oRP = new Mj_Compte_Communal($IDDNUPRO, $oBD); + 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 { + if ($sType === "tiers") { + $sDir = $sYear . "/tiers/"; + } else { + $sDir = $sYear . "/standard/"; + } + $sFile = str_replace("*", "~", $IDDNUPRO); + } + break; + + case "parcelle" : + require_once __DIR__ . '/../../class/majic_lib/Mj_Compte_Communal_Parcelle.class.inc'; + $oRP = new Mj_Compte_Communal_Parcelle("", $ID_PAR, $oBD); + 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_lib/xsl/Mj_fo_tiers.xsl'; + } else { + $sXSLFile = __DIR__ . '/../../class/majic_lib/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'] . '/cadastre/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/vas/rest/ws/cadastre/Section.class.inc b/vas/rest/ws/cadastre/Section.class.inc new file mode 100755 index 00000000..403db329 --- /dev/null +++ b/vas/rest/ws/cadastre/Section.class.inc @@ -0,0 +1,75 @@ +<?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 + * @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", "tex", "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="Poprerties Response", + * @SWG\Schema(ref="#/definitions/sections") + * ) + * ) + */ + + /** + * get informations about Section + */ + function GET() { + require __DIR__ . "/../vitis/" . $this->sRessourcesFile; + $this->aFields = $this->getFields('public', $this->aProperties['cadastre']['views']['section'], 'id_sec'); + } + +} + +?> \ No newline at end of file diff --git a/vas/rest/ws/cadastre/Sections.class.inc b/vas/rest/ws/cadastre/Sections.class.inc new file mode 100755 index 00000000..be0c3b5c --- /dev/null +++ b/vas/rest/ws/cadastre/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", "code_com", "commune", "replace(pre, '000', '')||replace(section, '0', '') as section", "pre", "idu", "tex", "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="sort order", + * 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/sections") + * ) + * ) + */ + + /** + * get Sections + * @return Sections + */ + function GET() { + $aReturn = $this->genericGet('public', $this->aProperties['cadastre']['views']['section'], 'id_sec'); + return $aReturn['sMessage']; + } + +} + +?> \ No newline at end of file diff --git a/vas/rest/ws/cadastre/Versions.class.inc b/vas/rest/ws/cadastre/Versions.class.inc new file mode 100755 index 00000000..590e0062 --- /dev/null +++ b/vas/rest/ws/cadastre/Versions.class.inc @@ -0,0 +1,77 @@ +<?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("cadastre"); + //$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/vas/rest/ws/cadastre/Voie.class.inc b/vas/rest/ws/cadastre/Voie.class.inc new file mode 100755 index 00000000..74d96ba2 --- /dev/null +++ b/vas/rest/ws/cadastre/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', 'ID_COM', 'ID_RIVOLI', 'CCODEP', 'CCODIR', 'CCOCOM', 'RIVOLI', 'CLERIVOLI', 'LIBVOIE', 'TYPCOM', 'RUR', 'CARVOIE', 'ANNULATION', 'DATEANNUL', 'DATECREA', 'MAJIC2', 'TYPEVOIE', 'INDIC', 'MOTCLASS', 'CODE_INSEE', 'NATURE', '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="Poprerties Response", + * @SWG\Schema(ref="#/definitions/voies") + * ) + * ) + */ + + /** + * get informations about Voie + */ + function GET() { + require __DIR__ . "/../vitis/" . $this->sRessourcesFile; + $this->aFields = $this->getFields('public', $this->aProperties['cadastre']['views']['voie'], 'ID_RIVOLI'); + } + +} + +?> \ No newline at end of file diff --git a/vas/rest/ws/cadastre/Voies.class.inc b/vas/rest/ws/cadastre/Voies.class.inc new file mode 100755 index 00000000..e9f61e93 --- /dev/null +++ b/vas/rest/ws/cadastre/Voies.class.inc @@ -0,0 +1,131 @@ +<?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_RIVOLI', 'L_NATURE_VOIE', '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="sort order", + * 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/voies") + * ) + * ) + */ + + /** + * get Voies + * @return Voies + */ + function GET() { + $aReturn = $this->genericGet('public', $this->aProperties['cadastre']['views']['voie'], 'ID_RIVOLI'); + return $aReturn['sMessage']; + } + +} + +?> \ No newline at end of file diff --git a/vas/rest/ws/cadastre/overview.phtml b/vas/rest/ws/cadastre/overview.phtml new file mode 100755 index 00000000..6e2671fd --- /dev/null +++ b/vas/rest/ws/cadastre/overview.phtml @@ -0,0 +1,24 @@ +<?php +/** + * @SWG\Swagger( + * basePath="/[service_alias]/cadastre", + * 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</h1> +<p> + <a class="linkOverview" href="javascript:sService='cadastre';LoadApi()">Cadastre</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 -- GitLab