Subversion Repositories eFlore/Applications.del

Compare Revisions

Ignore whitespace Rev 2210 → Rev 2211

/branches/v1.12-magnesium/scripts/modules/commentaires/Commentaires.php
New file
0,0 → 1,47
<?php
//declare(encoding='UTF-8');
/**
* Envoie les alertes par email sur les commentaires ajoutées dans DEL.
* Utilisation : <code>/opt/lampp/bin/php cli.php commentaires -a alerteMail</code>
*
* @category DEL
* @package Scripts
* @subpackage Commentaires
* @author Mathias CHOUET <mathias@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Aurelien PERONNET <aurelien@tela-botanica.org>
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @copyright 1999-2014 Tela Botanica <accueil@tela-botanica.org>
*/
class Commentaires extends DelScript {
 
protected $parametres_autorises = array(
'-t' => array(false, true, 'Indiquez votre e-mail pour tester le script.'),
'-d' => array(false, true, "Indiquer une date au format yyyy-mm-dd pour renvoyer l'alerte de cette date."));
 
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);
}
}