summaryrefslogtreecommitdiff
path: root/framework/Wsat/pages/TWsatGenerateAR.php
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Wsat/pages/TWsatGenerateAR.php')
-rw-r--r--framework/Wsat/pages/TWsatGenerateAR.php57
1 files changed, 57 insertions, 0 deletions
diff --git a/framework/Wsat/pages/TWsatGenerateAR.php b/framework/Wsat/pages/TWsatGenerateAR.php
new file mode 100644
index 00000000..f0ce8430
--- /dev/null
+++ b/framework/Wsat/pages/TWsatGenerateAR.php
@@ -0,0 +1,57 @@
+<?php
+
+/**
+ * @author Daniel Sampedro Bello <darthdaniel85@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2005-2013 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Id$
+ * @since 3.3
+ * @package Wsat.pages
+ */
+Prado::using("System.Wsat.TWsatARGenerator");
+
+class TWsatGenerateAR extends TPage
+{
+
+ public function generate($sender)
+ {
+ if ($this->IsValid)
+ {
+ $tableName = $this->table_name->Text;
+ $outputFolderNs = $this->output_folder->Text;
+ $classPrefix = $this->class_prefix->Text;
+ $classSuffix = $this->class_suffix->Text;
+
+ try
+ {
+ $ar_generator = new TWsatARGenerator();
+ $ar_generator->setOpFile($outputFolderNs);
+ $ar_generator->setClasPrefix($classPrefix);
+ $ar_generator->setClassSufix($classSuffix);
+
+ if ($this->build_rel->Checked)
+ $ar_generator->buildRelations();
+
+ if ($tableName != "*")
+ $ar_generator->generate($tableName);
+ else
+ $ar_generator->generateAll();
+
+ $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;
+ }
+ }
+
+ public function preview($sender)
+ {
+// throw new THttpException(500, "Not implemented yet.");
+ }
+
+} \ No newline at end of file