summaryrefslogtreecommitdiff
path: root/framework/Wsat/pages/TWsatGenerateAR.php
diff options
context:
space:
mode:
authorDaniel <darthdaniel85@gmail.com>2013-11-22 15:25:30 -0500
committerDaniel <darthdaniel85@gmail.com>2013-11-22 15:25:30 -0500
commitab6effd64caefa732ef0994d6c3048f5cd474bf6 (patch)
tree73f4e568295f4d7625fc16af9ce03c58bbbaab2a /framework/Wsat/pages/TWsatGenerateAR.php
parent85ca63b0896be3d12a098b44b5ec0c65a5b76a6c (diff)
WSAT beta release.
Diffstat (limited to 'framework/Wsat/pages/TWsatGenerateAR.php')
-rw-r--r--framework/Wsat/pages/TWsatGenerateAR.php80
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