@@ -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 | { |
@@ -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 | |
@@ -139,9 +139,9 @@ discard block |
||
| 139 | 139 | if(!$this->_started) |
| 140 | 140 | { |
| 141 | 141 | if($this->_customStorage) |
| 142 | - session_set_save_handler(array($this,'_open'),array($this,'_close'),array($this,'_read'),array($this,'_write'),array($this,'_destroy'),array($this,'_gc')); |
|
| 142 | + session_set_save_handler(array($this, '_open'), array($this, '_close'), array($this, '_read'), array($this, '_write'), array($this, '_destroy'), array($this, '_gc')); |
|
| 143 | 143 | if($this->_cookie!==null) |
| 144 | - session_set_cookie_params($this->_cookie->getExpire(),$this->_cookie->getPath(),$this->_cookie->getDomain(),$this->_cookie->getSecure(),$this->_cookie->getHttpOnly()); |
|
| 144 | + session_set_cookie_params($this->_cookie->getExpire(), $this->_cookie->getPath(), $this->_cookie->getDomain(), $this->_cookie->getSecure(), $this->_cookie->getHttpOnly()); |
|
| 145 | 145 | if(ini_get('session.auto_start')!=='1') |
| 146 | 146 | session_start(); |
| 147 | 147 | $this->_started=true; |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | */ |
| 182 | 182 | public function regenerate($deleteOld=false) |
| 183 | 183 | { |
| 184 | - $old = $this->getSessionID(); |
|
| 184 | + $old=$this->getSessionID(); |
|
| 185 | 185 | session_regenerate_id($deleteOld); |
| 186 | 186 | return $old; |
| 187 | 187 | } |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | else if(ctype_alnum($value)) |
| 234 | 234 | session_name($value); |
| 235 | 235 | else |
| 236 | - throw new TInvalidDataValueException('httpsession_sessionname_invalid',$value); |
|
| 236 | + throw new TInvalidDataValueException('httpsession_sessionname_invalid', $value); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | /** |
@@ -254,10 +254,10 @@ discard block |
||
| 254 | 254 | throw new TInvalidOperationException('httpsession_savepath_unchangeable'); |
| 255 | 255 | elseif(is_dir($value)) |
| 256 | 256 | session_save_path(realpath($value)); |
| 257 | - elseif(null !== ($ns = Prado::getPathOfNamespace($value)) && is_dir($ns)) |
|
| 257 | + elseif(null!==($ns=Prado::getPathOfNamespace($value)) && is_dir($ns)) |
|
| 258 | 258 | session_save_path(realpath($ns)); |
| 259 | 259 | else |
| 260 | - throw new TInvalidDataValueException('httpsession_savepath_invalid',$value); |
|
| 260 | + throw new TInvalidDataValueException('httpsession_savepath_invalid', $value); |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | /** |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | public function getCookie() |
| 286 | 286 | { |
| 287 | 287 | if($this->_cookie===null) |
| 288 | - $this->_cookie=new THttpCookie($this->getSessionName(),$this->getSessionID()); |
|
| 288 | + $this->_cookie=new THttpCookie($this->getSessionName(), $this->getSessionID()); |
|
| 289 | 289 | return $this->_cookie; |
| 290 | 290 | } |
| 291 | 291 | |
@@ -312,21 +312,21 @@ discard block |
||
| 312 | 312 | throw new TInvalidOperationException('httpsession_cookiemode_unchangeable'); |
| 313 | 313 | else |
| 314 | 314 | { |
| 315 | - $value=TPropertyValue::ensureEnum($value,'Prado\\Web\\THttpSessionCookieMode'); |
|
| 315 | + $value=TPropertyValue::ensureEnum($value, 'Prado\\Web\\THttpSessionCookieMode'); |
|
| 316 | 316 | if($value===THttpSessionCookieMode::None) |
| 317 | 317 | { |
| 318 | - ini_set('session.use_cookies','0'); |
|
| 319 | - ini_set('session.use_only_cookies','0'); |
|
| 318 | + ini_set('session.use_cookies', '0'); |
|
| 319 | + ini_set('session.use_only_cookies', '0'); |
|
| 320 | 320 | } |
| 321 | 321 | else if($value===THttpSessionCookieMode::Allow) |
| 322 | 322 | { |
| 323 | - ini_set('session.use_cookies','1'); |
|
| 324 | - ini_set('session.use_only_cookies','0'); |
|
| 323 | + ini_set('session.use_cookies', '1'); |
|
| 324 | + ini_set('session.use_only_cookies', '0'); |
|
| 325 | 325 | } |
| 326 | 326 | else |
| 327 | 327 | { |
| 328 | - ini_set('session.use_cookies','1'); |
|
| 329 | - ini_set('session.use_only_cookies','1'); |
|
| 328 | + ini_set('session.use_cookies', '1'); |
|
| 329 | + ini_set('session.use_only_cookies', '1'); |
|
| 330 | 330 | ini_set('session.use_trans_sid', 0); |
| 331 | 331 | } |
| 332 | 332 | } |
@@ -372,13 +372,13 @@ discard block |
||
| 372 | 372 | else |
| 373 | 373 | { |
| 374 | 374 | $value=TPropertyValue::ensureInteger($value); |
| 375 | - if($value>=0 && $value<=100) |
|
| 375 | + if($value >= 0 && $value <= 100) |
|
| 376 | 376 | { |
| 377 | - ini_set('session.gc_probability',$value); |
|
| 378 | - ini_set('session.gc_divisor','100'); |
|
| 377 | + ini_set('session.gc_probability', $value); |
|
| 378 | + ini_set('session.gc_divisor', '100'); |
|
| 379 | 379 | } |
| 380 | 380 | else |
| 381 | - throw new TInvalidDataValueException('httpsession_gcprobability_invalid',$value); |
|
| 381 | + throw new TInvalidDataValueException('httpsession_gcprobability_invalid', $value); |
|
| 382 | 382 | } |
| 383 | 383 | } |
| 384 | 384 | |
@@ -400,9 +400,9 @@ discard block |
||
| 400 | 400 | else |
| 401 | 401 | { |
| 402 | 402 | $value=TPropertyValue::ensureBoolean($value); |
| 403 | - if ($value && $this->getCookieMode()==THttpSessionCookieMode::Only) |
|
| 403 | + if($value && $this->getCookieMode()==THttpSessionCookieMode::Only) |
|
| 404 | 404 | throw new TInvalidOperationException('httpsession_transid_cookieonly'); |
| 405 | - ini_set('session.use_trans_sid',$value?'1':'0'); |
|
| 405 | + ini_set('session.use_trans_sid', $value ? '1' : '0'); |
|
| 406 | 406 | } |
| 407 | 407 | } |
| 408 | 408 | |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | if($this->_started) |
| 424 | 424 | throw new TInvalidOperationException('httpsession_maxlifetime_unchangeable'); |
| 425 | 425 | else |
| 426 | - ini_set('session.gc_maxlifetime',$value); |
|
| 426 | + ini_set('session.gc_maxlifetime', $value); |
|
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | /** |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | * @param string session name |
| 434 | 434 | * @return boolean whether session is opened successfully |
| 435 | 435 | */ |
| 436 | - public function _open($savePath,$sessionName) |
|
| 436 | + public function _open($savePath, $sessionName) |
|
| 437 | 437 | { |
| 438 | 438 | return true; |
| 439 | 439 | } |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | * @param string session data |
| 467 | 467 | * @return boolean whether session write is successful |
| 468 | 468 | */ |
| 469 | - public function _write($id,$data) |
|
| 469 | + public function _write($id, $data) |
|
| 470 | 470 | { |
| 471 | 471 | return true; |
| 472 | 472 | } |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | * @param mixed session variable name |
| 549 | 549 | * @param mixed session variable value |
| 550 | 550 | */ |
| 551 | - public function add($key,$value) |
|
| 551 | + public function add($key, $value) |
|
| 552 | 552 | { |
| 553 | 553 | $_SESSION[$key]=$value; |
| 554 | 554 | } |
@@ -621,7 +621,7 @@ discard block |
||
| 621 | 621 | * @param integer the offset to set element |
| 622 | 622 | * @param mixed the element value |
| 623 | 623 | */ |
| 624 | - public function offsetSet($offset,$item) |
|
| 624 | + public function offsetSet($offset, $item) |
|
| 625 | 625 | { |
| 626 | 626 | $_SESSION[$offset]=$item; |
| 627 | 627 | } |
@@ -314,10 +314,10 @@ |
||
| 314 | 314 | { |
| 315 | 315 | $value=TPropertyValue::ensureEnum($value,'Prado\\Web\\THttpSessionCookieMode'); |
| 316 | 316 | if($value===THttpSessionCookieMode::None) |
| 317 | - { |
|
| 317 | + { |
|
| 318 | 318 | ini_set('session.use_cookies','0'); |
| 319 | 319 | ini_set('session.use_only_cookies','0'); |
| 320 | - } |
|
| 320 | + } |
|
| 321 | 321 | else if($value===THttpSessionCookieMode::Allow) |
| 322 | 322 | { |
| 323 | 323 | ini_set('session.use_cookies','1'); |
@@ -175,6 +175,7 @@ |
||
| 175 | 175 | |
| 176 | 176 | /** |
| 177 | 177 | * @param string state tracker class. |
| 178 | + * @param string $value |
|
| 178 | 179 | */ |
| 179 | 180 | public function setStateTracker($value) |
| 180 | 181 | { |
@@ -78,8 +78,8 @@ |
||
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | - * Publish the ajax script |
|
| 82 | - */ |
|
| 81 | + * Publish the ajax script |
|
| 82 | + */ |
|
| 83 | 83 | public function onPreRender($param) |
| 84 | 84 | { |
| 85 | 85 | parent::onPreRender($param); |
@@ -73,12 +73,12 @@ discard block |
||
| 73 | 73 | if($type===null) |
| 74 | 74 | { |
| 75 | 75 | if($this->getControl() instanceof ICallbackEventHandler) |
| 76 | - $this->_activeControlType = 'Prado\\Web\UI\\ActiveControls\\TBaseActiveCallbackControl'; |
|
| 76 | + $this->_activeControlType='Prado\\Web\UI\\ActiveControls\\TBaseActiveCallbackControl'; |
|
| 77 | 77 | else |
| 78 | - $this->_activeControlType = 'Prado\\Web\UI\\ActiveControls\\TBaseActiveControl'; |
|
| 78 | + $this->_activeControlType='Prado\\Web\UI\\ActiveControls\\TBaseActiveControl'; |
|
| 79 | 79 | } |
| 80 | 80 | else |
| 81 | - $this->_activeControlType = $type; |
|
| 81 | + $this->_activeControlType=$type; |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -118,8 +118,8 @@ discard block |
||
| 118 | 118 | { |
| 119 | 119 | if($this->_baseActiveControl===null) |
| 120 | 120 | { |
| 121 | - $type = $this->_activeControlType; |
|
| 122 | - $this->_baseActiveControl = new $type($this->getControl()); |
|
| 121 | + $type=$this->_activeControlType; |
|
| 122 | + $this->_baseActiveControl=new $type($this->getControl()); |
|
| 123 | 123 | } |
| 124 | 124 | return $this->_baseActiveControl; |
| 125 | 125 | } |
@@ -131,10 +131,10 @@ discard block |
||
| 131 | 131 | { |
| 132 | 132 | if($this->getPage()->getIsCallback()) |
| 133 | 133 | { |
| 134 | - $target = $this->getPage()->getCallbackEventTarget(); |
|
| 134 | + $target=$this->getPage()->getCallbackEventTarget(); |
|
| 135 | 135 | if($target instanceof ICallbackEventHandler) |
| 136 | 136 | { |
| 137 | - $client = $target->getActiveControl()->getClientSide(); |
|
| 137 | + $client=$target->getActiveControl()->getClientSide(); |
|
| 138 | 138 | return $client->getEnablePageStateUpdate(); |
| 139 | 139 | } |
| 140 | 140 | } |
@@ -148,8 +148,8 @@ discard block |
||
| 148 | 148 | { |
| 149 | 149 | if($this->getIsTrackingPageState()) |
| 150 | 150 | { |
| 151 | - $stateTrackerClass = $this->_stateTrackerClass; |
|
| 152 | - $this->_stateTracker = new $stateTrackerClass($this->getControl()); |
|
| 151 | + $stateTrackerClass=$this->_stateTrackerClass; |
|
| 152 | + $this->_stateTracker=new $stateTrackerClass($this->getControl()); |
|
| 153 | 153 | $this->_stateTracker->trackChanges(); |
| 154 | 154 | } |
| 155 | 155 | parent::onLoad($param); |
@@ -182,6 +182,6 @@ discard block |
||
| 182 | 182 | */ |
| 183 | 183 | public function setStateTracker($value) |
| 184 | 184 | { |
| 185 | - $this->_stateTrackerClass = TPropertyValue::ensureString($value); |
|
| 185 | + $this->_stateTrackerClass=TPropertyValue::ensureString($value); |
|
| 186 | 186 | } |
| 187 | 187 | } |
@@ -76,8 +76,7 @@ |
||
| 76 | 76 | $this->_activeControlType = 'Prado\\Web\UI\\ActiveControls\\TBaseActiveCallbackControl'; |
| 77 | 77 | else |
| 78 | 78 | $this->_activeControlType = 'Prado\\Web\UI\\ActiveControls\\TBaseActiveControl'; |
| 79 | - } |
|
| 80 | - else |
|
| 79 | + } else |
|
| 81 | 80 | $this->_activeControlType = $type; |
| 82 | 81 | } |
| 83 | 82 | |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | /** |
| 67 | 67 | * No client class for this control. |
| 68 | 68 | * This method overrides the parent implementation. |
| 69 | - * @return null no javascript class name. |
|
| 69 | + * @return string no javascript class name. |
|
| 70 | 70 | */ |
| 71 | 71 | protected function getClientClassName() |
| 72 | 72 | { |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | protected function createListItemCollection() |
| 84 | 84 | { |
| 85 | - $collection = new TActiveListItemCollection; |
|
| 85 | + $collection=new TActiveListItemCollection; |
|
| 86 | 86 | $collection->setControl($this); |
| 87 | 87 | return $collection; |
| 88 | 88 | } |
@@ -102,8 +102,8 @@ discard block |
||
| 102 | 102 | protected function addAttributesToRender($writer) |
| 103 | 103 | { |
| 104 | 104 | parent::addAttributesToRender($writer); |
| 105 | - $writer->addAttribute('id',$this->getClientID()); |
|
| 106 | - if ($this->getAutoPostBack()) |
|
| 105 | + $writer->addAttribute('id', $this->getClientID()); |
|
| 106 | + if($this->getAutoPostBack()) |
|
| 107 | 107 | $this->getActiveControl()->registerCallbackClientScript( |
| 108 | 108 | $this->getClientClassName(), $this->getPostBackOptions()); |
| 109 | 109 | } |
@@ -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 | } |
@@ -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 | /** |
@@ -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 | { |
@@ -74,10 +74,10 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public function setDisplayTextBox($value) |
| 76 | 76 | { |
| 77 | - $value = TPropertyValue::ensureBoolean($value); |
|
| 78 | - $this->setViewState('DisplayTextBox', $value,false); |
|
| 77 | + $value=TPropertyValue::ensureBoolean($value); |
|
| 78 | + $this->setViewState('DisplayTextBox', $value, false); |
|
| 79 | 79 | if($this->getActiveControl()->canUpdateClientSide()) |
| 80 | - $this->callClientFunction('setDisplayTextBox',$value); |
|
| 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 | - $client = $this->getPage()->getCallbackClient(); |
|
| 99 | - $code = $this->getClientClassName().'.'.$func; |
|
| 100 | - $client->callClientFunction($code,array($this,$value)); |
|
| 98 | + $client=$this->getPage()->getCallbackClient(); |
|
| 99 | + $code=$this->getClientClassName().'.'.$func; |
|
| 100 | + $client->callClientFunction($code, array($this, $value)); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -121,9 +121,9 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | protected function getExternalControlID() |
| 123 | 123 | { |
| 124 | - $extID = $this->getEditTriggerControlID(); |
|
| 124 | + $extID=$this->getEditTriggerControlID(); |
|
| 125 | 125 | if($extID===null) return ''; |
| 126 | - if(($control = $this->findControl($extID))!==null) |
|
| 126 | + if(($control=$this->findControl($extID))!==null) |
|
| 127 | 127 | return $control->getClientID(); |
| 128 | 128 | return $extID; |
| 129 | 129 | } |
@@ -135,13 +135,13 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | public function setText($value) |
| 137 | 137 | { |
| 138 | - if(TTextBox::getText() === $value) |
|
| 138 | + if(TTextBox::getText()===$value) |
|
| 139 | 139 | return; |
| 140 | 140 | |
| 141 | 141 | TTextBox::setText($value); |
| 142 | 142 | if($this->getActiveControl()->canUpdateClientSide()) |
| 143 | 143 | { |
| 144 | - $client = $this->getPage()->getCallbackClient(); |
|
| 144 | + $client=$this->getPage()->getCallbackClient(); |
|
| 145 | 145 | $client->update($this->getLabelClientID(), $value); |
| 146 | 146 | $client->setValue($this, $value); |
| 147 | 147 | } |
@@ -152,14 +152,14 @@ discard block |
||
| 152 | 152 | * @param boolean value |
| 153 | 153 | * @since 3.1.2 |
| 154 | 154 | */ |
| 155 | - public function setReadOnly ($value) |
|
| 155 | + public function setReadOnly($value) |
|
| 156 | 156 | { |
| 157 | 157 | $value=TPropertyValue::ensureBoolean($value); |
| 158 | - if(TTextBox::getReadOnly() === $value) |
|
| 158 | + if(TTextBox::getReadOnly()===$value) |
|
| 159 | 159 | return; |
| 160 | 160 | |
| 161 | 161 | TTextBox::setReadOnly($value); |
| 162 | - if ($this->getActiveControl()->canUpdateClientSide()) |
|
| 162 | + if($this->getActiveControl()->canUpdateClientSide()) |
|
| 163 | 163 | { |
| 164 | 164 | $this->callClientFunction('setReadOnly', $value); |
| 165 | 165 | } |
@@ -202,10 +202,10 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | public function onCallback($param) |
| 204 | 204 | { |
| 205 | - $action = $param->getCallbackParameter(); |
|
| 206 | - if(is_array($action) && $action[0] === '__InlineEditor_loadExternalText__') |
|
| 205 | + $action=$param->getCallbackParameter(); |
|
| 206 | + if(is_array($action) && $action[0]==='__InlineEditor_loadExternalText__') |
|
| 207 | 207 | { |
| 208 | - $parameter = new TCallbackEventParameter($this->getResponse(), $action[1]); |
|
| 208 | + $parameter=new TCallbackEventParameter($this->getResponse(), $action[1]); |
|
| 209 | 209 | $this->onLoadingText($parameter); |
| 210 | 210 | } |
| 211 | 211 | $this->raiseEvent('OnCallback', $this, $param); |
@@ -216,26 +216,26 @@ discard block |
||
| 216 | 216 | */ |
| 217 | 217 | protected function getPostBackOptions() |
| 218 | 218 | { |
| 219 | - $options = parent::getPostBackOptions(); |
|
| 220 | - $options['ID'] = $this->getLabelClientID(); |
|
| 221 | - $options['TextBoxID'] = $this->getClientID(); |
|
| 222 | - $options['ExternalControl'] = $this->getExternalControlID(); |
|
| 223 | - $options['AutoHide'] = $this->getAutoHideTextBox() == false ? '' : true; |
|
| 224 | - $options['AutoPostBack'] = $this->getAutoPostBack() == false ? '' : true; |
|
| 225 | - $options['Columns'] = $this->getColumns(); |
|
| 219 | + $options=parent::getPostBackOptions(); |
|
| 220 | + $options['ID']=$this->getLabelClientID(); |
|
| 221 | + $options['TextBoxID']=$this->getClientID(); |
|
| 222 | + $options['ExternalControl']=$this->getExternalControlID(); |
|
| 223 | + $options['AutoHide']=$this->getAutoHideTextBox()==false ? '' : true; |
|
| 224 | + $options['AutoPostBack']=$this->getAutoPostBack()==false ? '' : true; |
|
| 225 | + $options['Columns']=$this->getColumns(); |
|
| 226 | 226 | if($this->getTextMode()==='MultiLine') |
| 227 | 227 | { |
| 228 | - $options['Rows'] = $this->getRows(); |
|
| 229 | - $options['Wrap'] = $this->getWrap()== false ? '' : true; |
|
| 228 | + $options['Rows']=$this->getRows(); |
|
| 229 | + $options['Wrap']=$this->getWrap()==false ? '' : true; |
|
| 230 | 230 | } |
| 231 | 231 | else |
| 232 | 232 | { |
| 233 | - $length = $this->getMaxLength(); |
|
| 234 | - $options['MaxLength'] = $length > 0 ? $length : ''; |
|
| 233 | + $length=$this->getMaxLength(); |
|
| 234 | + $options['MaxLength']=$length > 0 ? $length : ''; |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | if($this->hasEventHandler('OnLoadingText')) |
| 238 | - $options['LoadTextOnEdit'] = true; |
|
| 238 | + $options['LoadTextOnEdit']=true; |
|
| 239 | 239 | |
| 240 | 240 | $options['ReadOnly']=$this->getReadOnly(); |
| 241 | 241 | return $options; |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | */ |
| 249 | 249 | public function onLoadingText($param) |
| 250 | 250 | { |
| 251 | - $this->raiseEvent('OnLoadingText',$this,$param); |
|
| 251 | + $this->raiseEvent('OnLoadingText', $this, $param); |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | /** |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | { |
| 268 | 268 | //calls the TWebControl to avoid rendering other attribute normally render for a textbox. |
| 269 | 269 | TWebControl::addAttributesToRender($writer); |
| 270 | - $writer->addAttribute('id',$this->getLabelClientID()); |
|
| 270 | + $writer->addAttribute('id', $this->getLabelClientID()); |
|
| 271 | 271 | $this->getActiveControl()->registerCallbackClientScript( |
| 272 | 272 | $this->getClientClassName(), $this->getPostBackOptions()); |
| 273 | 273 | } |
@@ -233,8 +233,7 @@ |
||
| 233 | 233 | { |
| 234 | 234 | $options['Rows'] = $this->getRows(); |
| 235 | 235 | $options['Wrap'] = $this->getWrap()== false ? '' : true; |
| 236 | - } |
|
| 237 | - else |
|
| 236 | + } else |
|
| 238 | 237 | { |
| 239 | 238 | $length = $this->getMaxLength(); |
| 240 | 239 | $options['MaxLength'] = $length > 0 ? $length : ''; |
@@ -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 | { |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | protected function getTargetControl() |
| 46 | 46 | { |
| 47 | - $id = $this->getControlID(); |
|
| 47 | + $id=$this->getControlID(); |
|
| 48 | 48 | if(($control=$this->findControl($id)) instanceof TControl) |
| 49 | 49 | return $control->getClientID(); |
| 50 | 50 | if($id==='') |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | protected function getTriggerOptions() |
| 62 | 62 | { |
| 63 | - $options['ID'] = $this->getClientID(); |
|
| 64 | - $options['EventTarget'] = $this->getUniqueID(); |
|
| 65 | - $options['ControlID'] = $this->getTargetControl(); |
|
| 63 | + $options['ID']=$this->getClientID(); |
|
| 64 | + $options['EventTarget']=$this->getUniqueID(); |
|
| 65 | + $options['ControlID']=$this->getTargetControl(); |
|
| 66 | 66 | return $options; |
| 67 | 67 | } |
| 68 | 68 | } |
@@ -158,6 +158,9 @@ |
||
| 158 | 158 | $this->triggerClientMethod('close'); |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | + /** |
|
| 162 | + * @param string $method |
|
| 163 | + */ |
|
| 161 | 164 | private function triggerClientMethod($method) |
| 162 | 165 | { |
| 163 | 166 | $cs = $this->getPage()->getClientScript(); |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function getOptions() |
| 74 | 74 | { |
| 75 | - if (($options=$this->getViewState('JuiOptions'))===null) |
|
| 75 | + if(($options=$this->getViewState('JuiOptions'))===null) |
|
| 76 | 76 | { |
| 77 | 77 | $options=new TJuiControlOptions($this); |
| 78 | 78 | $this->setViewState('JuiOptions', $options); |
@@ -103,14 +103,14 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | protected function getPostBackOptions() |
| 105 | 105 | { |
| 106 | - $options = $this->getOptions()->toArray(); |
|
| 106 | + $options=$this->getOptions()->toArray(); |
|
| 107 | 107 | // always make the dialog a child of the form, or its inner inputs won't be collected |
| 108 | 108 | if(!isset($options['appendTo'])) |
| 109 | - $options['appendTo'] = 'form:first'; |
|
| 109 | + $options['appendTo']='form:first'; |
|
| 110 | 110 | |
| 111 | 111 | foreach($this->getControls() as $control) |
| 112 | 112 | if($control instanceof TJuiDialogButton) |
| 113 | - $options['buttons'][] = $control->getPostBackOptions(); |
|
| 113 | + $options['buttons'][]=$control->getPostBackOptions(); |
|
| 114 | 114 | |
| 115 | 115 | return $options; |
| 116 | 116 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | { |
| 124 | 124 | parent::addAttributesToRender($writer); |
| 125 | 125 | |
| 126 | - $writer->addAttribute('id',$this->getClientID()); |
|
| 126 | + $writer->addAttribute('id', $this->getClientID()); |
|
| 127 | 127 | $options=TJavaScript::encode($this->getPostBackOptions()); |
| 128 | 128 | $cs=$this->getPage()->getClientScript(); |
| 129 | 129 | $code="jQuery('#".$this->getWidgetID()."').".$this->getWidget()."(".$options.");"; |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | * Raises the OnCreate event |
| 145 | 145 | * @param object $params event parameters |
| 146 | 146 | */ |
| 147 | - public function onOpen ($params) |
|
| 147 | + public function onOpen($params) |
|
| 148 | 148 | { |
| 149 | 149 | $this->raiseEvent('OnOpen', $this, $params); |
| 150 | 150 | } |
@@ -167,8 +167,8 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | private function triggerClientMethod($method) |
| 169 | 169 | { |
| 170 | - $cs = $this->getPage()->getClientScript(); |
|
| 171 | - $code = "jQuery(document).ready(function() { jQuery('#".$this->getClientId()."').dialog('".$method."'); })"; |
|
| 170 | + $cs=$this->getPage()->getClientScript(); |
|
| 171 | + $code="jQuery(document).ready(function() { jQuery('#".$this->getClientId()."').dialog('".$method."'); })"; |
|
| 172 | 172 | $cs->registerEndScript(sprintf('%08X', crc32($code)), $code); |
| 173 | 173 | } |
| 174 | 174 | |
@@ -193,8 +193,7 @@ |
||
| 193 | 193 | { |
| 194 | 194 | parent::renderContents($writer); |
| 195 | 195 | $this->getPage()->getCallbackClient()->replaceContent($this, $writer, false); |
| 196 | - } |
|
| 197 | - else |
|
| 196 | + } else |
|
| 198 | 197 | parent::render($writer); |
| 199 | 198 | } |
| 200 | 199 | } |