Subversion Repositories eFlore/Applications.cel

Rev

Rev 1520 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1520 Rev 1523
Line 2... Line 2...
2
class Dao extends Bdd {
2
class Dao extends Bdd {
Line 3... Line 3...
3
	
3
	
Line 4... Line 4...
4
	private $temps_derniere_requete = 0;
4
	private $temps_derniere_requete = 0;
5
	
5
	
6
	public function rechercherCoordonnees() {
6
	public function rechercherCoordonnees() {
7
		$requete = "SELECT longitude, latitude
7
		$requete = "SELECT longitude, latitude ".
8
					FROM `cel_obs`
8
			"FROM cel_obs ".
9
					GROUP BY `longitude` , `latitude`";
9
			"GROUP BY longitude , latitude ";
10
		$resultat = $this->recupererTous($requete);
10
		$resultat = $this->recupererTous($requete);
11
		$this->reinitialiserTempsDerniereRequete();
11
		$this->reinitialiserTempsDerniereRequete();
Line 12... Line 12...
12
		return $resultat;
12
		return $resultat;
13
	}
13
	}
14
	
14
	
15
	public function rechercherCoordonneesSansCorrespondances() {
15
	public function rechercherCoordonneesSansCorrespondances() {
-
 
16
		$requete = 'SELECT longitude, latitude '.
16
		$requete = "SELECT longitude, latitude
17
			'FROM cel_obs '.
17
						FROM `cel_obs`
18
			"WHERE code_insee_calcule = '' ".
18
						WHERE code_insee_calcule = '' 
19
			'	AND DATE_ADD(date_modification, INTERVAL 25 HOUR) >= CURDATE() '. 
19
						GROUP BY `longitude` , `latitude`";
20
			'GROUP BY longitude , latitude ';
20
		$resultat = $this->recupererTous($requete);
21
		$resultat = $this->recupererTous($requete);
Line 21... Line 22...
21
		$this->reinitialiserTempsDerniereRequete();
22
		$this->reinitialiserTempsDerniereRequete();
-
 
23
		return $resultat;
22
		return $resultat;
24
	}
23
	}
25
	
24
	
26
	public function creerColonneCodeInseeCalcule() {
25
	public function creerColonneCodeInseeCalculee() {
27
		$create = 'ALTER TABLE cel_obs '.
Line 26... Line 28...
26
		$create = "ALTER TABLE `cel_obs` ADD `code_insee_calcule` VARCHAR( 5 ) NOT NULL";
28
			'ADD code_insee_calcule VARCHAR(5) NOT NULL ';
-
 
29
		$this->requeter($create);
27
		$this->requeter($create);
30
		$this->reinitialiserTempsDerniereRequete();
28
		$this->reinitialiserTempsDerniereRequete();
31
	}
-
 
32
	
29
	}
33
	public function ajouterCodeInseeCalcule($latitude, $longitude, $code_insee) {
30
	
34
		$insert = 'UPDATE cel_obs '.
31
	public function ajouterCodeInseeCalculee($latitude, $longitude, $code_insee) {
35
			"SET code_insee_calcule = ".$this->proteger($code_insee)." ".
Line 32... Line 36...
32
		$insert = "UPDATE `cel_obs` SET `code_insee_calcule` = '$code_insee' ".
36
			"WHERE latitude = ".$this->proteger($latitude)." ".
-
 
37
			"	AND longitude = ".$this->proteger($longitude)." ";
33
					"WHERE latitude = $latitude AND longitude = $longitude";
38
		$this->requeter($insert);
-
 
39
		$this->reinitialiserTempsDerniereRequete();
34
		$this->requeter($insert);
40
	}
-
 
41
	
-
 
42
	public function modifierCodeInseeEtZoneGeo($coordonnees) {
35
		$this->reinitialiserTempsDerniereRequete();
43
		$update = "UPDATE cel_obs ".
36
	}
44
			"SET ce_zone_geo = concat('INSEE-C:' , code_insee_calcule), ".
37
	
45
		    	"zone_geo = ".$this->proteger($coordonnees['nom'])." ".
Line 38... Line 46...
38
	public function modifierCodeInsee() {
46
			"WHERE ce_zone_geo = '' AND zone_geo = '' ".