Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 1519 Rev 1806
Line 24... Line 24...
24
	public function getElement($param = array()) {
24
	public function getElement($param = array()) {
25
		// Initialisation des variables
25
		// Initialisation des 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_collection'), $param);
29
		$p = $this->traiterParametresUrl(array('id_collection','source'), $param);
30
		
30
		
31
		// Construction de la requête
31
		// Construction de la requête
32
		$requete = 	(($this->distinct) ? 'SELECT DISTINCT ' : 'SELECT ').
32
		$requete = 	(($this->distinct) ? 'SELECT DISTINCT ' : 'SELECT ').
33
					'	ccapu.*, cpu.* '.
33
					'	ccapu.*, cpu.* '.
34
					'FROM coel_collection_a_publication AS ccapu '.
34
					'FROM coel_collection_a_publication AS ccapu '.
35
					'	LEFT JOIN coel_meta_historique_ligne ON (ccapu_ce_meta = cmhl_id_historique_ligne) '.
35
					'	LEFT JOIN coel_meta_historique_ligne ON (ccapu_ce_meta = cmhl_id_historique_ligne) '.
36
					'	LEFT JOIN coel_publication AS cpu ON (ccapu_id_publication = cpu_id_publication) '.
36
					'	LEFT JOIN coel_publication AS cpu ON (ccapu_id_publication = cpu_id_publication) '.
-
 
37
					((count($p) != 0) ? 'WHERE ' : '').
37
					((count($p) != 0) ? 'WHERE ' : '').
38
					(isset($p['id_collection']) 	? "AND ccapu_id_collection = {$p['id_collection']} " : '').	
38
					(isset($p['id_collection']) 	? "AND ccapu_id_collection = {$p['id_collection']} " : '').			
39
					(isset($p['source']) 	? "AND ccapu_source = {$p['source']} " : '').
39
					'ORDER BY '.((!is_null($this->orderby)) ? $this->orderby  : 'ccapu_ce_meta DESC').' ';
40
					'ORDER BY '.((!is_null($this->orderby)) ? $this->orderby  : 'ccapu_ce_meta DESC').' ';
40
		$requete = str_replace('WHERE AND', 'WHERE', $requete);
41
		$requete = str_replace('WHERE AND', 'WHERE', $requete);
41
		$requeteCount = $requete;
-
 
-
 
42
		$requeteCount = $requete;
42
		$requete .= "LIMIT $this->start, $this->limit ";
43
		$requete .= "LIMIT $this->start, $this->limit ";
43
		
44
		//echo $requete;exit;
44
		// Récupération des résultats
45
		// Récupération des résultats
45
		try {
46
		try {
46
			$donnees = $this->bdd->query($requete)->fetchAll(PDO::FETCH_ASSOC);
47
			$donnees = $this->bdd->query($requete)->fetchAll(PDO::FETCH_ASSOC);