diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ab68ae7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,12 @@ +# Ignore all directories, and all sub-directories, and it's contents: +# Ignore * all files in directories +# Ignore **/ alll subdirectories + +# VsCode files +.vscode/ + +# Eclipse files +/.settings/ +/.vscode/ +/.project +/.buildpath \ No newline at end of file diff --git a/en/README.md b/README.en.md similarity index 94% rename from en/README.md rename to README.en.md index 17efb8d..d8ceaf7 100644 --- a/en/README.md +++ b/README.en.md @@ -1,7 +1,7 @@ # PHP Automatic Application ## Em Português -![](../images/brasil.png) https://github.com/ribafs/auto-app/tree/master/pt_BR +![](assets/images/brasil.png) https://github.com/ribafs/auto-app/tree/master/pt_BR Are only two classes, Connection() and Crud() with good methods and the basic files from CRUD. You will not have to type any field names and no lines of code. It will automatically generate the code of a CRUD for each table in the database, no matter how many. @@ -36,16 +36,16 @@ https://github.com/ribafs/auto-app/archive/master.zip - Call by browser with - http://localhost/auto-app - It will open the form for entering the data of the bank, as below: -![](../images/form.png) +![](assets/images/form.png) - Enter the database info and click in Send. - Then you will already be in front of the menu with links to all database tables, as the screen below -![](../images/menu.png) +![](assets/images/menu.png) Select a table clicking in your link to access your CRUD, as the screen below -![](../images/crud.png) +![](assets/images/crud.png) Now try and see anothers features. diff --git a/README.md b/README.md index babf519..5aa9b64 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,10 @@ This software automates the creation of simple applications in PHP with good resources. ## Em Português -![](images/brasil.png) https://github.com/ribafs/auto-app/blob/master/pt_BR/README.md +![](assets/images/brasil.png) https://github.com/ribafs/auto-app/blob/master/README.pt-br.md ## In English -![](images/en.png) https://github.com/ribafs/auto-app/blob/master/en/README.md +![](assets/images/en.png) https://github.com/ribafs/auto-app/blob/master/README.en.md ### Download https://github.com/ribafs/auto-app/archive/master.zip diff --git a/pt_BR/README.md b/README.pt-br.md similarity index 94% rename from pt_BR/README.md rename to README.pt-br.md index 76f788d..9f17414 100644 --- a/pt_BR/README.md +++ b/README.pt-br.md @@ -1,7 +1,7 @@ # Aplicativo Automático em PHP ## In English -![](../images/en.png) https://github.com/ribafs/auto-app/tree/master/en +![](assets/images/en.png) https://github.com/ribafs/auto-app/tree/master/en Temos apenas duas classes, Connection() e Crud() com bons métodos e os arquivos básicos do CRUD. Você não precisará digitar nenhum nome de campo e nenhuma linha de código. Ele gerará automaticamente o código de um CRUD para cada tabela do banco de dados, não importando quantas sejam. @@ -35,16 +35,16 @@ https://github.com/ribafs/auto-app/archive/master.zip - E chame pelo navegador com - http://localhost/auto-app - Abrirá o formulário para entrada dos dados do banco, como abaixo: -![](../images/form.png) +![](assets/images/form.png) - Entre com os dados do banco e com o nome da tabela e clique em Send Já estará em frente ao menu com links para todas as tabelas do banco, como a tela abaixo -![](../images/menu.png) +![](assets/images/menu.png) Clique em um link para ver o CRUD completo para a tabela selecionada: -![](../images/crud.png) +![](assets/images/crud.png) ## Origem diff --git a/en/assets/css/bootstrap.min.css b/assets/css/bootstrap.min.css similarity index 100% rename from en/assets/css/bootstrap.min.css rename to assets/css/bootstrap.min.css diff --git a/pt_BR/assets/css/style.css b/assets/css/style.css similarity index 67% rename from pt_BR/assets/css/style.css rename to assets/css/style.css index 965bed7..4a532ca 100644 --- a/pt_BR/assets/css/style.css +++ b/assets/css/style.css @@ -2,9 +2,13 @@ padding-top: 5px; } -.footer{ +footer{ + position: fixed; + left: 0; + bottom: 0; + width: 100%; + vertical-align: middle; background-color:#e6e6e6; - width:85%; font-size:11px; text-align:center; } diff --git a/en/assets/fonts/glyphicons-halflings-regular.eot b/assets/fonts/glyphicons-halflings-regular.eot similarity index 100% rename from en/assets/fonts/glyphicons-halflings-regular.eot rename to assets/fonts/glyphicons-halflings-regular.eot diff --git a/en/assets/fonts/glyphicons-halflings-regular.svg b/assets/fonts/glyphicons-halflings-regular.svg similarity index 100% rename from en/assets/fonts/glyphicons-halflings-regular.svg rename to assets/fonts/glyphicons-halflings-regular.svg diff --git a/en/assets/fonts/glyphicons-halflings-regular.ttf b/assets/fonts/glyphicons-halflings-regular.ttf similarity index 100% rename from en/assets/fonts/glyphicons-halflings-regular.ttf rename to assets/fonts/glyphicons-halflings-regular.ttf diff --git a/en/assets/fonts/glyphicons-halflings-regular.woff b/assets/fonts/glyphicons-halflings-regular.woff similarity index 100% rename from en/assets/fonts/glyphicons-halflings-regular.woff rename to assets/fonts/glyphicons-halflings-regular.woff diff --git a/en/assets/fonts/glyphicons-halflings-regular.woff2 b/assets/fonts/glyphicons-halflings-regular.woff2 similarity index 100% rename from en/assets/fonts/glyphicons-halflings-regular.woff2 rename to assets/fonts/glyphicons-halflings-regular.woff2 diff --git a/en/assets/images/ajax-loader.gif b/assets/images/ajax-loader.gif similarity index 100% rename from en/assets/images/ajax-loader.gif rename to assets/images/ajax-loader.gif diff --git a/images/brasil.png b/assets/images/brasil.png similarity index 100% rename from images/brasil.png rename to assets/images/brasil.png diff --git a/images/crud-en.png b/assets/images/crud-en.png similarity index 100% rename from images/crud-en.png rename to assets/images/crud-en.png diff --git a/images/crud.png b/assets/images/crud.png similarity index 100% rename from images/crud.png rename to assets/images/crud.png diff --git a/images/en.png b/assets/images/en.png similarity index 100% rename from images/en.png rename to assets/images/en.png diff --git a/images/form.png b/assets/images/form.png similarity index 100% rename from images/form.png rename to assets/images/form.png diff --git a/images/menu-en.png b/assets/images/menu-en.png similarity index 100% rename from images/menu-en.png rename to assets/images/menu-en.png diff --git a/images/menu.png b/assets/images/menu.png similarity index 100% rename from images/menu.png rename to assets/images/menu.png diff --git a/en/assets/js/bootstrap.min.js b/assets/js/bootstrap.min.js similarity index 100% rename from en/assets/js/bootstrap.min.js rename to assets/js/bootstrap.min.js diff --git a/en/assets/js/jquery-1.10.2.min.js b/assets/js/jquery-1.10.2.min.js similarity index 100% rename from en/assets/js/jquery-1.10.2.min.js rename to assets/js/jquery-1.10.2.min.js diff --git a/en/assets/js/jquery.bootpag.min.js b/assets/js/jquery.bootpag.min.js similarity index 100% rename from en/assets/js/jquery.bootpag.min.js rename to assets/js/jquery.bootpag.min.js diff --git a/en/assets/tip.txt b/assets/tip.txt similarity index 100% rename from en/assets/tip.txt rename to assets/tip.txt diff --git a/controllers/TGeneratorHelper.class.php b/controllers/TGeneratorHelper.class.php new file mode 100644 index 0000000..b026a81 --- /dev/null +++ b/controllers/TGeneratorHelper.class.php @@ -0,0 +1,50 @@ + + * @link https://github.com/bjverde/sysgen + * + * PHP Version 5.6 + */ +class TGeneratorHelper +{ + public static function mkDir($path) + { + if (!is_dir($path)) { + mkdir($path, 0744, true); + } + } + public static function getPathNewSystem() + { + return ROOT_PATH.$_SESSION[SYSTEM_ACRONYM]['GEN_SYSTEM_ACRONYM']; + } + public static function createRootDirNewApp() + { + $path = self::getPathNewSystem(); + self::mkDir($path); + } + + public static function copySystemSkeletonToNewSystemByTpSystem($pathSkeleton) + { + $pathNewSystem = self::getPathNewSystem(); + + $list = new RecursiveDirectoryIterator($pathSkeleton); + $it = new RecursiveIteratorIterator($list); + + foreach ($it as $file) { + if ($it->isFile()) { + //echo ' SubPathName: ' . $it->getSubPathName(); + //echo ' SubPath: ' . $it->getSubPath()."
"; + self::mkDir($pathNewSystem.DS.$it->getSubPath()); + copy($pathSkeleton.DS.$it->getSubPathName(), $pathNewSystem.DS.$it->getSubPathName()); + } + } + } + + public static function copySystemSkeletonToNewSystem() + { + $pathSkeleton = 'system_skeleton'; + self::copySystemSkeletonToNewSystemByTpSystem($pathSkeleton); + } +} \ No newline at end of file diff --git a/controllers/autoload_class_autoapp.php b/controllers/autoload_class_autoapp.php new file mode 100644 index 0000000..38dc874 --- /dev/null +++ b/controllers/autoload_class_autoapp.php @@ -0,0 +1,13 @@ + - "Adapted by Ribamar FS - -
- - diff --git a/en/header.php b/en/header.php deleted file mode 100644 index dcb3443..0000000 --- a/en/header.php +++ /dev/null @@ -1,14 +0,0 @@ - - - - PHP Automatic Application - - - - - diff --git a/en/install.php b/en/install.php deleted file mode 100644 index 977fe23..0000000 --- a/en/install.php +++ /dev/null @@ -1,96 +0,0 @@ - - - - PHP Automatic Application - - - - - - - - - -
-

