Subversion Repositories Sites.obs-saisons.fr

Rev

Rev 43 | Rev 72 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 43 Rev 44
1
<?php
1
<?php
2
// declare(encoding='UTF-8');
2
// declare(encoding='UTF-8');
3
/**
3
/**
4
 * Classe de gestion des epeces.
4
 * Classe de gestion des epeces.
5
 *
5
 *
6
 * @package     Collection
6
 * @package     Collection
7
 * @category    Php 5.2
7
 * @category    Php 5.2
8
 * @author      Aurélien PERONNET <aurelien@tela-botanica.org>
8
 * @author      Aurélien PERONNET <aurelien@tela-botanica.org>
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: Espece.php 152 2010-09-06 16:19:12Z jpm $
12
 * @version     SVN: $Id: Espece.php 152 2010-09-06 16:19:12Z jpm $
13
 */
13
 */
14
class Espece extends aControleur {
14
class Espece extends aControleur {
15
   
15
   
16
	private $id_espece_en_cours = null;
16
	private $id_espece_en_cours = null;
17
   
17
   
18
    public function __construct()  {
18
    public function __construct()  {
19
    	
19
    	
20
		parent::__construct();
20
		parent::__construct();
21
        $this->initialiser();
21
        $this->initialiser();
22
    }
22
    }
23
    
23
    
24
    public function initialiser() {
24
    public function initialiser() {
25
    	
25
    	
26
    	$this->id_espece_en_cours = $_GET['$id_espece'];
26
    	$this->id_espece_en_cours = $_GET['$id_espece'];
27
    	$this->setNavigation();
27
    	$this->setNavigation();
28
    }
28
    }
29
    
29
    
30
    private function setNavigation() {   	
30
    private function setNavigation() {   	
31
		$station = new Station();
31
		$station = new Station();
32
    	$this->setSortie(self::RENDU_NAVIGATION, $station->construireMenuNavigation());
32
    	$this->setSortie(self::RENDU_NAVIGATION, $station->construireMenuNavigation());
33
    }
33
    }
34
    
34
    
35
    public function executerActionParDefaut() {
35
    public function executerActionParDefaut() {
36
    	return $this->afficherFormulaireSaisieIndividu();
36
    	return $this->afficherFormulaireSaisieIndividu();
37
    }
37
    }
38
    
38
    
39
   	// +---------------------------------------------------------------------------------------------------------------+
39
   	// +---------------------------------------------------------------------------------------------------------------+
40
    // METHODES D'AFFICHAGE DE FORMULAIRE 
40
    // METHODES D'AFFICHAGE DE FORMULAIRE 
41
    public function afficherFormulaireSaisieEspece() {
41
    public function afficherFormulaireSaisieEspece() {
42
    	
42
    	
43
    	$donnees = array();
43
    	$donnees = array();
44
    	
44
    	
45
    	if(!isset($_GET['id_station'])) {
45
    	if(!isset($_GET['id_station'])) {
46
    		return;
46
    		return;
47
    	}
47
    	}
48
    	
48
    	
49
    	$donnees['id_station'] = $_GET['id_station'];
49
    	$donnees['id_station'] = $_GET['id_station'];
50
    	
50
    	
51
    	$espece_dao = new EspeceDao();
51
    	$espece_dao = new EspeceDao();
52
    	$donnees['types'] = $espece_dao->getListeEspecesParType();
52
    	$donnees['types'] = $espece_dao->getListeEspecesParType();
53
    	
53
    	
54
    	$formulaire = $this->getVue('formulaires/espece_saisie',$donnees);
54
    	$formulaire = $this->getVue('formulaires/espece_saisie',$donnees);
55
    	$this->setSortie(self::RENDU_CORPS, $formulaire);   
55
    	$this->setSortie(self::RENDU_CORPS, $formulaire);   
56
    }
56
    }
57
    
57
    
58
    public function validerFormulaireSaisieEspece() {
58
    public function validerFormulaireSaisieEspece() {
59
    	
59
    	
60
    	$valeurs_verifiees = $this->collecterValeursFormulaireSaisieEspece();
60
    	$valeurs_verifiees = $this->collecterValeursFormulaireSaisieEspece();
61
 
61
 
62
    	$individu = new Individu();
62
    	$individu = new Individu();
-
 
63
    	$this->setNavigation();
63
    	$this->setSortie(self::RENDU_CORPS,$individu->getFormulaireSaisieIndividu($valeurs_verifiees));
64
    	$this->setSortie(self::RENDU_CORPS,$individu->getFormulaireSaisieIndividu($valeurs_verifiees));
64
    	
65
    
65
    	// TODO: à voir si on gère l'ajout d'espèce à part ?
-
 
66
    	//$espece_dao = new EspeceDao();
-
 
67
    	//$espece_dao->ajouterEspeceDansStation($valeurs_verifiees);
-
 
68
    }
66
    }
69
    
67
    
70
    // +---------------------------------------------------------------------------------------------------------------+
68
    // +---------------------------------------------------------------------------------------------------------------+
71
    // METHODES DE VALIDATION DE FORMULAIRE 
69
    // METHODES DE VALIDATION DE FORMULAIRE 
72
    private function collecterValeursFormulaireSaisieEspece() {
70
    private function collecterValeursFormulaireSaisieEspece() {
73
    	
71
    	
74
    	$valeurs_verifiees['espece'] = $_POST['espece'];
72
    	$valeurs_verifiees['id_espece'] = $_POST['id_espece'];
75
	    $valeurs_verifiees['station'] =  $_POST['station'];
73
	    $valeurs_verifiees['id_station'] =  $_POST['id_station'];
76
	    //TODO: verifier valeurs plus complètement
74
	    //TODO: verifier valeurs plus complètement
77
	    
75
	    
78
	    return $valeurs_verifiees;
76
	    return $valeurs_verifiees;
79
    	
77
    	
80
    }
78
    }
81
    
79
    
82
    public function getListeEvenementPourEspece($id_espece) {
80
    public function getListeEvenementPourEspece($id_espece) {
83
    	
81
    	
84
    	$evenementDao = new EvenementDao();
82
    	$evenementDao = new EvenementDao();
85
    	$liste_evenements = $evenementDao->getListeEvenementPourEspece($id_espece);
83
    	$liste_evenements = $evenementDao->getListeEvenementPourEspece($id_espece);
86
    	
84
    	
87
    	return $liste_evenements;
85
    	return $liste_evenements;
88
    }
86
    }
89
} 
87
}