@@ -267,6 +267,7 @@ discard block |
||
267 | 267 | |
268 | 268 | /** |
269 | 269 | * @param string the public key used for generating the token. A random one will be generated if this is not set. |
270 | + * @param string $value |
|
270 | 271 | */ |
271 | 272 | public function setPublicKey($value) |
272 | 273 | { |
@@ -322,6 +323,7 @@ discard block |
||
322 | 323 | /** |
323 | 324 | * Validates a user input with the token. |
324 | 325 | * @param string user input |
326 | + * @param string $input |
|
325 | 327 | * @return boolean if the user input is not the same as the token. |
326 | 328 | */ |
327 | 329 | public function validate($input) |
@@ -447,6 +449,11 @@ discard block |
||
447 | 449 | * @param string private key |
448 | 450 | * @param integer the length of the token |
449 | 451 | * @param boolean whether the token is case sensitive |
452 | + * @param string $publicKey |
|
453 | + * @param string $privateKey |
|
454 | + * @param string $alphabet |
|
455 | + * @param integer $tokenLength |
|
456 | + * @param boolean $caseSensitive |
|
450 | 457 | * @return string the token generated. |
451 | 458 | */ |
452 | 459 | protected function generateToken($publicKey,$privateKey,$alphabet,$tokenLength,$caseSensitive) |
@@ -459,6 +466,7 @@ discard block |
||
459 | 466 | * Converts a hash string into a string with characters consisting of alphanumeric characters. |
460 | 467 | * @param string the hexadecimal representation of the hash string |
461 | 468 | * @param string the alphabet used to represent the converted string. If empty, it means '234578adefhijmnrtwyABDEFGHIJLMNQRTWY', which excludes those confusing characters. |
469 | + * @param string $hex |
|
462 | 470 | * @return string the converted string |
463 | 471 | */ |
464 | 472 | protected function hash2string($hex,$alphabet='') |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function getTokenImageTheme() |
73 | 73 | { |
74 | - return $this->getViewState('TokenImageTheme',0); |
|
74 | + return $this->getViewState('TokenImageTheme', 0); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | public function setTokenImageTheme($value) |
91 | 91 | { |
92 | 92 | $value=TPropertyValue::ensureInteger($value); |
93 | - if($value>=0 && $value<=63) |
|
94 | - $this->setViewState('TokenImageTheme',$value,0); |
|
93 | + if($value >= 0 && $value <= 63) |
|
94 | + $this->setViewState('TokenImageTheme', $value, 0); |
|
95 | 95 | else |
96 | - throw new TConfigurationException('captcha_tokenimagetheme_invalid',0,63); |
|
96 | + throw new TConfigurationException('captcha_tokenimagetheme_invalid', 0, 63); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function getTokenFontSize() |
103 | 103 | { |
104 | - return $this->getViewState('TokenFontSize',30); |
|
104 | + return $this->getViewState('TokenFontSize', 30); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -113,10 +113,10 @@ discard block |
||
113 | 113 | public function setTokenFontSize($value) |
114 | 114 | { |
115 | 115 | $value=TPropertyValue::ensureInteger($value); |
116 | - if($value>=20 && $value<=100) |
|
117 | - $this->setViewState('TokenFontSize',$value,30); |
|
116 | + if($value >= 20 && $value <= 100) |
|
117 | + $this->setViewState('TokenFontSize', $value, 30); |
|
118 | 118 | else |
119 | - throw new TConfigurationException('captcha_tokenfontsize_invalid',20,100); |
|
119 | + throw new TConfigurationException('captcha_tokenfontsize_invalid', 20, 100); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public function getMinTokenLength() |
126 | 126 | { |
127 | - return $this->getViewState('MinTokenLength',4); |
|
127 | + return $this->getViewState('MinTokenLength', 4); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -133,10 +133,10 @@ discard block |
||
133 | 133 | public function setMinTokenLength($value) |
134 | 134 | { |
135 | 135 | $length=TPropertyValue::ensureInteger($value); |
136 | - if($length>=self::MIN_TOKEN_LENGTH && $length<=self::MAX_TOKEN_LENGTH) |
|
137 | - $this->setViewState('MinTokenLength',$length,4); |
|
136 | + if($length >= self::MIN_TOKEN_LENGTH && $length <= self::MAX_TOKEN_LENGTH) |
|
137 | + $this->setViewState('MinTokenLength', $length, 4); |
|
138 | 138 | else |
139 | - throw new TConfigurationException('captcha_mintokenlength_invalid',self::MIN_TOKEN_LENGTH,self::MAX_TOKEN_LENGTH); |
|
139 | + throw new TConfigurationException('captcha_mintokenlength_invalid', self::MIN_TOKEN_LENGTH, self::MAX_TOKEN_LENGTH); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public function getMaxTokenLength() |
146 | 146 | { |
147 | - return $this->getViewState('MaxTokenLength',6); |
|
147 | + return $this->getViewState('MaxTokenLength', 6); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -153,10 +153,10 @@ discard block |
||
153 | 153 | public function setMaxTokenLength($value) |
154 | 154 | { |
155 | 155 | $length=TPropertyValue::ensureInteger($value); |
156 | - if($length>=self::MIN_TOKEN_LENGTH && $length<=self::MAX_TOKEN_LENGTH) |
|
157 | - $this->setViewState('MaxTokenLength',$length,6); |
|
156 | + if($length >= self::MIN_TOKEN_LENGTH && $length <= self::MAX_TOKEN_LENGTH) |
|
157 | + $this->setViewState('MaxTokenLength', $length, 6); |
|
158 | 158 | else |
159 | - throw new TConfigurationException('captcha_maxtokenlength_invalid',self::MIN_TOKEN_LENGTH,self::MAX_TOKEN_LENGTH); |
|
159 | + throw new TConfigurationException('captcha_maxtokenlength_invalid', self::MIN_TOKEN_LENGTH, self::MAX_TOKEN_LENGTH); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | */ |
165 | 165 | public function getCaseSensitive() |
166 | 166 | { |
167 | - return $this->getViewState('CaseSensitive',true); |
|
167 | + return $this->getViewState('CaseSensitive', true); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | */ |
173 | 173 | public function setCaseSensitive($value) |
174 | 174 | { |
175 | - $this->setViewState('CaseSensitive',TPropertyValue::ensureBoolean($value),true); |
|
175 | + $this->setViewState('CaseSensitive', TPropertyValue::ensureBoolean($value), true); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | /** |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | */ |
181 | 181 | public function getTokenAlphabet() |
182 | 182 | { |
183 | - return $this->getViewState('TokenAlphabet','234578adefhijmnrtABDEFGHJLMNRT'); |
|
183 | + return $this->getViewState('TokenAlphabet', '234578adefhijmnrtABDEFGHJLMNRT'); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | /** |
@@ -188,9 +188,9 @@ discard block |
||
188 | 188 | */ |
189 | 189 | public function setTokenAlphabet($value) |
190 | 190 | { |
191 | - if(strlen($value)<2) |
|
191 | + if(strlen($value) < 2) |
|
192 | 192 | throw new TConfigurationException('captcha_tokenalphabet_invalid'); |
193 | - $this->setViewState('TokenAlphabet',$value,'234578adefhijmnrtABDEFGHJLMNRT'); |
|
193 | + $this->setViewState('TokenAlphabet', $value, '234578adefhijmnrtABDEFGHJLMNRT'); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | /** |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public function getTokenExpiry() |
200 | 200 | { |
201 | - return $this->getViewState('TokenExpiry',600); |
|
201 | + return $this->getViewState('TokenExpiry', 600); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | */ |
207 | 207 | public function setTokenExpiry($value) |
208 | 208 | { |
209 | - $this->setViewState('TokenExpiry',TPropertyValue::ensureInteger($value),600); |
|
209 | + $this->setViewState('TokenExpiry', TPropertyValue::ensureInteger($value), 600); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | /** |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | */ |
215 | 215 | public function getChangingTokenBackground() |
216 | 216 | { |
217 | - return $this->getViewState('ChangingTokenBackground',false); |
|
217 | + return $this->getViewState('ChangingTokenBackground', false); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | /** |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | */ |
223 | 223 | public function setChangingTokenBackground($value) |
224 | 224 | { |
225 | - $this->setViewState('ChangingTokenBackground',TPropertyValue::ensureBoolean($value),false); |
|
225 | + $this->setViewState('ChangingTokenBackground', TPropertyValue::ensureBoolean($value), false); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | */ |
231 | 231 | public function getTestLimit() |
232 | 232 | { |
233 | - return $this->getViewState('TestLimit',5); |
|
233 | + return $this->getViewState('TestLimit', 5); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | /** |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | */ |
239 | 239 | public function setTestLimit($value) |
240 | 240 | { |
241 | - $this->setViewState('TestLimit',TPropertyValue::ensureInteger($value),5); |
|
241 | + $this->setViewState('TestLimit', TPropertyValue::ensureInteger($value), 5); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -246,8 +246,8 @@ discard block |
||
246 | 246 | */ |
247 | 247 | public function getIsTokenExpired() |
248 | 248 | { |
249 | - if(($expiry=$this->getTokenExpiry())>0 && ($start=$this->getViewState('TokenGenerated',0))>0) |
|
250 | - return $expiry+$start<time(); |
|
249 | + if(($expiry=$this->getTokenExpiry()) > 0 && ($start=$this->getViewState('TokenGenerated', 0)) > 0) |
|
250 | + return $expiry + $start < time(); |
|
251 | 251 | else |
252 | 252 | return false; |
253 | 253 | } |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | */ |
258 | 258 | public function getPublicKey() |
259 | 259 | { |
260 | - if(($publicKey=$this->getViewState('PublicKey',''))==='') |
|
260 | + if(($publicKey=$this->getViewState('PublicKey', ''))==='') |
|
261 | 261 | { |
262 | 262 | $publicKey=$this->generateRandomKey(); |
263 | 263 | $this->setPublicKey($publicKey); |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | */ |
271 | 271 | public function setPublicKey($value) |
272 | 272 | { |
273 | - $this->setViewState('PublicKey',$value,''); |
|
273 | + $this->setViewState('PublicKey', $value, ''); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | /** |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | */ |
279 | 279 | public function getToken() |
280 | 280 | { |
281 | - return $this->generateToken($this->getPublicKey(),$this->getPrivateKey(),$this->getTokenAlphabet(),$this->getTokenLength(),$this->getCaseSensitive()); |
|
281 | + return $this->generateToken($this->getPublicKey(), $this->getPrivateKey(), $this->getTokenAlphabet(), $this->getTokenLength(), $this->getCaseSensitive()); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | /** |
@@ -290,13 +290,13 @@ discard block |
||
290 | 290 | { |
291 | 291 | $minLength=$this->getMinTokenLength(); |
292 | 292 | $maxLength=$this->getMaxTokenLength(); |
293 | - if($minLength>$maxLength) |
|
294 | - $tokenLength=rand($maxLength,$minLength); |
|
295 | - else if($minLength<$maxLength) |
|
296 | - $tokenLength=rand($minLength,$maxLength); |
|
293 | + if($minLength > $maxLength) |
|
294 | + $tokenLength=rand($maxLength, $minLength); |
|
295 | + else if($minLength < $maxLength) |
|
296 | + $tokenLength=rand($minLength, $maxLength); |
|
297 | 297 | else |
298 | 298 | $tokenLength=$minLength; |
299 | - $this->setViewState('TokenLength',$tokenLength); |
|
299 | + $this->setViewState('TokenLength', $tokenLength); |
|
300 | 300 | } |
301 | 301 | return $tokenLength; |
302 | 302 | } |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | $fileName=$this->generatePrivateKeyFile(); |
312 | 312 | $content=file_get_contents($fileName); |
313 | 313 | $matches=array(); |
314 | - if(preg_match("/privateKey='(.*?)'/ms",$content,$matches)>0) |
|
314 | + if(preg_match("/privateKey='(.*?)'/ms", $content, $matches) > 0) |
|
315 | 315 | $this->_privateKey=$matches[1]; |
316 | 316 | else |
317 | 317 | throw new TConfigurationException('captcha_privatekey_unknown'); |
@@ -326,18 +326,18 @@ discard block |
||
326 | 326 | */ |
327 | 327 | public function validate($input) |
328 | 328 | { |
329 | - $number=$this->getViewState('TestNumber',0); |
|
329 | + $number=$this->getViewState('TestNumber', 0); |
|
330 | 330 | if(!$this->_validated) |
331 | 331 | { |
332 | - $this->setViewState('TestNumber',++$number); |
|
332 | + $this->setViewState('TestNumber', ++$number); |
|
333 | 333 | $this->_validated=true; |
334 | 334 | } |
335 | - if($this->getIsTokenExpired() || (($limit=$this->getTestLimit())>0 && $number>$limit)) |
|
335 | + if($this->getIsTokenExpired() || (($limit=$this->getTestLimit()) > 0 && $number > $limit)) |
|
336 | 336 | { |
337 | 337 | $this->regenerateToken(); |
338 | 338 | return false; |
339 | 339 | } |
340 | - return ($this->getToken()===($this->getCaseSensitive()?$input:strtoupper($input))); |
|
340 | + return ($this->getToken()===($this->getCaseSensitive() ? $input : strtoupper($input))); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | /** |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | $this->setPublicKey(''); |
352 | 352 | $this->clearViewState('TokenGenerated'); |
353 | 353 | $this->clearViewState('RandomSeed'); |
354 | - $this->clearViewState('TestNumber',0); |
|
354 | + $this->clearViewState('TestNumber', 0); |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | /** |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | parent::onPreRender($param); |
364 | 364 | if(!self::checkRequirements()) |
365 | 365 | throw new TConfigurationException('captcha_imagettftext_required'); |
366 | - if(!$this->getViewState('TokenGenerated',0)) |
|
366 | + if(!$this->getViewState('TokenGenerated', 0)) |
|
367 | 367 | { |
368 | 368 | $manager=$this->getApplication()->getAssetManager(); |
369 | 369 | $manager->publishFilePath($this->getFontFile()); |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | $url.='?options='.urlencode($this->getTokenImageOptions()); |
372 | 372 | $this->setImageUrl($url); |
373 | 373 | |
374 | - $this->setViewState('TokenGenerated',time()); |
|
374 | + $this->setViewState('TokenGenerated', time()); |
|
375 | 375 | } |
376 | 376 | } |
377 | 377 | |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | */ |
381 | 381 | protected function getTokenImageOptions() |
382 | 382 | { |
383 | - $privateKey=$this->getPrivateKey(); // call this method to ensure private key is generated |
|
383 | + $privateKey=$this->getPrivateKey(); // call this method to ensure private key is generated |
|
384 | 384 | $token=$this->getToken(); |
385 | 385 | $options=array(); |
386 | 386 | $options['publicKey']=$this->getPublicKey(); |
@@ -389,12 +389,12 @@ discard block |
||
389 | 389 | $options['alphabet']=$this->getTokenAlphabet(); |
390 | 390 | $options['fontSize']=$this->getTokenFontSize(); |
391 | 391 | $options['theme']=$this->getTokenImageTheme(); |
392 | - if(($randomSeed=$this->getViewState('RandomSeed',0))===0) |
|
392 | + if(($randomSeed=$this->getViewState('RandomSeed', 0))===0) |
|
393 | 393 | { |
394 | - $randomSeed=(int)(microtime()*1000000); |
|
395 | - $this->setViewState('RandomSeed',$randomSeed); |
|
394 | + $randomSeed=(int) (microtime() * 1000000); |
|
395 | + $this->setViewState('RandomSeed', $randomSeed); |
|
396 | 396 | } |
397 | - $options['randomSeed']=$this->getChangingTokenBackground()?0:$randomSeed; |
|
397 | + $options['randomSeed']=$this->getChangingTokenBackground() ? 0 : $randomSeed; |
|
398 | 398 | $str=serialize($options); |
399 | 399 | return base64_encode(md5($privateKey.$str).$str); |
400 | 400 | } |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | $content="<?php |
429 | 429 | \$privateKey='$key'; |
430 | 430 | ?>"; |
431 | - file_put_contents($fileName,$content); |
|
431 | + file_put_contents($fileName, $content); |
|
432 | 432 | } |
433 | 433 | return $fileName; |
434 | 434 | } |
@@ -449,10 +449,10 @@ discard block |
||
449 | 449 | * @param boolean whether the token is case sensitive |
450 | 450 | * @return string the token generated. |
451 | 451 | */ |
452 | - protected function generateToken($publicKey,$privateKey,$alphabet,$tokenLength,$caseSensitive) |
|
452 | + protected function generateToken($publicKey, $privateKey, $alphabet, $tokenLength, $caseSensitive) |
|
453 | 453 | { |
454 | - $token=substr($this->hash2string(md5($publicKey.$privateKey),$alphabet).$this->hash2string(md5($privateKey.$publicKey),$alphabet),0,$tokenLength); |
|
455 | - return $caseSensitive?$token:strtoupper($token); |
|
454 | + $token=substr($this->hash2string(md5($publicKey.$privateKey), $alphabet).$this->hash2string(md5($privateKey.$publicKey), $alphabet), 0, $tokenLength); |
|
455 | + return $caseSensitive ? $token : strtoupper($token); |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | /** |
@@ -461,20 +461,20 @@ discard block |
||
461 | 461 | * @param string the alphabet used to represent the converted string. If empty, it means '234578adefhijmnrtwyABDEFGHIJLMNQRTWY', which excludes those confusing characters. |
462 | 462 | * @return string the converted string |
463 | 463 | */ |
464 | - protected function hash2string($hex,$alphabet='') |
|
464 | + protected function hash2string($hex, $alphabet='') |
|
465 | 465 | { |
466 | - if(strlen($alphabet)<2) |
|
466 | + if(strlen($alphabet) < 2) |
|
467 | 467 | $alphabet='234578adefhijmnrtABDEFGHJLMNQRT'; |
468 | 468 | $hexLength=strlen($hex); |
469 | 469 | $base=strlen($alphabet); |
470 | 470 | $result=''; |
471 | - for($i=0;$i<$hexLength;$i+=6) |
|
471 | + for($i=0; $i < $hexLength; $i+=6) |
|
472 | 472 | { |
473 | - $number=hexdec(substr($hex,$i,6)); |
|
473 | + $number=hexdec(substr($hex, $i, 6)); |
|
474 | 474 | while($number) |
475 | 475 | { |
476 | - $result.=$alphabet[$number%$base]; |
|
477 | - $number=floor($number/$base); |
|
476 | + $result.=$alphabet[$number % $base]; |
|
477 | + $number=floor($number / $base); |
|
478 | 478 | } |
479 | 479 | } |
480 | 480 | return $result; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
82 | - * @return TCaptchaControl the CAPTCHA control to be validated against |
|
82 | + * @return TCaptcha the CAPTCHA control to be validated against |
|
83 | 83 | * @throws TConfigurationException if the CAPTCHA cannot be found according to {@link setCaptchaControl CaptchaControl} |
84 | 84 | */ |
85 | 85 | protected function findCaptchaControl() |
@@ -115,6 +115,9 @@ discard block |
||
115 | 115 | return $options; |
116 | 116 | } |
117 | 117 | |
118 | + /** |
|
119 | + * @param string $token |
|
120 | + */ |
|
118 | 121 | private function generateTokenHash($token) |
119 | 122 | { |
120 | 123 | for($h=0,$i=strlen($token)-1;$i>=0;--$i) |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function getCaptchaControl() |
52 | 52 | { |
53 | - return $this->getViewState('CaptchaControl',''); |
|
53 | + return $this->getViewState('CaptchaControl', ''); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function setCaptchaControl($value) |
63 | 63 | { |
64 | - $this->setViewState('CaptchaControl',TPropertyValue::ensureString($value),''); |
|
64 | + $this->setViewState('CaptchaControl', TPropertyValue::ensureString($value), ''); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | if(($id=$this->getCaptchaControl())==='') |
88 | 88 | throw new TConfigurationException('captchavalidator_captchacontrol_required'); |
89 | 89 | else if(($control=$this->findControl($id))===null) |
90 | - throw new TConfigurationException('captchavalidator_captchacontrol_inexistent',$id); |
|
90 | + throw new TConfigurationException('captchavalidator_captchacontrol_inexistent', $id); |
|
91 | 91 | else if(!($control instanceof TCaptcha)) |
92 | - throw new TConfigurationException('captchavalidator_captchacontrol_invalid',$id); |
|
92 | + throw new TConfigurationException('captchavalidator_captchacontrol_invalid', $id); |
|
93 | 93 | else |
94 | 94 | return $control; |
95 | 95 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | private function generateTokenHash($token) |
119 | 119 | { |
120 | - for($h=0,$i=strlen($token)-1;$i>=0;--$i) |
|
120 | + for($h=0, $i=strlen($token) - 1; $i >= 0; --$i) |
|
121 | 121 | $h+=ord($token[$i]); |
122 | 122 | return $h; |
123 | 123 | } |
@@ -58,8 +58,7 @@ |
||
58 | 58 | if ($this->sourcepath === NULL) |
59 | 59 | { |
60 | 60 | $this->sourcepath = $sourcepath; |
61 | - } |
|
62 | - else |
|
61 | + } else |
|
63 | 62 | { |
64 | 63 | $this->sourcepath->append($sourcepath); |
65 | 64 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | /** |
119 | 119 | * Returns the value of the property that needs validation. |
120 | - * @return mixed the property value to be validated |
|
120 | + * @return boolean the property value to be validated |
|
121 | 121 | */ |
122 | 122 | public function getValidationPropertyValue() |
123 | 123 | { |
@@ -184,6 +184,7 @@ discard block |
||
184 | 184 | |
185 | 185 | /** |
186 | 186 | * @param TTextAlign the alignment of the text caption. Valid values include Left and Right. |
187 | + * @param TTextAlign $value |
|
187 | 188 | */ |
188 | 189 | public function setTextAlign($value) |
189 | 190 | { |
@@ -244,6 +245,7 @@ discard block |
||
244 | 245 | /** |
245 | 246 | * Sets a value indicating whether clicking on the checkbox will post the page. |
246 | 247 | * @param boolean whether clicking on the checkbox will post the page. |
248 | + * @param boolean $value |
|
247 | 249 | */ |
248 | 250 | public function setAutoPostBack($value) |
249 | 251 | { |
@@ -261,6 +263,7 @@ discard block |
||
261 | 263 | /** |
262 | 264 | * Sets the value indicating whether postback event trigger by this checkbox will cause input validation. |
263 | 265 | * @param boolean whether postback event trigger by this checkbox will cause input validation. |
266 | + * @param boolean $value |
|
264 | 267 | */ |
265 | 268 | public function setCausesValidation($value) |
266 | 269 | { |
@@ -277,6 +280,7 @@ discard block |
||
277 | 280 | |
278 | 281 | /** |
279 | 282 | * @param string the group of validators which the checkbox causes validation upon postback |
283 | + * @param string $value |
|
280 | 284 | */ |
281 | 285 | public function setValidationGroup($value) |
282 | 286 | { |
@@ -410,6 +414,7 @@ discard block |
||
410 | 414 | |
411 | 415 | /** |
412 | 416 | * @param boolean whether to render javascript. |
417 | + * @param boolean $value |
|
413 | 418 | */ |
414 | 419 | public function setEnableClientScript($value) |
415 | 420 | { |
@@ -131,14 +131,14 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public function getIsValid() |
133 | 133 | { |
134 | - return $this->_isValid; |
|
134 | + return $this->_isValid; |
|
135 | 135 | } |
136 | 136 | /** |
137 | 137 | * @param bool wether this control is valid. |
138 | 138 | */ |
139 | 139 | public function setIsValid($value) |
140 | 140 | { |
141 | - $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
141 | + $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | */ |
289 | 289 | public function getSurroundingTag() |
290 | 290 | { |
291 | - return 'span'; |
|
291 | + return 'span'; |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | /** |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | */ |
297 | 297 | public function getSurroundingTagID() |
298 | 298 | { |
299 | - return $this->getSpanNeeded() ? $this->getClientID().'_parent' : $this->getClientID(); |
|
299 | + return $this->getSpanNeeded() ? $this->getClientID().'_parent' : $this->getClientID(); |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | /** |
@@ -326,11 +326,11 @@ discard block |
||
326 | 326 | } |
327 | 327 | else |
328 | 328 | $onclick=''; |
329 | - if($needspan=$this->getSpanNeeded()) |
|
330 | - { |
|
331 | - $writer->addAttribute('id',$this->getSurroundingTagID()); |
|
332 | - $writer->renderBeginTag($this->getSurroundingTag()); |
|
333 | - } |
|
329 | + if($needspan=$this->getSpanNeeded()) |
|
330 | + { |
|
331 | + $writer->addAttribute('id',$this->getSurroundingTagID()); |
|
332 | + $writer->renderBeginTag($this->getSurroundingTag()); |
|
333 | + } |
|
334 | 334 | $clientID=$this->getClientID(); |
335 | 335 | if(($text=$this->getText())!=='') |
336 | 336 | { |
@@ -416,15 +416,15 @@ discard block |
||
416 | 416 | $this->setViewState('EnableClientScript',TPropertyValue::ensureBoolean($value),true); |
417 | 417 | } |
418 | 418 | |
419 | - /** |
|
420 | - * Check if we need a span tag to surround this control. The span tag will be created if |
|
421 | - * the Text property is set for this control. |
|
422 | - * |
|
423 | - * @return bool wether this control needs a surrounding span tag |
|
424 | - */ |
|
425 | - protected function getSpanNeeded() { |
|
426 | - return $this->getText()!==''; |
|
427 | - } |
|
419 | + /** |
|
420 | + * Check if we need a span tag to surround this control. The span tag will be created if |
|
421 | + * the Text property is set for this control. |
|
422 | + * |
|
423 | + * @return bool wether this control needs a surrounding span tag |
|
424 | + */ |
|
425 | + protected function getSpanNeeded() { |
|
426 | + return $this->getText()!==''; |
|
427 | + } |
|
428 | 428 | |
429 | 429 | /** |
430 | 430 | * Renders a label beside the checkbox. |
@@ -323,8 +323,7 @@ discard block |
||
323 | 323 | $writer->addAttributes($attributes); |
324 | 324 | if($value!==null) |
325 | 325 | $attributes->add('value',$value); |
326 | - } |
|
327 | - else |
|
326 | + } else |
|
328 | 327 | $onclick=''; |
329 | 328 | if($needspan=$this->getSpanNeeded()) |
330 | 329 | { |
@@ -338,14 +337,12 @@ discard block |
||
338 | 337 | { |
339 | 338 | $this->renderLabel($writer,$clientID,$text); |
340 | 339 | $this->renderInputTag($writer,$clientID,$onclick); |
341 | - } |
|
342 | - else |
|
340 | + } else |
|
343 | 341 | { |
344 | 342 | $this->renderInputTag($writer,$clientID,$onclick); |
345 | 343 | $this->renderLabel($writer,$clientID,$text); |
346 | 344 | } |
347 | - } |
|
348 | - else |
|
345 | + } else |
|
349 | 346 | $this->renderInputTag($writer,$clientID,$onclick); |
350 | 347 | if($needspan) |
351 | 348 | $writer->renderEndTag(); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @param array the input data collection |
59 | 59 | * @return boolean whether the data of the control has been changed |
60 | 60 | */ |
61 | - public function loadPostData($key,$values) |
|
61 | + public function loadPostData($key, $values) |
|
62 | 62 | { |
63 | 63 | $checked=$this->getChecked(); |
64 | 64 | if($newChecked=isset($values[$key])) |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function onCheckedChanged($param) |
89 | 89 | { |
90 | - $this->raiseEvent('OnCheckedChanged',$this,$param); |
|
90 | + $this->raiseEvent('OnCheckedChanged', $this, $param); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function getText() |
148 | 148 | { |
149 | - return $this->getViewState('Text',''); |
|
149 | + return $this->getViewState('Text', ''); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | */ |
156 | 156 | public function setText($value) |
157 | 157 | { |
158 | - $this->setViewState('Text',$value,''); |
|
158 | + $this->setViewState('Text', $value, ''); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public function getValue() |
165 | 165 | { |
166 | - return $this->getViewState('Value',''); |
|
166 | + return $this->getViewState('Value', ''); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public function setValue($value) |
173 | 173 | { |
174 | - $this->setViewState('Value',TPropertyValue::ensureString($value),''); |
|
174 | + $this->setViewState('Value', TPropertyValue::ensureString($value), ''); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public function getTextAlign() |
181 | 181 | { |
182 | - return $this->getViewState('TextAlign',TTextAlign::Right); |
|
182 | + return $this->getViewState('TextAlign', TTextAlign::Right); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | /** |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | */ |
188 | 188 | public function setTextAlign($value) |
189 | 189 | { |
190 | - $this->setViewState('TextAlign',TPropertyValue::ensureEnum($value,'TTextAlign'),TTextAlign::Right); |
|
190 | + $this->setViewState('TextAlign', TPropertyValue::ensureEnum($value, 'TTextAlign'), TTextAlign::Right); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | /** |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | */ |
196 | 196 | public function getChecked() |
197 | 197 | { |
198 | - return $this->getViewState('Checked',false); |
|
198 | + return $this->getViewState('Checked', false); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | /** |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | */ |
205 | 205 | public function setChecked($value) |
206 | 206 | { |
207 | - $this->setViewState('Checked',TPropertyValue::ensureBoolean($value),false); |
|
207 | + $this->setViewState('Checked', TPropertyValue::ensureBoolean($value), false); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | */ |
239 | 239 | public function getAutoPostBack() |
240 | 240 | { |
241 | - return $this->getViewState('AutoPostBack',false); |
|
241 | + return $this->getViewState('AutoPostBack', false); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | */ |
248 | 248 | public function setAutoPostBack($value) |
249 | 249 | { |
250 | - $this->setViewState('AutoPostBack',TPropertyValue::ensureBoolean($value),false); |
|
250 | + $this->setViewState('AutoPostBack', TPropertyValue::ensureBoolean($value), false); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | */ |
256 | 256 | public function getCausesValidation() |
257 | 257 | { |
258 | - return $this->getViewState('CausesValidation',true); |
|
258 | + return $this->getViewState('CausesValidation', true); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | /** |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | */ |
265 | 265 | public function setCausesValidation($value) |
266 | 266 | { |
267 | - $this->setViewState('CausesValidation',TPropertyValue::ensureBoolean($value),true); |
|
267 | + $this->setViewState('CausesValidation', TPropertyValue::ensureBoolean($value), true); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | /** |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | */ |
273 | 273 | public function getValidationGroup() |
274 | 274 | { |
275 | - return $this->getViewState('ValidationGroup',''); |
|
275 | + return $this->getViewState('ValidationGroup', ''); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | /** |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | */ |
281 | 281 | public function setValidationGroup($value) |
282 | 282 | { |
283 | - $this->setViewState('ValidationGroup',$value,''); |
|
283 | + $this->setViewState('ValidationGroup', $value, ''); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | /** |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | if($this->getHasStyle()) |
312 | 312 | $this->getStyle()->addAttributesToRender($writer); |
313 | 313 | if(($tooltip=$this->getToolTip())!=='') |
314 | - $writer->addAttribute('title',$tooltip); |
|
314 | + $writer->addAttribute('title', $tooltip); |
|
315 | 315 | if($this->getHasAttributes()) |
316 | 316 | { |
317 | 317 | $attributes=$this->getAttributes(); |
@@ -322,13 +322,13 @@ discard block |
||
322 | 322 | if($attributes->getCount()) |
323 | 323 | $writer->addAttributes($attributes); |
324 | 324 | if($value!==null) |
325 | - $attributes->add('value',$value); |
|
325 | + $attributes->add('value', $value); |
|
326 | 326 | } |
327 | 327 | else |
328 | 328 | $onclick=''; |
329 | 329 | if($needspan=$this->getSpanNeeded()) |
330 | 330 | { |
331 | - $writer->addAttribute('id',$this->getSurroundingTagID()); |
|
331 | + $writer->addAttribute('id', $this->getSurroundingTagID()); |
|
332 | 332 | $writer->renderBeginTag($this->getSurroundingTag()); |
333 | 333 | } |
334 | 334 | $clientID=$this->getClientID(); |
@@ -336,17 +336,17 @@ discard block |
||
336 | 336 | { |
337 | 337 | if($this->getTextAlign()===TTextAlign::Left) |
338 | 338 | { |
339 | - $this->renderLabel($writer,$clientID,$text); |
|
340 | - $this->renderInputTag($writer,$clientID,$onclick); |
|
339 | + $this->renderLabel($writer, $clientID, $text); |
|
340 | + $this->renderInputTag($writer, $clientID, $onclick); |
|
341 | 341 | } |
342 | 342 | else |
343 | 343 | { |
344 | - $this->renderInputTag($writer,$clientID,$onclick); |
|
345 | - $this->renderLabel($writer,$clientID,$text); |
|
344 | + $this->renderInputTag($writer, $clientID, $onclick); |
|
345 | + $this->renderLabel($writer, $clientID, $text); |
|
346 | 346 | } |
347 | 347 | } |
348 | 348 | else |
349 | - $this->renderInputTag($writer,$clientID,$onclick); |
|
349 | + $this->renderInputTag($writer, $clientID, $onclick); |
|
350 | 350 | if($needspan) |
351 | 351 | $writer->renderEndTag(); |
352 | 352 | } |
@@ -356,12 +356,12 @@ discard block |
||
356 | 356 | */ |
357 | 357 | public function getLabelAttributes() |
358 | 358 | { |
359 | - if($attributes=$this->getViewState('LabelAttributes',null)) |
|
359 | + if($attributes=$this->getViewState('LabelAttributes', null)) |
|
360 | 360 | return $attributes; |
361 | 361 | else |
362 | 362 | { |
363 | 363 | $attributes=new TAttributeCollection; |
364 | - $this->setViewState('LabelAttributes',$attributes,null); |
|
364 | + $this->setViewState('LabelAttributes', $attributes, null); |
|
365 | 365 | return $attributes; |
366 | 366 | } |
367 | 367 | } |
@@ -371,12 +371,12 @@ discard block |
||
371 | 371 | */ |
372 | 372 | public function getInputAttributes() |
373 | 373 | { |
374 | - if($attributes=$this->getViewState('InputAttributes',null)) |
|
374 | + if($attributes=$this->getViewState('InputAttributes', null)) |
|
375 | 375 | return $attributes; |
376 | 376 | else |
377 | 377 | { |
378 | 378 | $attributes=new TAttributeCollection; |
379 | - $this->setViewState('InputAttributes',$attributes,null); |
|
379 | + $this->setViewState('InputAttributes', $attributes, null); |
|
380 | 380 | return $attributes; |
381 | 381 | } |
382 | 382 | } |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | return $value; |
391 | 391 | else |
392 | 392 | { |
393 | - $attributes=$this->getViewState('InputAttributes',null); |
|
393 | + $attributes=$this->getViewState('InputAttributes', null); |
|
394 | 394 | if($attributes && $attributes->contains('value')) |
395 | 395 | return $attributes->itemAt('value'); |
396 | 396 | else if($this->hasAttribute('value')) |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | */ |
406 | 406 | public function getEnableClientScript() |
407 | 407 | { |
408 | - return $this->getViewState('EnableClientScript',true); |
|
408 | + return $this->getViewState('EnableClientScript', true); |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | /** |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | */ |
414 | 414 | public function setEnableClientScript($value) |
415 | 415 | { |
416 | - $this->setViewState('EnableClientScript',TPropertyValue::ensureBoolean($value),true); |
|
416 | + $this->setViewState('EnableClientScript', TPropertyValue::ensureBoolean($value), true); |
|
417 | 417 | } |
418 | 418 | |
419 | 419 | /** |
@@ -432,10 +432,10 @@ discard block |
||
432 | 432 | * @param string checkbox id |
433 | 433 | * @param string label text |
434 | 434 | */ |
435 | - protected function renderLabel($writer,$clientID,$text) |
|
435 | + protected function renderLabel($writer, $clientID, $text) |
|
436 | 436 | { |
437 | - $writer->addAttribute('for',$clientID); |
|
438 | - if($attributes=$this->getViewState('LabelAttributes',null)) |
|
437 | + $writer->addAttribute('for', $clientID); |
|
438 | + if($attributes=$this->getViewState('LabelAttributes', null)) |
|
439 | 439 | $writer->addAttributes($attributes); |
440 | 440 | $writer->renderBeginTag('label'); |
441 | 441 | $writer->write($text); |
@@ -448,21 +448,21 @@ discard block |
||
448 | 448 | * @param string checkbox id |
449 | 449 | * @param string onclick js |
450 | 450 | */ |
451 | - protected function renderInputTag($writer,$clientID,$onclick) |
|
451 | + protected function renderInputTag($writer, $clientID, $onclick) |
|
452 | 452 | { |
453 | 453 | if($clientID!=='') |
454 | - $writer->addAttribute('id',$clientID); |
|
455 | - $writer->addAttribute('type','checkbox'); |
|
454 | + $writer->addAttribute('id', $clientID); |
|
455 | + $writer->addAttribute('type', 'checkbox'); |
|
456 | 456 | if(($value=$this->getValueAttribute())!=='') |
457 | - $writer->addAttribute('value',$value); |
|
457 | + $writer->addAttribute('value', $value); |
|
458 | 458 | if(!empty($onclick)) |
459 | - $writer->addAttribute('onclick',$onclick); |
|
459 | + $writer->addAttribute('onclick', $onclick); |
|
460 | 460 | if(($uniqueID=$this->getUniqueID())!=='') |
461 | - $writer->addAttribute('name',$uniqueID); |
|
461 | + $writer->addAttribute('name', $uniqueID); |
|
462 | 462 | if($this->getChecked()) |
463 | - $writer->addAttribute('checked','checked'); |
|
463 | + $writer->addAttribute('checked', 'checked'); |
|
464 | 464 | if(!$this->getEnabled(true)) |
465 | - $writer->addAttribute('disabled','disabled'); |
|
465 | + $writer->addAttribute('disabled', 'disabled'); |
|
466 | 466 | |
467 | 467 | $page=$this->getPage(); |
468 | 468 | if($this->getEnabled(true) |
@@ -474,10 +474,10 @@ discard block |
||
474 | 474 | } |
475 | 475 | |
476 | 476 | if(($accesskey=$this->getAccessKey())!=='') |
477 | - $writer->addAttribute('accesskey',$accesskey); |
|
478 | - if(($tabindex=$this->getTabIndex())>0) |
|
479 | - $writer->addAttribute('tabindex',"$tabindex"); |
|
480 | - if($attributes=$this->getViewState('InputAttributes',null)) |
|
477 | + $writer->addAttribute('accesskey', $accesskey); |
|
478 | + if(($tabindex=$this->getTabIndex()) > 0) |
|
479 | + $writer->addAttribute('tabindex', "$tabindex"); |
|
480 | + if($attributes=$this->getViewState('InputAttributes', null)) |
|
481 | 481 | $writer->addAttributes($attributes); |
482 | 482 | $writer->renderBeginTag('input'); |
483 | 483 | $writer->renderEndTag(); |
@@ -488,8 +488,8 @@ discard block |
||
488 | 488 | */ |
489 | 489 | protected function renderClientControlScript($writer) |
490 | 490 | { |
491 | - $cs = $this->getPage()->getClientScript(); |
|
492 | - $cs->registerPostBackControl($this->getClientClassName(),$this->getPostBackOptions()); |
|
491 | + $cs=$this->getPage()->getClientScript(); |
|
492 | + $cs->registerPostBackControl($this->getClientClassName(), $this->getPostBackOptions()); |
|
493 | 493 | } |
494 | 494 | |
495 | 495 | /** |
@@ -508,10 +508,10 @@ discard block |
||
508 | 508 | */ |
509 | 509 | protected function getPostBackOptions() |
510 | 510 | { |
511 | - $options['ID'] = $this->getClientID(); |
|
512 | - $options['ValidationGroup'] = $this->getValidationGroup(); |
|
513 | - $options['CausesValidation'] = $this->getCausesValidation(); |
|
514 | - $options['EventTarget'] = $this->getUniqueID(); |
|
511 | + $options['ID']=$this->getClientID(); |
|
512 | + $options['ValidationGroup']=$this->getValidationGroup(); |
|
513 | + $options['CausesValidation']=$this->getCausesValidation(); |
|
514 | + $options['EventTarget']=$this->getUniqueID(); |
|
515 | 515 | return $options; |
516 | 516 | } |
517 | 517 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
157 | - * @return string the direction of traversing the list, defaults to 'Vertical' |
|
157 | + * @return TRepeatDirection the direction of traversing the list, defaults to 'Vertical' |
|
158 | 158 | */ |
159 | 159 | public function getRepeatDirection() |
160 | 160 | { |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
173 | - * @return string how the list should be displayed, using table or using line breaks. Defaults to 'Table'. |
|
173 | + * @return TRepeatLayout how the list should be displayed, using table or using line breaks. Defaults to 'Table'. |
|
174 | 174 | */ |
175 | 175 | public function getRepeatLayout() |
176 | 176 | { |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | /** |
450 | 450 | * Returns the value to be validated. |
451 | 451 | * This methid is required by IValidatable interface. |
452 | - * @return mixed the value of the property to be validated. |
|
452 | + * @return string the value of the property to be validated. |
|
453 | 453 | */ |
454 | 454 | public function getValidationPropertyValue() |
455 | 455 | { |
@@ -404,8 +404,8 @@ discard block |
||
404 | 404 | { |
405 | 405 | if ($needSpan=$this->getSpanNeeded()) |
406 | 406 | { |
407 | - $writer->addAttribute('id', $this->getClientId()); |
|
408 | - $writer->renderBeginTag('span'); |
|
407 | + $writer->addAttribute('id', $this->getClientId()); |
|
408 | + $writer->renderBeginTag('span'); |
|
409 | 409 | } |
410 | 410 | if($this->getItemCount()>0) |
411 | 411 | { |
@@ -463,14 +463,14 @@ discard block |
||
463 | 463 | */ |
464 | 464 | public function getIsValid() |
465 | 465 | { |
466 | - return $this->_isValid; |
|
466 | + return $this->_isValid; |
|
467 | 467 | } |
468 | 468 | /** |
469 | 469 | * @param bool wether this control is valid. |
470 | 470 | */ |
471 | 471 | public function setIsValid($value) |
472 | 472 | { |
473 | - $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
473 | + $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
474 | 474 | } |
475 | 475 | |
476 | 476 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @package System.Web.UI.WebControls |
46 | 46 | * @since 3.0 |
47 | 47 | */ |
48 | -class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingContainer, IPostBackDataHandler, IValidatable |
|
48 | +class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingContainer, IPostBackDataHandler, IValidatable |
|
49 | 49 | { |
50 | 50 | private $_repeatedControl; |
51 | 51 | private $_isEnabled; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function findControl($id, $real=false) |
86 | 86 | { |
87 | - if ($real===true) |
|
87 | + if($real===true) |
|
88 | 88 | return parent::findControl($id); |
89 | 89 | return $this; |
90 | 90 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function getTextAlign() |
114 | 114 | { |
115 | - return $this->getViewState('TextAlign',TTextAlign::Right); |
|
115 | + return $this->getViewState('TextAlign', TTextAlign::Right); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public function setTextAlign($value) |
122 | 122 | { |
123 | - $this->setViewState('TextAlign',TPropertyValue::ensureEnum($value,'TTextAlign'),TTextAlign::Right); |
|
123 | + $this->setViewState('TextAlign', TPropertyValue::ensureEnum($value, 'TTextAlign'), TTextAlign::Right); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | |
@@ -129,10 +129,10 @@ discard block |
||
129 | 129 | */ |
130 | 130 | protected function getRepeatInfo() |
131 | 131 | { |
132 | - if(($repeatInfo=$this->getViewState('RepeatInfo',null))===null) |
|
132 | + if(($repeatInfo=$this->getViewState('RepeatInfo', null))===null) |
|
133 | 133 | { |
134 | 134 | $repeatInfo=new TRepeatInfo; |
135 | - $this->setViewState('RepeatInfo',$repeatInfo,null); |
|
135 | + $this->setViewState('RepeatInfo', $repeatInfo, null); |
|
136 | 136 | } |
137 | 137 | return $repeatInfo; |
138 | 138 | } |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | public function setEnabled($value) |
262 | 262 | { |
263 | 263 | parent::setEnabled($value); |
264 | - $value = !TPropertyValue::ensureBoolean($value); |
|
264 | + $value=!TPropertyValue::ensureBoolean($value); |
|
265 | 265 | // if this is an active control, |
266 | 266 | // and it's a callback, |
267 | 267 | // and we can update clientside, |
@@ -270,9 +270,9 @@ discard block |
||
270 | 270 | $this->getPage()->getIsCallBack() && |
271 | 271 | $this->getActiveControl()->canUpdateClientSide()) |
272 | 272 | { |
273 | - $items = $this->getItems(); |
|
274 | - $cs = $this->getPage()->getCallbackClient(); |
|
275 | - $baseClientID = $this->getClientID().'_c'; |
|
273 | + $items=$this->getItems(); |
|
274 | + $cs=$this->getPage()->getCallbackClient(); |
|
275 | + $baseClientID=$this->getClientID().'_c'; |
|
276 | 276 | foreach($items as $index=>$item) |
277 | 277 | { |
278 | 278 | $cs->setAttribute($baseClientID.$index, 'disabled', $value); |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | * @param integer index of the item being rendered |
288 | 288 | * @return null |
289 | 289 | */ |
290 | - public function generateItemStyle($itemType,$index) |
|
290 | + public function generateItemStyle($itemType, $index) |
|
291 | 291 | { |
292 | 292 | return null; |
293 | 293 | } |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * @param string item type (Header,Footer,Item,AlternatingItem,SelectedItem,EditItem,Separator,Pager) |
301 | 301 | * @param integer zero-based index of the item in the item list |
302 | 302 | */ |
303 | - public function renderItem($writer,$repeatInfo,$itemType,$index) |
|
303 | + public function renderItem($writer, $repeatInfo, $itemType, $index) |
|
304 | 304 | { |
305 | 305 | $repeatedControl=$this->_repeatedControl; |
306 | 306 | $item=$this->getItems()->itemAt($index); |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | $repeatedControl->setID("c$index"); |
312 | 312 | $repeatedControl->setText($item->getText()); |
313 | 313 | $repeatedControl->setChecked($item->getSelected()); |
314 | - $repeatedControl->setAttribute('value',$item->getValue()); |
|
314 | + $repeatedControl->setAttribute('value', $item->getValue()); |
|
315 | 315 | $repeatedControl->setEnabled($this->_isEnabled && $item->getEnabled()); |
316 | 316 | $repeatedControl->setEnableClientScript(false); |
317 | 317 | $repeatedControl->renderControl($writer); |
@@ -324,13 +324,13 @@ discard block |
||
324 | 324 | * @param array the input data collection |
325 | 325 | * @return boolean whether the data of the control has been changed |
326 | 326 | */ |
327 | - public function loadPostData($key,$values) |
|
327 | + public function loadPostData($key, $values) |
|
328 | 328 | { |
329 | 329 | if($this->getEnabled(true)) |
330 | 330 | { |
331 | - $index=(int)substr($key,strlen($this->getUniqueID())+2); |
|
331 | + $index=(int) substr($key, strlen($this->getUniqueID()) + 2); |
|
332 | 332 | $this->ensureDataBound(); |
333 | - if($index>=0 && $index<$this->getItemCount()) |
|
333 | + if($index >= 0 && $index < $this->getItemCount()) |
|
334 | 334 | { |
335 | 335 | $item=$this->getItems()->itemAt($index); |
336 | 336 | if($item->getEnabled()) |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | $this->_repeatedControl->setValidationGroup($this->getValidationGroup()); |
379 | 379 | $page=$this->getPage(); |
380 | 380 | $n=$this->getItemCount(); |
381 | - for($i=0;$i<$n;++$i) |
|
381 | + for($i=0; $i < $n; ++$i) |
|
382 | 382 | { |
383 | 383 | $this->_repeatedControl->setID("c$i"); |
384 | 384 | $page->registerRequiresPostData($this->_repeatedControl); |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | * |
391 | 391 | *@return boolean true if we need a span |
392 | 392 | */ |
393 | - protected function getSpanNeeded () |
|
393 | + protected function getSpanNeeded() |
|
394 | 394 | { |
395 | 395 | return $this->getRepeatLayout()===TRepeatLayout::Raw; |
396 | 396 | } |
@@ -402,12 +402,12 @@ discard block |
||
402 | 402 | */ |
403 | 403 | public function render($writer) |
404 | 404 | { |
405 | - if ($needSpan=$this->getSpanNeeded()) |
|
405 | + if($needSpan=$this->getSpanNeeded()) |
|
406 | 406 | { |
407 | 407 | $writer->addAttribute('id', $this->getClientId()); |
408 | 408 | $writer->renderBeginTag('span'); |
409 | 409 | } |
410 | - if($this->getItemCount()>0) |
|
410 | + if($this->getItemCount() > 0) |
|
411 | 411 | { |
412 | 412 | $this->_isEnabled=$this->getEnabled(true); |
413 | 413 | $repeatInfo=$this->getRepeatInfo(); |
@@ -419,11 +419,11 @@ discard block |
||
419 | 419 | $this->setAccessKey(''); |
420 | 420 | $this->setTabIndex(0); |
421 | 421 | $this->addAttributesToRender($writer); |
422 | - $repeatInfo->renderRepeater($writer,$this); |
|
422 | + $repeatInfo->renderRepeater($writer, $this); |
|
423 | 423 | $this->setAccessKey($accessKey); |
424 | 424 | $this->setTabIndex($tabIndex); |
425 | 425 | } |
426 | - if ($needSpan) |
|
426 | + if($needSpan) |
|
427 | 427 | $writer->renderEndTag(); |
428 | 428 | |
429 | 429 | //checkbox skipped the client control script in addAttributesToRender |
@@ -489,11 +489,11 @@ discard block |
||
489 | 489 | */ |
490 | 490 | protected function getPostBackOptions() |
491 | 491 | { |
492 | - $options['ID'] = $this->getClientID(); |
|
493 | - $options['ValidationGroup'] = $this->getValidationGroup(); |
|
494 | - $options['CausesValidation'] = $this->getCausesValidation(); |
|
495 | - $options['ListName'] = $this->getUniqueID(); |
|
496 | - $options['ItemCount'] = $this->getItemCount(); |
|
492 | + $options['ID']=$this->getClientID(); |
|
493 | + $options['ValidationGroup']=$this->getValidationGroup(); |
|
494 | + $options['CausesValidation']=$this->getCausesValidation(); |
|
495 | + $options['ListName']=$this->getUniqueID(); |
|
496 | + $options['ItemCount']=$this->getItemCount(); |
|
497 | 497 | return $options; |
498 | 498 | } |
499 | 499 |
@@ -186,6 +186,8 @@ |
||
186 | 186 | * Parse the pair of values into the appropriate value type. |
187 | 187 | * @param string value one |
188 | 188 | * @param string second value |
189 | + * @param string $value1 |
|
190 | + * @param string $value2 |
|
189 | 191 | * @return array appropriate type of the value pair, array($value1, $value2); |
190 | 192 | */ |
191 | 193 | protected function getComparisonValues($value1, $value2) |
@@ -124,9 +124,9 @@ |
||
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
127 | - * Sets the date format for a date validation |
|
128 | - * @param string the date format value |
|
129 | - */ |
|
127 | + * Sets the date format for a date validation |
|
128 | + * @param string the date format value |
|
129 | + */ |
|
130 | 130 | public function setDateFormat($value) |
131 | 131 | { |
132 | 132 | $this->setViewState('DateFormat', $value, ''); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function getDataType() |
61 | 61 | { |
62 | - return $this->getViewState('DataType',TValidationDataType::String); |
|
62 | + return $this->getViewState('DataType', TValidationDataType::String); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function setDataType($value) |
71 | 71 | { |
72 | - $this->setViewState('DataType',TPropertyValue::ensureEnum($value,'TValidationDataType'),TValidationDataType::String); |
|
72 | + $this->setViewState('DataType', TPropertyValue::ensureEnum($value, 'TValidationDataType'), TValidationDataType::String); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function getControlToCompare() |
79 | 79 | { |
80 | - return $this->getViewState('ControlToCompare',''); |
|
80 | + return $this->getViewState('ControlToCompare', ''); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function setControlToCompare($value) |
88 | 88 | { |
89 | - $this->setViewState('ControlToCompare',$value,''); |
|
89 | + $this->setViewState('ControlToCompare', $value, ''); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function getValueToCompare() |
96 | 96 | { |
97 | - return $this->getViewState('ValueToCompare',''); |
|
97 | + return $this->getViewState('ValueToCompare', ''); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function setValueToCompare($value) |
105 | 105 | { |
106 | - $this->setViewState('ValueToCompare',$value,''); |
|
106 | + $this->setViewState('ValueToCompare', $value, ''); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function getOperator() |
113 | 113 | { |
114 | - return $this->getViewState('Operator',TValidationCompareOperator::Equal); |
|
114 | + return $this->getViewState('Operator', TValidationCompareOperator::Equal); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public function setOperator($value) |
122 | 122 | { |
123 | - $this->setViewState('Operator',TPropertyValue::ensureEnum($value,'TValidationCompareOperator'),TValidationCompareOperator::Equal); |
|
123 | + $this->setViewState('Operator', TPropertyValue::ensureEnum($value, 'TValidationCompareOperator'), TValidationCompareOperator::Equal); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -162,13 +162,13 @@ discard block |
||
162 | 162 | else |
163 | 163 | $value2=$this->getValueToCompare(); |
164 | 164 | |
165 | - $values = $this->getComparisonValues($value, $value2); |
|
165 | + $values=$this->getComparisonValues($value, $value2); |
|
166 | 166 | switch($this->getOperator()) |
167 | 167 | { |
168 | 168 | case TValidationCompareOperator::Equal: |
169 | - return $values[0] == $values[1]; |
|
169 | + return $values[0]==$values[1]; |
|
170 | 170 | case TValidationCompareOperator::NotEqual: |
171 | - return $values[0] != $values[1]; |
|
171 | + return $values[0]!=$values[1]; |
|
172 | 172 | case TValidationCompareOperator::GreaterThan: |
173 | 173 | return $values[0] > $values[1]; |
174 | 174 | case TValidationCompareOperator::GreaterThanEqual: |
@@ -197,10 +197,10 @@ discard block |
||
197 | 197 | case TValidationDataType::Float: |
198 | 198 | return array(floatval($value1), floatval($value2)); |
199 | 199 | case TValidationDataType::Date: |
200 | - $dateFormat = $this->getDateFormat(); |
|
200 | + $dateFormat=$this->getDateFormat(); |
|
201 | 201 | if($dateFormat!=='') |
202 | 202 | { |
203 | - $formatter = Prado::createComponent('System.Util.TSimpleDateFormatter', $dateFormat); |
|
203 | + $formatter=Prado::createComponent('System.Util.TSimpleDateFormatter', $dateFormat); |
|
204 | 204 | return array($formatter->parse($value1), $formatter->parse($value2)); |
205 | 205 | } |
206 | 206 | else |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | */ |
216 | 216 | protected function getClientScriptOptions() |
217 | 217 | { |
218 | - $options = parent::getClientScriptOptions(); |
|
218 | + $options=parent::getClientScriptOptions(); |
|
219 | 219 | if(($name=$this->getControlToCompare())!=='') |
220 | 220 | { |
221 | 221 | if(($control=$this->findControl($name))!==null) |
@@ -163,8 +163,7 @@ discard block |
||
163 | 163 | if(!is_file($dst.DIRECTORY_SEPARATOR.$fileName) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance) |
164 | 164 | $this->copyFile($fullpath,$dst); |
165 | 165 | return $this->_published[$path]=$this->_baseUrl.'/'.$dir.'/'.$fileName; |
166 | - } |
|
167 | - else |
|
166 | + } else |
|
168 | 167 | { |
169 | 168 | $dir=$this->hash($fullpath); |
170 | 169 | if(!is_dir($this->_basePath.DIRECTORY_SEPARATOR.$dir) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance) |
@@ -287,8 +286,7 @@ discard block |
||
287 | 286 | @copy($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file); |
288 | 287 | @chmod($dst.DIRECTORY_SEPARATOR.$file, PRADO_CHMOD); |
289 | 288 | } |
290 | - } |
|
291 | - else |
|
289 | + } else |
|
292 | 290 | $this->copyDirectory($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file); |
293 | 291 | } |
294 | 292 | closedir($folder); |
@@ -171,6 +171,7 @@ |
||
171 | 171 | * Constructor. |
172 | 172 | * @param string property value to be validated |
173 | 173 | * @param boolean whether the value is valid |
174 | + * @param boolean $isValid |
|
174 | 175 | */ |
175 | 176 | public function __construct($value,$isValid) |
176 | 177 | { |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function getClientValidationFunction() |
69 | 69 | { |
70 | - return $this->getViewState('ClientValidationFunction',''); |
|
70 | + return $this->getViewState('ClientValidationFunction', ''); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function setClientValidationFunction($value) |
78 | 78 | { |
79 | - $this->setViewState('ClientValidationFunction',$value,''); |
|
79 | + $this->setViewState('ClientValidationFunction', $value, ''); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function evaluateIsValid() |
88 | 88 | { |
89 | - $value = ''; |
|
89 | + $value=''; |
|
90 | 90 | if($this->getValidationTarget()!==null) |
91 | 91 | $value=$this->getValidationValue($this->getValidationTarget()); |
92 | 92 | return $this->onServerValidate($value); |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function onServerValidate($value) |
105 | 105 | { |
106 | - $param=new TServerValidateEventParameter($value,true); |
|
107 | - $this->raiseEvent('OnServerValidate',$this,$param); |
|
106 | + $param=new TServerValidateEventParameter($value, true); |
|
107 | + $this->raiseEvent('OnServerValidate', $this, $param); |
|
108 | 108 | return $param->getIsValid(); |
109 | 109 | } |
110 | 110 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | if(($id=$this->getControlToValidate())!=='' && ($control=$this->findControl($id))!==null) |
117 | 117 | return $control; |
118 | 118 | else if(($id=$this->getControlToValidate())!=='') |
119 | - throw new TInvalidDataTypeException('basevalidator_validatable_required',get_class($this)); |
|
119 | + throw new TInvalidDataTypeException('basevalidator_validatable_required', get_class($this)); |
|
120 | 120 | else |
121 | 121 | return null; |
122 | 122 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * @param string property value to be validated |
173 | 173 | * @param boolean whether the value is valid |
174 | 174 | */ |
175 | - public function __construct($value,$isValid) |
|
175 | + public function __construct($value, $isValid) |
|
176 | 176 | { |
177 | 177 | $this->_value=$value; |
178 | 178 | $this->setIsValid($isValid); |
@@ -151,6 +151,7 @@ discard block |
||
151 | 151 | |
152 | 152 | /** |
153 | 153 | * @param boolean if databind has been invoked in this page request |
154 | + * @param boolean $value |
|
154 | 155 | */ |
155 | 156 | protected function setIsDataBound($value) |
156 | 157 | { |
@@ -211,6 +212,7 @@ discard block |
||
211 | 212 | |
212 | 213 | /** |
213 | 214 | * @param integer the zero-based index of the current page |
215 | + * @param integer $value |
|
214 | 216 | * @throws TInvalidDataValueException if the value is less than 0 |
215 | 217 | */ |
216 | 218 | public function setCurrentPageIndex($value) |
@@ -273,6 +275,7 @@ discard block |
||
273 | 275 | * If true and the control has been prerendered while it uses the data source |
274 | 276 | * specified by {@link setDataSourceID}, a databind call will be called by this method. |
275 | 277 | * @param boolean whether a databind call is required. |
278 | + * @param boolean $value |
|
276 | 279 | */ |
277 | 280 | protected function setRequiresDataBinding($value) |
278 | 281 | { |
@@ -405,6 +408,9 @@ discard block |
||
405 | 408 | return $this->_currentDataSource; |
406 | 409 | } |
407 | 410 | |
411 | + /** |
|
412 | + * @param Traversable $data |
|
413 | + */ |
|
408 | 414 | abstract protected function performDataBinding($data); |
409 | 415 | |
410 | 416 | /** |
@@ -566,6 +572,7 @@ discard block |
||
566 | 572 | * Sets the zero-based index for the item. |
567 | 573 | * If the item is not in the item collection (e.g. it is a header item), -1 should be used. |
568 | 574 | * @param integer zero-based index of the item. |
575 | + * @return void |
|
569 | 576 | */ |
570 | 577 | public function setItemIndex($value); |
571 | 578 | |
@@ -576,6 +583,7 @@ discard block |
||
576 | 583 | |
577 | 584 | /** |
578 | 585 | * @param TListItemType the item type. |
586 | + * @return void |
|
579 | 587 | */ |
580 | 588 | public function setItemType($value); |
581 | 589 | } |
@@ -281,8 +281,7 @@ discard block |
||
281 | 281 | { |
282 | 282 | $this->_requiresDataBinding=true; |
283 | 283 | $this->ensureDataBound(); |
284 | - } |
|
285 | - else |
|
284 | + } else |
|
286 | 285 | $this->_requiresDataBinding=$value; |
287 | 286 | } |
288 | 287 | |
@@ -345,8 +344,7 @@ discard block |
||
345 | 344 | $this->setCurrentPageIndex($ds->getCurrentPageIndex()); |
346 | 345 | } |
347 | 346 | $this->performDataBinding($ds); |
348 | - } |
|
349 | - else |
|
347 | + } else |
|
350 | 348 | { |
351 | 349 | $this->clearViewState('PageCount'); |
352 | 350 | $this->performDataBinding($data); |
@@ -375,8 +373,7 @@ discard block |
||
375 | 373 | if($this->_currentViewIsFromDataSourceID=$this->getUsingDataSourceID()) |
376 | 374 | $view->attachEventHandler('OnDataSourceViewChanged',array($this,'dataSourceViewChanged')); |
377 | 375 | $this->_currentView=$view; |
378 | - } |
|
379 | - else |
|
376 | + } else |
|
380 | 377 | $this->_currentView=null; |
381 | 378 | $this->_currentViewValid=true; |
382 | 379 | } |
@@ -395,8 +392,7 @@ discard block |
||
395 | 392 | throw new TInvalidDataValueException('databoundcontrol_datasourceid_invalid',$dsid); |
396 | 393 | else |
397 | 394 | $this->_currentDataSource=$dataSource; |
398 | - } |
|
399 | - else if(($dataSource=$this->getDataSource())!==null) |
|
395 | + } else if(($dataSource=$this->getDataSource())!==null) |
|
400 | 396 | $this->_currentDataSource=new TReadOnlyDataSource($dataSource,$this->getDataMember()); |
401 | 397 | else |
402 | 398 | $this->_currentDataSource=null; |
@@ -477,14 +473,12 @@ discard block |
||
477 | 473 | $list->add(array($value,is_string($key)?$key:$value)); |
478 | 474 | } |
479 | 475 | return $list; |
480 | - } |
|
481 | - else if(is_array($value)) |
|
476 | + } else if(is_array($value)) |
|
482 | 477 | return new TMap($value); |
483 | 478 | else if($value instanceof TDbDataReader) { |
484 | 479 | // read array from TDbDataReader since it's forward-only stream and can only be traversed once |
485 | 480 | return $value->readAll(); |
486 | - } |
|
487 | - else if(($value instanceof Traversable) || $value===null) |
|
481 | + } else if(($value instanceof Traversable) || $value===null) |
|
488 | 482 | return $value; |
489 | 483 | else |
490 | 484 | throw new TInvalidDataTypeException('databoundcontrol_datasource_invalid',get_class($this)); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public function getDataSourceID() |
84 | 84 | { |
85 | - return $this->getViewState('DataSourceID',''); |
|
85 | + return $this->getViewState('DataSourceID', ''); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function setDataSourceID($value) |
93 | 93 | { |
94 | - $dsid=$this->getViewState('DataSourceID',''); |
|
94 | + $dsid=$this->getViewState('DataSourceID', ''); |
|
95 | 95 | if($dsid!=='' && $value==='') |
96 | 96 | $this->_requiresBindToNull=true; |
97 | - $this->setViewState('DataSourceID',$value,''); |
|
97 | + $this->setViewState('DataSourceID', $value, ''); |
|
98 | 98 | $this->onDataSourceChanged(); |
99 | 99 | } |
100 | 100 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | */ |
171 | 171 | public function getAllowPaging() |
172 | 172 | { |
173 | - return $this->getViewState('AllowPaging',false); |
|
173 | + return $this->getViewState('AllowPaging', false); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function setAllowPaging($value) |
180 | 180 | { |
181 | - $this->setViewState('AllowPaging',TPropertyValue::ensureBoolean($value),false); |
|
181 | + $this->setViewState('AllowPaging', TPropertyValue::ensureBoolean($value), false); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | */ |
187 | 187 | public function getAllowCustomPaging() |
188 | 188 | { |
189 | - return $this->getViewState('AllowCustomPaging',false); |
|
189 | + return $this->getViewState('AllowCustomPaging', false); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public function setAllowCustomPaging($value) |
200 | 200 | { |
201 | - $this->setViewState('AllowCustomPaging',TPropertyValue::ensureBoolean($value),false); |
|
201 | + $this->setViewState('AllowCustomPaging', TPropertyValue::ensureBoolean($value), false); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | */ |
207 | 207 | public function getCurrentPageIndex() |
208 | 208 | { |
209 | - return $this->getViewState('CurrentPageIndex',0); |
|
209 | + return $this->getViewState('CurrentPageIndex', 0); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | /** |
@@ -215,9 +215,9 @@ discard block |
||
215 | 215 | */ |
216 | 216 | public function setCurrentPageIndex($value) |
217 | 217 | { |
218 | - if(($value=TPropertyValue::ensureInteger($value))<0) |
|
218 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
219 | 219 | $value=0; |
220 | - $this->setViewState('CurrentPageIndex',$value,0); |
|
220 | + $this->setViewState('CurrentPageIndex', $value, 0); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public function getPageSize() |
227 | 227 | { |
228 | - return $this->getViewState('PageSize',10); |
|
228 | + return $this->getViewState('PageSize', 10); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | /** |
@@ -234,9 +234,9 @@ discard block |
||
234 | 234 | */ |
235 | 235 | public function setPageSize($value) |
236 | 236 | { |
237 | - if(($value=TPropertyValue::ensureInteger($value))<1) |
|
238 | - throw new TInvalidDataValueException('databoundcontrol_pagesize_invalid',get_class($this)); |
|
239 | - $this->setViewState('PageSize',TPropertyValue::ensureInteger($value),10); |
|
237 | + if(($value=TPropertyValue::ensureInteger($value)) < 1) |
|
238 | + throw new TInvalidDataValueException('databoundcontrol_pagesize_invalid', get_class($this)); |
|
239 | + $this->setViewState('PageSize', TPropertyValue::ensureInteger($value), 10); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | */ |
245 | 245 | public function getPageCount() |
246 | 246 | { |
247 | - return $this->getViewState('PageCount',1); |
|
247 | + return $this->getViewState('PageCount', 1); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | /** |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | */ |
254 | 254 | public function getVirtualItemCount() |
255 | 255 | { |
256 | - return $this->getViewState('VirtualItemCount',0); |
|
256 | + return $this->getViewState('VirtualItemCount', 0); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | /** |
@@ -263,9 +263,9 @@ discard block |
||
263 | 263 | */ |
264 | 264 | public function setVirtualItemCount($value) |
265 | 265 | { |
266 | - if(($value=TPropertyValue::ensureInteger($value))<0) |
|
267 | - throw new TInvalidDataValueException('databoundcontrol_virtualitemcount_invalid',get_class($this)); |
|
268 | - $this->setViewState('VirtualItemCount',$value,0); |
|
266 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
267 | + throw new TInvalidDataValueException('databoundcontrol_virtualitemcount_invalid', get_class($this)); |
|
268 | + $this->setViewState('VirtualItemCount', $value, 0); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | /** |
@@ -338,10 +338,10 @@ discard block |
||
338 | 338 | { |
339 | 339 | $ds=$this->createPagedDataSource(); |
340 | 340 | $ds->setDataSource($data); |
341 | - $this->setViewState('PageCount',$ds->getPageCount()); |
|
342 | - if($ds->getCurrentPageIndex()>=$ds->getPageCount()) |
|
341 | + $this->setViewState('PageCount', $ds->getPageCount()); |
|
342 | + if($ds->getCurrentPageIndex() >= $ds->getPageCount()) |
|
343 | 343 | { |
344 | - $ds->setCurrentPageIndex($ds->getPageCount()-1); |
|
344 | + $ds->setCurrentPageIndex($ds->getPageCount() - 1); |
|
345 | 345 | $this->setCurrentPageIndex($ds->getCurrentPageIndex()); |
346 | 346 | } |
347 | 347 | $this->performDataBinding($ds); |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | $this->onDataBound(null); |
357 | 357 | } |
358 | 358 | |
359 | - public function dataSourceViewChanged($sender,$param) |
|
359 | + public function dataSourceViewChanged($sender, $param) |
|
360 | 360 | { |
361 | 361 | if(!$this->_ignoreDataSourceViewChanged) |
362 | 362 | $this->setRequiresDataBinding(true); |
@@ -367,13 +367,13 @@ discard block |
||
367 | 367 | if(!$this->_currentViewValid) |
368 | 368 | { |
369 | 369 | if($this->_currentView && $this->_currentViewIsFromDataSourceID) |
370 | - $this->_currentView->detachEventHandler('DataSourceViewChanged',array($this,'dataSourceViewChanged')); |
|
370 | + $this->_currentView->detachEventHandler('DataSourceViewChanged', array($this, 'dataSourceViewChanged')); |
|
371 | 371 | if(($dataSource=$this->determineDataSource())!==null) |
372 | 372 | { |
373 | 373 | if(($view=$dataSource->getView($this->getDataMember()))===null) |
374 | - throw new TInvalidDataValueException('databoundcontrol_datamember_invalid',$this->getDataMember()); |
|
374 | + throw new TInvalidDataValueException('databoundcontrol_datamember_invalid', $this->getDataMember()); |
|
375 | 375 | if($this->_currentViewIsFromDataSourceID=$this->getUsingDataSourceID()) |
376 | - $view->attachEventHandler('OnDataSourceViewChanged',array($this,'dataSourceViewChanged')); |
|
376 | + $view->attachEventHandler('OnDataSourceViewChanged', array($this, 'dataSourceViewChanged')); |
|
377 | 377 | $this->_currentView=$view; |
378 | 378 | } |
379 | 379 | else |
@@ -390,14 +390,14 @@ discard block |
||
390 | 390 | if(($dsid=$this->getDataSourceID())!=='') |
391 | 391 | { |
392 | 392 | if(($dataSource=$this->getNamingContainer()->findControl($dsid))===null) |
393 | - throw new TInvalidDataValueException('databoundcontrol_datasourceid_inexistent',$dsid); |
|
393 | + throw new TInvalidDataValueException('databoundcontrol_datasourceid_inexistent', $dsid); |
|
394 | 394 | else if(!($dataSource instanceof IDataSource)) |
395 | - throw new TInvalidDataValueException('databoundcontrol_datasourceid_invalid',$dsid); |
|
395 | + throw new TInvalidDataValueException('databoundcontrol_datasourceid_invalid', $dsid); |
|
396 | 396 | else |
397 | 397 | $this->_currentDataSource=$dataSource; |
398 | 398 | } |
399 | 399 | else if(($dataSource=$this->getDataSource())!==null) |
400 | - $this->_currentDataSource=new TReadOnlyDataSource($dataSource,$this->getDataMember()); |
|
400 | + $this->_currentDataSource=new TReadOnlyDataSource($dataSource, $this->getDataMember()); |
|
401 | 401 | else |
402 | 402 | $this->_currentDataSource=null; |
403 | 403 | $this->_currentDataSourceValid=true; |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | */ |
415 | 415 | public function onDataBound($param) |
416 | 416 | { |
417 | - $this->raiseEvent('OnDataBound',$this,$param); |
|
417 | + $this->raiseEvent('OnDataBound', $this, $param); |
|
418 | 418 | } |
419 | 419 | |
420 | 420 | /** |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | { |
429 | 429 | parent::onInit($param); |
430 | 430 | $page=$this->getPage(); |
431 | - $page->attachEventHandler('OnPreLoad',array($this,'pagePreLoad')); |
|
431 | + $page->attachEventHandler('OnPreLoad', array($this, 'pagePreLoad')); |
|
432 | 432 | } |
433 | 433 | |
434 | 434 | /** |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | * @param mixed event sender |
438 | 438 | * @param TEventParameter event parameter |
439 | 439 | */ |
440 | - public function pagePreLoad($sender,$param) |
|
440 | + public function pagePreLoad($sender, $param) |
|
441 | 441 | { |
442 | 442 | $this->_initialized=true; |
443 | 443 | $isPostBack=$this->getPage()->getIsPostBack(); |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | if(is_array($value)) |
475 | 475 | $list->add($value); |
476 | 476 | else |
477 | - $list->add(array($value,is_string($key)?$key:$value)); |
|
477 | + $list->add(array($value, is_string($key) ? $key : $value)); |
|
478 | 478 | } |
479 | 479 | return $list; |
480 | 480 | } |
@@ -487,17 +487,17 @@ discard block |
||
487 | 487 | else if(($value instanceof Traversable) || $value===null) |
488 | 488 | return $value; |
489 | 489 | else |
490 | - throw new TInvalidDataTypeException('databoundcontrol_datasource_invalid',get_class($this)); |
|
490 | + throw new TInvalidDataTypeException('databoundcontrol_datasource_invalid', get_class($this)); |
|
491 | 491 | } |
492 | 492 | |
493 | 493 | public function getDataMember() |
494 | 494 | { |
495 | - return $this->getViewState('DataMember',''); |
|
495 | + return $this->getViewState('DataMember', ''); |
|
496 | 496 | } |
497 | 497 | |
498 | 498 | public function setDataMember($value) |
499 | 499 | { |
500 | - $this->setViewState('DataMember',$value,''); |
|
500 | + $this->setViewState('DataMember', $value, ''); |
|
501 | 501 | } |
502 | 502 | |
503 | 503 | public function getSelectParameters() |
@@ -534,6 +534,7 @@ discard block |
||
534 | 534 | * If the item to be selected is already in edit mode, it will remain in edit mode. |
535 | 535 | * If the index is less than 0, any existing selection will be cleared up. |
536 | 536 | * @param integer the selected item index |
537 | + * @param integer $value |
|
537 | 538 | */ |
538 | 539 | public function setSelectedItemIndex($value) |
539 | 540 | { |
@@ -762,6 +763,7 @@ discard block |
||
762 | 763 | * This method is invoked when a button control raises <b>OnCommand</b> event |
763 | 764 | * with <b>cancel</b> command name. |
764 | 765 | * @param TDataGridCommandEventParameter event parameter |
766 | + * @param TDataGridCommandEventParameter $param |
|
765 | 767 | */ |
766 | 768 | public function onCancelCommand($param) |
767 | 769 | { |
@@ -773,6 +775,7 @@ discard block |
||
773 | 775 | * This method is invoked when a button control raises <b>OnCommand</b> event |
774 | 776 | * with <b>delete</b> command name. |
775 | 777 | * @param TDataGridCommandEventParameter event parameter |
778 | + * @param TDataGridCommandEventParameter $param |
|
776 | 779 | */ |
777 | 780 | public function onDeleteCommand($param) |
778 | 781 | { |
@@ -784,6 +787,7 @@ discard block |
||
784 | 787 | * This method is invoked when a button control raises <b>OnCommand</b> event |
785 | 788 | * with <b>edit</b> command name. |
786 | 789 | * @param TDataGridCommandEventParameter event parameter |
790 | + * @param TDataGridCommandEventParameter $param |
|
787 | 791 | */ |
788 | 792 | public function onEditCommand($param) |
789 | 793 | { |
@@ -794,6 +798,7 @@ discard block |
||
794 | 798 | * Raises <b>OnItemCommand</b> event. |
795 | 799 | * This method is invoked when a button control raises <b>OnCommand</b> event. |
796 | 800 | * @param TDataGridCommandEventParameter event parameter |
801 | + * @param TDataGridCommandEventParameter $param |
|
797 | 802 | */ |
798 | 803 | public function onItemCommand($param) |
799 | 804 | { |
@@ -805,6 +810,7 @@ discard block |
||
805 | 810 | * This method is invoked when a button control raises <b>OnCommand</b> event |
806 | 811 | * with <b>sort</b> command name. |
807 | 812 | * @param TDataGridSortCommandEventParameter event parameter |
813 | + * @param TDataGridSortCommandEventParameter $param |
|
808 | 814 | */ |
809 | 815 | public function onSortCommand($param) |
810 | 816 | { |
@@ -816,6 +822,7 @@ discard block |
||
816 | 822 | * This method is invoked when a button control raises <b>OnCommand</b> event |
817 | 823 | * with <b>update</b> command name. |
818 | 824 | * @param TDataGridCommandEventParameter event parameter |
825 | + * @param TDataGridCommandEventParameter $param |
|
819 | 826 | */ |
820 | 827 | public function onUpdateCommand($param) |
821 | 828 | { |
@@ -827,6 +834,7 @@ discard block |
||
827 | 834 | * This method is invoked right after a datagrid item is created and before |
828 | 835 | * added to page hierarchy. |
829 | 836 | * @param TDataGridItemEventParameter event parameter |
837 | + * @param TDataGridItemEventParameter $param |
|
830 | 838 | */ |
831 | 839 | public function onItemCreated($param) |
832 | 840 | { |
@@ -838,6 +846,7 @@ discard block |
||
838 | 846 | * This method is invoked right after a datagrid pager is created and before |
839 | 847 | * added to page hierarchy. |
840 | 848 | * @param TDataGridPagerEventParameter event parameter |
849 | + * @param TDataGridPagerEventParameter $param |
|
841 | 850 | */ |
842 | 851 | public function onPagerCreated($param) |
843 | 852 | { |
@@ -849,6 +858,7 @@ discard block |
||
849 | 858 | * This method is invoked for each datagrid item after it performs |
850 | 859 | * databinding. |
851 | 860 | * @param TDataGridItemEventParameter event parameter |
861 | + * @param TDataGridItemEventParameter $param |
|
852 | 862 | */ |
853 | 863 | public function onItemDataBound($param) |
854 | 864 | { |
@@ -859,6 +869,7 @@ discard block |
||
859 | 869 | * Raises <b>OnPageIndexChanged</b> event. |
860 | 870 | * This method is invoked when current page is changed. |
861 | 871 | * @param TDataGridPageChangedEventParameter event parameter |
872 | + * @param TDataGridPageChangedEventParameter $param |
|
862 | 873 | */ |
863 | 874 | public function onPageIndexChanged($param) |
864 | 875 | { |
@@ -1155,6 +1166,11 @@ discard block |
||
1155 | 1166 | return new TDataGridItem($itemIndex,$dataSourceIndex,$itemType); |
1156 | 1167 | } |
1157 | 1168 | |
1169 | + /** |
|
1170 | + * @param integer $itemIndex |
|
1171 | + * @param boolean $dataBind |
|
1172 | + * @param TList $columns |
|
1173 | + */ |
|
1158 | 1174 | private function createItemInternal($itemIndex,$dataSourceIndex,$itemType,$dataBind,$dataItem,$columns) |
1159 | 1175 | { |
1160 | 1176 | $item=$this->createItem($itemIndex,$dataSourceIndex,$itemType); |
@@ -1180,6 +1196,7 @@ discard block |
||
1180 | 1196 | * Initializes a datagrid item and cells inside it |
1181 | 1197 | * @param TDataGrid datagrid item to be initialized |
1182 | 1198 | * @param TDataGridColumnCollection datagrid columns to be used to initialize the cells in the item |
1199 | + * @param TDataGridItem $item |
|
1183 | 1200 | */ |
1184 | 1201 | protected function initializeItem($item,$columns) |
1185 | 1202 | { |
@@ -1212,6 +1229,7 @@ discard block |
||
1212 | 1229 | /** |
1213 | 1230 | * Builds the pager content based on pager style. |
1214 | 1231 | * @param TDataGridPager the container for the pager |
1232 | + * @param TDataGridPager $pager |
|
1215 | 1233 | */ |
1216 | 1234 | protected function buildPager($pager) |
1217 | 1235 | { |
@@ -1237,6 +1255,9 @@ discard block |
||
1237 | 1255 | * @param string caption of the button |
1238 | 1256 | * @param string CommandName corresponding to the OnCommand event of the button |
1239 | 1257 | * @param string CommandParameter corresponding to the OnCommand event of the button |
1258 | + * @param TDataGridPagerButtonType $buttonType |
|
1259 | + * @param boolean $enabled |
|
1260 | + * @param string $commandName |
|
1240 | 1261 | * @return mixed the button instance |
1241 | 1262 | */ |
1242 | 1263 | protected function createPagerButton($pager,$buttonType,$enabled,$text,$commandName,$commandParameter) |
@@ -1881,6 +1902,7 @@ discard block |
||
1881 | 1902 | * Constructor. |
1882 | 1903 | * @param TControl the control originally raises the <b>OnCommand</b> event. |
1883 | 1904 | * @param integer new page index |
1905 | + * @param integer $newPageIndex |
|
1884 | 1906 | */ |
1885 | 1907 | public function __construct($source,$newPageIndex) |
1886 | 1908 | { |
@@ -1957,7 +1979,7 @@ discard block |
||
1957 | 1979 | } |
1958 | 1980 | |
1959 | 1981 | /** |
1960 | - * @return TListItemType item type. |
|
1982 | + * @return string item type. |
|
1961 | 1983 | */ |
1962 | 1984 | public function getItemType() |
1963 | 1985 | { |
@@ -2062,6 +2084,7 @@ discard block |
||
2062 | 2084 | /** |
2063 | 2085 | * Constructor. |
2064 | 2086 | * @param TDataGrid datagrid object |
2087 | + * @param TDataGrid $dataGrid |
|
2065 | 2088 | */ |
2066 | 2089 | public function __construct($dataGrid) |
2067 | 2090 | { |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | if($object instanceof TDataGridColumn) |
243 | 243 | $this->getColumns()->add($object); |
244 | 244 | else |
245 | - parent::addParsedObject($object); // this is needed by EmptyTemplate |
|
245 | + parent::addParsedObject($object); // this is needed by EmptyTemplate |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | /** |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | */ |
281 | 281 | public function getItemCount() |
282 | 282 | { |
283 | - return $this->_items?$this->_items->getCount():0; |
|
283 | + return $this->_items ? $this->_items->getCount() : 0; |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | /** |
@@ -314,10 +314,10 @@ discard block |
||
314 | 314 | */ |
315 | 315 | public function getItemStyle() |
316 | 316 | { |
317 | - if(($style=$this->getViewState('ItemStyle',null))===null) |
|
317 | + if(($style=$this->getViewState('ItemStyle', null))===null) |
|
318 | 318 | { |
319 | 319 | $style=new TTableItemStyle; |
320 | - $this->setViewState('ItemStyle',$style,null); |
|
320 | + $this->setViewState('ItemStyle', $style, null); |
|
321 | 321 | } |
322 | 322 | return $style; |
323 | 323 | } |
@@ -327,10 +327,10 @@ discard block |
||
327 | 327 | */ |
328 | 328 | public function getAlternatingItemStyle() |
329 | 329 | { |
330 | - if(($style=$this->getViewState('AlternatingItemStyle',null))===null) |
|
330 | + if(($style=$this->getViewState('AlternatingItemStyle', null))===null) |
|
331 | 331 | { |
332 | 332 | $style=new TTableItemStyle; |
333 | - $this->setViewState('AlternatingItemStyle',$style,null); |
|
333 | + $this->setViewState('AlternatingItemStyle', $style, null); |
|
334 | 334 | } |
335 | 335 | return $style; |
336 | 336 | } |
@@ -340,10 +340,10 @@ discard block |
||
340 | 340 | */ |
341 | 341 | public function getSelectedItemStyle() |
342 | 342 | { |
343 | - if(($style=$this->getViewState('SelectedItemStyle',null))===null) |
|
343 | + if(($style=$this->getViewState('SelectedItemStyle', null))===null) |
|
344 | 344 | { |
345 | 345 | $style=new TTableItemStyle; |
346 | - $this->setViewState('SelectedItemStyle',$style,null); |
|
346 | + $this->setViewState('SelectedItemStyle', $style, null); |
|
347 | 347 | } |
348 | 348 | return $style; |
349 | 349 | } |
@@ -353,10 +353,10 @@ discard block |
||
353 | 353 | */ |
354 | 354 | public function getEditItemStyle() |
355 | 355 | { |
356 | - if(($style=$this->getViewState('EditItemStyle',null))===null) |
|
356 | + if(($style=$this->getViewState('EditItemStyle', null))===null) |
|
357 | 357 | { |
358 | 358 | $style=new TTableItemStyle; |
359 | - $this->setViewState('EditItemStyle',$style,null); |
|
359 | + $this->setViewState('EditItemStyle', $style, null); |
|
360 | 360 | } |
361 | 361 | return $style; |
362 | 362 | } |
@@ -366,10 +366,10 @@ discard block |
||
366 | 366 | */ |
367 | 367 | public function getHeaderStyle() |
368 | 368 | { |
369 | - if(($style=$this->getViewState('HeaderStyle',null))===null) |
|
369 | + if(($style=$this->getViewState('HeaderStyle', null))===null) |
|
370 | 370 | { |
371 | 371 | $style=new TTableItemStyle; |
372 | - $this->setViewState('HeaderStyle',$style,null); |
|
372 | + $this->setViewState('HeaderStyle', $style, null); |
|
373 | 373 | } |
374 | 374 | return $style; |
375 | 375 | } |
@@ -379,10 +379,10 @@ discard block |
||
379 | 379 | */ |
380 | 380 | public function getFooterStyle() |
381 | 381 | { |
382 | - if(($style=$this->getViewState('FooterStyle',null))===null) |
|
382 | + if(($style=$this->getViewState('FooterStyle', null))===null) |
|
383 | 383 | { |
384 | 384 | $style=new TTableItemStyle; |
385 | - $this->setViewState('FooterStyle',$style,null); |
|
385 | + $this->setViewState('FooterStyle', $style, null); |
|
386 | 386 | } |
387 | 387 | return $style; |
388 | 388 | } |
@@ -392,10 +392,10 @@ discard block |
||
392 | 392 | */ |
393 | 393 | public function getPagerStyle() |
394 | 394 | { |
395 | - if(($style=$this->getViewState('PagerStyle',null))===null) |
|
395 | + if(($style=$this->getViewState('PagerStyle', null))===null) |
|
396 | 396 | { |
397 | 397 | $style=new TDataGridPagerStyle; |
398 | - $this->setViewState('PagerStyle',$style,null); |
|
398 | + $this->setViewState('PagerStyle', $style, null); |
|
399 | 399 | } |
400 | 400 | return $style; |
401 | 401 | } |
@@ -406,10 +406,10 @@ discard block |
||
406 | 406 | */ |
407 | 407 | public function getTableHeadStyle() |
408 | 408 | { |
409 | - if(($style=$this->getViewState('TableHeadStyle',null))===null) |
|
409 | + if(($style=$this->getViewState('TableHeadStyle', null))===null) |
|
410 | 410 | { |
411 | 411 | $style=new TStyle; |
412 | - $this->setViewState('TableHeadStyle',$style,null); |
|
412 | + $this->setViewState('TableHeadStyle', $style, null); |
|
413 | 413 | } |
414 | 414 | return $style; |
415 | 415 | } |
@@ -420,10 +420,10 @@ discard block |
||
420 | 420 | */ |
421 | 421 | public function getTableBodyStyle() |
422 | 422 | { |
423 | - if(($style=$this->getViewState('TableBodyStyle',null))===null) |
|
423 | + if(($style=$this->getViewState('TableBodyStyle', null))===null) |
|
424 | 424 | { |
425 | 425 | $style=new TStyle; |
426 | - $this->setViewState('TableBodyStyle',$style,null); |
|
426 | + $this->setViewState('TableBodyStyle', $style, null); |
|
427 | 427 | } |
428 | 428 | return $style; |
429 | 429 | } |
@@ -434,10 +434,10 @@ discard block |
||
434 | 434 | */ |
435 | 435 | public function getTableFootStyle() |
436 | 436 | { |
437 | - if(($style=$this->getViewState('TableFootStyle',null))===null) |
|
437 | + if(($style=$this->getViewState('TableFootStyle', null))===null) |
|
438 | 438 | { |
439 | 439 | $style=new TStyle; |
440 | - $this->setViewState('TableFootStyle',$style,null); |
|
440 | + $this->setViewState('TableFootStyle', $style, null); |
|
441 | 441 | } |
442 | 442 | return $style; |
443 | 443 | } |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | */ |
448 | 448 | public function getCaption() |
449 | 449 | { |
450 | - return $this->getViewState('Caption',''); |
|
450 | + return $this->getViewState('Caption', ''); |
|
451 | 451 | } |
452 | 452 | |
453 | 453 | /** |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | */ |
456 | 456 | public function setCaption($value) |
457 | 457 | { |
458 | - $this->setViewState('Caption',$value,''); |
|
458 | + $this->setViewState('Caption', $value, ''); |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | /** |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | */ |
464 | 464 | public function getCaptionAlign() |
465 | 465 | { |
466 | - return $this->getViewState('CaptionAlign',TTableCaptionAlign::NotSet); |
|
466 | + return $this->getViewState('CaptionAlign', TTableCaptionAlign::NotSet); |
|
467 | 467 | } |
468 | 468 | |
469 | 469 | /** |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | */ |
472 | 472 | public function setCaptionAlign($value) |
473 | 473 | { |
474 | - $this->setViewState('CaptionAlign',TPropertyValue::ensureEnum($value,'TTableCaptionAlign'),TTableCaptionAlign::NotSet); |
|
474 | + $this->setViewState('CaptionAlign', TPropertyValue::ensureEnum($value, 'TTableCaptionAlign'), TTableCaptionAlign::NotSet); |
|
475 | 475 | } |
476 | 476 | |
477 | 477 | /** |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | { |
514 | 514 | $index=$this->getSelectedItemIndex(); |
515 | 515 | $items=$this->getItems(); |
516 | - if($index>=0 && $index<$items->getCount()) |
|
516 | + if($index >= 0 && $index < $items->getCount()) |
|
517 | 517 | return $items->itemAt($index); |
518 | 518 | else |
519 | 519 | return null; |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | */ |
526 | 526 | public function getSelectedItemIndex() |
527 | 527 | { |
528 | - return $this->getViewState('SelectedItemIndex',-1); |
|
528 | + return $this->getViewState('SelectedItemIndex', -1); |
|
529 | 529 | } |
530 | 530 | |
531 | 531 | /** |
@@ -537,20 +537,20 @@ discard block |
||
537 | 537 | */ |
538 | 538 | public function setSelectedItemIndex($value) |
539 | 539 | { |
540 | - if(($value=TPropertyValue::ensureInteger($value))<0) |
|
540 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
541 | 541 | $value=-1; |
542 | 542 | if(($current=$this->getSelectedItemIndex())!==$value) |
543 | 543 | { |
544 | - $this->setViewState('SelectedItemIndex',$value,-1); |
|
544 | + $this->setViewState('SelectedItemIndex', $value, -1); |
|
545 | 545 | $items=$this->getItems(); |
546 | 546 | $itemCount=$items->getCount(); |
547 | - if($current>=0 && $current<$itemCount) |
|
547 | + if($current >= 0 && $current < $itemCount) |
|
548 | 548 | { |
549 | 549 | $item=$items->itemAt($current); |
550 | 550 | if($item->getItemType()!==TListItemType::EditItem) |
551 | - $item->setItemType($current%2?TListItemType::AlternatingItem:TListItemType::Item); |
|
551 | + $item->setItemType($current % 2 ? TListItemType::AlternatingItem : TListItemType::Item); |
|
552 | 552 | } |
553 | - if($value>=0 && $value<$itemCount) |
|
553 | + if($value >= 0 && $value < $itemCount) |
|
554 | 554 | { |
555 | 555 | $item=$items->itemAt($value); |
556 | 556 | if($item->getItemType()!==TListItemType::EditItem) |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | { |
567 | 567 | $index=$this->getEditItemIndex(); |
568 | 568 | $items=$this->getItems(); |
569 | - if($index>=0 && $index<$items->getCount()) |
|
569 | + if($index >= 0 && $index < $items->getCount()) |
|
570 | 570 | return $items->itemAt($index); |
571 | 571 | else |
572 | 572 | return null; |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | */ |
579 | 579 | public function getEditItemIndex() |
580 | 580 | { |
581 | - return $this->getViewState('EditItemIndex',-1); |
|
581 | + return $this->getViewState('EditItemIndex', -1); |
|
582 | 582 | } |
583 | 583 | |
584 | 584 | /** |
@@ -589,16 +589,16 @@ discard block |
||
589 | 589 | */ |
590 | 590 | public function setEditItemIndex($value) |
591 | 591 | { |
592 | - if(($value=TPropertyValue::ensureInteger($value))<0) |
|
592 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
593 | 593 | $value=-1; |
594 | 594 | if(($current=$this->getEditItemIndex())!==$value) |
595 | 595 | { |
596 | - $this->setViewState('EditItemIndex',$value,-1); |
|
596 | + $this->setViewState('EditItemIndex', $value, -1); |
|
597 | 597 | $items=$this->getItems(); |
598 | 598 | $itemCount=$items->getCount(); |
599 | - if($current>=0 && $current<$itemCount) |
|
600 | - $items->itemAt($current)->setItemType($current%2?TListItemType::AlternatingItem:TListItemType::Item); |
|
601 | - if($value>=0 && $value<$itemCount) |
|
599 | + if($current >= 0 && $current < $itemCount) |
|
600 | + $items->itemAt($current)->setItemType($current % 2 ? TListItemType::AlternatingItem : TListItemType::Item); |
|
601 | + if($value >= 0 && $value < $itemCount) |
|
602 | 602 | $items->itemAt($value)->setItemType(TListItemType::EditItem); |
603 | 603 | } |
604 | 604 | } |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | */ |
609 | 609 | public function getAllowSorting() |
610 | 610 | { |
611 | - return $this->getViewState('AllowSorting',false); |
|
611 | + return $this->getViewState('AllowSorting', false); |
|
612 | 612 | } |
613 | 613 | |
614 | 614 | /** |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | */ |
617 | 617 | public function setAllowSorting($value) |
618 | 618 | { |
619 | - $this->setViewState('AllowSorting',TPropertyValue::ensureBoolean($value),false); |
|
619 | + $this->setViewState('AllowSorting', TPropertyValue::ensureBoolean($value), false); |
|
620 | 620 | } |
621 | 621 | |
622 | 622 | /** |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | */ |
625 | 625 | public function getAutoGenerateColumns() |
626 | 626 | { |
627 | - return $this->getViewState('AutoGenerateColumns',true); |
|
627 | + return $this->getViewState('AutoGenerateColumns', true); |
|
628 | 628 | } |
629 | 629 | |
630 | 630 | /** |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | */ |
633 | 633 | public function setAutoGenerateColumns($value) |
634 | 634 | { |
635 | - $this->setViewState('AutoGenerateColumns',TPropertyValue::ensureBoolean($value),true); |
|
635 | + $this->setViewState('AutoGenerateColumns', TPropertyValue::ensureBoolean($value), true); |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | /** |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | */ |
641 | 641 | public function getShowHeader() |
642 | 642 | { |
643 | - return $this->getViewState('ShowHeader',true); |
|
643 | + return $this->getViewState('ShowHeader', true); |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | /** |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | */ |
649 | 649 | public function setShowHeader($value) |
650 | 650 | { |
651 | - $this->setViewState('ShowHeader',TPropertyValue::ensureBoolean($value),true); |
|
651 | + $this->setViewState('ShowHeader', TPropertyValue::ensureBoolean($value), true); |
|
652 | 652 | } |
653 | 653 | |
654 | 654 | /** |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | */ |
657 | 657 | public function getShowFooter() |
658 | 658 | { |
659 | - return $this->getViewState('ShowFooter',false); |
|
659 | + return $this->getViewState('ShowFooter', false); |
|
660 | 660 | } |
661 | 661 | |
662 | 662 | /** |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | */ |
665 | 665 | public function setShowFooter($value) |
666 | 666 | { |
667 | - $this->setViewState('ShowFooter',TPropertyValue::ensureBoolean($value),false); |
|
667 | + $this->setViewState('ShowFooter', TPropertyValue::ensureBoolean($value), false); |
|
668 | 668 | } |
669 | 669 | |
670 | 670 | /** |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | if($value instanceof ITemplate || $value===null) |
685 | 685 | $this->_emptyTemplate=$value; |
686 | 686 | else |
687 | - throw new TInvalidDataTypeException('datagrid_template_required','EmptyTemplate'); |
|
687 | + throw new TInvalidDataTypeException('datagrid_template_required', 'EmptyTemplate'); |
|
688 | 688 | } |
689 | 689 | |
690 | 690 | /** |
@@ -700,57 +700,57 @@ discard block |
||
700 | 700 | * @param TEventParameter event parameter |
701 | 701 | * @return boolean whether the event bubbling should stop here. |
702 | 702 | */ |
703 | - public function bubbleEvent($sender,$param) |
|
703 | + public function bubbleEvent($sender, $param) |
|
704 | 704 | { |
705 | 705 | if($param instanceof TDataGridCommandEventParameter) |
706 | 706 | { |
707 | 707 | $this->onItemCommand($param); |
708 | 708 | $command=$param->getCommandName(); |
709 | - if(strcasecmp($command,self::CMD_SELECT)===0) |
|
709 | + if(strcasecmp($command, self::CMD_SELECT)===0) |
|
710 | 710 | { |
711 | 711 | $this->setSelectedItemIndex($param->getItem()->getItemIndex()); |
712 | 712 | $this->onSelectedIndexChanged($param); |
713 | 713 | return true; |
714 | 714 | } |
715 | - else if(strcasecmp($command,self::CMD_EDIT)===0) |
|
715 | + else if(strcasecmp($command, self::CMD_EDIT)===0) |
|
716 | 716 | { |
717 | 717 | $this->onEditCommand($param); |
718 | 718 | return true; |
719 | 719 | } |
720 | - else if(strcasecmp($command,self::CMD_DELETE)===0) |
|
720 | + else if(strcasecmp($command, self::CMD_DELETE)===0) |
|
721 | 721 | { |
722 | 722 | $this->onDeleteCommand($param); |
723 | 723 | return true; |
724 | 724 | } |
725 | - else if(strcasecmp($command,self::CMD_UPDATE)===0) |
|
725 | + else if(strcasecmp($command, self::CMD_UPDATE)===0) |
|
726 | 726 | { |
727 | 727 | $this->onUpdateCommand($param); |
728 | 728 | return true; |
729 | 729 | } |
730 | - else if(strcasecmp($command,self::CMD_CANCEL)===0) |
|
730 | + else if(strcasecmp($command, self::CMD_CANCEL)===0) |
|
731 | 731 | { |
732 | 732 | $this->onCancelCommand($param); |
733 | 733 | return true; |
734 | 734 | } |
735 | - else if(strcasecmp($command,self::CMD_SORT)===0) |
|
735 | + else if(strcasecmp($command, self::CMD_SORT)===0) |
|
736 | 736 | { |
737 | - $this->onSortCommand(new TDataGridSortCommandEventParameter($sender,$param)); |
|
737 | + $this->onSortCommand(new TDataGridSortCommandEventParameter($sender, $param)); |
|
738 | 738 | return true; |
739 | 739 | } |
740 | - else if(strcasecmp($command,self::CMD_PAGE)===0) |
|
740 | + else if(strcasecmp($command, self::CMD_PAGE)===0) |
|
741 | 741 | { |
742 | 742 | $p=$param->getCommandParameter(); |
743 | - if(strcasecmp($p,self::CMD_PAGE_NEXT)===0) |
|
744 | - $pageIndex=$this->getCurrentPageIndex()+1; |
|
745 | - else if(strcasecmp($p,self::CMD_PAGE_PREV)===0) |
|
746 | - $pageIndex=$this->getCurrentPageIndex()-1; |
|
747 | - else if(strcasecmp($p,self::CMD_PAGE_FIRST)===0) |
|
743 | + if(strcasecmp($p, self::CMD_PAGE_NEXT)===0) |
|
744 | + $pageIndex=$this->getCurrentPageIndex() + 1; |
|
745 | + else if(strcasecmp($p, self::CMD_PAGE_PREV)===0) |
|
746 | + $pageIndex=$this->getCurrentPageIndex() - 1; |
|
747 | + else if(strcasecmp($p, self::CMD_PAGE_FIRST)===0) |
|
748 | 748 | $pageIndex=0; |
749 | - else if(strcasecmp($p,self::CMD_PAGE_LAST)===0) |
|
750 | - $pageIndex=$this->getPageCount()-1; |
|
749 | + else if(strcasecmp($p, self::CMD_PAGE_LAST)===0) |
|
750 | + $pageIndex=$this->getPageCount() - 1; |
|
751 | 751 | else |
752 | - $pageIndex=TPropertyValue::ensureInteger($p)-1; |
|
753 | - $this->onPageIndexChanged(new TDataGridPageChangedEventParameter($sender,$pageIndex)); |
|
752 | + $pageIndex=TPropertyValue::ensureInteger($p) - 1; |
|
753 | + $this->onPageIndexChanged(new TDataGridPageChangedEventParameter($sender, $pageIndex)); |
|
754 | 754 | return true; |
755 | 755 | } |
756 | 756 | } |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | */ |
766 | 766 | public function onCancelCommand($param) |
767 | 767 | { |
768 | - $this->raiseEvent('OnCancelCommand',$this,$param); |
|
768 | + $this->raiseEvent('OnCancelCommand', $this, $param); |
|
769 | 769 | } |
770 | 770 | |
771 | 771 | /** |
@@ -776,7 +776,7 @@ discard block |
||
776 | 776 | */ |
777 | 777 | public function onDeleteCommand($param) |
778 | 778 | { |
779 | - $this->raiseEvent('OnDeleteCommand',$this,$param); |
|
779 | + $this->raiseEvent('OnDeleteCommand', $this, $param); |
|
780 | 780 | } |
781 | 781 | |
782 | 782 | /** |
@@ -787,7 +787,7 @@ discard block |
||
787 | 787 | */ |
788 | 788 | public function onEditCommand($param) |
789 | 789 | { |
790 | - $this->raiseEvent('OnEditCommand',$this,$param); |
|
790 | + $this->raiseEvent('OnEditCommand', $this, $param); |
|
791 | 791 | } |
792 | 792 | |
793 | 793 | /** |
@@ -797,7 +797,7 @@ discard block |
||
797 | 797 | */ |
798 | 798 | public function onItemCommand($param) |
799 | 799 | { |
800 | - $this->raiseEvent('OnItemCommand',$this,$param); |
|
800 | + $this->raiseEvent('OnItemCommand', $this, $param); |
|
801 | 801 | } |
802 | 802 | |
803 | 803 | /** |
@@ -808,7 +808,7 @@ discard block |
||
808 | 808 | */ |
809 | 809 | public function onSortCommand($param) |
810 | 810 | { |
811 | - $this->raiseEvent('OnSortCommand',$this,$param); |
|
811 | + $this->raiseEvent('OnSortCommand', $this, $param); |
|
812 | 812 | } |
813 | 813 | |
814 | 814 | /** |
@@ -819,7 +819,7 @@ discard block |
||
819 | 819 | */ |
820 | 820 | public function onUpdateCommand($param) |
821 | 821 | { |
822 | - $this->raiseEvent('OnUpdateCommand',$this,$param); |
|
822 | + $this->raiseEvent('OnUpdateCommand', $this, $param); |
|
823 | 823 | } |
824 | 824 | |
825 | 825 | /** |
@@ -830,7 +830,7 @@ discard block |
||
830 | 830 | */ |
831 | 831 | public function onItemCreated($param) |
832 | 832 | { |
833 | - $this->raiseEvent('OnItemCreated',$this,$param); |
|
833 | + $this->raiseEvent('OnItemCreated', $this, $param); |
|
834 | 834 | } |
835 | 835 | |
836 | 836 | /** |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | */ |
842 | 842 | public function onPagerCreated($param) |
843 | 843 | { |
844 | - $this->raiseEvent('OnPagerCreated',$this,$param); |
|
844 | + $this->raiseEvent('OnPagerCreated', $this, $param); |
|
845 | 845 | } |
846 | 846 | |
847 | 847 | /** |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | */ |
853 | 853 | public function onItemDataBound($param) |
854 | 854 | { |
855 | - $this->raiseEvent('OnItemDataBound',$this,$param); |
|
855 | + $this->raiseEvent('OnItemDataBound', $this, $param); |
|
856 | 856 | } |
857 | 857 | |
858 | 858 | /** |
@@ -862,7 +862,7 @@ discard block |
||
862 | 862 | */ |
863 | 863 | public function onPageIndexChanged($param) |
864 | 864 | { |
865 | - $this->raiseEvent('OnPageIndexChanged',$this,$param); |
|
865 | + $this->raiseEvent('OnPageIndexChanged', $this, $param); |
|
866 | 866 | } |
867 | 867 | |
868 | 868 | /** |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | if(!$this->getEnableViewState(true)) |
876 | 876 | return; |
877 | 877 | if($this->_items) |
878 | - $this->setViewState('ItemCount',$this->_items->getCount(),0); |
|
878 | + $this->setViewState('ItemCount', $this->_items->getCount(), 0); |
|
879 | 879 | else |
880 | 880 | $this->clearViewState('ItemCount'); |
881 | 881 | if($this->_autoColumns) |
@@ -883,7 +883,7 @@ discard block |
||
883 | 883 | $state=array(); |
884 | 884 | foreach($this->_autoColumns as $column) |
885 | 885 | $state[]=$column->saveState(); |
886 | - $this->setViewState('AutoColumns',$state,array()); |
|
886 | + $this->setViewState('AutoColumns', $state, array()); |
|
887 | 887 | } |
888 | 888 | else |
889 | 889 | $this->clearViewState('AutoColumns'); |
@@ -892,7 +892,7 @@ discard block |
||
892 | 892 | $state=array(); |
893 | 893 | foreach($this->_columns as $column) |
894 | 894 | $state[]=$column->saveState(); |
895 | - $this->setViewState('Columns',$state,array()); |
|
895 | + $this->setViewState('Columns', $state, array()); |
|
896 | 896 | } |
897 | 897 | else |
898 | 898 | $this->clearViewState('Columns'); |
@@ -909,7 +909,7 @@ discard block |
||
909 | 909 | return; |
910 | 910 | if(!$this->getIsDataBound()) |
911 | 911 | { |
912 | - $state=$this->getViewState('AutoColumns',array()); |
|
912 | + $state=$this->getViewState('AutoColumns', array()); |
|
913 | 913 | if(!empty($state)) |
914 | 914 | { |
915 | 915 | $this->_autoColumns=new TDataGridColumnCollection($this); |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | } |
923 | 923 | else |
924 | 924 | $this->_autoColumns=null; |
925 | - $state=$this->getViewState('Columns',array()); |
|
925 | + $state=$this->getViewState('Columns', array()); |
|
926 | 926 | if($this->_columns && $this->_columns->getCount()===count($state)) |
927 | 927 | { |
928 | 928 | $i=0; |
@@ -959,8 +959,8 @@ discard block |
||
959 | 959 | |
960 | 960 | $allowPaging=$this->getAllowPaging(); |
961 | 961 | |
962 | - $itemCount=$this->getViewState('ItemCount',0); |
|
963 | - $dsIndex=$this->getViewState('DataSourceIndex',0); |
|
962 | + $itemCount=$this->getViewState('ItemCount', 0); |
|
963 | + $dsIndex=$this->getViewState('DataSourceIndex', 0); |
|
964 | 964 | |
965 | 965 | $columns=new TList($this->getColumns()); |
966 | 966 | $columns->mergeWith($this->_autoColumns); |
@@ -974,13 +974,13 @@ discard block |
||
974 | 974 | $column->initialize(); |
975 | 975 | $selectedIndex=$this->getSelectedItemIndex(); |
976 | 976 | $editIndex=$this->getEditItemIndex(); |
977 | - for($index=0;$index<$itemCount;++$index) |
|
977 | + for($index=0; $index < $itemCount; ++$index) |
|
978 | 978 | { |
979 | 979 | if($index===0) |
980 | 980 | { |
981 | 981 | if($allowPaging) |
982 | 982 | $this->_topPager=$this->createPager(); |
983 | - $this->_header=$this->createItemInternal(-1,-1,TListItemType::Header,false,null,$columns); |
|
983 | + $this->_header=$this->createItemInternal(-1, -1, TListItemType::Header, false, null, $columns); |
|
984 | 984 | } |
985 | 985 | if($index===$editIndex) |
986 | 986 | $itemType=TListItemType::EditItem; |
@@ -990,12 +990,12 @@ discard block |
||
990 | 990 | $itemType=TListItemType::AlternatingItem; |
991 | 991 | else |
992 | 992 | $itemType=TListItemType::Item; |
993 | - $items->add($this->createItemInternal($index,$dsIndex,$itemType,false,null,$columns)); |
|
993 | + $items->add($this->createItemInternal($index, $dsIndex, $itemType, false, null, $columns)); |
|
994 | 994 | $dsIndex++; |
995 | 995 | } |
996 | - if($index>0) |
|
996 | + if($index > 0) |
|
997 | 997 | { |
998 | - $this->_footer=$this->createItemInternal(-1,-1,TListItemType::Footer,false,null,$columns); |
|
998 | + $this->_footer=$this->createItemInternal(-1, -1, TListItemType::Footer, false, null, $columns); |
|
999 | 999 | if($allowPaging) |
1000 | 1000 | $this->_bottomPager=$this->createPager(); |
1001 | 1001 | } |
@@ -1035,8 +1035,8 @@ discard block |
||
1035 | 1035 | |
1036 | 1036 | $index=0; |
1037 | 1037 | $allowPaging=$this->getAllowPaging() && ($data instanceof TPagedDataSource); |
1038 | - $dsIndex=$allowPaging?$data->getFirstIndexInPage():0; |
|
1039 | - $this->setViewState('DataSourceIndex',$dsIndex,0); |
|
1038 | + $dsIndex=$allowPaging ? $data->getFirstIndexInPage() : 0; |
|
1039 | + $this->setViewState('DataSourceIndex', $dsIndex, 0); |
|
1040 | 1040 | if($columns->getCount()) |
1041 | 1041 | { |
1042 | 1042 | foreach($columns as $column) |
@@ -1047,14 +1047,14 @@ discard block |
||
1047 | 1047 | foreach($data as $key=>$row) |
1048 | 1048 | { |
1049 | 1049 | if($keyField!=='') |
1050 | - $keys->add($this->getDataFieldValue($row,$keyField)); |
|
1050 | + $keys->add($this->getDataFieldValue($row, $keyField)); |
|
1051 | 1051 | else |
1052 | 1052 | $keys->add($key); |
1053 | 1053 | if($index===0) |
1054 | 1054 | { |
1055 | 1055 | if($allowPaging) |
1056 | 1056 | $this->_topPager=$this->createPager(); |
1057 | - $this->_header=$this->createItemInternal(-1,-1,TListItemType::Header,true,null,$columns); |
|
1057 | + $this->_header=$this->createItemInternal(-1, -1, TListItemType::Header, true, null, $columns); |
|
1058 | 1058 | } |
1059 | 1059 | if($index===$editIndex) |
1060 | 1060 | $itemType=TListItemType::EditItem; |
@@ -1064,18 +1064,18 @@ discard block |
||
1064 | 1064 | $itemType=TListItemType::AlternatingItem; |
1065 | 1065 | else |
1066 | 1066 | $itemType=TListItemType::Item; |
1067 | - $items->add($this->createItemInternal($index,$dsIndex,$itemType,true,$row,$columns)); |
|
1067 | + $items->add($this->createItemInternal($index, $dsIndex, $itemType, true, $row, $columns)); |
|
1068 | 1068 | $index++; |
1069 | 1069 | $dsIndex++; |
1070 | 1070 | } |
1071 | - if($index>0) |
|
1071 | + if($index > 0) |
|
1072 | 1072 | { |
1073 | - $this->_footer=$this->createItemInternal(-1,-1,TListItemType::Footer,true,null,$columns); |
|
1073 | + $this->_footer=$this->createItemInternal(-1, -1, TListItemType::Footer, true, null, $columns); |
|
1074 | 1074 | if($allowPaging) |
1075 | 1075 | $this->_bottomPager=$this->createPager(); |
1076 | 1076 | } |
1077 | 1077 | } |
1078 | - $this->setViewState('ItemCount',$index,0); |
|
1078 | + $this->setViewState('ItemCount', $index, 0); |
|
1079 | 1079 | if(!$dsIndex && $this->_emptyTemplate!==null) |
1080 | 1080 | { |
1081 | 1081 | $this->_useEmptyTemplate=true; |
@@ -1122,7 +1122,7 @@ discard block |
||
1122 | 1122 | { |
1123 | 1123 | if(($rowSpan=$prevCell->getRowSpan())===0) |
1124 | 1124 | $rowSpan=1; |
1125 | - $prevCell->setRowSpan($rowSpan+1); |
|
1125 | + $prevCell->setRowSpan($rowSpan + 1); |
|
1126 | 1126 | $cell->setVisible(false); |
1127 | 1127 | } |
1128 | 1128 | } |
@@ -1150,15 +1150,15 @@ discard block |
||
1150 | 1150 | * @param TListItemType item type |
1151 | 1151 | * @return TDataGridItem created data list item |
1152 | 1152 | */ |
1153 | - protected function createItem($itemIndex,$dataSourceIndex,$itemType) |
|
1153 | + protected function createItem($itemIndex, $dataSourceIndex, $itemType) |
|
1154 | 1154 | { |
1155 | - return new TDataGridItem($itemIndex,$dataSourceIndex,$itemType); |
|
1155 | + return new TDataGridItem($itemIndex, $dataSourceIndex, $itemType); |
|
1156 | 1156 | } |
1157 | 1157 | |
1158 | - private function createItemInternal($itemIndex,$dataSourceIndex,$itemType,$dataBind,$dataItem,$columns) |
|
1158 | + private function createItemInternal($itemIndex, $dataSourceIndex, $itemType, $dataBind, $dataItem, $columns) |
|
1159 | 1159 | { |
1160 | - $item=$this->createItem($itemIndex,$dataSourceIndex,$itemType); |
|
1161 | - $this->initializeItem($item,$columns); |
|
1160 | + $item=$this->createItem($itemIndex, $dataSourceIndex, $itemType); |
|
1161 | + $this->initializeItem($item, $columns); |
|
1162 | 1162 | $param=new TDataGridItemEventParameter($item); |
1163 | 1163 | if($dataBind) |
1164 | 1164 | { |
@@ -1181,7 +1181,7 @@ discard block |
||
1181 | 1181 | * @param TDataGrid datagrid item to be initialized |
1182 | 1182 | * @param TDataGridColumnCollection datagrid columns to be used to initialize the cells in the item |
1183 | 1183 | */ |
1184 | - protected function initializeItem($item,$columns) |
|
1184 | + protected function initializeItem($item, $columns) |
|
1185 | 1185 | { |
1186 | 1186 | $cells=$item->getCells(); |
1187 | 1187 | $itemType=$item->getItemType(); |
@@ -1193,9 +1193,9 @@ discard block |
||
1193 | 1193 | else |
1194 | 1194 | $cell=new TTableCell; |
1195 | 1195 | if(($id=$column->getID())!=='') |
1196 | - $item->registerObject($id,$cell); |
|
1196 | + $item->registerObject($id, $cell); |
|
1197 | 1197 | $cells->add($cell); |
1198 | - $column->initializeCell($cell,$index,$itemType); |
|
1198 | + $column->initializeCell($cell, $index, $itemType); |
|
1199 | 1199 | $index++; |
1200 | 1200 | } |
1201 | 1201 | } |
@@ -1239,7 +1239,7 @@ discard block |
||
1239 | 1239 | * @param string CommandParameter corresponding to the OnCommand event of the button |
1240 | 1240 | * @return mixed the button instance |
1241 | 1241 | */ |
1242 | - protected function createPagerButton($pager,$buttonType,$enabled,$text,$commandName,$commandParameter) |
|
1242 | + protected function createPagerButton($pager, $buttonType, $enabled, $text, $commandName, $commandParameter) |
|
1243 | 1243 | { |
1244 | 1244 | if($buttonType===TDataGridPagerButtonType::LinkButton) |
1245 | 1245 | { |
@@ -1279,46 +1279,46 @@ discard block |
||
1279 | 1279 | { |
1280 | 1280 | if(($text=$style->getFirstPageText())!=='') |
1281 | 1281 | { |
1282 | - $label=$this->createPagerButton($pager,$buttonType,false,$text,'',''); |
|
1282 | + $label=$this->createPagerButton($pager, $buttonType, false, $text, '', ''); |
|
1283 | 1283 | $controls->add($label); |
1284 | 1284 | $controls->add("\n"); |
1285 | 1285 | } |
1286 | 1286 | |
1287 | - $label=$this->createPagerButton($pager,$buttonType,false,$style->getPrevPageText(),'',''); |
|
1287 | + $label=$this->createPagerButton($pager, $buttonType, false, $style->getPrevPageText(), '', ''); |
|
1288 | 1288 | $controls->add($label); |
1289 | 1289 | } |
1290 | 1290 | else |
1291 | 1291 | { |
1292 | 1292 | if(($text=$style->getFirstPageText())!=='') |
1293 | 1293 | { |
1294 | - $button=$this->createPagerButton($pager,$buttonType,true,$text,self::CMD_PAGE,self::CMD_PAGE_FIRST); |
|
1294 | + $button=$this->createPagerButton($pager, $buttonType, true, $text, self::CMD_PAGE, self::CMD_PAGE_FIRST); |
|
1295 | 1295 | $controls->add($button); |
1296 | 1296 | $controls->add("\n"); |
1297 | 1297 | } |
1298 | 1298 | |
1299 | - $button=$this->createPagerButton($pager,$buttonType,true,$style->getPrevPageText(),self::CMD_PAGE,self::CMD_PAGE_PREV); |
|
1299 | + $button=$this->createPagerButton($pager, $buttonType, true, $style->getPrevPageText(), self::CMD_PAGE, self::CMD_PAGE_PREV); |
|
1300 | 1300 | $controls->add($button); |
1301 | 1301 | } |
1302 | 1302 | $controls->add("\n"); |
1303 | - if($currentPageIndex===$this->getPageCount()-1) |
|
1303 | + if($currentPageIndex===$this->getPageCount() - 1) |
|
1304 | 1304 | { |
1305 | - $label=$this->createPagerButton($pager,$buttonType,false,$style->getNextPageText(),'',''); |
|
1305 | + $label=$this->createPagerButton($pager, $buttonType, false, $style->getNextPageText(), '', ''); |
|
1306 | 1306 | $controls->add($label); |
1307 | 1307 | if(($text=$style->getLastPageText())!=='') |
1308 | 1308 | { |
1309 | 1309 | $controls->add("\n"); |
1310 | - $label=$this->createPagerButton($pager,$buttonType,false,$text,'',''); |
|
1310 | + $label=$this->createPagerButton($pager, $buttonType, false, $text, '', ''); |
|
1311 | 1311 | $controls->add($label); |
1312 | 1312 | } |
1313 | 1313 | } |
1314 | 1314 | else |
1315 | 1315 | { |
1316 | - $button=$this->createPagerButton($pager,$buttonType,true,$style->getNextPageText(),self::CMD_PAGE,self::CMD_PAGE_NEXT); |
|
1316 | + $button=$this->createPagerButton($pager, $buttonType, true, $style->getNextPageText(), self::CMD_PAGE, self::CMD_PAGE_NEXT); |
|
1317 | 1317 | $controls->add($button); |
1318 | 1318 | if(($text=$style->getLastPageText())!=='') |
1319 | 1319 | { |
1320 | 1320 | $controls->add("\n"); |
1321 | - $button=$this->createPagerButton($pager,$buttonType,true,$text,self::CMD_PAGE,self::CMD_PAGE_LAST); |
|
1321 | + $button=$this->createPagerButton($pager, $buttonType, true, $text, self::CMD_PAGE, self::CMD_PAGE_LAST); |
|
1322 | 1322 | $controls->add($button); |
1323 | 1323 | } |
1324 | 1324 | } |
@@ -1334,63 +1334,63 @@ discard block |
||
1334 | 1334 | $buttonType=$style->getButtonType(); |
1335 | 1335 | $controls=$pager->getControls(); |
1336 | 1336 | $pageCount=$this->getPageCount(); |
1337 | - $pageIndex=$this->getCurrentPageIndex()+1; |
|
1337 | + $pageIndex=$this->getCurrentPageIndex() + 1; |
|
1338 | 1338 | $maxButtonCount=$style->getPageButtonCount(); |
1339 | - $buttonCount=$maxButtonCount>$pageCount?$pageCount:$maxButtonCount; |
|
1339 | + $buttonCount=$maxButtonCount > $pageCount ? $pageCount : $maxButtonCount; |
|
1340 | 1340 | $startPageIndex=1; |
1341 | 1341 | $endPageIndex=$buttonCount; |
1342 | - if($pageIndex>$endPageIndex) |
|
1342 | + if($pageIndex > $endPageIndex) |
|
1343 | 1343 | { |
1344 | - $startPageIndex=((int)(($pageIndex-1)/$maxButtonCount))*$maxButtonCount+1; |
|
1345 | - if(($endPageIndex=$startPageIndex+$maxButtonCount-1)>$pageCount) |
|
1344 | + $startPageIndex=((int) (($pageIndex - 1) / $maxButtonCount)) * $maxButtonCount + 1; |
|
1345 | + if(($endPageIndex=$startPageIndex + $maxButtonCount - 1) > $pageCount) |
|
1346 | 1346 | $endPageIndex=$pageCount; |
1347 | - if($endPageIndex-$startPageIndex+1<$maxButtonCount) |
|
1347 | + if($endPageIndex - $startPageIndex + 1 < $maxButtonCount) |
|
1348 | 1348 | { |
1349 | - if(($startPageIndex=$endPageIndex-$maxButtonCount+1)<1) |
|
1349 | + if(($startPageIndex=$endPageIndex - $maxButtonCount + 1) < 1) |
|
1350 | 1350 | $startPageIndex=1; |
1351 | 1351 | } |
1352 | 1352 | } |
1353 | 1353 | |
1354 | - if($startPageIndex>1) |
|
1354 | + if($startPageIndex > 1) |
|
1355 | 1355 | { |
1356 | 1356 | if(($text=$style->getFirstPageText())!=='') |
1357 | 1357 | { |
1358 | - $button=$this->createPagerButton($pager,$buttonType,true,$text,self::CMD_PAGE,self::CMD_PAGE_FIRST); |
|
1358 | + $button=$this->createPagerButton($pager, $buttonType, true, $text, self::CMD_PAGE, self::CMD_PAGE_FIRST); |
|
1359 | 1359 | $controls->add($button); |
1360 | 1360 | $controls->add("\n"); |
1361 | 1361 | } |
1362 | - $prevPageIndex=$startPageIndex-1; |
|
1363 | - $button=$this->createPagerButton($pager,$buttonType,true,$style->getPrevPageText(),self::CMD_PAGE,"$prevPageIndex"); |
|
1362 | + $prevPageIndex=$startPageIndex - 1; |
|
1363 | + $button=$this->createPagerButton($pager, $buttonType, true, $style->getPrevPageText(), self::CMD_PAGE, "$prevPageIndex"); |
|
1364 | 1364 | $controls->add($button); |
1365 | 1365 | $controls->add("\n"); |
1366 | 1366 | } |
1367 | 1367 | |
1368 | - for($i=$startPageIndex;$i<=$endPageIndex;++$i) |
|
1368 | + for($i=$startPageIndex; $i <= $endPageIndex; ++$i) |
|
1369 | 1369 | { |
1370 | 1370 | if($i===$pageIndex) |
1371 | 1371 | { |
1372 | - $label=$this->createPagerButton($pager,$buttonType,false,"$i",'',''); |
|
1372 | + $label=$this->createPagerButton($pager, $buttonType, false, "$i", '', ''); |
|
1373 | 1373 | $controls->add($label); |
1374 | 1374 | } |
1375 | 1375 | else |
1376 | 1376 | { |
1377 | - $button=$this->createPagerButton($pager,$buttonType,true,"$i",self::CMD_PAGE,"$i"); |
|
1377 | + $button=$this->createPagerButton($pager, $buttonType, true, "$i", self::CMD_PAGE, "$i"); |
|
1378 | 1378 | $controls->add($button); |
1379 | 1379 | } |
1380 | - if($i<$endPageIndex) |
|
1380 | + if($i < $endPageIndex) |
|
1381 | 1381 | $controls->add("\n"); |
1382 | 1382 | } |
1383 | 1383 | |
1384 | - if($pageCount>$endPageIndex) |
|
1384 | + if($pageCount > $endPageIndex) |
|
1385 | 1385 | { |
1386 | 1386 | $controls->add("\n"); |
1387 | - $nextPageIndex=$endPageIndex+1; |
|
1388 | - $button=$this->createPagerButton($pager,$buttonType,true,$style->getNextPageText(),self::CMD_PAGE,"$nextPageIndex"); |
|
1387 | + $nextPageIndex=$endPageIndex + 1; |
|
1388 | + $button=$this->createPagerButton($pager, $buttonType, true, $style->getNextPageText(), self::CMD_PAGE, "$nextPageIndex"); |
|
1389 | 1389 | $controls->add($button); |
1390 | 1390 | if(($text=$style->getLastPageText())!=='') |
1391 | 1391 | { |
1392 | 1392 | $controls->add("\n"); |
1393 | - $button=$this->createPagerButton($pager,$buttonType,true,$text,self::CMD_PAGE,self::CMD_PAGE_LAST); |
|
1393 | + $button=$this->createPagerButton($pager, $buttonType, true, $text, self::CMD_PAGE, self::CMD_PAGE_LAST); |
|
1394 | 1394 | $controls->add($button); |
1395 | 1395 | } |
1396 | 1396 | } |
@@ -1445,9 +1445,9 @@ discard block |
||
1445 | 1445 | */ |
1446 | 1446 | protected function applyItemStyles() |
1447 | 1447 | { |
1448 | - $itemStyle=$this->getViewState('ItemStyle',null); |
|
1448 | + $itemStyle=$this->getViewState('ItemStyle', null); |
|
1449 | 1449 | |
1450 | - $alternatingItemStyle=$this->getViewState('AlternatingItemStyle',null); |
|
1450 | + $alternatingItemStyle=$this->getViewState('AlternatingItemStyle', null); |
|
1451 | 1451 | if($itemStyle!==null) |
1452 | 1452 | { |
1453 | 1453 | if($alternatingItemStyle===null) |
@@ -1456,9 +1456,9 @@ discard block |
||
1456 | 1456 | $alternatingItemStyle->mergeWith($itemStyle); |
1457 | 1457 | } |
1458 | 1458 | |
1459 | - $selectedItemStyle=$this->getViewState('SelectedItemStyle',null); |
|
1459 | + $selectedItemStyle=$this->getViewState('SelectedItemStyle', null); |
|
1460 | 1460 | |
1461 | - $editItemStyle=$this->getViewState('EditItemStyle',null); |
|
1461 | + $editItemStyle=$this->getViewState('EditItemStyle', null); |
|
1462 | 1462 | if($selectedItemStyle!==null) |
1463 | 1463 | { |
1464 | 1464 | if($editItemStyle===null) |
@@ -1467,10 +1467,10 @@ discard block |
||
1467 | 1467 | $editItemStyle->mergeWith($selectedItemStyle); |
1468 | 1468 | } |
1469 | 1469 | |
1470 | - $headerStyle=$this->getViewState('HeaderStyle',null); |
|
1471 | - $footerStyle=$this->getViewState('FooterStyle',null); |
|
1472 | - $pagerStyle=$this->getViewState('PagerStyle',null); |
|
1473 | - $separatorStyle=$this->getViewState('SeparatorStyle',null); |
|
1470 | + $headerStyle=$this->getViewState('HeaderStyle', null); |
|
1471 | + $footerStyle=$this->getViewState('FooterStyle', null); |
|
1472 | + $pagerStyle=$this->getViewState('PagerStyle', null); |
|
1473 | + $separatorStyle=$this->getViewState('SeparatorStyle', null); |
|
1474 | 1474 | |
1475 | 1475 | foreach($this->getControls() as $index=>$item) |
1476 | 1476 | { |
@@ -1554,7 +1554,7 @@ discard block |
||
1554 | 1554 | { |
1555 | 1555 | $n=$this->_columns->getCount(); |
1556 | 1556 | $cells=$item->getCells(); |
1557 | - for($i=0;$i<$n;++$i) |
|
1557 | + for($i=0; $i < $n; ++$i) |
|
1558 | 1558 | { |
1559 | 1559 | $cell=$cells->itemAt($i); |
1560 | 1560 | $column=$this->_columns->itemAt($i); |
@@ -1586,7 +1586,7 @@ discard block |
||
1586 | 1586 | if(($caption=$this->getCaption())!=='') |
1587 | 1587 | { |
1588 | 1588 | if(($align=$this->getCaptionAlign())!==TTableCaptionAlign::NotSet) |
1589 | - $writer->addAttribute('align',strtolower($align)); |
|
1589 | + $writer->addAttribute('align', strtolower($align)); |
|
1590 | 1590 | $writer->renderBeginTag('caption'); |
1591 | 1591 | $writer->write($caption); |
1592 | 1592 | $writer->renderEndTag(); |
@@ -1613,7 +1613,7 @@ discard block |
||
1613 | 1613 | $this->renderContents($writer); |
1614 | 1614 | $control->renderEndTag($writer); |
1615 | 1615 | } |
1616 | - else if($this->getViewState('ItemCount',0)>0) |
|
1616 | + else if($this->getViewState('ItemCount', 0) > 0) |
|
1617 | 1617 | { |
1618 | 1618 | $this->applyItemStyles(); |
1619 | 1619 | if($this->_topPager) |
@@ -1641,14 +1641,14 @@ discard block |
||
1641 | 1641 | if($this->_header && $this->_header->getVisible()) |
1642 | 1642 | { |
1643 | 1643 | $writer->writeLine(); |
1644 | - if($style=$this->getViewState('TableHeadStyle',null)) |
|
1644 | + if($style=$this->getViewState('TableHeadStyle', null)) |
|
1645 | 1645 | $style->addAttributesToRender($writer); |
1646 | 1646 | $writer->renderBeginTag('thead'); |
1647 | 1647 | $this->_header->render($writer); |
1648 | 1648 | $writer->renderEndTag(); |
1649 | 1649 | } |
1650 | 1650 | $writer->writeLine(); |
1651 | - if($style=$this->getViewState('TableBodyStyle',null)) |
|
1651 | + if($style=$this->getViewState('TableBodyStyle', null)) |
|
1652 | 1652 | $style->addAttributesToRender($writer); |
1653 | 1653 | $writer->renderBeginTag('tbody'); |
1654 | 1654 | foreach($this->getItems() as $item) |
@@ -1658,7 +1658,7 @@ discard block |
||
1658 | 1658 | if($this->_footer && $this->_footer->getVisible()) |
1659 | 1659 | { |
1660 | 1660 | $writer->writeLine(); |
1661 | - if($style=$this->getViewState('TableFootStyle',null)) |
|
1661 | + if($style=$this->getViewState('TableFootStyle', null)) |
|
1662 | 1662 | $style->addAttributesToRender($writer); |
1663 | 1663 | $writer->renderBeginTag('tfoot'); |
1664 | 1664 | $this->_footer->render($writer); |
@@ -1775,11 +1775,11 @@ discard block |
||
1775 | 1775 | * @param TControl original event sender |
1776 | 1776 | * @param TCommandEventParameter original event parameter |
1777 | 1777 | */ |
1778 | - public function __construct($item,$source,TCommandEventParameter $param) |
|
1778 | + public function __construct($item, $source, TCommandEventParameter $param) |
|
1779 | 1779 | { |
1780 | 1780 | $this->_item=$item; |
1781 | 1781 | $this->_source=$source; |
1782 | - parent::__construct($param->getCommandName(),$param->getCommandParameter()); |
|
1782 | + parent::__construct($param->getCommandName(), $param->getCommandParameter()); |
|
1783 | 1783 | } |
1784 | 1784 | |
1785 | 1785 | /** |
@@ -1829,7 +1829,7 @@ discard block |
||
1829 | 1829 | * @param TControl the control originally raises the <b>OnCommand</b> event. |
1830 | 1830 | * @param TDataGridCommandEventParameter command event parameter |
1831 | 1831 | */ |
1832 | - public function __construct($source,TDataGridCommandEventParameter $param) |
|
1832 | + public function __construct($source, TDataGridCommandEventParameter $param) |
|
1833 | 1833 | { |
1834 | 1834 | $this->_source=$source; |
1835 | 1835 | $this->_sortExpression=$param->getCommandParameter(); |
@@ -1882,7 +1882,7 @@ discard block |
||
1882 | 1882 | * @param TControl the control originally raises the <b>OnCommand</b> event. |
1883 | 1883 | * @param integer new page index |
1884 | 1884 | */ |
1885 | - public function __construct($source,$newPageIndex) |
|
1885 | + public function __construct($source, $newPageIndex) |
|
1886 | 1886 | { |
1887 | 1887 | $this->_source=$source; |
1888 | 1888 | $this->_newIndex=$newPageIndex; |
@@ -1945,7 +1945,7 @@ discard block |
||
1945 | 1945 | * @param integer zero-based index of the item in the item collection of datagrid |
1946 | 1946 | * @param TListItemType item type |
1947 | 1947 | */ |
1948 | - public function __construct($itemIndex,$dataSourceIndex,$itemType) |
|
1948 | + public function __construct($itemIndex, $dataSourceIndex, $itemType) |
|
1949 | 1949 | { |
1950 | 1950 | $this->_itemIndex=$itemIndex; |
1951 | 1951 | $this->_dataSourceIndex=$dataSourceIndex; |
@@ -1969,7 +1969,7 @@ discard block |
||
1969 | 1969 | */ |
1970 | 1970 | public function setItemType($value) |
1971 | 1971 | { |
1972 | - $this->_itemType=TPropertyValue::ensureEnum($value,'TListItemType'); |
|
1972 | + $this->_itemType=TPropertyValue::ensureEnum($value, 'TListItemType'); |
|
1973 | 1973 | } |
1974 | 1974 | |
1975 | 1975 | /** |
@@ -2033,11 +2033,11 @@ discard block |
||
2033 | 2033 | * @param TEventParameter event parameter |
2034 | 2034 | * @return boolean whether the event bubbling should stop here. |
2035 | 2035 | */ |
2036 | - public function bubbleEvent($sender,$param) |
|
2036 | + public function bubbleEvent($sender, $param) |
|
2037 | 2037 | { |
2038 | 2038 | if($param instanceof TCommandEventParameter) |
2039 | 2039 | { |
2040 | - $this->raiseBubbleEvent($this,new TDataGridCommandEventParameter($this,$sender,$param)); |
|
2040 | + $this->raiseBubbleEvent($this, new TDataGridCommandEventParameter($this, $sender, $param)); |
|
2041 | 2041 | return true; |
2042 | 2042 | } |
2043 | 2043 | else |
@@ -2075,11 +2075,11 @@ discard block |
||
2075 | 2075 | * @param TEventParameter event parameter |
2076 | 2076 | * @return boolean whether the event bubbling should stop here. |
2077 | 2077 | */ |
2078 | - public function bubbleEvent($sender,$param) |
|
2078 | + public function bubbleEvent($sender, $param) |
|
2079 | 2079 | { |
2080 | 2080 | if($param instanceof TCommandEventParameter) |
2081 | 2081 | { |
2082 | - $this->raiseBubbleEvent($this,new TDataGridCommandEventParameter($this,$sender,$param)); |
|
2082 | + $this->raiseBubbleEvent($this, new TDataGridCommandEventParameter($this, $sender, $param)); |
|
2083 | 2083 | return true; |
2084 | 2084 | } |
2085 | 2085 | else |
@@ -2122,10 +2122,10 @@ discard block |
||
2122 | 2122 | * @param mixed new item |
2123 | 2123 | * @throws TInvalidDataTypeException if the item to be inserted is not a TDataGridItem. |
2124 | 2124 | */ |
2125 | - public function insertAt($index,$item) |
|
2125 | + public function insertAt($index, $item) |
|
2126 | 2126 | { |
2127 | 2127 | if($item instanceof TDataGridItem) |
2128 | - parent::insertAt($index,$item); |
|
2128 | + parent::insertAt($index, $item); |
|
2129 | 2129 | else |
2130 | 2130 | throw new TInvalidDataTypeException('datagriditemcollection_datagriditem_required'); |
2131 | 2131 | } |
@@ -2172,12 +2172,12 @@ discard block |
||
2172 | 2172 | * @param mixed new item |
2173 | 2173 | * @throws TInvalidDataTypeException if the item to be inserted is not a TDataGridColumn. |
2174 | 2174 | */ |
2175 | - public function insertAt($index,$item) |
|
2175 | + public function insertAt($index, $item) |
|
2176 | 2176 | { |
2177 | 2177 | if($item instanceof TDataGridColumn) |
2178 | 2178 | { |
2179 | 2179 | $item->setOwner($this->_o); |
2180 | - parent::insertAt($index,$item); |
|
2180 | + parent::insertAt($index, $item); |
|
2181 | 2181 | } |
2182 | 2182 | else |
2183 | 2183 | throw new TInvalidDataTypeException('datagridcolumncollection_datagridcolumn_required'); |
@@ -711,33 +711,27 @@ discard block |
||
711 | 711 | $this->setSelectedItemIndex($param->getItem()->getItemIndex()); |
712 | 712 | $this->onSelectedIndexChanged($param); |
713 | 713 | return true; |
714 | - } |
|
715 | - else if(strcasecmp($command,self::CMD_EDIT)===0) |
|
714 | + } else if(strcasecmp($command,self::CMD_EDIT)===0) |
|
716 | 715 | { |
717 | 716 | $this->onEditCommand($param); |
718 | 717 | return true; |
719 | - } |
|
720 | - else if(strcasecmp($command,self::CMD_DELETE)===0) |
|
718 | + } else if(strcasecmp($command,self::CMD_DELETE)===0) |
|
721 | 719 | { |
722 | 720 | $this->onDeleteCommand($param); |
723 | 721 | return true; |
724 | - } |
|
725 | - else if(strcasecmp($command,self::CMD_UPDATE)===0) |
|
722 | + } else if(strcasecmp($command,self::CMD_UPDATE)===0) |
|
726 | 723 | { |
727 | 724 | $this->onUpdateCommand($param); |
728 | 725 | return true; |
729 | - } |
|
730 | - else if(strcasecmp($command,self::CMD_CANCEL)===0) |
|
726 | + } else if(strcasecmp($command,self::CMD_CANCEL)===0) |
|
731 | 727 | { |
732 | 728 | $this->onCancelCommand($param); |
733 | 729 | return true; |
734 | - } |
|
735 | - else if(strcasecmp($command,self::CMD_SORT)===0) |
|
730 | + } else if(strcasecmp($command,self::CMD_SORT)===0) |
|
736 | 731 | { |
737 | 732 | $this->onSortCommand(new TDataGridSortCommandEventParameter($sender,$param)); |
738 | 733 | return true; |
739 | - } |
|
740 | - else if(strcasecmp($command,self::CMD_PAGE)===0) |
|
734 | + } else if(strcasecmp($command,self::CMD_PAGE)===0) |
|
741 | 735 | { |
742 | 736 | $p=$param->getCommandParameter(); |
743 | 737 | if(strcasecmp($p,self::CMD_PAGE_NEXT)===0) |
@@ -884,8 +878,7 @@ discard block |
||
884 | 878 | foreach($this->_autoColumns as $column) |
885 | 879 | $state[]=$column->saveState(); |
886 | 880 | $this->setViewState('AutoColumns',$state,array()); |
887 | - } |
|
888 | - else |
|
881 | + } else |
|
889 | 882 | $this->clearViewState('AutoColumns'); |
890 | 883 | if($this->_columns) |
891 | 884 | { |
@@ -893,8 +886,7 @@ discard block |
||
893 | 886 | foreach($this->_columns as $column) |
894 | 887 | $state[]=$column->saveState(); |
895 | 888 | $this->setViewState('Columns',$state,array()); |
896 | - } |
|
897 | - else |
|
889 | + } else |
|
898 | 890 | $this->clearViewState('Columns'); |
899 | 891 | } |
900 | 892 | |
@@ -919,8 +911,7 @@ discard block |
||
919 | 911 | $column->loadState($st); |
920 | 912 | $this->_autoColumns->add($column); |
921 | 913 | } |
922 | - } |
|
923 | - else |
|
914 | + } else |
|
924 | 915 | $this->_autoColumns=null; |
925 | 916 | $state=$this->getViewState('Columns',array()); |
926 | 917 | if($this->_columns && $this->_columns->getCount()===count($state)) |
@@ -1026,8 +1017,7 @@ discard block |
||
1026 | 1017 | $columns=new TList($this->getColumns()); |
1027 | 1018 | $autoColumns=$this->createAutoColumns($data); |
1028 | 1019 | $columns->mergeWith($autoColumns); |
1029 | - } |
|
1030 | - else |
|
1020 | + } else |
|
1031 | 1021 | $columns=$this->getColumns(); |
1032 | 1022 | $this->_allColumns=$columns; |
1033 | 1023 | |
@@ -1117,8 +1107,7 @@ discard block |
||
1117 | 1107 | { |
1118 | 1108 | $prevCell=$cell; |
1119 | 1109 | $prevCellText=$cellText; |
1120 | - } |
|
1121 | - else |
|
1110 | + } else |
|
1122 | 1111 | { |
1123 | 1112 | if(($rowSpan=$prevCell->getRowSpan())===0) |
1124 | 1113 | $rowSpan=1; |
@@ -1167,8 +1156,7 @@ discard block |
||
1167 | 1156 | $this->getControls()->add($item); |
1168 | 1157 | $item->dataBind(); |
1169 | 1158 | $this->onItemDataBound($param); |
1170 | - } |
|
1171 | - else |
|
1159 | + } else |
|
1172 | 1160 | { |
1173 | 1161 | $this->onItemCreated($param); |
1174 | 1162 | $this->getControls()->add($item); |
@@ -1251,8 +1239,7 @@ discard block |
||
1251 | 1239 | $button->setText($text); |
1252 | 1240 | return $button; |
1253 | 1241 | } |
1254 | - } |
|
1255 | - else |
|
1242 | + } else |
|
1256 | 1243 | { |
1257 | 1244 | $button=new TButton; |
1258 | 1245 | if(!$enabled) |
@@ -1286,8 +1273,7 @@ discard block |
||
1286 | 1273 | |
1287 | 1274 | $label=$this->createPagerButton($pager,$buttonType,false,$style->getPrevPageText(),'',''); |
1288 | 1275 | $controls->add($label); |
1289 | - } |
|
1290 | - else |
|
1276 | + } else |
|
1291 | 1277 | { |
1292 | 1278 | if(($text=$style->getFirstPageText())!=='') |
1293 | 1279 | { |
@@ -1310,8 +1296,7 @@ discard block |
||
1310 | 1296 | $label=$this->createPagerButton($pager,$buttonType,false,$text,'',''); |
1311 | 1297 | $controls->add($label); |
1312 | 1298 | } |
1313 | - } |
|
1314 | - else |
|
1299 | + } else |
|
1315 | 1300 | { |
1316 | 1301 | $button=$this->createPagerButton($pager,$buttonType,true,$style->getNextPageText(),self::CMD_PAGE,self::CMD_PAGE_NEXT); |
1317 | 1302 | $controls->add($button); |
@@ -1371,8 +1356,7 @@ discard block |
||
1371 | 1356 | { |
1372 | 1357 | $label=$this->createPagerButton($pager,$buttonType,false,"$i",'',''); |
1373 | 1358 | $controls->add($label); |
1374 | - } |
|
1375 | - else |
|
1359 | + } else |
|
1376 | 1360 | { |
1377 | 1361 | $button=$this->createPagerButton($pager,$buttonType,true,"$i",self::CMD_PAGE,"$i"); |
1378 | 1362 | $controls->add($button); |
@@ -1418,8 +1402,7 @@ discard block |
||
1418 | 1402 | $column->setDataField($key); |
1419 | 1403 | $column->setSortExpression($key); |
1420 | 1404 | $autoColumns->add($column); |
1421 | - } |
|
1422 | - else |
|
1405 | + } else |
|
1423 | 1406 | { |
1424 | 1407 | $column->setHeaderText(TListItemType::Item); |
1425 | 1408 | $column->setDataField($key); |
@@ -1510,8 +1493,7 @@ discard block |
||
1510 | 1493 | { |
1511 | 1494 | if($itemStyle) |
1512 | 1495 | $item->getStyle()->mergeWith($itemStyle); |
1513 | - } |
|
1514 | - else |
|
1496 | + } else |
|
1515 | 1497 | { |
1516 | 1498 | if($alternatingItemStyle) |
1517 | 1499 | $item->getStyle()->mergeWith($alternatingItemStyle); |
@@ -1524,8 +1506,7 @@ discard block |
||
1524 | 1506 | { |
1525 | 1507 | if($itemStyle) |
1526 | 1508 | $item->getStyle()->mergeWith($itemStyle); |
1527 | - } |
|
1528 | - else |
|
1509 | + } else |
|
1529 | 1510 | { |
1530 | 1511 | if($alternatingItemStyle) |
1531 | 1512 | $item->getStyle()->mergeWith($alternatingItemStyle); |
@@ -1539,8 +1520,7 @@ discard block |
||
1539 | 1520 | { |
1540 | 1521 | if($pagerStyle->getPosition()===TDataGridPagerPosition::Bottom || !$pagerStyle->getVisible()) |
1541 | 1522 | $item->setVisible(false); |
1542 | - } |
|
1543 | - else |
|
1523 | + } else |
|
1544 | 1524 | { |
1545 | 1525 | if($pagerStyle->getPosition()===TDataGridPagerPosition::Top || !$pagerStyle->getVisible()) |
1546 | 1526 | $item->setVisible(false); |
@@ -1612,8 +1592,7 @@ discard block |
||
1612 | 1592 | $control->renderBeginTag($writer); |
1613 | 1593 | $this->renderContents($writer); |
1614 | 1594 | $control->renderEndTag($writer); |
1615 | - } |
|
1616 | - else if($this->getViewState('ItemCount',0)>0) |
|
1595 | + } else if($this->getViewState('ItemCount',0)>0) |
|
1617 | 1596 | { |
1618 | 1597 | $this->applyItemStyles(); |
1619 | 1598 | if($this->_topPager) |
@@ -2039,8 +2018,7 @@ discard block |
||
2039 | 2018 | { |
2040 | 2019 | $this->raiseBubbleEvent($this,new TDataGridCommandEventParameter($this,$sender,$param)); |
2041 | 2020 | return true; |
2042 | - } |
|
2043 | - else |
|
2021 | + } else |
|
2044 | 2022 | return false; |
2045 | 2023 | } |
2046 | 2024 | } |
@@ -2081,8 +2059,7 @@ discard block |
||
2081 | 2059 | { |
2082 | 2060 | $this->raiseBubbleEvent($this,new TDataGridCommandEventParameter($this,$sender,$param)); |
2083 | 2061 | return true; |
2084 | - } |
|
2085 | - else |
|
2062 | + } else |
|
2086 | 2063 | return false; |
2087 | 2064 | } |
2088 | 2065 | |
@@ -2178,8 +2155,7 @@ discard block |
||
2178 | 2155 | { |
2179 | 2156 | $item->setOwner($this->_o); |
2180 | 2157 | parent::insertAt($index,$item); |
2181 | - } |
|
2182 | - else |
|
2158 | + } else |
|
2183 | 2159 | throw new TInvalidDataTypeException('datagridcolumncollection_datagridcolumn_required'); |
2184 | 2160 | } |
2185 | 2161 | } |
@@ -281,6 +281,7 @@ discard block |
||
281 | 281 | * |
282 | 282 | * @param string the name of the viewstate value to be returned |
283 | 283 | * @param mixed the default value. If $key is not found in viewstate, $defaultValue will be returned |
284 | + * @param string $key |
|
284 | 285 | * @return mixed the viewstate value corresponding to $key |
285 | 286 | */ |
286 | 287 | protected function getViewState($key,$defaultValue=null) |
@@ -295,6 +296,7 @@ discard block |
||
295 | 296 | * @param string the name of the viewstate value |
296 | 297 | * @param mixed the viewstate value to be set |
297 | 298 | * @param mixed default value. If $value===$defaultValue, the item will be cleared from the viewstate. |
299 | + * @param string $key |
|
298 | 300 | */ |
299 | 301 | protected function setViewState($key,$value,$defaultValue=null) |
300 | 302 | { |
@@ -356,6 +358,7 @@ discard block |
||
356 | 358 | * If the data is a component, the field is used as the name of a property. |
357 | 359 | * @param mixed data containing the field of value |
358 | 360 | * @param string the data field |
361 | + * @param string $field |
|
359 | 362 | * @return mixed data value at the specified field |
360 | 363 | * @throws TInvalidDataValueException if the data or the field is invalid. |
361 | 364 | */ |
@@ -515,6 +518,7 @@ discard block |
||
515 | 518 | * as the first and second parameters in {@link sprintf}. |
516 | 519 | * @param string format string |
517 | 520 | * @param mixed the data to be formatted |
521 | + * @param string $formatString |
|
518 | 522 | * @return string the formatted result |
519 | 523 | */ |
520 | 524 | protected function formatDataValue($formatString,$value) |
@@ -427,8 +427,7 @@ discard block |
||
427 | 427 | } |
428 | 428 | $control->setData($text); |
429 | 429 | } |
430 | - } |
|
431 | - else if($this->getAllowSorting()) |
|
430 | + } else if($this->getAllowSorting()) |
|
432 | 431 | { |
433 | 432 | $sortExpression=$this->getSortExpression(); |
434 | 433 | if(($url=$this->getHeaderImageUrl())!=='') |
@@ -441,8 +440,7 @@ discard block |
||
441 | 440 | $button->setAlternateText($text); |
442 | 441 | $button->setCausesValidation(false); |
443 | 442 | $cell->getControls()->add($button); |
444 | - } |
|
445 | - else if($text!=='') |
|
443 | + } else if($text!=='') |
|
446 | 444 | { |
447 | 445 | $button=Prado::createComponent('System.Web.UI.WebControls.TLinkButton'); |
448 | 446 | $button->setText($text); |
@@ -450,11 +448,9 @@ discard block |
||
450 | 448 | $button->setCommandParameter($sortExpression); |
451 | 449 | $button->setCausesValidation(false); |
452 | 450 | $cell->getControls()->add($button); |
453 | - } |
|
454 | - else |
|
451 | + } else |
|
455 | 452 | $cell->setText(' '); |
456 | - } |
|
457 | - else |
|
453 | + } else |
|
458 | 454 | { |
459 | 455 | if(($url=$this->getHeaderImageUrl())!=='') |
460 | 456 | { |
@@ -463,8 +459,7 @@ discard block |
||
463 | 459 | if($text!=='') |
464 | 460 | $image->setAlternateText($text); |
465 | 461 | $cell->getControls()->add($image); |
466 | - } |
|
467 | - else if($text!=='') |
|
462 | + } else if($text!=='') |
|
468 | 463 | $cell->setText($text); |
469 | 464 | else |
470 | 465 | $cell->setText(' '); |
@@ -498,8 +493,7 @@ discard block |
||
498 | 493 | } |
499 | 494 | $control->setData($text); |
500 | 495 | } |
501 | - } |
|
502 | - else if($text!=='') |
|
496 | + } else if($text!=='') |
|
503 | 497 | $cell->setText($text); |
504 | 498 | else |
505 | 499 | $cell->setText(' '); |
@@ -529,13 +523,11 @@ discard block |
||
529 | 523 | if(eval("\$result=$expression;")===false) |
530 | 524 | throw new Exception(''); |
531 | 525 | return $result; |
532 | - } |
|
533 | - catch(Exception $e) |
|
526 | + } catch(Exception $e) |
|
534 | 527 | { |
535 | 528 | throw new TInvalidDataValueException('datagridcolumn_expression_invalid',get_class($this),$expression,$e->getMessage()); |
536 | 529 | } |
537 | - } |
|
538 | - else |
|
530 | + } else |
|
539 | 531 | return sprintf($formatString,$value); |
540 | 532 | } |
541 | 533 | } |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function setID($value) |
85 | 85 | { |
86 | - if(!preg_match(TControl::ID_FORMAT,$value)) |
|
87 | - throw new TInvalidDataValueException('datagridcolumn_id_invalid',get_class($this),$value); |
|
86 | + if(!preg_match(TControl::ID_FORMAT, $value)) |
|
87 | + throw new TInvalidDataValueException('datagridcolumn_id_invalid', get_class($this), $value); |
|
88 | 88 | $this->_id=$value; |
89 | 89 | } |
90 | 90 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function getHeaderText() |
95 | 95 | { |
96 | - return $this->getViewState('HeaderText',''); |
|
96 | + return $this->getViewState('HeaderText', ''); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function setHeaderText($value) |
103 | 103 | { |
104 | - $this->setViewState('HeaderText',$value,''); |
|
104 | + $this->setViewState('HeaderText', $value, ''); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function getHeaderImageUrl() |
111 | 111 | { |
112 | - return $this->getViewState('HeaderImageUrl',''); |
|
112 | + return $this->getViewState('HeaderImageUrl', ''); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function setHeaderImageUrl($value) |
119 | 119 | { |
120 | - $this->setViewState('HeaderImageUrl',$value,''); |
|
120 | + $this->setViewState('HeaderImageUrl', $value, ''); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function getHeaderRenderer() |
128 | 128 | { |
129 | - return $this->getViewState('HeaderRenderer',''); |
|
129 | + return $this->getViewState('HeaderRenderer', ''); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function setHeaderRenderer($value) |
143 | 143 | { |
144 | - $this->setViewState('HeaderRenderer',$value,''); |
|
144 | + $this->setViewState('HeaderRenderer', $value, ''); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -150,10 +150,10 @@ discard block |
||
150 | 150 | */ |
151 | 151 | public function getHeaderStyle($createStyle=true) |
152 | 152 | { |
153 | - if(($style=$this->getViewState('HeaderStyle',null))===null && $createStyle) |
|
153 | + if(($style=$this->getViewState('HeaderStyle', null))===null && $createStyle) |
|
154 | 154 | { |
155 | 155 | $style=new TTableItemStyle; |
156 | - $this->setViewState('HeaderStyle',$style,null); |
|
156 | + $this->setViewState('HeaderStyle', $style, null); |
|
157 | 157 | } |
158 | 158 | return $style; |
159 | 159 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public function getFooterText() |
165 | 165 | { |
166 | - return $this->getViewState('FooterText',''); |
|
166 | + return $this->getViewState('FooterText', ''); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public function setFooterText($value) |
173 | 173 | { |
174 | - $this->setViewState('FooterText',$value,''); |
|
174 | + $this->setViewState('FooterText', $value, ''); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | */ |
181 | 181 | public function getFooterRenderer() |
182 | 182 | { |
183 | - return $this->getViewState('FooterRenderer',''); |
|
183 | + return $this->getViewState('FooterRenderer', ''); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | /** |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | */ |
196 | 196 | public function setFooterRenderer($value) |
197 | 197 | { |
198 | - $this->setViewState('FooterRenderer',$value,''); |
|
198 | + $this->setViewState('FooterRenderer', $value, ''); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | /** |
@@ -204,10 +204,10 @@ discard block |
||
204 | 204 | */ |
205 | 205 | public function getFooterStyle($createStyle=true) |
206 | 206 | { |
207 | - if(($style=$this->getViewState('FooterStyle',null))===null && $createStyle) |
|
207 | + if(($style=$this->getViewState('FooterStyle', null))===null && $createStyle) |
|
208 | 208 | { |
209 | 209 | $style=new TTableItemStyle; |
210 | - $this->setViewState('FooterStyle',$style,null); |
|
210 | + $this->setViewState('FooterStyle', $style, null); |
|
211 | 211 | } |
212 | 212 | return $style; |
213 | 213 | } |
@@ -218,10 +218,10 @@ discard block |
||
218 | 218 | */ |
219 | 219 | public function getItemStyle($createStyle=true) |
220 | 220 | { |
221 | - if(($style=$this->getViewState('ItemStyle',null))===null && $createStyle) |
|
221 | + if(($style=$this->getViewState('ItemStyle', null))===null && $createStyle) |
|
222 | 222 | { |
223 | 223 | $style=new TTableItemStyle; |
224 | - $this->setViewState('ItemStyle',$style,null); |
|
224 | + $this->setViewState('ItemStyle', $style, null); |
|
225 | 225 | } |
226 | 226 | return $style; |
227 | 227 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | */ |
232 | 232 | public function getSortExpression() |
233 | 233 | { |
234 | - return $this->getViewState('SortExpression',''); |
|
234 | + return $this->getViewState('SortExpression', ''); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | /** |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | */ |
240 | 240 | public function setSortExpression($value) |
241 | 241 | { |
242 | - $this->setViewState('SortExpression',$value,''); |
|
242 | + $this->setViewState('SortExpression', $value, ''); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | /** |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | */ |
249 | 249 | public function getEnableCellGrouping() |
250 | 250 | { |
251 | - return $this->getViewState('EnableCellGrouping',false); |
|
251 | + return $this->getViewState('EnableCellGrouping', false); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | /** |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | */ |
258 | 258 | public function setEnableCellGrouping($value) |
259 | 259 | { |
260 | - $this->setViewState('EnableCellGrouping',TPropertyValue::ensureBoolean($value),false); |
|
260 | + $this->setViewState('EnableCellGrouping', TPropertyValue::ensureBoolean($value), false); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | */ |
266 | 266 | public function getVisible($checkParents=true) |
267 | 267 | { |
268 | - return $this->getViewState('Visible',true); |
|
268 | + return $this->getViewState('Visible', true); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | /** |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | */ |
274 | 274 | public function setVisible($value) |
275 | 275 | { |
276 | - $this->setViewState('Visible',TPropertyValue::ensureBoolean($value),true); |
|
276 | + $this->setViewState('Visible', TPropertyValue::ensureBoolean($value), true); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | /** |
@@ -283,9 +283,9 @@ discard block |
||
283 | 283 | * @param mixed the default value. If $key is not found in viewstate, $defaultValue will be returned |
284 | 284 | * @return mixed the viewstate value corresponding to $key |
285 | 285 | */ |
286 | - protected function getViewState($key,$defaultValue=null) |
|
286 | + protected function getViewState($key, $defaultValue=null) |
|
287 | 287 | { |
288 | - return isset($this->_viewState[$key])?$this->_viewState[$key]:$defaultValue; |
|
288 | + return isset($this->_viewState[$key]) ? $this->_viewState[$key] : $defaultValue; |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | /** |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | * @param mixed the viewstate value to be set |
297 | 297 | * @param mixed default value. If $value===$defaultValue, the item will be cleared from the viewstate. |
298 | 298 | */ |
299 | - protected function setViewState($key,$value,$defaultValue=null) |
|
299 | + protected function setViewState($key, $value, $defaultValue=null) |
|
300 | 300 | { |
301 | 301 | if($value===$defaultValue) |
302 | 302 | unset($this->_viewState[$key]); |
@@ -359,9 +359,9 @@ discard block |
||
359 | 359 | * @return mixed data value at the specified field |
360 | 360 | * @throws TInvalidDataValueException if the data or the field is invalid. |
361 | 361 | */ |
362 | - protected function getDataFieldValue($data,$field) |
|
362 | + protected function getDataFieldValue($data, $field) |
|
363 | 363 | { |
364 | - return TDataFieldAccessor::getDataFieldValue($data,$field); |
|
364 | + return TDataFieldAccessor::getDataFieldValue($data, $field); |
|
365 | 365 | } |
366 | 366 | |
367 | 367 | |
@@ -376,12 +376,12 @@ discard block |
||
376 | 376 | * @param integer the index to the Columns property that the cell resides in. |
377 | 377 | * @param string the type of cell (Header,Footer,Item,AlternatingItem,EditItem,SelectedItem) |
378 | 378 | */ |
379 | - public function initializeCell($cell,$columnIndex,$itemType) |
|
379 | + public function initializeCell($cell, $columnIndex, $itemType) |
|
380 | 380 | { |
381 | 381 | if($itemType===TListItemType::Header) |
382 | - $this->initializeHeaderCell($cell,$columnIndex); |
|
382 | + $this->initializeHeaderCell($cell, $columnIndex); |
|
383 | 383 | else if($itemType===TListItemType::Footer) |
384 | - $this->initializeFooterCell($cell,$columnIndex); |
|
384 | + $this->initializeFooterCell($cell, $columnIndex); |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | /** |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | * @param TTableCell the cell to be initialized |
410 | 410 | * @param integer the index to the Columns property that the cell resides in. |
411 | 411 | */ |
412 | - protected function initializeHeaderCell($cell,$columnIndex) |
|
412 | + protected function initializeHeaderCell($cell, $columnIndex) |
|
413 | 413 | { |
414 | 414 | $text=$this->getHeaderText(); |
415 | 415 | |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | * @param TTableCell the cell to be initialized |
482 | 482 | * @param integer the index to the Columns property that the cell resides in. |
483 | 483 | */ |
484 | - protected function initializeFooterCell($cell,$columnIndex) |
|
484 | + protected function initializeFooterCell($cell, $columnIndex) |
|
485 | 485 | { |
486 | 486 | $text=$this->getFooterText(); |
487 | 487 | if(($classPath=$this->getFooterRenderer())!=='') |
@@ -517,13 +517,13 @@ discard block |
||
517 | 517 | * @param mixed the data to be formatted |
518 | 518 | * @return string the formatted result |
519 | 519 | */ |
520 | - protected function formatDataValue($formatString,$value) |
|
520 | + protected function formatDataValue($formatString, $value) |
|
521 | 521 | { |
522 | 522 | if($formatString==='') |
523 | 523 | return TPropertyValue::ensureString($value); |
524 | 524 | else if($formatString[0]==='#') |
525 | 525 | { |
526 | - $expression=strtr(substr($formatString,1),array('{0}'=>'$value')); |
|
526 | + $expression=strtr(substr($formatString, 1), array('{0}'=>'$value')); |
|
527 | 527 | try |
528 | 528 | { |
529 | 529 | if(eval("\$result=$expression;")===false) |
@@ -532,11 +532,11 @@ discard block |
||
532 | 532 | } |
533 | 533 | catch(Exception $e) |
534 | 534 | { |
535 | - throw new TInvalidDataValueException('datagridcolumn_expression_invalid',get_class($this),$expression,$e->getMessage()); |
|
535 | + throw new TInvalidDataValueException('datagridcolumn_expression_invalid', get_class($this), $expression, $e->getMessage()); |
|
536 | 536 | } |
537 | 537 | } |
538 | 538 | else |
539 | - return sprintf($formatString,$value); |
|
539 | + return sprintf($formatString, $value); |
|
540 | 540 | } |
541 | 541 | } |
542 | 542 |