@@ -215,22 +215,22 @@ discard block |
||
215 | 215 | */ |
216 | 216 | public function initializeCell($cell, $columnIndex, $itemType) |
217 | 217 | { |
218 | - if($itemType === TListItemType::Item || $itemType === TListItemType::AlternatingItem || $itemType === TListItemType::SelectedItem || $itemType === TListItemType::EditItem) |
|
218 | + if ($itemType === TListItemType::Item || $itemType === TListItemType::AlternatingItem || $itemType === TListItemType::SelectedItem || $itemType === TListItemType::EditItem) |
|
219 | 219 | { |
220 | 220 | $link = new THyperLink; |
221 | - if(($url = $this->getImageUrl()) !== '') |
|
221 | + if (($url = $this->getImageUrl()) !== '') |
|
222 | 222 | { |
223 | 223 | $link->setImageUrl($url); |
224 | - if(($width = $this->getImageWidth()) !== '') |
|
224 | + if (($width = $this->getImageWidth()) !== '') |
|
225 | 225 | $link->setImageWidth($width); |
226 | - if(($height = $this->getImageHeight()) !== '') |
|
226 | + if (($height = $this->getImageHeight()) !== '') |
|
227 | 227 | $link->setImageHeight($height); |
228 | 228 | } |
229 | 229 | $link->setText($this->getText()); |
230 | 230 | $link->setNavigateUrl($this->getNavigateUrl()); |
231 | 231 | $link->setTarget($this->getTarget()); |
232 | - if($this->getDataTextField() !== '' || $this->getDataNavigateUrlField() !== '') |
|
233 | - $link->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']); |
|
232 | + if ($this->getDataTextField() !== '' || $this->getDataNavigateUrlField() !== '') |
|
233 | + $link->attachEventHandler('OnDataBinding', [$this, 'dataBindColumn']); |
|
234 | 234 | $cell->getControls()->add($link); |
235 | 235 | $cell->registerObject('HyperLink', $link); |
236 | 236 | } |
@@ -247,13 +247,13 @@ discard block |
||
247 | 247 | { |
248 | 248 | $item = $sender->getNamingContainer(); |
249 | 249 | $data = $item->getData(); |
250 | - if(($field = $this->getDataTextField()) !== '') |
|
250 | + if (($field = $this->getDataTextField()) !== '') |
|
251 | 251 | { |
252 | 252 | $value = $this->getDataFieldValue($data, $field); |
253 | 253 | $text = $this->formatDataValue($this->getDataTextFormatString(), $value); |
254 | 254 | $sender->setText($text); |
255 | 255 | } |
256 | - if(($field = $this->getDataNavigateUrlField()) !== '') |
|
256 | + if (($field = $this->getDataNavigateUrlField()) !== '') |
|
257 | 257 | { |
258 | 258 | $value = $this->getDataFieldValue($data, $field); |
259 | 259 | $url = $this->formatDataValue($this->getDataNavigateUrlFormatString(), $value); |
@@ -221,21 +221,24 @@ |
||
221 | 221 | if(($url = $this->getImageUrl()) !== '') |
222 | 222 | { |
223 | 223 | $link->setImageUrl($url); |
224 | - if(($width = $this->getImageWidth()) !== '') |
|
225 | - $link->setImageWidth($width); |
|
226 | - if(($height = $this->getImageHeight()) !== '') |
|
227 | - $link->setImageHeight($height); |
|
224 | + if(($width = $this->getImageWidth()) !== '') { |
|
225 | + $link->setImageWidth($width); |
|
226 | + } |
|
227 | + if(($height = $this->getImageHeight()) !== '') { |
|
228 | + $link->setImageHeight($height); |
|
229 | + } |
|
228 | 230 | } |
229 | 231 | $link->setText($this->getText()); |
230 | 232 | $link->setNavigateUrl($this->getNavigateUrl()); |
231 | 233 | $link->setTarget($this->getTarget()); |
232 | - if($this->getDataTextField() !== '' || $this->getDataNavigateUrlField() !== '') |
|
233 | - $link->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']); |
|
234 | + if($this->getDataTextField() !== '' || $this->getDataNavigateUrlField() !== '') { |
|
235 | + $link->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']); |
|
236 | + } |
|
234 | 237 | $cell->getControls()->add($link); |
235 | 238 | $cell->registerObject('HyperLink', $link); |
239 | + } else { |
|
240 | + parent::initializeCell($cell, $columnIndex, $itemType); |
|
236 | 241 | } |
237 | - else |
|
238 | - parent::initializeCell($cell, $columnIndex, $itemType); |
|
239 | 242 | } |
240 | 243 | |
241 | 244 | /** |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function setWidth($value) |
164 | 164 | { |
165 | - if(($value = TPropertyValue::ensureInteger($value)) < 0) |
|
165 | + if (($value = TPropertyValue::ensureInteger($value)) < 0) |
|
166 | 166 | $value = -1; |
167 | 167 | $this->setViewState('Width', $value, -1); |
168 | 168 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | */ |
181 | 181 | public function setHeight($value) |
182 | 182 | { |
183 | - if(($value = TPropertyValue::ensureInteger($value)) < 0) |
|
183 | + if (($value = TPropertyValue::ensureInteger($value)) < 0) |
|
184 | 184 | $value = -1; |
185 | 185 | $this->setViewState('Height', $value, -1); |
186 | 186 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | */ |
201 | 201 | public function setMarginWidth($value) |
202 | 202 | { |
203 | - if(($value = TPropertyValue::ensureInteger($value)) < 0) |
|
203 | + if (($value = TPropertyValue::ensureInteger($value)) < 0) |
|
204 | 204 | $value = -1; |
205 | 205 | $this->setViewState('MarginWidth', $value, -1); |
206 | 206 | } |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | */ |
221 | 221 | public function setMarginHeight($value) |
222 | 222 | { |
223 | - if(($value = TPropertyValue::ensureInteger($value)) < 0) |
|
223 | + if (($value = TPropertyValue::ensureInteger($value)) < 0) |
|
224 | 224 | $value = -1; |
225 | 225 | $this->setViewState('MarginHeight', $value, -1); |
226 | 226 | } |
@@ -232,25 +232,25 @@ discard block |
||
232 | 232 | */ |
233 | 233 | protected function addAttributesToRender($writer) |
234 | 234 | { |
235 | - if($this->getID() !== '') |
|
235 | + if ($this->getID() !== '') |
|
236 | 236 | $writer->addAttribute('name', $this->getUniqueID()); |
237 | 237 | |
238 | - if(($src = $this->getFrameUrl()) !== '') |
|
238 | + if (($src = $this->getFrameUrl()) !== '') |
|
239 | 239 | $writer->addAttribute('src', $src); |
240 | 240 | |
241 | - if(($align = strtolower($this->getAlign())) !== 'notset') |
|
241 | + if (($align = strtolower($this->getAlign())) !== 'notset') |
|
242 | 242 | $writer->addAttribute('align', $align); |
243 | 243 | |
244 | 244 | $scrollBars = $this->getScrollBars(); |
245 | - if($scrollBars === TInlineFrameScrollBars::None) |
|
245 | + if ($scrollBars === TInlineFrameScrollBars::None) |
|
246 | 246 | $writer->addAttribute('scrolling', 'no'); |
247 | - elseif($scrollBars === TInlineFrameScrollBars::Both) |
|
247 | + elseif ($scrollBars === TInlineFrameScrollBars::Both) |
|
248 | 248 | $writer->addAttribute('scrolling', 'yes'); |
249 | 249 | |
250 | 250 | if (!$this->getShowBorder()) |
251 | 251 | $writer->addAttribute('frameborder', '0'); |
252 | 252 | |
253 | - if(($longdesc = $this->getDescriptionUrl()) !== '') |
|
253 | + if (($longdesc = $this->getDescriptionUrl()) !== '') |
|
254 | 254 | $writer->addAttribute('longdesc', $longdesc); |
255 | 255 | |
256 | 256 | if (($width = $this->getWidth()) !== -1) |
@@ -259,10 +259,10 @@ discard block |
||
259 | 259 | if (($height = $this->getHeight()) !== -1) |
260 | 260 | $writer->addAttribute('height', $height); |
261 | 261 | |
262 | - if(($marginheight = $this->getMarginHeight()) !== -1) |
|
262 | + if (($marginheight = $this->getMarginHeight()) !== -1) |
|
263 | 263 | $writer->addAttribute('marginheight', $marginheight); |
264 | 264 | |
265 | - if(($marginwidth = $this->getMarginWidth()) !== -1) |
|
265 | + if (($marginwidth = $this->getMarginWidth()) !== -1) |
|
266 | 266 | $writer->addAttribute('marginwidth', $marginwidth); |
267 | 267 | |
268 | 268 | parent::addAttributesToRender($writer); |
@@ -162,8 +162,9 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function setWidth($value) |
164 | 164 | { |
165 | - if(($value = TPropertyValue::ensureInteger($value)) < 0) |
|
166 | - $value = -1; |
|
165 | + if(($value = TPropertyValue::ensureInteger($value)) < 0) { |
|
166 | + $value = -1; |
|
167 | + } |
|
167 | 168 | $this->setViewState('Width', $value, -1); |
168 | 169 | } |
169 | 170 | |
@@ -180,8 +181,9 @@ discard block |
||
180 | 181 | */ |
181 | 182 | public function setHeight($value) |
182 | 183 | { |
183 | - if(($value = TPropertyValue::ensureInteger($value)) < 0) |
|
184 | - $value = -1; |
|
184 | + if(($value = TPropertyValue::ensureInteger($value)) < 0) { |
|
185 | + $value = -1; |
|
186 | + } |
|
185 | 187 | $this->setViewState('Height', $value, -1); |
186 | 188 | } |
187 | 189 | |
@@ -200,8 +202,9 @@ discard block |
||
200 | 202 | */ |
201 | 203 | public function setMarginWidth($value) |
202 | 204 | { |
203 | - if(($value = TPropertyValue::ensureInteger($value)) < 0) |
|
204 | - $value = -1; |
|
205 | + if(($value = TPropertyValue::ensureInteger($value)) < 0) { |
|
206 | + $value = -1; |
|
207 | + } |
|
205 | 208 | $this->setViewState('MarginWidth', $value, -1); |
206 | 209 | } |
207 | 210 | |
@@ -220,8 +223,9 @@ discard block |
||
220 | 223 | */ |
221 | 224 | public function setMarginHeight($value) |
222 | 225 | { |
223 | - if(($value = TPropertyValue::ensureInteger($value)) < 0) |
|
224 | - $value = -1; |
|
226 | + if(($value = TPropertyValue::ensureInteger($value)) < 0) { |
|
227 | + $value = -1; |
|
228 | + } |
|
225 | 229 | $this->setViewState('MarginHeight', $value, -1); |
226 | 230 | } |
227 | 231 | |
@@ -232,38 +236,48 @@ discard block |
||
232 | 236 | */ |
233 | 237 | protected function addAttributesToRender($writer) |
234 | 238 | { |
235 | - if($this->getID() !== '') |
|
236 | - $writer->addAttribute('name', $this->getUniqueID()); |
|
239 | + if($this->getID() !== '') { |
|
240 | + $writer->addAttribute('name', $this->getUniqueID()); |
|
241 | + } |
|
237 | 242 | |
238 | - if(($src = $this->getFrameUrl()) !== '') |
|
239 | - $writer->addAttribute('src', $src); |
|
243 | + if(($src = $this->getFrameUrl()) !== '') { |
|
244 | + $writer->addAttribute('src', $src); |
|
245 | + } |
|
240 | 246 | |
241 | - if(($align = strtolower($this->getAlign())) !== 'notset') |
|
242 | - $writer->addAttribute('align', $align); |
|
247 | + if(($align = strtolower($this->getAlign())) !== 'notset') { |
|
248 | + $writer->addAttribute('align', $align); |
|
249 | + } |
|
243 | 250 | |
244 | 251 | $scrollBars = $this->getScrollBars(); |
245 | - if($scrollBars === TInlineFrameScrollBars::None) |
|
246 | - $writer->addAttribute('scrolling', 'no'); |
|
247 | - elseif($scrollBars === TInlineFrameScrollBars::Both) |
|
248 | - $writer->addAttribute('scrolling', 'yes'); |
|
252 | + if($scrollBars === TInlineFrameScrollBars::None) { |
|
253 | + $writer->addAttribute('scrolling', 'no'); |
|
254 | + } elseif($scrollBars === TInlineFrameScrollBars::Both) { |
|
255 | + $writer->addAttribute('scrolling', 'yes'); |
|
256 | + } |
|
249 | 257 | |
250 | - if (!$this->getShowBorder()) |
|
251 | - $writer->addAttribute('frameborder', '0'); |
|
258 | + if (!$this->getShowBorder()) { |
|
259 | + $writer->addAttribute('frameborder', '0'); |
|
260 | + } |
|
252 | 261 | |
253 | - if(($longdesc = $this->getDescriptionUrl()) !== '') |
|
254 | - $writer->addAttribute('longdesc', $longdesc); |
|
262 | + if(($longdesc = $this->getDescriptionUrl()) !== '') { |
|
263 | + $writer->addAttribute('longdesc', $longdesc); |
|
264 | + } |
|
255 | 265 | |
256 | - if (($width = $this->getWidth()) !== -1) |
|
257 | - $writer->addAttribute('width', $width); |
|
266 | + if (($width = $this->getWidth()) !== -1) { |
|
267 | + $writer->addAttribute('width', $width); |
|
268 | + } |
|
258 | 269 | |
259 | - if (($height = $this->getHeight()) !== -1) |
|
260 | - $writer->addAttribute('height', $height); |
|
270 | + if (($height = $this->getHeight()) !== -1) { |
|
271 | + $writer->addAttribute('height', $height); |
|
272 | + } |
|
261 | 273 | |
262 | - if(($marginheight = $this->getMarginHeight()) !== -1) |
|
263 | - $writer->addAttribute('marginheight', $marginheight); |
|
274 | + if(($marginheight = $this->getMarginHeight()) !== -1) { |
|
275 | + $writer->addAttribute('marginheight', $marginheight); |
|
276 | + } |
|
264 | 277 | |
265 | - if(($marginwidth = $this->getMarginWidth()) !== -1) |
|
266 | - $writer->addAttribute('marginwidth', $marginwidth); |
|
278 | + if(($marginwidth = $this->getMarginWidth()) !== -1) { |
|
279 | + $writer->addAttribute('marginwidth', $marginwidth); |
|
280 | + } |
|
267 | 281 | |
268 | 282 | parent::addAttributesToRender($writer); |
269 | 283 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | public function onPreRender($param) |
122 | 122 | { |
123 | 123 | parent::onPreRender($param); |
124 | - if($this->getPage()->getClientSupportsJavaScript()) |
|
124 | + if ($this->getPage()->getClientSupportsJavaScript()) |
|
125 | 125 | { |
126 | 126 | $this->registerStyleSheet(); |
127 | 127 | $this->registerClientScript(); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | protected function addAttributesToRender($writer) |
137 | 137 | { |
138 | 138 | parent::addAttributesToRender($writer); |
139 | - if($this->getPage()->getClientSupportsJavaScript()) |
|
139 | + if ($this->getPage()->getClientSupportsJavaScript()) |
|
140 | 140 | $writer->addAttribute('id', $this->getClientID()); |
141 | 141 | } |
142 | 142 | |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | */ |
148 | 148 | protected function registerStyleSheet() |
149 | 149 | { |
150 | - if(($url = $this->getCssUrl()) === '') |
|
151 | - $url = $this->getApplication()->getAssetManager()->publishFilePath(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'keyboard.css'); |
|
150 | + if (($url = $this->getCssUrl()) === '') |
|
151 | + $url = $this->getApplication()->getAssetManager()->publishFilePath(dirname(__FILE__).DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'keyboard.css'); |
|
152 | 152 | $this->getPage()->getClientScript()->registerStyleSheetFile($url, $url); |
153 | 153 | } |
154 | 154 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | $className = $this->getClientClassName(); |
162 | 162 | $cs = $this->getPage()->getClientScript(); |
163 | 163 | $cs->registerPradoScript('keyboard'); |
164 | - $cs->registerEndScript('prado:' . $this->getClientID(), "new $className($options);"); |
|
164 | + $cs->registerEndScript('prado:'.$this->getClientID(), "new $className($options);"); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
@@ -177,9 +177,9 @@ discard block |
||
177 | 177 | */ |
178 | 178 | protected function getClientOptions() |
179 | 179 | { |
180 | - if(($forControl = $this->getForControl()) === '') |
|
180 | + if (($forControl = $this->getForControl()) === '') |
|
181 | 181 | throw new TConfigurationException('keyboard_forcontrol_required'); |
182 | - if(($target = $this->findControl($forControl)) === null) |
|
182 | + if (($target = $this->findControl($forControl)) === null) |
|
183 | 183 | throw new TConfigurationException('keyboard_forcontrol_invalid', $forControl); |
184 | 184 | |
185 | 185 | $options['ID'] = $this->getClientID(); |
@@ -136,8 +136,9 @@ discard block |
||
136 | 136 | protected function addAttributesToRender($writer) |
137 | 137 | { |
138 | 138 | parent::addAttributesToRender($writer); |
139 | - if($this->getPage()->getClientSupportsJavaScript()) |
|
140 | - $writer->addAttribute('id', $this->getClientID()); |
|
139 | + if($this->getPage()->getClientSupportsJavaScript()) { |
|
140 | + $writer->addAttribute('id', $this->getClientID()); |
|
141 | + } |
|
141 | 142 | } |
142 | 143 | |
143 | 144 | /** |
@@ -147,8 +148,9 @@ discard block |
||
147 | 148 | */ |
148 | 149 | protected function registerStyleSheet() |
149 | 150 | { |
150 | - if(($url = $this->getCssUrl()) === '') |
|
151 | - $url = $this->getApplication()->getAssetManager()->publishFilePath(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'keyboard.css'); |
|
151 | + if(($url = $this->getCssUrl()) === '') { |
|
152 | + $url = $this->getApplication()->getAssetManager()->publishFilePath(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'keyboard.css'); |
|
153 | + } |
|
152 | 154 | $this->getPage()->getClientScript()->registerStyleSheetFile($url, $url); |
153 | 155 | } |
154 | 156 | |
@@ -177,10 +179,12 @@ discard block |
||
177 | 179 | */ |
178 | 180 | protected function getClientOptions() |
179 | 181 | { |
180 | - if(($forControl = $this->getForControl()) === '') |
|
181 | - throw new TConfigurationException('keyboard_forcontrol_required'); |
|
182 | - if(($target = $this->findControl($forControl)) === null) |
|
183 | - throw new TConfigurationException('keyboard_forcontrol_invalid', $forControl); |
|
182 | + if(($forControl = $this->getForControl()) === '') { |
|
183 | + throw new TConfigurationException('keyboard_forcontrol_required'); |
|
184 | + } |
|
185 | + if(($target = $this->findControl($forControl)) === null) { |
|
186 | + throw new TConfigurationException('keyboard_forcontrol_invalid', $forControl); |
|
187 | + } |
|
184 | 188 | |
185 | 189 | $options['ID'] = $this->getClientID(); |
186 | 190 | $options['ForControl'] = $target->getClientID(); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function setEditItemTemplate($value) |
114 | 114 | { |
115 | - if($value instanceof ITemplate || $value === null) |
|
115 | + if ($value instanceof ITemplate || $value === null) |
|
116 | 116 | $this->_editItemTemplate = $value; |
117 | 117 | else |
118 | 118 | throw new TInvalidDataTypeException('templatecolumn_template_required', 'EditItemTemplate'); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | */ |
133 | 133 | public function setItemTemplate($value) |
134 | 134 | { |
135 | - if($value instanceof ITemplate || $value === null) |
|
135 | + if ($value instanceof ITemplate || $value === null) |
|
136 | 136 | $this->_itemTemplate = $value; |
137 | 137 | else |
138 | 138 | throw new TInvalidDataTypeException('templatecolumn_template_required', 'ItemTemplate'); |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function setHeaderTemplate($value) |
154 | 154 | { |
155 | - if($value instanceof ITemplate || $value === null) |
|
155 | + if ($value instanceof ITemplate || $value === null) |
|
156 | 156 | $this->_headerTemplate = $value; |
157 | 157 | else |
158 | 158 | throw new TInvalidDataTypeException('templatecolumn_template_required', 'HeaderTemplate'); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | */ |
173 | 173 | public function setFooterTemplate($value) |
174 | 174 | { |
175 | - if($value instanceof ITemplate || $value === null) |
|
175 | + if ($value instanceof ITemplate || $value === null) |
|
176 | 176 | $this->_footerTemplate = $value; |
177 | 177 | else |
178 | 178 | throw new TInvalidDataTypeException('templatecolumn_template_required', 'FooterTemplate'); |
@@ -189,11 +189,11 @@ discard block |
||
189 | 189 | */ |
190 | 190 | public function initializeCell($cell, $columnIndex, $itemType) |
191 | 191 | { |
192 | - if($itemType === TListItemType::Item || $itemType === TListItemType::AlternatingItem || $itemType === TListItemType::SelectedItem || $itemType === TListItemType::EditItem) |
|
192 | + if ($itemType === TListItemType::Item || $itemType === TListItemType::AlternatingItem || $itemType === TListItemType::SelectedItem || $itemType === TListItemType::EditItem) |
|
193 | 193 | { |
194 | - if($itemType === TListItemType::EditItem) |
|
194 | + if ($itemType === TListItemType::EditItem) |
|
195 | 195 | { |
196 | - if(($classPath = $this->getEditItemRenderer()) === '' && ($template = $this->_editItemTemplate) === null) |
|
196 | + if (($classPath = $this->getEditItemRenderer()) === '' && ($template = $this->_editItemTemplate) === null) |
|
197 | 197 | { |
198 | 198 | $classPath = $this->getItemRenderer(); |
199 | 199 | $template = $this->_itemTemplate; |
@@ -204,37 +204,37 @@ discard block |
||
204 | 204 | $template = $this->_itemTemplate; |
205 | 205 | $classPath = $this->getItemRenderer(); |
206 | 206 | } |
207 | - if($classPath !== '') |
|
207 | + if ($classPath !== '') |
|
208 | 208 | { |
209 | 209 | $control = Prado::createComponent($classPath); |
210 | 210 | $cell->getControls()->add($control); |
211 | - if($control instanceof IItemDataRenderer) |
|
211 | + if ($control instanceof IItemDataRenderer) |
|
212 | 212 | { |
213 | 213 | $control->setItemIndex($cell->getParent()->getItemIndex()); |
214 | 214 | $control->setItemType($itemType); |
215 | 215 | } |
216 | - if($control instanceof \Prado\IDataRenderer) |
|
217 | - $control->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']); |
|
216 | + if ($control instanceof \Prado\IDataRenderer) |
|
217 | + $control->attachEventHandler('OnDataBinding', [$this, 'dataBindColumn']); |
|
218 | 218 | } |
219 | - elseif($template !== null) |
|
219 | + elseif ($template !== null) |
|
220 | 220 | $template->instantiateIn($cell); |
221 | - elseif($itemType !== TListItemType::EditItem) |
|
221 | + elseif ($itemType !== TListItemType::EditItem) |
|
222 | 222 | $cell->setText(' '); |
223 | 223 | } |
224 | - elseif($itemType === TListItemType::Header) |
|
224 | + elseif ($itemType === TListItemType::Header) |
|
225 | 225 | { |
226 | - if(($classPath = $this->getHeaderRenderer()) !== '') |
|
226 | + if (($classPath = $this->getHeaderRenderer()) !== '') |
|
227 | 227 | $this->initializeHeaderCell($cell, $columnIndex); |
228 | - elseif($this->_headerTemplate !== null) |
|
228 | + elseif ($this->_headerTemplate !== null) |
|
229 | 229 | $this->_headerTemplate->instantiateIn($cell); |
230 | 230 | else |
231 | 231 | $this->initializeHeaderCell($cell, $columnIndex); |
232 | 232 | } |
233 | - elseif($itemType === TListItemType::Footer) |
|
233 | + elseif ($itemType === TListItemType::Footer) |
|
234 | 234 | { |
235 | - if(($classPath = $this->getFooterRenderer()) !== '') |
|
235 | + if (($classPath = $this->getFooterRenderer()) !== '') |
|
236 | 236 | $this->initializeFooterCell($cell, $columnIndex); |
237 | - elseif($this->_footerTemplate !== null) |
|
237 | + elseif ($this->_footerTemplate !== null) |
|
238 | 238 | $this->_footerTemplate->instantiateIn($cell); |
239 | 239 | else |
240 | 240 | $this->initializeFooterCell($cell, $columnIndex); |
@@ -112,10 +112,11 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function setEditItemTemplate($value) |
114 | 114 | { |
115 | - if($value instanceof ITemplate || $value === null) |
|
116 | - $this->_editItemTemplate = $value; |
|
117 | - else |
|
118 | - throw new TInvalidDataTypeException('templatecolumn_template_required', 'EditItemTemplate'); |
|
115 | + if($value instanceof ITemplate || $value === null) { |
|
116 | + $this->_editItemTemplate = $value; |
|
117 | + } else { |
|
118 | + throw new TInvalidDataTypeException('templatecolumn_template_required', 'EditItemTemplate'); |
|
119 | + } |
|
119 | 120 | } |
120 | 121 | |
121 | 122 | /** |
@@ -132,10 +133,11 @@ discard block |
||
132 | 133 | */ |
133 | 134 | public function setItemTemplate($value) |
134 | 135 | { |
135 | - if($value instanceof ITemplate || $value === null) |
|
136 | - $this->_itemTemplate = $value; |
|
137 | - else |
|
138 | - throw new TInvalidDataTypeException('templatecolumn_template_required', 'ItemTemplate'); |
|
136 | + if($value instanceof ITemplate || $value === null) { |
|
137 | + $this->_itemTemplate = $value; |
|
138 | + } else { |
|
139 | + throw new TInvalidDataTypeException('templatecolumn_template_required', 'ItemTemplate'); |
|
140 | + } |
|
139 | 141 | } |
140 | 142 | |
141 | 143 | /** |
@@ -152,10 +154,11 @@ discard block |
||
152 | 154 | */ |
153 | 155 | public function setHeaderTemplate($value) |
154 | 156 | { |
155 | - if($value instanceof ITemplate || $value === null) |
|
156 | - $this->_headerTemplate = $value; |
|
157 | - else |
|
158 | - throw new TInvalidDataTypeException('templatecolumn_template_required', 'HeaderTemplate'); |
|
157 | + if($value instanceof ITemplate || $value === null) { |
|
158 | + $this->_headerTemplate = $value; |
|
159 | + } else { |
|
160 | + throw new TInvalidDataTypeException('templatecolumn_template_required', 'HeaderTemplate'); |
|
161 | + } |
|
159 | 162 | } |
160 | 163 | |
161 | 164 | /** |
@@ -172,10 +175,11 @@ discard block |
||
172 | 175 | */ |
173 | 176 | public function setFooterTemplate($value) |
174 | 177 | { |
175 | - if($value instanceof ITemplate || $value === null) |
|
176 | - $this->_footerTemplate = $value; |
|
177 | - else |
|
178 | - throw new TInvalidDataTypeException('templatecolumn_template_required', 'FooterTemplate'); |
|
178 | + if($value instanceof ITemplate || $value === null) { |
|
179 | + $this->_footerTemplate = $value; |
|
180 | + } else { |
|
181 | + throw new TInvalidDataTypeException('templatecolumn_template_required', 'FooterTemplate'); |
|
182 | + } |
|
179 | 183 | } |
180 | 184 | |
181 | 185 | /** |
@@ -198,8 +202,7 @@ discard block |
||
198 | 202 | $classPath = $this->getItemRenderer(); |
199 | 203 | $template = $this->_itemTemplate; |
200 | 204 | } |
201 | - } |
|
202 | - else |
|
205 | + } else |
|
203 | 206 | { |
204 | 207 | $template = $this->_itemTemplate; |
205 | 208 | $classPath = $this->getItemRenderer(); |
@@ -213,31 +216,32 @@ discard block |
||
213 | 216 | $control->setItemIndex($cell->getParent()->getItemIndex()); |
214 | 217 | $control->setItemType($itemType); |
215 | 218 | } |
216 | - if($control instanceof \Prado\IDataRenderer) |
|
217 | - $control->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']); |
|
219 | + if($control instanceof \Prado\IDataRenderer) { |
|
220 | + $control->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']); |
|
221 | + } |
|
222 | + } elseif($template !== null) { |
|
223 | + $template->instantiateIn($cell); |
|
224 | + } elseif($itemType !== TListItemType::EditItem) { |
|
225 | + $cell->setText(' '); |
|
218 | 226 | } |
219 | - elseif($template !== null) |
|
220 | - $template->instantiateIn($cell); |
|
221 | - elseif($itemType !== TListItemType::EditItem) |
|
222 | - $cell->setText(' '); |
|
223 | - } |
|
224 | - elseif($itemType === TListItemType::Header) |
|
227 | + } elseif($itemType === TListItemType::Header) |
|
225 | 228 | { |
226 | - if(($classPath = $this->getHeaderRenderer()) !== '') |
|
227 | - $this->initializeHeaderCell($cell, $columnIndex); |
|
228 | - elseif($this->_headerTemplate !== null) |
|
229 | - $this->_headerTemplate->instantiateIn($cell); |
|
230 | - else |
|
231 | - $this->initializeHeaderCell($cell, $columnIndex); |
|
232 | - } |
|
233 | - elseif($itemType === TListItemType::Footer) |
|
229 | + if(($classPath = $this->getHeaderRenderer()) !== '') { |
|
230 | + $this->initializeHeaderCell($cell, $columnIndex); |
|
231 | + } elseif($this->_headerTemplate !== null) { |
|
232 | + $this->_headerTemplate->instantiateIn($cell); |
|
233 | + } else { |
|
234 | + $this->initializeHeaderCell($cell, $columnIndex); |
|
235 | + } |
|
236 | + } elseif($itemType === TListItemType::Footer) |
|
234 | 237 | { |
235 | - if(($classPath = $this->getFooterRenderer()) !== '') |
|
236 | - $this->initializeFooterCell($cell, $columnIndex); |
|
237 | - elseif($this->_footerTemplate !== null) |
|
238 | - $this->_footerTemplate->instantiateIn($cell); |
|
239 | - else |
|
240 | - $this->initializeFooterCell($cell, $columnIndex); |
|
238 | + if(($classPath = $this->getFooterRenderer()) !== '') { |
|
239 | + $this->initializeFooterCell($cell, $columnIndex); |
|
240 | + } elseif($this->_footerTemplate !== null) { |
|
241 | + $this->_footerTemplate->instantiateIn($cell); |
|
242 | + } else { |
|
243 | + $this->initializeFooterCell($cell, $columnIndex); |
|
244 | + } |
|
241 | 245 | } |
242 | 246 | } |
243 | 247 |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function addAttributesToRender($writer) |
74 | 74 | { |
75 | - if(($url = trim($this->getBackImageUrl())) !== '') |
|
76 | - $this->setStyleField('background-image', 'url(' . $url . ')'); |
|
75 | + if (($url = trim($this->getBackImageUrl())) !== '') |
|
76 | + $this->setStyleField('background-image', 'url('.$url.')'); |
|
77 | 77 | |
78 | - switch($this->getScrollBars()) |
|
78 | + switch ($this->getScrollBars()) |
|
79 | 79 | { |
80 | 80 | case TScrollBars::Horizontal: $this->setStyleField('overflow-x', 'scroll'); break; |
81 | 81 | case TScrollBars::Vertical: $this->setStyleField('overflow-y', 'scroll'); break; |
@@ -83,15 +83,15 @@ discard block |
||
83 | 83 | case TScrollBars::Auto: $this->setStyleField('overflow', 'auto'); break; |
84 | 84 | } |
85 | 85 | |
86 | - if(($align = $this->getHorizontalAlign()) !== THorizontalAlign::NotSet) |
|
86 | + if (($align = $this->getHorizontalAlign()) !== THorizontalAlign::NotSet) |
|
87 | 87 | $this->setStyleField('text-align', strtolower($align)); |
88 | 88 | |
89 | - if(!$this->getWrap()) |
|
89 | + if (!$this->getWrap()) |
|
90 | 90 | $this->setStyleField('white-space', 'nowrap'); |
91 | 91 | |
92 | - if(($direction = $this->getDirection()) !== TContentDirection::NotSet) |
|
92 | + if (($direction = $this->getDirection()) !== TContentDirection::NotSet) |
|
93 | 93 | { |
94 | - if($direction === TContentDirection::LeftToRight) |
|
94 | + if ($direction === TContentDirection::LeftToRight) |
|
95 | 95 | $this->setStyleField('direction', 'ltr'); |
96 | 96 | else |
97 | 97 | $this->setStyleField('direction', 'rtl'); |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | */ |
106 | 106 | public function getBackImageUrl() |
107 | 107 | { |
108 | - return $this->_backImageUrl === null?'':$this->_backImageUrl; |
|
108 | + return $this->_backImageUrl === null ? '' : $this->_backImageUrl; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function getDirection() |
124 | 124 | { |
125 | - return $this->_direction === null?TContentDirection::NotSet:$this->_direction; |
|
125 | + return $this->_direction === null ?TContentDirection::NotSet : $this->_direction; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function getWrap() |
140 | 140 | { |
141 | - return $this->_wrap === null?true:$this->_wrap; |
|
141 | + return $this->_wrap === null ?true:$this->_wrap; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | */ |
156 | 156 | public function getHorizontalAlign() |
157 | 157 | { |
158 | - return $this->_horizontalAlign === null?THorizontalAlign::NotSet:$this->_horizontalAlign; |
|
158 | + return $this->_horizontalAlign === null ?THorizontalAlign::NotSet : $this->_horizontalAlign; |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | */ |
173 | 173 | public function getScrollBars() |
174 | 174 | { |
175 | - return $this->_scrollBars === null?TScrollBars::None:$this->_scrollBars; |
|
175 | + return $this->_scrollBars === null ?TScrollBars::None : $this->_scrollBars; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | /** |
@@ -207,17 +207,17 @@ discard block |
||
207 | 207 | public function copyFrom($style) |
208 | 208 | { |
209 | 209 | parent::copyFrom($style); |
210 | - if($style instanceof TPanelStyle) |
|
210 | + if ($style instanceof TPanelStyle) |
|
211 | 211 | { |
212 | - if($style->_backImageUrl !== null) |
|
212 | + if ($style->_backImageUrl !== null) |
|
213 | 213 | $this->_backImageUrl = $style->_backImageUrl; |
214 | - if($style->_direction !== null) |
|
214 | + if ($style->_direction !== null) |
|
215 | 215 | $this->_direction = $style->_direction; |
216 | - if($style->_horizontalAlign !== null) |
|
216 | + if ($style->_horizontalAlign !== null) |
|
217 | 217 | $this->_horizontalAlign = $style->_horizontalAlign; |
218 | - if($style->_scrollBars !== null) |
|
218 | + if ($style->_scrollBars !== null) |
|
219 | 219 | $this->_scrollBars = $style->_scrollBars; |
220 | - if($style->_wrap !== null) |
|
220 | + if ($style->_wrap !== null) |
|
221 | 221 | $this->_wrap = $style->_wrap; |
222 | 222 | } |
223 | 223 | } |
@@ -231,17 +231,17 @@ discard block |
||
231 | 231 | public function mergeWith($style) |
232 | 232 | { |
233 | 233 | parent::mergeWith($style); |
234 | - if($style instanceof TPanelStyle) |
|
234 | + if ($style instanceof TPanelStyle) |
|
235 | 235 | { |
236 | - if($this->_backImageUrl === null && $style->_backImageUrl !== null) |
|
236 | + if ($this->_backImageUrl === null && $style->_backImageUrl !== null) |
|
237 | 237 | $this->_backImageUrl = $style->_backImageUrl; |
238 | - if($this->_direction === null && $style->_direction !== null) |
|
238 | + if ($this->_direction === null && $style->_direction !== null) |
|
239 | 239 | $this->_direction = $style->_direction; |
240 | - if($this->_horizontalAlign === null && $style->_horizontalAlign !== null) |
|
240 | + if ($this->_horizontalAlign === null && $style->_horizontalAlign !== null) |
|
241 | 241 | $this->_horizontalAlign = $style->_horizontalAlign; |
242 | - if($this->_scrollBars === null && $style->_scrollBars !== null) |
|
242 | + if ($this->_scrollBars === null && $style->_scrollBars !== null) |
|
243 | 243 | $this->_scrollBars = $style->_scrollBars; |
244 | - if($this->_wrap === null && $style->_wrap !== null) |
|
244 | + if ($this->_wrap === null && $style->_wrap !== null) |
|
245 | 245 | $this->_wrap = $style->_wrap; |
246 | 246 | } |
247 | 247 | } |
@@ -53,16 +53,21 @@ discard block |
||
53 | 53 | protected function _getZappableSleepProps(&$exprops) |
54 | 54 | { |
55 | 55 | parent::_getZappableSleepProps($exprops); |
56 | - if ($this->_backImageUrl === null) |
|
57 | - $exprops[] = "\0Prado\Web\UI\WebControls\TPanelStyle\0_backImageUrl"; |
|
58 | - if ($this->_direction === null) |
|
59 | - $exprops[] = "\0Prado\Web\UI\WebControls\TPanelStyle\0_direction"; |
|
60 | - if ($this->_horizontalAlign === null) |
|
61 | - $exprops[] = "\0Prado\Web\UI\WebControls\TPanelStyle\0_horizontalAlign"; |
|
62 | - if ($this->_scrollBars === null) |
|
63 | - $exprops[] = "\0Prado\Web\UI\WebControls\TPanelStyle\0_scrollBars"; |
|
64 | - if ($this->_wrap === null) |
|
65 | - $exprops[] = "\0Prado\Web\UI\WebControls\TPanelStyle\0_wrap"; |
|
56 | + if ($this->_backImageUrl === null) { |
|
57 | + $exprops[] = "\0Prado\Web\UI\WebControls\TPanelStyle\0_backImageUrl"; |
|
58 | + } |
|
59 | + if ($this->_direction === null) { |
|
60 | + $exprops[] = "\0Prado\Web\UI\WebControls\TPanelStyle\0_direction"; |
|
61 | + } |
|
62 | + if ($this->_horizontalAlign === null) { |
|
63 | + $exprops[] = "\0Prado\Web\UI\WebControls\TPanelStyle\0_horizontalAlign"; |
|
64 | + } |
|
65 | + if ($this->_scrollBars === null) { |
|
66 | + $exprops[] = "\0Prado\Web\UI\WebControls\TPanelStyle\0_scrollBars"; |
|
67 | + } |
|
68 | + if ($this->_wrap === null) { |
|
69 | + $exprops[] = "\0Prado\Web\UI\WebControls\TPanelStyle\0_wrap"; |
|
70 | + } |
|
66 | 71 | } |
67 | 72 | |
68 | 73 | /** |
@@ -72,8 +77,9 @@ discard block |
||
72 | 77 | */ |
73 | 78 | public function addAttributesToRender($writer) |
74 | 79 | { |
75 | - if(($url = trim($this->getBackImageUrl())) !== '') |
|
76 | - $this->setStyleField('background-image', 'url(' . $url . ')'); |
|
80 | + if(($url = trim($this->getBackImageUrl())) !== '') { |
|
81 | + $this->setStyleField('background-image', 'url(' . $url . ')'); |
|
82 | + } |
|
77 | 83 | |
78 | 84 | switch($this->getScrollBars()) |
79 | 85 | { |
@@ -83,18 +89,21 @@ discard block |
||
83 | 89 | case TScrollBars::Auto: $this->setStyleField('overflow', 'auto'); break; |
84 | 90 | } |
85 | 91 | |
86 | - if(($align = $this->getHorizontalAlign()) !== THorizontalAlign::NotSet) |
|
87 | - $this->setStyleField('text-align', strtolower($align)); |
|
92 | + if(($align = $this->getHorizontalAlign()) !== THorizontalAlign::NotSet) { |
|
93 | + $this->setStyleField('text-align', strtolower($align)); |
|
94 | + } |
|
88 | 95 | |
89 | - if(!$this->getWrap()) |
|
90 | - $this->setStyleField('white-space', 'nowrap'); |
|
96 | + if(!$this->getWrap()) { |
|
97 | + $this->setStyleField('white-space', 'nowrap'); |
|
98 | + } |
|
91 | 99 | |
92 | 100 | if(($direction = $this->getDirection()) !== TContentDirection::NotSet) |
93 | 101 | { |
94 | - if($direction === TContentDirection::LeftToRight) |
|
95 | - $this->setStyleField('direction', 'ltr'); |
|
96 | - else |
|
97 | - $this->setStyleField('direction', 'rtl'); |
|
102 | + if($direction === TContentDirection::LeftToRight) { |
|
103 | + $this->setStyleField('direction', 'ltr'); |
|
104 | + } else { |
|
105 | + $this->setStyleField('direction', 'rtl'); |
|
106 | + } |
|
98 | 107 | } |
99 | 108 | |
100 | 109 | parent::addAttributesToRender($writer); |
@@ -209,16 +218,21 @@ discard block |
||
209 | 218 | parent::copyFrom($style); |
210 | 219 | if($style instanceof TPanelStyle) |
211 | 220 | { |
212 | - if($style->_backImageUrl !== null) |
|
213 | - $this->_backImageUrl = $style->_backImageUrl; |
|
214 | - if($style->_direction !== null) |
|
215 | - $this->_direction = $style->_direction; |
|
216 | - if($style->_horizontalAlign !== null) |
|
217 | - $this->_horizontalAlign = $style->_horizontalAlign; |
|
218 | - if($style->_scrollBars !== null) |
|
219 | - $this->_scrollBars = $style->_scrollBars; |
|
220 | - if($style->_wrap !== null) |
|
221 | - $this->_wrap = $style->_wrap; |
|
221 | + if($style->_backImageUrl !== null) { |
|
222 | + $this->_backImageUrl = $style->_backImageUrl; |
|
223 | + } |
|
224 | + if($style->_direction !== null) { |
|
225 | + $this->_direction = $style->_direction; |
|
226 | + } |
|
227 | + if($style->_horizontalAlign !== null) { |
|
228 | + $this->_horizontalAlign = $style->_horizontalAlign; |
|
229 | + } |
|
230 | + if($style->_scrollBars !== null) { |
|
231 | + $this->_scrollBars = $style->_scrollBars; |
|
232 | + } |
|
233 | + if($style->_wrap !== null) { |
|
234 | + $this->_wrap = $style->_wrap; |
|
235 | + } |
|
222 | 236 | } |
223 | 237 | } |
224 | 238 | |
@@ -233,16 +247,21 @@ discard block |
||
233 | 247 | parent::mergeWith($style); |
234 | 248 | if($style instanceof TPanelStyle) |
235 | 249 | { |
236 | - if($this->_backImageUrl === null && $style->_backImageUrl !== null) |
|
237 | - $this->_backImageUrl = $style->_backImageUrl; |
|
238 | - if($this->_direction === null && $style->_direction !== null) |
|
239 | - $this->_direction = $style->_direction; |
|
240 | - if($this->_horizontalAlign === null && $style->_horizontalAlign !== null) |
|
241 | - $this->_horizontalAlign = $style->_horizontalAlign; |
|
242 | - if($this->_scrollBars === null && $style->_scrollBars !== null) |
|
243 | - $this->_scrollBars = $style->_scrollBars; |
|
244 | - if($this->_wrap === null && $style->_wrap !== null) |
|
245 | - $this->_wrap = $style->_wrap; |
|
250 | + if($this->_backImageUrl === null && $style->_backImageUrl !== null) { |
|
251 | + $this->_backImageUrl = $style->_backImageUrl; |
|
252 | + } |
|
253 | + if($this->_direction === null && $style->_direction !== null) { |
|
254 | + $this->_direction = $style->_direction; |
|
255 | + } |
|
256 | + if($this->_horizontalAlign === null && $style->_horizontalAlign !== null) { |
|
257 | + $this->_horizontalAlign = $style->_horizontalAlign; |
|
258 | + } |
|
259 | + if($this->_scrollBars === null && $style->_scrollBars !== null) { |
|
260 | + $this->_scrollBars = $style->_scrollBars; |
|
261 | + } |
|
262 | + if($this->_wrap === null && $style->_wrap !== null) { |
|
263 | + $this->_wrap = $style->_wrap; |
|
264 | + } |
|
246 | 265 | } |
247 | 266 | } |
248 | 267 | } |
249 | 268 | \ No newline at end of file |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | { |
48 | 48 | $rows = $this->getRows(); |
49 | 49 | $writer->addAttribute('size', "$rows"); |
50 | - if($this->getSelectionMode() === TListSelectionMode::Multiple) |
|
51 | - $writer->addAttribute('name', $this->getUniqueID() . '[]'); |
|
50 | + if ($this->getSelectionMode() === TListSelectionMode::Multiple) |
|
51 | + $writer->addAttribute('name', $this->getUniqueID().'[]'); |
|
52 | 52 | else |
53 | 53 | $writer->addAttribute('name', $this->getUniqueID()); |
54 | 54 | parent::addAttributesToRender($writer); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | public function onPreRender($param) |
73 | 73 | { |
74 | 74 | parent::onPreRender($param); |
75 | - if($this->getEnabled(true)) |
|
75 | + if ($this->getEnabled(true)) |
|
76 | 76 | $this->getPage()->registerRequiresPostData($this); |
77 | 77 | } |
78 | 78 | |
@@ -85,18 +85,18 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function loadPostData($key, $values) |
87 | 87 | { |
88 | - if(!$this->getEnabled(true)) |
|
88 | + if (!$this->getEnabled(true)) |
|
89 | 89 | return false; |
90 | 90 | $this->ensureDataBound(); |
91 | - $selections = isset($values[$key])?$values[$key]:null; |
|
92 | - if($selections !== null) |
|
91 | + $selections = isset($values[$key]) ? $values[$key] : null; |
|
92 | + if ($selections !== null) |
|
93 | 93 | { |
94 | 94 | $items = $this->getItems(); |
95 | - if($this->getSelectionMode() === TListSelectionMode::Single) |
|
95 | + if ($this->getSelectionMode() === TListSelectionMode::Single) |
|
96 | 96 | { |
97 | - $selection = is_array($selections)?$selections[0]:$selections; |
|
97 | + $selection = is_array($selections) ? $selections[0] : $selections; |
|
98 | 98 | $index = $items->findIndexByValue($selection, false); |
99 | - if($this->getSelectedIndex() !== $index) |
|
99 | + if ($this->getSelectedIndex() !== $index) |
|
100 | 100 | { |
101 | 101 | $this->setSelectedIndex($index); |
102 | 102 | return $this->_dataChanged = true; |
@@ -104,20 +104,20 @@ discard block |
||
104 | 104 | else |
105 | 105 | return false; |
106 | 106 | } |
107 | - if(!is_array($selections)) |
|
107 | + if (!is_array($selections)) |
|
108 | 108 | $selections = [$selections]; |
109 | 109 | $list = []; |
110 | - foreach($selections as $selection) |
|
110 | + foreach ($selections as $selection) |
|
111 | 111 | $list[] = $items->findIndexByValue($selection, false); |
112 | 112 | $list2 = $this->getSelectedIndices(); |
113 | 113 | $n = count($list); |
114 | 114 | $flag = false; |
115 | - if($n === count($list2)) |
|
115 | + if ($n === count($list2)) |
|
116 | 116 | { |
117 | 117 | sort($list, SORT_NUMERIC); |
118 | - for($i = 0;$i < $n;++$i) |
|
118 | + for ($i = 0; $i < $n; ++$i) |
|
119 | 119 | { |
120 | - if($list[$i] !== $list2[$i]) |
|
120 | + if ($list[$i] !== $list2[$i]) |
|
121 | 121 | { |
122 | 122 | $flag = true; |
123 | 123 | break; |
@@ -126,14 +126,14 @@ discard block |
||
126 | 126 | } |
127 | 127 | else |
128 | 128 | $flag = true; |
129 | - if($flag) |
|
129 | + if ($flag) |
|
130 | 130 | { |
131 | 131 | $this->setSelectedIndices($list); |
132 | 132 | $this->_dataChanged = true; |
133 | 133 | } |
134 | 134 | return $flag; |
135 | 135 | } |
136 | - elseif($this->getSelectedIndex() !== -1) |
|
136 | + elseif ($this->getSelectedIndex() !== -1) |
|
137 | 137 | { |
138 | 138 | $this->clearSelection(); |
139 | 139 | return $this->_dataChanged = true; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | */ |
152 | 152 | public function raisePostDataChangedEvent() |
153 | 153 | { |
154 | - if($this->getAutoPostBack() && $this->getCausesValidation()) |
|
154 | + if ($this->getAutoPostBack() && $this->getCausesValidation()) |
|
155 | 155 | $this->getPage()->validate($this->getValidationGroup()); |
156 | 156 | $this->onSelectedIndexChanged(null); |
157 | 157 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | public function setRows($value) |
189 | 189 | { |
190 | 190 | $value = TPropertyValue::ensureInteger($value); |
191 | - if($value <= 0) |
|
191 | + if ($value <= 0) |
|
192 | 192 | $value = 4; |
193 | 193 | $this->setViewState('Rows', $value, 4); |
194 | 194 | } |
@@ -47,10 +47,11 @@ discard block |
||
47 | 47 | { |
48 | 48 | $rows = $this->getRows(); |
49 | 49 | $writer->addAttribute('size', "$rows"); |
50 | - if($this->getSelectionMode() === TListSelectionMode::Multiple) |
|
51 | - $writer->addAttribute('name', $this->getUniqueID() . '[]'); |
|
52 | - else |
|
53 | - $writer->addAttribute('name', $this->getUniqueID()); |
|
50 | + if($this->getSelectionMode() === TListSelectionMode::Multiple) { |
|
51 | + $writer->addAttribute('name', $this->getUniqueID() . '[]'); |
|
52 | + } else { |
|
53 | + $writer->addAttribute('name', $this->getUniqueID()); |
|
54 | + } |
|
54 | 55 | parent::addAttributesToRender($writer); |
55 | 56 | } |
56 | 57 | |
@@ -72,8 +73,9 @@ discard block |
||
72 | 73 | public function onPreRender($param) |
73 | 74 | { |
74 | 75 | parent::onPreRender($param); |
75 | - if($this->getEnabled(true)) |
|
76 | - $this->getPage()->registerRequiresPostData($this); |
|
76 | + if($this->getEnabled(true)) { |
|
77 | + $this->getPage()->registerRequiresPostData($this); |
|
78 | + } |
|
77 | 79 | } |
78 | 80 | |
79 | 81 | /** |
@@ -85,8 +87,9 @@ discard block |
||
85 | 87 | */ |
86 | 88 | public function loadPostData($key, $values) |
87 | 89 | { |
88 | - if(!$this->getEnabled(true)) |
|
89 | - return false; |
|
90 | + if(!$this->getEnabled(true)) { |
|
91 | + return false; |
|
92 | + } |
|
90 | 93 | $this->ensureDataBound(); |
91 | 94 | $selections = isset($values[$key])?$values[$key]:null; |
92 | 95 | if($selections !== null) |
@@ -100,15 +103,17 @@ discard block |
||
100 | 103 | { |
101 | 104 | $this->setSelectedIndex($index); |
102 | 105 | return $this->_dataChanged = true; |
106 | + } else { |
|
107 | + return false; |
|
103 | 108 | } |
104 | - else |
|
105 | - return false; |
|
106 | 109 | } |
107 | - if(!is_array($selections)) |
|
108 | - $selections = [$selections]; |
|
110 | + if(!is_array($selections)) { |
|
111 | + $selections = [$selections]; |
|
112 | + } |
|
109 | 113 | $list = []; |
110 | - foreach($selections as $selection) |
|
111 | - $list[] = $items->findIndexByValue($selection, false); |
|
114 | + foreach($selections as $selection) { |
|
115 | + $list[] = $items->findIndexByValue($selection, false); |
|
116 | + } |
|
112 | 117 | $list2 = $this->getSelectedIndices(); |
113 | 118 | $n = count($list); |
114 | 119 | $flag = false; |
@@ -123,23 +128,22 @@ discard block |
||
123 | 128 | break; |
124 | 129 | } |
125 | 130 | } |
131 | + } else { |
|
132 | + $flag = true; |
|
126 | 133 | } |
127 | - else |
|
128 | - $flag = true; |
|
129 | 134 | if($flag) |
130 | 135 | { |
131 | 136 | $this->setSelectedIndices($list); |
132 | 137 | $this->_dataChanged = true; |
133 | 138 | } |
134 | 139 | return $flag; |
135 | - } |
|
136 | - elseif($this->getSelectedIndex() !== -1) |
|
140 | + } elseif($this->getSelectedIndex() !== -1) |
|
137 | 141 | { |
138 | 142 | $this->clearSelection(); |
139 | 143 | return $this->_dataChanged = true; |
144 | + } else { |
|
145 | + return false; |
|
140 | 146 | } |
141 | - else |
|
142 | - return false; |
|
143 | 147 | } |
144 | 148 | |
145 | 149 | /** |
@@ -151,8 +155,9 @@ discard block |
||
151 | 155 | */ |
152 | 156 | public function raisePostDataChangedEvent() |
153 | 157 | { |
154 | - if($this->getAutoPostBack() && $this->getCausesValidation()) |
|
155 | - $this->getPage()->validate($this->getValidationGroup()); |
|
158 | + if($this->getAutoPostBack() && $this->getCausesValidation()) { |
|
159 | + $this->getPage()->validate($this->getValidationGroup()); |
|
160 | + } |
|
156 | 161 | $this->onSelectedIndexChanged(null); |
157 | 162 | } |
158 | 163 | |
@@ -188,8 +193,9 @@ discard block |
||
188 | 193 | public function setRows($value) |
189 | 194 | { |
190 | 195 | $value = TPropertyValue::ensureInteger($value); |
191 | - if($value <= 0) |
|
192 | - $value = 4; |
|
196 | + if($value <= 0) { |
|
197 | + $value = 4; |
|
198 | + } |
|
193 | 199 | $this->setViewState('Rows', $value, 4); |
194 | 200 | } |
195 | 201 |
@@ -76,9 +76,9 @@ |
||
76 | 76 | */ |
77 | 77 | public function getVisible($checkParents = true) |
78 | 78 | { |
79 | - if(($parent = $this->getParent()) === null) |
|
79 | + if (($parent = $this->getParent()) === null) |
|
80 | 80 | return $this->getActive(); |
81 | - elseif($this->getActive()) |
|
81 | + elseif ($this->getActive()) |
|
82 | 82 | return $parent->getVisible($checkParents); |
83 | 83 | else |
84 | 84 | return false; |
@@ -76,12 +76,13 @@ |
||
76 | 76 | */ |
77 | 77 | public function getVisible($checkParents = true) |
78 | 78 | { |
79 | - if(($parent = $this->getParent()) === null) |
|
80 | - return $this->getActive(); |
|
81 | - elseif($this->getActive()) |
|
82 | - return $parent->getVisible($checkParents); |
|
83 | - else |
|
84 | - return false; |
|
79 | + if(($parent = $this->getParent()) === null) { |
|
80 | + return $this->getActive(); |
|
81 | + } elseif($this->getActive()) { |
|
82 | + return $parent->getVisible($checkParents); |
|
83 | + } else { |
|
84 | + return false; |
|
85 | + } |
|
85 | 86 | } |
86 | 87 | |
87 | 88 | /** |
@@ -75,13 +75,13 @@ discard block |
||
75 | 75 | public function copyFrom($style) |
76 | 76 | { |
77 | 77 | parent::copyFrom($style); |
78 | - if($style instanceof TTableItemStyle) |
|
78 | + if ($style instanceof TTableItemStyle) |
|
79 | 79 | { |
80 | - if($this->_verticalAlign === null && $style->_verticalAlign !== null) |
|
80 | + if ($this->_verticalAlign === null && $style->_verticalAlign !== null) |
|
81 | 81 | $this->_verticalAlign = $style->_verticalAlign; |
82 | - if($this->_horizontalAlign === null && $style->_horizontalAlign !== null) |
|
82 | + if ($this->_horizontalAlign === null && $style->_horizontalAlign !== null) |
|
83 | 83 | $this->_horizontalAlign = $style->_horizontalAlign; |
84 | - if($this->_wrap === null && $style->_wrap !== null) |
|
84 | + if ($this->_wrap === null && $style->_wrap !== null) |
|
85 | 85 | $this->_wrap = $style->_wrap; |
86 | 86 | } |
87 | 87 | } |
@@ -95,13 +95,13 @@ discard block |
||
95 | 95 | public function mergeWith($style) |
96 | 96 | { |
97 | 97 | parent::mergeWith($style); |
98 | - if($style instanceof TTableItemStyle) |
|
98 | + if ($style instanceof TTableItemStyle) |
|
99 | 99 | { |
100 | - if($style->_verticalAlign !== null) |
|
100 | + if ($style->_verticalAlign !== null) |
|
101 | 101 | $this->_verticalAlign = $style->_verticalAlign; |
102 | - if($style->_horizontalAlign !== null) |
|
102 | + if ($style->_horizontalAlign !== null) |
|
103 | 103 | $this->_horizontalAlign = $style->_horizontalAlign; |
104 | - if($style->_wrap !== null) |
|
104 | + if ($style->_wrap !== null) |
|
105 | 105 | $this->_wrap = $style->_wrap; |
106 | 106 | } |
107 | 107 | } |
@@ -113,13 +113,13 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function addAttributesToRender($writer) |
115 | 115 | { |
116 | - if(!$this->getWrap()) |
|
116 | + if (!$this->getWrap()) |
|
117 | 117 | $writer->addStyleAttribute('white-space', 'nowrap'); |
118 | 118 | |
119 | - if(($horizontalAlign = $this->getHorizontalAlign()) !== THorizontalAlign::NotSet) |
|
119 | + if (($horizontalAlign = $this->getHorizontalAlign()) !== THorizontalAlign::NotSet) |
|
120 | 120 | $writer->addAttribute('align', strtolower($horizontalAlign)); |
121 | 121 | |
122 | - if(($verticalAlign = $this->getVerticalAlign()) !== TVerticalAlign::NotSet) |
|
122 | + if (($verticalAlign = $this->getVerticalAlign()) !== TVerticalAlign::NotSet) |
|
123 | 123 | $writer->addAttribute('valign', strtolower($verticalAlign)); |
124 | 124 | |
125 | 125 | parent::addAttributesToRender($writer); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function getHorizontalAlign() |
132 | 132 | { |
133 | - return $this->_horizontalAlign === null?THorizontalAlign::NotSet:$this->_horizontalAlign; |
|
133 | + return $this->_horizontalAlign === null ?THorizontalAlign::NotSet : $this->_horizontalAlign; |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function getVerticalAlign() |
149 | 149 | { |
150 | - return $this->_verticalAlign === null?TVerticalAlign::NotSet:$this->_verticalAlign; |
|
150 | + return $this->_verticalAlign === null ?TVerticalAlign::NotSet : $this->_verticalAlign; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | */ |
165 | 165 | public function getWrap() |
166 | 166 | { |
167 | - return $this->_wrap === null?true:$this->_wrap; |
|
167 | + return $this->_wrap === null ?true:$this->_wrap; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
@@ -45,12 +45,15 @@ discard block |
||
45 | 45 | protected function _getZappableSleepProps(&$exprops) |
46 | 46 | { |
47 | 47 | parent::_getZappableSleepProps($exprops); |
48 | - if ($this->_horizontalAlign === null) |
|
49 | - $exprops[] = "\0Prado\Web\UI\WebControls\TTableItemStyle\0_horizontalAlign"; |
|
50 | - if ($this->_verticalAlign === null) |
|
51 | - $exprops[] = "\0Prado\Web\UI\WebControls\TTableItemStyle\0_verticalAlign"; |
|
52 | - if ($this->_wrap === null) |
|
53 | - $exprops[] = "\0Prado\Web\UI\WebControls\TTableItemStyle\0_wrap"; |
|
48 | + if ($this->_horizontalAlign === null) { |
|
49 | + $exprops[] = "\0Prado\Web\UI\WebControls\TTableItemStyle\0_horizontalAlign"; |
|
50 | + } |
|
51 | + if ($this->_verticalAlign === null) { |
|
52 | + $exprops[] = "\0Prado\Web\UI\WebControls\TTableItemStyle\0_verticalAlign"; |
|
53 | + } |
|
54 | + if ($this->_wrap === null) { |
|
55 | + $exprops[] = "\0Prado\Web\UI\WebControls\TTableItemStyle\0_wrap"; |
|
56 | + } |
|
54 | 57 | } |
55 | 58 | |
56 | 59 | /** |
@@ -77,12 +80,15 @@ discard block |
||
77 | 80 | parent::copyFrom($style); |
78 | 81 | if($style instanceof TTableItemStyle) |
79 | 82 | { |
80 | - if($this->_verticalAlign === null && $style->_verticalAlign !== null) |
|
81 | - $this->_verticalAlign = $style->_verticalAlign; |
|
82 | - if($this->_horizontalAlign === null && $style->_horizontalAlign !== null) |
|
83 | - $this->_horizontalAlign = $style->_horizontalAlign; |
|
84 | - if($this->_wrap === null && $style->_wrap !== null) |
|
85 | - $this->_wrap = $style->_wrap; |
|
83 | + if($this->_verticalAlign === null && $style->_verticalAlign !== null) { |
|
84 | + $this->_verticalAlign = $style->_verticalAlign; |
|
85 | + } |
|
86 | + if($this->_horizontalAlign === null && $style->_horizontalAlign !== null) { |
|
87 | + $this->_horizontalAlign = $style->_horizontalAlign; |
|
88 | + } |
|
89 | + if($this->_wrap === null && $style->_wrap !== null) { |
|
90 | + $this->_wrap = $style->_wrap; |
|
91 | + } |
|
86 | 92 | } |
87 | 93 | } |
88 | 94 | |
@@ -97,12 +103,15 @@ discard block |
||
97 | 103 | parent::mergeWith($style); |
98 | 104 | if($style instanceof TTableItemStyle) |
99 | 105 | { |
100 | - if($style->_verticalAlign !== null) |
|
101 | - $this->_verticalAlign = $style->_verticalAlign; |
|
102 | - if($style->_horizontalAlign !== null) |
|
103 | - $this->_horizontalAlign = $style->_horizontalAlign; |
|
104 | - if($style->_wrap !== null) |
|
105 | - $this->_wrap = $style->_wrap; |
|
106 | + if($style->_verticalAlign !== null) { |
|
107 | + $this->_verticalAlign = $style->_verticalAlign; |
|
108 | + } |
|
109 | + if($style->_horizontalAlign !== null) { |
|
110 | + $this->_horizontalAlign = $style->_horizontalAlign; |
|
111 | + } |
|
112 | + if($style->_wrap !== null) { |
|
113 | + $this->_wrap = $style->_wrap; |
|
114 | + } |
|
106 | 115 | } |
107 | 116 | } |
108 | 117 | |
@@ -113,14 +122,17 @@ discard block |
||
113 | 122 | */ |
114 | 123 | public function addAttributesToRender($writer) |
115 | 124 | { |
116 | - if(!$this->getWrap()) |
|
117 | - $writer->addStyleAttribute('white-space', 'nowrap'); |
|
125 | + if(!$this->getWrap()) { |
|
126 | + $writer->addStyleAttribute('white-space', 'nowrap'); |
|
127 | + } |
|
118 | 128 | |
119 | - if(($horizontalAlign = $this->getHorizontalAlign()) !== THorizontalAlign::NotSet) |
|
120 | - $writer->addAttribute('align', strtolower($horizontalAlign)); |
|
129 | + if(($horizontalAlign = $this->getHorizontalAlign()) !== THorizontalAlign::NotSet) { |
|
130 | + $writer->addAttribute('align', strtolower($horizontalAlign)); |
|
131 | + } |
|
121 | 132 | |
122 | - if(($verticalAlign = $this->getVerticalAlign()) !== TVerticalAlign::NotSet) |
|
123 | - $writer->addAttribute('valign', strtolower($verticalAlign)); |
|
133 | + if(($verticalAlign = $this->getVerticalAlign()) !== TVerticalAlign::NotSet) { |
|
134 | + $writer->addAttribute('valign', strtolower($verticalAlign)); |
|
135 | + } |
|
124 | 136 | |
125 | 137 | parent::addAttributesToRender($writer); |
126 | 138 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function addParsedObject($object) |
83 | 83 | { |
84 | - if($object instanceof TTableRow) |
|
84 | + if ($object instanceof TTableRow) |
|
85 | 85 | $this->getRows()->add($object); |
86 | 86 | } |
87 | 87 | |
@@ -103,14 +103,14 @@ discard block |
||
103 | 103 | { |
104 | 104 | parent::addAttributesToRender($writer); |
105 | 105 | $border = 0; |
106 | - if($this->getHasStyle()) |
|
106 | + if ($this->getHasStyle()) |
|
107 | 107 | { |
108 | - if($this->getGridLines() !== TTableGridLines::None) |
|
108 | + if ($this->getGridLines() !== TTableGridLines::None) |
|
109 | 109 | { |
110 | - if(($border = $this->getBorderWidth()) === '') |
|
110 | + if (($border = $this->getBorderWidth()) === '') |
|
111 | 111 | $border = 1; |
112 | 112 | else |
113 | - $border = (int)$border; |
|
113 | + $border = (int) $border; |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | $writer->addAttribute('border', "$border"); |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public function getCellSpacing() |
173 | 173 | { |
174 | - if($this->getHasStyle()) |
|
174 | + if ($this->getHasStyle()) |
|
175 | 175 | return $this->getStyle()->getCellSpacing(); |
176 | 176 | else |
177 | 177 | return -1; |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | */ |
191 | 191 | public function getCellPadding() |
192 | 192 | { |
193 | - if($this->getHasStyle()) |
|
193 | + if ($this->getHasStyle()) |
|
194 | 194 | return $this->getStyle()->getCellPadding(); |
195 | 195 | else |
196 | 196 | return -1; |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public function getHorizontalAlign() |
211 | 211 | { |
212 | - if($this->getHasStyle()) |
|
212 | + if ($this->getHasStyle()) |
|
213 | 213 | return $this->getStyle()->getHorizontalAlign(); |
214 | 214 | else |
215 | 215 | return THorizontalAlign::NotSet; |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | */ |
229 | 229 | public function getGridLines() |
230 | 230 | { |
231 | - if($this->getHasStyle()) |
|
231 | + if ($this->getHasStyle()) |
|
232 | 232 | return $this->getStyle()->getGridLines(); |
233 | 233 | else |
234 | 234 | return TTableGridLines::None; |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | */ |
248 | 248 | public function getBackImageUrl() |
249 | 249 | { |
250 | - if($this->getHasStyle()) |
|
250 | + if ($this->getHasStyle()) |
|
251 | 251 | return $this->getStyle()->getBackImageUrl(); |
252 | 252 | else |
253 | 253 | return ''; |
@@ -269,9 +269,9 @@ discard block |
||
269 | 269 | public function renderBeginTag($writer) |
270 | 270 | { |
271 | 271 | parent::renderBeginTag($writer); |
272 | - if(($caption = $this->getCaption()) !== '') |
|
272 | + if (($caption = $this->getCaption()) !== '') |
|
273 | 273 | { |
274 | - if(($align = $this->getCaptionAlign()) !== TTableCaptionAlign::NotSet) |
|
274 | + if (($align = $this->getCaptionAlign()) !== TTableCaptionAlign::NotSet) |
|
275 | 275 | $writer->addAttribute('align', strtolower($align)); |
276 | 276 | $writer->renderBeginTag('caption'); |
277 | 277 | $writer->write($caption); |
@@ -285,44 +285,44 @@ discard block |
||
285 | 285 | */ |
286 | 286 | public function renderContents($writer) |
287 | 287 | { |
288 | - if($this->getHasControls()) |
|
288 | + if ($this->getHasControls()) |
|
289 | 289 | { |
290 | 290 | $renderTableSection = false; |
291 | - foreach($this->getControls() as $row) |
|
291 | + foreach ($this->getControls() as $row) |
|
292 | 292 | { |
293 | - if($row->getTableSection() !== TTableRowSection::Body) |
|
293 | + if ($row->getTableSection() !== TTableRowSection::Body) |
|
294 | 294 | { |
295 | 295 | $renderTableSection = true; |
296 | 296 | break; |
297 | 297 | } |
298 | 298 | } |
299 | - if($renderTableSection) |
|
299 | + if ($renderTableSection) |
|
300 | 300 | { |
301 | 301 | $currentSection = TTableRowSection::Header; |
302 | 302 | $writer->writeLine(); |
303 | - foreach($this->getControls() as $index => $row) |
|
303 | + foreach ($this->getControls() as $index => $row) |
|
304 | 304 | { |
305 | - if(($section = $row->getTableSection()) === $currentSection) |
|
305 | + if (($section = $row->getTableSection()) === $currentSection) |
|
306 | 306 | { |
307 | - if($index === 0 && $currentSection === TTableRowSection::Header) |
|
307 | + if ($index === 0 && $currentSection === TTableRowSection::Header) |
|
308 | 308 | $writer->renderBeginTag('thead'); |
309 | 309 | } |
310 | 310 | else |
311 | 311 | { |
312 | - if($currentSection === TTableRowSection::Header) |
|
312 | + if ($currentSection === TTableRowSection::Header) |
|
313 | 313 | { |
314 | - if($index > 0) |
|
314 | + if ($index > 0) |
|
315 | 315 | $writer->renderEndTag(); |
316 | - if($section === TTableRowSection::Body) |
|
316 | + if ($section === TTableRowSection::Body) |
|
317 | 317 | $writer->renderBeginTag('tbody'); |
318 | 318 | else |
319 | 319 | $writer->renderBeginTag('tfoot'); |
320 | 320 | $currentSection = $section; |
321 | 321 | } |
322 | - elseif($currentSection === TTableRowSection::Body) |
|
322 | + elseif ($currentSection === TTableRowSection::Body) |
|
323 | 323 | { |
324 | 324 | $writer->renderEndTag(); |
325 | - if($section === TTableRowSection::Footer) |
|
325 | + if ($section === TTableRowSection::Footer) |
|
326 | 326 | $writer->renderBeginTag('tfoot'); |
327 | 327 | else |
328 | 328 | throw new TConfigurationException('table_tablesection_outoforder'); |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | else |
340 | 340 | { |
341 | 341 | $writer->writeLine(); |
342 | - foreach($this->getControls() as $row) |
|
342 | + foreach ($this->getControls() as $row) |
|
343 | 343 | { |
344 | 344 | $row->renderControl($writer); |
345 | 345 | $writer->writeLine(); |
@@ -81,8 +81,9 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function addParsedObject($object) |
83 | 83 | { |
84 | - if($object instanceof TTableRow) |
|
85 | - $this->getRows()->add($object); |
|
84 | + if($object instanceof TTableRow) { |
|
85 | + $this->getRows()->add($object); |
|
86 | + } |
|
86 | 87 | } |
87 | 88 | |
88 | 89 | /** |
@@ -107,10 +108,11 @@ discard block |
||
107 | 108 | { |
108 | 109 | if($this->getGridLines() !== TTableGridLines::None) |
109 | 110 | { |
110 | - if(($border = $this->getBorderWidth()) === '') |
|
111 | - $border = 1; |
|
112 | - else |
|
113 | - $border = (int)$border; |
|
111 | + if(($border = $this->getBorderWidth()) === '') { |
|
112 | + $border = 1; |
|
113 | + } else { |
|
114 | + $border = (int)$border; |
|
115 | + } |
|
114 | 116 | } |
115 | 117 | } |
116 | 118 | $writer->addAttribute('border', "$border"); |
@@ -171,10 +173,11 @@ discard block |
||
171 | 173 | */ |
172 | 174 | public function getCellSpacing() |
173 | 175 | { |
174 | - if($this->getHasStyle()) |
|
175 | - return $this->getStyle()->getCellSpacing(); |
|
176 | - else |
|
177 | - return -1; |
|
176 | + if($this->getHasStyle()) { |
|
177 | + return $this->getStyle()->getCellSpacing(); |
|
178 | + } else { |
|
179 | + return -1; |
|
180 | + } |
|
178 | 181 | } |
179 | 182 | |
180 | 183 | /** |
@@ -190,10 +193,11 @@ discard block |
||
190 | 193 | */ |
191 | 194 | public function getCellPadding() |
192 | 195 | { |
193 | - if($this->getHasStyle()) |
|
194 | - return $this->getStyle()->getCellPadding(); |
|
195 | - else |
|
196 | - return -1; |
|
196 | + if($this->getHasStyle()) { |
|
197 | + return $this->getStyle()->getCellPadding(); |
|
198 | + } else { |
|
199 | + return -1; |
|
200 | + } |
|
197 | 201 | } |
198 | 202 | |
199 | 203 | /** |
@@ -209,10 +213,11 @@ discard block |
||
209 | 213 | */ |
210 | 214 | public function getHorizontalAlign() |
211 | 215 | { |
212 | - if($this->getHasStyle()) |
|
213 | - return $this->getStyle()->getHorizontalAlign(); |
|
214 | - else |
|
215 | - return THorizontalAlign::NotSet; |
|
216 | + if($this->getHasStyle()) { |
|
217 | + return $this->getStyle()->getHorizontalAlign(); |
|
218 | + } else { |
|
219 | + return THorizontalAlign::NotSet; |
|
220 | + } |
|
216 | 221 | } |
217 | 222 | |
218 | 223 | /** |
@@ -228,10 +233,11 @@ discard block |
||
228 | 233 | */ |
229 | 234 | public function getGridLines() |
230 | 235 | { |
231 | - if($this->getHasStyle()) |
|
232 | - return $this->getStyle()->getGridLines(); |
|
233 | - else |
|
234 | - return TTableGridLines::None; |
|
236 | + if($this->getHasStyle()) { |
|
237 | + return $this->getStyle()->getGridLines(); |
|
238 | + } else { |
|
239 | + return TTableGridLines::None; |
|
240 | + } |
|
235 | 241 | } |
236 | 242 | |
237 | 243 | /** |
@@ -247,10 +253,11 @@ discard block |
||
247 | 253 | */ |
248 | 254 | public function getBackImageUrl() |
249 | 255 | { |
250 | - if($this->getHasStyle()) |
|
251 | - return $this->getStyle()->getBackImageUrl(); |
|
252 | - else |
|
253 | - return ''; |
|
256 | + if($this->getHasStyle()) { |
|
257 | + return $this->getStyle()->getBackImageUrl(); |
|
258 | + } else { |
|
259 | + return ''; |
|
260 | + } |
|
254 | 261 | } |
255 | 262 | |
256 | 263 | /** |
@@ -271,8 +278,9 @@ discard block |
||
271 | 278 | parent::renderBeginTag($writer); |
272 | 279 | if(($caption = $this->getCaption()) !== '') |
273 | 280 | { |
274 | - if(($align = $this->getCaptionAlign()) !== TTableCaptionAlign::NotSet) |
|
275 | - $writer->addAttribute('align', strtolower($align)); |
|
281 | + if(($align = $this->getCaptionAlign()) !== TTableCaptionAlign::NotSet) { |
|
282 | + $writer->addAttribute('align', strtolower($align)); |
|
283 | + } |
|
276 | 284 | $writer->renderBeginTag('caption'); |
277 | 285 | $writer->write($caption); |
278 | 286 | $writer->renderEndTag(); |
@@ -304,39 +312,41 @@ discard block |
||
304 | 312 | { |
305 | 313 | if(($section = $row->getTableSection()) === $currentSection) |
306 | 314 | { |
307 | - if($index === 0 && $currentSection === TTableRowSection::Header) |
|
308 | - $writer->renderBeginTag('thead'); |
|
309 | - } |
|
310 | - else |
|
315 | + if($index === 0 && $currentSection === TTableRowSection::Header) { |
|
316 | + $writer->renderBeginTag('thead'); |
|
317 | + } |
|
318 | + } else |
|
311 | 319 | { |
312 | 320 | if($currentSection === TTableRowSection::Header) |
313 | 321 | { |
314 | - if($index > 0) |
|
315 | - $writer->renderEndTag(); |
|
316 | - if($section === TTableRowSection::Body) |
|
317 | - $writer->renderBeginTag('tbody'); |
|
318 | - else |
|
319 | - $writer->renderBeginTag('tfoot'); |
|
322 | + if($index > 0) { |
|
323 | + $writer->renderEndTag(); |
|
324 | + } |
|
325 | + if($section === TTableRowSection::Body) { |
|
326 | + $writer->renderBeginTag('tbody'); |
|
327 | + } else { |
|
328 | + $writer->renderBeginTag('tfoot'); |
|
329 | + } |
|
320 | 330 | $currentSection = $section; |
321 | - } |
|
322 | - elseif($currentSection === TTableRowSection::Body) |
|
331 | + } elseif($currentSection === TTableRowSection::Body) |
|
323 | 332 | { |
324 | 333 | $writer->renderEndTag(); |
325 | - if($section === TTableRowSection::Footer) |
|
326 | - $writer->renderBeginTag('tfoot'); |
|
327 | - else |
|
328 | - throw new TConfigurationException('table_tablesection_outoforder'); |
|
334 | + if($section === TTableRowSection::Footer) { |
|
335 | + $writer->renderBeginTag('tfoot'); |
|
336 | + } else { |
|
337 | + throw new TConfigurationException('table_tablesection_outoforder'); |
|
338 | + } |
|
329 | 339 | $currentSection = $section; |
330 | - } |
|
331 | - else // Footer |
|
340 | + } else { |
|
341 | + // Footer |
|
332 | 342 | throw new TConfigurationException('table_tablesection_outoforder'); |
343 | + } |
|
333 | 344 | } |
334 | 345 | $row->renderControl($writer); |
335 | 346 | $writer->writeLine(); |
336 | 347 | } |
337 | 348 | $writer->renderEndTag(); |
338 | - } |
|
339 | - else |
|
349 | + } else |
|
340 | 350 | { |
341 | 351 | $writer->writeLine(); |
342 | 352 | foreach($this->getControls() as $row) |