@@ -28,12 +28,12 @@ discard block |
||
| 28 | 28 | /** |
| 29 | 29 | * Script path relative to the TClientScriptManager::SCRIPT_PATH |
| 30 | 30 | */ |
| 31 | - const SCRIPT_PATH = 'ratings'; |
|
| 31 | + const SCRIPT_PATH='ratings'; |
|
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * @var array list of published rating images. |
| 35 | 35 | */ |
| 36 | - private $_ratingImages = array(); |
|
| 36 | + private $_ratingImages=array(); |
|
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * Sets the default repeat direction to horizontal. |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function getReadOnly() |
| 51 | 51 | { |
| 52 | - return $this->getViewState('ReadOnly',false); |
|
| 52 | + return $this->getViewState('ReadOnly', false); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | public function setReadOnly($value) |
| 59 | 59 | { |
| 60 | - $this->setViewState('ReadOnly',TPropertyValue::ensureBoolean($value),false); |
|
| 60 | + $this->setViewState('ReadOnly', TPropertyValue::ensureBoolean($value), false); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -105,9 +105,9 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | public function getRating() |
| 107 | 107 | { |
| 108 | - $rating = $this->getViewState('Rating', null); |
|
| 109 | - if ($rating === null) |
|
| 110 | - return $this->getSelectedIndex()+1; |
|
| 108 | + $rating=$this->getViewState('Rating', null); |
|
| 109 | + if($rating===null) |
|
| 110 | + return $this->getSelectedIndex() + 1; |
|
| 111 | 111 | else |
| 112 | 112 | return $rating; |
| 113 | 113 | } |
@@ -117,15 +117,15 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | public function setRating($value) |
| 119 | 119 | { |
| 120 | - $value = TPropertyValue::ensureFloat($value); |
|
| 120 | + $value=TPropertyValue::ensureFloat($value); |
|
| 121 | 121 | $this->setViewState('Rating', $value, null); |
| 122 | - $index = $this->getRatingIndex($value); |
|
| 122 | + $index=$this->getRatingIndex($value); |
|
| 123 | 123 | parent::setSelectedIndex($index); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | public function setSelectedIndex($value) |
| 127 | 127 | { |
| 128 | - $this->setRating($value+1); |
|
| 128 | + $this->setRating($value + 1); |
|
| 129 | 129 | parent::setSelectedIndex($value); |
| 130 | 130 | } |
| 131 | 131 | |
@@ -135,10 +135,10 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | protected function getRatingIndex($rating) |
| 137 | 137 | { |
| 138 | - $interval = $this->getHalfRatingInterval(); |
|
| 139 | - $base = intval($rating)-1; |
|
| 140 | - $remainder = $rating-$base-1; |
|
| 141 | - return $remainder > $interval[1] ? $base+1 : $base; |
|
| 138 | + $interval=$this->getHalfRatingInterval(); |
|
| 139 | + $base=intval($rating) - 1; |
|
| 140 | + $remainder=$rating - $base - 1; |
|
| 141 | + return $remainder > $interval[1] ? $base + 1 : $base; |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | /** |
@@ -146,8 +146,8 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | public function onSelectedIndexChanged($param) |
| 148 | 148 | { |
| 149 | - $value = $this->getRating(); |
|
| 150 | - $value = TPropertyValue::ensureInteger($value); |
|
| 149 | + $value=$this->getRating(); |
|
| 150 | + $value=TPropertyValue::ensureInteger($value); |
|
| 151 | 151 | $this->setRating($value); |
| 152 | 152 | parent::onSelectedIndexChanged($param); |
| 153 | 153 | } |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | return $control; |
| 179 | 179 | } |
| 180 | 180 | throw new TInvalidDataValueException( |
| 181 | - 'ratinglist_invalid_caption_id',$id,$this->getID()); |
|
| 181 | + 'ratinglist_invalid_caption_id', $id, $this->getID()); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | /** |
@@ -245,14 +245,14 @@ discard block |
||
| 245 | 245 | */ |
| 246 | 246 | protected function getPostBackOptions() |
| 247 | 247 | { |
| 248 | - $options = parent::getPostBackOptions(); |
|
| 249 | - $options['AutoPostBack'] = $this->getAutoPostBack(); |
|
| 250 | - $options['ReadOnly'] = $this->getReadOnly(); |
|
| 251 | - $options['Style'] = $this->getRatingStyleCssClass(); |
|
| 252 | - $options['CaptionID'] = $this->getCaptionControlID(); |
|
| 253 | - $options['SelectedIndex'] = $this->getSelectedIndex(); |
|
| 254 | - $options['Rating'] = $this->getRating(); |
|
| 255 | - $options['HalfRating'] = $this->getHalfRatingInterval(); |
|
| 248 | + $options=parent::getPostBackOptions(); |
|
| 249 | + $options['AutoPostBack']=$this->getAutoPostBack(); |
|
| 250 | + $options['ReadOnly']=$this->getReadOnly(); |
|
| 251 | + $options['Style']=$this->getRatingStyleCssClass(); |
|
| 252 | + $options['CaptionID']=$this->getCaptionControlID(); |
|
| 253 | + $options['SelectedIndex']=$this->getSelectedIndex(); |
|
| 254 | + $options['Rating']=$this->getRating(); |
|
| 255 | + $options['HalfRating']=$this->getHalfRatingInterval(); |
|
| 256 | 256 | return $options; |
| 257 | 257 | } |
| 258 | 258 | |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | { |
| 282 | 282 | parent::onPreRender($param); |
| 283 | 283 | $this->publishStyle($this->getRatingStyle()); |
| 284 | - $this->_ratingImages = $this->publishImages($this->getRatingStyle()); |
|
| 284 | + $this->_ratingImages=$this->publishImages($this->getRatingStyle()); |
|
| 285 | 285 | $this->registerClientScript(); |
| 286 | 286 | } |
| 287 | 287 | |
@@ -291,8 +291,8 @@ discard block |
||
| 291 | 291 | */ |
| 292 | 292 | protected function publishStyle($style) |
| 293 | 293 | { |
| 294 | - $cs = $this->getPage()->getClientScript(); |
|
| 295 | - $url = $this->getAssetUrl($style.'.css'); |
|
| 294 | + $cs=$this->getPage()->getClientScript(); |
|
| 295 | + $url=$this->getAssetUrl($style.'.css'); |
|
| 296 | 296 | if(!$cs->isStyleSheetFileRegistered($url)) |
| 297 | 297 | $cs->registerStyleSheetFile($url, $url); |
| 298 | 298 | return $url; |
@@ -305,10 +305,10 @@ discard block |
||
| 305 | 305 | */ |
| 306 | 306 | protected function publishImages($style, $fileExt='.gif') |
| 307 | 307 | { |
| 308 | - $types = array('blank', 'selected', 'half', 'combined'); |
|
| 309 | - $files = array(); |
|
| 308 | + $types=array('blank', 'selected', 'half', 'combined'); |
|
| 309 | + $files=array(); |
|
| 310 | 310 | foreach($types as $type) |
| 311 | - $files[$type] = $this->getAssetUrl("{$style}_{$type}{$fileExt}"); |
|
| 311 | + $files[$type]=$this->getAssetUrl("{$style}_{$type}{$fileExt}"); |
|
| 312 | 312 | return $files; |
| 313 | 313 | } |
| 314 | 314 | |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | */ |
| 328 | 328 | protected function getAssetUrl($file='') |
| 329 | 329 | { |
| 330 | - $base = $this->getPage()->getClientScript()->getPradoScriptAssetUrl(); |
|
| 330 | + $base=$this->getPage()->getClientScript()->getPradoScriptAssetUrl(); |
|
| 331 | 331 | return $base.'/'.self::SCRIPT_PATH.'/'.$file; |
| 332 | 332 | } |
| 333 | 333 | |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | */ |
| 340 | 340 | public function render($writer) |
| 341 | 341 | { |
| 342 | - $writer->addAttribute('id',$this->getClientID()); |
|
| 342 | + $writer->addAttribute('id', $this->getClientID()); |
|
| 343 | 343 | $this->getPage()->getClientScript()->registerPostBackControl( |
| 344 | 344 | $this->getClientClassName(), $this->getPostBackOptions()); |
| 345 | 345 | parent::render($writer); |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | /** |
| 86 | 86 | * Script path relative to the TClientScriptManager::SCRIPT_PATH |
| 87 | 87 | */ |
| 88 | - const SCRIPT_PATH = 'datepicker'; |
|
| 88 | + const SCRIPT_PATH='datepicker'; |
|
| 89 | 89 | |
| 90 | 90 | /** |
| 91 | 91 | * @var TDatePickerClientScript validator client-script options. |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | public function getDateFormat() |
| 107 | 107 | { |
| 108 | - return $this->getViewState('DateFormat','dd-MM-yyyy'); |
|
| 108 | + return $this->getViewState('DateFormat', 'dd-MM-yyyy'); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | /** |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function setDateFormat($value) |
| 116 | 116 | { |
| 117 | - $this->setViewState('DateFormat',$value,'dd-MM-yyyy'); |
|
| 117 | + $this->setViewState('DateFormat', $value, 'dd-MM-yyyy'); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | /** |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | public function getShowCalendar() |
| 124 | 124 | { |
| 125 | - return $this->getViewState('ShowCalendar',true); |
|
| 125 | + return $this->getViewState('ShowCalendar', true); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /** |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | public function setShowCalendar($value) |
| 133 | 133 | { |
| 134 | - $this->setViewState('ShowCalendar',TPropertyValue::ensureBoolean($value),true); |
|
| 134 | + $this->setViewState('ShowCalendar', TPropertyValue::ensureBoolean($value), true); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | */ |
| 254 | 254 | public function setFromYear($value) |
| 255 | 255 | { |
| 256 | - $this->setViewState('FromYear', TPropertyValue::ensureInteger($value), intval(@date('Y'))-5); |
|
| 256 | + $this->setViewState('FromYear', TPropertyValue::ensureInteger($value), intval(@date('Y')) - 5); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | /** |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | */ |
| 262 | 262 | public function getFromYear() |
| 263 | 263 | { |
| 264 | - return $this->getViewState('FromYear', intval(@date('Y'))-5); |
|
| 264 | + return $this->getViewState('FromYear', intval(@date('Y')) - 5); |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | /** |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | */ |
| 270 | 270 | public function setUpToYear($value) |
| 271 | 271 | { |
| 272 | - $this->setViewState('UpToYear', TPropertyValue::ensureInteger($value), intval(@date('Y'))+10); |
|
| 272 | + $this->setViewState('UpToYear', TPropertyValue::ensureInteger($value), intval(@date('Y')) + 10); |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | /** |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | */ |
| 278 | 278 | public function getUpToYear() |
| 279 | 279 | { |
| 280 | - return $this->getViewState('UpToYear', intval(@date('Y'))+10); |
|
| 280 | + return $this->getViewState('UpToYear', intval(@date('Y')) + 10); |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | /** |
@@ -317,8 +317,8 @@ discard block |
||
| 317 | 317 | $this->setText(''); |
| 318 | 318 | else |
| 319 | 319 | { |
| 320 | - $date = TPropertyValue::ensureFloat($value); |
|
| 321 | - $formatter = new TSimpleDateFormatter($this->getDateFormat()); |
|
| 320 | + $date=TPropertyValue::ensureFloat($value); |
|
| 321 | + $formatter=new TSimpleDateFormatter($this->getDateFormat()); |
|
| 322 | 322 | $this->setText($formatter->format($date)); |
| 323 | 323 | } |
| 324 | 324 | } |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | public function getClientSide() |
| 379 | 379 | { |
| 380 | 380 | if($this->_clientScript===null) |
| 381 | - $this->_clientScript = $this->createClientScript(); |
|
| 381 | + $this->_clientScript=$this->createClientScript(); |
|
| 382 | 382 | return $this->_clientScript; |
| 383 | 383 | } |
| 384 | 384 | |
@@ -397,10 +397,10 @@ discard block |
||
| 397 | 397 | */ |
| 398 | 398 | public function getValidationPropertyValue() |
| 399 | 399 | { |
| 400 | - if(($text = $this->getText()) === '') |
|
| 400 | + if(($text=$this->getText())==='') |
|
| 401 | 401 | return ''; |
| 402 | - $date = $this->getTimeStamp(); |
|
| 403 | - return $date == null ? $text : $date; |
|
| 402 | + $date=$this->getTimeStamp(); |
|
| 403 | + return $date==null ? $text : $date; |
|
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | /** |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | */ |
| 422 | 422 | public function render($writer) |
| 423 | 423 | { |
| 424 | - if($this->getInputMode() == TDatePickerInputMode::TextBox) |
|
| 424 | + if($this->getInputMode()==TDatePickerInputMode::TextBox) |
|
| 425 | 425 | { |
| 426 | 426 | parent::render($writer); |
| 427 | 427 | $this->renderDatePickerButtons($writer); |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | { |
| 445 | 445 | if($this->getShowCalendar()) |
| 446 | 446 | { |
| 447 | - switch ($this->getMode()) |
|
| 447 | + switch($this->getMode()) |
|
| 448 | 448 | { |
| 449 | 449 | case TDatePickerMode::Button: |
| 450 | 450 | $this->renderButtonDatePicker($writer); |
@@ -464,11 +464,11 @@ discard block |
||
| 464 | 464 | * @param array the input data collection |
| 465 | 465 | * @return boolean whether the data of the component has been changed |
| 466 | 466 | */ |
| 467 | - public function loadPostData($key,$values) |
|
| 467 | + public function loadPostData($key, $values) |
|
| 468 | 468 | { |
| 469 | - if($this->getInputMode() == TDatePickerInputMode::TextBox) |
|
| 469 | + if($this->getInputMode()==TDatePickerInputMode::TextBox) |
|
| 470 | 470 | return parent::loadPostData($key, $values); |
| 471 | - $value = $this->getDateFromPostData($key, $values); |
|
| 471 | + $value=$this->getDateFromPostData($key, $values); |
|
| 472 | 472 | if(!$this->getReadOnly() && $this->getText()!==$value) |
| 473 | 473 | { |
| 474 | 474 | $this->setText($value); |
@@ -486,40 +486,40 @@ discard block |
||
| 486 | 486 | */ |
| 487 | 487 | protected function getDateFromPostData($key, $values) |
| 488 | 488 | { |
| 489 | - $date = @getdate(); |
|
| 489 | + $date=@getdate(); |
|
| 490 | 490 | |
| 491 | - $pattern = $this->getDateFormat(); |
|
| 492 | - $pattern = str_replace(array('MMMM', 'MMM'), array('MM','MM'), $pattern); |
|
| 493 | - $formatter = new TSimpleDateFormatter($pattern); |
|
| 491 | + $pattern=$this->getDateFormat(); |
|
| 492 | + $pattern=str_replace(array('MMMM', 'MMM'), array('MM', 'MM'), $pattern); |
|
| 493 | + $formatter=new TSimpleDateFormatter($pattern); |
|
| 494 | 494 | |
| 495 | - $order = $formatter->getDayMonthYearOrdering(); |
|
| 495 | + $order=$formatter->getDayMonthYearOrdering(); |
|
| 496 | 496 | |
| 497 | 497 | if(isset($values[$key.'$day'])) { |
| 498 | - $day = intval($values[$key.'$day']); |
|
| 498 | + $day=intval($values[$key.'$day']); |
|
| 499 | 499 | } elseif(in_array('day', $order)) { |
| 500 | - $day = $date['mday']; |
|
| 500 | + $day=$date['mday']; |
|
| 501 | 501 | } else { |
| 502 | - $day = 1; |
|
| 502 | + $day=1; |
|
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | if(isset($values[$key.'$month'])) |
| 506 | - $month = intval($values[$key.'$month']) + 1; |
|
| 506 | + $month=intval($values[$key.'$month']) + 1; |
|
| 507 | 507 | else |
| 508 | - $month = $date['mon']; |
|
| 508 | + $month=$date['mon']; |
|
| 509 | 509 | |
| 510 | 510 | if(isset($values[$key.'$year'])) |
| 511 | - $year = intval($values[$key.'$year']); |
|
| 511 | + $year=intval($values[$key.'$year']); |
|
| 512 | 512 | else |
| 513 | - $year = $date['year']; |
|
| 513 | + $year=$date['year']; |
|
| 514 | 514 | |
| 515 | - $s = new TDateTimeStamp; |
|
| 516 | - $date = $s->getTimeStamp(0, 0, 0, $month, $day, $year); |
|
| 515 | + $s=new TDateTimeStamp; |
|
| 516 | + $date=$s->getTimeStamp(0, 0, 0, $month, $day, $year); |
|
| 517 | 517 | //$date = @mktime(0, 0, 0, $month, $day, $year); |
| 518 | 518 | |
| 519 | - $pattern = $this->getDateFormat(); |
|
| 520 | - $pattern = str_replace(array('MMMM', 'MMM'), array('MM','MM'), $pattern); |
|
| 519 | + $pattern=$this->getDateFormat(); |
|
| 520 | + $pattern=str_replace(array('MMMM', 'MMM'), array('MM', 'MM'), $pattern); |
|
| 521 | 521 | |
| 522 | - $formatter = new TSimpleDateFormatter($pattern); |
|
| 522 | + $formatter=new TSimpleDateFormatter($pattern); |
|
| 523 | 523 | return $formatter->format($date); |
| 524 | 524 | } |
| 525 | 525 | |
@@ -529,31 +529,31 @@ discard block |
||
| 529 | 529 | */ |
| 530 | 530 | protected function getDatePickerOptions() |
| 531 | 531 | { |
| 532 | - $options['ID'] = $this->getClientID(); |
|
| 533 | - $options['InputMode'] = $this->getInputMode(); |
|
| 534 | - $options['Format'] = $this->getDateFormat(); |
|
| 535 | - $options['FirstDayOfWeek'] = $this->getFirstDayOfWeek(); |
|
| 532 | + $options['ID']=$this->getClientID(); |
|
| 533 | + $options['InputMode']=$this->getInputMode(); |
|
| 534 | + $options['Format']=$this->getDateFormat(); |
|
| 535 | + $options['FirstDayOfWeek']=$this->getFirstDayOfWeek(); |
|
| 536 | 536 | if(($cssClass=$this->getCssClass())!=='') |
| 537 | - $options['ClassName'] = $cssClass; |
|
| 538 | - $options['CalendarStyle'] = $this->getCalendarStyle(); |
|
| 539 | - $options['FromYear'] = $this->getFromYear(); |
|
| 540 | - $options['UpToYear'] = $this->getUpToYear(); |
|
| 537 | + $options['ClassName']=$cssClass; |
|
| 538 | + $options['CalendarStyle']=$this->getCalendarStyle(); |
|
| 539 | + $options['FromYear']=$this->getFromYear(); |
|
| 540 | + $options['UpToYear']=$this->getUpToYear(); |
|
| 541 | 541 | switch($this->getMode()) |
| 542 | 542 | { |
| 543 | 543 | case TDatePickerMode::Basic: |
| 544 | 544 | break; |
| 545 | 545 | case TDatePickerMode::Clickable: |
| 546 | - $options['TriggerEvent'] = "click"; |
|
| 546 | + $options['TriggerEvent']="click"; |
|
| 547 | 547 | break; |
| 548 | 548 | default: |
| 549 | - $options['Trigger'] = $this->getDatePickerButtonID(); |
|
| 549 | + $options['Trigger']=$this->getDatePickerButtonID(); |
|
| 550 | 550 | break; |
| 551 | 551 | } |
| 552 | - $options['PositionMode'] = $this->getPositionMode(); |
|
| 552 | + $options['PositionMode']=$this->getPositionMode(); |
|
| 553 | 553 | |
| 554 | - $options = array_merge($options, $this->getCulturalOptions()); |
|
| 554 | + $options=array_merge($options, $this->getCulturalOptions()); |
|
| 555 | 555 | if($this->_clientScript!==null) |
| 556 | - $options = array_merge($options, |
|
| 556 | + $options=array_merge($options, |
|
| 557 | 557 | $this->_clientScript->getOptions()->toArray()); |
| 558 | 558 | return $options; |
| 559 | 559 | } |
@@ -564,13 +564,13 @@ discard block |
||
| 564 | 564 | */ |
| 565 | 565 | protected function getCulturalOptions() |
| 566 | 566 | { |
| 567 | - if($this->getCurrentCulture() == 'en') |
|
| 567 | + if($this->getCurrentCulture()=='en') |
|
| 568 | 568 | return array(); |
| 569 | 569 | |
| 570 | - $date = $this->getLocalizedCalendarInfo(); |
|
| 571 | - $options['MonthNames'] = $date->getMonthNames(); |
|
| 572 | - $options['AbbreviatedMonthNames'] = $date->getAbbreviatedMonthNames(); |
|
| 573 | - $options['ShortWeekDayNames'] = $date->getAbbreviatedDayNames(); |
|
| 570 | + $date=$this->getLocalizedCalendarInfo(); |
|
| 571 | + $options['MonthNames']=$date->getMonthNames(); |
|
| 572 | + $options['AbbreviatedMonthNames']=$date->getAbbreviatedMonthNames(); |
|
| 573 | + $options['ShortWeekDayNames']=$date->getAbbreviatedDayNames(); |
|
| 574 | 574 | |
| 575 | 575 | return $options; |
| 576 | 576 | } |
@@ -580,8 +580,8 @@ discard block |
||
| 580 | 580 | */ |
| 581 | 581 | protected function getCurrentCulture() |
| 582 | 582 | { |
| 583 | - $app = $this->getApplication()->getGlobalization(false); |
|
| 584 | - return $this->getCulture() == '' ? |
|
| 583 | + $app=$this->getApplication()->getGlobalization(false); |
|
| 584 | + return $this->getCulture()=='' ? |
|
| 585 | 585 | ($app ? $app->getCulture() : 'en') : $this->getCulture(); |
| 586 | 586 | } |
| 587 | 587 | |
@@ -591,8 +591,8 @@ discard block |
||
| 591 | 591 | protected function getLocalizedCalendarInfo() |
| 592 | 592 | { |
| 593 | 593 | //expensive operations |
| 594 | - $culture = $this->getCurrentCulture(); |
|
| 595 | - $info = new CultureInfo($culture); |
|
| 594 | + $culture=$this->getCurrentCulture(); |
|
| 595 | + $info=new CultureInfo($culture); |
|
| 596 | 596 | return $info->getDateTimeFormat(); |
| 597 | 597 | } |
| 598 | 598 | |
@@ -601,19 +601,19 @@ discard block |
||
| 601 | 601 | */ |
| 602 | 602 | protected function renderDropDownListCalendar($writer) |
| 603 | 603 | { |
| 604 | - if($this->getMode() == TDatePickerMode::Basic) |
|
| 604 | + if($this->getMode()==TDatePickerMode::Basic) |
|
| 605 | 605 | $this->setMode(TDatePickerMode::ImageButton); |
| 606 | 606 | parent::addAttributesToRender($writer); |
| 607 | 607 | $writer->removeAttribute('name'); |
| 608 | 608 | $writer->removeAttribute('type'); |
| 609 | 609 | $writer->addAttribute('id', $this->getClientID()); |
| 610 | 610 | |
| 611 | - if(strlen($class = $this->getCssClass()) > 0) |
|
| 611 | + if(strlen($class=$this->getCssClass()) > 0) |
|
| 612 | 612 | $writer->addAttribute('class', $class); |
| 613 | 613 | $writer->renderBeginTag('span'); |
| 614 | 614 | |
| 615 | - $s = new TDateTimeStamp; |
|
| 616 | - $date = $s->getDate($this->getTimeStampFromText()); |
|
| 615 | + $s=new TDateTimeStamp; |
|
| 616 | + $date=$s->getDate($this->getTimeStampFromText()); |
|
| 617 | 617 | //$date = @getdate($this->getTimeStampFromText()); |
| 618 | 618 | |
| 619 | 619 | $this->renderCalendarSelections($writer, $date); |
@@ -630,7 +630,7 @@ discard block |
||
| 630 | 630 | |
| 631 | 631 | protected function hasDayPattern() |
| 632 | 632 | { |
| 633 | - $formatter = new TSimpleDateFormatter($this->getDateFormat()); |
|
| 633 | + $formatter=new TSimpleDateFormatter($this->getDateFormat()); |
|
| 634 | 634 | return ($formatter->getDayPattern()!==null); |
| 635 | 635 | } |
| 636 | 636 | |
@@ -641,16 +641,16 @@ discard block |
||
| 641 | 641 | */ |
| 642 | 642 | protected function renderCalendarSelections($writer, $date) |
| 643 | 643 | { |
| 644 | - $formatter = new TSimpleDateFormatter($this->getDateFormat()); |
|
| 644 | + $formatter=new TSimpleDateFormatter($this->getDateFormat()); |
|
| 645 | 645 | |
| 646 | 646 | foreach($formatter->getDayMonthYearOrdering() as $type) |
| 647 | 647 | { |
| 648 | - if($type == 'day') |
|
| 649 | - $this->renderCalendarDayOptions($writer,$date['mday']); |
|
| 650 | - elseif($type == 'month') |
|
| 651 | - $this->renderCalendarMonthOptions($writer,$date['mon']); |
|
| 652 | - elseif($type == 'year') |
|
| 653 | - $this->renderCalendarYearOptions($writer,$date['year']); |
|
| 648 | + if($type=='day') |
|
| 649 | + $this->renderCalendarDayOptions($writer, $date['mday']); |
|
| 650 | + elseif($type=='month') |
|
| 651 | + $this->renderCalendarMonthOptions($writer, $date['mon']); |
|
| 652 | + elseif($type=='year') |
|
| 653 | + $this->renderCalendarYearOptions($writer, $date['year']); |
|
| 654 | 654 | } |
| 655 | 655 | } |
| 656 | 656 | |
@@ -660,9 +660,9 @@ discard block |
||
| 660 | 660 | */ |
| 661 | 661 | protected function getTimeStampFromText() |
| 662 | 662 | { |
| 663 | - $pattern = $this->getDateFormat(); |
|
| 664 | - $pattern = str_replace(array('MMMM', 'MMM'), array('MM','MM'), $pattern); |
|
| 665 | - $formatter = new TSimpleDateFormatter($pattern); |
|
| 663 | + $pattern=$this->getDateFormat(); |
|
| 664 | + $pattern=str_replace(array('MMMM', 'MMM'), array('MM', 'MM'), $pattern); |
|
| 665 | + $formatter=new TSimpleDateFormatter($pattern); |
|
| 666 | 666 | return $formatter->parse($this->getText()); |
| 667 | 667 | } |
| 668 | 668 | |
@@ -672,12 +672,12 @@ discard block |
||
| 672 | 672 | * @param array list of selection options |
| 673 | 673 | * @param mixed selected key. |
| 674 | 674 | */ |
| 675 | - private function renderDropDownListOptions($writer,$options,$selected=null) |
|
| 675 | + private function renderDropDownListOptions($writer, $options, $selected=null) |
|
| 676 | 676 | { |
| 677 | 677 | foreach($options as $k => $v) |
| 678 | 678 | { |
| 679 | 679 | $writer->addAttribute('value', $k); |
| 680 | - if($k == $selected) |
|
| 680 | + if($k==$selected) |
|
| 681 | 681 | $writer->addAttribute('selected', 'selected'); |
| 682 | 682 | $writer->renderBeginTag('option'); |
| 683 | 683 | $writer->write($v); |
@@ -692,7 +692,7 @@ discard block |
||
| 692 | 692 | */ |
| 693 | 693 | protected function renderCalendarDayOptions($writer, $selected=null) |
| 694 | 694 | { |
| 695 | - $days = $this->getDropDownDayOptions(); |
|
| 695 | + $days=$this->getDropDownDayOptions(); |
|
| 696 | 696 | $writer->addAttribute('id', $this->getClientID().TControl::CLIENT_ID_SEPARATOR.'day'); |
| 697 | 697 | $writer->addAttribute('name', $this->getUniqueID().TControl::ID_SEPARATOR.'day'); |
| 698 | 698 | $writer->addAttribute('class', 'datepicker_day_options'); |
@@ -708,12 +708,12 @@ discard block |
||
| 708 | 708 | */ |
| 709 | 709 | protected function getDropDownDayOptions() |
| 710 | 710 | { |
| 711 | - $formatter = new TSimpleDateFormatter($this->getDateFormat()); |
|
| 712 | - $days = array(); |
|
| 713 | - $requiresPadding = $formatter->getDayPattern() === 'dd'; |
|
| 714 | - for($i=1;$i<=31;$i++) |
|
| 711 | + $formatter=new TSimpleDateFormatter($this->getDateFormat()); |
|
| 712 | + $days=array(); |
|
| 713 | + $requiresPadding=$formatter->getDayPattern()==='dd'; |
|
| 714 | + for($i=1; $i <= 31; $i++) |
|
| 715 | 715 | { |
| 716 | - $days[$i] = $requiresPadding ? str_pad($i, 2, '0', STR_PAD_LEFT) : $i; |
|
| 716 | + $days[$i]=$requiresPadding ? str_pad($i, 2, '0', STR_PAD_LEFT) : $i; |
|
| 717 | 717 | } |
| 718 | 718 | return $days; |
| 719 | 719 | } |
@@ -725,7 +725,7 @@ discard block |
||
| 725 | 725 | */ |
| 726 | 726 | protected function renderCalendarMonthOptions($writer, $selected=null) |
| 727 | 727 | { |
| 728 | - $info = $this->getLocalizedCalendarInfo(); |
|
| 728 | + $info=$this->getLocalizedCalendarInfo(); |
|
| 729 | 729 | $writer->addAttribute('id', $this->getClientID().TControl::CLIENT_ID_SEPARATOR.'month'); |
| 730 | 730 | $writer->addAttribute('name', $this->getUniqueID().TControl::ID_SEPARATOR.'month'); |
| 731 | 731 | $writer->addAttribute('class', 'datepicker_month_options'); |
@@ -733,7 +733,7 @@ discard block |
||
| 733 | 733 | $writer->addAttribute('disabled', 'disabled'); |
| 734 | 734 | $writer->renderBeginTag('select'); |
| 735 | 735 | $this->renderDropDownListOptions($writer, |
| 736 | - $this->getLocalizedMonthNames($info), $selected-1); |
|
| 736 | + $this->getLocalizedMonthNames($info), $selected - 1); |
|
| 737 | 737 | $writer->renderEndTag(); |
| 738 | 738 | } |
| 739 | 739 | |
@@ -746,17 +746,17 @@ discard block |
||
| 746 | 746 | */ |
| 747 | 747 | protected function getLocalizedMonthNames($info) |
| 748 | 748 | { |
| 749 | - $formatter = new TSimpleDateFormatter($this->getDateFormat()); |
|
| 749 | + $formatter=new TSimpleDateFormatter($this->getDateFormat()); |
|
| 750 | 750 | switch($formatter->getMonthPattern()) |
| 751 | 751 | { |
| 752 | 752 | case 'MMM': return $info->getAbbreviatedMonthNames(); |
| 753 | 753 | case 'MM': |
| 754 | - $array = array(); |
|
| 755 | - for($i=1;$i<=12;$i++) |
|
| 756 | - $array[$i-1] = $i < 10 ? '0'.$i : $i; |
|
| 754 | + $array=array(); |
|
| 755 | + for($i=1; $i <= 12; $i++) |
|
| 756 | + $array[$i - 1]=$i < 10 ? '0'.$i : $i; |
|
| 757 | 757 | return $array; |
| 758 | 758 | case 'M': |
| 759 | - $array = array(); for($i=1;$i<=12;$i++) $array[$i-1] = $i; |
|
| 759 | + $array=array(); for($i=1; $i <= 12; $i++) $array[$i - 1]=$i; |
|
| 760 | 760 | return $array; |
| 761 | 761 | default : return $info->getMonthNames(); |
| 762 | 762 | } |
@@ -769,9 +769,9 @@ discard block |
||
| 769 | 769 | */ |
| 770 | 770 | protected function renderCalendarYearOptions($writer, $selected=null) |
| 771 | 771 | { |
| 772 | - $years = array(); |
|
| 773 | - for($i = $this->getFromYear(); $i <= $this->getUpToYear(); $i++) |
|
| 774 | - $years[$i] = $i; |
|
| 772 | + $years=array(); |
|
| 773 | + for($i=$this->getFromYear(); $i <= $this->getUpToYear(); $i++) |
|
| 774 | + $years[$i]=$i; |
|
| 775 | 775 | $writer->addAttribute('id', $this->getClientID().TControl::CLIENT_ID_SEPARATOR.'year'); |
| 776 | 776 | $writer->addAttribute('name', $this->getUniqueID().TControl::ID_SEPARATOR.'year'); |
| 777 | 777 | $writer->addAttribute('class', 'datepicker_year_options'); |
@@ -800,7 +800,7 @@ discard block |
||
| 800 | 800 | $writer->addAttribute('id', $this->getDatePickerButtonID()); |
| 801 | 801 | $writer->addAttribute('type', 'button'); |
| 802 | 802 | $writer->addAttribute('class', $this->getCssClass().' TDatePickerButton'); |
| 803 | - $writer->addAttribute('value',$this->getButtonText()); |
|
| 803 | + $writer->addAttribute('value', $this->getButtonText()); |
|
| 804 | 804 | if(!$this->getEnabled(true)) |
| 805 | 805 | $writer->addAttribute('disabled', 'disabled'); |
| 806 | 806 | $writer->renderBeginTag("input"); |
@@ -813,8 +813,8 @@ discard block |
||
| 813 | 813 | */ |
| 814 | 814 | protected function renderImageButtonDatePicker($writer) |
| 815 | 815 | { |
| 816 | - $url = $this->getButtonImageUrl(); |
|
| 817 | - $url = empty($url) ? $this->getAssetUrl('calendar.png') : $url; |
|
| 816 | + $url=$this->getButtonImageUrl(); |
|
| 817 | + $url=empty($url) ? $this->getAssetUrl('calendar.png') : $url; |
|
| 818 | 818 | $writer->addAttribute('id', $this->getDatePickerButtonID()); |
| 819 | 819 | $writer->addAttribute('src', $url); |
| 820 | 820 | $writer->addAttribute('alt', ' '); |
@@ -833,7 +833,7 @@ discard block |
||
| 833 | 833 | */ |
| 834 | 834 | protected function getAssetUrl($file='') |
| 835 | 835 | { |
| 836 | - $base = $this->getPage()->getClientScript()->getPradoScriptAssetUrl(); |
|
| 836 | + $base=$this->getPage()->getClientScript()->getPradoScriptAssetUrl(); |
|
| 837 | 837 | return $base.'/'.self::SCRIPT_PATH.'/'.$file; |
| 838 | 838 | } |
| 839 | 839 | |
@@ -843,8 +843,8 @@ discard block |
||
| 843 | 843 | */ |
| 844 | 844 | protected function publishCalendarStyle() |
| 845 | 845 | { |
| 846 | - $url = $this->getAssetUrl($this->getCalendarStyle().'.css'); |
|
| 847 | - $cs = $this->getPage()->getClientScript(); |
|
| 846 | + $url=$this->getAssetUrl($this->getCalendarStyle().'.css'); |
|
| 847 | + $cs=$this->getPage()->getClientScript(); |
|
| 848 | 848 | if(!$cs->isStyleSheetFileRegistered($url)) |
| 849 | 849 | $cs->registerStyleSheetFile($url, $url); |
| 850 | 850 | return $url; |
@@ -857,7 +857,7 @@ discard block |
||
| 857 | 857 | protected function addAttributesToRender($writer) |
| 858 | 858 | { |
| 859 | 859 | parent::addAttributesToRender($writer); |
| 860 | - $writer->addAttribute('id',$this->getClientID()); |
|
| 860 | + $writer->addAttribute('id', $this->getClientID()); |
|
| 861 | 861 | } |
| 862 | 862 | |
| 863 | 863 | /** |
@@ -867,7 +867,7 @@ discard block |
||
| 867 | 867 | { |
| 868 | 868 | if($this->getShowCalendar()) |
| 869 | 869 | { |
| 870 | - $cs = $this->getPage()->getClientScript(); |
|
| 870 | + $cs=$this->getPage()->getClientScript(); |
|
| 871 | 871 | $cs->registerPradoScript("datepicker"); |
| 872 | 872 | } |
| 873 | 873 | } |
@@ -876,16 +876,16 @@ discard block |
||
| 876 | 876 | { |
| 877 | 877 | if($this->getShowCalendar()) |
| 878 | 878 | { |
| 879 | - $cs = $this->getPage()->getClientScript(); |
|
| 879 | + $cs=$this->getPage()->getClientScript(); |
|
| 880 | 880 | if(!$cs->isEndScriptRegistered('TDatePicker.spacer')) |
| 881 | 881 | { |
| 882 | - $spacer = $this->getAssetUrl('spacer.gif'); |
|
| 883 | - $code = "Prado.WebUI.TDatePicker.spacer = '$spacer';"; |
|
| 882 | + $spacer=$this->getAssetUrl('spacer.gif'); |
|
| 883 | + $code="Prado.WebUI.TDatePicker.spacer = '$spacer';"; |
|
| 884 | 884 | $cs->registerEndScript('TDatePicker.spacer', $code); |
| 885 | 885 | } |
| 886 | 886 | |
| 887 | - $options = TJavaScript::encode($this->getDatePickerOptions()); |
|
| 888 | - $code = "new Prado.WebUI.TDatePicker($options);"; |
|
| 887 | + $options=TJavaScript::encode($this->getDatePickerOptions()); |
|
| 888 | + $code="new Prado.WebUI.TDatePicker($options);"; |
|
| 889 | 889 | $cs->registerEndScript("prado:".$this->getClientID(), $code); |
| 890 | 890 | } |
| 891 | 891 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | class TColorPicker extends TTextBox |
| 43 | 43 | { |
| 44 | - const SCRIPT_PATH = 'colorpicker'; |
|
| 44 | + const SCRIPT_PATH='colorpicker'; |
|
| 45 | 45 | |
| 46 | 46 | private $_clientSide; |
| 47 | 47 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function getShowColorPicker() |
| 52 | 52 | { |
| 53 | - return $this->getViewState('ShowColorPicker',true); |
|
| 53 | + return $this->getViewState('ShowColorPicker', true); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | public function setShowColorPicker($value) |
| 61 | 61 | { |
| 62 | - $this->setViewState('ShowColorPicker',TPropertyValue::ensureBoolean($value),true); |
|
| 62 | + $this->setViewState('ShowColorPicker', TPropertyValue::ensureBoolean($value), true); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | public function getClientSide() |
| 133 | 133 | { |
| 134 | 134 | if($this->_clientSide===null) |
| 135 | - $this->_clientSide = $this->createClientSide(); |
|
| 135 | + $this->_clientSide=$this->createClientSide(); |
|
| 136 | 136 | return $this->_clientSide; |
| 137 | 137 | } |
| 138 | 138 | |
@@ -150,18 +150,18 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | protected function getPostBackOptions() |
| 152 | 152 | { |
| 153 | - $options = parent::getPostBackOptions(); |
|
| 154 | - $options['ClassName'] = $this->getCssClass(); |
|
| 155 | - $options['ShowColorPicker'] = $this->getShowColorPicker(); |
|
| 153 | + $options=parent::getPostBackOptions(); |
|
| 154 | + $options['ClassName']=$this->getCssClass(); |
|
| 155 | + $options['ShowColorPicker']=$this->getShowColorPicker(); |
|
| 156 | 156 | if($options['ShowColorPicker']) |
| 157 | 157 | { |
| 158 | - $mode = $this->getMode(); |
|
| 159 | - if($mode == TColorPickerMode::Full) $options['Mode'] = $mode; |
|
| 160 | - else if($mode == TColorPickerMode::Simple) $options['Palette'] = 'Tiny'; |
|
| 161 | - $options['OKButtonText'] = $this->getOKButtonText(); |
|
| 162 | - $options['CancelButtonText'] = $this->getCancelButtonText(); |
|
| 158 | + $mode=$this->getMode(); |
|
| 159 | + if($mode==TColorPickerMode::Full) $options['Mode']=$mode; |
|
| 160 | + else if($mode==TColorPickerMode::Simple) $options['Palette']='Tiny'; |
|
| 161 | + $options['OKButtonText']=$this->getOKButtonText(); |
|
| 162 | + $options['CancelButtonText']=$this->getCancelButtonText(); |
|
| 163 | 163 | } |
| 164 | - $options = array_merge($options,$this->getClientSide()->getOptions()->toArray()); |
|
| 164 | + $options=array_merge($options, $this->getClientSide()->getOptions()->toArray()); |
|
| 165 | 165 | return $options; |
| 166 | 166 | } |
| 167 | 167 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | protected function getAssetUrl($file='') |
| 173 | 173 | { |
| 174 | - $base = $this->getPage()->getClientScript()->getPradoScriptAssetUrl(); |
|
| 174 | + $base=$this->getPage()->getClientScript()->getPradoScriptAssetUrl(); |
|
| 175 | 175 | return $base.'/'.self::SCRIPT_PATH.'/'.$file; |
| 176 | 176 | } |
| 177 | 177 | |
@@ -189,15 +189,15 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | protected function publishColorPickerAssets() |
| 191 | 191 | { |
| 192 | - $cs = $this->getPage()->getClientScript(); |
|
| 193 | - $key = "prado:".get_class($this); |
|
| 194 | - $imgs['button.gif'] = $this->getAssetUrl('button.gif'); |
|
| 195 | - $imgs['background.png'] = $this->getAssetUrl('background.png'); |
|
| 196 | - $options = TJavaScript::encode($imgs); |
|
| 197 | - $code = "Prado.WebUI.TColorPicker.UIImages = {$options};"; |
|
| 192 | + $cs=$this->getPage()->getClientScript(); |
|
| 193 | + $key="prado:".get_class($this); |
|
| 194 | + $imgs['button.gif']=$this->getAssetUrl('button.gif'); |
|
| 195 | + $imgs['background.png']=$this->getAssetUrl('background.png'); |
|
| 196 | + $options=TJavaScript::encode($imgs); |
|
| 197 | + $code="Prado.WebUI.TColorPicker.UIImages = {$options};"; |
|
| 198 | 198 | $cs->registerEndScript($key, $code); |
| 199 | 199 | $cs->registerPradoScript("colorpicker"); |
| 200 | - $url = $this->getAssetUrl($this->getColorPickerStyle().'.css'); |
|
| 200 | + $url=$this->getAssetUrl($this->getColorPickerStyle().'.css'); |
|
| 201 | 201 | if(!$cs->isStyleSheetFileRegistered($url)) |
| 202 | 202 | $cs->registerStyleSheetFile($url, $url); |
| 203 | 203 | } |
@@ -212,13 +212,13 @@ discard block |
||
| 212 | 212 | { |
| 213 | 213 | parent::renderEndTag($writer); |
| 214 | 214 | |
| 215 | - $color = $this->getText(); |
|
| 215 | + $color=$this->getText(); |
|
| 216 | 216 | $writer->addAttribute('class', 'TColorPicker_button'); |
| 217 | 217 | $writer->renderBeginTag('span'); |
| 218 | 218 | |
| 219 | 219 | $writer->addAttribute('id', $this->getClientID().'_button'); |
| 220 | 220 | $writer->addAttribute('src', $this->getAssetUrl('button.gif')); |
| 221 | - if($color !== '') |
|
| 221 | + if($color!=='') |
|
| 222 | 222 | $writer->addAttribute('style', "background-color:{$color};"); |
| 223 | 223 | $writer->addAttribute('width', '20'); |
| 224 | 224 | $writer->addAttribute('height', '20'); |