PHP Automatic Application

-
- -
-
-
-
-

Enter your database details

-
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
- -
-
-
- -
By RibaFS
- - - -alert('The directory classes require read permission to web server!')"; - exit; - } - - $content .=$content2; - - if(is_writable('./classes')){ - $fp = fopen('./classes/connection.php', "w"); - fwrite($fp, $content); - fclose($fp); - }else{ - echo ""; - exit(); - } - - header('location: index.php'); -} -?> diff --git a/helpers/ArrayHelper.class.php b/helpers/ArrayHelper.class.php new file mode 100644 index 0000000..9369092 --- /dev/null +++ b/helpers/ArrayHelper.class.php @@ -0,0 +1,187 @@ + + * or write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301, USA. + * ---------------------------------------------------------------------------- + * Este arquivo é parte do Framework Formdin. + * + * O Framework Formdin é um software livre; você pode redistribuí-lo e/ou + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação + * do Software Livre (FSF). + * + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português + * para maiores detalhes. + * + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título + * "LICENCA.txt", junto com esse programa. Se não, acesse + * ou escreva para a Fundação do Software Livre (FSF) Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. + */ +class ArrayHelper +{ + + static function validateUndefined($array,$atributeName) + { + if(!isset($array[$atributeName])) { + $array[$atributeName]=null; + } + return is_null($array[$atributeName])?null:trim($array[$atributeName]); + } + + /** + * Similar to array_key_exists. But it does not generate an error message + * + * Semelhante ao array_key_exists. Mas não gera mensagem de erro + * + * @param string $atributeName + * @param array $array + * @return boolean + */ + static function has($atributeName,$array) + { + $value = false; + if (is_array($array) && array_key_exists($atributeName, $array)) { + $value = true; + } + return $value; + } + + /** + * Similar to array_keys. But it does not generate an Warning message in PHP7.2.X + * + * Semelhante to array_keys. Mas não gera mensagem de Alerta no PHP7.2.X + * + * @param array $array + * @param mixed $search_value + * @param boolean $strict + * @return array + */ + static function array_keys2($array, $search_value = null,$strict = false) + { + $value = array(); + if (is_array($array)) { + $value = array_keys($array, $search_value,$strict); + } + return $value; + } + + /*** + * + * @param array $array + * @param string $atributeName + * @param mixed $DefaultValue + * @return mixed + */ + static function getDefaultValeu($array,$atributeName,$DefaultValue) + { + $value = $DefaultValue; + if(self::has($atributeName, $array) ) { + if(isset($array[$atributeName]) && ($array[$atributeName]<>'') ) { + $value = $array[$atributeName]; + } + } + return $value; + } + + static function get($array,$atributeName) + { + $result = self::getDefaultValeu($array, $atributeName, null); + return $result; + } + + static function getArray($array,$atributeName) + { + if(!isset($array[$atributeName])) { + $array[$atributeName]=array(); + } + return is_null($array[$atributeName])?array():$array[$atributeName]; + } + + /*** + * Evita erro de notice. Recebe um array FormDin, um atributo e a chave. + * Verifica se o atributo e achave existem e devolve o valor + * @param array $array + * @param string $atributeName + * @param int $key + * @return NULL|mixed|array + */ + static function getArrayFormKey($array,$atributeName,$key) + { + $value = null; + if( self::has($atributeName, $array) ) { + $arrayResult = self::getArray($array, $atributeName); + $value = self::get($arrayResult, $key); + } + return $value; + } + + /** + * Convert Array PDO Format to FormDin format + * + * @param array $array + * @return array + */ + static function convertArrayPdo2FormDin($dataArray,$upperCase = true) + { + $result = false; + if(is_array($dataArray) ) { + foreach( $dataArray as $k => $arr ) { + foreach( $arr as $fieldName => $value ) { + if($upperCase) { + $result[ strtoupper($fieldName) ][ $k ] = $value; + }else{ + $result[ $fieldName ][ $k ] = $value; + } + } + } + } + return $result; + } + + /** + * Convert Array FormDin Format to PDO format + * + * @param array $array + * @return array + */ + static function convertArrayFormDin2Pdo($dataArray,$upperCase = false) + { + $result = false; + if(is_array($dataArray) ) { + $listKeys = array_keys($dataArray); + $firstKey = $listKeys[0]; + foreach( $dataArray[$firstKey] as $keyNumber => $value ) { + foreach( $listKeys as $keyName ) { + if($upperCase) { + $result[ $keyNumber ][ strtoupper($keyName) ] = $dataArray[$keyName][$keyNumber]; + }else{ + $result[ $keyNumber ][ strtolower($keyName) ] = $dataArray[$keyName][$keyNumber]; + } + } + } + } + return $result; + } +} +?> diff --git a/helpers/autoload_formdin_helper.php b/helpers/autoload_formdin_helper.php new file mode 100644 index 0000000..093ee08 --- /dev/null +++ b/helpers/autoload_formdin_helper.php @@ -0,0 +1,53 @@ + + * or write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301, USA. + * ---------------------------------------------------------------------------- + * Este arquivo é parte do Framework Formdin. + * + * O Framework Formdin é um software livre; você pode redistribuí-lo e/ou + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação + * do Software Livre (FSF). + * + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português + * para maiores detalhes. + * + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título + * "LICENCA.txt", junto com esse programa. Se não, acesse + * ou escreva para a Fundação do Software Livre (FSF) Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. + */ + +if ( !function_exists( 'formdin_helper_autoload') ) { + function formdin_helper_autoload( $class_name ) + { + $path = __DIR__.DS.$class_name.'.class.php'; + if (file_exists($path)){ + require_once $path; + } else { + return false; + } + } +spl_autoload_register('formdin_helper_autoload'); +} \ No newline at end of file diff --git a/helpers/index.php b/helpers/index.php new file mode 100644 index 0000000..80c1907 --- /dev/null +++ b/helpers/index.php @@ -0,0 +1,12 @@ + + * @license https://github.com/bjverde/formDin/blob/master/LICENSE GPL-3.0 + * @link https://github.com/bjverde/formDin + * + * PHP Version 5.6 + */ + +header('Location: ../index.php'); \ No newline at end of file diff --git a/helpers/langHelper.class.php b/helpers/langHelper.class.php new file mode 100644 index 0000000..a44ac79 --- /dev/null +++ b/helpers/langHelper.class.php @@ -0,0 +1,58 @@ +'; + } + + public static function showNameVersion() + { + $name = self::getMsg('APP-TITLE'); + echo $name.' - v'.SYSTEM_VERSION; + } + +} \ No newline at end of file diff --git a/helpers/stepHelper.class.php b/helpers/stepHelper.class.php new file mode 100644 index 0000000..9fc1c15 --- /dev/null +++ b/helpers/stepHelper.class.php @@ -0,0 +1,15 @@ +Aplicativo Automático em PHP'; - - public function __construct(){ - - switch ($this->sgbd){ - case 'mysql': - try { - $dsn = $this->sgbd.':host='.$this->host.';dbname='.$this->db.';port='.$this->port; - $this->pdo = new PDO($dsn, $this->user, $this->pass); - // Boa exibição de erros - $this->pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES,false); - $this->pdo->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); - - $this->pdo->query('SET NAMES utf8'); - return $this->pdo; - - }catch(PDOException $e){ - // Usar estas linhas no catch apenas em ambiente de testes/desenvolvimento. Em produção apenas o exit() - echo '

