@@ -252,7 +252,7 @@ |
||
252 | 252 | } |
253 | 253 | |
254 | 254 | /** |
255 | - * @return boolean true to observe changes. |
|
255 | + * @return boolean|string true to observe changes. |
|
256 | 256 | */ |
257 | 257 | public function getObserveChanges() |
258 | 258 | { |
@@ -88,7 +88,7 @@ |
||
88 | 88 | */ |
89 | 89 | public function getObserveChanges() |
90 | 90 | { |
91 | - $changes = $this->getOption('ObserveChanges'); |
|
91 | + $changes=$this->getOption('ObserveChanges'); |
|
92 | 92 | return ($changes===null) ? true : $changes; |
93 | 93 | } |
94 | 94 | } |
95 | 95 | \ No newline at end of file |
@@ -233,6 +233,8 @@ |
||
233 | 233 | |
234 | 234 | /** |
235 | 235 | * Appends data or javascript code to the body content surrounded with delimiters |
236 | + * @param \Prado\Web\THttpResponse $response |
|
237 | + * @param string $delimiter |
|
236 | 238 | */ |
237 | 239 | private function appendContentPart($response, $delimiter, $data) |
238 | 240 | { |
@@ -256,14 +256,12 @@ |
||
256 | 256 | $param = $this->getCallbackEventParameter(); |
257 | 257 | $result = new TCallbackEventParameter($this->getResponse(), $param); |
258 | 258 | $callbackHandler->raiseCallbackEvent($result); |
259 | - } |
|
260 | - else |
|
259 | + } else |
|
261 | 260 | { |
262 | 261 | throw new TInvalidCallbackException( |
263 | 262 | 'callback_invalid_handler', $callbackHandler->getUniqueID()); |
264 | 263 | } |
265 | - } |
|
266 | - else |
|
264 | + } else |
|
267 | 265 | { |
268 | 266 | $target = $this->getRequest()->itemAt(TPage::FIELD_CALLBACK_TARGET); |
269 | 267 | throw new TInvalidCallbackException('callback_invalid_target', $target); |
@@ -37,40 +37,40 @@ discard block |
||
37 | 37 | /** |
38 | 38 | * Callback response data header name. |
39 | 39 | */ |
40 | - const CALLBACK_DATA_HEADER = 'X-PRADO-DATA'; |
|
40 | + const CALLBACK_DATA_HEADER='X-PRADO-DATA'; |
|
41 | 41 | /** |
42 | 42 | * Callback response client-side action header name. |
43 | 43 | */ |
44 | - const CALLBACK_ACTION_HEADER = 'X-PRADO-ACTIONS'; |
|
44 | + const CALLBACK_ACTION_HEADER='X-PRADO-ACTIONS'; |
|
45 | 45 | /** |
46 | 46 | * Callback error header name. |
47 | 47 | */ |
48 | - const CALLBACK_ERROR_HEADER = 'X-PRADO-ERROR'; |
|
48 | + const CALLBACK_ERROR_HEADER='X-PRADO-ERROR'; |
|
49 | 49 | /** |
50 | 50 | * Callback page state header name. |
51 | 51 | */ |
52 | - const CALLBACK_PAGESTATE_HEADER = 'X-PRADO-PAGESTATE'; |
|
52 | + const CALLBACK_PAGESTATE_HEADER='X-PRADO-PAGESTATE'; |
|
53 | 53 | /** |
54 | 54 | * Script list header name. |
55 | 55 | */ |
56 | - const CALLBACK_SCRIPTLIST_HEADER = 'X-PRADO-SCRIPTLIST'; |
|
56 | + const CALLBACK_SCRIPTLIST_HEADER='X-PRADO-SCRIPTLIST'; |
|
57 | 57 | /** |
58 | 58 | * Stylesheet list header name. |
59 | 59 | */ |
60 | - const CALLBACK_STYLESHEETLIST_HEADER = 'X-PRADO-STYLESHEETLIST'; |
|
60 | + const CALLBACK_STYLESHEETLIST_HEADER='X-PRADO-STYLESHEETLIST'; |
|
61 | 61 | /** |
62 | 62 | * Stylesheet header name. |
63 | 63 | */ |
64 | - const CALLBACK_STYLESHEET_HEADER = 'X-PRADO-STYLESHEET'; |
|
64 | + const CALLBACK_STYLESHEET_HEADER='X-PRADO-STYLESHEET'; |
|
65 | 65 | /** |
66 | 66 | * Hidden field list header name. |
67 | 67 | */ |
68 | - const CALLBACK_HIDDENFIELDLIST_HEADER = 'X-PRADO-HIDDENFIELDLIST'; |
|
68 | + const CALLBACK_HIDDENFIELDLIST_HEADER='X-PRADO-HIDDENFIELDLIST'; |
|
69 | 69 | |
70 | 70 | /** |
71 | 71 | * Callback redirect url header name. |
72 | 72 | */ |
73 | - const CALLBACK_REDIRECT = 'X-PRADO-REDIRECT'; |
|
73 | + const CALLBACK_REDIRECT='X-PRADO-REDIRECT'; |
|
74 | 74 | |
75 | 75 | /** |
76 | 76 | * @var ICallbackEventHandler callback event handler. |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | parent::__construct($control); |
97 | 97 | |
98 | 98 | //TODO: can this be done later? |
99 | - $response = $this->getApplication()->getResponse(); |
|
99 | + $response=$this->getApplication()->getResponse(); |
|
100 | 100 | $response->setAdapter(new TCallbackResponseAdapter($response)); |
101 | 101 | |
102 | 102 | $this->trapCallbackErrorsExceptions(); |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function processCallbackEvent($writer) |
110 | 110 | { |
111 | - Prado::trace("ActivePage raiseCallbackEvent()",'Prado\Web\UI\ActiveControls\TActivePageAdapter'); |
|
111 | + Prado::trace("ActivePage raiseCallbackEvent()", 'Prado\Web\UI\ActiveControls\TActivePageAdapter'); |
|
112 | 112 | $this->raiseCallbackEvent(); |
113 | 113 | } |
114 | 114 | |
@@ -117,11 +117,11 @@ discard block |
||
117 | 117 | * @param TControl control for defered rendering |
118 | 118 | * @param THtmlWriter the renderer |
119 | 119 | */ |
120 | - public function registerControlToRender($control,$writer) |
|
120 | + public function registerControlToRender($control, $writer) |
|
121 | 121 | { |
122 | - $id = $control->getUniqueID(); |
|
122 | + $id=$control->getUniqueID(); |
|
123 | 123 | if(!isset($this->_controlsToRender[$id])) |
124 | - $this->_controlsToRender[$id] = array($control,$writer); |
|
124 | + $this->_controlsToRender[$id]=array($control, $writer); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function renderCallbackResponse($writer) |
140 | 140 | { |
141 | - Prado::trace("ActivePage renderCallbackResponse()",'Prado\Web\UI\ActiveControls\TActivePageAdapter'); |
|
142 | - if(($url = $this->getResponse()->getAdapter()->getRedirectedUrl())===null) |
|
141 | + Prado::trace("ActivePage renderCallbackResponse()", 'Prado\Web\UI\ActiveControls\TActivePageAdapter'); |
|
142 | + if(($url=$this->getResponse()->getAdapter()->getRedirectedUrl())===null) |
|
143 | 143 | $this->renderResponse($writer); |
144 | 144 | else |
145 | 145 | $this->redirect($url); |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | */ |
152 | 152 | protected function redirect($url) |
153 | 153 | { |
154 | - Prado::trace("ActivePage redirect()",'Prado\Web\UI\ActiveControls\TActivePageAdapter'); |
|
154 | + Prado::trace("ActivePage redirect()", 'Prado\Web\UI\ActiveControls\TActivePageAdapter'); |
|
155 | 155 | $this->appendContentPart($this->getResponse(), self::CALLBACK_REDIRECT, $url); |
156 | 156 | } |
157 | 157 | |
@@ -162,31 +162,31 @@ discard block |
||
162 | 162 | */ |
163 | 163 | protected function renderResponse($writer) |
164 | 164 | { |
165 | - Prado::trace("ActivePage renderResponse()",'Prado\Web\UI\ActiveControls\TActivePageAdapter'); |
|
165 | + Prado::trace("ActivePage renderResponse()", 'Prado\Web\UI\ActiveControls\TActivePageAdapter'); |
|
166 | 166 | //renders all the defered render() calls. |
167 | 167 | foreach($this->_controlsToRender as $rid => $forRender) |
168 | 168 | $forRender[0]->render($forRender[1]); |
169 | 169 | |
170 | - $response = $this->getResponse(); |
|
170 | + $response=$this->getResponse(); |
|
171 | 171 | |
172 | 172 | //send response data in header |
173 | 173 | if($response->getHasAdapter()) |
174 | 174 | { |
175 | - $responseData = $response->getAdapter()->getResponseData(); |
|
175 | + $responseData=$response->getAdapter()->getResponseData(); |
|
176 | 176 | if($responseData!==null) |
177 | 177 | { |
178 | - $data = TJavaScript::jsonEncode($responseData); |
|
178 | + $data=TJavaScript::jsonEncode($responseData); |
|
179 | 179 | |
180 | 180 | $this->appendContentPart($response, self::CALLBACK_DATA_HEADER, $data); |
181 | 181 | } |
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 | 187 | if($handler->getActiveControl()->getClientSide()->getEnablePageStateUpdate()) |
188 | 188 | { |
189 | - $pagestate = $this->getPage()->getClientState(); |
|
189 | + $pagestate=$this->getPage()->getClientState(); |
|
190 | 190 | $this->appendContentPart($response, self::CALLBACK_PAGESTATE_HEADER, $pagestate); |
191 | 191 | } |
192 | 192 | } |
@@ -197,37 +197,37 @@ discard block |
||
197 | 197 | //output the end javascript |
198 | 198 | if($this->getPage()->getClientScript()->hasEndScripts()) |
199 | 199 | { |
200 | - $writer = $response->createHtmlWriter(); |
|
200 | + $writer=$response->createHtmlWriter(); |
|
201 | 201 | $this->getPage()->getClientScript()->renderEndScriptsCallback($writer); |
202 | 202 | $this->getPage()->getCallbackClient()->evaluateScript($writer); |
203 | 203 | } |
204 | 204 | |
205 | 205 | //output the actions |
206 | - $executeJavascript = $this->getCallbackClientHandler()->getClientFunctionsToExecute(); |
|
207 | - $actions = TJavaScript::jsonEncode($executeJavascript); |
|
206 | + $executeJavascript=$this->getCallbackClientHandler()->getClientFunctionsToExecute(); |
|
207 | + $actions=TJavaScript::jsonEncode($executeJavascript); |
|
208 | 208 | $this->appendContentPart($response, self::CALLBACK_ACTION_HEADER, $actions); |
209 | 209 | |
210 | 210 | |
211 | - $cs = $this->Page->getClientScript(); |
|
211 | + $cs=$this->Page->getClientScript(); |
|
212 | 212 | |
213 | 213 | // collect all stylesheet file references |
214 | - $stylesheets = $cs->getStyleSheetUrls(); |
|
215 | - if (count($stylesheets)>0) |
|
214 | + $stylesheets=$cs->getStyleSheetUrls(); |
|
215 | + if(count($stylesheets) > 0) |
|
216 | 216 | $this->appendContentPart($response, self::CALLBACK_STYLESHEETLIST_HEADER, TJavaScript::jsonEncode($stylesheets)); |
217 | 217 | |
218 | 218 | // collect all stylesheet snippets references |
219 | - $stylesheets = $cs->getStyleSheetCodes(); |
|
220 | - if (count($stylesheets)>0) |
|
219 | + $stylesheets=$cs->getStyleSheetCodes(); |
|
220 | + if(count($stylesheets) > 0) |
|
221 | 221 | $this->appendContentPart($response, self::CALLBACK_STYLESHEET_HEADER, TJavaScript::jsonEncode($stylesheets)); |
222 | 222 | |
223 | 223 | // collect all script file references |
224 | - $scripts = $cs->getScriptUrls(); |
|
225 | - if (count($scripts)>0) |
|
224 | + $scripts=$cs->getScriptUrls(); |
|
225 | + if(count($scripts) > 0) |
|
226 | 226 | $this->appendContentPart($response, self::CALLBACK_SCRIPTLIST_HEADER, TJavaScript::jsonEncode($scripts)); |
227 | 227 | |
228 | 228 | // collect all hidden field references |
229 | - $fields = $cs->getHiddenFields(); |
|
230 | - if (count($fields)>0) |
|
229 | + $fields=$cs->getHiddenFields(); |
|
230 | + if(count($fields) > 0) |
|
231 | 231 | $this->appendContentPart($response, self::CALLBACK_HIDDENFIELDLIST_HEADER, TJavaScript::jsonEncode($fields)); |
232 | 232 | } |
233 | 233 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | */ |
237 | 237 | private function appendContentPart($response, $delimiter, $data) |
238 | 238 | { |
239 | - $content = $response->createHtmlWriter(); |
|
239 | + $content=$response->createHtmlWriter(); |
|
240 | 240 | $content->getWriter()->setBoundary($delimiter); |
241 | 241 | $content->write($data); |
242 | 242 | } |
@@ -253,8 +253,8 @@ discard block |
||
253 | 253 | { |
254 | 254 | if($callbackHandler instanceof ICallbackEventHandler) |
255 | 255 | { |
256 | - $param = $this->getCallbackEventParameter(); |
|
257 | - $result = new TCallbackEventParameter($this->getResponse(), $param); |
|
256 | + $param=$this->getCallbackEventParameter(); |
|
257 | + $result=new TCallbackEventParameter($this->getResponse(), $param); |
|
258 | 258 | $callbackHandler->raiseCallbackEvent($result); |
259 | 259 | } |
260 | 260 | else |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | } |
266 | 266 | else |
267 | 267 | { |
268 | - $target = $this->getRequest()->itemAt(TPage::FIELD_CALLBACK_TARGET); |
|
268 | + $target=$this->getRequest()->itemAt(TPage::FIELD_CALLBACK_TARGET); |
|
269 | 269 | throw new TInvalidCallbackException('callback_invalid_target', $target); |
270 | 270 | } |
271 | 271 | } |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | { |
303 | 303 | if($this->_callbackEventParameter===null) |
304 | 304 | { |
305 | - $param = $this->getRequest()->itemAt(TPage::FIELD_CALLBACK_PARAMETER); |
|
305 | + $param=$this->getRequest()->itemAt(TPage::FIELD_CALLBACK_PARAMETER); |
|
306 | 306 | $this->_callbackEventParameter=$param; |
307 | 307 | } |
308 | 308 | return $this->_callbackEventParameter; |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | public function getCallbackClientHandler() |
325 | 325 | { |
326 | 326 | if($this->_callbackClient===null) |
327 | - $this->_callbackClient = new TCallbackClientScript; |
|
327 | + $this->_callbackClient=new TCallbackClientScript; |
|
328 | 328 | return $this->_callbackClient; |
329 | 329 | } |
330 | 330 | } |
331 | 331 | \ No newline at end of file |
@@ -76,7 +76,7 @@ |
||
76 | 76 | |
77 | 77 | /** |
78 | 78 | * Creates a control used for repetition (used as a template). |
79 | - * @return TControl the control to be repeated |
|
79 | + * @return TActiveRadioButtonItem the control to be repeated |
|
80 | 80 | */ |
81 | 81 | protected function createRepeatedControl() |
82 | 82 | { |
@@ -80,7 +80,7 @@ |
||
80 | 80 | */ |
81 | 81 | protected function createRepeatedControl() |
82 | 82 | { |
83 | - $control = new TActiveRadioButtonItem; |
|
83 | + $control=new TActiveRadioButtonItem; |
|
84 | 84 | $control->getAdapter()->setBaseActiveControl($this->getActiveControl()); |
85 | 85 | return $control; |
86 | 86 | } |
@@ -113,6 +113,7 @@ |
||
113 | 113 | * method, be sure to call the parent implementation so that the event |
114 | 114 | * handler can be invoked. |
115 | 115 | * @param TActiveTableCellEventParameter event parameter to be passed to the event handlers |
116 | + * @param TActiveTableCellEventParameter $param |
|
116 | 117 | */ |
117 | 118 | public function onCellSelected($param) |
118 | 119 | { |
@@ -55,8 +55,8 @@ |
||
55 | 55 | { |
56 | 56 | |
57 | 57 | /** |
58 | - * @var TTable parent row control containing the cell |
|
59 | - */ |
|
58 | + * @var TTable parent row control containing the cell |
|
59 | + */ |
|
60 | 60 | private $_row; |
61 | 61 | |
62 | 62 | /** |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function raiseCallbackEvent($param) |
104 | 104 | { |
105 | - $parameter = new TActiveTableCellEventParameter($this->getResponse(), $param->getCallbackParameter(), $this->getCellIndex()); |
|
105 | + $parameter=new TActiveTableCellEventParameter($this->getResponse(), $param->getCallbackParameter(), $this->getCellIndex()); |
|
106 | 106 | $this->onCellSelected($parameter); |
107 | 107 | $this->raiseBubbleEvent($this, $parameter); |
108 | 108 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | { |
130 | 130 | parent::addAttributesToRender($writer); |
131 | 131 | $writer->addAttribute('id', $this->getClientID()); |
132 | - if ($this->hasEventHandler('OnCellSelected')) |
|
132 | + if($this->hasEventHandler('OnCellSelected')) |
|
133 | 133 | $this->getActiveControl()->registerCallbackClientScript($this->getClientClassName(), $this->getPostBackOptions()); |
134 | 134 | } |
135 | 135 | |
@@ -142,19 +142,19 @@ discard block |
||
142 | 142 | */ |
143 | 143 | public function render($writer) |
144 | 144 | { |
145 | - if ($this->getHasPreRendered()) |
|
145 | + if($this->getHasPreRendered()) |
|
146 | 146 | { |
147 | 147 | parent::render($writer); |
148 | - if ($this->getActiveControl()->canUpdateClientSide()) |
|
148 | + if($this->getActiveControl()->canUpdateClientSide()) |
|
149 | 149 | $this->getPage()->getCallbackClient()->replaceContent($this, $writer); |
150 | 150 | } |
151 | 151 | else { |
152 | 152 | $this->getPage()->getAdapter()->registerControlToRender($this, $writer); |
153 | 153 | // If we update a TActiveTableCell on callback, we shouldn't update all childs, |
154 | 154 | // because the whole content will be replaced by the parent. |
155 | - if ($this->getHasControls()) |
|
155 | + if($this->getHasControls()) |
|
156 | 156 | { |
157 | - foreach ($this->findControlsByType('Prado\Web\UI\ActiveControls\IActiveControl', false) as $control) |
|
157 | + foreach($this->findControlsByType('Prado\Web\UI\ActiveControls\IActiveControl', false) as $control) |
|
158 | 158 | $control->getActiveControl()->setEnableUpdate(false); |
159 | 159 | } |
160 | 160 | } |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | */ |
168 | 168 | protected function getPostBackOptions() |
169 | 169 | { |
170 | - $options['ID'] = $this->getClientID(); |
|
171 | - $options['EventTarget'] = $this->getUniqueID(); |
|
170 | + $options['ID']=$this->getClientID(); |
|
171 | + $options['EventTarget']=$this->getUniqueID(); |
|
172 | 172 | return $options; |
173 | 173 | } |
174 | 174 | |
@@ -180,8 +180,8 @@ discard block |
||
180 | 180 | */ |
181 | 181 | public function getCellIndex() |
182 | 182 | { |
183 | - foreach ($this->getRow()->getCells() as $key => $row) |
|
184 | - if ($row == $this) return $key; |
|
183 | + foreach($this->getRow()->getCells() as $key => $row) |
|
184 | + if($row==$this) return $key; |
|
185 | 185 | throw new TConfigurationException('tactivetablecell_control_notincollection', get_class($this), $this->getUniqueID()); |
186 | 186 | } |
187 | 187 | |
@@ -192,14 +192,14 @@ discard block |
||
192 | 192 | */ |
193 | 193 | public function getRow() |
194 | 194 | { |
195 | - if ($this->_row === null) |
|
195 | + if($this->_row===null) |
|
196 | 196 | { |
197 | - $row = $this->getParent(); |
|
198 | - while (!($row instanceof TTableRow) && $row !== null) |
|
197 | + $row=$this->getParent(); |
|
198 | + while(!($row instanceof TTableRow) && $row!==null) |
|
199 | 199 | { |
200 | - $row = $row->getParent(); |
|
200 | + $row=$row->getParent(); |
|
201 | 201 | } |
202 | - if ($row instanceof TTableRow) $this->_row = $row; |
|
202 | + if($row instanceof TTableRow) $this->_row=$row; |
|
203 | 203 | else throw new TConfigurationException('tactivetablecell_control_outoftable', get_class($this), $this->getUniqueID()); |
204 | 204 | } |
205 | 205 | return $this->_row; |
@@ -147,8 +147,7 @@ |
||
147 | 147 | parent::render($writer); |
148 | 148 | if ($this->getActiveControl()->canUpdateClientSide()) |
149 | 149 | $this->getPage()->getCallbackClient()->replaceContent($this, $writer); |
150 | - } |
|
151 | - else { |
|
150 | + } else { |
|
152 | 151 | $this->getPage()->getAdapter()->registerControlToRender($this, $writer); |
153 | 152 | // If we update a TActiveTableCell on callback, we shouldn't update all childs, |
154 | 153 | // because the whole content will be replaced by the parent. |
@@ -38,6 +38,7 @@ |
||
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Creates a new TActiveTableRowEventParameter. |
41 | + * @param \Prado\Web\THttpResponse $response |
|
41 | 42 | */ |
42 | 43 | public function __construct($response, $parameter, $index=-1) |
43 | 44 | { |
@@ -32,8 +32,8 @@ |
||
32 | 32 | { |
33 | 33 | |
34 | 34 | /** |
35 | - * @var integer the zero-based index of the cell. |
|
36 | - */ |
|
35 | + * @var integer the zero-based index of the cell. |
|
36 | + */ |
|
37 | 37 | private $_selectedCellIndex = -1; |
38 | 38 | |
39 | 39 | /** |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | /** |
35 | 35 | * @var integer the zero-based index of the cell. |
36 | 36 | */ |
37 | - private $_selectedCellIndex = -1; |
|
37 | + private $_selectedCellIndex=-1; |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Creates a new TActiveTableRowEventParameter. |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | public function __construct($response, $parameter, $index=-1) |
43 | 43 | { |
44 | 44 | parent::__construct($response, $parameter); |
45 | - $this->_selectedCellIndex = $index; |
|
45 | + $this->_selectedCellIndex=$index; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -28,6 +28,7 @@ |
||
28 | 28 | |
29 | 29 | /** |
30 | 30 | * Creates a new TCallbackEventParameter. |
31 | + * @param \Prado\Web\THttpResponse $response |
|
31 | 32 | */ |
32 | 33 | public function __construct($response, $parameter, $index=-1) |
33 | 34 | { |
@@ -59,6 +59,7 @@ discard block |
||
59 | 59 | /** |
60 | 60 | * Sets the client side options. Can only be set when client side is null. |
61 | 61 | * @param TCallbackClientSide client side options. |
62 | + * @param TActiveCustomValidatorClientSide $client |
|
62 | 63 | */ |
63 | 64 | public function setClientSide($client) |
64 | 65 | { |
@@ -225,6 +226,7 @@ discard block |
||
225 | 226 | * {@link getClientSide ClientSide} property. |
226 | 227 | * @param string client side javascript class name. |
227 | 228 | * @param array additional callback options. |
229 | + * @param string $class |
|
228 | 230 | */ |
229 | 231 | public function registerCallbackClientScript($class,$options=null) |
230 | 232 | { |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function getClientSide() |
50 | 50 | { |
51 | - if(($client = $this->getOption('ClientSide'))===null) |
|
51 | + if(($client=$this->getOption('ClientSide'))===null) |
|
52 | 52 | { |
53 | - $client = $this->createClientSide(); |
|
53 | + $client=$this->createClientSide(); |
|
54 | 54 | $this->setOption('ClientSide', $client); |
55 | 55 | } |
56 | 56 | return $client; |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function setClientSide($client) |
64 | 64 | { |
65 | - if( $this->getOption('ClientSide')===null) |
|
65 | + if($this->getOption('ClientSide')===null) |
|
66 | 66 | $this->setOption('ClientSide', $client); |
67 | 67 | else |
68 | 68 | throw new TConfigurationException( |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | { |
110 | 110 | if(($id=$this->getCallbackOptions())!=='') |
111 | 111 | { |
112 | - if(($pos=strrpos($id,'.'))!==false) |
|
112 | + if(($pos=strrpos($id, '.'))!==false) |
|
113 | 113 | { |
114 | - $control=$this->getControl()->getSubProperty(substr($id,0,$pos)); |
|
115 | - $newid=substr($id,$pos+1); |
|
116 | - if ($control!==null) |
|
114 | + $control=$this->getControl()->getSubProperty(substr($id, 0, $pos)); |
|
115 | + $newid=substr($id, $pos + 1); |
|
116 | + if($control!==null) |
|
117 | 117 | $control=$control->$newid; |
118 | 118 | } |
119 | 119 | else |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function getCausesValidation() |
140 | 140 | { |
141 | - return $this->getOption('CausesValidation',true); |
|
141 | + return $this->getOption('CausesValidation', true); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function setCausesValidation($value) |
149 | 149 | { |
150 | - $this->setOption('CausesValidation',TPropertyValue::ensureBoolean($value),true); |
|
150 | + $this->setOption('CausesValidation', TPropertyValue::ensureBoolean($value), true); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function getValidationGroup() |
158 | 158 | { |
159 | - return $this->getOption('ValidationGroup',''); |
|
159 | + return $this->getOption('ValidationGroup', ''); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | */ |
166 | 166 | public function setValidationGroup($value) |
167 | 167 | { |
168 | - $this->setOption('ValidationGroup',$value,''); |
|
168 | + $this->setOption('ValidationGroup', $value, ''); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | if($this->getCausesValidation()) |
178 | 178 | { |
179 | 179 | $group=$this->getValidationGroup(); |
180 | - return $this->getPage()->getValidators($group)->getCount()>0; |
|
180 | + return $this->getPage()->getValidators($group)->getCount() > 0; |
|
181 | 181 | } |
182 | 182 | else |
183 | 183 | return false; |
@@ -205,15 +205,15 @@ discard block |
||
205 | 205 | */ |
206 | 206 | protected function getClientSideOptions() |
207 | 207 | { |
208 | - $default = $this->getDefaultClientSideOptions(); |
|
209 | - $options = array_merge($default,$this->getClientSide()->getOptions()->toArray()); |
|
210 | - $validate = $this->getCausesValidation(); |
|
211 | - $options['CausesValidation']= $validate ? '' : false; |
|
208 | + $default=$this->getDefaultClientSideOptions(); |
|
209 | + $options=array_merge($default, $this->getClientSide()->getOptions()->toArray()); |
|
210 | + $validate=$this->getCausesValidation(); |
|
211 | + $options['CausesValidation']=$validate ? '' : false; |
|
212 | 212 | $options['ValidationGroup']=$this->getValidationGroup(); |
213 | - $options['CallbackParameter'] = $this->getCallbackParameter(); |
|
213 | + $options['CallbackParameter']=$this->getCallbackParameter(); |
|
214 | 214 | // needed for TCallback |
215 | 215 | if(!isset($options['EventTarget'])) |
216 | - $options['EventTarget'] = $this->getControl()->getUniqueID(); |
|
216 | + $options['EventTarget']=$this->getControl()->getUniqueID(); |
|
217 | 217 | return $options; |
218 | 218 | } |
219 | 219 | |
@@ -226,13 +226,13 @@ discard block |
||
226 | 226 | * @param string client side javascript class name. |
227 | 227 | * @param array additional callback options. |
228 | 228 | */ |
229 | - public function registerCallbackClientScript($class,$options=null) |
|
229 | + public function registerCallbackClientScript($class, $options=null) |
|
230 | 230 | { |
231 | - $cs = $this->getPage()->getClientScript(); |
|
231 | + $cs=$this->getPage()->getClientScript(); |
|
232 | 232 | if(is_array($options)) |
233 | - $options = array_merge($this->getClientSideOptions(),$options); |
|
233 | + $options=array_merge($this->getClientSideOptions(), $options); |
|
234 | 234 | else |
235 | - $options = $this->getClientSideOptions(); |
|
235 | + $options=$this->getClientSideOptions(); |
|
236 | 236 | |
237 | 237 | //remove true as default to save bytes |
238 | 238 | if($options['CausesValidation']===true) |
@@ -261,8 +261,8 @@ discard block |
||
261 | 261 | */ |
262 | 262 | public function getJavascript() |
263 | 263 | { |
264 | - $client = $this->getPage()->getClientScript(); |
|
265 | - return $client->getCallbackReference($this->getControl(),$this->getClientSideOptions()); |
|
264 | + $client=$this->getPage()->getClientScript(); |
|
265 | + return $client->getCallbackReference($this->getControl(), $this->getClientSideOptions()); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | /** |
@@ -233,8 +233,7 @@ discard block |
||
233 | 233 | $newid=substr($id,$pos+1); |
234 | 234 | if ($control!==null) |
235 | 235 | $control=$control->$newid; |
236 | - } |
|
237 | - else |
|
236 | + } else |
|
238 | 237 | { |
239 | 238 | // TCheckBoxList overrides findControl() with a fake implementation |
240 | 239 | // but accepts a second parameter to use the standard one |
@@ -296,8 +295,7 @@ discard block |
||
296 | 295 | { |
297 | 296 | $group=$this->getValidationGroup(); |
298 | 297 | return $this->getPage()->getValidators($group)->getCount()>0; |
299 | - } |
|
300 | - else |
|
298 | + } else |
|
301 | 299 | return false; |
302 | 300 | } |
303 | 301 |
@@ -58,6 +58,8 @@ discard block |
||
58 | 58 | * @param string option name. |
59 | 59 | * @param mixed new value. |
60 | 60 | * @param mixed default value. |
61 | + * @param string $name |
|
62 | + * @param string|boolean $default |
|
61 | 63 | * @return mixed options value. |
62 | 64 | */ |
63 | 65 | protected function setOption($name,$value,$default=null) |
@@ -72,6 +74,8 @@ discard block |
||
72 | 74 | * named values for the base active controls. |
73 | 75 | * @param string option name. |
74 | 76 | * @param mixed default value. |
77 | + * @param string $name |
|
78 | + * @param string|boolean $default |
|
75 | 79 | * @return mixed options value. |
76 | 80 | */ |
77 | 81 | protected function getOption($name,$default=null) |
@@ -89,7 +93,7 @@ discard block |
||
89 | 93 | } |
90 | 94 | |
91 | 95 | /** |
92 | - * @return TPage the page containing the attached control. |
|
96 | + * @return \Prado\Web\UI\TPage the page containing the attached control. |
|
93 | 97 | */ |
94 | 98 | protected function getPage() |
95 | 99 | { |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function __construct($control) |
50 | 50 | { |
51 | - $this->_control = $control; |
|
52 | - $this->_options = new TMap; |
|
51 | + $this->_control=$control; |
|
52 | + $this->_options=new TMap; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -60,11 +60,11 @@ discard block |
||
60 | 60 | * @param mixed default value. |
61 | 61 | * @return mixed options value. |
62 | 62 | */ |
63 | - protected function setOption($name,$value,$default=null) |
|
63 | + protected function setOption($name, $value, $default=null) |
|
64 | 64 | { |
65 | - $value = ($value===null) ? $default : $value; |
|
65 | + $value=($value===null) ? $default : $value; |
|
66 | 66 | if($value!==null) |
67 | - $this->_options->add($name,$value); |
|
67 | + $this->_options->add($name, $value); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | * @param mixed default value. |
75 | 75 | * @return mixed options value. |
76 | 76 | */ |
77 | - protected function getOption($name,$default=null) |
|
77 | + protected function getOption($name, $default=null) |
|
78 | 78 | { |
79 | - $item = $this->_options->itemAt($name); |
|
79 | + $item=$this->_options->itemAt($name); |
|
80 | 80 | return ($item===null) ? $default : $item; |
81 | 81 | } |
82 | 82 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | public function canUpdateClientSide($bDontRequireVisibility=false) |
132 | 132 | { |
133 | 133 | return $this->getControl()->getHasChildInitialized() |
134 | - && $this->getPage()->getIsLoadingPostData() == false |
|
134 | + && $this->getPage()->getIsLoadingPostData()==false |
|
135 | 135 | && $this->getPage()->getIsCallback() |
136 | 136 | && $this->getEnableUpdate() |
137 | 137 | && ($bDontRequireVisibility || $this->getControl()->getVisible()); |
@@ -39,7 +39,7 @@ |
||
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
42 | - * @param string CSS custom style string. |
|
42 | + * @param string string custom style string. |
|
43 | 43 | * @param array CSS style as name-value array. |
44 | 44 | */ |
45 | 45 | protected function getStyleFromString($string) |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | { |
32 | 32 | if(!($obj instanceof TStyle)) |
33 | 33 | return array(); |
34 | - $style = $obj->getStyleFields(); |
|
35 | - $style = array_merge($style,$this->getStyleFromString($obj->getCustomStyle())); |
|
34 | + $style=$obj->getStyleFields(); |
|
35 | + $style=array_merge($style, $this->getStyleFromString($obj->getCustomStyle())); |
|
36 | 36 | if($obj->hasFont()) |
37 | - $style = array_merge($style, $this->getStyleFromString($obj->getFont()->toString())); |
|
37 | + $style=array_merge($style, $this->getStyleFromString($obj->getFont()->toString())); |
|
38 | 38 | return $style; |
39 | 39 | } |
40 | 40 | |
@@ -44,14 +44,14 @@ discard block |
||
44 | 44 | */ |
45 | 45 | protected function getStyleFromString($string) |
46 | 46 | { |
47 | - $style = array(); |
|
47 | + $style=array(); |
|
48 | 48 | if(!is_string($string)) return $style; |
49 | 49 | |
50 | - foreach(explode(';',$string) as $sub) |
|
50 | + foreach(explode(';', $string) as $sub) |
|
51 | 51 | { |
52 | - $arr=explode(':',$sub); |
|
52 | + $arr=explode(':', $sub); |
|
53 | 53 | if(isset($arr[1]) && trim($arr[0])!=='') |
54 | - $style[trim($arr[0])] = trim($arr[1]); |
|
54 | + $style[trim($arr[0])]=trim($arr[1]); |
|
55 | 55 | } |
56 | 56 | return $style; |
57 | 57 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | } |
69 | 69 | else |
70 | 70 | { |
71 | - return $this->_old->getCssClass() !== $this->_new->getCssClass() ? |
|
71 | + return $this->_old->getCssClass()!==$this->_new->getCssClass() ? |
|
72 | 72 | $this->_new->getCssClass() : null; |
73 | 73 | } |
74 | 74 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | protected function getStyleDiff() |
80 | 80 | { |
81 | - $diff = array_diff_assoc( |
|
81 | + $diff=array_diff_assoc( |
|
82 | 82 | $this->getCombinedStyle($this->_new), |
83 | 83 | $this->getCombinedStyle($this->_old)); |
84 | 84 | return count($diff) > 0 ? $diff : null; |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | return $this->_null; |
94 | 94 | else |
95 | 95 | { |
96 | - $css = $this->getCssClassDiff(); |
|
97 | - $style = $this->getStyleDiff(); |
|
96 | + $css=$this->getCssClassDiff(); |
|
97 | + $style=$this->getStyleDiff(); |
|
98 | 98 | if(($css!==null) || ($style!==null)) |
99 | 99 | return array('CssClass' => $css, 'Style' => $style); |
100 | 100 | else |
@@ -65,8 +65,7 @@ |
||
65 | 65 | { |
66 | 66 | return ($this->_new!==null) && $this->_new->hasCssClass() |
67 | 67 | ? $this->_new->getCssClass() : null; |
68 | - } |
|
69 | - else |
|
68 | + } else |
|
70 | 69 | { |
71 | 70 | return $this->_old->getCssClass() !== $this->_new->getCssClass() ? |
72 | 71 | $this->_new->getCssClass() : null; |