Skip to content

Commit

Permalink
🔤 code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
bjverde committed Mar 18, 2018
1 parent 90662fe commit 15da02e
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion classes/TCreateConfigDataBase.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class TCreateConfigDataBase extends TCreateFileContent{

public function __construct(){
$this->setFileName('config_conexao.php');
$path = ROOT_PATH.$_SESSION[APLICATIVO]['GEN_SYSTEM_ACRONYM'].DS.'includes'.DS;
$path = TGeneratorHelper::getPathNewSystem().DS.'includes'.DS;
$this->setFilePath($path);
}
//--------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion classes/TCreateConstants.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class TCreateConstants extends TCreateFileContent{

public function __construct(){
$this->setFileName('constantes.php');
$path = ROOT_PATH.$_SESSION[APLICATIVO]['GEN_SYSTEM_ACRONYM'].DS.'includes'.DS;
$path = TGeneratorHelper::getPathNewSystem().DS.'includes'.DS;
$this->setFilePath($path);
}
//--------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion classes/TCreateDAO.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
if(!defined('EOL')){ define('EOL',"\n"); }
if(!defined('TAB')){ define('TAB',chr(9)); }

class TDAOCreate {
class TCreateDAO {
private $tableName;
private $aColumns;
private $lines;
Expand Down
2 changes: 1 addition & 1 deletion classes/TCreateForm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
if(!defined('EOL')){ define('EOL',"\n"); }
if(!defined('TAB')){ define('TAB',chr(9)); }
if(!defined('DS')){ define('DS',DIRECTORY_SEPARATOR); }
class TFormCreate {
class TCreateForm {
private $formTitle;
private $formPath;
private $formFileName;
Expand Down
2 changes: 1 addition & 1 deletion classes/TCreateIndex.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class TCreateIndex extends TCreateFileContent{
public function __construct(){
$this->setFileName('index.php');
$path = ROOT_PATH.$_SESSION[APLICATIVO]['GEN_SYSTEM_ACRONYM'].DS;
$path = TGeneratorHelper::getPathNewSystem().DS;
$this->setFilePath($path);
}
//--------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion classes/TCreateMenu.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class TCreateMenu extends TCreateFileContent{

public function __construct($listTableNames){
$this->setFileName('menu.php');
$path = ROOT_PATH.$_SESSION[APLICATIVO]['GEN_SYSTEM_ACRONYM'].DS.'includes'.DS;
$path = TGeneratorHelper::getPathNewSystem().DS.'includes'.DS;
$this->setFilePath($path);
$this->setListTableNames($listTableNames);
}
Expand Down
5 changes: 4 additions & 1 deletion classes/TGeneratorHelper.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,12 @@ public static function mkDir($path){
mkdir($path, 0744, true);
}
}
public static function getPathNewSystem(){
return ROOT_PATH.$_SESSION[APLICATIVO]['GEN_SYSTEM_ACRONYM'];
}

public static function copySystemSkeletonToNewSystem(){
$pathNewSystem = ROOT_PATH.$_SESSION[APLICATIVO]['GEN_SYSTEM_ACRONYM'];
$pathNewSystem = self::getPathNewSystem();
$pathSkeleton = 'system_skeleton';

$list = new RecursiveDirectoryIterator($pathSkeleton);
Expand Down
2 changes: 1 addition & 1 deletion modulos/gen00.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
if ( $frm->validate() ) {
try{
$GEN_SYSTEM_ACRONYM = strtolower($frm->get('GEN_SYSTEM_ACRONYM'));
FolderHelper::validateFolderName($GEN_SYSTEM_ACRONYM);
TGeneratorHelper::validateFolderName($GEN_SYSTEM_ACRONYM);
$_SESSION[APLICATIVO]=null;
$_SESSION[APLICATIVO]['DBMS']['TYPE']=$frm->get('DBMS');
$_SESSION[APLICATIVO]['GEN_SYSTEM_ACRONYM']=$GEN_SYSTEM_ACRONYM;
Expand Down
12 changes: 6 additions & 6 deletions modulos/gen02.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@
$listTables = TGeneratorHelper::loadTablesFromDatabase();

$path = ROOT_PATH.$_SESSION[APLICATIVO]['GEN_SYSTEM_ACRONYM'];
FolderHelper::mkDir($path);
TGeneratorHelper::mkDir($path);
$html->add(TGeneratorHelper::showMsg(true, Message::GEN02_MKDIR_SYSTEM.$path));
FolderHelper::copySystemSkeletonToNewSystem();
TGeneratorHelper::copySystemSkeletonToNewSystem();
$html->add(TGeneratorHelper::showMsg(true, Message::GEN02_COPY_SYSTEM_SKELETON));
FolderHelper::createFileConstants();
TGeneratorHelper::createFileConstants();
$html->add(TGeneratorHelper::showMsg(true, Message::GEN02_CREATED_CONSTANTS));
FolderHelper::createFileConfigDataBase();
TGeneratorHelper::createFileConfigDataBase();
$html->add(TGeneratorHelper::showMsg(true, Message::GEN02_CREATED_CONFIG_DATABASE));
FolderHelper::createFileMenu($listTables);
TGeneratorHelper::createFileMenu($listTables);
$html->add(TGeneratorHelper::showMsg(true, Message::GEN02_CREATED_MENU));
FolderHelper::createFileIndex();
TGeneratorHelper::createFileIndex();
$html->add(TGeneratorHelper::showMsg(true, Message::GEN02_CREATED_INDEX));
$_SESSION[APLICATIVO]['STEP2']=true;

Expand Down

0 comments on commit 15da02e

Please sign in to comment.