@@ -106,8 +106,7 @@ discard block |
||
106 | 106 | { |
107 | 107 | if($this->getEnableClientScript() && $this->needPostBackScript()) |
108 | 108 | $this->renderClientControlScript($writer); |
109 | - } |
|
110 | - else if($this->getEnabled()) // in this case, parent will not render 'disabled' |
|
109 | + } else if($this->getEnabled()) // in this case, parent will not render 'disabled' |
|
111 | 110 | $writer->addAttribute('disabled','disabled'); |
112 | 111 | parent::addAttributesToRender($writer); |
113 | 112 | } |
@@ -141,8 +140,7 @@ discard block |
||
141 | 140 | { |
142 | 141 | $group=$this->getValidationGroup(); |
143 | 142 | return $this->getPage()->getValidators($group)->getCount()>0; |
144 | - } |
|
145 | - else |
|
143 | + } else |
|
146 | 144 | return false; |
147 | 145 | } |
148 | 146 |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function getEnableClientScript() |
80 | 80 | { |
81 | - return $this->getViewState('EnableClientScript',true); |
|
81 | + return $this->getViewState('EnableClientScript', true); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function setEnableClientScript($value) |
88 | 88 | { |
89 | - $this->setViewState('EnableClientScript',TPropertyValue::ensureBoolean($value),true); |
|
89 | + $this->setViewState('EnableClientScript', TPropertyValue::ensureBoolean($value), true); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -98,16 +98,16 @@ discard block |
||
98 | 98 | { |
99 | 99 | $page=$this->getPage(); |
100 | 100 | $page->ensureRenderInForm($this); |
101 | - $writer->addAttribute('type','image'); |
|
101 | + $writer->addAttribute('type', 'image'); |
|
102 | 102 | if(($uniqueID=$this->getUniqueID())!=='') |
103 | - $writer->addAttribute('name',$uniqueID); |
|
103 | + $writer->addAttribute('name', $uniqueID); |
|
104 | 104 | if($this->getEnabled(true)) |
105 | 105 | { |
106 | 106 | if($this->getEnableClientScript() && $this->needPostBackScript()) |
107 | 107 | $this->renderClientControlScript($writer); |
108 | 108 | } |
109 | 109 | else if($this->getEnabled()) // in this case, parent will not render 'disabled' |
110 | - $writer->addAttribute('disabled','disabled'); |
|
110 | + $writer->addAttribute('disabled', 'disabled'); |
|
111 | 111 | parent::addAttributesToRender($writer); |
112 | 112 | } |
113 | 113 | |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | */ |
117 | 117 | protected function renderClientControlScript($writer) |
118 | 118 | { |
119 | - $writer->addAttribute('id',$this->getClientID()); |
|
120 | - $cs = $this->getPage()->getClientScript(); |
|
121 | - $cs->registerPostBackControl($this->getClientClassName(),$this->getPostBackOptions()); |
|
119 | + $writer->addAttribute('id', $this->getClientID()); |
|
120 | + $cs=$this->getPage()->getClientScript(); |
|
121 | + $cs->registerPostBackControl($this->getClientClassName(), $this->getPostBackOptions()); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | if($this->getCausesValidation()) |
140 | 140 | { |
141 | 141 | $group=$this->getValidationGroup(); |
142 | - return $this->getPage()->getValidators($group)->getCount()>0; |
|
142 | + return $this->getPage()->getValidators($group)->getCount() > 0; |
|
143 | 143 | } |
144 | 144 | else |
145 | 145 | return false; |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | */ |
151 | 151 | public function setIsDefaultButton($value) |
152 | 152 | { |
153 | - $this->setViewState('IsDefaultButton', TPropertyValue::ensureBoolean($value),false); |
|
153 | + $this->setViewState('IsDefaultButton', TPropertyValue::ensureBoolean($value), false); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
@@ -176,10 +176,10 @@ discard block |
||
176 | 176 | */ |
177 | 177 | protected function getPostBackOptions() |
178 | 178 | { |
179 | - $options['ID'] = $this->getClientID(); |
|
180 | - $options['CausesValidation'] = $this->getCausesValidation(); |
|
181 | - $options['ValidationGroup'] = $this->getValidationGroup(); |
|
182 | - $options['EventTarget'] = $this->getUniqueID(); |
|
179 | + $options['ID']=$this->getClientID(); |
|
180 | + $options['CausesValidation']=$this->getCausesValidation(); |
|
181 | + $options['ValidationGroup']=$this->getValidationGroup(); |
|
182 | + $options['EventTarget']=$this->getUniqueID(); |
|
183 | 183 | |
184 | 184 | return $options; |
185 | 185 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | * @param array the input data collection |
192 | 192 | * @return boolean whether the data of the component has been changed |
193 | 193 | */ |
194 | - public function loadPostData($key,$values) |
|
194 | + public function loadPostData($key, $values) |
|
195 | 195 | { |
196 | 196 | $uid=$this->getUniqueID(); |
197 | 197 | if(isset($values["{$uid}_x"]) && isset($values["{$uid}_y"])) |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | */ |
223 | 223 | public function onClick($param) |
224 | 224 | { |
225 | - $this->raiseEvent('OnClick',$this,$param); |
|
225 | + $this->raiseEvent('OnClick', $this, $param); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
@@ -234,8 +234,8 @@ discard block |
||
234 | 234 | */ |
235 | 235 | public function onCommand($param) |
236 | 236 | { |
237 | - $this->raiseEvent('OnCommand',$this,$param); |
|
238 | - $this->raiseBubbleEvent($this,$param); |
|
237 | + $this->raiseEvent('OnCommand', $this, $param); |
|
238 | + $this->raiseBubbleEvent($this, $param); |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | /** |
@@ -251,8 +251,8 @@ discard block |
||
251 | 251 | { |
252 | 252 | if($this->getCausesValidation()) |
253 | 253 | $this->getPage()->validate($this->getValidationGroup()); |
254 | - $this->onClick(new TImageClickEventParameter($this->_x,$this->_y)); |
|
255 | - $this->onCommand(new \Prado\Web\UI\TCommandEventParameter($this->getCommandName(),$this->getCommandParameter())); |
|
254 | + $this->onClick(new TImageClickEventParameter($this->_x, $this->_y)); |
|
255 | + $this->onCommand(new \Prado\Web\UI\TCommandEventParameter($this->getCommandName(), $this->getCommandParameter())); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | /** |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | */ |
271 | 271 | public function getCausesValidation() |
272 | 272 | { |
273 | - return $this->getViewState('CausesValidation',true); |
|
273 | + return $this->getViewState('CausesValidation', true); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | /** |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | */ |
279 | 279 | public function setCausesValidation($value) |
280 | 280 | { |
281 | - $this->setViewState('CausesValidation',TPropertyValue::ensureBoolean($value),true); |
|
281 | + $this->setViewState('CausesValidation', TPropertyValue::ensureBoolean($value), true); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | /** |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | */ |
287 | 287 | public function getCommandName() |
288 | 288 | { |
289 | - return $this->getViewState('CommandName',''); |
|
289 | + return $this->getViewState('CommandName', ''); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | /** |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | */ |
295 | 295 | public function setCommandName($value) |
296 | 296 | { |
297 | - $this->setViewState('CommandName',$value,''); |
|
297 | + $this->setViewState('CommandName', $value, ''); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | /** |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | */ |
303 | 303 | public function getCommandParameter() |
304 | 304 | { |
305 | - return $this->getViewState('CommandParameter',''); |
|
305 | + return $this->getViewState('CommandParameter', ''); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | /** |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | */ |
311 | 311 | public function setCommandParameter($value) |
312 | 312 | { |
313 | - $this->setViewState('CommandParameter',$value,''); |
|
313 | + $this->setViewState('CommandParameter', $value, ''); |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | /** |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | */ |
319 | 319 | public function getValidationGroup() |
320 | 320 | { |
321 | - return $this->getViewState('ValidationGroup',''); |
|
321 | + return $this->getViewState('ValidationGroup', ''); |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | /** |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | */ |
327 | 327 | public function setValidationGroup($value) |
328 | 328 | { |
329 | - $this->setViewState('ValidationGroup',$value,''); |
|
329 | + $this->setViewState('ValidationGroup', $value, ''); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | /** |
@@ -219,6 +219,7 @@ discard block |
||
219 | 219 | * If you override this method, be sure to call the parent implementation |
220 | 220 | * so that the event handler can be invoked. |
221 | 221 | * @param TImageClickEventParameter event parameter to be passed to the event handlers |
222 | + * @param TImageClickEventParameter $param |
|
222 | 223 | */ |
223 | 224 | public function onClick($param) |
224 | 225 | { |
@@ -231,6 +232,7 @@ discard block |
||
231 | 232 | * If you override this method, be sure to call the parent implementation |
232 | 233 | * so that the event handlers can be invoked. |
233 | 234 | * @param \Prado\Web\UI\TCommandEventParameter event parameter to be passed to the event handlers |
235 | + * @param \Prado\Web\UI\TCommandEventParameter $param |
|
234 | 236 | */ |
235 | 237 | public function onCommand($param) |
236 | 238 | { |
@@ -235,14 +235,12 @@ |
||
235 | 235 | { |
236 | 236 | $parameter = new TJuiAutoCompleteEventParameter($this->getResponse(), $token[0]); |
237 | 237 | $this->onSuggest($parameter); |
238 | - } |
|
239 | - else if($token[1] === '__TJuiAutoComplete_onSuggestionSelected__') |
|
238 | + } else if($token[1] === '__TJuiAutoComplete_onSuggestionSelected__') |
|
240 | 239 | { |
241 | 240 | $parameter = new TJuiAutoCompleteEventParameter($this->getResponse(), null, $token[0]); |
242 | 241 | $this->onSuggestionSelected($parameter); |
243 | 242 | } |
244 | - } |
|
245 | - else if($this->getAutoPostBack()) |
|
243 | + } else if($this->getAutoPostBack()) |
|
246 | 244 | parent::raiseCallbackEvent($param); |
247 | 245 | } |
248 | 246 |
@@ -260,6 +260,7 @@ discard block |
||
260 | 260 | * method, be sure to call the parent implementation so that the event |
261 | 261 | * handler can be invoked. |
262 | 262 | * @param TCallbackEventParameter event parameter to be passed to the event handlers |
263 | + * @param TJuiAutoCompleteEventParameter $param |
|
263 | 264 | */ |
264 | 265 | public function onSuggest($param) |
265 | 266 | { |
@@ -272,6 +273,7 @@ discard block |
||
272 | 273 | * method, be sure to call the parent implementation so that the event |
273 | 274 | * handler can be invoked. |
274 | 275 | * @param TCallbackEventParameter event parameter to be passed to the event handlers |
276 | + * @param TJuiAutoCompleteEventParameter $param |
|
275 | 277 | */ |
276 | 278 | public function onSuggestionSelected($param) |
277 | 279 | { |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public function getOptions() |
133 | 133 | { |
134 | - if (($options=$this->getViewState('JuiOptions'))===null) |
|
134 | + if(($options=$this->getViewState('JuiOptions'))===null) |
|
135 | 135 | { |
136 | 136 | $options=new TJuiControlOptions($this); |
137 | 137 | $this->setViewState('JuiOptions', $options); |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | */ |
213 | 213 | public function getMinChars() |
214 | 214 | { |
215 | - return $this->getViewState('minChars',''); |
|
215 | + return $this->getViewState('minChars', ''); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | /** |
@@ -236,17 +236,17 @@ discard block |
||
236 | 236 | */ |
237 | 237 | public function raiseCallbackEvent($param) |
238 | 238 | { |
239 | - $token = $param->getCallbackParameter(); |
|
240 | - if(is_array($token) && count($token) == 2) |
|
239 | + $token=$param->getCallbackParameter(); |
|
240 | + if(is_array($token) && count($token)==2) |
|
241 | 241 | { |
242 | - if($token[1] === '__TJuiAutoComplete_onSuggest__') |
|
242 | + if($token[1]==='__TJuiAutoComplete_onSuggest__') |
|
243 | 243 | { |
244 | - $parameter = new TJuiAutoCompleteEventParameter($this->getResponse(), $token[0]); |
|
244 | + $parameter=new TJuiAutoCompleteEventParameter($this->getResponse(), $token[0]); |
|
245 | 245 | $this->onSuggest($parameter); |
246 | 246 | } |
247 | - else if($token[1] === '__TJuiAutoComplete_onSuggestionSelected__') |
|
247 | + else if($token[1]==='__TJuiAutoComplete_onSuggestionSelected__') |
|
248 | 248 | { |
249 | - $parameter = new TJuiAutoCompleteEventParameter($this->getResponse(), null, $token[0]); |
|
249 | + $parameter=new TJuiAutoCompleteEventParameter($this->getResponse(), null, $token[0]); |
|
250 | 250 | $this->onSuggestionSelected($parameter); |
251 | 251 | } |
252 | 252 | } |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | public function getResultPanel() |
304 | 304 | { |
305 | 305 | if($this->_resultPanel===null) |
306 | - $this->_resultPanel = $this->createResultPanel(); |
|
306 | + $this->_resultPanel=$this->createResultPanel(); |
|
307 | 307 | return $this->_resultPanel; |
308 | 308 | } |
309 | 309 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | */ |
313 | 313 | protected function createResultPanel() |
314 | 314 | { |
315 | - $panel = new TPanel; |
|
315 | + $panel=new TPanel; |
|
316 | 316 | $this->getControls()->add($panel); |
317 | 317 | $panel->setID('result'); |
318 | 318 | return $panel; |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | public function getSuggestions() |
325 | 325 | { |
326 | 326 | if($this->_repeater===null) |
327 | - $this->_repeater = $this->createRepeater(); |
|
327 | + $this->_repeater=$this->createRepeater(); |
|
328 | 328 | return $this->_repeater; |
329 | 329 | } |
330 | 330 | |
@@ -333,8 +333,8 @@ discard block |
||
333 | 333 | */ |
334 | 334 | protected function createRepeater() |
335 | 335 | { |
336 | - $repeater = new TRepeater; |
|
337 | - $repeater->setItemTemplate(new TTemplate('<%# $this->Data %>',null)); |
|
336 | + $repeater=new TRepeater; |
|
337 | + $repeater->setItemTemplate(new TTemplate('<%# $this->Data %>', null)); |
|
338 | 338 | $this->getControls()->add($repeater); |
339 | 339 | return $repeater; |
340 | 340 | } |
@@ -376,12 +376,12 @@ discard block |
||
376 | 376 | { |
377 | 377 | $data=array(); |
378 | 378 | $items=$this->getSuggestions()->getItems(); |
379 | - $writer = new TTextWriter; |
|
380 | - for($i=0; $i<$items->Count; $i++) |
|
379 | + $writer=new TTextWriter; |
|
380 | + for($i=0; $i < $items->Count; $i++) |
|
381 | 381 | { |
382 | 382 | $items->itemAt($i)->render($writer); |
383 | 383 | $item=$writer->flush(); |
384 | - $data[]=array( 'id' => $i, 'label' => $item); |
|
384 | + $data[]=array('id' => $i, 'label' => $item); |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | $this->getResponse()->getAdapter()->setResponseData($data); |
@@ -393,25 +393,25 @@ discard block |
||
393 | 393 | */ |
394 | 394 | protected function getPostBackOptions() |
395 | 395 | { |
396 | - $options = $this->getOptions()->toArray(); |
|
396 | + $options=$this->getOptions()->toArray(); |
|
397 | 397 | |
398 | - if(strlen($separator = $this->getSeparator())) |
|
399 | - $options['Separators'] = $separator; |
|
398 | + if(strlen($separator=$this->getSeparator())) |
|
399 | + $options['Separators']=$separator; |
|
400 | 400 | |
401 | 401 | if($this->getAutoPostBack()) |
402 | 402 | { |
403 | - $options = array_merge($options,parent::getPostBackOptions()); |
|
404 | - $options['AutoPostBack'] = true; |
|
403 | + $options=array_merge($options, parent::getPostBackOptions()); |
|
404 | + $options['AutoPostBack']=true; |
|
405 | 405 | } |
406 | - if(strlen($textCssClass = $this->getTextCssClass())) |
|
407 | - $options['textCssClass'] = $textCssClass; |
|
408 | - $options['minLength'] = $this->getMinChars(); |
|
409 | - $options['delay'] = $this->getFrequency()*1000.0; |
|
410 | - $options['appendTo'] = '#'.$this->getResultPanel()->getClientID(); |
|
411 | - $options['ID'] = $this->getClientID(); |
|
412 | - $options['EventTarget'] = $this->getUniqueID(); |
|
413 | - $options['CausesValidation'] = $this->getCausesValidation(); |
|
414 | - $options['ValidationGroup'] = $this->getValidationGroup(); |
|
406 | + if(strlen($textCssClass=$this->getTextCssClass())) |
|
407 | + $options['textCssClass']=$textCssClass; |
|
408 | + $options['minLength']=$this->getMinChars(); |
|
409 | + $options['delay']=$this->getFrequency() * 1000.0; |
|
410 | + $options['appendTo']='#'.$this->getResultPanel()->getClientID(); |
|
411 | + $options['ID']=$this->getClientID(); |
|
412 | + $options['EventTarget']=$this->getUniqueID(); |
|
413 | + $options['CausesValidation']=$this->getCausesValidation(); |
|
414 | + $options['ValidationGroup']=$this->getValidationGroup(); |
|
415 | 415 | return $options; |
416 | 416 | } |
417 | 417 |
@@ -79,8 +79,7 @@ |
||
79 | 79 | if($this->getHasPreRendered()) { |
80 | 80 | $this->renderDataList($writer); |
81 | 81 | if($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getContainerID(),$writer); |
82 | - } |
|
83 | - else { |
|
82 | + } else { |
|
84 | 83 | $this->getPage()->getAdapter()->registerControlToRender($this,$writer); |
85 | 84 | } |
86 | 85 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | parent::setDataSource($value); |
56 | 56 | if($this->getActiveControl()->canUpdateClientSide()) { |
57 | 57 | $this->renderPager(); |
58 | - $this->getPage()->getAdapter()->registerControlToRender($this,$this->getResponse()->createHtmlWriter()); |
|
58 | + $this->getPage()->getAdapter()->registerControlToRender($this, $this->getResponse()->createHtmlWriter()); |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | |
@@ -78,10 +78,10 @@ discard block |
||
78 | 78 | { |
79 | 79 | if($this->getHasPreRendered()) { |
80 | 80 | $this->renderDataList($writer); |
81 | - if($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getContainerID(),$writer); |
|
81 | + if($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getContainerID(), $writer); |
|
82 | 82 | } |
83 | 83 | else { |
84 | - $this->getPage()->getAdapter()->registerControlToRender($this,$writer); |
|
84 | + $this->getPage()->getAdapter()->registerControlToRender($this, $writer); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | { |
98 | 98 | if($item->ControlToPaginate==$this->ID) { |
99 | 99 | $writer=$this->getResponse()->createHtmlWriter(); |
100 | - $this->getPage()->getAdapter()->registerControlToRender($item,$writer); |
|
100 | + $this->getPage()->getAdapter()->registerControlToRender($item, $writer); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | } |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function __construct() |
36 | 36 | { |
37 | - parent::__construct(); |
|
38 | - $this->setAdapter(new TActiveControlAdapter($this)); |
|
37 | + parent::__construct(); |
|
38 | + $this->setAdapter(new TActiveControlAdapter($this)); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function getActiveControl() |
45 | 45 | { |
46 | - return $this->getAdapter()->getBaseActiveControl(); |
|
46 | + return $this->getAdapter()->getBaseActiveControl(); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -55,11 +55,11 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function setDataSource($value) |
57 | 57 | { |
58 | - parent::setDataSource($value); |
|
59 | - if($this->getActiveControl()->canUpdateClientSide()) { |
|
60 | - $this->renderPager(); |
|
61 | - $this->getPage()->getAdapter()->registerControlToRender($this,$this->getResponse()->createHtmlWriter()); |
|
62 | - } |
|
58 | + parent::setDataSource($value); |
|
59 | + if($this->getActiveControl()->canUpdateClientSide()) { |
|
60 | + $this->renderPager(); |
|
61 | + $this->getPage()->getAdapter()->registerControlToRender($this,$this->getResponse()->createHtmlWriter()); |
|
62 | + } |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | */ |
69 | 69 | protected function getContainerID() |
70 | 70 | { |
71 | - return $this->ClientID.'_Container'; |
|
71 | + return $this->ClientID.'_Container'; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
@@ -79,13 +79,13 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function render($writer) |
81 | 81 | { |
82 | - if($this->getHasPreRendered()) { |
|
83 | - $this->renderDataList($writer); |
|
84 | - if($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getContainerID(),$writer); |
|
85 | - } |
|
86 | - else { |
|
87 | - $this->getPage()->getAdapter()->registerControlToRender($this,$writer); |
|
88 | - } |
|
82 | + if($this->getHasPreRendered()) { |
|
83 | + $this->renderDataList($writer); |
|
84 | + if($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getContainerID(),$writer); |
|
85 | + } |
|
86 | + else { |
|
87 | + $this->getPage()->getAdapter()->registerControlToRender($this,$writer); |
|
88 | + } |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -95,14 +95,14 @@ discard block |
||
95 | 95 | */ |
96 | 96 | private function renderPager() |
97 | 97 | { |
98 | - $pager=$this->getPage()->findControlsByType('Prado\Web\UI\ActiveControls\TActivePager', false); |
|
99 | - foreach($pager as $item) |
|
100 | - { |
|
101 | - if($item->ControlToPaginate==$this->ID) { |
|
102 | - $writer=$this->getResponse()->createHtmlWriter(); |
|
103 | - $this->getPage()->getAdapter()->registerControlToRender($item,$writer); |
|
104 | - } |
|
105 | - } |
|
98 | + $pager=$this->getPage()->findControlsByType('Prado\Web\UI\ActiveControls\TActivePager', false); |
|
99 | + foreach($pager as $item) |
|
100 | + { |
|
101 | + if($item->ControlToPaginate==$this->ID) { |
|
102 | + $writer=$this->getResponse()->createHtmlWriter(); |
|
103 | + $this->getPage()->getAdapter()->registerControlToRender($item,$writer); |
|
104 | + } |
|
105 | + } |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | */ |
113 | 113 | private function renderDataList($writer) |
114 | 114 | { |
115 | - $writer->write('<span id="'.$this->getContainerID().'">'); |
|
116 | - parent::render($writer); |
|
117 | - $writer->write('</span>'); |
|
115 | + $writer->write('<span id="'.$this->getContainerID().'">'); |
|
116 | + parent::render($writer); |
|
117 | + $writer->write('</span>'); |
|
118 | 118 | } |
119 | 119 | } |
@@ -223,14 +223,12 @@ discard block |
||
223 | 223 | // this is the most secure method, file info can't be forged from client side, no matter what |
224 | 224 | $token = md5('TActiveFileUpload::Params::'.$this->ClientID.'::'+rand(1000*1000,9999*1000)); |
225 | 225 | $cache->set($token, serialize($params), 5*60); // expire in 5 minutes - the callback should arrive back in seconds, actually |
226 | - } |
|
227 | - else |
|
226 | + } else |
|
228 | 227 | if ($mgr = Prado::getApplication()->getSecurityManager()) |
229 | 228 | { |
230 | 229 | // this is a less secure method, file info can be still forged from client side, but only if attacker knows the secret application key |
231 | 230 | $token = urlencode(base64_encode($mgr->encrypt(serialize($params)))); |
232 | - } |
|
233 | - else |
|
231 | + } else |
|
234 | 232 | throw new Exception('TActiveFileUpload needs either an application level cache or a security manager to work securely'); |
235 | 233 | |
236 | 234 | return $token; |
@@ -244,14 +242,12 @@ discard block |
||
244 | 242 | assert($v!=''); |
245 | 243 | $cache->delete($token); // remove it from cache so it can't be used again and won't take up space either |
246 | 244 | $params = unserialize($v); |
247 | - } |
|
248 | - else |
|
245 | + } else |
|
249 | 246 | if ($mgr = Prado::getApplication()->getSecurityManager()) |
250 | 247 | { |
251 | 248 | $v = $mgr->decrypt(base64_decode(urldecode($token))); |
252 | 249 | $params = unserialize($v); |
253 | - } |
|
254 | - else |
|
250 | + } else |
|
255 | 251 | throw new Exception('TActiveFileUpload needs either an application level cache or a security manager to work securely'); |
256 | 252 | |
257 | 253 | assert($params instanceof TActiveFileUploadCallbackParams); |
@@ -203,14 +203,14 @@ discard block |
||
203 | 203 | if ($key = $cp->targetID == $this->_target->getUniqueID()){ |
204 | 204 | |
205 | 205 | $params = $this->popParamsByToken($cp->callbackToken); |
206 | - foreach($params->files as $index => $file) |
|
207 | - { |
|
206 | + foreach($params->files as $index => $file) |
|
207 | + { |
|
208 | 208 | $_FILES[$key]['name'][$index] = stripslashes($file['fileName']); |
209 | 209 | $_FILES[$key]['size'][$index] = intval($file['fileSize']); |
210 | 210 | $_FILES[$key]['type'][$index] = $file['fileType']; |
211 | 211 | $_FILES[$key]['error'][$index] = intval($file['errorCode']); |
212 | 212 | $_FILES[$key]['tmp_name'][$index] = $file['localName']; |
213 | - } |
|
213 | + } |
|
214 | 214 | $this->loadPostData($key, null); |
215 | 215 | |
216 | 216 | $this->raiseEvent('OnFileUpload', $this, $param); |
@@ -281,11 +281,11 @@ discard block |
||
281 | 281 | { |
282 | 282 | $params = new TActiveFileUploadCallbackParams; |
283 | 283 | foreach ($this->getFiles() as $file) { |
284 | - $localName = str_replace('\\', '/', tempnam(Prado::getPathOfNamespace($this->getTempPath()),'')); |
|
285 | - $file->setLocalName($localName); |
|
286 | - // tricky workaround to intercept "uploaded file too big" error: real uploads happens in onFileUpload instead |
|
287 | - $file->setErrorCode(UPLOAD_ERR_FORM_SIZE); |
|
288 | - $params->files[] = $file->toArray(); |
|
284 | + $localName = str_replace('\\', '/', tempnam(Prado::getPathOfNamespace($this->getTempPath()),'')); |
|
285 | + $file->setLocalName($localName); |
|
286 | + // tricky workaround to intercept "uploaded file too big" error: real uploads happens in onFileUpload instead |
|
287 | + $file->setErrorCode(UPLOAD_ERR_FORM_SIZE); |
|
288 | + $params->files[] = $file->toArray(); |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | echo "<script language='Javascript'> |
@@ -340,8 +340,8 @@ discard block |
||
340 | 340 | if ($this->getPage()->getIsCallback()) |
341 | 341 | { |
342 | 342 | foreach($this->getFiles() as $file) |
343 | - if($file->getHasFile() && file_exists($file->getLocalName())){ |
|
344 | - unlink($file->getLocalName()); |
|
343 | + if($file->getHasFile() && file_exists($file->getLocalName())){ |
|
344 | + unlink($file->getLocalName()); |
|
345 | 345 | } |
346 | 346 | } |
347 | 347 | parent::onUnload($param); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | class TActiveFileUpload extends TFileUpload implements IActiveControl, ICallbackEventHandler, INamingContainer |
62 | 62 | { |
63 | - const SCRIPT_PATH = 'activefileupload'; |
|
63 | + const SCRIPT_PATH='activefileupload'; |
|
64 | 64 | |
65 | 65 | /** |
66 | 66 | * @var THiddenField a flag to tell which component is doing the callback. |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * TActiveControlAdapter. If you override this class, be sure to set the |
90 | 90 | * adapter appropriately by, for example, by calling this constructor. |
91 | 91 | */ |
92 | - public function __construct(){ |
|
92 | + public function __construct() { |
|
93 | 93 | parent::__construct(); |
94 | 94 | $this->setAdapter(new TActiveControlAdapter($this)); |
95 | 95 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | protected function getAssetUrl($file='') |
103 | 103 | { |
104 | - $base = $this->getPage()->getClientScript()->getPradoScriptAssetUrl(); |
|
104 | + $base=$this->getPage()->getClientScript()->getPradoScriptAssetUrl(); |
|
105 | 105 | return $base.'/'.self::SCRIPT_PATH.'/'.$file; |
106 | 106 | } |
107 | 107 | |
@@ -114,14 +114,14 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function onFileUpload($param) |
116 | 116 | { |
117 | - if ($this->_flag->getValue() && $this->getPage()->getIsPostBack() && $param == $this->_target->getUniqueID()){ |
|
118 | - $params = new TActiveFileUploadCallbackParams; |
|
117 | + if($this->_flag->getValue() && $this->getPage()->getIsPostBack() && $param==$this->_target->getUniqueID()) { |
|
118 | + $params=new TActiveFileUploadCallbackParams; |
|
119 | 119 | // save the files so that they will persist past the end of this return. |
120 | - foreach ($this->getFiles() as $file) { |
|
121 | - $localName = str_replace('\\', '/', tempnam(Prado::getPathOfNamespace($this->getTempPath()),'')); |
|
120 | + foreach($this->getFiles() as $file) { |
|
121 | + $localName=str_replace('\\', '/', tempnam(Prado::getPathOfNamespace($this->getTempPath()), '')); |
|
122 | 122 | $file->saveAs($localName); |
123 | 123 | $file->setLocalName($localName); |
124 | - $params->files[] = $file->toArray(); |
|
124 | + $params->files[]=$file->toArray(); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | // return some javascript to display a completion status. |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | Options = new Object(); |
130 | 130 | Options.clientID = '{$this->getClientID()}'; |
131 | 131 | Options.targetID = '{$this->_target->getUniqueID()}'; |
132 | - Options.errorCode = '" . (int)!$this->getHasAllFiles() . "'; |
|
132 | + Options.errorCode = '".(int) !$this->getHasAllFiles()."'; |
|
133 | 133 | Options.callbackToken = '{$this->pushParamsAndGetToken($params)}'; |
134 | - Options.fileName = '" . ($this->getMultiple() ? TJavaScript::jsonEncode(array_column($params->files, 'fileName')) : $this->getFileName()) . "'; |
|
135 | - Options.fileSize = '" . ($this->getMultiple() ? TJavaScript::jsonEncode(array_column($params->files, 'fileSize')) : $this->getFileSize()) . "'; |
|
136 | - Options.fileType = '" . ($this->getMultiple() ? TJavaScript::jsonEncode(array_column($params->files, 'fileType')) : $this->getFileType()) . "'; |
|
137 | - Options.errorCode = '" . ($this->getMultiple() ? TJavaScript::jsonEncode(array_column($params->files, 'errorCode')) : $this->getErrorCode()) . "'; |
|
134 | + Options.fileName = '".($this->getMultiple() ? TJavaScript::jsonEncode(array_column($params->files, 'fileName')) : $this->getFileName())."'; |
|
135 | + Options.fileSize = '" . ($this->getMultiple() ? TJavaScript::jsonEncode(array_column($params->files, 'fileSize')) : $this->getFileSize())."'; |
|
136 | + Options.fileType = '" . ($this->getMultiple() ? TJavaScript::jsonEncode(array_column($params->files, 'fileType')) : $this->getFileType())."'; |
|
137 | + Options.errorCode = '" . ($this->getMultiple() ? TJavaScript::jsonEncode(array_column($params->files, 'errorCode')) : $this->getErrorCode())."'; |
|
138 | 138 | parent.Prado.WebUI.TActiveFileUpload.onFileUpload(Options); |
139 | 139 | </script>"; |
140 | 140 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @return string the path where the uploaded file will be stored temporarily, in namespace format |
147 | 147 | * default "Application.runtime.*" |
148 | 148 | */ |
149 | - public function getTempPath(){ |
|
149 | + public function getTempPath() { |
|
150 | 150 | return $this->getViewState('TempPath', 'Application.runtime.*'); |
151 | 151 | } |
152 | 152 | |
@@ -154,15 +154,15 @@ discard block |
||
154 | 154 | * @param string the path where the uploaded file will be stored temporarily in namespace format |
155 | 155 | * default "Application.runtime.*" |
156 | 156 | */ |
157 | - public function setTempPath($value){ |
|
158 | - $this->setViewState('TempPath',$value,'Application.runtime.*'); |
|
157 | + public function setTempPath($value) { |
|
158 | + $this->setViewState('TempPath', $value, 'Application.runtime.*'); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
162 | 162 | * @return boolean a value indicating whether an automatic callback to the server will occur whenever the user modifies the text in the TTextBox control and then tabs out of the component. Defaults to true. |
163 | 163 | * Note: When set to false, you will need to trigger the callback yourself. |
164 | 164 | */ |
165 | - public function getAutoPostBack(){ |
|
165 | + public function getAutoPostBack() { |
|
166 | 166 | return $this->getViewState('AutoPostBack', true); |
167 | 167 | } |
168 | 168 | |
@@ -170,28 +170,28 @@ discard block |
||
170 | 170 | * @param boolean a value indicating whether an automatic callback to the server will occur whenever the user modifies the text in the TTextBox control and then tabs out of the component. Defaults to true. |
171 | 171 | * Note: When set to false, you will need to trigger the callback yourself. |
172 | 172 | */ |
173 | - public function setAutoPostBack($value){ |
|
174 | - $this->setViewState('AutoPostBack',TPropertyValue::ensureBoolean($value),true); |
|
173 | + public function setAutoPostBack($value) { |
|
174 | + $this->setViewState('AutoPostBack', TPropertyValue::ensureBoolean($value), true); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
178 | 178 | * @return string A chuck of javascript that will need to be called if {{@link getAutoPostBack AutoPostBack} is set to false} |
179 | 179 | */ |
180 | - public function getCallbackJavascript(){ |
|
180 | + public function getCallbackJavascript() { |
|
181 | 181 | return "Prado.WebUI.TActiveFileUpload.fileChanged(\"{$this->getClientID()}\")"; |
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
185 | 185 | * @throws TInvalidDataValueException if the {@link getTempPath TempPath} is not writable. |
186 | 186 | */ |
187 | - public function onInit($sender){ |
|
187 | + public function onInit($sender) { |
|
188 | 188 | parent::onInit($sender); |
189 | 189 | |
190 | - if (!Prado::getApplication()->getCache()) |
|
191 | - if (!Prado::getApplication()->getSecurityManager()) |
|
190 | + if(!Prado::getApplication()->getCache()) |
|
191 | + if(!Prado::getApplication()->getSecurityManager()) |
|
192 | 192 | throw new Exception('TActiveFileUpload needs either an application level cache or a security manager to work securely'); |
193 | 193 | |
194 | - if (!is_writable(Prado::getPathOfNamespace($this->getTempPath()))){ |
|
194 | + if(!is_writable(Prado::getPathOfNamespace($this->getTempPath()))) { |
|
195 | 195 | throw new TInvalidDataValueException("activefileupload_temppath_invalid", $this->getTempPath()); |
196 | 196 | } |
197 | 197 | } |
@@ -203,18 +203,18 @@ discard block |
||
203 | 203 | * This method is mainly used by framework and control developers. |
204 | 204 | * @param TCallbackEventParameter the event parameter |
205 | 205 | */ |
206 | - public function raiseCallbackEvent($param){ |
|
207 | - $cp = $param->getCallbackParameter(); |
|
208 | - if ($key = $cp->targetID == $this->_target->getUniqueID()){ |
|
206 | + public function raiseCallbackEvent($param) { |
|
207 | + $cp=$param->getCallbackParameter(); |
|
208 | + if($key=$cp->targetID==$this->_target->getUniqueID()) { |
|
209 | 209 | |
210 | - $params = $this->popParamsByToken($cp->callbackToken); |
|
210 | + $params=$this->popParamsByToken($cp->callbackToken); |
|
211 | 211 | foreach($params->files as $index => $file) |
212 | 212 | { |
213 | - $_FILES[$key]['name'][$index] = stripslashes($file['fileName']); |
|
214 | - $_FILES[$key]['size'][$index] = intval($file['fileSize']); |
|
215 | - $_FILES[$key]['type'][$index] = $file['fileType']; |
|
216 | - $_FILES[$key]['error'][$index] = intval($file['errorCode']); |
|
217 | - $_FILES[$key]['tmp_name'][$index] = $file['localName']; |
|
213 | + $_FILES[$key]['name'][$index]=stripslashes($file['fileName']); |
|
214 | + $_FILES[$key]['size'][$index]=intval($file['fileSize']); |
|
215 | + $_FILES[$key]['type'][$index]=$file['fileType']; |
|
216 | + $_FILES[$key]['error'][$index]=intval($file['errorCode']); |
|
217 | + $_FILES[$key]['tmp_name'][$index]=$file['localName']; |
|
218 | 218 | } |
219 | 219 | $this->loadPostData($key, null); |
220 | 220 | |
@@ -234,17 +234,17 @@ discard block |
||
234 | 234 | |
235 | 235 | protected function pushParamsAndGetToken(TActiveFileUploadCallbackParams $params) |
236 | 236 | { |
237 | - if ($cache = Prado::getApplication()->getCache()) |
|
237 | + if($cache=Prado::getApplication()->getCache()) |
|
238 | 238 | { |
239 | 239 | // this is the most secure method, file info can't be forged from client side, no matter what |
240 | - $token = md5('TActiveFileUpload::Params::'.$this->ClientID.'::'+rand(1000*1000,9999*1000)); |
|
241 | - $cache->set($token, serialize($params), 5*60); // expire in 5 minutes - the callback should arrive back in seconds, actually |
|
240 | + $token=md5('TActiveFileUpload::Params::'.$this->ClientID.'::'+rand(1000 * 1000, 9999 * 1000)); |
|
241 | + $cache->set($token, serialize($params), 5 * 60); // expire in 5 minutes - the callback should arrive back in seconds, actually |
|
242 | 242 | } |
243 | 243 | else |
244 | - if ($mgr = Prado::getApplication()->getSecurityManager()) |
|
244 | + if($mgr=Prado::getApplication()->getSecurityManager()) |
|
245 | 245 | { |
246 | 246 | // this is a less secure method, file info can be still forged from client side, but only if attacker knows the secret application key |
247 | - $token = urlencode(base64_encode($mgr->encrypt(serialize($params)))); |
|
247 | + $token=urlencode(base64_encode($mgr->encrypt(serialize($params)))); |
|
248 | 248 | } |
249 | 249 | else |
250 | 250 | throw new Exception('TActiveFileUpload needs either an application level cache or a security manager to work securely'); |
@@ -254,18 +254,18 @@ discard block |
||
254 | 254 | |
255 | 255 | protected function popParamsByToken($token) |
256 | 256 | { |
257 | - if ($cache = Prado::getApplication()->getCache()) |
|
257 | + if($cache=Prado::getApplication()->getCache()) |
|
258 | 258 | { |
259 | - $v = $cache->get($token); |
|
259 | + $v=$cache->get($token); |
|
260 | 260 | assert($v!=''); |
261 | 261 | $cache->delete($token); // remove it from cache so it can't be used again and won't take up space either |
262 | - $params = unserialize($v); |
|
262 | + $params=unserialize($v); |
|
263 | 263 | } |
264 | 264 | else |
265 | - if ($mgr = Prado::getApplication()->getSecurityManager()) |
|
265 | + if($mgr=Prado::getApplication()->getSecurityManager()) |
|
266 | 266 | { |
267 | - $v = $mgr->decrypt(base64_decode(urldecode($token))); |
|
268 | - $params = unserialize($v); |
|
267 | + $v=$mgr->decrypt(base64_decode(urldecode($token))); |
|
268 | + $params=unserialize($v); |
|
269 | 269 | } |
270 | 270 | else |
271 | 271 | throw new Exception('TActiveFileUpload needs either an application level cache or a security manager to work securely'); |
@@ -282,27 +282,27 @@ discard block |
||
282 | 282 | { |
283 | 283 | parent::onPreRender($param); |
284 | 284 | |
285 | - if(!$this->getPage()->getIsPostBack() && isset($_GET['TActiveFileUpload_InputId']) && isset($_GET['TActiveFileUpload_TargetId']) && $_GET['TActiveFileUpload_InputId'] == $this->getClientID()) |
|
285 | + if(!$this->getPage()->getIsPostBack() && isset($_GET['TActiveFileUpload_InputId']) && isset($_GET['TActiveFileUpload_TargetId']) && $_GET['TActiveFileUpload_InputId']==$this->getClientID()) |
|
286 | 286 | { |
287 | - $params = new TActiveFileUploadCallbackParams; |
|
288 | - foreach ($this->getFiles() as $file) { |
|
289 | - $localName = str_replace('\\', '/', tempnam(Prado::getPathOfNamespace($this->getTempPath()),'')); |
|
287 | + $params=new TActiveFileUploadCallbackParams; |
|
288 | + foreach($this->getFiles() as $file) { |
|
289 | + $localName=str_replace('\\', '/', tempnam(Prado::getPathOfNamespace($this->getTempPath()), '')); |
|
290 | 290 | $file->setLocalName($localName); |
291 | 291 | // tricky workaround to intercept "uploaded file too big" error: real uploads happens in onFileUpload instead |
292 | 292 | $file->setErrorCode(UPLOAD_ERR_FORM_SIZE); |
293 | - $params->files[] = $file->toArray(); |
|
293 | + $params->files[]=$file->toArray(); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | echo "<script language='Javascript'> |
297 | 297 | Options = new Object(); |
298 | 298 | Options.clientID = '{$_GET['TActiveFileUpload_InputId']}'; |
299 | 299 | Options.targetID = '{$_GET['TActiveFileUpload_TargetId']}'; |
300 | - Options.errorCode = '" . (int)!$this->getHasAllFiles() . "'; |
|
300 | + Options.errorCode = '".(int) !$this->getHasAllFiles()."'; |
|
301 | 301 | Options.callbackToken = '{$this->pushParamsAndGetToken($params)}'; |
302 | - Options.fileName = '" . ($this->getMultiple() ? TJavaScript::jsonEncode(array_column($params->files, 'fileName')) : $this->getFileName()) . "'; |
|
303 | - Options.fileSize = '" . ($this->getMultiple() ? TJavaScript::jsonEncode(array_column($params->files, 'fileSize')) : $this->getFileSize()) . "'; |
|
304 | - Options.fileType = '" . ($this->getMultiple() ? TJavaScript::jsonEncode(array_column($params->files, 'fileType')) : $this->getFileType()) . "'; |
|
305 | - Options.errorCode = '" . ($this->getMultiple() ? TJavaScript::jsonEncode(array_column($params->files, 'errorCode')) : $this->getErrorCode()) . "'; |
|
302 | + Options.fileName = '".($this->getMultiple() ? TJavaScript::jsonEncode(array_column($params->files, 'fileName')) : $this->getFileName())."'; |
|
303 | + Options.fileSize = '" . ($this->getMultiple() ? TJavaScript::jsonEncode(array_column($params->files, 'fileSize')) : $this->getFileSize())."'; |
|
304 | + Options.fileType = '" . ($this->getMultiple() ? TJavaScript::jsonEncode(array_column($params->files, 'fileType')) : $this->getFileType())."'; |
|
305 | + Options.errorCode = '" . ($this->getMultiple() ? TJavaScript::jsonEncode(array_column($params->files, 'errorCode')) : $this->getErrorCode())."'; |
|
306 | 306 | parent.Prado.WebUI.TActiveFileUpload.onFileUpload(Options); |
307 | 307 | </script>"; |
308 | 308 | } |
@@ -312,29 +312,29 @@ discard block |
||
312 | 312 | { |
313 | 313 | $this->getPage()->getClientScript()->registerPradoScript('activefileupload'); |
314 | 314 | |
315 | - $this->_flag = new THiddenField; |
|
315 | + $this->_flag=new THiddenField; |
|
316 | 316 | $this->_flag->setID('Flag'); |
317 | 317 | $this->getControls()->add($this->_flag); |
318 | 318 | |
319 | - $this->_busy = new TImage; |
|
319 | + $this->_busy=new TImage; |
|
320 | 320 | $this->_busy->setID('Busy'); |
321 | 321 | $this->_busy->setImageUrl($this->getAssetUrl('ActiveFileUploadIndicator.gif')); |
322 | 322 | $this->_busy->setStyle("display:none"); |
323 | 323 | $this->getControls()->add($this->_busy); |
324 | 324 | |
325 | - $this->_success = new TImage; |
|
325 | + $this->_success=new TImage; |
|
326 | 326 | $this->_success->setID('Success'); |
327 | 327 | $this->_success->setImageUrl($this->getAssetUrl('ActiveFileUploadComplete.png')); |
328 | 328 | $this->_success->setStyle("display:none"); |
329 | 329 | $this->getControls()->add($this->_success); |
330 | 330 | |
331 | - $this->_error = new TImage; |
|
331 | + $this->_error=new TImage; |
|
332 | 332 | $this->_error->setID('Error'); |
333 | 333 | $this->_error->setImageUrl($this->getAssetUrl('ActiveFileUploadError.png')); |
334 | 334 | $this->_error->setStyle("display:none"); |
335 | 335 | $this->getControls()->add($this->_error); |
336 | 336 | |
337 | - $this->_target = new TInlineFrame; |
|
337 | + $this->_target=new TInlineFrame; |
|
338 | 338 | $this->_target->setID('Target'); |
339 | 339 | $this->_target->setFrameUrl($this->getAssetUrl('ActiveFileUploadBlank.html')); |
340 | 340 | $this->_target->setStyle("width:0px; height:0px;"); |
@@ -345,11 +345,11 @@ discard block |
||
345 | 345 | /** |
346 | 346 | * Removes localfile on ending of the callback. |
347 | 347 | */ |
348 | - public function onUnload($param){ |
|
349 | - if ($this->getPage()->getIsCallback()) |
|
348 | + public function onUnload($param) { |
|
349 | + if($this->getPage()->getIsCallback()) |
|
350 | 350 | { |
351 | 351 | foreach($this->getFiles() as $file) |
352 | - if($file->getHasFile() && file_exists($file->getLocalName())){ |
|
352 | + if($file->getHasFile() && file_exists($file->getLocalName())) { |
|
353 | 353 | unlink($file->getLocalName()); |
354 | 354 | } |
355 | 355 | } |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | /** |
360 | 360 | * @return TBaseActiveCallbackControl standard callback control options. |
361 | 361 | */ |
362 | - public function getActiveControl(){ |
|
362 | + public function getActiveControl() { |
|
363 | 363 | return $this->getAdapter()->getBaseActiveControl(); |
364 | 364 | } |
365 | 365 | |
@@ -375,17 +375,17 @@ discard block |
||
375 | 375 | * Adds ID attribute, and renders the javascript for active component. |
376 | 376 | * @param THtmlWriter the writer used for the rendering purpose |
377 | 377 | */ |
378 | - public function addAttributesToRender($writer){ |
|
378 | + public function addAttributesToRender($writer) { |
|
379 | 379 | parent::addAttributesToRender($writer); |
380 | - $writer->addAttribute('id',$this->getClientID()); |
|
380 | + $writer->addAttribute('id', $this->getClientID()); |
|
381 | 381 | |
382 | - $this->getActiveControl()->registerCallbackClientScript($this->getClientClassName(),$this->getClientOptions()); |
|
382 | + $this->getActiveControl()->registerCallbackClientScript($this->getClientClassName(), $this->getClientOptions()); |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | /** |
386 | 386 | * @return string corresponding javascript class name for this control. |
387 | 387 | */ |
388 | - protected function getClientClassName(){ |
|
388 | + protected function getClientClassName() { |
|
389 | 389 | return 'Prado.WebUI.TActiveFileUpload'; |
390 | 390 | } |
391 | 391 | |
@@ -399,18 +399,18 @@ discard block |
||
399 | 399 | * completeID => complete client ID, |
400 | 400 | * errorID => error client ID) |
401 | 401 | */ |
402 | - protected function getClientOptions(){ |
|
403 | - $options['ID'] = $this->getClientID(); |
|
404 | - $options['EventTarget'] = $this->getUniqueID(); |
|
405 | - |
|
406 | - $options['inputID'] = $this->getClientID(); |
|
407 | - $options['flagID'] = $this->_flag->getClientID(); |
|
408 | - $options['targetID'] = $this->_target->getUniqueID(); |
|
409 | - $options['formID'] = $this->getPage()->getForm()->getClientID(); |
|
410 | - $options['indicatorID'] = $this->_busy->getClientID(); |
|
411 | - $options['completeID'] = $this->_success->getClientID(); |
|
412 | - $options['errorID'] = $this->_error->getClientID(); |
|
413 | - $options['autoPostBack'] = $this->getAutoPostBack(); |
|
402 | + protected function getClientOptions() { |
|
403 | + $options['ID']=$this->getClientID(); |
|
404 | + $options['EventTarget']=$this->getUniqueID(); |
|
405 | + |
|
406 | + $options['inputID']=$this->getClientID(); |
|
407 | + $options['flagID']=$this->_flag->getClientID(); |
|
408 | + $options['targetID']=$this->_target->getUniqueID(); |
|
409 | + $options['formID']=$this->getPage()->getForm()->getClientID(); |
|
410 | + $options['indicatorID']=$this->_busy->getClientID(); |
|
411 | + $options['completeID']=$this->_success->getClientID(); |
|
412 | + $options['errorID']=$this->_error->getClientID(); |
|
413 | + $options['autoPostBack']=$this->getAutoPostBack(); |
|
414 | 414 | return $options; |
415 | 415 | } |
416 | 416 | |
@@ -421,12 +421,12 @@ discard block |
||
421 | 421 | * If true, you will not be able to save the uploaded file again. |
422 | 422 | * @return boolean true if the file saving is successful |
423 | 423 | */ |
424 | - public function saveAs($fileName,$deleteTempFile=true,$index=0){ |
|
425 | - if (($this->getErrorCode($index)===UPLOAD_ERR_OK) && (file_exists($this->getLocalName($index)))){ |
|
426 | - if ($deleteTempFile) |
|
427 | - return rename($this->getLocalName($index),$fileName); |
|
424 | + public function saveAs($fileName, $deleteTempFile=true, $index=0) { |
|
425 | + if(($this->getErrorCode($index)===UPLOAD_ERR_OK) && (file_exists($this->getLocalName($index)))) { |
|
426 | + if($deleteTempFile) |
|
427 | + return rename($this->getLocalName($index), $fileName); |
|
428 | 428 | else |
429 | - return copy($this->getLocalName($index),$fileName); |
|
429 | + return copy($this->getLocalName($index), $fileName); |
|
430 | 430 | } else |
431 | 431 | return false; |
432 | 432 | } |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | * @return TImage the image displayed when an upload |
436 | 436 | * completes successfully. |
437 | 437 | */ |
438 | - public function getSuccessImage(){ |
|
438 | + public function getSuccessImage() { |
|
439 | 439 | $this->ensureChildControls(); |
440 | 440 | return $this->_success; |
441 | 441 | } |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | * @return TImage the image displayed when an upload |
445 | 445 | * does not complete successfully. |
446 | 446 | */ |
447 | - public function getErrorImage(){ |
|
447 | + public function getErrorImage() { |
|
448 | 448 | $this->ensureChildControls(); |
449 | 449 | return $this->_error; |
450 | 450 | } |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | * @return TImage the image displayed when an upload |
454 | 454 | * is in progress. |
455 | 455 | */ |
456 | - public function getBusyImage(){ |
|
456 | + public function getBusyImage() { |
|
457 | 457 | $this->ensureChildControls(); |
458 | 458 | return $this->_busy; |
459 | 459 | } |
@@ -127,8 +127,7 @@ discard block |
||
127 | 127 | $button->setCssClass($this->getButtonCssClass()); |
128 | 128 | return $button; |
129 | 129 | } |
130 | - } |
|
131 | - else if($buttonType===TPagerButtonType::ImageButton) |
|
130 | + } else if($buttonType===TPagerButtonType::ImageButton) |
|
132 | 131 | { |
133 | 132 | $button = new TActiveImageButton; |
134 | 133 | $button->setImageUrl($this->getPageImageUrl($text,$commandName)); |
@@ -136,8 +135,7 @@ discard block |
||
136 | 135 | $button->Visible = true; |
137 | 136 | else |
138 | 137 | $button->Visible = false; |
139 | - } |
|
140 | - else |
|
138 | + } else |
|
141 | 139 | { |
142 | 140 | $button=new TActiveButton; |
143 | 141 | if(!$enabled) |
@@ -197,8 +195,7 @@ discard block |
||
197 | 195 | TWebControl::render($writer); |
198 | 196 | if($this->getActiveControl()->canUpdateClientSide()) |
199 | 197 | $this->getPage()->getCallbackClient()->replaceContent($this,$writer); |
200 | - } |
|
201 | - else |
|
198 | + } else |
|
202 | 199 | { |
203 | 200 | $this->getPage()->getAdapter()->registerControlToRender($this,$writer); |
204 | 201 | } |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | ); |
104 | 104 | |
105 | 105 | $this->getControls()->add($list); |
106 | - $list->setDataSource(range(1,$this->getPageCount())); |
|
106 | + $list->setDataSource(range(1, $this->getPageCount())); |
|
107 | 107 | $list->dataBind(); |
108 | 108 | $list->setSelectedIndex($this->getCurrentPageIndex()); |
109 | 109 | $list->setAutoPostBack(true); |
110 | - $list->attachEventHandler('OnSelectedIndexChanged',array($this,'listIndexChanged')); |
|
110 | + $list->attachEventHandler('OnSelectedIndexChanged', array($this, 'listIndexChanged')); |
|
111 | 111 | $list->attachEventHandler('OnCallback', array($this, 'handleCallback')); |
112 | 112 | } |
113 | 113 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * @param string CommandParameter corresponding to the OnCommand event of the button |
124 | 124 | * @return mixed the button instance |
125 | 125 | */ |
126 | - protected function createPagerButton($buttonType,$enabled,$text,$commandName,$commandParameter) |
|
126 | + protected function createPagerButton($buttonType, $enabled, $text, $commandName, $commandParameter) |
|
127 | 127 | { |
128 | 128 | if($buttonType===TPagerButtonType::LinkButton) |
129 | 129 | { |
@@ -139,12 +139,12 @@ discard block |
||
139 | 139 | } |
140 | 140 | else if($buttonType===TPagerButtonType::ImageButton) |
141 | 141 | { |
142 | - $button = new TActiveImageButton; |
|
143 | - $button->setImageUrl($this->getPageImageUrl($text,$commandName)); |
|
142 | + $button=new TActiveImageButton; |
|
143 | + $button->setImageUrl($this->getPageImageUrl($text, $commandName)); |
|
144 | 144 | if($enabled) |
145 | - $button->Visible = true; |
|
145 | + $button->Visible=true; |
|
146 | 146 | else |
147 | - $button->Visible = false; |
|
147 | + $button->Visible=false; |
|
148 | 148 | } |
149 | 149 | else |
150 | 150 | { |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | if($buttonType===TPagerButtonType::ImageButton) |
157 | 157 | { |
158 | - $button->ImageUrl = $text; |
|
158 | + $button->ImageUrl=$text; |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | $button->setText($text); |
@@ -179,14 +179,14 @@ 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. |
186 | 186 | $controlToPaginate=$this->getControlToPaginate(); |
187 | - foreach ($this->getNamingContainer()->findControlsByType('Prado\Web\UI\ActiveControls\TActivePager', false) as $control) |
|
187 | + foreach($this->getNamingContainer()->findControlsByType('Prado\Web\UI\ActiveControls\TActivePager', false) as $control) |
|
188 | 188 | { |
189 | - if ($control->getMode() !== TPagerMode::DropDownList && $control->getControlToPaginate()===$controlToPaginate) |
|
189 | + if($control->getMode()!==TPagerMode::DropDownList && $control->getControlToPaginate()===$controlToPaginate) |
|
190 | 190 | { |
191 | 191 | $control->render($param->getNewWriter()); |
192 | 192 | // FIXME : With some very fast machine, the getNewWriter() consecutive calls are in the same microsecond, resulting |
@@ -198,18 +198,18 @@ discard block |
||
198 | 198 | $this->onCallback($param); |
199 | 199 | } |
200 | 200 | |
201 | - public function render ($writer) |
|
201 | + public function render($writer) |
|
202 | 202 | { |
203 | 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 | 207 | if($this->getActiveControl()->canUpdateClientSide()) |
208 | - $this->getPage()->getCallbackClient()->replaceContent($this,$writer); |
|
208 | + $this->getPage()->getCallbackClient()->replaceContent($this, $writer); |
|
209 | 209 | } |
210 | 210 | else |
211 | 211 | { |
212 | - $this->getPage()->getAdapter()->registerControlToRender($this,$writer); |
|
212 | + $this->getPage()->getAdapter()->registerControlToRender($this, $writer); |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 | } |
@@ -174,14 +174,12 @@ |
||
174 | 174 | { |
175 | 175 | $parameter = new TAutoCompleteEventParameter($this->getResponse(), $token[0]); |
176 | 176 | $this->onSuggest($parameter); |
177 | - } |
|
178 | - else if($token[1] === '__TAutoComplete_onSuggestionSelected__') |
|
177 | + } else if($token[1] === '__TAutoComplete_onSuggestionSelected__') |
|
179 | 178 | { |
180 | 179 | $parameter = new TAutoCompleteEventParameter($this->getResponse(), null, $token[0]); |
181 | 180 | $this->onSuggestionSelected($parameter); |
182 | 181 | } |
183 | - } |
|
184 | - else if($this->getAutoPostBack()) |
|
182 | + } else if($this->getAutoPostBack()) |
|
185 | 183 | parent::raiseCallbackEvent($param); |
186 | 184 | } |
187 | 185 |
@@ -201,6 +201,7 @@ discard block |
||
201 | 201 | * method, be sure to call the parent implementation so that the event |
202 | 202 | * handler can be invoked. |
203 | 203 | * @param TCallbackEventParameter event parameter to be passed to the event handlers |
204 | + * @param TAutoCompleteEventParameter $param |
|
204 | 205 | */ |
205 | 206 | public function onSuggest($param) |
206 | 207 | { |
@@ -213,6 +214,7 @@ discard block |
||
213 | 214 | * method, be sure to call the parent implementation so that the event |
214 | 215 | * handler can be invoked. |
215 | 216 | * @param TCallbackEventParameter event parameter to be passed to the event handlers |
217 | + * @param TAutoCompleteEventParameter $param |
|
216 | 218 | */ |
217 | 219 | public function onSuggestionSelected($param) |
218 | 220 | { |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function setFrequency($value) |
132 | 132 | { |
133 | - $this->setViewState('frequency', TPropertyValue::ensureFloat($value),''); |
|
133 | + $this->setViewState('frequency', TPropertyValue::ensureFloat($value), ''); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function getMinChars() |
140 | 140 | { |
141 | - return $this->getViewState('minChars',''); |
|
141 | + return $this->getViewState('minChars', ''); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -177,17 +177,17 @@ discard block |
||
177 | 177 | */ |
178 | 178 | public function raiseCallbackEvent($param) |
179 | 179 | { |
180 | - $token = $param->getCallbackParameter(); |
|
181 | - if(is_array($token) && count($token) == 2) |
|
180 | + $token=$param->getCallbackParameter(); |
|
181 | + if(is_array($token) && count($token)==2) |
|
182 | 182 | { |
183 | - if($token[1] === '__TAutoComplete_onSuggest__') |
|
183 | + if($token[1]==='__TAutoComplete_onSuggest__') |
|
184 | 184 | { |
185 | - $parameter = new TAutoCompleteEventParameter($this->getResponse(), $token[0]); |
|
185 | + $parameter=new TAutoCompleteEventParameter($this->getResponse(), $token[0]); |
|
186 | 186 | $this->onSuggest($parameter); |
187 | 187 | } |
188 | - else if($token[1] === '__TAutoComplete_onSuggestionSelected__') |
|
188 | + else if($token[1]==='__TAutoComplete_onSuggestionSelected__') |
|
189 | 189 | { |
190 | - $parameter = new TAutoCompleteEventParameter($this->getResponse(), null, $token[0]); |
|
190 | + $parameter=new TAutoCompleteEventParameter($this->getResponse(), null, $token[0]); |
|
191 | 191 | $this->onSuggestionSelected($parameter); |
192 | 192 | } |
193 | 193 | } |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | public function getResultPanel() |
245 | 245 | { |
246 | 246 | if($this->_resultPanel===null) |
247 | - $this->_resultPanel = $this->createResultPanel(); |
|
247 | + $this->_resultPanel=$this->createResultPanel(); |
|
248 | 248 | return $this->_resultPanel; |
249 | 249 | } |
250 | 250 | |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | */ |
254 | 254 | protected function createResultPanel() |
255 | 255 | { |
256 | - $panel = new TPanel; |
|
256 | + $panel=new TPanel; |
|
257 | 257 | $this->getControls()->add($panel); |
258 | 258 | $panel->setID('result'); |
259 | 259 | return $panel; |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | public function getSuggestions() |
266 | 266 | { |
267 | 267 | if($this->_repeater===null) |
268 | - $this->_repeater = $this->createRepeater(); |
|
268 | + $this->_repeater=$this->createRepeater(); |
|
269 | 269 | return $this->_repeater; |
270 | 270 | } |
271 | 271 | |
@@ -274,10 +274,10 @@ discard block |
||
274 | 274 | */ |
275 | 275 | protected function createRepeater() |
276 | 276 | { |
277 | - $repeater = new TRepeater; |
|
277 | + $repeater=new TRepeater; |
|
278 | 278 | $repeater->setHeaderTemplate(new TAutoCompleteTemplate('<ul>')); |
279 | 279 | $repeater->setFooterTemplate(new TAutoCompleteTemplate('</ul>')); |
280 | - $repeater->setItemTemplate(new TTemplate('<li><%# $this->DataItem %></li>',null)); |
|
280 | + $repeater->setItemTemplate(new TTemplate('<li><%# $this->DataItem %></li>', null)); |
|
281 | 281 | $repeater->setEmptyTemplate(new TAutoCompleteTemplate('<ul></ul>')); |
282 | 282 | $this->getControls()->add($repeater); |
283 | 283 | return $repeater; |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | if($this->getActiveControl()->canUpdateClientSide()) |
322 | 322 | { |
323 | 323 | $this->getSuggestions()->render($writer); |
324 | - $boundary = $writer->getWriter()->getBoundary(); |
|
324 | + $boundary=$writer->getWriter()->getBoundary(); |
|
325 | 325 | $this->getResponse()->getAdapter()->setResponseData($boundary); |
326 | 326 | } |
327 | 327 | } |
@@ -333,29 +333,29 @@ discard block |
||
333 | 333 | { |
334 | 334 | //disallow page state update ? |
335 | 335 | //$this->getActiveControl()->getClientSide()->setEnablePageStateUpdate(false); |
336 | - $options = array(); |
|
337 | - if(strlen($string = $this->getSeparator())) |
|
336 | + $options=array(); |
|
337 | + if(strlen($string=$this->getSeparator())) |
|
338 | 338 | { |
339 | - $string = strtr($string,array('\t'=>"\t",'\n'=>"\n",'\r'=>"\r")); |
|
340 | - $token = preg_split('//', $string, -1, PREG_SPLIT_NO_EMPTY); |
|
341 | - $options['tokens'] = $token; |
|
339 | + $string=strtr($string, array('\t'=>"\t", '\n'=>"\n", '\r'=>"\r")); |
|
340 | + $token=preg_split('//', $string, -1, PREG_SPLIT_NO_EMPTY); |
|
341 | + $options['tokens']=$token; |
|
342 | 342 | } |
343 | 343 | if($this->getAutoPostBack()) |
344 | 344 | { |
345 | - $options = array_merge($options,parent::getPostBackOptions()); |
|
346 | - $options['AutoPostBack'] = true; |
|
345 | + $options=array_merge($options, parent::getPostBackOptions()); |
|
346 | + $options['AutoPostBack']=true; |
|
347 | 347 | } |
348 | - if(strlen($select = $this->getTextCssClass())) |
|
349 | - $options['select'] = $select; |
|
350 | - $options['ResultPanel'] = $this->getResultPanel()->getClientID(); |
|
351 | - $options['ID'] = $this->getClientID(); |
|
352 | - $options['EventTarget'] = $this->getUniqueID(); |
|
348 | + if(strlen($select=$this->getTextCssClass())) |
|
349 | + $options['select']=$select; |
|
350 | + $options['ResultPanel']=$this->getResultPanel()->getClientID(); |
|
351 | + $options['ID']=$this->getClientID(); |
|
352 | + $options['EventTarget']=$this->getUniqueID(); |
|
353 | 353 | if(($minchars=$this->getMinChars())!=='') |
354 | - $options['minChars'] = $minchars; |
|
354 | + $options['minChars']=$minchars; |
|
355 | 355 | if(($frequency=$this->getFrequency())!=='') |
356 | - $options['frequency'] = $frequency; |
|
357 | - $options['CausesValidation'] = $this->getCausesValidation(); |
|
358 | - $options['ValidationGroup'] = $this->getValidationGroup(); |
|
356 | + $options['frequency']=$frequency; |
|
357 | + $options['CausesValidation']=$this->getCausesValidation(); |
|
358 | + $options['ValidationGroup']=$this->getValidationGroup(); |
|
359 | 359 | return $options; |
360 | 360 | } |
361 | 361 |
@@ -95,8 +95,7 @@ |
||
95 | 95 | if($this->getHasPreRendered()) { |
96 | 96 | $this->renderRepeater($writer); |
97 | 97 | if($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getSurroundingTagId(),$writer); |
98 | - } |
|
99 | - else { |
|
98 | + } else { |
|
100 | 99 | $this->getPage()->getAdapter()->registerControlToRender($this,$writer); |
101 | 100 | } |
102 | 101 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | parent::setDataSource($value); |
58 | 58 | if($this->getActiveControl()->canUpdateClientSide()) { |
59 | 59 | $this->renderPager(); |
60 | - $this->getPage()->getAdapter()->registerControlToRender($this,$this->getResponse()->createHtmlWriter()); |
|
60 | + $this->getPage()->getAdapter()->registerControlToRender($this, $this->getResponse()->createHtmlWriter()); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | public function render($writer) { |
95 | 95 | if($this->getHasPreRendered()) { |
96 | 96 | $this->renderRepeater($writer); |
97 | - if($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getSurroundingTagId(),$writer); |
|
97 | + if($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getSurroundingTagId(), $writer); |
|
98 | 98 | } |
99 | 99 | else { |
100 | - $this->getPage()->getAdapter()->registerControlToRender($this,$writer); |
|
100 | + $this->getPage()->getAdapter()->registerControlToRender($this, $writer); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | foreach($pager as $item) { |
112 | 112 | if($item->ControlToPaginate==$this->ID) { |
113 | 113 | $writer=$this->getResponse()->createHtmlWriter(); |
114 | - $this->getPage()->getAdapter()->registerControlToRender($item,$writer); |
|
114 | + $this->getPage()->getAdapter()->registerControlToRender($item, $writer); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * @param THtmlWriter writer for the rendering purpose |
124 | 124 | */ |
125 | 125 | private function renderRepeater($writer) { |
126 | - $writer->addAttribute('id',$this->getSurroundingTagID()); |
|
126 | + $writer->addAttribute('id', $this->getSurroundingTagID()); |
|
127 | 127 | $writer->renderBeginTag($this->getSurroundingTag()); |
128 | 128 | parent::render($writer); |
129 | 129 | $writer->renderEndTag(); |
@@ -424,13 +424,11 @@ discard block |
||
424 | 424 | { |
425 | 425 | $boundary = $this->getRenderedContentBoundary($content); |
426 | 426 | $content = null; |
427 | - } |
|
428 | - else if($content instanceof THtmlWriter) |
|
427 | + } else if($content instanceof THtmlWriter) |
|
429 | 428 | { |
430 | 429 | $boundary = $this->getResponseContentBoundary($content); |
431 | 430 | $content = null; |
432 | - } |
|
433 | - else |
|
431 | + } else |
|
434 | 432 | $boundary = null; |
435 | 433 | |
436 | 434 | $this->callClientFunction('Prado.Element.replace', array($element, $content, $boundary, $self)); |
@@ -477,8 +475,7 @@ discard block |
||
477 | 475 | if($content instanceof TControl) |
478 | 476 | { |
479 | 477 | $boundary = $this->getRenderedContentBoundary($content); |
480 | - } |
|
481 | - elseif($content instanceof THtmlWriter) |
|
478 | + } elseif($content instanceof THtmlWriter) |
|
482 | 479 | { |
483 | 480 | $boundary = $this->getResponseContentBoundary($content); |
484 | 481 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function __construct() |
70 | 70 | { |
71 | - $this->_actions = new TList; |
|
71 | + $this->_actions=new TList; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
@@ -88,14 +88,14 @@ discard block |
||
88 | 88 | public function callClientFunction($function, $params=array()) |
89 | 89 | { |
90 | 90 | if(!is_array($params)) |
91 | - $params = array($params); |
|
91 | + $params=array($params); |
|
92 | 92 | |
93 | 93 | if(count($params) > 0) |
94 | 94 | { |
95 | - if ($params[0] instanceof ISurroundable) |
|
96 | - $params[0] = $params[0]->getSurroundingTagID(); |
|
95 | + if($params[0] instanceof ISurroundable) |
|
96 | + $params[0]=$params[0]->getSurroundingTagID(); |
|
97 | 97 | elseif($params[0] instanceof TControl) |
98 | - $params[0] = $params[0]->getClientID(); |
|
98 | + $params[0]=$params[0]->getClientID(); |
|
99 | 99 | } |
100 | 100 | $this->_actions->add(array($function => $params)); |
101 | 101 | } |
@@ -108,13 +108,13 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function jQuery($element, $method, $params=array()) |
110 | 110 | { |
111 | - if ($element instanceof ISurroundable) |
|
112 | - $element = $element->getSurroundingTagID(); |
|
111 | + if($element instanceof ISurroundable) |
|
112 | + $element=$element->getSurroundingTagID(); |
|
113 | 113 | elseif($element instanceof TControl) |
114 | - $element = $element->getClientID(); |
|
114 | + $element=$element->getClientID(); |
|
115 | 115 | |
116 | 116 | if(!is_array($params)) |
117 | - $params = array($params); |
|
117 | + $params=array($params); |
|
118 | 118 | |
119 | 119 | $this->_actions->add(array('Prado.Element.j' => array($element, $method, $params))); |
120 | 120 | } |
@@ -147,14 +147,14 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function select($control, $method='Value', $value=null, $type=null) |
149 | 149 | { |
150 | - $method = TPropertyValue::ensureEnum($method, |
|
150 | + $method=TPropertyValue::ensureEnum($method, |
|
151 | 151 | 'Value', 'Index', 'Clear', 'Indices', 'Values', 'All', 'Invert'); |
152 | - $type = ($type===null) ? $this->getSelectionControlType($control) : $type; |
|
153 | - $total = $this->getSelectionControlIsListType($control) ? $control->getItemCount() : 1; |
|
152 | + $type=($type===null) ? $this->getSelectionControlType($control) : $type; |
|
153 | + $total=$this->getSelectionControlIsListType($control) ? $control->getItemCount() : 1; |
|
154 | 154 | |
155 | 155 | // pass the ID to avoid getting the surrounding elements (ISurroundable) |
156 | 156 | if($control instanceof TControl) |
157 | - $control = $control->getClientID(); |
|
157 | + $control=$control->getClientID(); |
|
158 | 158 | |
159 | 159 | $this->callClientFunction('Prado.Element.select', |
160 | 160 | array($control, $type.$method, $value, $total)); |
@@ -214,9 +214,9 @@ discard block |
||
214 | 214 | public function setAttribute($control, $name, $value) |
215 | 215 | { |
216 | 216 | // Attributes should be applied on Surrounding tag, except for 'disabled' attribute |
217 | - if ($control instanceof ISurroundable && strtolower($name)!=='disabled') |
|
217 | + if($control instanceof ISurroundable && strtolower($name)!=='disabled') |
|
218 | 218 | $control=$control->getSurroundingTagID(); |
219 | - $this->callClientFunction('Prado.Element.setAttribute',array($control, $name, $value)); |
|
219 | + $this->callClientFunction('Prado.Element.setAttribute', array($control, $name, $value)); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | /** |
@@ -226,25 +226,25 @@ discard block |
||
226 | 226 | */ |
227 | 227 | public function setListItems($control, $items) |
228 | 228 | { |
229 | - $options = array(); |
|
229 | + $options=array(); |
|
230 | 230 | if($control instanceof TListControl) |
231 | 231 | { |
232 | - $promptText = $control->getPromptText(); |
|
233 | - $promptValue = $control->getPromptValue(); |
|
232 | + $promptText=$control->getPromptText(); |
|
233 | + $promptValue=$control->getPromptValue(); |
|
234 | 234 | |
235 | 235 | if($promptValue==='') |
236 | - $promptValue = $promptText; |
|
236 | + $promptValue=$promptText; |
|
237 | 237 | |
238 | 238 | if($promptValue!=='') |
239 | - $options[] = array($promptText, $promptValue); |
|
239 | + $options[]=array($promptText, $promptValue); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | foreach($items as $item) |
243 | 243 | { |
244 | 244 | if($item->getHasAttributes()) |
245 | - $options[] = array($item->getText(),$item->getValue(), $item->getAttributes()->itemAt('Group')); |
|
245 | + $options[]=array($item->getText(), $item->getValue(), $item->getAttributes()->itemAt('Group')); |
|
246 | 246 | else |
247 | - $options[] = array($item->getText(),$item->getValue()); |
|
247 | + $options[]=array($item->getText(), $item->getValue()); |
|
248 | 248 | } |
249 | 249 | $this->callClientFunction('Prado.Element.setOptions', array($control, $options)); |
250 | 250 | } |
@@ -422,16 +422,16 @@ discard block |
||
422 | 422 | { |
423 | 423 | if($content instanceof TControl) |
424 | 424 | { |
425 | - $boundary = $this->getRenderedContentBoundary($content); |
|
426 | - $content = null; |
|
425 | + $boundary=$this->getRenderedContentBoundary($content); |
|
426 | + $content=null; |
|
427 | 427 | } |
428 | 428 | else if($content instanceof THtmlWriter) |
429 | 429 | { |
430 | - $boundary = $this->getResponseContentBoundary($content); |
|
431 | - $content = null; |
|
430 | + $boundary=$this->getResponseContentBoundary($content); |
|
431 | + $content=null; |
|
432 | 432 | } |
433 | 433 | else |
434 | - $boundary = null; |
|
434 | + $boundary=null; |
|
435 | 435 | |
436 | 436 | $this->callClientFunction('Prado.Element.replace', array($element, $content, $boundary, $self)); |
437 | 437 | } |
@@ -456,11 +456,11 @@ discard block |
||
456 | 456 | { |
457 | 457 | if($writer instanceof THtmlWriter) |
458 | 458 | { |
459 | - $boundary = $this->getResponseContentBoundary($writer); |
|
460 | - $content = null; |
|
459 | + $boundary=$this->getResponseContentBoundary($writer); |
|
460 | + $content=null; |
|
461 | 461 | } else { |
462 | - $boundary = null; |
|
463 | - $content = $writer; |
|
462 | + $boundary=null; |
|
463 | + $content=$writer; |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | $this->callClientFunction('Prado.Element.evaluateScript', array($content, $boundary)); |
@@ -476,11 +476,11 @@ discard block |
||
476 | 476 | { |
477 | 477 | if($content instanceof TControl) |
478 | 478 | { |
479 | - $boundary = $this->getRenderedContentBoundary($content); |
|
479 | + $boundary=$this->getRenderedContentBoundary($content); |
|
480 | 480 | } |
481 | 481 | elseif($content instanceof THtmlWriter) |
482 | 482 | { |
483 | - $boundary = $this->getResponseContentBoundary($content); |
|
483 | + $boundary=$this->getResponseContentBoundary($content); |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | $this->callClientFunction('Prado.Element.appendScriptBlock', array($boundary)); |
@@ -496,8 +496,8 @@ discard block |
||
496 | 496 | */ |
497 | 497 | private function getRenderedContentBoundary($control) |
498 | 498 | { |
499 | - $writer = $this->getResponse()->createHtmlWriter(); |
|
500 | - $adapter = $control->getPage()->getAdapter(); |
|
499 | + $writer=$this->getResponse()->createHtmlWriter(); |
|
500 | + $adapter=$control->getPage()->getAdapter(); |
|
501 | 501 | $adapter->registerControlToRender($control, $writer); |
502 | 502 | return $writer->getWriter()->getBoundary(); |
503 | 503 | } |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | */ |
562 | 562 | public function fadeTo($element, $value, $duration=500) |
563 | 563 | { |
564 | - $value = TPropertyValue::ensureFloat($value); |
|
564 | + $value=TPropertyValue::ensureFloat($value); |
|
565 | 565 | $this->visualEffect('fadeTo', $element, array($duration, $value)); |
566 | 566 | } |
567 | 567 |
@@ -94,6 +94,7 @@ discard block |
||
94 | 94 | * Executes a client-side statement. |
95 | 95 | * @param string javascript function name |
96 | 96 | * @param array list of arguments for the function |
97 | + * @param string $function |
|
97 | 98 | */ |
98 | 99 | public function callClientFunction($function, $params=array()) |
99 | 100 | { |
@@ -154,6 +155,7 @@ discard block |
||
154 | 155 | * @param string selection method |
155 | 156 | * @param string|int the value or index to select/check. |
156 | 157 | * @param string selection control type, either 'check' or 'select' |
158 | + * @param string $type |
|
157 | 159 | */ |
158 | 160 | public function select($control, $method='Value', $value=null, $type=null) |
159 | 161 | { |
@@ -423,6 +425,7 @@ discard block |
||
423 | 425 | * @param TControl control element or HTML element id. |
424 | 426 | * @param string HTML fragement or the control to be rendered. |
425 | 427 | * @param boolean whether to fully replace the element or just its inner content. |
428 | + * @param boolean $self |
|
426 | 429 | * @see insertAbout |
427 | 430 | * @see insertBelow |
428 | 431 | * @see insertBefore |
@@ -481,6 +484,7 @@ discard block |
||
481 | 484 | * Similar to to evaluateScript(), but functions declared in the |
482 | 485 | * inline block will be available to page elements. |
483 | 486 | * @param THtmlWriter writer for the content. |
487 | + * @param \Prado\TComponent $content |
|
484 | 488 | */ |
485 | 489 | public function appendScriptBlock($content) |
486 | 490 | { |
@@ -502,6 +506,7 @@ discard block |
||
502 | 506 | * component developers. The render() method is defered to be called in the |
503 | 507 | * TActivePageAdapter class. |
504 | 508 | * @param TControl control to be rendered on callback response. |
509 | + * @param TControl $control |
|
505 | 510 | * @return string the boundary for which the rendered content is wrapped. |
506 | 511 | */ |
507 | 512 | private function getRenderedContentBoundary($control) |
@@ -514,6 +519,7 @@ discard block |
||
514 | 519 | |
515 | 520 | /** |
516 | 521 | * @param THtmlWriter the writer responsible for rendering html content. |
522 | + * @param THtmlWriter $html |
|
517 | 523 | * @return string content boundary. |
518 | 524 | */ |
519 | 525 | private function getResponseContentBoundary($html) |
@@ -533,6 +539,7 @@ discard block |
||
533 | 539 | * @param string visual effect function name. |
534 | 540 | * @param TControl control element or element id |
535 | 541 | * @param array visual effect key-value pair options. |
542 | + * @param string $type |
|
536 | 543 | */ |
537 | 544 | public function visualEffect($type, $element, $options=array()) |
538 | 545 | { |
@@ -640,6 +647,7 @@ discard block |
||
640 | 647 | * @param string visual effect function name. |
641 | 648 | * @param TControl control element or element id |
642 | 649 | * @param array effect options. |
650 | + * @param string $effect |
|
643 | 651 | */ |
644 | 652 | public function juiEffect($element, $effect, $options=array()) |
645 | 653 | { |
@@ -78,8 +78,7 @@ |
||
78 | 78 | $this->_d[]=$item; |
79 | 79 | ++$this->_c; |
80 | 80 | } |
81 | - } |
|
82 | - else if($data!==null) |
|
81 | + } else if($data!==null) |
|
83 | 82 | throw new TInvalidDataTypeException('stack_data_not_iterable'); |
84 | 83 | } |
85 | 84 |
@@ -148,7 +148,7 @@ |
||
148 | 148 | /** |
149 | 149 | * Returns an iterator for traversing the items in the stack. |
150 | 150 | * This method is required by the interface \IteratorAggregate. |
151 | - * @return Iterator an iterator for traversing the items in the stack. |
|
151 | + * @return \ArrayIterator an iterator for traversing the items in the stack. |
|
152 | 152 | */ |
153 | 153 | public function getIterator() |
154 | 154 | { |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function contains($item) |
104 | 104 | { |
105 | - return array_search($item,$this->_d,true)!==false; |
|
105 | + return array_search($item, $this->_d, true)!==false; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | if($this->_c===0) |
117 | 117 | throw new TInvalidOperationException('stack_empty'); |
118 | 118 | else |
119 | - return $this->_d[$this->_c-1]; |
|
119 | + return $this->_d[$this->_c - 1]; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | public function push($item) |
143 | 143 | { |
144 | 144 | ++$this->_c; |
145 | - $this->_d[] = $item; |
|
145 | + $this->_d[]=$item; |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function getIterator() |
154 | 154 | { |
155 | - return new \ArrayIterator( $this->_d ); |
|
155 | + return new \ArrayIterator($this->_d); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |