diff options
author | emkael <emkael@tlen.pl> | 2016-02-24 23:18:07 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2016-02-24 23:18:07 +0100 |
commit | 6f7fdef0f500cd4bb540affd3bc1482243f337c1 (patch) | |
tree | 4853eecd0769a903e6130c1896e1d070848150dd /lib/prado/framework/Wsat/pages/TWsatScaffolding.php | |
parent | 61f2ea48a4e11cb5fb941b3783e19c9e9ef38a45 (diff) |
* Prado 3.3.0
Diffstat (limited to 'lib/prado/framework/Wsat/pages/TWsatScaffolding.php')
-rw-r--r-- | lib/prado/framework/Wsat/pages/TWsatScaffolding.php | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/lib/prado/framework/Wsat/pages/TWsatScaffolding.php b/lib/prado/framework/Wsat/pages/TWsatScaffolding.php new file mode 100644 index 0000000..b480174 --- /dev/null +++ b/lib/prado/framework/Wsat/pages/TWsatScaffolding.php @@ -0,0 +1,72 @@ +<?php + +/** + * @author Daniel Sampedro Bello <darthdaniel85@gmail.com> + * @link https://github.com/pradosoft/prado + * @copyright Copyright © 2005-2015 The PRADO Group + * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT + * @version $Id$ + * @since 3.3 + * @package Wsat.pages + */ +Prado::using("System.Wsat.TWsatScaffoldingGenerator"); + +class TWsatScaffolding extends TPage +{ + + public function onInit($param) + { + parent::onInit($param); + $this->startVisual(); + } + + private function startVisual() + { + $scf_generator = new TWsatScaffoldingGenerator(); + foreach ($scf_generator->getAllTableNames() as $tableName) + { + $dynChb = new TCheckBox(); + $dynChb->ID = "cb_$tableName"; + $dynChb->Text = ucfirst($tableName); + $dynChb->Checked = true; + $this->registerObject("cb_$tableName", $dynChb); + $this->tableNames->getControls()->add($dynChb); + $this->tableNames->getControls()->add("</br>"); + } + } + + /** + * Generate Scaffolding code for selected tables + * @param type $sender + */ + public function generate($sender) + { + if ($this->IsValid) + { + try + { + $scf_generator = new TWsatScaffoldingGenerator(); + $scf_generator->setOpFile($this->output_folder->Text); + foreach ($scf_generator->getAllTableNames() as $tableName) + { + $id = "cb_$tableName"; + $obj = $this->tableNames->findControl($id); + if($obj!==null && $obj->Checked) + { + $scf_generator->generateCRUD($tableName); + } + } + + $this->feedback_panel->CssClass = "green_panel"; + $this->generation_msg->Text = "The code has been generated successfully."; + } catch (Exception $ex) + { + $this->feedback_panel->CssClass = "red_panel"; + $this->generation_msg->Text = $ex->getMessage(); + } + $this->feedback_panel->Visible = true; + } + + // $scf_generator->renderAllTablesInformation(); + } +}
\ No newline at end of file |