/** * Retorna um dialeto pelo nome * @author Hugo Ferreira da Silva * @param string $dialectName * @return ILumine_Dialect */ public static function getByName($dialectName) { if (isset(self::$createdItems[$dialectName])) { return self::$createdItems[$dialectName]; } else { Lumine::load('Lumine_Dialect_' . $dialectName); $ref = new ReflectionClass('Lumine_Dialect_' . $dialectName); self::$createdItems[$dialectName] = $ref->newInstance(); } return self::$createdItems[$dialectName]; }
<?php /** * classe de conexao com o PostgreSQL * @author Hugo Ferreira da Silva * @link http://www.hufersil.com.br * @package Lumine_Connection */ Lumine::load('Connection_AbstractConnection'); /** * classe de conexao com o PostgreSQL * @package Lumine_Connection * @author Hugo Ferreira da Silva * @link http://www.hufersil.com.br */ class Lumine_Connection_PostgreSQL extends Lumine_Connection_AbstractConnection { /** * ultima consulta * @var resource */ private $last_rs; /** * Construtor * * @author Hugo Ferreira da Silva * @link http://www.hufersil.com.br * @return Lumine_Connection_PostgreSQL */ public function __construct() {
<?php Lumine::load('Lumine_Annotations_Annotations'); /** * * * @author Hugo Ferreira da Silva */ class Lumine_Templates_DefaultTemplate extends Lumine_Templates_AbstractTemplate { /** * nome do autor * * @var string */ private $author = 'Hugo Ferreira da Silva'; /** * data de criacao * * @var unknown_type */ private $date = null; /** * nome do gerador * * @var string */ private $generator = "Lumine_Reverse"; /** * link padrao da documentacao *
<?php /** * Classe de geracao de relatorio em pdf * * @package Lumine_Report * @author Hugo Ferreira da Silva * @link http://www.hufersil.com.br */ Lumine::load('Report_IReport'); if (!class_exists('FPDF')) { Lumine::load('Utils_fpdf'); } /** * Classe de geracao de relatorio em pdf * * @package Lumine_Report * @author Hugo Ferreira da Silva * @link http://www.hufersil.com.br */ class Lumine_Report_PDF extends Lumine_Report implements Lumine_Report_IReport { /** * objeto pdf * @var resource */ protected $pdf; /** * estilo anterior * @var array */
/** * Inicia uma geracao em PDF * * @author Hugo Ferreira da Silva * @link http://www.hufersil.com.br/ * @param Lumine_Base $obj * @return Lumine_IReport */ public static function PDF(Lumine_Base $obj) { Lumine::load('Report_PDF'); $obj = new Lumine_Report_PDF($obj, 'PDF'); return $obj; }
// vamos indicar quais metodos este plugin usa self::$_plugins[$methodName] = $class; } } /** * Executa um plugin registrado * * @param string $method Nome do metodo * @param Lumine_Base $obj Objeto de escopo para a chamada do plugin * @param array $args Argumentos * @author Hugo Ferreira da silva * @link http://www.hufersil.com.br * @return mixed O retorno do metodo do plugin */ public static function runPlugin($method, Lumine_Base $obj, array $args) { // se nao existir if (!array_key_exists($method, self::$_plugins)) { // retorna false throw new Lumine_Exception('Metodo inexistente: ' . $method, Lumine_Exception::NO_SUCH_METHOD); } // coloca o objeto de lumine na primeira posicao de argumentos array_unshift($args, $obj); // executa o metodo e retorna o mesmo retorno do metodo return call_user_func_array(array(self::$_plugins[$method], $method), $args); } } // carrega principais dependencias Lumine::load('Utils_Util', 'Utils_Crypt', 'Event', 'Events_SQLEvent', 'Events_FormatEvent', 'Events_IteratorEvent'); Lumine::load('Exception', 'SQLException', 'EventListener', 'Tokenizer', 'Parser', 'Exception', 'Configuration', 'ConnectionManager', 'Base', 'Validator', 'Union', 'Factory', 'Model', 'IPlugin');
<?php /** * Classe de conexao com o firebird * @author Hugo Ferreira da Silva * @link http://www.hufersil.com.br * @package Lumine_Dialect */ Lumine::load('Dialect_Exception'); Lumine::load('Dialect_IDialect'); /** * Classe de conexao com o firebird * @package Lumine_Dialect * @author Hugo Ferreira da Silva * @link http://www.hufersil.com.br */ class Lumine_Dialect_Firebird extends Lumine_EventListener implements Lumine_Dialect_IDialect { /** * Conexao ativa * @var Lumine_Connection_IConnection */ private $connection = null; /** * Resultset atual * @var resource */ private $result_set = null; /** * Objeto que requisitou a "ponte" * @var Lumine_Base
# This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> ################################################################################ require_once 'C:\\www\\ExtJS\\teste2\\Abstergo\\library\\Lumine/Lumine.php'; require_once 'C:/www/ExtJS/teste2/Abstergo/library/lumine-conf.php'; Lumine::load('Form_White'); $cfg = new Lumine_Configuration($lumineConfig); $cfg->import('Clientes'); register_shutdown_function(array($cfg->getConnection(), 'close')); $obj = new Clientes(); $form = new Lumine_Form_White($obj); if (!empty($_REQUEST['_lumineAction'])) { switch ($_REQUEST['_lumineAction']) { case 'insert': case 'save': $result = $form->handleAction($_REQUEST['_lumineAction'], $_POST); if ($result === true) { header("Location: " . $_SERVER['PHP_SELF'] . '?msg=ok'); exit; } break;
<?php Lumine::load('Reverse_ValidatorTemplate'); class Lumine_Reverse_ValidatorTemplate { private $author = 'Hugo Ferreira da Silva'; private $date = null; private $generator = "Lumine_Reverse"; private $link = 'http://www.hufersil.com.br/lumine'; private $dtd = 'http://www.hufersil.com.br/lumine/validator.dtd'; private $conf = null; private $ident = ' '; private $database = ''; private $obj = null; function __construct(Lumine_Reverse_ClassTemplate $obj, array $conf) { $this->date = date("Y-m-d"); $this->conf = $conf; $this->obj = $obj; $this->database = $conf['database']; } public function getGeneratedFile() { $ds = DIRECTORY_SEPARATOR; $modelo = LUMINE_INCLUDE_PATH . "{$ds}lib{$ds}Templates{$ds}validator.xml"; $props = array(); $options = array(); foreach ($this->conf as $key => $val) { if ($key == 'options') { foreach ($val as $k => $v) { $options[] = $this->ident . $this->ident . "'{$k}' => '{$v}'";
<?php /** * @package Lumine_Connection * @author Hugo Ferreira da Silva * @link http://www.hufersil.com.br */ Lumine::load('Events_ConnectionEvent'); /** * Interface para conexoes * @author Hugo Ferreira da Silva * @link http://www.hufersil.com.br * @package Lumine_Connection */ interface ILumine_Connection extends ILumine_EventListener { /** * Abre a conexao com o banco * @author Hugo Ferreira da Silva * @link http://www.hufersil.com.br/ * @return void */ function connect(); /** * Fecha a conexao * @author Hugo Ferreira da Silva * @link http://www.hufersil.com.br/ * @return void */ function close(); /**
} echo '<br />'; echo '<input type="button" id="btnConcluir" value="Gerar Classes" onclick="concluir()" />'; } else { echo 'Nenhuma tabela encontrada'; } } catch (Exception $e) { $message = $e->getMessage(); $res = false; echo $message; } exit; break; case 'gerar': try { Lumine::load('Reverse'); $table_list = !empty($_POST['tables']) ? $_POST['tables'] : array(); unset($_POST['tables'], $_POST['options']['dto_package_mapping_check']); $_POST['options']['classDescriptor'] = ''; if ($_POST['options']['classMapping'] != 'default') { $_POST['options']['classDescriptor'] = $_POST['options']['classMapping']; } $_POST['options']['overwrite'] = 0; $_POST['options']['create_dtos'] = !empty($_POST['options']['create_dtos']); $_POST['options']['create_paths'] = !empty($_POST['options']['create_paths']); $_POST['options']['generateAccessors'] = !empty($_POST['options']['generateAccessors']); $_POST['options']['create_entities_for_many_to_many'] = !empty($_POST['options']['create_entities_for_many_to_many']); // ajusta algumas configuracoes if ($_POST['options']['tipo_geracao'] == 1) { $_POST['options']['generate_files'] = 1; $_POST['options']['generate_zip'] = 0;
<?php /** * Conexao com MySQL * @author Hugo Ferreira da Silva * @link http://www.hufersil.com.br * @package Lumine_Connection */ Lumine::load('Connection_IConnection'); /** * Conexao abstrata * * @package Lumine_Connection * @author Hugo Ferreira da Silva * @link http://www.hufersil.com.br */ abstract class Lumine_Connection_AbstractConnection extends Lumine_EventListener implements ILumine_Connection { /** * Estado fechado * @var int */ const CLOSED = 0; /** * Estado aberto * @var int */ const OPEN = 1; /** * Constante para versao do servidor * @var int
<?php /** * Classe para gerar as tabelas em MySQL * @package Lumine_Export * @author Hugo Ferreira da Silva * @link http://www.hufersil.com.br */ // carrega a classe abstrata Lumine::load('Export_IExport'); /** * Classe para gerar as tabelas em MySQL * @package Lumine_Export * @author Hugo Ferreira da Silva * @link http://www.hufersil.com.br */ class Lumine_Export_MySQL extends Lumine_Export_IExport { /** * guarda as SQL's para chaves estrangeiras * @var array */ private $foreignKeysSQL = array(); /** * * @see Lumine_Export_IExport::create() */ public function create() { $this->getForeignKeys(); $this->getIndexes();
/** * Recupera uma sequencia para um campo * * @author Hugo Ferreira da Silva * @link http://www.hufersil.com.br/ * @param array $field * @return string */ public function getSequence($field) { $st = null; $con_st = $this->obj->_getConnection()->getOption('sequence_type'); if (empty($field['sequence_type'])) { $st = $con_st; } else { $st = $field['sequence_type']; } $dialect = $this->obj->_getConfiguration()->getProperty('dialect'); switch ($st) { case self::SEQUENCE: $class = $dialect . "_Sequence"; Lumine::load('Sequence_' . $class); $this->seq_obj = new $class($obj, $field); break; case self::COUNT_TABLE: $class = $dialect . "_Count"; Lumine::load('Sequence_' . $class); $this->seq_obj = new $class($obj, $field); break; case self::NATURAL: default: $class = $dialect . "_Natural"; Lumine::load('Sequence_' . $class); $this->seq_obj = new $class($obj, $field); } $this->seq_obj->createSequence(); return $this->seq_obj; }
<?php Lumine::load('Reverse_ClassTemplate'); class Lumine_Reverse_ConfigurationTemplate { private $author = 'Hugo Ferreira da Silva'; private $date = null; private $generator = "Lumine_Reverse"; private $link = 'http://www.hufersil.com.br/lumine'; private $conf = null; private $ident = ' '; private $database = ''; function __construct(array $conf) { $this->date = date("Y-m-d"); $this->conf = $conf; $this->database = $conf['database']; } public function getGeneratedFile() { $ds = DIRECTORY_SEPARATOR; $modelo = LUMINE_INCLUDE_PATH . "{$ds}lib{$ds}Templates{$ds}config.txt"; $props = array(); $options = array(); foreach ($this->conf as $key => $val) { if ($key == 'options') { foreach ($val as $k => $v) { if (!is_array($v)) { $options[] = $this->ident . $this->ident . "'{$k}' => '{$v}'"; } else { $optionsString = $this->ident . $this->ident . "'{$k}' => array(" . PHP_EOL;
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> ################################################################################ /** * Classe que representa uma arvore de dados * * @author Hugo Ferreira da Silva * @package Lumine_Tree * @link http://www.hufersil.com.br/lumine * */ // Carrega as dependencias Lumine::load('Tree_Node', 'Tree_NodeList', 'Tree_Event'); /** * Classe que representa uma arvore de dados * * @author Hugo Ferreira da Silva * @link http://www.hufersil.com.br/lumine * */ class Lumine_Tree extends Lumine_EventListener { /** * Constante para setar o valor como nulo * @var int */ const DELETE_SET_NULL = 0x1; /**
/** * Exporta o schema para o banco * @author Hugo Ferreira da Silva * @link http://www.hufersil.com.br/ * @return void */ public function export() { $class = 'Lumine_Export_' . $this->options['dialect']; Lumine::load($class); $reflection = new ReflectionClass($class); $instance = $reflection->newInstance(); $instance->export($this); }
<?php /** * Implementacao de EventListeners * * @author Hugo Ferreira da Silva * @link http://www.hufersil.com.br * @package Lumine */ // carrega o arquivo da interface desta classe Lumine::load('IEventListener'); /** * Implementacao de EventListeners * * @package Lumine * @author Hugo Ferreira da Silva * @link http://www.hufersil.com.br */ class Lumine_EventListener implements Lumine_IEventListener { /** * ouvintes registrados * @var array */ private $_listeners = array(); /** * tipos de eventos suportados * @var array */ protected $_event_types = array(); /**
/** * cria os controles basicos * * @author Hugo Ferreira da Silva * @link http://www.hufersil.com.br/ * @param string $controlName Nome do controle * @return void */ private function createControls($controlName) { $clname = 'Lumine_Form_' . $controlName; Lumine::load('Form_' . $controlName); $clControls = new $clname(null); reset($this->files); foreach ($this->files as $classname => $content) { $this->controls[$classname] = $clControls->getControlTemplate($this->cfg, $classname); } }
<?php /** * Geracao de formularios basicos para Lumine * * @package Lumine_Form * @author Hugo Ferreira da Silva * @link http://www.hufersil.com.br */ // carrega a interface Lumine::load('Form_IForm'); /** * Geracao de formularios basicos para Lumine * * @package Lumine_Form * @author Hugo Ferreira da Silva * @link http://www.hufersil.com.br */ class Lumine_Form_White extends Lumine_EventListener implements Lumine_Form_IForm { /** * Objeto a ser usado * @var Lumine_Base */ private $obj; /** * flag para saber se eh para remover as contra-barras dos valores * @var boolean */ private $strip_slashes; /**
<?php /** * Classe principal para as entidades. * Todas as classes de interace com o banco devem extender esta classe * * @author Hugo Ferreira da Silva * @link http://www.hufersil.com.br/lumine * @package Lumine */ Lumine::load('Sequence', 'Lumine_Dialect_Factory'); /** * Classe principal * * @package Lumine * @author Hugo Ferreira da Silva * @link http://www.hufersil.com.br/lumine */ class Lumine_Base extends Lumine_EventListener implements Iterator { const BASE_CLASS = 'Lumine_Base'; const STATE_TRANSIENT = 10; const STATE_PERSISTENT = 11; const WHERE_ADD_ONLY = 30; const SQL_SELECT = 40; const SQL_SELECT_COUNT = 41; const SQL_UPDATE = 42; const SQL_INSERT = 43; const SQL_DELETE = 44; const SQL_MULTI_INSERT = 45; const FETCH_ROW = 50;
<?php /** * Classe abstrata para validacao * * @author Hugo Ferreira da Silva * @link http://www.hufersil.com.br * @package Lumine */ // carrega os validators Lumine::load('Validator_XMLValidator'); Lumine::load('Validator_ClassValidator'); Lumine::load('Validator_PHPValidator'); /** * Classe abstrata para validacao * * @package Lumine * @author Hugo Ferreira da Silva * @link http://www.hufersil.com.br */ abstract class Lumine_Validator { /** * Indica que e para validar uma string * @var string */ const REQUIRED_STRING = 'requiredString'; /** * Indica que e para validar um numero * @var string */