[ Index ] |
|
Code source de SPIP Agora 1.4 |
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_newsletter_factory.php"); 22 require_once (dirname(__FILE__). "/include/bd/inc_newsletter_instance_factory.php"); 23 24 if (!isset($id_newsletter)) { 25 header ('Location: newsletter_page.php'); 26 } 27 28 lire_metas(); 29 30 session_start(); 31 32 //var_dump($_SESSION['selected_articles']); 33 //echo '<br>'; 34 //var_dump($_SESSION['selected_articles_array']); 35 if ($_SESSION['selected_articles_array'] == NULL) { 36 //$_SESSION['selected_articles_array'] = array(); 37 $_SESSION['selected_articles_array'] = $_SESSION['selected_articles']; 38 } 39 40 //var_dump($_SESSION['selected_articles_array']); 41 $urlParams = '?'; 42 43 if ($new == 'oui') { 44 $urlParams .= 'new=oui&'; 45 } 46 else { 47 $urlParams .= 'mod=oui&id_post=' . $id_post . '&'; 48 } 49 50 $urlParams .= 'id_newsletter=' . $id_newsletter; 51 52 $newsletterMetier = &recuperer_instance_newsletter(); 53 $newsletterMetier->load($id_newsletter); 54 $nbArticles = $newsletterMetier->getNbArticles(); 55 56 $postMetier = &recuperer_instance_newsletter_instance(); 57 58 if ($new != "oui") { 59 //Faire d'abord l'update des champs et articles sélectionnés sur l'écran précédent! 60 $postMetier->load($id_post); 61 $id = $postMetier->getId(); 62 } 63 else { 64 //Ici, creation de la NL en base de donnée, et renseignement de la var globale id_post 65 } 66 67 //Ici récupération de la liste d'articles sélectionnés pour la NL. 68 69 debut_page("Newsletter", "documents", "newsletter"); 70 debut_gauche(); 71 debut_raccourcis(); 72 icone_horizontale("Revenir à, la liste des lettres", "newsletter.php?id_newsletter=$id_newsletter", "edit.gif", 73 "rien.gif"); 74 fin_raccourcis(); 75 76 debut_droite(); 77 debut_cadre_formulaire(); 78 79 // 80 // Modification d'une Newsletter 81 // 82 echo "\n<table cellpadding=0 cellspacing=0 border=0 width='100%'>"; 83 echo "<tr width='100%'>"; 84 echo "<td>"; 85 icone("Annuler", "newsletter.php?id_newsletter=$id_newsletter", "newsletter-24.gif", "rien.gif"); 86 87 echo "</td>"; 88 echo "<td><img src='img_pack/rien.gif' width=10></td>\n"; 89 echo "<td width='100%'>"; 90 91 if ($new != "oui") 92 echo "Modifier la lettre d'information :"; 93 else 94 echo "Créer une lettre d'information :"; 95 96 gros_titre ($_SESSION['sujet']); 97 $sujets = addslashes(corriger_caracteres($sujets)); 98 echo "</td></tr></table>"; 99 100 echo "<form action='newsletter.php' method='post'>"; 101 echo "<input type='hidden' name='id_newsletter' value='$id_newsletter'>"; 102 echo "<input type='hidden' name='sujets' value=\"$sujets\">"; 103 104 if ($new != "oui") { 105 echo "<input type='hidden' name='id_post' value='$id_post'>"; 106 echo "<input type='hidden' name='mod' value='oui'>"; 107 } 108 else { 109 echo "<input type='hidden' name='new' value='oui'>"; 110 } 111 112 gros_titre ('Etape 3'); 113 114 echo "<p><b>Ordonancement des articles sélectionnés</b><br>"; 115 116 if ($_SESSION['selected_articles_array'] != NULL) { 117 echo "Reordonnancement et affichage<br>"; 118 $articles_array = $_SESSION['selected_articles_array']; 119 120 if (isset($newpos) && isset($id_article)) { 121 echo 'Changement des positions<br>'; 122 $articleFound = false; 123 $articleToSwapIndex = 0; 124 125 while (!$articleFound && $articleToSwapIndex < sizeof($articles_array)) { 126 $currentArticleId = $articles_array[$articleToSwapIndex]; 127 128 if ($currentArticleId == $id_article) { 129 $articleFound = true; 130 } 131 $articleToSwapIndex++; 132 } 133 if ($articleFound) { 134 $articleToSwapIndex--; 135 $tempIdArticle = $articles_array[$newpos]; 136 $articles_array[$newpos] = $id_article; 137 $articles_array[$articleToSwapIndex] = $tempIdArticle; 138 $_SESSION['selected_articles_array'] = $articles_array; 139 } 140 } 141 142 $articleMetier = &recuperer_instance_article(); 143 144 //for ($position = 0; $position < sizeof($articles_array); $position++) { 145 $position = 0; 146 147 while (list(, $monArticleId) = each($articles_array)) { 148 $loadOK = $articleMetier->load($monArticleId); 149 150 if (PEAR::isError($loadOK)) { 151 die ($loadOK->getMessage()); 152 } 153 154 $id_article = $articleMetier->getArticleId(); 155 $titre_article = $articleMetier->getTitre(); 156 $statut_article = $articleMetier->getStatut(); 157 158 echo $titre_article . ' '; 159 160 //$urlArticle = $meta['adresse_site']."/ecrire/newsletter_post_edit_step3.php$urlParams&id_article=$id_article&newpos="; 161 $urlArticle = "/ecrire/newsletter_post_edit_step3.php$urlParams&id_article=$id_article&newpos="; 162 $posMonter = $position - 1; 163 $posDescendre = $position + 1; 164 165 if ($position > 0) { 166 echo " <a href=\"$urlArticle$posMonter\">monter</a>"; 167 } 168 169 if ($position < sizeof($articles_array) - 1) { 170 echo " <a href=\"$urlArticle$posDescendre\">descendre</a>"; 171 } 172 173 echo '<br>'; 174 $position++; 175 } 176 echo "<br>"; 177 } 178 179 echo "<DIV ALIGN='center'>"; 180 //echo "<INPUT CLASS='fondo' TYPE='submit' NAME='step2' VALUE=\"Retour à l'étape 1\" O>"; 181 echo "<img src='img_pack/rien.gif' height='1' width='100'>"; 182 echo "<INPUT CLASS='fondo' TYPE='submit' NAME='terminer' VALUE=\"Terminer\">"; 183 echo "</DIV></FORM>"; 184 185 fin_cadre_formulaire(); 186 fin_page(); 187 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Feb 24 14:40:03 2007 | par Balluche grâce à PHPXref 0.7 |