@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | //package base folder in prado alias notation |
| 4 | -$folders = array( |
|
| 4 | +$folders=array( |
|
| 5 | 5 | 'prado' => 'Prado\\Web\\Javascripts\\source\\prado', |
| 6 | 6 | 'jquery' => 'Vendor\\bower-asset\\jquery\\dist', |
| 7 | 7 | 'jquery-ui' => 'Vendor\\bower-asset\\jquery-ui', |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | ); |
| 14 | 14 | |
| 15 | 15 | //package names and its contents (files relative to the current directory) |
| 16 | -$packages = array( |
|
| 16 | +$packages=array( |
|
| 17 | 17 | // base prado scripts |
| 18 | 18 | 'prado' => array( |
| 19 | 19 | 'prado/prado.js', |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | ); |
| 113 | 113 | |
| 114 | 114 | //package names and their dependencies |
| 115 | -$dependencies = array( |
|
| 115 | +$dependencies=array( |
|
| 116 | 116 | 'jquery' => array('jquery'), |
| 117 | 117 | 'prado' => array('jquery', 'prado'), |
| 118 | 118 | 'bootstrap' => array('jquery', 'bootstrap'), |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | */ |
| 201 | 201 | public function setActiveStep($step) |
| 202 | 202 | { |
| 203 | - if(($index=$this->getWizardSteps()->indexOf($step))<0) |
|
| 203 | + if(($index=$this->getWizardSteps()->indexOf($step)) < 0) |
|
| 204 | 204 | throw new TInvalidOperationException('wizard_step_invalid'); |
| 205 | 205 | $this->setActiveStepIndex($index); |
| 206 | 206 | } |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | public function getShowCancelButton() |
| 249 | 249 | { |
| 250 | - return $this->getViewState('ShowCancelButton',false); |
|
| 250 | + return $this->getViewState('ShowCancelButton', false); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | /** |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | */ |
| 256 | 256 | public function setShowCancelButton($value) |
| 257 | 257 | { |
| 258 | - $this->setViewState('ShowCancelButton',TPropertyValue::ensureBoolean($value),false); |
|
| 258 | + $this->setViewState('ShowCancelButton', TPropertyValue::ensureBoolean($value), false); |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | /** |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | */ |
| 264 | 264 | public function getShowSideBar() |
| 265 | 265 | { |
| 266 | - return $this->getViewState('ShowSideBar',true); |
|
| 266 | + return $this->getViewState('ShowSideBar', true); |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | /** |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | */ |
| 272 | 272 | public function setShowSideBar($value) |
| 273 | 273 | { |
| 274 | - $this->setViewState('ShowSideBar',TPropertyValue::ensureBoolean($value),true); |
|
| 274 | + $this->setViewState('ShowSideBar', TPropertyValue::ensureBoolean($value), true); |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | /** |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | */ |
| 365 | 365 | public function getHeaderText() |
| 366 | 366 | { |
| 367 | - return $this->getViewState('HeaderText',''); |
|
| 367 | + return $this->getViewState('HeaderText', ''); |
|
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | /** |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | */ |
| 373 | 373 | public function setHeaderText($value) |
| 374 | 374 | { |
| 375 | - $this->setViewState('HeaderText',TPropertyValue::ensureString($value),''); |
|
| 375 | + $this->setViewState('HeaderText', TPropertyValue::ensureString($value), ''); |
|
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | /** |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | */ |
| 382 | 382 | public function getCancelDestinationUrl() |
| 383 | 383 | { |
| 384 | - return $this->getViewState('CancelDestinationUrl',''); |
|
| 384 | + return $this->getViewState('CancelDestinationUrl', ''); |
|
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | /** |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | */ |
| 391 | 391 | public function setCancelDestinationUrl($value) |
| 392 | 392 | { |
| 393 | - $this->setViewState('CancelDestinationUrl',TPropertyValue::ensureString($value),''); |
|
| 393 | + $this->setViewState('CancelDestinationUrl', TPropertyValue::ensureString($value), ''); |
|
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | /** |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | */ |
| 400 | 400 | public function getFinishDestinationUrl() |
| 401 | 401 | { |
| 402 | - return $this->getViewState('FinishDestinationUrl',''); |
|
| 402 | + return $this->getViewState('FinishDestinationUrl', ''); |
|
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | /** |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | */ |
| 408 | 408 | public function setFinishDestinationUrl($value) |
| 409 | 409 | { |
| 410 | - $this->setViewState('FinishDestinationUrl',TPropertyValue::ensureString($value),''); |
|
| 410 | + $this->setViewState('FinishDestinationUrl', TPropertyValue::ensureString($value), ''); |
|
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | /** |
@@ -415,10 +415,10 @@ discard block |
||
| 415 | 415 | */ |
| 416 | 416 | public function getSideBarButtonStyle() |
| 417 | 417 | { |
| 418 | - if(($style=$this->getViewState('SideBarButtonStyle',null))===null) |
|
| 418 | + if(($style=$this->getViewState('SideBarButtonStyle', null))===null) |
|
| 419 | 419 | { |
| 420 | 420 | $style=new TStyle; |
| 421 | - $this->setViewState('SideBarButtonStyle',$style,null); |
|
| 421 | + $this->setViewState('SideBarButtonStyle', $style, null); |
|
| 422 | 422 | } |
| 423 | 423 | return $style; |
| 424 | 424 | } |
@@ -428,10 +428,10 @@ discard block |
||
| 428 | 428 | */ |
| 429 | 429 | public function getNavigationButtonStyle() |
| 430 | 430 | { |
| 431 | - if(($style=$this->getViewState('NavigationButtonStyle',null))===null) |
|
| 431 | + if(($style=$this->getViewState('NavigationButtonStyle', null))===null) |
|
| 432 | 432 | { |
| 433 | 433 | $style=new TStyle; |
| 434 | - $this->setViewState('NavigationButtonStyle',$style,null); |
|
| 434 | + $this->setViewState('NavigationButtonStyle', $style, null); |
|
| 435 | 435 | } |
| 436 | 436 | return $style; |
| 437 | 437 | } |
@@ -441,11 +441,11 @@ discard block |
||
| 441 | 441 | */ |
| 442 | 442 | public function getStartNextButtonStyle() |
| 443 | 443 | { |
| 444 | - if(($style=$this->getViewState('StartNextButtonStyle',null))===null) |
|
| 444 | + if(($style=$this->getViewState('StartNextButtonStyle', null))===null) |
|
| 445 | 445 | { |
| 446 | 446 | $style=new TWizardNavigationButtonStyle; |
| 447 | 447 | $style->setButtonText('Next'); |
| 448 | - $this->setViewState('StartNextButtonStyle',$style,null); |
|
| 448 | + $this->setViewState('StartNextButtonStyle', $style, null); |
|
| 449 | 449 | } |
| 450 | 450 | return $style; |
| 451 | 451 | } |
@@ -455,11 +455,11 @@ discard block |
||
| 455 | 455 | */ |
| 456 | 456 | public function getStepNextButtonStyle() |
| 457 | 457 | { |
| 458 | - if(($style=$this->getViewState('StepNextButtonStyle',null))===null) |
|
| 458 | + if(($style=$this->getViewState('StepNextButtonStyle', null))===null) |
|
| 459 | 459 | { |
| 460 | 460 | $style=new TWizardNavigationButtonStyle; |
| 461 | 461 | $style->setButtonText('Next'); |
| 462 | - $this->setViewState('StepNextButtonStyle',$style,null); |
|
| 462 | + $this->setViewState('StepNextButtonStyle', $style, null); |
|
| 463 | 463 | } |
| 464 | 464 | return $style; |
| 465 | 465 | } |
@@ -469,11 +469,11 @@ discard block |
||
| 469 | 469 | */ |
| 470 | 470 | public function getStepPreviousButtonStyle() |
| 471 | 471 | { |
| 472 | - if(($style=$this->getViewState('StepPreviousButtonStyle',null))===null) |
|
| 472 | + if(($style=$this->getViewState('StepPreviousButtonStyle', null))===null) |
|
| 473 | 473 | { |
| 474 | 474 | $style=new TWizardNavigationButtonStyle; |
| 475 | 475 | $style->setButtonText('Previous'); |
| 476 | - $this->setViewState('StepPreviousButtonStyle',$style,null); |
|
| 476 | + $this->setViewState('StepPreviousButtonStyle', $style, null); |
|
| 477 | 477 | } |
| 478 | 478 | return $style; |
| 479 | 479 | } |
@@ -483,11 +483,11 @@ discard block |
||
| 483 | 483 | */ |
| 484 | 484 | public function getFinishCompleteButtonStyle() |
| 485 | 485 | { |
| 486 | - if(($style=$this->getViewState('FinishCompleteButtonStyle',null))===null) |
|
| 486 | + if(($style=$this->getViewState('FinishCompleteButtonStyle', null))===null) |
|
| 487 | 487 | { |
| 488 | 488 | $style=new TWizardNavigationButtonStyle; |
| 489 | 489 | $style->setButtonText('Complete'); |
| 490 | - $this->setViewState('FinishCompleteButtonStyle',$style,null); |
|
| 490 | + $this->setViewState('FinishCompleteButtonStyle', $style, null); |
|
| 491 | 491 | } |
| 492 | 492 | return $style; |
| 493 | 493 | } |
@@ -497,11 +497,11 @@ discard block |
||
| 497 | 497 | */ |
| 498 | 498 | public function getFinishPreviousButtonStyle() |
| 499 | 499 | { |
| 500 | - if(($style=$this->getViewState('FinishPreviousButtonStyle',null))===null) |
|
| 500 | + if(($style=$this->getViewState('FinishPreviousButtonStyle', null))===null) |
|
| 501 | 501 | { |
| 502 | 502 | $style=new TWizardNavigationButtonStyle; |
| 503 | 503 | $style->setButtonText('Previous'); |
| 504 | - $this->setViewState('FinishPreviousButtonStyle',$style,null); |
|
| 504 | + $this->setViewState('FinishPreviousButtonStyle', $style, null); |
|
| 505 | 505 | } |
| 506 | 506 | return $style; |
| 507 | 507 | } |
@@ -511,11 +511,11 @@ discard block |
||
| 511 | 511 | */ |
| 512 | 512 | public function getCancelButtonStyle() |
| 513 | 513 | { |
| 514 | - if(($style=$this->getViewState('CancelButtonStyle',null))===null) |
|
| 514 | + if(($style=$this->getViewState('CancelButtonStyle', null))===null) |
|
| 515 | 515 | { |
| 516 | 516 | $style=new TWizardNavigationButtonStyle; |
| 517 | 517 | $style->setButtonText('Cancel'); |
| 518 | - $this->setViewState('CancelButtonStyle',$style,null); |
|
| 518 | + $this->setViewState('CancelButtonStyle', $style, null); |
|
| 519 | 519 | } |
| 520 | 520 | return $style; |
| 521 | 521 | } |
@@ -525,10 +525,10 @@ discard block |
||
| 525 | 525 | */ |
| 526 | 526 | public function getSideBarStyle() |
| 527 | 527 | { |
| 528 | - if(($style=$this->getViewState('SideBarStyle',null))===null) |
|
| 528 | + if(($style=$this->getViewState('SideBarStyle', null))===null) |
|
| 529 | 529 | { |
| 530 | 530 | $style=new TPanelStyle; |
| 531 | - $this->setViewState('SideBarStyle',$style,null); |
|
| 531 | + $this->setViewState('SideBarStyle', $style, null); |
|
| 532 | 532 | } |
| 533 | 533 | return $style; |
| 534 | 534 | } |
@@ -538,10 +538,10 @@ discard block |
||
| 538 | 538 | */ |
| 539 | 539 | public function getHeaderStyle() |
| 540 | 540 | { |
| 541 | - if(($style=$this->getViewState('HeaderStyle',null))===null) |
|
| 541 | + if(($style=$this->getViewState('HeaderStyle', null))===null) |
|
| 542 | 542 | { |
| 543 | 543 | $style=new TPanelStyle; |
| 544 | - $this->setViewState('HeaderStyle',$style,null); |
|
| 544 | + $this->setViewState('HeaderStyle', $style, null); |
|
| 545 | 545 | } |
| 546 | 546 | return $style; |
| 547 | 547 | } |
@@ -551,10 +551,10 @@ discard block |
||
| 551 | 551 | */ |
| 552 | 552 | public function getStepStyle() |
| 553 | 553 | { |
| 554 | - if(($style=$this->getViewState('StepStyle',null))===null) |
|
| 554 | + if(($style=$this->getViewState('StepStyle', null))===null) |
|
| 555 | 555 | { |
| 556 | 556 | $style=new TPanelStyle; |
| 557 | - $this->setViewState('StepStyle',$style,null); |
|
| 557 | + $this->setViewState('StepStyle', $style, null); |
|
| 558 | 558 | } |
| 559 | 559 | return $style; |
| 560 | 560 | } |
@@ -564,10 +564,10 @@ discard block |
||
| 564 | 564 | */ |
| 565 | 565 | public function getNavigationStyle() |
| 566 | 566 | { |
| 567 | - if(($style=$this->getViewState('NavigationStyle',null))===null) |
|
| 567 | + if(($style=$this->getViewState('NavigationStyle', null))===null) |
|
| 568 | 568 | { |
| 569 | 569 | $style=new TPanelStyle; |
| 570 | - $this->setViewState('NavigationStyle',$style,null); |
|
| 570 | + $this->setViewState('NavigationStyle', $style, null); |
|
| 571 | 571 | } |
| 572 | 572 | return $style; |
| 573 | 573 | } |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | */ |
| 578 | 578 | public function getUseDefaultLayout() |
| 579 | 579 | { |
| 580 | - return $this->getViewState('UseDefaultLayout',true); |
|
| 580 | + return $this->getViewState('UseDefaultLayout', true); |
|
| 581 | 581 | } |
| 582 | 582 | |
| 583 | 583 | /** |
@@ -587,7 +587,7 @@ discard block |
||
| 587 | 587 | */ |
| 588 | 588 | public function setUseDefaultLayout($value) |
| 589 | 589 | { |
| 590 | - $this->setViewState('UseDefaultLayout',TPropertyValue::ensureBoolean($value),true); |
|
| 590 | + $this->setViewState('UseDefaultLayout', TPropertyValue::ensureBoolean($value), true); |
|
| 591 | 591 | } |
| 592 | 592 | |
| 593 | 593 | /** |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | */ |
| 647 | 647 | public function onActiveStepChanged($param) |
| 648 | 648 | { |
| 649 | - $this->raiseEvent('OnActiveStepChanged',$this,$param); |
|
| 649 | + $this->raiseEvent('OnActiveStepChanged', $this, $param); |
|
| 650 | 650 | } |
| 651 | 651 | |
| 652 | 652 | /** |
@@ -657,7 +657,7 @@ discard block |
||
| 657 | 657 | */ |
| 658 | 658 | public function onCancelButtonClick($param) |
| 659 | 659 | { |
| 660 | - $this->raiseEvent('OnCancelButtonClick',$this,$param); |
|
| 660 | + $this->raiseEvent('OnCancelButtonClick', $this, $param); |
|
| 661 | 661 | if(($url=$this->getCancelDestinationUrl())!=='') |
| 662 | 662 | $this->getResponse()->redirect($url); |
| 663 | 663 | } |
@@ -670,7 +670,7 @@ discard block |
||
| 670 | 670 | */ |
| 671 | 671 | public function onCompleteButtonClick($param) |
| 672 | 672 | { |
| 673 | - $this->raiseEvent('OnCompleteButtonClick',$this,$param); |
|
| 673 | + $this->raiseEvent('OnCompleteButtonClick', $this, $param); |
|
| 674 | 674 | if(($url=$this->getFinishDestinationUrl())!=='') |
| 675 | 675 | $this->getResponse()->redirect($url); |
| 676 | 676 | } |
@@ -683,7 +683,7 @@ discard block |
||
| 683 | 683 | */ |
| 684 | 684 | public function onNextButtonClick($param) |
| 685 | 685 | { |
| 686 | - $this->raiseEvent('OnNextButtonClick',$this,$param); |
|
| 686 | + $this->raiseEvent('OnNextButtonClick', $this, $param); |
|
| 687 | 687 | } |
| 688 | 688 | |
| 689 | 689 | /** |
@@ -694,7 +694,7 @@ discard block |
||
| 694 | 694 | */ |
| 695 | 695 | public function onPreviousButtonClick($param) |
| 696 | 696 | { |
| 697 | - $this->raiseEvent('OnPreviousButtonClick',$this,$param); |
|
| 697 | + $this->raiseEvent('OnPreviousButtonClick', $this, $param); |
|
| 698 | 698 | } |
| 699 | 699 | |
| 700 | 700 | /** |
@@ -704,7 +704,7 @@ discard block |
||
| 704 | 704 | */ |
| 705 | 705 | public function onSideBarButtonClick($param) |
| 706 | 706 | { |
| 707 | - $this->raiseEvent('OnSideBarButtonClick',$this,$param); |
|
| 707 | + $this->raiseEvent('OnSideBarButtonClick', $this, $param); |
|
| 708 | 708 | } |
| 709 | 709 | |
| 710 | 710 | /** |
@@ -718,7 +718,7 @@ discard block |
||
| 718 | 718 | { |
| 719 | 719 | $this->_multiView=new TMultiView; |
| 720 | 720 | $this->_multiView->setID('WizardMultiView'); |
| 721 | - $this->_multiView->attachEventHandler('OnActiveViewChanged',array($this,'onActiveStepChanged')); |
|
| 721 | + $this->_multiView->attachEventHandler('OnActiveViewChanged', array($this, 'onActiveStepChanged')); |
|
| 722 | 722 | $this->_multiView->ignoreBubbleEvents(); |
| 723 | 723 | } |
| 724 | 724 | return $this->_multiView; |
@@ -760,7 +760,7 @@ discard block |
||
| 760 | 760 | parent::onInit($param); |
| 761 | 761 | $this->ensureChildControls(); |
| 762 | 762 | $this->setEnsureId(true); |
| 763 | - if($this->getActiveStepIndex()<0 && $this->getWizardSteps()->getCount()>0) |
|
| 763 | + if($this->getActiveStepIndex() < 0 && $this->getWizardSteps()->getCount() > 0) |
|
| 764 | 764 | $this->setActiveStepIndex(0); |
| 765 | 765 | } |
| 766 | 766 | |
@@ -836,7 +836,7 @@ discard block |
||
| 836 | 836 | */ |
| 837 | 837 | protected function applyHeaderProperties() |
| 838 | 838 | { |
| 839 | - if(($style=$this->getViewState('HeaderStyle',null))!==null) |
|
| 839 | + if(($style=$this->getViewState('HeaderStyle', null))!==null) |
|
| 840 | 840 | $this->_header->getStyle()->mergeWith($style); |
| 841 | 841 | if($this->getHeaderTemplate()===null) |
| 842 | 842 | { |
@@ -856,7 +856,7 @@ discard block |
||
| 856 | 856 | $this->_sideBarDataList->setDataSource($this->getWizardSteps()); |
| 857 | 857 | $this->_sideBarDataList->setSelectedItemIndex($this->getActiveStepIndex()); |
| 858 | 858 | $this->_sideBarDataList->dataBind(); |
| 859 | - if(($style=$this->getViewState('SideBarButtonStyle',null))!==null) |
|
| 859 | + if(($style=$this->getViewState('SideBarButtonStyle', null))!==null) |
|
| 860 | 860 | { |
| 861 | 861 | foreach($this->_sideBarDataList->getItems() as $item) |
| 862 | 862 | { |
@@ -865,7 +865,7 @@ discard block |
||
| 865 | 865 | } |
| 866 | 866 | } |
| 867 | 867 | } |
| 868 | - if(($style=$this->getViewState('SideBarStyle',null))!==null) |
|
| 868 | + if(($style=$this->getViewState('SideBarStyle', null))!==null) |
|
| 869 | 869 | $this->_sideBar->getStyle()->mergeWith($style); |
| 870 | 870 | } |
| 871 | 871 | |
@@ -874,7 +874,7 @@ discard block |
||
| 874 | 874 | */ |
| 875 | 875 | protected function applyStepContentProperties() |
| 876 | 876 | { |
| 877 | - if(($style=$this->getViewState('StepStyle',null))!==null) |
|
| 877 | + if(($style=$this->getViewState('StepStyle', null))!==null) |
|
| 878 | 878 | $this->_stepContent->getStyle()->mergeWith($style); |
| 879 | 879 | } |
| 880 | 880 | |
@@ -889,7 +889,7 @@ discard block |
||
| 889 | 889 | |
| 890 | 890 | if(!$this->_navigation) |
| 891 | 891 | return; |
| 892 | - else if($activeStepIndex<0 || $activeStepIndex>=$wizardSteps->getCount()) |
|
| 892 | + else if($activeStepIndex < 0 || $activeStepIndex >= $wizardSteps->getCount()) |
|
| 893 | 893 | { |
| 894 | 894 | $this->_navigation->setVisible(false); |
| 895 | 895 | return; |
@@ -920,12 +920,12 @@ discard block |
||
| 920 | 920 | $this->_stepNavigation->setVisible($showStandard && $activeStepType===TWizardStepType::Step); |
| 921 | 921 | $this->_finishNavigation->setVisible($showStandard && $activeStepType===TWizardStepType::Finish); |
| 922 | 922 | |
| 923 | - if(($navigationStyle=$this->getViewState('NavigationStyle',null))!==null) |
|
| 923 | + if(($navigationStyle=$this->getViewState('NavigationStyle', null))!==null) |
|
| 924 | 924 | $this->_navigation->getStyle()->mergeWith($navigationStyle); |
| 925 | 925 | |
| 926 | 926 | $displayCancelButton=$this->getShowCancelButton(); |
| 927 | 927 | $cancelButtonStyle=$this->getCancelButtonStyle(); |
| 928 | - $buttonStyle=$this->getViewState('NavigationButtonStyle',null); |
|
| 928 | + $buttonStyle=$this->getViewState('NavigationButtonStyle', null); |
|
| 929 | 929 | if($buttonStyle!==null) |
| 930 | 930 | $cancelButtonStyle->mergeWith($buttonStyle); |
| 931 | 931 | |
@@ -1002,10 +1002,10 @@ discard block |
||
| 1002 | 1002 | */ |
| 1003 | 1003 | protected function getHistory() |
| 1004 | 1004 | { |
| 1005 | - if(($history=$this->getControlState('History',null))===null) |
|
| 1005 | + if(($history=$this->getControlState('History', null))===null) |
|
| 1006 | 1006 | { |
| 1007 | 1007 | $history=new TStack; |
| 1008 | - $this->setControlState('History',$history); |
|
| 1008 | + $this->setControlState('History', $history); |
|
| 1009 | 1009 | } |
| 1010 | 1010 | return $history; |
| 1011 | 1011 | } |
@@ -1020,14 +1020,14 @@ discard block |
||
| 1020 | 1020 | if(($type=$wizardStep->getStepType())===TWizardStepType::Auto) |
| 1021 | 1021 | { |
| 1022 | 1022 | $steps=$this->getWizardSteps(); |
| 1023 | - if(($index=$steps->indexOf($wizardStep))>=0) |
|
| 1023 | + if(($index=$steps->indexOf($wizardStep)) >= 0) |
|
| 1024 | 1024 | { |
| 1025 | 1025 | $stepCount=$steps->getCount(); |
| 1026 | - if($stepCount===1 || ($index<$stepCount-1 && $steps->itemAt($index+1)->getStepType()===TWizardStepType::Complete)) |
|
| 1026 | + if($stepCount===1 || ($index < $stepCount - 1 && $steps->itemAt($index + 1)->getStepType()===TWizardStepType::Complete)) |
|
| 1027 | 1027 | return TWizardStepType::Finish; |
| 1028 | 1028 | else if($index===0) |
| 1029 | 1029 | return TWizardStepType::Start; |
| 1030 | - else if($index===$stepCount-1) |
|
| 1030 | + else if($index===$stepCount - 1) |
|
| 1031 | 1031 | return TWizardStepType::Finish; |
| 1032 | 1032 | else |
| 1033 | 1033 | return TWizardStepType::Step; |
@@ -1096,8 +1096,8 @@ discard block |
||
| 1096 | 1096 | |
| 1097 | 1097 | if(($this->_sideBarDataList=$this->_sideBar->findControl(self::ID_SIDEBAR_LIST))!==null) |
| 1098 | 1098 | { |
| 1099 | - $this->_sideBarDataList->attachEventHandler('OnItemCommand',array($this,'dataListItemCommand')); |
|
| 1100 | - $this->_sideBarDataList->attachEventHandler('OnItemDataBound',array($this,'dataListItemDataBound')); |
|
| 1099 | + $this->_sideBarDataList->attachEventHandler('OnItemCommand', array($this, 'dataListItemCommand')); |
|
| 1100 | + $this->_sideBarDataList->attachEventHandler('OnItemDataBound', array($this, 'dataListItemDataBound')); |
|
| 1101 | 1101 | $this->_sideBarDataList->setDataSource($this->getWizardSteps()); |
| 1102 | 1102 | $this->_sideBarDataList->setSelectedItemIndex($this->getActiveStepIndex()); |
| 1103 | 1103 | $this->_sideBarDataList->dataBind(); |
@@ -1117,7 +1117,7 @@ discard block |
||
| 1117 | 1117 | * @param mixed sender of the event |
| 1118 | 1118 | * @param TDataListCommandEventParameter |
| 1119 | 1119 | */ |
| 1120 | - public function dataListItemCommand($sender,$param) |
|
| 1120 | + public function dataListItemCommand($sender, $param) |
|
| 1121 | 1121 | { |
| 1122 | 1122 | $item=$param->getItem(); |
| 1123 | 1123 | if($param->getCommandName()===self::CMD_MOVETO) |
@@ -1153,7 +1153,7 @@ discard block |
||
| 1153 | 1153 | * @param mixed sender of the event |
| 1154 | 1154 | * @param TDataListItemEventParameter |
| 1155 | 1155 | */ |
| 1156 | - public function dataListItemDataBound($sender,$param) |
|
| 1156 | + public function dataListItemDataBound($sender, $param) |
|
| 1157 | 1157 | { |
| 1158 | 1158 | $item=$param->getItem(); |
| 1159 | 1159 | $itemType=$item->getItemType(); |
@@ -1276,20 +1276,20 @@ discard block |
||
| 1276 | 1276 | protected function getPreviousStepIndex($popStack) |
| 1277 | 1277 | { |
| 1278 | 1278 | $history=$this->getHistory(); |
| 1279 | - if($history->getCount()>=0) |
|
| 1279 | + if($history->getCount() >= 0) |
|
| 1280 | 1280 | { |
| 1281 | 1281 | $activeStepIndex=$this->getActiveStepIndex(); |
| 1282 | 1282 | $previousStepIndex=-1; |
| 1283 | 1283 | if($popStack) |
| 1284 | 1284 | { |
| 1285 | 1285 | $previousStepIndex=$history->pop(); |
| 1286 | - if($activeStepIndex===$previousStepIndex && $history->getCount()>0) |
|
| 1286 | + if($activeStepIndex===$previousStepIndex && $history->getCount() > 0) |
|
| 1287 | 1287 | $previousStepIndex=$history->pop(); |
| 1288 | 1288 | } |
| 1289 | 1289 | else |
| 1290 | 1290 | { |
| 1291 | 1291 | $previousStepIndex=$history->peek(); |
| 1292 | - if($activeStepIndex===$previousStepIndex && $history->getCount()>1) |
|
| 1292 | + if($activeStepIndex===$previousStepIndex && $history->getCount() > 1) |
|
| 1293 | 1293 | { |
| 1294 | 1294 | $saveIndex=$history->pop(); |
| 1295 | 1295 | $previousStepIndex=$history->peek(); |
@@ -1333,12 +1333,12 @@ discard block |
||
| 1333 | 1333 | * @param TEventParameter event parameter |
| 1334 | 1334 | * @throws TInvalidDataValueException if a navigation command is associated with an invalid parameter |
| 1335 | 1335 | */ |
| 1336 | - public function bubbleEvent($sender,$param) |
|
| 1336 | + public function bubbleEvent($sender, $param) |
|
| 1337 | 1337 | { |
| 1338 | 1338 | if($param instanceof \Prado\Web\UI\TCommandEventParameter) |
| 1339 | 1339 | { |
| 1340 | 1340 | $command=$param->getCommandName(); |
| 1341 | - if(strcasecmp($command,self::CMD_CANCEL)===0) |
|
| 1341 | + if(strcasecmp($command, self::CMD_CANCEL)===0) |
|
| 1342 | 1342 | { |
| 1343 | 1343 | $this->onCancelButtonClick($param); |
| 1344 | 1344 | return true; |
@@ -1354,49 +1354,49 @@ discard block |
||
| 1354 | 1354 | $movePrev=false; |
| 1355 | 1355 | $this->_activeStepIndexSet=false; |
| 1356 | 1356 | |
| 1357 | - if(strcasecmp($command,self::CMD_NEXT)===0) |
|
| 1357 | + if(strcasecmp($command, self::CMD_NEXT)===0) |
|
| 1358 | 1358 | { |
| 1359 | 1359 | if($type!==TWizardStepType::Start && $type!==TWizardStepType::Step) |
| 1360 | - throw new TInvalidDataValueException('wizard_command_invalid',self::CMD_NEXT); |
|
| 1361 | - if($index<$this->getWizardSteps()->getCount()-1) |
|
| 1362 | - $navParam->setNextStepIndex($index+1); |
|
| 1360 | + throw new TInvalidDataValueException('wizard_command_invalid', self::CMD_NEXT); |
|
| 1361 | + if($index < $this->getWizardSteps()->getCount() - 1) |
|
| 1362 | + $navParam->setNextStepIndex($index + 1); |
|
| 1363 | 1363 | $this->onNextButtonClick($navParam); |
| 1364 | 1364 | $handled=true; |
| 1365 | 1365 | } |
| 1366 | - else if(strcasecmp($command,self::CMD_PREVIOUS)===0) |
|
| 1366 | + else if(strcasecmp($command, self::CMD_PREVIOUS)===0) |
|
| 1367 | 1367 | { |
| 1368 | 1368 | if($type!==TWizardStepType::Finish && $type!==TWizardStepType::Step) |
| 1369 | - throw new TInvalidDataValueException('wizard_command_invalid',self::CMD_PREVIOUS); |
|
| 1369 | + throw new TInvalidDataValueException('wizard_command_invalid', self::CMD_PREVIOUS); |
|
| 1370 | 1370 | $movePrev=true; |
| 1371 | - if(($prevIndex=$this->getPreviousStepIndex(false))>=0) |
|
| 1371 | + if(($prevIndex=$this->getPreviousStepIndex(false)) >= 0) |
|
| 1372 | 1372 | $navParam->setNextStepIndex($prevIndex); |
| 1373 | 1373 | $this->onPreviousButtonClick($navParam); |
| 1374 | 1374 | $handled=true; |
| 1375 | 1375 | } |
| 1376 | - else if(strcasecmp($command,self::CMD_COMPLETE)===0) |
|
| 1376 | + else if(strcasecmp($command, self::CMD_COMPLETE)===0) |
|
| 1377 | 1377 | { |
| 1378 | 1378 | if($type!==TWizardStepType::Finish) |
| 1379 | - throw new TInvalidDataValueException('wizard_command_invalid',self::CMD_COMPLETE); |
|
| 1380 | - if($index<$this->getWizardSteps()->getCount()-1) |
|
| 1381 | - $navParam->setNextStepIndex($index+1); |
|
| 1379 | + throw new TInvalidDataValueException('wizard_command_invalid', self::CMD_COMPLETE); |
|
| 1380 | + if($index < $this->getWizardSteps()->getCount() - 1) |
|
| 1381 | + $navParam->setNextStepIndex($index + 1); |
|
| 1382 | 1382 | $this->onCompleteButtonClick($navParam); |
| 1383 | 1383 | $handled=true; |
| 1384 | 1384 | } |
| 1385 | - else if(strcasecmp($command,self::CMD_MOVETO)===0) |
|
| 1385 | + else if(strcasecmp($command, self::CMD_MOVETO)===0) |
|
| 1386 | 1386 | { |
| 1387 | 1387 | if($this->_cancelNavigation) // may be set in onSideBarButtonClick |
| 1388 | 1388 | $navParam->setCancelNavigation(true); |
| 1389 | 1389 | $requestedStep=$param->getCommandParameter(); |
| 1390 | - if (!is_numeric($requestedStep)) |
|
| 1390 | + if(!is_numeric($requestedStep)) |
|
| 1391 | 1391 | { |
| 1392 | 1392 | $requestedIndex=-1; |
| 1393 | - foreach ($this->getWizardSteps() as $index=>$step) |
|
| 1394 | - if ($step->getId()===$requestedStep) |
|
| 1393 | + foreach($this->getWizardSteps() as $index=>$step) |
|
| 1394 | + if($step->getId()===$requestedStep) |
|
| 1395 | 1395 | { |
| 1396 | 1396 | $requestedIndex=$index; |
| 1397 | 1397 | break; |
| 1398 | 1398 | } |
| 1399 | - if ($requestedIndex<0) |
|
| 1399 | + if($requestedIndex < 0) |
|
| 1400 | 1400 | throw new TConfigurationException('wizard_step_invalid'); |
| 1401 | 1401 | } |
| 1402 | 1402 | else |
@@ -1413,7 +1413,7 @@ discard block |
||
| 1413 | 1413 | if(!$this->_activeStepIndexSet && $this->allowNavigationToStep($nextStepIndex)) |
| 1414 | 1414 | { |
| 1415 | 1415 | if($movePrev) |
| 1416 | - $this->getPreviousStepIndex(true); // pop out the previous move from history |
|
| 1416 | + $this->getPreviousStepIndex(true); // pop out the previous move from history |
|
| 1417 | 1417 | $this->setActiveStepIndex($nextStepIndex); |
| 1418 | 1418 | } |
| 1419 | 1419 | } |
@@ -41,22 +41,22 @@ discard block |
||
| 41 | 41 | { |
| 42 | 42 | if($this->getApplication()->getMode()===TApplicationMode::Debug) |
| 43 | 43 | { |
| 44 | - $response = $this->getApplication()->getResponse(); |
|
| 45 | - $trace = $this->getExceptionStackTrace($exception); |
|
| 44 | + $response=$this->getApplication()->getResponse(); |
|
| 45 | + $trace=$this->getExceptionStackTrace($exception); |
|
| 46 | 46 | // avoid error on non-utf8 strings |
| 47 | 47 | try { |
| 48 | - $trace = TJavaScript::jsonEncode($trace); |
|
| 49 | - } catch (Exception $e) { |
|
| 48 | + $trace=TJavaScript::jsonEncode($trace); |
|
| 49 | + } catch(Exception $e) { |
|
| 50 | 50 | // strip everythin not 7bit ascii |
| 51 | - $trace = preg_replace('/[^(\x20-\x7F)]*/','', serialize($trace)); |
|
| 51 | + $trace=preg_replace('/[^(\x20-\x7F)]*/', '', serialize($trace)); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | // avoid exception loop if headers have already been sent |
| 55 | 55 | try { |
| 56 | 56 | $response->setStatusCode(500, 'Internal Server Error'); |
| 57 | - } catch (Exception $e) { } |
|
| 57 | + } catch(Exception $e) { } |
|
| 58 | 58 | |
| 59 | - $content = $response->createHtmlWriter(); |
|
| 59 | + $content=$response->createHtmlWriter(); |
|
| 60 | 60 | $content->getWriter()->setBoundary(TActivePageAdapter::CALLBACK_ERROR_HEADER); |
| 61 | 61 | $content->write($trace); |
| 62 | 62 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $data['type']=get_class($exception); |
| 92 | 92 | $data['message']=$exception->getMessage(); |
| 93 | 93 | $data['version']=$_SERVER['SERVER_SOFTWARE'].' '.Prado::getVersion(); |
| 94 | - $data['time']=@strftime('%Y-%m-%d %H:%M',time()); |
|
| 94 | + $data['time']=@strftime('%Y-%m-%d %H:%M', time()); |
|
| 95 | 95 | return $data; |
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | \ No newline at end of file |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function getWidgetID() |
| 74 | 74 | { |
| 75 | - return $this->getClientID() . '_0'; |
|
| 75 | + return $this->getClientID().'_0'; |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function getOptions() |
| 83 | 83 | { |
| 84 | - if (($options=$this->getViewState('JuiOptions'))===null) |
|
| 84 | + if(($options=$this->getViewState('JuiOptions'))===null) |
|
| 85 | 85 | { |
| 86 | 86 | $options=new TJuiControlOptions($this); |
| 87 | 87 | $this->setViewState('JuiOptions', $options); |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | protected function getPostBackOptions() |
| 114 | 114 | { |
| 115 | - $options = $this->getOptions()->toArray(); |
|
| 115 | + $options=$this->getOptions()->toArray(); |
|
| 116 | 116 | // overload the "OnStop" event to add information about the current selected items |
| 117 | 117 | if(isset($options['stop'])) |
| 118 | 118 | { |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | protected function addAttributesToRender($writer) |
| 129 | 129 | { |
| 130 | 130 | parent::addAttributesToRender($writer); |
| 131 | - $writer->addAttribute('id',$this->getClientID()); |
|
| 131 | + $writer->addAttribute('id', $this->getClientID()); |
|
| 132 | 132 | $options=TJavaScript::encode($this->getPostBackOptions()); |
| 133 | 133 | $cs=$this->getPage()->getClientScript(); |
| 134 | 134 | $code="jQuery('#".$this->getWidgetID()."').".$this->getWidget()."(".$options.");"; |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | * Raises the OnCreate event |
| 150 | 150 | * @param object $params event parameters |
| 151 | 151 | */ |
| 152 | - public function onCreate ($params) |
|
| 152 | + public function onCreate($params) |
|
| 153 | 153 | { |
| 154 | 154 | $this->raiseEvent('OnCreate', $this, $params); |
| 155 | 155 | } |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * Raises the OnSelected event |
| 159 | 159 | * @param object $params event parameters |
| 160 | 160 | */ |
| 161 | - public function onSelected ($params) |
|
| 161 | + public function onSelected($params) |
|
| 162 | 162 | { |
| 163 | 163 | $this->raiseEvent('OnSelected', $this, $params); |
| 164 | 164 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | * Raises the OnSelecting event |
| 168 | 168 | * @param object $params event parameters |
| 169 | 169 | */ |
| 170 | - public function onSelecting ($params) |
|
| 170 | + public function onSelecting($params) |
|
| 171 | 171 | { |
| 172 | 172 | $this->raiseEvent('OnSelecting', $this, $params); |
| 173 | 173 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | * Raises the OnStart event |
| 177 | 177 | * @param object $params event parameters |
| 178 | 178 | */ |
| 179 | - public function onStart ($params) |
|
| 179 | + public function onStart($params) |
|
| 180 | 180 | { |
| 181 | 181 | $this->raiseEvent('OnStart', $this, $params); |
| 182 | 182 | } |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | * Raises the OnStop event |
| 186 | 186 | * @param object $params event parameters |
| 187 | 187 | */ |
| 188 | - public function onStop ($params) |
|
| 188 | + public function onStop($params) |
|
| 189 | 189 | { |
| 190 | 190 | $this->raiseEvent('OnStop', $this, $params); |
| 191 | 191 | } |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | * Raises the OnUnselected event |
| 195 | 195 | * @param object $params event parameters |
| 196 | 196 | */ |
| 197 | - public function onUnselected ($params) |
|
| 197 | + public function onUnselected($params) |
|
| 198 | 198 | { |
| 199 | 199 | $this->raiseEvent('OnUnselected', $this, $params); |
| 200 | 200 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | * Raises the OnUnselecting event |
| 204 | 204 | * @param object $params event parameters |
| 205 | 205 | */ |
| 206 | - public function onUnselecting ($params) |
|
| 206 | + public function onUnselecting($params) |
|
| 207 | 207 | { |
| 208 | 208 | $this->raiseEvent('OnUnselecting', $this, $params); |
| 209 | 209 | } |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | public function getSelectables() |
| 239 | 239 | { |
| 240 | 240 | if($this->_repeater===null) |
| 241 | - $this->_repeater = $this->createRepeater(); |
|
| 241 | + $this->_repeater=$this->createRepeater(); |
|
| 242 | 242 | return $this->_repeater; |
| 243 | 243 | } |
| 244 | 244 | |
@@ -247,10 +247,10 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | protected function createRepeater() |
| 249 | 249 | { |
| 250 | - $repeater = new TRepeater; |
|
| 250 | + $repeater=new TRepeater; |
|
| 251 | 251 | $repeater->setHeaderTemplate(new TJuiSelectableTemplate('<ul id="'.$this->getWidgetID().'">')); |
| 252 | 252 | $repeater->setFooterTemplate(new TJuiSelectableTemplate('</ul>')); |
| 253 | - $repeater->setItemTemplate(new TTemplate('<li id="<%# $this->ItemIndex %>"><%# $this->Data %></li>',null)); |
|
| 253 | + $repeater->setItemTemplate(new TTemplate('<li id="<%# $this->ItemIndex %>"><%# $this->Data %></li>', null)); |
|
| 254 | 254 | $repeater->setEmptyTemplate(new TJuiSelectableTemplate('<ul></ul>')); |
| 255 | 255 | $this->getControls()->add($repeater); |
| 256 | 256 | return $repeater; |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | public function setRecordPk($value) |
| 91 | 91 | { |
| 92 | 92 | $this->clearRecordObject(); |
| 93 | - $val = TPropertyValue::ensureArray($value); |
|
| 93 | + $val=TPropertyValue::ensureArray($value); |
|
| 94 | 94 | $this->setViewState('PK', count($val) > 0 ? $val : null); |
| 95 | 95 | } |
| 96 | 96 | |
@@ -115,11 +115,11 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | public function initializeEditForm() |
| 117 | 117 | { |
| 118 | - $record = $this->getCurrentRecord(); |
|
| 119 | - $classPath = $this->getEditRenderer(); |
|
| 120 | - if($classPath === '') |
|
| 118 | + $record=$this->getCurrentRecord(); |
|
| 119 | + $classPath=$this->getEditRenderer(); |
|
| 120 | + if($classPath==='') |
|
| 121 | 121 | { |
| 122 | - $columns = $this->getTableInfo()->getColumns(); |
|
| 122 | + $columns=$this->getTableInfo()->getColumns(); |
|
| 123 | 123 | $this->getInputRepeater()->setDataSource($columns); |
| 124 | 124 | $this->getInputRepeater()->dataBind(); |
| 125 | 125 | } |
@@ -141,11 +141,11 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | protected function createEditRenderer($record, $classPath) |
| 143 | 143 | { |
| 144 | - $this->_editRenderer = Prado::createComponent($classPath); |
|
| 144 | + $this->_editRenderer=Prado::createComponent($classPath); |
|
| 145 | 145 | if($this->_editRenderer instanceof IScaffoldEditRenderer) |
| 146 | 146 | { |
| 147 | - $index = $this->getControls()->remove($this->getInputRepeater()); |
|
| 148 | - $this->getControls()->insertAt($index,$this->_editRenderer); |
|
| 147 | + $index=$this->getControls()->remove($this->getInputRepeater()); |
|
| 148 | + $this->getControls()->insertAt($index, $this->_editRenderer); |
|
| 149 | 149 | $this->_editRenderer->setData($record); |
| 150 | 150 | } |
| 151 | 151 | else |
@@ -160,16 +160,16 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | protected function createRepeaterEditItem($sender, $param) |
| 162 | 162 | { |
| 163 | - $type = $param->getItem()->getItemType(); |
|
| 163 | + $type=$param->getItem()->getItemType(); |
|
| 164 | 164 | if($type==TListItemType::Item || $type==TListItemType::AlternatingItem) |
| 165 | 165 | { |
| 166 | - $item = $param->getItem(); |
|
| 167 | - $column = $item->getData(); |
|
| 166 | + $item=$param->getItem(); |
|
| 167 | + $column=$item->getData(); |
|
| 168 | 168 | if($column===null) |
| 169 | 169 | return; |
| 170 | 170 | |
| 171 | - $record = $this->getCurrentRecord(); |
|
| 172 | - $builder = $this->getScaffoldInputBuilder($record); |
|
| 171 | + $record=$this->getCurrentRecord(); |
|
| 172 | + $builder=$this->getScaffoldInputBuilder($record); |
|
| 173 | 173 | $builder->createScaffoldInput($this, $item, $column, $record); |
| 174 | 174 | } |
| 175 | 175 | } |
@@ -201,14 +201,14 @@ discard block |
||
| 201 | 201 | { |
| 202 | 202 | if($this->getPage()->getIsValid()) |
| 203 | 203 | { |
| 204 | - $record = $this->getCurrentRecord(); |
|
| 204 | + $record=$this->getCurrentRecord(); |
|
| 205 | 205 | if($this->_editRenderer===null) |
| 206 | 206 | { |
| 207 | - $table = $this->getTableInfo(); |
|
| 208 | - $builder = $this->getScaffoldInputBuilder($record); |
|
| 207 | + $table=$this->getTableInfo(); |
|
| 208 | + $builder=$this->getScaffoldInputBuilder($record); |
|
| 209 | 209 | foreach($this->getInputRepeater()->getItems() as $item) |
| 210 | 210 | { |
| 211 | - $column = $table->getColumn($item->getCustomData()); |
|
| 211 | + $column=$table->getColumn($item->getCustomData()); |
|
| 212 | 212 | $builder->loadScaffoldInput($this, $item, $column, $record); |
| 213 | 213 | } |
| 214 | 214 | } |
@@ -272,10 +272,10 @@ discard block |
||
| 272 | 272 | protected function getScaffoldInputBuilder($record) |
| 273 | 273 | { |
| 274 | 274 | static $_builders=array(); |
| 275 | - $class = get_class($record); |
|
| 275 | + $class=get_class($record); |
|
| 276 | 276 | if(!isset($_builders[$class])) |
| 277 | 277 | { |
| 278 | - $_builders[$class] = TScaffoldInputBase::createInputBuilder($record); |
|
| 278 | + $_builders[$class]=TScaffoldInputBase::createInputBuilder($record); |
|
| 279 | 279 | } |
| 280 | 280 | return $_builders[$class]; |
| 281 | 281 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | /** |
| 108 | 108 | * Configuration file type, application.xml and config.xml |
| 109 | 109 | */ |
| 110 | - const CONFIG_TYPE_XML = 'xml'; |
|
| 110 | + const CONFIG_TYPE_XML='xml'; |
|
| 111 | 111 | /** |
| 112 | 112 | * Application configuration file name |
| 113 | 113 | */ |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | /** |
| 120 | 120 | * Configuration file type, application.php and config.php |
| 121 | 121 | */ |
| 122 | - const CONFIG_TYPE_PHP = 'php'; |
|
| 122 | + const CONFIG_TYPE_PHP='php'; |
|
| 123 | 123 | /** |
| 124 | 124 | * Runtime directory name |
| 125 | 125 | */ |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | /** |
| 273 | 273 | * @var string Customizable page service ID |
| 274 | 274 | */ |
| 275 | - private $_pageServiceID = self::PAGE_SERVICE_ID; |
|
| 275 | + private $_pageServiceID=self::PAGE_SERVICE_ID; |
|
| 276 | 276 | |
| 277 | 277 | /** |
| 278 | 278 | * Constructor. |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | * @param boolean whether to cache application configuration. Defaults to true. |
| 293 | 293 | * @throws TConfigurationException if configuration file cannot be read or the runtime path is invalid. |
| 294 | 294 | */ |
| 295 | - public function __construct($basePath='protected',$cacheConfig=true, $configType=self::CONFIG_TYPE_XML) |
|
| 295 | + public function __construct($basePath='protected', $cacheConfig=true, $configType=self::CONFIG_TYPE_XML) |
|
| 296 | 296 | { |
| 297 | 297 | // register application as a singleton |
| 298 | 298 | Prado::setApplication($this); |
@@ -305,9 +305,9 @@ discard block |
||
| 305 | 305 | // generates unique ID by hashing the runtime path |
| 306 | 306 | $this->_uniqueID=md5($this->_runtimePath); |
| 307 | 307 | $this->_parameters=new \Prado\Collections\TMap; |
| 308 | - $this->_services=array($this->getPageServiceID()=>array('TPageService',array(),null)); |
|
| 308 | + $this->_services=array($this->getPageServiceID()=>array('TPageService', array(), null)); |
|
| 309 | 309 | |
| 310 | - Prado::setPathOfAlias('Application',$this->_basePath); |
|
| 310 | + Prado::setPathOfAlias('Application', $this->_basePath); |
|
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | /** |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | { |
| 325 | 325 | // determine configuration path and file |
| 326 | 326 | if(empty($basePath) || ($basePath=realpath($basePath))===false) |
| 327 | - throw new TConfigurationException('application_basepath_invalid',$basePath); |
|
| 327 | + throw new TConfigurationException('application_basepath_invalid', $basePath); |
|
| 328 | 328 | if(is_dir($basePath) && is_file($basePath.DIRECTORY_SEPARATOR.$this->getConfigurationFileName())) |
| 329 | 329 | $configFile=$basePath.DIRECTORY_SEPARATOR.$this->getConfigurationFileName(); |
| 330 | 330 | else if(is_file($basePath)) |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | if(!is_dir($runtimePath)) |
| 346 | 346 | { |
| 347 | 347 | if(@mkdir($runtimePath)===false) |
| 348 | - throw new TConfigurationException('application_runtimepath_failed',$runtimePath); |
|
| 348 | + throw new TConfigurationException('application_runtimepath_failed', $runtimePath); |
|
| 349 | 349 | @chmod($runtimePath, PRADO_CHMOD); //make it deletable |
| 350 | 350 | } |
| 351 | 351 | $this->setConfigurationFile($configFile); |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | $this->setRuntimePath($runtimePath); |
| 355 | 355 | } |
| 356 | 356 | else |
| 357 | - throw new TConfigurationException('application_runtimepath_invalid',$runtimePath); |
|
| 357 | + throw new TConfigurationException('application_runtimepath_invalid', $runtimePath); |
|
| 358 | 358 | |
| 359 | 359 | } |
| 360 | 360 | |
@@ -371,14 +371,14 @@ discard block |
||
| 371 | 371 | $n=count(self::$_steps); |
| 372 | 372 | $this->_step=0; |
| 373 | 373 | $this->_requestCompleted=false; |
| 374 | - while($this->_step<$n) |
|
| 374 | + while($this->_step < $n) |
|
| 375 | 375 | { |
| 376 | 376 | if($this->_mode===TApplicationMode::Off) |
| 377 | - throw new THttpException(503,'application_unavailable'); |
|
| 377 | + throw new THttpException(503, 'application_unavailable'); |
|
| 378 | 378 | if($this->_requestCompleted) |
| 379 | 379 | break; |
| 380 | 380 | $method=self::$_steps[$this->_step]; |
| 381 | - Prado::trace("Executing $method()",'Prado\TApplication'); |
|
| 381 | + Prado::trace("Executing $method()", 'Prado\TApplication'); |
|
| 382 | 382 | $this->$method(); |
| 383 | 383 | $this->_step++; |
| 384 | 384 | } |
@@ -416,9 +416,9 @@ discard block |
||
| 416 | 416 | * @param mixed the default value. If $key is not found, $defaultValue will be returned |
| 417 | 417 | * @return mixed the global value corresponding to $key |
| 418 | 418 | */ |
| 419 | - public function getGlobalState($key,$defaultValue=null) |
|
| 419 | + public function getGlobalState($key, $defaultValue=null) |
|
| 420 | 420 | { |
| 421 | - return isset($this->_globals[$key])?$this->_globals[$key]:$defaultValue; |
|
| 421 | + return isset($this->_globals[$key]) ? $this->_globals[$key] : $defaultValue; |
|
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | /** |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | * @param mixed the default value. If $key is not found, $defaultValue will be returned |
| 432 | 432 | * @param boolean wheter to force an immediate GlobalState save. defaults to false |
| 433 | 433 | */ |
| 434 | - public function setGlobalState($key,$value,$defaultValue=null,$forceSave=false) |
|
| 434 | + public function setGlobalState($key, $value, $defaultValue=null, $forceSave=false) |
|
| 435 | 435 | { |
| 436 | 436 | $this->_stateChanged=true; |
| 437 | 437 | if($value===$defaultValue) |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | */ |
| 532 | 532 | public function setMode($value) |
| 533 | 533 | { |
| 534 | - $this->_mode=TPropertyValue::ensureEnum($value,'\Prado\TApplicationMode'); |
|
| 534 | + $this->_mode=TPropertyValue::ensureEnum($value, '\Prado\TApplicationMode'); |
|
| 535 | 535 | } |
| 536 | 536 | |
| 537 | 537 | /** |
@@ -579,7 +579,7 @@ discard block |
||
| 579 | 579 | */ |
| 580 | 580 | public function setConfigurationType($value) |
| 581 | 581 | { |
| 582 | - $this->_configType = $value; |
|
| 582 | + $this->_configType=$value; |
|
| 583 | 583 | } |
| 584 | 584 | |
| 585 | 585 | /** |
@@ -592,10 +592,10 @@ discard block |
||
| 592 | 592 | switch($this->_configType) |
| 593 | 593 | { |
| 594 | 594 | case TApplication::CONFIG_TYPE_PHP: |
| 595 | - $this->_configFileExt = TApplication::CONFIG_FILE_EXT_PHP; |
|
| 595 | + $this->_configFileExt=TApplication::CONFIG_FILE_EXT_PHP; |
|
| 596 | 596 | break; |
| 597 | 597 | default: |
| 598 | - $this->_configFileExt = TApplication::CONFIG_FILE_EXT_XML; |
|
| 598 | + $this->_configFileExt=TApplication::CONFIG_FILE_EXT_XML; |
|
| 599 | 599 | } |
| 600 | 600 | } |
| 601 | 601 | return $this->_configFileExt; |
@@ -607,15 +607,15 @@ discard block |
||
| 607 | 607 | public function getConfigurationFileName() |
| 608 | 608 | { |
| 609 | 609 | static $fileName; |
| 610 | - if($fileName == null) |
|
| 610 | + if($fileName==null) |
|
| 611 | 611 | { |
| 612 | 612 | switch($this->_configType) |
| 613 | 613 | { |
| 614 | 614 | case TApplication::CONFIG_TYPE_PHP: |
| 615 | - $fileName = TApplication::CONFIG_FILE_PHP; |
|
| 615 | + $fileName=TApplication::CONFIG_FILE_PHP; |
|
| 616 | 616 | break; |
| 617 | 617 | default: |
| 618 | - $fileName = TApplication::CONFIG_FILE_XML; |
|
| 618 | + $fileName=TApplication::CONFIG_FILE_XML; |
|
| 619 | 619 | } |
| 620 | 620 | } |
| 621 | 621 | return $fileName; |
@@ -666,7 +666,7 @@ discard block |
||
| 666 | 666 | public function setModule($id, IModule $module=null) |
| 667 | 667 | { |
| 668 | 668 | if(isset($this->_modules[$id])) |
| 669 | - throw new TConfigurationException('application_moduleid_duplicated',$id); |
|
| 669 | + throw new TConfigurationException('application_moduleid_duplicated', $id); |
|
| 670 | 670 | else |
| 671 | 671 | $this->_modules[$id]=$module; |
| 672 | 672 | } |
@@ -682,7 +682,7 @@ discard block |
||
| 682 | 682 | // force loading of a lazy module |
| 683 | 683 | if($this->_modules[$id]===null) |
| 684 | 684 | { |
| 685 | - $module = $this->internalLoadModule($id, true); |
|
| 685 | + $module=$this->internalLoadModule($id, true); |
|
| 686 | 686 | $module[0]->init($module[1]); |
| 687 | 687 | } |
| 688 | 688 | |
@@ -931,37 +931,37 @@ discard block |
||
| 931 | 931 | list($moduleClass, $initProperties, $configElement)=$this->_lazyModules[$id]; |
| 932 | 932 | if(isset($initProperties['lazy']) && $initProperties['lazy'] && !$force) |
| 933 | 933 | { |
| 934 | - Prado::trace("Postponed loading of lazy module $id ({$moduleClass})",'\Prado\TApplication'); |
|
| 934 | + Prado::trace("Postponed loading of lazy module $id ({$moduleClass})", '\Prado\TApplication'); |
|
| 935 | 935 | $this->setModule($id, null); |
| 936 | 936 | return null; |
| 937 | 937 | } |
| 938 | 938 | |
| 939 | - Prado::trace("Loading module $id ({$moduleClass})",'\Prado\TApplication'); |
|
| 939 | + Prado::trace("Loading module $id ({$moduleClass})", '\Prado\TApplication'); |
|
| 940 | 940 | $module=Prado::createComponent($moduleClass); |
| 941 | 941 | foreach($initProperties as $name=>$value) |
| 942 | 942 | { |
| 943 | 943 | if($name==='lazy') continue; |
| 944 | - $module->setSubProperty($name,$value); |
|
| 944 | + $module->setSubProperty($name, $value); |
|
| 945 | 945 | } |
| 946 | - $this->setModule($id,$module); |
|
| 946 | + $this->setModule($id, $module); |
|
| 947 | 947 | // keep the key to avoid reuse of the old module id |
| 948 | 948 | $this->_lazyModules[$id]=null; |
| 949 | 949 | |
| 950 | - return array($module,$configElement); |
|
| 950 | + return array($module, $configElement); |
|
| 951 | 951 | } |
| 952 | 952 | /** |
| 953 | 953 | * Applies an application configuration. |
| 954 | 954 | * @param TApplicationConfiguration the configuration |
| 955 | 955 | * @param boolean whether the configuration is specified within a service. |
| 956 | 956 | */ |
| 957 | - public function applyConfiguration($config,$withinService=false) |
|
| 957 | + public function applyConfiguration($config, $withinService=false) |
|
| 958 | 958 | { |
| 959 | 959 | if($config->getIsEmpty()) |
| 960 | 960 | return; |
| 961 | 961 | |
| 962 | 962 | // set path aliases and using namespaces |
| 963 | 963 | foreach($config->getAliases() as $alias=>$path) |
| 964 | - Prado::setPathOfAlias($alias,$path); |
|
| 964 | + Prado::setPathOfAlias($alias, $path); |
|
| 965 | 965 | foreach($config->getUsings() as $using) |
| 966 | 966 | Prado::using($using); |
| 967 | 967 | |
@@ -969,11 +969,11 @@ discard block |
||
| 969 | 969 | if(!$withinService) |
| 970 | 970 | { |
| 971 | 971 | foreach($config->getProperties() as $name=>$value) |
| 972 | - $this->setSubProperty($name,$value); |
|
| 972 | + $this->setSubProperty($name, $value); |
|
| 973 | 973 | } |
| 974 | 974 | |
| 975 | 975 | if(empty($this->_services)) |
| 976 | - $this->_services=array($this->getPageServiceID()=>array('Prado\Web\Services\TPageService',array(),null)); |
|
| 976 | + $this->_services=array($this->getPageServiceID()=>array('Prado\Web\Services\TPageService', array(), null)); |
|
| 977 | 977 | |
| 978 | 978 | // load parameters |
| 979 | 979 | foreach($config->getParameters() as $id=>$parameter) |
@@ -982,11 +982,11 @@ discard block |
||
| 982 | 982 | { |
| 983 | 983 | $component=Prado::createComponent($parameter[0]); |
| 984 | 984 | foreach($parameter[1] as $name=>$value) |
| 985 | - $component->setSubProperty($name,$value); |
|
| 986 | - $this->_parameters->add($id,$component); |
|
| 985 | + $component->setSubProperty($name, $value); |
|
| 986 | + $this->_parameters->add($id, $component); |
|
| 987 | 987 | } |
| 988 | 988 | else |
| 989 | - $this->_parameters->add($id,$parameter); |
|
| 989 | + $this->_parameters->add($id, $parameter); |
|
| 990 | 990 | } |
| 991 | 991 | |
| 992 | 992 | // load and init modules specified in app config |
@@ -996,7 +996,7 @@ discard block |
||
| 996 | 996 | if(!is_string($id)) |
| 997 | 997 | $id='_module'.count($this->_lazyModules); |
| 998 | 998 | $this->_lazyModules[$id]=$moduleConfig; |
| 999 | - if($module = $this->internalLoadModule($id)) |
|
| 999 | + if($module=$this->internalLoadModule($id)) |
|
| 1000 | 1000 | $modules[]=$module; |
| 1001 | 1001 | } |
| 1002 | 1002 | foreach($modules as $module) |
@@ -1013,12 +1013,12 @@ discard block |
||
| 1013 | 1013 | $condition=$this->evaluateExpression($condition); |
| 1014 | 1014 | if($condition) |
| 1015 | 1015 | { |
| 1016 | - if(($path=Prado::getPathOfNamespace($filePath,$this->getConfigurationFileExt()))===null || !is_file($path)) |
|
| 1017 | - throw new TConfigurationException('application_includefile_invalid',$filePath); |
|
| 1016 | + if(($path=Prado::getPathOfNamespace($filePath, $this->getConfigurationFileExt()))===null || !is_file($path)) |
|
| 1017 | + throw new TConfigurationException('application_includefile_invalid', $filePath); |
|
| 1018 | 1018 | $cn=$this->getApplicationConfigurationClass(); |
| 1019 | 1019 | $c=new $cn; |
| 1020 | 1020 | $c->loadFromFile($path); |
| 1021 | - $this->applyConfiguration($c,$withinService); |
|
| 1021 | + $this->applyConfiguration($c, $withinService); |
|
| 1022 | 1022 | } |
| 1023 | 1023 | } |
| 1024 | 1024 | } |
@@ -1034,21 +1034,21 @@ discard block |
||
| 1034 | 1034 | */ |
| 1035 | 1035 | protected function initApplication() |
| 1036 | 1036 | { |
| 1037 | - Prado::trace('Initializing application','Prado\TApplication'); |
|
| 1037 | + Prado::trace('Initializing application', 'Prado\TApplication'); |
|
| 1038 | 1038 | |
| 1039 | 1039 | if($this->_configFile!==null) |
| 1040 | 1040 | { |
| 1041 | - if($this->_cacheFile===null || @filemtime($this->_cacheFile)<filemtime($this->_configFile)) |
|
| 1041 | + if($this->_cacheFile===null || @filemtime($this->_cacheFile) < filemtime($this->_configFile)) |
|
| 1042 | 1042 | { |
| 1043 | 1043 | $config=new TApplicationConfiguration; |
| 1044 | 1044 | $config->loadFromFile($this->_configFile); |
| 1045 | 1045 | if($this->_cacheFile!==null) |
| 1046 | - file_put_contents($this->_cacheFile,serialize($config),LOCK_EX); |
|
| 1046 | + file_put_contents($this->_cacheFile, serialize($config), LOCK_EX); |
|
| 1047 | 1047 | } |
| 1048 | 1048 | else |
| 1049 | 1049 | $config=unserialize(file_get_contents($this->_cacheFile)); |
| 1050 | 1050 | |
| 1051 | - $this->applyConfiguration($config,false); |
|
| 1051 | + $this->applyConfiguration($config, false); |
|
| 1052 | 1052 | } |
| 1053 | 1053 | |
| 1054 | 1054 | if(($serviceID=$this->getRequest()->resolveRequest(array_keys($this->_services)))===null) |
@@ -1067,32 +1067,32 @@ discard block |
||
| 1067 | 1067 | { |
| 1068 | 1068 | if(isset($this->_services[$serviceID])) |
| 1069 | 1069 | { |
| 1070 | - list($serviceClass,$initProperties,$configElement)=$this->_services[$serviceID]; |
|
| 1070 | + list($serviceClass, $initProperties, $configElement)=$this->_services[$serviceID]; |
|
| 1071 | 1071 | $service=Prado::createComponent($serviceClass); |
| 1072 | 1072 | if(!($service instanceof IService)) |
| 1073 | - throw new THttpException(500,'application_service_invalid',$serviceClass); |
|
| 1073 | + throw new THttpException(500, 'application_service_invalid', $serviceClass); |
|
| 1074 | 1074 | if(!$service->getEnabled()) |
| 1075 | - throw new THttpException(500,'application_service_unavailable',$serviceClass); |
|
| 1075 | + throw new THttpException(500, 'application_service_unavailable', $serviceClass); |
|
| 1076 | 1076 | $service->setID($serviceID); |
| 1077 | 1077 | $this->setService($service); |
| 1078 | 1078 | |
| 1079 | 1079 | foreach($initProperties as $name=>$value) |
| 1080 | - $service->setSubProperty($name,$value); |
|
| 1080 | + $service->setSubProperty($name, $value); |
|
| 1081 | 1081 | |
| 1082 | 1082 | if($configElement!==null) |
| 1083 | 1083 | { |
| 1084 | 1084 | $config=new TApplicationConfiguration; |
| 1085 | 1085 | if($this->getConfigurationType()==self::CONFIG_TYPE_PHP) |
| 1086 | - $config->loadFromPhp($configElement,$this->getBasePath()); |
|
| 1086 | + $config->loadFromPhp($configElement, $this->getBasePath()); |
|
| 1087 | 1087 | else |
| 1088 | - $config->loadFromXml($configElement,$this->getBasePath()); |
|
| 1089 | - $this->applyConfiguration($config,true); |
|
| 1088 | + $config->loadFromXml($configElement, $this->getBasePath()); |
|
| 1089 | + $this->applyConfiguration($config, true); |
|
| 1090 | 1090 | } |
| 1091 | 1091 | |
| 1092 | 1092 | $service->init($configElement); |
| 1093 | 1093 | } |
| 1094 | 1094 | else |
| 1095 | - throw new THttpException(500,'application_service_unknown',$serviceID); |
|
| 1095 | + throw new THttpException(500, 'application_service_unknown', $serviceID); |
|
| 1096 | 1096 | } |
| 1097 | 1097 | |
| 1098 | 1098 | /** |
@@ -1103,9 +1103,9 @@ discard block |
||
| 1103 | 1103 | */ |
| 1104 | 1104 | public function onError($param) |
| 1105 | 1105 | { |
| 1106 | - Prado::log($param->getMessage(),TLogger::ERROR,'Prado\TApplication'); |
|
| 1107 | - $this->raiseEvent('OnError',$this,$param); |
|
| 1108 | - $this->getErrorHandler()->handleError($this,$param); |
|
| 1106 | + Prado::log($param->getMessage(), TLogger::ERROR, 'Prado\TApplication'); |
|
| 1107 | + $this->raiseEvent('OnError', $this, $param); |
|
| 1108 | + $this->getErrorHandler()->handleError($this, $param); |
|
| 1109 | 1109 | } |
| 1110 | 1110 | |
| 1111 | 1111 | /** |
@@ -1117,7 +1117,7 @@ discard block |
||
| 1117 | 1117 | */ |
| 1118 | 1118 | public function onBeginRequest() |
| 1119 | 1119 | { |
| 1120 | - $this->raiseEvent('OnBeginRequest',$this,null); |
|
| 1120 | + $this->raiseEvent('OnBeginRequest', $this, null); |
|
| 1121 | 1121 | } |
| 1122 | 1122 | |
| 1123 | 1123 | /** |
@@ -1126,7 +1126,7 @@ discard block |
||
| 1126 | 1126 | */ |
| 1127 | 1127 | public function onAuthentication() |
| 1128 | 1128 | { |
| 1129 | - $this->raiseEvent('OnAuthentication',$this,null); |
|
| 1129 | + $this->raiseEvent('OnAuthentication', $this, null); |
|
| 1130 | 1130 | } |
| 1131 | 1131 | |
| 1132 | 1132 | /** |
@@ -1135,7 +1135,7 @@ discard block |
||
| 1135 | 1135 | */ |
| 1136 | 1136 | public function onAuthenticationComplete() |
| 1137 | 1137 | { |
| 1138 | - $this->raiseEvent('OnAuthenticationComplete',$this,null); |
|
| 1138 | + $this->raiseEvent('OnAuthenticationComplete', $this, null); |
|
| 1139 | 1139 | } |
| 1140 | 1140 | |
| 1141 | 1141 | /** |
@@ -1144,7 +1144,7 @@ discard block |
||
| 1144 | 1144 | */ |
| 1145 | 1145 | public function onAuthorization() |
| 1146 | 1146 | { |
| 1147 | - $this->raiseEvent('OnAuthorization',$this,null); |
|
| 1147 | + $this->raiseEvent('OnAuthorization', $this, null); |
|
| 1148 | 1148 | } |
| 1149 | 1149 | |
| 1150 | 1150 | /** |
@@ -1153,7 +1153,7 @@ discard block |
||
| 1153 | 1153 | */ |
| 1154 | 1154 | public function onAuthorizationComplete() |
| 1155 | 1155 | { |
| 1156 | - $this->raiseEvent('OnAuthorizationComplete',$this,null); |
|
| 1156 | + $this->raiseEvent('OnAuthorizationComplete', $this, null); |
|
| 1157 | 1157 | } |
| 1158 | 1158 | |
| 1159 | 1159 | /** |
@@ -1163,7 +1163,7 @@ discard block |
||
| 1163 | 1163 | public function onLoadState() |
| 1164 | 1164 | { |
| 1165 | 1165 | $this->loadGlobals(); |
| 1166 | - $this->raiseEvent('OnLoadState',$this,null); |
|
| 1166 | + $this->raiseEvent('OnLoadState', $this, null); |
|
| 1167 | 1167 | } |
| 1168 | 1168 | |
| 1169 | 1169 | /** |
@@ -1172,7 +1172,7 @@ discard block |
||
| 1172 | 1172 | */ |
| 1173 | 1173 | public function onLoadStateComplete() |
| 1174 | 1174 | { |
| 1175 | - $this->raiseEvent('OnLoadStateComplete',$this,null); |
|
| 1175 | + $this->raiseEvent('OnLoadStateComplete', $this, null); |
|
| 1176 | 1176 | } |
| 1177 | 1177 | |
| 1178 | 1178 | /** |
@@ -1181,7 +1181,7 @@ discard block |
||
| 1181 | 1181 | */ |
| 1182 | 1182 | public function onPreRunService() |
| 1183 | 1183 | { |
| 1184 | - $this->raiseEvent('OnPreRunService',$this,null); |
|
| 1184 | + $this->raiseEvent('OnPreRunService', $this, null); |
|
| 1185 | 1185 | } |
| 1186 | 1186 | |
| 1187 | 1187 | /** |
@@ -1199,7 +1199,7 @@ discard block |
||
| 1199 | 1199 | */ |
| 1200 | 1200 | public function onSaveState() |
| 1201 | 1201 | { |
| 1202 | - $this->raiseEvent('OnSaveState',$this,null); |
|
| 1202 | + $this->raiseEvent('OnSaveState', $this, null); |
|
| 1203 | 1203 | $this->saveGlobals(); |
| 1204 | 1204 | } |
| 1205 | 1205 | |
@@ -1209,7 +1209,7 @@ discard block |
||
| 1209 | 1209 | */ |
| 1210 | 1210 | public function onSaveStateComplete() |
| 1211 | 1211 | { |
| 1212 | - $this->raiseEvent('OnSaveStateComplete',$this,null); |
|
| 1212 | + $this->raiseEvent('OnSaveStateComplete', $this, null); |
|
| 1213 | 1213 | } |
| 1214 | 1214 | |
| 1215 | 1215 | /** |
@@ -1218,14 +1218,14 @@ discard block |
||
| 1218 | 1218 | */ |
| 1219 | 1219 | public function onPreFlushOutput() |
| 1220 | 1220 | { |
| 1221 | - $this->raiseEvent('OnPreFlushOutput',$this,null); |
|
| 1221 | + $this->raiseEvent('OnPreFlushOutput', $this, null); |
|
| 1222 | 1222 | } |
| 1223 | 1223 | |
| 1224 | 1224 | /** |
| 1225 | 1225 | * Flushes output to client side. |
| 1226 | 1226 | * @param boolean whether to continue buffering after flush if buffering was active |
| 1227 | 1227 | */ |
| 1228 | - public function flushOutput($continueBuffering = true) |
|
| 1228 | + public function flushOutput($continueBuffering=true) |
|
| 1229 | 1229 | { |
| 1230 | 1230 | $this->getResponse()->flush($continueBuffering); |
| 1231 | 1231 | } |
@@ -1237,7 +1237,7 @@ discard block |
||
| 1237 | 1237 | public function onEndRequest() |
| 1238 | 1238 | { |
| 1239 | 1239 | $this->flushOutput(false); // flush all remaining content in the buffer |
| 1240 | - $this->saveGlobals(); // save global state |
|
| 1241 | - $this->raiseEvent('OnEndRequest',$this,null); |
|
| 1240 | + $this->saveGlobals(); // save global state |
|
| 1241 | + $this->raiseEvent('OnEndRequest', $this, null); |
|
| 1242 | 1242 | } |
| 1243 | 1243 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * Array of translation messages. |
| 83 | 83 | * @var array |
| 84 | 84 | */ |
| 85 | - protected $messages = array(); |
|
| 85 | + protected $messages=array(); |
|
| 86 | 86 | |
| 87 | 87 | /** |
| 88 | 88 | * The source of message translations. |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | protected $cache; |
| 98 | 98 | |
| 99 | - protected $untranslated = array(); |
|
| 99 | + protected $untranslated=array(); |
|
| 100 | 100 | |
| 101 | 101 | /** |
| 102 | 102 | * Private constructor. MessageSource must be initialized using |
@@ -126,23 +126,23 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | static function &factory($type, $source='.', $filename='') |
| 128 | 128 | { |
| 129 | - $types = array('XLIFF','PHP','gettext','Database'); |
|
| 129 | + $types=array('XLIFF', 'PHP', 'gettext', 'Database'); |
|
| 130 | 130 | |
| 131 | 131 | if(empty($filename) && !in_array($type, $types)) |
| 132 | 132 | throw new Exception('Invalid type "'.$type.'", valid types are '. |
| 133 | 133 | implode(', ', $types)); |
| 134 | 134 | |
| 135 | - $class = 'MessageSource_'.$type; |
|
| 135 | + $class='MessageSource_'.$type; |
|
| 136 | 136 | |
| 137 | 137 | if(empty($filename)) |
| 138 | - $filename = dirname(__FILE__).'/'.$class.'.php'; |
|
| 138 | + $filename=dirname(__FILE__).'/'.$class.'.php'; |
|
| 139 | 139 | |
| 140 | - if(is_file($filename) == false) |
|
| 140 | + if(is_file($filename)==false) |
|
| 141 | 141 | throw new Exception("File $filename not found"); |
| 142 | 142 | |
| 143 | 143 | include_once $filename; |
| 144 | 144 | |
| 145 | - $obj = new $class($source); |
|
| 145 | + $obj=new $class($source); |
|
| 146 | 146 | |
| 147 | 147 | return $obj; |
| 148 | 148 | } |
@@ -168,36 +168,36 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | function load($catalogue='messages') |
| 170 | 170 | { |
| 171 | - $variants = $this->getCatalogueList($catalogue); |
|
| 171 | + $variants=$this->getCatalogueList($catalogue); |
|
| 172 | 172 | |
| 173 | - $this->messages = array(); |
|
| 173 | + $this->messages=array(); |
|
| 174 | 174 | |
| 175 | 175 | foreach($variants as $variant) |
| 176 | 176 | { |
| 177 | - $source = $this->getSource($variant); |
|
| 177 | + $source=$this->getSource($variant); |
|
| 178 | 178 | |
| 179 | - if($this->isValidSource($source) == false) continue; |
|
| 179 | + if($this->isValidSource($source)==false) continue; |
|
| 180 | 180 | |
| 181 | - $loadData = true; |
|
| 181 | + $loadData=true; |
|
| 182 | 182 | |
| 183 | 183 | if($this->cache) |
| 184 | 184 | { |
| 185 | - $data = $this->cache->get($variant, |
|
| 185 | + $data=$this->cache->get($variant, |
|
| 186 | 186 | $this->culture, $this->getLastModified($source)); |
| 187 | 187 | |
| 188 | 188 | if(is_array($data)) |
| 189 | 189 | { |
| 190 | - $this->messages[$variant] = $data; |
|
| 191 | - $loadData = false; |
|
| 190 | + $this->messages[$variant]=$data; |
|
| 191 | + $loadData=false; |
|
| 192 | 192 | } |
| 193 | 193 | unset($data); |
| 194 | 194 | } |
| 195 | 195 | if($loadData) |
| 196 | 196 | { |
| 197 | - $data = &$this->loadData($source); |
|
| 197 | + $data=&$this->loadData($source); |
|
| 198 | 198 | if(is_array($data)) |
| 199 | 199 | { |
| 200 | - $this->messages[$variant] = $data; |
|
| 200 | + $this->messages[$variant]=$data; |
|
| 201 | 201 | if($this->cache) |
| 202 | 202 | $this->cache->save($data, $variant, $this->culture); |
| 203 | 203 | } |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | */ |
| 234 | 234 | public function setCache(MessageCache $cache) |
| 235 | 235 | { |
| 236 | - $this->cache = $cache; |
|
| 236 | + $this->cache=$cache; |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | /** |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | public function append($message) |
| 245 | 245 | { |
| 246 | 246 | if(!in_array($message, $this->untranslated)) |
| 247 | - $this->untranslated[] = $message; |
|
| 247 | + $this->untranslated[]=$message; |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | /** |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | */ |
| 254 | 254 | public function setCulture($culture) |
| 255 | 255 | { |
| 256 | - $this->culture = $culture; |
|
| 256 | + $this->culture=$culture; |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | /** |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | case 'datetime': case 'timestamp': |
| 37 | 37 | return $this->createDateTimeControl($container, $column, $record); |
| 38 | 38 | default: |
| 39 | - return $this->createDefaultControl($container,$column, $record); |
|
| 39 | + return $this->createDefaultControl($container, $column, $record); |
|
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | |
@@ -53,16 +53,16 @@ discard block |
||
| 53 | 53 | case 'time': |
| 54 | 54 | return $this->getTimeValue($container, $column, $record); |
| 55 | 55 | case 'datetime': case 'timestamp': |
| 56 | - return $this->getDateTimeValue($container,$column, $record); |
|
| 56 | + return $this->getDateTimeValue($container, $column, $record); |
|
| 57 | 57 | default: |
| 58 | - return $this->getDefaultControlValue($container,$column, $record); |
|
| 58 | + return $this->getDefaultControlValue($container, $column, $record); |
|
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | protected function createDateControl($container, $column, $record) |
| 63 | 63 | { |
| 64 | - $control = parent::createDateControl($container, $column, $record); |
|
| 65 | - $value = $this->getRecordPropertyValue($column, $record); |
|
| 64 | + $control=parent::createDateControl($container, $column, $record); |
|
| 65 | + $value=$this->getRecordPropertyValue($column, $record); |
|
| 66 | 66 | if(!empty($value) && preg_match('/timestamp/i', $column->getDbType())) |
| 67 | 67 | $control->setTimestamp(intval($value)); |
| 68 | 68 | return $control; |
@@ -70,11 +70,11 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | protected function createDateTimeControl($container, $column, $record) |
| 72 | 72 | { |
| 73 | - $value = $this->getRecordPropertyValue($column, $record); |
|
| 74 | - $time = parent::createDateTimeControl($container, $column, $record); |
|
| 73 | + $value=$this->getRecordPropertyValue($column, $record); |
|
| 74 | + $time=parent::createDateTimeControl($container, $column, $record); |
|
| 75 | 75 | if(!empty($value) && preg_match('/timestamp/i', $column->getDbType())) |
| 76 | 76 | { |
| 77 | - $dt = new \DateTime; |
|
| 77 | + $dt=new \DateTime; |
|
| 78 | 78 | $dt->setTimestamp(intval($value)); |
| 79 | 79 | $time[1]->setSelectedValue($dt->format('G')); |
| 80 | 80 | $time[2]->setSelectedValue($dt->format('i')); |
@@ -87,12 +87,12 @@ discard block |
||
| 87 | 87 | { |
| 88 | 88 | if(preg_match('/timestamp/i', $column->getDbType())) |
| 89 | 89 | { |
| 90 | - $time = $container->findControl(self::DEFAULT_ID)->getTimestamp(); |
|
| 91 | - $dt = new \DateTime; |
|
| 90 | + $time=$container->findControl(self::DEFAULT_ID)->getTimestamp(); |
|
| 91 | + $dt=new \DateTime; |
|
| 92 | 92 | $dt->setTimestamp($time); |
| 93 | - $hour = $container->findControl('scaffold_time_hour')->getSelectedValue(); |
|
| 94 | - $mins = $container->findControl('scaffold_time_min')->getSelectedValue(); |
|
| 95 | - $secs = $container->findControl('scaffold_time_sec')->getSelectedValue(); |
|
| 93 | + $hour=$container->findControl('scaffold_time_hour')->getSelectedValue(); |
|
| 94 | + $mins=$container->findControl('scaffold_time_min')->getSelectedValue(); |
|
| 95 | + $secs=$container->findControl('scaffold_time_sec')->getSelectedValue(); |
|
| 96 | 96 | return $s->getTimeStamp( |
| 97 | 97 | $hour, |
| 98 | 98 | $mins, |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * @param integer the precision of the numeric priorities |
| 88 | 88 | * @throws TInvalidDataTypeException If data is not null and is neither an array nor an iterator. |
| 89 | 89 | */ |
| 90 | - public function __construct($data=null,$readOnly=false,$defaultPriority=10,$precision=8) |
|
| 90 | + public function __construct($data=null, $readOnly=false, $defaultPriority=10, $precision=8) |
|
| 91 | 91 | { |
| 92 | 92 | parent::__construct(); |
| 93 | 93 | if($data!==null) |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | { |
| 126 | 126 | if($priority===null) |
| 127 | 127 | $priority=$this->getDefaultPriority(); |
| 128 | - $priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p); |
|
| 128 | + $priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p); |
|
| 129 | 129 | |
| 130 | 130 | if(!isset($this->_d[$priority]) || !is_array($this->_d[$priority])) |
| 131 | 131 | return false; |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | protected function setDefaultPriority($value) |
| 148 | 148 | { |
| 149 | - $this->_dp=(string)round(TPropertyValue::ensureFloat($value),$this->_p); |
|
| 149 | + $this->_dp=(string) round(TPropertyValue::ensureFloat($value), $this->_p); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | /** |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | protected function sortPriorities() { |
| 194 | 194 | if(!$this->_o) { |
| 195 | - ksort($this->_d,SORT_NUMERIC); |
|
| 195 | + ksort($this->_d, SORT_NUMERIC); |
|
| 196 | 196 | $this->_o=true; |
| 197 | 197 | } |
| 198 | 198 | } |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | $this->sortPriorities(); |
| 209 | 209 | $this->_fd=array(); |
| 210 | 210 | foreach($this->_d as $priority => $itemsatpriority) |
| 211 | - $this->_fd=array_merge($this->_fd,$itemsatpriority); |
|
| 211 | + $this->_fd=array_merge($this->_fd, $itemsatpriority); |
|
| 212 | 212 | return $this->_fd; |
| 213 | 213 | } |
| 214 | 214 | |
@@ -222,11 +222,11 @@ discard block |
||
| 222 | 222 | */ |
| 223 | 223 | public function itemAt($index) |
| 224 | 224 | { |
| 225 | - if($index>=0&&$index<$this->getCount()) { |
|
| 225 | + if($index >= 0 && $index < $this->getCount()) { |
|
| 226 | 226 | $arr=$this->flattenPriorities(); |
| 227 | 227 | return $arr[$index]; |
| 228 | 228 | } else |
| 229 | - throw new TInvalidDataValueException('list_index_invalid',$index); |
|
| 229 | + throw new TInvalidDataValueException('list_index_invalid', $index); |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | /** |
@@ -238,9 +238,9 @@ discard block |
||
| 238 | 238 | { |
| 239 | 239 | if($priority===null) |
| 240 | 240 | $priority=$this->getDefaultPriority(); |
| 241 | - $priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p); |
|
| 241 | + $priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p); |
|
| 242 | 242 | |
| 243 | - return isset($this->_d[$priority])?$this->_d[$priority]:null; |
|
| 243 | + return isset($this->_d[$priority]) ? $this->_d[$priority] : null; |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | /** |
@@ -249,14 +249,14 @@ discard block |
||
| 249 | 249 | * @param numeric the priority which to index. no parameter or null will result in the default priority |
| 250 | 250 | * @return mixed the element at the offset, false if no element is found at the offset |
| 251 | 251 | */ |
| 252 | - public function itemAtIndexInPriority($index,$priority=null) |
|
| 252 | + public function itemAtIndexInPriority($index, $priority=null) |
|
| 253 | 253 | { |
| 254 | 254 | if($priority===null) |
| 255 | 255 | $priority=$this->getDefaultPriority(); |
| 256 | - $priority=(string)round(TPropertyValue::ensureFloat($priority), $this->_p); |
|
| 256 | + $priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p); |
|
| 257 | 257 | |
| 258 | - return !isset($this->_d[$priority])?false:( |
|
| 259 | - isset($this->_d[$priority][$index])?$this->_d[$priority][$index]:false |
|
| 258 | + return !isset($this->_d[$priority]) ?false:( |
|
| 259 | + isset($this->_d[$priority][$index]) ? $this->_d[$priority][$index] : false |
|
| 260 | 260 | ); |
| 261 | 261 | } |
| 262 | 262 | |
@@ -268,12 +268,12 @@ discard block |
||
| 268 | 268 | * @return int the index within the flattened array |
| 269 | 269 | * @throws TInvalidOperationException if the map is read-only |
| 270 | 270 | */ |
| 271 | - public function add($item,$priority=null) |
|
| 271 | + public function add($item, $priority=null) |
|
| 272 | 272 | { |
| 273 | 273 | if($this->getReadOnly()) |
| 274 | - throw new TInvalidOperationException('list_readonly',get_class($this)); |
|
| 274 | + throw new TInvalidOperationException('list_readonly', get_class($this)); |
|
| 275 | 275 | |
| 276 | - return $this->insertAtIndexInPriority($item,false,$priority,true); |
|
| 276 | + return $this->insertAtIndexInPriority($item, false, $priority, true); |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | /** |
@@ -284,15 +284,15 @@ discard block |
||
| 284 | 284 | * @throws TInvalidDataValueException If the index specified exceeds the bound |
| 285 | 285 | * @throws TInvalidOperationException if the list is read-only |
| 286 | 286 | */ |
| 287 | - public function insertAt($index,$item) |
|
| 287 | + public function insertAt($index, $item) |
|
| 288 | 288 | { |
| 289 | 289 | if($this->getReadOnly()) |
| 290 | - throw new TInvalidOperationException('list_readonly',get_class($this)); |
|
| 290 | + throw new TInvalidOperationException('list_readonly', get_class($this)); |
|
| 291 | 291 | |
| 292 | - if(($priority=$this->priorityAt($index,true))!==false) |
|
| 293 | - $this->insertAtIndexInPriority($item,$priority[1],$priority[0]); |
|
| 292 | + if(($priority=$this->priorityAt($index, true))!==false) |
|
| 293 | + $this->insertAtIndexInPriority($item, $priority[1], $priority[0]); |
|
| 294 | 294 | else |
| 295 | - throw new TInvalidDataValueException('list_index_invalid',$index); |
|
| 295 | + throw new TInvalidDataValueException('list_index_invalid', $index); |
|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | /** |
@@ -305,54 +305,54 @@ discard block |
||
| 305 | 305 | * @throws TInvalidDataValueException If the index specified exceeds the bound |
| 306 | 306 | * @throws TInvalidOperationException if the list is read-only |
| 307 | 307 | */ |
| 308 | - public function insertAtIndexInPriority($item,$index=false,$priority=null,$preserveCache=false) |
|
| 308 | + public function insertAtIndexInPriority($item, $index=false, $priority=null, $preserveCache=false) |
|
| 309 | 309 | { |
| 310 | 310 | if($this->getReadOnly()) |
| 311 | - throw new TInvalidOperationException('list_readonly',get_class($this)); |
|
| 311 | + throw new TInvalidOperationException('list_readonly', get_class($this)); |
|
| 312 | 312 | |
| 313 | 313 | if($priority===null) |
| 314 | 314 | $priority=$this->getDefaultPriority(); |
| 315 | - $priority=(string)round(TPropertyValue::ensureFloat($priority), $this->_p); |
|
| 315 | + $priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p); |
|
| 316 | 316 | |
| 317 | 317 | if($preserveCache) { |
| 318 | 318 | $this->sortPriorities(); |
| 319 | 319 | $cc=0; |
| 320 | 320 | foreach($this->_d as $prioritykey=>$items) |
| 321 | - if($prioritykey>=$priority) |
|
| 321 | + if($prioritykey >= $priority) |
|
| 322 | 322 | break; |
| 323 | 323 | else |
| 324 | 324 | $cc+=count($items); |
| 325 | 325 | |
| 326 | - if($index===false&&isset($this->_d[$priority])) { |
|
| 326 | + if($index===false && isset($this->_d[$priority])) { |
|
| 327 | 327 | $c=count($this->_d[$priority]); |
| 328 | 328 | $c+=$cc; |
| 329 | 329 | $this->_d[$priority][]=$item; |
| 330 | 330 | } else if(isset($this->_d[$priority])) { |
| 331 | - $c=$index+$cc; |
|
| 332 | - array_splice($this->_d[$priority],$index,0,array($item)); |
|
| 331 | + $c=$index + $cc; |
|
| 332 | + array_splice($this->_d[$priority], $index, 0, array($item)); |
|
| 333 | 333 | } else { |
| 334 | - $c = $cc; |
|
| 335 | - $this->_o = false; |
|
| 334 | + $c=$cc; |
|
| 335 | + $this->_o=false; |
|
| 336 | 336 | $this->_d[$priority]=array($item); |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | - if($this->_fd&&is_array($this->_fd)) // if there is a flattened array cache |
|
| 340 | - array_splice($this->_fd,$c,0,array($item)); |
|
| 339 | + if($this->_fd && is_array($this->_fd)) // if there is a flattened array cache |
|
| 340 | + array_splice($this->_fd, $c, 0, array($item)); |
|
| 341 | 341 | } else { |
| 342 | 342 | $c=null; |
| 343 | - if($index===false&&isset($this->_d[$priority])) { |
|
| 343 | + if($index===false && isset($this->_d[$priority])) { |
|
| 344 | 344 | $cc=count($this->_d[$priority]); |
| 345 | 345 | $this->_d[$priority][]=$item; |
| 346 | 346 | } else if(isset($this->_d[$priority])) { |
| 347 | 347 | $cc=$index; |
| 348 | - array_splice($this->_d[$priority],$index,0,array($item)); |
|
| 348 | + array_splice($this->_d[$priority], $index, 0, array($item)); |
|
| 349 | 349 | } else { |
| 350 | 350 | $cc=0; |
| 351 | 351 | $this->_o=false; |
| 352 | 352 | $this->_d[$priority]=array($item); |
| 353 | 353 | } |
| 354 | - if($this->_fd&&is_array($this->_fd)&&count($this->_d)==1) |
|
| 355 | - array_splice($this->_fd,$cc,0,array($item)); |
|
| 354 | + if($this->_fd && is_array($this->_fd) && count($this->_d)==1) |
|
| 355 | + array_splice($this->_fd, $cc, 0, array($item)); |
|
| 356 | 356 | else |
| 357 | 357 | $this->_fd=null; |
| 358 | 358 | } |
@@ -373,22 +373,22 @@ discard block |
||
| 373 | 373 | * @return integer index within the flattened list at which the item is being removed |
| 374 | 374 | * @throws TInvalidDataValueException If the item does not exist |
| 375 | 375 | */ |
| 376 | - public function remove($item,$priority=false) |
|
| 376 | + public function remove($item, $priority=false) |
|
| 377 | 377 | { |
| 378 | 378 | if($this->getReadOnly()) |
| 379 | - throw new TInvalidOperationException('list_readonly',get_class($this)); |
|
| 379 | + throw new TInvalidOperationException('list_readonly', get_class($this)); |
|
| 380 | 380 | |
| 381 | - if(($p=$this->priorityOf($item,true))!==false) |
|
| 381 | + if(($p=$this->priorityOf($item, true))!==false) |
|
| 382 | 382 | { |
| 383 | 383 | if($priority!==false) { |
| 384 | 384 | if($priority===null) |
| 385 | 385 | $priority=$this->getDefaultPriority(); |
| 386 | - $priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p); |
|
| 386 | + $priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p); |
|
| 387 | 387 | |
| 388 | 388 | if($p[0]!=$priority) |
| 389 | 389 | throw new TInvalidDataValueException('list_item_inexistent'); |
| 390 | 390 | } |
| 391 | - $this->removeAtIndexInPriority($p[1],$p[0]); |
|
| 391 | + $this->removeAtIndexInPriority($p[1], $p[0]); |
|
| 392 | 392 | return $p[2]; |
| 393 | 393 | } |
| 394 | 394 | else |
@@ -405,11 +405,11 @@ discard block |
||
| 405 | 405 | public function removeAt($index) |
| 406 | 406 | { |
| 407 | 407 | if($this->getReadOnly()) |
| 408 | - throw new TInvalidOperationException('list_readonly',get_class($this)); |
|
| 408 | + throw new TInvalidOperationException('list_readonly', get_class($this)); |
|
| 409 | 409 | |
| 410 | 410 | if(($priority=$this->priorityAt($index, true))!==false) |
| 411 | - return $this->removeAtIndexInPriority($priority[1],$priority[0]); |
|
| 412 | - throw new TInvalidDataValueException('list_index_invalid',$index); |
|
| 411 | + return $this->removeAtIndexInPriority($priority[1], $priority[0]); |
|
| 412 | + throw new TInvalidDataValueException('list_index_invalid', $index); |
|
| 413 | 413 | } |
| 414 | 414 | |
| 415 | 415 | /** |
@@ -423,17 +423,17 @@ discard block |
||
| 423 | 423 | public function removeAtIndexInPriority($index, $priority=null) |
| 424 | 424 | { |
| 425 | 425 | if($this->getReadOnly()) |
| 426 | - throw new TInvalidOperationException('list_readonly',get_class($this)); |
|
| 426 | + throw new TInvalidOperationException('list_readonly', get_class($this)); |
|
| 427 | 427 | |
| 428 | 428 | if($priority===null) |
| 429 | 429 | $priority=$this->getDefaultPriority(); |
| 430 | - $priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p); |
|
| 430 | + $priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p); |
|
| 431 | 431 | |
| 432 | - if(!isset($this->_d[$priority])||$index<0||$index>=count($this->_d[$priority])) |
|
| 432 | + if(!isset($this->_d[$priority]) || $index < 0 || $index >= count($this->_d[$priority])) |
|
| 433 | 433 | throw new TInvalidDataValueException('list_item_inexistent'); |
| 434 | 434 | |
| 435 | 435 | // $value is an array of elements removed, only one |
| 436 | - $value=array_splice($this->_d[$priority],$index,1); |
|
| 436 | + $value=array_splice($this->_d[$priority], $index, 1); |
|
| 437 | 437 | $value=$value[0]; |
| 438 | 438 | |
| 439 | 439 | if(!count($this->_d[$priority])) |
@@ -450,11 +450,11 @@ discard block |
||
| 450 | 450 | public function clear() |
| 451 | 451 | { |
| 452 | 452 | if($this->getReadOnly()) |
| 453 | - throw new TInvalidOperationException('list_readonly',get_class($this)); |
|
| 453 | + throw new TInvalidOperationException('list_readonly', get_class($this)); |
|
| 454 | 454 | |
| 455 | 455 | foreach($this->_d as $priority=>$items) { |
| 456 | - for($index=count($items)-1;$index>=0;$index--) |
|
| 457 | - $this->removeAtIndexInPriority($index,$priority); |
|
| 456 | + for($index=count($items) - 1; $index >= 0; $index--) |
|
| 457 | + $this->removeAtIndexInPriority($index, $priority); |
|
| 458 | 458 | unset($this->_d[$priority]); |
| 459 | 459 | } |
| 460 | 460 | } |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | */ |
| 466 | 466 | public function contains($item) |
| 467 | 467 | { |
| 468 | - return $this->indexOf($item)>=0; |
|
| 468 | + return $this->indexOf($item) >= 0; |
|
| 469 | 469 | } |
| 470 | 470 | |
| 471 | 471 | /** |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | */ |
| 475 | 475 | public function indexOf($item) |
| 476 | 476 | { |
| 477 | - if(($index=array_search($item,$this->flattenPriorities(),true))===false) |
|
| 477 | + if(($index=array_search($item, $this->flattenPriorities(), true))===false) |
|
| 478 | 478 | return -1; |
| 479 | 479 | else |
| 480 | 480 | return $index; |
@@ -489,16 +489,16 @@ discard block |
||
| 489 | 489 | * if withindex is true, an array is returned of [0 => $priority, 1 => $priorityIndex, 2 => flattenedIndex, |
| 490 | 490 | * 'priority' => $priority, 'index' => $priorityIndex, 'absindex' => flattenedIndex] |
| 491 | 491 | */ |
| 492 | - public function priorityOf($item,$withindex = false) |
|
| 492 | + public function priorityOf($item, $withindex=false) |
|
| 493 | 493 | { |
| 494 | 494 | $this->sortPriorities(); |
| 495 | 495 | |
| 496 | - $absindex = 0; |
|
| 496 | + $absindex=0; |
|
| 497 | 497 | foreach($this->_d as $priority=>$items) { |
| 498 | - if(($index=array_search($item,$items,true))!==false) { |
|
| 498 | + if(($index=array_search($item, $items, true))!==false) { |
|
| 499 | 499 | $absindex+=$index; |
| 500 | - return $withindex?array($priority,$index,$absindex, |
|
| 501 | - 'priority'=>$priority,'index'=>$index,'absindex'=>$absindex):$priority; |
|
| 500 | + return $withindex ? array($priority, $index, $absindex, |
|
| 501 | + 'priority'=>$priority, 'index'=>$index, 'absindex'=>$absindex) : $priority; |
|
| 502 | 502 | } else |
| 503 | 503 | $absindex+=count($items); |
| 504 | 504 | } |
@@ -515,19 +515,19 @@ discard block |
||
| 515 | 515 | * if withindex is true, an array is returned of [0 => $priority, 1 => $priorityIndex, 2 => flattenedIndex, |
| 516 | 516 | * 'priority' => $priority, 'index' => $priorityIndex, 'absindex' => flattenedIndex] |
| 517 | 517 | */ |
| 518 | - public function priorityAt($index,$withindex = false) |
|
| 518 | + public function priorityAt($index, $withindex=false) |
|
| 519 | 519 | { |
| 520 | - if($index<0||$index>=$this->getCount()) |
|
| 521 | - throw new TInvalidDataValueException('list_index_invalid',$index); |
|
| 520 | + if($index < 0 || $index >= $this->getCount()) |
|
| 521 | + throw new TInvalidDataValueException('list_index_invalid', $index); |
|
| 522 | 522 | |
| 523 | 523 | $absindex=$index; |
| 524 | 524 | $this->sortPriorities(); |
| 525 | 525 | foreach($this->_d as $priority=>$items) { |
| 526 | - if($index>=($c=count($items))) |
|
| 526 | + if($index >= ($c=count($items))) |
|
| 527 | 527 | $index-=$c; |
| 528 | 528 | else |
| 529 | - return $withindex?array($priority,$index,$absindex, |
|
| 530 | - 'priority'=>$priority,'index'=>$index,'absindex'=>$absindex):$priority; |
|
| 529 | + return $withindex ? array($priority, $index, $absindex, |
|
| 530 | + 'priority'=>$priority, 'index'=>$index, 'absindex'=>$absindex) : $priority; |
|
| 531 | 531 | } |
| 532 | 532 | return false; |
| 533 | 533 | } |
@@ -543,12 +543,12 @@ discard block |
||
| 543 | 543 | public function insertBefore($indexitem, $item) |
| 544 | 544 | { |
| 545 | 545 | if($this->getReadOnly()) |
| 546 | - throw new TInvalidOperationException('list_readonly',get_class($this)); |
|
| 546 | + throw new TInvalidOperationException('list_readonly', get_class($this)); |
|
| 547 | 547 | |
| 548 | - if(($priority=$this->priorityOf($indexitem,true))===false) |
|
| 548 | + if(($priority=$this->priorityOf($indexitem, true))===false) |
|
| 549 | 549 | throw new TInvalidDataValueException('list_item_inexistent'); |
| 550 | 550 | |
| 551 | - $this->insertAtIndexInPriority($item,$priority[1],$priority[0]); |
|
| 551 | + $this->insertAtIndexInPriority($item, $priority[1], $priority[0]); |
|
| 552 | 552 | |
| 553 | 553 | return $priority[2]; |
| 554 | 554 | } |
@@ -564,14 +564,14 @@ discard block |
||
| 564 | 564 | public function insertAfter($indexitem, $item) |
| 565 | 565 | { |
| 566 | 566 | if($this->getReadOnly()) |
| 567 | - throw new TInvalidOperationException('list_readonly',get_class($this)); |
|
| 567 | + throw new TInvalidOperationException('list_readonly', get_class($this)); |
|
| 568 | 568 | |
| 569 | - if(($priority=$this->priorityOf($indexitem,true))===false) |
|
| 569 | + if(($priority=$this->priorityOf($indexitem, true))===false) |
|
| 570 | 570 | throw new TInvalidDataValueException('list_item_inexistent'); |
| 571 | 571 | |
| 572 | - $this->insertAtIndexInPriority($item,$priority[1]+1,$priority[0]); |
|
| 572 | + $this->insertAtIndexInPriority($item, $priority[1] + 1, $priority[0]); |
|
| 573 | 573 | |
| 574 | - return $priority[2]+1; |
|
| 574 | + return $priority[2] + 1; |
|
| 575 | 575 | } |
| 576 | 576 | |
| 577 | 577 | /** |
@@ -598,15 +598,15 @@ discard block |
||
| 598 | 598 | * @return array the array of priorities keys with values of arrays of items that are below a specified priority. |
| 599 | 599 | * The priorities are sorted so important priorities, lower numerics, are first. |
| 600 | 600 | */ |
| 601 | - public function toArrayBelowPriority($priority,$inclusive=false) |
|
| 601 | + public function toArrayBelowPriority($priority, $inclusive=false) |
|
| 602 | 602 | { |
| 603 | 603 | $this->sortPriorities(); |
| 604 | 604 | $items=array(); |
| 605 | 605 | foreach($this->_d as $itemspriority=>$itemsatpriority) |
| 606 | 606 | { |
| 607 | - if((!$inclusive&&$itemspriority>=$priority)||$itemspriority>$priority) |
|
| 607 | + if((!$inclusive && $itemspriority >= $priority) || $itemspriority > $priority) |
|
| 608 | 608 | break; |
| 609 | - $items=array_merge($items,$itemsatpriority); |
|
| 609 | + $items=array_merge($items, $itemsatpriority); |
|
| 610 | 610 | } |
| 611 | 611 | return $items; |
| 612 | 612 | } |
@@ -618,15 +618,15 @@ discard block |
||
| 618 | 618 | * @return array the array of priorities keys with values of arrays of items that are above a specified priority. |
| 619 | 619 | * The priorities are sorted so important priorities, lower numerics, are first. |
| 620 | 620 | */ |
| 621 | - public function toArrayAbovePriority($priority,$inclusive=true) |
|
| 621 | + public function toArrayAbovePriority($priority, $inclusive=true) |
|
| 622 | 622 | { |
| 623 | 623 | $this->sortPriorities(); |
| 624 | 624 | $items=array(); |
| 625 | 625 | foreach($this->_d as $itemspriority=>$itemsatpriority) |
| 626 | 626 | { |
| 627 | - if((!$inclusive&&$itemspriority<=$priority)||$itemspriority<$priority) |
|
| 627 | + if((!$inclusive && $itemspriority <= $priority) || $itemspriority < $priority) |
|
| 628 | 628 | continue; |
| 629 | - $items=array_merge($items,$itemsatpriority); |
|
| 629 | + $items=array_merge($items, $itemsatpriority); |
|
| 630 | 630 | } |
| 631 | 631 | return $items; |
| 632 | 632 | } |
@@ -642,15 +642,15 @@ discard block |
||
| 642 | 642 | { |
| 643 | 643 | if($data instanceof TPriorityList) |
| 644 | 644 | { |
| 645 | - if($this->getCount()>0) |
|
| 645 | + if($this->getCount() > 0) |
|
| 646 | 646 | $this->clear(); |
| 647 | 647 | foreach($data->getPriorities() as $priority) |
| 648 | 648 | { |
| 649 | 649 | foreach($data->itemsAtPriority($priority) as $index=>$item) |
| 650 | - $this->insertAtIndexInPriority($item,$index,$priority); |
|
| 650 | + $this->insertAtIndexInPriority($item, $index, $priority); |
|
| 651 | 651 | } |
| 652 | - } else if(is_array($data)||$data instanceof \Traversable) { |
|
| 653 | - if($this->getCount()>0) |
|
| 652 | + } else if(is_array($data) || $data instanceof \Traversable) { |
|
| 653 | + if($this->getCount() > 0) |
|
| 654 | 654 | $this->clear(); |
| 655 | 655 | foreach($data as $key=>$item) |
| 656 | 656 | $this->add($item); |
@@ -673,10 +673,10 @@ discard block |
||
| 673 | 673 | foreach($data->getPriorities() as $priority) |
| 674 | 674 | { |
| 675 | 675 | foreach($data->itemsAtPriority($priority) as $index=>$item) |
| 676 | - $this->insertAtIndexInPriority($item,false,$priority); |
|
| 676 | + $this->insertAtIndexInPriority($item, false, $priority); |
|
| 677 | 677 | } |
| 678 | 678 | } |
| 679 | - else if(is_array($data)||$data instanceof \Traversable) |
|
| 679 | + else if(is_array($data) || $data instanceof \Traversable) |
|
| 680 | 680 | { |
| 681 | 681 | foreach($data as $priority=>$item) |
| 682 | 682 | $this->add($item); |
@@ -694,7 +694,7 @@ discard block |
||
| 694 | 694 | */ |
| 695 | 695 | public function offsetExists($offset) |
| 696 | 696 | { |
| 697 | - return ($offset>=0&&$offset<$this->getCount()); |
|
| 697 | + return ($offset >= 0 && $offset < $this->getCount()); |
|
| 698 | 698 | } |
| 699 | 699 | |
| 700 | 700 | /** |
@@ -720,18 +720,18 @@ discard block |
||
| 720 | 720 | * @param integer the offset to set element |
| 721 | 721 | * @param mixed the element value |
| 722 | 722 | */ |
| 723 | - public function offsetSet($offset,$item) |
|
| 723 | + public function offsetSet($offset, $item) |
|
| 724 | 724 | { |
| 725 | 725 | if($offset===null) |
| 726 | 726 | return $this->add($item); |
| 727 | 727 | if($offset===$this->getCount()) { |
| 728 | - $priority=$this->priorityAt($offset-1,true); |
|
| 728 | + $priority=$this->priorityAt($offset - 1, true); |
|
| 729 | 729 | $priority[1]++; |
| 730 | 730 | } else { |
| 731 | - $priority=$this->priorityAt($offset,true); |
|
| 732 | - $this->removeAtIndexInPriority($priority[1],$priority[0]); |
|
| 731 | + $priority=$this->priorityAt($offset, true); |
|
| 732 | + $this->removeAtIndexInPriority($priority[1], $priority[0]); |
|
| 733 | 733 | } |
| 734 | - $this->insertAtIndexInPriority($item,$priority[1],$priority[0]); |
|
| 734 | + $this->insertAtIndexInPriority($item, $priority[1], $priority[0]); |
|
| 735 | 735 | } |
| 736 | 736 | |
| 737 | 737 | /** |