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/TWsatGenerateAR.php | |
parent | 61f2ea48a4e11cb5fb941b3783e19c9e9ef38a45 (diff) |
* Prado 3.3.0
Diffstat (limited to 'lib/prado/framework/Wsat/pages/TWsatGenerateAR.php')
-rw-r--r-- | lib/prado/framework/Wsat/pages/TWsatGenerateAR.php | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/lib/prado/framework/Wsat/pages/TWsatGenerateAR.php b/lib/prado/framework/Wsat/pages/TWsatGenerateAR.php new file mode 100644 index 0000000..1677a8e --- /dev/null +++ b/lib/prado/framework/Wsat/pages/TWsatGenerateAR.php @@ -0,0 +1,57 @@ +<?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.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 |