Source for file arquivo.classe.php

Documentation is available at arquivo.classe.php

  1. <?php
  2.  
  3.     /**
  4.      * Provê métodos para geração de arquivos simples
  5.      *
  6.      * @copyright 2008 Soomp
  7.      * @package Soomp
  8.      * @author Jonas Beto Rompkovski <jonasbeto.rompkovski@gmail.com>
  9.      * @version 1.0
  10.      * @since 11/12/2006
  11.      */
  12.     /* $Id: arquivo.classe.php,v 1.4 2007/03/16 15:00:51 mmerlone Exp $ */
  13.     if(!defined('INDEX'&& !defined('AJAX'&& !defined('SOAP')){
  14.         die('Este script nao pode ser acessado diretamente!');
  15.     }
  16.     
  17.     require_once("exception/ioException.classe.php");
  18.     /**
  19.      * arquivo.classe.php
  20.      * Esta classe destina-se a geração de arquivos simples.
  21.      */
  22.     class arquivo {  
  23.         /**
  24.          * @var String Nome do arquivo a ser criado
  25.          */  
  26.         public $strNomeArquivo;
  27.         /**
  28.          * @var String Extensão do arquivo a ser criado
  29.          */
  30.         public $strExtensaoArquivo;
  31.         /**
  32.          * @var String Descrição de erro
  33.          */
  34.         public $strErro = "";
  35.         /**
  36.          * @var String Conteúdo do Arquivo
  37.          */
  38.         public $strConteudo;
  39.         
  40.         public $strModoGravacao = "w+";
  41.         
  42.         /**
  43.          * Define o Nome do Arquivo
  44.          * @param String $strValor Nome do Arquivo
  45.          */
  46.         public function setNomeArquivo($strValor){
  47.             $this->strNomeArquivo = $strValor;
  48.         }
  49.         
  50.         /**
  51.          * Define a extensão do arquivo
  52.          * @param String $strValor Extensão do Arquivo
  53.          */
  54.         public function setExtensaoArquivo($strValor){
  55.             $this->strExtensaoArquivo = $strValor;
  56.         }
  57.         
  58.         /**
  59.          * Define o conteúdo do arquivo
  60.          * @param String $strValor Conteúdo do Arquivo
  61.          */
  62.         public function setConteudo($strValor){
  63.             $this->strConteudo = $strValor;
  64.         }
  65.         
  66.         /**
  67.          * Cria o arquivo
  68.          */
  69.         public function buildArquivo(){
  70.             /**
  71.              * Verificando o arquivo
  72.              */
  73.             //echo $this->strNomeArquivo.".".$this->strExtensaoArquivo.$this->strModoGravacao;
  74.             if(!$arq fopen($this->strNomeArquivo.".".$this->strExtensaoArquivo$this->strModoGravacao)){
  75.                 throw new ioException("Problema ao tentar criar ou abrir o arquivo");
  76.             }
  77.             /**
  78.              * Escrevendo no arquivo
  79.              */
  80.             if(!fwrite($arq$this->strConteudo)){
  81.                 throw new ioException("Problema ao escrever no arquivo");
  82.             }
  83.             /**
  84.              * Fechando o Arquivo
  85.              */
  86.             if(!fclose($arq)){
  87.                 throw new ioException("Problema ao tentar fechar o arquivo");
  88.             }
  89.         }       
  90.     }
  91.  
  92. ?>

Documentation generated on Sun, 09 Mar 2008 23:50:43 -0300 by phpDocumentor 1.4.0

SourceForge.net Logo Support This Project