@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function insertAt($index, $item) |
36 | 36 | { |
37 | - if($item instanceof TAccordionView) |
|
37 | + if ($item instanceof TAccordionView) |
|
38 | 38 | parent::insertAt($index, $item); |
39 | 39 | else |
40 | 40 | throw new TInvalidDataTypeException('tabviewcollection_tabview_required'); |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function findIndexByID($id) |
49 | 49 | { |
50 | - foreach($this as $index => $view) |
|
50 | + foreach ($this as $index => $view) |
|
51 | 51 | { |
52 | - if($view->getID(false) === $id) |
|
52 | + if ($view->getID(false) === $id) |
|
53 | 53 | return $index; |
54 | 54 | } |
55 | 55 | return -1; |
@@ -34,10 +34,11 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function insertAt($index, $item) |
36 | 36 | { |
37 | - if($item instanceof TAccordionView) |
|
38 | - parent::insertAt($index, $item); |
|
39 | - else |
|
40 | - throw new TInvalidDataTypeException('tabviewcollection_tabview_required'); |
|
37 | + if($item instanceof TAccordionView) { |
|
38 | + parent::insertAt($index, $item); |
|
39 | + } else { |
|
40 | + throw new TInvalidDataTypeException('tabviewcollection_tabview_required'); |
|
41 | + } |
|
41 | 42 | } |
42 | 43 | |
43 | 44 | /** |
@@ -49,8 +50,9 @@ discard block |
||
49 | 50 | { |
50 | 51 | foreach($this as $index => $view) |
51 | 52 | { |
52 | - if($view->getID(false) === $id) |
|
53 | - return $index; |
|
53 | + if($view->getID(false) === $id) { |
|
54 | + return $index; |
|
55 | + } |
|
54 | 56 | } |
55 | 57 | return -1; |
56 | 58 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function getStyle() |
54 | 54 | { |
55 | - if($style = $this->getViewState('Style', null)) |
|
55 | + if ($style = $this->getViewState('Style', null)) |
|
56 | 56 | return $style; |
57 | 57 | else |
58 | 58 | { |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function bubbleEvent($sender, $param) |
81 | 81 | { |
82 | - if($param instanceof \Prado\Web\UI\TCommandEventParameter) |
|
82 | + if ($param instanceof \Prado\Web\UI\TCommandEventParameter) |
|
83 | 83 | { |
84 | 84 | $this->raiseBubbleEvent($this, new TDataListCommandEventParameter($this, $sender, $param)); |
85 | 85 | return true; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | protected function addAttributesToRender($writer) |
110 | 110 | { |
111 | - if($style = $this->getViewState('Style', null)) |
|
111 | + if ($style = $this->getViewState('Style', null)) |
|
112 | 112 | $style->addAttributesToRender($writer); |
113 | 113 | } |
114 | 114 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public function render($writer) |
126 | 126 | { |
127 | - if($this->getTagName() !== '') |
|
127 | + if ($this->getTagName() !== '') |
|
128 | 128 | { |
129 | 129 | $this->renderBeginTag($writer); |
130 | 130 | $this->renderContents($writer); |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function getStyle() |
54 | 54 | { |
55 | - if($style = $this->getViewState('Style', null)) |
|
56 | - return $style; |
|
57 | - else |
|
55 | + if($style = $this->getViewState('Style', null)) { |
|
56 | + return $style; |
|
57 | + } else |
|
58 | 58 | { |
59 | 59 | $style = $this->createStyle(); |
60 | 60 | $this->setViewState('Style', $style, null); |
@@ -83,9 +83,9 @@ discard block |
||
83 | 83 | { |
84 | 84 | $this->raiseBubbleEvent($this, new TDataListCommandEventParameter($this, $sender, $param)); |
85 | 85 | return true; |
86 | + } else { |
|
87 | + return false; |
|
86 | 88 | } |
87 | - else |
|
88 | - return false; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -108,8 +108,9 @@ discard block |
||
108 | 108 | */ |
109 | 109 | protected function addAttributesToRender($writer) |
110 | 110 | { |
111 | - if($style = $this->getViewState('Style', null)) |
|
112 | - $style->addAttributesToRender($writer); |
|
111 | + if($style = $this->getViewState('Style', null)) { |
|
112 | + $style->addAttributesToRender($writer); |
|
113 | + } |
|
113 | 114 | } |
114 | 115 | |
115 | 116 | /** |
@@ -129,9 +130,9 @@ discard block |
||
129 | 130 | $this->renderBeginTag($writer); |
130 | 131 | $this->renderContents($writer); |
131 | 132 | $this->renderEndTag($writer); |
133 | + } else { |
|
134 | + $this->renderContents($writer); |
|
132 | 135 | } |
133 | - else |
|
134 | - $this->renderContents($writer); |
|
135 | 136 | } |
136 | 137 | |
137 | 138 | /** |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | public function evaluateIsValid() |
87 | 87 | { |
88 | 88 | $value = ''; |
89 | - if($this->getValidationTarget() !== null) |
|
89 | + if ($this->getValidationTarget() !== null) |
|
90 | 90 | $value = $this->getValidationValue($this->getValidationTarget()); |
91 | 91 | return $this->onServerValidate($value); |
92 | 92 | } |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function getValidationTarget() |
114 | 114 | { |
115 | - if(($id = $this->getControlToValidate()) !== '' && ($control = $this->findControl($id)) !== null) |
|
115 | + if (($id = $this->getControlToValidate()) !== '' && ($control = $this->findControl($id)) !== null) |
|
116 | 116 | return $control; |
117 | - elseif(($id = $this->getControlToValidate()) !== '') |
|
117 | + elseif (($id = $this->getControlToValidate()) !== '') |
|
118 | 118 | throw new TInvalidDataTypeException('basevalidator_validatable_required', get_class($this)); |
119 | 119 | else |
120 | 120 | return null; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | protected function getClientScriptOptions() |
128 | 128 | { |
129 | 129 | $options = parent::getClientScriptOptions(); |
130 | - if(($clientJs = $this->getClientValidationFunction()) !== '') |
|
130 | + if (($clientJs = $this->getClientValidationFunction()) !== '') |
|
131 | 131 | $options['ClientValidationFunction'] = $clientJs; |
132 | 132 | return $options; |
133 | 133 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | protected function registerClientScriptValidator() |
140 | 140 | { |
141 | - if($this->getClientValidationFunction() !== '') |
|
141 | + if ($this->getClientValidationFunction() !== '') |
|
142 | 142 | parent::registerClientScriptValidator(); |
143 | 143 | } |
144 | 144 | } |
145 | 145 | \ No newline at end of file |
@@ -86,8 +86,9 @@ discard block |
||
86 | 86 | public function evaluateIsValid() |
87 | 87 | { |
88 | 88 | $value = ''; |
89 | - if($this->getValidationTarget() !== null) |
|
90 | - $value = $this->getValidationValue($this->getValidationTarget()); |
|
89 | + if($this->getValidationTarget() !== null) { |
|
90 | + $value = $this->getValidationValue($this->getValidationTarget()); |
|
91 | + } |
|
91 | 92 | return $this->onServerValidate($value); |
92 | 93 | } |
93 | 94 | |
@@ -112,12 +113,13 @@ discard block |
||
112 | 113 | */ |
113 | 114 | public function getValidationTarget() |
114 | 115 | { |
115 | - if(($id = $this->getControlToValidate()) !== '' && ($control = $this->findControl($id)) !== null) |
|
116 | - return $control; |
|
117 | - elseif(($id = $this->getControlToValidate()) !== '') |
|
118 | - throw new TInvalidDataTypeException('basevalidator_validatable_required', get_class($this)); |
|
119 | - else |
|
120 | - return null; |
|
116 | + if(($id = $this->getControlToValidate()) !== '' && ($control = $this->findControl($id)) !== null) { |
|
117 | + return $control; |
|
118 | + } elseif(($id = $this->getControlToValidate()) !== '') { |
|
119 | + throw new TInvalidDataTypeException('basevalidator_validatable_required', get_class($this)); |
|
120 | + } else { |
|
121 | + return null; |
|
122 | + } |
|
121 | 123 | } |
122 | 124 | |
123 | 125 | /** |
@@ -127,8 +129,9 @@ discard block |
||
127 | 129 | protected function getClientScriptOptions() |
128 | 130 | { |
129 | 131 | $options = parent::getClientScriptOptions(); |
130 | - if(($clientJs = $this->getClientValidationFunction()) !== '') |
|
131 | - $options['ClientValidationFunction'] = $clientJs; |
|
132 | + if(($clientJs = $this->getClientValidationFunction()) !== '') { |
|
133 | + $options['ClientValidationFunction'] = $clientJs; |
|
134 | + } |
|
132 | 135 | return $options; |
133 | 136 | } |
134 | 137 | |
@@ -138,7 +141,8 @@ discard block |
||
138 | 141 | */ |
139 | 142 | protected function registerClientScriptValidator() |
140 | 143 | { |
141 | - if($this->getClientValidationFunction() !== '') |
|
142 | - parent::registerClientScriptValidator(); |
|
144 | + if($this->getClientValidationFunction() !== '') { |
|
145 | + parent::registerClientScriptValidator(); |
|
146 | + } |
|
143 | 147 | } |
144 | 148 | } |
145 | 149 | \ No newline at end of file |
@@ -54,13 +54,13 @@ discard block |
||
54 | 54 | public function copyFrom($style) |
55 | 55 | { |
56 | 56 | parent::copyFrom($style); |
57 | - if($style instanceof TWizardNavigationButtonStyle) |
|
57 | + if ($style instanceof TWizardNavigationButtonStyle) |
|
58 | 58 | { |
59 | - if($this->_imageUrl === null && $style->_imageUrl !== null) |
|
59 | + if ($this->_imageUrl === null && $style->_imageUrl !== null) |
|
60 | 60 | $this->_imageUrl = $style->_imageUrl; |
61 | - if($this->_buttonText === null && $style->_buttonText !== null) |
|
61 | + if ($this->_buttonText === null && $style->_buttonText !== null) |
|
62 | 62 | $this->_buttonText = $style->_buttonText; |
63 | - if($this->_buttonType === null && $style->_buttonType !== null) |
|
63 | + if ($this->_buttonType === null && $style->_buttonType !== null) |
|
64 | 64 | $this->_buttonType = $style->_buttonType; |
65 | 65 | } |
66 | 66 | } |
@@ -74,13 +74,13 @@ discard block |
||
74 | 74 | public function mergeWith($style) |
75 | 75 | { |
76 | 76 | parent::mergeWith($style); |
77 | - if($style instanceof TWizardNavigationButtonStyle) |
|
77 | + if ($style instanceof TWizardNavigationButtonStyle) |
|
78 | 78 | { |
79 | - if($style->_imageUrl !== null) |
|
79 | + if ($style->_imageUrl !== null) |
|
80 | 80 | $this->_imageUrl = $style->_imageUrl; |
81 | - if($style->_buttonText !== null) |
|
81 | + if ($style->_buttonText !== null) |
|
82 | 82 | $this->_buttonText = $style->_buttonText; |
83 | - if($style->_buttonType !== null) |
|
83 | + if ($style->_buttonType !== null) |
|
84 | 84 | $this->_buttonType = $style->_buttonType; |
85 | 85 | } |
86 | 86 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function getImageUrl() |
92 | 92 | { |
93 | - return $this->_imageUrl === null?'':$this->_imageUrl; |
|
93 | + return $this->_imageUrl === null ? '' : $this->_imageUrl; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function getButtonText() |
108 | 108 | { |
109 | - return $this->_buttonText === null?'':$this->_buttonText; |
|
109 | + return $this->_buttonText === null ? '' : $this->_buttonText; |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function getButtonType() |
124 | 124 | { |
125 | - return $this->_buttonType === null? TWizardNavigationButtonType::Button :$this->_buttonType; |
|
125 | + return $this->_buttonType === null ? TWizardNavigationButtonType::Button : $this->_buttonType; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -139,12 +139,12 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public function apply($button) |
141 | 141 | { |
142 | - if($button instanceof TImageButton) |
|
142 | + if ($button instanceof TImageButton) |
|
143 | 143 | { |
144 | - if($button->getImageUrl() === '') |
|
144 | + if ($button->getImageUrl() === '') |
|
145 | 145 | $button->setImageUrl($this->getImageUrl()); |
146 | 146 | } |
147 | - if($button->getText() === '') |
|
147 | + if ($button->getText() === '') |
|
148 | 148 | $button->setText($this->getButtonText()); |
149 | 149 | $button->getStyle()->mergeWith($this); |
150 | 150 | } |
@@ -56,12 +56,15 @@ discard block |
||
56 | 56 | parent::copyFrom($style); |
57 | 57 | if($style instanceof TWizardNavigationButtonStyle) |
58 | 58 | { |
59 | - if($this->_imageUrl === null && $style->_imageUrl !== null) |
|
60 | - $this->_imageUrl = $style->_imageUrl; |
|
61 | - if($this->_buttonText === null && $style->_buttonText !== null) |
|
62 | - $this->_buttonText = $style->_buttonText; |
|
63 | - if($this->_buttonType === null && $style->_buttonType !== null) |
|
64 | - $this->_buttonType = $style->_buttonType; |
|
59 | + if($this->_imageUrl === null && $style->_imageUrl !== null) { |
|
60 | + $this->_imageUrl = $style->_imageUrl; |
|
61 | + } |
|
62 | + if($this->_buttonText === null && $style->_buttonText !== null) { |
|
63 | + $this->_buttonText = $style->_buttonText; |
|
64 | + } |
|
65 | + if($this->_buttonType === null && $style->_buttonType !== null) { |
|
66 | + $this->_buttonType = $style->_buttonType; |
|
67 | + } |
|
65 | 68 | } |
66 | 69 | } |
67 | 70 | |
@@ -76,12 +79,15 @@ discard block |
||
76 | 79 | parent::mergeWith($style); |
77 | 80 | if($style instanceof TWizardNavigationButtonStyle) |
78 | 81 | { |
79 | - if($style->_imageUrl !== null) |
|
80 | - $this->_imageUrl = $style->_imageUrl; |
|
81 | - if($style->_buttonText !== null) |
|
82 | - $this->_buttonText = $style->_buttonText; |
|
83 | - if($style->_buttonType !== null) |
|
84 | - $this->_buttonType = $style->_buttonType; |
|
82 | + if($style->_imageUrl !== null) { |
|
83 | + $this->_imageUrl = $style->_imageUrl; |
|
84 | + } |
|
85 | + if($style->_buttonText !== null) { |
|
86 | + $this->_buttonText = $style->_buttonText; |
|
87 | + } |
|
88 | + if($style->_buttonType !== null) { |
|
89 | + $this->_buttonType = $style->_buttonType; |
|
90 | + } |
|
85 | 91 | } |
86 | 92 | } |
87 | 93 | |
@@ -141,11 +147,13 @@ discard block |
||
141 | 147 | { |
142 | 148 | if($button instanceof TImageButton) |
143 | 149 | { |
144 | - if($button->getImageUrl() === '') |
|
145 | - $button->setImageUrl($this->getImageUrl()); |
|
150 | + if($button->getImageUrl() === '') { |
|
151 | + $button->setImageUrl($this->getImageUrl()); |
|
152 | + } |
|
153 | + } |
|
154 | + if($button->getText() === '') { |
|
155 | + $button->setText($this->getButtonText()); |
|
146 | 156 | } |
147 | - if($button->getText() === '') |
|
148 | - $button->setText($this->getButtonText()); |
|
149 | 157 | $button->getStyle()->mergeWith($this); |
150 | 158 | } |
151 | 159 | } |
@@ -101,9 +101,9 @@ |
||
101 | 101 | */ |
102 | 102 | public function render($writer) |
103 | 103 | { |
104 | - if(($text = $this->getText()) !== '') |
|
104 | + if (($text = $this->getText()) !== '') |
|
105 | 105 | { |
106 | - if($this->getEncode()) |
|
106 | + if ($this->getEncode()) |
|
107 | 107 | $writer->write(THttpUtility::htmlEncode($text)); |
108 | 108 | else |
109 | 109 | $writer->write($text); |
@@ -103,13 +103,14 @@ |
||
103 | 103 | { |
104 | 104 | if(($text = $this->getText()) !== '') |
105 | 105 | { |
106 | - if($this->getEncode()) |
|
107 | - $writer->write(THttpUtility::htmlEncode($text)); |
|
108 | - else |
|
109 | - $writer->write($text); |
|
106 | + if($this->getEncode()) { |
|
107 | + $writer->write(THttpUtility::htmlEncode($text)); |
|
108 | + } else { |
|
109 | + $writer->write($text); |
|
110 | + } |
|
111 | + } else { |
|
112 | + parent::render($writer); |
|
110 | 113 | } |
111 | - else |
|
112 | - parent::render($writer); |
|
113 | 114 | } |
114 | 115 | } |
115 | 116 |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | { |
78 | 78 | parent::loadState($state); |
79 | 79 | $this->_stateLoaded = true; |
80 | - if(!$this->_dataBound) |
|
80 | + if (!$this->_dataBound) |
|
81 | 81 | $this->_listControl->getItems()->loadState($this->getViewState('Items', null)); |
82 | 82 | } |
83 | 83 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | public function addParsedObject($object) |
101 | 101 | { |
102 | 102 | // Do not add items from template if items are loaded from viewstate |
103 | - if(!$this->_stateLoaded && ($object instanceof TListItem)) |
|
103 | + if (!$this->_stateLoaded && ($object instanceof TListItem)) |
|
104 | 104 | { |
105 | 105 | $object->setSelected(false); |
106 | 106 | $index = $this->_listControl->getItems()->add($object); |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | */ |
255 | 255 | public function initializeCell($cell, $columnIndex, $itemType) |
256 | 256 | { |
257 | - if(!$this->_dataBound && $this->_listControl->getDataSource() !== null) |
|
257 | + if (!$this->_dataBound && $this->_listControl->getDataSource() !== null) |
|
258 | 258 | { |
259 | 259 | $this->_listControl->setDataTextField($this->getListTextField()); |
260 | 260 | $this->_listControl->setDataValueField($this->getListValueField()); |
@@ -262,10 +262,10 @@ discard block |
||
262 | 262 | $this->_listControl->dataBind(); |
263 | 263 | $this->_dataBound = true; |
264 | 264 | } |
265 | - switch($itemType) |
|
265 | + switch ($itemType) |
|
266 | 266 | { |
267 | 267 | case TListItemType::EditItem: |
268 | - if(!$this->getReadOnly()) |
|
268 | + if (!$this->getReadOnly()) |
|
269 | 269 | { |
270 | 270 | $listControl = clone $this->_listControl; |
271 | 271 | $cell->getControls()->add($listControl); |
@@ -274,13 +274,13 @@ discard block |
||
274 | 274 | } |
275 | 275 | else |
276 | 276 | $control = $cell; |
277 | - $control->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']); |
|
277 | + $control->attachEventHandler('OnDataBinding', [$this, 'dataBindColumn']); |
|
278 | 278 | break; |
279 | 279 | case TListItemType::Item: |
280 | 280 | case TListItemType::AlternatingItem: |
281 | 281 | case TListItemType::SelectedItem: |
282 | - if($this->getDataTextField() !== '' || $this->getDataValueField() !== '') |
|
283 | - $cell->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']); |
|
282 | + if ($this->getDataTextField() !== '' || $this->getDataValueField() !== '') |
|
283 | + $cell->attachEventHandler('OnDataBinding', [$this, 'dataBindColumn']); |
|
284 | 284 | break; |
285 | 285 | default: |
286 | 286 | parent::initializeCell($cell, $columnIndex, $itemType); |
@@ -297,23 +297,23 @@ discard block |
||
297 | 297 | { |
298 | 298 | $item = $sender->getNamingContainer(); |
299 | 299 | $data = $item->getData(); |
300 | - if(($valueField = $this->getDataValueField()) !== '') |
|
300 | + if (($valueField = $this->getDataValueField()) !== '') |
|
301 | 301 | $value = $this->getDataFieldValue($data, $valueField); |
302 | 302 | else |
303 | 303 | $value = ''; |
304 | - if(($textField = $this->getDataTextField()) !== '') |
|
304 | + if (($textField = $this->getDataTextField()) !== '') |
|
305 | 305 | { |
306 | 306 | $text = $this->getDataFieldValue($data, $textField); |
307 | - if($valueField === '') |
|
307 | + if ($valueField === '') |
|
308 | 308 | $value = $text; |
309 | 309 | $formatString = $this->getDataTextFormatString(); |
310 | 310 | $text = $this->formatDataValue($formatString, $text); |
311 | 311 | } |
312 | 312 | else |
313 | 313 | $text = $value; |
314 | - if($sender instanceof TTableCell) |
|
314 | + if ($sender instanceof TTableCell) |
|
315 | 315 | $sender->setText($text); |
316 | - elseif($sender instanceof TDropDownList) |
|
316 | + elseif ($sender instanceof TDropDownList) |
|
317 | 317 | $sender->setSelectedValue($value); |
318 | 318 | } |
319 | 319 | } |
@@ -77,8 +77,9 @@ discard block |
||
77 | 77 | { |
78 | 78 | parent::loadState($state); |
79 | 79 | $this->_stateLoaded = true; |
80 | - if(!$this->_dataBound) |
|
81 | - $this->_listControl->getItems()->loadState($this->getViewState('Items', null)); |
|
80 | + if(!$this->_dataBound) { |
|
81 | + $this->_listControl->getItems()->loadState($this->getViewState('Items', null)); |
|
82 | + } |
|
82 | 83 | } |
83 | 84 | |
84 | 85 | /** |
@@ -271,16 +272,17 @@ discard block |
||
271 | 272 | $cell->getControls()->add($listControl); |
272 | 273 | $cell->registerObject('DropDownList', $listControl); |
273 | 274 | $control = $listControl; |
275 | + } else { |
|
276 | + $control = $cell; |
|
274 | 277 | } |
275 | - else |
|
276 | - $control = $cell; |
|
277 | 278 | $control->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']); |
278 | 279 | break; |
279 | 280 | case TListItemType::Item: |
280 | 281 | case TListItemType::AlternatingItem: |
281 | 282 | case TListItemType::SelectedItem: |
282 | - if($this->getDataTextField() !== '' || $this->getDataValueField() !== '') |
|
283 | - $cell->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']); |
|
283 | + if($this->getDataTextField() !== '' || $this->getDataValueField() !== '') { |
|
284 | + $cell->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']); |
|
285 | + } |
|
284 | 286 | break; |
285 | 287 | default: |
286 | 288 | parent::initializeCell($cell, $columnIndex, $itemType); |
@@ -297,24 +299,27 @@ discard block |
||
297 | 299 | { |
298 | 300 | $item = $sender->getNamingContainer(); |
299 | 301 | $data = $item->getData(); |
300 | - if(($valueField = $this->getDataValueField()) !== '') |
|
301 | - $value = $this->getDataFieldValue($data, $valueField); |
|
302 | - else |
|
303 | - $value = ''; |
|
302 | + if(($valueField = $this->getDataValueField()) !== '') { |
|
303 | + $value = $this->getDataFieldValue($data, $valueField); |
|
304 | + } else { |
|
305 | + $value = ''; |
|
306 | + } |
|
304 | 307 | if(($textField = $this->getDataTextField()) !== '') |
305 | 308 | { |
306 | 309 | $text = $this->getDataFieldValue($data, $textField); |
307 | - if($valueField === '') |
|
308 | - $value = $text; |
|
310 | + if($valueField === '') { |
|
311 | + $value = $text; |
|
312 | + } |
|
309 | 313 | $formatString = $this->getDataTextFormatString(); |
310 | 314 | $text = $this->formatDataValue($formatString, $text); |
315 | + } else { |
|
316 | + $text = $value; |
|
317 | + } |
|
318 | + if($sender instanceof TTableCell) { |
|
319 | + $sender->setText($text); |
|
320 | + } elseif($sender instanceof TDropDownList) { |
|
321 | + $sender->setSelectedValue($value); |
|
311 | 322 | } |
312 | - else |
|
313 | - $text = $value; |
|
314 | - if($sender instanceof TTableCell) |
|
315 | - $sender->setText($text); |
|
316 | - elseif($sender instanceof TDropDownList) |
|
317 | - $sender->setSelectedValue($value); |
|
318 | 323 | } |
319 | 324 | } |
320 | 325 |
@@ -106,7 +106,7 @@ |
||
106 | 106 | */ |
107 | 107 | public function bubbleEvent($sender, $param) |
108 | 108 | { |
109 | - if($param instanceof \Prado\Web\UI\TCommandEventParameter) |
|
109 | + if ($param instanceof \Prado\Web\UI\TCommandEventParameter) |
|
110 | 110 | { |
111 | 111 | $this->raiseBubbleEvent($this, new TRepeaterCommandEventParameter($this, $sender, $param)); |
112 | 112 | return true; |
@@ -110,8 +110,8 @@ |
||
110 | 110 | { |
111 | 111 | $this->raiseBubbleEvent($this, new TRepeaterCommandEventParameter($this, $sender, $param)); |
112 | 112 | return true; |
113 | + } else { |
|
114 | + return false; |
|
113 | 115 | } |
114 | - else |
|
115 | - return false; |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | \ No newline at end of file |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | public function setDataSourceID($value) |
99 | 99 | { |
100 | 100 | $dsid = $this->getViewState('DataSourceID', ''); |
101 | - if($dsid !== '' && $value === '') |
|
101 | + if ($dsid !== '' && $value === '') |
|
102 | 102 | $this->_requiresBindToNull = true; |
103 | 103 | $this->setViewState('DataSourceID', $value, ''); |
104 | 104 | $this->onDataSourceChanged(); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | { |
123 | 123 | $this->_currentViewValid = false; |
124 | 124 | $this->_currentDataSourceValid = false; |
125 | - if($this->getInitialized()) |
|
125 | + if ($this->getInitialized()) |
|
126 | 126 | $this->setRequiresDataBinding(true); |
127 | 127 | } |
128 | 128 | |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | */ |
222 | 222 | public function setCurrentPageIndex($value) |
223 | 223 | { |
224 | - if(($value = TPropertyValue::ensureInteger($value)) < 0) |
|
224 | + if (($value = TPropertyValue::ensureInteger($value)) < 0) |
|
225 | 225 | $value = 0; |
226 | 226 | $this->setViewState('CurrentPageIndex', $value, 0); |
227 | 227 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | */ |
241 | 241 | public function setPageSize($value) |
242 | 242 | { |
243 | - if(($value = TPropertyValue::ensureInteger($value)) < 1) |
|
243 | + if (($value = TPropertyValue::ensureInteger($value)) < 1) |
|
244 | 244 | throw new TInvalidDataValueException('databoundcontrol_pagesize_invalid', get_class($this)); |
245 | 245 | $this->setViewState('PageSize', TPropertyValue::ensureInteger($value), 10); |
246 | 246 | } |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | */ |
270 | 270 | public function setVirtualItemCount($value) |
271 | 271 | { |
272 | - if(($value = TPropertyValue::ensureInteger($value)) < 0) |
|
272 | + if (($value = TPropertyValue::ensureInteger($value)) < 0) |
|
273 | 273 | throw new TInvalidDataValueException('databoundcontrol_virtualitemcount_invalid', get_class($this)); |
274 | 274 | $this->setViewState('VirtualItemCount', $value, 0); |
275 | 275 | } |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | protected function setRequiresDataBinding($value) |
284 | 284 | { |
285 | 285 | $value = TPropertyValue::ensureBoolean($value); |
286 | - if($value && $this->_prerendered) |
|
286 | + if ($value && $this->_prerendered) |
|
287 | 287 | { |
288 | 288 | $this->_requiresDataBinding = true; |
289 | 289 | $this->ensureDataBound(); |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | */ |
301 | 301 | protected function ensureDataBound() |
302 | 302 | { |
303 | - if($this->_requiresDataBinding && ($this->getUsingDataSourceID() || $this->_requiresBindToNull)) |
|
303 | + if ($this->_requiresDataBinding && ($this->getUsingDataSourceID() || $this->_requiresBindToNull)) |
|
304 | 304 | { |
305 | 305 | $this->dataBind(); |
306 | 306 | $this->_requiresBindToNull = false; |
@@ -333,19 +333,19 @@ discard block |
||
333 | 333 | $this->dataBindProperties(); |
334 | 334 | $this->onDataBinding(null); |
335 | 335 | |
336 | - if(($view = $this->getDataSourceView()) !== null) |
|
336 | + if (($view = $this->getDataSourceView()) !== null) |
|
337 | 337 | $data = $view->select($this->getSelectParameters()); |
338 | 338 | else |
339 | 339 | $data = null; |
340 | 340 | |
341 | - if($data instanceof \Traversable) |
|
341 | + if ($data instanceof \Traversable) |
|
342 | 342 | { |
343 | - if($this->getAllowPaging()) |
|
343 | + if ($this->getAllowPaging()) |
|
344 | 344 | { |
345 | 345 | $ds = $this->createPagedDataSource(); |
346 | 346 | $ds->setDataSource($data); |
347 | 347 | $this->setViewState('PageCount', $ds->getPageCount()); |
348 | - if($ds->getCurrentPageIndex() >= $ds->getPageCount()) |
|
348 | + if ($ds->getCurrentPageIndex() >= $ds->getPageCount()) |
|
349 | 349 | { |
350 | 350 | $ds->setCurrentPageIndex($ds->getPageCount() - 1); |
351 | 351 | $this->setCurrentPageIndex($ds->getCurrentPageIndex()); |
@@ -364,22 +364,22 @@ discard block |
||
364 | 364 | |
365 | 365 | public function dataSourceViewChanged($sender, $param) |
366 | 366 | { |
367 | - if(!$this->_ignoreDataSourceViewChanged) |
|
367 | + if (!$this->_ignoreDataSourceViewChanged) |
|
368 | 368 | $this->setRequiresDataBinding(true); |
369 | 369 | } |
370 | 370 | |
371 | 371 | protected function getDataSourceView() |
372 | 372 | { |
373 | - if(!$this->_currentViewValid) |
|
373 | + if (!$this->_currentViewValid) |
|
374 | 374 | { |
375 | - if($this->_currentView && $this->_currentViewIsFromDataSourceID) |
|
376 | - $this->_currentView->detachEventHandler('DataSourceViewChanged', [$this,'dataSourceViewChanged']); |
|
377 | - if(($dataSource = $this->determineDataSource()) !== null) |
|
375 | + if ($this->_currentView && $this->_currentViewIsFromDataSourceID) |
|
376 | + $this->_currentView->detachEventHandler('DataSourceViewChanged', [$this, 'dataSourceViewChanged']); |
|
377 | + if (($dataSource = $this->determineDataSource()) !== null) |
|
378 | 378 | { |
379 | - if(($view = $dataSource->getView($this->getDataMember())) === null) |
|
379 | + if (($view = $dataSource->getView($this->getDataMember())) === null) |
|
380 | 380 | throw new TInvalidDataValueException('databoundcontrol_datamember_invalid', $this->getDataMember()); |
381 | - if($this->_currentViewIsFromDataSourceID = $this->getUsingDataSourceID()) |
|
382 | - $view->attachEventHandler('OnDataSourceViewChanged', [$this,'dataSourceViewChanged']); |
|
381 | + if ($this->_currentViewIsFromDataSourceID = $this->getUsingDataSourceID()) |
|
382 | + $view->attachEventHandler('OnDataSourceViewChanged', [$this, 'dataSourceViewChanged']); |
|
383 | 383 | $this->_currentView = $view; |
384 | 384 | } |
385 | 385 | else |
@@ -391,18 +391,18 @@ discard block |
||
391 | 391 | |
392 | 392 | protected function determineDataSource() |
393 | 393 | { |
394 | - if(!$this->_currentDataSourceValid) |
|
394 | + if (!$this->_currentDataSourceValid) |
|
395 | 395 | { |
396 | - if(($dsid = $this->getDataSourceID()) !== '') |
|
396 | + if (($dsid = $this->getDataSourceID()) !== '') |
|
397 | 397 | { |
398 | - if(($dataSource = $this->getNamingContainer()->findControl($dsid)) === null) |
|
398 | + if (($dataSource = $this->getNamingContainer()->findControl($dsid)) === null) |
|
399 | 399 | throw new TInvalidDataValueException('databoundcontrol_datasourceid_inexistent', $dsid); |
400 | - elseif(!($dataSource instanceof IDataSource)) |
|
400 | + elseif (!($dataSource instanceof IDataSource)) |
|
401 | 401 | throw new TInvalidDataValueException('databoundcontrol_datasourceid_invalid', $dsid); |
402 | 402 | else |
403 | 403 | $this->_currentDataSource = $dataSource; |
404 | 404 | } |
405 | - elseif(($dataSource = $this->getDataSource()) !== null) |
|
405 | + elseif (($dataSource = $this->getDataSource()) !== null) |
|
406 | 406 | $this->_currentDataSource = new TReadOnlyDataSource($dataSource, $this->getDataMember()); |
407 | 407 | else |
408 | 408 | $this->_currentDataSource = null; |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | { |
435 | 435 | parent::onInit($param); |
436 | 436 | $page = $this->getPage(); |
437 | - $page->attachEventHandler('OnPreLoad', [$this,'pagePreLoad']); |
|
437 | + $page->attachEventHandler('OnPreLoad', [$this, 'pagePreLoad']); |
|
438 | 438 | } |
439 | 439 | |
440 | 440 | /** |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | { |
448 | 448 | $this->_initialized = true; |
449 | 449 | $isPostBack = $this->getPage()->getIsPostBack(); |
450 | - if(!$isPostBack || ($isPostBack && (!$this->getEnableViewState(true) || !$this->getIsDataBound()))) |
|
450 | + if (!$isPostBack || ($isPostBack && (!$this->getEnableViewState(true) || !$this->getIsDataBound()))) |
|
451 | 451 | $this->setRequiresDataBinding(true); |
452 | 452 | } |
453 | 453 | |
@@ -472,25 +472,25 @@ discard block |
||
472 | 472 | */ |
473 | 473 | protected function validateDataSource($value) |
474 | 474 | { |
475 | - if(is_string($value)) |
|
475 | + if (is_string($value)) |
|
476 | 476 | { |
477 | 477 | $list = new TList; |
478 | - foreach(TPropertyValue::ensureArray($value) as $key => $value) |
|
478 | + foreach (TPropertyValue::ensureArray($value) as $key => $value) |
|
479 | 479 | { |
480 | - if(is_array($value)) |
|
480 | + if (is_array($value)) |
|
481 | 481 | $list->add($value); |
482 | 482 | else |
483 | - $list->add([$value,is_string($key)?$key:$value]); |
|
483 | + $list->add([$value, is_string($key) ? $key : $value]); |
|
484 | 484 | } |
485 | 485 | return $list; |
486 | 486 | } |
487 | - elseif(is_array($value)) |
|
487 | + elseif (is_array($value)) |
|
488 | 488 | return new TMap($value); |
489 | - elseif($value instanceof TDbDataReader) { |
|
489 | + elseif ($value instanceof TDbDataReader) { |
|
490 | 490 | // read array from TDbDataReader since it's forward-only stream and can only be traversed once |
491 | 491 | return $value->readAll(); |
492 | 492 | } |
493 | - elseif(($value instanceof \Traversable) || $value === null) |
|
493 | + elseif (($value instanceof \Traversable) || $value === null) |
|
494 | 494 | return $value; |
495 | 495 | else |
496 | 496 | throw new TInvalidDataTypeException('databoundcontrol_datasource_invalid', get_class($this)); |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | |
509 | 509 | public function getSelectParameters() |
510 | 510 | { |
511 | - if(!$this->_parameters) |
|
511 | + if (!$this->_parameters) |
|
512 | 512 | $this->_parameters = new TDataSourceSelectParameters; |
513 | 513 | return $this->_parameters; |
514 | 514 | } |
@@ -98,8 +98,9 @@ discard block |
||
98 | 98 | public function setDataSourceID($value) |
99 | 99 | { |
100 | 100 | $dsid = $this->getViewState('DataSourceID', ''); |
101 | - if($dsid !== '' && $value === '') |
|
102 | - $this->_requiresBindToNull = true; |
|
101 | + if($dsid !== '' && $value === '') { |
|
102 | + $this->_requiresBindToNull = true; |
|
103 | + } |
|
103 | 104 | $this->setViewState('DataSourceID', $value, ''); |
104 | 105 | $this->onDataSourceChanged(); |
105 | 106 | } |
@@ -122,8 +123,9 @@ discard block |
||
122 | 123 | { |
123 | 124 | $this->_currentViewValid = false; |
124 | 125 | $this->_currentDataSourceValid = false; |
125 | - if($this->getInitialized()) |
|
126 | - $this->setRequiresDataBinding(true); |
|
126 | + if($this->getInitialized()) { |
|
127 | + $this->setRequiresDataBinding(true); |
|
128 | + } |
|
127 | 129 | } |
128 | 130 | |
129 | 131 | /** |
@@ -221,8 +223,9 @@ discard block |
||
221 | 223 | */ |
222 | 224 | public function setCurrentPageIndex($value) |
223 | 225 | { |
224 | - if(($value = TPropertyValue::ensureInteger($value)) < 0) |
|
225 | - $value = 0; |
|
226 | + if(($value = TPropertyValue::ensureInteger($value)) < 0) { |
|
227 | + $value = 0; |
|
228 | + } |
|
226 | 229 | $this->setViewState('CurrentPageIndex', $value, 0); |
227 | 230 | } |
228 | 231 | |
@@ -240,8 +243,9 @@ discard block |
||
240 | 243 | */ |
241 | 244 | public function setPageSize($value) |
242 | 245 | { |
243 | - if(($value = TPropertyValue::ensureInteger($value)) < 1) |
|
244 | - throw new TInvalidDataValueException('databoundcontrol_pagesize_invalid', get_class($this)); |
|
246 | + if(($value = TPropertyValue::ensureInteger($value)) < 1) { |
|
247 | + throw new TInvalidDataValueException('databoundcontrol_pagesize_invalid', get_class($this)); |
|
248 | + } |
|
245 | 249 | $this->setViewState('PageSize', TPropertyValue::ensureInteger($value), 10); |
246 | 250 | } |
247 | 251 | |
@@ -269,8 +273,9 @@ discard block |
||
269 | 273 | */ |
270 | 274 | public function setVirtualItemCount($value) |
271 | 275 | { |
272 | - if(($value = TPropertyValue::ensureInteger($value)) < 0) |
|
273 | - throw new TInvalidDataValueException('databoundcontrol_virtualitemcount_invalid', get_class($this)); |
|
276 | + if(($value = TPropertyValue::ensureInteger($value)) < 0) { |
|
277 | + throw new TInvalidDataValueException('databoundcontrol_virtualitemcount_invalid', get_class($this)); |
|
278 | + } |
|
274 | 279 | $this->setViewState('VirtualItemCount', $value, 0); |
275 | 280 | } |
276 | 281 | |
@@ -287,9 +292,9 @@ discard block |
||
287 | 292 | { |
288 | 293 | $this->_requiresDataBinding = true; |
289 | 294 | $this->ensureDataBound(); |
295 | + } else { |
|
296 | + $this->_requiresDataBinding = $value; |
|
290 | 297 | } |
291 | - else |
|
292 | - $this->_requiresDataBinding = $value; |
|
293 | 298 | } |
294 | 299 | |
295 | 300 | /** |
@@ -333,10 +338,11 @@ discard block |
||
333 | 338 | $this->dataBindProperties(); |
334 | 339 | $this->onDataBinding(null); |
335 | 340 | |
336 | - if(($view = $this->getDataSourceView()) !== null) |
|
337 | - $data = $view->select($this->getSelectParameters()); |
|
338 | - else |
|
339 | - $data = null; |
|
341 | + if(($view = $this->getDataSourceView()) !== null) { |
|
342 | + $data = $view->select($this->getSelectParameters()); |
|
343 | + } else { |
|
344 | + $data = null; |
|
345 | + } |
|
340 | 346 | |
341 | 347 | if($data instanceof \Traversable) |
342 | 348 | { |
@@ -351,8 +357,7 @@ discard block |
||
351 | 357 | $this->setCurrentPageIndex($ds->getCurrentPageIndex()); |
352 | 358 | } |
353 | 359 | $this->performDataBinding($ds); |
354 | - } |
|
355 | - else |
|
360 | + } else |
|
356 | 361 | { |
357 | 362 | $this->clearViewState('PageCount'); |
358 | 363 | $this->performDataBinding($data); |
@@ -364,26 +369,30 @@ discard block |
||
364 | 369 | |
365 | 370 | public function dataSourceViewChanged($sender, $param) |
366 | 371 | { |
367 | - if(!$this->_ignoreDataSourceViewChanged) |
|
368 | - $this->setRequiresDataBinding(true); |
|
372 | + if(!$this->_ignoreDataSourceViewChanged) { |
|
373 | + $this->setRequiresDataBinding(true); |
|
374 | + } |
|
369 | 375 | } |
370 | 376 | |
371 | 377 | protected function getDataSourceView() |
372 | 378 | { |
373 | 379 | if(!$this->_currentViewValid) |
374 | 380 | { |
375 | - if($this->_currentView && $this->_currentViewIsFromDataSourceID) |
|
376 | - $this->_currentView->detachEventHandler('DataSourceViewChanged', [$this,'dataSourceViewChanged']); |
|
381 | + if($this->_currentView && $this->_currentViewIsFromDataSourceID) { |
|
382 | + $this->_currentView->detachEventHandler('DataSourceViewChanged', [$this,'dataSourceViewChanged']); |
|
383 | + } |
|
377 | 384 | if(($dataSource = $this->determineDataSource()) !== null) |
378 | 385 | { |
379 | - if(($view = $dataSource->getView($this->getDataMember())) === null) |
|
380 | - throw new TInvalidDataValueException('databoundcontrol_datamember_invalid', $this->getDataMember()); |
|
381 | - if($this->_currentViewIsFromDataSourceID = $this->getUsingDataSourceID()) |
|
382 | - $view->attachEventHandler('OnDataSourceViewChanged', [$this,'dataSourceViewChanged']); |
|
386 | + if(($view = $dataSource->getView($this->getDataMember())) === null) { |
|
387 | + throw new TInvalidDataValueException('databoundcontrol_datamember_invalid', $this->getDataMember()); |
|
388 | + } |
|
389 | + if($this->_currentViewIsFromDataSourceID = $this->getUsingDataSourceID()) { |
|
390 | + $view->attachEventHandler('OnDataSourceViewChanged', [$this,'dataSourceViewChanged']); |
|
391 | + } |
|
383 | 392 | $this->_currentView = $view; |
393 | + } else { |
|
394 | + $this->_currentView = null; |
|
384 | 395 | } |
385 | - else |
|
386 | - $this->_currentView = null; |
|
387 | 396 | $this->_currentViewValid = true; |
388 | 397 | } |
389 | 398 | return $this->_currentView; |
@@ -395,17 +404,18 @@ discard block |
||
395 | 404 | { |
396 | 405 | if(($dsid = $this->getDataSourceID()) !== '') |
397 | 406 | { |
398 | - if(($dataSource = $this->getNamingContainer()->findControl($dsid)) === null) |
|
399 | - throw new TInvalidDataValueException('databoundcontrol_datasourceid_inexistent', $dsid); |
|
400 | - elseif(!($dataSource instanceof IDataSource)) |
|
401 | - throw new TInvalidDataValueException('databoundcontrol_datasourceid_invalid', $dsid); |
|
402 | - else |
|
403 | - $this->_currentDataSource = $dataSource; |
|
407 | + if(($dataSource = $this->getNamingContainer()->findControl($dsid)) === null) { |
|
408 | + throw new TInvalidDataValueException('databoundcontrol_datasourceid_inexistent', $dsid); |
|
409 | + } elseif(!($dataSource instanceof IDataSource)) { |
|
410 | + throw new TInvalidDataValueException('databoundcontrol_datasourceid_invalid', $dsid); |
|
411 | + } else { |
|
412 | + $this->_currentDataSource = $dataSource; |
|
413 | + } |
|
414 | + } elseif(($dataSource = $this->getDataSource()) !== null) { |
|
415 | + $this->_currentDataSource = new TReadOnlyDataSource($dataSource, $this->getDataMember()); |
|
416 | + } else { |
|
417 | + $this->_currentDataSource = null; |
|
404 | 418 | } |
405 | - elseif(($dataSource = $this->getDataSource()) !== null) |
|
406 | - $this->_currentDataSource = new TReadOnlyDataSource($dataSource, $this->getDataMember()); |
|
407 | - else |
|
408 | - $this->_currentDataSource = null; |
|
409 | 419 | $this->_currentDataSourceValid = true; |
410 | 420 | } |
411 | 421 | return $this->_currentDataSource; |
@@ -447,8 +457,9 @@ discard block |
||
447 | 457 | { |
448 | 458 | $this->_initialized = true; |
449 | 459 | $isPostBack = $this->getPage()->getIsPostBack(); |
450 | - if(!$isPostBack || ($isPostBack && (!$this->getEnableViewState(true) || !$this->getIsDataBound()))) |
|
451 | - $this->setRequiresDataBinding(true); |
|
460 | + if(!$isPostBack || ($isPostBack && (!$this->getEnableViewState(true) || !$this->getIsDataBound()))) { |
|
461 | + $this->setRequiresDataBinding(true); |
|
462 | + } |
|
452 | 463 | } |
453 | 464 | |
454 | 465 | /** |
@@ -477,23 +488,23 @@ discard block |
||
477 | 488 | $list = new TList; |
478 | 489 | foreach(TPropertyValue::ensureArray($value) as $key => $value) |
479 | 490 | { |
480 | - if(is_array($value)) |
|
481 | - $list->add($value); |
|
482 | - else |
|
483 | - $list->add([$value,is_string($key)?$key:$value]); |
|
491 | + if(is_array($value)) { |
|
492 | + $list->add($value); |
|
493 | + } else { |
|
494 | + $list->add([$value,is_string($key)?$key:$value]); |
|
495 | + } |
|
484 | 496 | } |
485 | 497 | return $list; |
486 | - } |
|
487 | - elseif(is_array($value)) |
|
488 | - return new TMap($value); |
|
489 | - elseif($value instanceof TDbDataReader) { |
|
498 | + } elseif(is_array($value)) { |
|
499 | + return new TMap($value); |
|
500 | + } elseif($value instanceof TDbDataReader) { |
|
490 | 501 | // read array from TDbDataReader since it's forward-only stream and can only be traversed once |
491 | 502 | return $value->readAll(); |
503 | + } elseif(($value instanceof \Traversable) || $value === null) { |
|
504 | + return $value; |
|
505 | + } else { |
|
506 | + throw new TInvalidDataTypeException('databoundcontrol_datasource_invalid', get_class($this)); |
|
492 | 507 | } |
493 | - elseif(($value instanceof \Traversable) || $value === null) |
|
494 | - return $value; |
|
495 | - else |
|
496 | - throw new TInvalidDataTypeException('databoundcontrol_datasource_invalid', get_class($this)); |
|
497 | 508 | } |
498 | 509 | |
499 | 510 | public function getDataMember() |
@@ -508,8 +519,9 @@ discard block |
||
508 | 519 | |
509 | 520 | public function getSelectParameters() |
510 | 521 | { |
511 | - if(!$this->_parameters) |
|
512 | - $this->_parameters = new TDataSourceSelectParameters; |
|
522 | + if(!$this->_parameters) { |
|
523 | + $this->_parameters = new TDataSourceSelectParameters; |
|
524 | + } |
|
513 | 525 | return $this->_parameters; |
514 | 526 | } |
515 | 527 | } |
516 | 528 | \ No newline at end of file |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | protected function addAttributesToRender($writer) |
47 | 47 | { |
48 | - if(!$this->getActive() && $this->getPage()->getClientSupportsJavaScript()) |
|
48 | + if (!$this->getActive() && $this->getPage()->getClientSupportsJavaScript()) |
|
49 | 49 | $this->getStyle()->setStyleField('display', 'none'); |
50 | 50 | |
51 | 51 | $this->getStyle()->mergeWith($this->getParent()->getViewStyle()); |
@@ -129,9 +129,9 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function renderContents($writer) |
131 | 131 | { |
132 | - if(($text = $this->getText()) !== '') |
|
132 | + if (($text = $this->getText()) !== '') |
|
133 | 133 | $writer->write($text); |
134 | - elseif($this->getHasControls()) |
|
134 | + elseif ($this->getHasControls()) |
|
135 | 135 | parent::renderContents($writer); |
136 | 136 | } |
137 | 137 | |
@@ -141,11 +141,11 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function renderHeader($writer) |
143 | 143 | { |
144 | - if($this->getVisible(false) && $this->getPage()->getClientSupportsJavaScript()) |
|
144 | + if ($this->getVisible(false) && $this->getPage()->getClientSupportsJavaScript()) |
|
145 | 145 | { |
146 | - $writer->addAttribute('id', $this->getClientID() . '_0'); |
|
146 | + $writer->addAttribute('id', $this->getClientID().'_0'); |
|
147 | 147 | |
148 | - $style = $this->getActive()?$this->getParent()->getActiveHeaderStyle():$this->getParent()->getHeaderStyle(); |
|
148 | + $style = $this->getActive() ? $this->getParent()->getActiveHeaderStyle() : $this->getParent()->getHeaderStyle(); |
|
149 | 149 | |
150 | 150 | $style->addAttributesToRender($writer); |
151 | 151 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | protected function renderHeaderContent($writer) |
166 | 166 | { |
167 | 167 | $url = $this->getNavigateUrl(); |
168 | - if(($caption = $this->getCaption()) === '') |
|
168 | + if (($caption = $this->getCaption()) === '') |
|
169 | 169 | $caption = ' '; |
170 | 170 | |
171 | 171 | if ($url != '') |
@@ -45,8 +45,9 @@ discard block |
||
45 | 45 | */ |
46 | 46 | protected function addAttributesToRender($writer) |
47 | 47 | { |
48 | - if(!$this->getActive() && $this->getPage()->getClientSupportsJavaScript()) |
|
49 | - $this->getStyle()->setStyleField('display', 'none'); |
|
48 | + if(!$this->getActive() && $this->getPage()->getClientSupportsJavaScript()) { |
|
49 | + $this->getStyle()->setStyleField('display', 'none'); |
|
50 | + } |
|
50 | 51 | |
51 | 52 | $this->getStyle()->mergeWith($this->getParent()->getViewStyle()); |
52 | 53 | |
@@ -129,10 +130,11 @@ discard block |
||
129 | 130 | */ |
130 | 131 | public function renderContents($writer) |
131 | 132 | { |
132 | - if(($text = $this->getText()) !== '') |
|
133 | - $writer->write($text); |
|
134 | - elseif($this->getHasControls()) |
|
135 | - parent::renderContents($writer); |
|
133 | + if(($text = $this->getText()) !== '') { |
|
134 | + $writer->write($text); |
|
135 | + } elseif($this->getHasControls()) { |
|
136 | + parent::renderContents($writer); |
|
137 | + } |
|
136 | 138 | } |
137 | 139 | |
138 | 140 | /** |
@@ -165,13 +167,16 @@ discard block |
||
165 | 167 | protected function renderHeaderContent($writer) |
166 | 168 | { |
167 | 169 | $url = $this->getNavigateUrl(); |
168 | - if(($caption = $this->getCaption()) === '') |
|
169 | - $caption = ' '; |
|
170 | + if(($caption = $this->getCaption()) === '') { |
|
171 | + $caption = ' '; |
|
172 | + } |
|
170 | 173 | |
171 | - if ($url != '') |
|
172 | - $writer->write("<a href=\"{$url}\">"); |
|
174 | + if ($url != '') { |
|
175 | + $writer->write("<a href=\"{$url}\">"); |
|
176 | + } |
|
173 | 177 | $writer->write("{$caption}"); |
174 | - if ($url != '') |
|
175 | - $writer->write("</a>"); |
|
178 | + if ($url != '') { |
|
179 | + $writer->write("</a>"); |
|
180 | + } |
|
176 | 181 | } |
177 | 182 | } |