Changeset 107647 in spip-zone
- Timestamp:
- Nov 20, 2017, 1:48:26 PM (3 years ago)
- Location:
- _plugins_/mailsubscribers/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
_plugins_/mailsubscribers/trunk/action/mailsubscribers_export.php
r99117 r107647 2 2 /** 3 3 * Plugin mailsubscribers 4 * (c) 201 2Cédric Morin4 * (c) 2017 Cédric Morin 5 5 * Licence GNU/GPL v3 6 6 */ 7 7 8 if (!defined('_ECRIRE_INC_VERSION')) return; 8 if (!defined('_ECRIRE_INC_VERSION')) { 9 return; 10 } 9 11 10 12 … … 12 14 * Exporter la base au format CSV 13 15 * 14 * @param null|string $ statut16 * @param null|string $arg 15 17 */ 16 function action_mailsubscribers_export_dist($ statut= null) {17 if (is_null($ statut)) {18 function action_mailsubscribers_export_dist($arg = null) { 19 if (is_null($arg)) { 18 20 $securiser_action = charger_fonction('securiser_action', 'inc'); 19 $ statut= $securiser_action();21 $arg = $securiser_action(); 20 22 } 21 23 … … 26 28 } 27 29 30 $args = explode("-", $arg); 31 $statut = $args[0]; 32 $id_liste = isset($args[1]) ? intval($args[1]) : false; 33 28 34 $where = array(); 29 35 // '' ou 'all' pour tout exporter (sauf poubelle) 30 36 if (in_array($statut, array('', 'all'))) { 31 $where[] = " statut<>" . sql_quote('poubelle');37 $where[] = "M.statut<>" . sql_quote('poubelle'); 32 38 } else { 33 $where[] = " statut=" . sql_quote($statut);39 $where[] = "M.statut=" . sql_quote($statut); 34 40 } 35 36 41 37 42 $entetes = array( … … 44 49 ); 45 50 46 $titre = _T('mailsubscriber:titre_mailsubscribers') . "-" . $GLOBALS['meta']['nom_site'] . "-" . date('Y-m-d');47 51 $exporter_csv = charger_fonction("exporter_csv", "inc"); 48 52 $listes = sql_get_select('group_concat(L.identifiant)','spip_mailsubscriptions as S JOIN spip_mailsubscribinglists as L ON L.id_mailsubscribinglist=S.id_mailsubscribinglist','S.id_segment=0 AND S.id_mailsubscriber=M.id_mailsubscriber'); 49 $res = sql_select("M.email,M.nom,M.lang,M.date,M.statut,($listes) as listes", "spip_mailsubscribers AS M", $where); 53 // si un id_liste est present, restreindre l'export à cette liste 54 if ($id_liste) { 55 $identifiant = sql_getfetsel('identifiant', 'spip_mailsubscribinglists', 'id_mailsubscribinglist =' . intval($id_liste)); 56 $titre = _T('mailsubscriber:titre_mailsubscribers') . "-" . $GLOBALS['meta']['nom_site'] . "-" . $identifiant . "-" . date('Y-m-d'); 57 $where[] = "N.id_mailsubscribinglist=$id_liste"; 58 $res = sql_select( 59 "M.email,M.nom,M.lang,M.date,M.statut,($listes) as listes", 60 "spip_mailsubscribers AS M LEFT JOIN spip_mailsubscriptions as N ON M.id_mailsubscriber=N.id_mailsubscriber", 61 $where 62 ); 63 } else { 64 $titre = _T('mailsubscriber:titre_mailsubscribers') . "-" . $GLOBALS['meta']['nom_site'] . "-" . date('Y-m-d'); 65 $res = sql_select( 66 "M.email,M.nom,M.lang,M.date,M.statut,($listes) as listes", 67 "spip_mailsubscribers AS M", 68 $where 69 ); 70 } 50 71 $exporter_csv($titre, $res, ',', $entetes); 51 72 -
_plugins_/mailsubscribers/trunk/paquet.xml
r107224 r107647 2 2 prefix="mailsubscribers" 3 3 categorie="communication" 4 version="2.5. 3"4 version="2.5.4" 5 5 etat="stable" 6 6 compatibilite="[3.0.0;3.2.*]" -
_plugins_/mailsubscribers/trunk/prive/squelettes/navigation/mailsubscribers.html
r100927 r107647 7 7 <li class="item[(#ENV{id_mailsubscribinglist}|=={#ID_MAILSUBSCRIBINGLIST}|oui)on]">[(#SELF|parametre_url{s,''}|parametre_url{id_mailsubscribinglist,#ID_MAILSUBSCRIBINGLIST}|lien_ou_expose{#TITRE,#ENV{id_mailsubscribinglist}|=={#ID_MAILSUBSCRIBINGLIST}})] 8 8 ([(#IDENTIFIANT|mailsubscribers_compte_inscrits)]) 9 [(#ENV{id_mailsubscribinglist}|=={#ID_MAILSUBSCRIBINGLIST}|oui) 10 [(#PLUGIN{spip_bonux}|oui) 11 [(#URL_ACTION_AUTEUR{mailsubscribers_export,valide-#ID_MAILSUBSCRIBINGLIST}|icone_horizontale{<:mailsubscriber:titre_export_mailsubscribers:>,mailsubscriber-24,export})] 12 ] 13 ] 9 14 </li> 10 15 </BOUCLE_listes>
Note: See TracChangeset
for help on using the changeset viewer.