Código: '.$e->getCode().'

'; - echo 'Mensagem: '. $e->getMessage().'
'; - echo 'Arquivo: '.$e->getFile().'
'; - echo 'Linha: '.$e->getLine().'
'; - exit(); - } - break; - - case 'pgsql': - try { - $dsn = $this->sgbd.':host='.$this->host.';dbname='.$this->db.';port='.$this->port; - $this->pdo = new PDO($dsn, $this->user, $this->pass); - - // Boa exibição de erros - $this->pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES,false); - $this->pdo->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); - - return $this->pdo; - - }catch(PDOException $e){ - echo '

Código: '.$e->getCode().'

'; - echo 'Mensagem: '. $e->getMessage().'
'; - echo 'Arquivo: '.$e->getFile().'
'; - echo 'Linha: '.$e->getLine().'
'; - exit(); - } - break; - - case 'sqlite': - try { - $this->pdo = new PDO('sqlite:/home/ribafs/estoque.db'); // Caminho do banco em sqlite - - // Boa exibição de erros - $this->pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES,false); - $this->pdo->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); - - return $this->pdo; - - }catch(PDOException $e){ - echo '

Código: '.$e->getCode().'

'; - echo 'Mensagem: '. $e->getMessage().'
'; - echo 'Arquivo: '.$e->getFile().'
'; - echo 'Linha: '.$e->getLine().'
'; - exit(); - } - break; - case 'default': - break; - } - } - - // Copiar uma pasta com todos os arquivos e subpastas recursivamente - // Crédito - https://stackoverflow.com/questions/2050859/copy-entire-contents-of-a-directory-to-another-using-php#2050909 - public function copyDir($src,$dst) { - $dir = opendir($src); - mkdir($dst); - while(false !== ( $file = readdir($dir)) ) { - if (( $file != '.' ) && ( $file != '..' )) { - if ( is_dir($src . '/' . $file) ) { - recurse_copy($src . '/' . $file,$dst . '/' . $file); - } - else { - copy($src . '/' . $file,$dst . '/' . $file); - } - } - } - closedir($dir); - } - // Caso a pasta de destino não exista será criada - // copyDir('j381/installation', 'joomla3/installation'); - - // Nomes das tabelas do banco atual - public function tableNames(){ - try { - if($this->sgbd=='mysql'){ - $sql="SHOW TABLES"; - }elseif($this->sgbd=='pgsql'){ - $sql="SELECT relname FROM pg_class WHERE relname !~ '^(pg_|sql_)' AND relkind = 'r';"; - }elseif($this->sgbd=='sqlite'){ - $sql='SELECT name FROM sqlite_master WHERE type = "table"'; - } - $tableList = array(); - $res = $this->pdo->prepare($sql); - $res->execute(); - while($cRow = $res->fetch()) - { - $tableList[] = $cRow[0]; - } - return $tableList;// array - }catch (PDOException $p){ - print $p->getMessage(); - exit; - } - } - -} - diff --git a/pt_BR/classes/crud.php b/pt_BR/classes/crud.php deleted file mode 100644 index 31ea120..0000000 --- a/pt_BR/classes/crud.php +++ /dev/null @@ -1,213 +0,0 @@ -pdo; - -/* Classe que trabalha com um crud, lidando com uma tabela por vez, que é fornecida a cada instância, desde a conexão com o banco */ - -class Crud extends Connection -{ - - public $pdo; - public $table; - - public function __construct($pdo, $table){ - $this->pdo = $pdo; - $this->table = $table; - } - - // Número de campos da tabela atual - private function numFields(){ - $sql = 'SELECT * FROM '.$this->table.' LIMIT 1'; - $sth = $this->pdo->query($sql); - $num_campos = $sth->columnCount(); - return $num_campos; - } - - // Nome de campo pelo número $x - public function fieldName($x){ - $sql = 'SELECT * FROM '.$this->table.' LIMIT 1'; - $sth = $this->pdo->query($sql); - $meta = $sth->getColumnMeta($x); - $field = $meta['name']; - return $field; - } - - // Retornar todos os nomes do form dentro de uma tabela. Assim: - // Nome - public function formFields(){ - $fields = ''; - - for($x=1;$x < $this->numFields();$x++){ - $field = $this->fieldName($x); - - if($x < $this->numFields()){ - $fields .= ''.ucFirst($field).''."\n"; - } - } - return $fields; - } - - // Retornar relação de todos os campos com row, assim: - /* "" . $row['id'] . "" . */ - public function rowFields($row){ - $fields = ''; - $fld = ''; - - for($x=0;$x < $this->numFields();$x++){ - $fld = $this->fieldName($x); - - if($x < $this->numFields() -1){ - $fields .= '' . $row["$fld"] . ''."\n"; - }else{ - $fields .= '' . $row["$fld"] . ''; - } - } - return $fields; - } - - // Retornar os nomes de todos os campos envolvidos com th, assim: - // ID - public function thFields(){ - $fields = ''; - - for($x=0;$x < $this->numFields();$x++){ - $field = $this->fieldName($x); - - if($x < $this->numFields()){ - $fields .= ''.ucFirst($field).''."\n"; - } - } - return $fields; - } - - // Retornar os nomes de todos os campos: - // Exemplo: id, nome,email,nascimento,cpf - public function fields(){ - $fields = ''; - - for($x=0;$x < $this->numFields();$x++){ - $field = $this->fieldName($x); - - if($x < $this->numFields() -1){ - $fields .= "$field,"."\n"; - }else{ - $fields .= "$field"; - } - } - return $fields; - } - - // Retornar campos do update dentro de tabela - /* Exemplo:Nome */ - public function fieldsUpdate($reg){ - $fields = ''; - - for($x=1;$x < $this->numFields();$x++){ - $field = $this->fieldName($x); - ?> - "> - numFields();$x++){ - $field = $this->fieldName($x); - // A linha abaixo gerará a linha: $nome = 'Nome do cliente'; - $$field = $_POST[$field]; - - // Este if gerará a variável $set contendo "$nome = :$nome, $email = :$email, ..."; - if($x<$this->numFields()-1){ - if($x==0) continue;// Não contar o campo id - $set .= "$field = :$field,"; - }else{ - if($x==0) continue; - $set .= "$field = :$field"; - } - } - return $set; - } - - // Retornar a string para o insert(): (nome, email, data_nasc, cpf) values (:nome, :email, :data_nasc, cpf) - private function inserirStr(){ - $fields = ''; - $values = ''; - - for($x=1;$x < $this->numFields();$x++){ - $field = $this->fieldName($x); - - // Este if gera o seguinte código para a variável $fields = "nome, email, data_nasc, cpf" (exemplo para clientes) - // E também para a variável $values = ":nome, :email, :data_nasc, cpf" - if($x < $this->numFields()-1){ - $fields .= "$field,"; - $values .= ":$field, "; - }else{ - $fields .= "$field"; - $values .= ":$field"; - } - } - $inserirStr = "($fields) VALUES ($values)"; - return $inserirStr; - } - - // Efetuar o insert no banco - public function insert(){ - if(isset($_POST['enviar'])){ - - $sql = "INSERT INTO $this->table {$this->inserirStr()}"; - $sth = $this->pdo->prepare($sql); - - for($x=1;$x < $this->numFields();$x++){ - $field = $this->fieldName($x); - $sth->bindParam(":$field", $_POST["$field"], PDO::PARAM_INT); - } - $execute = $sth->execute(); - - if($execute){ - print ""; - }else{ - echo 'Error insert dates'; - } - } - } - - // Efetuar delete - public function delete($id){ - if(isset($_GET['id'])){ - $id = $_GET['id']; - - $sql = "DELETE FROM {$this->table} WHERE id = :id"; - $sth = $this->pdo->prepare($sql); - $sth->bindParam(':id', $id, PDO::PARAM_INT); - - if( $sth->execute()){ - print ""; - }else{ - print "Error on delete register!

