@@ -53,15 +53,15 @@ discard block |
||
53 | 53 | */ |
54 | 54 | protected function initializeSort() |
55 | 55 | { |
56 | - $table = $this->getTableInfo(); |
|
57 | - $sorts = array('Sort By', str_repeat('-',15)); |
|
58 | - $headers = array(); |
|
56 | + $table=$this->getTableInfo(); |
|
57 | + $sorts=array('Sort By', str_repeat('-', 15)); |
|
58 | + $headers=array(); |
|
59 | 59 | foreach($table->getColumns() as $name=>$colum) |
60 | 60 | { |
61 | - $fname = ucwords(str_replace('_', ' ', $name)); |
|
62 | - $sorts[$name.' ASC'] = $fname .' Ascending'; |
|
63 | - $sorts[$name.' DESC'] = $fname .' Descending'; |
|
64 | - $headers[] = $fname ; |
|
61 | + $fname=ucwords(str_replace('_', ' ', $name)); |
|
62 | + $sorts[$name.' ASC']=$fname.' Ascending'; |
|
63 | + $sorts[$name.' DESC']=$fname.' Descending'; |
|
64 | + $headers[]=$fname; |
|
65 | 65 | } |
66 | 66 | $this->_sort->setDataSource($sorts); |
67 | 67 | $this->_sort->dataBind(); |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | */ |
89 | 89 | protected function loadRecordData() |
90 | 90 | { |
91 | - $search = new TActiveRecordCriteria($this->getSearchCondition(), $this->getSearchParameters()); |
|
91 | + $search=new TActiveRecordCriteria($this->getSearchCondition(), $this->getSearchParameters()); |
|
92 | 92 | $this->_list->setVirtualItemCount($this->getRecordFinder()->count($search)); |
93 | - $finder = $this->getRecordFinder(); |
|
94 | - $criteria = $this->getRecordCriteria(); |
|
93 | + $finder=$this->getRecordFinder(); |
|
94 | + $criteria=$this->getRecordCriteria(); |
|
95 | 95 | $this->_list->setDataSource($finder->findAll($criteria)); |
96 | 96 | $this->_list->dataBind(); |
97 | 97 | } |
@@ -101,21 +101,21 @@ discard block |
||
101 | 101 | */ |
102 | 102 | protected function getRecordCriteria() |
103 | 103 | { |
104 | - $total = $this->_list->getVirtualItemCount(); |
|
105 | - $limit = $this->_list->getPageSize(); |
|
106 | - $offset = $this->_list->getCurrentPageIndex()*$limit; |
|
104 | + $total=$this->_list->getVirtualItemCount(); |
|
105 | + $limit=$this->_list->getPageSize(); |
|
106 | + $offset=$this->_list->getCurrentPageIndex() * $limit; |
|
107 | 107 | if($offset + $limit > $total) |
108 | - $limit = $total - $offset; |
|
109 | - $criteria = new TActiveRecordCriteria($this->getSearchCondition(), $this->getSearchParameters()); |
|
108 | + $limit=$total - $offset; |
|
109 | + $criteria=new TActiveRecordCriteria($this->getSearchCondition(), $this->getSearchParameters()); |
|
110 | 110 | if($limit > 0) |
111 | 111 | { |
112 | 112 | $criteria->setLimit($limit); |
113 | 113 | if($offset <= $total) |
114 | 114 | $criteria->setOffset($offset); |
115 | 115 | } |
116 | - $order = explode(' ',$this->_sort->getSelectedValue(), 2); |
|
117 | - if(is_array($order) && count($order) === 2) |
|
118 | - $criteria->OrdersBy[$order[0]] = $order[1]; |
|
116 | + $order=explode(' ', $this->_sort->getSelectedValue(), 2); |
|
117 | + if(is_array($order) && count($order)===2) |
|
118 | + $criteria->OrdersBy[$order[0]]=$order[1]; |
|
119 | 119 | return $criteria; |
120 | 120 | } |
121 | 121 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | */ |
141 | 141 | public function setSearchParameters($value) |
142 | 142 | { |
143 | - $this->setViewState('SearchParameters', TPropertyValue::ensureArray($value),array()); |
|
143 | + $this->setViewState('SearchParameters', TPropertyValue::ensureArray($value), array()); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | { |
177 | 177 | if($param instanceof TRepeaterCommandEventParameter) |
178 | 178 | { |
179 | - $pk = $param->getItem()->getCustomData(); |
|
179 | + $pk=$param->getItem()->getCustomData(); |
|
180 | 180 | $ctrl->setRecordPk($pk); |
181 | 181 | $ctrl->initializeEditForm(); |
182 | 182 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | { |
191 | 191 | if($param instanceof TRepeaterCommandEventParameter) |
192 | 192 | { |
193 | - $pk = $param->getItem()->getCustomData(); |
|
193 | + $pk=$param->getItem()->getCustomData(); |
|
194 | 194 | $this->getRecordFinder()->deleteByPk($pk); |
195 | 195 | } |
196 | 196 | } |
@@ -200,10 +200,10 @@ discard block |
||
200 | 200 | */ |
201 | 201 | protected function listItemCreated($sender, $param) |
202 | 202 | { |
203 | - $item = $param->getItem(); |
|
203 | + $item=$param->getItem(); |
|
204 | 204 | if($item instanceof IItemDataRenderer) |
205 | 205 | { |
206 | - $type = $item->getItemType(); |
|
206 | + $type=$item->getItemType(); |
|
207 | 207 | if($type==TListItemType::Item || $type==TListItemType::AlternatingItem) |
208 | 208 | $this->populateField($sender, $param); |
209 | 209 | } |
@@ -215,11 +215,11 @@ discard block |
||
215 | 215 | */ |
216 | 216 | protected function populateField($sender, $param) |
217 | 217 | { |
218 | - $item = $param->getItem(); |
|
219 | - if(($data = $item->getData()) !== null) |
|
218 | + $item=$param->getItem(); |
|
219 | + if(($data=$item->getData())!==null) |
|
220 | 220 | { |
221 | 221 | $item->setCustomData($this->getRecordPkValues($data)); |
222 | - if(($prop = $item->findControl('_properties'))!==null) |
|
222 | + if(($prop=$item->findControl('_properties'))!==null) |
|
223 | 223 | { |
224 | 224 | $item->_properties->setDataSource($this->getRecordPropertyValues($data)); |
225 | 225 | $item->_properties->dataBind(); |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | { |
295 | 295 | if(($id=$this->getEditViewID())!==null) |
296 | 296 | { |
297 | - $ctrl = $this->getParent()->findControl($id); |
|
297 | + $ctrl=$this->getParent()->findControl($id); |
|
298 | 298 | if($ctrl===null) |
299 | 299 | throw new TConfigurationException('scaffold_unable_to_find_edit_view', $id); |
300 | 300 | return $ctrl; |
@@ -113,6 +113,7 @@ |
||
113 | 113 | |
114 | 114 | /** |
115 | 115 | * @param string button caption |
116 | + * @param string $value |
|
116 | 117 | */ |
117 | 118 | public function setButtonText($value) |
118 | 119 | { |
@@ -49,7 +49,7 @@ |
||
49 | 49 | * xxx is the property name). |
50 | 50 | * |
51 | 51 | * @author Wei Zhuo <weizho[at]gmail[dot]com> |
52 | - * @package Prado\Data\ActiveRecord\Scaffold |
|
52 | + * @package Prado\Data\ActiveRecord\Scaffold |
|
53 | 53 | * @since 3.1 |
54 | 54 | */ |
55 | 55 | class TScaffoldEditView extends TScaffoldBase |
@@ -90,7 +90,7 @@ |
||
90 | 90 | * Handle the "edit" and "new" commands by displaying the edit view. |
91 | 91 | * Default command shows the list view. |
92 | 92 | */ |
93 | - public function bubbleEvent($sender,$param) |
|
93 | + public function bubbleEvent($sender, $param) |
|
94 | 94 | { |
95 | 95 | switch(strtolower($param->getCommandName())) |
96 | 96 | { |
@@ -49,7 +49,7 @@ |
||
49 | 49 | * xxx is the property name). |
50 | 50 | * |
51 | 51 | * @author Wei Zhuo <weizho[at]gmail[dot]com> |
52 | - * @package Prado\Data\ActiveRecord\Scaffold |
|
52 | + * @package Prado\Data\ActiveRecord\Scaffold |
|
53 | 53 | * @since 3.1 |
54 | 54 | */ |
55 | 55 | class TScaffoldEditView extends TScaffoldBase |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | case 'char': case 'varchar': |
30 | 30 | return $this->createMultiLineControl($container, $column, $record); |
31 | 31 | default: |
32 | - return $this->createDefaultControl($container,$column, $record); |
|
32 | + return $this->createDefaultControl($container, $column, $record); |
|
33 | 33 | } |
34 | 34 | } |
35 | 35 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | case 'timestamp': |
45 | 45 | return $this->getDateTimeValue($container, $column, $record); |
46 | 46 | default: |
47 | - return $this->getDefaultControlValue($container,$column, $record); |
|
47 | + return $this->getDefaultControlValue($container, $column, $record); |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | case 'datetime': case 'smalldatetime': |
27 | 27 | return $this->createDateTimeControl($container, $column, $record); |
28 | 28 | default: |
29 | - $control = $this->createDefaultControl($container,$column, $record); |
|
29 | + $control=$this->createDefaultControl($container, $column, $record); |
|
30 | 30 | if($column->getIsExcluded()) |
31 | 31 | $control->setEnabled(false); |
32 | 32 | return $control; |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | case 'boolean': |
41 | 41 | return $container->findControl(self::DEFAULT_ID)->getChecked(); |
42 | 42 | case 'datetime': case 'smalldatetime': |
43 | - return $this->getDateTimeValue($container,$column, $record); |
|
43 | + return $this->getDateTimeValue($container, $column, $record); |
|
44 | 44 | default: |
45 | - $value = $this->getDefaultControlValue($container,$column, $record); |
|
45 | + $value=$this->getDefaultControlValue($container, $column, $record); |
|
46 | 46 | if(trim($value)==='' && $column->getAllowNull()) |
47 | 47 | return null; |
48 | 48 | else |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | */ |
10 | 10 | class TScaffoldInputBase |
11 | 11 | { |
12 | - const DEFAULT_ID = 'scaffold_input'; |
|
12 | + const DEFAULT_ID='scaffold_input'; |
|
13 | 13 | private $_parent; |
14 | 14 | |
15 | 15 | protected function getParent() |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | public static function createInputBuilder($record) |
21 | 21 | { |
22 | 22 | $record->getDbConnection()->setActive(true); //must be connected before retrieving driver name! |
23 | - $driver = $record->getDbConnection()->getDriverName(); |
|
23 | + $driver=$record->getDbConnection()->getDriverName(); |
|
24 | 24 | switch(strtolower($driver)) |
25 | 25 | { |
26 | 26 | case 'sqlite': //sqlite 3 |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | return new TIbmScaffoldInput($conn); |
43 | 43 | default: |
44 | 44 | throw new TConfigurationException( |
45 | - 'scaffold_invalid_database_driver',$driver); |
|
45 | + 'scaffold_invalid_database_driver', $driver); |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | protected function createControlLabel($label, $column, $record) |
59 | 59 | { |
60 | - $fieldname = ucwords(str_replace('_', ' ', $column->getColumnId())).':'; |
|
60 | + $fieldname=ucwords(str_replace('_', ' ', $column->getColumnId())).':'; |
|
61 | 61 | $label->setText($fieldname); |
62 | 62 | $label->setForControl(self::DEFAULT_ID); |
63 | 63 | } |
@@ -67,20 +67,20 @@ discard block |
||
67 | 67 | $this->_parent=$parent; |
68 | 68 | if($this->getIsEnabled($column, $record)) |
69 | 69 | { |
70 | - $prop = $column->getColumnId(); |
|
70 | + $prop=$column->getColumnId(); |
|
71 | 71 | $record->setColumnValue($prop, $this->getControlValue($item->_input, $column, $record)); |
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
75 | 75 | protected function getIsEnabled($column, $record) |
76 | 76 | { |
77 | - return !($this->getParent()->getRecordPk() !== null |
|
77 | + return !($this->getParent()->getRecordPk()!==null |
|
78 | 78 | && $column->getIsPrimaryKey() || $column->hasSequence()); |
79 | 79 | } |
80 | 80 | |
81 | 81 | protected function getRecordPropertyValue($column, $record) |
82 | 82 | { |
83 | - $value = $record->getColumnValue($column->getColumnId()); |
|
83 | + $value=$record->getColumnValue($column->getColumnId()); |
|
84 | 84 | if($column->getDefaultValue()!==TDbTableColumn::UNDEFINED_VALUE && $value===null) |
85 | 85 | return $column->getDefaultValue(); |
86 | 86 | else |
@@ -52,6 +52,10 @@ discard block |
||
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
55 | + /** |
|
56 | + * @param \Prado\Data\ActiveRecord\Scaffold\TScaffoldEditView $parent |
|
57 | + * @param \Prado\Data\ActiveRecord\TActiveRecord $record |
|
58 | + */ |
|
55 | 59 | public function createScaffoldInput($parent, $item, $column, $record) |
56 | 60 | { |
57 | 61 | $this->_parent=$parent; |
@@ -68,6 +72,10 @@ discard block |
||
68 | 72 | $label->setForControl(self::DEFAULT_ID); |
69 | 73 | } |
70 | 74 | |
75 | + /** |
|
76 | + * @param \Prado\Data\ActiveRecord\Scaffold\TScaffoldEditView $parent |
|
77 | + * @param \Prado\Data\ActiveRecord\TActiveRecord $record |
|
78 | + */ |
|
71 | 79 | public function loadScaffoldInput($parent, $item, $column, $record) |
72 | 80 | { |
73 | 81 | $this->_parent=$parent; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | case 'timestamp without time zone': |
31 | 31 | return $this->createDateTimeControl($container, $column, $record); |
32 | 32 | default: |
33 | - return $this->createDefaultControl($container,$column, $record); |
|
33 | + return $this->createDefaultControl($container, $column, $record); |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 | |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | case 'time without time zone': |
46 | 46 | return $this->getTimeValue($container, $column, $record); |
47 | 47 | case 'timestamp without time zone': |
48 | - return $this->getDateTimeValue($container,$column, $record); |
|
48 | + return $this->getDateTimeValue($container, $column, $record); |
|
49 | 49 | default: |
50 | - return $this->getDefaultControlValue($container,$column, $record); |
|
50 | + return $this->getDefaultControlValue($container, $column, $record); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | { |
14 | 14 | protected function createControl($container, $column, $record) |
15 | 15 | { |
16 | - $dbtype = trim(str_replace(array('unsigned', 'zerofill'),array('','',),strtolower($column->getDbType()))); |
|
16 | + $dbtype=trim(str_replace(array('unsigned', 'zerofill'), array('', '',), strtolower($column->getDbType()))); |
|
17 | 17 | switch($dbtype) |
18 | 18 | { |
19 | 19 | case 'date': |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | protected function getControlValue($container, $column, $record) |
44 | 44 | { |
45 | - $dbtype = trim(str_replace(array('unsigned', 'zerofill'),array('','',),strtolower($column->getDbType()))); |
|
45 | + $dbtype=trim(str_replace(array('unsigned', 'zerofill'), array('', '',), strtolower($column->getDbType()))); |
|
46 | 46 | switch($dbtype) |
47 | 47 | { |
48 | 48 | case 'date': |
@@ -52,15 +52,15 @@ discard block |
||
52 | 52 | case 'time': |
53 | 53 | return $this->getTimeValue($container, $column, $record); |
54 | 54 | case 'datetime': case 'timestamp': |
55 | - return $this->getDateTimeValue($container,$column, $record); |
|
55 | + return $this->getDateTimeValue($container, $column, $record); |
|
56 | 56 | case 'tinyint': |
57 | - return $this->getIntBooleanValue($container,$column, $record); |
|
57 | + return $this->getIntBooleanValue($container, $column, $record); |
|
58 | 58 | case 'set': |
59 | 59 | return $this->getSetValue($container, $column, $record); |
60 | 60 | case 'enum': |
61 | 61 | return $this->getEnumValue($container, $column, $record); |
62 | 62 | default: |
63 | - return $this->getDefaultControlValue($container,$column, $record); |
|
63 | + return $this->getDefaultControlValue($container, $column, $record); |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
@@ -72,12 +72,12 @@ discard block |
||
72 | 72 | parent::createIntegerControl($container, $column, $record); |
73 | 73 | } |
74 | 74 | |
75 | - protected function getIntBooleanValue($container,$column, $record) |
|
75 | + protected function getIntBooleanValue($container, $column, $record) |
|
76 | 76 | { |
77 | 77 | if($column->getColumnSize()==1) |
78 | - return (int)$container->findControl(self::DEFAULT_ID)->getChecked(); |
|
78 | + return (int) $container->findControl(self::DEFAULT_ID)->getChecked(); |
|
79 | 79 | else |
80 | - return $this->getDefaultControlValue($container,$column, $record); |
|
80 | + return $this->getDefaultControlValue($container, $column, $record); |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | */ |
46 | 46 | protected function getListView() |
47 | 47 | { |
48 | - if($this->_list===null && ($id = $this->getListViewID()) !== null) |
|
48 | + if($this->_list===null && ($id=$this->getListViewID())!==null) |
|
49 | 49 | { |
50 | - $this->_list = $this->getParent()->findControl($id); |
|
51 | - if($this->_list ===null) |
|
50 | + $this->_list=$this->getParent()->findControl($id); |
|
51 | + if($this->_list===null) |
|
52 | 52 | throw new TConfigurationException('scaffold_unable_to_find_list_view', $id); |
53 | 53 | } |
54 | 54 | return $this->_list; |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | { |
79 | 79 | if(strtolower($param->getCommandName())==='search') |
80 | 80 | { |
81 | - if(($list = $this->getListView()) !== null) |
|
81 | + if(($list=$this->getListView())!==null) |
|
82 | 82 | { |
83 | 83 | $list->setSearchCondition($this->createSearchCondition()); |
84 | 84 | return false; |
@@ -93,10 +93,10 @@ discard block |
||
93 | 93 | */ |
94 | 94 | protected function createSearchCondition() |
95 | 95 | { |
96 | - $table = $this->getTableInfo(); |
|
96 | + $table=$this->getTableInfo(); |
|
97 | 97 | if(strlen($str=$this->getSearchText()->getText()) > 0) |
98 | 98 | { |
99 | - $builder = $table->createCommandBuilder($this->getRecordFinder()->getDbConnection()); |
|
99 | + $builder=$table->createCommandBuilder($this->getRecordFinder()->getDbConnection()); |
|
100 | 100 | return $builder->getSearchExpression($this->getFields(), $str); |
101 | 101 | } |
102 | 102 | } |
@@ -106,10 +106,10 @@ discard block |
||
106 | 106 | */ |
107 | 107 | protected function getFields() |
108 | 108 | { |
109 | - if(strlen(trim($str=$this->getSearchableFields()))>0) |
|
110 | - $fields = preg_split('/\s*,\s*/', $str); |
|
109 | + if(strlen(trim($str=$this->getSearchableFields())) > 0) |
|
110 | + $fields=preg_split('/\s*,\s*/', $str); |
|
111 | 111 | else |
112 | - $fields = $this->getTableInfo()->getColumns()->getKeys(); |
|
112 | + $fields=$this->getTableInfo()->getColumns()->getKeys(); |
|
113 | 113 | return $fields; |
114 | 114 | } |
115 | 115 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function getSearchableFields() |
120 | 120 | { |
121 | - return $this->getViewState('SearchableFields',''); |
|
121 | + return $this->getViewState('SearchableFields', ''); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @link https://github.com/pradosoft/prado |
7 | 7 | * @copyright Copyright © 2005-2016 The PRADO Group |
8 | 8 | * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
9 | - * @package Prado\Data\ActiveRecord\Scaffold |
|
9 | + * @package Prado\Data\ActiveRecord\Scaffold |
|
10 | 10 | */ |
11 | 11 | |
12 | 12 | namespace Prado\Data\ActiveRecord\Scaffold; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * file explicitly. |
33 | 33 | * |
34 | 34 | * @author Wei Zhuo <weizho[at]gmail[dot]com> |
35 | - * @package Prado\Data\ActiveRecord\Scaffold |
|
35 | + * @package Prado\Data\ActiveRecord\Scaffold |
|
36 | 36 | * @since 3.1 |
37 | 37 | */ |
38 | 38 | abstract class TScaffoldBase extends TTemplateControl |
@@ -24,7 +24,7 @@ |
||
24 | 24 | protected function getErrorMessageFile() |
25 | 25 | { |
26 | 26 | $lang=Prado::getPreferredLanguage(); |
27 | - $path = dirname(__FILE__); |
|
27 | + $path=dirname(__FILE__); |
|
28 | 28 | $msgFile=$path.'/messages-'.$lang.'.txt'; |
29 | 29 | if(!is_file($msgFile)) |
30 | 30 | $msgFile=$path.'/messages.txt'; |