Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 423 Rev 877
Line 51... Line 51...
51
// france_BDNFF_4.02_nt8523.png
51
// france_BDNFF_4.02_nt8523.png
52
/** Constante stockant l'URL d'appel du module chorologie*/
52
/** Constante stockant l'URL d'appel du module chorologie*/
53
define('EF_URL_CHORO', 'http://www.tela-botanica.org/eflore/BDNFF/4.02/nn/');
53
define('EF_URL_CHORO', 'http://www.tela-botanica.org/eflore/BDNFF/4.02/nn/');
54
// 182/chorologie
54
// 182/chorologie
Line -... Line 55...
-
 
55
 
Line 55... Line 56...
55
 
56
class NameMap extends Cel  {
56
 
-
 
57
Class NameMap extends DBAccessor  {
-
 
58
 
-
 
59
 
57
 
60
	var $config;
-
 
61
	var $extendMapProductor;
-
 
62
	
-
 
63
	
-
 
64
	function NameMap($config) {
-
 
65
 
-
 
66
		$this->config=$config;
-
 
67
	}
-
 
Line 68... Line 58...
68
	
58
	// TODO: voir avec David quoi faire de cette variable inutilisée
Line 69... Line -...
69
	
-
 
70
 
59
	private $extendMapProductor;
71
	function getElement($uid){
-
 
72
 
60
 
73
 
61
	function getElement($uid){
74
		// Num nomenclatural : recherche nt 
62
 
75
		$DB=$this->connectDB($this->config);
63
		// Num nomenclatural : recherche nt 
76
	    $query = "SELECT DISTINCT b.esn_id_taxon FROM eflore_nom, eflore_nom_rang," .
64
	    $requete_recherche_nt = "SELECT DISTINCT b.esn_id_taxon FROM eflore_nom, eflore_nom_rang," .
77
	     " eflore_selection_nom a, eflore_selection_nom b".
65
	    " eflore_selection_nom a, eflore_selection_nom b".
78
	     " WHERE a.esn_id_nom= ".$uid[0]. 
66
	    " WHERE a.esn_id_nom= ".$this->proteger($uid[0]). 
79
	     " AND a.esn_id_version_projet_taxon = 25 ".
67
	    " AND a.esn_id_version_projet_taxon = 25 ".
80
	     " AND a.esn_id_taxon=b.esn_id_taxon ".
68
	    " AND a.esn_id_taxon=b.esn_id_taxon ".
81
	     " AND b.esn_ce_statut=3 ".
69
	    " AND b.esn_ce_statut=3 ".
82
	     " AND a.esn_id_version_projet_taxon=b.esn_id_version_projet_taxon" .
-
 
83
	     " AND en_ce_rang = enrg_id_rang" .
70
	    " AND a.esn_id_version_projet_taxon=b.esn_id_version_projet_taxon" .
84
	     " AND en_id_nom = b.esn_id_nom" .
71
	    " AND en_ce_rang = enrg_id_rang" .
85
	     " AND a.esn_id_version_projet_taxon=en_id_version_projet_nom ";
72
	    " AND en_id_nom = b.esn_id_nom" .
-
 
73
	    " AND a.esn_id_version_projet_taxon=en_id_version_projet_nom ";
-
 
74
	     	    
86
	     
75
	    $resultat_recherche_nt = $this->requeter($requete_recherche_nt);
87
	    
-
 
88
	        $res =& $DB->query($query);
-
 
89
			    
76
		
90
			    
77
		$nt = null;
-
 
78
		if (is_array($resultat_recherche_nt) && count($resultat_recherche_nt) > 0) {
91
	        if (DB::isError($res)) {
79
			
92
    	        die($res->getMessage());
-
 
93
        	}
80
		}	    
94
 
-
 
95
  
81
 
96
	        while ($row =& $res->fetchrow(DB_FETCHMODE_ASSOC)) {
82
        $nt=$resultat_recherche_nt[0]['esn_id_taxon'];
97
                $nt=$row['esn_id_taxon'];
83
        
98
    	    }
-
 
99
 
-
 
100
            // si le taxon cherché n'existe pas 
-
 
101
            if(!$nt) { 
-
 
102
                $output = json_encode(array(''));
-
 
103
                print($output);
84
        $retour = array('');
104
                exit();
85
        
-
 
86
        // si le taxon cherché existe 
105
            }
87
        if ($nt) {           
106
            
88
			$file = EF_URL_CARTO."france_BDNFF_4.02_nt".$nt.".png";
107
			$file = EF_URL_CARTO."france_BDNFF_4.02_nt".$nt.".png";
89
			$file_headers = @get_headers($file);
108
			$file_headers = @get_headers($file);
90
			
109
			if($file_headers[0] == 'HTTP/1.1 404 Not Found') {
91
			if ($file_headers[0] == 'HTTP/1.1 404 Not Found') {
110
			}
92
			}
-
 
93
			else {
-
 
94
				$service=EF_URL_CHORO.$uid[0].'/chorologie';
-
 
95
				@get_headers($service);
111
			else {
96
			}
112
				$service=EF_URL_CHORO.$uid[0].'/chorologie';
97
			
113
				@get_headers($service);
98
			$retour = array($file);
Line 114... Line 99...
114
			}    	    
99
        }    	    
115
	
-
 
116
			$output = json_encode(array($file));
100
 
Line 117... Line 101...
117
			print($output);
101
		$output = json_encode($retour);
118
			
102
		print($output);
119
	}
103
			
120
	
104
	}
121
}
105
}
122
 
106
 
123
/* +--Fin du code ---------------------------------------------------------------------------------------+
107
/* +--Fin du code ---------------------------------------------------------------------------------------+
124
* $Log$
-
 
125
* Revision 1.1  2008-01-30 08:57:28  ddelon
-
 
126
* fin mise en place mygwt
-
 
127
*
-
 
128
* Revision 1.1  2007-06-06 13:31:16  ddelon
108
* $Log$
129
* v0.09
-
 
130
*
-
 
131
*
109
* Revision 1.1  2008-01-30 08:57:28  ddelon
132
*
110
* fin mise en place mygwt