"; - } - } - } - - // Efetuar update - public function update(){ - - $sql = "UPDATE {$this->table} SET {$this->updateSet()} WHERE id = :id"; - $sth = $this->pdo->prepare($sql); - - for($x=0;$x < $this->numFields();$x++){ - $field = $this->fieldName($x); - $sth->bindParam(":$field", $_POST["$field"], PDO::PARAM_INT); - } - - if($sth->execute()){ - print ""; - }else{ - print "Error on update register!

"; - } - } -} diff --git a/pt_BR/core/delete.php b/pt_BR/core/delete.php deleted file mode 100644 index 3276e7d..0000000 --- a/pt_BR/core/delete.php +++ /dev/null @@ -1,10 +0,0 @@ -delete($id); -} -?> diff --git a/pt_BR/core/fetch_data.php b/pt_BR/core/fetch_data.php deleted file mode 100644 index 437a6f9..0000000 --- a/pt_BR/core/fetch_data.php +++ /dev/null @@ -1,42 +0,0 @@ -regsPerPage); - -if($conn->sgbd == 'mysql'){ - $results = $crud->pdo->prepare("SELECT * FROM $crud->table ORDER BY id LIMIT $start, $conn->regsPerPage"); -}else if($conn->sgbd == 'pgsql'){ - $results = $crud->pdo->prepare("SELECT * FROM $crud->table ORDER BY id LIMIT $conn->regsPerPage OFFSET $start"); -} - -$results->execute(); -$nr = $results->rowCount(); - -if($nr > 0){ - - while($row = $results->fetch(PDO::FETCH_ASSOC)) { - echo "" . $crud->rowFields($row); - - $id = $row['id']; - ?> - - - "; - } - -}else{ - echo '

Nenhum registro encontrado

'; -} diff --git a/pt_BR/core/footer.php b/pt_BR/core/footer.php deleted file mode 100644 index 8cfcefb..0000000 --- a/pt_BR/core/footer.php +++ /dev/null @@ -1,6 +0,0 @@ - -
- - diff --git a/pt_BR/core/header.php b/pt_BR/core/header.php deleted file mode 100644 index 1d4c2f7..0000000 --- a/pt_BR/core/header.php +++ /dev/null @@ -1,14 +0,0 @@ - - - - Aplicativos com CRUDs Automáticos - - - - - diff --git a/pt_BR/core/index.php b/pt_BR/core/index.php deleted file mode 100644 index 7e4cb32..0000000 --- a/pt_BR/core/index.php +++ /dev/null @@ -1,95 +0,0 @@ -pdo->prepare("SELECT COUNT(*) FROM {$crud->table}"); -$stmt->execute(); -$rows = $stmt->fetch(); - -// get total no. of pages -$totalPages = ceil($rows[0]/$conn->regsPerPage); - -?> - - -
-
-

appName. ' - '. ucfirst($crud->table)?>

-
- - - - - -
-
-
- - -   - -
-
-
-
- - - - - thFields(); - ?> - - - - - -
Ação
- -
-
- - - - - - - - - diff --git a/pt_BR/core/insert.php b/pt_BR/core/insert.php deleted file mode 100644 index f5e0aa7..0000000 --- a/pt_BR/core/insert.php +++ /dev/null @@ -1,42 +0,0 @@ -'.$table.''; - -$crud = new Crud($pdo,$table); -?> - -
-
-

appName?>
(Adicionar)

-
- -
-
- - - - formFields(); - ?> - - - -
    -
-
-
-
- -insert(); -} - -require_once('./footer.php'); -?> - diff --git a/pt_BR/core/search.php b/pt_BR/core/search.php deleted file mode 100644 index c9a562a..0000000 --- a/pt_BR/core/search.php +++ /dev/null @@ -1,53 +0,0 @@ -table} WHERE {$crud->fieldName(1)} LIKE :keyword order by id"; - $sth = $crud->pdo->prepare($sql); - $sth->bindValue(":keyword", $keyword."%"); - $sth->execute(); - //$nr = $sth->rowCount(); - $rows =$sth->fetchAll(PDO::FETCH_ASSOC); -} -?> -
-
-

