@@ -191,6 +191,7 @@ discard block |
||
191 | 191 | * method, be sure to call the parent implementation so that the event |
192 | 192 | * handler can be invoked. |
193 | 193 | * @param TCallbackEventParameter event parameter to be passed to the event handlers |
194 | + * @param TAutoCompleteEventParameter $param |
|
194 | 195 | */ |
195 | 196 | public function onSuggest($param) |
196 | 197 | { |
@@ -203,6 +204,7 @@ discard block |
||
203 | 204 | * method, be sure to call the parent implementation so that the event |
204 | 205 | * handler can be invoked. |
205 | 206 | * @param TCallbackEventParameter event parameter to be passed to the event handlers |
207 | + * @param TAutoCompleteEventParameter $param |
|
206 | 208 | */ |
207 | 209 | public function onSuggestionSelected($param) |
208 | 210 | { |
@@ -383,6 +385,7 @@ discard block |
||
383 | 385 | |
384 | 386 | /** |
385 | 387 | * Creates a new TCallbackEventParameter. |
388 | + * @param THttpResponse $response |
|
386 | 389 | */ |
387 | 390 | public function __construct($response, $parameter, $index=-1) |
388 | 391 | { |
@@ -421,6 +424,9 @@ discard block |
||
421 | 424 | { |
422 | 425 | private $_template; |
423 | 426 | |
427 | + /** |
|
428 | + * @param string $template |
|
429 | + */ |
|
424 | 430 | public function __construct($template) |
425 | 431 | { |
426 | 432 | $this->_template = $template; |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | /** |
85 | 85 | * @var ITemplate template for repeater items |
86 | 86 | */ |
87 | - private $_repeater=null; |
|
87 | + private $_repeater = null; |
|
88 | 88 | /** |
89 | 89 | * @var TPanel result panel holding the suggestion items. |
90 | 90 | */ |
91 | - private $_resultPanel=null; |
|
91 | + private $_resultPanel = null; |
|
92 | 92 | |
93 | 93 | /** |
94 | 94 | * @return string word or token separators (delimiters). |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public function setFrequency($value) |
122 | 122 | { |
123 | - $this->setViewState('frequency', TPropertyValue::ensureFloat($value),''); |
|
123 | + $this->setViewState('frequency', TPropertyValue::ensureFloat($value), ''); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | public function getMinChars() |
130 | 130 | { |
131 | - return $this->getViewState('minChars',''); |
|
131 | + return $this->getViewState('minChars', ''); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
@@ -168,20 +168,20 @@ discard block |
||
168 | 168 | public function raiseCallbackEvent($param) |
169 | 169 | { |
170 | 170 | $token = $param->getCallbackParameter(); |
171 | - if(is_array($token) && count($token) == 2) |
|
171 | + if (is_array($token) && count($token) == 2) |
|
172 | 172 | { |
173 | - if($token[1] === '__TAutoComplete_onSuggest__') |
|
173 | + if ($token[1] === '__TAutoComplete_onSuggest__') |
|
174 | 174 | { |
175 | 175 | $parameter = new TAutoCompleteEventParameter($this->getResponse(), $token[0]); |
176 | 176 | $this->onSuggest($parameter); |
177 | 177 | } |
178 | - else if($token[1] === '__TAutoComplete_onSuggestionSelected__') |
|
178 | + else if ($token[1] === '__TAutoComplete_onSuggestionSelected__') |
|
179 | 179 | { |
180 | 180 | $parameter = new TAutoCompleteEventParameter($this->getResponse(), null, $token[0]); |
181 | 181 | $this->onSuggestionSelected($parameter); |
182 | 182 | } |
183 | 183 | } |
184 | - else if($this->getAutoPostBack()) |
|
184 | + else if ($this->getAutoPostBack()) |
|
185 | 185 | parent::raiseCallbackEvent($param); |
186 | 186 | } |
187 | 187 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | public function dataBind() |
225 | 225 | { |
226 | 226 | parent::dataBind(); |
227 | - if($this->getPage()->getIsCallback()) |
|
227 | + if ($this->getPage()->getIsCallback()) |
|
228 | 228 | $this->renderSuggestions($this->getResponse()->createHtmlWriter()); |
229 | 229 | } |
230 | 230 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | */ |
234 | 234 | public function getResultPanel() |
235 | 235 | { |
236 | - if($this->_resultPanel===null) |
|
236 | + if ($this->_resultPanel === null) |
|
237 | 237 | $this->_resultPanel = $this->createResultPanel(); |
238 | 238 | return $this->_resultPanel; |
239 | 239 | } |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | */ |
255 | 255 | public function getSuggestions() |
256 | 256 | { |
257 | - if($this->_repeater===null) |
|
257 | + if ($this->_repeater === null) |
|
258 | 258 | $this->_repeater = $this->createRepeater(); |
259 | 259 | return $this->_repeater; |
260 | 260 | } |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | $repeater = Prado::createComponent('System.Web.UI.WebControls.TRepeater'); |
268 | 268 | $repeater->setHeaderTemplate(new TAutoCompleteTemplate('<ul>')); |
269 | 269 | $repeater->setFooterTemplate(new TAutoCompleteTemplate('</ul>')); |
270 | - $repeater->setItemTemplate(new TTemplate('<li><%# $this->DataItem %></li>',null)); |
|
270 | + $repeater->setItemTemplate(new TTemplate('<li><%# $this->DataItem %></li>', null)); |
|
271 | 271 | $repeater->setEmptyTemplate(new TAutoCompleteTemplate('<ul></ul>')); |
272 | 272 | $this->getControls()->add($repeater); |
273 | 273 | return $repeater; |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | */ |
279 | 279 | public function renderEndTag($writer) |
280 | 280 | { |
281 | - $cs=$this->getPage()->getClientScript(); |
|
281 | + $cs = $this->getPage()->getClientScript(); |
|
282 | 282 | $cs->registerPradoScript('autocomplete'); |
283 | 283 | parent::renderEndTag($writer); |
284 | 284 | $this->renderResultPanel($writer); |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | */ |
309 | 309 | public function renderSuggestions($writer) |
310 | 310 | { |
311 | - if($this->getActiveControl()->canUpdateClientSide()) |
|
311 | + if ($this->getActiveControl()->canUpdateClientSide()) |
|
312 | 312 | { |
313 | 313 | $this->getSuggestions()->render($writer); |
314 | 314 | $boundary = $writer->getWriter()->getBoundary(); |
@@ -324,25 +324,25 @@ discard block |
||
324 | 324 | //disallow page state update ? |
325 | 325 | //$this->getActiveControl()->getClientSide()->setEnablePageStateUpdate(false); |
326 | 326 | $options = array(); |
327 | - if(strlen($string = $this->getSeparator())) |
|
327 | + if (strlen($string = $this->getSeparator())) |
|
328 | 328 | { |
329 | - $string = strtr($string,array('\t'=>"\t",'\n'=>"\n",'\r'=>"\r")); |
|
329 | + $string = strtr($string, array('\t'=>"\t", '\n'=>"\n", '\r'=>"\r")); |
|
330 | 330 | $token = preg_split('//', $string, -1, PREG_SPLIT_NO_EMPTY); |
331 | 331 | $options['tokens'] = $token; |
332 | 332 | } |
333 | - if($this->getAutoPostBack()) |
|
333 | + if ($this->getAutoPostBack()) |
|
334 | 334 | { |
335 | - $options = array_merge($options,parent::getPostBackOptions()); |
|
335 | + $options = array_merge($options, parent::getPostBackOptions()); |
|
336 | 336 | $options['AutoPostBack'] = true; |
337 | 337 | } |
338 | - if(strlen($select = $this->getTextCssClass())) |
|
338 | + if (strlen($select = $this->getTextCssClass())) |
|
339 | 339 | $options['select'] = $select; |
340 | 340 | $options['ResultPanel'] = $this->getResultPanel()->getClientID(); |
341 | 341 | $options['ID'] = $this->getClientID(); |
342 | 342 | $options['EventTarget'] = $this->getUniqueID(); |
343 | - if(($minchars=$this->getMinChars())!=='') |
|
343 | + if (($minchars = $this->getMinChars()) !== '') |
|
344 | 344 | $options['minChars'] = $minchars; |
345 | - if(($frequency=$this->getFrequency())!=='') |
|
345 | + if (($frequency = $this->getFrequency()) !== '') |
|
346 | 346 | $options['frequency'] = $frequency; |
347 | 347 | $options['CausesValidation'] = $this->getCausesValidation(); |
348 | 348 | $options['ValidationGroup'] = $this->getValidationGroup(); |
@@ -379,15 +379,15 @@ discard block |
||
379 | 379 | */ |
380 | 380 | class TAutoCompleteEventParameter extends TCallbackEventParameter |
381 | 381 | { |
382 | - private $_selectedIndex=-1; |
|
382 | + private $_selectedIndex = -1; |
|
383 | 383 | |
384 | 384 | /** |
385 | 385 | * Creates a new TCallbackEventParameter. |
386 | 386 | */ |
387 | - public function __construct($response, $parameter, $index=-1) |
|
387 | + public function __construct($response, $parameter, $index = -1) |
|
388 | 388 | { |
389 | 389 | parent::__construct($response, $parameter); |
390 | - $this->_selectedIndex=$index; |
|
390 | + $this->_selectedIndex = $index; |
|
391 | 391 | } |
392 | 392 | |
393 | 393 | /** |
@@ -174,15 +174,14 @@ discard block |
||
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 | } |
182 | + } else if($this->getAutoPostBack()) { |
|
183 | + parent::raiseCallbackEvent($param); |
|
183 | 184 | } |
184 | - else if($this->getAutoPostBack()) |
|
185 | - parent::raiseCallbackEvent($param); |
|
186 | 185 | } |
187 | 186 | |
188 | 187 | /** |
@@ -224,8 +223,9 @@ discard block |
||
224 | 223 | public function dataBind() |
225 | 224 | { |
226 | 225 | parent::dataBind(); |
227 | - if($this->getPage()->getIsCallback()) |
|
228 | - $this->renderSuggestions($this->getResponse()->createHtmlWriter()); |
|
226 | + if($this->getPage()->getIsCallback()) { |
|
227 | + $this->renderSuggestions($this->getResponse()->createHtmlWriter()); |
|
228 | + } |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | /** |
@@ -233,8 +233,9 @@ discard block |
||
233 | 233 | */ |
234 | 234 | public function getResultPanel() |
235 | 235 | { |
236 | - if($this->_resultPanel===null) |
|
237 | - $this->_resultPanel = $this->createResultPanel(); |
|
236 | + if($this->_resultPanel===null) { |
|
237 | + $this->_resultPanel = $this->createResultPanel(); |
|
238 | + } |
|
238 | 239 | return $this->_resultPanel; |
239 | 240 | } |
240 | 241 | |
@@ -254,8 +255,9 @@ discard block |
||
254 | 255 | */ |
255 | 256 | public function getSuggestions() |
256 | 257 | { |
257 | - if($this->_repeater===null) |
|
258 | - $this->_repeater = $this->createRepeater(); |
|
258 | + if($this->_repeater===null) { |
|
259 | + $this->_repeater = $this->createRepeater(); |
|
260 | + } |
|
259 | 261 | return $this->_repeater; |
260 | 262 | } |
261 | 263 | |
@@ -335,15 +337,18 @@ discard block |
||
335 | 337 | $options = array_merge($options,parent::getPostBackOptions()); |
336 | 338 | $options['AutoPostBack'] = true; |
337 | 339 | } |
338 | - if(strlen($select = $this->getTextCssClass())) |
|
339 | - $options['select'] = $select; |
|
340 | + if(strlen($select = $this->getTextCssClass())) { |
|
341 | + $options['select'] = $select; |
|
342 | + } |
|
340 | 343 | $options['ResultPanel'] = $this->getResultPanel()->getClientID(); |
341 | 344 | $options['ID'] = $this->getClientID(); |
342 | 345 | $options['EventTarget'] = $this->getUniqueID(); |
343 | - if(($minchars=$this->getMinChars())!=='') |
|
344 | - $options['minChars'] = $minchars; |
|
345 | - if(($frequency=$this->getFrequency())!=='') |
|
346 | - $options['frequency'] = $frequency; |
|
346 | + if(($minchars=$this->getMinChars())!=='') { |
|
347 | + $options['minChars'] = $minchars; |
|
348 | + } |
|
349 | + if(($frequency=$this->getFrequency())!=='') { |
|
350 | + $options['frequency'] = $frequency; |
|
351 | + } |
|
347 | 352 | $options['CausesValidation'] = $this->getCausesValidation(); |
348 | 353 | $options['ValidationGroup'] = $this->getValidationGroup(); |
349 | 354 | return $options; |
@@ -52,6 +52,8 @@ discard block |
||
52 | 52 | * @param string option name. |
53 | 53 | * @param mixed new value. |
54 | 54 | * @param mixed default value. |
55 | + * @param string $name |
|
56 | + * @param boolean|string $default |
|
55 | 57 | * @return mixed options value. |
56 | 58 | */ |
57 | 59 | protected function setOption($name,$value,$default=null) |
@@ -66,6 +68,8 @@ discard block |
||
66 | 68 | * named values for the base active controls. |
67 | 69 | * @param string option name. |
68 | 70 | * @param mixed default value. |
71 | + * @param string $name |
|
72 | + * @param boolean|string $default |
|
69 | 73 | * @return mixed options value. |
70 | 74 | */ |
71 | 75 | protected function getOption($name,$default=null) |
@@ -177,6 +181,7 @@ discard block |
||
177 | 181 | /** |
178 | 182 | * Sets the client side options. Can only be set when client side is null. |
179 | 183 | * @param TCallbackClientSide client side options. |
184 | + * @param TActiveCustomValidatorClientSide $client |
|
180 | 185 | */ |
181 | 186 | public function setClientSide($client) |
182 | 187 | { |
@@ -343,6 +348,7 @@ discard block |
||
343 | 348 | * {@link getClientSide ClientSide} property. |
344 | 349 | * @param string client side javascript class name. |
345 | 350 | * @param array additional callback options. |
351 | + * @param string $class |
|
346 | 352 | */ |
347 | 353 | public function registerCallbackClientScript($class,$options=null) |
348 | 354 | { |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | * @param mixed default value. |
55 | 55 | * @return mixed options value. |
56 | 56 | */ |
57 | - protected function setOption($name,$value,$default=null) |
|
57 | + protected function setOption($name, $value, $default = null) |
|
58 | 58 | { |
59 | - $value = ($value===null) ? $default : $value; |
|
60 | - if($value!==null) |
|
61 | - $this->_options->add($name,$value); |
|
59 | + $value = ($value === null) ? $default : $value; |
|
60 | + if ($value !== null) |
|
61 | + $this->_options->add($name, $value); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -68,10 +68,10 @@ discard block |
||
68 | 68 | * @param mixed default value. |
69 | 69 | * @return mixed options value. |
70 | 70 | */ |
71 | - protected function getOption($name,$default=null) |
|
71 | + protected function getOption($name, $default = null) |
|
72 | 72 | { |
73 | 73 | $item = $this->_options->itemAt($name); |
74 | - return ($item===null) ? $default : $item; |
|
74 | + return ($item === null) ? $default : $item; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @return boolean true if the callback response is allowed update |
123 | 123 | * client-side contents. |
124 | 124 | */ |
125 | - public function canUpdateClientSide($bDontRequireVisibility=false) |
|
125 | + public function canUpdateClientSide($bDontRequireVisibility = false) |
|
126 | 126 | { |
127 | 127 | return $this->getControl()->getHasChildInitialized() |
128 | 128 | && $this->getPage()->getIsLoadingPostData() == false |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | */ |
167 | 167 | public function getClientSide() |
168 | 168 | { |
169 | - if(($client = $this->getOption('ClientSide'))===null) |
|
169 | + if (($client = $this->getOption('ClientSide')) === null) |
|
170 | 170 | { |
171 | 171 | $client = $this->createClientSide(); |
172 | 172 | $this->setOption('ClientSide', $client); |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | */ |
181 | 181 | public function setClientSide($client) |
182 | 182 | { |
183 | - if( $this->getOption('ClientSide')===null) |
|
183 | + if ($this->getOption('ClientSide') === null) |
|
184 | 184 | $this->setOption('ClientSide', $client); |
185 | 185 | else |
186 | 186 | throw new TConfigurationException( |
@@ -225,23 +225,23 @@ discard block |
||
225 | 225 | */ |
226 | 226 | protected function getDefaultClientSideOptions() |
227 | 227 | { |
228 | - if(($id=$this->getCallbackOptions())!=='') |
|
228 | + if (($id = $this->getCallbackOptions()) !== '') |
|
229 | 229 | { |
230 | - if(($pos=strrpos($id,'.'))!==false) |
|
230 | + if (($pos = strrpos($id, '.')) !== false) |
|
231 | 231 | { |
232 | - $control=$this->getControl()->getSubProperty(substr($id,0,$pos)); |
|
233 | - $newid=substr($id,$pos+1); |
|
234 | - if ($control!==null) |
|
235 | - $control=$control->$newid; |
|
232 | + $control = $this->getControl()->getSubProperty(substr($id, 0, $pos)); |
|
233 | + $newid = substr($id, $pos + 1); |
|
234 | + if ($control !== null) |
|
235 | + $control = $control->$newid; |
|
236 | 236 | } |
237 | 237 | else |
238 | 238 | { |
239 | 239 | // TCheckBoxList overrides findControl() with a fake implementation |
240 | 240 | // but accepts a second parameter to use the standard one |
241 | - $control=$this->getControl()->findControl($id, true); |
|
241 | + $control = $this->getControl()->findControl($id, true); |
|
242 | 242 | } |
243 | 243 | |
244 | - if($control instanceof TCallbackOptions) |
|
244 | + if ($control instanceof TCallbackOptions) |
|
245 | 245 | return $control->getClientSide()->getOptions()->toArray(); |
246 | 246 | else |
247 | 247 | throw new TConfigurationException('callback_invalid_callback_options', $this->getControl()->getID(), $id); |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | */ |
257 | 257 | public function getCausesValidation() |
258 | 258 | { |
259 | - return $this->getOption('CausesValidation',true); |
|
259 | + return $this->getOption('CausesValidation', true); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | /** |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | */ |
266 | 266 | public function setCausesValidation($value) |
267 | 267 | { |
268 | - $this->setOption('CausesValidation',TPropertyValue::ensureBoolean($value),true); |
|
268 | + $this->setOption('CausesValidation', TPropertyValue::ensureBoolean($value), true); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | /** |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | */ |
275 | 275 | public function getValidationGroup() |
276 | 276 | { |
277 | - return $this->getOption('ValidationGroup',''); |
|
277 | + return $this->getOption('ValidationGroup', ''); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | /** |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | */ |
284 | 284 | public function setValidationGroup($value) |
285 | 285 | { |
286 | - $this->setOption('ValidationGroup',$value,''); |
|
286 | + $this->setOption('ValidationGroup', $value, ''); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | /** |
@@ -292,10 +292,10 @@ discard block |
||
292 | 292 | */ |
293 | 293 | public function canCauseValidation() |
294 | 294 | { |
295 | - if($this->getCausesValidation()) |
|
295 | + if ($this->getCausesValidation()) |
|
296 | 296 | { |
297 | - $group=$this->getValidationGroup(); |
|
298 | - return $this->getPage()->getValidators($group)->getCount()>0; |
|
297 | + $group = $this->getValidationGroup(); |
|
298 | + return $this->getPage()->getValidators($group)->getCount() > 0; |
|
299 | 299 | } |
300 | 300 | else |
301 | 301 | return false; |
@@ -324,13 +324,13 @@ discard block |
||
324 | 324 | protected function getClientSideOptions() |
325 | 325 | { |
326 | 326 | $default = $this->getDefaultClientSideOptions(); |
327 | - $options = array_merge($default,$this->getClientSide()->getOptions()->toArray()); |
|
327 | + $options = array_merge($default, $this->getClientSide()->getOptions()->toArray()); |
|
328 | 328 | $validate = $this->getCausesValidation(); |
329 | - $options['CausesValidation']= $validate ? '' : false; |
|
330 | - $options['ValidationGroup']=$this->getValidationGroup(); |
|
329 | + $options['CausesValidation'] = $validate ? '' : false; |
|
330 | + $options['ValidationGroup'] = $this->getValidationGroup(); |
|
331 | 331 | $options['CallbackParameter'] = $this->getCallbackParameter(); |
332 | 332 | // needed for TCallback |
333 | - if(!isset($options['EventTarget'])) |
|
333 | + if (!isset($options['EventTarget'])) |
|
334 | 334 | $options['EventTarget'] = $this->getControl()->getUniqueID(); |
335 | 335 | return $options; |
336 | 336 | } |
@@ -344,17 +344,17 @@ discard block |
||
344 | 344 | * @param string client side javascript class name. |
345 | 345 | * @param array additional callback options. |
346 | 346 | */ |
347 | - public function registerCallbackClientScript($class,$options=null) |
|
347 | + public function registerCallbackClientScript($class, $options = null) |
|
348 | 348 | { |
349 | 349 | $cs = $this->getPage()->getClientScript(); |
350 | - if(is_array($options)) |
|
351 | - $options = array_merge($this->getClientSideOptions(),$options); |
|
350 | + if (is_array($options)) |
|
351 | + $options = array_merge($this->getClientSideOptions(), $options); |
|
352 | 352 | else |
353 | 353 | $options = $this->getClientSideOptions(); |
354 | 354 | |
355 | 355 | //remove true as default to save bytes |
356 | - if($options['CausesValidation']===true) |
|
357 | - $options['CausesValidation']=''; |
|
356 | + if ($options['CausesValidation'] === true) |
|
357 | + $options['CausesValidation'] = ''; |
|
358 | 358 | $cs->registerCallbackControl($class, $options); |
359 | 359 | } |
360 | 360 | |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | public function getJavascript() |
381 | 381 | { |
382 | 382 | $client = $this->getPage()->getClientScript(); |
383 | - return $client->getCallbackReference($this->getControl(),$this->getClientSideOptions()); |
|
383 | + return $client->getCallbackReference($this->getControl(), $this->getClientSideOptions()); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | /** |
@@ -57,8 +57,9 @@ discard block |
||
57 | 57 | protected function setOption($name,$value,$default=null) |
58 | 58 | { |
59 | 59 | $value = ($value===null) ? $default : $value; |
60 | - if($value!==null) |
|
61 | - $this->_options->add($name,$value); |
|
60 | + if($value!==null) { |
|
61 | + $this->_options->add($name,$value); |
|
62 | + } |
|
62 | 63 | } |
63 | 64 | |
64 | 65 | /** |
@@ -180,11 +181,12 @@ discard block |
||
180 | 181 | */ |
181 | 182 | public function setClientSide($client) |
182 | 183 | { |
183 | - if( $this->getOption('ClientSide')===null) |
|
184 | - $this->setOption('ClientSide', $client); |
|
185 | - else |
|
186 | - throw new TConfigurationException( |
|
184 | + if( $this->getOption('ClientSide')===null) { |
|
185 | + $this->setOption('ClientSide', $client); |
|
186 | + } else { |
|
187 | + throw new TConfigurationException( |
|
187 | 188 | 'active_controls_client_side_exists', $this->getControl()->getID()); |
189 | + } |
|
188 | 190 | } |
189 | 191 | |
190 | 192 | /** |
@@ -231,20 +233,21 @@ discard block |
||
231 | 233 | { |
232 | 234 | $control=$this->getControl()->getSubProperty(substr($id,0,$pos)); |
233 | 235 | $newid=substr($id,$pos+1); |
234 | - if ($control!==null) |
|
235 | - $control=$control->$newid; |
|
236 | - } |
|
237 | - else |
|
236 | + if ($control!==null) { |
|
237 | + $control=$control->$newid; |
|
238 | + } |
|
239 | + } else |
|
238 | 240 | { |
239 | 241 | // TCheckBoxList overrides findControl() with a fake implementation |
240 | 242 | // but accepts a second parameter to use the standard one |
241 | 243 | $control=$this->getControl()->findControl($id, true); |
242 | 244 | } |
243 | 245 | |
244 | - if($control instanceof TCallbackOptions) |
|
245 | - return $control->getClientSide()->getOptions()->toArray(); |
|
246 | - else |
|
247 | - throw new TConfigurationException('callback_invalid_callback_options', $this->getControl()->getID(), $id); |
|
246 | + if($control instanceof TCallbackOptions) { |
|
247 | + return $control->getClientSide()->getOptions()->toArray(); |
|
248 | + } else { |
|
249 | + throw new TConfigurationException('callback_invalid_callback_options', $this->getControl()->getID(), $id); |
|
250 | + } |
|
248 | 251 | } |
249 | 252 | |
250 | 253 | return array(); |
@@ -296,9 +299,9 @@ discard block |
||
296 | 299 | { |
297 | 300 | $group=$this->getValidationGroup(); |
298 | 301 | return $this->getPage()->getValidators($group)->getCount()>0; |
302 | + } else { |
|
303 | + return false; |
|
299 | 304 | } |
300 | - else |
|
301 | - return false; |
|
302 | 305 | } |
303 | 306 | |
304 | 307 | /** |
@@ -330,8 +333,9 @@ discard block |
||
330 | 333 | $options['ValidationGroup']=$this->getValidationGroup(); |
331 | 334 | $options['CallbackParameter'] = $this->getCallbackParameter(); |
332 | 335 | // needed for TCallback |
333 | - if(!isset($options['EventTarget'])) |
|
334 | - $options['EventTarget'] = $this->getControl()->getUniqueID(); |
|
336 | + if(!isset($options['EventTarget'])) { |
|
337 | + $options['EventTarget'] = $this->getControl()->getUniqueID(); |
|
338 | + } |
|
335 | 339 | return $options; |
336 | 340 | } |
337 | 341 | |
@@ -347,14 +351,16 @@ discard block |
||
347 | 351 | public function registerCallbackClientScript($class,$options=null) |
348 | 352 | { |
349 | 353 | $cs = $this->getPage()->getClientScript(); |
350 | - if(is_array($options)) |
|
351 | - $options = array_merge($this->getClientSideOptions(),$options); |
|
352 | - else |
|
353 | - $options = $this->getClientSideOptions(); |
|
354 | + if(is_array($options)) { |
|
355 | + $options = array_merge($this->getClientSideOptions(),$options); |
|
356 | + } else { |
|
357 | + $options = $this->getClientSideOptions(); |
|
358 | + } |
|
354 | 359 | |
355 | 360 | //remove true as default to save bytes |
356 | - if($options['CausesValidation']===true) |
|
357 | - $options['CausesValidation']=''; |
|
361 | + if($options['CausesValidation']===true) { |
|
362 | + $options['CausesValidation']=''; |
|
363 | + } |
|
358 | 364 | $cs->registerCallbackControl($class, $options); |
359 | 365 | } |
360 | 366 |
@@ -84,6 +84,7 @@ discard block |
||
84 | 84 | * Executes a client-side statement. |
85 | 85 | * @param string javascript function name |
86 | 86 | * @param array list of arguments for the function |
87 | + * @param string $function |
|
87 | 88 | */ |
88 | 89 | public function callClientFunction($function, $params=array()) |
89 | 90 | { |
@@ -144,6 +145,7 @@ discard block |
||
144 | 145 | * @param string selection method |
145 | 146 | * @param string|int the value or index to select/check. |
146 | 147 | * @param string selection control type, either 'check' or 'select' |
148 | + * @param boolean $value |
|
147 | 149 | */ |
148 | 150 | public function select($control, $method='Value', $value=null, $type=null) |
149 | 151 | { |
@@ -210,6 +212,7 @@ discard block |
||
210 | 212 | * @param TControl control element or element id |
211 | 213 | * @param string attribute name |
212 | 214 | * @param string attribute value |
215 | + * @param TControl $control |
|
213 | 216 | */ |
214 | 217 | public function setAttribute($control, $name, $value) |
215 | 218 | { |
@@ -359,6 +362,7 @@ discard block |
||
359 | 362 | * key is the style property and the value is the style value. |
360 | 363 | * @param TControl control element or element id |
361 | 364 | * @param array list of key-value pairs as style property and style value. |
365 | + * @param TControl $element |
|
362 | 366 | */ |
363 | 367 | public function setStyle($element, $styles) |
364 | 368 | { |
@@ -413,6 +417,7 @@ discard block |
||
413 | 417 | * @param TControl control element or HTML element id. |
414 | 418 | * @param string HTML fragement or the control to be rendered. |
415 | 419 | * @param boolean whether to fully replace the element or just its inner content. |
420 | + * @param boolean $self |
|
416 | 421 | * @see insertAbout |
417 | 422 | * @see insertBelow |
418 | 423 | * @see insertBefore |
@@ -441,6 +446,7 @@ discard block |
||
441 | 446 | * @param TControl control element or HTML element id. |
442 | 447 | * @param string HTML fragement or the control to be rendered. |
443 | 448 | * @param boolean whether to fully replace the element or just its inner content, defaults to true. |
449 | + * @param TControl $element |
|
444 | 450 | */ |
445 | 451 | public function replaceContent($element, $content, $self=true) |
446 | 452 | { |
@@ -492,6 +498,7 @@ discard block |
||
492 | 498 | * component developers. The render() method is defered to be called in the |
493 | 499 | * TActivePageAdapter class. |
494 | 500 | * @param TControl control to be rendered on callback response. |
501 | + * @param TControl $control |
|
495 | 502 | * @return string the boundary for which the rendered content is wrapped. |
496 | 503 | */ |
497 | 504 | private function getRenderedContentBoundary($control) |
@@ -504,6 +511,7 @@ discard block |
||
504 | 511 | |
505 | 512 | /** |
506 | 513 | * @param THtmlWriter the writer responsible for rendering html content. |
514 | + * @param THtmlWriter $html |
|
507 | 515 | * @return string content boundary. |
508 | 516 | */ |
509 | 517 | private function getResponseContentBoundary($html) |
@@ -523,6 +531,7 @@ discard block |
||
523 | 531 | * @param string visual effect function name. |
524 | 532 | * @param TControl control element or element id |
525 | 533 | * @param array visual effect key-value pair options. |
534 | + * @param string $type |
|
526 | 535 | */ |
527 | 536 | public function visualEffect($type, $element, $options=array()) |
528 | 537 | { |
@@ -630,6 +639,7 @@ discard block |
||
630 | 639 | * @param string visual effect function name. |
631 | 640 | * @param TControl control element or element id |
632 | 641 | * @param array effect options. |
642 | + * @param string $effect |
|
633 | 643 | */ |
634 | 644 | public function juiEffect($element, $effect, $options=array()) |
635 | 645 | { |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * TCallbackClientScript class file |
|
4 | - * |
|
5 | - * @author Wei Zhuo <weizhuo[at]gamil[dot]com> |
|
6 | - * @link https://github.com/pradosoft/prado |
|
7 | - * @copyright Copyright © 2005-2015 The PRADO Group |
|
8 | - * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
9 | - * @package System.Web.UI.ActiveControls |
|
10 | - */ |
|
3 | + * TCallbackClientScript class file |
|
4 | + * |
|
5 | + * @author Wei Zhuo <weizhuo[at]gamil[dot]com> |
|
6 | + * @link https://github.com/pradosoft/prado |
|
7 | + * @copyright Copyright © 2005-2015 The PRADO Group |
|
8 | + * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
9 | + * @package System.Web.UI.ActiveControls |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * TCallbackClientScript class. |
@@ -85,16 +85,16 @@ discard block |
||
85 | 85 | * @param string javascript function name |
86 | 86 | * @param array list of arguments for the function |
87 | 87 | */ |
88 | - public function callClientFunction($function, $params=array()) |
|
88 | + public function callClientFunction($function, $params = array()) |
|
89 | 89 | { |
90 | - if(!is_array($params)) |
|
90 | + if (!is_array($params)) |
|
91 | 91 | $params = array($params); |
92 | 92 | |
93 | - if(count($params) > 0) |
|
93 | + if (count($params) > 0) |
|
94 | 94 | { |
95 | 95 | if ($params[0] instanceof ISurroundable) |
96 | 96 | $params[0] = $params[0]->getSurroundingTagID(); |
97 | - elseif($params[0] instanceof TControl) |
|
97 | + elseif ($params[0] instanceof TControl) |
|
98 | 98 | $params[0] = $params[0]->getClientID(); |
99 | 99 | } |
100 | 100 | $this->_actions->add(array($function => $params)); |
@@ -106,14 +106,14 @@ discard block |
||
106 | 106 | * @param string jQuery method name |
107 | 107 | * @param array list of arguments for the function |
108 | 108 | */ |
109 | - public function jQuery($element, $method, $params=array()) |
|
109 | + public function jQuery($element, $method, $params = array()) |
|
110 | 110 | { |
111 | 111 | if ($element instanceof ISurroundable) |
112 | 112 | $element = $element->getSurroundingTagID(); |
113 | - elseif($element instanceof TControl) |
|
113 | + elseif ($element instanceof TControl) |
|
114 | 114 | $element = $element->getClientID(); |
115 | 115 | |
116 | - if(!is_array($params)) |
|
116 | + if (!is_array($params)) |
|
117 | 117 | $params = array($params); |
118 | 118 | |
119 | 119 | $this->_actions->add(array('Prado.Element.j' => array($element, $method, $params))); |
@@ -145,27 +145,27 @@ discard block |
||
145 | 145 | * @param string|int the value or index to select/check. |
146 | 146 | * @param string selection control type, either 'check' or 'select' |
147 | 147 | */ |
148 | - public function select($control, $method='Value', $value=null, $type=null) |
|
148 | + public function select($control, $method = 'Value', $value = null, $type = null) |
|
149 | 149 | { |
150 | 150 | $method = TPropertyValue::ensureEnum($method, |
151 | 151 | 'Value', 'Index', 'Clear', 'Indices', 'Values', 'All', 'Invert'); |
152 | - $type = ($type===null) ? $this->getSelectionControlType($control) : $type; |
|
152 | + $type = ($type === null) ? $this->getSelectionControlType($control) : $type; |
|
153 | 153 | $total = $this->getSelectionControlIsListType($control) ? $control->getItemCount() : 1; |
154 | 154 | |
155 | 155 | // pass the ID to avoid getting the surrounding elements (ISurroundable) |
156 | - if($control instanceof TControl) |
|
156 | + if ($control instanceof TControl) |
|
157 | 157 | $control = $control->getClientID(); |
158 | 158 | |
159 | 159 | $this->callClientFunction('Prado.Element.select', |
160 | - array($control, $type.$method, $value, $total)); |
|
160 | + array($control, $type . $method, $value, $total)); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | private function getSelectionControlType($control) |
164 | 164 | { |
165 | - if(is_string($control)) return 'check'; |
|
166 | - if($control instanceof TCheckBoxList) |
|
165 | + if (is_string($control)) return 'check'; |
|
166 | + if ($control instanceof TCheckBoxList) |
|
167 | 167 | return 'check'; |
168 | - if($control instanceof TCheckBox) |
|
168 | + if ($control instanceof TCheckBox) |
|
169 | 169 | return 'check'; |
170 | 170 | return 'select'; |
171 | 171 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * @param TControl control element or element id |
191 | 191 | * @param boolean check or uncheck the checkbox or radio button. |
192 | 192 | */ |
193 | - public function check($checkbox, $checked=true) |
|
193 | + public function check($checkbox, $checked = true) |
|
194 | 194 | { |
195 | 195 | $this->select($checkbox, "Value", $checked); |
196 | 196 | } |
@@ -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') |
|
218 | - $control=$control->getSurroundingTagID(); |
|
219 | - $this->callClientFunction('Prado.Element.setAttribute',array($control, $name, $value)); |
|
217 | + if ($control instanceof ISurroundable && strtolower($name) !== 'disabled') |
|
218 | + $control = $control->getSurroundingTagID(); |
|
219 | + $this->callClientFunction('Prado.Element.setAttribute', array($control, $name, $value)); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | /** |
@@ -227,24 +227,24 @@ discard block |
||
227 | 227 | public function setListItems($control, $items) |
228 | 228 | { |
229 | 229 | $options = array(); |
230 | - if($control instanceof TListControl) |
|
230 | + if ($control instanceof TListControl) |
|
231 | 231 | { |
232 | 232 | $promptText = $control->getPromptText(); |
233 | 233 | $promptValue = $control->getPromptValue(); |
234 | 234 | |
235 | - if($promptValue==='') |
|
235 | + if ($promptValue === '') |
|
236 | 236 | $promptValue = $promptText; |
237 | 237 | |
238 | - if($promptValue!=='') |
|
238 | + if ($promptValue !== '') |
|
239 | 239 | $options[] = array($promptText, $promptValue); |
240 | 240 | } |
241 | 241 | |
242 | - foreach($items as $item) |
|
242 | + foreach ($items as $item) |
|
243 | 243 | { |
244 | - if($item->getHasAttributes()) |
|
245 | - $options[] = array($item->getText(),$item->getValue(), $item->getAttributes()->itemAt('Group')); |
|
244 | + if ($item->getHasAttributes()) |
|
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 | } |
@@ -273,21 +273,21 @@ discard block |
||
273 | 273 | * @param string visual effect, such as, 'fade' or 'slide'. |
274 | 274 | * @param array additional options. |
275 | 275 | */ |
276 | - public function toggle($element, $effect=null, $options=array()) |
|
276 | + public function toggle($element, $effect = null, $options = array()) |
|
277 | 277 | { |
278 | - switch(strtolower($effect)) |
|
278 | + switch (strtolower($effect)) |
|
279 | 279 | { |
280 | 280 | case 'fade': |
281 | - $method='fadeToggle'; |
|
281 | + $method = 'fadeToggle'; |
|
282 | 282 | break; |
283 | 283 | case 'slide': |
284 | - $method='slideToggle'; |
|
284 | + $method = 'slideToggle'; |
|
285 | 285 | break; |
286 | 286 | default: |
287 | - $method='toggle'; |
|
287 | + $method = 'toggle'; |
|
288 | 288 | // avoid fancy effect by default |
289 | - if(!array_key_exists('duration', $options)) |
|
290 | - $options['duration']=0; |
|
289 | + if (!array_key_exists('duration', $options)) |
|
290 | + $options['duration'] = 0; |
|
291 | 291 | break; |
292 | 292 | } |
293 | 293 | $this->jQuery($element, $method, $options); |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | * @param TControl control element or element id |
341 | 341 | * @param array additional options: 'duration' in ms, 'offset' from the top in pixels |
342 | 342 | */ |
343 | - public function scrollTo($element, $options=array()) |
|
343 | + public function scrollTo($element, $options = array()) |
|
344 | 344 | { |
345 | 345 | $this->callClientFunction('Prado.Element.scrollTo', array($element, $options)); |
346 | 346 | } |
@@ -420,12 +420,12 @@ discard block |
||
420 | 420 | */ |
421 | 421 | protected function replace($element, $content, $self) |
422 | 422 | { |
423 | - if($content instanceof TControl) |
|
423 | + if ($content instanceof TControl) |
|
424 | 424 | { |
425 | 425 | $boundary = $this->getRenderedContentBoundary($content); |
426 | 426 | $content = null; |
427 | 427 | } |
428 | - else if($content instanceof THtmlWriter) |
|
428 | + else if ($content instanceof THtmlWriter) |
|
429 | 429 | { |
430 | 430 | $boundary = $this->getResponseContentBoundary($content); |
431 | 431 | $content = null; |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | * @param string HTML fragement or the control to be rendered. |
443 | 443 | * @param boolean whether to fully replace the element or just its inner content, defaults to true. |
444 | 444 | */ |
445 | - public function replaceContent($element, $content, $self=true) |
|
445 | + public function replaceContent($element, $content, $self = true) |
|
446 | 446 | { |
447 | 447 | $this->replace($element, $content, $self); |
448 | 448 | } |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | */ |
455 | 455 | public function evaluateScript($writer) |
456 | 456 | { |
457 | - if($writer instanceof THtmlWriter) |
|
457 | + if ($writer instanceof THtmlWriter) |
|
458 | 458 | { |
459 | 459 | $boundary = $this->getResponseContentBoundary($writer); |
460 | 460 | $content = null; |
@@ -474,11 +474,11 @@ discard block |
||
474 | 474 | */ |
475 | 475 | public function appendScriptBlock($content) |
476 | 476 | { |
477 | - if($content instanceof TControl) |
|
477 | + if ($content instanceof TControl) |
|
478 | 478 | { |
479 | 479 | $boundary = $this->getRenderedContentBoundary($content); |
480 | 480 | } |
481 | - elseif($content instanceof THtmlWriter) |
|
481 | + elseif ($content instanceof THtmlWriter) |
|
482 | 482 | { |
483 | 483 | $boundary = $this->getResponseContentBoundary($content); |
484 | 484 | } |
@@ -508,9 +508,9 @@ discard block |
||
508 | 508 | */ |
509 | 509 | private function getResponseContentBoundary($html) |
510 | 510 | { |
511 | - if($html instanceof THtmlWriter) |
|
511 | + if ($html instanceof THtmlWriter) |
|
512 | 512 | { |
513 | - if($html->getWriter() instanceof TCallbackResponseWriter) |
|
513 | + if ($html->getWriter() instanceof TCallbackResponseWriter) |
|
514 | 514 | return $html->getWriter()->getBoundary(); |
515 | 515 | } |
516 | 516 | return null; |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | * @param TControl control element or element id |
525 | 525 | * @param array visual effect key-value pair options. |
526 | 526 | */ |
527 | - public function visualEffect($type, $element, $options=array()) |
|
527 | + public function visualEffect($type, $element, $options = array()) |
|
528 | 528 | { |
529 | 529 | $this->jQuery($element, $type, $options); |
530 | 530 | } |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | * @param TControl control element or element id |
538 | 538 | * @param array visual effect key-value pair options. |
539 | 539 | */ |
540 | - public function fadeIn($element, $options=array()) |
|
540 | + public function fadeIn($element, $options = array()) |
|
541 | 541 | { |
542 | 542 | $this->visualEffect('fadeIn', $element, $options); |
543 | 543 | } |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | * @param TControl control element or element id |
549 | 549 | * @param array visual effect key-value pair options. |
550 | 550 | */ |
551 | - public function fadeOut($element, $options=array()) |
|
551 | + public function fadeOut($element, $options = array()) |
|
552 | 552 | { |
553 | 553 | $this->visualEffect('fadeOut', $element, $options); |
554 | 554 | } |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | * @param TControl control element or element id |
560 | 560 | * @param float opacity value between 1 and 0 |
561 | 561 | */ |
562 | - public function fadeTo($element, $value, $duration=500) |
|
562 | + public function fadeTo($element, $value, $duration = 500) |
|
563 | 563 | { |
564 | 564 | $value = TPropertyValue::ensureFloat($value); |
565 | 565 | $this->visualEffect('fadeTo', $element, array($duration, $value)); |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | * @param TControl control element or element id |
572 | 572 | * @param array visual effect key-value pair options. |
573 | 573 | */ |
574 | - public function slideDown($element, $options=array()) |
|
574 | + public function slideDown($element, $options = array()) |
|
575 | 575 | { |
576 | 576 | $this->visualEffect('slideDown', $element, $options); |
577 | 577 | } |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | * @param TControl control element or element id |
583 | 583 | * @param array visual effect key-value pair options. |
584 | 584 | */ |
585 | - public function slideUp($element, $options=array()) |
|
585 | + public function slideUp($element, $options = array()) |
|
586 | 586 | { |
587 | 587 | $this->visualEffect('slideUp', $element, $options); |
588 | 588 | } |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | * @param TControl control element or element id |
596 | 596 | * @param array visual effect key-value pair options. |
597 | 597 | */ |
598 | - public function appear($element, $options=array()) |
|
598 | + public function appear($element, $options = array()) |
|
599 | 599 | { |
600 | 600 | $this->fadeIn($element, $options); |
601 | 601 | } |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | * @param TControl control element or element id |
607 | 607 | * @param array visual effect key-value pair options. |
608 | 608 | */ |
609 | - public function fade($element, $options=array()) |
|
609 | + public function fade($element, $options = array()) |
|
610 | 610 | { |
611 | 611 | $this->fadeOut($element, $options); |
612 | 612 | } |
@@ -631,9 +631,9 @@ discard block |
||
631 | 631 | * @param TControl control element or element id |
632 | 632 | * @param array effect options. |
633 | 633 | */ |
634 | - public function juiEffect($element, $effect, $options=array()) |
|
634 | + public function juiEffect($element, $effect, $options = array()) |
|
635 | 635 | { |
636 | - $options['effect']=$effect; |
|
636 | + $options['effect'] = $effect; |
|
637 | 637 | $this->jQuery($element, 'effect', array($options)); |
638 | 638 | } |
639 | 639 | |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | * @param TControl control element or element id |
644 | 644 | * @param array visual effect key-value pair options. |
645 | 645 | */ |
646 | - public function blind($element, $options=array()) |
|
646 | + public function blind($element, $options = array()) |
|
647 | 647 | { |
648 | 648 | $this->juiEffect($element, 'blind', $options); |
649 | 649 | } |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | * @param TControl control element or element id |
655 | 655 | * @param array visual effect key-value pair options. |
656 | 656 | */ |
657 | - public function drop($element, $options=array()) |
|
657 | + public function drop($element, $options = array()) |
|
658 | 658 | { |
659 | 659 | $this->juiEffect($element, 'drop', $options); |
660 | 660 | } |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | * @param TControl control element or element id |
666 | 666 | * @param array visual effect key-value pair options. |
667 | 667 | */ |
668 | - public function fold($element, $options=array()) |
|
668 | + public function fold($element, $options = array()) |
|
669 | 669 | { |
670 | 670 | $this->juiEffect($element, 'fold', $options); |
671 | 671 | } |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | * @param TControl control element or element id |
677 | 677 | * @param array visual effect key-value pair options. |
678 | 678 | */ |
679 | - public function size($element, $options=array()) |
|
679 | + public function size($element, $options = array()) |
|
680 | 680 | { |
681 | 681 | $this->juiEffect($element, 'size', $options); |
682 | 682 | } |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | * @param TControl control element or element id |
688 | 688 | * @param array visual effect key-value pair options. |
689 | 689 | */ |
690 | - public function puff($element, $options=array()) |
|
690 | + public function puff($element, $options = array()) |
|
691 | 691 | { |
692 | 692 | $this->juiEffect($element, 'puff', $options); |
693 | 693 | } |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | * @param TControl control element or element id |
699 | 699 | * @param array visual effect key-value pair options. |
700 | 700 | */ |
701 | - public function pulsate($element, $options=array()) |
|
701 | + public function pulsate($element, $options = array()) |
|
702 | 702 | { |
703 | 703 | $this->juiEffect($element, 'pulsate', $options); |
704 | 704 | } |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | * @param TControl control element or element id |
710 | 710 | * @param array visual effect key-value pair options. |
711 | 711 | */ |
712 | - public function shake($element, $options=array()) |
|
712 | + public function shake($element, $options = array()) |
|
713 | 713 | { |
714 | 714 | $this->juiEffect($element, 'shake', $options); |
715 | 715 | } |
@@ -720,7 +720,7 @@ discard block |
||
720 | 720 | * @param TControl control element or element id |
721 | 721 | * @param array visual effect key-value pair options. |
722 | 722 | */ |
723 | - public function scale($element, $options=array()) |
|
723 | + public function scale($element, $options = array()) |
|
724 | 724 | { |
725 | 725 | $this->juiEffect($element, 'scale', $options); |
726 | 726 | } |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | * @param TControl control element or element id |
732 | 732 | * @param array visual effect key-value pair options. |
733 | 733 | */ |
734 | - public function highlight($element, $options=array()) |
|
734 | + public function highlight($element, $options = array()) |
|
735 | 735 | { |
736 | 736 | $this->juiEffect($element, 'highlight', $options); |
737 | 737 | } |
@@ -744,9 +744,9 @@ discard block |
||
744 | 744 | * @param TControl control element or element id |
745 | 745 | * @param array visual effect key-value pair options. |
746 | 746 | */ |
747 | - public function blindDown($element, $options=array()) |
|
747 | + public function blindDown($element, $options = array()) |
|
748 | 748 | { |
749 | - $options['direction']='down'; |
|
749 | + $options['direction'] = 'down'; |
|
750 | 750 | $this->blind($element, $options); |
751 | 751 | } |
752 | 752 | |
@@ -756,9 +756,9 @@ discard block |
||
756 | 756 | * @param TControl control element or element id |
757 | 757 | * @param array visual effect key-value pair options. |
758 | 758 | */ |
759 | - public function blindUp($element, $options=array()) |
|
759 | + public function blindUp($element, $options = array()) |
|
760 | 760 | { |
761 | - $options['direction']='up'; |
|
761 | + $options['direction'] = 'up'; |
|
762 | 762 | $this->blind($element, $options); |
763 | 763 | } |
764 | 764 | |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | * @param TControl control element or element id |
769 | 769 | * @param array visual effect key-value pair options. |
770 | 770 | */ |
771 | - public function dropOut($element, $options=array()) |
|
771 | + public function dropOut($element, $options = array()) |
|
772 | 772 | { |
773 | 773 | $this->drop($element, $options); |
774 | 774 | } |
@@ -779,7 +779,7 @@ discard block |
||
779 | 779 | * @param TControl control element or element id |
780 | 780 | * @param array visual effect key-value pair options. |
781 | 781 | */ |
782 | - public function grow($element, $options=array()) |
|
782 | + public function grow($element, $options = array()) |
|
783 | 783 | { |
784 | 784 | $this->size($element, $options); |
785 | 785 | } |
@@ -790,9 +790,9 @@ discard block |
||
790 | 790 | * @param TControl control element or element id |
791 | 791 | * @param array visual effect key-value pair options. |
792 | 792 | */ |
793 | - public function shrink($element, $options=array()) |
|
793 | + public function shrink($element, $options = array()) |
|
794 | 794 | { |
795 | - $options['percent']=0; |
|
795 | + $options['percent'] = 0; |
|
796 | 796 | $this->scale($element, $options); |
797 | 797 | } |
798 | 798 | |
@@ -802,10 +802,10 @@ discard block |
||
802 | 802 | * @param TControl control element or element id |
803 | 803 | * @param array visual effect key-value pair options. |
804 | 804 | */ |
805 | - public function squish($element, $options=array()) |
|
805 | + public function squish($element, $options = array()) |
|
806 | 806 | { |
807 | - $options['origin']=array('top', 'left'); |
|
808 | - $options['percent']=0; |
|
807 | + $options['origin'] = array('top', 'left'); |
|
808 | + $options['percent'] = 0; |
|
809 | 809 | $this->scale($element, $options); |
810 | 810 | } |
811 | 811 | |
@@ -815,10 +815,10 @@ discard block |
||
815 | 815 | * @param TControl control element or element id |
816 | 816 | * @param array visual effect key-value pair options. |
817 | 817 | */ |
818 | - public function switchOff($element, $options=array()) |
|
818 | + public function switchOff($element, $options = array()) |
|
819 | 819 | { |
820 | - $options['direction']='vertical'; |
|
821 | - $options['percent']=0; |
|
820 | + $options['direction'] = 'vertical'; |
|
821 | + $options['percent'] = 0; |
|
822 | 822 | $this->scale($element, $options); |
823 | 823 | } |
824 | 824 |
@@ -87,15 +87,17 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function callClientFunction($function, $params=array()) |
89 | 89 | { |
90 | - if(!is_array($params)) |
|
91 | - $params = array($params); |
|
90 | + if(!is_array($params)) { |
|
91 | + $params = array($params); |
|
92 | + } |
|
92 | 93 | |
93 | 94 | if(count($params) > 0) |
94 | 95 | { |
95 | - if ($params[0] instanceof ISurroundable) |
|
96 | - $params[0] = $params[0]->getSurroundingTagID(); |
|
97 | - elseif($params[0] instanceof TControl) |
|
98 | - $params[0] = $params[0]->getClientID(); |
|
96 | + if ($params[0] instanceof ISurroundable) { |
|
97 | + $params[0] = $params[0]->getSurroundingTagID(); |
|
98 | + } elseif($params[0] instanceof TControl) { |
|
99 | + $params[0] = $params[0]->getClientID(); |
|
100 | + } |
|
99 | 101 | } |
100 | 102 | $this->_actions->add(array($function => $params)); |
101 | 103 | } |
@@ -108,13 +110,15 @@ discard block |
||
108 | 110 | */ |
109 | 111 | public function jQuery($element, $method, $params=array()) |
110 | 112 | { |
111 | - if ($element instanceof ISurroundable) |
|
112 | - $element = $element->getSurroundingTagID(); |
|
113 | - elseif($element instanceof TControl) |
|
114 | - $element = $element->getClientID(); |
|
113 | + if ($element instanceof ISurroundable) { |
|
114 | + $element = $element->getSurroundingTagID(); |
|
115 | + } elseif($element instanceof TControl) { |
|
116 | + $element = $element->getClientID(); |
|
117 | + } |
|
115 | 118 | |
116 | - if(!is_array($params)) |
|
117 | - $params = array($params); |
|
119 | + if(!is_array($params)) { |
|
120 | + $params = array($params); |
|
121 | + } |
|
118 | 122 | |
119 | 123 | $this->_actions->add(array('Prado.Element.j' => array($element, $method, $params))); |
120 | 124 | } |
@@ -153,8 +157,9 @@ discard block |
||
153 | 157 | $total = $this->getSelectionControlIsListType($control) ? $control->getItemCount() : 1; |
154 | 158 | |
155 | 159 | // pass the ID to avoid getting the surrounding elements (ISurroundable) |
156 | - if($control instanceof TControl) |
|
157 | - $control = $control->getClientID(); |
|
160 | + if($control instanceof TControl) { |
|
161 | + $control = $control->getClientID(); |
|
162 | + } |
|
158 | 163 | |
159 | 164 | $this->callClientFunction('Prado.Element.select', |
160 | 165 | array($control, $type.$method, $value, $total)); |
@@ -162,11 +167,15 @@ discard block |
||
162 | 167 | |
163 | 168 | private function getSelectionControlType($control) |
164 | 169 | { |
165 | - if(is_string($control)) return 'check'; |
|
166 | - if($control instanceof TCheckBoxList) |
|
167 | - return 'check'; |
|
168 | - if($control instanceof TCheckBox) |
|
170 | + if(is_string($control)) { |
|
169 | 171 | return 'check'; |
172 | + } |
|
173 | + if($control instanceof TCheckBoxList) { |
|
174 | + return 'check'; |
|
175 | + } |
|
176 | + if($control instanceof TCheckBox) { |
|
177 | + return 'check'; |
|
178 | + } |
|
170 | 179 | return 'select'; |
171 | 180 | } |
172 | 181 | |
@@ -214,8 +223,9 @@ discard block |
||
214 | 223 | public function setAttribute($control, $name, $value) |
215 | 224 | { |
216 | 225 | // Attributes should be applied on Surrounding tag, except for 'disabled' attribute |
217 | - if ($control instanceof ISurroundable && strtolower($name)!=='disabled') |
|
218 | - $control=$control->getSurroundingTagID(); |
|
226 | + if ($control instanceof ISurroundable && strtolower($name)!=='disabled') { |
|
227 | + $control=$control->getSurroundingTagID(); |
|
228 | + } |
|
219 | 229 | $this->callClientFunction('Prado.Element.setAttribute',array($control, $name, $value)); |
220 | 230 | } |
221 | 231 | |
@@ -232,19 +242,22 @@ discard block |
||
232 | 242 | $promptText = $control->getPromptText(); |
233 | 243 | $promptValue = $control->getPromptValue(); |
234 | 244 | |
235 | - if($promptValue==='') |
|
236 | - $promptValue = $promptText; |
|
245 | + if($promptValue==='') { |
|
246 | + $promptValue = $promptText; |
|
247 | + } |
|
237 | 248 | |
238 | - if($promptValue!=='') |
|
239 | - $options[] = array($promptText, $promptValue); |
|
249 | + if($promptValue!=='') { |
|
250 | + $options[] = array($promptText, $promptValue); |
|
251 | + } |
|
240 | 252 | } |
241 | 253 | |
242 | 254 | foreach($items as $item) |
243 | 255 | { |
244 | - if($item->getHasAttributes()) |
|
245 | - $options[] = array($item->getText(),$item->getValue(), $item->getAttributes()->itemAt('Group')); |
|
246 | - else |
|
247 | - $options[] = array($item->getText(),$item->getValue()); |
|
256 | + if($item->getHasAttributes()) { |
|
257 | + $options[] = array($item->getText(),$item->getValue(), $item->getAttributes()->itemAt('Group')); |
|
258 | + } else { |
|
259 | + $options[] = array($item->getText(),$item->getValue()); |
|
260 | + } |
|
248 | 261 | } |
249 | 262 | $this->callClientFunction('Prado.Element.setOptions', array($control, $options)); |
250 | 263 | } |
@@ -286,8 +299,9 @@ discard block |
||
286 | 299 | default: |
287 | 300 | $method='toggle'; |
288 | 301 | // avoid fancy effect by default |
289 | - if(!array_key_exists('duration', $options)) |
|
290 | - $options['duration']=0; |
|
302 | + if(!array_key_exists('duration', $options)) { |
|
303 | + $options['duration']=0; |
|
304 | + } |
|
291 | 305 | break; |
292 | 306 | } |
293 | 307 | $this->jQuery($element, $method, $options); |
@@ -424,14 +438,13 @@ discard block |
||
424 | 438 | { |
425 | 439 | $boundary = $this->getRenderedContentBoundary($content); |
426 | 440 | $content = null; |
427 | - } |
|
428 | - else if($content instanceof THtmlWriter) |
|
441 | + } else if($content instanceof THtmlWriter) |
|
429 | 442 | { |
430 | 443 | $boundary = $this->getResponseContentBoundary($content); |
431 | 444 | $content = null; |
445 | + } else { |
|
446 | + $boundary = null; |
|
432 | 447 | } |
433 | - else |
|
434 | - $boundary = null; |
|
435 | 448 | |
436 | 449 | $this->callClientFunction('Prado.Element.replace', array($element, $content, $boundary, $self)); |
437 | 450 | } |
@@ -477,8 +490,7 @@ discard block |
||
477 | 490 | if($content instanceof TControl) |
478 | 491 | { |
479 | 492 | $boundary = $this->getRenderedContentBoundary($content); |
480 | - } |
|
481 | - elseif($content instanceof THtmlWriter) |
|
493 | + } elseif($content instanceof THtmlWriter) |
|
482 | 494 | { |
483 | 495 | $boundary = $this->getResponseContentBoundary($content); |
484 | 496 | } |
@@ -510,8 +522,9 @@ discard block |
||
510 | 522 | { |
511 | 523 | if($html instanceof THtmlWriter) |
512 | 524 | { |
513 | - if($html->getWriter() instanceof TCallbackResponseWriter) |
|
514 | - return $html->getWriter()->getBoundary(); |
|
525 | + if($html->getWriter() instanceof TCallbackResponseWriter) { |
|
526 | + return $html->getWriter()->getBoundary(); |
|
527 | + } |
|
515 | 528 | } |
516 | 529 | return null; |
517 | 530 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | } |
200 | 200 | |
201 | 201 | /** |
202 | - * @return boolean true to post the inputs of the form on callback, default |
|
202 | + * @return string true to post the inputs of the form on callback, default |
|
203 | 203 | * is post the inputs on callback. |
204 | 204 | */ |
205 | 205 | public function getPostState() |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | } |
218 | 218 | |
219 | 219 | /** |
220 | - * @return integer callback request timeout. |
|
220 | + * @return string callback request timeout. |
|
221 | 221 | */ |
222 | 222 | public function getRequestTimeOut() |
223 | 223 | { |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | } |
234 | 234 | |
235 | 235 | /** |
236 | - * @return boolean true if the callback request has priority and will abort |
|
236 | + * @return boolean|string true if the callback request has priority and will abort |
|
237 | 237 | * existing prioritized request in order to send immediately. It does not |
238 | 238 | * affect callbacks that are not prioritized. Default is true. |
239 | 239 | * @deprecated since 3.3.0 |
@@ -248,6 +248,7 @@ discard block |
||
248 | 248 | * @param boolean true to ensure that the callback request will be sent |
249 | 249 | * immediately and will abort existing prioritized requests. It does not |
250 | 250 | * affect callbacks that are not prioritized. |
251 | + * @param boolean $value |
|
251 | 252 | * @deprecated since 3.3.0 |
252 | 253 | */ |
253 | 254 | public function setHasPriority($value) |
@@ -263,6 +264,7 @@ discard block |
||
263 | 264 | * update. This will automatically set HasPrority to true. |
264 | 265 | * @param boolean true enables the callback response to update the |
265 | 266 | * viewstate. |
267 | + * @param boolean $value |
|
266 | 268 | */ |
267 | 269 | public function setEnablePageStateUpdate($value) |
268 | 270 | { |
@@ -273,7 +275,7 @@ discard block |
||
273 | 275 | } |
274 | 276 | |
275 | 277 | /** |
276 | - * @return boolean client-side viewstate will be updated on callback |
|
278 | + * @return boolean|string client-side viewstate will be updated on callback |
|
277 | 279 | * response if true. Default is true. |
278 | 280 | */ |
279 | 281 | public function getEnablePageStateUpdate() |
@@ -240,8 +240,8 @@ discard block |
||
240 | 240 | */ |
241 | 241 | public function getHasPriority() |
242 | 242 | { |
243 | - $option = $this->getOption('HasPriority'); |
|
244 | - return ($option===null) ? true : $option; |
|
243 | + $option = $this->getOption('HasPriority'); |
|
244 | + return ($option === null) ? true : $option; |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | /** |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | { |
255 | 255 | $hasPriority = TPropertyValue::ensureBoolean($value); |
256 | 256 | $this->setOption('HasPriority', $hasPriority); |
257 | - if(!$hasPriority) |
|
257 | + if (!$hasPriority) |
|
258 | 258 | $this->setEnablePageStateUpdate(false); |
259 | 259 | } |
260 | 260 | |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | { |
269 | 269 | $enabled = TPropertyValue::ensureBoolean($value); |
270 | 270 | $this->setOption('EnablePageStateUpdate', $enabled); |
271 | - if($enabled) |
|
271 | + if ($enabled) |
|
272 | 272 | $this->setHasPriority(true); |
273 | 273 | } |
274 | 274 | |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | public function getEnablePageStateUpdate() |
280 | 280 | { |
281 | 281 | $option = $this->getOption('EnablePageStateUpdate'); |
282 | - return ($option===null) ? true : $option; |
|
282 | + return ($option === null) ? true : $option; |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | /** |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | */ |
296 | 296 | public function setPostBackTarget($value) |
297 | 297 | { |
298 | - if($value instanceof TControl) |
|
298 | + if ($value instanceof TControl) |
|
299 | 299 | $value = $value->getUniqueID(); |
300 | 300 | $this->setOption('EventTarget', $value); |
301 | 301 | } |
@@ -254,8 +254,9 @@ discard block |
||
254 | 254 | { |
255 | 255 | $hasPriority = TPropertyValue::ensureBoolean($value); |
256 | 256 | $this->setOption('HasPriority', $hasPriority); |
257 | - if(!$hasPriority) |
|
258 | - $this->setEnablePageStateUpdate(false); |
|
257 | + if(!$hasPriority) { |
|
258 | + $this->setEnablePageStateUpdate(false); |
|
259 | + } |
|
259 | 260 | } |
260 | 261 | |
261 | 262 | /** |
@@ -268,8 +269,9 @@ discard block |
||
268 | 269 | { |
269 | 270 | $enabled = TPropertyValue::ensureBoolean($value); |
270 | 271 | $this->setOption('EnablePageStateUpdate', $enabled); |
271 | - if($enabled) |
|
272 | - $this->setHasPriority(true); |
|
272 | + if($enabled) { |
|
273 | + $this->setHasPriority(true); |
|
274 | + } |
|
273 | 275 | } |
274 | 276 | |
275 | 277 | /** |
@@ -295,8 +297,9 @@ discard block |
||
295 | 297 | */ |
296 | 298 | public function setPostBackTarget($value) |
297 | 299 | { |
298 | - if($value instanceof TControl) |
|
299 | - $value = $value->getUniqueID(); |
|
300 | + if($value instanceof TControl) { |
|
301 | + $value = $value->getUniqueID(); |
|
302 | + } |
|
300 | 303 | $this->setOption('EventTarget', $value); |
301 | 304 | } |
302 | 305 |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * o 'True' or 'Revert' : The draggable will revert to it's original position |
54 | 54 | * o 'False' or 'None' : The draggable won't revert to it's original position |
55 | 55 | * o 'Failure' : The draggable will only revert if it's dropped on a non droppable area |
56 | - * @return TDraggableRevertOption true to revert |
|
56 | + * @return string true to revert |
|
57 | 57 | */ |
58 | 58 | public function getRevert() |
59 | 59 | { |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | /** |
120 | 120 | * Determine if the element should be constrainted in one direction or not |
121 | - * @return CDraggableConstraint |
|
121 | + * @return string |
|
122 | 122 | */ |
123 | 123 | public function getConstraint() |
124 | 124 | { |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * Set the handle id or css class |
33 | 33 | * @param string |
34 | 34 | */ |
35 | - public function setHandle ($value) |
|
35 | + public function setHandle($value) |
|
36 | 36 | { |
37 | 37 | $this->setViewState('DragHandle', TPropertyValue::ensureString($value), null); |
38 | 38 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * Get the handle id or css class |
42 | 42 | * @return string |
43 | 43 | */ |
44 | - public function getHandle () |
|
44 | + public function getHandle() |
|
45 | 45 | { |
46 | 46 | return $this->getViewState('DragHandle', null); |
47 | 47 | } |
@@ -71,10 +71,10 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function setRevert($value) |
73 | 73 | { |
74 | - if (strcasecmp($value,'true')==0 || $value===true) |
|
75 | - $value=TDraggableRevertOptions::Revert; |
|
76 | - elseif (strcasecmp($value,'false')==0 || $value===false) |
|
77 | - $value=TDraggableRevertOptions::None; |
|
74 | + if (strcasecmp($value, 'true') == 0 || $value === true) |
|
75 | + $value = TDraggableRevertOptions::Revert; |
|
76 | + elseif (strcasecmp($value, 'false') == 0 || $value === false) |
|
77 | + $value = TDraggableRevertOptions::None; |
|
78 | 78 | $this->setViewState('Revert', TPropertyValue::ensureEnum($value, 'TDraggableRevertOptions'), true); |
79 | 79 | } |
80 | 80 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @return TDraggableGhostingOption to clone the element |
92 | 92 | */ |
93 | - public function getGhosting () |
|
93 | + public function getGhosting() |
|
94 | 94 | { |
95 | 95 | return $this->getViewState('Ghosting', TDraggableGhostingOptions::None); |
96 | 96 | } |
@@ -107,12 +107,12 @@ discard block |
||
107 | 107 | * o "False" or "None" means no Ghosting options |
108 | 108 | * |
109 | 109 | */ |
110 | - public function setGhosting ($value) |
|
110 | + public function setGhosting($value) |
|
111 | 111 | { |
112 | - if (strcasecmp($value,'true')==0 || $value===true) |
|
113 | - $value=TDraggableGhostingOptions::Ghosting; |
|
114 | - elseif (strcasecmp($value,'false')==0 || $value===false) |
|
115 | - $value=TDraggableGhostingOptions::None; |
|
112 | + if (strcasecmp($value, 'true') == 0 || $value === true) |
|
113 | + $value = TDraggableGhostingOptions::Ghosting; |
|
114 | + elseif (strcasecmp($value, 'false') == 0 || $value === false) |
|
115 | + $value = TDraggableGhostingOptions::None; |
|
116 | 116 | $this->setViewState('Ghosting', TPropertyValue::ensureEnum($value, 'TDraggableGhostingOptions'), TDraggableGhostingOptions::None); |
117 | 117 | } |
118 | 118 | |
@@ -153,15 +153,15 @@ discard block |
||
153 | 153 | { |
154 | 154 | parent::addAttributesToRender($writer); |
155 | 155 | |
156 | - $cs=$this->getPage()->getClientScript(); |
|
157 | - if ($this->getGhosting()==TDraggableGhostingOptions::SuperGhosting) |
|
156 | + $cs = $this->getPage()->getClientScript(); |
|
157 | + if ($this->getGhosting() == TDraggableGhostingOptions::SuperGhosting) |
|
158 | 158 | $cs->registerPradoScript('dragdropextra'); |
159 | 159 | else |
160 | 160 | $cs->registerPradoScript('dragdrop'); |
161 | - $writer->addAttribute('id',$this->getClientID()); |
|
162 | - $options=TJavascript::encode($this->getPostBackOptions()); |
|
163 | - $class=$this->getClientClassName(); |
|
164 | - $code="new {$class}('{$this->getClientId()}', {$options}) "; |
|
161 | + $writer->addAttribute('id', $this->getClientID()); |
|
162 | + $options = TJavascript::encode($this->getPostBackOptions()); |
|
163 | + $class = $this->getClientClassName(); |
|
164 | + $code = "new {$class}('{$this->getClientId()}', {$options}) "; |
|
165 | 165 | $cs->registerEndScript(sprintf('%08X', crc32($code)), $code); |
166 | 166 | } |
167 | 167 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * This method overrides the parent implementation. |
171 | 171 | * @return string the javascript class name |
172 | 172 | */ |
173 | - protected function getClientClassName () |
|
173 | + protected function getClientClassName() |
|
174 | 174 | { |
175 | 175 | return 'Draggable'; |
176 | 176 | } |
@@ -183,21 +183,21 @@ discard block |
||
183 | 183 | { |
184 | 184 | $options['ID'] = $this->getClientID(); |
185 | 185 | |
186 | - if (($handle=$this->getHandle())!== null) $options['handle']=$handle; |
|
187 | - if (($revert=$this->getRevert())===TDraggableRevertOptions::None) |
|
188 | - $options['revert']=false; |
|
189 | - elseif ($revert==TDraggableRevertOptions::Revert) |
|
190 | - $options['revert']=true; |
|
186 | + if (($handle = $this->getHandle()) !== null) $options['handle'] = $handle; |
|
187 | + if (($revert = $this->getRevert()) === TDraggableRevertOptions::None) |
|
188 | + $options['revert'] = false; |
|
189 | + elseif ($revert == TDraggableRevertOptions::Revert) |
|
190 | + $options['revert'] = true; |
|
191 | 191 | else |
192 | - $options['revert']=strtolower($revert); |
|
193 | - if (($constraint=$this->getConstraint())!==TDraggableConstraint::None) $options['constraint']=strtolower($constraint); |
|
192 | + $options['revert'] = strtolower($revert); |
|
193 | + if (($constraint = $this->getConstraint()) !== TDraggableConstraint::None) $options['constraint'] = strtolower($constraint); |
|
194 | 194 | switch ($this->getGhosting()) |
195 | 195 | { |
196 | 196 | case TDraggableGhostingOptions::SuperGhosting: |
197 | - $options['superghosting']=true; |
|
197 | + $options['superghosting'] = true; |
|
198 | 198 | break; |
199 | 199 | case TDraggableGhostingOptions::Ghosting: |
200 | - $options['ghosting']=true; |
|
200 | + $options['ghosting'] = true; |
|
201 | 201 | break; |
202 | 202 | } |
203 | 203 | |
@@ -214,9 +214,9 @@ discard block |
||
214 | 214 | */ |
215 | 215 | class TDraggableConstraint extends TEnumerable |
216 | 216 | { |
217 | - const None='None'; |
|
218 | - const Horizontal='Horizontal'; |
|
219 | - const Vertical='Vertical'; |
|
217 | + const None = 'None'; |
|
218 | + const Horizontal = 'Horizontal'; |
|
219 | + const Vertical = 'Vertical'; |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | /** |
@@ -227,9 +227,9 @@ discard block |
||
227 | 227 | */ |
228 | 228 | class TDraggableGhostingOptions extends TEnumerable |
229 | 229 | { |
230 | - const None='None'; |
|
231 | - const Ghosting='Ghosting'; |
|
232 | - const SuperGhosting='SuperGhosting'; |
|
230 | + const None = 'None'; |
|
231 | + const Ghosting = 'Ghosting'; |
|
232 | + const SuperGhosting = 'SuperGhosting'; |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | /** |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | */ |
241 | 241 | class TDraggableRevertOptions extends TEnumerable |
242 | 242 | { |
243 | - const None='None'; |
|
244 | - const Revert='Revert'; |
|
245 | - const Failure='Failure'; |
|
243 | + const None = 'None'; |
|
244 | + const Revert = 'Revert'; |
|
245 | + const Failure = 'Failure'; |
|
246 | 246 | } |
@@ -71,10 +71,11 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function setRevert($value) |
73 | 73 | { |
74 | - if (strcasecmp($value,'true')==0 || $value===true) |
|
75 | - $value=TDraggableRevertOptions::Revert; |
|
76 | - elseif (strcasecmp($value,'false')==0 || $value===false) |
|
77 | - $value=TDraggableRevertOptions::None; |
|
74 | + if (strcasecmp($value,'true')==0 || $value===true) { |
|
75 | + $value=TDraggableRevertOptions::Revert; |
|
76 | + } elseif (strcasecmp($value,'false')==0 || $value===false) { |
|
77 | + $value=TDraggableRevertOptions::None; |
|
78 | + } |
|
78 | 79 | $this->setViewState('Revert', TPropertyValue::ensureEnum($value, 'TDraggableRevertOptions'), true); |
79 | 80 | } |
80 | 81 | |
@@ -109,10 +110,11 @@ discard block |
||
109 | 110 | */ |
110 | 111 | public function setGhosting ($value) |
111 | 112 | { |
112 | - if (strcasecmp($value,'true')==0 || $value===true) |
|
113 | - $value=TDraggableGhostingOptions::Ghosting; |
|
114 | - elseif (strcasecmp($value,'false')==0 || $value===false) |
|
115 | - $value=TDraggableGhostingOptions::None; |
|
113 | + if (strcasecmp($value,'true')==0 || $value===true) { |
|
114 | + $value=TDraggableGhostingOptions::Ghosting; |
|
115 | + } elseif (strcasecmp($value,'false')==0 || $value===false) { |
|
116 | + $value=TDraggableGhostingOptions::None; |
|
117 | + } |
|
116 | 118 | $this->setViewState('Ghosting', TPropertyValue::ensureEnum($value, 'TDraggableGhostingOptions'), TDraggableGhostingOptions::None); |
117 | 119 | } |
118 | 120 | |
@@ -154,10 +156,11 @@ discard block |
||
154 | 156 | parent::addAttributesToRender($writer); |
155 | 157 | |
156 | 158 | $cs=$this->getPage()->getClientScript(); |
157 | - if ($this->getGhosting()==TDraggableGhostingOptions::SuperGhosting) |
|
158 | - $cs->registerPradoScript('dragdropextra'); |
|
159 | - else |
|
160 | - $cs->registerPradoScript('dragdrop'); |
|
159 | + if ($this->getGhosting()==TDraggableGhostingOptions::SuperGhosting) { |
|
160 | + $cs->registerPradoScript('dragdropextra'); |
|
161 | + } else { |
|
162 | + $cs->registerPradoScript('dragdrop'); |
|
163 | + } |
|
161 | 164 | $writer->addAttribute('id',$this->getClientID()); |
162 | 165 | $options=TJavascript::encode($this->getPostBackOptions()); |
163 | 166 | $class=$this->getClientClassName(); |
@@ -183,14 +186,19 @@ discard block |
||
183 | 186 | { |
184 | 187 | $options['ID'] = $this->getClientID(); |
185 | 188 | |
186 | - if (($handle=$this->getHandle())!== null) $options['handle']=$handle; |
|
187 | - if (($revert=$this->getRevert())===TDraggableRevertOptions::None) |
|
188 | - $options['revert']=false; |
|
189 | - elseif ($revert==TDraggableRevertOptions::Revert) |
|
190 | - $options['revert']=true; |
|
191 | - else |
|
192 | - $options['revert']=strtolower($revert); |
|
193 | - if (($constraint=$this->getConstraint())!==TDraggableConstraint::None) $options['constraint']=strtolower($constraint); |
|
189 | + if (($handle=$this->getHandle())!== null) { |
|
190 | + $options['handle']=$handle; |
|
191 | + } |
|
192 | + if (($revert=$this->getRevert())===TDraggableRevertOptions::None) { |
|
193 | + $options['revert']=false; |
|
194 | + } elseif ($revert==TDraggableRevertOptions::Revert) { |
|
195 | + $options['revert']=true; |
|
196 | + } else { |
|
197 | + $options['revert']=strtolower($revert); |
|
198 | + } |
|
199 | + if (($constraint=$this->getConstraint())!==TDraggableConstraint::None) { |
|
200 | + $options['constraint']=strtolower($constraint); |
|
201 | + } |
|
194 | 202 | switch ($this->getGhosting()) |
195 | 203 | { |
196 | 204 | case TDraggableGhostingOptions::SuperGhosting: |
@@ -127,7 +127,6 @@ |
||
127 | 127 | * Raises the onDrop event. |
128 | 128 | * The drop parameters are encapsulated into a {@link TDropContainerEventParameter} |
129 | 129 | * |
130 | - * @param object $dropControlId |
|
131 | 130 | */ |
132 | 131 | public function onDrop ($dropParams) |
133 | 132 | { |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * TDropContainer class file |
|
4 | - * |
|
5 | - * @author Christophe BOULAIN ([email protected]) |
|
6 | - * @copyright Copyright © 2008, PradoSoft |
|
7 | - * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
8 | - * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
9 | - * @package System.Web.UI.ActiveControls |
|
10 | - */ |
|
3 | + * TDropContainer class file |
|
4 | + * |
|
5 | + * @author Christophe BOULAIN ([email protected]) |
|
6 | + * @copyright Copyright © 2008, PradoSoft |
|
7 | + * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
8 | + * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
9 | + * @package System.Web.UI.ActiveControls |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * Load active control adapter. |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | class TDropContainer extends TPanel implements IActiveControl, ICallbackEventHandler |
44 | 44 | { |
45 | - private $_container=null; |
|
45 | + private $_container = null; |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Creates a new callback control, sets the adapter to |
@@ -129,9 +129,9 @@ discard block |
||
129 | 129 | * |
130 | 130 | * @param object $dropControlId |
131 | 131 | */ |
132 | - public function onDrop ($dropParams) |
|
132 | + public function onDrop($dropParams) |
|
133 | 133 | { |
134 | - $this->raiseEvent('OnDrop', $this, new TDropContainerEventParameter ($dropParams)); |
|
134 | + $this->raiseEvent('OnDrop', $this, new TDropContainerEventParameter($dropParams)); |
|
135 | 135 | |
136 | 136 | } |
137 | 137 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | protected function addAttributesToRender($writer) |
190 | 190 | { |
191 | 191 | parent::addAttributesToRender($writer); |
192 | - $writer->addAttribute('id',$this->getClientID()); |
|
192 | + $writer->addAttribute('id', $this->getClientID()); |
|
193 | 193 | |
194 | 194 | $this->getPage()->getClientScript()->registerPradoScript('dragdrop'); |
195 | 195 | $this->getActiveControl()->registerCallbackClientScript( |
@@ -202,12 +202,12 @@ discard block |
||
202 | 202 | * child controls. This container will be a TActivePanel, in order to allow user |
203 | 203 | * to update its content on callback. |
204 | 204 | */ |
205 | - public function createChildControls () |
|
205 | + public function createChildControls() |
|
206 | 206 | { |
207 | - if ($this->_container===null) |
|
207 | + if ($this->_container === null) |
|
208 | 208 | { |
209 | - $this->_container=Prado::CreateComponent('System.Web.UI.ActiveControls.TActivePanel'); |
|
210 | - $this->_container->setId($this->getId(false).'_content'); |
|
209 | + $this->_container = Prado::CreateComponent('System.Web.UI.ActiveControls.TActivePanel'); |
|
210 | + $this->_container->setId($this->getId(false) . '_content'); |
|
211 | 211 | parent::getControls()->add($this->_container); |
212 | 212 | } |
213 | 213 | } |
@@ -230,17 +230,17 @@ discard block |
||
230 | 230 | * is defered until OnPreRender event is raised. |
231 | 231 | * @param THtmlWriter html writer |
232 | 232 | */ |
233 | - public function render ($writer) |
|
233 | + public function render($writer) |
|
234 | 234 | { |
235 | - if($this->getHasPreRendered()) |
|
235 | + if ($this->getHasPreRendered()) |
|
236 | 236 | { |
237 | 237 | parent::render($writer); |
238 | - if($this->getActiveControl()->canUpdateClientSide()) |
|
239 | - $this->getPage()->getCallbackClient()->replaceContent($this->_container,$writer); |
|
238 | + if ($this->getActiveControl()->canUpdateClientSide()) |
|
239 | + $this->getPage()->getCallbackClient()->replaceContent($this->_container, $writer); |
|
240 | 240 | } |
241 | 241 | else |
242 | 242 | { |
243 | - $this->getPage()->getAdapter()->registerControlToRender($this->_container,$writer); |
|
243 | + $this->getPage()->getAdapter()->registerControlToRender($this->_container, $writer); |
|
244 | 244 | } |
245 | 245 | } |
246 | 246 | |
@@ -284,16 +284,16 @@ discard block |
||
284 | 284 | $this->_altKey = TPropertyValue::ensureBoolean($dropParams->AltKey); |
285 | 285 | } |
286 | 286 | |
287 | - public function getDragElementId() { return $this->_dragElementId; } |
|
288 | - public function getScreenX() { return $this->_screenX; } |
|
289 | - public function getScreenY() { return $this->_screenY; } |
|
290 | - public function getOffsetX() { return $this->_offsetX; } |
|
291 | - public function geOffsetY() { return $this->_offsetY; } |
|
292 | - public function getClientX() { return $this->_clientX; } |
|
293 | - public function getClientY() { return $this->_clientY; } |
|
294 | - public function getShiftKey() { return $this->_shiftKey; } |
|
295 | - public function getCtrlKey() { return $this->_ctrlKey; } |
|
296 | - public function getAltKey() { return $this->_altKey; } |
|
287 | + public function getDragElementId() { return $this->_dragElementId; } |
|
288 | + public function getScreenX() { return $this->_screenX; } |
|
289 | + public function getScreenY() { return $this->_screenY; } |
|
290 | + public function getOffsetX() { return $this->_offsetX; } |
|
291 | + public function geOffsetY() { return $this->_offsetY; } |
|
292 | + public function getClientX() { return $this->_clientX; } |
|
293 | + public function getClientY() { return $this->_clientY; } |
|
294 | + public function getShiftKey() { return $this->_shiftKey; } |
|
295 | + public function getCtrlKey() { return $this->_ctrlKey; } |
|
296 | + public function getAltKey() { return $this->_altKey; } |
|
297 | 297 | |
298 | 298 | /** |
299 | 299 | * GetDroppedControl |
@@ -301,16 +301,16 @@ discard block |
||
301 | 301 | * Compatibility method to get the dropped control |
302 | 302 | * @return TControl dropped control, or null if not found |
303 | 303 | */ |
304 | - public function getDroppedControl () |
|
304 | + public function getDroppedControl() |
|
305 | 305 | { |
306 | - $control=null; |
|
307 | - $service=prado::getApplication()->getService(); |
|
306 | + $control = null; |
|
307 | + $service = prado::getApplication()->getService(); |
|
308 | 308 | if ($service instanceof TPageService) |
309 | 309 | { |
310 | 310 | // Find the control |
311 | 311 | // Warning, this will not work if you have a '_' in your control Id ! |
312 | - $dropControlId=str_replace(TControl::CLIENT_ID_SEPARATOR,TControl::ID_SEPARATOR,$this->_dragElementId); |
|
313 | - $control=$service->getRequestedPage()->findControl($dropControlId); |
|
312 | + $dropControlId = str_replace(TControl::CLIENT_ID_SEPARATOR, TControl::ID_SEPARATOR, $this->_dragElementId); |
|
313 | + $control = $service->getRequestedPage()->findControl($dropControlId); |
|
314 | 314 | } |
315 | 315 | return $control; |
316 | 316 | } |
@@ -235,10 +235,10 @@ |
||
235 | 235 | if($this->getHasPreRendered()) |
236 | 236 | { |
237 | 237 | parent::render($writer); |
238 | - if($this->getActiveControl()->canUpdateClientSide()) |
|
239 | - $this->getPage()->getCallbackClient()->replaceContent($this->_container,$writer); |
|
240 | - } |
|
241 | - else |
|
238 | + if($this->getActiveControl()->canUpdateClientSide()) { |
|
239 | + $this->getPage()->getCallbackClient()->replaceContent($this->_container,$writer); |
|
240 | + } |
|
241 | + } else |
|
242 | 242 | { |
243 | 243 | $this->getPage()->getAdapter()->registerControlToRender($this->_container,$writer); |
244 | 244 | } |
@@ -92,6 +92,8 @@ discard block |
||
92 | 92 | * Calls the client-side static method for this control class. |
93 | 93 | * @param string static method name |
94 | 94 | * @param mixed method parmaeter |
95 | + * @param string $func |
|
96 | + * @param boolean $value |
|
95 | 97 | */ |
96 | 98 | protected function callClientFunction($func,$value) |
97 | 99 | { |
@@ -239,6 +241,7 @@ discard block |
||
239 | 241 | * Raised when editing the content is requsted to be loaded from the |
240 | 242 | * server side. |
241 | 243 | * @param TCallbackEventParameter event parameter to be passed to the event handlers |
244 | + * @param TCallbackEventParameter $param |
|
242 | 245 | */ |
243 | 246 | public function onLoadingText($param) |
244 | 247 | { |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | public function setDisplayTextBox($value) |
76 | 76 | { |
77 | 77 | $value = TPropertyValue::ensureBoolean($value); |
78 | - $this->setViewState('DisplayTextBox', $value,false); |
|
79 | - if($this->getActiveControl()->canUpdateClientSide()) |
|
80 | - $this->callClientFunction('setDisplayTextBox',$value); |
|
78 | + $this->setViewState('DisplayTextBox', $value, false); |
|
79 | + if ($this->getActiveControl()->canUpdateClientSide()) |
|
80 | + $this->callClientFunction('setDisplayTextBox', $value); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -93,11 +93,11 @@ discard block |
||
93 | 93 | * @param string static method name |
94 | 94 | * @param mixed method parmaeter |
95 | 95 | */ |
96 | - protected function callClientFunction($func,$value) |
|
96 | + protected function callClientFunction($func, $value) |
|
97 | 97 | { |
98 | 98 | $client = $this->getPage()->getCallbackClient(); |
99 | - $code = $this->getClientClassName().'.'.$func; |
|
100 | - $client->callClientFunction($code,array($this,$value)); |
|
99 | + $code = $this->getClientClassName() . '.' . $func; |
|
100 | + $client->callClientFunction($code, array($this, $value)); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | protected function getExternalControlID() |
123 | 123 | { |
124 | 124 | $extID = $this->getEditTriggerControlID(); |
125 | - if($extID===null) return ''; |
|
126 | - if(($control = $this->findControl($extID))!==null) |
|
125 | + if ($extID === null) return ''; |
|
126 | + if (($control = $this->findControl($extID)) !== null) |
|
127 | 127 | return $control->getClientID(); |
128 | 128 | return $extID; |
129 | 129 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | public function setText($value) |
137 | 137 | { |
138 | 138 | TTextBox::setText($value); |
139 | - if($this->getActiveControl()->canUpdateClientSide()) |
|
139 | + if ($this->getActiveControl()->canUpdateClientSide()) |
|
140 | 140 | { |
141 | 141 | $client = $this->getPage()->getCallbackClient(); |
142 | 142 | $client->update($this->getLabelClientID(), $value); |
@@ -149,9 +149,9 @@ discard block |
||
149 | 149 | * @param boolean value |
150 | 150 | * @since 3.1.2 |
151 | 151 | */ |
152 | - public function setReadOnly ($value) |
|
152 | + public function setReadOnly($value) |
|
153 | 153 | { |
154 | - $value=TPropertyValue::ensureBoolean($value); |
|
154 | + $value = TPropertyValue::ensureBoolean($value); |
|
155 | 155 | TTextBox::setReadOnly($value); |
156 | 156 | if ($this->getActiveControl()->canUpdateClientSide()) |
157 | 157 | { |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | */ |
174 | 174 | public function renderContents($writer) |
175 | 175 | { |
176 | - if(($text=$this->getText())==='') |
|
176 | + if (($text = $this->getText()) === '') |
|
177 | 177 | parent::renderContents($writer); |
178 | 178 | else |
179 | 179 | $writer->write($text); |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | */ |
185 | 185 | protected function getLabelClientID() |
186 | 186 | { |
187 | - return $this->getClientID().'__label'; |
|
187 | + return $this->getClientID() . '__label'; |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | public function onCallback($param) |
198 | 198 | { |
199 | 199 | $action = $param->getCallbackParameter(); |
200 | - if(is_array($action) && $action[0] === '__InlineEditor_loadExternalText__') |
|
200 | + if (is_array($action) && $action[0] === '__InlineEditor_loadExternalText__') |
|
201 | 201 | { |
202 | 202 | $parameter = new TCallbackEventParameter($this->getResponse(), $action[1]); |
203 | 203 | $this->onLoadingText($parameter); |
@@ -217,10 +217,10 @@ discard block |
||
217 | 217 | $options['AutoHide'] = $this->getAutoHideTextBox() == false ? '' : true; |
218 | 218 | $options['AutoPostBack'] = $this->getAutoPostBack() == false ? '' : true; |
219 | 219 | $options['Columns'] = $this->getColumns(); |
220 | - if($this->getTextMode()==='MultiLine') |
|
220 | + if ($this->getTextMode() === 'MultiLine') |
|
221 | 221 | { |
222 | 222 | $options['Rows'] = $this->getRows(); |
223 | - $options['Wrap'] = $this->getWrap()== false ? '' : true; |
|
223 | + $options['Wrap'] = $this->getWrap() == false ? '' : true; |
|
224 | 224 | } |
225 | 225 | else |
226 | 226 | { |
@@ -228,10 +228,10 @@ discard block |
||
228 | 228 | $options['MaxLength'] = $length > 0 ? $length : ''; |
229 | 229 | } |
230 | 230 | |
231 | - if($this->hasEventHandler('OnLoadingText')) |
|
231 | + if ($this->hasEventHandler('OnLoadingText')) |
|
232 | 232 | $options['LoadTextOnEdit'] = true; |
233 | 233 | |
234 | - $options['ReadOnly']=$this->getReadOnly(); |
|
234 | + $options['ReadOnly'] = $this->getReadOnly(); |
|
235 | 235 | return $options; |
236 | 236 | } |
237 | 237 | |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | */ |
243 | 243 | public function onLoadingText($param) |
244 | 244 | { |
245 | - $this->raiseEvent('OnLoadingText',$this,$param); |
|
245 | + $this->raiseEvent('OnLoadingText', $this, $param); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | /** |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | { |
262 | 262 | //calls the TWebControl to avoid rendering other attribute normally render for a textbox. |
263 | 263 | TWebControl::addAttributesToRender($writer); |
264 | - $writer->addAttribute('id',$this->getLabelClientID()); |
|
264 | + $writer->addAttribute('id', $this->getLabelClientID()); |
|
265 | 265 | $this->getActiveControl()->registerCallbackClientScript( |
266 | 266 | $this->getClientClassName(), $this->getPostBackOptions()); |
267 | 267 | } |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | */ |
283 | 283 | protected function registerClientScript() |
284 | 284 | { |
285 | - $cs=$this->getPage()->getClientScript(); |
|
285 | + $cs = $this->getPage()->getClientScript(); |
|
286 | 286 | $cs->registerPradoScript('inlineeditor'); |
287 | 287 | } |
288 | 288 | } |
@@ -76,8 +76,9 @@ discard block |
||
76 | 76 | { |
77 | 77 | $value = TPropertyValue::ensureBoolean($value); |
78 | 78 | $this->setViewState('DisplayTextBox', $value,false); |
79 | - if($this->getActiveControl()->canUpdateClientSide()) |
|
80 | - $this->callClientFunction('setDisplayTextBox',$value); |
|
79 | + if($this->getActiveControl()->canUpdateClientSide()) { |
|
80 | + $this->callClientFunction('setDisplayTextBox',$value); |
|
81 | + } |
|
81 | 82 | } |
82 | 83 | |
83 | 84 | /** |
@@ -122,9 +123,12 @@ discard block |
||
122 | 123 | protected function getExternalControlID() |
123 | 124 | { |
124 | 125 | $extID = $this->getEditTriggerControlID(); |
125 | - if($extID===null) return ''; |
|
126 | - if(($control = $this->findControl($extID))!==null) |
|
127 | - return $control->getClientID(); |
|
126 | + if($extID===null) { |
|
127 | + return ''; |
|
128 | + } |
|
129 | + if(($control = $this->findControl($extID))!==null) { |
|
130 | + return $control->getClientID(); |
|
131 | + } |
|
128 | 132 | return $extID; |
129 | 133 | } |
130 | 134 | |
@@ -173,10 +177,11 @@ discard block |
||
173 | 177 | */ |
174 | 178 | public function renderContents($writer) |
175 | 179 | { |
176 | - if(($text=$this->getText())==='') |
|
177 | - parent::renderContents($writer); |
|
178 | - else |
|
179 | - $writer->write($text); |
|
180 | + if(($text=$this->getText())==='') { |
|
181 | + parent::renderContents($writer); |
|
182 | + } else { |
|
183 | + $writer->write($text); |
|
184 | + } |
|
180 | 185 | } |
181 | 186 | |
182 | 187 | /** |
@@ -221,15 +226,15 @@ discard block |
||
221 | 226 | { |
222 | 227 | $options['Rows'] = $this->getRows(); |
223 | 228 | $options['Wrap'] = $this->getWrap()== false ? '' : true; |
224 | - } |
|
225 | - else |
|
229 | + } else |
|
226 | 230 | { |
227 | 231 | $length = $this->getMaxLength(); |
228 | 232 | $options['MaxLength'] = $length > 0 ? $length : ''; |
229 | 233 | } |
230 | 234 | |
231 | - if($this->hasEventHandler('OnLoadingText')) |
|
232 | - $options['LoadTextOnEdit'] = true; |
|
235 | + if($this->hasEventHandler('OnLoadingText')) { |
|
236 | + $options['LoadTextOnEdit'] = true; |
|
237 | + } |
|
233 | 238 | |
234 | 239 | $options['ReadOnly']=$this->getReadOnly(); |
235 | 240 | return $options; |
@@ -56,7 +56,7 @@ |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
59 | - * @return array list of trigger callback options. |
|
59 | + * @return string list of trigger callback options. |
|
60 | 60 | */ |
61 | 61 | protected function getTriggerOptions() |
62 | 62 | { |
@@ -45,9 +45,9 @@ |
||
45 | 45 | protected function getTargetControl() |
46 | 46 | { |
47 | 47 | $id = $this->getControlID(); |
48 | - if(($control=$this->findControl($id)) instanceof TControl) |
|
48 | + if (($control = $this->findControl($id)) instanceof TControl) |
|
49 | 49 | return $control->getClientID(); |
50 | - if($id==='') |
|
50 | + if ($id === '') |
|
51 | 51 | { |
52 | 52 | throw new TConfigurationException( |
53 | 53 | 'ttriggeredcallback_invalid_controlid', get_class($this)); |
@@ -45,8 +45,9 @@ |
||
45 | 45 | protected function getTargetControl() |
46 | 46 | { |
47 | 47 | $id = $this->getControlID(); |
48 | - if(($control=$this->findControl($id)) instanceof TControl) |
|
49 | - return $control->getClientID(); |
|
48 | + if(($control=$this->findControl($id)) instanceof TControl) { |
|
49 | + return $control->getClientID(); |
|
50 | + } |
|
50 | 51 | if($id==='') |
51 | 52 | { |
52 | 53 | throw new TConfigurationException( |
@@ -252,6 +252,7 @@ discard block |
||
252 | 252 | * method, be sure to call the parent implementation so that the event |
253 | 253 | * handler can be invoked. |
254 | 254 | * @param TCallbackEventParameter event parameter to be passed to the event handlers |
255 | + * @param TJuiAutoCompleteEventParameter $param |
|
255 | 256 | */ |
256 | 257 | public function onSuggest($param) |
257 | 258 | { |
@@ -264,6 +265,7 @@ discard block |
||
264 | 265 | * method, be sure to call the parent implementation so that the event |
265 | 266 | * handler can be invoked. |
266 | 267 | * @param TCallbackEventParameter event parameter to be passed to the event handlers |
268 | + * @param TJuiAutoCompleteEventParameter $param |
|
267 | 269 | */ |
268 | 270 | public function onSuggestionSelected($param) |
269 | 271 | { |
@@ -441,6 +443,7 @@ discard block |
||
441 | 443 | |
442 | 444 | /** |
443 | 445 | * Creates a new TCallbackEventParameter. |
446 | + * @param THttpResponse $response |
|
444 | 447 | */ |
445 | 448 | public function __construct($response, $parameter, $index=-1) |
446 | 449 | { |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * TJuiAutoComplete class file. |
|
4 | - * |
|
5 | - * @author Wei Zhuo <weizhuo[at]gamil[dot]com> |
|
6 | - * @link https://github.com/pradosoft/prado |
|
7 | - * @copyright Copyright © 2005-2015 The PRADO Group |
|
8 | - * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
9 | - * @package System.Web.UI.ActiveControls |
|
10 | - */ |
|
3 | + * TJuiAutoComplete class file. |
|
4 | + * |
|
5 | + * @author Wei Zhuo <weizhuo[at]gamil[dot]com> |
|
6 | + * @link https://github.com/pradosoft/prado |
|
7 | + * @copyright Copyright © 2005-2015 The PRADO Group |
|
8 | + * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
9 | + * @package System.Web.UI.ActiveControls |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * Load active text box. |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | /** |
85 | 85 | * @var ITemplate template for repeater items |
86 | 86 | */ |
87 | - private $_repeater=null; |
|
87 | + private $_repeater = null; |
|
88 | 88 | /** |
89 | 89 | * @var TPanel result panel holding the suggestion items. |
90 | 90 | */ |
91 | - private $_resultPanel=null; |
|
91 | + private $_resultPanel = null; |
|
92 | 92 | |
93 | 93 | /** |
94 | 94 | * Creates a new callback control, sets the adapter to |
@@ -123,9 +123,9 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public function getOptions() |
125 | 125 | { |
126 | - if (($options=$this->getViewState('JuiOptions'))===null) |
|
126 | + if (($options = $this->getViewState('JuiOptions')) === null) |
|
127 | 127 | { |
128 | - $options=new TJuiControlOptions($this); |
|
128 | + $options = new TJuiControlOptions($this); |
|
129 | 129 | $this->setViewState('JuiOptions', $options); |
130 | 130 | } |
131 | 131 | return $options; |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | */ |
205 | 205 | public function getMinChars() |
206 | 206 | { |
207 | - return $this->getViewState('minChars',''); |
|
207 | + return $this->getViewState('minChars', ''); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
@@ -229,20 +229,20 @@ discard block |
||
229 | 229 | public function raiseCallbackEvent($param) |
230 | 230 | { |
231 | 231 | $token = $param->getCallbackParameter(); |
232 | - if(is_array($token) && count($token) == 2) |
|
232 | + if (is_array($token) && count($token) == 2) |
|
233 | 233 | { |
234 | - if($token[1] === '__TJuiAutoComplete_onSuggest__') |
|
234 | + if ($token[1] === '__TJuiAutoComplete_onSuggest__') |
|
235 | 235 | { |
236 | 236 | $parameter = new TJuiAutoCompleteEventParameter($this->getResponse(), $token[0]); |
237 | 237 | $this->onSuggest($parameter); |
238 | 238 | } |
239 | - else if($token[1] === '__TJuiAutoComplete_onSuggestionSelected__') |
|
239 | + else if ($token[1] === '__TJuiAutoComplete_onSuggestionSelected__') |
|
240 | 240 | { |
241 | 241 | $parameter = new TJuiAutoCompleteEventParameter($this->getResponse(), null, $token[0]); |
242 | 242 | $this->onSuggestionSelected($parameter); |
243 | 243 | } |
244 | 244 | } |
245 | - else if($this->getAutoPostBack()) |
|
245 | + else if ($this->getAutoPostBack()) |
|
246 | 246 | parent::raiseCallbackEvent($param); |
247 | 247 | } |
248 | 248 | |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | public function dataBind() |
286 | 286 | { |
287 | 287 | parent::dataBind(); |
288 | - if($this->getPage()->getIsCallback()) |
|
288 | + if ($this->getPage()->getIsCallback()) |
|
289 | 289 | $this->renderSuggestions($this->getResponse()->createHtmlWriter()); |
290 | 290 | } |
291 | 291 | |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | */ |
295 | 295 | public function getResultPanel() |
296 | 296 | { |
297 | - if($this->_resultPanel===null) |
|
297 | + if ($this->_resultPanel === null) |
|
298 | 298 | $this->_resultPanel = $this->createResultPanel(); |
299 | 299 | return $this->_resultPanel; |
300 | 300 | } |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | */ |
316 | 316 | public function getSuggestions() |
317 | 317 | { |
318 | - if($this->_repeater===null) |
|
318 | + if ($this->_repeater === null) |
|
319 | 319 | $this->_repeater = $this->createRepeater(); |
320 | 320 | return $this->_repeater; |
321 | 321 | } |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | protected function createRepeater() |
327 | 327 | { |
328 | 328 | $repeater = Prado::createComponent('System.Web.UI.WebControls.TRepeater'); |
329 | - $repeater->setItemTemplate(new TTemplate('<%# $this->Data %>',null)); |
|
329 | + $repeater->setItemTemplate(new TTemplate('<%# $this->Data %>', null)); |
|
330 | 330 | $this->getControls()->add($repeater); |
331 | 331 | return $repeater; |
332 | 332 | } |
@@ -364,16 +364,16 @@ discard block |
||
364 | 364 | */ |
365 | 365 | public function renderSuggestions($writer) |
366 | 366 | { |
367 | - if($this->getActiveControl()->canUpdateClientSide()) |
|
367 | + if ($this->getActiveControl()->canUpdateClientSide()) |
|
368 | 368 | { |
369 | - $data=array(); |
|
370 | - $items=$this->getSuggestions()->getItems(); |
|
369 | + $data = array(); |
|
370 | + $items = $this->getSuggestions()->getItems(); |
|
371 | 371 | $writer = new TTextWriter; |
372 | - for($i=0; $i<$items->Count; $i++) |
|
372 | + for ($i = 0; $i < $items->Count; $i++) |
|
373 | 373 | { |
374 | 374 | $items->itemAt($i)->render($writer); |
375 | - $item=$writer->flush(); |
|
376 | - $data[]=array( 'id' => $i, 'label' => $item); |
|
375 | + $item = $writer->flush(); |
|
376 | + $data[] = array('id' => $i, 'label' => $item); |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | $this->getResponse()->getAdapter()->setResponseData($data); |
@@ -387,19 +387,19 @@ discard block |
||
387 | 387 | { |
388 | 388 | $options = $this->getOptions()->toArray(); |
389 | 389 | |
390 | - if(strlen($separator = $this->getSeparator())) |
|
390 | + if (strlen($separator = $this->getSeparator())) |
|
391 | 391 | $options['Separators'] = $separator; |
392 | 392 | |
393 | - if($this->getAutoPostBack()) |
|
393 | + if ($this->getAutoPostBack()) |
|
394 | 394 | { |
395 | - $options = array_merge($options,parent::getPostBackOptions()); |
|
395 | + $options = array_merge($options, parent::getPostBackOptions()); |
|
396 | 396 | $options['AutoPostBack'] = true; |
397 | 397 | } |
398 | - if(strlen($textCssClass = $this->getTextCssClass())) |
|
398 | + if (strlen($textCssClass = $this->getTextCssClass())) |
|
399 | 399 | $options['textCssClass'] = $textCssClass; |
400 | 400 | $options['minLength'] = $this->getMinChars(); |
401 | - $options['delay'] = $this->getFrequency()*1000.0; |
|
402 | - $options['appendTo'] = '#'.$this->getResultPanel()->getClientID(); |
|
401 | + $options['delay'] = $this->getFrequency() * 1000.0; |
|
402 | + $options['appendTo'] = '#' . $this->getResultPanel()->getClientID(); |
|
403 | 403 | $options['ID'] = $this->getClientID(); |
404 | 404 | $options['EventTarget'] = $this->getUniqueID(); |
405 | 405 | $options['CausesValidation'] = $this->getCausesValidation(); |
@@ -437,15 +437,15 @@ discard block |
||
437 | 437 | */ |
438 | 438 | class TJuiAutoCompleteEventParameter extends TCallbackEventParameter |
439 | 439 | { |
440 | - private $_selectedIndex=-1; |
|
440 | + private $_selectedIndex = -1; |
|
441 | 441 | |
442 | 442 | /** |
443 | 443 | * Creates a new TCallbackEventParameter. |
444 | 444 | */ |
445 | - public function __construct($response, $parameter, $index=-1) |
|
445 | + public function __construct($response, $parameter, $index = -1) |
|
446 | 446 | { |
447 | 447 | parent::__construct($response, $parameter); |
448 | - $this->_selectedIndex=$index; |
|
448 | + $this->_selectedIndex = $index; |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | /** |
@@ -235,15 +235,14 @@ discard block |
||
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 | } |
243 | + } else if($this->getAutoPostBack()) { |
|
244 | + parent::raiseCallbackEvent($param); |
|
244 | 245 | } |
245 | - else if($this->getAutoPostBack()) |
|
246 | - parent::raiseCallbackEvent($param); |
|
247 | 246 | } |
248 | 247 | |
249 | 248 | /** |
@@ -285,8 +284,9 @@ discard block |
||
285 | 284 | public function dataBind() |
286 | 285 | { |
287 | 286 | parent::dataBind(); |
288 | - if($this->getPage()->getIsCallback()) |
|
289 | - $this->renderSuggestions($this->getResponse()->createHtmlWriter()); |
|
287 | + if($this->getPage()->getIsCallback()) { |
|
288 | + $this->renderSuggestions($this->getResponse()->createHtmlWriter()); |
|
289 | + } |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | /** |
@@ -294,8 +294,9 @@ discard block |
||
294 | 294 | */ |
295 | 295 | public function getResultPanel() |
296 | 296 | { |
297 | - if($this->_resultPanel===null) |
|
298 | - $this->_resultPanel = $this->createResultPanel(); |
|
297 | + if($this->_resultPanel===null) { |
|
298 | + $this->_resultPanel = $this->createResultPanel(); |
|
299 | + } |
|
299 | 300 | return $this->_resultPanel; |
300 | 301 | } |
301 | 302 | |
@@ -315,8 +316,9 @@ discard block |
||
315 | 316 | */ |
316 | 317 | public function getSuggestions() |
317 | 318 | { |
318 | - if($this->_repeater===null) |
|
319 | - $this->_repeater = $this->createRepeater(); |
|
319 | + if($this->_repeater===null) { |
|
320 | + $this->_repeater = $this->createRepeater(); |
|
321 | + } |
|
320 | 322 | return $this->_repeater; |
321 | 323 | } |
322 | 324 | |
@@ -387,16 +389,18 @@ discard block |
||
387 | 389 | { |
388 | 390 | $options = $this->getOptions()->toArray(); |
389 | 391 | |
390 | - if(strlen($separator = $this->getSeparator())) |
|
391 | - $options['Separators'] = $separator; |
|
392 | + if(strlen($separator = $this->getSeparator())) { |
|
393 | + $options['Separators'] = $separator; |
|
394 | + } |
|
392 | 395 | |
393 | 396 | if($this->getAutoPostBack()) |
394 | 397 | { |
395 | 398 | $options = array_merge($options,parent::getPostBackOptions()); |
396 | 399 | $options['AutoPostBack'] = true; |
397 | 400 | } |
398 | - if(strlen($textCssClass = $this->getTextCssClass())) |
|
399 | - $options['textCssClass'] = $textCssClass; |
|
401 | + if(strlen($textCssClass = $this->getTextCssClass())) { |
|
402 | + $options['textCssClass'] = $textCssClass; |
|
403 | + } |
|
400 | 404 | $options['minLength'] = $this->getMinChars(); |
401 | 405 | $options['delay'] = $this->getFrequency()*1000.0; |
402 | 406 | $options['appendTo'] = '#'.$this->getResultPanel()->getClientID(); |