Subversion Repositories eFlore/Projets.eflore-projets

Rev

Rev 477 | Rev 479 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
292 jpm 1
<?php
2
//declare(encoding='UTF-8');
3
/**
4
 * Exemple de lancement du script : :
5
 * /opt/lampp/bin/php cli.php coste -a chargerTous
6
 *
7
 * @category	php 5.2
8
 * @package		eFlore/Scripts
9
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
10
 * @copyright	Copyright (c) 2012, Tela Botanica (accueil@tela-botanica.org)
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
13
 * @version		$Id$
14
 */
15
class Coste extends EfloreScript {
16
 
17
	public function executer() {
18
		try {
19
			$this->initialiserProjet('coste');
20
 
21
			// Lancement de l'action demandée
22
			$cmd = $this->getParametre('a');
23
			switch ($cmd) {
24
				case 'chargerTous' :
478 jpm 25
					$version = $this->getClasseVersion();
26
					$version->chargerTous();
292 jpm 27
					break;
28
				case 'chargerStructureSql' :
478 jpm 29
					$version = $this->getClasseVersion();
30
					$version->chargerStructureSql();
292 jpm 31
					break;
32
				case 'chargerVersions' :
478 jpm 33
					$version = $this->getClasseVersion();
34
					$version->chargerVersions();
292 jpm 35
					break;
36
				case 'supprimerTous' :
478 jpm 37
					$version = $this->getClasseVersion();
38
					$version->supprimerTous();
292 jpm 39
					break;
40
				case 'creerV1' :
478 jpm 41
					$version = $this->getClasseVersion();
42
					$version->creerVersion1();
292 jpm 43
					break;
44
				case 'nettoyerV1' :
478 jpm 45
					$version = $this->getClasseVersion();
46
					$version->nettoyerVersion1();
292 jpm 47
					break;
424 jpm 48
				case 'creerDscTxt' :
478 jpm 49
					$description = $this->getClasseDescription();
50
					$description->genererDescriptionTxt();
424 jpm 51
					break;
428 jpm 52
				case 'statDscTxt' :
478 jpm 53
					$description = $this->getClasseDescription();
54
					$description->verifierDescriptionTxt();
428 jpm 55
					break;
56
				case 'correspondanceDsc' :
478 jpm 57
					$description = $this->getClasseDescription();
58
					$description->genererCorrespondance();
428 jpm 59
					break;
469 jpm 60
				case 'fusionIndex' :
478 jpm 61
					$description = $this->getClasseIndex();
62
					$description->fusionnerIndex();
469 jpm 63
					break;
477 jpm 64
				case 'uploadFichiersSp' :
478 jpm 65
					$wiki = $this->getClasseWiki();
66
					$wiki->uploaderFichiersSp();
477 jpm 67
					break;
68
				case 'downloadWiki' :
478 jpm 69
					$wiki = $this->getClasseWiki();
70
					$wiki->dowloaderPagesWiki();
477 jpm 71
					break;
478 jpm 72
				case 'uploadEflore' :
73
					$wiki = $this->getClasseWiki();
74
					$wiki->uploaderDansWikiEflore();
75
					break;
292 jpm 76
				default :
77
					throw new Exception("Erreur : la commande '$cmd' n'existe pas!");
78
			}
79
		} catch (Exception $e) {
80
			$this->traiterErreur($e->getMessage());
81
		}
82
	}
83
 
478 jpm 84
	private function getClasseVersion($version = '1') {
85
		$version1 = $this->getClasse('Version');
86
		return $version1;
292 jpm 87
	}
88
 
469 jpm 89
	private function getClasseDescription() {
90
		$description = $this->getClasse('Description');
91
		return $description;
92
	}
93
 
94
	private function getClasseIndex() {
95
		$index = $this->getClasse('Index');
96
		return $index;
97
	}
98
 
477 jpm 99
	private function getClasseWiki() {
100
		$wiki = $this->getClasse('Wiki');
101
		return $wiki;
102
	}
103
 
104
	private function getClasse($classeNom) {
428 jpm 105
		$conteneur = new Conteneur();
478 jpm 106
		$conteneur->setParametre('-v', $this->getParametre('-v'));
107
		$conteneur->setParametre('scriptChemin', $this->getScriptChemin());
469 jpm 108
		require_once dirname(__FILE__).'/'.$classeNom.'.php';
109
		$objet = new $classeNom($conteneur);
477 jpm 110
		return $objet;
428 jpm 111
	}
292 jpm 112
}
113
?>