Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 1612 Rev 1636
Line 27... Line 27...
27
	function getElement($param = array()) {
27
	function getElement($param = array()) {
28
		// Initialisation de variables
28
		// Initialisation de variables
29
		$info = array();
29
		$info = array();
Line 30... Line 30...
30
		
30
		
31
		// Pré traitement des paramêtres
31
		// Pré traitement des paramêtres
Line 32... Line 32...
32
		$p = $this->traiterParametresUrl(array('id_personne', 'ce_projet', 'nom'), $param);
32
		$p = $this->traiterParametresUrl(array('id_personne', 'ce_projet', 'recherche'), $param);
33
		
33
		
34
		// Construction de la requête
34
		// Construction de la requête
35
		$requete = 	(($this->distinct) ? 'SELECT DISTINCT' : 'SELECT').' cp.*, '.
35
		$requete = 	(($this->distinct) ? 'SELECT DISTINCT' : 'SELECT').' cp.*, '.
36
					'	cmhl_date_modification, cmhl_notes, cmhl_source, cmhl_ce_modifier_par, cmhl_ce_etat, cmhl_ip '.
36
					'	cmhl_date_modification, cmhl_notes, cmhl_source, cmhl_ce_modifier_par, cmhl_ce_etat, cmhl_ip '.
37
					'FROM coel_personne AS cp '.
37
					'FROM coel_personne AS cp '.
38
					'	LEFT JOIN coel_meta_historique_ligne ON (cp_ce_meta = cmhl_id_historique_ligne) '.
38
					'	LEFT JOIN coel_meta_historique_ligne ON (cp_ce_meta = cmhl_id_historique_ligne) '.
39
					((count($p) != 0) ? 'WHERE ' : '').
39
					((count($p) != 0) ? 'WHERE ' : '').
40
					(isset($p['id_personne']) 	? "AND cp_id_personne = {$p['id_personne']} " 				: '').
40
					(isset($p['id_personne']) 	? "AND cp_id_personne = {$p['id_personne']} " 				: '').
41
					(isset($p['ce_projet']) 	? "AND cp_ce_projet = {$p['ce_projet']} " 					: '').
41
					(isset($p['ce_projet']) 	? "AND cp_ce_projet = {$p['ce_projet']} " 					: '').
Line 42... Line 42...
42
					(isset($p['nom']) 			? "AND cp_nom LIKE {$p['nom']} "	: '').
42
					(isset($p['recherche']) ? $this->construireWhereRecherche($p['recherche']) : '').
43
					'ORDER BY '.((!is_null($this->orderby)) ? $this->orderby  : 'cp_fmt_nom_complet ASC').' ';
43
					'ORDER BY '.((!is_null($this->orderby)) ? $this->orderby  : 'cp_fmt_nom_complet ASC').' ';
44
					
44
					
Line 64... Line 64...
64
		
64
		
65
		// Envoie sur la sortie standard
65
		// Envoie sur la sortie standard
66
		$this->envoyer($info);
66
		$this->envoyer($info);
Line -... Line 67...
-
 
67
	}
-
 
68
	
-
 
69
	private function construireWhereRecherche($recherche) {
-
 
70
		$recherche = "AND ".
-
 
71
			"(".
-
 
72
				"cp_fmt_nom_complet LIKE {$recherche}  OR ".
-
 
73
				"cp_code_postal LIKE {$recherche} OR ".
-
 
74
				"cp_ville LIKE {$recherche}  OR ".
-
 
75
				"cp_truk_courriel LIKE {$recherche} ".
-
 
76
			")";
-
 
77
		return $recherche;
67
	}
78
	}
68
	
79
	
69
	/**
80
	/**
70
	 * Méthode appelée pour ajouter un élément.
81
	 * Méthode appelée pour ajouter un élément.
71
	 */
82
	 */