Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 1605 Rev 1636
Line 22... Line 22...
22
	public function getElement($param = array()) {
22
	public function getElement($param = array()) {
23
		// Initialisation des variables
23
		// Initialisation des variables
24
		$info = array();
24
		$info = array();
Line 25... Line 25...
25
		
25
		
26
		// Pré traitement des paramêtres
26
		// Pré traitement des paramêtres
Line 27... Line 27...
27
		$p = $this->traiterParametresUrl(array('id_publication', 'id_projet', 'fmt_nom_complet'), $param);
27
		$p = $this->traiterParametresUrl(array('id_publication', 'id_projet', 'recherche'), $param);
28
 
28
 
29
		// Construction de la requête
29
		// Construction de la requête
30
		$requete = 	(($this->distinct) ? 'SELECT DISTINCT' : 'SELECT').' cp.*, cmhl.*, cs_nom '.
30
		$requete = 	(($this->distinct) ? 'SELECT DISTINCT' : 'SELECT').' cp.*, cmhl.*, cs_nom '.
31
					'FROM coel_publication AS cp '.
31
					'FROM coel_publication AS cp '.
32
					'	LEFT JOIN coel_meta_historique_ligne AS cmhl ON (cpu_ce_meta = cmhl_id_historique_ligne) '.
32
					'	LEFT JOIN coel_meta_historique_ligne AS cmhl ON (cpu_ce_meta = cmhl_id_historique_ligne) '.
33
					'	LEFT JOIN coel_structure ON (cpu_ce_truk_editeur = cs_id_structure) '.
33
					'	LEFT JOIN coel_structure ON (cpu_ce_truk_editeur = cs_id_structure) '.
34
					((count($p) != 0) ? 'WHERE ' : '').
34
					((count($p) != 0) ? 'WHERE ' : '').
35
					(isset($p['id_projet']) 		? "AND cpu_ce_projet = {$p['id_projet']} " : '').
35
					(isset($p['id_projet']) 		? "AND cpu_ce_projet = {$p['id_projet']} " : '').
36
					(isset($p['id_publication'])	? "AND cpu_id_publication = {$p['id_publication']} " : '').
36
					(isset($p['id_publication'])	? "AND cpu_id_publication = {$p['id_publication']} " : '').
37
					(isset($p['fmt_nom_complet']) 	? "AND cpu_fmt_nom_complet LIKE {$p['fmt_nom_complet']} "	: '').
37
					(isset($p['recherche']) ? $this->construireWhereRecherche($p['recherche']) : '').
38
					'ORDER BY '.((!is_null($this->orderby)) ? $this->orderby  : 'cpu_id_publication ASC').' ';
38
					'ORDER BY '.((!is_null($this->orderby)) ? $this->orderby  : 'cpu_id_publication ASC').' ';
39
		$requete = str_replace('WHERE AND', 'WHERE', $requete);
39
		$requete = str_replace('WHERE AND', 'WHERE', $requete);
Line 59... Line 59...
59
		}
59
		}
Line 60... Line 60...
60
 
60
 
61
		// Envoie sur la sortie standard
61
		// Envoie sur la sortie standard
62
		$this->envoyer($info);
62
		$this->envoyer($info);
-
 
63
	}
-
 
64
	
-
 
65
	private function construireWhereRecherche($recherche) {
-
 
66
		$recherche = "AND ".
-
 
67
				"(".
-
 
68
					"cpu_fmt_nom_complet LIKE {$recherche} OR ".
-
 
69
					"cpu_date_parution LIKE {$recherche} OR ".
-
 
70
					"cpu_fascicule LIKE {$recherche}  OR ".
-
 
71
					"cpu_truk_pages LIKE {$recherche} ".
-
 
72
				")";
-
 
73
		return $recherche;
Line 63... Line 74...
63
	}
74
	}
64
 
75
 
65
	/**
76
	/**
66
	 * Méthode appelée pour ajouter un élément.
77
	 * Méthode appelée pour ajouter un élément.