| Line 9... |
Line 9... |
| 9 |
* @copyright 2010 Tela-Botanica
|
9 |
* @copyright 2010 Tela-Botanica
|
| 10 |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
|
10 |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
|
| 11 |
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
|
11 |
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
|
| 12 |
* @version SVN: $$Id: AdminAdministrateur.php 128 2009-09-02 12:20:55Z aurelien $$
|
12 |
* @version SVN: $$Id: AdminAdministrateur.php 128 2009-09-02 12:20:55Z aurelien $$
|
| 13 |
*/
|
13 |
*/
|
| 14 |
class Recherche extends Controleur {
|
14 |
class Recherche extends ColControleur {
|
| 15 |
const RENDU_TETE = 'tete';
|
- |
|
| 16 |
const RENDU_CORPS = 'corps';
|
- |
|
| 17 |
const RENDU_PIED = 'pied';
|
- |
|
| 18 |
private $sortie = array();
|
- |
|
| 19 |
private $parametres = array();
|
- |
|
| 20 |
private $url = null;
|
- |
|
| Line 21... |
Line -... |
| 21 |
|
- |
|
| 22 |
public function __construct() {
|
- |
|
| 23 |
$registre = Registre::getInstance();
|
- |
|
| 24 |
$this->parametres = $registre->get('parametres');
|
- |
|
| 25 |
$this->url = $this->parametres['url'];
|
- |
|
| 26 |
parent::__construct();
|
- |
|
| 27 |
}
|
15 |
|
| 28 |
//+----------------------------------------------------------------------------------------------------------------+
|
16 |
//+----------------------------------------------------------------------------------------------------------------+
|
| 29 |
// Méthodes à refactoriser dans une classe mère
|
17 |
// Méthodes
|
| 30 |
/**
|
18 |
/**
|
| 31 |
* Fonction d'affichage par défaut, elle appelle la liste des administrateurs
|
19 |
* Fonction d'affichage par défaut, elle appelle la liste des administrateurs
|
| 32 |
*/
|
20 |
*/
|
| 33 |
public function executerActionParDefaut() {
|
21 |
public function executerActionParDefaut() {
|
| 34 |
return $this->rechercher();
|
22 |
return $this->rechercher();
|
| 35 |
}
|
- |
|
| 36 |
/**
|
- |
|
| 37 |
* Fonction d'affichage par défaut, elle appelle la liste des administrateurs
|
- |
|
| 38 |
*/
|
- |
|
| 39 |
protected function setSortie($position, $contenu, $fusionner = false) {
|
- |
|
| 40 |
if ($position != self::RENDU_TETE &&
|
- |
|
| 41 |
$position != self::RENDU_CORPS &&
|
- |
|
| 42 |
$position != self::RENDU_PIED) {
|
- |
|
| 43 |
trigger_error("La position '$position' n'existe pas", E_USER_WARNING);
|
- |
|
| 44 |
} else {
|
- |
|
| 45 |
if ($fusionner) {
|
- |
|
| 46 |
$this->sortie[$position] .= $contenu;
|
- |
|
| 47 |
} else {
|
- |
|
| 48 |
$this->sortie[$position] = $contenu;
|
- |
|
| 49 |
}
|
- |
|
| 50 |
}
|
- |
|
| 51 |
}
|
- |
|
| 52 |
public function getSortie() {
|
- |
|
| 53 |
return $this->sortie;
|
- |
|
| Line 54... |
Line -... |
| 54 |
}
|
- |
|
| 55 |
|
- |
|
| 56 |
//+----------------------------------------------------------------------------------------------------------------+
|
23 |
}
|
| 57 |
// Méthodes
|
24 |
|
| 58 |
/**
|
25 |
/**
|
| 59 |
* Charge le moteur de recherche et l'envoie à la vue.
|
26 |
* Charge le moteur de recherche et l'envoie à la vue.
|
| 60 |
*/
|
27 |
*/
|
| Line 103... |
Line 70... |
| 103 |
// Gestion de l'accès aux données
|
70 |
// Gestion de l'accès aux données
|
| 104 |
$rechercheDao->setLimitation(($de - 1), $fragmenteur->getDonneesParPage());
|
71 |
$rechercheDao->setLimitation(($de - 1), $fragmenteur->getDonneesParPage());
|
| 105 |
$resultats = $rechercheDao->chercher($parametres);
|
72 |
$resultats = $rechercheDao->chercher($parametres);
|
| Line 106... |
Line 73... |
| 106 |
|
73 |
|
| - |
|
74 |
// Post-traitement des résultats pour l'affichage
|
| 107 |
// Post-traitement des résultats pour l'affichage
|
75 |
$this->url->setVariableRequete('module', 'Fiche');
|
| 108 |
foreach ($resultats as $resultat) {
|
76 |
foreach ($resultats as $resultat) {
|
| 109 |
$structure_id = $resultat['cs_id_structure'];
|
77 |
$structure_id = $resultat['cs_id_structure'];
|
| - |
|
78 |
if (!isset($donnees['infos'][$structure_id])) {
|
| - |
|
79 |
$this->url->setVariableRequete('action', 'afficherStructure');
|
| 110 |
if (!isset($donnees['infos'][$structure_id])) {
|
80 |
$this->url->setVariableRequete('id', $resultat['cs_id_structure']);
|
| 111 |
$structure = array(
|
81 |
$structure = array(
|
| 112 |
'nom' => $resultat['cs_nom'],
|
82 |
'nom' => $resultat['cs_nom'],
|
| - |
|
83 |
'ville' => $resultat['cs_ville'],
|
| - |
|
84 |
'url' => $this->url->getURL());
|
| - |
|
85 |
$this->url->unsetVariableRequete('action');
|
| 113 |
'ville' => $resultat['cs_ville']);
|
86 |
$this->url->unsetVariableRequete('id');
|
| 114 |
$donnees['infos'][$structure_id]['structure'] = $structure;
|
87 |
$donnees['infos'][$structure_id]['structure'] = $structure;
|
| 115 |
}
|
- |
|
| - |
|
88 |
}
|
| - |
|
89 |
$this->url->setVariableRequete('action', 'afficherCollection');
|
| 116 |
|
90 |
$this->url->setVariableRequete('id', $resultat['cc_id_collection']);
|
| - |
|
91 |
$collection = array('nom' => $resultat['cc_nom'],
|
| - |
|
92 |
'url' => $this->url->getURL());
|
| - |
|
93 |
$this->url->unsetVariableRequete('action');
|
| 117 |
$collection = array('nom' => $resultat['cc_nom']);
|
94 |
$this->url->unsetVariableRequete('id');
|
| 118 |
$donnees['infos'][$structure_id]['collections'][] = $collection;
|
95 |
$donnees['infos'][$structure_id]['collections'][] = $collection;
|
| - |
|
96 |
}
|
| Line 119... |
Line 97... |
| 119 |
}
|
97 |
$this->url->unsetVariableRequete('module');
|
| 120 |
|
98 |
|
| 121 |
// Gestion des squelettes
|
99 |
// Gestion des squelettes
|
| 122 |
$this->chargerMoteurRecherche();
|
100 |
$this->chargerMoteurRecherche();
|