diff options
Diffstat (limited to 'framework/Wsat/pages/TWsatGenerateAR.php')
-rw-r--r-- | framework/Wsat/pages/TWsatGenerateAR.php | 80 |
1 files changed, 48 insertions, 32 deletions
diff --git a/framework/Wsat/pages/TWsatGenerateAR.php b/framework/Wsat/pages/TWsatGenerateAR.php index 754cac5c..3d4291e2 100644 --- a/framework/Wsat/pages/TWsatGenerateAR.php +++ b/framework/Wsat/pages/TWsatGenerateAR.php @@ -1,33 +1,49 @@ -<?php
-
-/**
- * Description of Inicio
- *
- * @author daniels
- */
-Prado::using("System.Wsat.TWsatARGenerator");
-
-class TWsatGenerateAR extends TPage {
-
- public function onInit($param) {
- parent::onInit($param);
- }
-
- public function generate($sender) {
- $table_name = $this->table_name->Text;
-
- $ar_generator = new TWsatARGenerator();
- if ($table_name != "*") {
- $ar_generator->generate($table_name);
- } else {
- $ar_generator->generateAll();
- }
- }
-
- public function preview($sender) {
-
- }
-
-}
-
+<?php + +/** + * Description of Inicio + * + * @author daniels + */ +Prado::using("System.Wsat.TWsatARGenerator"); + +class TWsatGenerateAR extends TPage { + + public function generate($sender) { + if ($this->IsValid) { + $table_name = $this->table_name->Text; + $class_prefix = $this->class_prefix->Text; + $output_folder_ns = $this->output_folder->Text; + + try { + $ar_generator = new TWsatARGenerator(); + $ar_generator->setOpFile($output_folder_ns); + $ar_generator->setClasPrefix($class_prefix); + + if ($this->build_rel->Checked) { + $ar_generator->buildRelations(); + } + if ($table_name != "*") { + $ar_generator->generate($table_name); + } else { + $ar_generator->generateAll(); + } + $this->success_panel->CssClass = "success_panel"; + $this->generation_msg->Text = "The code has been generated successfully."; + } catch (Exception $ex) { + $this->success_panel->CssClass = "exception_panel"; + $this->generation_msg->Text = $ex->getMessage(); + } + $this->success_panel->Visible = true; + } + } + + public function preview($sender) { +// $ar_generator = new TWsatARGenerator(); +// $ar_generator->renderAllTablesInformation(); + throw new THttpException(500, "Not implemented yet."); + } + +} + ?>
\ No newline at end of file |