Skip to content

Commit

Permalink
🔨 CLOSED #36 - classe e negocio ajustadas para views
Browse files Browse the repository at this point in the history
  • Loading branch information
bjverde committed Feb 3, 2019
1 parent 23fabf9 commit cb101d5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
2 changes: 1 addition & 1 deletion classes/TCreateClass.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public function show($print = false)
$this->addLine();
$this->addSelectAll();

if ($this->getTableType() != TGeneratorHelper::TABLE_TYPE_VIEW) {
if ($this->getTableType() == TGeneratorHelper::TABLE_TYPE_TABLE) {
$this->addLine();
$this->addSave();

Expand Down
26 changes: 22 additions & 4 deletions classes/TCreateForm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class TCreateForm
private $lines;
private $gridType;
private $listColumnsProperties;
private $tableType = null;

const FORMDIN_TYPE_DATE = 'DATE';
const FORMDIN_TYPE_TEXT = 'TEXT';
Expand Down Expand Up @@ -141,6 +142,15 @@ public function getListColumnsProperties()
return $this->listColumnsProperties;
}
//------------------------------------------------------------------------------------
public function setTableType($tableType)
{
$this->tableType = $tableType;
}
public function getTableType()
{
return $this->tableType;
}
//------------------------------------------------------------------------------------
public function getLinesArray()
{
return $this->lines;
Expand Down Expand Up @@ -425,12 +435,14 @@ private function addBasicaViewController()
$this->addBlankLine();
$this->addLine('$acao = isset($acao) ? $acao : null;');
$this->addLine('switch( $acao ) {');
$this->addBasicaViewController_salvar();
$this->addBasicaViewController_limpar();
if ($this->gridType == GRID_SIMPLE) {
$this->addBasicaViewController_buscar();
}
$this->addBasicaViewController_limpar();
$this->addBasicaViewController_gdExcluir();
if ($this->getTableType() == TGeneratorHelper::TABLE_TYPE_TABLE) {
$this->addBasicaViewController_salvar();
$this->addBasicaViewController_gdExcluir();
}
$this->addLine('}');
}
//--------------------------------------------------------------------------------------
Expand Down Expand Up @@ -595,6 +607,10 @@ public function addGrid()
$this->addBlankLine();
$this->addColumnsGrid(TAB);
$this->addBlankLine();
if ($this->getTableType() == TGeneratorHelper::TABLE_TYPE_VIEW) {
$this->addLine(TAB.'$gride->enableDefaultButtons(false);');
}
$this->addBlankLine();
$this->addLine(TAB.'$gride->show();');
$this->addLine(TAB.'die();');
$this->addLine('}');
Expand All @@ -615,7 +631,9 @@ public function addButtons()
} else {
$this->addLine('$frm->addButton(\'Buscar\', null, \'btnBuscar\', \'buscar()\', null, true, false);');
}
$this->addLine('$frm->addButton(\'Salvar\', null, \'Salvar\', null, null, false, false);');
if ($this->getTableType() == TGeneratorHelper::TABLE_TYPE_TABLE) {
$this->addLine('$frm->addButton(\'Salvar\', null, \'Salvar\', null, null, false, false);');
}
$this->addLine('$frm->addButton(\'Limpar\', null, \'Limpar\', null, null, false, false);');
}
//--------------------------------------------------------------------------------------
Expand Down
5 changes: 3 additions & 2 deletions classes/TGeneratorHelper.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,13 +311,14 @@ public static function createFilesDaoVoFromTable($tableName, $listColumnsPropert
$generatorDao->saveDAO();
}

public static function createFilesForms($tableName, $listColumnsProperties)
public static function createFilesForms($tableName, $listColumnsProperties, $tableSchema, $tableType)
{
$DBMS = $_SESSION[APLICATIVO]['DBMS']['TYPE'];
$configDBMS = self::getConfigByDBMS($DBMS);
$folder = self::getPathNewSystem().DS.'modulos'.DS;
$columnPrimaryKey = $listColumnsProperties['COLUMN_NAME'][0];
$geradorForm = new TCreateForm();
$geradorForm->setTableType($tableType);
$geradorForm->setFormTitle($tableName);
$geradorForm->setFormPath($folder);
$geradorForm->setFormFileName($tableName);
Expand All @@ -333,7 +334,7 @@ public static function createFilesFormClassDaoVoFromTable($tableName, $listColum
{
self::createFilesDaoVoFromTable($tableName, $listColumnsProperties,$tableSchema,$tableType);
self::createFilesClasses($tableName, $listColumnsProperties, $tableSchema, $tableType);
self::createFilesForms($tableName, $listColumnsProperties);
self::createFilesForms($tableName, $listColumnsProperties, $tableSchema, $tableType);
}

public static function getUrlNewSystem()
Expand Down

0 comments on commit cb101d5

Please sign in to comment.