appName;?>

-

Registro(s) encontrado(s): '.count($rows).' com '.$keyword.'

'; - -if(count($rows) > 0){ -?> - - - - - thFields(); - ?> - - - -" . $crud->rowFields($row); - } - echo "
"; - -}else{ - print '

Nenhum Registro encontrado!

-
'; -} -?> - -
-
-
- diff --git a/pt_BR/core/update.php b/pt_BR/core/update.php deleted file mode 100644 index b8d9c2a..0000000 --- a/pt_BR/core/update.php +++ /dev/null @@ -1,44 +0,0 @@ -pdo->prepare("SELECT {$crud->fields()} from $crud->table WHERE id = :id"); -$sth->bindValue(':id', $id, PDO::PARAM_STR); // No select e no delete basta um bindValue -$sth->execute(); - -$reg = $sth->fetch(PDO::FETCH_ASSOC);// Talvez mudar para ASSOC para facilitar - -require_once('./header.php'); -?> -
-
-

appName?>
Atualizar

-
-
-
-
- - fieldsUpdate($reg); - ?> - - -
        -
-
- -
-
-
- -update(); -} -?> - diff --git a/pt_BR/footer.php b/pt_BR/footer.php deleted file mode 100644 index 8cfcefb..0000000 --- a/pt_BR/footer.php +++ /dev/null @@ -1,6 +0,0 @@ - -
- - diff --git a/pt_BR/header.php b/pt_BR/header.php deleted file mode 100644 index 43d1156..0000000 --- a/pt_BR/header.php +++ /dev/null @@ -1,14 +0,0 @@ - - - - Auto CRUD 2.0 - - - - - diff --git a/pt_BR/index.php b/pt_BR/index.php deleted file mode 100644 index 9f5bdbe..0000000 --- a/pt_BR/index.php +++ /dev/null @@ -1,56 +0,0 @@ -tableNames()); -$sel = 'Selecione uma Tabela'; -?> - -


