Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 1595 Rev 1636
Line 62... Line 62...
62
	public function getElementParDefaut($param) {
62
	public function getElementParDefaut($param) {
63
		// Initialisation des variables
63
		// Initialisation des variables
64
		$info = array();
64
		$info = array();
Line 65... Line 65...
65
				
65
				
66
		// Pré traitement des paramêtres
66
		// Pré traitement des paramêtres
Line 67... Line 67...
67
		$p = $this->traiterParametresUrl(array('id_projet', 'id_structure', 'nom'), $param);
67
		$p = $this->traiterParametresUrl(array('id_projet', 'id_structure', 'recherche'), $param);
68
				 
68
				 
69
		// Construction de la requête
69
		// Construction de la requête
70
		$requete = 	(($this->distinct) ? 'SELECT DISTINCT' : 'SELECT').' cs.*, csc.*, csv.*, '.
70
		$requete = 	(($this->distinct) ? 'SELECT DISTINCT' : 'SELECT').' cs.*, csc.*, csv.*, '.
Line 74... Line 74...
74
					'	LEFT JOIN coel_structure_conservation AS csc ON (cs_id_structure = csc_id_structure) '.
74
					'	LEFT JOIN coel_structure_conservation AS csc ON (cs_id_structure = csc_id_structure) '.
75
					'	LEFT JOIN coel_structure_valorisation AS csv ON (cs_id_structure = csv_id_structure) '.
75
					'	LEFT JOIN coel_structure_valorisation AS csv ON (cs_id_structure = csv_id_structure) '.
76
					((count($p) != 0) ? 'WHERE ' : '').			
76
					((count($p) != 0) ? 'WHERE ' : '').			
77
					((isset($p['id_projet'])) ? "AND cs_ce_projet = {$p['id_projet']} " : '').
77
					((isset($p['id_projet'])) ? "AND cs_ce_projet = {$p['id_projet']} " : '').
78
					((isset($p['id_structure'])) ? "AND cs_id_structure = {$p['id_structure']} " : '').
78
					((isset($p['id_structure'])) ? "AND cs_id_structure = {$p['id_structure']} " : '').
79
					((isset($p['nom'])) ? "AND cs_nom LIKE {$p['nom']} " : '').
79
					(isset($p['recherche']) ? $this->construireWhereRecherche($p['recherche']) : '').
80
					'ORDER BY '.((!is_null($this->orderby)) ? $this->orderby  : 'cs.cs_nom ASC').' ';
80
					'ORDER BY '.((!is_null($this->orderby)) ? $this->orderby  : 'cs.cs_nom ASC').' ';
Line 81... Line 81...
81
		
81
		
82
		$requete = str_replace('WHERE AND', 'WHERE', $requete);
82
		$requete = str_replace('WHERE AND', 'WHERE', $requete);
83
		$requete_compte = $requete;
83
		$requete_compte = $requete;
Line 100... Line 100...
100
		}
100
		}
Line 101... Line 101...
101
 
101
 
102
		return $info;
102
		return $info;
Line -... Line 103...
-
 
103
	}
-
 
104
	
-
 
105
	private function construireWhereRecherche($recherche) {
-
 
106
		$recherche = "AND ".
-
 
107
		"(".
-
 
108
			"cs_nom LIKE {$recherche}  OR ".
-
 
109
			"cs_ville LIKE {$recherche} ".
-
 
110
		")";
-
 
111
		return $recherche;
103
	}
112
	}
104
	
113
	
105
	/* Méthode pour récupérer le nombre de structure par zone géographique.
114
	/* Méthode pour récupérer le nombre de structure par zone géographique.
106
	 * Appelée avec les paramêtres d'url suivant :
115
	 * Appelée avec les paramêtres d'url suivant :
107
	 * /CoelStructure/ParZoneGeo/_
116
	 * /CoelStructure/ParZoneGeo/_