Subversion Repositories Applications.referentiel

Rev

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

Rev 38 Rev 39
1
<?php
1
<?php
2
// declare(encoding='UTF-8');
2
// declare(encoding='UTF-8');
3
/**
3
/**
4
 * Classe Controleur du module Versionnage.
4
 * Classe Controleur du module Versionnage.
5
 * Permet de publier une nouvelle version d'un référentiel de travail. 
5
 * Permet de publier une nouvelle version d'un référentiel de travail. 
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 Versionnage extends AppliControleur {
15
class Versionnage extends AppliControleur {
-
 
16
	
-
 
17
	const SCRIPT_A_LANCER = 'versionnage';
16
	
18
	
17
	private $manuel = null;
19
	private $manuel = null;
-
 
20
	private $referentiel = null;
18
	private $referentiel = null;
21
	private $traitementDao = null;
19
	
22
	
20
	public function __construct()  {
23
	public function __construct()  {
21
		parent::__construct();
24
		parent::__construct();
22
		
25
		
23
		// Récupération de paramêtres
26
		// Récupération de paramêtres
24
		if (isset($_GET['ref'])) { // code du projet courrant
27
		if (isset($_GET['ref'])) { // code du projet courrant
25
			$this->referentiel = strtolower($_GET['ref']);
28
			$this->referentiel = strtolower($_GET['ref']);
26
		}
29
		}
27
		
-
 
-
 
30
		// Chargement des infos du manuel technique des référentiels
28
		$this->manuel = parse_ini_file(Config::get('chemin_appli').DS.'..'.DS.'configurations'.DS.'referentiel_v2.1.ini');
31
		$this->manuel = parse_ini_file(Config::get('chemin_appli').DS.'..'.DS.'configurations'.DS.'referentiel_v2.1.ini');
-
 
32
		
-
 
33
		// Chargement des DAO nécessaires
-
 
34
		$this->traitementDao = new TraitementDao();
29
	}
35
	}
30
	
36
	
31
	//+----------------------------------------------------------------------------------------------------------------+
37
	//+----------------------------------------------------------------------------------------------------------------+
32
	// Méthodes
38
	// Méthodes
33
	/**
39
	/**
34
	 * Fonction d'affichage par défaut
40
	 * Fonction d'affichage par défaut
35
	 */
41
	 */
36
	public function executerActionParDefaut() {
42
	public function executerActionParDefaut() {
37
		return $this->afficherInterface();
43
		return $this->afficherInterface();
38
	}
44
	}
39
 
45
 
40
	/**
46
	/**
41
	 * Affiche le formulaire de demande de versionnage
47
	 * Affiche le formulaire de demande de versionnage
42
	 */
48
	 */
