[ Index ]
 

Code source de SPIP Agora 1.4

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

title

Body

[fermer]

/Agora1-4/ecrire/ -> verif_mot_granularite.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  require_once  ("inc.php");
  20  
  21  require_once (dirname(__FILE__). "/include/bd/inc_groupe_mot_factory.php");
  22  require_once (dirname(__FILE__). "/include/bd/inc_mot_factory.php");
  23  // Ce script vérifie les conséquences d'un changement de mot clé en terme
  24  // de granularité.
  25  
  26  $motMetier = &recuperer_instance_mot();
  27  $groupeMotMetier = &recuperer_instance_groupe_mot();
  28  $allMots = $motMetier->getAllFromMotsAndAnotherTable($table, $id_table, $id_objet);
  29  
  30  if (PEAR::isError($allMots)) {
  31      die ($allMots->getMessage());
  32  }
  33  
  34  // Calcul de l'URL de destination
  35  reset ($_GET);
  36  
  37  while (list($key, $value) = each($_GET)) {
  38      if ($key != 'url_post_check' && $key != 'verif_granularite') {
  39          $params .= "$key=$value&";
  40      }
  41  }
  42  
  43  $redirectURL = $url_post_check . '?' . $params;
  44  //Boucle sur les mots clés attaché à l'article
  45  
  46  while (list(, $mot) = each($allMots)) {
  47      $motsUsed[] = $mot->getMotId();
  48  }
  49  
  50  $changeGranularityMots = $motMetier->getBranch($motsUsed);
  51  
  52  if (is_array($changeGranularityMots) && in_array($nouv_mot, $changeGranularityMots)) {
  53      $impactedMots = $motMetier->getGranularityImpactedMot($nouv_mot, $motsUsed);
  54      $idsToDelete = join(',', $impactedMots);
  55  
  56      $validateURL = $url_post_check . '?' . $params . 'delete_nodes=' . $idsToDelete;
  57      $refuseURL = $url_post_check;
  58  
  59      if ($coll) {
  60          $refuseURL .= "?coll=$coll";
  61      }
  62      else {
  63          $refuseURL .= "?$id_table=$id_objet";
  64      }
  65  
  66      //echo '<html>';
  67      //echo '<body>';
  68      $impactString = _T('info_change_granu'). '<br>';
  69  
  70      while (list(, $motId) = each($impactedMots)) {
  71          $loadOK = $motMetier->load($motId);
  72  
  73          if (PEAR::isError($loadOK)) {
  74              die ($loadOK->getMessage());
  75          }
  76          $impactString .= _T(info_mot_change_granu,
  77                              array('titre_mot' => $motMetier->getCheminMot(). $motMetier->getTitre()));
  78      }
  79  
  80      //echo $impactString;
  81      //echo '<a href="'.$validateURL.'">Accepter le changement de granularité</a><br>'."\n";
  82      //echo '<a href="'.$refuseURL.'">Refuser le changement de granularité</a><br>';
  83      //echo '</body>';
  84      //echo '</html>';
  85      debut_boite_info();
  86      echo "<FONT FACE='Georgia,Garamond,Times,serif' SIZE=3>";
  87      echo $impactString;
  88  
  89      echo "<UL>";
  90      echo "<LI><B><A HREF='$validateURL'>" . _T('item_oui'). "</A></B> ";
  91      echo "<LI><B><A HREF='$refuseURL'>" . _T('item_non'). "</A></B> ";
  92      echo "</UL>";
  93      echo "</FONT>";
  94      fin_boite_info();
  95  }
  96  else {
  97      $pas_changement_granularite = 1;
  98  }
  99  ?>


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