[ Index ]
 

Code source de SPIP Agora 1.4

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/Agora1-4/ecrire/ -> export_newsletter_user_csv.php (source)

   1  <?php
   2  /*****************************************************
   3  * This file is part of Agora, web based content management system.
   4  *
   5  * Agora is free software; you can redistribute it and/or modify
   6  * it under the terms of the GNU General Public License as published by
   7  * the Free Software Foundation; version 2 of the License.
   8  *
   9  * Agora is distributed in the hope that it will be useful,
  10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  * GNU General Public License for more details (file "COPYING").
  13  *
  14  * Copyright © Arnaud Martin, Antoine Pitrou et Philippe Rivière.
  15  * List of authors detailed in "copyright_fr.html" file.
  16  * E-mail : agora@sig.premier-ministre.gouv.fr
  17  * Web site : http://www.agora.gouv.fr
  18  *****************************************************/
  19  //************ Enregistrement des utilisateurs de la newsletter  - fxlacroix@clever-age.com **************************/
  20  //  $ID$
  21  //  Choix du nom de fichier pour l'exportation au format CSV
  22  require_once ("PEAR.php");
  23  
  24  require_once (dirname(__FILE__). "/include/bd/inc_auteur_factory.php");
  25  include  ("inc.php");
  26  include_ecrire  ("inc_mots.php");
  27  require_once (dirname(__FILE__). "/include/bd/inc_newsletter_factory.php");
  28  require_once (dirname(__FILE__). "/include/bd/inc_cm_user_groups_factory.php");
  29  require_once (dirname(__FILE__). "/inc_newsletter_constants.php");
  30  require_once (dirname(__FILE__). "/inc_draw_api.php");
  31  require_once (dirname(__FILE__). "/include/bd/inc_subscriber_cm_factory.php");
  32  require_once (dirname(__FILE__). "/include/bd/inc_newsletter_cm_list_factory.php");
  33  require_once (dirname(__FILE__). "/include/bd/inc_subscriber_link_factory.php");
  34  require_once (dirname(__FILE__). "/include/bd/inc_subscriber_pending_factory.php");
  35  
  36  header ('Content-Type: text/x-csv');
  37  
  38  if (ereg("MSIE", $_SERVER['HTTP_USER_AGENT'])) {
  39      header ('Content-Disposition: inline; filename="newsletter.csv"');
  40  }
  41  else {
  42      header ('Content-Disposition: attachment; filename="newsletter.csv"');
  43  }
  44  
  45  //fxlacroix  -  liste_user_non_inscrit
  46  //Pour l'exportation, on cree les personnes qui sont inscrits dans le fichier csfv en précisant le lrs mode et le mot inscrit
  47  //Pour cela on utilise la table spip_LINK
  48  $subscriber = &recuperer_instance_subscriber_link();
  49  $tab_total = $subscriber->liste($id_newsletter);
  50  $tab_inscrits = $tab_total[0];
  51  $tab_non_inscrits = $tab_total[1];
  52  
  53  if (is_array($tab_inscrits)) {
  54      foreach ($tab_inscrits as $inscrits) {
  55          echo ($inscrits['email']. "," . $inscrits['sub_first_name']. "," . $inscrits['sub_middle_name']. "," . $inscrits['sub_last_name']. "," . $inscrits['sub_title']. "," . ($inscrits['mode']
  56                                                                                                                                                                                     == 1
  57                                                                                                                                                                                     ? 'html'
  58                                                                                                                                                                                     : 'text'). ",inscrit\n");
  59      }
  60  }
  61  
  62  if (is_array($tab_non_inscrits)) {
  63      foreach ($tab_non_inscrits as $inscrits) {
  64          echo ($inscrits['email']. "," . $inscrits['sub_first_name']. "," . $inscrits['sub_middle_name']. "," . $inscrits['sub_last_name']. "," . $inscrits['sub_title']. "," . ($inscrits['mode']
  65                                                                                                                                                                                     == 1
  66                                                                                                                                                                                     ? 'html'
  67                                                                                                                                                                                     : 'text'). ",en attente\n");
  68      }
  69  }
  70  
  71  unset ($subscriber);
  72  ?>


Généré le : Sat Feb 24 14:40:03 2007 par Balluche grâce à PHPXref 0.7