| Line 57... |
Line 57... |
| 57 |
public function getElementParDefaut($param) {
|
57 |
public function getElementParDefaut($param) {
|
| 58 |
// Initialisation des variables
|
58 |
// Initialisation des variables
|
| 59 |
$info = array();
|
59 |
$info = array();
|
| Line 60... |
Line 60... |
| 60 |
|
60 |
|
| 61 |
// Pré traitement des paramêtres
|
61 |
// Pré traitement des paramêtres
|
| Line 62... |
Line 62... |
| 62 |
$p = $this->traiterParametresUrl(array('id_projet', 'id_collection', 'nom'), $param);
|
62 |
$p = $this->traiterParametresUrl(array('id_projet', 'id_collection', 'recherche'), $param);
|
| 63 |
|
63 |
|
| 64 |
// Construction de la requête
|
64 |
// Construction de la requête
|
| 65 |
$requete = (($this->distinct) ? 'SELECT DISTINCT' : 'SELECT').' c.*, cb.*, '.
|
65 |
$requete = (($this->distinct) ? 'SELECT DISTINCT' : 'SELECT').' c.*, cb.*, '.
|
| Line 72... |
Line 72... |
| 72 |
' LEFT JOIN coel_collection AS ccm ON (c.cc_ce_mere = ccm.cc_id_collection) '.
|
72 |
' LEFT JOIN coel_collection AS ccm ON (c.cc_ce_mere = ccm.cc_id_collection) '.
|
| 73 |
' LEFT JOIN coel_collection_botanique AS cb ON (c.cc_id_collection = ccb_id_collection) '.
|
73 |
' LEFT JOIN coel_collection_botanique AS cb ON (c.cc_id_collection = ccb_id_collection) '.
|
| 74 |
((count($p) != 0) ? 'WHERE ' : '').
|
74 |
((count($p) != 0) ? 'WHERE ' : '').
|
| 75 |
((isset($p['id_projet'])) ? "AND c.cc_ce_projet = {$p['id_projet']} " : '').
|
75 |
((isset($p['id_projet'])) ? "AND c.cc_ce_projet = {$p['id_projet']} " : '').
|
| 76 |
((isset($p['id_collection'])) ? "AND c.cc_id_collection = {$p['id_collection']} " : '').
|
76 |
((isset($p['id_collection'])) ? "AND c.cc_id_collection = {$p['id_collection']} " : '').
|
| 77 |
((isset($p['nom'])) ? "AND c.cc_nom LIKE {$p['nom']} " : '').
|
77 |
(isset($p['recherche']) ? $this->construireWhereRecherche($p['recherche']) : '').
|
| 78 |
'ORDER BY '.((!is_null($this->orderby)) ? $this->orderby : 'c.cc_nom ASC').' ';
|
78 |
'ORDER BY '.((!is_null($this->orderby)) ? $this->orderby : 'c.cc_nom ASC').' ';
|
| Line 79... |
Line 79... |
| 79 |
|
79 |
|
| 80 |
$requete = str_replace('WHERE AND', 'WHERE', $requete);
|
80 |
$requete = str_replace('WHERE AND', 'WHERE', $requete);
|
| 81 |
$requeteCount = $requete;
|
81 |
$requeteCount = $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 |
"c.cc_nom LIKE {$recherche} OR ".
|
| - |
|
109 |
"cs_ville LIKE {$recherche} ".
|
| - |
|
110 |
")";
|
| - |
|
111 |
return $recherche;
|
| 103 |
}
|
112 |
}
|
| 104 |
|
113 |
|
| 105 |
/* Méthode pour récupérer une liste de collection en fonction d'un id structure.
|
114 |
/* Méthode pour récupérer une liste de collection en fonction d'un id structure.
|
| 106 |
* Appelée avec les paramêtres d'url suivant :
|
115 |
* Appelée avec les paramêtres d'url suivant :
|
| 107 |
* /CoelCollection/ParIdStructure/_
|
116 |
* /CoelCollection/ParIdStructure/_
|