Subversion Repositories eFlore/Applications.coel

Rev

Rev 1706 | Rev 1709 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1706 Rev 1708
Line 17... Line 17...
17
		'csc_mark_acquisition_collection', 'csc_mark_acquisition_echantillon',
17
		'csc_mark_acquisition_collection', 'csc_mark_acquisition_echantillon',
18
		'cs_latitude', 'cs_longitude',
18
		'cs_latitude', 'cs_longitude',
19
	);
19
	);
Line 20... Line 20...
20
 
20
 
21
	// ATTENTION : tjrs garder la table principale en premier, puis mettre les tables spécialisées.
21
	// ATTENTION : tjrs garder la table principale en premier, puis mettre les tables spécialisées.
22
	static $tables = array(	120 => array(
22
    protected $tables = array(	120 => array(
23
        'nom' => 'coel_structure', 
23
        'nom' => 'coel_structure', 
24
        'prefixe' => 'cs', 
24
        'prefixe' => 'cs', 
25
        'id' => array('cs_id_structure')),
25
        'id' => array('cs_id_structure')),
26
    122 => array(
26
    122 => array(
Line 244... Line 244...
244
				$this->ajouterGuid($params['cpr_abreviation'], $id_structure);
244
				$this->ajouterGuid($params['cpr_abreviation'], $id_structure);
245
			}
245
			}
246
		} catch (PDOException $e) {
246
		} catch (PDOException $e) {
247
			$this->messages[] = sprintf($this->getTxt('sql_erreur'), $e->getFile(), $e->getLine(), $e->getMessage(), $requete);
247
			$this->messages[] = sprintf($this->getTxt('sql_erreur'), $e->getFile(), $e->getLine(), $e->getMessage(), $requete);
248
		}
248
		}
249
		
249
 
-
 
250
		if($form_needs_refresh) { // coordonnées mises à jour en DB: en informer le formulaire
-
 
251
			$this->envoyer($this->getElementParDefaut(array('id_structure' => $id_structure)));
-
 
252
			exit;
-
 
253
		}
-
 
254
	
250
		$this->envoyer($id_structure);
255
		$this->envoyer($id_structure);
251
	}
256
	}
Line 252... Line 257...
252
 
257
 
253
	/**
258
	/**
Line 361... Line 366...
361
            ' WHERE cc_ce_structure = %d GROUP BY cc_ce_structure ',
366
            ' WHERE cc_ce_structure = %d GROUP BY cc_ce_structure ',
362
            $id_structure))->fetchColumn() != 0);
367
            $id_structure))->fetchColumn() != 0);
363
	}
368
	}
Line 364... Line 369...
364
 
369
 
-
 
370
	static function callNominatim(&$params) {
365
	static function callNominatim(&$params) {
371
		if (
366
		if ( (! @$params['cs_latitude'] || ! @$params['cs_longitude']) &&
372
            (! @$params['cs_latitude'] || ! @$params['cs_longitude']) &&
367
		(@$params['cs_adresse_01'] || @$params['cs_code_postal'] || @$params['cs_ville']) ) {
373
            (@$params['cs_adresse_01'] || @$params['cs_code_postal'] || @$params['cs_ville']) ) {
368
			$lonlat = array();
374
			$lonlat = array();
369
			if(Coel::coordGuess(Coel::addrReStruct($params), $lonlat)) {
375
			if(Coel::coordGuess(Coel::addrReStruct($params), $lonlat)) {
370
				$params['cs_latitude'] = $lonlat['lat'];
376
				$params['cs_latitude'] = $lonlat['lat'];
371
				$params['cs_longitude'] = $lonlat['lon'];
377
				$params['cs_longitude'] = $lonlat['lon'];
372
				$form_needs_refresh = TRUE;
378
				return TRUE;
373
			}
379
			}
374
		}
380
		}
375
		return FALSE;
381
		return FALSE;
Line 376... Line 382...
376
	}
382
	}
377
	
383
	
378
	private function ajouterGuid($abr_projet, $id_structure) {
384
	private function ajouterGuid($abr_projet, $id_structure) {
379
		if ($id_structure !== false) {
385
		if ($id_structure !== false) {
380
			$table_guid = self::$tables[120];
386
			$table_guid = $this->tables[120];
381
			$table_guid['champs_valeurs_id']['cs_id_structure'] = $id_structure;
387
			$table_guid['champs_valeurs_id']['cs_id_structure'] = $id_structure;
382
			$table_guid['champs_valeurs_protege']['cs_guid'] = $this->bdd->quote(sprintf($this->config['coel']['guid'], $abr_projet, 'str'.$id_structure));
388
			$table_guid['champs_valeurs_protege']['cs_guid'] = $this->bdd->quote(sprintf($this->config['coel']['guid'], $abr_projet, 'str'.$id_structure));
383
			$this->modifier($table_guid);
389
			$this->modifier($table_guid);