13,15 → 13,43 |
* @version $Id$ |
*/ |
class Fiche extends aControleur { |
|
private $onglet = 'synthese'; |
private $parametres = array(); |
private $conteneur = null; |
private $num_nom = 0; |
|
|
|
|
public function initialiser() { |
$this->capturerParametres(); |
$this->conteneur = new Conteneur($this->parametres); |
spl_autoload_register(array($this, 'chargerClassesOnglets')); |
} |
|
|
private function capturerParametres() { |
if (isset($_GET['num_nom'])) { |
$this->parametres['num_nom'] = $_GET['num_nom']; |
} |
|
if (isset($_GET['nom_retenu'])) { |
$this->parametres['nom_retenu'] = $_GET['nom_retenu']; |
} |
|
if (isset($_GET['nom'])) { |
$this->parametres['nom'] = $_GET['nom']; |
} |
if (isset($_GET['type_nom'])) { |
$this->parametres['type_nom'] = $_GET['type_nom']; |
} |
|
if (isset($_GET['niveau'])) { |
Registre::set('parametres.niveau', $_GET['niveau']); |
} |
if (isset($_GET['onglet'])) { |
$this->onglet = $_GET['onglet']; |
} |
} |
|
private function chargerClassesOnglets($classe) { |
$base = dirname(__FILE__).DS; |
$cheminFormateurs = $base.'formateurs'.DS; |
34,80 → 62,37 |
} |
} |
} |
|
|
public function executerActionParDefaut() { |
$this->executerFiche(); |
} |
|
|
public function executerFiche(){ |
$donnees = array('type_nom' => $this->type_nom, 'nom' => $this->nom); |
$this->executerAction('Recherche', 'executerAccueil', $donnees); |
$donnees['num_nom'] = $this->num_nom; |
$blocs_niveaux = $this->recupererTableauConfig('blocs_fiche_defaut'); |
$donnees = $this->parametres; |
$this->executerAction('Recherche', 'executerAccueil', $this->parametres); |
$blocs_niveaux = $this->conteneur->getParametreTableau('blocs_fiche_defaut'); |
$donnees['blocs'] = '"'.str_replace('|', '","', $blocs_niveaux[Registre::get('parametres.niveau')]).'"'; |
$donnees = $this->obtenirDonnees($donnees); |
|
$donnees = array_merge($this->obtenirDonnees(), $donnees); |
$donnees['onglet'] = $this->onglet; |
$donnees['contenu_onglet'] = $this->getVue('fiche_'.$this->onglet, $donnees); |
$donnees['nom_retenu'] = $this->nom_retenu; |
|
$this->setSortie(self::RENDU_CORPS, $this->getVue('fiche_accueil', $donnees), true); |
} |
|
|
public function executerOnglet(){ |
$donnees = $this->obtenirDonnees(); |
header('Content-type: text/html'); |
header('Content-type: text/html'); |
echo $this->getVue('fiche_'.$this->onglet, $donnees); |
exit; |
} |
|
private function obtenirDonnees($donnees = array()) { |
if ($this->onglet == 'synthese') { |
$serviceRepartition = new Repartition($this->num_nom, 'nn', "190x178"); |
$donnees['repartition_vignette'] = $serviceRepartition->getUrlPng(); |
} else { |
$classe = ucfirst($this->onglet); |
$metier = new $classe(); |
$donnees = $metier->obtenirDonnees($this->num_nom); |
} |
|
private function obtenirDonnees() { |
$donnees = array(); |
$classe = ucfirst($this->onglet); |
$onglet = new $classe($this->conteneur); |
$donnees = $onglet->obtenirDonnees(); |
return $donnees; |
} |
|
private function capturerParametres() { |
if (isset($_GET['num_nom'])) { |
$this->num_nom = $_GET['num_nom']; |
} |
|
if (isset($_GET['nom_retenu'])) { |
$this->nom_retenu = $_GET['nom_retenu']; |
} |
|
if (isset($_GET['nom'])) { |
$this->nom = $_GET['nom']; |
} |
if (isset($_GET['type_nom'])) { |
$this->type_nom = $_GET['type_nom']; |
} |
|
if (isset($_GET['niveau'])) { |
Registre::set('parametres.niveau', $_GET['niveau']); |
} |
if (isset($_GET['onglet'])) { |
$this->onglet = $_GET['onglet']; |
} |
} |
|
protected function recupererTableauConfig($param) { |
$tableau = array(); |
$tableauPartiel = explode(',', Config::get($param)); |
$tableauPartiel = array_map('trim', $tableauPartiel); |
foreach ($tableauPartiel as $champ) { |
if (strpos($champ, '=') === false) { |
$tableau[] = $champ; |
} else { |
list($cle, $val) = explode('=', $champ); |
$tableau[$cle] = $val; |
} |
} |
return $tableau; |
} |
} |
?> |