@@ -31,6 +31,7 @@ |
||
31 | 31 | /** |
32 | 32 | * Constructor. Attach a response to be adapted. |
33 | 33 | * @param THttpResponse the response object the adapter is to attach to. |
34 | + * @param THttpResponse $response |
|
34 | 35 | */ |
35 | 36 | public function __construct($response) |
36 | 37 | { |
@@ -71,7 +71,7 @@ |
||
71 | 71 | */ |
72 | 72 | public function createNewHtmlWriter($type, $writer) |
73 | 73 | { |
74 | - return $this->_response->createNewHtmlWriter($type,$writer); |
|
74 | + return $this->_response->createNewHtmlWriter($type, $writer); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 |
@@ -265,6 +265,7 @@ discard block |
||
265 | 265 | * If true, make sure the methods {@link _open}, {@link _close}, {@link _read}, |
266 | 266 | * {@link _write}, {@link _destroy}, and {@link _gc} are overridden in child |
267 | 267 | * class, because they will be used as the callback handlers. |
268 | + * @param boolean $value |
|
268 | 269 | */ |
269 | 270 | public function setUseCustomStorage($value) |
270 | 271 | { |
@@ -527,6 +528,7 @@ discard block |
||
527 | 528 | * Returns the session variable value with the session variable name. |
528 | 529 | * This method is exactly the same as {@link offsetGet}. |
529 | 530 | * @param mixed the session variable name |
531 | + * @param string $key |
|
530 | 532 | * @return mixed the session variable value, null if no such variable exists |
531 | 533 | */ |
532 | 534 | public function itemAt($key) |
@@ -539,6 +541,7 @@ discard block |
||
539 | 541 | * Note, if the specified name already exists, the old value will be removed first. |
540 | 542 | * @param mixed session variable name |
541 | 543 | * @param mixed session variable value |
544 | + * @param string $key |
|
542 | 545 | */ |
543 | 546 | public function add($key,$value) |
544 | 547 | { |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @package System.Web |
68 | 68 | * @since 3.0 |
69 | 69 | */ |
70 | -class THttpSession extends TApplicationComponent implements IteratorAggregate,ArrayAccess,Countable,IModule |
|
70 | +class THttpSession extends TApplicationComponent implements IteratorAggregate, ArrayAccess, Countable, IModule |
|
71 | 71 | { |
72 | 72 | /** |
73 | 73 | * @var boolean whether this module has been initialized |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | if(!$this->_started) |
134 | 134 | { |
135 | 135 | if($this->_customStorage) |
136 | - session_set_save_handler(array($this,'_open'),array($this,'_close'),array($this,'_read'),array($this,'_write'),array($this,'_destroy'),array($this,'_gc')); |
|
136 | + session_set_save_handler(array($this, '_open'), array($this, '_close'), array($this, '_read'), array($this, '_write'), array($this, '_destroy'), array($this, '_gc')); |
|
137 | 137 | if($this->_cookie!==null) |
138 | - session_set_cookie_params($this->_cookie->getExpire(),$this->_cookie->getPath(),$this->_cookie->getDomain(),$this->_cookie->getSecure(),$this->_cookie->getHttpOnly()); |
|
138 | + session_set_cookie_params($this->_cookie->getExpire(), $this->_cookie->getPath(), $this->_cookie->getDomain(), $this->_cookie->getSecure(), $this->_cookie->getHttpOnly()); |
|
139 | 139 | if(ini_get('session.auto_start')!=='1') |
140 | 140 | session_start(); |
141 | 141 | $this->_started=true; |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function regenerate($deleteOld=false) |
177 | 177 | { |
178 | - $old = $this->getSessionID(); |
|
178 | + $old=$this->getSessionID(); |
|
179 | 179 | session_regenerate_id($deleteOld); |
180 | 180 | return $old; |
181 | 181 | } |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | else if(ctype_alnum($value)) |
228 | 228 | session_name($value); |
229 | 229 | else |
230 | - throw new TInvalidDataValueException('httpsession_sessionname_invalid',$value); |
|
230 | + throw new TInvalidDataValueException('httpsession_sessionname_invalid', $value); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | else if(is_dir($value)) |
250 | 250 | session_save_path($value); |
251 | 251 | else |
252 | - throw new TInvalidDataValueException('httpsession_savepath_invalid',$value); |
|
252 | + throw new TInvalidDataValueException('httpsession_savepath_invalid', $value); |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | /** |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | public function getCookie() |
278 | 278 | { |
279 | 279 | if($this->_cookie===null) |
280 | - $this->_cookie=new THttpCookie($this->getSessionName(),$this->getSessionID()); |
|
280 | + $this->_cookie=new THttpCookie($this->getSessionName(), $this->getSessionID()); |
|
281 | 281 | return $this->_cookie; |
282 | 282 | } |
283 | 283 | |
@@ -304,21 +304,21 @@ discard block |
||
304 | 304 | throw new TInvalidOperationException('httpsession_cookiemode_unchangeable'); |
305 | 305 | else |
306 | 306 | { |
307 | - $value=TPropertyValue::ensureEnum($value,'THttpSessionCookieMode'); |
|
307 | + $value=TPropertyValue::ensureEnum($value, 'THttpSessionCookieMode'); |
|
308 | 308 | if($value===THttpSessionCookieMode::None) |
309 | 309 | { |
310 | - ini_set('session.use_cookies','0'); |
|
311 | - ini_set('session.use_only_cookies','0'); |
|
310 | + ini_set('session.use_cookies', '0'); |
|
311 | + ini_set('session.use_only_cookies', '0'); |
|
312 | 312 | } |
313 | 313 | else if($value===THttpSessionCookieMode::Allow) |
314 | 314 | { |
315 | - ini_set('session.use_cookies','1'); |
|
316 | - ini_set('session.use_only_cookies','0'); |
|
315 | + ini_set('session.use_cookies', '1'); |
|
316 | + ini_set('session.use_only_cookies', '0'); |
|
317 | 317 | } |
318 | 318 | else |
319 | 319 | { |
320 | - ini_set('session.use_cookies','1'); |
|
321 | - ini_set('session.use_only_cookies','1'); |
|
320 | + ini_set('session.use_cookies', '1'); |
|
321 | + ini_set('session.use_only_cookies', '1'); |
|
322 | 322 | ini_set('session.use_trans_sid', 0); |
323 | 323 | } |
324 | 324 | } |
@@ -364,13 +364,13 @@ discard block |
||
364 | 364 | else |
365 | 365 | { |
366 | 366 | $value=TPropertyValue::ensureInteger($value); |
367 | - if($value>=0 && $value<=100) |
|
367 | + if($value >= 0 && $value <= 100) |
|
368 | 368 | { |
369 | - ini_set('session.gc_probability',$value); |
|
370 | - ini_set('session.gc_divisor','100'); |
|
369 | + ini_set('session.gc_probability', $value); |
|
370 | + ini_set('session.gc_divisor', '100'); |
|
371 | 371 | } |
372 | 372 | else |
373 | - throw new TInvalidDataValueException('httpsession_gcprobability_invalid',$value); |
|
373 | + throw new TInvalidDataValueException('httpsession_gcprobability_invalid', $value); |
|
374 | 374 | } |
375 | 375 | } |
376 | 376 | |
@@ -392,9 +392,9 @@ discard block |
||
392 | 392 | else |
393 | 393 | { |
394 | 394 | $value=TPropertyValue::ensureBoolean($value); |
395 | - if ($value && $this->getCookieMode()==THttpSessionCookieMode::Only) |
|
395 | + if($value && $this->getCookieMode()==THttpSessionCookieMode::Only) |
|
396 | 396 | throw new TInvalidOperationException('httpsession_transid_cookieonly'); |
397 | - ini_set('session.use_trans_sid',$value?'1':'0'); |
|
397 | + ini_set('session.use_trans_sid', $value ? '1' : '0'); |
|
398 | 398 | } |
399 | 399 | } |
400 | 400 | |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | if($this->_started) |
416 | 416 | throw new TInvalidOperationException('httpsession_maxlifetime_unchangeable'); |
417 | 417 | else |
418 | - ini_set('session.gc_maxlifetime',$value); |
|
418 | + ini_set('session.gc_maxlifetime', $value); |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | /** |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | * @param string session name |
426 | 426 | * @return boolean whether session is opened successfully |
427 | 427 | */ |
428 | - public function _open($savePath,$sessionName) |
|
428 | + public function _open($savePath, $sessionName) |
|
429 | 429 | { |
430 | 430 | return true; |
431 | 431 | } |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | * @param string session data |
459 | 459 | * @return boolean whether session write is successful |
460 | 460 | */ |
461 | - public function _write($id,$data) |
|
461 | + public function _write($id, $data) |
|
462 | 462 | { |
463 | 463 | return true; |
464 | 464 | } |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | * @param mixed session variable name |
541 | 541 | * @param mixed session variable value |
542 | 542 | */ |
543 | - public function add($key,$value) |
|
543 | + public function add($key, $value) |
|
544 | 544 | { |
545 | 545 | $_SESSION[$key]=$value; |
546 | 546 | } |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | * @param integer the offset to set element |
614 | 614 | * @param mixed the element value |
615 | 615 | */ |
616 | - public function offsetSet($offset,$item) |
|
616 | + public function offsetSet($offset, $item) |
|
617 | 617 | { |
618 | 618 | $_SESSION[$offset]=$item; |
619 | 619 | } |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | */ |
687 | 687 | public function current() |
688 | 688 | { |
689 | - return isset($_SESSION[$this->_key])?$_SESSION[$this->_key]:null; |
|
689 | + return isset($_SESSION[$this->_key]) ? $_SESSION[$this->_key] : null; |
|
690 | 690 | } |
691 | 691 | |
692 | 692 | /** |
@@ -309,13 +309,11 @@ discard block |
||
309 | 309 | { |
310 | 310 | ini_set('session.use_cookies','0'); |
311 | 311 | ini_set('session.use_only_cookies','0'); |
312 | - } |
|
313 | - else if($value===THttpSessionCookieMode::Allow) |
|
312 | + } else if($value===THttpSessionCookieMode::Allow) |
|
314 | 313 | { |
315 | 314 | ini_set('session.use_cookies','1'); |
316 | 315 | ini_set('session.use_only_cookies','0'); |
317 | - } |
|
318 | - else |
|
316 | + } else |
|
319 | 317 | { |
320 | 318 | ini_set('session.use_cookies','1'); |
321 | 319 | ini_set('session.use_only_cookies','1'); |
@@ -368,8 +366,7 @@ discard block |
||
368 | 366 | { |
369 | 367 | ini_set('session.gc_probability',$value); |
370 | 368 | ini_set('session.gc_divisor','100'); |
371 | - } |
|
372 | - else |
|
369 | + } else |
|
373 | 370 | throw new TInvalidDataValueException('httpsession_gcprobability_invalid',$value); |
374 | 371 | } |
375 | 372 | } |
@@ -557,8 +554,7 @@ discard block |
||
557 | 554 | $value=$_SESSION[$key]; |
558 | 555 | unset($_SESSION[$key]); |
559 | 556 | return $value; |
560 | - } |
|
561 | - else |
|
557 | + } else |
|
562 | 558 | return null; |
563 | 559 | } |
564 | 560 |
@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * THttpSession class |
|
4 | - * |
|
5 | - * @author Qiang Xue <[email protected]> |
|
6 | - * @link https://github.com/pradosoft/prado |
|
7 | - * @copyright Copyright © 2005-2016 The PRADO Group |
|
8 | - * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
9 | - * @package System.Web |
|
10 | - */ |
|
3 | + * THttpSession class |
|
4 | + * |
|
5 | + * @author Qiang Xue <[email protected]> |
|
6 | + * @link https://github.com/pradosoft/prado |
|
7 | + * @copyright Copyright © 2005-2016 The PRADO Group |
|
8 | + * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
9 | + * @package System.Web |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * THttpSession class |
@@ -306,10 +306,10 @@ discard block |
||
306 | 306 | { |
307 | 307 | $value=TPropertyValue::ensureEnum($value,'THttpSessionCookieMode'); |
308 | 308 | if($value===THttpSessionCookieMode::None) |
309 | - { |
|
309 | + { |
|
310 | 310 | ini_set('session.use_cookies','0'); |
311 | 311 | ini_set('session.use_only_cookies','0'); |
312 | - } |
|
312 | + } |
|
313 | 313 | else if($value===THttpSessionCookieMode::Allow) |
314 | 314 | { |
315 | 315 | ini_set('session.use_cookies','1'); |
@@ -252,7 +252,7 @@ |
||
252 | 252 | } |
253 | 253 | |
254 | 254 | /** |
255 | - * @return boolean true to observe changes. |
|
255 | + * @return boolean|string true to observe changes. |
|
256 | 256 | */ |
257 | 257 | public function getObserveChanges() |
258 | 258 | { |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | /** |
37 | 37 | * @var boolean true if validation is made during a callback request. |
38 | 38 | */ |
39 | - private $_isCallback = false; |
|
39 | + private $_isCallback=false; |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * @return boolean true if validation is made during a callback request. |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function raiseCallbackEvent($param) |
95 | 95 | { |
96 | - $this->_isCallback = true; |
|
97 | - $result = $this->onServerValidate($param->getCallbackParameter()); |
|
96 | + $this->_isCallback=true; |
|
97 | + $result=$this->onServerValidate($param->getCallbackParameter()); |
|
98 | 98 | $param->setResponseData($result); |
99 | 99 | $this->onCallback($param); |
100 | 100 | } |
@@ -110,8 +110,8 @@ discard block |
||
110 | 110 | parent::setIsValid($value); |
111 | 111 | if($this->getActiveControl()->canUpdateClientSide()) |
112 | 112 | { |
113 | - $client = $this->getPage()->getCallbackClient(); |
|
114 | - $func = 'Prado.Validation.updateActiveCustomValidator'; |
|
113 | + $client=$this->getPage()->getCallbackClient(); |
|
114 | + $func='Prado.Validation.updateActiveCustomValidator'; |
|
115 | 115 | $client->callClientFunction($func, array($this, $value)); |
116 | 116 | } |
117 | 117 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | protected function getClientScriptOptions() |
136 | 136 | { |
137 | 137 | $options=TBaseValidator::getClientScriptOptions(); |
138 | - $options['EventTarget'] = $this->getUniqueID(); |
|
138 | + $options['EventTarget']=$this->getUniqueID(); |
|
139 | 139 | return $options; |
140 | 140 | } |
141 | 141 | |
@@ -145,15 +145,15 @@ discard block |
||
145 | 145 | */ |
146 | 146 | public function setErrorMessage($value) |
147 | 147 | { |
148 | - if(parent::getErrorMessage() === $value) |
|
148 | + if(parent::getErrorMessage()===$value) |
|
149 | 149 | return; |
150 | 150 | |
151 | 151 | |
152 | 152 | parent::setErrorMessage($value); |
153 | 153 | if($this->getActiveControl()->canUpdateClientSide()) |
154 | 154 | { |
155 | - $client = $this->getPage()->getCallbackClient(); |
|
156 | - $func = 'Prado.Validation.setErrorMessage'; |
|
155 | + $client=$this->getPage()->getCallbackClient(); |
|
156 | + $func='Prado.Validation.setErrorMessage'; |
|
157 | 157 | $client->callClientFunction($func, array($this, $value)); |
158 | 158 | } |
159 | 159 | } |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | */ |
264 | 264 | public function getObserveChanges() |
265 | 265 | { |
266 | - $changes = $this->getOption('ObserveChanges'); |
|
266 | + $changes=$this->getOption('ObserveChanges'); |
|
267 | 267 | return ($changes===null) ? true : $changes; |
268 | 268 | } |
269 | 269 | } |
@@ -70,7 +70,7 @@ |
||
70 | 70 | /** |
71 | 71 | * Javascript client class for this control. |
72 | 72 | * This method overrides the parent implementation. |
73 | - * @return null no javascript class name. |
|
73 | + * @return string no javascript class name. |
|
74 | 74 | */ |
75 | 75 | protected function getClientClassName() |
76 | 76 | { |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | protected function createListItemCollection() |
64 | 64 | { |
65 | - $collection = new TActiveListItemCollection; |
|
65 | + $collection=new TActiveListItemCollection; |
|
66 | 66 | $collection->setControl($this); |
67 | 67 | return $collection; |
68 | 68 | } |
@@ -85,15 +85,15 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function setSelectionMode($value) |
87 | 87 | { |
88 | - if(parent::getSelectionMode() === $value) |
|
88 | + if(parent::getSelectionMode()===$value) |
|
89 | 89 | return; |
90 | 90 | |
91 | 91 | parent::setSelectionMode($value); |
92 | - $multiple = $this->getIsMultiSelect(); |
|
93 | - $id = $this->getUniqueID(); $multi_id = $id.'[]'; |
|
92 | + $multiple=$this->getIsMultiSelect(); |
|
93 | + $id=$this->getUniqueID(); $multi_id=$id.'[]'; |
|
94 | 94 | if($this->getActiveControl()->canUpdateClientSide()) |
95 | 95 | { |
96 | - $client = $this->getPage()->getCallbackClient(); |
|
96 | + $client=$this->getPage()->getCallbackClient(); |
|
97 | 97 | $client->setAttribute($this, 'multiple', $multiple ? 'multiple' : false); |
98 | 98 | $client->setAttribute($this, 'name', $multiple ? $multi_id : $id); |
99 | 99 | } |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | protected function addAttributesToRender($writer) |
147 | 147 | { |
148 | 148 | parent::addAttributesToRender($writer); |
149 | - $writer->addAttribute('id',$this->getClientID()); |
|
150 | - if ($this->getAutoPostBack()) |
|
149 | + $writer->addAttribute('id', $this->getClientID()); |
|
150 | + if($this->getAutoPostBack()) |
|
151 | 151 | $this->getActiveControl()->registerCallbackClientScript( |
152 | 152 | $this->getClientClassName(), $this->getPostBackOptions()); |
153 | 153 | } |
@@ -228,6 +228,8 @@ |
||
228 | 228 | |
229 | 229 | /** |
230 | 230 | * Appends data or javascript code to the body content surrounded with delimiters |
231 | + * @param THttpResponse $response |
|
232 | + * @param string $delimiter |
|
231 | 233 | */ |
232 | 234 | private function appendContentPart($response, $delimiter, $data) |
233 | 235 | { |
@@ -32,40 +32,40 @@ discard block |
||
32 | 32 | /** |
33 | 33 | * Callback response data header name. |
34 | 34 | */ |
35 | - const CALLBACK_DATA_HEADER = 'X-PRADO-DATA'; |
|
35 | + const CALLBACK_DATA_HEADER='X-PRADO-DATA'; |
|
36 | 36 | /** |
37 | 37 | * Callback response client-side action header name. |
38 | 38 | */ |
39 | - const CALLBACK_ACTION_HEADER = 'X-PRADO-ACTIONS'; |
|
39 | + const CALLBACK_ACTION_HEADER='X-PRADO-ACTIONS'; |
|
40 | 40 | /** |
41 | 41 | * Callback error header name. |
42 | 42 | */ |
43 | - const CALLBACK_ERROR_HEADER = 'X-PRADO-ERROR'; |
|
43 | + const CALLBACK_ERROR_HEADER='X-PRADO-ERROR'; |
|
44 | 44 | /** |
45 | 45 | * Callback page state header name. |
46 | 46 | */ |
47 | - const CALLBACK_PAGESTATE_HEADER = 'X-PRADO-PAGESTATE'; |
|
47 | + const CALLBACK_PAGESTATE_HEADER='X-PRADO-PAGESTATE'; |
|
48 | 48 | /** |
49 | 49 | * Script list header name. |
50 | 50 | */ |
51 | - const CALLBACK_SCRIPTLIST_HEADER = 'X-PRADO-SCRIPTLIST'; |
|
51 | + const CALLBACK_SCRIPTLIST_HEADER='X-PRADO-SCRIPTLIST'; |
|
52 | 52 | /** |
53 | 53 | * Stylesheet list header name. |
54 | 54 | */ |
55 | - const CALLBACK_STYLESHEETLIST_HEADER = 'X-PRADO-STYLESHEETLIST'; |
|
55 | + const CALLBACK_STYLESHEETLIST_HEADER='X-PRADO-STYLESHEETLIST'; |
|
56 | 56 | /** |
57 | 57 | * Stylesheet header name. |
58 | 58 | */ |
59 | - const CALLBACK_STYLESHEET_HEADER = 'X-PRADO-STYLESHEET'; |
|
59 | + const CALLBACK_STYLESHEET_HEADER='X-PRADO-STYLESHEET'; |
|
60 | 60 | /** |
61 | 61 | * Hidden field list header name. |
62 | 62 | */ |
63 | - const CALLBACK_HIDDENFIELDLIST_HEADER = 'X-PRADO-HIDDENFIELDLIST'; |
|
63 | + const CALLBACK_HIDDENFIELDLIST_HEADER='X-PRADO-HIDDENFIELDLIST'; |
|
64 | 64 | |
65 | 65 | /** |
66 | 66 | * Callback redirect url header name. |
67 | 67 | */ |
68 | - const CALLBACK_REDIRECT = 'X-PRADO-REDIRECT'; |
|
68 | + const CALLBACK_REDIRECT='X-PRADO-REDIRECT'; |
|
69 | 69 | |
70 | 70 | /** |
71 | 71 | * @var ICallbackEventHandler callback event handler. |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | parent::__construct($control); |
92 | 92 | |
93 | 93 | //TODO: can this be done later? |
94 | - $response = $this->getApplication()->getResponse(); |
|
94 | + $response=$this->getApplication()->getResponse(); |
|
95 | 95 | $response->setAdapter(new TCallbackResponseAdapter($response)); |
96 | 96 | |
97 | 97 | $this->trapCallbackErrorsExceptions(); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function processCallbackEvent($writer) |
105 | 105 | { |
106 | - Prado::trace("ActivePage raiseCallbackEvent()",'System.Web.UI.ActiveControls.TActivePageAdapter'); |
|
106 | + Prado::trace("ActivePage raiseCallbackEvent()", 'System.Web.UI.ActiveControls.TActivePageAdapter'); |
|
107 | 107 | $this->raiseCallbackEvent(); |
108 | 108 | } |
109 | 109 | |
@@ -112,11 +112,11 @@ discard block |
||
112 | 112 | * @param TControl control for defered rendering |
113 | 113 | * @param THtmlWriter the renderer |
114 | 114 | */ |
115 | - public function registerControlToRender($control,$writer) |
|
115 | + public function registerControlToRender($control, $writer) |
|
116 | 116 | { |
117 | - $id = $control->getUniqueID(); |
|
117 | + $id=$control->getUniqueID(); |
|
118 | 118 | if(!isset($this->_controlsToRender[$id])) |
119 | - $this->_controlsToRender[$id] = array($control,$writer); |
|
119 | + $this->_controlsToRender[$id]=array($control, $writer); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public function renderCallbackResponse($writer) |
135 | 135 | { |
136 | - Prado::trace("ActivePage renderCallbackResponse()",'System.Web.UI.ActiveControls.TActivePageAdapter'); |
|
137 | - if(($url = $this->getResponse()->getAdapter()->getRedirectedUrl())===null) |
|
136 | + Prado::trace("ActivePage renderCallbackResponse()", 'System.Web.UI.ActiveControls.TActivePageAdapter'); |
|
137 | + if(($url=$this->getResponse()->getAdapter()->getRedirectedUrl())===null) |
|
138 | 138 | $this->renderResponse($writer); |
139 | 139 | else |
140 | 140 | $this->redirect($url); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | protected function redirect($url) |
148 | 148 | { |
149 | - Prado::trace("ActivePage redirect()",'System.Web.UI.ActiveControls.TActivePageAdapter'); |
|
149 | + Prado::trace("ActivePage redirect()", 'System.Web.UI.ActiveControls.TActivePageAdapter'); |
|
150 | 150 | $this->appendContentPart($this->getResponse(), self::CALLBACK_REDIRECT, $url); |
151 | 151 | } |
152 | 152 | |
@@ -157,31 +157,31 @@ discard block |
||
157 | 157 | */ |
158 | 158 | protected function renderResponse($writer) |
159 | 159 | { |
160 | - Prado::trace("ActivePage renderResponse()",'System.Web.UI.ActiveControls.TActivePageAdapter'); |
|
160 | + Prado::trace("ActivePage renderResponse()", 'System.Web.UI.ActiveControls.TActivePageAdapter'); |
|
161 | 161 | //renders all the defered render() calls. |
162 | 162 | foreach($this->_controlsToRender as $rid => $forRender) |
163 | 163 | $forRender[0]->render($forRender[1]); |
164 | 164 | |
165 | - $response = $this->getResponse(); |
|
165 | + $response=$this->getResponse(); |
|
166 | 166 | |
167 | 167 | //send response data in header |
168 | 168 | if($response->getHasAdapter()) |
169 | 169 | { |
170 | - $responseData = $response->getAdapter()->getResponseData(); |
|
170 | + $responseData=$response->getAdapter()->getResponseData(); |
|
171 | 171 | if($responseData!==null) |
172 | 172 | { |
173 | - $data = TJavaScript::jsonEncode($responseData); |
|
173 | + $data=TJavaScript::jsonEncode($responseData); |
|
174 | 174 | |
175 | 175 | $this->appendContentPart($response, self::CALLBACK_DATA_HEADER, $data); |
176 | 176 | } |
177 | 177 | } |
178 | 178 | |
179 | 179 | //sends page state in header |
180 | - if(($handler = $this->getCallbackEventTarget()) !== null) |
|
180 | + if(($handler=$this->getCallbackEventTarget())!==null) |
|
181 | 181 | { |
182 | 182 | if($handler->getActiveControl()->getClientSide()->getEnablePageStateUpdate()) |
183 | 183 | { |
184 | - $pagestate = $this->getPage()->getClientState(); |
|
184 | + $pagestate=$this->getPage()->getClientState(); |
|
185 | 185 | $this->appendContentPart($response, self::CALLBACK_PAGESTATE_HEADER, $pagestate); |
186 | 186 | } |
187 | 187 | } |
@@ -192,37 +192,37 @@ discard block |
||
192 | 192 | //output the end javascript |
193 | 193 | if($this->getPage()->getClientScript()->hasEndScripts()) |
194 | 194 | { |
195 | - $writer = $response->createHtmlWriter(); |
|
195 | + $writer=$response->createHtmlWriter(); |
|
196 | 196 | $this->getPage()->getClientScript()->renderEndScriptsCallback($writer); |
197 | 197 | $this->getPage()->getCallbackClient()->evaluateScript($writer); |
198 | 198 | } |
199 | 199 | |
200 | 200 | //output the actions |
201 | - $executeJavascript = $this->getCallbackClientHandler()->getClientFunctionsToExecute(); |
|
202 | - $actions = TJavaScript::jsonEncode($executeJavascript); |
|
201 | + $executeJavascript=$this->getCallbackClientHandler()->getClientFunctionsToExecute(); |
|
202 | + $actions=TJavaScript::jsonEncode($executeJavascript); |
|
203 | 203 | $this->appendContentPart($response, self::CALLBACK_ACTION_HEADER, $actions); |
204 | 204 | |
205 | 205 | |
206 | - $cs = $this->Page->getClientScript(); |
|
206 | + $cs=$this->Page->getClientScript(); |
|
207 | 207 | |
208 | 208 | // collect all stylesheet file references |
209 | - $stylesheets = $cs->getStyleSheetUrls(); |
|
210 | - if (count($stylesheets)>0) |
|
209 | + $stylesheets=$cs->getStyleSheetUrls(); |
|
210 | + if(count($stylesheets) > 0) |
|
211 | 211 | $this->appendContentPart($response, self::CALLBACK_STYLESHEETLIST_HEADER, TJavaScript::jsonEncode($stylesheets)); |
212 | 212 | |
213 | 213 | // collect all stylesheet snippets references |
214 | - $stylesheets = $cs->getStyleSheetCodes(); |
|
215 | - if (count($stylesheets)>0) |
|
214 | + $stylesheets=$cs->getStyleSheetCodes(); |
|
215 | + if(count($stylesheets) > 0) |
|
216 | 216 | $this->appendContentPart($response, self::CALLBACK_STYLESHEET_HEADER, TJavaScript::jsonEncode($stylesheets)); |
217 | 217 | |
218 | 218 | // collect all script file references |
219 | - $scripts = $cs->getScriptUrls(); |
|
220 | - if (count($scripts)>0) |
|
219 | + $scripts=$cs->getScriptUrls(); |
|
220 | + if(count($scripts) > 0) |
|
221 | 221 | $this->appendContentPart($response, self::CALLBACK_SCRIPTLIST_HEADER, TJavaScript::jsonEncode($scripts)); |
222 | 222 | |
223 | 223 | // collect all hidden field references |
224 | - $fields = $cs->getHiddenFields(); |
|
225 | - if (count($fields)>0) |
|
224 | + $fields=$cs->getHiddenFields(); |
|
225 | + if(count($fields) > 0) |
|
226 | 226 | $this->appendContentPart($response, self::CALLBACK_HIDDENFIELDLIST_HEADER, TJavaScript::jsonEncode($fields)); |
227 | 227 | } |
228 | 228 | |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | */ |
232 | 232 | private function appendContentPart($response, $delimiter, $data) |
233 | 233 | { |
234 | - $content = $response->createHtmlWriter(); |
|
234 | + $content=$response->createHtmlWriter(); |
|
235 | 235 | $content->getWriter()->setBoundary($delimiter); |
236 | 236 | $content->write($data); |
237 | 237 | } |
@@ -248,8 +248,8 @@ discard block |
||
248 | 248 | { |
249 | 249 | if($callbackHandler instanceof ICallbackEventHandler) |
250 | 250 | { |
251 | - $param = $this->getCallbackEventParameter(); |
|
252 | - $result = new TCallbackEventParameter($this->getResponse(), $param); |
|
251 | + $param=$this->getCallbackEventParameter(); |
|
252 | + $result=new TCallbackEventParameter($this->getResponse(), $param); |
|
253 | 253 | $callbackHandler->raiseCallbackEvent($result); |
254 | 254 | } |
255 | 255 | else |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | } |
261 | 261 | else |
262 | 262 | { |
263 | - $target = $this->getRequest()->itemAt(TPage::FIELD_CALLBACK_TARGET); |
|
263 | + $target=$this->getRequest()->itemAt(TPage::FIELD_CALLBACK_TARGET); |
|
264 | 264 | throw new TInvalidCallbackException('callback_invalid_target', $target); |
265 | 265 | } |
266 | 266 | } |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | { |
298 | 298 | if($this->_callbackEventParameter===null) |
299 | 299 | { |
300 | - $param = $this->getRequest()->itemAt(TPage::FIELD_CALLBACK_PARAMETER); |
|
300 | + $param=$this->getRequest()->itemAt(TPage::FIELD_CALLBACK_PARAMETER); |
|
301 | 301 | $this->_callbackEventParameter=$param; |
302 | 302 | } |
303 | 303 | return $this->_callbackEventParameter; |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | public function getCallbackClientHandler() |
320 | 320 | { |
321 | 321 | if($this->_callbackClient===null) |
322 | - $this->_callbackClient = new TCallbackClientScript; |
|
322 | + $this->_callbackClient=new TCallbackClientScript; |
|
323 | 323 | return $this->_callbackClient; |
324 | 324 | } |
325 | 325 | } |
@@ -347,22 +347,22 @@ discard block |
||
347 | 347 | { |
348 | 348 | if($this->getApplication()->getMode()===TApplication::STATE_DEBUG) |
349 | 349 | { |
350 | - $response = $this->getApplication()->getResponse(); |
|
351 | - $trace = $this->getExceptionStackTrace($exception); |
|
350 | + $response=$this->getApplication()->getResponse(); |
|
351 | + $trace=$this->getExceptionStackTrace($exception); |
|
352 | 352 | // avoid error on non-utf8 strings |
353 | 353 | try { |
354 | - $trace = TJavaScript::jsonEncode($trace); |
|
355 | - } catch (Exception $e) { |
|
354 | + $trace=TJavaScript::jsonEncode($trace); |
|
355 | + } catch(Exception $e) { |
|
356 | 356 | // strip everythin not 7bit ascii |
357 | - $trace = preg_replace('/[^(\x20-\x7F)]*/','', serialize($trace)); |
|
357 | + $trace=preg_replace('/[^(\x20-\x7F)]*/', '', serialize($trace)); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | // avoid exception loop if headers have already been sent |
361 | 361 | try { |
362 | 362 | $response->setStatusCode(500, 'Internal Server Error'); |
363 | - } catch (Exception $e) { } |
|
363 | + } catch(Exception $e) { } |
|
364 | 364 | |
365 | - $content = $response->createHtmlWriter(); |
|
365 | + $content=$response->createHtmlWriter(); |
|
366 | 366 | $content->getWriter()->setBoundary(TActivePageAdapter::CALLBACK_ERROR_HEADER); |
367 | 367 | $content->write($trace); |
368 | 368 | } |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | $data['type']=get_class($exception); |
398 | 398 | $data['message']=$exception->getMessage(); |
399 | 399 | $data['version']=$_SERVER['SERVER_SOFTWARE'].' '.Prado::getVersion(); |
400 | - $data['time']=@strftime('%Y-%m-%d %H:%M',time()); |
|
400 | + $data['time']=@strftime('%Y-%m-%d %H:%M', time()); |
|
401 | 401 | return $data; |
402 | 402 | } |
403 | 403 | } |
@@ -251,14 +251,12 @@ discard block |
||
251 | 251 | $param = $this->getCallbackEventParameter(); |
252 | 252 | $result = new TCallbackEventParameter($this->getResponse(), $param); |
253 | 253 | $callbackHandler->raiseCallbackEvent($result); |
254 | - } |
|
255 | - else |
|
254 | + } else |
|
256 | 255 | { |
257 | 256 | throw new TInvalidCallbackException( |
258 | 257 | 'callback_invalid_handler', $callbackHandler->getUniqueID()); |
259 | 258 | } |
260 | - } |
|
261 | - else |
|
259 | + } else |
|
262 | 260 | { |
263 | 261 | $target = $this->getRequest()->itemAt(TPage::FIELD_CALLBACK_TARGET); |
264 | 262 | throw new TInvalidCallbackException('callback_invalid_target', $target); |
@@ -365,8 +363,7 @@ discard block |
||
365 | 363 | $content = $response->createHtmlWriter(); |
366 | 364 | $content->getWriter()->setBoundary(TActivePageAdapter::CALLBACK_ERROR_HEADER); |
367 | 365 | $content->write($trace); |
368 | - } |
|
369 | - else |
|
366 | + } else |
|
370 | 367 | { |
371 | 368 | error_log("Error happened while processing an existing error:\n".$exception->__toString()); |
372 | 369 | header('HTTP/1.0 500 Internal Server Error', true, 500); |
@@ -1,14 +1,14 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * TActivePageAdapter, TCallbackErrorHandler and TInvalidCallbackException class file. |
|
4 | - * |
|
5 | - * @author Wei Zhuo <weizhuo[at]gamil[dot]com> |
|
6 | - * @author Gabor Berczi <[email protected]> (lazyload additions & progressive rendering) |
|
7 | - * @link https://github.com/pradosoft/prado |
|
8 | - * @copyright Copyright © 2005-2016 The PRADO Group |
|
9 | - * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
10 | - * @package System.Web.UI.ActiveControls |
|
11 | - */ |
|
3 | + * TActivePageAdapter, TCallbackErrorHandler and TInvalidCallbackException class file. |
|
4 | + * |
|
5 | + * @author Wei Zhuo <weizhuo[at]gamil[dot]com> |
|
6 | + * @author Gabor Berczi <[email protected]> (lazyload additions & progressive rendering) |
|
7 | + * @link https://github.com/pradosoft/prado |
|
8 | + * @copyright Copyright © 2005-2016 The PRADO Group |
|
9 | + * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
10 | + * @package System.Web.UI.ActiveControls |
|
11 | + */ |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Load callback response adapter class. |
@@ -99,6 +99,7 @@ |
||
99 | 99 | * Calls the client-side static method for this control class. |
100 | 100 | * @param string static method name |
101 | 101 | * @param mixed method parmaeter |
102 | + * @param string $func |
|
102 | 103 | */ |
103 | 104 | protected function callClientFunction($func,$value) |
104 | 105 | { |
@@ -80,12 +80,12 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function setReadOnly($value) |
82 | 82 | { |
83 | - if(parent::getReadOnly() === $value) |
|
83 | + if(parent::getReadOnly()===$value) |
|
84 | 84 | return; |
85 | 85 | |
86 | 86 | parent::setReadOnly($value); |
87 | - $value = $this->getReadOnly(); |
|
88 | - $this->callClientFunction('setReadOnly',$value); |
|
87 | + $value=$this->getReadOnly(); |
|
88 | + $this->callClientFunction('setReadOnly', $value); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -93,12 +93,12 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function setRating($value) |
95 | 95 | { |
96 | - if(parent::getRating() === $value) |
|
96 | + if(parent::getRating()===$value) |
|
97 | 97 | return; |
98 | 98 | |
99 | 99 | parent::setRating($value); |
100 | - $value = $this->getRating(); |
|
101 | - $this->callClientFunction('setRating',$value); |
|
100 | + $value=$this->getRating(); |
|
101 | + $this->callClientFunction('setRating', $value); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -106,13 +106,13 @@ discard block |
||
106 | 106 | * @param string static method name |
107 | 107 | * @param mixed method parmaeter |
108 | 108 | */ |
109 | - protected function callClientFunction($func,$value) |
|
109 | + protected function callClientFunction($func, $value) |
|
110 | 110 | { |
111 | 111 | if($this->getActiveControl()->canUpdateClientSide()) |
112 | 112 | { |
113 | - $client = $this->getPage()->getCallbackClient(); |
|
114 | - $code = 'Prado.Registry[\''.$this->ClientID.'\'].'.$func.'('.$value.')'; |
|
115 | - $client->evaluateScript($code,array($value)); |
|
113 | + $client=$this->getPage()->getCallbackClient(); |
|
114 | + $code='Prado.Registry[\''.$this->ClientID.'\'].'.$func.'('.$value.')'; |
|
115 | + $client->evaluateScript($code, array($value)); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
@@ -121,12 +121,12 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function setCaption($value) |
123 | 123 | { |
124 | - if(parent::getCaption() === $value) |
|
124 | + if(parent::getCaption()===$value) |
|
125 | 125 | return; |
126 | 126 | |
127 | 127 | parent::setCaption($value); |
128 | 128 | // if it's an active control, this should not be needed. |
129 | - $this->callClientFunction('setCaption',$value); |
|
129 | + $this->callClientFunction('setCaption', $value); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -111,6 +111,7 @@ discard block |
||
111 | 111 | * method, be sure to call the parent implementation so that the event |
112 | 112 | * handler can be invoked. |
113 | 113 | * @param TActiveTableCellEventParameter event parameter to be passed to the event handlers |
114 | + * @param TActiveTableCellEventParameter $param |
|
114 | 115 | */ |
115 | 116 | public function onCellSelected($param) |
116 | 117 | { |
@@ -232,6 +233,7 @@ discard block |
||
232 | 233 | |
233 | 234 | /** |
234 | 235 | * Creates a new TActiveTableRowEventParameter. |
236 | + * @param THttpResponse $response |
|
235 | 237 | */ |
236 | 238 | public function __construct($response, $parameter, $index=-1) |
237 | 239 | { |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | { |
54 | 54 | |
55 | 55 | /** |
56 | - * @var TTable parent row control containing the cell |
|
57 | - */ |
|
56 | + * @var TTable parent row control containing the cell |
|
57 | + */ |
|
58 | 58 | private $_row; |
59 | 59 | |
60 | 60 | /** |
@@ -226,8 +226,8 @@ discard block |
||
226 | 226 | { |
227 | 227 | |
228 | 228 | /** |
229 | - * @var integer the zero-based index of the cell. |
|
230 | - */ |
|
229 | + * @var integer the zero-based index of the cell. |
|
230 | + */ |
|
231 | 231 | private $_selectedCellIndex = -1; |
232 | 232 | |
233 | 233 | /** |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function raiseCallbackEvent($param) |
102 | 102 | { |
103 | - $parameter = new TActiveTableCellEventParameter($this->getResponse(), $param->getCallbackParameter(), $this->getCellIndex()); |
|
103 | + $parameter=new TActiveTableCellEventParameter($this->getResponse(), $param->getCallbackParameter(), $this->getCellIndex()); |
|
104 | 104 | $this->onCellSelected($parameter); |
105 | 105 | $this->raiseBubbleEvent($this, $parameter); |
106 | 106 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | { |
128 | 128 | parent::addAttributesToRender($writer); |
129 | 129 | $writer->addAttribute('id', $this->getClientID()); |
130 | - if ($this->hasEventHandler('OnCellSelected')) |
|
130 | + if($this->hasEventHandler('OnCellSelected')) |
|
131 | 131 | $this->getActiveControl()->registerCallbackClientScript($this->getClientClassName(), $this->getPostBackOptions()); |
132 | 132 | } |
133 | 133 | |
@@ -140,19 +140,19 @@ discard block |
||
140 | 140 | */ |
141 | 141 | public function render($writer) |
142 | 142 | { |
143 | - if ($this->getHasPreRendered()) |
|
143 | + if($this->getHasPreRendered()) |
|
144 | 144 | { |
145 | 145 | parent::render($writer); |
146 | - if ($this->getActiveControl()->canUpdateClientSide()) |
|
146 | + if($this->getActiveControl()->canUpdateClientSide()) |
|
147 | 147 | $this->getPage()->getCallbackClient()->replaceContent($this, $writer); |
148 | 148 | } |
149 | 149 | else { |
150 | 150 | $this->getPage()->getAdapter()->registerControlToRender($this, $writer); |
151 | 151 | // If we update a TActiveTableCell on callback, we shouldn't update all childs, |
152 | 152 | // because the whole content will be replaced by the parent. |
153 | - if ($this->getHasControls()) |
|
153 | + if($this->getHasControls()) |
|
154 | 154 | { |
155 | - foreach ($this->findControlsByType('IActiveControl', false) as $control) |
|
155 | + foreach($this->findControlsByType('IActiveControl', false) as $control) |
|
156 | 156 | $control->getActiveControl()->setEnableUpdate(false); |
157 | 157 | } |
158 | 158 | } |
@@ -165,8 +165,8 @@ discard block |
||
165 | 165 | */ |
166 | 166 | protected function getPostBackOptions() |
167 | 167 | { |
168 | - $options['ID'] = $this->getClientID(); |
|
169 | - $options['EventTarget'] = $this->getUniqueID(); |
|
168 | + $options['ID']=$this->getClientID(); |
|
169 | + $options['EventTarget']=$this->getUniqueID(); |
|
170 | 170 | return $options; |
171 | 171 | } |
172 | 172 | |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function getCellIndex() |
180 | 180 | { |
181 | - foreach ($this->getRow()->getCells() as $key => $row) |
|
182 | - if ($row == $this) return $key; |
|
181 | + foreach($this->getRow()->getCells() as $key => $row) |
|
182 | + if($row==$this) return $key; |
|
183 | 183 | throw new TConfigurationException('tactivetablecell_control_notincollection', get_class($this), $this->getUniqueID()); |
184 | 184 | } |
185 | 185 | |
@@ -190,14 +190,14 @@ discard block |
||
190 | 190 | */ |
191 | 191 | public function getRow() |
192 | 192 | { |
193 | - if ($this->_row === null) |
|
193 | + if($this->_row===null) |
|
194 | 194 | { |
195 | - $row = $this->getParent(); |
|
196 | - while (!($row instanceof TTableRow) && $row !== null) |
|
195 | + $row=$this->getParent(); |
|
196 | + while(!($row instanceof TTableRow) && $row!==null) |
|
197 | 197 | { |
198 | - $row = $row->getParent(); |
|
198 | + $row=$row->getParent(); |
|
199 | 199 | } |
200 | - if ($row instanceof TTableRow) $this->_row = $row; |
|
200 | + if($row instanceof TTableRow) $this->_row=$row; |
|
201 | 201 | else throw new TConfigurationException('tactivetablecell_control_outoftable', get_class($this), $this->getUniqueID()); |
202 | 202 | } |
203 | 203 | return $this->_row; |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | /** |
229 | 229 | * @var integer the zero-based index of the cell. |
230 | 230 | */ |
231 | - private $_selectedCellIndex = -1; |
|
231 | + private $_selectedCellIndex=-1; |
|
232 | 232 | |
233 | 233 | /** |
234 | 234 | * Creates a new TActiveTableRowEventParameter. |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | public function __construct($response, $parameter, $index=-1) |
237 | 237 | { |
238 | 238 | parent::__construct($response, $parameter); |
239 | - $this->_selectedCellIndex = $index; |
|
239 | + $this->_selectedCellIndex=$index; |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
@@ -95,8 +95,7 @@ |
||
95 | 95 | if($this->getHasPreRendered()) { |
96 | 96 | $this->renderRepeater($writer); |
97 | 97 | if($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getSurroundingTagId(),$writer); |
98 | - } |
|
99 | - else { |
|
98 | + } else { |
|
100 | 99 | $this->getPage()->getAdapter()->registerControlToRender($this,$writer); |
101 | 100 | } |
102 | 101 | } |
@@ -98,6 +98,7 @@ discard block |
||
98 | 98 | * TActiveTableRow. |
99 | 99 | * This method is mainly used by framework and control developers. |
100 | 100 | * @param TCallbackEventParameter the event parameter |
101 | + * @param TActiveTableCellEventParameter $param |
|
101 | 102 | */ |
102 | 103 | public function raiseCallbackEvent($param) |
103 | 104 | { |
@@ -129,6 +130,7 @@ discard block |
||
129 | 130 | * method, be sure to call the parent implementation so that the event |
130 | 131 | * handler can be invoked. |
131 | 132 | * @param TActiveTableRowEventParameter event parameter to be passed to the event handlers |
133 | + * @param TActiveTableRowEventParameter $param |
|
132 | 134 | */ |
133 | 135 | public function onRowSelected($param) |
134 | 136 | { |
@@ -250,6 +252,7 @@ discard block |
||
250 | 252 | |
251 | 253 | /** |
252 | 254 | * Creates a new TActiveTableRowEventParameter. |
255 | + * @param THttpResponse $response |
|
253 | 256 | */ |
254 | 257 | public function __construct($response, $parameter, $index=-1) |
255 | 258 | { |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function raiseCallbackEvent($param) |
103 | 103 | { |
104 | - $parameter = new TActiveTableRowEventParameter($this->getResponse(), $param->getCallbackParameter(), $this->getRowIndex()); |
|
104 | + $parameter=new TActiveTableRowEventParameter($this->getResponse(), $param->getCallbackParameter(), $this->getRowIndex()); |
|
105 | 105 | $this->onRowSelected($parameter); |
106 | 106 | } |
107 | 107 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function bubbleEvent($sender, $param) |
117 | 117 | { |
118 | - if ($param instanceof TActiveTableCellEventParameter) |
|
118 | + if($param instanceof TActiveTableCellEventParameter) |
|
119 | 119 | { |
120 | 120 | $this->raiseCallbackEvent($param); |
121 | 121 | return true; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | { |
146 | 146 | parent::addAttributesToRender($writer); |
147 | 147 | $writer->addAttribute('id', $this->getClientID()); |
148 | - if ($this->hasEventHandler('OnRowSelected')) |
|
148 | + if($this->hasEventHandler('OnRowSelected')) |
|
149 | 149 | $this->getActiveControl()->registerCallbackClientScript($this->getClientClassName(), $this->getPostBackOptions()); |
150 | 150 | } |
151 | 151 | |
@@ -158,10 +158,10 @@ discard block |
||
158 | 158 | */ |
159 | 159 | public function render($writer) |
160 | 160 | { |
161 | - if ($this->getHasPreRendered()) |
|
161 | + if($this->getHasPreRendered()) |
|
162 | 162 | { |
163 | 163 | parent::render($writer); |
164 | - if ($this->getActiveControl()->canUpdateClientSide()) |
|
164 | + if($this->getActiveControl()->canUpdateClientSide()) |
|
165 | 165 | $this->getPage()->getCallbackClient()->replaceContent($this, $writer); |
166 | 166 | } |
167 | 167 | else |
@@ -169,9 +169,9 @@ discard block |
||
169 | 169 | $this->getPage()->getAdapter()->registerControlToRender($this, $writer); |
170 | 170 | // If we update a TActiveTableRow on callback, we shouldn't update all childs, |
171 | 171 | // because the whole content will be replaced by the parent. |
172 | - if ($this->getHasControls()) |
|
172 | + if($this->getHasControls()) |
|
173 | 173 | { |
174 | - foreach ($this->findControlsByType('IActiveControl', false) as $control) |
|
174 | + foreach($this->findControlsByType('IActiveControl', false) as $control) |
|
175 | 175 | $control->getActiveControl()->setEnableUpdate(false); |
176 | 176 | } |
177 | 177 | } |
@@ -184,8 +184,8 @@ discard block |
||
184 | 184 | */ |
185 | 185 | protected function getPostBackOptions() |
186 | 186 | { |
187 | - $options['ID'] = $this->getClientID(); |
|
188 | - $options['EventTarget'] = $this->getUniqueID(); |
|
187 | + $options['ID']=$this->getClientID(); |
|
188 | + $options['EventTarget']=$this->getUniqueID(); |
|
189 | 189 | return $options; |
190 | 190 | } |
191 | 191 | |
@@ -197,8 +197,8 @@ discard block |
||
197 | 197 | */ |
198 | 198 | public function getRowIndex() |
199 | 199 | { |
200 | - foreach ($this->getTable()->getRows() as $key => $row) |
|
201 | - if ($row == $this) return $key; |
|
200 | + foreach($this->getTable()->getRows() as $key => $row) |
|
201 | + if($row==$this) return $key; |
|
202 | 202 | throw new TConfigurationException('tactivetablerow_control_notincollection', get_class($this), $this->getUniqueID()); |
203 | 203 | } |
204 | 204 | |
@@ -209,14 +209,14 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public function getTable() |
211 | 211 | { |
212 | - if ($this->_table === null) |
|
212 | + if($this->_table===null) |
|
213 | 213 | { |
214 | - $table = $this->getParent(); |
|
215 | - while (!($table instanceof TTable) && $table !== null) |
|
214 | + $table=$this->getParent(); |
|
215 | + while(!($table instanceof TTable) && $table!==null) |
|
216 | 216 | { |
217 | - $table = $table->getParent(); |
|
217 | + $table=$table->getParent(); |
|
218 | 218 | } |
219 | - if ($table instanceof TTable) $this->_table = $table; |
|
219 | + if($table instanceof TTable) $this->_table=$table; |
|
220 | 220 | else throw new TConfigurationException('tactivetablerow_control_outoftable', get_class($this), $this->getUniqueID()); |
221 | 221 | } |
222 | 222 | return $this->_table; |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | /** |
247 | 247 | * @var integer the zero-based index of the row. |
248 | 248 | */ |
249 | - private $_selectedRowIndex = -1; |
|
249 | + private $_selectedRowIndex=-1; |
|
250 | 250 | |
251 | 251 | /** |
252 | 252 | * Creates a new TActiveTableRowEventParameter. |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | public function __construct($response, $parameter, $index=-1) |
255 | 255 | { |
256 | 256 | parent::__construct($response, $parameter); |
257 | - $this->_selectedRowIndex = $index; |
|
257 | + $this->_selectedRowIndex=$index; |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | /** |
@@ -119,8 +119,7 @@ discard block |
||
119 | 119 | { |
120 | 120 | $this->raiseCallbackEvent($param); |
121 | 121 | return true; |
122 | - } |
|
123 | - else return false; |
|
122 | + } else return false; |
|
124 | 123 | } |
125 | 124 | |
126 | 125 | /** |
@@ -163,8 +162,7 @@ discard block |
||
163 | 162 | parent::render($writer); |
164 | 163 | if ($this->getActiveControl()->canUpdateClientSide()) |
165 | 164 | $this->getPage()->getCallbackClient()->replaceContent($this, $writer); |
166 | - } |
|
167 | - else |
|
165 | + } else |
|
168 | 166 | { |
169 | 167 | $this->getPage()->getAdapter()->registerControlToRender($this, $writer); |
170 | 168 | // If we update a TActiveTableRow on callback, we shouldn't update all childs, |
@@ -1,14 +1,14 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * TActiveTableRow and TActiveTableRowEventParameter class file |
|
4 | - * |
|
5 | - * @author LANDWEHR Computer und Software GmbH <[email protected]> |
|
6 | - * @link http://www.landwehr-software.de/ |
|
7 | - * @copyright Copyright © 2009 LANDWEHR Computer und Software GmbH |
|
8 | - * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
9 | - * @package System.Web.UI.ActiveControls |
|
10 | - * @version $Id$ |
|
11 | - */ |
|
3 | + * TActiveTableRow and TActiveTableRowEventParameter class file |
|
4 | + * |
|
5 | + * @author LANDWEHR Computer und Software GmbH <[email protected]> |
|
6 | + * @link http://www.landwehr-software.de/ |
|
7 | + * @copyright Copyright © 2009 LANDWEHR Computer und Software GmbH |
|
8 | + * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
9 | + * @package System.Web.UI.ActiveControls |
|
10 | + * @version $Id$ |
|
11 | + */ |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Includes the following used classes |
@@ -244,8 +244,8 @@ discard block |
||
244 | 244 | class TActiveTableRowEventParameter extends TCallbackEventParameter |
245 | 245 | { |
246 | 246 | /** |
247 | - * @var integer the zero-based index of the row. |
|
248 | - */ |
|
247 | + * @var integer the zero-based index of the row. |
|
248 | + */ |
|
249 | 249 | private $_selectedRowIndex = -1; |
250 | 250 | |
251 | 251 | /** |
@@ -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; |
@@ -174,14 +174,12 @@ |
||
174 | 174 | { |
175 | 175 | $parameter = new TAutoCompleteEventParameter($this->getResponse(), $token[0]); |
176 | 176 | $this->onSuggest($parameter); |
177 | - } |
|
178 | - else if($token[1] === '__TAutoComplete_onSuggestionSelected__') |
|
177 | + } else if($token[1] === '__TAutoComplete_onSuggestionSelected__') |
|
179 | 178 | { |
180 | 179 | $parameter = new TAutoCompleteEventParameter($this->getResponse(), null, $token[0]); |
181 | 180 | $this->onSuggestionSelected($parameter); |
182 | 181 | } |
183 | - } |
|
184 | - else if($this->getAutoPostBack()) |
|
182 | + } else if($this->getAutoPostBack()) |
|
185 | 183 | parent::raiseCallbackEvent($param); |
186 | 184 | } |
187 | 185 |
@@ -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 | /** |
@@ -167,17 +167,17 @@ discard block |
||
167 | 167 | */ |
168 | 168 | public function raiseCallbackEvent($param) |
169 | 169 | { |
170 | - $token = $param->getCallbackParameter(); |
|
171 | - if(is_array($token) && count($token) == 2) |
|
170 | + $token=$param->getCallbackParameter(); |
|
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 | - $parameter = new TAutoCompleteEventParameter($this->getResponse(), $token[0]); |
|
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 | - $parameter = new TAutoCompleteEventParameter($this->getResponse(), null, $token[0]); |
|
180 | + $parameter=new TAutoCompleteEventParameter($this->getResponse(), null, $token[0]); |
|
181 | 181 | $this->onSuggestionSelected($parameter); |
182 | 182 | } |
183 | 183 | } |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | public function getResultPanel() |
235 | 235 | { |
236 | 236 | if($this->_resultPanel===null) |
237 | - $this->_resultPanel = $this->createResultPanel(); |
|
237 | + $this->_resultPanel=$this->createResultPanel(); |
|
238 | 238 | return $this->_resultPanel; |
239 | 239 | } |
240 | 240 | |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | */ |
244 | 244 | protected function createResultPanel() |
245 | 245 | { |
246 | - $panel = Prado::createComponent('System.Web.UI.WebControls.TPanel'); |
|
246 | + $panel=Prado::createComponent('System.Web.UI.WebControls.TPanel'); |
|
247 | 247 | $this->getControls()->add($panel); |
248 | 248 | $panel->setID('result'); |
249 | 249 | return $panel; |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | public function getSuggestions() |
256 | 256 | { |
257 | 257 | if($this->_repeater===null) |
258 | - $this->_repeater = $this->createRepeater(); |
|
258 | + $this->_repeater=$this->createRepeater(); |
|
259 | 259 | return $this->_repeater; |
260 | 260 | } |
261 | 261 | |
@@ -264,10 +264,10 @@ discard block |
||
264 | 264 | */ |
265 | 265 | protected function createRepeater() |
266 | 266 | { |
267 | - $repeater = Prado::createComponent('System.Web.UI.WebControls.TRepeater'); |
|
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; |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | if($this->getActiveControl()->canUpdateClientSide()) |
312 | 312 | { |
313 | 313 | $this->getSuggestions()->render($writer); |
314 | - $boundary = $writer->getWriter()->getBoundary(); |
|
314 | + $boundary=$writer->getWriter()->getBoundary(); |
|
315 | 315 | $this->getResponse()->getAdapter()->setResponseData($boundary); |
316 | 316 | } |
317 | 317 | } |
@@ -323,29 +323,29 @@ discard block |
||
323 | 323 | { |
324 | 324 | //disallow page state update ? |
325 | 325 | //$this->getActiveControl()->getClientSide()->setEnablePageStateUpdate(false); |
326 | - $options = array(); |
|
327 | - if(strlen($string = $this->getSeparator())) |
|
326 | + $options=array(); |
|
327 | + if(strlen($string=$this->getSeparator())) |
|
328 | 328 | { |
329 | - $string = strtr($string,array('\t'=>"\t",'\n'=>"\n",'\r'=>"\r")); |
|
330 | - $token = preg_split('//', $string, -1, PREG_SPLIT_NO_EMPTY); |
|
331 | - $options['tokens'] = $token; |
|
329 | + $string=strtr($string, array('\t'=>"\t", '\n'=>"\n", '\r'=>"\r")); |
|
330 | + $token=preg_split('//', $string, -1, PREG_SPLIT_NO_EMPTY); |
|
331 | + $options['tokens']=$token; |
|
332 | 332 | } |
333 | 333 | if($this->getAutoPostBack()) |
334 | 334 | { |
335 | - $options = array_merge($options,parent::getPostBackOptions()); |
|
336 | - $options['AutoPostBack'] = true; |
|
335 | + $options=array_merge($options, parent::getPostBackOptions()); |
|
336 | + $options['AutoPostBack']=true; |
|
337 | 337 | } |
338 | - if(strlen($select = $this->getTextCssClass())) |
|
339 | - $options['select'] = $select; |
|
340 | - $options['ResultPanel'] = $this->getResultPanel()->getClientID(); |
|
341 | - $options['ID'] = $this->getClientID(); |
|
342 | - $options['EventTarget'] = $this->getUniqueID(); |
|
338 | + if(strlen($select=$this->getTextCssClass())) |
|
339 | + $options['select']=$select; |
|
340 | + $options['ResultPanel']=$this->getResultPanel()->getClientID(); |
|
341 | + $options['ID']=$this->getClientID(); |
|
342 | + $options['EventTarget']=$this->getUniqueID(); |
|
343 | 343 | if(($minchars=$this->getMinChars())!=='') |
344 | - $options['minChars'] = $minchars; |
|
344 | + $options['minChars']=$minchars; |
|
345 | 345 | if(($frequency=$this->getFrequency())!=='') |
346 | - $options['frequency'] = $frequency; |
|
347 | - $options['CausesValidation'] = $this->getCausesValidation(); |
|
348 | - $options['ValidationGroup'] = $this->getValidationGroup(); |
|
346 | + $options['frequency']=$frequency; |
|
347 | + $options['CausesValidation']=$this->getCausesValidation(); |
|
348 | + $options['ValidationGroup']=$this->getValidationGroup(); |
|
349 | 349 | return $options; |
350 | 350 | } |
351 | 351 | |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | |
424 | 424 | public function __construct($template) |
425 | 425 | { |
426 | - $this->_template = $template; |
|
426 | + $this->_template=$template; |
|
427 | 427 | } |
428 | 428 | /** |
429 | 429 | * Instantiates the template. |