- -
-

Aplicativo com CRUDs Automáticos

-
-
-

0) print $sel; ?>

-

-
- 0){ - for($x=0;$x < $nrtables;$x++){ - // Nome da tabela - $table = $conn->tableNames()[$x]; - - //if($table != 'nomeTabela') continue; - - // Copiar pasta core para cada tabela - if(!file_exists($table)){ - $conn->copyDir('core',$table); - } - ?> - -      -

Ajuda

'; -}else{ - print "

Nenhuma tabela no banco de dados!

"; -} -?> - -
-
-


- - diff --git a/pt_BR/install.php b/pt_BR/install.php deleted file mode 100644 index 30e6221..0000000 --- a/pt_BR/install.php +++ /dev/null @@ -1,95 +0,0 @@ - - - - Aplicativo Automático em PHP - - - - - - - - - -
-

Aplicativo Automático em PHP

-
- -
-
-
-
-

Entre informações sobre o banco de dados

-
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
- -
-
-
-
Por RibaFS
- - - -alert('The directory classes require read permission to web server!')"; - exit; - } - - $content .=$content2; - - if(is_writable('./classes')){ - $fp = fopen('./classes/connection.php', "w"); - fwrite($fp, $content); - fclose($fp); - }else{ - echo ""; - exit(); - } - - header('location: index.php'); -} -?> diff --git a/en/index.php b/show_system.php similarity index 87% rename from en/index.php rename to show_system.php index 8579088..4cebc9e 100644 --- a/en/index.php +++ b/show_system.php @@ -1,13 +1,7 @@ tableNames()); $sel = 'Select a Table'; ?> @@ -52,5 +46,5 @@



- + diff --git a/pt_BR/assets/css/bootstrap.min.css b/system_skeleton/assets/css/bootstrap.min.css similarity index 100% rename from pt_BR/assets/css/bootstrap.min.css rename to system_skeleton/assets/css/bootstrap.min.css diff --git a/en/assets/css/style.css b/system_skeleton/assets/css/style.css similarity index 67% rename from en/assets/css/style.css rename to system_skeleton/assets/css/style.css index 965bed7..4a532ca 100644 --- a/en/assets/css/style.css +++ b/system_skeleton/assets/css/style.css @@ -2,9 +2,13 @@ padding-top: 5px; } -.footer{ +footer{ + position: fixed; + left: 0; + bottom: 0; + width: 100%; + vertical-align: middle; background-color:#e6e6e6; - width:85%; font-size:11px; text-align:center; } diff --git a/pt_BR/assets/fonts/glyphicons-halflings-regular.eot b/system_skeleton/assets/fonts/glyphicons-halflings-regular.eot similarity index 100% rename from pt_BR/assets/fonts/glyphicons-halflings-regular.eot rename to system_skeleton/assets/fonts/glyphicons-halflings-regular.eot diff --git a/pt_BR/assets/fonts/glyphicons-halflings-regular.svg b/system_skeleton/assets/fonts/glyphicons-halflings-regular.svg similarity index 100% rename from pt_BR/assets/fonts/glyphicons-halflings-regular.svg rename to system_skeleton/assets/fonts/glyphicons-halflings-regular.svg diff --git a/pt_BR/assets/fonts/glyphicons-halflings-regular.ttf b/system_skeleton/assets/fonts/glyphicons-halflings-regular.ttf similarity index 100% rename from pt_BR/assets/fonts/glyphicons-halflings-regular.ttf rename to system_skeleton/assets/fonts/glyphicons-halflings-regular.ttf diff --git a/pt_BR/assets/fonts/glyphicons-halflings-regular.woff b/system_skeleton/assets/fonts/glyphicons-halflings-regular.woff similarity index 100% rename from pt_BR/assets/fonts/glyphicons-halflings-regular.woff rename to system_skeleton/assets/fonts/glyphicons-halflings-regular.woff diff --git a/pt_BR/assets/fonts/glyphicons-halflings-regular.woff2 b/system_skeleton/assets/fonts/glyphicons-halflings-regular.woff2 similarity index 100% rename from pt_BR/assets/fonts/glyphicons-halflings-regular.woff2 rename to system_skeleton/assets/fonts/glyphicons-halflings-regular.woff2 diff --git a/pt_BR/assets/images/ajax-loader.gif b/system_skeleton/assets/images/ajax-loader.gif similarity index 100% rename from pt_BR/assets/images/ajax-loader.gif rename to system_skeleton/assets/images/ajax-loader.gif diff --git a/system_skeleton/assets/images/brasil.png b/system_skeleton/assets/images/brasil.png new file mode 100644 index 0000000..bbdda4d Binary files /dev/null and b/system_skeleton/assets/images/brasil.png differ diff --git a/system_skeleton/assets/images/crud-en.png b/system_skeleton/assets/images/crud-en.png new file mode 100644 index 0000000..621b1da Binary files /dev/null and b/system_skeleton/assets/images/crud-en.png differ diff --git a/system_skeleton/assets/images/crud.png b/system_skeleton/assets/images/crud.png new file mode 100644 index 0000000..79ac20e Binary files /dev/null and b/system_skeleton/assets/images/crud.png differ diff --git a/system_skeleton/assets/images/en.png b/system_skeleton/assets/images/en.png new file mode 100644 index 0000000..fbf6f37 Binary files /dev/null and b/system_skeleton/assets/images/en.png differ diff --git a/system_skeleton/assets/images/form.png b/system_skeleton/assets/images/form.png new file mode 100644 index 0000000..6c42e39 Binary files /dev/null and b/system_skeleton/assets/images/form.png differ diff --git a/system_skeleton/assets/images/menu-en.png b/system_skeleton/assets/images/menu-en.png new file mode 100644 index 0000000..27b5bef Binary files /dev/null and b/system_skeleton/assets/images/menu-en.png differ diff --git a/system_skeleton/assets/images/menu.png b/system_skeleton/assets/images/menu.png new file mode 100644 index 0000000..a33858c Binary files /dev/null and b/system_skeleton/assets/images/menu.png differ diff --git a/pt_BR/assets/js/bootstrap.min.js b/system_skeleton/assets/js/bootstrap.min.js similarity index 100% rename from pt_BR/assets/js/bootstrap.min.js rename to system_skeleton/assets/js/bootstrap.min.js diff --git a/pt_BR/assets/js/jquery-1.10.2.min.js b/system_skeleton/assets/js/jquery-1.10.2.min.js similarity index 100% rename from pt_BR/assets/js/jquery-1.10.2.min.js rename to system_skeleton/assets/js/jquery-1.10.2.min.js diff --git a/pt_BR/assets/js/jquery.bootpag.min.js b/system_skeleton/assets/js/jquery.bootpag.min.js similarity index 100% rename from pt_BR/assets/js/jquery.bootpag.min.js rename to system_skeleton/assets/js/jquery.bootpag.min.js diff --git a/pt_BR/assets/dicas.txt b/system_skeleton/assets/tip.txt similarity index 72% rename from pt_BR/assets/dicas.txt rename to system_skeleton/assets/tip.txt index 3730686..33b0f8c 100644 --- a/pt_BR/assets/dicas.txt +++ b/system_skeleton/assets/tip.txt @@ -1,2 +1,2 @@ -Relação de glyphicons: +Glyphicons: https://www.w3schools.com/bootstrap/bootstrap_ref_comp_glyphs.asp diff --git a/en/classes/connection.txt b/system_skeleton/classes/connection.txt similarity index 100% rename from en/classes/connection.txt rename to system_skeleton/classes/connection.txt diff --git a/en/classes/crud.php b/system_skeleton/classes/crud.php similarity index 100% rename from en/classes/crud.php rename to system_skeleton/classes/crud.php diff --git a/en/core/delete.php b/system_skeleton/core/delete.php similarity index 100% rename from en/core/delete.php rename to system_skeleton/core/delete.php diff --git a/en/core/fetch_data.php b/system_skeleton/core/fetch_data.php similarity index 100% rename from en/core/fetch_data.php rename to system_skeleton/core/fetch_data.php diff --git a/en/core/footer.php b/system_skeleton/core/footer.php similarity index 100% rename from en/core/footer.php rename to system_skeleton/core/footer.php diff --git a/en/core/header.php b/system_skeleton/core/header.php similarity index 100% rename from en/core/header.php rename to system_skeleton/core/header.php diff --git a/en/core/index.php b/system_skeleton/core/index.php similarity index 100% rename from en/core/index.php rename to system_skeleton/core/index.php diff --git a/en/core/insert.php b/system_skeleton/core/insert.php similarity index 100% rename from en/core/insert.php rename to system_skeleton/core/insert.php diff --git a/en/core/search.php b/system_skeleton/core/search.php similarity index 100% rename from en/core/search.php rename to system_skeleton/core/search.php diff --git a/en/core/update.php b/system_skeleton/core/update.php similarity index 100% rename from en/core/update.php rename to system_skeleton/core/update.php diff --git a/view/footer.php b/view/footer.php new file mode 100644 index 0000000..59740e9 --- /dev/null +++ b/view/footer.php @@ -0,0 +1,5 @@ + + + diff --git a/view/header.php b/view/header.php new file mode 100644 index 0000000..c933b78 --- /dev/null +++ b/view/header.php @@ -0,0 +1,13 @@ + + + + <?php langHelper::showNameVersion(); ?> + + + + + + + + + diff --git a/view/jumbotron.php b/view/jumbotron.php new file mode 100644 index 0000000..a9cbccc --- /dev/null +++ b/view/jumbotron.php @@ -0,0 +1,3 @@ +
+

+
diff --git a/view/step00.php b/view/step00.php new file mode 100644 index 0000000..69c33a4 --- /dev/null +++ b/view/step00.php @@ -0,0 +1,24 @@ +
+
+
+
+

Choose your language

+
+ +
+ + +
+
+ + +
+ +
+
+
+
\ No newline at end of file diff --git a/view/step01.php b/view/step01.php new file mode 100644 index 0000000..dd52600 --- /dev/null +++ b/view/step01.php @@ -0,0 +1,46 @@ +
+
+
+
+
+ + +

+ +
+ +
+ +
+ +
+ +

+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ + +
+
+ +
+ +
+
+
\ No newline at end of file diff --git a/view/step02.php b/view/step02.php new file mode 100644 index 0000000..06c12be --- /dev/null +++ b/view/step02.php @@ -0,0 +1,54 @@ +alert('The directory classes require read permission to web server!')"; + exit; + } + + $content .=$content2; + + if(is_writable('./classes')){ + $fp = fopen('./classes/connection.php', "w"); + fwrite($fp, $content); + fclose($fp); + }else{ + echo ""; + exit(); + } + + header('location: index.php'); + */ +} +?>