Subversion Repositories Applications.referentiel

Rev

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

Rev 271 Rev 276
1
<?php
1
<?php
2
// declare(encoding='UTF-8');
2
// declare(encoding='UTF-8');
3
/**
3
/**
4
 * Classe Controleur du module Accueil.
4
 * Classe Controleur du module Accueil.
5
 * Affichage les infos sur l'ensemble des référentiels disponibles.
5
 * Affichage les infos sur l'ensemble des référentiels disponibles.
6
 * 
6
 * 
7
 * @package		Referentiel
7
 * @package		Referentiel
8
 * @category	Php5.2
8
 * @category	Php5.2
9
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
9
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
10
 * @copyright	2010 Tela-Botanica
10
 * @copyright	2010 Tela-Botanica
11
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
11
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
12
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
12
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
13
 * @version		SVN: $Id$
13
 * @version		SVN: $Id$
14
 */
14
 */
15
class Informations extends AppliControleur {
15
class Informations extends AppliControleur {
16
	
16
	
17
	private $referentiel = null;
17
	private $referentiel = null;
18
	private $referentielDao = null;
18
	private $referentielDao = null;
-
 
19
	private $traitementDao = null;
-
 
20
	private $resultatDao = null;
19
	
21
	
20
	public function __construct()  {
22
	public function __construct()  {
21
		parent::__construct();
23
		parent::__construct();
22
		
24
		
23
		// Récupération de paramêtres
25
		// Récupération de paramêtres
24
		if (isset($_GET['ref'])) { // code du projet courrant
26
		if (isset($_GET['ref'])) { // code du projet courrant
25
			$this->referentiel = strtolower(strip_tags($_GET['ref']));
27
			$this->referentiel = strtolower(strip_tags($_GET['ref']));
26
		}
28
		}
27
		
29
		
28
		// Chargement des DAO nécessaires
30
		// Chargement des DAO nécessaires
-
 
31
		$this->resultatDao = new ResultatDao();
-
 
32
		$this->traitementDao = new TraitementDao();
29
		$this->referentielDao = new ReferentielDao();
33
		$this->referentielDao = new ReferentielDao();
30
	}
34
	}
31
	
35
	
32
	//+----------------------------------------------------------------------------------------------------------------+
36
	//+----------------------------------------------------------------------------------------------------------------+
33
	// Méthodes
37
	// Méthodes
34
	/**
38
	/**
35
	 * Fonction d'affichage par défaut
39
	 * Fonction d'affichage par défaut
36
	 */
40
	 */
37
	public function executerActionParDefaut() {
41
	public function executerActionParDefaut() {
38
		return $this->afficherDetail();
42
		return $this->afficherDetail();
39
	}
43
	}
40
	
-
 
41
 
-
 
42
	
44
 
43
	/**
45
	/**
44
	 * Affiche le détail d'un référentiel et la liste des actions possibles
46
	 * Affiche le détail d'un référentiel et la liste des actions possibles
45
	 */
47
	 */
46
	public function afficherDetail() {
48
	public function afficherDetail() {
47
		$donnees = array();
49
		$donnees = array();
48
		$this->definirCommeModulePrincipal('Informations');
50
		$this->definirCommeModulePrincipal('Informations');
49
		
51
		
50
		// Traitement de l'info sur le code du référentiel
52
		// Traitement de l'info sur le code du référentiel
51
		if (isset($this->referentiel)) {
53
		if (isset($this->referentiel)) {
52
			$this->construireMenu($this->referentiel);
54
			$this->construireMenu($this->referentiel);
53
			$this->construireFilAriane($this->referentiel);
55
			$this->construireFilAriane($this->referentiel);
54
			$donnees['referentiel'] = $this->referentiel;
56
			$donnees['referentiel'] = $this->referentiel;
55
			$donnees['nom_referentiel'] = $this->referentielDao->getNom($this->referentiel);
57
			$donnees['nom_referentiel'] = $this->referentielDao->getNom($this->referentiel);
56
			$donnees['url_menu_test'] = $this->obtenirUrlMenuTest($this->referentiel);
58
			$donnees['url_menu_test'] = $this->obtenirUrlMenuTest($this->referentiel);
57
			$donnees['url_menu_versionnage'] = $this->obtenirUrlMenuVersionnage($this->referentiel);
59
			$donnees['url_menu_versionnage'] = $this->obtenirUrlMenuVersionnage($this->referentiel);
58
			$donnees['url_menu_consultation'] = $this->obtenirUrlMenuConsultation($this->referentiel);
60
			$donnees['url_menu_consultation'] = $this->obtenirUrlMenuConsultation($this->referentiel);
-
 
61
			
59
			
62
			$donnees['infos_telechargements'] = $this->afficherTelechargementsReferentiels();
60
		} else {
63
		} else {
61
			$this->addMessage("Aucun code de projet de référentiel n'est indiqué (Ex. bdtfx).");
64
			$this->addMessage("Aucun code de projet de référentiel n'est indiqué (Ex. bdtfx).");
62
		}
65
		}
63
		
66
		
64
		$donnees['messages'] = $this->getMessages();
67
		$donnees['messages'] = $this->getMessages();
65
		$this->traiterEsperluette($donnees);
68
		$this->traiterEsperluette($donnees);
66
		$this->setSortie(self::RENDU_CORPS, $this->getVue('detail_referentiel', $donnees), false);
69
		$this->setSortie(self::RENDU_CORPS, $this->getVue('detail_referentiel', $donnees), false);
67
	}
70
	}
-
 
71
	
-
 
72
	private function afficherTelechargementsReferentiels() {
-
 
73
		$infos_telechargements = array();
-
 
74
		// Recherche des traitements déjà effectué
-
 
75
		$resultat = $this->traitementDao->getTraitementsTermines($this->referentiel, 'versionnage');
-
 
76
		if (is_array($resultat)) {
-
 
77
			foreach ($resultat as &$traitement) {
-
 
78
				$infos_traitement = $this->traitementDao->getInfos($traitement['id_traitement']);
-
 
79
				if ($infos_traitement != false) {
-
 
80
					// Recherche des fichiers disponibles
-
 
81
					$infos_zip = $this->obtenirUrlsZipPourTraitement($infos_traitement);
-
 
82
					$infos_telechargements[] = array(
-
 
83
								'infos_traitement' => $traitement,
-
 
84
								'description' => $this->creerDescriptionTelechargement($traitement),
-
 
85
								'urls_zip' => $infos_zip);
-
 
86
				}
-
 
87
			}
-
 
88
		}
-
 
89
		return $infos_telechargements;
-
 
90
	}
-
 
91
		
-
 
92
	private function creerDescriptionTelechargement($traitement) {
-
 
93
		return strftime('%e %B %Y', strtotime($traitement['meta_date_creation'])).' ('.$this->referentielDao->getNom($this->referentiel).') ';
-
 
94
	}
68
	
95
	
69
}
96
}
70
?>
97
?>