Subversion Repositories eFlore/Projets.eflore-projets

Rev

Go to most recent revision | Details | 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;
424 jpm 40
				case 'creerDscTxt' :
478 jpm 41
					$description = $this->getClasseDescription();
42
					$description->genererDescriptionTxt();
424 jpm 43
					break;
428 jpm 44
				case 'statDscTxt' :
478 jpm 45
					$description = $this->getClasseDescription();
46
					$description->verifierDescriptionTxt();
428 jpm 47
					break;
48
				case 'correspondanceDsc' :
478 jpm 49
					$description = $this->getClasseDescription();
50
					$description->genererCorrespondance();
428 jpm 51
					break;
469 jpm 52
				case 'fusionIndex' :
478 jpm 53
					$description = $this->getClasseIndex();
54
					$description->fusionnerIndex();
469 jpm 55
					break;
477 jpm 56
				case 'uploadFichiersSp' :
478 jpm 57
					$wiki = $this->getClasseWiki();
58
					$wiki->uploaderFichiersSp();
477 jpm 59
					break;
60
				case 'downloadWiki' :
478 jpm 61
					$wiki = $this->getClasseWiki();
62
					$wiki->dowloaderPagesWiki();
477 jpm 63
					break;
478 jpm 64
				case 'uploadEflore' :
65
					$wiki = $this->getClasseWiki();
66
					$wiki->uploaderDansWikiEflore();
67
					break;
484 jpm 68
				case 'uploadEfloreIndex' :
69
					$wiki = $this->getClasseWiki();
70
					$wiki->uploaderIndexDansWikiEflore();
71
					break;
292 jpm 72
				default :
73
					throw new Exception("Erreur : la commande '$cmd' n'existe pas!");
74
			}
75
		} catch (Exception $e) {
76
			$this->traiterErreur($e->getMessage());
77
		}
78
	}
79
 
479 jpm 80
	private function getClasseVersion() {
81
		$version = $this->getClasse('Versions');
82
		return $version;
292 jpm 83
	}
84
 
469 jpm 85
	private function getClasseDescription() {
86
		$description = $this->getClasse('Description');
87
		return $description;
88
	}
89
 
90
	private function getClasseIndex() {
91
		$index = $this->getClasse('Index');
92
		return $index;
93
	}
94
 
477 jpm 95
	private function getClasseWiki() {
96
		$wiki = $this->getClasse('Wiki');
97
		return $wiki;
98
	}
99
 
100
	private function getClasse($classeNom) {
428 jpm 101
		$conteneur = new Conteneur();
478 jpm 102
		$conteneur->setParametre('-v', $this->getParametre('-v'));
103
		$conteneur->setParametre('scriptChemin', $this->getScriptChemin());
469 jpm 104
		require_once dirname(__FILE__).'/'.$classeNom.'.php';
105
		$objet = new $classeNom($conteneur);
477 jpm 106
		return $objet;
428 jpm 107
	}
292 jpm 108
}
109
?>