@@ -189,11 +189,11 @@ |
||
189 | 189 | return false; |
190 | 190 | } |
191 | 191 | |
192 | - /** |
|
193 | - * Returns all table names in the database. |
|
194 | - * @param string $schema the schema of the tables. This is not used for sqlite database. |
|
195 | - * @return array all table names in the database. |
|
196 | - */ |
|
192 | + /** |
|
193 | + * Returns all table names in the database. |
|
194 | + * @param string $schema the schema of the tables. This is not used for sqlite database. |
|
195 | + * @return array all table names in the database. |
|
196 | + */ |
|
197 | 197 | public function findTableNames($schema='') |
198 | 198 | { |
199 | 199 | $sql="SELECT DISTINCT tbl_name FROM sqlite_master WHERE tbl_name<>'sqlite_sequence'"; |
@@ -146,8 +146,7 @@ |
||
146 | 146 | { |
147 | 147 | $info['NumericPrecision'] = intval($ps[0]); |
148 | 148 | $info['NumericScale'] = intval($ps[1]); |
149 | - } |
|
150 | - else |
|
149 | + } else |
|
151 | 150 | $info['ColumnSize']=intval($match[1]); |
152 | 151 | $info['DbType'] = substr($type,0,$pos); |
153 | 152 | } |
@@ -69,30 +69,30 @@ discard block |
||
69 | 69 | */ |
70 | 70 | protected function createTableInfo($tableName) |
71 | 71 | { |
72 | - $tableName = str_replace("'",'',$tableName); |
|
72 | + $tableName=str_replace("'", '', $tableName); |
|
73 | 73 | $this->getDbConnection()->setActive(true); |
74 | - $table = $this->getDbConnection()->quoteString($tableName); |
|
75 | - $sql = "PRAGMA table_info({$table})"; |
|
76 | - $command = $this->getDbConnection()->createCommand($sql); |
|
77 | - $foreign = $this->getForeignKeys($table); |
|
74 | + $table=$this->getDbConnection()->quoteString($tableName); |
|
75 | + $sql="PRAGMA table_info({$table})"; |
|
76 | + $command=$this->getDbConnection()->createCommand($sql); |
|
77 | + $foreign=$this->getForeignKeys($table); |
|
78 | 78 | $index=0; |
79 | 79 | $columns=array(); |
80 | 80 | $primary=array(); |
81 | 81 | foreach($command->query() as $col) |
82 | 82 | { |
83 | - $col['index'] = $index++; |
|
84 | - $column = $this->processColumn($col, $foreign); |
|
85 | - $columns[$col['name']] = $column; |
|
83 | + $col['index']=$index++; |
|
84 | + $column=$this->processColumn($col, $foreign); |
|
85 | + $columns[$col['name']]=$column; |
|
86 | 86 | if($column->getIsPrimaryKey()) |
87 | - $primary[] = $col['name']; |
|
87 | + $primary[]=$col['name']; |
|
88 | 88 | } |
89 | - $info['TableName'] = $tableName; |
|
89 | + $info['TableName']=$tableName; |
|
90 | 90 | if($this->getIsView($tableName)) |
91 | - $info['IsView'] = true; |
|
91 | + $info['IsView']=true; |
|
92 | 92 | if(count($columns)===0) |
93 | 93 | throw new TDbException('dbmetadata_invalid_table_view', $tableName); |
94 | - $class = $this->getTableInfoClass(); |
|
95 | - $tableInfo = new $class($info,$primary,$foreign); |
|
94 | + $class=$this->getTableInfoClass(); |
|
95 | + $tableInfo=new $class($info, $primary, $foreign); |
|
96 | 96 | $tableInfo->getColumns()->copyFrom($columns); |
97 | 97 | return $tableInfo; |
98 | 98 | } |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | */ |
104 | 104 | protected function getIsView($tableName) |
105 | 105 | { |
106 | - $sql = 'SELECT count(*) FROM sqlite_master WHERE type="view" AND name= :table'; |
|
106 | + $sql='SELECT count(*) FROM sqlite_master WHERE type="view" AND name= :table'; |
|
107 | 107 | $this->getDbConnection()->setActive(true); |
108 | - $command = $this->getDbConnection()->createCommand($sql); |
|
108 | + $command=$this->getDbConnection()->createCommand($sql); |
|
109 | 109 | $command->bindValue(':table', $tableName); |
110 | - return intval($command->queryScalar()) === 1; |
|
110 | + return intval($command->queryScalar())===1; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -117,39 +117,39 @@ discard block |
||
117 | 117 | */ |
118 | 118 | protected function processColumn($col, $foreign) |
119 | 119 | { |
120 | - $columnId = $col['name']; //use column name as column Id |
|
120 | + $columnId=$col['name']; //use column name as column Id |
|
121 | 121 | |
122 | - $info['ColumnName'] = '"'.$columnId.'"'; //quote the column names! |
|
123 | - $info['ColumnId'] = $columnId; |
|
124 | - $info['ColumnIndex'] = $col['index']; |
|
122 | + $info['ColumnName']='"'.$columnId.'"'; //quote the column names! |
|
123 | + $info['ColumnId']=$columnId; |
|
124 | + $info['ColumnIndex']=$col['index']; |
|
125 | 125 | |
126 | 126 | if($col['notnull']!=='99') |
127 | - $info['AllowNull'] = true; |
|
127 | + $info['AllowNull']=true; |
|
128 | 128 | |
129 | 129 | if($col['pk']==='1') |
130 | - $info['IsPrimaryKey'] = true; |
|
130 | + $info['IsPrimaryKey']=true; |
|
131 | 131 | if($this->isForeignKeyColumn($columnId, $foreign)) |
132 | - $info['IsForeignKey'] = true; |
|
132 | + $info['IsForeignKey']=true; |
|
133 | 133 | |
134 | 134 | if($col['dflt_value']!==null) |
135 | - $info['DefaultValue'] = $col['dflt_value']; |
|
135 | + $info['DefaultValue']=$col['dflt_value']; |
|
136 | 136 | |
137 | - $type = strtolower($col['type']); |
|
138 | - $info['AutoIncrement'] = $type==='integer' && $col['pk']==='1'; |
|
137 | + $type=strtolower($col['type']); |
|
138 | + $info['AutoIncrement']=$type==='integer' && $col['pk']==='1'; |
|
139 | 139 | |
140 | - $info['DbType'] = $type; |
|
140 | + $info['DbType']=$type; |
|
141 | 141 | $match=array(); |
142 | 142 | if(is_int($pos=strpos($type, '(')) && preg_match('/\((.*)\)/', $type, $match)) |
143 | 143 | { |
144 | - $ps = explode(',', $match[1]); |
|
144 | + $ps=explode(',', $match[1]); |
|
145 | 145 | if(count($ps)===2) |
146 | 146 | { |
147 | - $info['NumericPrecision'] = intval($ps[0]); |
|
148 | - $info['NumericScale'] = intval($ps[1]); |
|
147 | + $info['NumericPrecision']=intval($ps[0]); |
|
148 | + $info['NumericScale']=intval($ps[1]); |
|
149 | 149 | } |
150 | 150 | else |
151 | 151 | $info['ColumnSize']=intval($match[1]); |
152 | - $info['DbType'] = substr($type,0,$pos); |
|
152 | + $info['DbType']=substr($type, 0, $pos); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | return new TSqliteTableColumn($info); |
@@ -163,13 +163,13 @@ discard block |
||
163 | 163 | */ |
164 | 164 | protected function getForeignKeys($table) |
165 | 165 | { |
166 | - $sql = "PRAGMA foreign_key_list({$table})"; |
|
167 | - $command = $this->getDbConnection()->createCommand($sql); |
|
168 | - $fkeys = array(); |
|
166 | + $sql="PRAGMA foreign_key_list({$table})"; |
|
167 | + $command=$this->getDbConnection()->createCommand($sql); |
|
168 | + $fkeys=array(); |
|
169 | 169 | foreach($command->query() as $col) |
170 | 170 | { |
171 | - $fkeys[$col['table']]['keys'][$col['from']] = $col['to']; |
|
172 | - $fkeys[$col['table']]['table'] = $col['table']; |
|
171 | + $fkeys[$col['table']]['keys'][$col['from']]=$col['to']; |
|
172 | + $fkeys[$col['table']]['table']=$col['table']; |
|
173 | 173 | } |
174 | 174 | return count($fkeys) > 0 ? array_values($fkeys) : $fkeys; |
175 | 175 | } |
@@ -36,46 +36,46 @@ |
||
36 | 36 | class TWsatService extends TPageService |
37 | 37 | { |
38 | 38 | |
39 | - private $_pass = ''; |
|
39 | + private $_pass = ''; |
|
40 | 40 | |
41 | - public function init($config) |
|
42 | - { |
|
43 | - if ($this->getApplication()->getMode() === TApplicationMode::Performance || $this->getApplication()->getMode() === TApplicationMode::Normal) |
|
44 | - throw new TInvalidOperationException("You should not use Prado WSAT in any of the production modes."); |
|
41 | + public function init($config) |
|
42 | + { |
|
43 | + if ($this->getApplication()->getMode() === TApplicationMode::Performance || $this->getApplication()->getMode() === TApplicationMode::Normal) |
|
44 | + throw new TInvalidOperationException("You should not use Prado WSAT in any of the production modes."); |
|
45 | 45 | |
46 | - if (empty($this->_pass)) |
|
47 | - throw new TConfigurationException("You need to specify the Password attribute."); |
|
46 | + if (empty($this->_pass)) |
|
47 | + throw new TConfigurationException("You need to specify the Password attribute."); |
|
48 | 48 | |
49 | - $this->setDefaultPage("TWsatHome"); |
|
50 | - $this->_startThemeManager(); |
|
51 | - parent::init($config); |
|
52 | - } |
|
49 | + $this->setDefaultPage("TWsatHome"); |
|
50 | + $this->_startThemeManager(); |
|
51 | + parent::init($config); |
|
52 | + } |
|
53 | 53 | |
54 | - public function getBasePath() |
|
55 | - { |
|
56 | - $basePath = Prado::getPathOfNamespace("System.Wsat.pages"); |
|
57 | - return realpath($basePath); |
|
58 | - } |
|
54 | + public function getBasePath() |
|
55 | + { |
|
56 | + $basePath = Prado::getPathOfNamespace("System.Wsat.pages"); |
|
57 | + return realpath($basePath); |
|
58 | + } |
|
59 | 59 | |
60 | - private function _startThemeManager() |
|
61 | - { |
|
62 | - $themeManager = new TThemeManager; |
|
63 | - $themeManager->BasePath = "System.Wsat.themes"; |
|
64 | - $url = Prado::getApplication()->getAssetManager()->publishFilePath(Prado::getPathOfNamespace('System.Wsat')); |
|
65 | - $themeManager->BaseUrl = "$url/themes"; |
|
60 | + private function _startThemeManager() |
|
61 | + { |
|
62 | + $themeManager = new TThemeManager; |
|
63 | + $themeManager->BasePath = "System.Wsat.themes"; |
|
64 | + $url = Prado::getApplication()->getAssetManager()->publishFilePath(Prado::getPathOfNamespace('System.Wsat')); |
|
65 | + $themeManager->BaseUrl = "$url/themes"; |
|
66 | 66 | |
67 | - $themeManager->init(null); |
|
68 | - $this->setThemeManager($themeManager); |
|
69 | - } |
|
67 | + $themeManager->init(null); |
|
68 | + $this->setThemeManager($themeManager); |
|
69 | + } |
|
70 | 70 | |
71 | - public function getPassword() |
|
72 | - { |
|
73 | - return $this->_pass; |
|
74 | - } |
|
71 | + public function getPassword() |
|
72 | + { |
|
73 | + return $this->_pass; |
|
74 | + } |
|
75 | 75 | |
76 | - public function setPassword($_pass) |
|
77 | - { |
|
78 | - $this->_pass = $_pass; |
|
79 | - } |
|
76 | + public function setPassword($_pass) |
|
77 | + { |
|
78 | + $this->_pass = $_pass; |
|
79 | + } |
|
80 | 80 | |
81 | 81 | } |
82 | 82 | \ No newline at end of file |
@@ -36,14 +36,14 @@ discard block |
||
36 | 36 | class TWsatService extends TPageService |
37 | 37 | { |
38 | 38 | |
39 | - private $_pass = ''; |
|
39 | + private $_pass=''; |
|
40 | 40 | |
41 | 41 | public function init($config) |
42 | 42 | { |
43 | - if ($this->getApplication()->getMode() === TApplicationMode::Performance || $this->getApplication()->getMode() === TApplicationMode::Normal) |
|
43 | + if($this->getApplication()->getMode()===TApplicationMode::Performance || $this->getApplication()->getMode()===TApplicationMode::Normal) |
|
44 | 44 | throw new TInvalidOperationException("You should not use Prado WSAT in any of the production modes."); |
45 | 45 | |
46 | - if (empty($this->_pass)) |
|
46 | + if(empty($this->_pass)) |
|
47 | 47 | throw new TConfigurationException("You need to specify the Password attribute."); |
48 | 48 | |
49 | 49 | $this->setDefaultPage("TWsatHome"); |
@@ -53,16 +53,16 @@ discard block |
||
53 | 53 | |
54 | 54 | public function getBasePath() |
55 | 55 | { |
56 | - $basePath = Prado::getPathOfNamespace("System.Wsat.pages"); |
|
56 | + $basePath=Prado::getPathOfNamespace("System.Wsat.pages"); |
|
57 | 57 | return realpath($basePath); |
58 | 58 | } |
59 | 59 | |
60 | 60 | private function _startThemeManager() |
61 | 61 | { |
62 | - $themeManager = new TThemeManager; |
|
63 | - $themeManager->BasePath = "System.Wsat.themes"; |
|
64 | - $url = Prado::getApplication()->getAssetManager()->publishFilePath(Prado::getPathOfNamespace('System.Wsat')); |
|
65 | - $themeManager->BaseUrl = "$url/themes"; |
|
62 | + $themeManager=new TThemeManager; |
|
63 | + $themeManager->BasePath="System.Wsat.themes"; |
|
64 | + $url=Prado::getApplication()->getAssetManager()->publishFilePath(Prado::getPathOfNamespace('System.Wsat')); |
|
65 | + $themeManager->BaseUrl="$url/themes"; |
|
66 | 66 | |
67 | 67 | $themeManager->init(null); |
68 | 68 | $this->setThemeManager($themeManager); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | public function setPassword($_pass) |
77 | 77 | { |
78 | - $this->_pass = $_pass; |
|
78 | + $this->_pass=$_pass; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | } |
82 | 82 | \ No newline at end of file |
@@ -14,69 +14,69 @@ |
||
14 | 14 | class TWsatBaseGenerator |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * @return TDbMetaData for retrieving metadata information, such as |
|
19 | - * table and columns information, from a database connection. |
|
20 | - */ |
|
21 | - protected $_dbMetaData; |
|
17 | + /** |
|
18 | + * @return TDbMetaData for retrieving metadata information, such as |
|
19 | + * table and columns information, from a database connection. |
|
20 | + */ |
|
21 | + protected $_dbMetaData; |
|
22 | 22 | |
23 | - /** |
|
24 | - * Output folder where AR classes will be saved. |
|
25 | - */ |
|
26 | - protected $_opFile; |
|
23 | + /** |
|
24 | + * Output folder where AR classes will be saved. |
|
25 | + */ |
|
26 | + protected $_opFile; |
|
27 | 27 | |
28 | - function __construct() |
|
29 | - { |
|
30 | - if (!class_exists("TActiveRecordManager", false)) |
|
31 | - throw new Exception("You need to enable the ActiveRecord module in your application configuration file."); |
|
32 | - $ar_manager = TActiveRecordManager::getInstance(); |
|
33 | - $_conn = $ar_manager->getDbConnection(); |
|
34 | - $_conn->Active = true; |
|
35 | - $this->_dbMetaData = TDbMetaData::getInstance($_conn); |
|
36 | - } |
|
28 | + function __construct() |
|
29 | + { |
|
30 | + if (!class_exists("TActiveRecordManager", false)) |
|
31 | + throw new Exception("You need to enable the ActiveRecord module in your application configuration file."); |
|
32 | + $ar_manager = TActiveRecordManager::getInstance(); |
|
33 | + $_conn = $ar_manager->getDbConnection(); |
|
34 | + $_conn->Active = true; |
|
35 | + $this->_dbMetaData = TDbMetaData::getInstance($_conn); |
|
36 | + } |
|
37 | 37 | |
38 | - public function setOpFile($op_file_namespace) |
|
39 | - { |
|
40 | - $op_file = Prado::getPathOfNamespace($op_file_namespace); |
|
41 | - if (empty($op_file)) |
|
42 | - throw new Exception("You need to fix your output folder namespace."); |
|
43 | - if (!is_dir($op_file)) |
|
44 | - mkdir($op_file, 0777, true); |
|
45 | - $this->_opFile = $op_file; |
|
46 | - } |
|
38 | + public function setOpFile($op_file_namespace) |
|
39 | + { |
|
40 | + $op_file = Prado::getPathOfNamespace($op_file_namespace); |
|
41 | + if (empty($op_file)) |
|
42 | + throw new Exception("You need to fix your output folder namespace."); |
|
43 | + if (!is_dir($op_file)) |
|
44 | + mkdir($op_file, 0777, true); |
|
45 | + $this->_opFile = $op_file; |
|
46 | + } |
|
47 | 47 | |
48 | - public function renderAllTablesInformation() |
|
49 | - { |
|
50 | - foreach ($this->getAllTableNames() as $table_name) |
|
51 | - { |
|
52 | - echo $table_name . "<br>"; |
|
53 | - $tableInfo = $this->_dbMetaData->getTableInfo($table_name); |
|
54 | - echo "Table info:" . "<br>"; |
|
55 | - echo "<pre>"; |
|
56 | - print_r($tableInfo); |
|
57 | - echo "</pre>"; |
|
58 | - } |
|
59 | - } |
|
48 | + public function renderAllTablesInformation() |
|
49 | + { |
|
50 | + foreach ($this->getAllTableNames() as $table_name) |
|
51 | + { |
|
52 | + echo $table_name . "<br>"; |
|
53 | + $tableInfo = $this->_dbMetaData->getTableInfo($table_name); |
|
54 | + echo "Table info:" . "<br>"; |
|
55 | + echo "<pre>"; |
|
56 | + print_r($tableInfo); |
|
57 | + echo "</pre>"; |
|
58 | + } |
|
59 | + } |
|
60 | 60 | |
61 | - public function getAllTableNames() |
|
62 | - { |
|
63 | - $tableNames = $this->_dbMetaData->findTableNames(); |
|
64 | - $index = array_search('pradocache', $tableNames); |
|
65 | - if ($index) |
|
66 | - array_splice($tableNames, $index, 1); |
|
67 | - return $tableNames; |
|
68 | - } |
|
61 | + public function getAllTableNames() |
|
62 | + { |
|
63 | + $tableNames = $this->_dbMetaData->findTableNames(); |
|
64 | + $index = array_search('pradocache', $tableNames); |
|
65 | + if ($index) |
|
66 | + array_splice($tableNames, $index, 1); |
|
67 | + return $tableNames; |
|
68 | + } |
|
69 | 69 | |
70 | - public static function pr($data) |
|
71 | - { |
|
72 | - echo "<pre>"; |
|
73 | - print_r($data); |
|
74 | - echo "</pre>"; |
|
75 | - } |
|
70 | + public static function pr($data) |
|
71 | + { |
|
72 | + echo "<pre>"; |
|
73 | + print_r($data); |
|
74 | + echo "</pre>"; |
|
75 | + } |
|
76 | 76 | |
77 | - protected function eq($data) |
|
78 | - { |
|
79 | - return '"' . $data . '"'; |
|
80 | - } |
|
77 | + protected function eq($data) |
|
78 | + { |
|
79 | + return '"' . $data . '"'; |
|
80 | + } |
|
81 | 81 | |
82 | 82 | } |
@@ -27,31 +27,31 @@ discard block |
||
27 | 27 | |
28 | 28 | function __construct() |
29 | 29 | { |
30 | - if (!class_exists("TActiveRecordManager", false)) |
|
30 | + if(!class_exists("TActiveRecordManager", false)) |
|
31 | 31 | throw new Exception("You need to enable the ActiveRecord module in your application configuration file."); |
32 | - $ar_manager = TActiveRecordManager::getInstance(); |
|
33 | - $_conn = $ar_manager->getDbConnection(); |
|
34 | - $_conn->Active = true; |
|
35 | - $this->_dbMetaData = TDbMetaData::getInstance($_conn); |
|
32 | + $ar_manager=TActiveRecordManager::getInstance(); |
|
33 | + $_conn=$ar_manager->getDbConnection(); |
|
34 | + $_conn->Active=true; |
|
35 | + $this->_dbMetaData=TDbMetaData::getInstance($_conn); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | public function setOpFile($op_file_namespace) |
39 | 39 | { |
40 | - $op_file = Prado::getPathOfNamespace($op_file_namespace); |
|
41 | - if (empty($op_file)) |
|
40 | + $op_file=Prado::getPathOfNamespace($op_file_namespace); |
|
41 | + if(empty($op_file)) |
|
42 | 42 | throw new Exception("You need to fix your output folder namespace."); |
43 | - if (!is_dir($op_file)) |
|
43 | + if(!is_dir($op_file)) |
|
44 | 44 | mkdir($op_file, 0777, true); |
45 | - $this->_opFile = $op_file; |
|
45 | + $this->_opFile=$op_file; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | public function renderAllTablesInformation() |
49 | 49 | { |
50 | - foreach ($this->getAllTableNames() as $table_name) |
|
50 | + foreach($this->getAllTableNames() as $table_name) |
|
51 | 51 | { |
52 | - echo $table_name . "<br>"; |
|
53 | - $tableInfo = $this->_dbMetaData->getTableInfo($table_name); |
|
54 | - echo "Table info:" . "<br>"; |
|
52 | + echo $table_name."<br>"; |
|
53 | + $tableInfo=$this->_dbMetaData->getTableInfo($table_name); |
|
54 | + echo "Table info:"."<br>"; |
|
55 | 55 | echo "<pre>"; |
56 | 56 | print_r($tableInfo); |
57 | 57 | echo "</pre>"; |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | |
61 | 61 | public function getAllTableNames() |
62 | 62 | { |
63 | - $tableNames = $this->_dbMetaData->findTableNames(); |
|
64 | - $index = array_search('pradocache', $tableNames); |
|
65 | - if ($index) |
|
63 | + $tableNames=$this->_dbMetaData->findTableNames(); |
|
64 | + $index=array_search('pradocache', $tableNames); |
|
65 | + if($index) |
|
66 | 66 | array_splice($tableNames, $index, 1); |
67 | 67 | return $tableNames; |
68 | 68 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | protected function eq($data) |
78 | 78 | { |
79 | - return '"' . $data . '"'; |
|
79 | + return '"'.$data.'"'; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | } |
@@ -14,59 +14,59 @@ |
||
14 | 14 | class TWsatScaffolding extends TPage |
15 | 15 | { |
16 | 16 | |
17 | - public function onInit($param) |
|
18 | - { |
|
19 | - parent::onInit($param); |
|
20 | - $this->startVisual(); |
|
21 | - } |
|
17 | + public function onInit($param) |
|
18 | + { |
|
19 | + parent::onInit($param); |
|
20 | + $this->startVisual(); |
|
21 | + } |
|
22 | 22 | |
23 | - private function startVisual() |
|
24 | - { |
|
25 | - $scf_generator = new TWsatScaffoldingGenerator(); |
|
26 | - foreach ($scf_generator->getAllTableNames() as $tableName) |
|
27 | - { |
|
28 | - $dynChb = new TCheckBox(); |
|
29 | - $dynChb->ID = "cb_$tableName"; |
|
30 | - $dynChb->Text = ucfirst($tableName); |
|
31 | - $dynChb->Checked = true; |
|
32 | - $this->registerObject("cb_$tableName", $dynChb); |
|
33 | - $this->tableNames->getControls()->add($dynChb); |
|
34 | - $this->tableNames->getControls()->add("</br>"); |
|
35 | - } |
|
36 | - } |
|
23 | + private function startVisual() |
|
24 | + { |
|
25 | + $scf_generator = new TWsatScaffoldingGenerator(); |
|
26 | + foreach ($scf_generator->getAllTableNames() as $tableName) |
|
27 | + { |
|
28 | + $dynChb = new TCheckBox(); |
|
29 | + $dynChb->ID = "cb_$tableName"; |
|
30 | + $dynChb->Text = ucfirst($tableName); |
|
31 | + $dynChb->Checked = true; |
|
32 | + $this->registerObject("cb_$tableName", $dynChb); |
|
33 | + $this->tableNames->getControls()->add($dynChb); |
|
34 | + $this->tableNames->getControls()->add("</br>"); |
|
35 | + } |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * Generate Scaffolding code for selected tables |
|
40 | - * @param type $sender |
|
41 | - */ |
|
42 | - public function generate($sender) |
|
43 | - { |
|
44 | - if ($this->IsValid) |
|
45 | - { |
|
46 | - try |
|
47 | - { |
|
48 | - $scf_generator = new TWsatScaffoldingGenerator(); |
|
49 | - $scf_generator->setOpFile($this->output_folder->Text); |
|
50 | - foreach ($scf_generator->getAllTableNames() as $tableName) |
|
51 | - { |
|
52 | - $id = "cb_$tableName"; |
|
53 | - $obj = $this->tableNames->findControl($id); |
|
54 | - if($obj!==null && $obj->Checked) |
|
55 | - { |
|
56 | - $scf_generator->generateCRUD($tableName); |
|
57 | - } |
|
58 | - } |
|
38 | + /** |
|
39 | + * Generate Scaffolding code for selected tables |
|
40 | + * @param type $sender |
|
41 | + */ |
|
42 | + public function generate($sender) |
|
43 | + { |
|
44 | + if ($this->IsValid) |
|
45 | + { |
|
46 | + try |
|
47 | + { |
|
48 | + $scf_generator = new TWsatScaffoldingGenerator(); |
|
49 | + $scf_generator->setOpFile($this->output_folder->Text); |
|
50 | + foreach ($scf_generator->getAllTableNames() as $tableName) |
|
51 | + { |
|
52 | + $id = "cb_$tableName"; |
|
53 | + $obj = $this->tableNames->findControl($id); |
|
54 | + if($obj!==null && $obj->Checked) |
|
55 | + { |
|
56 | + $scf_generator->generateCRUD($tableName); |
|
57 | + } |
|
58 | + } |
|
59 | 59 | |
60 | - $this->feedback_panel->CssClass = "green_panel"; |
|
61 | - $this->generation_msg->Text = "The code has been generated successfully."; |
|
62 | - } catch (Exception $ex) |
|
63 | - { |
|
64 | - $this->feedback_panel->CssClass = "red_panel"; |
|
65 | - $this->generation_msg->Text = $ex->getMessage(); |
|
66 | - } |
|
67 | - $this->feedback_panel->Visible = true; |
|
68 | - } |
|
60 | + $this->feedback_panel->CssClass = "green_panel"; |
|
61 | + $this->generation_msg->Text = "The code has been generated successfully."; |
|
62 | + } catch (Exception $ex) |
|
63 | + { |
|
64 | + $this->feedback_panel->CssClass = "red_panel"; |
|
65 | + $this->generation_msg->Text = $ex->getMessage(); |
|
66 | + } |
|
67 | + $this->feedback_panel->Visible = true; |
|
68 | + } |
|
69 | 69 | |
70 | - // $scf_generator->renderAllTablesInformation(); |
|
71 | - } |
|
70 | + // $scf_generator->renderAllTablesInformation(); |
|
71 | + } |
|
72 | 72 | } |
73 | 73 | \ No newline at end of file |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | |
23 | 23 | private function startVisual() |
24 | 24 | { |
25 | - $scf_generator = new TWsatScaffoldingGenerator(); |
|
26 | - foreach ($scf_generator->getAllTableNames() as $tableName) |
|
25 | + $scf_generator=new TWsatScaffoldingGenerator(); |
|
26 | + foreach($scf_generator->getAllTableNames() as $tableName) |
|
27 | 27 | { |
28 | - $dynChb = new TCheckBox(); |
|
29 | - $dynChb->ID = "cb_$tableName"; |
|
30 | - $dynChb->Text = ucfirst($tableName); |
|
31 | - $dynChb->Checked = true; |
|
28 | + $dynChb=new TCheckBox(); |
|
29 | + $dynChb->ID="cb_$tableName"; |
|
30 | + $dynChb->Text=ucfirst($tableName); |
|
31 | + $dynChb->Checked=true; |
|
32 | 32 | $this->registerObject("cb_$tableName", $dynChb); |
33 | 33 | $this->tableNames->getControls()->add($dynChb); |
34 | 34 | $this->tableNames->getControls()->add("</br>"); |
@@ -41,30 +41,30 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function generate($sender) |
43 | 43 | { |
44 | - if ($this->IsValid) |
|
44 | + if($this->IsValid) |
|
45 | 45 | { |
46 | 46 | try |
47 | 47 | { |
48 | - $scf_generator = new TWsatScaffoldingGenerator(); |
|
48 | + $scf_generator=new TWsatScaffoldingGenerator(); |
|
49 | 49 | $scf_generator->setOpFile($this->output_folder->Text); |
50 | - foreach ($scf_generator->getAllTableNames() as $tableName) |
|
50 | + foreach($scf_generator->getAllTableNames() as $tableName) |
|
51 | 51 | { |
52 | - $id = "cb_$tableName"; |
|
53 | - $obj = $this->tableNames->findControl($id); |
|
52 | + $id="cb_$tableName"; |
|
53 | + $obj=$this->tableNames->findControl($id); |
|
54 | 54 | if($obj!==null && $obj->Checked) |
55 | 55 | { |
56 | 56 | $scf_generator->generateCRUD($tableName); |
57 | 57 | } |
58 | 58 | } |
59 | 59 | |
60 | - $this->feedback_panel->CssClass = "green_panel"; |
|
61 | - $this->generation_msg->Text = "The code has been generated successfully."; |
|
62 | - } catch (Exception $ex) |
|
60 | + $this->feedback_panel->CssClass="green_panel"; |
|
61 | + $this->generation_msg->Text="The code has been generated successfully."; |
|
62 | + } catch(Exception $ex) |
|
63 | 63 | { |
64 | - $this->feedback_panel->CssClass = "red_panel"; |
|
65 | - $this->generation_msg->Text = $ex->getMessage(); |
|
64 | + $this->feedback_panel->CssClass="red_panel"; |
|
65 | + $this->generation_msg->Text=$ex->getMessage(); |
|
66 | 66 | } |
67 | - $this->feedback_panel->Visible = true; |
|
67 | + $this->feedback_panel->Visible=true; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | // $scf_generator->renderAllTablesInformation(); |
@@ -8,29 +8,29 @@ |
||
8 | 8 | class TWsatLayout extends TTemplateControl |
9 | 9 | { |
10 | 10 | |
11 | - public function onLoad($param) |
|
12 | - { |
|
13 | - parent::onLoad($param); |
|
14 | - $this->validateSecurity(); |
|
15 | - } |
|
11 | + public function onLoad($param) |
|
12 | + { |
|
13 | + parent::onLoad($param); |
|
14 | + $this->validateSecurity(); |
|
15 | + } |
|
16 | 16 | |
17 | - private function validateSecurity() |
|
18 | - { |
|
19 | - if ($this->Session["wsat_password"] !== $this->getService()->getPassword()) |
|
20 | - { |
|
21 | - if (!$this->getPage() instanceof TWsatLogin) |
|
22 | - { |
|
23 | - $url = $this->Service->constructUrl('TWsatLogin'); |
|
24 | - $this->Response->redirect($url); |
|
25 | - } |
|
26 | - } |
|
27 | - } |
|
17 | + private function validateSecurity() |
|
18 | + { |
|
19 | + if ($this->Session["wsat_password"] !== $this->getService()->getPassword()) |
|
20 | + { |
|
21 | + if (!$this->getPage() instanceof TWsatLogin) |
|
22 | + { |
|
23 | + $url = $this->Service->constructUrl('TWsatLogin'); |
|
24 | + $this->Response->redirect($url); |
|
25 | + } |
|
26 | + } |
|
27 | + } |
|
28 | 28 | |
29 | - public function logout() |
|
30 | - { |
|
31 | - $this->Session["wsat_password"] = ""; |
|
32 | - $url = $this->Service->constructUrl('TWsatLogin'); |
|
33 | - $this->Response->redirect($url); |
|
34 | - } |
|
29 | + public function logout() |
|
30 | + { |
|
31 | + $this->Session["wsat_password"] = ""; |
|
32 | + $url = $this->Service->constructUrl('TWsatLogin'); |
|
33 | + $this->Response->redirect($url); |
|
34 | + } |
|
35 | 35 | |
36 | 36 | } |
37 | 37 | \ No newline at end of file |
@@ -16,11 +16,11 @@ discard block |
||
16 | 16 | |
17 | 17 | private function validateSecurity() |
18 | 18 | { |
19 | - if ($this->Session["wsat_password"] !== $this->getService()->getPassword()) |
|
19 | + if($this->Session["wsat_password"]!==$this->getService()->getPassword()) |
|
20 | 20 | { |
21 | - if (!$this->getPage() instanceof TWsatLogin) |
|
21 | + if(!$this->getPage() instanceof TWsatLogin) |
|
22 | 22 | { |
23 | - $url = $this->Service->constructUrl('TWsatLogin'); |
|
23 | + $url=$this->Service->constructUrl('TWsatLogin'); |
|
24 | 24 | $this->Response->redirect($url); |
25 | 25 | } |
26 | 26 | } |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | |
29 | 29 | public function logout() |
30 | 30 | { |
31 | - $this->Session["wsat_password"] = ""; |
|
32 | - $url = $this->Service->constructUrl('TWsatLogin'); |
|
31 | + $this->Session["wsat_password"]=""; |
|
32 | + $url=$this->Service->constructUrl('TWsatLogin'); |
|
33 | 33 | $this->Response->redirect($url); |
34 | 34 | } |
35 | 35 |
@@ -12,21 +12,21 @@ |
||
12 | 12 | class TWsatLogin extends TPage |
13 | 13 | { |
14 | 14 | |
15 | - public function login() |
|
16 | - { |
|
17 | - if ($this->IsValid) |
|
18 | - { |
|
19 | - $this->Session["wsat_password"] = $this->getService()->getPassword(); |
|
20 | - $url = $this->Service->constructUrl('TWsatHome'); |
|
21 | - $this->Response->redirect($url); |
|
22 | - } |
|
23 | - } |
|
15 | + public function login() |
|
16 | + { |
|
17 | + if ($this->IsValid) |
|
18 | + { |
|
19 | + $this->Session["wsat_password"] = $this->getService()->getPassword(); |
|
20 | + $url = $this->Service->constructUrl('TWsatHome'); |
|
21 | + $this->Response->redirect($url); |
|
22 | + } |
|
23 | + } |
|
24 | 24 | |
25 | - public function validatePassword($sender, $param) |
|
26 | - { |
|
27 | - $config_pass = $this->Service->Password; |
|
28 | - $user_pass = $this->password->Text; |
|
29 | - $param->IsValid = $user_pass === $config_pass; |
|
30 | - } |
|
25 | + public function validatePassword($sender, $param) |
|
26 | + { |
|
27 | + $config_pass = $this->Service->Password; |
|
28 | + $user_pass = $this->password->Text; |
|
29 | + $param->IsValid = $user_pass === $config_pass; |
|
30 | + } |
|
31 | 31 | |
32 | 32 | } |
33 | 33 | \ No newline at end of file |
@@ -14,19 +14,19 @@ |
||
14 | 14 | |
15 | 15 | public function login() |
16 | 16 | { |
17 | - if ($this->IsValid) |
|
17 | + if($this->IsValid) |
|
18 | 18 | { |
19 | - $this->Session["wsat_password"] = $this->getService()->getPassword(); |
|
20 | - $url = $this->Service->constructUrl('TWsatHome'); |
|
19 | + $this->Session["wsat_password"]=$this->getService()->getPassword(); |
|
20 | + $url=$this->Service->constructUrl('TWsatHome'); |
|
21 | 21 | $this->Response->redirect($url); |
22 | 22 | } |
23 | 23 | } |
24 | 24 | |
25 | 25 | public function validatePassword($sender, $param) |
26 | 26 | { |
27 | - $config_pass = $this->Service->Password; |
|
28 | - $user_pass = $this->password->Text; |
|
29 | - $param->IsValid = $user_pass === $config_pass; |
|
27 | + $config_pass=$this->Service->Password; |
|
28 | + $user_pass=$this->password->Text; |
|
29 | + $param->IsValid=$user_pass===$config_pass; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | } |
33 | 33 | \ No newline at end of file |
@@ -120,11 +120,11 @@ discard block |
||
120 | 120 | } |
121 | 121 | } |
122 | 122 | |
123 | - /** |
|
124 | - * Clears all existing selections on the client side. |
|
125 | - */ |
|
126 | - public function clearSelection() |
|
127 | - { |
|
123 | + /** |
|
124 | + * Clears all existing selections on the client side. |
|
125 | + */ |
|
126 | + public function clearSelection() |
|
127 | + { |
|
128 | 128 | if($this->canUpdateClientSide()) |
129 | 129 | { |
130 | 130 | $this->updateListItems(); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | $this->getPage()->getCallbackClient()->select($this->getControl(), 'Clear'); |
138 | 138 | } |
139 | 139 | } |
140 | - } |
|
140 | + } |
|
141 | 141 | |
142 | 142 | /** |
143 | 143 | * Update the client-side list options. |
@@ -70,20 +70,20 @@ discard block |
||
70 | 70 | if($this->canUpdateClientSide()) |
71 | 71 | { |
72 | 72 | $this->updateListItems(); |
73 | - $n = $this->getControl()->getItemCount(); |
|
73 | + $n=$this->getControl()->getItemCount(); |
|
74 | 74 | |
75 | 75 | $promptValue=$this->getControl()->getPromptValue(); |
76 | 76 | if($promptValue==='') |
77 | 77 | $promptValue=$this->getControl()->getPromptText(); |
78 | 78 | |
79 | - $list = array(); |
|
79 | + $list=array(); |
|
80 | 80 | foreach($indices as $index) |
81 | 81 | { |
82 | - $index = intval($index); |
|
82 | + $index=intval($index); |
|
83 | 83 | if($promptValue!=='') |
84 | 84 | $index++; |
85 | 85 | if($index >= 0 && $index <= $n) |
86 | - $list[] = $index; |
|
86 | + $list[]=$index; |
|
87 | 87 | } |
88 | 88 | if(count($list) > 0) |
89 | 89 | $this->getPage()->getCallbackClient()->select( |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | if($this->canUpdateClientSide()) |
115 | 115 | { |
116 | 116 | $this->updateListItems(); |
117 | - $list = array(); |
|
117 | + $list=array(); |
|
118 | 118 | foreach($values as $value) |
119 | - $list[] = $value; |
|
119 | + $list[]=$value; |
|
120 | 120 | if(count($list) > 0) |
121 | 121 | $this->getPage()->getCallbackClient()->select( |
122 | 122 | $this->getControl(), 'Values', $list); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | { |
150 | 150 | if($this->canUpdateClientSide()) |
151 | 151 | { |
152 | - $items = $this->getControl()->getItems(); |
|
152 | + $items=$this->getControl()->getItems(); |
|
153 | 153 | if($items instanceof TActiveListItemCollection |
154 | 154 | && $items->getListHasChanged()) |
155 | 155 | { |
@@ -173,15 +173,15 @@ |
||
173 | 173 | { |
174 | 174 | if(($forControl=$this->getForControl())==='') |
175 | 175 | throw new TConfigurationException('keyboard_forcontrol_required'); |
176 | - if(($target=$this->findControl($forControl))===null) |
|
177 | - throw new TConfigurationException('keyboard_forcontrol_invalid',$forControl); |
|
176 | + if(($target=$this->findControl($forControl))===null) |
|
177 | + throw new TConfigurationException('keyboard_forcontrol_invalid',$forControl); |
|
178 | 178 | |
179 | - $options['ID'] = $this->getClientID(); |
|
180 | - $options['ForControl'] = $target->getClientID(); |
|
181 | - $options['AutoHide'] = $this->getAutoHide(); |
|
182 | - $options['CssClass'] = $this->getKeyboardCssClass(); |
|
179 | + $options['ID'] = $this->getClientID(); |
|
180 | + $options['ForControl'] = $target->getClientID(); |
|
181 | + $options['AutoHide'] = $this->getAutoHide(); |
|
182 | + $options['CssClass'] = $this->getKeyboardCssClass(); |
|
183 | 183 | |
184 | - return $options; |
|
184 | + return $options; |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function getForControl() |
44 | 44 | { |
45 | - return $this->getViewState('ForControl',''); |
|
45 | + return $this->getViewState('ForControl', ''); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | { |
132 | 132 | parent::addAttributesToRender($writer); |
133 | 133 | if($this->getPage()->getClientSupportsJavaScript()) |
134 | - $writer->addAttribute('id',$this->getClientID()); |
|
134 | + $writer->addAttribute('id', $this->getClientID()); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | { |
144 | 144 | if(($url=$this->getCssUrl())==='') |
145 | 145 | $url=$this->getApplication()->getAssetManager()->publishFilePath(dirname(__FILE__).DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'keyboard.css'); |
146 | - $this->getPage()->getClientScript()->registerStyleSheetFile($url,$url); |
|
146 | + $this->getPage()->getClientScript()->registerStyleSheetFile($url, $url); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -174,12 +174,12 @@ discard block |
||
174 | 174 | if(($forControl=$this->getForControl())==='') |
175 | 175 | throw new TConfigurationException('keyboard_forcontrol_required'); |
176 | 176 | if(($target=$this->findControl($forControl))===null) |
177 | - throw new TConfigurationException('keyboard_forcontrol_invalid',$forControl); |
|
177 | + throw new TConfigurationException('keyboard_forcontrol_invalid', $forControl); |
|
178 | 178 | |
179 | - $options['ID'] = $this->getClientID(); |
|
180 | - $options['ForControl'] = $target->getClientID(); |
|
181 | - $options['AutoHide'] = $this->getAutoHide(); |
|
182 | - $options['CssClass'] = $this->getKeyboardCssClass(); |
|
179 | + $options['ID']=$this->getClientID(); |
|
180 | + $options['ForControl']=$target->getClientID(); |
|
181 | + $options['AutoHide']=$this->getAutoHide(); |
|
182 | + $options['CssClass']=$this->getKeyboardCssClass(); |
|
183 | 183 | |
184 | 184 | return $options; |
185 | 185 | } |
@@ -101,7 +101,7 @@ |
||
101 | 101 | |
102 | 102 | /** |
103 | 103 | * Sets the horizontal alignment of the contents within the panel. |
104 | - * Valid values include 'NotSet', 'Justify', 'Left', 'Right', 'Center' |
|
104 | + * Valid values include 'NotSet', 'Justify', 'Left', 'Right', 'Center' |
|
105 | 105 | * @param string the horizontal alignment |
106 | 106 | */ |
107 | 107 | public function setHorizontalAlign($value) |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | { |
72 | 72 | parent::addAttributesToRender($writer); |
73 | 73 | if(($butt=$this->getDefaultButton())!=='') |
74 | - $writer->addAttribute('id',$this->getClientID()); |
|
74 | + $writer->addAttribute('id', $this->getClientID()); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | */ |
169 | 169 | public function getGroupingText() |
170 | 170 | { |
171 | - return $this->getViewState('GroupingText',''); |
|
171 | + return $this->getViewState('GroupingText', ''); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | /** |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | */ |
177 | 177 | public function setGroupingText($value) |
178 | 178 | { |
179 | - $this->setViewState('GroupingText',$value,''); |
|
179 | + $this->setViewState('GroupingText', $value, ''); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | if(($butt=$this->getDefaultButton())!=='') |
231 | 231 | { |
232 | 232 | if(($button=$this->findControl($butt))===null) |
233 | - throw new TInvalidDataValueException('panel_defaultbutton_invalid',$butt); |
|
233 | + throw new TInvalidDataValueException('panel_defaultbutton_invalid', $butt); |
|
234 | 234 | else |
235 | 235 | $this->getPage()->getClientScript()->registerDefaultButton($this, $button); |
236 | 236 | } |