[ Index ]
 

Code source de SPIP Agora 1.4

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

title

Body

[fermer]

/Agora1-4/ecrire/include/dxs/ -> document.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(dirname(__FILE__). "/dxs_object.php");
  20  
  21  require_once(dirname(__FILE__). "/item.php");
  22  
  23  require_once(dirname(__FILE__). '/../bd/inc_document_factory.php');
  24  
  25  /**
  26   * The DXS representation of a SPIP-Agora article.
  27   * @package    DXS
  28   * @author Maciek Borowka <maciek@clever-age.com>
  29   * @access    public
  30   */
  31  class DXS_Document extends DXS_Object {
  32  
  33      // {{{ properties
  34  
  35      /**
  36      * The corresponding document business object.
  37      * @var     BD_article
  38      * @access  private
  39      */
  40      var $agoraDocument;
  41  
  42      // }}}
  43  
  44      // {{{ constructor
  45  
  46      /**
  47      * DXS_Document constructor.
  48      * @access public
  49      */
  50  	function DXS_Document () { }
  51  
  52      // }}}
  53  
  54      // {{{ getAgoraEntity()
  55      /**
  56      * Fetches, parses and constructs an object BD_Document 
  57      * using the data found at the URL $url.
  58      * @access public    
  59      */
  60  	function getAgoraEntity ($url) {
  61          if ($this->initFromFile($url, new DXS_TrivialValidatorData("http://www.clever-age.com/DXS:1.2", "spipdocument"))) {
  62              $this->parseDocument();
  63          }
  64          else
  65              echo "<h2>initfromfile failed</h2>";
  66  
  67          return $this->agoraDocument;
  68      }
  69  
  70      // }}}
  71  
  72      // {{{ parseDocument()
  73      /**
  74      * Helper function to parse the tree, create
  75      * the document buisiness object and extract the actual data.
  76      * Warning, no error checking is performed in this method.
  77      * @access  private
  78      */
  79  	function parseDocument () {
  80          $this->agoraDocument = &recuperer_instance_document();
  81  
  82          $max_child = count($this->xmlTree->root->children);
  83          //echo "<p>DXS_Article:parseArticle we have $max_child children</p>";
  84  
  85          for ($i = 0; $i < $max_child; $i++) {
  86              //echo '<p>DXS_Document: child: '.$this->xmlTree->root->children[$i]->name.' Value: <pre>';
  87              //echo $this->xmlTree->root->children[$i]->content.'</pre></p>';
  88              switch ($this->xmlTree->root->children[$i]->name) {
  89                  case "source":
  90                      {
  91                          echo "<p> source child tag not supported yet!</p>";
  92                          break;
  93                      }
  94  
  95                  case "data":
  96                      {
  97                          //echo "<p>".strlen($this->xmlTree->root->children[$i]->content)." of bytes of data received. </p>";
  98                          $this->agoraDocument->setFichierContenuBase64($this->xmlTree->root->children[$i]->content);
  99                          break;
 100                      }
 101  
 102                  case "":
 103                      break; //XXX BUG in the xml parser
 104  
 105                  default:
 106                      {
 107                          echo "<p> '" . $this->xmlTree->root->children[$i]->name . "' not supported yet!</p>";
 108                          break;
 109                      }
 110              }
 111          }
 112      }
 113  
 114  // }}}
 115  
 116  }
 117  ?>


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