[PLUGINS] +set de base
[lhc/web/www.git] / www / plugins / notifications2 / notifications / instituerbreve.php
1 <?php
2 /*
3 * Plugin Notifications
4 * (c) 2009-2012 SPIP
5 * Distribue sous licence GPL
6 *
7 */
8
9 if (!defined("_ECRIRE_INC_VERSION")) return;
10
11 // Fonction appelee par divers pipelines
12 // http://doc.spip.org/@notifications_instituerbreve_dist
13 function notifications_instituerbreve_dist($quoi, $id_breve, $options) {
14
15 // ne devrait jamais se produire
16 if ($options['statut'] == $options['statut_ancien']) {
17 spip_log("statut inchange",'notifications');
18 return;
19 }
20
21 include_spip('inc/texte');
22
23 $modele = "";
24 if ($options['statut'] == 'publie') {
25 $modele = "notifications/breve_publie";
26 }
27
28 if ($options['statut'] == 'prop' AND $options['statut_ancien'] != 'publie')
29 $modele = "notifications/breve_propose";
30
31 if ($modele){
32 $destinataires = array();
33 if ($GLOBALS['meta']["suivi_edito"] == "oui")
34 $destinataires = explode(',',$GLOBALS['meta']["adresse_suivi"]);
35
36
37 $destinataires = pipeline('notifications_destinataires',
38 array(
39 'args'=>array('quoi'=>$quoi,'id'=>$id_breve,'options'=>$options)
40 ,
41 'data'=>$destinataires)
42 );
43
44 $texte = email_notification_objet($id_breve, "breve", $modele);
45 notifications_envoyer_mails($destinataires, $texte);
46 }
47 }
48
49 ?>