@@ -79,9 +79,9 @@ |
||
79 | 79 | */ |
80 | 80 | public function evaluateIsValid() |
81 | 81 | { |
82 | - if(($value = $this->getValidationValue($this->getValidationTarget())) === '') |
|
82 | + if (($value = $this->getValidationValue($this->getValidationTarget())) === '') |
|
83 | 83 | return true; |
84 | - if(($expression = addcslashes($this->getRegularExpression(), "/")) !== '') |
|
84 | + if (($expression = addcslashes($this->getRegularExpression(), "/")) !== '') |
|
85 | 85 | { |
86 | 86 | $mods = $this->getPatternModifiers(); |
87 | 87 | return preg_match("/^$expression\$/{$mods}", $value); |
@@ -79,15 +79,16 @@ |
||
79 | 79 | */ |
80 | 80 | public function evaluateIsValid() |
81 | 81 | { |
82 | - if(($value = $this->getValidationValue($this->getValidationTarget())) === '') |
|
83 | - return true; |
|
82 | + if(($value = $this->getValidationValue($this->getValidationTarget())) === '') { |
|
83 | + return true; |
|
84 | + } |
|
84 | 85 | if(($expression = addcslashes($this->getRegularExpression(), "/")) !== '') |
85 | 86 | { |
86 | 87 | $mods = $this->getPatternModifiers(); |
87 | 88 | return preg_match("/^$expression\$/{$mods}", $value); |
89 | + } else { |
|
90 | + return true; |
|
88 | 91 | } |
89 | - else |
|
90 | - return true; |
|
91 | 92 | } |
92 | 93 | |
93 | 94 | /** |
@@ -220,12 +220,12 @@ discard block |
||
220 | 220 | */ |
221 | 221 | public function initializeCell($cell, $columnIndex, $itemType) |
222 | 222 | { |
223 | - if($itemType === TListItemType::Item || $itemType === TListItemType::AlternatingItem || $itemType === TListItemType::SelectedItem || $itemType === TListItemType::EditItem) |
|
223 | + if ($itemType === TListItemType::Item || $itemType === TListItemType::AlternatingItem || $itemType === TListItemType::SelectedItem || $itemType === TListItemType::EditItem) |
|
224 | 224 | { |
225 | 225 | $buttonType = $this->getButtonType(); |
226 | - if($buttonType === TButtonColumnType::LinkButton) |
|
226 | + if ($buttonType === TButtonColumnType::LinkButton) |
|
227 | 227 | $button = new TLinkButton; |
228 | - elseif($buttonType === TButtonColumnType::PushButton) |
|
228 | + elseif ($buttonType === TButtonColumnType::PushButton) |
|
229 | 229 | $button = new TButton; |
230 | 230 | else // image button |
231 | 231 | { |
@@ -237,8 +237,8 @@ discard block |
||
237 | 237 | $button->setCommandName($this->getCommandName()); |
238 | 238 | $button->setCausesValidation($this->getCausesValidation()); |
239 | 239 | $button->setValidationGroup($this->getValidationGroup()); |
240 | - if($this->getDataTextField() !== '' || ($buttonType === TButtonColumnType::ImageButton && $this->getDataImageUrlField() !== '')) |
|
241 | - $button->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']); |
|
240 | + if ($this->getDataTextField() !== '' || ($buttonType === TButtonColumnType::ImageButton && $this->getDataImageUrlField() !== '')) |
|
241 | + $button->attachEventHandler('OnDataBinding', [$this, 'dataBindColumn']); |
|
242 | 242 | $cell->getControls()->add($button); |
243 | 243 | $cell->registerObject('Button', $button); |
244 | 244 | } |
@@ -253,15 +253,15 @@ discard block |
||
253 | 253 | */ |
254 | 254 | public function dataBindColumn($sender, $param) |
255 | 255 | { |
256 | - if($sender instanceof \Prado\Web\UI\IButtonControl) |
|
256 | + if ($sender instanceof \Prado\Web\UI\IButtonControl) |
|
257 | 257 | { |
258 | - if(($field = $this->getDataTextField()) !== '') |
|
258 | + if (($field = $this->getDataTextField()) !== '') |
|
259 | 259 | { |
260 | 260 | $value = $this->getDataFieldValue($sender->getNamingContainer()->getData(), $field); |
261 | 261 | $text = $this->formatDataValue($this->getDataTextFormatString(), $value); |
262 | 262 | $sender->setText($text); |
263 | 263 | } |
264 | - if(($sender instanceof TImageButton) && ($field = $this->getDataImageUrlField()) !== '') |
|
264 | + if (($sender instanceof TImageButton) && ($field = $this->getDataImageUrlField()) !== '') |
|
265 | 265 | { |
266 | 266 | $value = $this->getDataFieldValue($sender->getNamingContainer()->getData(), $field); |
267 | 267 | $url = $this->formatDataValue($this->getDataImageUrlFormatString(), $value); |
@@ -223,11 +223,11 @@ discard block |
||
223 | 223 | if($itemType === TListItemType::Item || $itemType === TListItemType::AlternatingItem || $itemType === TListItemType::SelectedItem || $itemType === TListItemType::EditItem) |
224 | 224 | { |
225 | 225 | $buttonType = $this->getButtonType(); |
226 | - if($buttonType === TButtonColumnType::LinkButton) |
|
227 | - $button = new TLinkButton; |
|
228 | - elseif($buttonType === TButtonColumnType::PushButton) |
|
229 | - $button = new TButton; |
|
230 | - else // image button |
|
226 | + if($buttonType === TButtonColumnType::LinkButton) { |
|
227 | + $button = new TLinkButton; |
|
228 | + } elseif($buttonType === TButtonColumnType::PushButton) { |
|
229 | + $button = new TButton; |
|
230 | + } else // image button |
|
231 | 231 | { |
232 | 232 | $button = new TImageButton; |
233 | 233 | $button->setImageUrl($this->getImageUrl()); |
@@ -237,13 +237,14 @@ discard block |
||
237 | 237 | $button->setCommandName($this->getCommandName()); |
238 | 238 | $button->setCausesValidation($this->getCausesValidation()); |
239 | 239 | $button->setValidationGroup($this->getValidationGroup()); |
240 | - if($this->getDataTextField() !== '' || ($buttonType === TButtonColumnType::ImageButton && $this->getDataImageUrlField() !== '')) |
|
241 | - $button->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']); |
|
240 | + if($this->getDataTextField() !== '' || ($buttonType === TButtonColumnType::ImageButton && $this->getDataImageUrlField() !== '')) { |
|
241 | + $button->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']); |
|
242 | + } |
|
242 | 243 | $cell->getControls()->add($button); |
243 | 244 | $cell->registerObject('Button', $button); |
245 | + } else { |
|
246 | + parent::initializeCell($cell, $columnIndex, $itemType); |
|
244 | 247 | } |
245 | - else |
|
246 | - parent::initializeCell($cell, $columnIndex, $itemType); |
|
247 | 248 | } |
248 | 249 | |
249 | 250 | /** |
@@ -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 |