phpDocumentor lodel
[ class tree: lodel ] [ index: lodel ] [ all elements ]

Source for file class.checkImportHandler.php

Documentation is available at class.checkImportHandler.php

  1. <?php
  2. /**
  3.  * Fichier de classe du Handler de checkImport
  4.  *
  5.  * PHP versions 4 et 5
  6.  *
  7.  * LODEL - Logiciel d'Edition ELectronique.
  8.  *
  9.  * Copyright (c) 2001-2002, Ghislain Picard, Marin Dacos
  10.  * Copyright (c) 2003, Ghislain Picard, Marin Dacos, Luc Santeramo, Nicolas Nutten, Anne Gentil-Beccot
  11.  * Copyright (c) 2004, Ghislain Picard, Marin Dacos, Luc Santeramo, Anne Gentil-Beccot, Bruno Cénou
  12.  * Copyright (c) 2005, Ghislain Picard, Marin Dacos, Luc Santeramo, Gautier Poupeau, Jean Lamy, Bruno Cénou
  13.  * Copyright (c) 2006, Marin Dacos, Luc Santeramo, Bruno Cénou, Jean Lamy, Mikaël Cixous, Sophie Malafosse
  14.  * Copyright (c) 2007, Marin Dacos, Bruno Cénou, Sophie Malafosse, Pierre-Alain Mignot
  15.  *
  16.  * Home page: http://www.lodel.org
  17.  *
  18.  * E-Mail: lodel@lodel.org
  19.  *
  20.  * All Rights Reserved
  21.  *
  22.  * This program is free software; you can redistribute it and/or modify
  23.  * it under the terms of the GNU General Public License as published by
  24.  * the Free Software Foundation; either version 2 of the License, or
  25.  * (at your option) any later version.
  26.  *
  27.  * This program is distributed in the hope that it will be useful,
  28.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  29.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  30.  * GNU General Public License for more details.
  31.  *
  32.  * You should have received a copy of the GNU General Public License
  33.  * along with this program; if not, write to the Free Software
  34.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  35.  *
  36.  * @author Jean Lamy
  37.  * @copyright 2005, Ghislain Picard, Marin Dacos, Luc Santeramo, Gautier Poupeau, Jean Lamy, Bruno Cénou
  38.  * @copyright 2006, Marin Dacos, Luc Santeramo, Bruno Cénou, Jean Lamy, Mikaël Cixous, Sophie Malafosse
  39.  * @copyright 2007, Marin Dacos, Bruno Cénou, Sophie Malafosse, Pierre-Alain Mignot
  40.  * @licence http://www.gnu.org/copyleft/gpl.html
  41.  * @version CVS:$Id:
  42.  * @package lodel
  43.  */
  44. //--------------------------------------------------//
  45. // definition of the handler to proceduce the table
  46. //--------------------------------------------------//
  47.  
  48. /**
  49.  * This class define the handler used during the first part of an entity import :
  50.  * the construction of a table containing all the field, the entries and the persons to check that
  51.  * the document was correctly parsed
  52.  */
  53. {
  54.  
  55.     var $_contents/** the table content */
  56.     function contents()
  57.     {
  58.         return $this->_contents;
  59.     }
  60.  
  61.     /**
  62.      * process the data
  63.      * @param string $data the data encountered
  64.      */
  65.     function processData($data)
  66.     {
  67.         return $data;
  68.     }
  69.     
  70.     /**
  71.      * process the differents tablefieds of the entity, constructing the table and adding information
  72.      * on the field.
  73.      * @param object $obj the corresponding field object
  74.      * @param string $data the data of this field
  75.      */
  76.     function processTableFields ($obj$data
  77.     {
  78.         if ($obj->style[0== '.'{
  79.             return '<span style="background-color: violet;">'.$data.'</span>';
  80.         }
  81.         $title $obj->title;
  82.         if ($obj->lang{
  83.             $title.= '<br />('$obj->lang')';
  84.         }
  85.         $this->_contents.= '<tr><th class="sideInfo">'$title'</th><td>'$data'</td></tr>';
  86.         return $data;
  87.     }
  88.     /**
  89.      * process the differents entry fields of the entity, constructing the table and
  90.      * adding information on the entry.
  91.      * @param object $obj the corresponding entry object
  92.      * @param string $data the data of this field
  93.      */
  94.     function processEntryTypes ($obj$data
  95.     {
  96.         $this->_contents.= '<tr><th class="sideInfo">'$obj->style'</th><td>'$data'</td></tr>';
  97.     }
  98.     
  99.     /**
  100.      * this function is used when  an object like an entry is encountered during the XML parsing.
  101.      * @param array $class an array with the name and the title of the class
  102.      * @param object $obj by default null, the object corresponding
  103.      */
  104.     function openClass ($class$obj null
  105.     {
  106.     $this->_contents.= '<tr><td colspan="2" class="openclass '$class[1]'">'$class[0].' &darr;</td></tr>';
  107.     }
  108.  
  109.     function closeClass ($class$multidoc=false
  110.     {
  111.         if ($multidoc{
  112.             $this->multidoc=true;
  113.         }
  114.         $this->_contents.= '<tr><td colspan="2" class="closeclass '$class[1]'">'$class[0].' &uarr;</td></tr>';
  115.   }
  116.     
  117.     /**
  118.      * process the differents persons fields of the entity, constructing the table and
  119.      * adding information on the person.
  120.      * @param object $obj the corresponding person object
  121.      * @param string $data the data of this field
  122.      */
  123.     function processPersonTypes ($obj$data
  124.     {
  125.         $this->_contents.= '<tr><th class="sideInfo">'$obj->style'</th><td>'$data'</td></tr>';
  126.     }
  127.     /**
  128.      * process the encountered character styles.
  129.      * @param object $obj the corresponding to the character style
  130.      * @param string $data the data which use this character style
  131.      */
  132.     function processCharacterStyles ($obj$data
  133.     {
  134.         return '<span style="background-color: gray;">'$data'</span>';
  135.     }
  136.     /**
  137.      * process the encountered internal styles.
  138.      * @param object $obj the corresponding to the internal style
  139.      * @param string $data the data which use this internal style
  140.      */
  141.     function processInternalStyles ($obj$data
  142.     {
  143.         if (strpos ($obj->conversion'<li>'!== false{
  144.             $conversion str_replace('<li>'''$obj->conversion);
  145.             $data $conversionpreg_replace(array("/(<p\b)/""/(<\/p>)/")array("<li>\\1""\\1</li>")$data)closetags($conversion);
  146.         }
  147.         return '<div class="internalstyleblock"><span class="internalstyle">'$obj->style'</span>'$data'</div>';
  148.     }
  149.  
  150.     /**
  151.      * process when an unknow paragraph style is encountered
  152.      * @param string $style the name of the unknown style
  153.      * @param string $data the data contained in this style
  154.      */
  155.     function unknownParagraphStyle ($style$data
  156.     {
  157.         $this->_contents.= '<tr><th class="sideInfo">'.getlodeltextcontents('unknown_style''common').' : '$style'</th><td>'$data'</td></tr>';
  158.     }
  159.     /**
  160.      * process when an unknow character style is encountered
  161.      * @param string $style the name of the unknown style
  162.      * @param string $data the data contained in this style
  163.      */
  164.     function unknownCharacterStyle($style,$data
  165.     {
  166.         return '<span style="background-color: #ff8080;" title="'$style'">'$data'</span>';
  167.     }
  168. }// end of Handler class
  169.  
  170. ?>

Documentation generated on Thu, 24 Jul 2008 05:07:19 +0200 by phpDocumentor 1.4.0a2