TeeChartPHP
[ class tree: TeeChartPHP ] [ index: TeeChartPHP ] [ all elements ]

Source for file Imports.php

Documentation is available at Imports.php

  1. <?php
  2.  
  3.  /**
  4.  * Imports class
  5.  *
  6.  * Description:
  7.  *
  8.  * @author
  9.  * @copyright (c) 1995-2008 by Steema Software SL. All Rights Reserved. <info@steema.com>
  10.  * @version 1.0
  11.  * @package TeeChartPHP
  12.  * @subpackage imports
  13.  * @link http://www.steema.com
  14.  */
  15.  
  16. class Imports extends TeeBase
  17. {
  18.  
  19.    private $template;
  20.    private $xml;
  21.  
  22.     // Interceptors
  23.     function __get$property {
  24.       $method ="get{$property}";
  25.       if method_exists$this$method ) ) {
  26.         return $this->$method();
  27.       }
  28.     }
  29.  
  30.     function __set $property,$value {
  31.       $method ="set{$property}";
  32.       if method_exists$this$method ) ) {
  33.         return $this->$method($value);
  34.       }
  35.     }
  36.  
  37.    public function Imports($c)
  38.    {
  39.       parent::__construct($c);
  40.    }
  41.  
  42.    public function getTemplate()
  43.    {
  44.       if($this->template == null)
  45.       {
  46.          $this->template new Template($this->chart);
  47.       }
  48.  
  49.       return $this->template;
  50.    }
  51.  
  52.    public function getXML()
  53.    {
  54.       if($this->xml == null)
  55.       {
  56.          $this->xml new XMLImport($this->chart);
  57.       }
  58.  
  59.       return $this->xml;
  60.    }
  61.  
  62. }
  63.  
  64.  
  65. class Template
  66. {
  67.  
  68.    private $chart;
  69.    
  70.    
  71.    function Template ($c=null{
  72.       $this->chart $c;        
  73.    }
  74.    
  75.    /**
  76.    * @return TChart Object
  77.    */
  78.    public function fromFile($fileName{
  79.        
  80.        if (file_exists($fileName)) {              
  81.          $str file_get_contents($fileName);
  82.          if ($str != false)
  83.          {
  84.              $newo SerializeManager::instance()->unserializeObject($str);          
  85.              $newo->getGraphics3D()->img $this->chart->getGraphics3D()->img;             
  86.              return $newo;
  87.          }
  88.          else
  89.          {
  90.              // There's not strings into the file
  91.              echo "The Files does not contain any string to import !";             
  92.          }
  93.        }              
  94.        else
  95.        {
  96.             // File does not exists
  97.             echo "The File doex not exists !";
  98.        }
  99.    }    
  100.     
  101. /*   public function fromXML($fileName) /* TODO throws FileNotFoundException {
  102.        return $this->fromXML(new BufferedInputStream(
  103.               new FileInputStream($fileName)));
  104.               
  105.  
  106.               return $filename;
  107.    }
  108.    
  109.  
  110.    public function fromXML($stream)
  111.    {
  112.       $decoder = new XMLDecoder($stream);
  113.  
  114.       $decoder->setExceptionListener(new ExceptionListener()
  115.       {
  116.          public function exceptionThrown($exception)
  117.          {
  118.             $exception->printStackTrace();
  119.          }
  120.       }
  121.       );
  122.  
  123.       $result = null;
  124.       try
  125.       {
  126.          $result = ($this->Chart)$this->decoder->readObject();
  127.       }
  128.       $this->finally{
  129.       $this->decoder->close();
  130.       }
  131.  
  132.       if(($this->chart->getParent() != null))
  133.          (($this->com->steema->teechart->TChart)($this->chart->getParent()))->setChart($result);
  134.  
  135.       return $result;
  136.    }
  137. */
  138.  
  139. /* TODO
  140.    public function fromFile($fileName) throws FileNotFoundException,
  141.    IOException, ClassNotFoundException{
  142.    return fromStream(new BufferedInputStream(new FileInputStream(
  143.    fileName)));
  144.    }
  145.  
  146.    public function fromFile($file)throws FileNotFoundException,
  147.    IOException, ClassNotFoundException{
  148.    return fromFile(file . getPath());
  149.    }
  150.  
  151.    public function fromStream($stream)throws IOException,
  152.    ClassNotFoundException{
  153.    ObjectInputStream in = new ObjectInputStream(stream);
  154.    Chart result = null;
  155.    try
  156.    {
  157.       result = (Chart)in . readObject();
  158.       }finally{
  159.       in . close();
  160.       }
  161.       return result;
  162.    }
  163. */
  164. }
  165.  
  166. ?>

Documentation generated on Wed, 16 Jun 2010 12:06:28 +0200 by phpDocumentor 1.4.1