1 |
fraynaud |
178 |
<?php |
2 |
|
|
/** |
3 |
nhaye |
1785 |
* Classe permettant la mise en forme de chaque ligne de l'export SITADEL |
4 |
|
|
* Les méthode retourne des morceaux de lignes en faisant correspondre les valeurs |
5 |
|
|
* du dossier avec les valeurs définie pour l'export SITADEL |
6 |
fmichon |
1515 |
* |
7 |
|
|
* @package openfoncier |
8 |
|
|
* @version SVN : $Id$ |
9 |
fraynaud |
178 |
*/ |
10 |
|
|
|
11 |
|
|
class sitadel { |
12 |
|
|
|
13 |
nhaye |
1785 |
var $dossier; // identifiant du dossier à insérer dans l'export |
14 |
|
|
var $row; // Valeurs du dossier |
15 |
fraynaud |
184 |
var $val; // parametre par defaut |
16 |
|
|
var $parametre; //parametre dossier |
17 |
fraynaud |
190 |
var $DEBUG=0; // 1 = valeur |
18 |
fraynaud |
178 |
|
19 |
nhaye |
1785 |
/** |
20 |
|
|
* Constructeur, initialisation de l'attribut dossier |
21 |
|
|
* |
22 |
|
|
* @param dossier string identifiant du dossier à traiter |
23 |
|
|
*/ |
24 |
fraynaud |
178 |
function sitadel($dossier) { |
25 |
|
|
$this->dossier=$dossier; |
26 |
|
|
}// fin constructeur |
27 |
|
|
|
28 |
nhaye |
1785 |
/** |
29 |
|
|
* Permet de mettre en forme le début de chaque la ligne |
30 |
|
|
* |
31 |
|
|
* @param mouvement string DEPOT, DECISION, SUIVI, TRANSFERT, MODIFICATIF, SUPPRESSION |
32 |
|
|
* @param departement string non utilisé |
33 |
|
|
* @param commune string code commune du dossier |
34 |
|
|
* @param pf_departement string code du département du dossier |
35 |
|
|
* |
36 |
|
|
* @return string entete de la ligne |
37 |
|
|
*/ |
38 |
fraynaud |
193 |
function entete($mouvement, $departement, $commune,$pf_departement){ |
39 |
fraynaud |
178 |
// sitadel : mouv|typpermis|equivalence|dep|commune|andepnumpc|indmod |
40 |
nhaye |
1785 |
// l'equivalence n'est pas utilisée |
41 |
nhaye |
1797 |
$entete=$mouvement."|".$this->row['code']."|Vm|".$pf_departement.$departement."|".$commune."|".substr($this->dossier,8,2). |
42 |
|
|
"|".substr($this->dossier,10,5)."|".$this->row['version']."|"; |
43 |
fraynaud |
178 |
return $entete; |
44 |
|
|
} |
45 |
|
|
|
46 |
nhaye |
1785 |
/** |
47 |
|
|
* Permet de mettre en forme l'état civil : |
48 |
|
|
* personne morale / physique |
49 |
|
|
* société, siret, civilité, nom, prénom / civilité, nom, prénom |
50 |
|
|
* |
51 |
|
|
* @return string demandeur désigné |
52 |
|
|
*/ |
53 |
fraynaud |
178 |
function etatcivil(){ |
54 |
|
|
// etat civil demandeur |
55 |
|
|
// codemo| |
56 |
nhaye |
1797 |
if ($this->row['qualite'] == "particulier") { |
57 |
fraynaud |
178 |
$codemo=1;// personne physique |
58 |
nhaye |
1797 |
} else { |
59 |
|
|
$codemo=2;// personne morale |
60 |
|
|
} |
61 |
fraynaud |
178 |
$etatcivil=$codemo."|"; // 1 personne physique ; 2 sinon |
62 |
|
|
// openfoncier civilite (5/8 ok), nom (80/30-> substr), societe (80/50->substr) |
63 |
|
|
// civpart|prenompart|nompart|denopm|rspm|siret|catjur|civrep|prenomrep|nomrep| |
64 |
|
|
// suivant codemo = 1 (personne physique) ou 2 (personne morale) |
65 |
|
|
// demandeur_civilite n est pas normalise Madame ou Monsieur |
66 |
nhaye |
1797 |
if ($codemo == 1) { |
67 |
fraynaud |
185 |
// *civpart*|*prenompart*|nompart|||||| |
68 |
nhaye |
1797 |
$etatcivil.= $this->maj(substr($this->row['civilite_pp'],0,8))."|"; |
69 |
|
|
$etatcivil.= $this->maj(substr($this->row['pp_particulier_prenom'],0,30))."|"; |
70 |
|
|
|
71 |
|
|
$etatcivil.= $this->maj(substr($this->row['pp_particulier_nom'],0,30))."||||||||"; |
72 |
|
|
} else { |
73 |
fraynaud |
186 |
//denopm|*rspm*|*siret*|*catjur*|*civrep*|*prenomrep*|nomrep| |
74 |
|
|
$etatcivil.="|||"; // codemo=1 |
75 |
nhaye |
1797 |
$etatcivil.=$this->maj(substr($this->row['pp_personne_morale_denomination'],0,50))."|"; |
76 |
|
|
$etatcivil.=$this->maj(substr($this->row['pp_personne_morale_raison_sociale'],0,30))."|"; |
77 |
|
|
$etatcivil.=$this->maj(substr($this->row['pp_personne_morale_siret'],0,14))."|"; |
78 |
|
|
$etatcivil.=$this->maj(substr($this->row['pp_personne_morale_categorie_juridique'],0,4))."|"; |
79 |
|
|
$etatcivil.=$this->maj(substr($this->row['civilite_pm_libelle'],0,8))."|"; |
80 |
|
|
$etatcivil.=$this->maj(substr($this->row['pp_personne_morale_prenom'],0,30))."|"; |
81 |
|
|
$etatcivil.=$this->maj(substr($this->row['pp_personne_morale_nom'],0,30))."|"; |
82 |
fraynaud |
178 |
} |
83 |
|
|
return $etatcivil; |
84 |
|
|
} |
85 |
|
|
|
86 |
|
|
function adresse(){ |
87 |
|
|
// openfoncier : adresse (80/ 26+38 -> substr sur 2 zones) - cp (5/5 OK) - ville (30/36 -> OK) |
88 |
|
|
// *numvoiemo*|*typvoiemo*|libvoiemo|lieuditmo(+)|communemo|codposmo|*bpmo*|*cedexmo*|*paysmo*|*divetermo| |
89 |
fraynaud |
186 |
$adresse=""; |
90 |
nhaye |
1797 |
$adresse.= $this->maj(substr($this->row['pp_numero'],0,5))."|"; |
91 |
|
|
$adresse.= $this->maj(substr("",0,5))."|"; |
92 |
|
|
$adresse.= $this->maj(substr($this->row['pp_voie'],0,26))."|"; |
93 |
|
|
$adresse.= $this->maj(substr($this->row['pp_lieu_dit'],0,38))."|"; |
94 |
|
|
$adresse.= $this->maj(substr($this->row['pp_localite'],0,32))."|"; |
95 |
|
|
$adresse.= $this->maj(substr($this->row['pp_code_postal'],0,5))."|"; |
96 |
|
|
$adresse.= $this->maj(substr($this->row['pp_bp'],0,5))."|"; |
97 |
|
|
$adresse.= $this->maj(substr($this->row['pp_cedex'],0,5))."|"; |
98 |
|
|
$adresse.= $this->maj(substr($this->row['pp_pays'],0,3))."|"; |
99 |
|
|
$adresse.= $this->maj(substr($this->row['pp_division_territoriale'],0,38))."|"; |
100 |
|
|
|
101 |
fraynaud |
187 |
return $adresse; |
102 |
fraynaud |
178 |
} |
103 |
|
|
|
104 |
|
|
|
105 |
|
|
function delegataire(){ |
106 |
|
|
// openFoncier civilite (non normalise monsieur/madame), nom (80/30 substr) |
107 |
|
|
// openfoncier : adresse (80/ 26+38 -> substr sur 2 zones) - cp (5/5 OK) - ville (30/32 -> OK) |
108 |
fraynaud |
186 |
// *civtiers*|*prenomtier*|nomtier|*numvoietiers*|*typvoietiers*| |
109 |
fraynaud |
178 |
// libvoietiers|lieudittier|communetier|codpostier |
110 |
|
|
// |*bptier*|*cedextier*|*paystier*|*divtertier*| |
111 |
|
|
$delegataire=""; |
112 |
nhaye |
1797 |
$delegataire.= $this->maj(substr($this->row['civilite_delegataire_libelle'],0,8))."|"; |
113 |
|
|
$delegataire.= $this->maj(substr($this->row['delegataire_particulier_prenom'],0,30))."|"; |
114 |
|
|
$delegataire.= $this->maj(substr($this->row['delegataire_particulier_nom'],0,30))."|"; |
115 |
|
|
$delegataire.= $this->maj(substr($this->row['delegataire_numero'],0,5))."|"; |
116 |
|
|
$delegataire.= $this->maj(substr("",0,5))."|"; |
117 |
|
|
$delegataire.= $this->maj(substr($this->row['delegataire_voie'],0,26))."|"; |
118 |
|
|
$delegataire.= $this->maj(substr($this->row['delegataire_lieu_dit'],0,38))."|"; |
119 |
|
|
$delegataire.= $this->maj(substr($this->row['delegataire_localite'],0,32))."|"; |
120 |
|
|
$delegataire.= $this->maj(substr($this->row['delegataire_code_postal'],0,5))."|"; |
121 |
|
|
$delegataire.= $this->maj(substr($this->row['delegataire_bp'],0,5))."|"; |
122 |
|
|
$delegataire.= $this->maj(substr($this->row['delegataire_cedex'],0,5))."|"; |
123 |
|
|
$delegataire.= $this->maj(substr($this->row['delegataire_pays'],0,3))."|"; |
124 |
|
|
$delegataire.= $this->maj(substr($this->row['delegataire_division_territoriale'],0,38))."|"; |
125 |
fraynaud |
187 |
return $delegataire; |
126 |
|
|
} |
127 |
|
|
|
128 |
|
|
function meltel($mouvement){ |
129 |
fraynaud |
178 |
// sitadel : telmo|melmo| |
130 |
fraynaud |
187 |
$meltel=""; |
131 |
|
|
if($mouvement != "Transfert") |
132 |
nhaye |
1797 |
$meltel.=$this->maj(substr($this->row['pp_telephone_fixe'],0,5))."|"; |
133 |
|
|
$meltel.= $this->maj(substr($this->row['pp_courriel'],0,5))."|"; |
134 |
|
|
// suivi electronique |
135 |
|
|
// Il n'y a pas de notification par mail gérée dans l'appli |
136 |
|
|
/*if($this->row['delegataire']=='Oui'){ |
137 |
fraynaud |
187 |
$meltel.= "1"; |
138 |
|
|
}else{ |
139 |
|
|
$meltel.= "0"; |
140 |
nhaye |
1797 |
}*/ |
141 |
fraynaud |
193 |
// suivi -> fin enr pour transfert (sans |) |
142 |
fraynaud |
187 |
if($mouvement != "Transfert") |
143 |
fraynaud |
190 |
$meltel.= "|"; |
144 |
fraynaud |
187 |
return $meltel; |
145 |
fraynaud |
193 |
} |
146 |
fraynaud |
178 |
|
147 |
|
|
function adresse_terrain(){ |
148 |
|
|
// openfoncier numero (4/5 substr), adresse(80, 26 +38 -> substr), complement (non utilise (80)), cp (5/5 ok), ville (30/32 ok) |
149 |
fraynaud |
187 |
// sitadel : |numvoiete|*typvoiete*|libvoiete|lieudite|communete|codposte|*bpte*|*cedexte*| |
150 |
|
|
// mettre le | en debut pour info du 2eme groupe (suite 1er groupe) |
151 |
fraynaud |
193 |
$adresse=""; |
152 |
nhaye |
1797 |
$adresse.= $this->maj(substr($this->row['dossier_terrain_adresse_voie_numero'],0,5))."|"; |
153 |
|
|
$adresse.= $this->maj(substr("",0,5))."|"; |
154 |
|
|
$adresse.= $this->maj(substr($this->row['dossier_complement'],0,26))."|"; |
155 |
|
|
$adresse.= $this->maj(substr($this->row['dossier_terrain_adresse_lieu_dit'],0,38))."|"; |
156 |
|
|
$adresse.= $this->maj(substr($this->row['dossier_terrain_adresse_localite'],0,32))."|"; |
157 |
|
|
$adresse.= $this->maj(substr($this->row['dossier_terrain_adresse_code_postal'],0,5))."|"; |
158 |
|
|
$adresse.= $this->maj(substr($this->row['dossier_terrain_adresse_bp'],0,5))."|"; |
159 |
|
|
$adresse.= $this->maj(substr($this->row['dossier_terrain_adresse_cedex'],0,5))."|"; |
160 |
|
|
|
161 |
fraynaud |
178 |
return $adresse; |
162 |
|
|
} |
163 |
|
|
|
164 |
|
|
function parcelle(){ |
165 |
|
|
// ======== |
166 |
|
|
// parcelle |
167 |
|
|
// ======== |
168 |
|
|
// cadastre 3 parcelles + 3 sections |
169 |
|
|
// openfoncier = 1 seule parcelle (6/3+5) |
170 |
|
|
// sitadel : scadastre1|ncadastre1|*scadastre2*|*ncadastre2*|*scadastre3*|*ncadastre3*| |
171 |
nhaye |
1797 |
$parcelle = ""; |
172 |
|
|
$numero = ""; |
173 |
|
|
if ($this->row['dossier_terrain_references_cadastrales'] != "" ) { |
174 |
|
|
$tab_parcelles = $this->parseParcelles($this->row['dossier_terrain_references_cadastrales']); |
175 |
|
|
} else { |
176 |
|
|
$parcelle.= $this->p('scadastre1')."|".$this->p('ncadastre1')."|"; |
177 |
|
|
} |
178 |
|
|
|
179 |
fraynaud |
186 |
$parcelle.= $this->p('scadastre2')."|".$this->p('ncadastre2')."|"; |
180 |
|
|
$parcelle.= $this->p('scadastre3')."|".$this->p('ncadastre3')."|"; |
181 |
fraynaud |
178 |
return $parcelle; |
182 |
|
|
} |
183 |
|
|
|
184 |
nhaye |
1797 |
/** |
185 |
|
|
* Permet de calculer la liste des parcelles à partir de la chaîne passée en paramètre |
186 |
|
|
* et la retourner sous forme d'un tableau associatif |
187 |
|
|
* @param string $strParcelles chaîne de la parcelles |
188 |
|
|
* @return array (array(quartier, section, parcelle), ...) |
189 |
|
|
*/ |
190 |
|
|
function parseParcelles($strParcelles) { |
191 |
|
|
// Séparation des lignes |
192 |
|
|
$references = explode(";", $strParcelles); |
193 |
|
|
$liste_parcelles = array(); |
194 |
|
|
// On boucle sur chaque ligne pour ajouter la liste des parcelles de chaque ligne |
195 |
|
|
foreach ($references as $parcelles) { |
196 |
|
|
// On transforme la chaîne de la ligne de parcelles en tableau |
197 |
|
|
$ref = str_split($parcelles); |
198 |
|
|
// Les 1er caractères sont numériques |
199 |
|
|
$num = true; |
200 |
|
|
// Tableau des champs de la ligne de références cadastrales |
201 |
|
|
$reference_tab = array(); |
202 |
|
|
$temp = ""; |
203 |
|
|
foreach ($ref as $carac) { |
204 |
|
|
// Permet de tester si le caractère courant est de même type que le précédent |
205 |
|
|
if(is_numeric($carac) === $num) { |
206 |
|
|
$temp .= $carac; |
207 |
|
|
} else { |
208 |
|
|
// Bascule |
209 |
|
|
$num = !$num; |
210 |
|
|
// On stock le champ |
211 |
|
|
$reference_tab[] = $temp; |
212 |
|
|
// re-init de la valeur temporaire pour le champ suivant |
213 |
|
|
$temp = $carac; |
214 |
|
|
} |
215 |
|
|
} |
216 |
|
|
// Stockage du dernier champ sur lequel il n'y a pas eu de bascule |
217 |
|
|
$reference_tab[] = $temp; |
218 |
|
|
|
219 |
|
|
// Calcul des parcelles |
220 |
|
|
$quartier = $reference_tab[0]; |
221 |
|
|
$sect = $reference_tab[1]; |
222 |
|
|
|
223 |
|
|
for ($i=2; $i < count($reference_tab); $i+=2) { |
224 |
|
|
$parc["quartier"] = $quartier; |
225 |
|
|
$parc["section"] = $sect; |
226 |
|
|
if(!isset($ancien_ref_parc) OR $reference_tab[$i-1] == "/") { |
227 |
|
|
// 1ere parcelle ou parcelle individuelle |
228 |
|
|
$parc["parcelle"] = $reference_tab[$i]; |
229 |
|
|
// Ajout d'une parcelle à la liste |
230 |
|
|
$liste_parcelles[] = $parc; |
231 |
|
|
} elseif ($reference_tab[$i-1] == "A") { |
232 |
|
|
// Interval de parcelles |
233 |
|
|
for ($j=$ancien_ref_parc+1; $j <= $reference_tab[$i]; $j++) { |
234 |
|
|
$parc["parcelle"] = $j; |
235 |
|
|
// Ajout d'une parcelle à la liste |
236 |
|
|
$liste_parcelles[] = $parc; |
237 |
|
|
} |
238 |
|
|
} |
239 |
|
|
// Sauvegarde de la référence courante de parcelle |
240 |
|
|
$ancien_ref_parc = $reference_tab[$i]; |
241 |
|
|
} |
242 |
|
|
} |
243 |
|
|
return $liste_parcelles; |
244 |
|
|
} |
245 |
|
|
|
246 |
fraynaud |
200 |
function decision_groupe1($avis_sitadel, $avis_sitadel_motif,$structure){ |
247 |
|
|
$decision= $structure.'|'; // au nom de la commune |
248 |
fraynaud |
178 |
$decision.= $avis_sitadel."|"; |
249 |
|
|
// date au format francais 8 caracteres |
250 |
|
|
$decision.= substr($this->row['date_decision'],8,2).''. |
251 |
|
|
substr($this->row['date_decision'],5,2)."". |
252 |
|
|
substr($this->row['date_decision'],0,4)."|"; |
253 |
fraynaud |
193 |
$decision.= $avis_sitadel_motif."|"; |
254 |
fraynaud |
178 |
return $decision; |
255 |
|
|
} |
256 |
|
|
|
257 |
fraynaud |
187 |
function terrain(){ |
258 |
|
|
$contenu=""; |
259 |
|
|
$contenu= floor($this->row['terrain_surface'])."|"; |
260 |
|
|
return $contenu; |
261 |
|
|
} |
262 |
|
|
|
263 |
fraynaud |
179 |
function amenagement(){ |
264 |
|
|
// renseignement du groupe 2 *** |
265 |
fraynaud |
187 |
// lotissement|zac|afu| |
266 |
fraynaud |
190 |
$contenu=""; |
267 |
fraynaud |
179 |
if($this->row['amenagement']!='') |
268 |
|
|
$contenu.= "1|"; |
269 |
|
|
else |
270 |
fraynaud |
190 |
$contenu.= "0|"; |
271 |
fraynaud |
186 |
$contenu.= $this->p('zac')."|".$this->p('afu')."|"; |
272 |
fraynaud |
179 |
return $contenu; |
273 |
|
|
} |
274 |
|
|
|
275 |
fraynaud |
187 |
function travaux($travaux, $lascot,$mouvement){ |
276 |
|
|
// libnattrav| ou libmotif dans MODIFICATIF |
277 |
fraynaud |
179 |
$contenu=$this->maj($travaux)."|"; |
278 |
fraynaud |
187 |
// natproj| innexistant en MODIFICATIF |
279 |
|
|
if($mouvement != "Modificatif"){ |
280 |
|
|
if($lascot=='1' |
281 |
|
|
or $lascot=='2' |
282 |
|
|
or $lascot=='3') |
283 |
|
|
$contenu.= $lascot."|"; // natproj 1:construction 2:extension ou 3:surelevation |
284 |
|
|
else |
285 |
|
|
$contenu.= "|"; |
286 |
|
|
} |
287 |
|
|
// INITIAL (ou TRANSFERT)natdp|nattrav|*annexe*|*nivmax* |
288 |
|
|
// MODIFICATIF nattrav|*annexe*|*nivmax* |
289 |
|
|
if($mouvement != "Modificatif"){ |
290 |
|
|
$natdp='00000'; |
291 |
|
|
if($lascot=='1') $natdp="10000"; // nouvelle construction |
292 |
|
|
if($lascot=='2') $natdp="01000"; // travaux sur construction existante |
293 |
|
|
if($lascot=='3') $natdp="01000"; // |
294 |
|
|
if($lascot=='X') $natdp="00001"; // cloture |
295 |
|
|
$contenu.= $natdp."|"; |
296 |
|
|
} |
297 |
fraynaud |
179 |
// nattrav |
298 |
|
|
$nattrav = "0000"; |
299 |
|
|
if($lascot=='2') $nattrav="1000"; |
300 |
|
|
if($lascot=='3') $nattrav="0100"; |
301 |
|
|
$contenu.= $nattrav."|"; |
302 |
|
|
// annexe non renseigner defaut 00000 |
303 |
fraynaud |
186 |
$contenu.= $this->p('annexe')."|"; |
304 |
fraynaud |
179 |
//nivmax non saisi |
305 |
fraynaud |
186 |
$contenu.=$this->p('nivmax')."|"; |
306 |
fraynaud |
179 |
return $contenu; |
307 |
|
|
} |
308 |
fraynaud |
178 |
|
309 |
fraynaud |
179 |
function destination($shon){ |
310 |
|
|
$contenu=""; |
311 |
|
|
for($i=1;$i<=9;$i++){ |
312 |
|
|
if(!isset($shon[$i])) $shon[$i]=0; |
313 |
|
|
$contenu.=$shon[$i].'|'; |
314 |
|
|
|
315 |
|
|
} |
316 |
|
|
return $contenu; |
317 |
|
|
} |
318 |
fraynaud |
178 |
|
319 |
fraynaud |
187 |
function descriptif($mouvement){ |
320 |
fraynaud |
179 |
// cpublic : non renseignee N par defaut |
321 |
|
|
// O/N transport/enseignement/sante/social/special/culture |
322 |
fraynaud |
184 |
|
323 |
fraynaud |
187 |
$contenu= $this->p('cpublic')."|"; //* supp| |
324 |
fraynaud |
179 |
// nblogdem |
325 |
fraynaud |
187 |
if($mouvement != "Modificatif"){ |
326 |
|
|
$contenu.= $this->row['logement_nombre']."|"; |
327 |
|
|
} |
328 |
fraynaud |
179 |
// nbmaison : nombre de maison |
329 |
fraynaud |
187 |
$contenu.= $this->p('nbmaison')."|"; |
330 |
fraynaud |
179 |
// nblogcoll : nombre de logement collectif |
331 |
fraynaud |
187 |
$contenu.= $this->p('nblogcoll')."|"; |
332 |
fraynaud |
179 |
// nbtotlog : nombre de logement total |
333 |
fraynaud |
187 |
$contenu.= $this->p('nbtotlog')."|"; |
334 |
fraynaud |
179 |
// natres : nature des residences |
335 |
|
|
// O/N 1=ages, 2=etudiant, 3=tourisme, 4=hotel, 5=social, 6= handicap, 7=autres |
336 |
fraynaud |
187 |
$contenu.= $this->p('natres')."|"; |
337 |
fraynaud |
179 |
// libres= si autre residence (long max 1000 c) |
338 |
fraynaud |
187 |
$contenu.= $this->p('libres')."|"; |
339 |
fraynaud |
179 |
// util : O/N personnel, principale, secondaire, vente, location |
340 |
fraynaud |
187 |
$contenu.= $this->p('util')."|"; |
341 |
fraynaud |
184 |
//chambre |
342 |
fraynaud |
187 |
$contenu.= $this->p('chambre')."|"; |
343 |
fraynaud |
179 |
// nb logement sociaux |
344 |
fraynaud |
187 |
$contenu.= $this->p('finis')."|"; |
345 |
fraynaud |
179 |
// nb logt financt aides |
346 |
fraynaud |
187 |
$contenu.= $this->p('finaa')."|"; |
347 |
fraynaud |
179 |
// nb de logt pret a taux 0 |
348 |
fraynaud |
187 |
$contenu.= $this->p('finptz')."|"; |
349 |
fraynaud |
179 |
// nb de logt finances autrt |
350 |
fraynaud |
187 |
$contenu.= $this->p('finaf')."|"; |
351 |
fraynaud |
179 |
// nb pieces en maison individuelle |
352 |
fraynaud |
187 |
if($mouvement != "Modificatif") |
353 |
|
|
$contenu.= $this->row['piece_nombre']."|"; // voir si 0 |
354 |
fraynaud |
179 |
// chambre (num capacite accueil locaux hebergement) |
355 |
fraynaud |
184 |
// $contenu.= "|"; |
356 |
fraynaud |
179 |
// nb de logement 1piece |
357 |
fraynaud |
187 |
$contenu.= $this->p('piec1')."|"; |
358 |
fraynaud |
179 |
// nb de logement 2 pieces |
359 |
fraynaud |
187 |
$contenu.= $this->p('piec2')."|"; |
360 |
fraynaud |
179 |
// nb de logement 3 pieces |
361 |
fraynaud |
187 |
$contenu.= $this->p('piec3')."|"; |
362 |
fraynaud |
179 |
// nb de logement 4 pieces |
363 |
fraynaud |
187 |
$contenu.= $this->p('piec4')."|"; |
364 |
fraynaud |
179 |
// nb de logement 5 pieces |
365 |
fraynaud |
187 |
$contenu.= $this->p('piec5')."|"; |
366 |
fraynaud |
179 |
// nb de logement 6 pieces |
367 |
fraynaud |
187 |
$contenu.= $this->p('piec6'); |
368 |
|
|
// (derniere zone decision et modificatif) |
369 |
fraynaud |
179 |
return $contenu; |
370 |
|
|
} |
371 |
|
|
|
372 |
fraynaud |
181 |
function chantier(){ |
373 |
fraynaud |
186 |
//datereoc| |
374 |
fraynaud |
181 |
$suivi1=""; |
375 |
fraynaud |
186 |
$suivi1.=substr($this->row['date_chantier'],8,2).substr($this->row['date_chantier'],5,2). |
376 |
|
|
substr($this->row['date_chantier'],0,4)."|"; // *** au format francais |
377 |
|
|
//nblogoc|nbmaisoc|nbcolloc| |
378 |
|
|
$suivi1.=$this->p('nblogoc')."|".$this->p('nbmaisoc')."|".$this->p('nbcolloc')."|"; |
379 |
|
|
//shonoc| |
380 |
|
|
$suivi1.=floor($this->row['shon'])."|"; // ok *** enlever les decimales |
381 |
|
|
//*finisoc*|*finaaoc*|*finptzoc*|*finafoc|*indoc*| |
382 |
|
|
$suivi1.=$this->p('finisoc')."|".$this->p('finaaoc')."|". |
383 |
|
|
$this->p('finptzoc')."|".$this->p('finafoc')."|".$this->p('indoc')."|"; |
384 |
|
|
$suivi1.="|||||||||||"; // achevement 11| |
385 |
fraynaud |
193 |
return $suivi1; |
386 |
fraynaud |
181 |
} |
387 |
fraynaud |
179 |
|
388 |
fraynaud |
181 |
function achevement(){ |
389 |
fraynaud |
186 |
$suivi2="||||||||||"; // occupation 10 | |
390 |
|
|
//datereat| |
391 |
fraynaud |
200 |
$suivi2.=substr($this->row['date_achevement'],8,2). |
392 |
|
|
substr($this->row['date_achevement'],5,2). |
393 |
fraynaud |
186 |
substr($this->row['date_achevement'],0,4)."|"; // ok *** au format francais |
394 |
|
|
//nblogat|nbmaisat|nbcollat| |
395 |
|
|
$suivi2.=$this->p('nblogat')."|".$this->p('nbmaisat')."|".$this->p('nbcollat')."|"; |
396 |
|
|
//shonat| |
397 |
|
|
$suivi2.=floor($this->row['shon'])."|"; // ok *** enlever les decimales |
398 |
|
|
//finisat|finaaat|finptzat|finafat|indat| |
399 |
|
|
$suivi2.=$this->p('finisat')."|".$this->p('finaaat')."|".$this->p('finptzat'). |
400 |
|
|
"|".$this->p('finafat')."|".$this->p('indat')."|"; |
401 |
fraynaud |
181 |
// Finchantier 1 si etat=cloturer sinon 0 |
402 |
|
|
if ($this->row['etat']=="cloturer"){ |
403 |
|
|
$suivi2.="1|"; |
404 |
|
|
}else{ |
405 |
|
|
$suivi2.="0|"; |
406 |
|
|
} |
407 |
fraynaud |
184 |
// Origat 1 par defaut |
408 |
|
|
$suivi2.=$this->p('origat'); |
409 |
fraynaud |
181 |
return $suivi2; |
410 |
|
|
} |
411 |
fraynaud |
184 |
|
412 |
|
|
function p($champ){ |
413 |
fraynaud |
186 |
if($this->DEBUG==2) return $champ; |
414 |
fraynaud |
184 |
if(isset($this->parametre[$champ])){ |
415 |
|
|
return $this->parametre[$champ]; |
416 |
|
|
}else |
417 |
|
|
return $this->val[$champ]; |
418 |
|
|
} |
419 |
|
|
|
420 |
fraynaud |
178 |
function maj($val) { |
421 |
|
|
$val = strtoupper($val); |
422 |
|
|
$val=str_replace(chr(195), "", $val); // supprime le premier code des accents en UTF-8 |
423 |
|
|
$s = array('/[âàäÀ]/', '/[éêèëÉÈ]/', '/[îï]/', '/[ôöÔ]/', '/[ûùü]/', '/[çÇ]/', '/\'|\"|^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\-\s\r/'); |
424 |
|
|
$r = array('A', 'E', 'I', 'O', 'U', 'C', ' '); |
425 |
|
|
$val = preg_replace($s , $r, $val); |
426 |
nhaye |
1797 |
// Formatage des valeurs manquantes |
427 |
|
|
return $this->testVM($val); |
428 |
fraynaud |
178 |
} |
429 |
nhaye |
1797 |
|
430 |
|
|
/** |
431 |
|
|
* Permet de tester si la valeur est manquante et retourner Vm |
432 |
|
|
* sinon retourne le champ |
433 |
|
|
* |
434 |
|
|
* @param string $champ champ à tester |
435 |
|
|
* @return string valeur à insérer dans l'export |
436 |
|
|
*/ |
437 |
|
|
function testVM($champ) { |
438 |
|
|
if ( $champ == "" ) { |
439 |
|
|
return "Vm"; |
440 |
|
|
} else { |
441 |
|
|
return $champ; |
442 |
|
|
} |
443 |
|
|
} |
444 |
fraynaud |
178 |
} |
445 |
fmichon |
1515 |
|
446 |
fraynaud |
178 |
?> |