Rev 488 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php
//declare(encoding='UTF-8');
/**
* Exemple de lancement du script : :
* /opt/lampp/bin/php cli.php coste -a chargerTous
*
* @category php 5.2
* @package eFlore/Scripts
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @copyright Copyright (c) 2012, Tela Botanica (accueil@tela-botanica.org)
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
* @version $Id$
*/
class Coste extends EfloreScript {
public function executer() {
try {
$this->initialiserProjet('coste');
// Lancement de l'action demandée
$cmd = $this->getParametre('a');
switch ($cmd) {
case 'chargerTous' :
$version = $this->getClasseVersion();
$version->chargerTous();
break;
case 'chargerStructureSql' :
$version = $this->getClasseVersion();
$version->chargerStructureSql();
break;
case 'chargerVersions' :
$version = $this->getClasseVersion();
$version->chargerVersions();
break;
case 'supprimerTous' :
$version = $this->getClasseVersion();
$version->supprimerTous();
break;
case 'creerDscTxt' :
$description = $this->getClasseDescription();
$description->genererDescriptionTxt();
break;
case 'statDscTxt' :
$description = $this->getClasseDescription();
$description->verifierDescriptionTxt();
break;
case 'correspondanceDsc' :
$description = $this->getClasseDescription();
$description->genererCorrespondance();
break;
case 'fusionIndex' :
$description = $this->getClasseIndex();
$description->fusionnerIndex();
break;
case 'uploadFichiersSp' :
$wiki = $this->getClasseWiki();
$wiki->uploaderFichiersSp();
break;
case 'downloadWiki' :
$wiki = $this->getClasseWiki();
$wiki->dowloaderPagesWiki();
break;
case 'uploadTxt' :
$wiki = $this->getClasseWiki();
$wiki->uploaderDansWikiEflore();
break;
case 'uploadIndex' :
$wiki = $this->getClasseWiki();
$wiki->uploaderIndexDansWikiEflore();
break;
case 'chargerTxt' :
$wiki = $this->getClasseWiki();
$wiki->chargerTxtDansWikiEflore();
break;
case 'chargerIndex' :
$wiki = $this->getClasseWiki();
$wiki->chargerIndexDansWikiEflore();
break;
default :
throw new Exception("Erreur : la commande '$cmd' n'existe pas!");
}
} catch (Exception $e) {
$this->traiterErreur($e->getMessage());
}
}
private function getClasseVersion() {
$version = $this->getClasse('Versions');
return $version;
}
private function getClasseDescription() {
$description = $this->getClasse('Description');
return $description;
}
private function getClasseIndex() {
$index = $this->getClasse('Index');
return $index;
}
private function getClasseWiki() {
$wiki = $this->getClasse('Wiki');
return $wiki;
}
private function getClasse($classeNom) {
$conteneur = new Conteneur();
$conteneur->setParametre('-v', $this->getParametre('-v'));
$conteneur->setParametre('scriptChemin', $this->getScriptChemin());
require_once dirname(__FILE__).'/'.$classeNom.'.php';
$objet = new $classeNom($conteneur);
return $objet;
}
}
?>