@@ -270,6 +270,7 @@ discard block |
||
| 270 | 270 | |
| 271 | 271 | /** |
| 272 | 272 | * @param string the public key used for generating the token. A random one will be generated if this is not set. |
| 273 | + * @param string $value |
|
| 273 | 274 | */ |
| 274 | 275 | public function setPublicKey($value) |
| 275 | 276 | { |
@@ -325,6 +326,7 @@ discard block |
||
| 325 | 326 | /** |
| 326 | 327 | * Validates a user input with the token. |
| 327 | 328 | * @param string user input |
| 329 | + * @param string $input |
|
| 328 | 330 | * @return boolean if the user input is not the same as the token. |
| 329 | 331 | */ |
| 330 | 332 | public function validate($input) |
@@ -450,6 +452,11 @@ discard block |
||
| 450 | 452 | * @param string private key |
| 451 | 453 | * @param integer the length of the token |
| 452 | 454 | * @param boolean whether the token is case sensitive |
| 455 | + * @param string $publicKey |
|
| 456 | + * @param string $privateKey |
|
| 457 | + * @param string $alphabet |
|
| 458 | + * @param integer $tokenLength |
|
| 459 | + * @param boolean $caseSensitive |
|
| 453 | 460 | * @return string the token generated. |
| 454 | 461 | */ |
| 455 | 462 | protected function generateToken($publicKey, $privateKey, $alphabet, $tokenLength, $caseSensitive) |
@@ -462,6 +469,7 @@ discard block |
||
| 462 | 469 | * Converts a hash string into a string with characters consisting of alphanumeric characters. |
| 463 | 470 | * @param string the hexadecimal representation of the hash string |
| 464 | 471 | * @param string the alphabet used to represent the converted string. If empty, it means '234578adefhijmnrtwyABDEFGHIJLMNQRTWY', which excludes those confusing characters. |
| 472 | + * @param string $hex |
|
| 465 | 473 | * @return string the converted string |
| 466 | 474 | */ |
| 467 | 475 | protected function hash2string($hex, $alphabet = '') |
@@ -64,10 +64,10 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | class TCaptcha extends TImage |
| 66 | 66 | { |
| 67 | - const MIN_TOKEN_LENGTH = 2; |
|
| 68 | - const MAX_TOKEN_LENGTH = 40; |
|
| 67 | + const MIN_TOKEN_LENGTH=2; |
|
| 68 | + const MAX_TOKEN_LENGTH=40; |
|
| 69 | 69 | private $_privateKey; |
| 70 | - private $_validated = false; |
|
| 70 | + private $_validated=false; |
|
| 71 | 71 | |
| 72 | 72 | /** |
| 73 | 73 | * @return integer the theme of the token image. Defaults to 0. |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function setTokenImageTheme($value) |
| 94 | 94 | { |
| 95 | - $value = TPropertyValue::ensureInteger($value); |
|
| 95 | + $value=TPropertyValue::ensureInteger($value); |
|
| 96 | 96 | if($value >= 0 && $value <= 63) |
| 97 | 97 | $this->setViewState('TokenImageTheme', $value, 0); |
| 98 | 98 | else |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | public function setTokenFontSize($value) |
| 117 | 117 | { |
| 118 | - $value = TPropertyValue::ensureInteger($value); |
|
| 118 | + $value=TPropertyValue::ensureInteger($value); |
|
| 119 | 119 | if($value >= 20 && $value <= 100) |
| 120 | 120 | $this->setViewState('TokenFontSize', $value, 30); |
| 121 | 121 | else |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | public function setMinTokenLength($value) |
| 137 | 137 | { |
| 138 | - $length = TPropertyValue::ensureInteger($value); |
|
| 138 | + $length=TPropertyValue::ensureInteger($value); |
|
| 139 | 139 | if($length >= self::MIN_TOKEN_LENGTH && $length <= self::MAX_TOKEN_LENGTH) |
| 140 | 140 | $this->setViewState('MinTokenLength', $length, 4); |
| 141 | 141 | else |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | public function setMaxTokenLength($value) |
| 157 | 157 | { |
| 158 | - $length = TPropertyValue::ensureInteger($value); |
|
| 158 | + $length=TPropertyValue::ensureInteger($value); |
|
| 159 | 159 | if($length >= self::MIN_TOKEN_LENGTH && $length <= self::MAX_TOKEN_LENGTH) |
| 160 | 160 | $this->setViewState('MaxTokenLength', $length, 6); |
| 161 | 161 | else |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | */ |
| 250 | 250 | public function getIsTokenExpired() |
| 251 | 251 | { |
| 252 | - if(($expiry = $this->getTokenExpiry()) > 0 && ($start = $this->getViewState('TokenGenerated', 0)) > 0) |
|
| 252 | + if(($expiry=$this->getTokenExpiry()) > 0 && ($start=$this->getViewState('TokenGenerated', 0)) > 0) |
|
| 253 | 253 | return $expiry + $start < time(); |
| 254 | 254 | else |
| 255 | 255 | return false; |
@@ -260,9 +260,9 @@ discard block |
||
| 260 | 260 | */ |
| 261 | 261 | public function getPublicKey() |
| 262 | 262 | { |
| 263 | - if(($publicKey = $this->getViewState('PublicKey', '')) === '') |
|
| 263 | + if(($publicKey=$this->getViewState('PublicKey', ''))==='') |
|
| 264 | 264 | { |
| 265 | - $publicKey = $this->generateRandomKey(); |
|
| 265 | + $publicKey=$this->generateRandomKey(); |
|
| 266 | 266 | $this->setPublicKey($publicKey); |
| 267 | 267 | } |
| 268 | 268 | return $publicKey; |
@@ -289,16 +289,16 @@ discard block |
||
| 289 | 289 | */ |
| 290 | 290 | protected function getTokenLength() |
| 291 | 291 | { |
| 292 | - if(($tokenLength = $this->getViewState('TokenLength')) === null) |
|
| 292 | + if(($tokenLength=$this->getViewState('TokenLength'))===null) |
|
| 293 | 293 | { |
| 294 | - $minLength = $this->getMinTokenLength(); |
|
| 295 | - $maxLength = $this->getMaxTokenLength(); |
|
| 294 | + $minLength=$this->getMinTokenLength(); |
|
| 295 | + $maxLength=$this->getMaxTokenLength(); |
|
| 296 | 296 | if($minLength > $maxLength) |
| 297 | - $tokenLength = rand($maxLength, $minLength); |
|
| 297 | + $tokenLength=rand($maxLength, $minLength); |
|
| 298 | 298 | elseif($minLength < $maxLength) |
| 299 | - $tokenLength = rand($minLength, $maxLength); |
|
| 299 | + $tokenLength=rand($minLength, $maxLength); |
|
| 300 | 300 | else |
| 301 | - $tokenLength = $minLength; |
|
| 301 | + $tokenLength=$minLength; |
|
| 302 | 302 | $this->setViewState('TokenLength', $tokenLength); |
| 303 | 303 | } |
| 304 | 304 | return $tokenLength; |
@@ -309,13 +309,13 @@ discard block |
||
| 309 | 309 | */ |
| 310 | 310 | public function getPrivateKey() |
| 311 | 311 | { |
| 312 | - if($this->_privateKey === null) |
|
| 312 | + if($this->_privateKey===null) |
|
| 313 | 313 | { |
| 314 | - $fileName = $this->generatePrivateKeyFile(); |
|
| 315 | - $content = file_get_contents($fileName); |
|
| 316 | - $matches = []; |
|
| 314 | + $fileName=$this->generatePrivateKeyFile(); |
|
| 315 | + $content=file_get_contents($fileName); |
|
| 316 | + $matches=[]; |
|
| 317 | 317 | if(preg_match("/privateKey='(.*?)'/ms", $content, $matches) > 0) |
| 318 | - $this->_privateKey = $matches[1]; |
|
| 318 | + $this->_privateKey=$matches[1]; |
|
| 319 | 319 | else |
| 320 | 320 | throw new TConfigurationException('captcha_privatekey_unknown'); |
| 321 | 321 | } |
@@ -329,18 +329,18 @@ discard block |
||
| 329 | 329 | */ |
| 330 | 330 | public function validate($input) |
| 331 | 331 | { |
| 332 | - $number = $this->getViewState('TestNumber', 0); |
|
| 332 | + $number=$this->getViewState('TestNumber', 0); |
|
| 333 | 333 | if(!$this->_validated) |
| 334 | 334 | { |
| 335 | 335 | $this->setViewState('TestNumber', ++$number); |
| 336 | - $this->_validated = true; |
|
| 336 | + $this->_validated=true; |
|
| 337 | 337 | } |
| 338 | - if($this->getIsTokenExpired() || (($limit = $this->getTestLimit()) > 0 && $number > $limit)) |
|
| 338 | + if($this->getIsTokenExpired() || (($limit=$this->getTestLimit()) > 0 && $number > $limit)) |
|
| 339 | 339 | { |
| 340 | 340 | $this->regenerateToken(); |
| 341 | 341 | return false; |
| 342 | 342 | } |
| 343 | - return ($this->getToken() === ($this->getCaseSensitive()?$input:strtoupper($input))); |
|
| 343 | + return ($this->getToken()===($this->getCaseSensitive() ? $input : strtoupper($input))); |
|
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | /** |
@@ -368,10 +368,10 @@ discard block |
||
| 368 | 368 | throw new TConfigurationException('captcha_imagettftext_required'); |
| 369 | 369 | if(!$this->getViewState('TokenGenerated', 0)) |
| 370 | 370 | { |
| 371 | - $manager = $this->getApplication()->getAssetManager(); |
|
| 371 | + $manager=$this->getApplication()->getAssetManager(); |
|
| 372 | 372 | $manager->publishFilePath($this->getFontFile()); |
| 373 | - $url = $manager->publishFilePath($this->getCaptchaScriptFile()); |
|
| 374 | - $url .= '?options=' . urlencode($this->getTokenImageOptions()); |
|
| 373 | + $url=$manager->publishFilePath($this->getCaptchaScriptFile()); |
|
| 374 | + $url.='?options='.urlencode($this->getTokenImageOptions()); |
|
| 375 | 375 | $this->setImageUrl($url); |
| 376 | 376 | |
| 377 | 377 | $this->setViewState('TokenGenerated', time()); |
@@ -383,23 +383,23 @@ discard block |
||
| 383 | 383 | */ |
| 384 | 384 | protected function getTokenImageOptions() |
| 385 | 385 | { |
| 386 | - $privateKey = $this->getPrivateKey(); // call this method to ensure private key is generated |
|
| 387 | - $token = $this->getToken(); |
|
| 388 | - $options = []; |
|
| 389 | - $options['publicKey'] = $this->getPublicKey(); |
|
| 390 | - $options['tokenLength'] = strlen($token); |
|
| 391 | - $options['caseSensitive'] = $this->getCaseSensitive(); |
|
| 392 | - $options['alphabet'] = $this->getTokenAlphabet(); |
|
| 393 | - $options['fontSize'] = $this->getTokenFontSize(); |
|
| 394 | - $options['theme'] = $this->getTokenImageTheme(); |
|
| 395 | - if(($randomSeed = $this->getViewState('RandomSeed', 0)) === 0) |
|
| 386 | + $privateKey=$this->getPrivateKey(); // call this method to ensure private key is generated |
|
| 387 | + $token=$this->getToken(); |
|
| 388 | + $options=[]; |
|
| 389 | + $options['publicKey']=$this->getPublicKey(); |
|
| 390 | + $options['tokenLength']=strlen($token); |
|
| 391 | + $options['caseSensitive']=$this->getCaseSensitive(); |
|
| 392 | + $options['alphabet']=$this->getTokenAlphabet(); |
|
| 393 | + $options['fontSize']=$this->getTokenFontSize(); |
|
| 394 | + $options['theme']=$this->getTokenImageTheme(); |
|
| 395 | + if(($randomSeed=$this->getViewState('RandomSeed', 0))===0) |
|
| 396 | 396 | { |
| 397 | - $randomSeed = (int)(microtime(true) * 1000000); |
|
| 397 | + $randomSeed=(int) (microtime(true) * 1000000); |
|
| 398 | 398 | $this->setViewState('RandomSeed', $randomSeed); |
| 399 | 399 | } |
| 400 | - $options['randomSeed'] = $this->getChangingTokenBackground()?0:$randomSeed; |
|
| 401 | - $str = serialize($options); |
|
| 402 | - return base64_encode(md5($privateKey . $str) . $str); |
|
| 400 | + $options['randomSeed']=$this->getChangingTokenBackground() ? 0 : $randomSeed; |
|
| 401 | + $str=serialize($options); |
|
| 402 | + return base64_encode(md5($privateKey.$str).$str); |
|
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | /** |
@@ -407,12 +407,12 @@ discard block |
||
| 407 | 407 | */ |
| 408 | 408 | protected function getCaptchaScriptFile() |
| 409 | 409 | { |
| 410 | - return dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'captcha.php'; |
|
| 410 | + return dirname(__FILE__).DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'captcha.php'; |
|
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | protected function getFontFile() |
| 414 | 414 | { |
| 415 | - return dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'verase.ttf'; |
|
| 415 | + return dirname(__FILE__).DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'verase.ttf'; |
|
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | /** |
@@ -421,14 +421,14 @@ discard block |
||
| 421 | 421 | */ |
| 422 | 422 | protected function generatePrivateKeyFile() |
| 423 | 423 | { |
| 424 | - $captchaScript = $this->getCaptchaScriptFile(); |
|
| 425 | - $path = dirname($this->getApplication()->getAssetManager()->getPublishedPath($captchaScript)); |
|
| 426 | - $fileName = $path . DIRECTORY_SEPARATOR . 'captcha_key.php'; |
|
| 424 | + $captchaScript=$this->getCaptchaScriptFile(); |
|
| 425 | + $path=dirname($this->getApplication()->getAssetManager()->getPublishedPath($captchaScript)); |
|
| 426 | + $fileName=$path.DIRECTORY_SEPARATOR.'captcha_key.php'; |
|
| 427 | 427 | if(!is_file($fileName)) |
| 428 | 428 | { |
| 429 | 429 | @mkdir($path); |
| 430 | - $key = $this->generateRandomKey(); |
|
| 431 | - $content = "<?php |
|
| 430 | + $key=$this->generateRandomKey(); |
|
| 431 | + $content="<?php |
|
| 432 | 432 | \$privateKey='$key'; |
| 433 | 433 | ?>"; |
| 434 | 434 | file_put_contents($fileName, $content); |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | */ |
| 442 | 442 | protected function generateRandomKey() |
| 443 | 443 | { |
| 444 | - return md5(rand() . rand() . rand() . rand()); |
|
| 444 | + return md5(rand().rand().rand().rand()); |
|
| 445 | 445 | } |
| 446 | 446 | |
| 447 | 447 | /** |
@@ -454,8 +454,8 @@ discard block |
||
| 454 | 454 | */ |
| 455 | 455 | protected function generateToken($publicKey, $privateKey, $alphabet, $tokenLength, $caseSensitive) |
| 456 | 456 | { |
| 457 | - $token = substr($this->hash2string(md5($publicKey . $privateKey), $alphabet) . $this->hash2string(md5($privateKey . $publicKey), $alphabet), 0, $tokenLength); |
|
| 458 | - return $caseSensitive?$token:strtoupper($token); |
|
| 457 | + $token=substr($this->hash2string(md5($publicKey.$privateKey), $alphabet).$this->hash2string(md5($privateKey.$publicKey), $alphabet), 0, $tokenLength); |
|
| 458 | + return $caseSensitive ? $token : strtoupper($token); |
|
| 459 | 459 | } |
| 460 | 460 | |
| 461 | 461 | /** |
@@ -464,20 +464,20 @@ discard block |
||
| 464 | 464 | * @param string the alphabet used to represent the converted string. If empty, it means '234578adefhijmnrtwyABDEFGHIJLMNQRTWY', which excludes those confusing characters. |
| 465 | 465 | * @return string the converted string |
| 466 | 466 | */ |
| 467 | - protected function hash2string($hex, $alphabet = '') |
|
| 467 | + protected function hash2string($hex, $alphabet='') |
|
| 468 | 468 | { |
| 469 | 469 | if(strlen($alphabet) < 2) |
| 470 | - $alphabet = '234578adefhijmnrtABDEFGHJLMNQRT'; |
|
| 471 | - $hexLength = strlen($hex); |
|
| 472 | - $base = strlen($alphabet); |
|
| 473 | - $result = ''; |
|
| 474 | - for($i = 0;$i < $hexLength;$i += 6) |
|
| 470 | + $alphabet='234578adefhijmnrtABDEFGHJLMNQRT'; |
|
| 471 | + $hexLength=strlen($hex); |
|
| 472 | + $base=strlen($alphabet); |
|
| 473 | + $result=''; |
|
| 474 | + for($i=0; $i < $hexLength; $i+=6) |
|
| 475 | 475 | { |
| 476 | - $number = hexdec(substr($hex, $i, 6)); |
|
| 476 | + $number=hexdec(substr($hex, $i, 6)); |
|
| 477 | 477 | while($number) |
| 478 | 478 | { |
| 479 | - $result .= $alphabet[$number % $base]; |
|
| 480 | - $number = floor($number / $base); |
|
| 479 | + $result.=$alphabet[$number % $base]; |
|
| 480 | + $number=floor($number / $base); |
|
| 481 | 481 | } |
| 482 | 482 | } |
| 483 | 483 | return $result; |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /** |
| 84 | - * @return TCaptchaControl the CAPTCHA control to be validated against |
|
| 84 | + * @return TCaptcha the CAPTCHA control to be validated against |
|
| 85 | 85 | * @throws TConfigurationException if the CAPTCHA cannot be found according to {@link setCaptchaControl CaptchaControl} |
| 86 | 86 | */ |
| 87 | 87 | protected function findCaptchaControl() |
@@ -117,6 +117,9 @@ discard block |
||
| 117 | 117 | return $options; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | + /** |
|
| 121 | + * @param string $token |
|
| 122 | + */ |
|
| 120 | 123 | private function generateTokenHash($token) |
| 121 | 124 | { |
| 122 | 125 | for($h = 0,$i = strlen($token) - 1;$i >= 0;--$i) |
@@ -75,8 +75,8 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | protected function evaluateIsValid() |
| 77 | 77 | { |
| 78 | - $value = $this->getValidationValue($this->getValidationTarget()); |
|
| 79 | - $control = $this->findCaptchaControl(); |
|
| 78 | + $value=$this->getValidationValue($this->getValidationTarget()); |
|
| 79 | + $control=$this->findCaptchaControl(); |
|
| 80 | 80 | return $control->validate(trim($value)); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -86,9 +86,9 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | protected function findCaptchaControl() |
| 88 | 88 | { |
| 89 | - if(($id = $this->getCaptchaControl()) === '') |
|
| 89 | + if(($id=$this->getCaptchaControl())==='') |
|
| 90 | 90 | throw new TConfigurationException('captchavalidator_captchacontrol_required'); |
| 91 | - elseif(($control = $this->findControl($id)) === null) |
|
| 91 | + elseif(($control=$this->findControl($id))===null) |
|
| 92 | 92 | throw new TConfigurationException('captchavalidator_captchacontrol_inexistent', $id); |
| 93 | 93 | elseif(!($control instanceof TCaptcha)) |
| 94 | 94 | throw new TConfigurationException('captchavalidator_captchacontrol_invalid', $id); |
@@ -102,25 +102,25 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | protected function getClientScriptOptions() |
| 104 | 104 | { |
| 105 | - $options = parent::getClientScriptOptions(); |
|
| 106 | - $control = $this->findCaptchaControl(); |
|
| 105 | + $options=parent::getClientScriptOptions(); |
|
| 106 | + $control=$this->findCaptchaControl(); |
|
| 107 | 107 | if($control->getCaseSensitive()) |
| 108 | 108 | { |
| 109 | - $options['TokenHash'] = $this->generateTokenHash($control->getToken()); |
|
| 110 | - $options['CaseSensitive'] = true; |
|
| 109 | + $options['TokenHash']=$this->generateTokenHash($control->getToken()); |
|
| 110 | + $options['CaseSensitive']=true; |
|
| 111 | 111 | } |
| 112 | 112 | else |
| 113 | 113 | { |
| 114 | - $options['TokenHash'] = $this->generateTokenHash(strtoupper($control->getToken())); |
|
| 115 | - $options['CaseSensitive'] = false; |
|
| 114 | + $options['TokenHash']=$this->generateTokenHash(strtoupper($control->getToken())); |
|
| 115 | + $options['CaseSensitive']=false; |
|
| 116 | 116 | } |
| 117 | 117 | return $options; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | private function generateTokenHash($token) |
| 121 | 121 | { |
| 122 | - for($h = 0,$i = strlen($token) - 1;$i >= 0;--$i) |
|
| 123 | - $h += ord($token[$i]); |
|
| 122 | + for($h=0, $i=strlen($token) - 1; $i >= 0; --$i) |
|
| 123 | + $h+=ord($token[$i]); |
|
| 124 | 124 | return $h; |
| 125 | 125 | } |
| 126 | 126 | } |
@@ -108,8 +108,7 @@ |
||
| 108 | 108 | { |
| 109 | 109 | $options['TokenHash'] = $this->generateTokenHash($control->getToken()); |
| 110 | 110 | $options['CaseSensitive'] = true; |
| 111 | - } |
|
| 112 | - else |
|
| 111 | + } else |
|
| 113 | 112 | { |
| 114 | 113 | $options['TokenHash'] = $this->generateTokenHash(strtoupper($control->getToken())); |
| 115 | 114 | $options['CaseSensitive'] = false; |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | 62 | * Creates a control used for repetition (used as a template). |
| 63 | - * @return TControl the control to be repeated |
|
| 63 | + * @return TCheckBoxItem the control to be repeated |
|
| 64 | 64 | */ |
| 65 | 65 | protected function createRepeatedControl() |
| 66 | 66 | { |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * This method overrides the parent implementation so that it always returns |
| 73 | 73 | * the checkbox list itself (because the checkbox list does not have child controls.) |
| 74 | 74 | * @param string control ID |
| 75 | - * @return TControl control being found |
|
| 75 | + * @return \Prado\Web\UI\TControl|null control being found |
|
| 76 | 76 | */ |
| 77 | 77 | public function findControl($id, $real = false) |
| 78 | 78 | { |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** |
| 149 | - * @return string the direction of traversing the list, defaults to 'Vertical' |
|
| 149 | + * @return TRepeatDirection the direction of traversing the list, defaults to 'Vertical' |
|
| 150 | 150 | */ |
| 151 | 151 | public function getRepeatDirection() |
| 152 | 152 | { |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | /** |
| 165 | - * @return string how the list should be displayed, using table or using line breaks. Defaults to 'Table'. |
|
| 165 | + * @return TRepeatLayout how the list should be displayed, using table or using line breaks. Defaults to 'Table'. |
|
| 166 | 166 | */ |
| 167 | 167 | public function getRepeatLayout() |
| 168 | 168 | { |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | /** |
| 442 | 442 | * Returns the value to be validated. |
| 443 | 443 | * This methid is required by \Prado\Web\UI\IValidatable interface. |
| 444 | - * @return mixed the value of the property to be validated. |
|
| 444 | + * @return string the value of the property to be validated. |
|
| 445 | 445 | */ |
| 446 | 446 | public function getValidationPropertyValue() |
| 447 | 447 | { |
@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | { |
| 42 | 42 | private $_repeatedControl; |
| 43 | 43 | private $_isEnabled; |
| 44 | - private $_changedEventRaised = false; |
|
| 45 | - private $_dataChanged = false; |
|
| 46 | - private $_isValid = true; |
|
| 44 | + private $_changedEventRaised=false; |
|
| 45 | + private $_dataChanged=false; |
|
| 46 | + private $_isValid=true; |
|
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * Constructor. |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | public function __construct() |
| 53 | 53 | { |
| 54 | 54 | parent::__construct(); |
| 55 | - $this->_repeatedControl = $this->createRepeatedControl(); |
|
| 55 | + $this->_repeatedControl=$this->createRepeatedControl(); |
|
| 56 | 56 | $this->_repeatedControl->setEnableViewState(false); |
| 57 | 57 | $this->_repeatedControl->setID('c0'); |
| 58 | 58 | $this->getControls()->add($this->_repeatedControl); |
@@ -74,9 +74,9 @@ discard block |
||
| 74 | 74 | * @param string control ID |
| 75 | 75 | * @return TControl control being found |
| 76 | 76 | */ |
| 77 | - public function findControl($id, $real = false) |
|
| 77 | + public function findControl($id, $real=false) |
|
| 78 | 78 | { |
| 79 | - if ($real === true) |
|
| 79 | + if($real===true) |
|
| 80 | 80 | return parent::findControl($id); |
| 81 | 81 | return $this; |
| 82 | 82 | } |
@@ -121,9 +121,9 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | protected function getRepeatInfo() |
| 123 | 123 | { |
| 124 | - if(($repeatInfo = $this->getViewState('RepeatInfo', null)) === null) |
|
| 124 | + if(($repeatInfo=$this->getViewState('RepeatInfo', null))===null) |
|
| 125 | 125 | { |
| 126 | - $repeatInfo = new TRepeatInfo; |
|
| 126 | + $repeatInfo=new TRepeatInfo; |
|
| 127 | 127 | $this->setViewState('RepeatInfo', $repeatInfo, null); |
| 128 | 128 | } |
| 129 | 129 | return $repeatInfo; |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | public function setEnabled($value) |
| 254 | 254 | { |
| 255 | 255 | parent::setEnabled($value); |
| 256 | - $value = !TPropertyValue::ensureBoolean($value); |
|
| 256 | + $value=!TPropertyValue::ensureBoolean($value); |
|
| 257 | 257 | // if this is an active control, |
| 258 | 258 | // and it's a callback, |
| 259 | 259 | // and we can update clientside, |
@@ -262,12 +262,12 @@ discard block |
||
| 262 | 262 | $this->getPage()->getIsCallBack() && |
| 263 | 263 | $this->getActiveControl()->canUpdateClientSide()) |
| 264 | 264 | { |
| 265 | - $items = $this->getItems(); |
|
| 266 | - $cs = $this->getPage()->getCallbackClient(); |
|
| 267 | - $baseClientID = $this->getClientID() . '_c'; |
|
| 265 | + $items=$this->getItems(); |
|
| 266 | + $cs=$this->getPage()->getCallbackClient(); |
|
| 267 | + $baseClientID=$this->getClientID().'_c'; |
|
| 268 | 268 | foreach($items as $index => $item) |
| 269 | 269 | { |
| 270 | - $cs->setAttribute($baseClientID . $index, 'disabled', $value); |
|
| 270 | + $cs->setAttribute($baseClientID.$index, 'disabled', $value); |
|
| 271 | 271 | } |
| 272 | 272 | } |
| 273 | 273 | } |
@@ -294,8 +294,8 @@ discard block |
||
| 294 | 294 | */ |
| 295 | 295 | public function renderItem($writer, $repeatInfo, $itemType, $index) |
| 296 | 296 | { |
| 297 | - $repeatedControl = $this->_repeatedControl; |
|
| 298 | - $item = $this->getItems()->itemAt($index); |
|
| 297 | + $repeatedControl=$this->_repeatedControl; |
|
| 298 | + $item=$this->getItems()->itemAt($index); |
|
| 299 | 299 | if($item->getHasAttributes()) |
| 300 | 300 | $repeatedControl->getAttributes()->copyFrom($item->getAttributes()); |
| 301 | 301 | elseif($repeatedControl->getHasAttributes()) |
@@ -320,21 +320,21 @@ discard block |
||
| 320 | 320 | { |
| 321 | 321 | if($this->getEnabled(true)) |
| 322 | 322 | { |
| 323 | - $index = (int)substr($key, strlen($this->getUniqueID()) + 2); |
|
| 323 | + $index=(int) substr($key, strlen($this->getUniqueID()) + 2); |
|
| 324 | 324 | $this->ensureDataBound(); |
| 325 | 325 | if($index >= 0 && $index < $this->getItemCount()) |
| 326 | 326 | { |
| 327 | - $item = $this->getItems()->itemAt($index); |
|
| 327 | + $item=$this->getItems()->itemAt($index); |
|
| 328 | 328 | if($item->getEnabled()) |
| 329 | 329 | { |
| 330 | - $checked = isset($values[$key]); |
|
| 331 | - if($item->getSelected() !== $checked) |
|
| 330 | + $checked=isset($values[$key]); |
|
| 331 | + if($item->getSelected()!==$checked) |
|
| 332 | 332 | { |
| 333 | 333 | $item->setSelected($checked); |
| 334 | 334 | if(!$this->_changedEventRaised) |
| 335 | 335 | { |
| 336 | - $this->_changedEventRaised = true; |
|
| 337 | - return $this->_dataChanged = true; |
|
| 336 | + $this->_changedEventRaised=true; |
|
| 337 | + return $this->_dataChanged=true; |
|
| 338 | 338 | } |
| 339 | 339 | } |
| 340 | 340 | } |
@@ -368,9 +368,9 @@ discard block |
||
| 368 | 368 | $this->_repeatedControl->setAutoPostBack($this->getAutoPostBack()); |
| 369 | 369 | $this->_repeatedControl->setCausesValidation($this->getCausesValidation()); |
| 370 | 370 | $this->_repeatedControl->setValidationGroup($this->getValidationGroup()); |
| 371 | - $page = $this->getPage(); |
|
| 372 | - $n = $this->getItemCount(); |
|
| 373 | - for($i = 0;$i < $n;++$i) |
|
| 371 | + $page=$this->getPage(); |
|
| 372 | + $n=$this->getItemCount(); |
|
| 373 | + for($i=0; $i < $n; ++$i) |
|
| 374 | 374 | { |
| 375 | 375 | $this->_repeatedControl->setID("c$i"); |
| 376 | 376 | $page->registerRequiresPostData($this->_repeatedControl); |
@@ -382,9 +382,9 @@ discard block |
||
| 382 | 382 | * |
| 383 | 383 | *@return boolean true if we need a span |
| 384 | 384 | */ |
| 385 | - protected function getSpanNeeded () |
|
| 385 | + protected function getSpanNeeded() |
|
| 386 | 386 | { |
| 387 | - return $this->getRepeatLayout() === TRepeatLayout::Raw; |
|
| 387 | + return $this->getRepeatLayout()===TRepeatLayout::Raw; |
|
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | /** |
@@ -394,17 +394,17 @@ discard block |
||
| 394 | 394 | */ |
| 395 | 395 | public function render($writer) |
| 396 | 396 | { |
| 397 | - if ($needSpan = $this->getSpanNeeded()) |
|
| 397 | + if($needSpan=$this->getSpanNeeded()) |
|
| 398 | 398 | { |
| 399 | 399 | $writer->addAttribute('id', $this->getClientId()); |
| 400 | 400 | $writer->renderBeginTag('span'); |
| 401 | 401 | } |
| 402 | 402 | if($this->getItemCount() > 0) |
| 403 | 403 | { |
| 404 | - $this->_isEnabled = $this->getEnabled(true); |
|
| 405 | - $repeatInfo = $this->getRepeatInfo(); |
|
| 406 | - $accessKey = $this->getAccessKey(); |
|
| 407 | - $tabIndex = $this->getTabIndex(); |
|
| 404 | + $this->_isEnabled=$this->getEnabled(true); |
|
| 405 | + $repeatInfo=$this->getRepeatInfo(); |
|
| 406 | + $accessKey=$this->getAccessKey(); |
|
| 407 | + $tabIndex=$this->getTabIndex(); |
|
| 408 | 408 | $this->_repeatedControl->setTextAlign($this->getTextAlign()); |
| 409 | 409 | $this->_repeatedControl->setAccessKey($accessKey); |
| 410 | 410 | $this->_repeatedControl->setTabIndex($tabIndex); |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | $this->setAccessKey($accessKey); |
| 416 | 416 | $this->setTabIndex($tabIndex); |
| 417 | 417 | } |
| 418 | - if ($needSpan) |
|
| 418 | + if($needSpan) |
|
| 419 | 419 | $writer->renderEndTag(); |
| 420 | 420 | |
| 421 | 421 | //checkbox skipped the client control script in addAttributesToRender |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | */ |
| 463 | 463 | public function setIsValid($value) |
| 464 | 464 | { |
| 465 | - $this->_isValid = TPropertyValue::ensureBoolean($value); |
|
| 465 | + $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | /** |
@@ -481,11 +481,11 @@ discard block |
||
| 481 | 481 | */ |
| 482 | 482 | protected function getPostBackOptions() |
| 483 | 483 | { |
| 484 | - $options['ID'] = $this->getClientID(); |
|
| 485 | - $options['ValidationGroup'] = $this->getValidationGroup(); |
|
| 486 | - $options['CausesValidation'] = $this->getCausesValidation(); |
|
| 487 | - $options['ListName'] = $this->getUniqueID(); |
|
| 488 | - $options['ItemCount'] = $this->getItemCount(); |
|
| 484 | + $options['ID']=$this->getClientID(); |
|
| 485 | + $options['ValidationGroup']=$this->getValidationGroup(); |
|
| 486 | + $options['CausesValidation']=$this->getCausesValidation(); |
|
| 487 | + $options['ListName']=$this->getUniqueID(); |
|
| 488 | + $options['ItemCount']=$this->getItemCount(); |
|
| 489 | 489 | return $options; |
| 490 | 490 | } |
| 491 | 491 | |
@@ -519,6 +519,7 @@ discard block |
||
| 519 | 519 | * If the item to be selected is already in edit mode, it will remain in edit mode. |
| 520 | 520 | * If the index is less than 0, any existing selection will be cleared up. |
| 521 | 521 | * @param integer the selected item index |
| 522 | + * @param integer $value |
|
| 522 | 523 | */ |
| 523 | 524 | public function setSelectedItemIndex($value) |
| 524 | 525 | { |
@@ -747,6 +748,7 @@ discard block |
||
| 747 | 748 | * This method is invoked when a button control raises <b>OnCommand</b> event |
| 748 | 749 | * with <b>cancel</b> command name. |
| 749 | 750 | * @param TDataGridCommandEventParameter event parameter |
| 751 | + * @param TDataGridCommandEventParameter $param |
|
| 750 | 752 | */ |
| 751 | 753 | public function onCancelCommand($param) |
| 752 | 754 | { |
@@ -758,6 +760,7 @@ discard block |
||
| 758 | 760 | * This method is invoked when a button control raises <b>OnCommand</b> event |
| 759 | 761 | * with <b>delete</b> command name. |
| 760 | 762 | * @param TDataGridCommandEventParameter event parameter |
| 763 | + * @param TDataGridCommandEventParameter $param |
|
| 761 | 764 | */ |
| 762 | 765 | public function onDeleteCommand($param) |
| 763 | 766 | { |
@@ -769,6 +772,7 @@ discard block |
||
| 769 | 772 | * This method is invoked when a button control raises <b>OnCommand</b> event |
| 770 | 773 | * with <b>edit</b> command name. |
| 771 | 774 | * @param TDataGridCommandEventParameter event parameter |
| 775 | + * @param TDataGridCommandEventParameter $param |
|
| 772 | 776 | */ |
| 773 | 777 | public function onEditCommand($param) |
| 774 | 778 | { |
@@ -779,6 +783,7 @@ discard block |
||
| 779 | 783 | * Raises <b>OnItemCommand</b> event. |
| 780 | 784 | * This method is invoked when a button control raises <b>OnCommand</b> event. |
| 781 | 785 | * @param TDataGridCommandEventParameter event parameter |
| 786 | + * @param TDataGridCommandEventParameter $param |
|
| 782 | 787 | */ |
| 783 | 788 | public function onItemCommand($param) |
| 784 | 789 | { |
@@ -790,6 +795,7 @@ discard block |
||
| 790 | 795 | * This method is invoked when a button control raises <b>OnCommand</b> event |
| 791 | 796 | * with <b>sort</b> command name. |
| 792 | 797 | * @param TDataGridSortCommandEventParameter event parameter |
| 798 | + * @param TDataGridSortCommandEventParameter $param |
|
| 793 | 799 | */ |
| 794 | 800 | public function onSortCommand($param) |
| 795 | 801 | { |
@@ -801,6 +807,7 @@ discard block |
||
| 801 | 807 | * This method is invoked when a button control raises <b>OnCommand</b> event |
| 802 | 808 | * with <b>update</b> command name. |
| 803 | 809 | * @param TDataGridCommandEventParameter event parameter |
| 810 | + * @param TDataGridCommandEventParameter $param |
|
| 804 | 811 | */ |
| 805 | 812 | public function onUpdateCommand($param) |
| 806 | 813 | { |
@@ -812,6 +819,7 @@ discard block |
||
| 812 | 819 | * This method is invoked right after a datagrid item is created and before |
| 813 | 820 | * added to page hierarchy. |
| 814 | 821 | * @param TDataGridItemEventParameter event parameter |
| 822 | + * @param TDataGridItemEventParameter $param |
|
| 815 | 823 | */ |
| 816 | 824 | public function onItemCreated($param) |
| 817 | 825 | { |
@@ -823,6 +831,7 @@ discard block |
||
| 823 | 831 | * This method is invoked right after a datagrid pager is created and before |
| 824 | 832 | * added to page hierarchy. |
| 825 | 833 | * @param TDataGridPagerEventParameter event parameter |
| 834 | + * @param TDataGridPagerEventParameter $param |
|
| 826 | 835 | */ |
| 827 | 836 | public function onPagerCreated($param) |
| 828 | 837 | { |
@@ -834,6 +843,7 @@ discard block |
||
| 834 | 843 | * This method is invoked for each datagrid item after it performs |
| 835 | 844 | * databinding. |
| 836 | 845 | * @param TDataGridItemEventParameter event parameter |
| 846 | + * @param TDataGridItemEventParameter $param |
|
| 837 | 847 | */ |
| 838 | 848 | public function onItemDataBound($param) |
| 839 | 849 | { |
@@ -844,6 +854,7 @@ discard block |
||
| 844 | 854 | * Raises <b>OnPageIndexChanged</b> event. |
| 845 | 855 | * This method is invoked when current page is changed. |
| 846 | 856 | * @param TDataGridPageChangedEventParameter event parameter |
| 857 | + * @param TDataGridPageChangedEventParameter $param |
|
| 847 | 858 | */ |
| 848 | 859 | public function onPageIndexChanged($param) |
| 849 | 860 | { |
@@ -1140,6 +1151,11 @@ discard block |
||
| 1140 | 1151 | return new TDataGridItem($itemIndex, $dataSourceIndex, $itemType); |
| 1141 | 1152 | } |
| 1142 | 1153 | |
| 1154 | + /** |
|
| 1155 | + * @param integer $itemIndex |
|
| 1156 | + * @param boolean $dataBind |
|
| 1157 | + * @param TList $columns |
|
| 1158 | + */ |
|
| 1143 | 1159 | private function createItemInternal($itemIndex, $dataSourceIndex, $itemType, $dataBind, $dataItem, $columns) |
| 1144 | 1160 | { |
| 1145 | 1161 | $item = $this->createItem($itemIndex, $dataSourceIndex, $itemType); |
@@ -1165,6 +1181,7 @@ discard block |
||
| 1165 | 1181 | * Initializes a datagrid item and cells inside it |
| 1166 | 1182 | * @param TDataGrid datagrid item to be initialized |
| 1167 | 1183 | * @param TDataGridColumnCollection datagrid columns to be used to initialize the cells in the item |
| 1184 | + * @param TDataGridItem $item |
|
| 1168 | 1185 | */ |
| 1169 | 1186 | protected function initializeItem($item, $columns) |
| 1170 | 1187 | { |
@@ -1197,6 +1214,7 @@ discard block |
||
| 1197 | 1214 | /** |
| 1198 | 1215 | * Builds the pager content based on pager style. |
| 1199 | 1216 | * @param TDataGridPager the container for the pager |
| 1217 | + * @param TDataGridPager $pager |
|
| 1200 | 1218 | */ |
| 1201 | 1219 | protected function buildPager($pager) |
| 1202 | 1220 | { |
@@ -1222,6 +1240,9 @@ discard block |
||
| 1222 | 1240 | * @param string caption of the button |
| 1223 | 1241 | * @param string CommandName corresponding to the OnCommand event of the button |
| 1224 | 1242 | * @param string CommandParameter corresponding to the OnCommand event of the button |
| 1243 | + * @param TDataGridPagerButtonType $buttonType |
|
| 1244 | + * @param boolean $enabled |
|
| 1245 | + * @param string $commandName |
|
| 1225 | 1246 | * @return mixed the button instance |
| 1226 | 1247 | */ |
| 1227 | 1248 | protected function createPagerButton($pager, $buttonType, $enabled, $text, $commandName, $commandParameter) |
@@ -150,17 +150,17 @@ discard block |
||
| 150 | 150 | /** |
| 151 | 151 | * Command name that TDataGrid understands. |
| 152 | 152 | */ |
| 153 | - const CMD_SELECT = 'Select'; |
|
| 154 | - const CMD_EDIT = 'Edit'; |
|
| 155 | - const CMD_UPDATE = 'Update'; |
|
| 156 | - const CMD_DELETE = 'Delete'; |
|
| 157 | - const CMD_CANCEL = 'Cancel'; |
|
| 158 | - const CMD_SORT = 'Sort'; |
|
| 159 | - const CMD_PAGE = 'Page'; |
|
| 160 | - const CMD_PAGE_NEXT = 'Next'; |
|
| 161 | - const CMD_PAGE_PREV = 'Previous'; |
|
| 162 | - const CMD_PAGE_FIRST = 'First'; |
|
| 163 | - const CMD_PAGE_LAST = 'Last'; |
|
| 153 | + const CMD_SELECT='Select'; |
|
| 154 | + const CMD_EDIT='Edit'; |
|
| 155 | + const CMD_UPDATE='Update'; |
|
| 156 | + const CMD_DELETE='Delete'; |
|
| 157 | + const CMD_CANCEL='Cancel'; |
|
| 158 | + const CMD_SORT='Sort'; |
|
| 159 | + const CMD_PAGE='Page'; |
|
| 160 | + const CMD_PAGE_NEXT='Next'; |
|
| 161 | + const CMD_PAGE_PREV='Previous'; |
|
| 162 | + const CMD_PAGE_FIRST='First'; |
|
| 163 | + const CMD_PAGE_LAST='Last'; |
|
| 164 | 164 | |
| 165 | 165 | /** |
| 166 | 166 | * @var TDataGridColumnCollection manually created column collection |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | /** |
| 200 | 200 | * @var boolean whether empty template is effective |
| 201 | 201 | */ |
| 202 | - private $_useEmptyTemplate = false; |
|
| 202 | + private $_useEmptyTemplate=false; |
|
| 203 | 203 | |
| 204 | 204 | /** |
| 205 | 205 | * @return string tag name (table) of the datagrid |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | if($object instanceof TDataGridColumn) |
| 228 | 228 | $this->getColumns()->add($object); |
| 229 | 229 | else |
| 230 | - parent::addParsedObject($object); // this is needed by EmptyTemplate |
|
| 230 | + parent::addParsedObject($object); // this is needed by EmptyTemplate |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | /** |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | public function getColumns() |
| 237 | 237 | { |
| 238 | 238 | if(!$this->_columns) |
| 239 | - $this->_columns = new TDataGridColumnCollection($this); |
|
| 239 | + $this->_columns=new TDataGridColumnCollection($this); |
|
| 240 | 240 | return $this->_columns; |
| 241 | 241 | } |
| 242 | 242 | |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | public function getAutoColumns() |
| 247 | 247 | { |
| 248 | 248 | if(!$this->_autoColumns) |
| 249 | - $this->_autoColumns = new TDataGridColumnCollection($this); |
|
| 249 | + $this->_autoColumns=new TDataGridColumnCollection($this); |
|
| 250 | 250 | return $this->_autoColumns; |
| 251 | 251 | } |
| 252 | 252 | |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | public function getItems() |
| 257 | 257 | { |
| 258 | 258 | if(!$this->_items) |
| 259 | - $this->_items = new TDataGridItemCollection; |
|
| 259 | + $this->_items=new TDataGridItemCollection; |
|
| 260 | 260 | return $this->_items; |
| 261 | 261 | } |
| 262 | 262 | |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | */ |
| 266 | 266 | public function getItemCount() |
| 267 | 267 | { |
| 268 | - return $this->_items?$this->_items->getCount():0; |
|
| 268 | + return $this->_items ? $this->_items->getCount() : 0; |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | /** |
@@ -299,9 +299,9 @@ discard block |
||
| 299 | 299 | */ |
| 300 | 300 | public function getItemStyle() |
| 301 | 301 | { |
| 302 | - if(($style = $this->getViewState('ItemStyle', null)) === null) |
|
| 302 | + if(($style=$this->getViewState('ItemStyle', null))===null) |
|
| 303 | 303 | { |
| 304 | - $style = new TTableItemStyle; |
|
| 304 | + $style=new TTableItemStyle; |
|
| 305 | 305 | $this->setViewState('ItemStyle', $style, null); |
| 306 | 306 | } |
| 307 | 307 | return $style; |
@@ -312,9 +312,9 @@ discard block |
||
| 312 | 312 | */ |
| 313 | 313 | public function getAlternatingItemStyle() |
| 314 | 314 | { |
| 315 | - if(($style = $this->getViewState('AlternatingItemStyle', null)) === null) |
|
| 315 | + if(($style=$this->getViewState('AlternatingItemStyle', null))===null) |
|
| 316 | 316 | { |
| 317 | - $style = new TTableItemStyle; |
|
| 317 | + $style=new TTableItemStyle; |
|
| 318 | 318 | $this->setViewState('AlternatingItemStyle', $style, null); |
| 319 | 319 | } |
| 320 | 320 | return $style; |
@@ -325,9 +325,9 @@ discard block |
||
| 325 | 325 | */ |
| 326 | 326 | public function getSelectedItemStyle() |
| 327 | 327 | { |
| 328 | - if(($style = $this->getViewState('SelectedItemStyle', null)) === null) |
|
| 328 | + if(($style=$this->getViewState('SelectedItemStyle', null))===null) |
|
| 329 | 329 | { |
| 330 | - $style = new TTableItemStyle; |
|
| 330 | + $style=new TTableItemStyle; |
|
| 331 | 331 | $this->setViewState('SelectedItemStyle', $style, null); |
| 332 | 332 | } |
| 333 | 333 | return $style; |
@@ -338,9 +338,9 @@ discard block |
||
| 338 | 338 | */ |
| 339 | 339 | public function getEditItemStyle() |
| 340 | 340 | { |
| 341 | - if(($style = $this->getViewState('EditItemStyle', null)) === null) |
|
| 341 | + if(($style=$this->getViewState('EditItemStyle', null))===null) |
|
| 342 | 342 | { |
| 343 | - $style = new TTableItemStyle; |
|
| 343 | + $style=new TTableItemStyle; |
|
| 344 | 344 | $this->setViewState('EditItemStyle', $style, null); |
| 345 | 345 | } |
| 346 | 346 | return $style; |
@@ -351,9 +351,9 @@ discard block |
||
| 351 | 351 | */ |
| 352 | 352 | public function getHeaderStyle() |
| 353 | 353 | { |
| 354 | - if(($style = $this->getViewState('HeaderStyle', null)) === null) |
|
| 354 | + if(($style=$this->getViewState('HeaderStyle', null))===null) |
|
| 355 | 355 | { |
| 356 | - $style = new TTableItemStyle; |
|
| 356 | + $style=new TTableItemStyle; |
|
| 357 | 357 | $this->setViewState('HeaderStyle', $style, null); |
| 358 | 358 | } |
| 359 | 359 | return $style; |
@@ -364,9 +364,9 @@ discard block |
||
| 364 | 364 | */ |
| 365 | 365 | public function getFooterStyle() |
| 366 | 366 | { |
| 367 | - if(($style = $this->getViewState('FooterStyle', null)) === null) |
|
| 367 | + if(($style=$this->getViewState('FooterStyle', null))===null) |
|
| 368 | 368 | { |
| 369 | - $style = new TTableItemStyle; |
|
| 369 | + $style=new TTableItemStyle; |
|
| 370 | 370 | $this->setViewState('FooterStyle', $style, null); |
| 371 | 371 | } |
| 372 | 372 | return $style; |
@@ -377,9 +377,9 @@ discard block |
||
| 377 | 377 | */ |
| 378 | 378 | public function getPagerStyle() |
| 379 | 379 | { |
| 380 | - if(($style = $this->getViewState('PagerStyle', null)) === null) |
|
| 380 | + if(($style=$this->getViewState('PagerStyle', null))===null) |
|
| 381 | 381 | { |
| 382 | - $style = new TDataGridPagerStyle; |
|
| 382 | + $style=new TDataGridPagerStyle; |
|
| 383 | 383 | $this->setViewState('PagerStyle', $style, null); |
| 384 | 384 | } |
| 385 | 385 | return $style; |
@@ -391,9 +391,9 @@ discard block |
||
| 391 | 391 | */ |
| 392 | 392 | public function getTableHeadStyle() |
| 393 | 393 | { |
| 394 | - if(($style = $this->getViewState('TableHeadStyle', null)) === null) |
|
| 394 | + if(($style=$this->getViewState('TableHeadStyle', null))===null) |
|
| 395 | 395 | { |
| 396 | - $style = new TStyle; |
|
| 396 | + $style=new TStyle; |
|
| 397 | 397 | $this->setViewState('TableHeadStyle', $style, null); |
| 398 | 398 | } |
| 399 | 399 | return $style; |
@@ -405,9 +405,9 @@ discard block |
||
| 405 | 405 | */ |
| 406 | 406 | public function getTableBodyStyle() |
| 407 | 407 | { |
| 408 | - if(($style = $this->getViewState('TableBodyStyle', null)) === null) |
|
| 408 | + if(($style=$this->getViewState('TableBodyStyle', null))===null) |
|
| 409 | 409 | { |
| 410 | - $style = new TStyle; |
|
| 410 | + $style=new TStyle; |
|
| 411 | 411 | $this->setViewState('TableBodyStyle', $style, null); |
| 412 | 412 | } |
| 413 | 413 | return $style; |
@@ -419,9 +419,9 @@ discard block |
||
| 419 | 419 | */ |
| 420 | 420 | public function getTableFootStyle() |
| 421 | 421 | { |
| 422 | - if(($style = $this->getViewState('TableFootStyle', null)) === null) |
|
| 422 | + if(($style=$this->getViewState('TableFootStyle', null))===null) |
|
| 423 | 423 | { |
| 424 | - $style = new TStyle; |
|
| 424 | + $style=new TStyle; |
|
| 425 | 425 | $this->setViewState('TableFootStyle', $style, null); |
| 426 | 426 | } |
| 427 | 427 | return $style; |
@@ -496,8 +496,8 @@ discard block |
||
| 496 | 496 | */ |
| 497 | 497 | public function getSelectedItem() |
| 498 | 498 | { |
| 499 | - $index = $this->getSelectedItemIndex(); |
|
| 500 | - $items = $this->getItems(); |
|
| 499 | + $index=$this->getSelectedItemIndex(); |
|
| 500 | + $items=$this->getItems(); |
|
| 501 | 501 | if($index >= 0 && $index < $items->getCount()) |
| 502 | 502 | return $items->itemAt($index); |
| 503 | 503 | else |
@@ -522,23 +522,23 @@ discard block |
||
| 522 | 522 | */ |
| 523 | 523 | public function setSelectedItemIndex($value) |
| 524 | 524 | { |
| 525 | - if(($value = TPropertyValue::ensureInteger($value)) < 0) |
|
| 526 | - $value = -1; |
|
| 527 | - if(($current = $this->getSelectedItemIndex()) !== $value) |
|
| 525 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
| 526 | + $value=-1; |
|
| 527 | + if(($current=$this->getSelectedItemIndex())!==$value) |
|
| 528 | 528 | { |
| 529 | 529 | $this->setViewState('SelectedItemIndex', $value, -1); |
| 530 | - $items = $this->getItems(); |
|
| 531 | - $itemCount = $items->getCount(); |
|
| 530 | + $items=$this->getItems(); |
|
| 531 | + $itemCount=$items->getCount(); |
|
| 532 | 532 | if($current >= 0 && $current < $itemCount) |
| 533 | 533 | { |
| 534 | - $item = $items->itemAt($current); |
|
| 535 | - if($item->getItemType() !== TListItemType::EditItem) |
|
| 536 | - $item->setItemType($current % 2?TListItemType::AlternatingItem:TListItemType::Item); |
|
| 534 | + $item=$items->itemAt($current); |
|
| 535 | + if($item->getItemType()!==TListItemType::EditItem) |
|
| 536 | + $item->setItemType($current % 2 ?TListItemType::AlternatingItem : TListItemType::Item); |
|
| 537 | 537 | } |
| 538 | 538 | if($value >= 0 && $value < $itemCount) |
| 539 | 539 | { |
| 540 | - $item = $items->itemAt($value); |
|
| 541 | - if($item->getItemType() !== TListItemType::EditItem) |
|
| 540 | + $item=$items->itemAt($value); |
|
| 541 | + if($item->getItemType()!==TListItemType::EditItem) |
|
| 542 | 542 | $item->setItemType(TListItemType::SelectedItem); |
| 543 | 543 | } |
| 544 | 544 | } |
@@ -549,8 +549,8 @@ discard block |
||
| 549 | 549 | */ |
| 550 | 550 | public function getEditItem() |
| 551 | 551 | { |
| 552 | - $index = $this->getEditItemIndex(); |
|
| 553 | - $items = $this->getItems(); |
|
| 552 | + $index=$this->getEditItemIndex(); |
|
| 553 | + $items=$this->getItems(); |
|
| 554 | 554 | if($index >= 0 && $index < $items->getCount()) |
| 555 | 555 | return $items->itemAt($index); |
| 556 | 556 | else |
@@ -574,15 +574,15 @@ discard block |
||
| 574 | 574 | */ |
| 575 | 575 | public function setEditItemIndex($value) |
| 576 | 576 | { |
| 577 | - if(($value = TPropertyValue::ensureInteger($value)) < 0) |
|
| 578 | - $value = -1; |
|
| 579 | - if(($current = $this->getEditItemIndex()) !== $value) |
|
| 577 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
| 578 | + $value=-1; |
|
| 579 | + if(($current=$this->getEditItemIndex())!==$value) |
|
| 580 | 580 | { |
| 581 | 581 | $this->setViewState('EditItemIndex', $value, -1); |
| 582 | - $items = $this->getItems(); |
|
| 583 | - $itemCount = $items->getCount(); |
|
| 582 | + $items=$this->getItems(); |
|
| 583 | + $itemCount=$items->getCount(); |
|
| 584 | 584 | if($current >= 0 && $current < $itemCount) |
| 585 | - $items->itemAt($current)->setItemType($current % 2?TListItemType::AlternatingItem:TListItemType::Item); |
|
| 585 | + $items->itemAt($current)->setItemType($current % 2 ?TListItemType::AlternatingItem : TListItemType::Item); |
|
| 586 | 586 | if($value >= 0 && $value < $itemCount) |
| 587 | 587 | $items->itemAt($value)->setItemType(TListItemType::EditItem); |
| 588 | 588 | } |
@@ -666,8 +666,8 @@ discard block |
||
| 666 | 666 | */ |
| 667 | 667 | public function setEmptyTemplate($value) |
| 668 | 668 | { |
| 669 | - if($value instanceof ITemplate || $value === null) |
|
| 670 | - $this->_emptyTemplate = $value; |
|
| 669 | + if($value instanceof ITemplate || $value===null) |
|
| 670 | + $this->_emptyTemplate=$value; |
|
| 671 | 671 | else |
| 672 | 672 | throw new TInvalidDataTypeException('datagrid_template_required', 'EmptyTemplate'); |
| 673 | 673 | } |
@@ -690,51 +690,51 @@ discard block |
||
| 690 | 690 | if($param instanceof TDataGridCommandEventParameter) |
| 691 | 691 | { |
| 692 | 692 | $this->onItemCommand($param); |
| 693 | - $command = $param->getCommandName(); |
|
| 694 | - if(strcasecmp($command, self::CMD_SELECT) === 0) |
|
| 693 | + $command=$param->getCommandName(); |
|
| 694 | + if(strcasecmp($command, self::CMD_SELECT)===0) |
|
| 695 | 695 | { |
| 696 | 696 | $this->setSelectedItemIndex($param->getItem()->getItemIndex()); |
| 697 | 697 | $this->onSelectedIndexChanged($param); |
| 698 | 698 | return true; |
| 699 | 699 | } |
| 700 | - elseif(strcasecmp($command, self::CMD_EDIT) === 0) |
|
| 700 | + elseif(strcasecmp($command, self::CMD_EDIT)===0) |
|
| 701 | 701 | { |
| 702 | 702 | $this->onEditCommand($param); |
| 703 | 703 | return true; |
| 704 | 704 | } |
| 705 | - elseif(strcasecmp($command, self::CMD_DELETE) === 0) |
|
| 705 | + elseif(strcasecmp($command, self::CMD_DELETE)===0) |
|
| 706 | 706 | { |
| 707 | 707 | $this->onDeleteCommand($param); |
| 708 | 708 | return true; |
| 709 | 709 | } |
| 710 | - elseif(strcasecmp($command, self::CMD_UPDATE) === 0) |
|
| 710 | + elseif(strcasecmp($command, self::CMD_UPDATE)===0) |
|
| 711 | 711 | { |
| 712 | 712 | $this->onUpdateCommand($param); |
| 713 | 713 | return true; |
| 714 | 714 | } |
| 715 | - elseif(strcasecmp($command, self::CMD_CANCEL) === 0) |
|
| 715 | + elseif(strcasecmp($command, self::CMD_CANCEL)===0) |
|
| 716 | 716 | { |
| 717 | 717 | $this->onCancelCommand($param); |
| 718 | 718 | return true; |
| 719 | 719 | } |
| 720 | - elseif(strcasecmp($command, self::CMD_SORT) === 0) |
|
| 720 | + elseif(strcasecmp($command, self::CMD_SORT)===0) |
|
| 721 | 721 | { |
| 722 | 722 | $this->onSortCommand(new TDataGridSortCommandEventParameter($sender, $param)); |
| 723 | 723 | return true; |
| 724 | 724 | } |
| 725 | - elseif(strcasecmp($command, self::CMD_PAGE) === 0) |
|
| 725 | + elseif(strcasecmp($command, self::CMD_PAGE)===0) |
|
| 726 | 726 | { |
| 727 | - $p = $param->getCommandParameter(); |
|
| 728 | - if(strcasecmp($p, self::CMD_PAGE_NEXT) === 0) |
|
| 729 | - $pageIndex = $this->getCurrentPageIndex() + 1; |
|
| 730 | - elseif(strcasecmp($p, self::CMD_PAGE_PREV) === 0) |
|
| 731 | - $pageIndex = $this->getCurrentPageIndex() - 1; |
|
| 732 | - elseif(strcasecmp($p, self::CMD_PAGE_FIRST) === 0) |
|
| 733 | - $pageIndex = 0; |
|
| 734 | - elseif(strcasecmp($p, self::CMD_PAGE_LAST) === 0) |
|
| 735 | - $pageIndex = $this->getPageCount() - 1; |
|
| 727 | + $p=$param->getCommandParameter(); |
|
| 728 | + if(strcasecmp($p, self::CMD_PAGE_NEXT)===0) |
|
| 729 | + $pageIndex=$this->getCurrentPageIndex() + 1; |
|
| 730 | + elseif(strcasecmp($p, self::CMD_PAGE_PREV)===0) |
|
| 731 | + $pageIndex=$this->getCurrentPageIndex() - 1; |
|
| 732 | + elseif(strcasecmp($p, self::CMD_PAGE_FIRST)===0) |
|
| 733 | + $pageIndex=0; |
|
| 734 | + elseif(strcasecmp($p, self::CMD_PAGE_LAST)===0) |
|
| 735 | + $pageIndex=$this->getPageCount() - 1; |
|
| 736 | 736 | else |
| 737 | - $pageIndex = TPropertyValue::ensureInteger($p) - 1; |
|
| 737 | + $pageIndex=TPropertyValue::ensureInteger($p) - 1; |
|
| 738 | 738 | $this->onPageIndexChanged(new TDataGridPageChangedEventParameter($sender, $pageIndex)); |
| 739 | 739 | return true; |
| 740 | 740 | } |
@@ -865,18 +865,18 @@ discard block |
||
| 865 | 865 | $this->clearViewState('ItemCount'); |
| 866 | 866 | if($this->_autoColumns) |
| 867 | 867 | { |
| 868 | - $state = []; |
|
| 868 | + $state=[]; |
|
| 869 | 869 | foreach($this->_autoColumns as $column) |
| 870 | - $state[] = $column->saveState(); |
|
| 870 | + $state[]=$column->saveState(); |
|
| 871 | 871 | $this->setViewState('AutoColumns', $state, []); |
| 872 | 872 | } |
| 873 | 873 | else |
| 874 | 874 | $this->clearViewState('AutoColumns'); |
| 875 | 875 | if($this->_columns) |
| 876 | 876 | { |
| 877 | - $state = []; |
|
| 877 | + $state=[]; |
|
| 878 | 878 | foreach($this->_columns as $column) |
| 879 | - $state[] = $column->saveState(); |
|
| 879 | + $state[]=$column->saveState(); |
|
| 880 | 880 | $this->setViewState('Columns', $state, []); |
| 881 | 881 | } |
| 882 | 882 | else |
@@ -894,23 +894,23 @@ discard block |
||
| 894 | 894 | return; |
| 895 | 895 | if(!$this->getIsDataBound()) |
| 896 | 896 | { |
| 897 | - $state = $this->getViewState('AutoColumns', []); |
|
| 897 | + $state=$this->getViewState('AutoColumns', []); |
|
| 898 | 898 | if(!empty($state)) |
| 899 | 899 | { |
| 900 | - $this->_autoColumns = new TDataGridColumnCollection($this); |
|
| 900 | + $this->_autoColumns=new TDataGridColumnCollection($this); |
|
| 901 | 901 | foreach($state as $st) |
| 902 | 902 | { |
| 903 | - $column = new $this->AutoGenerateColumnName; |
|
| 903 | + $column=new $this->AutoGenerateColumnName; |
|
| 904 | 904 | $column->loadState($st); |
| 905 | 905 | $this->_autoColumns->add($column); |
| 906 | 906 | } |
| 907 | 907 | } |
| 908 | 908 | else |
| 909 | - $this->_autoColumns = null; |
|
| 910 | - $state = $this->getViewState('Columns', []); |
|
| 911 | - if($this->_columns && $this->_columns->getCount() === count($state)) |
|
| 909 | + $this->_autoColumns=null; |
|
| 910 | + $state=$this->getViewState('Columns', []); |
|
| 911 | + if($this->_columns && $this->_columns->getCount()===count($state)) |
|
| 912 | 912 | { |
| 913 | - $i = 0; |
|
| 913 | + $i=0; |
|
| 914 | 914 | foreach($this->_columns as $column) |
| 915 | 915 | { |
| 916 | 916 | $column->loadState($state[$i]); |
@@ -928,11 +928,11 @@ discard block |
||
| 928 | 928 | { |
| 929 | 929 | $this->getControls()->clear(); |
| 930 | 930 | $this->getItems()->clear(); |
| 931 | - $this->_header = null; |
|
| 932 | - $this->_footer = null; |
|
| 933 | - $this->_topPager = null; |
|
| 934 | - $this->_bottomPager = null; |
|
| 935 | - $this->_useEmptyTemplate = false; |
|
| 931 | + $this->_header=null; |
|
| 932 | + $this->_footer=null; |
|
| 933 | + $this->_topPager=null; |
|
| 934 | + $this->_bottomPager=null; |
|
| 935 | + $this->_useEmptyTemplate=false; |
|
| 936 | 936 | } |
| 937 | 937 | |
| 938 | 938 | /** |
@@ -942,52 +942,52 @@ discard block |
||
| 942 | 942 | { |
| 943 | 943 | $this->reset(); |
| 944 | 944 | |
| 945 | - $allowPaging = $this->getAllowPaging(); |
|
| 945 | + $allowPaging=$this->getAllowPaging(); |
|
| 946 | 946 | |
| 947 | - $itemCount = $this->getViewState('ItemCount', 0); |
|
| 948 | - $dsIndex = $this->getViewState('DataSourceIndex', 0); |
|
| 947 | + $itemCount=$this->getViewState('ItemCount', 0); |
|
| 948 | + $dsIndex=$this->getViewState('DataSourceIndex', 0); |
|
| 949 | 949 | |
| 950 | - $columns = new TList($this->getColumns()); |
|
| 950 | + $columns=new TList($this->getColumns()); |
|
| 951 | 951 | $columns->mergeWith($this->_autoColumns); |
| 952 | - $this->_allColumns = $columns; |
|
| 952 | + $this->_allColumns=$columns; |
|
| 953 | 953 | |
| 954 | - $items = $this->getItems(); |
|
| 954 | + $items=$this->getItems(); |
|
| 955 | 955 | |
| 956 | 956 | if($columns->getCount()) |
| 957 | 957 | { |
| 958 | 958 | foreach($columns as $column) |
| 959 | 959 | $column->initialize(); |
| 960 | - $selectedIndex = $this->getSelectedItemIndex(); |
|
| 961 | - $editIndex = $this->getEditItemIndex(); |
|
| 962 | - for($index = 0;$index < $itemCount;++$index) |
|
| 960 | + $selectedIndex=$this->getSelectedItemIndex(); |
|
| 961 | + $editIndex=$this->getEditItemIndex(); |
|
| 962 | + for($index=0; $index < $itemCount; ++$index) |
|
| 963 | 963 | { |
| 964 | - if($index === 0) |
|
| 964 | + if($index===0) |
|
| 965 | 965 | { |
| 966 | 966 | if($allowPaging) |
| 967 | - $this->_topPager = $this->createPager(); |
|
| 968 | - $this->_header = $this->createItemInternal(-1, -1, TListItemType::Header, false, null, $columns); |
|
| 967 | + $this->_topPager=$this->createPager(); |
|
| 968 | + $this->_header=$this->createItemInternal(-1, -1, TListItemType::Header, false, null, $columns); |
|
| 969 | 969 | } |
| 970 | - if($index === $editIndex) |
|
| 971 | - $itemType = TListItemType::EditItem; |
|
| 972 | - elseif($index === $selectedIndex) |
|
| 973 | - $itemType = TListItemType::SelectedItem; |
|
| 970 | + if($index===$editIndex) |
|
| 971 | + $itemType=TListItemType::EditItem; |
|
| 972 | + elseif($index===$selectedIndex) |
|
| 973 | + $itemType=TListItemType::SelectedItem; |
|
| 974 | 974 | elseif($index % 2) |
| 975 | - $itemType = TListItemType::AlternatingItem; |
|
| 975 | + $itemType=TListItemType::AlternatingItem; |
|
| 976 | 976 | else |
| 977 | - $itemType = TListItemType::Item; |
|
| 977 | + $itemType=TListItemType::Item; |
|
| 978 | 978 | $items->add($this->createItemInternal($index, $dsIndex, $itemType, false, null, $columns)); |
| 979 | 979 | $dsIndex++; |
| 980 | 980 | } |
| 981 | 981 | if($index > 0) |
| 982 | 982 | { |
| 983 | - $this->_footer = $this->createItemInternal(-1, -1, TListItemType::Footer, false, null, $columns); |
|
| 983 | + $this->_footer=$this->createItemInternal(-1, -1, TListItemType::Footer, false, null, $columns); |
|
| 984 | 984 | if($allowPaging) |
| 985 | - $this->_bottomPager = $this->createPager(); |
|
| 985 | + $this->_bottomPager=$this->createPager(); |
|
| 986 | 986 | } |
| 987 | 987 | } |
| 988 | - if(!$dsIndex && $this->_emptyTemplate !== null) |
|
| 988 | + if(!$dsIndex && $this->_emptyTemplate!==null) |
|
| 989 | 989 | { |
| 990 | - $this->_useEmptyTemplate = true; |
|
| 990 | + $this->_useEmptyTemplate=true; |
|
| 991 | 991 | $this->_emptyTemplate->instantiateIn($this); |
| 992 | 992 | } |
| 993 | 993 | } |
@@ -1001,69 +1001,69 @@ discard block |
||
| 1001 | 1001 | protected function performDataBinding($data) |
| 1002 | 1002 | { |
| 1003 | 1003 | $this->reset(); |
| 1004 | - $keys = $this->getDataKeys(); |
|
| 1004 | + $keys=$this->getDataKeys(); |
|
| 1005 | 1005 | $keys->clear(); |
| 1006 | - $keyField = $this->getDataKeyField(); |
|
| 1006 | + $keyField=$this->getDataKeyField(); |
|
| 1007 | 1007 | |
| 1008 | 1008 | // get all columns |
| 1009 | 1009 | if($this->getAutoGenerateColumns()) |
| 1010 | 1010 | { |
| 1011 | - $columns = new TList($this->getColumns()); |
|
| 1012 | - $autoColumns = $this->createAutoColumns($data); |
|
| 1011 | + $columns=new TList($this->getColumns()); |
|
| 1012 | + $autoColumns=$this->createAutoColumns($data); |
|
| 1013 | 1013 | $columns->mergeWith($autoColumns); |
| 1014 | 1014 | } |
| 1015 | 1015 | else |
| 1016 | - $columns = $this->getColumns(); |
|
| 1017 | - $this->_allColumns = $columns; |
|
| 1016 | + $columns=$this->getColumns(); |
|
| 1017 | + $this->_allColumns=$columns; |
|
| 1018 | 1018 | |
| 1019 | - $items = $this->getItems(); |
|
| 1019 | + $items=$this->getItems(); |
|
| 1020 | 1020 | |
| 1021 | - $index = 0; |
|
| 1022 | - $allowPaging = $this->getAllowPaging() && ($data instanceof TPagedDataSource); |
|
| 1023 | - $dsIndex = $allowPaging?$data->getFirstIndexInPage():0; |
|
| 1021 | + $index=0; |
|
| 1022 | + $allowPaging=$this->getAllowPaging() && ($data instanceof TPagedDataSource); |
|
| 1023 | + $dsIndex=$allowPaging ? $data->getFirstIndexInPage() : 0; |
|
| 1024 | 1024 | $this->setViewState('DataSourceIndex', $dsIndex, 0); |
| 1025 | 1025 | if($columns->getCount()) |
| 1026 | 1026 | { |
| 1027 | 1027 | foreach($columns as $column) |
| 1028 | 1028 | $column->initialize(); |
| 1029 | 1029 | |
| 1030 | - $selectedIndex = $this->getSelectedItemIndex(); |
|
| 1031 | - $editIndex = $this->getEditItemIndex(); |
|
| 1030 | + $selectedIndex=$this->getSelectedItemIndex(); |
|
| 1031 | + $editIndex=$this->getEditItemIndex(); |
|
| 1032 | 1032 | foreach($data as $key => $row) |
| 1033 | 1033 | { |
| 1034 | - if($keyField !== '') |
|
| 1034 | + if($keyField!=='') |
|
| 1035 | 1035 | $keys->add($this->getDataFieldValue($row, $keyField)); |
| 1036 | 1036 | else |
| 1037 | 1037 | $keys->add($key); |
| 1038 | - if($index === 0) |
|
| 1038 | + if($index===0) |
|
| 1039 | 1039 | { |
| 1040 | 1040 | if($allowPaging) |
| 1041 | - $this->_topPager = $this->createPager(); |
|
| 1042 | - $this->_header = $this->createItemInternal(-1, -1, TListItemType::Header, true, null, $columns); |
|
| 1041 | + $this->_topPager=$this->createPager(); |
|
| 1042 | + $this->_header=$this->createItemInternal(-1, -1, TListItemType::Header, true, null, $columns); |
|
| 1043 | 1043 | } |
| 1044 | - if($index === $editIndex) |
|
| 1045 | - $itemType = TListItemType::EditItem; |
|
| 1046 | - elseif($index === $selectedIndex) |
|
| 1047 | - $itemType = TListItemType::SelectedItem; |
|
| 1044 | + if($index===$editIndex) |
|
| 1045 | + $itemType=TListItemType::EditItem; |
|
| 1046 | + elseif($index===$selectedIndex) |
|
| 1047 | + $itemType=TListItemType::SelectedItem; |
|
| 1048 | 1048 | elseif($index % 2) |
| 1049 | - $itemType = TListItemType::AlternatingItem; |
|
| 1049 | + $itemType=TListItemType::AlternatingItem; |
|
| 1050 | 1050 | else |
| 1051 | - $itemType = TListItemType::Item; |
|
| 1051 | + $itemType=TListItemType::Item; |
|
| 1052 | 1052 | $items->add($this->createItemInternal($index, $dsIndex, $itemType, true, $row, $columns)); |
| 1053 | 1053 | $index++; |
| 1054 | 1054 | $dsIndex++; |
| 1055 | 1055 | } |
| 1056 | 1056 | if($index > 0) |
| 1057 | 1057 | { |
| 1058 | - $this->_footer = $this->createItemInternal(-1, -1, TListItemType::Footer, true, null, $columns); |
|
| 1058 | + $this->_footer=$this->createItemInternal(-1, -1, TListItemType::Footer, true, null, $columns); |
|
| 1059 | 1059 | if($allowPaging) |
| 1060 | - $this->_bottomPager = $this->createPager(); |
|
| 1060 | + $this->_bottomPager=$this->createPager(); |
|
| 1061 | 1061 | } |
| 1062 | 1062 | } |
| 1063 | 1063 | $this->setViewState('ItemCount', $index, 0); |
| 1064 | - if(!$dsIndex && $this->_emptyTemplate !== null) |
|
| 1064 | + if(!$dsIndex && $this->_emptyTemplate!==null) |
|
| 1065 | 1065 | { |
| 1066 | - $this->_useEmptyTemplate = true; |
|
| 1066 | + $this->_useEmptyTemplate=true; |
|
| 1067 | 1067 | $this->_emptyTemplate->instantiateIn($this); |
| 1068 | 1068 | $this->dataBindChildren(); |
| 1069 | 1069 | } |
@@ -1075,38 +1075,38 @@ discard block |
||
| 1075 | 1075 | */ |
| 1076 | 1076 | private function groupCells() |
| 1077 | 1077 | { |
| 1078 | - if(($columns = $this->_allColumns) === null) |
|
| 1078 | + if(($columns=$this->_allColumns)===null) |
|
| 1079 | 1079 | return; |
| 1080 | - $items = $this->getItems(); |
|
| 1080 | + $items=$this->getItems(); |
|
| 1081 | 1081 | foreach($columns as $id => $column) |
| 1082 | 1082 | { |
| 1083 | 1083 | if(!$column->getEnableCellGrouping()) |
| 1084 | 1084 | continue; |
| 1085 | - $prevCell = null; |
|
| 1086 | - $prevCellText = null; |
|
| 1085 | + $prevCell=null; |
|
| 1086 | + $prevCellText=null; |
|
| 1087 | 1087 | foreach($items as $item) |
| 1088 | 1088 | { |
| 1089 | - $itemType = $item->getItemType(); |
|
| 1090 | - $cell = $item->getCells()->itemAt($id); |
|
| 1089 | + $itemType=$item->getItemType(); |
|
| 1090 | + $cell=$item->getCells()->itemAt($id); |
|
| 1091 | 1091 | if(!$cell->getVisible()) |
| 1092 | 1092 | continue; |
| 1093 | - if($itemType === TListItemType::Item || $itemType === TListItemType::AlternatingItem || $itemType === TListItemType::SelectedItem) |
|
| 1093 | + if($itemType===TListItemType::Item || $itemType===TListItemType::AlternatingItem || $itemType===TListItemType::SelectedItem) |
|
| 1094 | 1094 | { |
| 1095 | - if(($cellText = $this->getCellText($cell)) === '') |
|
| 1095 | + if(($cellText=$this->getCellText($cell))==='') |
|
| 1096 | 1096 | { |
| 1097 | - $prevCell = null; |
|
| 1098 | - $prevCellText = null; |
|
| 1097 | + $prevCell=null; |
|
| 1098 | + $prevCellText=null; |
|
| 1099 | 1099 | continue; |
| 1100 | 1100 | } |
| 1101 | - if($prevCell === null || $prevCellText !== $cellText) |
|
| 1101 | + if($prevCell===null || $prevCellText!==$cellText) |
|
| 1102 | 1102 | { |
| 1103 | - $prevCell = $cell; |
|
| 1104 | - $prevCellText = $cellText; |
|
| 1103 | + $prevCell=$cell; |
|
| 1104 | + $prevCellText=$cellText; |
|
| 1105 | 1105 | } |
| 1106 | 1106 | else |
| 1107 | 1107 | { |
| 1108 | - if(($rowSpan = $prevCell->getRowSpan()) === 0) |
|
| 1109 | - $rowSpan = 1; |
|
| 1108 | + if(($rowSpan=$prevCell->getRowSpan())===0) |
|
| 1109 | + $rowSpan=1; |
|
| 1110 | 1110 | $prevCell->setRowSpan($rowSpan + 1); |
| 1111 | 1111 | $cell->setVisible(false); |
| 1112 | 1112 | } |
@@ -1117,9 +1117,9 @@ discard block |
||
| 1117 | 1117 | |
| 1118 | 1118 | private function getCellText($cell) |
| 1119 | 1119 | { |
| 1120 | - if(($data = $cell->getText()) === '' && $cell->getHasControls()) |
|
| 1120 | + if(($data=$cell->getText())==='' && $cell->getHasControls()) |
|
| 1121 | 1121 | { |
| 1122 | - $controls = $cell->getControls(); |
|
| 1122 | + $controls=$cell->getControls(); |
|
| 1123 | 1123 | foreach($controls as $control) |
| 1124 | 1124 | { |
| 1125 | 1125 | if($control instanceof \Prado\IDataRenderer) |
@@ -1142,9 +1142,9 @@ discard block |
||
| 1142 | 1142 | |
| 1143 | 1143 | private function createItemInternal($itemIndex, $dataSourceIndex, $itemType, $dataBind, $dataItem, $columns) |
| 1144 | 1144 | { |
| 1145 | - $item = $this->createItem($itemIndex, $dataSourceIndex, $itemType); |
|
| 1145 | + $item=$this->createItem($itemIndex, $dataSourceIndex, $itemType); |
|
| 1146 | 1146 | $this->initializeItem($item, $columns); |
| 1147 | - $param = new TDataGridItemEventParameter($item); |
|
| 1147 | + $param=new TDataGridItemEventParameter($item); |
|
| 1148 | 1148 | if($dataBind) |
| 1149 | 1149 | { |
| 1150 | 1150 | $item->setData($dataItem); |
@@ -1168,16 +1168,16 @@ discard block |
||
| 1168 | 1168 | */ |
| 1169 | 1169 | protected function initializeItem($item, $columns) |
| 1170 | 1170 | { |
| 1171 | - $cells = $item->getCells(); |
|
| 1172 | - $itemType = $item->getItemType(); |
|
| 1173 | - $index = 0; |
|
| 1171 | + $cells=$item->getCells(); |
|
| 1172 | + $itemType=$item->getItemType(); |
|
| 1173 | + $index=0; |
|
| 1174 | 1174 | foreach($columns as $column) |
| 1175 | 1175 | { |
| 1176 | - if($itemType === TListItemType::Header) |
|
| 1177 | - $cell = new TTableHeaderCell; |
|
| 1176 | + if($itemType===TListItemType::Header) |
|
| 1177 | + $cell=new TTableHeaderCell; |
|
| 1178 | 1178 | else |
| 1179 | - $cell = new TTableCell; |
|
| 1180 | - if(($id = $column->getID()) !== '') |
|
| 1179 | + $cell=new TTableCell; |
|
| 1180 | + if(($id=$column->getID())!=='') |
|
| 1181 | 1181 | $item->registerObject($id, $cell); |
| 1182 | 1182 | $cells->add($cell); |
| 1183 | 1183 | $column->initializeCell($cell, $index, $itemType); |
@@ -1187,7 +1187,7 @@ discard block |
||
| 1187 | 1187 | |
| 1188 | 1188 | protected function createPager() |
| 1189 | 1189 | { |
| 1190 | - $pager = new TDataGridPager($this); |
|
| 1190 | + $pager=new TDataGridPager($this); |
|
| 1191 | 1191 | $this->buildPager($pager); |
| 1192 | 1192 | $this->onPagerCreated(new TDataGridPagerEventParameter($pager)); |
| 1193 | 1193 | $this->getControls()->add($pager); |
@@ -1226,20 +1226,20 @@ discard block |
||
| 1226 | 1226 | */ |
| 1227 | 1227 | protected function createPagerButton($pager, $buttonType, $enabled, $text, $commandName, $commandParameter) |
| 1228 | 1228 | { |
| 1229 | - if($buttonType === TDataGridPagerButtonType::LinkButton) |
|
| 1229 | + if($buttonType===TDataGridPagerButtonType::LinkButton) |
|
| 1230 | 1230 | { |
| 1231 | 1231 | if($enabled) |
| 1232 | - $button = new TLinkButton; |
|
| 1232 | + $button=new TLinkButton; |
|
| 1233 | 1233 | else |
| 1234 | 1234 | { |
| 1235 | - $button = new TLabel; |
|
| 1235 | + $button=new TLabel; |
|
| 1236 | 1236 | $button->setText($text); |
| 1237 | 1237 | return $button; |
| 1238 | 1238 | } |
| 1239 | 1239 | } |
| 1240 | 1240 | else |
| 1241 | 1241 | { |
| 1242 | - $button = new TButton; |
|
| 1242 | + $button=new TButton; |
|
| 1243 | 1243 | if(!$enabled) |
| 1244 | 1244 | $button->setEnabled(false); |
| 1245 | 1245 | } |
@@ -1256,54 +1256,54 @@ discard block |
||
| 1256 | 1256 | */ |
| 1257 | 1257 | protected function buildNextPrevPager($pager) |
| 1258 | 1258 | { |
| 1259 | - $style = $this->getPagerStyle(); |
|
| 1260 | - $buttonType = $style->getButtonType(); |
|
| 1261 | - $controls = $pager->getControls(); |
|
| 1262 | - $currentPageIndex = $this->getCurrentPageIndex(); |
|
| 1263 | - if($currentPageIndex === 0) |
|
| 1259 | + $style=$this->getPagerStyle(); |
|
| 1260 | + $buttonType=$style->getButtonType(); |
|
| 1261 | + $controls=$pager->getControls(); |
|
| 1262 | + $currentPageIndex=$this->getCurrentPageIndex(); |
|
| 1263 | + if($currentPageIndex===0) |
|
| 1264 | 1264 | { |
| 1265 | - if(($text = $style->getFirstPageText()) !== '') |
|
| 1265 | + if(($text=$style->getFirstPageText())!=='') |
|
| 1266 | 1266 | { |
| 1267 | - $label = $this->createPagerButton($pager, $buttonType, false, $text, '', ''); |
|
| 1267 | + $label=$this->createPagerButton($pager, $buttonType, false, $text, '', ''); |
|
| 1268 | 1268 | $controls->add($label); |
| 1269 | 1269 | $controls->add("\n"); |
| 1270 | 1270 | } |
| 1271 | 1271 | |
| 1272 | - $label = $this->createPagerButton($pager, $buttonType, false, $style->getPrevPageText(), '', ''); |
|
| 1272 | + $label=$this->createPagerButton($pager, $buttonType, false, $style->getPrevPageText(), '', ''); |
|
| 1273 | 1273 | $controls->add($label); |
| 1274 | 1274 | } |
| 1275 | 1275 | else |
| 1276 | 1276 | { |
| 1277 | - if(($text = $style->getFirstPageText()) !== '') |
|
| 1277 | + if(($text=$style->getFirstPageText())!=='') |
|
| 1278 | 1278 | { |
| 1279 | - $button = $this->createPagerButton($pager, $buttonType, true, $text, self::CMD_PAGE, self::CMD_PAGE_FIRST); |
|
| 1279 | + $button=$this->createPagerButton($pager, $buttonType, true, $text, self::CMD_PAGE, self::CMD_PAGE_FIRST); |
|
| 1280 | 1280 | $controls->add($button); |
| 1281 | 1281 | $controls->add("\n"); |
| 1282 | 1282 | } |
| 1283 | 1283 | |
| 1284 | - $button = $this->createPagerButton($pager, $buttonType, true, $style->getPrevPageText(), self::CMD_PAGE, self::CMD_PAGE_PREV); |
|
| 1284 | + $button=$this->createPagerButton($pager, $buttonType, true, $style->getPrevPageText(), self::CMD_PAGE, self::CMD_PAGE_PREV); |
|
| 1285 | 1285 | $controls->add($button); |
| 1286 | 1286 | } |
| 1287 | 1287 | $controls->add("\n"); |
| 1288 | - if($currentPageIndex === $this->getPageCount() - 1) |
|
| 1288 | + if($currentPageIndex===$this->getPageCount() - 1) |
|
| 1289 | 1289 | { |
| 1290 | - $label = $this->createPagerButton($pager, $buttonType, false, $style->getNextPageText(), '', ''); |
|
| 1290 | + $label=$this->createPagerButton($pager, $buttonType, false, $style->getNextPageText(), '', ''); |
|
| 1291 | 1291 | $controls->add($label); |
| 1292 | - if(($text = $style->getLastPageText()) !== '') |
|
| 1292 | + if(($text=$style->getLastPageText())!=='') |
|
| 1293 | 1293 | { |
| 1294 | 1294 | $controls->add("\n"); |
| 1295 | - $label = $this->createPagerButton($pager, $buttonType, false, $text, '', ''); |
|
| 1295 | + $label=$this->createPagerButton($pager, $buttonType, false, $text, '', ''); |
|
| 1296 | 1296 | $controls->add($label); |
| 1297 | 1297 | } |
| 1298 | 1298 | } |
| 1299 | 1299 | else |
| 1300 | 1300 | { |
| 1301 | - $button = $this->createPagerButton($pager, $buttonType, true, $style->getNextPageText(), self::CMD_PAGE, self::CMD_PAGE_NEXT); |
|
| 1301 | + $button=$this->createPagerButton($pager, $buttonType, true, $style->getNextPageText(), self::CMD_PAGE, self::CMD_PAGE_NEXT); |
|
| 1302 | 1302 | $controls->add($button); |
| 1303 | - if(($text = $style->getLastPageText()) !== '') |
|
| 1303 | + if(($text=$style->getLastPageText())!=='') |
|
| 1304 | 1304 | { |
| 1305 | 1305 | $controls->add("\n"); |
| 1306 | - $button = $this->createPagerButton($pager, $buttonType, true, $text, self::CMD_PAGE, self::CMD_PAGE_LAST); |
|
| 1306 | + $button=$this->createPagerButton($pager, $buttonType, true, $text, self::CMD_PAGE, self::CMD_PAGE_LAST); |
|
| 1307 | 1307 | $controls->add($button); |
| 1308 | 1308 | } |
| 1309 | 1309 | } |
@@ -1315,51 +1315,51 @@ discard block |
||
| 1315 | 1315 | */ |
| 1316 | 1316 | protected function buildNumericPager($pager) |
| 1317 | 1317 | { |
| 1318 | - $style = $this->getPagerStyle(); |
|
| 1319 | - $buttonType = $style->getButtonType(); |
|
| 1320 | - $controls = $pager->getControls(); |
|
| 1321 | - $pageCount = $this->getPageCount(); |
|
| 1322 | - $pageIndex = $this->getCurrentPageIndex() + 1; |
|
| 1323 | - $maxButtonCount = $style->getPageButtonCount(); |
|
| 1324 | - $buttonCount = $maxButtonCount > $pageCount?$pageCount:$maxButtonCount; |
|
| 1325 | - $startPageIndex = 1; |
|
| 1326 | - $endPageIndex = $buttonCount; |
|
| 1318 | + $style=$this->getPagerStyle(); |
|
| 1319 | + $buttonType=$style->getButtonType(); |
|
| 1320 | + $controls=$pager->getControls(); |
|
| 1321 | + $pageCount=$this->getPageCount(); |
|
| 1322 | + $pageIndex=$this->getCurrentPageIndex() + 1; |
|
| 1323 | + $maxButtonCount=$style->getPageButtonCount(); |
|
| 1324 | + $buttonCount=$maxButtonCount > $pageCount ? $pageCount : $maxButtonCount; |
|
| 1325 | + $startPageIndex=1; |
|
| 1326 | + $endPageIndex=$buttonCount; |
|
| 1327 | 1327 | if($pageIndex > $endPageIndex) |
| 1328 | 1328 | { |
| 1329 | - $startPageIndex = ((int)(($pageIndex - 1) / $maxButtonCount)) * $maxButtonCount + 1; |
|
| 1330 | - if(($endPageIndex = $startPageIndex + $maxButtonCount - 1) > $pageCount) |
|
| 1331 | - $endPageIndex = $pageCount; |
|
| 1329 | + $startPageIndex=((int) (($pageIndex - 1) / $maxButtonCount)) * $maxButtonCount + 1; |
|
| 1330 | + if(($endPageIndex=$startPageIndex + $maxButtonCount - 1) > $pageCount) |
|
| 1331 | + $endPageIndex=$pageCount; |
|
| 1332 | 1332 | if($endPageIndex - $startPageIndex + 1 < $maxButtonCount) |
| 1333 | 1333 | { |
| 1334 | - if(($startPageIndex = $endPageIndex - $maxButtonCount + 1) < 1) |
|
| 1335 | - $startPageIndex = 1; |
|
| 1334 | + if(($startPageIndex=$endPageIndex - $maxButtonCount + 1) < 1) |
|
| 1335 | + $startPageIndex=1; |
|
| 1336 | 1336 | } |
| 1337 | 1337 | } |
| 1338 | 1338 | |
| 1339 | 1339 | if($startPageIndex > 1) |
| 1340 | 1340 | { |
| 1341 | - if(($text = $style->getFirstPageText()) !== '') |
|
| 1341 | + if(($text=$style->getFirstPageText())!=='') |
|
| 1342 | 1342 | { |
| 1343 | - $button = $this->createPagerButton($pager, $buttonType, true, $text, self::CMD_PAGE, self::CMD_PAGE_FIRST); |
|
| 1343 | + $button=$this->createPagerButton($pager, $buttonType, true, $text, self::CMD_PAGE, self::CMD_PAGE_FIRST); |
|
| 1344 | 1344 | $controls->add($button); |
| 1345 | 1345 | $controls->add("\n"); |
| 1346 | 1346 | } |
| 1347 | - $prevPageIndex = $startPageIndex - 1; |
|
| 1348 | - $button = $this->createPagerButton($pager, $buttonType, true, $style->getPrevPageText(), self::CMD_PAGE, "$prevPageIndex"); |
|
| 1347 | + $prevPageIndex=$startPageIndex - 1; |
|
| 1348 | + $button=$this->createPagerButton($pager, $buttonType, true, $style->getPrevPageText(), self::CMD_PAGE, "$prevPageIndex"); |
|
| 1349 | 1349 | $controls->add($button); |
| 1350 | 1350 | $controls->add("\n"); |
| 1351 | 1351 | } |
| 1352 | 1352 | |
| 1353 | - for($i = $startPageIndex;$i <= $endPageIndex;++$i) |
|
| 1353 | + for($i=$startPageIndex; $i <= $endPageIndex; ++$i) |
|
| 1354 | 1354 | { |
| 1355 | - if($i === $pageIndex) |
|
| 1355 | + if($i===$pageIndex) |
|
| 1356 | 1356 | { |
| 1357 | - $label = $this->createPagerButton($pager, $buttonType, false, "$i", '', ''); |
|
| 1357 | + $label=$this->createPagerButton($pager, $buttonType, false, "$i", '', ''); |
|
| 1358 | 1358 | $controls->add($label); |
| 1359 | 1359 | } |
| 1360 | 1360 | else |
| 1361 | 1361 | { |
| 1362 | - $button = $this->createPagerButton($pager, $buttonType, true, "$i", self::CMD_PAGE, "$i"); |
|
| 1362 | + $button=$this->createPagerButton($pager, $buttonType, true, "$i", self::CMD_PAGE, "$i"); |
|
| 1363 | 1363 | $controls->add($button); |
| 1364 | 1364 | } |
| 1365 | 1365 | if($i < $endPageIndex) |
@@ -1369,13 +1369,13 @@ discard block |
||
| 1369 | 1369 | if($pageCount > $endPageIndex) |
| 1370 | 1370 | { |
| 1371 | 1371 | $controls->add("\n"); |
| 1372 | - $nextPageIndex = $endPageIndex + 1; |
|
| 1373 | - $button = $this->createPagerButton($pager, $buttonType, true, $style->getNextPageText(), self::CMD_PAGE, "$nextPageIndex"); |
|
| 1372 | + $nextPageIndex=$endPageIndex + 1; |
|
| 1373 | + $button=$this->createPagerButton($pager, $buttonType, true, $style->getNextPageText(), self::CMD_PAGE, "$nextPageIndex"); |
|
| 1374 | 1374 | $controls->add($button); |
| 1375 | - if(($text = $style->getLastPageText()) !== '') |
|
| 1375 | + if(($text=$style->getLastPageText())!=='') |
|
| 1376 | 1376 | { |
| 1377 | 1377 | $controls->add("\n"); |
| 1378 | - $button = $this->createPagerButton($pager, $buttonType, true, $text, self::CMD_PAGE, self::CMD_PAGE_LAST); |
|
| 1378 | + $button=$this->createPagerButton($pager, $buttonType, true, $text, self::CMD_PAGE, self::CMD_PAGE_LAST); |
|
| 1379 | 1379 | $controls->add($button); |
| 1380 | 1380 | } |
| 1381 | 1381 | } |
@@ -1390,13 +1390,13 @@ discard block |
||
| 1390 | 1390 | { |
| 1391 | 1391 | if(!$dataSource) |
| 1392 | 1392 | return null; |
| 1393 | - $autoColumns = $this->getAutoColumns(); |
|
| 1393 | + $autoColumns=$this->getAutoColumns(); |
|
| 1394 | 1394 | $autoColumns->clear(); |
| 1395 | 1395 | foreach($dataSource as $row) |
| 1396 | 1396 | { |
| 1397 | 1397 | foreach($row as $key => $value) |
| 1398 | 1398 | { |
| 1399 | - $column = new $this->AutoGenerateColumnName; |
|
| 1399 | + $column=new $this->AutoGenerateColumnName; |
|
| 1400 | 1400 | if(is_string($key)) |
| 1401 | 1401 | { |
| 1402 | 1402 | $column->setHeaderText($key); |
@@ -1430,38 +1430,38 @@ discard block |
||
| 1430 | 1430 | */ |
| 1431 | 1431 | protected function applyItemStyles() |
| 1432 | 1432 | { |
| 1433 | - $itemStyle = $this->getViewState('ItemStyle', null); |
|
| 1433 | + $itemStyle=$this->getViewState('ItemStyle', null); |
|
| 1434 | 1434 | |
| 1435 | - $alternatingItemStyle = $this->getViewState('AlternatingItemStyle', null); |
|
| 1436 | - if($itemStyle !== null) |
|
| 1435 | + $alternatingItemStyle=$this->getViewState('AlternatingItemStyle', null); |
|
| 1436 | + if($itemStyle!==null) |
|
| 1437 | 1437 | { |
| 1438 | - if($alternatingItemStyle === null) |
|
| 1439 | - $alternatingItemStyle = $itemStyle; |
|
| 1438 | + if($alternatingItemStyle===null) |
|
| 1439 | + $alternatingItemStyle=$itemStyle; |
|
| 1440 | 1440 | else |
| 1441 | 1441 | $alternatingItemStyle->mergeWith($itemStyle); |
| 1442 | 1442 | } |
| 1443 | 1443 | |
| 1444 | - $selectedItemStyle = $this->getViewState('SelectedItemStyle', null); |
|
| 1444 | + $selectedItemStyle=$this->getViewState('SelectedItemStyle', null); |
|
| 1445 | 1445 | |
| 1446 | - $editItemStyle = $this->getViewState('EditItemStyle', null); |
|
| 1447 | - if($selectedItemStyle !== null) |
|
| 1446 | + $editItemStyle=$this->getViewState('EditItemStyle', null); |
|
| 1447 | + if($selectedItemStyle!==null) |
|
| 1448 | 1448 | { |
| 1449 | - if($editItemStyle === null) |
|
| 1450 | - $editItemStyle = $selectedItemStyle; |
|
| 1449 | + if($editItemStyle===null) |
|
| 1450 | + $editItemStyle=$selectedItemStyle; |
|
| 1451 | 1451 | else |
| 1452 | 1452 | $editItemStyle->mergeWith($selectedItemStyle); |
| 1453 | 1453 | } |
| 1454 | 1454 | |
| 1455 | - $headerStyle = $this->getViewState('HeaderStyle', null); |
|
| 1456 | - $footerStyle = $this->getViewState('FooterStyle', null); |
|
| 1457 | - $pagerStyle = $this->getViewState('PagerStyle', null); |
|
| 1458 | - $separatorStyle = $this->getViewState('SeparatorStyle', null); |
|
| 1455 | + $headerStyle=$this->getViewState('HeaderStyle', null); |
|
| 1456 | + $footerStyle=$this->getViewState('FooterStyle', null); |
|
| 1457 | + $pagerStyle=$this->getViewState('PagerStyle', null); |
|
| 1458 | + $separatorStyle=$this->getViewState('SeparatorStyle', null); |
|
| 1459 | 1459 | |
| 1460 | 1460 | foreach($this->getControls() as $index => $item) |
| 1461 | 1461 | { |
| 1462 | 1462 | if(!($item instanceof TDataGridItem) && !($item instanceof TDataGridPager)) |
| 1463 | 1463 | continue; |
| 1464 | - $itemType = $item->getItemType(); |
|
| 1464 | + $itemType=$item->getItemType(); |
|
| 1465 | 1465 | switch($itemType) |
| 1466 | 1466 | { |
| 1467 | 1467 | case TListItemType::Header: |
@@ -1491,7 +1491,7 @@ discard block |
||
| 1491 | 1491 | case TListItemType::SelectedItem: |
| 1492 | 1492 | if($selectedItemStyle) |
| 1493 | 1493 | $item->getStyle()->mergeWith($selectedItemStyle); |
| 1494 | - if($index % 2 == 1) |
|
| 1494 | + if($index % 2==1) |
|
| 1495 | 1495 | { |
| 1496 | 1496 | if($itemStyle) |
| 1497 | 1497 | $item->getStyle()->mergeWith($itemStyle); |
@@ -1505,7 +1505,7 @@ discard block |
||
| 1505 | 1505 | case TListItemType::EditItem: |
| 1506 | 1506 | if($editItemStyle) |
| 1507 | 1507 | $item->getStyle()->mergeWith($editItemStyle); |
| 1508 | - if($index % 2 == 1) |
|
| 1508 | + if($index % 2==1) |
|
| 1509 | 1509 | { |
| 1510 | 1510 | if($itemStyle) |
| 1511 | 1511 | $item->getStyle()->mergeWith($itemStyle); |
@@ -1520,14 +1520,14 @@ discard block |
||
| 1520 | 1520 | if($pagerStyle) |
| 1521 | 1521 | { |
| 1522 | 1522 | $item->getStyle()->mergeWith($pagerStyle); |
| 1523 | - if($index === 0) |
|
| 1523 | + if($index===0) |
|
| 1524 | 1524 | { |
| 1525 | - if($pagerStyle->getPosition() === TDataGridPagerPosition::Bottom || !$pagerStyle->getVisible()) |
|
| 1525 | + if($pagerStyle->getPosition()===TDataGridPagerPosition::Bottom || !$pagerStyle->getVisible()) |
|
| 1526 | 1526 | $item->setVisible(false); |
| 1527 | 1527 | } |
| 1528 | 1528 | else |
| 1529 | 1529 | { |
| 1530 | - if($pagerStyle->getPosition() === TDataGridPagerPosition::Top || !$pagerStyle->getVisible()) |
|
| 1530 | + if($pagerStyle->getPosition()===TDataGridPagerPosition::Top || !$pagerStyle->getVisible()) |
|
| 1531 | 1531 | $item->setVisible(false); |
| 1532 | 1532 | } |
| 1533 | 1533 | } |
@@ -1535,25 +1535,25 @@ discard block |
||
| 1535 | 1535 | default: |
| 1536 | 1536 | break; |
| 1537 | 1537 | } |
| 1538 | - if($this->_columns && $itemType !== TListItemType::Pager) |
|
| 1538 | + if($this->_columns && $itemType!==TListItemType::Pager) |
|
| 1539 | 1539 | { |
| 1540 | - $n = $this->_columns->getCount(); |
|
| 1541 | - $cells = $item->getCells(); |
|
| 1542 | - for($i = 0;$i < $n;++$i) |
|
| 1540 | + $n=$this->_columns->getCount(); |
|
| 1541 | + $cells=$item->getCells(); |
|
| 1542 | + for($i=0; $i < $n; ++$i) |
|
| 1543 | 1543 | { |
| 1544 | - $cell = $cells->itemAt($i); |
|
| 1545 | - $column = $this->_columns->itemAt($i); |
|
| 1544 | + $cell=$cells->itemAt($i); |
|
| 1545 | + $column=$this->_columns->itemAt($i); |
|
| 1546 | 1546 | if(!$column->getVisible()) |
| 1547 | 1547 | $cell->setVisible(false); |
| 1548 | 1548 | else |
| 1549 | 1549 | { |
| 1550 | - if($itemType === TListItemType::Header) |
|
| 1551 | - $style = $column->getHeaderStyle(false); |
|
| 1552 | - elseif($itemType === TListItemType::Footer) |
|
| 1553 | - $style = $column->getFooterStyle(false); |
|
| 1550 | + if($itemType===TListItemType::Header) |
|
| 1551 | + $style=$column->getHeaderStyle(false); |
|
| 1552 | + elseif($itemType===TListItemType::Footer) |
|
| 1553 | + $style=$column->getFooterStyle(false); |
|
| 1554 | 1554 | else |
| 1555 | - $style = $column->getItemStyle(false); |
|
| 1556 | - if($style !== null) |
|
| 1555 | + $style=$column->getItemStyle(false); |
|
| 1556 | + if($style!==null) |
|
| 1557 | 1557 | $cell->getStyle()->mergeWith($style); |
| 1558 | 1558 | } |
| 1559 | 1559 | } |
@@ -1568,9 +1568,9 @@ discard block |
||
| 1568 | 1568 | public function renderBeginTag($writer) |
| 1569 | 1569 | { |
| 1570 | 1570 | parent::renderBeginTag($writer); |
| 1571 | - if(($caption = $this->getCaption()) !== '') |
|
| 1571 | + if(($caption=$this->getCaption())!=='') |
|
| 1572 | 1572 | { |
| 1573 | - if(($align = $this->getCaptionAlign()) !== TTableCaptionAlign::NotSet) |
|
| 1573 | + if(($align=$this->getCaptionAlign())!==TTableCaptionAlign::NotSet) |
|
| 1574 | 1574 | $writer->addAttribute('align', strtolower($align)); |
| 1575 | 1575 | $writer->renderBeginTag('caption'); |
| 1576 | 1576 | $writer->write($caption); |
@@ -1589,7 +1589,7 @@ discard block |
||
| 1589 | 1589 | $this->groupCells(); |
| 1590 | 1590 | if($this->_useEmptyTemplate) |
| 1591 | 1591 | { |
| 1592 | - $control = new TWebControl; |
|
| 1592 | + $control=new TWebControl; |
|
| 1593 | 1593 | $control->setID($this->getClientID()); |
| 1594 | 1594 | $control->copyBaseAttributes($this); |
| 1595 | 1595 | if($this->getHasStyle()) |
@@ -1626,14 +1626,14 @@ discard block |
||
| 1626 | 1626 | if($this->_header && $this->_header->getVisible()) |
| 1627 | 1627 | { |
| 1628 | 1628 | $writer->writeLine(); |
| 1629 | - if($style = $this->getViewState('TableHeadStyle', null)) |
|
| 1629 | + if($style=$this->getViewState('TableHeadStyle', null)) |
|
| 1630 | 1630 | $style->addAttributesToRender($writer); |
| 1631 | 1631 | $writer->renderBeginTag('thead'); |
| 1632 | 1632 | $this->_header->render($writer); |
| 1633 | 1633 | $writer->renderEndTag(); |
| 1634 | 1634 | } |
| 1635 | 1635 | $writer->writeLine(); |
| 1636 | - if($style = $this->getViewState('TableBodyStyle', null)) |
|
| 1636 | + if($style=$this->getViewState('TableBodyStyle', null)) |
|
| 1637 | 1637 | $style->addAttributesToRender($writer); |
| 1638 | 1638 | $writer->renderBeginTag('tbody'); |
| 1639 | 1639 | foreach($this->getItems() as $item) |
@@ -1643,7 +1643,7 @@ discard block |
||
| 1643 | 1643 | if($this->_footer && $this->_footer->getVisible()) |
| 1644 | 1644 | { |
| 1645 | 1645 | $writer->writeLine(); |
| 1646 | - if($style = $this->getViewState('TableFootStyle', null)) |
|
| 1646 | + if($style=$this->getViewState('TableFootStyle', null)) |
|
| 1647 | 1647 | $style->addAttributesToRender($writer); |
| 1648 | 1648 | $writer->renderBeginTag('tfoot'); |
| 1649 | 1649 | $this->_footer->render($writer); |
@@ -696,33 +696,27 @@ discard block |
||
| 696 | 696 | $this->setSelectedItemIndex($param->getItem()->getItemIndex()); |
| 697 | 697 | $this->onSelectedIndexChanged($param); |
| 698 | 698 | return true; |
| 699 | - } |
|
| 700 | - elseif(strcasecmp($command, self::CMD_EDIT) === 0) |
|
| 699 | + } elseif(strcasecmp($command, self::CMD_EDIT) === 0) |
|
| 701 | 700 | { |
| 702 | 701 | $this->onEditCommand($param); |
| 703 | 702 | return true; |
| 704 | - } |
|
| 705 | - elseif(strcasecmp($command, self::CMD_DELETE) === 0) |
|
| 703 | + } elseif(strcasecmp($command, self::CMD_DELETE) === 0) |
|
| 706 | 704 | { |
| 707 | 705 | $this->onDeleteCommand($param); |
| 708 | 706 | return true; |
| 709 | - } |
|
| 710 | - elseif(strcasecmp($command, self::CMD_UPDATE) === 0) |
|
| 707 | + } elseif(strcasecmp($command, self::CMD_UPDATE) === 0) |
|
| 711 | 708 | { |
| 712 | 709 | $this->onUpdateCommand($param); |
| 713 | 710 | return true; |
| 714 | - } |
|
| 715 | - elseif(strcasecmp($command, self::CMD_CANCEL) === 0) |
|
| 711 | + } elseif(strcasecmp($command, self::CMD_CANCEL) === 0) |
|
| 716 | 712 | { |
| 717 | 713 | $this->onCancelCommand($param); |
| 718 | 714 | return true; |
| 719 | - } |
|
| 720 | - elseif(strcasecmp($command, self::CMD_SORT) === 0) |
|
| 715 | + } elseif(strcasecmp($command, self::CMD_SORT) === 0) |
|
| 721 | 716 | { |
| 722 | 717 | $this->onSortCommand(new TDataGridSortCommandEventParameter($sender, $param)); |
| 723 | 718 | return true; |
| 724 | - } |
|
| 725 | - elseif(strcasecmp($command, self::CMD_PAGE) === 0) |
|
| 719 | + } elseif(strcasecmp($command, self::CMD_PAGE) === 0) |
|
| 726 | 720 | { |
| 727 | 721 | $p = $param->getCommandParameter(); |
| 728 | 722 | if(strcasecmp($p, self::CMD_PAGE_NEXT) === 0) |
@@ -869,8 +863,7 @@ discard block |
||
| 869 | 863 | foreach($this->_autoColumns as $column) |
| 870 | 864 | $state[] = $column->saveState(); |
| 871 | 865 | $this->setViewState('AutoColumns', $state, []); |
| 872 | - } |
|
| 873 | - else |
|
| 866 | + } else |
|
| 874 | 867 | $this->clearViewState('AutoColumns'); |
| 875 | 868 | if($this->_columns) |
| 876 | 869 | { |
@@ -878,8 +871,7 @@ discard block |
||
| 878 | 871 | foreach($this->_columns as $column) |
| 879 | 872 | $state[] = $column->saveState(); |
| 880 | 873 | $this->setViewState('Columns', $state, []); |
| 881 | - } |
|
| 882 | - else |
|
| 874 | + } else |
|
| 883 | 875 | $this->clearViewState('Columns'); |
| 884 | 876 | } |
| 885 | 877 | |
@@ -904,8 +896,7 @@ discard block |
||
| 904 | 896 | $column->loadState($st); |
| 905 | 897 | $this->_autoColumns->add($column); |
| 906 | 898 | } |
| 907 | - } |
|
| 908 | - else |
|
| 899 | + } else |
|
| 909 | 900 | $this->_autoColumns = null; |
| 910 | 901 | $state = $this->getViewState('Columns', []); |
| 911 | 902 | if($this->_columns && $this->_columns->getCount() === count($state)) |
@@ -1011,8 +1002,7 @@ discard block |
||
| 1011 | 1002 | $columns = new TList($this->getColumns()); |
| 1012 | 1003 | $autoColumns = $this->createAutoColumns($data); |
| 1013 | 1004 | $columns->mergeWith($autoColumns); |
| 1014 | - } |
|
| 1015 | - else |
|
| 1005 | + } else |
|
| 1016 | 1006 | $columns = $this->getColumns(); |
| 1017 | 1007 | $this->_allColumns = $columns; |
| 1018 | 1008 | |
@@ -1102,8 +1092,7 @@ discard block |
||
| 1102 | 1092 | { |
| 1103 | 1093 | $prevCell = $cell; |
| 1104 | 1094 | $prevCellText = $cellText; |
| 1105 | - } |
|
| 1106 | - else |
|
| 1095 | + } else |
|
| 1107 | 1096 | { |
| 1108 | 1097 | if(($rowSpan = $prevCell->getRowSpan()) === 0) |
| 1109 | 1098 | $rowSpan = 1; |
@@ -1152,8 +1141,7 @@ discard block |
||
| 1152 | 1141 | $this->getControls()->add($item); |
| 1153 | 1142 | $item->dataBind(); |
| 1154 | 1143 | $this->onItemDataBound($param); |
| 1155 | - } |
|
| 1156 | - else |
|
| 1144 | + } else |
|
| 1157 | 1145 | { |
| 1158 | 1146 | $this->onItemCreated($param); |
| 1159 | 1147 | $this->getControls()->add($item); |
@@ -1236,8 +1224,7 @@ discard block |
||
| 1236 | 1224 | $button->setText($text); |
| 1237 | 1225 | return $button; |
| 1238 | 1226 | } |
| 1239 | - } |
|
| 1240 | - else |
|
| 1227 | + } else |
|
| 1241 | 1228 | { |
| 1242 | 1229 | $button = new TButton; |
| 1243 | 1230 | if(!$enabled) |
@@ -1271,8 +1258,7 @@ discard block |
||
| 1271 | 1258 | |
| 1272 | 1259 | $label = $this->createPagerButton($pager, $buttonType, false, $style->getPrevPageText(), '', ''); |
| 1273 | 1260 | $controls->add($label); |
| 1274 | - } |
|
| 1275 | - else |
|
| 1261 | + } else |
|
| 1276 | 1262 | { |
| 1277 | 1263 | if(($text = $style->getFirstPageText()) !== '') |
| 1278 | 1264 | { |
@@ -1295,8 +1281,7 @@ discard block |
||
| 1295 | 1281 | $label = $this->createPagerButton($pager, $buttonType, false, $text, '', ''); |
| 1296 | 1282 | $controls->add($label); |
| 1297 | 1283 | } |
| 1298 | - } |
|
| 1299 | - else |
|
| 1284 | + } else |
|
| 1300 | 1285 | { |
| 1301 | 1286 | $button = $this->createPagerButton($pager, $buttonType, true, $style->getNextPageText(), self::CMD_PAGE, self::CMD_PAGE_NEXT); |
| 1302 | 1287 | $controls->add($button); |
@@ -1356,8 +1341,7 @@ discard block |
||
| 1356 | 1341 | { |
| 1357 | 1342 | $label = $this->createPagerButton($pager, $buttonType, false, "$i", '', ''); |
| 1358 | 1343 | $controls->add($label); |
| 1359 | - } |
|
| 1360 | - else |
|
| 1344 | + } else |
|
| 1361 | 1345 | { |
| 1362 | 1346 | $button = $this->createPagerButton($pager, $buttonType, true, "$i", self::CMD_PAGE, "$i"); |
| 1363 | 1347 | $controls->add($button); |
@@ -1403,8 +1387,7 @@ discard block |
||
| 1403 | 1387 | $column->setDataField($key); |
| 1404 | 1388 | $column->setSortExpression($key); |
| 1405 | 1389 | $autoColumns->add($column); |
| 1406 | - } |
|
| 1407 | - else |
|
| 1390 | + } else |
|
| 1408 | 1391 | { |
| 1409 | 1392 | $column->setHeaderText(TListItemType::Item); |
| 1410 | 1393 | $column->setDataField($key); |
@@ -1495,8 +1478,7 @@ discard block |
||
| 1495 | 1478 | { |
| 1496 | 1479 | if($itemStyle) |
| 1497 | 1480 | $item->getStyle()->mergeWith($itemStyle); |
| 1498 | - } |
|
| 1499 | - else |
|
| 1481 | + } else |
|
| 1500 | 1482 | { |
| 1501 | 1483 | if($alternatingItemStyle) |
| 1502 | 1484 | $item->getStyle()->mergeWith($alternatingItemStyle); |
@@ -1509,8 +1491,7 @@ discard block |
||
| 1509 | 1491 | { |
| 1510 | 1492 | if($itemStyle) |
| 1511 | 1493 | $item->getStyle()->mergeWith($itemStyle); |
| 1512 | - } |
|
| 1513 | - else |
|
| 1494 | + } else |
|
| 1514 | 1495 | { |
| 1515 | 1496 | if($alternatingItemStyle) |
| 1516 | 1497 | $item->getStyle()->mergeWith($alternatingItemStyle); |
@@ -1524,8 +1505,7 @@ discard block |
||
| 1524 | 1505 | { |
| 1525 | 1506 | if($pagerStyle->getPosition() === TDataGridPagerPosition::Bottom || !$pagerStyle->getVisible()) |
| 1526 | 1507 | $item->setVisible(false); |
| 1527 | - } |
|
| 1528 | - else |
|
| 1508 | + } else |
|
| 1529 | 1509 | { |
| 1530 | 1510 | if($pagerStyle->getPosition() === TDataGridPagerPosition::Top || !$pagerStyle->getVisible()) |
| 1531 | 1511 | $item->setVisible(false); |
@@ -1597,8 +1577,7 @@ discard block |
||
| 1597 | 1577 | $control->renderBeginTag($writer); |
| 1598 | 1578 | $this->renderContents($writer); |
| 1599 | 1579 | $control->renderEndTag($writer); |
| 1600 | - } |
|
| 1601 | - elseif($this->getViewState('ItemCount', 0) > 0) |
|
| 1580 | + } elseif($this->getViewState('ItemCount', 0) > 0) |
|
| 1602 | 1581 | { |
| 1603 | 1582 | $this->applyItemStyles(); |
| 1604 | 1583 | if($this->_topPager) |
@@ -287,6 +287,7 @@ discard block |
||
| 287 | 287 | * |
| 288 | 288 | * @param string the name of the viewstate value to be returned |
| 289 | 289 | * @param mixed the default value. If $key is not found in viewstate, $defaultValue will be returned |
| 290 | + * @param string $key |
|
| 290 | 291 | * @return mixed the viewstate value corresponding to $key |
| 291 | 292 | */ |
| 292 | 293 | protected function getViewState($key, $defaultValue = null) |
@@ -301,6 +302,7 @@ discard block |
||
| 301 | 302 | * @param string the name of the viewstate value |
| 302 | 303 | * @param mixed the viewstate value to be set |
| 303 | 304 | * @param mixed default value. If $value===$defaultValue, the item will be cleared from the viewstate. |
| 305 | + * @param string $key |
|
| 304 | 306 | */ |
| 305 | 307 | protected function setViewState($key, $value, $defaultValue = null) |
| 306 | 308 | { |
@@ -362,6 +364,7 @@ discard block |
||
| 362 | 364 | * If the data is a component, the field is used as the name of a property. |
| 363 | 365 | * @param mixed data containing the field of value |
| 364 | 366 | * @param string the data field |
| 367 | + * @param string $field |
|
| 365 | 368 | * @return mixed data value at the specified field |
| 366 | 369 | * @throws TInvalidDataValueException if the data or the field is invalid. |
| 367 | 370 | */ |
@@ -521,6 +524,7 @@ discard block |
||
| 521 | 524 | * as the first and second parameters in {@link sprintf}. |
| 522 | 525 | * @param string format string |
| 523 | 526 | * @param mixed the data to be formatted |
| 527 | + * @param string $formatString |
|
| 524 | 528 | * @return string the formatted result |
| 525 | 529 | */ |
| 526 | 530 | protected function formatDataValue($formatString, $value) |
@@ -68,9 +68,9 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | abstract class TDataGridColumn extends \Prado\TApplicationComponent |
| 70 | 70 | { |
| 71 | - private $_id = ''; |
|
| 71 | + private $_id=''; |
|
| 72 | 72 | private $_owner; |
| 73 | - private $_viewState = []; |
|
| 73 | + private $_viewState=[]; |
|
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | 76 | * @return string the ID of the column. |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | { |
| 92 | 92 | if(!preg_match(TControl::ID_FORMAT, $value)) |
| 93 | 93 | throw new TInvalidDataValueException('datagridcolumn_id_invalid', get_class($this), $value); |
| 94 | - $this->_id = $value; |
|
| 94 | + $this->_id=$value; |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
@@ -154,11 +154,11 @@ discard block |
||
| 154 | 154 | * @param boolean whether to create a style if previously not existing |
| 155 | 155 | * @return TTableItemStyle the style for header |
| 156 | 156 | */ |
| 157 | - public function getHeaderStyle($createStyle = true) |
|
| 157 | + public function getHeaderStyle($createStyle=true) |
|
| 158 | 158 | { |
| 159 | - if(($style = $this->getViewState('HeaderStyle', null)) === null && $createStyle) |
|
| 159 | + if(($style=$this->getViewState('HeaderStyle', null))===null && $createStyle) |
|
| 160 | 160 | { |
| 161 | - $style = new TTableItemStyle; |
|
| 161 | + $style=new TTableItemStyle; |
|
| 162 | 162 | $this->setViewState('HeaderStyle', $style, null); |
| 163 | 163 | } |
| 164 | 164 | return $style; |
@@ -208,11 +208,11 @@ discard block |
||
| 208 | 208 | * @param boolean whether to create a style if previously not existing |
| 209 | 209 | * @return TTableItemStyle the style for footer |
| 210 | 210 | */ |
| 211 | - public function getFooterStyle($createStyle = true) |
|
| 211 | + public function getFooterStyle($createStyle=true) |
|
| 212 | 212 | { |
| 213 | - if(($style = $this->getViewState('FooterStyle', null)) === null && $createStyle) |
|
| 213 | + if(($style=$this->getViewState('FooterStyle', null))===null && $createStyle) |
|
| 214 | 214 | { |
| 215 | - $style = new TTableItemStyle; |
|
| 215 | + $style=new TTableItemStyle; |
|
| 216 | 216 | $this->setViewState('FooterStyle', $style, null); |
| 217 | 217 | } |
| 218 | 218 | return $style; |
@@ -222,11 +222,11 @@ discard block |
||
| 222 | 222 | * @param boolean whether to create a style if previously not existing |
| 223 | 223 | * @return TTableItemStyle the style for item |
| 224 | 224 | */ |
| 225 | - public function getItemStyle($createStyle = true) |
|
| 225 | + public function getItemStyle($createStyle=true) |
|
| 226 | 226 | { |
| 227 | - if(($style = $this->getViewState('ItemStyle', null)) === null && $createStyle) |
|
| 227 | + if(($style=$this->getViewState('ItemStyle', null))===null && $createStyle) |
|
| 228 | 228 | { |
| 229 | - $style = new TTableItemStyle; |
|
| 229 | + $style=new TTableItemStyle; |
|
| 230 | 230 | $this->setViewState('ItemStyle', $style, null); |
| 231 | 231 | } |
| 232 | 232 | return $style; |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | /** |
| 270 | 270 | * @return boolean whether the column is visible. Defaults to true. |
| 271 | 271 | */ |
| 272 | - public function getVisible($checkParents = true) |
|
| 272 | + public function getVisible($checkParents=true) |
|
| 273 | 273 | { |
| 274 | 274 | return $this->getViewState('Visible', true); |
| 275 | 275 | } |
@@ -289,9 +289,9 @@ discard block |
||
| 289 | 289 | * @param mixed the default value. If $key is not found in viewstate, $defaultValue will be returned |
| 290 | 290 | * @return mixed the viewstate value corresponding to $key |
| 291 | 291 | */ |
| 292 | - protected function getViewState($key, $defaultValue = null) |
|
| 292 | + protected function getViewState($key, $defaultValue=null) |
|
| 293 | 293 | { |
| 294 | - return isset($this->_viewState[$key])?$this->_viewState[$key]:$defaultValue; |
|
| 294 | + return isset($this->_viewState[$key]) ? $this->_viewState[$key] : $defaultValue; |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /** |
@@ -302,12 +302,12 @@ discard block |
||
| 302 | 302 | * @param mixed the viewstate value to be set |
| 303 | 303 | * @param mixed default value. If $value===$defaultValue, the item will be cleared from the viewstate. |
| 304 | 304 | */ |
| 305 | - protected function setViewState($key, $value, $defaultValue = null) |
|
| 305 | + protected function setViewState($key, $value, $defaultValue=null) |
|
| 306 | 306 | { |
| 307 | - if($value === $defaultValue) |
|
| 307 | + if($value===$defaultValue) |
|
| 308 | 308 | unset($this->_viewState[$key]); |
| 309 | 309 | else |
| 310 | - $this->_viewState[$key] = $value; |
|
| 310 | + $this->_viewState[$key]=$value; |
|
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | /** |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | */ |
| 317 | 317 | public function loadState($state) |
| 318 | 318 | { |
| 319 | - $this->_viewState = $state; |
|
| 319 | + $this->_viewState=$state; |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | /** |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | */ |
| 342 | 342 | public function setOwner(TDataGrid $value) |
| 343 | 343 | { |
| 344 | - $this->_owner = $value; |
|
| 344 | + $this->_owner=$value; |
|
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | /** |
@@ -384,9 +384,9 @@ discard block |
||
| 384 | 384 | */ |
| 385 | 385 | public function initializeCell($cell, $columnIndex, $itemType) |
| 386 | 386 | { |
| 387 | - if($itemType === TListItemType::Header) |
|
| 387 | + if($itemType===TListItemType::Header) |
|
| 388 | 388 | $this->initializeHeaderCell($cell, $columnIndex); |
| 389 | - elseif($itemType === TListItemType::Footer) |
|
| 389 | + elseif($itemType===TListItemType::Footer) |
|
| 390 | 390 | $this->initializeFooterCell($cell, $columnIndex); |
| 391 | 391 | } |
| 392 | 392 | |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | */ |
| 399 | 399 | public function getAllowSorting() |
| 400 | 400 | { |
| 401 | - return $this->getSortExpression() !== '' && (!$this->_owner || $this->_owner->getAllowSorting()); |
|
| 401 | + return $this->getSortExpression()!=='' && (!$this->_owner || $this->_owner->getAllowSorting()); |
|
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | /** |
@@ -417,17 +417,17 @@ discard block |
||
| 417 | 417 | */ |
| 418 | 418 | protected function initializeHeaderCell($cell, $columnIndex) |
| 419 | 419 | { |
| 420 | - $text = $this->getHeaderText(); |
|
| 420 | + $text=$this->getHeaderText(); |
|
| 421 | 421 | |
| 422 | - if(($classPath = $this->getHeaderRenderer()) !== '') |
|
| 422 | + if(($classPath=$this->getHeaderRenderer())!=='') |
|
| 423 | 423 | { |
| 424 | - $control = Prado::createComponent($classPath); |
|
| 424 | + $control=Prado::createComponent($classPath); |
|
| 425 | 425 | $cell->getControls()->add($control); |
| 426 | 426 | if($control instanceof \Prado\IDataRenderer) |
| 427 | 427 | { |
| 428 | 428 | if($control instanceof IItemDataRenderer) |
| 429 | 429 | { |
| 430 | - $item = $cell->getParent(); |
|
| 430 | + $item=$cell->getParent(); |
|
| 431 | 431 | $control->setItemIndex($item->getItemIndex()); |
| 432 | 432 | $control->setItemType($item->getItemType()); |
| 433 | 433 | } |
@@ -436,21 +436,21 @@ discard block |
||
| 436 | 436 | } |
| 437 | 437 | elseif($this->getAllowSorting()) |
| 438 | 438 | { |
| 439 | - $sortExpression = $this->getSortExpression(); |
|
| 440 | - if(($url = $this->getHeaderImageUrl()) !== '') |
|
| 439 | + $sortExpression=$this->getSortExpression(); |
|
| 440 | + if(($url=$this->getHeaderImageUrl())!=='') |
|
| 441 | 441 | { |
| 442 | - $button = new TImageButton; |
|
| 442 | + $button=new TImageButton; |
|
| 443 | 443 | $button->setImageUrl($url); |
| 444 | 444 | $button->setCommandName(TDataGrid::CMD_SORT); |
| 445 | 445 | $button->setCommandParameter($sortExpression); |
| 446 | - if($text !== '') |
|
| 446 | + if($text!=='') |
|
| 447 | 447 | $button->setAlternateText($text); |
| 448 | 448 | $button->setCausesValidation(false); |
| 449 | 449 | $cell->getControls()->add($button); |
| 450 | 450 | } |
| 451 | - elseif($text !== '') |
|
| 451 | + elseif($text!=='') |
|
| 452 | 452 | { |
| 453 | - $button = new TLinkButton; |
|
| 453 | + $button=new TLinkButton; |
|
| 454 | 454 | $button->setText($text); |
| 455 | 455 | $button->setCommandName(TDataGrid::CMD_SORT); |
| 456 | 456 | $button->setCommandParameter($sortExpression); |
@@ -462,15 +462,15 @@ discard block |
||
| 462 | 462 | } |
| 463 | 463 | else |
| 464 | 464 | { |
| 465 | - if(($url = $this->getHeaderImageUrl()) !== '') |
|
| 465 | + if(($url=$this->getHeaderImageUrl())!=='') |
|
| 466 | 466 | { |
| 467 | - $image = new TImage; |
|
| 467 | + $image=new TImage; |
|
| 468 | 468 | $image->setImageUrl($url); |
| 469 | - if($text !== '') |
|
| 469 | + if($text!=='') |
|
| 470 | 470 | $image->setAlternateText($text); |
| 471 | 471 | $cell->getControls()->add($image); |
| 472 | 472 | } |
| 473 | - elseif($text !== '') |
|
| 473 | + elseif($text!=='') |
|
| 474 | 474 | $cell->setText($text); |
| 475 | 475 | else |
| 476 | 476 | $cell->setText(' '); |
@@ -489,23 +489,23 @@ discard block |
||
| 489 | 489 | */ |
| 490 | 490 | protected function initializeFooterCell($cell, $columnIndex) |
| 491 | 491 | { |
| 492 | - $text = $this->getFooterText(); |
|
| 493 | - if(($classPath = $this->getFooterRenderer()) !== '') |
|
| 492 | + $text=$this->getFooterText(); |
|
| 493 | + if(($classPath=$this->getFooterRenderer())!=='') |
|
| 494 | 494 | { |
| 495 | - $control = Prado::createComponent($classPath); |
|
| 495 | + $control=Prado::createComponent($classPath); |
|
| 496 | 496 | $cell->getControls()->add($control); |
| 497 | 497 | if($control instanceof \Prado\IDataRenderer) |
| 498 | 498 | { |
| 499 | 499 | if($control instanceof IItemDataRenderer) |
| 500 | 500 | { |
| 501 | - $item = $cell->getParent(); |
|
| 501 | + $item=$cell->getParent(); |
|
| 502 | 502 | $control->setItemIndex($item->getItemIndex()); |
| 503 | 503 | $control->setItemType($item->getItemType()); |
| 504 | 504 | } |
| 505 | 505 | $control->setData($text); |
| 506 | 506 | } |
| 507 | 507 | } |
| 508 | - elseif($text !== '') |
|
| 508 | + elseif($text!=='') |
|
| 509 | 509 | $cell->setText($text); |
| 510 | 510 | else |
| 511 | 511 | $cell->setText(' '); |
@@ -525,14 +525,14 @@ discard block |
||
| 525 | 525 | */ |
| 526 | 526 | protected function formatDataValue($formatString, $value) |
| 527 | 527 | { |
| 528 | - if($formatString === '') |
|
| 528 | + if($formatString==='') |
|
| 529 | 529 | return TPropertyValue::ensureString($value); |
| 530 | - elseif($formatString[0] === '#') |
|
| 530 | + elseif($formatString[0]==='#') |
|
| 531 | 531 | { |
| 532 | - $expression = strtr(substr($formatString, 1), ['{0}' => '$value']); |
|
| 532 | + $expression=strtr(substr($formatString, 1), ['{0}' => '$value']); |
|
| 533 | 533 | try |
| 534 | 534 | { |
| 535 | - if(eval("\$result=$expression;") === false) |
|
| 535 | + if(eval("\$result=$expression;")===false) |
|
| 536 | 536 | throw new Exception(''); |
| 537 | 537 | return $result; |
| 538 | 538 | } |
@@ -433,8 +433,7 @@ discard block |
||
| 433 | 433 | } |
| 434 | 434 | $control->setData($text); |
| 435 | 435 | } |
| 436 | - } |
|
| 437 | - elseif($this->getAllowSorting()) |
|
| 436 | + } elseif($this->getAllowSorting()) |
|
| 438 | 437 | { |
| 439 | 438 | $sortExpression = $this->getSortExpression(); |
| 440 | 439 | if(($url = $this->getHeaderImageUrl()) !== '') |
@@ -447,8 +446,7 @@ discard block |
||
| 447 | 446 | $button->setAlternateText($text); |
| 448 | 447 | $button->setCausesValidation(false); |
| 449 | 448 | $cell->getControls()->add($button); |
| 450 | - } |
|
| 451 | - elseif($text !== '') |
|
| 449 | + } elseif($text !== '') |
|
| 452 | 450 | { |
| 453 | 451 | $button = new TLinkButton; |
| 454 | 452 | $button->setText($text); |
@@ -456,11 +454,9 @@ discard block |
||
| 456 | 454 | $button->setCommandParameter($sortExpression); |
| 457 | 455 | $button->setCausesValidation(false); |
| 458 | 456 | $cell->getControls()->add($button); |
| 459 | - } |
|
| 460 | - else |
|
| 457 | + } else |
|
| 461 | 458 | $cell->setText(' '); |
| 462 | - } |
|
| 463 | - else |
|
| 459 | + } else |
|
| 464 | 460 | { |
| 465 | 461 | if(($url = $this->getHeaderImageUrl()) !== '') |
| 466 | 462 | { |
@@ -469,8 +465,7 @@ discard block |
||
| 469 | 465 | if($text !== '') |
| 470 | 466 | $image->setAlternateText($text); |
| 471 | 467 | $cell->getControls()->add($image); |
| 472 | - } |
|
| 473 | - elseif($text !== '') |
|
| 468 | + } elseif($text !== '') |
|
| 474 | 469 | $cell->setText($text); |
| 475 | 470 | else |
| 476 | 471 | $cell->setText(' '); |
@@ -504,8 +499,7 @@ discard block |
||
| 504 | 499 | } |
| 505 | 500 | $control->setData($text); |
| 506 | 501 | } |
| 507 | - } |
|
| 508 | - elseif($text !== '') |
|
| 502 | + } elseif($text !== '') |
|
| 509 | 503 | $cell->setText($text); |
| 510 | 504 | else |
| 511 | 505 | $cell->setText(' '); |
@@ -535,13 +529,11 @@ discard block |
||
| 535 | 529 | if(eval("\$result=$expression;") === false) |
| 536 | 530 | throw new Exception(''); |
| 537 | 531 | return $result; |
| 538 | - } |
|
| 539 | - catch(Exception $e) |
|
| 532 | + } catch(Exception $e) |
|
| 540 | 533 | { |
| 541 | 534 | throw new TInvalidDataValueException('datagridcolumn_expression_invalid', get_class($this), $expression, $e->getMessage()); |
| 542 | 535 | } |
| 543 | - } |
|
| 544 | - else |
|
| 536 | + } else |
|
| 545 | 537 | return sprintf($formatString, $value); |
| 546 | 538 | } |
| 547 | 539 | } |
| 548 | 540 | \ No newline at end of file |
@@ -91,6 +91,7 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | 93 | * @param string the local name of the file (where it is after being uploaded). |
| 94 | + * @param string $value |
|
| 94 | 95 | */ |
| 95 | 96 | public function setLocalName($value) |
| 96 | 97 | { |
@@ -110,6 +111,7 @@ discard block |
||
| 110 | 111 | /** |
| 111 | 112 | * Sets the error code describing the status of this file uploading. |
| 112 | 113 | * @param integer the error code |
| 114 | + * @param integer $value |
|
| 113 | 115 | * @see http://www.php.net/manual/en/features.file-upload.errors.php |
| 114 | 116 | */ |
| 115 | 117 | public function setErrorCode($value) |
@@ -130,6 +132,7 @@ discard block |
||
| 130 | 132 | * @param string the file name used to save the uploaded file |
| 131 | 133 | * @param boolean whether to delete the temporary file after saving. |
| 132 | 134 | * If true, you will not be able to save the uploaded file again. |
| 135 | + * @param string $fileName |
|
| 133 | 136 | * @return boolean true if the file saving is successful |
| 134 | 137 | */ |
| 135 | 138 | public function saveAs($fileName, $deleteTempFile = true) |
@@ -28,31 +28,31 @@ discard block |
||
| 28 | 28 | /** |
| 29 | 29 | * @var integer the size of the uploaded file (in bytes) |
| 30 | 30 | */ |
| 31 | - private $_fileSize = 0; |
|
| 31 | + private $_fileSize=0; |
|
| 32 | 32 | /** |
| 33 | 33 | * @var string The original name of the file on the client machine |
| 34 | 34 | */ |
| 35 | - private $_fileName = ''; |
|
| 35 | + private $_fileName=''; |
|
| 36 | 36 | /** |
| 37 | 37 | * @var string the name of the temporary file storing the uploaded file |
| 38 | 38 | */ |
| 39 | - private $_localName = ''; |
|
| 39 | + private $_localName=''; |
|
| 40 | 40 | /** |
| 41 | 41 | * @var string the uploaded file mime type |
| 42 | 42 | */ |
| 43 | - private $_fileType = ''; |
|
| 43 | + private $_fileType=''; |
|
| 44 | 44 | /** |
| 45 | 45 | * @var integer error code of the current file upload |
| 46 | 46 | */ |
| 47 | - private $_errorCode = UPLOAD_ERR_NO_FILE; |
|
| 47 | + private $_errorCode=UPLOAD_ERR_NO_FILE; |
|
| 48 | 48 | |
| 49 | 49 | public function __construct($fileName, $fileSize, $fileType, $errorCode, $localName) |
| 50 | 50 | { |
| 51 | - $this->_fileName = $fileName; |
|
| 52 | - $this->_fileSize = $fileSize; |
|
| 53 | - $this->_fileType = $fileType; |
|
| 54 | - $this->_errorCode = $errorCode; |
|
| 55 | - $this->_localName = $localName; |
|
| 51 | + $this->_fileName=$fileName; |
|
| 52 | + $this->_fileSize=$fileSize; |
|
| 53 | + $this->_fileType=$fileType; |
|
| 54 | + $this->_errorCode=$errorCode; |
|
| 55 | + $this->_localName=$localName; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | public function setLocalName($value) |
| 96 | 96 | { |
| 97 | - $this->_localName = $value; |
|
| 97 | + $this->_localName=$value; |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function setErrorCode($value) |
| 116 | 116 | { |
| 117 | - $this->_errorCode = $value; |
|
| 117 | + $this->_errorCode=$value; |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | /** |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | public function getHasFile() |
| 124 | 124 | { |
| 125 | - return $this->_errorCode === UPLOAD_ERR_OK; |
|
| 125 | + return $this->_errorCode===UPLOAD_ERR_OK; |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /** |
@@ -132,14 +132,14 @@ discard block |
||
| 132 | 132 | * If true, you will not be able to save the uploaded file again. |
| 133 | 133 | * @return boolean true if the file saving is successful |
| 134 | 134 | */ |
| 135 | - public function saveAs($fileName, $deleteTempFile = true) |
|
| 135 | + public function saveAs($fileName, $deleteTempFile=true) |
|
| 136 | 136 | { |
| 137 | - if($this->_errorCode === UPLOAD_ERR_OK) |
|
| 137 | + if($this->_errorCode===UPLOAD_ERR_OK) |
|
| 138 | 138 | { |
| 139 | 139 | if($deleteTempFile) |
| 140 | 140 | return move_uploaded_file($this->_localName, $fileName); |
| 141 | 141 | elseif(is_uploaded_file($this->_localName)) |
| 142 | - return file_put_contents($fileName, file_get_contents($this->_localName)) !== false; |
|
| 142 | + return file_put_contents($fileName, file_get_contents($this->_localName))!==false; |
|
| 143 | 143 | else |
| 144 | 144 | return false; |
| 145 | 145 | } |
@@ -142,8 +142,7 @@ |
||
| 142 | 142 | return file_put_contents($fileName, file_get_contents($this->_localName)) !== false; |
| 143 | 143 | else |
| 144 | 144 | return false; |
| 145 | - } |
|
| 146 | - else |
|
| 145 | + } else |
|
| 147 | 146 | return false; |
| 148 | 147 | } |
| 149 | 148 | |
@@ -36,6 +36,7 @@ discard block |
||
| 36 | 36 | * that must be kept in viewstate. |
| 37 | 37 | * @param string the name of the viewstate value to be returned |
| 38 | 38 | * @param mixed the default value. If $key is not found in viewstate, $defaultValue will be returned |
| 39 | + * @param string $key |
|
| 39 | 40 | * @return mixed the viewstate value corresponding to $key |
| 40 | 41 | */ |
| 41 | 42 | protected function getViewState($key, $defaultValue = null) |
@@ -52,6 +53,7 @@ discard block |
||
| 52 | 53 | * @param string the name of the viewstate value |
| 53 | 54 | * @param mixed the viewstate value to be set |
| 54 | 55 | * @param mixed default value. If $value===$defaultValue, the item will be cleared from the viewstate. |
| 56 | + * @param string $key |
|
| 55 | 57 | */ |
| 56 | 58 | protected function setViewState($key, $value, $defaultValue = null) |
| 57 | 59 | { |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | abstract class THotSpot extends \Prado\TComponent |
| 29 | 29 | { |
| 30 | - private $_viewState = []; |
|
| 30 | + private $_viewState=[]; |
|
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * Returns a viewstate value. |
@@ -38,9 +38,9 @@ discard block |
||
| 38 | 38 | * @param mixed the default value. If $key is not found in viewstate, $defaultValue will be returned |
| 39 | 39 | * @return mixed the viewstate value corresponding to $key |
| 40 | 40 | */ |
| 41 | - protected function getViewState($key, $defaultValue = null) |
|
| 41 | + protected function getViewState($key, $defaultValue=null) |
|
| 42 | 42 | { |
| 43 | - return isset($this->_viewState[$key])?$this->_viewState[$key]:$defaultValue; |
|
| 43 | + return isset($this->_viewState[$key]) ? $this->_viewState[$key] : $defaultValue; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
@@ -53,12 +53,12 @@ discard block |
||
| 53 | 53 | * @param mixed the viewstate value to be set |
| 54 | 54 | * @param mixed default value. If $value===$defaultValue, the item will be cleared from the viewstate. |
| 55 | 55 | */ |
| 56 | - protected function setViewState($key, $value, $defaultValue = null) |
|
| 56 | + protected function setViewState($key, $value, $defaultValue=null) |
|
| 57 | 57 | { |
| 58 | - if($value === $defaultValue) |
|
| 58 | + if($value===$defaultValue) |
|
| 59 | 59 | unset($this->_viewState[$key]); |
| 60 | 60 | else |
| 61 | - $this->_viewState[$key] = $value; |
|
| 61 | + $this->_viewState[$key]=$value; |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | */ |
| 222 | 222 | public function getHasAttributes() |
| 223 | 223 | { |
| 224 | - if($attributes = $this->getViewState('Attributes', null)) |
|
| 224 | + if($attributes=$this->getViewState('Attributes', null)) |
|
| 225 | 225 | return $attributes->getCount() > 0; |
| 226 | 226 | else |
| 227 | 227 | return false; |
@@ -235,11 +235,11 @@ discard block |
||
| 235 | 235 | */ |
| 236 | 236 | public function getAttributes() |
| 237 | 237 | { |
| 238 | - if($attributes = $this->getViewState('Attributes', null)) |
|
| 238 | + if($attributes=$this->getViewState('Attributes', null)) |
|
| 239 | 239 | return $attributes; |
| 240 | 240 | else |
| 241 | 241 | { |
| 242 | - $attributes = new TAttributeCollection; |
|
| 242 | + $attributes=new TAttributeCollection; |
|
| 243 | 243 | $this->setViewState('Attributes', $attributes, null); |
| 244 | 244 | return $attributes; |
| 245 | 245 | } |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | */ |
| 251 | 251 | public function hasAttribute($name) |
| 252 | 252 | { |
| 253 | - if($attributes = $this->getViewState('Attributes', null)) |
|
| 253 | + if($attributes=$this->getViewState('Attributes', null)) |
|
| 254 | 254 | return $attributes->contains($name); |
| 255 | 255 | else |
| 256 | 256 | return false; |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | */ |
| 262 | 262 | public function getAttribute($name) |
| 263 | 263 | { |
| 264 | - if($attributes = $this->getViewState('Attributes', null)) |
|
| 264 | + if($attributes=$this->getViewState('Attributes', null)) |
|
| 265 | 265 | return $attributes->itemAt($name); |
| 266 | 266 | else |
| 267 | 267 | return null; |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | */ |
| 285 | 285 | public function removeAttribute($name) |
| 286 | 286 | { |
| 287 | - if($attributes = $this->getViewState('Attributes', null)) |
|
| 287 | + if($attributes=$this->getViewState('Attributes', null)) |
|
| 288 | 288 | return $attributes->remove($name); |
| 289 | 289 | else |
| 290 | 290 | return null; |
@@ -298,22 +298,22 @@ discard block |
||
| 298 | 298 | { |
| 299 | 299 | $writer->addAttribute('shape', $this->getShape()); |
| 300 | 300 | $writer->addAttribute('coords', $this->getCoordinates()); |
| 301 | - if(($mode = $this->getHotSpotMode()) === THotSpotMode::NotSet) |
|
| 302 | - $mode = THotSpotMode::Navigate; |
|
| 303 | - if($mode === THotSpotMode::Navigate) |
|
| 301 | + if(($mode=$this->getHotSpotMode())===THotSpotMode::NotSet) |
|
| 302 | + $mode=THotSpotMode::Navigate; |
|
| 303 | + if($mode===THotSpotMode::Navigate) |
|
| 304 | 304 | { |
| 305 | 305 | $writer->addAttribute('href', $this->getNavigateUrl()); |
| 306 | - if(($target = $this->getTarget()) !== '') |
|
| 306 | + if(($target=$this->getTarget())!=='') |
|
| 307 | 307 | $writer->addAttribute('target', $target); |
| 308 | 308 | } |
| 309 | - elseif($mode === THotSpotMode::Inactive) |
|
| 309 | + elseif($mode===THotSpotMode::Inactive) |
|
| 310 | 310 | $writer->addAttribute('nohref', 'true'); |
| 311 | - $text = $this->getAlternateText(); |
|
| 311 | + $text=$this->getAlternateText(); |
|
| 312 | 312 | $writer->addAttribute('title', $text); |
| 313 | 313 | $writer->addAttribute('alt', $text); |
| 314 | - if(($accessKey = $this->getAccessKey()) !== '') |
|
| 314 | + if(($accessKey=$this->getAccessKey())!=='') |
|
| 315 | 315 | $writer->addAttribute('accesskey', $accessKey); |
| 316 | - if(($tabIndex = $this->getTabIndex()) !== 0) |
|
| 316 | + if(($tabIndex=$this->getTabIndex())!==0) |
|
| 317 | 317 | $writer->addAttribute('tabindex', "$tabIndex"); |
| 318 | 318 | if($this->getHasAttributes()) |
| 319 | 319 | { |
@@ -305,8 +305,7 @@ |
||
| 305 | 305 | $writer->addAttribute('href', $this->getNavigateUrl()); |
| 306 | 306 | if(($target = $this->getTarget()) !== '') |
| 307 | 307 | $writer->addAttribute('target', $target); |
| 308 | - } |
|
| 309 | - elseif($mode === THotSpotMode::Inactive) |
|
| 308 | + } elseif($mode === THotSpotMode::Inactive) |
|
| 310 | 309 | $writer->addAttribute('nohref', 'true'); |
| 311 | 310 | $text = $this->getAlternateText(); |
| 312 | 311 | $writer->addAttribute('title', $text); |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | private $_active = false; |
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | - * @return the tag name for the view element |
|
| 43 | + * @return string tag name for the view element |
|
| 44 | 44 | */ |
| 45 | 45 | protected function getTagName() |
| 46 | 46 | { |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | class TTabView extends \Prado\Web\UI\WebControls\TWebControl |
| 39 | 39 | { |
| 40 | - private $_active = false; |
|
| 40 | + private $_active=false; |
|
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * @return the tag name for the view element |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | public function setActive($value) |
| 130 | 130 | { |
| 131 | - $this->_active = TPropertyValue::ensureBoolean($value); |
|
| 131 | + $this->_active=TPropertyValue::ensureBoolean($value); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | public function renderContents($writer) |
| 139 | 139 | { |
| 140 | - if(($text = $this->getText()) !== '') |
|
| 140 | + if(($text=$this->getText())!=='') |
|
| 141 | 141 | $writer->write($text); |
| 142 | 142 | elseif($this->getHasControls()) |
| 143 | 143 | parent::renderContents($writer); |
@@ -151,9 +151,9 @@ discard block |
||
| 151 | 151 | { |
| 152 | 152 | if($this->getVisible(false) && $this->getPage()->getClientSupportsJavaScript()) |
| 153 | 153 | { |
| 154 | - $writer->addAttribute('id', $this->getClientID() . '_0'); |
|
| 154 | + $writer->addAttribute('id', $this->getClientID().'_0'); |
|
| 155 | 155 | |
| 156 | - $style = $this->getActive()?$this->getParent()->getActiveTabStyle():$this->getParent()->getTabStyle(); |
|
| 156 | + $style=$this->getActive() ? $this->getParent()->getActiveTabStyle() : $this->getParent()->getTabStyle(); |
|
| 157 | 157 | $style->addAttributesToRender($writer); |
| 158 | 158 | |
| 159 | 159 | $writer->renderBeginTag($this->getTagName()); |
@@ -171,10 +171,10 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | protected function renderTabContent($writer) |
| 173 | 173 | { |
| 174 | - if(($url = $this->getNavigateUrl()) === '') |
|
| 175 | - $url = 'javascript://'; |
|
| 176 | - if(($caption = $this->getCaption()) === '') |
|
| 177 | - $caption = ' '; |
|
| 174 | + if(($url=$this->getNavigateUrl())==='') |
|
| 175 | + $url='javascript://'; |
|
| 176 | + if(($caption=$this->getCaption())==='') |
|
| 177 | + $caption=' '; |
|
| 178 | 178 | $writer->write("<a href=\"{$url}\">{$caption}</a>"); |
| 179 | 179 | } |
| 180 | 180 | } |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function setFileName($value) |
| 52 | 52 | { |
| 53 | - $this->_fileName = $value; |
|
| 54 | - $this->_timestamp = @filemtime($value); |
|
| 53 | + $this->_fileName=$value; |
|
| 54 | + $this->_timestamp=@filemtime($value); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -69,6 +69,6 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function getHasChanged() |
| 71 | 71 | { |
| 72 | - return @filemtime($this->_fileName) !== $this->_timestamp; |
|
| 72 | + return @filemtime($this->_fileName)!==$this->_timestamp; |
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | \ No newline at end of file |