@@ -65,12 +65,12 @@ discard block |
||
65 | 65 | $table = $this->getTableInfo(); |
66 | 66 | $sorts = ['Sort By', str_repeat('-', 15)]; |
67 | 67 | $headers = []; |
68 | - foreach($table->getColumns() as $name => $colum) |
|
68 | + foreach ($table->getColumns() as $name => $colum) |
|
69 | 69 | { |
70 | 70 | $fname = ucwords(str_replace('_', ' ', $name)); |
71 | - $sorts[$name . ' ASC'] = $fname . ' Ascending'; |
|
72 | - $sorts[$name . ' DESC'] = $fname . ' Descending'; |
|
73 | - $headers[] = $fname ; |
|
71 | + $sorts[$name.' ASC'] = $fname.' Ascending'; |
|
72 | + $sorts[$name.' DESC'] = $fname.' Descending'; |
|
73 | + $headers[] = $fname; |
|
74 | 74 | } |
75 | 75 | $this->_sort->setDataSource($sorts); |
76 | 76 | $this->_sort->dataBind(); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | public function onPreRender($param) |
85 | 85 | { |
86 | 86 | parent::onPreRender($param); |
87 | - if(!$this->getPage()->getIsPostBack() || $this->getViewState('CurrentClass') != $this->getRecordClass()) |
|
87 | + if (!$this->getPage()->getIsPostBack() || $this->getViewState('CurrentClass') != $this->getRecordClass()) |
|
88 | 88 | { |
89 | 89 | $this->initializeSort(); |
90 | 90 | $this->setViewState('CurrentClass', $this->getRecordClass()); |
@@ -113,17 +113,17 @@ discard block |
||
113 | 113 | $total = $this->_list->getVirtualItemCount(); |
114 | 114 | $limit = $this->_list->getPageSize(); |
115 | 115 | $offset = $this->_list->getCurrentPageIndex() * $limit; |
116 | - if($offset + $limit > $total) |
|
116 | + if ($offset + $limit > $total) |
|
117 | 117 | $limit = $total - $offset; |
118 | 118 | $criteria = new TActiveRecordCriteria($this->getSearchCondition(), $this->getSearchParameters()); |
119 | - if($limit > 0) |
|
119 | + if ($limit > 0) |
|
120 | 120 | { |
121 | 121 | $criteria->setLimit($limit); |
122 | - if($offset <= $total) |
|
122 | + if ($offset <= $total) |
|
123 | 123 | $criteria->setOffset($offset); |
124 | 124 | } |
125 | 125 | $order = explode(' ', $this->_sort->getSelectedValue(), 2); |
126 | - if(is_array($order) && count($order) === 2) |
|
126 | + if (is_array($order) && count($order) === 2) |
|
127 | 127 | $criteria->OrdersBy[$order[0]] = $order[1]; |
128 | 128 | return $criteria; |
129 | 129 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | */ |
166 | 166 | public function bubbleEvent($sender, $param) |
167 | 167 | { |
168 | - switch(strtolower($param->getCommandName())) |
|
168 | + switch (strtolower($param->getCommandName())) |
|
169 | 169 | { |
170 | 170 | case 'delete': |
171 | 171 | return $this->deleteRecord($sender, $param); |
@@ -181,9 +181,9 @@ discard block |
||
181 | 181 | */ |
182 | 182 | protected function initializeEdit($sender, $param) |
183 | 183 | { |
184 | - if(($ctrl = $this->getEditViewControl()) !== null) |
|
184 | + if (($ctrl = $this->getEditViewControl()) !== null) |
|
185 | 185 | { |
186 | - if($param instanceof TRepeaterCommandEventParameter) |
|
186 | + if ($param instanceof TRepeaterCommandEventParameter) |
|
187 | 187 | { |
188 | 188 | $pk = $param->getItem()->getCustomData(); |
189 | 189 | $ctrl->setRecordPk($pk); |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | */ |
198 | 198 | protected function deleteRecord($sender, $param) |
199 | 199 | { |
200 | - if($param instanceof TRepeaterCommandEventParameter) |
|
200 | + if ($param instanceof TRepeaterCommandEventParameter) |
|
201 | 201 | { |
202 | 202 | $pk = $param->getItem()->getCustomData(); |
203 | 203 | $this->getRecordFinder()->deleteByPk($pk); |
@@ -210,10 +210,10 @@ discard block |
||
210 | 210 | protected function listItemCreated($sender, $param) |
211 | 211 | { |
212 | 212 | $item = $param->getItem(); |
213 | - if($item instanceof IItemDataRenderer) |
|
213 | + if ($item instanceof IItemDataRenderer) |
|
214 | 214 | { |
215 | 215 | $type = $item->getItemType(); |
216 | - if($type == TListItemType::Item || $type == TListItemType::AlternatingItem) |
|
216 | + if ($type == TListItemType::Item || $type == TListItemType::AlternatingItem) |
|
217 | 217 | $this->populateField($sender, $param); |
218 | 218 | } |
219 | 219 | } |
@@ -225,10 +225,10 @@ discard block |
||
225 | 225 | protected function populateField($sender, $param) |
226 | 226 | { |
227 | 227 | $item = $param->getItem(); |
228 | - if(($data = $item->getData()) !== null) |
|
228 | + if (($data = $item->getData()) !== null) |
|
229 | 229 | { |
230 | 230 | $item->setCustomData($this->getRecordPkValues($data)); |
231 | - if(($prop = $item->findControl('_properties')) !== null) |
|
231 | + if (($prop = $item->findControl('_properties')) !== null) |
|
232 | 232 | { |
233 | 233 | $item->_properties->setDataSource($this->getRecordPropertyValues($data)); |
234 | 234 | $item->_properties->dataBind(); |
@@ -301,10 +301,10 @@ discard block |
||
301 | 301 | */ |
302 | 302 | protected function getEditViewControl() |
303 | 303 | { |
304 | - if(($id = $this->getEditViewID()) !== null) |
|
304 | + if (($id = $this->getEditViewID()) !== null) |
|
305 | 305 | { |
306 | 306 | $ctrl = $this->getParent()->findControl($id); |
307 | - if($ctrl === null) |
|
307 | + if ($ctrl === null) |
|
308 | 308 | throw new TConfigurationException('scaffold_unable_to_find_edit_view', $id); |
309 | 309 | return $ctrl; |
310 | 310 | } |
@@ -113,18 +113,21 @@ discard block |
||
113 | 113 | $total = $this->_list->getVirtualItemCount(); |
114 | 114 | $limit = $this->_list->getPageSize(); |
115 | 115 | $offset = $this->_list->getCurrentPageIndex() * $limit; |
116 | - if($offset + $limit > $total) |
|
117 | - $limit = $total - $offset; |
|
116 | + if($offset + $limit > $total) { |
|
117 | + $limit = $total - $offset; |
|
118 | + } |
|
118 | 119 | $criteria = new TActiveRecordCriteria($this->getSearchCondition(), $this->getSearchParameters()); |
119 | 120 | if($limit > 0) |
120 | 121 | { |
121 | 122 | $criteria->setLimit($limit); |
122 | - if($offset <= $total) |
|
123 | - $criteria->setOffset($offset); |
|
123 | + if($offset <= $total) { |
|
124 | + $criteria->setOffset($offset); |
|
125 | + } |
|
124 | 126 | } |
125 | 127 | $order = explode(' ', $this->_sort->getSelectedValue(), 2); |
126 | - if(is_array($order) && count($order) === 2) |
|
127 | - $criteria->OrdersBy[$order[0]] = $order[1]; |
|
128 | + if(is_array($order) && count($order) === 2) { |
|
129 | + $criteria->OrdersBy[$order[0]] = $order[1]; |
|
130 | + } |
|
128 | 131 | return $criteria; |
129 | 132 | } |
130 | 133 | |
@@ -213,8 +216,9 @@ discard block |
||
213 | 216 | if($item instanceof IItemDataRenderer) |
214 | 217 | { |
215 | 218 | $type = $item->getItemType(); |
216 | - if($type == TListItemType::Item || $type == TListItemType::AlternatingItem) |
|
217 | - $this->populateField($sender, $param); |
|
219 | + if($type == TListItemType::Item || $type == TListItemType::AlternatingItem) { |
|
220 | + $this->populateField($sender, $param); |
|
221 | + } |
|
218 | 222 | } |
219 | 223 | } |
220 | 224 | |
@@ -304,8 +308,9 @@ discard block |
||
304 | 308 | if(($id = $this->getEditViewID()) !== null) |
305 | 309 | { |
306 | 310 | $ctrl = $this->getParent()->findControl($id); |
307 | - if($ctrl === null) |
|
308 | - throw new TConfigurationException('scaffold_unable_to_find_edit_view', $id); |
|
311 | + if($ctrl === null) { |
|
312 | + throw new TConfigurationException('scaffold_unable_to_find_edit_view', $id); |
|
313 | + } |
|
309 | 314 | return $ctrl; |
310 | 315 | } |
311 | 316 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | protected function getRecordPropertyValues($record) |
60 | 60 | { |
61 | 61 | $data = []; |
62 | - foreach($this->getTableInfo()->getColumns() as $name => $column) |
|
62 | + foreach ($this->getTableInfo()->getColumns() as $name => $column) |
|
63 | 63 | $data[] = $record->getColumnValue($name); |
64 | 64 | return $data; |
65 | 65 | } |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | protected function getRecordPkValues($record) |
72 | 72 | { |
73 | 73 | $data = []; |
74 | - foreach($this->getTableInfo()->getColumns() as $name => $column) |
|
74 | + foreach ($this->getTableInfo()->getColumns() as $name => $column) |
|
75 | 75 | { |
76 | - if($column->getIsPrimaryKey()) |
|
76 | + if ($column->getIsPrimaryKey()) |
|
77 | 77 | $data[] = $record->getColumnValue($name); |
78 | 78 | } |
79 | 79 | return $data; |
@@ -124,19 +124,19 @@ discard block |
||
124 | 124 | */ |
125 | 125 | protected function getRecordObject($pk = null) |
126 | 126 | { |
127 | - if($this->_record === null) |
|
127 | + if ($this->_record === null) |
|
128 | 128 | { |
129 | - if($pk !== null) |
|
129 | + if ($pk !== null) |
|
130 | 130 | { |
131 | 131 | $this->_record = $this->getRecordFinder()->findByPk($pk); |
132 | - if($this->_record === null) |
|
132 | + if ($this->_record === null) |
|
133 | 133 | throw new TConfigurationException('scaffold_invalid_record_pk', |
134 | 134 | $this->getRecordClass(), $pk); |
135 | 135 | } |
136 | 136 | else |
137 | 137 | { |
138 | 138 | $class = $this->getRecordClass(); |
139 | - if($class !== null) |
|
139 | + if ($class !== null) |
|
140 | 140 | $this->_record = Prado::createComponent($class); |
141 | 141 | else |
142 | 142 | { |
@@ -202,9 +202,9 @@ discard block |
||
202 | 202 | public function onPreRender($param) |
203 | 203 | { |
204 | 204 | parent::onPreRender($param); |
205 | - if($this->getEnableDefaultStyle()) |
|
205 | + if ($this->getEnableDefaultStyle()) |
|
206 | 206 | { |
207 | - $url = $this->publishAsset($this->getDefaultStyle() . '.css'); |
|
207 | + $url = $this->publishAsset($this->getDefaultStyle().'.css'); |
|
208 | 208 | $this->getPage()->getClientScript()->registerStyleSheetFile($url, $url); |
209 | 209 | } |
210 | 210 | } |
@@ -59,8 +59,9 @@ discard block |
||
59 | 59 | protected function getRecordPropertyValues($record) |
60 | 60 | { |
61 | 61 | $data = []; |
62 | - foreach($this->getTableInfo()->getColumns() as $name => $column) |
|
63 | - $data[] = $record->getColumnValue($name); |
|
62 | + foreach($this->getTableInfo()->getColumns() as $name => $column) { |
|
63 | + $data[] = $record->getColumnValue($name); |
|
64 | + } |
|
64 | 65 | return $data; |
65 | 66 | } |
66 | 67 | |
@@ -73,8 +74,9 @@ discard block |
||
73 | 74 | $data = []; |
74 | 75 | foreach($this->getTableInfo()->getColumns() as $name => $column) |
75 | 76 | { |
76 | - if($column->getIsPrimaryKey()) |
|
77 | - $data[] = $record->getColumnValue($name); |
|
77 | + if($column->getIsPrimaryKey()) { |
|
78 | + $data[] = $record->getColumnValue($name); |
|
79 | + } |
|
78 | 80 | } |
79 | 81 | return $data; |
80 | 82 | } |
@@ -129,16 +131,16 @@ discard block |
||
129 | 131 | if($pk !== null) |
130 | 132 | { |
131 | 133 | $this->_record = $this->getRecordFinder()->findByPk($pk); |
132 | - if($this->_record === null) |
|
133 | - throw new TConfigurationException('scaffold_invalid_record_pk', |
|
134 | + if($this->_record === null) { |
|
135 | + throw new TConfigurationException('scaffold_invalid_record_pk', |
|
134 | 136 | $this->getRecordClass(), $pk); |
135 | - } |
|
136 | - else |
|
137 | + } |
|
138 | + } else |
|
137 | 139 | { |
138 | 140 | $class = $this->getRecordClass(); |
139 | - if($class !== null) |
|
140 | - $this->_record = Prado::createComponent($class); |
|
141 | - else |
|
141 | + if($class !== null) { |
|
142 | + $this->_record = Prado::createComponent($class); |
|
143 | + } else |
|
142 | 144 | { |
143 | 145 | throw new TConfigurationException('scaffold_invalid_record_class', |
144 | 146 | $this->getRecordClass(), $this->getID()); |
@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | { |
18 | 18 | protected function createControl($container, $column, $record) |
19 | 19 | { |
20 | - $dbtype = trim(str_replace(['unsigned', 'zerofill'], ['','',], strtolower($column->getDbType()))); |
|
21 | - switch($dbtype) |
|
20 | + $dbtype = trim(str_replace(['unsigned', 'zerofill'], ['', '', ], strtolower($column->getDbType()))); |
|
21 | + switch ($dbtype) |
|
22 | 22 | { |
23 | 23 | case 'date': |
24 | 24 | return $this->createDateControl($container, $column, $record); |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | |
47 | 47 | protected function getControlValue($container, $column, $record) |
48 | 48 | { |
49 | - $dbtype = trim(str_replace(['unsigned', 'zerofill'], ['','',], strtolower($column->getDbType()))); |
|
50 | - switch($dbtype) |
|
49 | + $dbtype = trim(str_replace(['unsigned', 'zerofill'], ['', '', ], strtolower($column->getDbType()))); |
|
50 | + switch ($dbtype) |
|
51 | 51 | { |
52 | 52 | case 'date': |
53 | 53 | return $container->findControl(self::DEFAULT_ID)->getDate(); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | protected function createIntegerControl($container, $column, $record) |
72 | 72 | { |
73 | - if($column->getColumnSize() == 1) |
|
73 | + if ($column->getColumnSize() == 1) |
|
74 | 74 | return $this->createBooleanControl($container, $column, $record); |
75 | 75 | else |
76 | 76 | parent::createIntegerControl($container, $column, $record); |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | |
79 | 79 | protected function getIntBooleanValue($container, $column, $record) |
80 | 80 | { |
81 | - if($column->getColumnSize() == 1) |
|
82 | - return (int)$container->findControl(self::DEFAULT_ID)->getChecked(); |
|
81 | + if ($column->getColumnSize() == 1) |
|
82 | + return (int) $container->findControl(self::DEFAULT_ID)->getChecked(); |
|
83 | 83 | else |
84 | 84 | return $this->getDefaultControlValue($container, $column, $record); |
85 | 85 | } |
@@ -70,18 +70,20 @@ |
||
70 | 70 | |
71 | 71 | protected function createIntegerControl($container, $column, $record) |
72 | 72 | { |
73 | - if($column->getColumnSize() == 1) |
|
74 | - return $this->createBooleanControl($container, $column, $record); |
|
75 | - else |
|
76 | - parent::createIntegerControl($container, $column, $record); |
|
73 | + if($column->getColumnSize() == 1) { |
|
74 | + return $this->createBooleanControl($container, $column, $record); |
|
75 | + } else { |
|
76 | + parent::createIntegerControl($container, $column, $record); |
|
77 | + } |
|
77 | 78 | } |
78 | 79 | |
79 | 80 | protected function getIntBooleanValue($container, $column, $record) |
80 | 81 | { |
81 | - if($column->getColumnSize() == 1) |
|
82 | - return (int)$container->findControl(self::DEFAULT_ID)->getChecked(); |
|
83 | - else |
|
84 | - return $this->getDefaultControlValue($container, $column, $record); |
|
82 | + if($column->getColumnSize() == 1) { |
|
83 | + return (int)$container->findControl(self::DEFAULT_ID)->getChecked(); |
|
84 | + } else { |
|
85 | + return $this->getDefaultControlValue($container, $column, $record); |
|
86 | + } |
|
85 | 87 | } |
86 | 88 | } |
87 | 89 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | protected function setNotNullProperty($container, $control, $column, $record) |
41 | 41 | { |
42 | 42 | $this->setDefaultProperty($container, $control, $column, $record); |
43 | - if(!$column->getAllowNull() && !$column->hasSequence()) |
|
43 | + if (!$column->getAllowNull() && !$column->hasSequence()) |
|
44 | 44 | $this->createRequiredValidator($container, $column, $record); |
45 | 45 | } |
46 | 46 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $control = new TTextBox(); |
61 | 61 | $control->setText($value); |
62 | 62 | $control->setCssClass('default-textbox scaffold_input'); |
63 | - if(($len = $column->getColumnSize()) !== null) |
|
63 | + if (($len = $column->getColumnSize()) !== null) |
|
64 | 64 | $control->setMaxLength($len); |
65 | 65 | $this->setNotNullProperty($container, $control, $column, $record); |
66 | 66 | return $control; |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | protected function getDefaultControlValue($container, $column, $record) |
70 | 70 | { |
71 | 71 | $control = $container->findControl(self::DEFAULT_ID); |
72 | - if($control instanceof TCheckBox) |
|
72 | + if ($control instanceof TCheckBox) |
|
73 | 73 | return $control->getChecked(); |
74 | - elseif($control instanceof TControl) |
|
74 | + elseif ($control instanceof TControl) |
|
75 | 75 | return $control->getText(); |
76 | 76 | } |
77 | 77 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $years = []; |
94 | 94 | $current = intval(@date('Y')); |
95 | 95 | $from = $current - 10; $to = $current + 10; |
96 | - for($i = $from; $i <= $to; $i++) |
|
96 | + for ($i = $from; $i <= $to; $i++) |
|
97 | 97 | $years[$i] = $i; |
98 | 98 | $control->setDataSource($years); |
99 | 99 | $control->setSelectedValue(empty($value) ? $current : $value); |
@@ -117,13 +117,13 @@ discard block |
||
117 | 117 | $val = $this->createTypeValidator($container, $column, $record); |
118 | 118 | $val->setDataType(TValidationDataType::Float); |
119 | 119 | $val->setErrorMessage('Please entery a decimal number.'); |
120 | - if(($max = $column->getMaxiumNumericConstraint()) !== null) |
|
120 | + if (($max = $column->getMaxiumNumericConstraint()) !== null) |
|
121 | 121 | { |
122 | 122 | $val = $this->createRangeValidator($container, $column, $record); |
123 | 123 | $val->setDataType(TValidationDataType::Float); |
124 | 124 | $val->setMaxValue($max); |
125 | 125 | $val->setStrictComparison(true); |
126 | - $val->setErrorMessage('Please entery a decimal number strictly less than ' . $max . '.'); |
|
126 | + $val->setErrorMessage('Please entery a decimal number strictly less than '.$max.'.'); |
|
127 | 127 | } |
128 | 128 | return $control; |
129 | 129 | } |
@@ -169,20 +169,20 @@ discard block |
||
169 | 169 | { |
170 | 170 | $value = $this->getRecordPropertyValue($column, $record); |
171 | 171 | $hours = []; |
172 | - for($i = 0;$i < 24;$i++) $hours[] = str_pad($i, 2, '0', STR_PAD_LEFT); |
|
172 | + for ($i = 0; $i < 24; $i++) $hours[] = str_pad($i, 2, '0', STR_PAD_LEFT); |
|
173 | 173 | $mins = []; |
174 | - for($i = 0;$i < 60;$i++) $mins[] = str_pad($i, 2, '0', STR_PAD_LEFT); |
|
174 | + for ($i = 0; $i < 60; $i++) $mins[] = str_pad($i, 2, '0', STR_PAD_LEFT); |
|
175 | 175 | $hour = intval(@date('H')); |
176 | 176 | $min = intval(@date('i')); |
177 | 177 | $sec = intval(@date('s')); |
178 | - if(!empty($value)) |
|
178 | + if (!empty($value)) |
|
179 | 179 | { |
180 | 180 | $match = []; |
181 | - if(preg_match('/(\d+):(\d+):?(\d+)?/', $value, $match)) |
|
181 | + if (preg_match('/(\d+):(\d+):?(\d+)?/', $value, $match)) |
|
182 | 182 | { |
183 | 183 | $hour = $match[1]; |
184 | 184 | $min = $match[2]; |
185 | - if(isset($match[3])) |
|
185 | + if (isset($match[3])) |
|
186 | 186 | $sec = $match[3]; |
187 | 187 | } |
188 | 188 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | $scontrol->setSelectedValue(intval($sec)); |
211 | 211 | $container->Controls[] = $scontrol; |
212 | 212 | |
213 | - return [$hcontrol,$mcontrol,$scontrol]; |
|
213 | + return [$hcontrol, $mcontrol, $scontrol]; |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | $control->setFromYear(1900); |
222 | 222 | $control->setInputMode(TDatePickerInputMode::DropDownList); |
223 | 223 | $control->setDateFormat('yyyy-MM-dd'); |
224 | - if(!empty($value)) |
|
224 | + if (!empty($value)) |
|
225 | 225 | $control->setDate(substr($value, 0, 10)); |
226 | 226 | $control->setCssClass('date-dropdown'); |
227 | 227 | $this->setNotNullProperty($container, $control, $column, $record); |
@@ -234,14 +234,14 @@ discard block |
||
234 | 234 | $control = $this->createDateControl($container, $column, $record); |
235 | 235 | $container->Controls[] = ' @ '; |
236 | 236 | $time = $this->createTimeControl($container, $column, $record); |
237 | - if(!empty($value)) |
|
237 | + if (!empty($value)) |
|
238 | 238 | { |
239 | 239 | $match = []; |
240 | - if(preg_match('/(\d+):(\d+):?(\d+)?/', substr($value, 11), $match)) |
|
240 | + if (preg_match('/(\d+):(\d+):?(\d+)?/', substr($value, 11), $match)) |
|
241 | 241 | { |
242 | 242 | $time[0]->setSelectedValue(intval($match[1])); |
243 | 243 | $time[1]->setSelectedValue(intval($match[2])); |
244 | - if(isset($match[3])) |
|
244 | + if (isset($match[3])) |
|
245 | 245 | $time[2]->setSelectedValue(intval($match[3])); |
246 | 246 | } |
247 | 247 | } |
@@ -284,9 +284,9 @@ discard block |
||
284 | 284 | protected function getMatchingIndices($checks, $values) |
285 | 285 | { |
286 | 286 | $index = []; |
287 | - for($i = 0, $k = count($checks); $i < $k; $i++) |
|
287 | + for ($i = 0, $k = count($checks); $i < $k; $i++) |
|
288 | 288 | { |
289 | - if(in_array($checks[$i], $values)) |
|
289 | + if (in_array($checks[$i], $values)) |
|
290 | 290 | $index[] = $i; |
291 | 291 | } |
292 | 292 | return $index; |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | $control->setDataSource($values); |
302 | 302 | $control->dataBind(); |
303 | 303 | $index = $this->getMatchingIndices($values, $selectedValues); |
304 | - if(count($index) > 0) |
|
304 | + if (count($index) > 0) |
|
305 | 305 | $control->setSelectedIndex($index[0]); |
306 | 306 | $control->setID(self::DEFAULT_ID); |
307 | 307 | $control->setCssClass('enum-radio-buttons'); |
@@ -312,9 +312,9 @@ discard block |
||
312 | 312 | protected function getSetValue($container, $column, $record) |
313 | 313 | { |
314 | 314 | $value = []; |
315 | - foreach($container->findControl(self::DEFAULT_ID)->getItems() as $item) |
|
315 | + foreach ($container->findControl(self::DEFAULT_ID)->getItems() as $item) |
|
316 | 316 | { |
317 | - if($item->getSelected()) |
|
317 | + if ($item->getSelected()) |
|
318 | 318 | $value[] = $item->getText(); |
319 | 319 | } |
320 | 320 | return implode(',', $value); |
@@ -40,8 +40,9 @@ discard block |
||
40 | 40 | protected function setNotNullProperty($container, $control, $column, $record) |
41 | 41 | { |
42 | 42 | $this->setDefaultProperty($container, $control, $column, $record); |
43 | - if(!$column->getAllowNull() && !$column->hasSequence()) |
|
44 | - $this->createRequiredValidator($container, $column, $record); |
|
43 | + if(!$column->getAllowNull() && !$column->hasSequence()) { |
|
44 | + $this->createRequiredValidator($container, $column, $record); |
|
45 | + } |
|
45 | 46 | } |
46 | 47 | |
47 | 48 | protected function createBooleanControl($container, $column, $record) |
@@ -60,8 +61,9 @@ discard block |
||
60 | 61 | $control = new TTextBox(); |
61 | 62 | $control->setText($value); |
62 | 63 | $control->setCssClass('default-textbox scaffold_input'); |
63 | - if(($len = $column->getColumnSize()) !== null) |
|
64 | - $control->setMaxLength($len); |
|
64 | + if(($len = $column->getColumnSize()) !== null) { |
|
65 | + $control->setMaxLength($len); |
|
66 | + } |
|
65 | 67 | $this->setNotNullProperty($container, $control, $column, $record); |
66 | 68 | return $control; |
67 | 69 | } |
@@ -69,10 +71,11 @@ discard block |
||
69 | 71 | protected function getDefaultControlValue($container, $column, $record) |
70 | 72 | { |
71 | 73 | $control = $container->findControl(self::DEFAULT_ID); |
72 | - if($control instanceof TCheckBox) |
|
73 | - return $control->getChecked(); |
|
74 | - elseif($control instanceof TControl) |
|
75 | - return $control->getText(); |
|
74 | + if($control instanceof TCheckBox) { |
|
75 | + return $control->getChecked(); |
|
76 | + } elseif($control instanceof TControl) { |
|
77 | + return $control->getText(); |
|
78 | + } |
|
76 | 79 | } |
77 | 80 | |
78 | 81 | protected function createMultiLineControl($container, $column, $record) |
@@ -93,8 +96,9 @@ discard block |
||
93 | 96 | $years = []; |
94 | 97 | $current = intval(@date('Y')); |
95 | 98 | $from = $current - 10; $to = $current + 10; |
96 | - for($i = $from; $i <= $to; $i++) |
|
97 | - $years[$i] = $i; |
|
99 | + for($i = $from; $i <= $to; $i++) { |
|
100 | + $years[$i] = $i; |
|
101 | + } |
|
98 | 102 | $control->setDataSource($years); |
99 | 103 | $control->setSelectedValue(empty($value) ? $current : $value); |
100 | 104 | $control->setCssClass('year-dropdown'); |
@@ -169,9 +173,13 @@ discard block |
||
169 | 173 | { |
170 | 174 | $value = $this->getRecordPropertyValue($column, $record); |
171 | 175 | $hours = []; |
172 | - for($i = 0;$i < 24;$i++) $hours[] = str_pad($i, 2, '0', STR_PAD_LEFT); |
|
176 | + for($i = 0;$i < 24;$i++) { |
|
177 | + $hours[] = str_pad($i, 2, '0', STR_PAD_LEFT); |
|
178 | + } |
|
173 | 179 | $mins = []; |
174 | - for($i = 0;$i < 60;$i++) $mins[] = str_pad($i, 2, '0', STR_PAD_LEFT); |
|
180 | + for($i = 0;$i < 60;$i++) { |
|
181 | + $mins[] = str_pad($i, 2, '0', STR_PAD_LEFT); |
|
182 | + } |
|
175 | 183 | $hour = intval(@date('H')); |
176 | 184 | $min = intval(@date('i')); |
177 | 185 | $sec = intval(@date('s')); |
@@ -182,8 +190,9 @@ discard block |
||
182 | 190 | { |
183 | 191 | $hour = $match[1]; |
184 | 192 | $min = $match[2]; |
185 | - if(isset($match[3])) |
|
186 | - $sec = $match[3]; |
|
193 | + if(isset($match[3])) { |
|
194 | + $sec = $match[3]; |
|
195 | + } |
|
187 | 196 | } |
188 | 197 | } |
189 | 198 | |
@@ -221,8 +230,9 @@ discard block |
||
221 | 230 | $control->setFromYear(1900); |
222 | 231 | $control->setInputMode(TDatePickerInputMode::DropDownList); |
223 | 232 | $control->setDateFormat('yyyy-MM-dd'); |
224 | - if(!empty($value)) |
|
225 | - $control->setDate(substr($value, 0, 10)); |
|
233 | + if(!empty($value)) { |
|
234 | + $control->setDate(substr($value, 0, 10)); |
|
235 | + } |
|
226 | 236 | $control->setCssClass('date-dropdown'); |
227 | 237 | $this->setNotNullProperty($container, $control, $column, $record); |
228 | 238 | return $control; |
@@ -241,8 +251,9 @@ discard block |
||
241 | 251 | { |
242 | 252 | $time[0]->setSelectedValue(intval($match[1])); |
243 | 253 | $time[1]->setSelectedValue(intval($match[2])); |
244 | - if(isset($match[3])) |
|
245 | - $time[2]->setSelectedValue(intval($match[3])); |
|
254 | + if(isset($match[3])) { |
|
255 | + $time[2]->setSelectedValue(intval($match[3])); |
|
256 | + } |
|
246 | 257 | } |
247 | 258 | } |
248 | 259 | $time[0]->setID('scaffold_time_hour'); |
@@ -286,8 +297,9 @@ discard block |
||
286 | 297 | $index = []; |
287 | 298 | for($i = 0, $k = count($checks); $i < $k; $i++) |
288 | 299 | { |
289 | - if(in_array($checks[$i], $values)) |
|
290 | - $index[] = $i; |
|
300 | + if(in_array($checks[$i], $values)) { |
|
301 | + $index[] = $i; |
|
302 | + } |
|
291 | 303 | } |
292 | 304 | return $index; |
293 | 305 | } |
@@ -301,8 +313,9 @@ discard block |
||
301 | 313 | $control->setDataSource($values); |
302 | 314 | $control->dataBind(); |
303 | 315 | $index = $this->getMatchingIndices($values, $selectedValues); |
304 | - if(count($index) > 0) |
|
305 | - $control->setSelectedIndex($index[0]); |
|
316 | + if(count($index) > 0) { |
|
317 | + $control->setSelectedIndex($index[0]); |
|
318 | + } |
|
306 | 319 | $control->setID(self::DEFAULT_ID); |
307 | 320 | $control->setCssClass('enum-radio-buttons'); |
308 | 321 | $this->setNotNullProperty($container, $control, $column, $record); |
@@ -314,8 +327,9 @@ discard block |
||
314 | 327 | $value = []; |
315 | 328 | foreach($container->findControl(self::DEFAULT_ID)->getItems() as $item) |
316 | 329 | { |
317 | - if($item->getSelected()) |
|
318 | - $value[] = $item->getText(); |
|
330 | + if($item->getSelected()) { |
|
331 | + $value[] = $item->getText(); |
|
332 | + } |
|
319 | 333 | } |
320 | 334 | return implode(',', $value); |
321 | 335 | } |
@@ -27,24 +27,24 @@ discard block |
||
27 | 27 | { |
28 | 28 | $record->getDbConnection()->setActive(true); //must be connected before retrieving driver name! |
29 | 29 | $driver = $record->getDbConnection()->getDriverName(); |
30 | - switch(strtolower($driver)) |
|
30 | + switch (strtolower($driver)) |
|
31 | 31 | { |
32 | 32 | case 'sqlite': //sqlite 3 |
33 | 33 | case 'sqlite2': //sqlite 2 |
34 | - require_once(dirname(__FILE__) . '/TSqliteScaffoldInput.php'); |
|
34 | + require_once(dirname(__FILE__).'/TSqliteScaffoldInput.php'); |
|
35 | 35 | return new TSqliteScaffoldInput($conn); |
36 | 36 | case 'mysqli': |
37 | 37 | case 'mysql': |
38 | - require_once(dirname(__FILE__) . '/TMysqlScaffoldInput.php'); |
|
38 | + require_once(dirname(__FILE__).'/TMysqlScaffoldInput.php'); |
|
39 | 39 | return new TMysqlScaffoldInput($conn); |
40 | 40 | case 'pgsql': |
41 | - require_once(dirname(__FILE__) . '/TPgsqlScaffoldInput.php'); |
|
41 | + require_once(dirname(__FILE__).'/TPgsqlScaffoldInput.php'); |
|
42 | 42 | return new TPgsqlScaffoldInput($conn); |
43 | 43 | case 'mssql': |
44 | - require_once(dirname(__FILE__) . '/TMssqlScaffoldInput.php'); |
|
44 | + require_once(dirname(__FILE__).'/TMssqlScaffoldInput.php'); |
|
45 | 45 | return new TMssqlScaffoldInput($conn); |
46 | 46 | case 'ibm': |
47 | - require_once(dirname(__FILE__) . '/TIbmScaffoldInput.php'); |
|
47 | + require_once(dirname(__FILE__).'/TIbmScaffoldInput.php'); |
|
48 | 48 | return new TIbmScaffoldInput($conn); |
49 | 49 | default: |
50 | 50 | throw new TConfigurationException( |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | $this->_parent = $parent; |
58 | 58 | $item->setCustomData($column->getColumnId()); |
59 | 59 | $this->createControl($item->_input, $column, $record); |
60 | - if($item->_input->findControl(self::DEFAULT_ID)) |
|
60 | + if ($item->_input->findControl(self::DEFAULT_ID)) |
|
61 | 61 | $this->createControlLabel($item->_label, $column, $record); |
62 | 62 | } |
63 | 63 | |
64 | 64 | protected function createControlLabel($label, $column, $record) |
65 | 65 | { |
66 | - $fieldname = ucwords(str_replace('_', ' ', $column->getColumnId())) . ':'; |
|
66 | + $fieldname = ucwords(str_replace('_', ' ', $column->getColumnId())).':'; |
|
67 | 67 | $label->setText($fieldname); |
68 | 68 | $label->setForControl(self::DEFAULT_ID); |
69 | 69 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | public function loadScaffoldInput($parent, $item, $column, $record) |
72 | 72 | { |
73 | 73 | $this->_parent = $parent; |
74 | - if($this->getIsEnabled($column, $record)) |
|
74 | + if ($this->getIsEnabled($column, $record)) |
|
75 | 75 | { |
76 | 76 | $prop = $column->getColumnId(); |
77 | 77 | $record->setColumnValue($prop, $this->getControlValue($item->_input, $column, $record)); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | protected function getRecordPropertyValue($column, $record) |
88 | 88 | { |
89 | 89 | $value = $record->getColumnValue($column->getColumnId()); |
90 | - if($column->getDefaultValue() !== TDbTableColumn::UNDEFINED_VALUE && $value === null) |
|
90 | + if ($column->getDefaultValue() !== TDbTableColumn::UNDEFINED_VALUE && $value === null) |
|
91 | 91 | return $column->getDefaultValue(); |
92 | 92 | else |
93 | 93 | return $value; |
@@ -57,8 +57,9 @@ discard block |
||
57 | 57 | $this->_parent = $parent; |
58 | 58 | $item->setCustomData($column->getColumnId()); |
59 | 59 | $this->createControl($item->_input, $column, $record); |
60 | - if($item->_input->findControl(self::DEFAULT_ID)) |
|
61 | - $this->createControlLabel($item->_label, $column, $record); |
|
60 | + if($item->_input->findControl(self::DEFAULT_ID)) { |
|
61 | + $this->createControlLabel($item->_label, $column, $record); |
|
62 | + } |
|
62 | 63 | } |
63 | 64 | |
64 | 65 | protected function createControlLabel($label, $column, $record) |
@@ -87,10 +88,11 @@ discard block |
||
87 | 88 | protected function getRecordPropertyValue($column, $record) |
88 | 89 | { |
89 | 90 | $value = $record->getColumnValue($column->getColumnId()); |
90 | - if($column->getDefaultValue() !== TDbTableColumn::UNDEFINED_VALUE && $value === null) |
|
91 | - return $column->getDefaultValue(); |
|
92 | - else |
|
93 | - return $value; |
|
91 | + if($column->getDefaultValue() !== TDbTableColumn::UNDEFINED_VALUE && $value === null) { |
|
92 | + return $column->getDefaultValue(); |
|
93 | + } else { |
|
94 | + return $value; |
|
95 | + } |
|
94 | 96 | } |
95 | 97 | |
96 | 98 | protected function setRecordPropertyValue($item, $record, $input) |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | { |
18 | 18 | protected function createControl($container, $column, $record) |
19 | 19 | { |
20 | - switch(strtolower($column->getDbType())) |
|
20 | + switch (strtolower($column->getDbType())) |
|
21 | 21 | { |
22 | 22 | case 'bit': |
23 | 23 | return $this->createBooleanControl($container, $column, $record); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | return $this->createDateTimeControl($container, $column, $record); |
32 | 32 | default: |
33 | 33 | $control = $this->createDefaultControl($container, $column, $record); |
34 | - if($column->getIsExcluded()) |
|
34 | + if ($column->getIsExcluded()) |
|
35 | 35 | $control->setEnabled(false); |
36 | 36 | return $control; |
37 | 37 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | protected function getControlValue($container, $column, $record) |
41 | 41 | { |
42 | - switch(strtolower($column->getDbType())) |
|
42 | + switch (strtolower($column->getDbType())) |
|
43 | 43 | { |
44 | 44 | case 'boolean': |
45 | 45 | return $container->findControl(self::DEFAULT_ID)->getChecked(); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | return $this->getDateTimeValue($container, $column, $record); |
48 | 48 | default: |
49 | 49 | $value = $this->getDefaultControlValue($container, $column, $record); |
50 | - if(trim($value) === '' && $column->getAllowNull()) |
|
50 | + if (trim($value) === '' && $column->getAllowNull()) |
|
51 | 51 | return null; |
52 | 52 | else |
53 | 53 | return $value; |
@@ -31,8 +31,9 @@ discard block |
||
31 | 31 | return $this->createDateTimeControl($container, $column, $record); |
32 | 32 | default: |
33 | 33 | $control = $this->createDefaultControl($container, $column, $record); |
34 | - if($column->getIsExcluded()) |
|
35 | - $control->setEnabled(false); |
|
34 | + if($column->getIsExcluded()) { |
|
35 | + $control->setEnabled(false); |
|
36 | + } |
|
36 | 37 | return $control; |
37 | 38 | } |
38 | 39 | } |
@@ -47,10 +48,11 @@ discard block |
||
47 | 48 | return $this->getDateTimeValue($container, $column, $record); |
48 | 49 | default: |
49 | 50 | $value = $this->getDefaultControlValue($container, $column, $record); |
50 | - if(trim($value) === '' && $column->getAllowNull()) |
|
51 | - return null; |
|
52 | - else |
|
53 | - return $value; |
|
51 | + if(trim($value) === '' && $column->getAllowNull()) { |
|
52 | + return null; |
|
53 | + } else { |
|
54 | + return $value; |
|
55 | + } |
|
54 | 56 | } |
55 | 57 | } |
56 | 58 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function onLoad($param) |
66 | 66 | { |
67 | - if($this->getVisible()) |
|
67 | + if ($this->getVisible()) |
|
68 | 68 | $this->initializeEditForm(); |
69 | 69 | } |
70 | 70 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | { |
118 | 118 | $record = $this->getCurrentRecord(); |
119 | 119 | $classPath = $this->getEditRenderer(); |
120 | - if($classPath === '') |
|
120 | + if ($classPath === '') |
|
121 | 121 | { |
122 | 122 | $columns = $this->getTableInfo()->getColumns(); |
123 | 123 | $this->getInputRepeater()->setDataSource($columns); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | } |
126 | 126 | else |
127 | 127 | { |
128 | - if($this->_editRenderer === null) |
|
128 | + if ($this->_editRenderer === null) |
|
129 | 129 | $this->createEditRenderer($record, $classPath); |
130 | 130 | else |
131 | 131 | $this->_editRenderer->setData($record); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | protected function createEditRenderer($record, $classPath) |
143 | 143 | { |
144 | 144 | $this->_editRenderer = Prado::createComponent($classPath); |
145 | - if($this->_editRenderer instanceof IScaffoldEditRenderer) |
|
145 | + if ($this->_editRenderer instanceof IScaffoldEditRenderer) |
|
146 | 146 | { |
147 | 147 | $index = $this->getControls()->remove($this->getInputRepeater()); |
148 | 148 | $this->getControls()->insertAt($index, $this->_editRenderer); |
@@ -161,11 +161,11 @@ discard block |
||
161 | 161 | protected function createRepeaterEditItem($sender, $param) |
162 | 162 | { |
163 | 163 | $type = $param->getItem()->getItemType(); |
164 | - if($type == TListItemType::Item || $type == TListItemType::AlternatingItem) |
|
164 | + if ($type == TListItemType::Item || $type == TListItemType::AlternatingItem) |
|
165 | 165 | { |
166 | 166 | $item = $param->getItem(); |
167 | 167 | $column = $item->getData(); |
168 | - if($column === null) |
|
168 | + if ($column === null) |
|
169 | 169 | return; |
170 | 170 | |
171 | 171 | $record = $this->getCurrentRecord(); |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | */ |
181 | 181 | public function bubbleEvent($sender, $param) |
182 | 182 | { |
183 | - switch(strtolower($param->getCommandName())) |
|
183 | + switch (strtolower($param->getCommandName())) |
|
184 | 184 | { |
185 | 185 | case 'save': |
186 | 186 | return $this->doSave() ? false : true; |
@@ -199,14 +199,14 @@ discard block |
||
199 | 199 | */ |
200 | 200 | protected function doSave() |
201 | 201 | { |
202 | - if($this->getPage()->getIsValid()) |
|
202 | + if ($this->getPage()->getIsValid()) |
|
203 | 203 | { |
204 | 204 | $record = $this->getCurrentRecord(); |
205 | - if($this->_editRenderer === null) |
|
205 | + if ($this->_editRenderer === null) |
|
206 | 206 | { |
207 | 207 | $table = $this->getTableInfo(); |
208 | 208 | $builder = $this->getScaffoldInputBuilder($record); |
209 | - foreach($this->getInputRepeater()->getItems() as $item) |
|
209 | + foreach ($this->getInputRepeater()->getItems() as $item) |
|
210 | 210 | { |
211 | 211 | $column = $table->getColumn($item->getCustomData()); |
212 | 212 | $builder->loadScaffoldInput($this, $item, $column, $record); |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $record->save(); |
220 | 220 | return true; |
221 | 221 | } |
222 | - elseif($this->_editRenderer !== null) |
|
222 | + elseif ($this->_editRenderer !== null) |
|
223 | 223 | { |
224 | 224 | //preserve the form data. |
225 | 225 | $this->_editRenderer->updateRecord($this->getCurrentRecord()); |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | { |
274 | 274 | static $_builders = []; |
275 | 275 | $class = get_class($record); |
276 | - if(!isset($_builders[$class])) |
|
276 | + if (!isset($_builders[$class])) |
|
277 | 277 | { |
278 | 278 | $_builders[$class] = TScaffoldInputBase::createInputBuilder($record); |
279 | 279 | } |
@@ -285,6 +285,6 @@ discard block |
||
285 | 285 | */ |
286 | 286 | public function getValidationGroup() |
287 | 287 | { |
288 | - return 'group_' . $this->getUniqueID(); |
|
288 | + return 'group_'.$this->getUniqueID(); |
|
289 | 289 | } |
290 | 290 | } |
291 | 291 | \ No newline at end of file |
@@ -64,8 +64,9 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function onLoad($param) |
66 | 66 | { |
67 | - if($this->getVisible()) |
|
68 | - $this->initializeEditForm(); |
|
67 | + if($this->getVisible()) { |
|
68 | + $this->initializeEditForm(); |
|
69 | + } |
|
69 | 70 | } |
70 | 71 | |
71 | 72 | /** |
@@ -122,13 +123,13 @@ discard block |
||
122 | 123 | $columns = $this->getTableInfo()->getColumns(); |
123 | 124 | $this->getInputRepeater()->setDataSource($columns); |
124 | 125 | $this->getInputRepeater()->dataBind(); |
125 | - } |
|
126 | - else |
|
126 | + } else |
|
127 | 127 | { |
128 | - if($this->_editRenderer === null) |
|
129 | - $this->createEditRenderer($record, $classPath); |
|
130 | - else |
|
131 | - $this->_editRenderer->setData($record); |
|
128 | + if($this->_editRenderer === null) { |
|
129 | + $this->createEditRenderer($record, $classPath); |
|
130 | + } else { |
|
131 | + $this->_editRenderer->setData($record); |
|
132 | + } |
|
132 | 133 | } |
133 | 134 | } |
134 | 135 | |
@@ -147,8 +148,7 @@ discard block |
||
147 | 148 | $index = $this->getControls()->remove($this->getInputRepeater()); |
148 | 149 | $this->getControls()->insertAt($index, $this->_editRenderer); |
149 | 150 | $this->_editRenderer->setData($record); |
150 | - } |
|
151 | - else |
|
151 | + } else |
|
152 | 152 | { |
153 | 153 | throw new TConfigurationException( |
154 | 154 | 'scaffold_invalid_edit_renderer', $this->getID(), get_class($record)); |
@@ -165,8 +165,9 @@ discard block |
||
165 | 165 | { |
166 | 166 | $item = $param->getItem(); |
167 | 167 | $column = $item->getData(); |
168 | - if($column === null) |
|
169 | - return; |
|
168 | + if($column === null) { |
|
169 | + return; |
|
170 | + } |
|
170 | 171 | |
171 | 172 | $record = $this->getCurrentRecord(); |
172 | 173 | $builder = $this->getScaffoldInputBuilder($record); |
@@ -211,15 +212,13 @@ discard block |
||
211 | 212 | $column = $table->getColumn($item->getCustomData()); |
212 | 213 | $builder->loadScaffoldInput($this, $item, $column, $record); |
213 | 214 | } |
214 | - } |
|
215 | - else |
|
215 | + } else |
|
216 | 216 | { |
217 | 217 | $this->_editRenderer->updateRecord($record); |
218 | 218 | } |
219 | 219 | $record->save(); |
220 | 220 | return true; |
221 | - } |
|
222 | - elseif($this->_editRenderer !== null) |
|
221 | + } elseif($this->_editRenderer !== null) |
|
223 | 222 | { |
224 | 223 | //preserve the form data. |
225 | 224 | $this->_editRenderer->updateRecord($this->getCurrentRecord()); |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | */ |
48 | 48 | protected function getListView() |
49 | 49 | { |
50 | - if($this->_list === null && ($id = $this->getListViewID()) !== null) |
|
50 | + if ($this->_list === null && ($id = $this->getListViewID()) !== null) |
|
51 | 51 | { |
52 | 52 | $this->_list = $this->getParent()->findControl($id); |
53 | - if($this->_list === null) |
|
53 | + if ($this->_list === null) |
|
54 | 54 | throw new TConfigurationException('scaffold_unable_to_find_list_view', $id); |
55 | 55 | } |
56 | 56 | return $this->_list; |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function bubbleEvent($sender, $param) |
80 | 80 | { |
81 | - if(strtolower($param->getCommandName()) === 'search') |
|
81 | + if (strtolower($param->getCommandName()) === 'search') |
|
82 | 82 | { |
83 | - if(($list = $this->getListView()) !== null) |
|
83 | + if (($list = $this->getListView()) !== null) |
|
84 | 84 | { |
85 | 85 | $list->setSearchCondition($this->createSearchCondition()); |
86 | 86 | return false; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | protected function createSearchCondition() |
97 | 97 | { |
98 | 98 | $table = $this->getTableInfo(); |
99 | - if(strlen($str = $this->getSearchText()->getText()) > 0) |
|
99 | + if (strlen($str = $this->getSearchText()->getText()) > 0) |
|
100 | 100 | { |
101 | 101 | $builder = $table->createCommandBuilder($this->getRecordFinder()->getDbConnection()); |
102 | 102 | return $builder->getSearchExpression($this->getFields(), $str); |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | protected function getFields() |
110 | 110 | { |
111 | - if(strlen(trim($str = $this->getSearchableFields())) > 0) |
|
111 | + if (strlen(trim($str = $this->getSearchableFields())) > 0) |
|
112 | 112 | $fields = preg_split('/\s*,\s*/', $str); |
113 | 113 | else |
114 | 114 | $fields = $this->getTableInfo()->getColumns()->getKeys(); |
@@ -50,8 +50,9 @@ discard block |
||
50 | 50 | if($this->_list === null && ($id = $this->getListViewID()) !== null) |
51 | 51 | { |
52 | 52 | $this->_list = $this->getParent()->findControl($id); |
53 | - if($this->_list === null) |
|
54 | - throw new TConfigurationException('scaffold_unable_to_find_list_view', $id); |
|
53 | + if($this->_list === null) { |
|
54 | + throw new TConfigurationException('scaffold_unable_to_find_list_view', $id); |
|
55 | + } |
|
55 | 56 | } |
56 | 57 | return $this->_list; |
57 | 58 | } |
@@ -108,10 +109,11 @@ discard block |
||
108 | 109 | */ |
109 | 110 | protected function getFields() |
110 | 111 | { |
111 | - if(strlen(trim($str = $this->getSearchableFields())) > 0) |
|
112 | - $fields = preg_split('/\s*,\s*/', $str); |
|
113 | - else |
|
114 | - $fields = $this->getTableInfo()->getColumns()->getKeys(); |
|
112 | + if(strlen(trim($str = $this->getSearchableFields())) > 0) { |
|
113 | + $fields = preg_split('/\s*,\s*/', $str); |
|
114 | + } else { |
|
115 | + $fields = $this->getTableInfo()->getColumns()->getKeys(); |
|
116 | + } |
|
115 | 117 | return $fields; |
116 | 118 | } |
117 | 119 |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | public static function getInstance($self = null) |
97 | 97 | { |
98 | 98 | static $instance; |
99 | - if($self !== null) |
|
99 | + if ($self !== null) |
|
100 | 100 | $instance = $self; |
101 | - elseif($instance === null) |
|
101 | + elseif ($instance === null) |
|
102 | 102 | $instance = new self; |
103 | 103 | return $instance; |
104 | 104 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function getRecordGateway() |
110 | 110 | { |
111 | - if($this->_gateway === null) { |
|
111 | + if ($this->_gateway === null) { |
|
112 | 112 | $this->_gateway = $this->createRecordGateway(); |
113 | 113 | } |
114 | 114 | return $this->_gateway; |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | public function setGatewayClass($value) |
130 | 130 | { |
131 | 131 | $this->_gateway = null; |
132 | - $this->_gatewayClass = (string)$value; |
|
132 | + $this->_gatewayClass = (string) $value; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -96,10 +96,11 @@ |
||
96 | 96 | public static function getInstance($self = null) |
97 | 97 | { |
98 | 98 | static $instance; |
99 | - if($self !== null) |
|
100 | - $instance = $self; |
|
101 | - elseif($instance === null) |
|
102 | - $instance = new self; |
|
99 | + if($self !== null) { |
|
100 | + $instance = $self; |
|
101 | + } elseif($instance === null) { |
|
102 | + $instance = new self; |
|
103 | + } |
|
103 | 104 | return $instance; |
104 | 105 | } |
105 | 106 |