Subversion Repositories eFlore/Applications.del

Rev

Rev 1621 | 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 commentaires -a alerteMail
 *
 * @category    php 5.4
 * @package             DEL
 * @subpackage  Scripts
 * @author              Aurélien PERONNET <aurelien@tela-botanica.org>
 * @copyright   Copyright (c) 2012, Tela Botanica (accueil@tela-botanica.org)
* @license              CeCILL v2 http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt
 * @license             GNU-GPL http://www.gnu.org/licenses/gpl.html
 */
class Commentaires extends DelScript {

        public function executer() {
                try {
                        $this->initialiserProjet('commentaires');

                        // Lancement de l'action demandée
                        $cmd = $this->getParametre('a');
                        switch ($cmd) {
                                case 'alerteMail' :
                                        $script = $this->chargerClasse('AlerteMailCommentaires');
                                        $script->executer();
                                        break;
                                default :
                                        throw new Exception("Erreur : la commande '$cmd' n'existe pas!");
                        }
                } catch (Exception $e) {
                        $this->traiterErreur($e->getMessage());
                }
        }

        private function chargerClasse($classe) {
                require_once $classe.'.php';
                $conteneur = new Conteneur($this->parametres);
                return new $classe($conteneur);
        }
}
?>