[SPIP Zone] r4045 - in /_plugins_/_boucles_/boucles_xml: base/xml_temporaire.php plugin.xml xml_mes_fonctions.php xml_mes_options.php

Author: cedric@yterium.com
Date: Mon Jul 17 19:37:15 2006
New Revision: 4045

Log:
les fondements du code

Added:
    _plugins_/_boucles_/boucles_xml/plugin.xml
    _plugins_/_boucles_/boucles_xml/xml_mes_fonctions.php
    _plugins_/_boucles_/boucles_xml/xml_mes_options.php
Modified:
    _plugins_/_boucles_/boucles_xml/base/xml_temporaire.php

Modified: _plugins_/_boucles_/boucles_xml/base/xml_temporaire.php

--- _plugins_/_boucles_/boucles_xml/base/xml_temporaire.php (original)
+++ _plugins_/_boucles_/boucles_xml/base/xml_temporaire.php Mon Jul 17 19:37:15 2006
@@ -41,4 +41,31 @@
     
   }
}
+
+function xml_fill_table($xml_file){
+ if (lire_fichier($xml_file,$contenu)!==false){
+ include_spip('inc/plugin');
+ $tree = parse_plugin_xml($contenu);
+ xml_recurse_parse_to_table('/',$tree);
+ }
+}
+
+function xml_recurse_parse_to_table($xpath,$subtree){
+ foreach($subtree as $tag=>$tagoccur){
+ $attrs = explode(' ',$tag);
+ $noeud = array_shift($attrs);
+ $attrs = trim(implode(' ',$attrs));
+ if ((count($tagoccur)==1) AND !is_array($tagoccur[0])){
+ // c'est une feuille
+ // insertion sql
+ }
+ else{
+ foreach ($tagoccur as $subsubtree) {
+ // c'est un noeud
+ // insertion sql
+ xml_recurse_parse_to_table("$xpath$noeud/",$subsubtree);
+ }
+ }
+ }
+}
?>
\ No newline at end of file

Added: _plugins_/_boucles_/boucles_xml/plugin.xml

--- _plugins_/_boucles_/boucles_xml/plugin.xml (added)
+++ _plugins_/_boucles_/boucles_xml/plugin.xml Mon Jul 17 19:37:15 2006
@@ -0,0 +1,27 @@
+<plugin>
+ <nom> <!-- Nom du plugin -->
+ Boucles XML
+ </nom>
+ <auteur> <!-- Auteur du plugin -->
+ Cedric MORIN
+ </auteur>
+ <version>
+ 0.10
+ </version>
+ <etat>
+ dev
+ </etat>
+ <description>
+ Parser du xml avec les boucles SPIP
+ </description>
+ <options> <!-- fichier charge a chaque hit -->
+ xml_options.php
+ </options>
+ <fonctions> <!-- fichier charge a chaque recalul de page -->
+ xml_fonctions.php
+ </fonctions>
+ <prefix>
+ xml
+ </prefix>
+ <!-- Le parametre action est facultatif : en son absence la methode de la classe portant le nom du pipeline est appelee. Le parametre inclure est facultatif. -->
+</plugin>
\ No newline at end of file

Added: _plugins_/_boucles_/boucles_xml/xml_mes_fonctions.php

--- _plugins_/_boucles_/boucles_xml/xml_mes_fonctions.php (added)
+++ _plugins_/_boucles_/boucles_xml/xml_mes_fonctions.php Mon Jul 17 19:37:15 2006
@@ -0,0 +1,14 @@
+<?php
+
+function boucle_FORMS_dist($id_boucle, &$boucles) {
+ $boucle = &$boucles[$id_boucle];
+ $id_table = $boucle->id_table;
+ $boucle->from[$id_table] = "spip_xml";
+ $boucle->hash = '
+ // CREER les table temporaire forms_champs et forms_champs_choix
+ xml_fill_table_temporaire_boucle();
+';
+ return calculer_boucle($id_boucle, $boucles);
+}
+
+?>
\ No newline at end of file

Added: _plugins_/_boucles_/boucles_xml/xml_mes_options.php

    (empty)