@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | */ |
31 | 31 | protected function getCombinedStyle($obj) |
32 | 32 | { |
33 | - if(!($obj instanceof TStyle)) |
|
33 | + if (!($obj instanceof TStyle)) |
|
34 | 34 | return []; |
35 | 35 | $style = $obj->getStyleFields(); |
36 | 36 | $style = array_merge($style, $this->getStyleFromString($obj->getCustomStyle())); |
37 | - if($obj->hasFont()) |
|
37 | + if ($obj->hasFont()) |
|
38 | 38 | $style = array_merge($style, $this->getStyleFromString($obj->getFont()->toString())); |
39 | 39 | return $style; |
40 | 40 | } |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | protected function getStyleFromString($string) |
47 | 47 | { |
48 | 48 | $style = []; |
49 | - if(!is_string($string)) return $style; |
|
49 | + if (!is_string($string)) return $style; |
|
50 | 50 | |
51 | - foreach(explode(';', $string) as $sub) |
|
51 | + foreach (explode(';', $string) as $sub) |
|
52 | 52 | { |
53 | 53 | $arr = explode(':', $sub); |
54 | - if(isset($arr[1]) && trim($arr[0]) !== '') |
|
54 | + if (isset($arr[1]) && trim($arr[0]) !== '') |
|
55 | 55 | $style[trim($arr[0])] = trim($arr[1]); |
56 | 56 | } |
57 | 57 | return $style; |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | protected function getCssClassDiff() |
64 | 64 | { |
65 | - if($this->_old === null) |
|
65 | + if ($this->_old === null) |
|
66 | 66 | { |
67 | 67 | return ($this->_new !== null) && $this->_new->hasCssClass() |
68 | 68 | ? $this->_new->getCssClass() : null; |
@@ -90,13 +90,13 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function getDifference() |
92 | 92 | { |
93 | - if($this->_new === null) |
|
93 | + if ($this->_new === null) |
|
94 | 94 | return $this->_null; |
95 | 95 | else |
96 | 96 | { |
97 | 97 | $css = $this->getCssClassDiff(); |
98 | 98 | $style = $this->getStyleDiff(); |
99 | - if(($css !== null) || ($style !== null)) |
|
99 | + if (($css !== null) || ($style !== null)) |
|
100 | 100 | return ['CssClass' => $css, 'Style' => $style]; |
101 | 101 | else |
102 | 102 | $this->_null; |
@@ -30,12 +30,14 @@ discard block |
||
30 | 30 | */ |
31 | 31 | protected function getCombinedStyle($obj) |
32 | 32 | { |
33 | - if(!($obj instanceof TStyle)) |
|
34 | - return []; |
|
33 | + if(!($obj instanceof TStyle)) { |
|
34 | + return []; |
|
35 | + } |
|
35 | 36 | $style = $obj->getStyleFields(); |
36 | 37 | $style = array_merge($style, $this->getStyleFromString($obj->getCustomStyle())); |
37 | - if($obj->hasFont()) |
|
38 | - $style = array_merge($style, $this->getStyleFromString($obj->getFont()->toString())); |
|
38 | + if($obj->hasFont()) { |
|
39 | + $style = array_merge($style, $this->getStyleFromString($obj->getFont()->toString())); |
|
40 | + } |
|
39 | 41 | return $style; |
40 | 42 | } |
41 | 43 | |
@@ -46,13 +48,16 @@ discard block |
||
46 | 48 | protected function getStyleFromString($string) |
47 | 49 | { |
48 | 50 | $style = []; |
49 | - if(!is_string($string)) return $style; |
|
51 | + if(!is_string($string)) { |
|
52 | + return $style; |
|
53 | + } |
|
50 | 54 | |
51 | 55 | foreach(explode(';', $string) as $sub) |
52 | 56 | { |
53 | 57 | $arr = explode(':', $sub); |
54 | - if(isset($arr[1]) && trim($arr[0]) !== '') |
|
55 | - $style[trim($arr[0])] = trim($arr[1]); |
|
58 | + if(isset($arr[1]) && trim($arr[0]) !== '') { |
|
59 | + $style[trim($arr[0])] = trim($arr[1]); |
|
60 | + } |
|
56 | 61 | } |
57 | 62 | return $style; |
58 | 63 | } |
@@ -66,8 +71,7 @@ discard block |
||
66 | 71 | { |
67 | 72 | return ($this->_new !== null) && $this->_new->hasCssClass() |
68 | 73 | ? $this->_new->getCssClass() : null; |
69 | - } |
|
70 | - else |
|
74 | + } else |
|
71 | 75 | { |
72 | 76 | return $this->_old->getCssClass() !== $this->_new->getCssClass() ? |
73 | 77 | $this->_new->getCssClass() : null; |
@@ -90,16 +94,17 @@ discard block |
||
90 | 94 | */ |
91 | 95 | public function getDifference() |
92 | 96 | { |
93 | - if($this->_new === null) |
|
94 | - return $this->_null; |
|
95 | - else |
|
97 | + if($this->_new === null) { |
|
98 | + return $this->_null; |
|
99 | + } else |
|
96 | 100 | { |
97 | 101 | $css = $this->getCssClassDiff(); |
98 | 102 | $style = $this->getStyleDiff(); |
99 | - if(($css !== null) || ($style !== null)) |
|
100 | - return ['CssClass' => $css, 'Style' => $style]; |
|
101 | - else |
|
102 | - $this->_null; |
|
103 | + if(($css !== null) || ($style !== null)) { |
|
104 | + return ['CssClass' => $css, 'Style' => $style]; |
|
105 | + } else { |
|
106 | + $this->_null; |
|
107 | + } |
|
103 | 108 | } |
104 | 109 | } |
105 | 110 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $list->dataBind(); |
108 | 108 | $list->setSelectedIndex($this->getCurrentPageIndex()); |
109 | 109 | $list->setAutoPostBack(true); |
110 | - $list->attachEventHandler('OnSelectedIndexChanged', [$this,'listIndexChanged']); |
|
110 | + $list->attachEventHandler('OnSelectedIndexChanged', [$this, 'listIndexChanged']); |
|
111 | 111 | $list->attachEventHandler('OnCallback', [$this, 'handleCallback']); |
112 | 112 | } |
113 | 113 | |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | */ |
126 | 126 | protected function createPagerButton($buttonType, $enabled, $text, $commandName, $commandParameter) |
127 | 127 | { |
128 | - if($buttonType === TPagerButtonType::LinkButton) |
|
128 | + if ($buttonType === TPagerButtonType::LinkButton) |
|
129 | 129 | { |
130 | - if($enabled) |
|
130 | + if ($enabled) |
|
131 | 131 | $button = new TActiveLinkButton; |
132 | 132 | else |
133 | 133 | { |
@@ -137,11 +137,11 @@ discard block |
||
137 | 137 | return $button; |
138 | 138 | } |
139 | 139 | } |
140 | - elseif($buttonType === TPagerButtonType::ImageButton) |
|
140 | + elseif ($buttonType === TPagerButtonType::ImageButton) |
|
141 | 141 | { |
142 | 142 | $button = new TActiveImageButton; |
143 | 143 | $button->setImageUrl($this->getPageImageUrl($text, $commandName)); |
144 | - if($enabled) |
|
144 | + if ($enabled) |
|
145 | 145 | $button->Visible = true; |
146 | 146 | else |
147 | 147 | $button->Visible = false; |
@@ -149,11 +149,11 @@ discard block |
||
149 | 149 | else |
150 | 150 | { |
151 | 151 | $button = new TActiveButton; |
152 | - if(!$enabled) |
|
152 | + if (!$enabled) |
|
153 | 153 | $button->setEnabled(false); |
154 | 154 | } |
155 | 155 | |
156 | - if($buttonType === TPagerButtonType::ImageButton) |
|
156 | + if ($buttonType === TPagerButtonType::ImageButton) |
|
157 | 157 | { |
158 | 158 | $button->ImageUrl = $text; |
159 | 159 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * @param mixed $sender |
180 | 180 | * @param TCallbackEventParameter $param |
181 | 181 | */ |
182 | - public function handleCallback ($sender, $param) |
|
182 | + public function handleCallback($sender, $param) |
|
183 | 183 | { |
184 | 184 | // Update all the buttons pagers attached to the same control. |
185 | 185 | // Dropdown pagers doesn't need to be re-rendered. |
@@ -198,13 +198,13 @@ discard block |
||
198 | 198 | $this->onCallback($param); |
199 | 199 | } |
200 | 200 | |
201 | - public function render ($writer) |
|
201 | + public function render($writer) |
|
202 | 202 | { |
203 | - if($this->getHasPreRendered()) |
|
203 | + if ($this->getHasPreRendered()) |
|
204 | 204 | { |
205 | - $this->setDisplay(($this->getPageCount() == 1)?TDisplayStyle::None:TDisplayStyle::Dynamic); |
|
205 | + $this->setDisplay(($this->getPageCount() == 1) ?TDisplayStyle::None : TDisplayStyle::Dynamic); |
|
206 | 206 | TWebControl::render($writer); |
207 | - if($this->getActiveControl()->canUpdateClientSide()) |
|
207 | + if ($this->getActiveControl()->canUpdateClientSide()) |
|
208 | 208 | $this->getPage()->getCallbackClient()->replaceContent($this, $writer); |
209 | 209 | } |
210 | 210 | else |
@@ -127,30 +127,30 @@ discard block |
||
127 | 127 | { |
128 | 128 | if($buttonType === TPagerButtonType::LinkButton) |
129 | 129 | { |
130 | - if($enabled) |
|
131 | - $button = new TActiveLinkButton; |
|
132 | - else |
|
130 | + if($enabled) { |
|
131 | + $button = new TActiveLinkButton; |
|
132 | + } else |
|
133 | 133 | { |
134 | 134 | $button = new TLabel; |
135 | 135 | $button->setText($text); |
136 | 136 | $button->setCssClass($this->getButtonCssClass()); |
137 | 137 | return $button; |
138 | 138 | } |
139 | - } |
|
140 | - elseif($buttonType === TPagerButtonType::ImageButton) |
|
139 | + } elseif($buttonType === TPagerButtonType::ImageButton) |
|
141 | 140 | { |
142 | 141 | $button = new TActiveImageButton; |
143 | 142 | $button->setImageUrl($this->getPageImageUrl($text, $commandName)); |
144 | - if($enabled) |
|
145 | - $button->Visible = true; |
|
146 | - else |
|
147 | - $button->Visible = false; |
|
148 | - } |
|
149 | - else |
|
143 | + if($enabled) { |
|
144 | + $button->Visible = true; |
|
145 | + } else { |
|
146 | + $button->Visible = false; |
|
147 | + } |
|
148 | + } else |
|
150 | 149 | { |
151 | 150 | $button = new TActiveButton; |
152 | - if(!$enabled) |
|
153 | - $button->setEnabled(false); |
|
151 | + if(!$enabled) { |
|
152 | + $button->setEnabled(false); |
|
153 | + } |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | if($buttonType === TPagerButtonType::ImageButton) |
@@ -204,10 +204,10 @@ discard block |
||
204 | 204 | { |
205 | 205 | $this->setDisplay(($this->getPageCount() == 1)?TDisplayStyle::None:TDisplayStyle::Dynamic); |
206 | 206 | TWebControl::render($writer); |
207 | - if($this->getActiveControl()->canUpdateClientSide()) |
|
208 | - $this->getPage()->getCallbackClient()->replaceContent($this, $writer); |
|
209 | - } |
|
210 | - else |
|
207 | + if($this->getActiveControl()->canUpdateClientSide()) { |
|
208 | + $this->getPage()->getCallbackClient()->replaceContent($this, $writer); |
|
209 | + } |
|
210 | + } else |
|
211 | 211 | { |
212 | 212 | $this->getPage()->getAdapter()->registerControlToRender($this, $writer); |
213 | 213 | } |
@@ -120,8 +120,8 @@ discard block |
||
120 | 120 | public function registerControlToRender($control, $writer) |
121 | 121 | { |
122 | 122 | $id = $control->getUniqueID(); |
123 | - if(!isset($this->_controlsToRender[$id])) |
|
124 | - $this->_controlsToRender[$id] = [$control,$writer]; |
|
123 | + if (!isset($this->_controlsToRender[$id])) |
|
124 | + $this->_controlsToRender[$id] = [$control, $writer]; |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | public function renderCallbackResponse($writer) |
140 | 140 | { |
141 | 141 | Prado::trace("ActivePage renderCallbackResponse()", 'Prado\Web\UI\ActiveControls\TActivePageAdapter'); |
142 | - if(($url = $this->getResponse()->getAdapter()->getRedirectedUrl()) === null) |
|
142 | + if (($url = $this->getResponse()->getAdapter()->getRedirectedUrl()) === null) |
|
143 | 143 | $this->renderResponse($writer); |
144 | 144 | else |
145 | 145 | $this->redirect($url); |
@@ -164,16 +164,16 @@ discard block |
||
164 | 164 | { |
165 | 165 | Prado::trace("ActivePage renderResponse()", 'Prado\Web\UI\ActiveControls\TActivePageAdapter'); |
166 | 166 | //renders all the defered render() calls. |
167 | - foreach($this->_controlsToRender as $rid => $forRender) |
|
167 | + foreach ($this->_controlsToRender as $rid => $forRender) |
|
168 | 168 | $forRender[0]->render($forRender[1]); |
169 | 169 | |
170 | 170 | $response = $this->getResponse(); |
171 | 171 | |
172 | 172 | //send response data in header |
173 | - if($response->getHasAdapter()) |
|
173 | + if ($response->getHasAdapter()) |
|
174 | 174 | { |
175 | 175 | $responseData = $response->getAdapter()->getResponseData(); |
176 | - if($responseData !== null) |
|
176 | + if ($responseData !== null) |
|
177 | 177 | { |
178 | 178 | $data = TJavaScript::jsonEncode($responseData); |
179 | 179 | |
@@ -182,9 +182,9 @@ discard block |
||
182 | 182 | } |
183 | 183 | |
184 | 184 | //sends page state in header |
185 | - if(($handler = $this->getCallbackEventTarget()) !== null) |
|
185 | + if (($handler = $this->getCallbackEventTarget()) !== null) |
|
186 | 186 | { |
187 | - if($handler->getActiveControl()->getClientSide()->getEnablePageStateUpdate()) |
|
187 | + if ($handler->getActiveControl()->getClientSide()->getEnablePageStateUpdate()) |
|
188 | 188 | { |
189 | 189 | $pagestate = $this->getPage()->getClientState(); |
190 | 190 | $this->appendContentPart($response, self::CALLBACK_PAGESTATE_HEADER, $pagestate); |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | $writer->write(" "); |
196 | 196 | |
197 | 197 | //output the end javascript |
198 | - if($this->getPage()->getClientScript()->hasEndScripts()) |
|
198 | + if ($this->getPage()->getClientScript()->hasEndScripts()) |
|
199 | 199 | { |
200 | 200 | $writer = $response->createHtmlWriter(); |
201 | 201 | $this->getPage()->getClientScript()->renderEndScriptsCallback($writer); |
@@ -249,9 +249,9 @@ discard block |
||
249 | 249 | */ |
250 | 250 | private function raiseCallbackEvent() |
251 | 251 | { |
252 | - if(($callbackHandler = $this->getCallbackEventTarget()) !== null) |
|
252 | + if (($callbackHandler = $this->getCallbackEventTarget()) !== null) |
|
253 | 253 | { |
254 | - if($callbackHandler instanceof ICallbackEventHandler) |
|
254 | + if ($callbackHandler instanceof ICallbackEventHandler) |
|
255 | 255 | { |
256 | 256 | $param = $this->getCallbackEventParameter(); |
257 | 257 | $result = new TCallbackEventParameter($this->getResponse(), $param); |
@@ -276,10 +276,10 @@ discard block |
||
276 | 276 | */ |
277 | 277 | public function getCallbackEventTarget() |
278 | 278 | { |
279 | - if($this->_callbackEventTarget === null) |
|
279 | + if ($this->_callbackEventTarget === null) |
|
280 | 280 | { |
281 | 281 | $eventTarget = $this->getRequest()->itemAt(TPage::FIELD_CALLBACK_TARGET); |
282 | - if(!empty($eventTarget)) |
|
282 | + if (!empty($eventTarget)) |
|
283 | 283 | $this->_callbackEventTarget = $this->getPage()->findControl($eventTarget); |
284 | 284 | } |
285 | 285 | return $this->_callbackEventTarget; |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | */ |
301 | 301 | public function getCallbackEventParameter() |
302 | 302 | { |
303 | - if($this->_callbackEventParameter === null) |
|
303 | + if ($this->_callbackEventParameter === null) |
|
304 | 304 | { |
305 | 305 | $param = $this->getRequest()->itemAt(TPage::FIELD_CALLBACK_PARAMETER); |
306 | 306 | $this->_callbackEventParameter = $param; |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | */ |
324 | 324 | public function getCallbackClientHandler() |
325 | 325 | { |
326 | - if($this->_callbackClient === null) |
|
326 | + if ($this->_callbackClient === null) |
|
327 | 327 | $this->_callbackClient = new TCallbackClientScript; |
328 | 328 | return $this->_callbackClient; |
329 | 329 | } |
@@ -120,8 +120,9 @@ discard block |
||
120 | 120 | public function registerControlToRender($control, $writer) |
121 | 121 | { |
122 | 122 | $id = $control->getUniqueID(); |
123 | - if(!isset($this->_controlsToRender[$id])) |
|
124 | - $this->_controlsToRender[$id] = [$control,$writer]; |
|
123 | + if(!isset($this->_controlsToRender[$id])) { |
|
124 | + $this->_controlsToRender[$id] = [$control,$writer]; |
|
125 | + } |
|
125 | 126 | } |
126 | 127 | |
127 | 128 | /** |
@@ -139,10 +140,11 @@ discard block |
||
139 | 140 | public function renderCallbackResponse($writer) |
140 | 141 | { |
141 | 142 | Prado::trace("ActivePage renderCallbackResponse()", 'Prado\Web\UI\ActiveControls\TActivePageAdapter'); |
142 | - if(($url = $this->getResponse()->getAdapter()->getRedirectedUrl()) === null) |
|
143 | - $this->renderResponse($writer); |
|
144 | - else |
|
145 | - $this->redirect($url); |
|
143 | + if(($url = $this->getResponse()->getAdapter()->getRedirectedUrl()) === null) { |
|
144 | + $this->renderResponse($writer); |
|
145 | + } else { |
|
146 | + $this->redirect($url); |
|
147 | + } |
|
146 | 148 | } |
147 | 149 | |
148 | 150 | /** |
@@ -164,8 +166,9 @@ discard block |
||
164 | 166 | { |
165 | 167 | Prado::trace("ActivePage renderResponse()", 'Prado\Web\UI\ActiveControls\TActivePageAdapter'); |
166 | 168 | //renders all the defered render() calls. |
167 | - foreach($this->_controlsToRender as $rid => $forRender) |
|
168 | - $forRender[0]->render($forRender[1]); |
|
169 | + foreach($this->_controlsToRender as $rid => $forRender) { |
|
170 | + $forRender[0]->render($forRender[1]); |
|
171 | + } |
|
169 | 172 | |
170 | 173 | $response = $this->getResponse(); |
171 | 174 | |
@@ -212,23 +215,27 @@ discard block |
||
212 | 215 | |
213 | 216 | // collect all stylesheet file references |
214 | 217 | $stylesheets = $cs->getStyleSheetUrls(); |
215 | - if (count($stylesheets) > 0) |
|
216 | - $this->appendContentPart($response, self::CALLBACK_STYLESHEETLIST_HEADER, TJavaScript::jsonEncode($stylesheets)); |
|
218 | + if (count($stylesheets) > 0) { |
|
219 | + $this->appendContentPart($response, self::CALLBACK_STYLESHEETLIST_HEADER, TJavaScript::jsonEncode($stylesheets)); |
|
220 | + } |
|
217 | 221 | |
218 | 222 | // collect all stylesheet snippets references |
219 | 223 | $stylesheets = $cs->getStyleSheetCodes(); |
220 | - if (count($stylesheets) > 0) |
|
221 | - $this->appendContentPart($response, self::CALLBACK_STYLESHEET_HEADER, TJavaScript::jsonEncode($stylesheets)); |
|
224 | + if (count($stylesheets) > 0) { |
|
225 | + $this->appendContentPart($response, self::CALLBACK_STYLESHEET_HEADER, TJavaScript::jsonEncode($stylesheets)); |
|
226 | + } |
|
222 | 227 | |
223 | 228 | // collect all script file references |
224 | 229 | $scripts = $cs->getScriptUrls(); |
225 | - if (count($scripts) > 0) |
|
226 | - $this->appendContentPart($response, self::CALLBACK_SCRIPTLIST_HEADER, TJavaScript::jsonEncode($scripts)); |
|
230 | + if (count($scripts) > 0) { |
|
231 | + $this->appendContentPart($response, self::CALLBACK_SCRIPTLIST_HEADER, TJavaScript::jsonEncode($scripts)); |
|
232 | + } |
|
227 | 233 | |
228 | 234 | // collect all hidden field references |
229 | 235 | $fields = $cs->getHiddenFields(); |
230 | - if (count($fields) > 0) |
|
231 | - $this->appendContentPart($response, self::CALLBACK_HIDDENFIELDLIST_HEADER, TJavaScript::jsonEncode($fields)); |
|
236 | + if (count($fields) > 0) { |
|
237 | + $this->appendContentPart($response, self::CALLBACK_HIDDENFIELDLIST_HEADER, TJavaScript::jsonEncode($fields)); |
|
238 | + } |
|
232 | 239 | } |
233 | 240 | |
234 | 241 | /** |
@@ -256,14 +263,12 @@ discard block |
||
256 | 263 | $param = $this->getCallbackEventParameter(); |
257 | 264 | $result = new TCallbackEventParameter($this->getResponse(), $param); |
258 | 265 | $callbackHandler->raiseCallbackEvent($result); |
259 | - } |
|
260 | - else |
|
266 | + } else |
|
261 | 267 | { |
262 | 268 | throw new TInvalidCallbackException( |
263 | 269 | 'callback_invalid_handler', $callbackHandler->getUniqueID()); |
264 | 270 | } |
265 | - } |
|
266 | - else |
|
271 | + } else |
|
267 | 272 | { |
268 | 273 | $target = $this->getRequest()->itemAt(TPage::FIELD_CALLBACK_TARGET); |
269 | 274 | throw new TInvalidCallbackException('callback_invalid_target', $target); |
@@ -279,8 +284,9 @@ discard block |
||
279 | 284 | if($this->_callbackEventTarget === null) |
280 | 285 | { |
281 | 286 | $eventTarget = $this->getRequest()->itemAt(TPage::FIELD_CALLBACK_TARGET); |
282 | - if(!empty($eventTarget)) |
|
283 | - $this->_callbackEventTarget = $this->getPage()->findControl($eventTarget); |
|
287 | + if(!empty($eventTarget)) { |
|
288 | + $this->_callbackEventTarget = $this->getPage()->findControl($eventTarget); |
|
289 | + } |
|
284 | 290 | } |
285 | 291 | return $this->_callbackEventTarget; |
286 | 292 | } |
@@ -323,8 +329,9 @@ discard block |
||
323 | 329 | */ |
324 | 330 | public function getCallbackClientHandler() |
325 | 331 | { |
326 | - if($this->_callbackClient === null) |
|
327 | - $this->_callbackClient = new TCallbackClientScript; |
|
332 | + if($this->_callbackClient === null) { |
|
333 | + $this->_callbackClient = new TCallbackClientScript; |
|
334 | + } |
|
328 | 335 | return $this->_callbackClient; |
329 | 336 | } |
330 | 337 | } |
331 | 338 | \ No newline at end of file |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function trackChanges() |
91 | 91 | { |
92 | - foreach($this->_states as $name => $value) |
|
92 | + foreach ($this->_states as $name => $value) |
|
93 | 93 | { |
94 | 94 | $obj = $this->_control->getViewState($name); |
95 | 95 | $this->_existingState[$name] = is_object($obj) ? clone($obj) : $obj; |
@@ -102,15 +102,15 @@ discard block |
||
102 | 102 | protected function getChanges() |
103 | 103 | { |
104 | 104 | $changes = []; |
105 | - foreach($this->_states as $name => $details) |
|
105 | + foreach ($this->_states as $name => $details) |
|
106 | 106 | { |
107 | 107 | $new = $this->_control->getViewState($name); |
108 | 108 | $old = $this->_existingState[$name]; |
109 | - if($new !== $old) |
|
109 | + if ($new !== $old) |
|
110 | 110 | { |
111 | 111 | $diff = new $details[0]($new, $old, $this->_nullObject); |
112 | - if(($change = $diff->getDifference()) !== $this->_nullObject) |
|
113 | - $changes[] = [$details[1],[$change]]; |
|
112 | + if (($change = $diff->getDifference()) !== $this->_nullObject) |
|
113 | + $changes[] = [$details[1], [$change]]; |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | return $changes; |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function respondToChanges() |
123 | 123 | { |
124 | - foreach($this->getChanges() as $change) |
|
124 | + foreach ($this->getChanges() as $change) |
|
125 | 125 | call_user_func_array($change[0], $change[1]); |
126 | 126 | } |
127 | 127 | |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | */ |
168 | 168 | protected function updateVisible($visible) |
169 | 169 | { |
170 | - if($visible === false) |
|
171 | - $this->client()->replaceContent($this->_control, "<span id=\"" . $this->_control->getClientID() . "\" style=\"display:none\" ></span>"); |
|
170 | + if ($visible === false) |
|
171 | + $this->client()->replaceContent($this->_control, "<span id=\"".$this->_control->getClientID()."\" style=\"display:none\" ></span>"); |
|
172 | 172 | else |
173 | 173 | $this->client()->replaceContent($this->_control, $this->_control); |
174 | 174 | } |
@@ -188,9 +188,9 @@ discard block |
||
188 | 188 | */ |
189 | 189 | protected function updateStyle($style) |
190 | 190 | { |
191 | - if($style['CssClass'] !== null) |
|
191 | + if ($style['CssClass'] !== null) |
|
192 | 192 | $this->client()->setAttribute($this->_control, 'class', $style['CssClass']); |
193 | - if(is_array($style['Style']) && count($style['Style']) > 0) |
|
193 | + if (is_array($style['Style']) && count($style['Style']) > 0) |
|
194 | 194 | $this->client()->setStyle($this->_control, $style['Style']); |
195 | 195 | } |
196 | 196 | |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | */ |
201 | 201 | protected function updateAttributes($attributes) |
202 | 202 | { |
203 | - foreach($attributes as $name => $value) |
|
203 | + foreach ($attributes as $name => $value) |
|
204 | 204 | $this->client()->setAttribute($this->_control, $name, $value); |
205 | 205 | } |
206 | 206 | } |
@@ -109,8 +109,9 @@ discard block |
||
109 | 109 | if($new !== $old) |
110 | 110 | { |
111 | 111 | $diff = new $details[0]($new, $old, $this->_nullObject); |
112 | - if(($change = $diff->getDifference()) !== $this->_nullObject) |
|
113 | - $changes[] = [$details[1],[$change]]; |
|
112 | + if(($change = $diff->getDifference()) !== $this->_nullObject) { |
|
113 | + $changes[] = [$details[1],[$change]]; |
|
114 | + } |
|
114 | 115 | } |
115 | 116 | } |
116 | 117 | return $changes; |
@@ -121,8 +122,9 @@ discard block |
||
121 | 122 | */ |
122 | 123 | public function respondToChanges() |
123 | 124 | { |
124 | - foreach($this->getChanges() as $change) |
|
125 | - call_user_func_array($change[0], $change[1]); |
|
125 | + foreach($this->getChanges() as $change) { |
|
126 | + call_user_func_array($change[0], $change[1]); |
|
127 | + } |
|
126 | 128 | } |
127 | 129 | |
128 | 130 | /** |
@@ -167,10 +169,11 @@ discard block |
||
167 | 169 | */ |
168 | 170 | protected function updateVisible($visible) |
169 | 171 | { |
170 | - if($visible === false) |
|
171 | - $this->client()->replaceContent($this->_control, "<span id=\"" . $this->_control->getClientID() . "\" style=\"display:none\" ></span>"); |
|
172 | - else |
|
173 | - $this->client()->replaceContent($this->_control, $this->_control); |
|
172 | + if($visible === false) { |
|
173 | + $this->client()->replaceContent($this->_control, "<span id=\"" . $this->_control->getClientID() . "\" style=\"display:none\" ></span>"); |
|
174 | + } else { |
|
175 | + $this->client()->replaceContent($this->_control, $this->_control); |
|
176 | + } |
|
174 | 177 | } |
175 | 178 | |
176 | 179 | /** |
@@ -188,10 +191,12 @@ discard block |
||
188 | 191 | */ |
189 | 192 | protected function updateStyle($style) |
190 | 193 | { |
191 | - if($style['CssClass'] !== null) |
|
192 | - $this->client()->setAttribute($this->_control, 'class', $style['CssClass']); |
|
193 | - if(is_array($style['Style']) && count($style['Style']) > 0) |
|
194 | - $this->client()->setStyle($this->_control, $style['Style']); |
|
194 | + if($style['CssClass'] !== null) { |
|
195 | + $this->client()->setAttribute($this->_control, 'class', $style['CssClass']); |
|
196 | + } |
|
197 | + if(is_array($style['Style']) && count($style['Style']) > 0) { |
|
198 | + $this->client()->setStyle($this->_control, $style['Style']); |
|
199 | + } |
|
195 | 200 | } |
196 | 201 | |
197 | 202 | /** |
@@ -200,7 +205,8 @@ discard block |
||
200 | 205 | */ |
201 | 206 | protected function updateAttributes($attributes) |
202 | 207 | { |
203 | - foreach($attributes as $name => $value) |
|
204 | - $this->client()->setAttribute($this->_control, $name, $value); |
|
208 | + foreach($attributes as $name => $value) { |
|
209 | + $this->client()->setAttribute($this->_control, $name, $value); |
|
210 | + } |
|
205 | 211 | } |
206 | 212 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | */ |
41 | 41 | public function getClientSide() |
42 | 42 | { |
43 | - if($this->_clientSide === null) |
|
43 | + if ($this->_clientSide === null) |
|
44 | 44 | $this->_clientSide = $this->createClientSide(); |
45 | 45 | return $this->_clientSide; |
46 | 46 | } |
@@ -40,8 +40,9 @@ |
||
40 | 40 | */ |
41 | 41 | public function getClientSide() |
42 | 42 | { |
43 | - if($this->_clientSide === null) |
|
44 | - $this->_clientSide = $this->createClientSide(); |
|
43 | + if($this->_clientSide === null) { |
|
44 | + $this->_clientSide = $this->createClientSide(); |
|
45 | + } |
|
45 | 46 | return $this->_clientSide; |
46 | 47 | } |
47 | 48 |
@@ -93,11 +93,11 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function setText($value) |
95 | 95 | { |
96 | - if(parent::getText() === $value) |
|
96 | + if (parent::getText() === $value) |
|
97 | 97 | return; |
98 | 98 | |
99 | 99 | parent::setText($value); |
100 | - if($this->getActiveControl()->canUpdateClientSide()) |
|
100 | + if ($this->getActiveControl()->canUpdateClientSide()) |
|
101 | 101 | $this->getPage()->getCallbackClient()->update( |
102 | 102 | $this->getDefaultLabelID(), $value); |
103 | 103 | } |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | public function setChecked($value) |
112 | 112 | { |
113 | 113 | $value = TPropertyValue::ensureBoolean($value); |
114 | - if(parent::getChecked() === $value) |
|
114 | + if (parent::getChecked() === $value) |
|
115 | 115 | return; |
116 | 116 | |
117 | 117 | parent::setChecked($value); |
118 | - if($this->getActiveControl()->canUpdateClientSide()) |
|
118 | + if ($this->getActiveControl()->canUpdateClientSide()) |
|
119 | 119 | $this->getPage()->getCallbackClient()->check($this, $value); |
120 | 120 | } |
121 | 121 | |
@@ -181,10 +181,10 @@ discard block |
||
181 | 181 | */ |
182 | 182 | protected function getDefaultLabelID() |
183 | 183 | { |
184 | - if($attributes = $this->getViewState('LabelAttributes', null)) |
|
184 | + if ($attributes = $this->getViewState('LabelAttributes', null)) |
|
185 | 185 | return TCheckBox::getLabelAttributes()->itemAt('id'); |
186 | 186 | else |
187 | - return $this->getClientID() . '_label'; |
|
187 | + return $this->getClientID().'_label'; |
|
188 | 188 | } |
189 | 189 | } |
190 | 190 |
@@ -93,13 +93,15 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function setText($value) |
95 | 95 | { |
96 | - if(parent::getText() === $value) |
|
97 | - return; |
|
96 | + if(parent::getText() === $value) { |
|
97 | + return; |
|
98 | + } |
|
98 | 99 | |
99 | 100 | parent::setText($value); |
100 | - if($this->getActiveControl()->canUpdateClientSide()) |
|
101 | - $this->getPage()->getCallbackClient()->update( |
|
101 | + if($this->getActiveControl()->canUpdateClientSide()) { |
|
102 | + $this->getPage()->getCallbackClient()->update( |
|
102 | 103 | $this->getDefaultLabelID(), $value); |
104 | + } |
|
103 | 105 | } |
104 | 106 | |
105 | 107 | /** |
@@ -111,12 +113,14 @@ discard block |
||
111 | 113 | public function setChecked($value) |
112 | 114 | { |
113 | 115 | $value = TPropertyValue::ensureBoolean($value); |
114 | - if(parent::getChecked() === $value) |
|
115 | - return; |
|
116 | + if(parent::getChecked() === $value) { |
|
117 | + return; |
|
118 | + } |
|
116 | 119 | |
117 | 120 | parent::setChecked($value); |
118 | - if($this->getActiveControl()->canUpdateClientSide()) |
|
119 | - $this->getPage()->getCallbackClient()->check($this, $value); |
|
121 | + if($this->getActiveControl()->canUpdateClientSide()) { |
|
122 | + $this->getPage()->getCallbackClient()->check($this, $value); |
|
123 | + } |
|
120 | 124 | } |
121 | 125 | |
122 | 126 | /** |
@@ -140,9 +144,10 @@ discard block |
||
140 | 144 | protected function renderInputTag($writer, $clientID, $onclick) |
141 | 145 | { |
142 | 146 | parent::renderInputTag($writer, $clientID, $onclick); |
143 | - if ($this->getAutoPostBack()) |
|
144 | - $this->getActiveControl()->registerCallbackClientScript( |
|
147 | + if ($this->getAutoPostBack()) { |
|
148 | + $this->getActiveControl()->registerCallbackClientScript( |
|
145 | 149 | $this->getClientClassName(), $this->getPostBackOptions()); |
150 | + } |
|
146 | 151 | } |
147 | 152 | |
148 | 153 | /** |
@@ -181,10 +186,11 @@ discard block |
||
181 | 186 | */ |
182 | 187 | protected function getDefaultLabelID() |
183 | 188 | { |
184 | - if($attributes = $this->getViewState('LabelAttributes', null)) |
|
185 | - return TCheckBox::getLabelAttributes()->itemAt('id'); |
|
186 | - else |
|
187 | - return $this->getClientID() . '_label'; |
|
189 | + if($attributes = $this->getViewState('LabelAttributes', null)) { |
|
190 | + return TCheckBox::getLabelAttributes()->itemAt('id'); |
|
191 | + } else { |
|
192 | + return $this->getClientID() . '_label'; |
|
193 | + } |
|
188 | 194 | } |
189 | 195 | } |
190 | 196 |
@@ -63,7 +63,7 @@ |
||
63 | 63 | protected function setOption($name, $value, $default = null) |
64 | 64 | { |
65 | 65 | $value = ($value === null) ? $default : $value; |
66 | - if($value !== null) |
|
66 | + if ($value !== null) |
|
67 | 67 | $this->_options->add($name, $value); |
68 | 68 | } |
69 | 69 |
@@ -63,8 +63,9 @@ |
||
63 | 63 | protected function setOption($name, $value, $default = null) |
64 | 64 | { |
65 | 65 | $value = ($value === null) ? $default : $value; |
66 | - if($value !== null) |
|
67 | - $this->_options->add($name, $value); |
|
66 | + if($value !== null) { |
|
67 | + $this->_options->add($name, $value); |
|
68 | + } |
|
68 | 69 | } |
69 | 70 | |
70 | 71 | /** |
@@ -38,10 +38,10 @@ discard block |
||
38 | 38 | protected function initializeHeaderCell($cell, $columnIndex) { |
39 | 39 | $text = $this->getHeaderText(); |
40 | 40 | |
41 | - if(($classPath = $this->getHeaderRenderer()) !== '') { |
|
41 | + if (($classPath = $this->getHeaderRenderer()) !== '') { |
|
42 | 42 | $control = Prado::createComponent($classPath); |
43 | - if($control instanceof \Prado\IDataRenderer) { |
|
44 | - if($control instanceof IItemDataRenderer) { |
|
43 | + if ($control instanceof \Prado\IDataRenderer) { |
|
44 | + if ($control instanceof IItemDataRenderer) { |
|
45 | 45 | $item = $cell->getParent(); |
46 | 46 | $control->setItemIndex($item->getItemIndex()); |
47 | 47 | $control->setItemType($item->getItemType()); |
@@ -50,19 +50,19 @@ discard block |
||
50 | 50 | } |
51 | 51 | $cell->getControls()->add($control); |
52 | 52 | } |
53 | - elseif($this->getAllowSorting()) { |
|
53 | + elseif ($this->getAllowSorting()) { |
|
54 | 54 | $sortExpression = $this->getSortExpression(); |
55 | - if(($url = $this->getHeaderImageUrl()) !== '') { |
|
55 | + if (($url = $this->getHeaderImageUrl()) !== '') { |
|
56 | 56 | $button = new TActiveImageButton; |
57 | 57 | $button->setImageUrl($url); |
58 | 58 | $button->setCommandName(TDataGrid::CMD_SORT); |
59 | 59 | $button->setCommandParameter($sortExpression); |
60 | - if($text !== '') |
|
60 | + if ($text !== '') |
|
61 | 61 | $button->setAlternateText($text); |
62 | 62 | $button->setCausesValidation(false); |
63 | 63 | $cell->getControls()->add($button); |
64 | 64 | } |
65 | - elseif($text !== '') { |
|
65 | + elseif ($text !== '') { |
|
66 | 66 | $button = new TActiveLinkButton; |
67 | 67 | $button->setText($text); |
68 | 68 | $button->setCommandName(TDataGrid::CMD_SORT); |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | $cell->setText(' '); |
75 | 75 | } |
76 | 76 | else { |
77 | - if(($url = $this->getHeaderImageUrl()) !== '') { |
|
77 | + if (($url = $this->getHeaderImageUrl()) !== '') { |
|
78 | 78 | $image = new TActiveImage; |
79 | 79 | $image->setImageUrl($url); |
80 | - if($text !== '') |
|
80 | + if ($text !== '') |
|
81 | 81 | $image->setAlternateText($text); |
82 | 82 | $cell->getControls()->add($image); |
83 | 83 | } |
84 | - elseif($text !== '') |
|
84 | + elseif ($text !== '') |
|
85 | 85 | $cell->setText($text); |
86 | 86 | else |
87 | 87 | $cell->setText(' '); |
@@ -49,42 +49,41 @@ |
||
49 | 49 | $control->setData($text); |
50 | 50 | } |
51 | 51 | $cell->getControls()->add($control); |
52 | - } |
|
53 | - elseif($this->getAllowSorting()) { |
|
52 | + } elseif($this->getAllowSorting()) { |
|
54 | 53 | $sortExpression = $this->getSortExpression(); |
55 | 54 | if(($url = $this->getHeaderImageUrl()) !== '') { |
56 | 55 | $button = new TActiveImageButton; |
57 | 56 | $button->setImageUrl($url); |
58 | 57 | $button->setCommandName(TDataGrid::CMD_SORT); |
59 | 58 | $button->setCommandParameter($sortExpression); |
60 | - if($text !== '') |
|
61 | - $button->setAlternateText($text); |
|
59 | + if($text !== '') { |
|
60 | + $button->setAlternateText($text); |
|
61 | + } |
|
62 | 62 | $button->setCausesValidation(false); |
63 | 63 | $cell->getControls()->add($button); |
64 | - } |
|
65 | - elseif($text !== '') { |
|
64 | + } elseif($text !== '') { |
|
66 | 65 | $button = new TActiveLinkButton; |
67 | 66 | $button->setText($text); |
68 | 67 | $button->setCommandName(TDataGrid::CMD_SORT); |
69 | 68 | $button->setCommandParameter($sortExpression); |
70 | 69 | $button->setCausesValidation(false); |
71 | 70 | $cell->getControls()->add($button); |
71 | + } else { |
|
72 | + $cell->setText(' '); |
|
72 | 73 | } |
73 | - else |
|
74 | - $cell->setText(' '); |
|
75 | - } |
|
76 | - else { |
|
74 | + } else { |
|
77 | 75 | if(($url = $this->getHeaderImageUrl()) !== '') { |
78 | 76 | $image = new TActiveImage; |
79 | 77 | $image->setImageUrl($url); |
80 | - if($text !== '') |
|
81 | - $image->setAlternateText($text); |
|
78 | + if($text !== '') { |
|
79 | + $image->setAlternateText($text); |
|
80 | + } |
|
82 | 81 | $cell->getControls()->add($image); |
83 | - } |
|
84 | - elseif($text !== '') |
|
85 | - $cell->setText($text); |
|
86 | - else |
|
87 | - $cell->setText(' '); |
|
82 | + } elseif($text !== '') { |
|
83 | + $cell->setText($text); |
|
84 | + } else { |
|
85 | + $cell->setText(' '); |
|
86 | + } |
|
88 | 87 | } |
89 | 88 | } |
90 | 89 | } |
91 | 90 | \ No newline at end of file |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | */ |
33 | 33 | class TActiveButtonColumn extends TButtonColumn { |
34 | 34 | public function initializeCell($cell, $columnIndex, $itemType) { |
35 | - if($itemType === TListItemType::Item || $itemType === TListItemType::AlternatingItem || $itemType === TListItemType::SelectedItem || $itemType === TListItemType::EditItem) { |
|
35 | + if ($itemType === TListItemType::Item || $itemType === TListItemType::AlternatingItem || $itemType === TListItemType::SelectedItem || $itemType === TListItemType::EditItem) { |
|
36 | 36 | $buttonType = $this->getButtonType(); |
37 | - if($buttonType === TButtonColumnType::LinkButton) |
|
37 | + if ($buttonType === TButtonColumnType::LinkButton) |
|
38 | 38 | $button = new TActiveLinkButton; |
39 | - elseif($buttonType === TButtonColumnType::PushButton) |
|
39 | + elseif ($buttonType === TButtonColumnType::PushButton) |
|
40 | 40 | $button = new TActiveButton; |
41 | 41 | else // image button |
42 | 42 | { |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | $button->setCommandName($this->getCommandName()); |
49 | 49 | $button->setCausesValidation($this->getCausesValidation()); |
50 | 50 | $button->setValidationGroup($this->getValidationGroup()); |
51 | - if($this->getDataTextField() !== '' || ($buttonType === TButtonColumnType::ImageButton && $this->getDataImageUrlField() !== '')) |
|
52 | - $button->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']); |
|
51 | + if ($this->getDataTextField() !== '' || ($buttonType === TButtonColumnType::ImageButton && $this->getDataImageUrlField() !== '')) |
|
52 | + $button->attachEventHandler('OnDataBinding', [$this, 'dataBindColumn']); |
|
53 | 53 | $cell->getControls()->add($button); |
54 | 54 | $cell->registerObject('Button', $button); |
55 | 55 | } |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | public function initializeCell($cell, $columnIndex, $itemType) { |
35 | 35 | if($itemType === TListItemType::Item || $itemType === TListItemType::AlternatingItem || $itemType === TListItemType::SelectedItem || $itemType === TListItemType::EditItem) { |
36 | 36 | $buttonType = $this->getButtonType(); |
37 | - if($buttonType === TButtonColumnType::LinkButton) |
|
38 | - $button = new TActiveLinkButton; |
|
39 | - elseif($buttonType === TButtonColumnType::PushButton) |
|
40 | - $button = new TActiveButton; |
|
41 | - else // image button |
|
37 | + if($buttonType === TButtonColumnType::LinkButton) { |
|
38 | + $button = new TActiveLinkButton; |
|
39 | + } elseif($buttonType === TButtonColumnType::PushButton) { |
|
40 | + $button = new TActiveButton; |
|
41 | + } else // image button |
|
42 | 42 | { |
43 | 43 | $button = new TActiveImageButton; |
44 | 44 | $button->setImageUrl($this->getImageUrl()); |
@@ -48,12 +48,13 @@ discard block |
||
48 | 48 | $button->setCommandName($this->getCommandName()); |
49 | 49 | $button->setCausesValidation($this->getCausesValidation()); |
50 | 50 | $button->setValidationGroup($this->getValidationGroup()); |
51 | - if($this->getDataTextField() !== '' || ($buttonType === TButtonColumnType::ImageButton && $this->getDataImageUrlField() !== '')) |
|
52 | - $button->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']); |
|
51 | + if($this->getDataTextField() !== '' || ($buttonType === TButtonColumnType::ImageButton && $this->getDataImageUrlField() !== '')) { |
|
52 | + $button->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']); |
|
53 | + } |
|
53 | 54 | $cell->getControls()->add($button); |
54 | 55 | $cell->registerObject('Button', $button); |
56 | + } else { |
|
57 | + parent::initializeCell($cell, $columnIndex, $itemType); |
|
55 | 58 | } |
56 | - else |
|
57 | - parent::initializeCell($cell, $columnIndex, $itemType); |
|
58 | 59 | } |
59 | 60 | } |
60 | 61 | \ No newline at end of file |