[ Index ]
 

Code source de SPIP Agora 1.4

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

title

Body

[fermer]

/Agora1-4/ecrire/ -> postinfo.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  include  ("inc.php");
  20  
  21  require_once (dirname(__FILE__). '/include/bd/inc_article_list_factory.php');
  22  require_once (dirname(__FILE__). '/include/bd/inc_newsletter_factory.php');
  23  require_once (dirname(__FILE__). '/include/bd/inc_cm_user_groups_factory.php');
  24  require_once (dirname(__FILE__). '/include/bd/inc_newsletter_instance_factory.php');
  25  require_once (dirname(__FILE__). "/include/bd/inc_subscriber_link_factory.php");
  26  require_once (dirname(__FILE__). '/include/bd/inc_metier_factory.php');
  27  require_once (dirname(__FILE__). '/inc_draw_api.php');
  28  require_once (dirname(__FILE__). '/inc_newsletter.php');
  29  //require_once (dirname(__FILE__).'/include/clevermail/settings.php');
  30  require_once("Mail.php");
  31  require_once("Mail/mime.php");
  32  
  33  $nlInstance = &recuperer_instance_newsletter_instance();
  34  
  35  if (isset($id_post)) {
  36      $nlInstance->load($id_post);
  37  }
  38  else {
  39      header ('Location: newsletter.php?id_newsletter=' . $id_newsletter);
  40  }
  41  
  42  $sujet = $nlInstance->getSubject();
  43  $dateCreation = new Date($nlInstance->getCreationDate());
  44  $dateModif = new Date($nlInstance->getModificationDate());
  45  
  46  if ($nlInstance->getSentDate() != null) {
  47      $dateEnvoi = new Date($nlInstance->getSentDate());
  48      $NLisAlreadySend = true;
  49  }
  50  else {
  51      $NLisAlreadySend = false;
  52  }
  53  
  54  $linkedArticleIds = $nlInstance->getLinkedArticleIds();
  55  $destinatairesSpecifiques = $nlInstance->getDestinatairesSpecifiques();
  56  
  57  if (isset($activerGroup)) {
  58      $nlInstance->activerGroupe($activerGroup);
  59  }
  60  
  61  if (isset($desactiverGroup)) {
  62      $nlInstance->desactiverGroupe($desactiverGroup);
  63  }
  64  
  65  $userGroupInactif = explode(";", $nlInstance->getUserGroupInactif());
  66  
  67  debut_page("Newsletter", "documents", "newsletter");
  68  
  69  debut_gauche();
  70  debut_raccourcis();
  71  icone_horizontale("Revenir &agrave la liste des lettres", "newsletter.php?id_newsletter=$id_newsletter", "edit.gif",
  72                    "rien.gif");
  73  $authorization = &recuperer_instance_authorization('envoyerLettresInfos', $GLOBALS['connect_id_auteur']);
  74  
  75  if ($authorization->isAuthorizedAction()) {
  76      icone_horizontale("G&eacute;rer les destinataires",
  77                        "post_admin_groups.php?id_post=$id_post&id_newsletter=$id_newsletter",
  78                        "redacteurs-24.gif",
  79                        "edit.gif");
  80  }
  81  
  82  fin_raccourcis();
  83  
  84  //Ajout fxlacroix : indication sur le nombre d'abonné de cette lettre
  85  debut_boite_info();
  86  $countTotat = &recuperer_instance_subscriber_link();
  87  $nbUser = $countTotat->nbUserHtmlText($_GET['id_newsletter']);
  88  echo _T('nbInscrit'). " : " . ($nbUser[0] + $nbUser[1]);
  89  fin_boite_info();
  90  //Fin ajout fxlacroix
  91  
  92  debut_droite();
  93  
  94  if ((!$nlInstance->isAlreadyQueued()) && !$NLisAlreadySend) {
  95      debut_cadre_relief ("newsletter-24.gif");
  96      $authorization = &recuperer_instance_authorization('envoyerLettresInfos', $GLOBALS['connect_id_auteur']);
  97  
  98      if ($authorization->isAuthorizedAction()) {
  99          echo "<p>";
 100          gros_titre (_T('newsletter_prete'));
 101          echo "<br /></p>";
 102          echo "<center>";
 103          echo "<form action='initialisation_postage.php' method='post'>";
 104          echo "<input type='hidden' name='id_newsletter' value='$id_newsletter'>";
 105          echo "<input type='hidden' name='id_post' value='$id_post'>";
 106          echo "<input type='submit' class='fondo' name='envoieNewsletter' value=\"" . _T('envoyer_newsletter'). "\">";
 107          echo "</form>";
 108          echo "</center>";
 109      }
 110      else {
 111          echo gros_titre(_T('pas_envoyer_newsletter'));
 112      }
 113      fin_cadre_relief();
 114  }
 115  else { // la lettre a deja ete envoyee ou est en passe de l etre
 116      debut_cadre_relief ("newsletter-24.gif");
 117      echo "<p>";
 118      gros_titre (_T('newsletter_deja'));
 119      echo "<br /></p>";
 120      fin_cadre_relief();
 121  }
 122  
 123  /*Ajout fxlacroix */
 124  /* permettre de suivre l'activité de l'envoi : Doit afficher un nombre de personne ayant reçu / nombre total */
 125  debut_cadre_relief();
 126  echo "<div>";
 127  $newsletterPartie = &recuperer_instance_newsletter_instance();
 128  $tabPercentage = $newsletterPartie->percentage_left($_GET['id_post'], $_GET['id_newsletter']);
 129  echo barreProgression(480, $tabPercentage[0], $tabPercentage[1]);
 130  fin_cadre_relief();
 131  /* Fin Ajout fxlacroix */
 132  
 133  debut_cadre_relief ("newsletter-24.gif");
 134  echo "\n<table cellpadding=0 cellspacing=0 border=0 width='100%'>";
 135  echo "<tr width='100%'><td width='100%' valign='top'>";
 136  gros_titre ($sujet);
 137  echo "</td>";
 138  
 139  echo "<td><img src='img_pack/rien.gif' width=5></td>\n";
 140  echo "<td  align='right' valign='top'>";
 141  icone("Modifier cette lettre d'information", "newsletter_post_edit.php?id_newsletter=$id_newsletter&id_post=$id_post",
 142        "newsletter-24.gif", "edit.gif");
 143  echo "</td>";
 144  echo "</tr>\n";
 145  
 146  affiche_bloc_contenu(_T('creee_le'),
 147                       sprintf("%04d/%02d/%02d &agrave; %02d:%02d:%02d", $dateCreation->getYear(),
 148                               $dateCreation->getMonth(), $dateCreation->getDay(),
 149                               $dateCreation->getHour(), $dateCreation->getMinute(),
 150                               $dateCreation->getSecond()));
 151  
 152  if (Date::Compare($dateCreation, $dateModif) != 0) {
 153      affiche_bloc_contenu(_T('modifiee_le'),
 154                           sprintf("%04d/%02d/%02d &agrave; %02d:%02d:%02d", $dateModif->getYear(),
 155                                   $dateModif->getMonth(), $dateModif->getDay(),
 156                                   $dateModif->getHour(), $dateModif->getMinute(),
 157                                   $dateModif->getSecond()));
 158  }
 159  
 160  if ($dateEnvoi != null) {
 161      //var_dump($dateEnvoi);
 162      affiche_bloc_contenu('Envoy&eacute;e le ',
 163                           sprintf("%04d/%02d/%02d &agrave; %02d:%02d:%02d", $dateEnvoi->getYear(),
 164                                   $dateEnvoi->getMonth(), $dateEnvoi->getDay(),
 165                                   $dateEnvoi->getHour(), $dateEnvoi->getMinute(),
 166                                   $dateEnvoi->getSecond()));
 167  }
 168  
 169  echo "<tr><td colspan='3'><table border='0' width='100%'><tr>";
 170  
 171  for ($i = 0; $i < $spacer; $i++) {
 172      echo "<td><img src='img_pack/rien.gif' height=1 width=" . SPACESIZE . "></td>\n";
 173  }
 174  
 175  echo "<td width='100%'><div align='left' style='padding: 5px'>";
 176  echo "<font size=3 face='Verdana,Arial,Helvetica,sans-serif'><b>$contenuDescription</b></font><br>";
 177  echo "<font size=2 face='Verdana,Arial,Helvetica,sans-serif'>";
 178  
 179  $articleList = &recuperer_instance_list_articles();
 180  
 181  if (PEAR::isError($articeList)) {
 182      die ($articleList->getMessage());
 183  }
 184  
 185  $queryParams = array();
 186  $queryParams[] = implode($linkedArticleIds, ",");
 187  $queryParams[] = $id_post;
 188  
 189  if (count($linkedArticleIds) > 0) { // HACK a améliorer
 190      $articleList->displayHTMLList('Articles s&eacute;lectionn&eacute;s', ARTICLES_IN_NL, $queryParams, false, false,
 191                                    true, false);
 192  }
 193  
 194  $newsletterMetier = &recuperer_instance_newsletter();
 195  
 196  $loadOK = $newsletterMetier->load($id_newsletter);
 197  
 198  if (PEAR::isError($loadOK)) {
 199      die ($loadOK->getMessage());
 200  }
 201  
 202  $squeletteHTML = $newsletterMetier->getHtmlSkeleton();
 203  $squeletteTexte = $newsletterMetier->getTexteSkeleton();
 204  
 205  global $auteur_session;
 206  
 207  echo '<div align=center>';
 208  //$adresse = '../previsualisationNL.php?fondNL=' . $squeletteHTML . '&nl_preview_path=' . $id_newsletter.'/html/&id_post_newsletter='.$id_post.'&id_personnalisation_newsletter='.$auteur_session['id_auteur'].'&recalcul=oui&submit=Recalculer+cette+page';
 209  $adresse
 210      = '../previsualisationNL.php?fondNL=' . $squeletteHTML . '&id_post_newsletter=' . $id_post . '&id_personnalisation_newsletter=' . $auteur_session['id_auteur']. '&recalcul=oui';
 211  echo "<br><INPUT CLASS='fondo' TYPE='button' NAME='VisuHTML' VALUE='Visualiser $squeletteHTML.html' onClick=\"javascript:window.open('$adresse','previsualisationNL')\";>";
 212  
 213  //$adresse = '../previsualisationNL.php?fondNL=' . $squeletteTexte . '&nl_preview_path=' . $id_newsletter.'/texte/&id_post_newsletter='.$id_post.'&id_personnalisation_newsletter='.$auteur_session['id_auteur'].'&recalcul=oui&submit=Recalculer+cette+page';
 214  $adresse
 215      = '../previsualisationNL.php?fondNL=' . $squeletteTexte . '&id_post_newsletter=' . $id_post . '&id_personnalisation_newsletter=' . $auteur_session['id_auteur']. '&recalcul=oui';
 216  echo "<br><br><INPUT CLASS='fondo' TYPE='button' NAME='VisuTexte' VALUE='Visualiser $squeletteTexte.txt' onClick=\"javascript:window.open('$adresse','previsualisationNL');\">";
 217  echo "</div>";
 218  
 219  echo "</font>";
 220  echo "</div>";
 221  
 222  echo "</td></tr>\n";
 223  echo "</table></td></tr>\n";
 224  echo "</table>\n";
 225  fin_cadre_relief();
 226  
 227  debut_cadre_relief ("redacteurs-24.gif");
 228  echo "\n<table cellpadding=0 cellspacing=0 border=0 width='100%'>";
 229  echo "<tr width='100%'><td width='100%' valign='top'>";
 230  gros_titre ('Groupes d\'utilisateurs destinataires ');
 231  //titre_bloc_contenu();
 232  echo "</td>";
 233  echo "<td>\n";
 234  icone("G&eacute;rer les destinataires", "post_admin_groups.php?id_post=$id_post&id_newsletter=$id_newsletter",
 235        "redacteurs-24.gif", "edit.gif");
 236  echo "</td>";
 237  echo "</tr>\n";
 238  
 239  sous_titre_bloc_contenu ('Groupes par défaut');
 240  
 241  $CMUserGroups = &recuperer_instance_cm_user_groups();
 242  $allGroups = $CMUserGroups->getAllUserGroups($id_newsletter);
 243  
 244  if (PEAR::isError($allGroups)) {
 245      die ($allGroups->getMessage());
 246  }
 247  
 248  $i = 0;
 249  
 250  while (list(, $myGroup) = each($allGroups)) {
 251      $authorization = &recuperer_instance_authorization('modifierCMuserGroupe', $GLOBALS['connect_id_auteur']);
 252      if (!$authorization->isAuthorizedAction()) {
 253          affiche_bloc_contenu('', $myGroup->getTitre());
 254      }
 255      else {
 256          if (in_array($myGroup->getGroupeId(), $userGroupInactif)) {
 257              $activerUrl
 258                  = "<img src='img_pack/puce-rouge.gif' alt='Groupe Inactif' width='13' height='14' border='0'>&nbsp;";
 259              $activerUrl
 260                  .= "<a href='newsletter_admin_groups.php?id_newsletter=$id_newsletter'>" . $myGroup->getTitre(). "</a>";
 261              $activerUrl
 262                  .= " | <a href='postinfo.php?id_post=$id_post&id_newsletter=$id_newsletter&activerGroup=" . $myGroup->getGroupeId(). "'>activer</a>";
 263          }
 264          else {
 265              $activerUrl
 266                  = "<img src='img_pack/puce-verte.gif' alt='Groupe Actif' width='13' height='14' border='0'>&nbsp;";
 267              $activerUrl
 268                  .= "<a href='newsletter_admin_groups.php?id_newsletter=$id_newsletter'>" . $myGroup->getTitre(). "</a>";
 269              $activerUrl
 270                  .= " | <a href='postinfo.php?id_post=$id_post&id_newsletter=$id_newsletter&desactiverGroup=" . $myGroup->getGroupeId(). "'>désactiver</a>";
 271          }
 272          affiche_bloc_contenu('', $activerUrl);
 273      }
 274  }
 275  
 276  sous_titre_bloc_contenu ('Groupes sp&eacute; sp&eacute;cifiques');
 277  $CMUserGroups = &recuperer_instance_cm_user_groups();
 278  $allGroupsForPostId = $CMUserGroups->getAllUserGroupsForPostId($id_post);
 279  
 280  if (PEAR::isError($allGroupsForPostId)) {
 281      die ($allGroupsForPostId->getMessage());
 282  }
 283  
 284  $i = 0;
 285  
 286  while (list(, $myGroup) = each($allGroupsForPostId)) {
 287      $authorization = &recuperer_instance_authorization('modifierCMuserGroupeInstance', $GLOBALS['connect_id_auteur']);
 288      if (!$authorization->isAuthorizedAction()) {
 289          affiche_bloc_contenu('', $myGroup->getTitre());
 290      }
 291      else {
 292          affiche_bloc_contenu('',
 293                               '<a href="post_admin_groups.php?id_post=' . $id_post . '&id_newsletter=' . $id_newsletter . '">' . $myGroup->getTitre(). '</a>');
 294      }
 295  }
 296  
 297  sous_titre_bloc_contenu ('Destinataires sp&eacute;cifiques');
 298  $destinatairesSpecifiques = explode(";", $destinatairesSpecifiques);
 299  $i = 1;
 300  
 301  while (list(, $monDestinataireSpecifique) = each($destinatairesSpecifiques)) {
 302      if ($monDestinataireSpecifique != '') {
 303          affiche_bloc_contenu('Destinataire ' . $i++ . ':', $monDestinataireSpecifique);
 304      }
 305  }
 306  
 307  echo "</table>\n";
 308  
 309  fin_cadre_relief();
 310  
 311  fin_page();
 312  ?>


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