Subversion Repositories eFlore/Projets.eflore-projets

Rev

Rev 484 | 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;
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;
488 jpm 64
				case 'uploadTxt' :
478 jpm 65
					$wiki = $this->getClasseWiki();
66
					$wiki->uploaderDansWikiEflore();
67
					break;
488 jpm 68
				case 'uploadIndex' :
484 jpm 69
					$wiki = $this->getClasseWiki();
70
					$wiki->uploaderIndexDansWikiEflore();
71
					break;
488 jpm 72
				case 'chargerTxt' :
73
					$wiki = $this->getClasseWiki();
74
					$wiki->chargerTxtDansWikiEflore();
75
					break;
76
				case 'chargerIndex' :
77
					$wiki = $this->getClasseWiki();
78
					$wiki->chargerIndexDansWikiEflore();
79
					break;
292 jpm 80
				default :
81
					throw new Exception("Erreur : la commande '$cmd' n'existe pas!");
82
			}
83
		} catch (Exception $e) {
84
			$this->traiterErreur($e->getMessage());
85
		}
86
	}
87
 
479 jpm 88
	private function getClasseVersion() {
89
		$version = $this->getClasse('Versions');
90
		return $version;
292 jpm 91
	}
92
 
469 jpm 93
	private function getClasseDescription() {
94
		$description = $this->getClasse('Description');
95
		return $description;
96
	}
97
 
98
	private function getClasseIndex() {
99
		$index = $this->getClasse('Index');
100
		return $index;
101
	}
102
 
477 jpm 103
	private function getClasseWiki() {
104
		$wiki = $this->getClasse('Wiki');
105
		return $wiki;
106
	}
107
 
108
	private function getClasse($classeNom) {
428 jpm 109
		$conteneur = new Conteneur();
478 jpm 110
		$conteneur->setParametre('-v', $this->getParametre('-v'));
111
		$conteneur->setParametre('scriptChemin', $this->getScriptChemin());
469 jpm 112
		require_once dirname(__FILE__).'/'.$classeNom.'.php';
113
		$objet = new $classeNom($conteneur);
477 jpm 114
		return $objet;
428 jpm 115
	}
292 jpm 116
}
117
?>