[ Index ]
 

Code source de SPIP Agora 1.4

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

title

Body

[fermer]

/Agora1-4/ecrire/ -> articles_tous.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  // abstraction BD
  22  require_once ("PEAR.php");
  23  require_once (dirname(__FILE__). "/include/bd/inc_article_list_factory.php");
  24  
  25  include_ecrire  ("inc_layer.php");
  26  
  27  if (count($aff_art) > 0)
  28      $aff_art = join(',', $aff_art);
  29  else
  30      $aff_art = 'prop,publie,valid';
  31  
  32  $statut_art = "'" . join("','", explode(",", $aff_art)). "'";
  33  
  34  debut_page(_T('titre_page_articles_tous'), "asuivre", "tout-site");
  35  debut_gauche();
  36  
  37  echo "<form action='articles_tous.php' method='get'>";
  38  echo "<input type='hidden' name='liste_coll' value='$liste_coll'>";
  39  echo "<input type='hidden' name='aff_art[]' value='x'>";
  40  
  41  debut_boite_info();
  42  echo "<B>" . _T('titre_cadre_afficher_article'). "&nbsp;:</B><BR>";
  43  
  44  $profilMetier = &recuperer_instance_profil();
  45  $monProfil = $profilMetier->getProfilForIntitule('item_redacteur');
  46  
  47  if (PEAR::isError($monProfil)) {
  48      die ($monProfil->getMessage());
  49  }
  50  
  51  if ($connect_profil >= $monProfil->getPoids()) {
  52      if (ereg('prepa', $aff_art)) {
  53          echo "<input type='checkbox' CHECKED name='aff_art[]' value='prepa' id='prepa'>";
  54      }
  55      else {
  56          echo "<input type='checkbox' name='aff_art[]' value='prepa' id='prepa'>";
  57      }
  58  
  59      echo " <label for='prepa'><img src='img_pack/puce-blanche-breve.gif' alt='' width='8' height='9' border='0'>";
  60      echo "  " . _T('texte_statut_en_cours_redaction'). "</label><BR>";
  61  }
  62  
  63  if (ereg('prop', $aff_art)) {
  64      echo "<input type='checkbox' CHECKED name='aff_art[]' value='prop' id='prop'>";
  65  }
  66  else {
  67      echo "<input type='checkbox' name='aff_art[]' value='prop' id='prop'>";
  68  }
  69  
  70  echo " <label for='prop'><img src='img_pack/puce-orange-breve.gif' alt='' width='8' height='9' border='0'>";
  71  echo "  " . _T('texte_statut_attente_validation'). "</label><BR>";
  72  
  73  if (ereg('valid', $aff_art)) {
  74      echo "<input type='checkbox' CHECKED name='aff_art[]' value='valid' id='valid'>";
  75  }
  76  else {
  77      echo "<input type='checkbox' name='aff_art[]' value='valid' id='valid'>";
  78  }
  79  
  80  echo " <label for='valid'><img src='img_pack/puce-jaune.gif' alt='' width='9' height='9' border='0'>";
  81  echo "  " . _T('texte_statut_valides'). "</label><BR>";
  82  
  83  if (ereg('publie', $aff_art)) {
  84      echo "<input type='checkbox' CHECKED name='aff_art[]' value='publie' id='publie'>";
  85  }
  86  else {
  87      echo "<input type='checkbox' name='aff_art[]' value='publie' id='publie'>";
  88  }
  89  
  90  echo " <label for='publie'><img src='img_pack/puce-verte-breve.gif' alt='' width='8' height='9' border='0'>";
  91  echo "  " . _T('texte_statut_publies'). "</label><BR>";
  92  
  93  if (ereg('archi', $aff_art)) {
  94      echo "<input type='checkbox' CHECKED name='aff_art[]' value='archi' id='archi'>";
  95  }
  96  else {
  97      echo "<input type='checkbox' name='aff_art[]' value='archi' id='archi'>";
  98  }
  99  
 100  echo " <label for='archi'><img src='img_pack/puce-marron.gif' alt='' width='9' height='9' border='0'>";
 101  echo "  " . _T('texte_statut_archives'). "</label><BR>";
 102  
 103  $profilMetier = &recuperer_instance_profil();
 104  $monProfil = $profilMetier->getProfilForIntitule('item_redacteur');
 105  
 106  if (PEAR::isError($monProfil)) {
 107      die ($monProfil->getMessage());
 108  }
 109  
 110  if ($connect_profil >= $monProfil->getPoids()) {
 111      if (ereg("refuse", $aff_art)) {
 112          echo "<input type='checkbox' CHECKED name='aff_art[]' value='refuse' id='refuse'>";
 113      }
 114      else {
 115          echo "<input type='checkbox' name='aff_art[]' value='refuse' id='refuse'>";
 116      }
 117  
 118      echo " <label for='refuse'><img src='img_pack/puce-rouge-breve.gif' alt='' width='8' height='9' border='0'>";
 119      echo "  " . _T('texte_statut_refuses'). "</label><BR>";
 120  
 121      if (ereg('poubelle', $aff_art)) {
 122          echo "<input type='checkbox' CHECKED name='aff_art[]' value='poubelle' id='poubelle'>";
 123      }
 124      else {
 125          echo "<input type='checkbox' name='aff_art[]' value='poubelle' id='poubelle'>";
 126      }
 127  
 128      echo " <label for='poubelle'><img src='img_pack/puce-poubelle-breve.gif' alt='' width='8' height='9' border='0'>";
 129      echo "  " . _T('texte_statut_poubelle'). "</label>";
 130  }
 131  
 132  echo "<div align='right'><INPUT TYPE='submit' NAME='Changer' CLASS='fondo' VALUE='" . _T('bouton_changer'). "'></div>";
 133  fin_boite_info();
 134  echo "</form>";
 135  
 136  debut_droite();
 137  
 138  function afficher_rubriques_filles ($id_parent) {
 139      global $rubrique, $enfant, $article;
 140      global $spip_lang_left, $spip_lang_right;
 141      global $couleur_claire;
 142  
 143      if ($enfant[$id_parent]) {
 144          while (list(, $id_rubrique) = each($enfant[$id_parent])) {
 145  
 146              // On vérifie que l'auteur à le droit de consulter la rubrique
 147              $authorization = &recuperer_instance_authorization(
 148                                    'isManagedRubriqueByAuteurId', $GLOBALS['connect_id_auteur'],
 149                                    array('rubriqueId' => $id_rubrique));
 150  
 151              if (!$authorization->isAuthorizedAction()) {
 152                  continue;
 153              }
 154  
 155              if ($id_parent == 0) {
 156                  $icone = "secteur-24.gif";
 157                  $bgcolor = " background-color: $couleur_claire;";
 158              }
 159              else {
 160                  $icone = "rubrique-24.gif";
 161                  $bgcolor = "";
 162              }
 163  
 164              echo "<div style='padding-top: 5px; padding-bottom: 5px; padding-$spip_lang_left: 28px; background: url(img_pack/$icone) $spip_lang_left center no-repeat;$bgcolor'>";
 165  
 166              if ($enfant[$id_rubrique]OR $article[$id_rubrique])
 167                  echo bouton_block_invisible("rubrique$id_rubrique");
 168  
 169              echo "<b class='verdana2'><a href='naviguer.php?coll=$id_rubrique'>";
 170              echo $rubrique[$id_rubrique];
 171              echo "</b></a></div>\n";
 172  
 173              if ($enfant[$id_rubrique]OR $article[$id_rubrique]) {
 174                  echo debut_block_invisible("rubrique$id_rubrique");
 175  
 176                  echo "<div class='plan-rubrique'>";
 177  
 178                  if ($article[$id_rubrique]) {
 179                      echo "<div class='plan-articles'>";
 180  
 181                      while (list(, $zarticle) = each($article[$id_rubrique])) {
 182                          echo "$zarticle\n";
 183                      }
 184                      echo "</div>";
 185                  }
 186  
 187                  afficher_rubriques_filles ($id_rubrique);
 188                  echo "</div>";
 189                  echo fin_block();
 190              }
 191              if ($id_parent == 0)
 192                  echo "<div>&nbsp;</div>";
 193          }
 194      }
 195  }
 196  
 197  // Recuperer toutes les rubriques 
 198  
 199  $rubriqueMetier = &recuperer_instance_rubrique();
 200  $rubriques = $rubriqueMetier->getAllRubriqueOrderBy("titre");
 201  
 202  if (PEAR::isError($rubriques)) {
 203      die ($rubriques->getMessage());
 204  }
 205  
 206  while (list(, $maRubrique) = each($rubriques)) {
 207      $id_rubrique = $maRubrique->getRubriqueId();
 208      $titre = $maRubrique->getTitre();
 209      $id_parent = $maRubrique->getParentId();
 210  
 211      $les_rubriques[] = "rubrique$id_rubrique";
 212  
 213      $nom_block = "rubrique$id_rubrique";
 214  
 215      if (!$numero_block["$nom_block"] > 0) {
 216          $compteur_block++;
 217          $numero_block["$nom_block"] = $compteur_block;
 218  
 219          if (!$first_couche)
 220              $first_couche = $compteur_block;
 221          $last_couche = $compteur_block;
 222      }
 223  
 224      if ($id_parent == '0') {
 225          $rubrique[$id_rubrique] = "$titre";
 226      }
 227      else {
 228          $rubrique[$id_rubrique] = "$titre";
 229      }
 230      $enfant[$id_parent][] = $id_rubrique;
 231  }
 232  
 233  $articleMetier = &recuperer_instance_article();
 234  $rubriqueIds = $articleMetier->getRubriqueIds();
 235  
 236  while (list(, $rubriqueId) = each($rubriqueIds)) {
 237      $id_rubrique = $rubriqueId;
 238      $rubriques_actives[$id_rubrique] = $id_rubrique;
 239  }
 240  
 241  $articles = $articleMetier->getAllArticleForStatutsOrderBy($statut_art);
 242  
 243  foreach ($articles as $monArticle) {
 244      $id_rubrique = $monArticle->getRubriqueId();
 245      $id_article = $monArticle->getArticleId();
 246      $titre = $monArticle->getTitre();
 247      $statut = $monArticle->getStatut();
 248  
 249      $article[$id_rubrique][] = "<a class='$statut' href='articles.php?id_article=$id_article'>$titre</a>\n";
 250  }
 251  
 252  $javasc_ouvrir = "manipuler_couches('ouvrir','$spip_lang_rtl',$first_couche,$last_couche)";
 253  $javasc_fermer = "manipuler_couches('fermer','$spip_lang_rtl',$first_couche,$last_couche)";
 254  
 255  // Demarrer l'affichage
 256  if ($les_rubriques AND test_layer()) {
 257      $les_rubriques = join($les_rubriques, ",");
 258      echo "<div>&nbsp;</div>";
 259      echo "<b class='verdana3'>";
 260      echo "<a href=\"javascript:$javasc_ouvrir\">";
 261      echo _T('lien_tout_deplier');
 262      echo "</a>";
 263      echo "</b>";
 264      echo " | ";
 265      echo "<b class='verdana3'>";
 266      echo "<a href=\"javascript:$javasc_fermer\">";
 267      echo _T('lien_tout_replier');
 268      echo "</a>";
 269      echo "</b>";
 270      echo "<div>&nbsp;</div>";
 271  }
 272  
 273  afficher_rubriques_filles (0);
 274  
 275  fin_page();
 276  ?>


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