Ejemplo n.º 1
0
 /**
  * retona a classe criada
  *
  * @author Hugo Ferreira da Silva
  * @link http://www.hufersil.com.br
  * @param string $tablename
  * @param Lumine_Configuration $cfg
  * @return Lumine_Factory
  */
 public static function create($tablename, Lumine_Configuration $cfg)
 {
     $pkg = $cfg->getProperty('package');
     Lumine_Log::debug('Recuperando campos da tabela ' . $tablename);
     $fields = $cfg->getConnection()->describe($tablename);
     $obj = new Lumine_Factory($pkg, $tablename);
     foreach ($fields as $item) {
         list($name, $type_native, $type, $length, $primary, $notnull, $default, $autoincrement) = $item;
         $options = array('primary' => $primary, 'notnull' => $notnull, 'autoincrement' => $autoincrement);
         // para o pg, ainda tem o nome da sequence
         if (!empty($item[8]['sequence'])) {
             $options['sequence'] = $item[8]['sequence'];
         }
         // se tiver um valor padrao
         if (!empty($default)) {
             $options['default'] = $default;
         }
         // nome do membro
         $memberName = $name;
         // se for para usar camel case
         if ($cfg->getOption('camel_case') == true) {
             $memberName = Lumine_Util::camelCase($memberName);
         }
         $obj->metadata()->addField($memberName, $name, $type, $length, $options);
     }
     return $obj;
 }
 /**
  * Construtor
  * 
  * @author Hugo Ferreira da Silva
  * @link http://www.hufersil.com.br
  * @return Lumine_ApplicationContext
  */
 public function __construct()
 {
     include 'lumine-conf.php';
     $cfg = new Lumine_Configuration($lumineConfig);
     register_shutdown_function(array($cfg->getConnection(), 'close'));
     spl_autoload_register(array('Lumine', 'import'));
     spl_autoload_register(array('Lumine', 'loadModel'));
 }
Ejemplo n.º 3
0
#  (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;
        case 'delete':
            $result = $form->handleAction($_REQUEST['_lumineAction'], $_GET);
            if ($result === true) {
Ejemplo n.º 4
0
 /**
  * Inicia a exportacao para o banco
  * @author Hugo Ferreira da Silva
  * @link http://www.hufersil.com.br/
  * @param Lumine_Configuration $cfg
  * @return void
  */
 public function export(Lumine_Configuration $cfg)
 {
     $this->cfg = $cfg;
     $this->cnn = $cfg->getConnection();
     $this->create();
 }
Ejemplo n.º 5
0
            $class = new ReflectionClass($name);
            $instance = $class->newInstance();
            $method = $class->getMethod($method);
            if (is_null($method) || $method->isPublic() == false) {
                die('Metodo nao encontrado ou nao e publico');
            }
            $result = $method->invokeArgs($instance, array($_POST));
            echo $result;
            break;
        case 'tabelas':
            $res = false;
            $message = '';
            $list = array();
            try {
                $dbh = new Lumine_Configuration($_POST);
                $conn = $dbh->getConnection();
                $res = $conn->connect();
                $list = $conn->getTables();
                $conn->close();
                $dto_packages = array();
                if (!empty($_POST['options']['dto_package']) && !empty($_POST['options']['create_dtos'])) {
                    $dto_packages = $_POST['options']['dto_package'];
                }
                // 2011-04-15 - mapeamento de DTO's
                if (!empty($list)) {
                    echo '<input type="checkbox" onclick="checarTodas(this)" />Selecionar todas as tabelas<br /><br />';
                    foreach ($list as $table) {
                        printf('<p class="table-item">
									<span>
										<input type="checkbox" class="table" name="tables[]" value="%1$s" />
										%1$s