Subversion Repositories eFlore/Applications.coel

Rev

Rev 1611 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1611 Rev 1636
Line 24... Line 24...
24
	public function getElement($param = array()) {
24
	public function getElement($param = array()) {
25
		// Initialisation de variables
25
		// Initialisation de variables
26
		$info = array();
26
		$info = array();
Line 27... Line 27...
27
 
27
 
28
		// Pré traitement des paramêtres
28
		// Pré traitement des paramêtres
Line 29... Line 29...
29
		$p = $this->traiterParametresUrl(array('id_projet', 'cpr_nom'), $param);
29
		$p = $this->traiterParametresUrl(array('id_projet', 'recherche'), $param);
30
 
30
 
31
		// Nous avons un identifiant de projet, nous récupérons seulement les informations du projet donné
31
		// Nous avons un identifiant de projet, nous récupérons seulement les informations du projet donné
32
		$requete = 	(($this->distinct) ? 'SELECT DISTINCT' : 'SELECT').' * '.
32
		$requete = 	(($this->distinct) ? 'SELECT DISTINCT' : 'SELECT').' * '.
33
					'FROM coel_projet '.
33
					'FROM coel_projet '.
34
					((count($p) != 0) ? 'WHERE ' : '').	
34
					((count($p) != 0) ? 'WHERE ' : '').	
35
					((isset($p['cpr_nom'])) ? "AND cpr_nom LIKE {$p['cpr_nom']} " : '').
35
					((isset($p['recherche'])) ? $this->construireWhereRecherche($p['recherche']) : '').
Line 36... Line 36...
36
					((isset($p['id_projet'])) ? "AND cpr_id_projet = {$p['id_projet']} " : '').
36
					((isset($p['id_projet'])) ? "AND cpr_id_projet = {$p['id_projet']} " : '').
37
					'ORDER BY '.((!is_null($this->orderby)) ? $this->orderby  : 'cpr_id_projet ASC').' ';
37
					'ORDER BY '.((!is_null($this->orderby)) ? $this->orderby  : 'cpr_id_projet ASC').' ';
Line 60... Line 60...
60
		// Envoie sur la sortie standard
60
		// Envoie sur la sortie standard
61
		$this->envoyer($info);
61
		$this->envoyer($info);
Line 62... Line 62...
62
 
62
 
Line -... Line 63...
-
 
63
	}
-
 
64
	
-
 
65
	private function construireWhereRecherche($recherche) {
-
 
66
		$recherche = "AND ".
-
 
67
					"(".
-
 
68
						"cpr_nom LIKE {$recherche}  OR ".
-
 
69
						"cpr_abreviation LIKE {$recherche}  OR ".
-
 
70
						"cpr_resume LIKE {$recherche}  OR ".
-
 
71
						"cpr_url LIKE {$recherche}  OR ".
-
 
72
						"cpr_mot_cles LIKE {$recherche} ".
-
 
73
					")";
-
 
74
		return $recherche;
63
	}
75
	}
64
 
76
 
65
	 /**
77
	 /**
66
	  * Méthode appelée pour ajouter un élément.
78
	  * Méthode appelée pour ajouter un élément.
67
	  */
79
	  */