43
	public function afficherInterface() {
49
	public function afficherInterface() {
44
		$donnees = array();
50
		$donnees = array();
-
 
51
		
45
		// Paramêtres pour l'url du formulaire
52
		// Paramêtres pour l'url du formulaire
46
		$this->url->unsetVariablesRequete(array('module', 'action', 'ref'));
53
		$this->url->unsetVariablesRequete(array('module', 'action', 'ref'));
47
		$donnees['url_form'] = $this->url->getUrl();
54
		$donnees['url_form'] = $this->url->getUrl();
48
		$donnees['url_module'] = 'Versionnage';
55
		$donnees['url_module'] = 'Versionnage';
49
		$donnees['url_action_demande'] = 'demanderTraitement';
56
		$donnees['url_action_demande'] = 'demanderTraitement';
50
		$donnees['url_action_rafraichir'] = 'afficherInterface';
57
		$donnees['url_action_rafraichir'] = 'afficherInterface';
51
		
58
		
52
		// Date de production de la version
59
		// Date de production de la version
53
		$donnees['date_prod'] = date('Y-m-d');
60
		$donnees['date_prod'] = date('Y-m-d');
54
		 
61
		 
55
		// Récupération des paramètres de configuration du manuel des référentiels
62
		// Récupération des paramètres de configuration du manuel des référentiels
56
		$donnees['domaine_geo'] = explode(';', $this->manuel['domaine_geo']);
63
		$donnees['domaine_geo'] = explode(';', $this->manuel['domaine_geo']);
57
		$donnees['domaine_taxo'] = explode(';', $this->manuel['domaine_taxo']);
64
		$donnees['domaine_taxo'] = explode(';', $this->manuel['domaine_taxo']);
58
		$donnees['domaine_code'] = explode(';', $this->manuel['domaine_code']);
65
		$donnees['domaine_code'] = explode(';', $this->manuel['domaine_code']);
59
		$licences = explode(';', $this->manuel['licences']);
66
		$licences = explode(';', $this->manuel['licences']);
60
		foreach ($licences as $licence) {
67
		foreach ($licences as $licence) {
61
			if (preg_match('/^([^<]+)<([^>]+)>/', $licence, $match)) {
68
			if (preg_match('/^([^<]+)<([^>]+)>/', $licence, $match)) {
62
				$info_licence = array();
69
				$info_licence = array();
63
				$info_licence['nom'] = $match[1];
70
				$info_licence['nom'] = $match[1];
64
				$info_licence['url'] = $match[2];
71
				$info_licence['url'] = $match[2];
65
				$donnees['licences'][] = $info_licence;
72
				$donnees['licences'][] = $info_licence;
66
			}
73
			}
67
		}
74
		}
-
 
75
		
-
 
76
		// Traitement de l'info sur le code du référentiel
-
 
77
		if (isset($this->referentiel)) {
-
 
78
			// Récupération du référentiel courrant
-
 
79
			$donnees['ref'] = $this->referentiel;
-
 
80
			
-
 
81
			// Recherche des traitements en attente
-
 
82
			$donnees['traitements_en_attente'] = $this->traitementDao->getTraitementsEnAttente($this->referentiel, self::SCRIPT_A_LANCER);
-
 
83
			
-
 
84
			// Recherche des traitements en cours d'éxecution
-
 
85
			$donnees['traitements_en_cours'] = $this->traitementDao->getTraitementsEnCours($this->referentiel, self::SCRIPT_A_LANCER);
-
 
86
			
-
 
87
			// Recherche des traitements déjà effectué
-
 
88
			$resultat = $this->traitementDao->getTraitementsTermines($this->referentiel, self::SCRIPT_A_LANCER);
-
 
89
			if (is_array($resultat)) {
-
 
90
				// Ajout de l'url vers la fiche du traitement
-
 
91
				foreach ($resultat as &$traitement) {
-
 
92
					$traitement['url'] = $this->obtenirUrlFicheTraitement($this->referentiel, $traitement['id_traitement']);
-
 
93
				}
-
 
94
				$donnees['traitements_termines'] = $resultat;
-
 
95
			}
-
 
96
		} else {
-
 
97
			$this->addMessage("Aucun code de projet de référentiel n'est indiqué (Ex. bdnff).");
-
 
98
		}
68
		
99
		
69
		$this->setSortie(self::RENDU_CORPS, $this->getVue('form_version', $donnees), false);
100
		$this->setSortie(self::RENDU_CORPS, $this->getVue('form_version', $donnees), false);
70
		$this->construireMenu($this->referentiel);
101
		$this->construireMenu($this->referentiel);
71
		$this->construireFilAriane($this->referentiel);
102
		$this->construireFilAriane($this->referentiel);
72
	}
103
	}
-
 
104
	
-
 
105
	/**
-
 
106
	 * Lance l'ajout d'un traitement
-
 
107
	 */
-
 
108
	public function demanderTraitement() {
-
 
109
		$this->ajouterTraitement($this->referentiel, self::SCRIPT_A_LANCER);
-
 
110
		$this->afficherInterface();
-
 
111
	}
73
}
112
}
74
?>
113
?>