diff --git a/vmap/vas/rest/ws/anc/Anc.class.inc b/vmap/vas/rest/ws/anc/Anc.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..9a578d4b607b23243022ebd717158efc5e5c651b --- /dev/null +++ b/vmap/vas/rest/ws/anc/Anc.class.inc @@ -0,0 +1,41 @@ +<?php + +require_once __DIR__ . "/../../class/vitis_lib/DbClass.class.inc"; +require_once __DIR__ . '/../vitis/Vitis.class.inc'; +require_once 'vmlib/logUtil.inc'; + +class Anc extends Vitis { + + //Chemin du fichier de ressources contenant les requêtes SQL + var $sRessourcesFile = 'ws/anc/Anc.class.sql.inc'; + + /** + * Upload un document dans le ws_data du module Anc. + * @param type $sIndex + * @param type $sFolder + */ + function uploadDocument($sIndex, $sFolder) { + // Crée le répertoire si inexistant. + $sDirPath = $this->aProperties['ws_data_dir'] . '/anc/' . $sFolder . '/documents/' . $this->aValues["my_vitis_id"] . '/' . $sIndex . '/'; + if (!is_dir($sDirPath)) + mkdir($sDirPath, 0777, true); + // Ecrit le fichier. + if (!empty($_FILES[$sIndex])) { + $sErrorMessage = uploadFile($sIndex, "", $sDirPath . $_FILES[$sIndex]["name"], $_FILES[$sIndex]['size'] + 1); + if ($sErrorMessage != "") + writeToErrorLog($sErrorMessage); + } + else { + $sfileContentIndex = $sIndex . '_file'; + $sfileNameIndex = $sIndex . '_name'; + if (!empty($this->aValues[$sfileContentIndex])) { + + $this->aValues[$sIndex] = $this->aValues[$sfileNameIndex]; + $fp = fopen($sDirPath . $this->aValues[$sfileNameIndex], "w"); + fwrite($fp, $this->aValues[$sfileContentIndex]); + fclose($fp); + } + } + } +} +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/anc/Anc.class.sql.inc b/vmap/vas/rest/ws/anc/Anc.class.sql.inc new file mode 100755 index 0000000000000000000000000000000000000000..200a536fd956f14f947b54de7504f590a6e72ae1 --- /dev/null +++ b/vmap/vas/rest/ws/anc/Anc.class.sql.inc @@ -0,0 +1,22 @@ +<?php +//Définition des requêtes de l'api Vitis +$aSql['checkIP'] = "SELECT user_id, ip_constraint FROM [sSchemaFramework].user WHERE login ='[sLogin]'"; +$aSql['getGroups'] = "SELECT group_id FROM [sSchemaFramework].user_group WHERE user_id = [user_id]"; +$aSql['loginUnique'] = 'SELECT UPPER("login") FROM [sSchemaFramework]."user" WHERE UPPER("login")=UPPER(\'sLoginUser\')'; +$aSql['getLoginbyId'] = 'SELECT "login" FROM [sSchemaFramework]."user" WHERE user_id=[user_id]'; +$aSql['getTableColumn'] = 'SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = \'[sSchemaFramework]\' and table_name= \'[sTable]\''; +$aSql['getUserPrivileges'] = 'SELECT groname FROM pg_user s LEFT OUTER JOIN pg_group g on (s.usesysid = any(g.grolist) )inner join [sSchemaFramework].user on "user".login = usename WHERE user_id = [user_id]'; +$aSql['listDomain'] = 'SELECT distinct domain, alias FROM [sSchemaFramework].domain WHERE "type" = \'AD\''; +$aSql['createRolname'] = 'CREATE ROLE "vitis_[sDomain]" NOSUPERUSER INHERIT NOCREATEDB CREATEROLE;'; +$aSql['getInfoRolname'] = 'SELECT * FROM pg_catalog.pg_roles WHERE rolname = \'vitis_[sDomain]\''; +// Installations +$aSql['getInstallationControls'] = "SELECT id_controle FROM [sSchemaAnc].v_controle WHERE id_installation IN([idList]) LIMIT 1"; +$aSql['getContZoneUrbaIntersect'] = "SELECT [sColumn]::text FROM [sSchema].[sTable] WHERE ST_INTERSECTS([sTable].[sColumnGeom], [geom])"; + +// Suppressions des sous-objets +$aSql['getControleEvacuationEaux'] = "SELECT id_eva FROM [sSchemaAnc].v_evacuation_eaux WHERE id_controle IN([idList])"; +$aSql['getControleFilieresAgrees'] = "SELECT id_fag FROM [sSchemaAnc].v_filieres_agrees WHERE id_controle IN([idList])"; +$aSql['getControlePretraitements'] = "SELECT id_pretraitement FROM [sSchemaAnc].v_pretraitement WHERE id_controle IN([idList])"; +$aSql['getControleTraitements'] = "SELECT id_traitement FROM [sSchemaAnc].v_traitement WHERE id_controle IN([idList])"; +$aSql['getControleComposants'] = "SELECT id_composant FROM [sSchemaAnc].v_composant WHERE id_controle IN([idList])"; +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/anc/Composant.class.inc b/vmap/vas/rest/ws/anc/Composant.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..281b190b33a2584bd6a1bfe656045992900974e5 --- /dev/null +++ b/vmap/vas/rest/ws/anc/Composant.class.inc @@ -0,0 +1,93 @@ +<?php + +require_once __DIR__ . '/Anc.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; + +/** + * \file Composant.class.inc + * \class Composant + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the Composant php class + * + * This class defines operation for one Composant + * + */ +class Composant extends Anc { + + public $oError; + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties) { + $this->aValues = $aValues; + $this->aPath = $aPath; + $this->aProperties = $properties; + $this->oConnection = new Connection($this->aValues, $this->aProperties); + } + + /** + * @SWG\Get(path="/composants/{id_composant}", + * tags={"Composants"}, + * summary="Get Composant", + * description="Request to get Composant by id", + * operationId="GET", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="id_composant", + * in="path", + * description="id_composant", + * required=true, + * type="integer", + * format="int32" + * ), + * @SWG\Parameter( + * name="attributs", + * in="query", + * description="list of attributs", + * required=false, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="Composant Response", + * @SWG\Schema(ref="#/definitions/composants") + * ) + * ) + */ + + /** + * get informations about mode + */ + function GET() { + $this->aFields = $this->getFields($this->aProperties['schema_anc'], "v_composant", "id_composant"); + } + + /** + * delete a Point_situation + */ + function DELETE() { + $this->oConnection->oBd->delete($this->aProperties['schema_anc'], 'v_composant', 'id_composant', $this->aValues["my_vitis_id"], 'integer'); + if ($this->oConnection->oBd->enErreur()) { + $this->oError = new VitisError(1, $this->oConnection->oBd->getBDMessage()); + } else { + $this->aFields["id_composant"] = $this->aValues["my_vitis_id"]; + } + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/anc/ComposantTypeFeatureStyle.class.inc b/vmap/vas/rest/ws/anc/ComposantTypeFeatureStyle.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..e455f8648b63bfddb54ea7ba36ecf6e4af6baf34 --- /dev/null +++ b/vmap/vas/rest/ws/anc/ComposantTypeFeatureStyle.class.inc @@ -0,0 +1,92 @@ +<?php + +require_once __DIR__ . '/Anc.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; + +/** + * \file ComposantTypeFeatureStyle.class.inc + * \class ComposantTypeFeatureStyle + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the ComposantTypeFeatureStyle php class + * + * This class defines operation for one ComposantTypeFeatureStyle + * + */ +class ComposantTypeFeatureStyle extends Anc { + + public $oError; + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties) { + $this->aValues = $aValues; + $this->aPath = $aPath; + $this->aProperties = $properties; + $this->oConnection = new Connection($this->aValues, $this->aProperties); + } + + /** + * @SWG\Get(path="/composanttypefeaturestyles/{composant_type}", + * tags={"ComposantTypeFeatureStyles"}, + * summary="Get ComposantTypeFeatureStyle", + * description="Request to get ComposantTypeFeatureStyle by id", + * operationId="GET", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="composant_type", + * in="path", + * description="composant_type", + * required=true, + * type="integer", + * format="int32" + * ), + * @SWG\Parameter( + * name="attributs", + * in="query", + * description="list of attributs", + * required=false, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="ComposantTypeFeatureStyle Response", + * @SWG\Schema(ref="#/definitions/composanttypefeaturestyles") + * ) + * ) + */ + + /** + * get informations about mode + */ + function GET() { + $this->aFields = $this->getFields($this->aProperties['schema_anc'], "v_composant_type_feature_style", "composant_type"); + } + + /** + * delete a Point_situation + */ + function DELETE() { + $this->oConnection->oBd->delete($this->aProperties['schema_anc'], 'v_composant_type_feature_style', 'composant_type', $this->aValues["my_vitis_id"], 'integer'); + if ($this->oConnection->oBd->enErreur()) { + $this->oError = new VitisError(1, $this->oConnection->oBd->getBDMessage()); + } else { + $this->aFields["composant_type"] = $this->aValues["my_vitis_id"]; + } + } +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/anc/ComposantTypeFeatureStyles.class.inc b/vmap/vas/rest/ws/anc/ComposantTypeFeatureStyles.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..3a91900e63f26db7a8f54e7710aed0ace99d1a10 --- /dev/null +++ b/vmap/vas/rest/ws/anc/ComposantTypeFeatureStyles.class.inc @@ -0,0 +1,266 @@ +<?php + +/** + * \file ComposantTypeFeatureStyles.class.inc + * \class ComposantTypeFeatureStyles + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the ComposantTypeFeatureStyles php class + * + * This class defines Rest Api to Vitis ComposantTypeFeatureStyles + * + */ +require_once __DIR__ . '/Anc.class.inc'; +require_once 'ComposantTypeFeatureStyle.class.inc'; + + +class ComposantTypeFeatureStyles extends Anc { + /** + * @SWG\Definition( + * definition="/composanttypefeaturestyles", + * allOf={ + * @SWG\Schema(ref="#/definitions/composanttypefeaturestyles") + * } + * ) + * * @SWG\Tag( + * name="ComposantTypeFeatureStyles", + * description="Operations about ComposantTypeFeatureStyles" + * ) + */ + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + */ + function __construct($aPath, $aValues, $properties) { + $this->aValues = $aValues; + $this->aPath = $aPath; + $this->aProperties = $properties; + $this->oConnection = new Connection($this->aValues, $this->aProperties); + } + + /** + * @SWG\Get(path="/composanttypefeaturestyles", + * tags={"ComposantTypeFeatureStyles"}, + * summary="Get ComposantTypeFeatureStyles", + * description="Request to get ComposantTypeFeatureStyles", + * 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", + * 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="ComposantTypeFeatureStyle Response", + * @SWG\Schema(ref="#/definitions/composanttypefeaturestyles") + * ) + * ) + */ + + /** + * get ComposantTypeFeatureStyles + * @return ComposantTypeFeatureStyles + */ + function GET() { + $aReturn = $this->genericGet($this->aProperties['schema_anc'], "v_composant_type_feature_style", "composant_type"); + $sMessage = $aReturn['sMessage']; + return $sMessage; + } + + /** + * @SWG\Post(path="/composanttypefeaturestyles", + * tags={"ComposantTypeFeatureStyles"}, + * summary="Add composant", + * description="Request to add ComposantTypeFeatureStyles", + * operationId="POST", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="composant Response", + * @SWG\Schema(ref="#/definitions/composanttypefeaturestyles") + * ) + * ) + */ + + /** + * insert ComposantTypeFeatureStyle + * @return id of the ComposantTypeFeatureStyle created + */ + function POST() { + $aReturn = $this->genericPost($this->aProperties['schema_anc'], 'v_composant_type_feature_style', null, 'composant_type'); + return $aReturn['sMessage']; + } + + /** + * @SWG\Put(path="/composanttypefeaturestyles/{composant_type}", + * tags={"ComposantTypeFeatureStyles"}, + * summary="update ComposantTypeFeatureStyles", + * description="Request to update ComposantTypeFeatureStyles", + * operationId="PUT", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="ComposantTypeFeatureStyle token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="composant_type", + * in="path", + * description="id of the ComposantTypeFeatureStyles", + * required=true, + * type="integer", + * format = "int32" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/composanttypefeaturestyles") + * ) + * ) + */ + + /** + * update composanttypefeaturestyles + * @return id of composanttypefeaturestyles updated or error object if a composanttypefeaturestyles is not updated + */ + function PUT() { + $aReturn = $this->genericPut($this->aProperties['schema_anc'], 'v_composant_type_feature_style', 'composant_type'); + return $aReturn['sMessage']; + } + + /** + * @SWG\Delete(path="/composanttypefeaturestyles", + * tags={"ComposantTypeFeatureStyles"}, + * summary="delete ComposantTypeFeatureStyles", + * description="Request to delete ComposantTypeFeatureStyles", + * operationId="DELETE", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="idList", + * in="query", + * description="id of the composant", + * required=true, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="composant Response", + * @SWG\Schema(ref="#/definitions/composanttypefeaturestyles") + * ) + * ) + */ + /** + * @SWG\Delete(path="/composanttypefeaturestyles/{composant_type}", + * tags={"ComposantTypeFeatureStyles"}, + * summary="delete ComposantTypeFeatureStyles", + * description="Request to delete ComposantTypeFeatureStyles", + * operationId="DELETE", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="ComposantTypeFeatureStyle token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="composant_type", + * in="path", + * description="id of the ComposantTypeFeatureStyles", + * required=true, + * type="integer", + * format = "int32" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/composanttypefeaturestyles") + * ) + * ) + */ + + /** + * delete composanttypefeaturestyles + * @return id of composanttypefeaturestyles deleted or error object if a composanttypefeaturestyles is not deleted + */ + function DELETE() { + $aReturn = $this->genericDelete($this->aProperties['schema_anc'], 'v_composant_type_feature_style', 'composant_type'); + return $aReturn['sMessage']; + } +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/anc/Composants.class.inc b/vmap/vas/rest/ws/anc/Composants.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..fbbfed9b125bc40decb3f3c998747f54721537ee --- /dev/null +++ b/vmap/vas/rest/ws/anc/Composants.class.inc @@ -0,0 +1,267 @@ +<?php + +/** + * \file Composants.class.inc + * \class Composants + * + * \author Armand Bahi <armand.bahi@veremes.com>. + * + * \brief This file contains the Composants php class + * + * This class defines Rest Api to Vitis Composants + * + */ +require_once __DIR__ . '/Anc.class.inc'; +require_once 'Composant.class.inc'; + + +class Composants extends Anc { + /** + * @SWG\Definition( + * definition="/composants", + * allOf={ + * @SWG\Schema(ref="#/definitions/composants") + * } + * ) + * * @SWG\Tag( + * name="Composants", + * description="Operations about Composants" + * ) + */ + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + */ + function __construct($aPath, $aValues, $properties) { + $this->aValues = $aValues; + $this->aPath = $aPath; + $this->aProperties = $properties; + $this->oConnection = new Connection($this->aValues, $this->aProperties); + $this->aSelectedFields = Array( "id_installation", "id_controle", "id_composant", "composant_type", "label", "observations", "size", "rotation", "feature_style_id", "draw_color", "draw_outline_color", "draw_size", "draw_dash", "draw_symbol", "draw_rotation", "image", "text_font", "text_color", "text_outline_color", "text_size", "text_outline_size", "text_offset_x", "text_offset_y", "text_rotation", "text_text", "ST_AsGeoJSON(ST_Transform(geom, 4326)) as geom"); + } + + /** + * @SWG\Get(path="/composants", + * tags={"Composants"}, + * summary="Get Composants", + * description="Request to get Composants", + * 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", + * 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="composant Response", + * @SWG\Schema(ref="#/definitions/composants") + * ) + * ) + */ + + /** + * get Composants + * @return Composants + */ + function GET() { + $aReturn = $this->genericGet($this->aProperties['schema_anc'], "v_composant", "id_composant"); + $sMessage = $aReturn['sMessage']; + return $sMessage; + } + + /** + * @SWG\Post(path="/composants", + * tags={"Composants"}, + * summary="Add composant", + * description="Request to add Composants", + * operationId="POST", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="composant Response", + * @SWG\Schema(ref="#/definitions/composants") + * ) + * ) + */ + + /** + * insert composant + * @return id of the composant created + */ + function POST() { + $aReturn = $this->genericPost($this->aProperties['schema_anc'], 'v_composant', null, 'id_composant'); + return $aReturn['sMessage']; + } + + /** + * @SWG\Put(path="/composants/{id_composant}", + * tags={"Composants"}, + * summary="update Composants", + * description="Request to update Composants", + * operationId="PUT", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="Composant token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="id_composant", + * in="path", + * description="id of the Composants", + * required=true, + * type="integer", + * format = "int32" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/composants") + * ) + * ) + */ + + /** + * update composants + * @return id of composants updated or error object if a composants is not updated + */ + function PUT() { + $aReturn = $this->genericPut($this->aProperties['schema_anc'], 'v_composant', 'id_composant'); + return $aReturn['sMessage']; + } + + /** + * @SWG\Delete(path="/composants", + * tags={"Composants"}, + * summary="delete Composants", + * description="Request to delete Composants", + * operationId="DELETE", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="idList", + * in="query", + * description="id of the composant", + * required=true, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="composant Response", + * @SWG\Schema(ref="#/definitions/composants") + * ) + * ) + */ + /** + * @SWG\Delete(path="/composants/{id_composant}", + * tags={"Composants"}, + * summary="delete Composants", + * description="Request to delete Composants", + * operationId="DELETE", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="Composant token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="id_composant", + * in="path", + * description="id of the Composants", + * required=true, + * type="integer", + * format = "int32" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/composants") + * ) + * ) + */ + + /** + * delete composants + * @return id of composants deleted or error object if a composants is not deleted + */ + function DELETE() { + $aReturn = $this->genericDelete($this->aProperties['schema_anc'], 'v_composant', 'id_composant'); + return $aReturn['sMessage']; + } +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/anc/Controle.class.inc b/vmap/vas/rest/ws/anc/Controle.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..c63fb9ce7b711c6719180dddb268d214135e0cba --- /dev/null +++ b/vmap/vas/rest/ws/anc/Controle.class.inc @@ -0,0 +1,263 @@ +<?php + +require_once __DIR__ . '/Anc.class.inc'; +require_once __DIR__ . '/Composants.class.inc'; +require_once __DIR__ . '/ComposantTypeFeatureStyles.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; + +/** + * \file Controle.class.inc + * \class Controle + * + * \author WAB <support.wab@veremes.com>. + * + * \brief This file contains the Controle php class + * + * This class defines operation for one Controle + * + */ +class Controle extends Anc { + + public $oError; + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties) { + $this->aValues = $aValues; + $this->aPath = $aPath; + $this->aProperties = $properties; + $this->oConnection = new Connection($this->aValues, $this->aProperties); + } + + /** + * @SWG\Get(path="/controles/{id_controle}", + * tags={"Controles"}, + * summary="Get Controle", + * description="Request to get Controle by id", + * operationId="GET", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="id_controle", + * in="path", + * description="id_controle", + * required=true, + * type="integer", + * format="int32" + * ), + * @SWG\Parameter( + * name="attributs", + * in="query", + * description="list of attributs", + * required=false, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="Controle Response", + * @SWG\Schema(ref="#/definitions/controles") + * ) + * ) + */ + + /** + * get informations about mode + */ + function GET() { + $this->aFields = $this->getFields($this->aProperties['schema_anc'], "v_controle", "id_controle"); + // Url des fichiers. + $sWsDataUrl = $this->aProperties['web_server_name'] . '/' . $this->aProperties['ws_data_alias'] . '/anc/anc_saisie_anc_controle/documents/' . $this->aValues["my_vitis_id"]; + if (!empty($this->aFields['photos_f'])) + $this->aFields['photos_f'] = $sWsDataUrl . '/photos_f/' . $this->aFields['photos_f']; + if (!empty($this->aFields['fiche_f'])) + $this->aFields['fiche_f'] = $sWsDataUrl . '/fiche_f/' . $this->aFields['fiche_f']; + if (!empty($this->aFields['rapport_f'])) + $this->aFields['rapport_f'] = $sWsDataUrl . '/rapport_f/' . $this->aFields['rapport_f']; + if (!empty($this->aFields['schema_f'])) + $this->aFields['schema_f'] = $sWsDataUrl . '/schema_f/' . $this->aFields['schema_f']; + if (!empty($this->aFields['documents_f'])) + $this->aFields['documents_f'] = $sWsDataUrl . '/documents_f/' . $this->aFields['documents_f']; + if (!empty($this->aFields['plan_f'])) + $this->aFields['plan_f'] = $sWsDataUrl . '/plan_f/' . $this->aFields['plan_f']; + + // Champ sur lequel sera fait le typage pour changer les styles etc.. + $this->sTyleField = 'composant_type'; + // custom_form du controle pour map_workbench + $this->getCustomFormInfos(); + // Composants du controle + $this->getComposants(); + } + + /** + * Récupère au format GeoJSON les composants à afficher + */ + function getComposants() { + $aPath = array('anc', 'composants'); + $aValues = $this->aValues; + unset($aValues['my_vitis_id']); + unset($aValues['attributs']); + //$aValues['attributs'] = 'composant_type|label|observations||geom'; + $aValues['filter'] = '{"column":"id_controle","compare_operator":"=","value":"' . $this->aFields['id_controle'] . '"}'; + $oComposants = new Composants($aPath, $aValues, $this->aProperties, $this->oConnection); + $oComposants->GET(); + $aComposants = array(); + if (!empty($oComposants->aObjects)) { + for ($i = 0; $i < count($oComposants->aObjects); $i++) { + if (!empty($oComposants->aObjects[$i]->aFields)) { + array_push($aComposants, $oComposants->aObjects[$i]->aFields); + } + } + } + $aFeatures = array(); + for ($i = 0; $i < count($aComposants); $i++) { + if (!empty($aComposants[$i]['geom'])) { + $aGeom = json_decode($aComposants[$i]['geom'], true); + $aAttributes = $aComposants[$i]; + unset($aAttributes['geom']); + $aTmpFeature = array( + 'type' => 'Feature', + 'geometry' => $aGeom, + 'properties' => array( + 'style' => $this->getGeoJSONStyle($aAttributes), + 'attributes' => $aAttributes + ) + ); + array_push($aFeatures, $aTmpFeature); + } + } + if (!empty($aFeatures)) { + $this->aFields['composants'] = json_encode(array( + 'type' => 'FeatureCollection', + 'features' => $aFeatures + )); + } + } + + /** + * Récupère les informations à merger dans le custom_form + */ + function getCustomFormInfos() { + $aPath = array('anc', 'composanttypefeaturestyles'); + $aValues = $this->aValues; + unset($aValues['my_vitis_id']); + unset($aValues['filter']); + unset($aValues['attributs']); + $oComposantTypeFeatureStyles = new ComposantTypeFeatureStyles($aPath, $aValues, $this->aProperties, $this->oConnection); + $oComposantTypeFeatureStyles->GET(); + if (!empty($oComposantTypeFeatureStyles->aObjects)) { + $this->aFields['custom_form'] = array( + 'featureStructure' => array( + 'field' => $this->sTyleField, + 'types' => array() + ) + ); + for ($i = 0; $i < count($oComposantTypeFeatureStyles->aObjects); $i++) { + if (!empty($oComposantTypeFeatureStyles->aObjects[$i]->aFields)) { + $aStyle = $oComposantTypeFeatureStyles->aObjects[$i]->aFields; + if (!empty($aStyle[$this->sTyleField])) { + $this->aFields['custom_form']['featureStructure']['types'][$aStyle[$this->sTyleField]] = array( + 'style' => $this->getGeoJSONStyle($aStyle), + 'geometryType' => $aStyle['feature_type'] + ); + } + } + } + } + } + + /** + * Returns a GeoJSON format style from an array format style + * @param array $aStyle + * @return array + */ + function getGeoJSONStyle($aStyle) { + $aGeoJSONStyle = array( + 'draw' => array(), + 'text' => array() + ); + // Draw + if (!empty($aStyle['draw_color'])) { + $aGeoJSONStyle['draw']['color'] = $aStyle['draw_color']; + } + if (!empty($aStyle['draw_outline_color'])) { + $aGeoJSONStyle['draw']['outline_color'] = $aStyle['draw_outline_color']; + } + if (!empty($aStyle['draw_size'])) { + $aGeoJSONStyle['draw']['size'] = $aStyle['draw_size']; + } + if (!empty($aStyle['draw_dash'])) { + $aGeoJSONStyle['draw']['dash'] = $aStyle['draw_dash']; + } + if (!empty($aStyle['draw_symbol'])) { + $aGeoJSONStyle['draw']['symbol'] = $aStyle['draw_symbol']; + } + if (!empty($aStyle['draw_rotation'])) { + $aGeoJSONStyle['draw']['rotation'] = $aStyle['draw_rotation']; + } + if (!empty($aStyle['image'])) { + $aGeoJSONStyle['draw']['image'] = $aStyle['image']; + } + // Text + if (!empty($aStyle['text_font'])) { + $aGeoJSONStyle['text']['font'] = $aStyle['text_font']; + } + if (!empty($aStyle['text_color'])) { + $aGeoJSONStyle['text']['color'] = $aStyle['text_color']; + } + if (!empty($aStyle['text_outline_color'])) { + $aGeoJSONStyle['text']['outline_color'] = $aStyle['text_outline_color']; + } + if (!empty($aStyle['text_size'])) { + $aGeoJSONStyle['text']['size'] = $aStyle['text_size']; + } + if (!empty($aStyle['text_outline_size'])) { + $aGeoJSONStyle['text']['outline_size'] = $aStyle['text_outline_size']; + } + if (!empty($aStyle['text_offset_x'])) { + $aGeoJSONStyle['text']['offsetX'] = $aStyle['text_offset_x']; + } + if (!empty($aStyle['text_offset_y'])) { + $aGeoJSONStyle['text']['offsetY'] = $aStyle['text_offset_y']; + } + if (!empty($aStyle['text_rotation'])) { + $aGeoJSONStyle['text']['rotation'] = $aStyle['text_rotation']; + } + if (!empty($aStyle['text_text'])) { + $aGeoJSONStyle['text']['text'] = $aStyle['text_text']; + } + // Vide draw ou text si ils sont vides + if (empty($aGeoJSONStyle['draw'])) { + unset($aGeoJSONStyle['draw']); + } + if (empty($aGeoJSONStyle['text'])) { + unset($aGeoJSONStyle['text']); + } + return $aGeoJSONStyle; + } + + /** + * delete a Point_situation + */ + function DELETE() { + $this->oConnection->oBd->delete($this->aProperties['schema_anc'], 'v_controle', 'id_controle', $this->aValues["my_vitis_id"], 'integer'); + if ($this->oConnection->oBd->enErreur()) { + $this->oError = new VitisError(1, $this->oConnection->oBd->getBDMessage()); + } else { + $this->aFields["id_controle"] = $this->aValues["my_vitis_id"]; + } + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/anc/Controles.class.inc b/vmap/vas/rest/ws/anc/Controles.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..51f0e88c7d2abcd385131fe9cdd8219279b9d7b8 --- /dev/null +++ b/vmap/vas/rest/ws/anc/Controles.class.inc @@ -0,0 +1,719 @@ +<?php + +/** + * \file Controles.class.inc + * \class Controles + * + * \author WAB <support.wab@veremes.com>. + * + * \brief This file contains the Controles php class + * + * This class defines Rest Api to Vitis Controles + * + */ +require_once __DIR__ . '/Anc.class.inc'; +require_once 'Controle.class.inc'; +require_once 'Evacuation_eauxs.class.inc'; +require_once 'Filieres_agrees.class.inc'; +require_once 'Pretraitements.class.inc'; +require_once 'Traitements.class.inc'; +require_once 'Composants.class.inc'; + +class Controles extends Anc { + /** + * @SWG\Definition( + * definition="/controles", + * allOf={ + * @SWG\Schema(ref="#/definitions/controles") + * } + * ) + * * @SWG\Tag( + * name="Controles", + * description="Operations about Controles" + * ) + */ + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + */ + function __construct($aPath, $aValues, $properties) { + $this->aValues = $aValues; + $this->aPath = $aPath; + $this->aProperties = $properties; + $this->oConnection = new Connection($this->aValues, $this->aProperties); + } + + /** + * @SWG\Get(path="/controles", + * tags={"Controles"}, + * summary="Get Controles", + * description="Request to get Controles", + * 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", + * 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="controle Response", + * @SWG\Schema(ref="#/definitions/controles") + * ) + * ) + */ + + /** + * get Controles + * @return Controles + */ + function GET() { + $aReturn = $this->genericGet($this->aProperties['schema_anc'], "v_controle", "id_controle"); + $sMessage = $aReturn['sMessage']; + return $sMessage; + } + + /** + * @SWG\Post(path="/controles", + * tags={"Controles"}, + * summary="Add controle", + * description="Request to add Controles", + * operationId="POST", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="controle Response", + * @SWG\Schema(ref="#/definitions/controles") + * ) + * ) + */ + + /** + * insert controle + * @return id of the controle created + */ + function POST() { + $this->aValues['create'] = $_SESSION["ses_Login"]; + $this->aValues['create_date'] = date('Y-m-d'); + //if (empty($this->aValues['des_date_control'])) + //$this->aValues['des_date_control'] = date('Y-m-d'); + if (empty($this->aValues['des_interval_control'])) + $this->aValues['des_interval_control'] = 0; + // Sauve le nom des fichiers. + if (!empty($_FILES['photos_f'])) + $this->aValues['photos_f'] = $_FILES['photos_f']["name"]; + if (!empty($_FILES['fiche_f'])) + $this->aValues['fiche_f'] = $_FILES['fiche_f']["name"]; + if (!empty($_FILES['rapport_f'])) + $this->aValues['rapport_f'] = $_FILES['rapport_f']["name"]; + if (!empty($_FILES['schema_f'])) + $this->aValues['schema_f'] = $_FILES['schema_f']["name"]; + if (!empty($_FILES['documents_f'])) + $this->aValues['documents_f'] = $_FILES['documents_f']["name"]; + if (!empty($_FILES['plan_f'])) + $this->aValues['plan_f'] = $_FILES['plan_f']["name"]; + // Conversion des dates + $aDates = array('cl_date_avis', 'cl_facture_le', 'des_date_installation', 'des_date_recommande', 'dep_date_depot', 'dep_date_envoi_incomplet', 'des_date_control'); + foreach ($aDates as $sDate) { + if (isset($this->aValues[$sDate])) { + if ($this->aValues[$sDate] == '') + unset($this->aValues[$sDate]); + else + $this->aValues[$sDate] = date_format(date_create_from_format('d/m/Y', $this->aValues[$sDate]), 'Y-m-d'); + } + } + // + $aReturn = $this->genericPost($this->aProperties['schema_anc'], 'v_controle', $this->aProperties['schema_anc'] . '.controle_id_controle_seq', 'id_controle'); + // Upload les fichiers. + $this->uploadDocument('photos_f', 'anc_saisie_anc_controle'); + $this->uploadDocument('fiche_f', 'anc_saisie_anc_controle'); + $this->uploadDocument('rapport_f', 'anc_saisie_anc_controle'); + $this->uploadDocument('schema_f', 'anc_saisie_anc_controle'); + $this->uploadDocument('documents_f', 'anc_saisie_anc_controle'); + $this->uploadDocument('plan_f', 'anc_saisie_anc_controle'); + // + return $aReturn['sMessage']; + } + + /** + * @SWG\Put(path="/controles/{id_controle}", + * tags={"Controles"}, + * summary="update Controles", + * description="Request to update Controles", + * operationId="PUT", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="Controle token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="id_controle", + * in="path", + * description="id of the Controles", + * required=true, + * type="integer", + * format = "int32" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/controles") + * ) + * ) + */ + + /** + * update controles + * @return id of controles updated or error object if a controles is not updated + */ + function PUT() { + if (empty($this->aValues['maj'])) + $this->aValues['maj'] = $_SESSION["ses_Login"]; + if (empty($this->aValues['maj_date'])) + $this->aValues['maj_date'] = date('Y-m-d'); + // Upload les fichiers. + $this->uploadDocument('photos_f', 'anc_saisie_anc_controle'); + $this->uploadDocument('fiche_f', 'anc_saisie_anc_controle'); + $this->uploadDocument('rapport_f', 'anc_saisie_anc_controle'); + $this->uploadDocument('schema_f', 'anc_saisie_anc_controle'); + $this->uploadDocument('documents_f', 'anc_saisie_anc_controle'); + $this->uploadDocument('plan_f', 'anc_saisie_anc_controle'); + + // Si il y a des composants à ajouter/supprimer/mettre à jour + if (!empty($this->aValues['composants'])) { + + // Supprime les composants liés au controle + $this->deleteControleComposants($this->aPath[2]); + + // Récupère les composants au bon format + $aComposants = $this->getTableFormedComposants(json_decode($this->aValues['composants'], true)); + + // Inserre les composants + $this->createComposants($aComposants); + } + // Conversion des dates + $aDates = array('cl_date_avis', 'cl_facture_le', 'des_date_control', 'des_date_installation', 'des_date_recommande', 'dep_date_depot', 'dep_date_envoi_incomplet'); + foreach ($aDates as $sDate) { + if (isset($this->aValues[$sDate])) { + if ($this->aValues[$sDate] == '') + unset($this->aValues[$sDate]); + else + $this->aValues[$sDate] = date_format(date_create_from_format('d/m/Y', $this->aValues[$sDate]), 'Y-m-d'); + } + } + // + $aReturn = $this->genericPut($this->aProperties['schema_anc'], 'v_controle', 'id_controle'); + return $aReturn['sMessage']; + } + + /** + * Get the composant on table format + * @param array $aGeoJSONComposants + * @return array + */ + function getTableFormedComposants($aGeoJSONComposants) { + $aComposants = array(); + + for ($i = 0; $i < count($aGeoJSONComposants['features']); $i++) { + + $aTmpComposant = array(); + + // Récupère la géométrie en EWKT + if (!empty($aGeoJSONComposants['features'][$i]['geometry'])) { + $sSql = 'SELECT ST_AsEWKT(ST_SetSRID(ST_GeomFromGeoJSON([geom]), 4326)) as ewktgeom'; + $aSQLParams = array('geom' => array('value' => json_encode($aGeoJSONComposants['features'][$i]['geometry']), 'type' => 'geometry')); + $oPDOresult = $this->oConnection->oBd->executeWithParams($sSql, $aSQLParams); + if (!$this->oConnection->oBd->enErreur()) { + while ($aLine = $this->oConnection->oBd->ligneSuivante($oPDOresult)) { + $aTmpComposant['geom'] = $aLine['ewktgeom']; + } + } + } + + if (!empty($aGeoJSONComposants['features'][$i]['properties'])) { + if (!empty($aGeoJSONComposants['features'][$i]['properties']['attributes'])) { + foreach ($aGeoJSONComposants['features'][$i]['properties']['attributes'] as $key => $value) { + $aTmpComposant[$key] = $value; + } + } + if (!empty($aGeoJSONComposants['features'][$i]['properties']['style'])) { + if (!empty($aGeoJSONComposants['features'][$i]['properties']['style']['draw'])) { + foreach ($aGeoJSONComposants['features'][$i]['properties']['style']['draw'] as $key => $value) { + $aTmpComposant['draw_' . $key] = $value; + } + } + if (!empty($aGeoJSONComposants['features'][$i]['properties']['style']['text'])) { + foreach ($aGeoJSONComposants['features'][$i]['properties']['style']['text'] as $key => $value) { + $aTmpComposant['text_' . $key] = $value; + } + } + } + } + array_push($aComposants, $aTmpComposant); + } + + + return $aComposants; + } + + /** + * Insert the composants defined in $aComposants + * @param array $aComposants + */ + function createComposants($aComposants) { + for ($i = 0; $i < count($aComposants); $i++) { + $aPath = array('anc', 'composants'); + $aValues = array( + 'token' => $this->aValues['token'], + 'output' => $this->aValues['output'], + 'sEncoding' => $this->aValues['sEncoding'], + 'sSourceEncoding' => $this->aValues['sSourceEncoding'], + 'xslstylesheet' => $this->aValues['xslstylesheet'], + 'module' => $this->aValues['module'], + 'id_controle' => $this->aPath[2] + ); + $aValues = array_merge($aValues, $aComposants[$i]); + $oComposants = new Composants($aPath, $aValues, $this->aProperties, $this->oConnection); + $oComposants->POST(); + } + } + + /** + * @SWG\Delete(path="/controles", + * tags={"Controles"}, + * summary="delete Controles", + * description="Request to delete Controles", + * operationId="DELETE", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="idList", + * in="query", + * description="id of the controle", + * required=true, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="controle Response", + * @SWG\Schema(ref="#/definitions/controles") + * ) + * ) + */ + /** + * @SWG\Delete(path="/controles/{id_controle}", + * tags={"Controles"}, + * summary="delete Controles", + * description="Request to delete Controles", + * operationId="DELETE", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="Controle token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="id_controle", + * in="path", + * description="id of the Controles", + * required=true, + * type="integer", + * format = "int32" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/controles") + * ) + * ) + */ + + /** + * delete controles + * @return id of controles deleted or error object if a controles is not deleted + */ + function DELETE() { + require $this->sRessourcesFile; + + // Supprime les objets dépendants + $this->deleteControleDependencies($this->aValues['idList']); + +// $aParams['idControle'] = array('value' => $this->aValues['id_controle'], 'type' => 'integer'); +// $oPDOresult = $this->oConnection->oBd->executeWithParams($aSql['getInstallationControls'], $aParams); +// if ($this->oConnection->oBd->enErreur()) { +// $aReturn = array('status' => 0, 'message' => $this->oConnection->oBd->getBDMessage(), 'error_code' => 1); +// return json_encode($aReturn); +// } + + $aReturn = $this->genericDelete($this->aProperties['schema_anc'], 'v_controle', 'id_controle'); + return $aReturn['sMessage']; + } + + /** + * Delete the controle dependencies + * @param string $sIdControles + */ + function deleteControleDependencies($sIdControles) { + + // Suppression dpépendance s_anc.evacuation_eaux + $this->deleteControleEvacuationEaux($sIdControles); + + // Suppression dpépendance s_anc.filieres_agrees + $this->deleteControleFilieresAgrees($sIdControles); + + // Suppression dpépendance s_anc.pretraitement + $this->deleteControlePretraitements($sIdControles); + + // Suppression dpépendance s_anc.traitement + $this->deleteControleTraitements($sIdControles); + + // Suppression dpépendance s_anc.composant + $this->deleteControleComposants($sIdControles); + } + + /** + * Get the composant's evacuationEaux + * @param string $sIdControles + * @return array|null + */ + function getControleEvacuationEaux($sIdControles) { + require $this->sRessourcesFile; + + $aParams = array(); + $aParams['sSchemaAnc'] = array('value' => $this->aProperties['schema_anc'], 'type' => 'schema_name'); + $aParams['idList'] = array('value' => $sIdControles, 'type' => 'group'); + $oPDOresult = $this->oConnection->oBd->executeWithParams($aSql['getControleEvacuationEaux'], $aParams); + if ($this->oConnection->oBd->enErreur()) { + return null; + } else { + $aEvacuationEaux = $this->oConnection->oBd->getResultTableAssoc($oPDOresult); + return $aEvacuationEaux; + } + } + + /** + * Get the composant's FilieresAgrees + * @param string $sIdControles + * @return array|null + */ + function getControleFilieresAgrees($sIdControles) { + require $this->sRessourcesFile; + + $aParams = array(); + $aParams['sSchemaAnc'] = array('value' => $this->aProperties['schema_anc'], 'type' => 'schema_name'); + $aParams['idList'] = array('value' => $sIdControles, 'type' => 'group'); + $oPDOresult = $this->oConnection->oBd->executeWithParams($aSql['getControleFilieresAgrees'], $aParams); + if ($this->oConnection->oBd->enErreur()) { + return null; + } else { + $aFilieresAgrees = $this->oConnection->oBd->getResultTableAssoc($oPDOresult); + return $aFilieresAgrees; + } + } + + /** + * Get the composant's Pretraitement + * @param string $sIdControles + * @return array|null + */ + function getControlePretraitements($sIdControles) { + require $this->sRessourcesFile; + + $aParams = array(); + $aParams['sSchemaAnc'] = array('value' => $this->aProperties['schema_anc'], 'type' => 'schema_name'); + $aParams['idList'] = array('value' => $sIdControles, 'type' => 'group'); + $oPDOresult = $this->oConnection->oBd->executeWithParams($aSql['getControlePretraitements'], $aParams); + if ($this->oConnection->oBd->enErreur()) { + return null; + } else { + $aPretraitement = $this->oConnection->oBd->getResultTableAssoc($oPDOresult); + return $aPretraitement; + } + } + + /** + * Get the composant's Traitement + * @param string $sIdControles + * @return array|null + */ + function getControleTraitements($sIdControles) { + require $this->sRessourcesFile; + + $aParams = array(); + $aParams['sSchemaAnc'] = array('value' => $this->aProperties['schema_anc'], 'type' => 'schema_name'); + $aParams['idList'] = array('value' => $sIdControles, 'type' => 'group'); + $oPDOresult = $this->oConnection->oBd->executeWithParams($aSql['getControleTraitements'], $aParams); + if ($this->oConnection->oBd->enErreur()) { + return null; + } else { + $aTraitement = $this->oConnection->oBd->getResultTableAssoc($oPDOresult); + return $aTraitement; + } + } + + /** + * Get the composant's Composant + * @param string $sIdControles + * @return array|null + */ + function getControleComposants($sIdControles) { + require $this->sRessourcesFile; + + $aParams = array(); + $aParams['sSchemaAnc'] = array('value' => $this->aProperties['schema_anc'], 'type' => 'schema_name'); + $aParams['idList'] = array('value' => $sIdControles, 'type' => 'group'); + $oPDOresult = $this->oConnection->oBd->executeWithParams($aSql['getControleComposants'], $aParams); + if ($this->oConnection->oBd->enErreur()) { + return null; + } else { + $aComposant = $this->oConnection->oBd->getResultTableAssoc($oPDOresult); + return $aComposant; + } + } + + /** + * Delete the composant's EvacuationEaux + * @param string $sIdControles + */ + function deleteControleEvacuationEaux($sIdControles) { + + $aEvacuationEaux = $this->getControleEvacuationEaux($sIdControles); + if (!empty($aEvacuationEaux)) { + if (count($aEvacuationEaux) > 0) { + $sIdList = ''; + $aIdList = array(); + for ($i = 0; $i < count($aEvacuationEaux); $i++) { + if (!empty($aEvacuationEaux[$i]['id_eva'])) { + array_push($aIdList, $aEvacuationEaux[$i]['id_eva']); + } + } + $sIdList = join('|', $aIdList); + $aPath = array('anc', 'evacuation_eauxs'); + $aValues = array( + 'token' => $this->aValues['token'], + 'output' => $this->aValues['output'], + 'sEncoding' => $this->aValues['sEncoding'], + 'sSourceEncoding' => $this->aValues['sSourceEncoding'], + 'xslstylesheet' => $this->aValues['xslstylesheet'], + 'module' => $this->aValues['module'], + 'idList' => $sIdList, + ); + $oComposants = new Evacuation_eauxs($aPath, $aValues, $this->aProperties, $this->oConnection); + $oComposants->DELETE(); + } + } + } + + /** + * Delete the composant's FilieresAgrees + * @param string $sIdControles + */ + function deleteControleFilieresAgrees($sIdControles) { + + $aFilieresAgrees = $this->getControleFilieresAgrees($sIdControles); + + if (!empty($aFilieresAgrees)) { + if (count($aFilieresAgrees) > 0) { + $sIdList = ''; + $aIdList = array(); + for ($i = 0; $i < count($aFilieresAgrees); $i++) { + if (!empty($aFilieresAgrees[$i]['id_fag'])) { + array_push($aIdList, $aFilieresAgrees[$i]['id_fag']); + } + } + $sIdList = join('|', $aIdList); + $aPath = array('anc', 'evacuation_eauxs'); + $aValues = array( + 'token' => $this->aValues['token'], + 'output' => $this->aValues['output'], + 'sEncoding' => $this->aValues['sEncoding'], + 'sSourceEncoding' => $this->aValues['sSourceEncoding'], + 'xslstylesheet' => $this->aValues['xslstylesheet'], + 'module' => $this->aValues['module'], + 'idList' => $sIdList, + ); + $oComposants = new Filieres_agrees($aPath, $aValues, $this->aProperties, $this->oConnection); + $oComposants->DELETE(); + } + } + } + + /** + * Delete the composant's Pretraitement + * @param string $sIdControles + */ + function deleteControlePretraitements($sIdControles) { + + $aPretraitement = $this->getControlePretraitements($sIdControles); + + if (!empty($aPretraitement)) { + if (count($aPretraitement) > 0) { + $sIdList = ''; + $aIdList = array(); + for ($i = 0; $i < count($aPretraitement); $i++) { + if (!empty($aPretraitement[$i]['id_pretraitement'])) { + array_push($aIdList, $aPretraitement[$i]['id_pretraitement']); + } + } + $sIdList = join('|', $aIdList); + $aPath = array('anc', 'evacuation_eauxs'); + $aValues = array( + 'token' => $this->aValues['token'], + 'output' => $this->aValues['output'], + 'sEncoding' => $this->aValues['sEncoding'], + 'sSourceEncoding' => $this->aValues['sSourceEncoding'], + 'xslstylesheet' => $this->aValues['xslstylesheet'], + 'module' => $this->aValues['module'], + 'idList' => $sIdList, + ); + $oComposants = new Pretraitements($aPath, $aValues, $this->aProperties, $this->oConnection); + $oComposants->DELETE(); + } + } + } + + /** + * Delete the composant's Traitement + * @param string $sIdControles + */ + function deleteControleTraitements($sIdControles) { + + $aTraitement = $this->getControleTraitements($sIdControles); + + if (!empty($aTraitement)) { + if (count($aTraitement) > 0) { + $sIdList = ''; + $aIdList = array(); + for ($i = 0; $i < count($aTraitement); $i++) { + if (!empty($aTraitement[$i]['id_traitement'])) { + array_push($aIdList, $aTraitement[$i]['id_traitement']); + } + } + $sIdList = join('|', $aIdList); + $aPath = array('anc', 'evacuation_eauxs'); + $aValues = array( + 'token' => $this->aValues['token'], + 'output' => $this->aValues['output'], + 'sEncoding' => $this->aValues['sEncoding'], + 'sSourceEncoding' => $this->aValues['sSourceEncoding'], + 'xslstylesheet' => $this->aValues['xslstylesheet'], + 'module' => $this->aValues['module'], + 'idList' => $sIdList, + ); + $oComposants = new Traitements($aPath, $aValues, $this->aProperties, $this->oConnection); + $oComposants->DELETE(); + } + } + } + + /** + * Delete the composant's Composant + * @param string $sIdControles + */ + function deleteControleComposants($sIdControles) { + + $aComposant = $this->getControleComposants($sIdControles); + + if (!empty($aComposant)) { + if (count($aComposant) > 0) { + $sIdList = ''; + $aIdList = array(); + for ($i = 0; $i < count($aComposant); $i++) { + if (!empty($aComposant[$i]['id_composant'])) { + array_push($aIdList, $aComposant[$i]['id_composant']); + } + } + $sIdList = join('|', $aIdList); + $aPath = array('anc', 'evacuation_eauxs'); + $aValues = array( + 'token' => $this->aValues['token'], + 'output' => $this->aValues['output'], + 'sEncoding' => $this->aValues['sEncoding'], + 'sSourceEncoding' => $this->aValues['sSourceEncoding'], + 'xslstylesheet' => $this->aValues['xslstylesheet'], + 'module' => $this->aValues['module'], + 'idList' => $sIdList, + ); + $oComposants = new Composants($aPath, $aValues, $this->aProperties, $this->oConnection); + $oComposants->DELETE(); + } + } + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/anc/Entreprise.class.inc b/vmap/vas/rest/ws/anc/Entreprise.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..bfbf59eb4be8e50d6cf678b55f6ab20df4b2505a --- /dev/null +++ b/vmap/vas/rest/ws/anc/Entreprise.class.inc @@ -0,0 +1,94 @@ +<?php + +require_once __DIR__ . '/Anc.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; + +/** + * \file Entreprise.class.inc + * \class Entreprise + * + * \author WAB <support.wab@veremes.com>. + * + * \brief This file contains the Entreprise php class + * + * This class defines operation for one Entreprise + * + */ +class Entreprise extends Anc { + + public $oError; + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties) { + $this->aValues = $aValues; + $this->aPath = $aPath; + $this->aProperties = $properties; + $this->oConnection = new Connection($this->aValues, $this->aProperties); + $this->aSelectedFields = Array("id_parametre_entreprises", "id_com", "siret", "raison_sociale", "nom_entreprise", "nom_contact", "telephone_fixe", "telephone_mobile", "web", "mail", "code_postal", "voie", "bureau_etude", "concepteur", "constructeur", "installateur", "vidangeur", "en_activite", "observations", "creat", "creat_date", "maj", "maj_date", "geom"); + } + + /** + * @SWG\Get(path="/entreprises/{id_entreprise}", + * tags={"Entreprises"}, + * summary="Get Entreprise", + * description="Request to get Entreprise by id", + * operationId="GET", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="id_entreprise", + * in="path", + * description="id_entreprise", + * required=true, + * type="integer", + * format="int32" + * ), + * @SWG\Parameter( + * name="attributs", + * in="query", + * description="list of attributs", + * required=false, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="Entreprise Response", + * @SWG\Schema(ref="#/definitions/entreprises") + * ) + * ) + */ + + /** + * get informations about mode + */ + function GET() { + $this->aFields = $this->getFields($this->aProperties['schema_anc'], "param_entreprise", "id_parametre_entreprises"); + } + + /** + * delete a Point_situation + */ + function DELETE() { + $this->oConnection->oBd->delete($this->aProperties['schema_anc'], 'param_entreprise', 'id_parametre_entreprises', $this->aValues["my_vitis_id"], 'integer'); + if ($this->oConnection->oBd->enErreur()) { + $this->oError = new VitisError(1, $this->oConnection->oBd->getBDMessage()); + } else { + $this->aFields["id_parametre_entreprises"] = $this->aValues["my_vitis_id"]; + } + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/anc/Entreprises.class.inc b/vmap/vas/rest/ws/anc/Entreprises.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..625e00892081a0f50eb0fc4dbdfbf8f3b7b15e8e --- /dev/null +++ b/vmap/vas/rest/ws/anc/Entreprises.class.inc @@ -0,0 +1,272 @@ +<?php + +/** + * \file Entreprises.class.inc + * \class Entreprises + * + * \author WAB <support.wab@veremes.com>. + * + * \brief This file contains the Entreprises php class + * + * This class defines Rest Api to Vitis Entreprises + * + */ +require_once __DIR__ . '/Anc.class.inc'; +require_once 'Entreprise.class.inc'; + + +class Entreprises extends Anc { + /** + * @SWG\Definition( + * definition="/entreprises", + * allOf={ + * @SWG\Schema(ref="#/definitions/entreprises") + * } + * ) + * * @SWG\Tag( + * name="Entreprises", + * description="Operations about Entreprises" + * ) + */ + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + */ + function __construct($aPath, $aValues, $properties) { + $this->aValues = $aValues; + $this->aPath = $aPath; + $this->aProperties = $properties; + $this->oConnection = new Connection($this->aValues, $this->aProperties); + $this->aSelectedFields = Array("id_parametre_entreprises", "id_com", "siret", "raison_sociale", "nom_entreprise", "nom_contact", "telephone_fixe", "telephone_mobile", "web", "mail", "code_postal", "voie", "bureau_etude", "concepteur", "constructeur", "installateur", "vidangeur", "en_activite", "observations", "creat", "creat_date", "maj", "maj_date", "geom"); + } + + /** + * @SWG\Get(path="/entreprises", + * tags={"Entreprises"}, + * summary="Get Entreprises", + * description="Request to get Entreprises", + * 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", + * 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="entreprise Response", + * @SWG\Schema(ref="#/definitions/entreprises") + * ) + * ) + */ + + /** + * get Entreprises + * @return Entreprises + */ + function GET() { + $aReturn = $this->genericGet($this->aProperties['schema_anc'], "param_entreprise", "id_parametre_entreprises"); + $sMessage = $aReturn['sMessage']; + return $sMessage; + } + + /** + * @SWG\Post(path="/entreprises", + * tags={"Entreprises"}, + * summary="Add entreprise", + * description="Request to add Entreprises", + * operationId="POST", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="entreprise Response", + * @SWG\Schema(ref="#/definitions/entreprises") + * ) + * ) + */ + + /** + * insert entreprise + * @return id of the entreprise created + */ + function POST() { + $this->aValues['creat'] = $_SESSION["ses_Login"]; + $this->aValues['creat_date'] = date('Y-m-d'); + $aReturn = $this->genericPost($this->aProperties['schema_anc'], 'param_entreprise', $this->aProperties['schema_anc'].'.param_entreprise_id_parametre_entreprises_seq', 'id_parametre_entreprises'); + return $aReturn['sMessage']; + } + + /** + * @SWG\Put(path="/entreprises/{id_entreprise}", + * tags={"Entreprises"}, + * summary="update Entreprises", + * description="Request to update Entreprises", + * operationId="PUT", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="Entreprise token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="id_entreprise", + * in="path", + * description="id of the Entreprises", + * required=true, + * type="integer", + * format = "int32" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/entreprises") + * ) + * ) + */ + + /** + * update entreprises + * @return id of entreprises updated or error object if a entreprises is not updated + */ + function PUT() { + if (empty($this->aValues['maj'])) + $this->aValues['maj'] = $_SESSION["ses_Login"]; + if (empty($this->aValues['maj_date'])) + $this->aValues['maj_date'] = date('Y-m-d'); + $aReturn = $this->genericPut($this->aProperties['schema_anc'], 'param_entreprise', 'id_parametre_entreprises'); + return $aReturn['sMessage']; + } + + /** + * @SWG\Delete(path="/entreprises", + * tags={"Entreprises"}, + * summary="delete Entreprises", + * description="Request to delete Entreprises", + * operationId="DELETE", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="idList", + * in="query", + * description="id of the entreprise", + * required=true, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="entreprise Response", + * @SWG\Schema(ref="#/definitions/entreprises") + * ) + * ) + */ + /** + * @SWG\Delete(path="/entreprises/{id_entreprise}", + * tags={"Entreprises"}, + * summary="delete Entreprises", + * description="Request to delete Entreprises", + * operationId="DELETE", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="Entreprise token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="id_entreprise", + * in="path", + * description="id of the Entreprises", + * required=true, + * type="integer", + * format = "int32" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/entreprises") + * ) + * ) + */ + + /** + * delete entreprises + * @return id of entreprises deleted or error object if a entreprises is not deleted + */ + function DELETE() { + $aReturn = $this->genericDelete($this->aProperties['schema_anc'], 'param_entreprise', 'id_parametre_entreprises'); + return $aReturn['sMessage']; + } +} +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/anc/Evacuation_eaux.class.inc b/vmap/vas/rest/ws/anc/Evacuation_eaux.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..4b9d3b8dc57716f0b2704498b3cadee8ccf103a6 --- /dev/null +++ b/vmap/vas/rest/ws/anc/Evacuation_eaux.class.inc @@ -0,0 +1,105 @@ +<?php + +require_once __DIR__ . '/Anc.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; + +/** + * \file Evacuation_eaux.class.inc + * \class Evacuation_eaux + * + * \author WAB <support.wab@veremes.com>. + * + * \brief This file contains the Evacuation_eaux php class + * + * This class defines operation for one Evacuation_eaux + * + */ +class Evacuation_eaux extends Anc { + + public $oError; + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties) { + $this->aValues = $aValues; + $this->aPath = $aPath; + $this->aProperties = $properties; + $this->oConnection = new Connection($this->aValues, $this->aProperties); + } + + /** + * @SWG\Get(path="/evacuation_eauxs/{id_evacuation_eaux}", + * tags={"Evacuation_eauxs"}, + * summary="Get Evacuation_eaux", + * description="Request to get Evacuation_eaux by id", + * operationId="GET", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="id_evacuation_eaux", + * in="path", + * description="id_evacuation_eaux", + * required=true, + * type="integer", + * format="int32" + * ), + * @SWG\Parameter( + * name="attributs", + * in="query", + * description="list of attributs", + * required=false, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="Evacuation_eaux Response", + * @SWG\Schema(ref="#/definitions/evacuation_eauxs") + * ) + * ) + */ + + /** + * get informations about mode + */ + function GET() { + $this->aFields = $this->getFields($this->aProperties['schema_anc'], "v_evacuation_eaux", "id_eva"); + // Url des fichiers. + $sWsDataUrl = $this->aProperties['web_server_name'] . '/' . $this->aProperties['ws_data_alias'] . '/anc/anc_saisie_anc_evacuation_eaux/documents/' . $this->aValues["my_vitis_id"]; + if (!empty($this->aFields['photos_f'])) + $this->aFields['photos_f'] = $sWsDataUrl . '/photos_f/' . $this->aFields['photos_f']; + if (!empty($this->aFields['fiche_f'])) + $this->aFields['fiche_f'] = $sWsDataUrl . '/fiche_f/' . $this->aFields['fiche_f']; + if (!empty($this->aFields['schema_f'])) + $this->aFields['schema_f'] = $sWsDataUrl . '/schema_f/' . $this->aFields['schema_f']; + if (!empty($this->aFields['documents_f'])) + $this->aFields['documents_f'] = $sWsDataUrl . '/documents_f/' . $this->aFields['documents_f']; + if (!empty($this->aFields['plan_f'])) + $this->aFields['plan_f'] = $sWsDataUrl . '/plan_f/' . $this->aFields['plan_f']; + } + + /** + * delete a Point_situation + */ + function DELETE() { + $this->oConnection->oBd->delete($this->aProperties['schema_anc'], 'v_evacuation_eaux', 'id_eva', $this->aValues["my_vitis_id"], 'integer'); + if ($this->oConnection->oBd->enErreur()) { + $this->oError = new VitisError(1, $this->oConnection->oBd->getBDMessage()); + } else { + $this->aFields["id_eva"] = $this->aValues["my_vitis_id"]; + } + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/anc/Evacuation_eauxs.class.inc b/vmap/vas/rest/ws/anc/Evacuation_eauxs.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..e7bafb94f732b5ad60aaae77a4412bb8e8b3acc2 --- /dev/null +++ b/vmap/vas/rest/ws/anc/Evacuation_eauxs.class.inc @@ -0,0 +1,297 @@ +<?php + +/** + * \file Evacuation_eauxs.class.inc + * \class Evacuation_eauxs + * + * \author WAB <support.wab@veremes.com>. + * + * \brief This file contains the Evacuation_eauxs php class + * + * This class defines Rest Api to Vitis Evacuation_eauxs + * + */ +require_once __DIR__ . '/Anc.class.inc'; +require_once 'Evacuation_eaux.class.inc'; + + +class Evacuation_eauxs extends Anc { + /** + * @SWG\Definition( + * definition="/evacuation_eauxs", + * allOf={ + * @SWG\Schema(ref="#/definitions/evacuation_eauxs") + * } + * ) + * * @SWG\Tag( + * name="Evacuation_eauxs", + * description="Operations about Evacuation_eauxs" + * ) + */ + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + */ + function __construct($aPath, $aValues, $properties) { + $this->aValues = $aValues; + $this->aPath = $aPath; + $this->aProperties = $properties; + $this->oConnection = new Connection($this->aValues, $this->aProperties); + } + + /** + * @SWG\Get(path="/evacuation_eauxs", + * tags={"Evacuation_eauxs"}, + * summary="Get Evacuation_eauxs", + * description="Request to get Evacuation_eauxs", + * 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", + * 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="evacuation_eaux Response", + * @SWG\Schema(ref="#/definitions/evacuation_eauxs") + * ) + * ) + */ + + /** + * get Evacuation_eauxs + * @return Evacuation_eauxs + */ + function GET() { + $aReturn = $this->genericGet($this->aProperties['schema_anc'], "v_evacuation_eaux", "id_eva"); + $sMessage = $aReturn['sMessage']; + return $sMessage; + } + + /** + * @SWG\Post(path="/evacuation_eauxs", + * tags={"Evacuation_eauxs"}, + * summary="Add evacuation_eaux", + * description="Request to add Evacuation_eauxs", + * operationId="POST", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="evacuation_eaux Response", + * @SWG\Schema(ref="#/definitions/evacuation_eauxs") + * ) + * ) + */ + + /** + * insert evacuation_eaux + * @return id of the evacuation_eaux created + */ + function POST() { + $this->aValues['create'] = $_SESSION["ses_Login"]; + $this->aValues['create_date'] = date('Y-m-d'); + // Sauve le nom des fichiers. + if (!empty($_FILES['photos_f'])) + $this->aValues['photos_f'] = $_FILES['photos_f']["name"]; + if (!empty($_FILES['fiche_f'])) + $this->aValues['fiche_f'] = $_FILES['fiche_f']["name"]; + if (!empty($_FILES['schema_f'])) + $this->aValues['schema_f'] = $_FILES['schema_f']["name"]; + if (!empty($_FILES['documents_f'])) + $this->aValues['documents_f'] = $_FILES['documents_f']["name"]; + if (!empty($_FILES['plan_f'])) + $this->aValues['plan_f'] = $_FILES['plan_f']["name"]; + // + $aReturn = $this->genericPost($this->aProperties['schema_anc'], 'v_evacuation_eaux', $this->aProperties['schema_anc'].'.evacuation_eaux_id_eva_seq', 'id_eva'); + // Upload les fichiers. + $this->uploadDocument('photos_f', 'anc_saisie_anc_evacuation_eaux'); + $this->uploadDocument('fiche_f', 'anc_saisie_anc_evacuation_eaux'); + $this->uploadDocument('schema_f', 'anc_saisie_anc_evacuation_eaux'); + $this->uploadDocument('documents_f', 'anc_saisie_anc_evacuation_eaux'); + $this->uploadDocument('plan_f', 'anc_saisie_anc_evacuation_eaux'); + // + return $aReturn['sMessage']; + } + + /** + * @SWG\Put(path="/evacuation_eauxs/{id_evacuation_eaux}", + * tags={"Evacuation_eauxs"}, + * summary="update Evacuation_eauxs", + * description="Request to update Evacuation_eauxs", + * operationId="PUT", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="Evacuation_eaux token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="id_evacuation_eaux", + * in="path", + * description="id of the Evacuation_eauxs", + * required=true, + * type="integer", + * format = "int32" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/evacuation_eauxs") + * ) + * ) + */ + + /** + * update evacuation_eauxs + * @return id of evacuation_eauxs updated or error object if a evacuation_eauxs is not updated + */ + function PUT() { + if (empty($this->aValues['maj'])) + $this->aValues['maj'] = $_SESSION["ses_Login"]; + if (empty($this->aValues['maj_date'])) + $this->aValues['maj_date'] = date('Y-m-d'); + // Upload les fichiers. + $this->uploadDocument('photos_f', 'anc_saisie_anc_evacuation_eaux'); + $this->uploadDocument('fiche_f', 'anc_saisie_anc_evacuation_eaux'); + $this->uploadDocument('schema_f', 'anc_saisie_anc_evacuation_eaux'); + $this->uploadDocument('documents_f', 'anc_saisie_anc_evacuation_eaux'); + $this->uploadDocument('plan_f', 'anc_saisie_anc_evacuation_eaux'); + // + $aReturn = $this->genericPut($this->aProperties['schema_anc'], 'v_evacuation_eaux', 'id_eva'); + return $aReturn['sMessage']; + } + + /** + * @SWG\Delete(path="/evacuation_eauxs", + * tags={"Evacuation_eauxs"}, + * summary="delete Evacuation_eauxs", + * description="Request to delete Evacuation_eauxs", + * operationId="DELETE", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="idList", + * in="query", + * description="id of the evacuation_eaux", + * required=true, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="evacuation_eaux Response", + * @SWG\Schema(ref="#/definitions/evacuation_eauxs") + * ) + * ) + */ + /** + * @SWG\Delete(path="/evacuation_eauxs/{id_evacuation_eaux}", + * tags={"Evacuation_eauxs"}, + * summary="delete Evacuation_eauxs", + * description="Request to delete Evacuation_eauxs", + * operationId="DELETE", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="Evacuation_eaux token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="id_evacuation_eaux", + * in="path", + * description="id of the Evacuation_eauxs", + * required=true, + * type="integer", + * format = "int32" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/evacuation_eauxs") + * ) + * ) + */ + + /** + * delete evacuation_eauxs + * @return id of evacuation_eauxs deleted or error object if a evacuation_eauxs is not deleted + */ + function DELETE() { + $aReturn = $this->genericDelete($this->aProperties['schema_anc'], 'v_evacuation_eaux', 'id_eva'); + return $aReturn['sMessage']; + } +} +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/anc/Filieres_agree.class.inc b/vmap/vas/rest/ws/anc/Filieres_agree.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..8dad000d32e46580aa4426069fa9f06853d251ac --- /dev/null +++ b/vmap/vas/rest/ws/anc/Filieres_agree.class.inc @@ -0,0 +1,105 @@ +<?php + +require_once __DIR__ . '/Anc.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; + +/** + * \file Filieres_agree.class.inc + * \class Filieres_agree + * + * \author WAB <support.wab@veremes.com>. + * + * \brief This file contains the Filieres_agree php class + * + * This class defines operation for one Filieres_agree + * + */ +class Filieres_agree extends Anc { + + public $oError; + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties) { + $this->aValues = $aValues; + $this->aPath = $aPath; + $this->aProperties = $properties; + $this->oConnection = new Connection($this->aValues, $this->aProperties); + } + + /** + * @SWG\Get(path="/filieres_agrees/{id_filieres_agree}", + * tags={"Filieres_agrees"}, + * summary="Get Filieres_agree", + * description="Request to get Filieres_agree by id", + * operationId="GET", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="id_filieres_agree", + * in="path", + * description="id_filieres_agree", + * required=true, + * type="integer", + * format="int32" + * ), + * @SWG\Parameter( + * name="attributs", + * in="query", + * description="list of attributs", + * required=false, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="Filieres_agree Response", + * @SWG\Schema(ref="#/definitions/filieres_agrees") + * ) + * ) + */ + + /** + * get informations about mode + */ + function GET() { + $this->aFields = $this->getFields($this->aProperties['schema_anc'], "v_filieres_agrees", "id_fag"); + // Url des fichiers. + $sWsDataUrl = $this->aProperties['web_server_name'] . '/' . $this->aProperties['ws_data_alias'] . '/anc/anc_saisie_anc_filieres_agree/documents/' . $this->aValues["my_vitis_id"]; + if (!empty($this->aFields['photos_f'])) + $this->aFields['photos_f'] = $sWsDataUrl . '/photos_f/' . $this->aFields['photos_f']; + if (!empty($this->aFields['fiche_f'])) + $this->aFields['fiche_f'] = $sWsDataUrl . '/fiche_f/' . $this->aFields['fiche_f']; + if (!empty($this->aFields['schema_f'])) + $this->aFields['schema_f'] = $sWsDataUrl . '/schema_f/' . $this->aFields['schema_f']; + if (!empty($this->aFields['documents_f'])) + $this->aFields['documents_f'] = $sWsDataUrl . '/documents_f/' . $this->aFields['documents_f']; + if (!empty($this->aFields['plan_f'])) + $this->aFields['plan_f'] = $sWsDataUrl . '/plan_f/' . $this->aFields['plan_f']; + } + + /** + * delete a Point_situation + */ + function DELETE() { + $this->oConnection->oBd->delete($this->aProperties['schema_anc'], 'v_filieres_agrees', 'id_fag', $this->aValues["my_vitis_id"], 'integer'); + if ($this->oConnection->oBd->enErreur()) { + $this->oError = new VitisError(1, $this->oConnection->oBd->getBDMessage()); + } else { + $this->aFields["id_fag"] = $this->aValues["my_vitis_id"]; + } + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/anc/Filieres_agrees.class.inc b/vmap/vas/rest/ws/anc/Filieres_agrees.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..f8480883e30010efa04cb9c20ad1db8747f33179 --- /dev/null +++ b/vmap/vas/rest/ws/anc/Filieres_agrees.class.inc @@ -0,0 +1,311 @@ +<?php + +/** + * \file Filieres_agrees.class.inc + * \class Filieres_agrees + * + * \author WAB <support.wab@veremes.com>. + * + * \brief This file contains the Filieres_agrees php class + * + * This class defines Rest Api to Vitis Filieres_agrees + * + */ +require_once __DIR__ . '/Anc.class.inc'; +require_once 'Filieres_agree.class.inc'; + + +class Filieres_agrees extends Anc { + /** + * @SWG\Definition( + * definition="/filieres_agrees", + * allOf={ + * @SWG\Schema(ref="#/definitions/filieres_agrees") + * } + * ) + * * @SWG\Tag( + * name="Filieres_agrees", + * description="Operations about Filieres_agrees" + * ) + */ + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + */ + function __construct($aPath, $aValues, $properties) { + $this->aValues = $aValues; + $this->aPath = $aPath; + $this->aProperties = $properties; + $this->oConnection = new Connection($this->aValues, $this->aProperties); + } + + /** + * @SWG\Get(path="/filieres_agrees", + * tags={"Filieres_agrees"}, + * summary="Get Filieres_agrees", + * description="Request to get Filieres_agrees", + * 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", + * 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="filieres_agree Response", + * @SWG\Schema(ref="#/definitions/filieres_agrees") + * ) + * ) + */ + + /** + * get Filieres_agrees + * @return Filieres_agrees + */ + function GET() { + $aReturn = $this->genericGet($this->aProperties['schema_anc'], "v_filieres_agrees", "id_fag"); + $sMessage = $aReturn['sMessage']; + return $sMessage; + } + + /** + * @SWG\Post(path="/filieres_agrees", + * tags={"Filieres_agrees"}, + * summary="Add filieres_agree", + * description="Request to add Filieres_agrees", + * operationId="POST", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="filieres_agree Response", + * @SWG\Schema(ref="#/definitions/filieres_agrees") + * ) + * ) + */ + + /** + * insert filieres_agree + * @return id of the filieres_agree created + */ + function POST() { + $this->aValues['create'] = $_SESSION["ses_Login"]; + $this->aValues['create_date'] = date('Y-m-d'); + // Sauve le nom des fichiers. + if (!empty($_FILES['photos_f'])) + $this->aValues['photos_f'] = $_FILES['photos_f']["name"]; + if (!empty($_FILES['fiche_f'])) + $this->aValues['fiche_f'] = $_FILES['fiche_f']["name"]; + if (!empty($_FILES['schema_f'])) + $this->aValues['schema_f'] = $_FILES['schema_f']["name"]; + if (!empty($_FILES['documents_f'])) + $this->aValues['documents_f'] = $_FILES['documents_f']["name"]; + if (!empty($_FILES['plan_f'])) + $this->aValues['plan_f'] = $_FILES['plan_f']["name"]; + // Conversion des dates + if (isset($this->aValues['fag_en_date'])) { + if ($this->aValues['fag_en_date'] == '') + unset($this->aValues['fag_en_date']); + else + $this->aValues['fag_en_date'] = date_format(date_create_from_format('d/m/Y', $this->aValues['fag_en_date']), 'Y-m-d'); + } + // + $aReturn = $this->genericPost($this->aProperties['schema_anc'], 'v_filieres_agrees', $this->aProperties['schema_anc'].'.filieres_agrees_id_fag_seq', 'id_fag'); + // Upload les fichiers. + $this->uploadDocument('photos_f', 'anc_saisie_anc_filieres_agree'); + $this->uploadDocument('fiche_f', 'anc_saisie_anc_filieres_agree'); + $this->uploadDocument('schema_f', 'anc_saisie_anc_filieres_agree'); + $this->uploadDocument('documents_f', 'anc_saisie_anc_filieres_agree'); + $this->uploadDocument('plan_f', 'anc_saisie_anc_filieres_agree'); + // + return $aReturn['sMessage']; + } + + /** + * @SWG\Put(path="/filieres_agrees/{id_filieres_agree}", + * tags={"Filieres_agrees"}, + * summary="update Filieres_agrees", + * description="Request to update Filieres_agrees", + * operationId="PUT", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="Filieres_agree token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="id_filieres_agree", + * in="path", + * description="id of the Filieres_agrees", + * required=true, + * type="integer", + * format = "int32" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/filieres_agrees") + * ) + * ) + */ + + /** + * update filieres_agrees + * @return id of filieres_agrees updated or error object if a filieres_agrees is not updated + */ + function PUT() { + if (empty($this->aValues['maj'])) + $this->aValues['maj'] = $_SESSION["ses_Login"]; + if (empty($this->aValues['maj_date'])) + $this->aValues['maj_date'] = date('Y-m-d'); + // Upload les fichiers. + $this->uploadDocument('photos_f', 'anc_saisie_anc_filieres_agree'); + $this->uploadDocument('fiche_f', 'anc_saisie_anc_filieres_agree'); + $this->uploadDocument('schema_f', 'anc_saisie_anc_filieres_agree'); + $this->uploadDocument('documents_f', 'anc_saisie_anc_filieres_agree'); + $this->uploadDocument('plan_f', 'anc_saisie_anc_filieres_agree'); + // Conversion des dates + if (isset($this->aValues['fag_en_date'])) { + if ($this->aValues['fag_en_date'] == '') + unset($this->aValues['fag_en_date']); + else + $this->aValues['fag_en_date'] = date_format(date_create_from_format('d/m/Y', $this->aValues['fag_en_date']), 'Y-m-d'); + } + // + $aReturn = $this->genericPut($this->aProperties['schema_anc'], 'v_filieres_agrees', 'id_fag'); + return $aReturn['sMessage']; + } + + /** + * @SWG\Delete(path="/filieres_agrees", + * tags={"Filieres_agrees"}, + * summary="delete Filieres_agrees", + * description="Request to delete Filieres_agrees", + * operationId="DELETE", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="idList", + * in="query", + * description="id of the filieres_agree", + * required=true, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="filieres_agree Response", + * @SWG\Schema(ref="#/definitions/filieres_agrees") + * ) + * ) + */ + /** + * @SWG\Delete(path="/filieres_agrees/{id_filieres_agree}", + * tags={"Filieres_agrees"}, + * summary="delete Filieres_agrees", + * description="Request to delete Filieres_agrees", + * operationId="DELETE", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="Filieres_agree token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="id_filieres_agree", + * in="path", + * description="id of the Filieres_agrees", + * required=true, + * type="integer", + * format = "int32" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/filieres_agrees") + * ) + * ) + */ + + /** + * delete filieres_agrees + * @return id of filieres_agrees deleted or error object if a filieres_agrees is not deleted + */ + function DELETE() { + $aReturn = $this->genericDelete($this->aProperties['schema_anc'], 'v_filieres_agrees', 'id_fag'); + return $aReturn['sMessage']; + } +} +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/anc/Installation.class.inc b/vmap/vas/rest/ws/anc/Installation.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..0b95a7f2e9ab08e4926c61c4146ad1d693f9a030 --- /dev/null +++ b/vmap/vas/rest/ws/anc/Installation.class.inc @@ -0,0 +1,99 @@ +<?php + +require_once __DIR__ . '/Anc.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; + +/** + * \file Installation.class.inc + * \class Installation + * + * \author WAB <support.wab@veremes.com>. + * + * \brief This file contains the Installation php class + * + * This class defines operation for one Installation + * + */ +class Installation extends Anc { + + public $oError; + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties) { + $this->aValues = $aValues; + $this->aPath = $aPath; + $this->aProperties = $properties; + $this->oConnection = new Connection($this->aValues, $this->aProperties); + $this->aSelectedFields = Array("id_installation", "id_com", "id_parc", "parc_sup", "parc_parcelle_associees", "parc_adresse", "code_postal", "parc_commune", "prop_titre", "prop_nom_prenom", "prop_adresse", "prop_code_postal", "prop_commune", "prop_tel", "prop_mail", "bati_type", "bati_ca_nb_pp", "bati_ca_nb_eh", "bati_ca_nb_chambres", "bati_ca_nb_autres_pieces", "bati_ca_nb_occupant", "bati_nb_a_control", "bati_date_achat", "bati_date_mutation", "cont_zone_enjeu", "cont_zone_sage", "cont_zone_autre", "cont_zone_urba", "cont_zone_anc", "cont_alim_eau_potable", "cont_puits_usage", "cont_puits_declaration", "cont_puits_situation", "cont_puits_terrain_mitoyen", "observations", "maj", "maj_date", "create", "create_date", "archivage", "geom", "photo_f", "document_f", "num_dossier", "commune", "section", "parcelle", "nb_controle", "last_date_control", "cl_avis", "next_control", "classement_installation"); + } + + /** + * @SWG\Get(path="/installations/{id_installation}", + * tags={"Installations"}, + * summary="Get Installation", + * description="Request to get Installation by id", + * operationId="GET", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="id_installation", + * in="path", + * description="id_installation", + * required=true, + * type="integer", + * format="int32" + * ), + * @SWG\Parameter( + * name="attributs", + * in="query", + * description="list of attributs", + * required=false, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="Installation Response", + * @SWG\Schema(ref="#/definitions/installations") + * ) + * ) + */ + + /** + * get informations about mode + */ + function GET() { + $this->aFields = $this->getFields($this->aProperties['schema_anc'], "v_installation", "id_installation"); + // Url des fichiers. + if (!empty($this->aFields['photo_f'])) + $this->aFields['photo_f'] = $this->aProperties['web_server_name'] . '/' . $this->aProperties['ws_data_alias'] . '/anc/anc_saisie_anc_installation/documents/' . $this->aValues["my_vitis_id"] . '/photo_f/' . $this->aFields['photo_f']; + if (!empty($this->aFields['document_f'])) + $this->aFields['document_f'] = $this->aProperties['web_server_name'] . '/' . $this->aProperties['ws_data_alias'] . '/anc/anc_saisie_anc_installation/documents/' . $this->aValues["my_vitis_id"] . '/document_f/' . $this->aFields['document_f']; + } + + /** + * delete a Point_situation + */ + function DELETE() { + $this->oConnection->oBd->delete($this->aProperties['schema_anc'], 'v_installation', 'id_installation', $this->aValues["my_vitis_id"], 'integer'); + if ($this->oConnection->oBd->enErreur()) { + $this->oError = new VitisError(1, $this->oConnection->oBd->getBDMessage()); + } else { + $this->aFields["id_installation"] = $this->aValues["my_vitis_id"]; + } + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/anc/Installations.class.inc b/vmap/vas/rest/ws/anc/Installations.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..2993a37050e8bbad65512b1b436cfcd9a4d20279 --- /dev/null +++ b/vmap/vas/rest/ws/anc/Installations.class.inc @@ -0,0 +1,312 @@ +<?php + +/** + * \file Installations.class.inc + * \class Installations + * + * \author WAB <support.wab@veremes.com>. + * + * \brief This file contains the Installations php class + * + * This class defines Rest Api to Vitis Installations + * + */ +require_once __DIR__ . '/Anc.class.inc'; +require_once 'Installation.class.inc'; + + +class Installations extends Anc { + /** + * @SWG\Definition( + * definition="/installations", + * allOf={ + * @SWG\Schema(ref="#/definitions/installations") + * } + * ) + * * @SWG\Tag( + * name="Installations", + * description="Operations about Installations" + * ) + */ + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + */ + function __construct($aPath, $aValues, $properties) { + $this->aValues = $aValues; + $this->aPath = $aPath; + $this->aProperties = $properties; + $this->oConnection = new Connection($this->aValues, $this->aProperties); + $this->aSelectedFields = Array("id_installation", "id_com", "id_parc", "parc_sup", "parc_parcelle_associees", "parc_adresse", "code_postal", "parc_commune", "prop_titre", "prop_nom_prenom", "prop_adresse", "prop_code_postal", "prop_commune", "prop_tel", "prop_mail", "bati_type", "bati_ca_nb_pp", "bati_ca_nb_eh", "bati_ca_nb_chambres", "bati_ca_nb_autres_pieces", "bati_ca_nb_occupant", "bati_nb_a_control", "bati_date_achat", "bati_date_mutation", "cont_zone_enjeu", "cont_zone_sage", "cont_zone_autre", "cont_zone_urba", "cont_zone_anc", "cont_alim_eau_potable", "cont_puits_usage", "cont_puits_declaration", "cont_puits_situation", "cont_puits_terrain_mitoyen", "observations", "maj", "maj_date", "create", "create_date", "archivage", "geom", "photo_f", "document_f", "num_dossier", "commune", "section", "parcelle", "nb_controle", "last_date_control", "cl_avis", "next_control", "classement_installation"); + } + + /** + * @SWG\Get(path="/installations", + * tags={"Installations"}, + * summary="Get Installations", + * description="Request to get Installations", + * 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", + * 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="installation Response", + * @SWG\Schema(ref="#/definitions/installations") + * ) + * ) + */ + + /** + * get Installations + * @return Installations + */ + function GET() { + $aReturn = $this->genericGet($this->aProperties['schema_anc'], "v_installation", "id_installation"); + $sMessage = $aReturn['sMessage']; + return $sMessage; + } + + /** + * @SWG\Post(path="/installations", + * tags={"Installations"}, + * summary="Add installation", + * description="Request to add Installations", + * operationId="POST", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="installation Response", + * @SWG\Schema(ref="#/definitions/installations") + * ) + * ) + */ + + /** + * insert installation + * @return id of the installation created + */ + function POST() { + $this->aValues['create'] = $_SESSION["ses_Login"]; + $this->aValues['create_date'] = date('Y-m-d'); + $aReturn = $this->genericPost($this->aProperties['schema_anc'], 'v_installation', $this->aProperties['schema_anc'].'.installation_id_installation_seq', 'id_installation'); + return $aReturn['sMessage']; + } + + /** + * @SWG\Put(path="/installations/{id_installation}", + * tags={"Installations"}, + * summary="update Installations", + * description="Request to update Installations", + * operationId="PUT", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="Installation token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="id_installation", + * in="path", + * description="id of the Installations", + * required=true, + * type="integer", + * format = "int32" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/installations") + * ) + * ) + */ + + /** + * update installations + * @return id of installations updated or error object if a installations is not updated + */ + function PUT() { + if (empty($this->aValues['maj'])) + $this->aValues['maj'] = $_SESSION["ses_Login"]; + if (empty($this->aValues['maj_date'])) + $this->aValues['maj_date'] = date('Y-m-d'); + // Upload les fichiers. + $this->uploadDocument('photo_f', 'anc_saisie_anc_installation'); + $this->uploadDocument('document_f', 'anc_saisie_anc_installation'); + // Zone PLU. + if (!empty($this->aValues['geom'])) { + $sSchema = $this->aProperties["anc"]["cont_zone_urba"]["intersect"]["schema"]; + $sTable = $this->aProperties["anc"]["cont_zone_urba"]["intersect"]["table"]; + $sColumn = $this->aProperties["anc"]["cont_zone_urba"]["intersect"]["column"]; + $sColumnGeom = $this->aProperties["anc"]["cont_zone_urba"]["intersect"]["column_geom"]; + if (!empty($sSchema) && !empty($sTable) && !empty($sColumn) && !empty($sColumnGeom)) { + require $this->sRessourcesFile; + $aParams['sSchema'] = array('value' => $sSchema, 'type' => 'schema_name'); + $aParams['sTable'] = array('value' => $sTable, 'type' => 'table_name'); + $aParams['sColumn'] = array('value' => $sColumn, 'type' => 'column_name'); + $aParams['sColumnGeom'] = array('value' => $sColumnGeom, 'type' => 'column_name'); + $aParams['geom'] = array('value' => $this->aValues['geom'], 'type' => 'geometry'); + $oPDOresult = $this->oConnection->oBd->executeWithParams($aSql['getContZoneUrbaIntersect'], $aParams); + if ($this->oConnection->oBd->nombreLigne($oPDOresult) > 0) { + $aLigne = $this->oConnection->oBd->ligneSuivante ($oPDOresult); + $this->aValues['cont_zone_urba'] = $aLigne[$sColumn]; + } + } + } + $aReturn = $this->genericPut($this->aProperties['schema_anc'], 'v_installation', 'id_installation'); + return $aReturn['sMessage']; + } + + /** + * @SWG\Delete(path="/installations", + * tags={"Installations"}, + * summary="delete Installations", + * description="Request to delete Installations", + * operationId="DELETE", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="idList", + * in="query", + * description="id of the installation", + * required=true, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="installation Response", + * @SWG\Schema(ref="#/definitions/installations") + * ) + * ) + */ + /** + * @SWG\Delete(path="/installations/{id_installation}", + * tags={"Installations"}, + * summary="delete Installations", + * description="Request to delete Installations", + * operationId="DELETE", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="Installation token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="id_installation", + * in="path", + * description="id of the Installations", + * required=true, + * type="integer", + * format = "int32" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/installations") + * ) + * ) + */ + + /** + * delete installations + * @return id of installations deleted or error object if a installations is not deleted + */ + function DELETE() { + require $this->sRessourcesFile; + // Pas de Suppression si des contrôles sont associés. + $aParams['sSchemaAnc'] = array('value' => $this->aProperties['schema_anc'], 'type' => 'schema_name'); + $aParams['idList'] = array('value' => $this->aValues['idList'], 'type' => 'group'); + $oPDOresult = $this->oConnection->oBd->executeWithParams($aSql['getInstallationControls'], $aParams); + if ($this->oConnection->oBd->enErreur()) { + $aReturn = array('status' => 0, 'message' => $this->oConnection->oBd->getBDMessage(), 'error_code' => 1); + return json_encode($aReturn); + } + else { + if ($this->oConnection->oBd->nombreLigne($oPDOresult) > 0) { + $aReturn = array('status' => 0, 'errorMessage' => 'Des contrôles sont associés à / aux installation(s) à supprimer.', 'error_code' => 1); + return json_encode($aReturn); + } + else { + $aReturn = $this->genericDelete($this->aProperties['schema_anc'], 'v_installation', 'id_installation'); + return $aReturn['sMessage']; + } + } + } +} +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/anc/Param_admin.class.inc b/vmap/vas/rest/ws/anc/Param_admin.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..e8d16f41ce9dfaaa9be222639b0f132c04137feb --- /dev/null +++ b/vmap/vas/rest/ws/anc/Param_admin.class.inc @@ -0,0 +1,91 @@ +<?php + +require_once __DIR__ . '/Anc.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; + +/** + * \file Param_admin.class.inc + * \class Param_admin + * + * \author WAB <support.wab@veremes.com>. + * + * \brief This file contains the Param_admin php class + * + * This class defines operation for one Param_admin + * + */ +class Param_admin extends Anc { + + public $oError; + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties) { + $this->aValues = $aValues; + $this->aPath = $aPath; + $this->aProperties = $properties; + $this->oConnection = new Connection($this->aValues, $this->aProperties); + } + + /** + * @SWG\Get(path="/param_admins/{id_param_admin}", + * tags={"Param_admins"}, + * summary="Get Param_admin", + * description="Request to get Param_admin by id", + * operationId="GET", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="id_param_admin", + * in="path", + * description="id_param_admin", + * required=true, + * type="integer", + * format="int32" + * ), + * @SWG\Parameter( + * name="attributs", + * in="query", + * description="list of attributs", + * required=false, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="Param_admin Response", + * @SWG\Schema(ref="#/definitions/param_admins") + * ) + * ) + */ + + /** + * get informations about mode + */ + function GET() { + $this->aFields = $this->getFields($this->aProperties['schema_anc'], "param_admin", "id_parametre_admin"); + } + + /** + * delete a Point_situation + */ + function DELETE() { + $this->oConnection->oBd->delete($this->aProperties['schema_anc'], 'param_admin', 'id_parametre_admin', $this->aValues["my_vitis_id"], 'integer'); + if ($this->oConnection->oBd->enErreur()) { + $this->oError = new VitisError(1, $this->oConnection->oBd->getBDMessage()); + } else { + $this->aFields["id_parametre_admin"] = $this->aValues["my_vitis_id"]; + } + } +} +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/anc/Param_admins.class.inc b/vmap/vas/rest/ws/anc/Param_admins.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..eb9caa92474c3d34918360d2dd3de4bb848374a5 --- /dev/null +++ b/vmap/vas/rest/ws/anc/Param_admins.class.inc @@ -0,0 +1,285 @@ +<?php + +/** + * \file Param_admins.class.inc + * \class Param_admins + * + * \author WAB <support.wab@veremes.com>. + * + * \brief This file contains the Param_admins php class + * + * This class defines Rest Api to Vitis Param_admins + * + */ +require_once __DIR__ . '/Anc.class.inc'; +require_once 'Param_admin.class.inc'; + + +class Param_admins extends Anc { + /** + * @SWG\Definition( + * definition="/param_admins", + * allOf={ + * @SWG\Schema(ref="#/definitions/param_admins") + * } + * ) + * * @SWG\Tag( + * name="Param_admins", + * description="Operations about Param_admins" + * ) + */ + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + */ + function __construct($aPath, $aValues, $properties) { + $this->aValues = $aValues; + $this->aPath = $aPath; + $this->aProperties = $properties; + $this->oConnection = new Connection($this->aValues, $this->aProperties); + } + + /** + * @SWG\Get(path="/param_admins", + * tags={"Param_admins"}, + * summary="Get Param_admins", + * description="Request to get Param_admins", + * 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", + * 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="param_admin Response", + * @SWG\Schema(ref="#/definitions/param_admins") + * ) + * ) + */ + + /** + * get Param_admins + * @return Param_admins + */ + function GET() { + $aReturn = $this->genericGet($this->aProperties['schema_anc'], "v_param_admin", "id_parametre_admin"); + $sMessage = $aReturn['sMessage']; + return $sMessage; + } + + /** + * @SWG\Post(path="/param_admins", + * tags={"Param_admins"}, + * summary="Add param_admin", + * description="Request to add Param_admins", + * operationId="POST", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="param_admin Response", + * @SWG\Schema(ref="#/definitions/param_admins") + * ) + * ) + */ + + /** + * insert param_admin + * @return id of the param_admin created + */ + function POST() { + // Conversion des dates + $aDates = array('date_fin_validite'); + foreach ($aDates as $sDate) { + if (isset($this->aValues[$sDate])) { + if ($this->aValues[$sDate] == '') + unset($this->aValues[$sDate]); + else + $this->aValues[$sDate] = date_format(date_create_from_format('d/m/Y', $this->aValues[$sDate]), 'Y-m-d'); + } + } + $aReturn = $this->genericPost($this->aProperties['schema_anc'], 'param_admin', $this->aProperties['schema_anc'].'.param_admin_id_parametre_admin_seq', 'id_parametre_admin'); + return $aReturn['sMessage']; + } + + /** + * @SWG\Put(path="/param_admins/{id_param_admin}", + * tags={"Param_admins"}, + * summary="update Param_admins", + * description="Request to update Param_admins", + * operationId="PUT", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="Param_admin token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="id_param_admin", + * in="path", + * description="id of the Param_admins", + * required=true, + * type="integer", + * format = "int32" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/param_admins") + * ) + * ) + */ + + /** + * update param_admins + * @return id of param_admins updated or error object if a param_admins is not updated + */ + function PUT() { + // Conversion des dates + $aDates = array('date_fin_validite'); + foreach ($aDates as $sDate) { + if (isset($this->aValues[$sDate])) { + if ($this->aValues[$sDate] == '') + unset($this->aValues[$sDate]); + else + $this->aValues[$sDate] = date_format(date_create_from_format('d/m/Y', $this->aValues[$sDate]), 'Y-m-d'); + } + } + $aReturn = $this->genericPut($this->aProperties['schema_anc'], 'param_admin', 'id_parametre_admin'); + return $aReturn['sMessage']; + } + + /** + * @SWG\Delete(path="/param_admins", + * tags={"Param_admins"}, + * summary="delete Param_admins", + * description="Request to delete Param_admins", + * operationId="DELETE", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="idList", + * in="query", + * description="id of the param_admin", + * required=true, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="param_admin Response", + * @SWG\Schema(ref="#/definitions/param_admins") + * ) + * ) + */ + /** + * @SWG\Delete(path="/param_admins/{id_param_admin}", + * tags={"Param_admins"}, + * summary="delete Param_admins", + * description="Request to delete Param_admins", + * operationId="DELETE", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="Param_admin token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="id_param_admin", + * in="path", + * description="id of the Param_admins", + * required=true, + * type="integer", + * format = "int32" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/param_admins") + * ) + * ) + */ + + /** + * delete param_admins + * @return id of param_admins deleted or error object if a param_admins is not deleted + */ + function DELETE() { + $aReturn = $this->genericDelete($this->aProperties['schema_anc'], 'param_admin', 'id_parametre_admin'); + return $aReturn['sMessage']; + } +} +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/anc/Param_liste.class.inc b/vmap/vas/rest/ws/anc/Param_liste.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..46014f125e29accadef3dab50d2f8d16592e41e8 --- /dev/null +++ b/vmap/vas/rest/ws/anc/Param_liste.class.inc @@ -0,0 +1,91 @@ +<?php + +require_once __DIR__ . '/Anc.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; + +/** + * \file Param_liste.class.inc + * \class Param_liste + * + * \author WAB <support.wab@veremes.com>. + * + * \brief This file contains the Param_liste php class + * + * This class defines operation for one Param_liste + * + */ +class Param_liste extends Anc { + + public $oError; + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties) { + $this->aValues = $aValues; + $this->aPath = $aPath; + $this->aProperties = $properties; + $this->oConnection = new Connection($this->aValues, $this->aProperties); + } + + /** + * @SWG\Get(path="/param_listes/{id_param_liste}", + * tags={"Param_listes"}, + * summary="Get Param_liste", + * description="Request to get Param_liste by id", + * operationId="GET", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="id_param_liste", + * in="path", + * description="id_param_liste", + * required=true, + * type="integer", + * format="int32" + * ), + * @SWG\Parameter( + * name="attributs", + * in="query", + * description="list of attributs", + * required=false, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="Param_liste Response", + * @SWG\Schema(ref="#/definitions/param_listes") + * ) + * ) + */ + + /** + * get informations about mode + */ + function GET() { + $this->aFields = $this->getFields($this->aProperties['schema_anc'], "param_liste", "id_parametre_liste"); + } + + /** + * delete a Point_situation + */ + function DELETE() { + $this->oConnection->oBd->delete($this->aProperties['schema_anc'], 'param_liste', 'id_parametre_liste', $this->aValues["my_vitis_id"], 'integer'); + if ($this->oConnection->oBd->enErreur()) { + $this->oError = new VitisError(1, $this->oConnection->oBd->getBDMessage()); + } else { + $this->aFields["id_parametre_liste"] = $this->aValues["my_vitis_id"]; + } + } +} +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/anc/Param_listes.class.inc b/vmap/vas/rest/ws/anc/Param_listes.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..85b6ae2b3835c66975c13da7c59fe719f649711e --- /dev/null +++ b/vmap/vas/rest/ws/anc/Param_listes.class.inc @@ -0,0 +1,265 @@ +<?php + +/** + * \file Param_listes.class.inc + * \class Param_listes + * + * \author WAB <support.wab@veremes.com>. + * + * \brief This file contains the Param_listes php class + * + * This class defines Rest Api to Vitis Param_listes + * + */ +require_once __DIR__ . '/Anc.class.inc'; +require_once 'Param_liste.class.inc'; + + +class Param_listes extends Anc { + /** + * @SWG\Definition( + * definition="/param_listes", + * allOf={ + * @SWG\Schema(ref="#/definitions/param_listes") + * } + * ) + * * @SWG\Tag( + * name="Param_listes", + * description="Operations about Param_listes" + * ) + */ + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + */ + function __construct($aPath, $aValues, $properties) { + $this->aValues = $aValues; + $this->aPath = $aPath; + $this->aProperties = $properties; + $this->oConnection = new Connection($this->aValues, $this->aProperties); + } + + /** + * @SWG\Get(path="/param_listes", + * tags={"Param_listes"}, + * summary="Get Param_listes", + * description="Request to get Param_listes", + * 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", + * 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="param_liste Response", + * @SWG\Schema(ref="#/definitions/param_listes") + * ) + * ) + */ + + /** + * get Param_listes + * @return Param_listes + */ + function GET() { + $aReturn = $this->genericGet($this->aProperties['schema_anc'], "param_liste", "id_parametre_liste"); + $sMessage = $aReturn['sMessage']; + return $sMessage; + } + + /** + * @SWG\Post(path="/param_listes", + * tags={"Param_listes"}, + * summary="Add param_liste", + * description="Request to add Param_listes", + * operationId="POST", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="param_liste Response", + * @SWG\Schema(ref="#/definitions/param_listes") + * ) + * ) + */ + + /** + * insert param_liste + * @return id of the param_liste created + */ + function POST() { + $aReturn = $this->genericPost($this->aProperties['schema_anc'], 'param_liste', $this->aProperties['schema_anc'].'.param_liste_id_parametre_liste_seq', 'id_parametre_liste'); + return $aReturn['sMessage']; + } + + /** + * @SWG\Put(path="/param_listes/{id_param_liste}", + * tags={"Param_listes"}, + * summary="update Param_listes", + * description="Request to update Param_listes", + * operationId="PUT", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="Param_liste token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="id_param_liste", + * in="path", + * description="id of the Param_listes", + * required=true, + * type="integer", + * format = "int32" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/param_listes") + * ) + * ) + */ + + /** + * update param_listes + * @return id of param_listes updated or error object if a param_listes is not updated + */ + function PUT() { + $aReturn = $this->genericPut($this->aProperties['schema_anc'], 'param_liste', 'id_parametre_liste'); + return $aReturn['sMessage']; + } + + /** + * @SWG\Delete(path="/param_listes", + * tags={"Param_listes"}, + * summary="delete Param_listes", + * description="Request to delete Param_listes", + * operationId="DELETE", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="idList", + * in="query", + * description="id of the param_liste", + * required=true, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="param_liste Response", + * @SWG\Schema(ref="#/definitions/param_listes") + * ) + * ) + */ + /** + * @SWG\Delete(path="/param_listes/{id_param_liste}", + * tags={"Param_listes"}, + * summary="delete Param_listes", + * description="Request to delete Param_listes", + * operationId="DELETE", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="Param_liste token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="id_param_liste", + * in="path", + * description="id of the Param_listes", + * required=true, + * type="integer", + * format = "int32" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/param_listes") + * ) + * ) + */ + + /** + * delete param_listes + * @return id of param_listes deleted or error object if a param_listes is not deleted + */ + function DELETE() { + $aReturn = $this->genericDelete($this->aProperties['schema_anc'], 'param_liste', 'id_parametre_liste'); + return $aReturn['sMessage']; + } +} +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/anc/Param_tarif.class.inc b/vmap/vas/rest/ws/anc/Param_tarif.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..1ea43cc9774e3929a21ed81c801d35bf1e971134 --- /dev/null +++ b/vmap/vas/rest/ws/anc/Param_tarif.class.inc @@ -0,0 +1,94 @@ +<?php + +require_once __DIR__ . '/Anc.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; + +/** + * \file Param_tarif.class.inc + * \class Param_tarif + * + * \author WAB <support.wab@veremes.com>. + * + * \brief This file contains the Param_tarif php class + * + * This class defines operation for one Param_tarif + * + */ +class Param_tarif extends Anc { + + public $oError; + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties) { + $this->aValues = $aValues; + $this->aPath = $aPath; + $this->aProperties = $properties; + $this->oConnection = new Connection($this->aValues, $this->aProperties); + $this->aSelectedFields = Array("id_parametre_tarif", "id_com", "controle_type", "montant", "annee_validite", "devise", "libelle_montant"); + } + + /** + * @SWG\Get(path="/param_tarifs/{id_param_tarif}", + * tags={"Param_tarifs"}, + * summary="Get Param_tarif", + * description="Request to get Param_tarif by id", + * operationId="GET", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="id_param_tarif", + * in="path", + * description="id_param_tarif", + * required=true, + * type="integer", + * format="int32" + * ), + * @SWG\Parameter( + * name="attributs", + * in="query", + * description="list of attributs", + * required=false, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="Param_tarif Response", + * @SWG\Schema(ref="#/definitions/param_tarifs") + * ) + * ) + */ + + /** + * get informations about mode + */ + function GET() { + $this->aFields = $this->getFields($this->aProperties['schema_anc'], "v_param_tarif", "id_parametre_tarif"); + } + + /** + * delete a Point_situation + */ + function DELETE() { + $this->oConnection->oBd->delete($this->aProperties['schema_anc'], 'param_tarif', 'id_parametre_tarif', $this->aValues["my_vitis_id"], 'integer'); + if ($this->oConnection->oBd->enErreur()) { + $this->oError = new VitisError(1, $this->oConnection->oBd->getBDMessage()); + } else { + $this->aFields["id_parametre_tarif"] = $this->aValues["my_vitis_id"]; + } + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/anc/Param_tarifs.class.inc b/vmap/vas/rest/ws/anc/Param_tarifs.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..7c6c2d45789be6dd3109dec927e550df6799c393 --- /dev/null +++ b/vmap/vas/rest/ws/anc/Param_tarifs.class.inc @@ -0,0 +1,266 @@ +<?php + +/** + * \file Param_tarifs.class.inc + * \class Param_tarifs + * + * \author WAB <support.wab@veremes.com>. + * + * \brief This file contains the Param_tarifs php class + * + * This class defines Rest Api to Vitis Param_tarifs + * + */ +require_once __DIR__ . '/Anc.class.inc'; +require_once 'Param_tarif.class.inc'; + + +class Param_tarifs extends Anc { + /** + * @SWG\Definition( + * definition="/param_tarifs", + * allOf={ + * @SWG\Schema(ref="#/definitions/param_tarifs") + * } + * ) + * * @SWG\Tag( + * name="Param_tarifs", + * description="Operations about Param_tarifs" + * ) + */ + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + */ + function __construct($aPath, $aValues, $properties) { + $this->aValues = $aValues; + $this->aPath = $aPath; + $this->aProperties = $properties; + $this->oConnection = new Connection($this->aValues, $this->aProperties); + $this->aSelectedFields = Array("id_parametre_tarif", "id_com", "controle_type", "montant", "annee_validite", "devise", "libelle_montant"); + } + + /** + * @SWG\Get(path="/param_tarifs", + * tags={"Param_tarifs"}, + * summary="Get Param_tarifs", + * description="Request to get Param_tarifs", + * 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", + * 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="param_tarif Response", + * @SWG\Schema(ref="#/definitions/param_tarifs") + * ) + * ) + */ + + /** + * get Param_tarifs + * @return Param_tarifs + */ + function GET() { + $aReturn = $this->genericGet($this->aProperties['schema_anc'], "v_param_tarif", "id_parametre_tarif"); + $sMessage = $aReturn['sMessage']; + return $sMessage; + } + + /** + * @SWG\Post(path="/param_tarifs", + * tags={"Param_tarifs"}, + * summary="Add param_tarif", + * description="Request to add Param_tarifs", + * operationId="POST", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="param_tarif Response", + * @SWG\Schema(ref="#/definitions/param_tarifs") + * ) + * ) + */ + + /** + * insert param_tarif + * @return id of the param_tarif created + */ + function POST() { + $aReturn = $this->genericPost($this->aProperties['schema_anc'], 'param_tarif', $this->aProperties['schema_anc'].'.param_tarif_id_parametre_tarif_seq', 'id_parametre_tarif'); + return $aReturn['sMessage']; + } + + /** + * @SWG\Put(path="/param_tarifs/{id_param_tarif}", + * tags={"Param_tarifs"}, + * summary="update Param_tarifs", + * description="Request to update Param_tarifs", + * operationId="PUT", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="Param_tarif token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="id_param_tarif", + * in="path", + * description="id of the Param_tarifs", + * required=true, + * type="integer", + * format = "int32" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/param_tarifs") + * ) + * ) + */ + + /** + * update param_tarifs + * @return id of param_tarifs updated or error object if a param_tarifs is not updated + */ + function PUT() { + $aReturn = $this->genericPut($this->aProperties['schema_anc'], 'param_tarif', 'id_parametre_tarif'); + return $aReturn['sMessage']; + } + + /** + * @SWG\Delete(path="/param_tarifs", + * tags={"Param_tarifs"}, + * summary="delete Param_tarifs", + * description="Request to delete Param_tarifs", + * operationId="DELETE", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="idList", + * in="query", + * description="id of the param_tarif", + * required=true, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="param_tarif Response", + * @SWG\Schema(ref="#/definitions/param_tarifs") + * ) + * ) + */ + /** + * @SWG\Delete(path="/param_tarifs/{id_param_tarif}", + * tags={"Param_tarifs"}, + * summary="delete Param_tarifs", + * description="Request to delete Param_tarifs", + * operationId="DELETE", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="Param_tarif token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="id_param_tarif", + * in="path", + * description="id of the Param_tarifs", + * required=true, + * type="integer", + * format = "int32" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/param_tarifs") + * ) + * ) + */ + + /** + * delete param_tarifs + * @return id of param_tarifs deleted or error object if a param_tarifs is not deleted + */ + function DELETE() { + $aReturn = $this->genericDelete($this->aProperties['schema_anc'], 'param_tarif', 'id_parametre_tarif'); + return $aReturn['sMessage']; + } +} +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/anc/Pretraitement.class.inc b/vmap/vas/rest/ws/anc/Pretraitement.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..41a1ec39cfc3810e53cb84ca2c04e5f667a9eda5 --- /dev/null +++ b/vmap/vas/rest/ws/anc/Pretraitement.class.inc @@ -0,0 +1,105 @@ +<?php + +require_once __DIR__ . '/Anc.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; + +/** + * \file Pretraitement.class.inc + * \class Pretraitement + * + * \author WAB <support.wab@veremes.com>. + * + * \brief This file contains the Pretraitement php class + * + * This class defines operation for one Pretraitement + * + */ +class Pretraitement extends Anc { + + public $oError; + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties) { + $this->aValues = $aValues; + $this->aPath = $aPath; + $this->aProperties = $properties; + $this->oConnection = new Connection($this->aValues, $this->aProperties); + } + + /** + * @SWG\Get(path="/pretraitements/{id_pretraitement}", + * tags={"Pretraitements"}, + * summary="Get Pretraitement", + * description="Request to get Pretraitement by id", + * operationId="GET", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="id_pretraitement", + * in="path", + * description="id_pretraitement", + * required=true, + * type="integer", + * format="int32" + * ), + * @SWG\Parameter( + * name="attributs", + * in="query", + * description="list of attributs", + * required=false, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="Pretraitement Response", + * @SWG\Schema(ref="#/definitions/pretraitements") + * ) + * ) + */ + + /** + * get informations about mode + */ + function GET() { + $this->aFields = $this->getFields($this->aProperties['schema_anc'], "v_pretraitement", "id_pretraitement"); + // Url des fichiers. + $sWsDataUrl = $this->aProperties['web_server_name'] . '/' . $this->aProperties['ws_data_alias'] . '/anc/anc_saisie_anc_pretraitement/documents/' . $this->aValues["my_vitis_id"]; + if (!empty($this->aFields['photos_f'])) + $this->aFields['photos_f'] = $sWsDataUrl . '/photos_f/' . $this->aFields['photos_f']; + if (!empty($this->aFields['fiche_f'])) + $this->aFields['fiche_f'] = $sWsDataUrl . '/fiche_f/' . $this->aFields['fiche_f']; + if (!empty($this->aFields['schema_f'])) + $this->aFields['schema_f'] = $sWsDataUrl . '/schema_f/' . $this->aFields['schema_f']; + if (!empty($this->aFields['documents_f'])) + $this->aFields['documents_f'] = $sWsDataUrl . '/documents_f/' . $this->aFields['documents_f']; + if (!empty($this->aFields['plan_f'])) + $this->aFields['plan_f'] = $sWsDataUrl . '/plan_f/' . $this->aFields['plan_f']; + } + + /** + * delete a Point_situation + */ + function DELETE() { + $this->oConnection->oBd->delete($this->aProperties['schema_anc'], 'v_pretraitement', 'id_pretraitement', $this->aValues["my_vitis_id"], 'integer'); + if ($this->oConnection->oBd->enErreur()) { + $this->oError = new VitisError(1, $this->oConnection->oBd->getBDMessage()); + } else { + $this->aFields["id_pretraitement"] = $this->aValues["my_vitis_id"]; + } + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/anc/Pretraitements.class.inc b/vmap/vas/rest/ws/anc/Pretraitements.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..49be91d57e8f6266528f64cb5de79bf641317e0e --- /dev/null +++ b/vmap/vas/rest/ws/anc/Pretraitements.class.inc @@ -0,0 +1,320 @@ +<?php + +/** + * \file Pretraitements.class.inc + * \class Pretraitements + * + * \author WAB <support.wab@veremes.com>. + * + * \brief This file contains the Pretraitements php class + * + * This class defines Rest Api to Vitis Pretraitements + * + */ +require_once __DIR__ . '/Anc.class.inc'; +require_once 'Pretraitement.class.inc'; + + +class Pretraitements extends Anc { + /** + * @SWG\Definition( + * definition="/pretraitements", + * allOf={ + * @SWG\Schema(ref="#/definitions/pretraitements") + * } + * ) + * * @SWG\Tag( + * name="Pretraitements", + * description="Operations about Pretraitements" + * ) + */ + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + */ + function __construct($aPath, $aValues, $properties) { + $this->aValues = $aValues; + $this->aPath = $aPath; + $this->aProperties = $properties; + $this->oConnection = new Connection($this->aValues, $this->aProperties); + } + + /** + * @SWG\Get(path="/pretraitements", + * tags={"Pretraitements"}, + * summary="Get Pretraitements", + * description="Request to get Pretraitements", + * 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", + * 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="pretraitement Response", + * @SWG\Schema(ref="#/definitions/pretraitements") + * ) + * ) + */ + + /** + * get Pretraitements + * @return Pretraitements + */ + function GET() { + $aReturn = $this->genericGet($this->aProperties['schema_anc'], "v_pretraitement", "id_pretraitement"); + $sMessage = $aReturn['sMessage']; + return $sMessage; + } + + /** + * @SWG\Post(path="/pretraitements", + * tags={"Pretraitements"}, + * summary="Add pretraitement", + * description="Request to add Pretraitements", + * operationId="POST", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="pretraitement Response", + * @SWG\Schema(ref="#/definitions/pretraitements") + * ) + * ) + */ + + /** + * insert pretraitement + * @return id of the pretraitement created + */ + function POST() { + $this->aValues['create'] = $_SESSION["ses_Login"]; + $this->aValues['create_date'] = date('Y-m-d'); + // Sauve le nom des fichiers. + if (!empty($_FILES['photos_f'])) + $this->aValues['photos_f'] = $_FILES['photos_f']["name"]; + if (!empty($_FILES['fiche_f'])) + $this->aValues['fiche_f'] = $_FILES['fiche_f']["name"]; + if (!empty($_FILES['schema_f'])) + $this->aValues['schema_f'] = $_FILES['schema_f']["name"]; + if (!empty($_FILES['documents_f'])) + $this->aValues['documents_f'] = $_FILES['documents_f']["name"]; + if (!empty($_FILES['plan_f'])) + $this->aValues['plan_f'] = $_FILES['plan_f']["name"]; + // + $aDates = array('ptr_vi_date'); + foreach ($aDates as $sDate) { + if (isset($this->aValues[$sDate])) { + if ($this->aValues[$sDate] == '') + unset($this->aValues[$sDate]); + else + $this->aValues[$sDate] = date_format(date_create_from_format('d/m/Y', $this->aValues[$sDate]), 'Y-m-d'); + } + } + // + $aReturn = $this->genericPost($this->aProperties['schema_anc'], 'v_pretraitement', $this->aProperties['schema_anc'].'.pretraitement_id_pretraitement_seq', 'id_pretraitement'); + // Upload les fichiers. + $this->uploadDocument('photos_f', 'anc_saisie_anc_pretraitement'); + $this->uploadDocument('fiche_f', 'anc_saisie_anc_pretraitement'); + $this->uploadDocument('schema_f', 'anc_saisie_anc_pretraitement'); + $this->uploadDocument('documents_f', 'anc_saisie_anc_pretraitement'); + $this->uploadDocument('plan_f', 'anc_saisie_anc_pretraitement'); + // + return $aReturn['sMessage']; + } + + /** + * @SWG\Put(path="/pretraitements/{id_pretraitement}", + * tags={"Pretraitements"}, + * summary="update Pretraitements", + * description="Request to update Pretraitements", + * operationId="PUT", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="Pretraitement token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="id_pretraitement", + * in="path", + * description="id of the Pretraitements", + * required=true, + * type="integer", + * format = "int32" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/pretraitements") + * ) + * ) + */ + + /** + * update pretraitements + * @return id of pretraitements updated or error object if a pretraitements is not updated + */ + function PUT() { + if (empty($this->aValues['maj'])) + $this->aValues['maj'] = $_SESSION["ses_Login"]; + if (empty($this->aValues['maj_date'])) + $this->aValues['maj_date'] = date('Y-m-d'); + // Upload les fichiers. + $this->uploadDocument('photos_f', 'anc_saisie_anc_pretraitement'); + $this->uploadDocument('fiche_f', 'anc_saisie_anc_pretraitement'); + $this->uploadDocument('schema_f', 'anc_saisie_anc_pretraitement'); + $this->uploadDocument('documents_f', 'anc_saisie_anc_pretraitement'); + $this->uploadDocument('plan_f', 'anc_saisie_anc_pretraitement'); + // + $aDates = array('ptr_vi_date'); + foreach ($aDates as $sDate) { + if (isset($this->aValues[$sDate])) { + if ($this->aValues[$sDate] == '') + unset($this->aValues[$sDate]); + else + $this->aValues[$sDate] = date_format(date_create_from_format('d/m/Y', $this->aValues[$sDate]), 'Y-m-d'); + } + } + // + $aReturn = $this->genericPut($this->aProperties['schema_anc'], 'v_pretraitement', 'id_pretraitement'); + return $aReturn['sMessage']; + } + + /** + * @SWG\Delete(path="/pretraitements", + * tags={"Pretraitements"}, + * summary="delete Pretraitements", + * description="Request to delete Pretraitements", + * operationId="DELETE", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="idList", + * in="query", + * description="id of the pretraitement", + * required=true, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="pretraitement Response", + * @SWG\Schema(ref="#/definitions/pretraitements") + * ) + * ) + */ + /** + * @SWG\Delete(path="/pretraitements/{id_pretraitement}", + * tags={"Pretraitements"}, + * summary="delete Pretraitements", + * description="Request to delete Pretraitements", + * operationId="DELETE", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="Pretraitement token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="id_pretraitement", + * in="path", + * description="id of the Pretraitements", + * required=true, + * type="integer", + * format = "int32" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/pretraitements") + * ) + * ) + */ + + /** + * delete pretraitements + * @return id of pretraitements deleted or error object if a pretraitements is not deleted + */ + function DELETE() { + $aReturn = $this->genericDelete($this->aProperties['schema_anc'], 'v_pretraitement', 'id_pretraitement'); + return $aReturn['sMessage']; + } + + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/anc/Traitement.class.inc b/vmap/vas/rest/ws/anc/Traitement.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..b102f3740c2a3a38dc80af58dbc1e9532b32ab45 --- /dev/null +++ b/vmap/vas/rest/ws/anc/Traitement.class.inc @@ -0,0 +1,105 @@ +<?php + +require_once __DIR__ . '/Anc.class.inc'; +require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc'; + +/** + * \file Traitement.class.inc + * \class Traitement + * + * \author WAB <support.wab@veremes.com>. + * + * \brief This file contains the Traitement php class + * + * This class defines operation for one Traitement + * + */ +class Traitement extends Anc { + + public $oError; + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + * @param type $oConnection connection object + */ + function __construct($aPath, $aValues, $properties) { + $this->aValues = $aValues; + $this->aPath = $aPath; + $this->aProperties = $properties; + $this->oConnection = new Connection($this->aValues, $this->aProperties); + } + + /** + * @SWG\Get(path="/traitements/{id_traitement}", + * tags={"Traitements"}, + * summary="Get Traitement", + * description="Request to get Traitement by id", + * operationId="GET", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Parameter( + * name="id_traitement", + * in="path", + * description="id_traitement", + * required=true, + * type="integer", + * format="int32" + * ), + * @SWG\Parameter( + * name="attributs", + * in="query", + * description="list of attributs", + * required=false, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="Traitement Response", + * @SWG\Schema(ref="#/definitions/traitements") + * ) + * ) + */ + + /** + * get informations about mode + */ + function GET() { + $this->aFields = $this->getFields($this->aProperties['schema_anc'], "v_traitement", "id_traitement"); + // Url des fichiers. + $sWsDataUrl = $this->aProperties['web_server_name'] . '/' . $this->aProperties['ws_data_alias'] . '/anc/anc_saisie_anc_traitement/documents/' . $this->aValues["my_vitis_id"]; + if (!empty($this->aFields['photos_f'])) + $this->aFields['photos_f'] = $sWsDataUrl . '/photos_f/' . $this->aFields['photos_f']; + if (!empty($this->aFields['fiche_f'])) + $this->aFields['fiche_f'] = $sWsDataUrl . '/fiche_f/' . $this->aFields['fiche_f']; + if (!empty($this->aFields['schema_f'])) + $this->aFields['schema_f'] = $sWsDataUrl . '/schema_f/' . $this->aFields['schema_f']; + if (!empty($this->aFields['documents_f'])) + $this->aFields['documents_f'] = $sWsDataUrl . '/documents_f/' . $this->aFields['documents_f']; + if (!empty($this->aFields['plan_f'])) + $this->aFields['plan_f'] = $sWsDataUrl . '/plan_f/' . $this->aFields['plan_f']; + } + + /** + * delete a Point_situation + */ + function DELETE() { + $this->oConnection->oBd->delete($this->aProperties['schema_anc'], 'v_traitement', 'id_traitement', $this->aValues["my_vitis_id"], 'integer'); + if ($this->oConnection->oBd->enErreur()) { + $this->oError = new VitisError(1, $this->oConnection->oBd->getBDMessage()); + } else { + $this->aFields["id_traitement"] = $this->aValues["my_vitis_id"]; + } + } + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/anc/Traitements.class.inc b/vmap/vas/rest/ws/anc/Traitements.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..b4ce521c4d338e104365315babd03e478234e2b0 --- /dev/null +++ b/vmap/vas/rest/ws/anc/Traitements.class.inc @@ -0,0 +1,300 @@ +<?php + +/** + * \file Traitements.class.inc + * \class Traitements + * + * \author WAB <support.wab@veremes.com>. + * + * \brief This file contains the Traitements php class + * + * This class defines Rest Api to Vitis Traitements + * + */ +require_once __DIR__ . '/Anc.class.inc'; +require_once 'Traitement.class.inc'; + + +class Traitements extends Anc { + /** + * @SWG\Definition( + * definition="/traitements", + * allOf={ + * @SWG\Schema(ref="#/definitions/traitements") + * } + * ) + * * @SWG\Tag( + * name="Traitements", + * description="Operations about Traitements" + * ) + */ + + /** + * construct + * @param type $aPath url of the request + * @param type $aValues parameters of the request + * @param type $properties properties + */ + function __construct($aPath, $aValues, $properties) { + $this->aValues = $aValues; + $this->aPath = $aPath; + $this->aProperties = $properties; + $this->oConnection = new Connection($this->aValues, $this->aProperties); + } + + /** + * @SWG\Get(path="/traitements", + * tags={"Traitements"}, + * summary="Get Traitements", + * description="Request to get Traitements", + * 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", + * 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="traitement Response", + * @SWG\Schema(ref="#/definitions/traitements") + * ) + * ) + */ + + /** + * get Traitements + * @return Traitements + */ + function GET() { + $aReturn = $this->genericGet($this->aProperties['schema_anc'], "v_traitement", "id_traitement"); + $sMessage = $aReturn['sMessage']; + return $sMessage; + } + + /** + * @SWG\Post(path="/traitements", + * tags={"Traitements"}, + * summary="Add traitement", + * description="Request to add Traitements", + * operationId="POST", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="user token", + * required=true, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="traitement Response", + * @SWG\Schema(ref="#/definitions/traitements") + * ) + * ) + */ + + /** + * insert traitement + * @return id of the traitement created + */ + function POST() { + $this->aValues['create'] = $_SESSION["ses_Login"]; + $this->aValues['create_date'] = date('Y-m-d'); + // Sauve le nom des fichiers. + if (!empty($_FILES['photos_f'])) + $this->aValues['photos_f'] = $_FILES['photos_f']["name"]; + if (!empty($_FILES['fiche_f'])) + $this->aValues['fiche_f'] = $_FILES['fiche_f']["name"]; + if (!empty($_FILES['schema_f'])) + $this->aValues['schema_f'] = $_FILES['schema_f']["name"]; + if (!empty($_FILES['documents_f'])) + $this->aValues['documents_f'] = $_FILES['documents_f']["name"]; + if (!empty($_FILES['plan_f'])) + $this->aValues['plan_f'] = $_FILES['plan_f']["name"]; + // + $aReturn = $this->genericPost($this->aProperties['schema_anc'], 'v_traitement', $this->aProperties['schema_anc'].'.traitement_id_traitement_seq', 'id_traitement'); + // Upload les fichiers. + $this->uploadDocument('photos_f', 'anc_saisie_anc_traitement'); + $this->uploadDocument('fiche_f', 'anc_saisie_anc_traitement'); + $this->uploadDocument('schema_f', 'anc_saisie_anc_traitement'); + $this->uploadDocument('documents_f', 'anc_saisie_anc_traitement'); + $this->uploadDocument('plan_f', 'anc_saisie_anc_traitement'); + // + return $aReturn['sMessage']; + } + + /** + * @SWG\Put(path="/traitements/{id_traitement}", + * tags={"Traitements"}, + * summary="update Traitements", + * description="Request to update Traitements", + * operationId="PUT", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="Traitement token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="id_traitement", + * in="path", + * description="id of the Traitements", + * required=true, + * type="integer", + * format = "int32" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/traitements") + * ) + * ) + */ + + /** + * update traitements + * @return id of traitements updated or error object if a traitements is not updated + */ + function PUT() { + if (empty($this->aValues['maj'])) + $this->aValues['maj'] = $_SESSION["ses_Login"]; + if (empty($this->aValues['maj_date'])) + $this->aValues['maj_date'] = date('Y-m-d'); + // Upload les fichiers. + $this->uploadDocument('photos_f', 'anc_saisie_anc_traitement'); + $this->uploadDocument('fiche_f', 'anc_saisie_anc_traitement'); + $this->uploadDocument('schema_f', 'anc_saisie_anc_traitement'); + $this->uploadDocument('documents_f', 'anc_saisie_anc_traitement'); + $this->uploadDocument('plan_f', 'anc_saisie_anc_traitement'); + // + $aReturn = $this->genericPut($this->aProperties['schema_anc'], 'v_traitement', 'id_traitement'); + return $aReturn['sMessage']; + } + + /** + * @SWG\Delete(path="/traitements", + * tags={"Traitements"}, + * summary="delete Traitements", + * description="Request to delete Traitements", + * operationId="DELETE", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="idList", + * in="query", + * description="id of the traitement", + * required=true, + * type="string" + * ), + * @SWG\Response( + * response=200, + * description="traitement Response", + * @SWG\Schema(ref="#/definitions/traitements") + * ) + * ) + */ + /** + * @SWG\Delete(path="/traitements/{id_traitement}", + * tags={"Traitements"}, + * summary="delete Traitements", + * description="Request to delete Traitements", + * operationId="DELETE", + * produces={"application/xml", "application/json"}, + * @SWG\Parameter( + * name="token", + * in="query", + * description="Traitement token", + * required=true, + * type="string" + * ), + * * @SWG\Parameter( + * name="id_traitement", + * in="path", + * description="id of the Traitements", + * required=true, + * type="integer", + * format = "int32" + * ), + * @SWG\Response( + * response=200, + * description="Poprerties Response", + * @SWG\Schema(ref="#/definitions/traitements") + * ) + * ) + */ + + /** + * delete traitements + * @return id of traitements deleted or error object if a traitements is not deleted + */ + function DELETE() { + $aReturn = $this->genericDelete($this->aProperties['schema_anc'], 'v_traitement', 'id_traitement'); + return $aReturn['sMessage']; + } + + +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/anc/Versions.class.inc b/vmap/vas/rest/ws/anc/Versions.class.inc new file mode 100755 index 0000000000000000000000000000000000000000..55c1e16ad36587d48913f34c74e5f42aef2a2f39 --- /dev/null +++ b/vmap/vas/rest/ws/anc/Versions.class.inc @@ -0,0 +1,77 @@ +<?php + +require_once 'Anc.class.inc'; +/** +* \file versions.class.inc +* \class Versions +* +* \author Armand Bahi <armand.bahi@veremes.com>. +* +* \brief This file contains the Versions php class +* +* This class defines the rest api for versions +* +*/ +class Versions extends Anc{ + + /** + * @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("anc"); + //$this->aFields = $this->aVersions; + + // + $aXmlRacineAttribute['status']=1; + $sMessage = $this->asDocument('','vitis',$this->aValues['sEncoding'],True,$aXmlRacineAttribute,$this->aValues['sSourceEncoding'],$this->aValues['output']); + return $sMessage; + } +} + +?> \ No newline at end of file diff --git a/vmap/vas/rest/ws/anc/overview.phtml b/vmap/vas/rest/ws/anc/overview.phtml new file mode 100755 index 0000000000000000000000000000000000000000..9697daeff7a43c70f06f0e3f14ee5e4d7adcd9de --- /dev/null +++ b/vmap/vas/rest/ws/anc/overview.phtml @@ -0,0 +1,24 @@ +<?php +/** + * @SWG\Swagger( + * basePath="/[service_alias]/anc", + * host="[server]", + * schemes={"[protocol]"}, + * produces={ + * "application/json", + "application/xml", + "text/html" + * }, + * @SWG\Info( + * version="1.0.0", + * title="Anc Test Rest", + * description="All fetaures to access server operation for anc", + * ) + * ) + */ +?> + +<h1 class="titleOverview">Service Anc</h1> +<p> + <a class="linkOverview" href="javascript:sService='anc';LoadApi()">Anc</a>: this is the most comprehensive service which should be used as a preference when developing applications communicating with Anc. Those services allow you to administrate Anc applications. +</p> \ No newline at end of file