@@ -160,8 +160,7 @@ discard block |
||
| 160 | 160 | throw new TInvalidDataValueException('comparevalidator_controltocompare_invalid'); |
| 161 | 161 | if(($value2 = $this->getValidationValue($control2)) === '') |
| 162 | 162 | return false; |
| 163 | - } |
|
| 164 | - else |
|
| 163 | + } else |
|
| 165 | 164 | $value2 = $this->getValueToCompare(); |
| 166 | 165 | |
| 167 | 166 | $values = $this->getComparisonValues($value, $value2); |
@@ -204,8 +203,7 @@ discard block |
||
| 204 | 203 | { |
| 205 | 204 | $formatter = new TSimpleDateFormatter($dateFormat); |
| 206 | 205 | return [$formatter->parse($value1), $formatter->parse($value2)]; |
| 207 | - } |
|
| 208 | - else |
|
| 206 | + } else |
|
| 209 | 207 | return [strtotime($value1), strtotime($value2)]; |
| 210 | 208 | } |
| 211 | 209 | return [$value1, $value2]; |
@@ -198,8 +198,7 @@ discard block |
||
| 198 | 198 | $classPath = $this->getItemRenderer(); |
| 199 | 199 | $template = $this->_itemTemplate; |
| 200 | 200 | } |
| 201 | - } |
|
| 202 | - else |
|
| 201 | + } else |
|
| 203 | 202 | { |
| 204 | 203 | $template = $this->_itemTemplate; |
| 205 | 204 | $classPath = $this->getItemRenderer(); |
@@ -215,13 +214,11 @@ discard block |
||
| 215 | 214 | } |
| 216 | 215 | if($control instanceof \Prado\IDataRenderer) |
| 217 | 216 | $control->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']); |
| 218 | - } |
|
| 219 | - elseif($template !== null) |
|
| 217 | + } elseif($template !== null) |
|
| 220 | 218 | $template->instantiateIn($cell); |
| 221 | 219 | elseif($itemType !== TListItemType::EditItem) |
| 222 | 220 | $cell->setText(' '); |
| 223 | - } |
|
| 224 | - elseif($itemType === TListItemType::Header) |
|
| 221 | + } elseif($itemType === TListItemType::Header) |
|
| 225 | 222 | { |
| 226 | 223 | if(($classPath = $this->getHeaderRenderer()) !== '') |
| 227 | 224 | $this->initializeHeaderCell($cell, $columnIndex); |
@@ -229,8 +226,7 @@ discard block |
||
| 229 | 226 | $this->_headerTemplate->instantiateIn($cell); |
| 230 | 227 | else |
| 231 | 228 | $this->initializeHeaderCell($cell, $columnIndex); |
| 232 | - } |
|
| 233 | - elseif($itemType === TListItemType::Footer) |
|
| 229 | + } elseif($itemType === TListItemType::Footer) |
|
| 234 | 230 | { |
| 235 | 231 | if(($classPath = $this->getFooterRenderer()) !== '') |
| 236 | 232 | $this->initializeFooterCell($cell, $columnIndex); |
@@ -214,7 +214,7 @@ |
||
| 214 | 214 | $control->setItemType($itemType); |
| 215 | 215 | } |
| 216 | 216 | if($control instanceof \Prado\IDataRenderer) |
| 217 | - $control->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']); |
|
| 217 | + $control->attachEventHandler('OnDataBinding', [$this, 'dataBindColumn']); |
|
| 218 | 218 | } |
| 219 | 219 | elseif($template !== null) |
| 220 | 220 | $template->instantiateIn($cell); |
@@ -260,8 +260,7 @@ |
||
| 260 | 260 | if($maxValue !== '') |
| 261 | 261 | $valid = $valid && $this->isLessThan($value, $formatter->parse($maxValue)); |
| 262 | 262 | return $valid; |
| 263 | - } |
|
| 264 | - else |
|
| 263 | + } else |
|
| 265 | 264 | { |
| 266 | 265 | $value = strtotime($value); |
| 267 | 266 | if($minValue !== '') |
@@ -143,15 +143,13 @@ discard block |
||
| 143 | 143 | $activeView = $views->itemAt($index); |
| 144 | 144 | else |
| 145 | 145 | throw new TInvalidDataValueException('tabpanel_activeviewid_invalid', $id); |
| 146 | - } |
|
| 147 | - elseif(($index = $this->getActiveViewIndex()) >= 0) |
|
| 146 | + } elseif(($index = $this->getActiveViewIndex()) >= 0) |
|
| 148 | 147 | { |
| 149 | 148 | if($index < $views->getCount()) |
| 150 | 149 | $activeView = $views->itemAt($index); |
| 151 | 150 | else |
| 152 | 151 | throw new TInvalidDataValueException('tabpanel_activeviewindex_invalid', $index); |
| 153 | - } |
|
| 154 | - else |
|
| 152 | + } else |
|
| 155 | 153 | { |
| 156 | 154 | foreach($views as $index => $view) |
| 157 | 155 | { |
@@ -327,8 +325,7 @@ discard block |
||
| 327 | 325 | $this->setActiveViewIndex($index); |
| 328 | 326 | $this->setActiveViewID($view->getID(false)); |
| 329 | 327 | $view->setActive(true); |
| 330 | - } |
|
| 331 | - else |
|
| 328 | + } else |
|
| 332 | 329 | $v->setActive(false); |
| 333 | 330 | } |
| 334 | 331 | } |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | public function getCssClass() |
| 219 | 219 | { |
| 220 | 220 | $cssClass = parent::getCssClass(); |
| 221 | - return $cssClass === ''?'tab-panel':$cssClass; |
|
| 221 | + return $cssClass === '' ? 'tab-panel' : $cssClass; |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | /** |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | { |
| 345 | 345 | if(($index = $values[$this->getClientID() . '_1']) !== null) |
| 346 | 346 | { |
| 347 | - $index = (int)$index; |
|
| 347 | + $index = (int) $index; |
|
| 348 | 348 | $currentIndex = $this->getActiveViewIndex(); |
| 349 | 349 | if($currentIndex !== $index) |
| 350 | 350 | { |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | public function onPreRender($param) |
| 398 | 398 | { |
| 399 | 399 | parent::onPreRender($param); |
| 400 | - $this->getActiveView(); // determine the active view |
|
| 400 | + $this->getActiveView(); // determine the active view |
|
| 401 | 401 | $this->registerStyleSheet(); |
| 402 | 402 | |
| 403 | 403 | $page = $this->getPage(); |
@@ -211,8 +211,7 @@ discard block |
||
| 211 | 211 | $button = $this->createButton('Edit', $this->getEditText(), false, ''); |
| 212 | 212 | $cell->getControls()->add($button); |
| 213 | 213 | $cell->registerObject('EditButton', $button); |
| 214 | - } |
|
| 215 | - elseif($itemType === TListItemType::EditItem) |
|
| 214 | + } elseif($itemType === TListItemType::EditItem) |
|
| 216 | 215 | { |
| 217 | 216 | $controls = $cell->getControls(); |
| 218 | 217 | $button = $this->createButton('Update', $this->getUpdateText(), $this->getCausesValidation(), $this->getValidationGroup()); |
@@ -222,8 +221,7 @@ discard block |
||
| 222 | 221 | $button = $this->createButton('Cancel', $this->getCancelText(), false, ''); |
| 223 | 222 | $controls->add($button); |
| 224 | 223 | $cell->registerObject('CancelButton', $button); |
| 225 | - } |
|
| 226 | - else |
|
| 224 | + } else |
|
| 227 | 225 | parent::initializeCell($cell, $columnIndex, $itemType); |
| 228 | 226 | } |
| 229 | 227 | |
@@ -271,8 +271,7 @@ discard block |
||
| 271 | 271 | $cell->getControls()->add($listControl); |
| 272 | 272 | $cell->registerObject('DropDownList', $listControl); |
| 273 | 273 | $control = $listControl; |
| 274 | - } |
|
| 275 | - else |
|
| 274 | + } else |
|
| 276 | 275 | $control = $cell; |
| 277 | 276 | $control->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']); |
| 278 | 277 | break; |
@@ -308,8 +307,7 @@ discard block |
||
| 308 | 307 | $value = $text; |
| 309 | 308 | $formatString = $this->getDataTextFormatString(); |
| 310 | 309 | $text = $this->formatDataValue($formatString, $text); |
| 311 | - } |
|
| 312 | - else |
|
| 310 | + } else |
|
| 313 | 311 | $text = $value; |
| 314 | 312 | if($sender instanceof TTableCell) |
| 315 | 313 | $sender->setText($text); |
@@ -274,13 +274,13 @@ |
||
| 274 | 274 | } |
| 275 | 275 | else |
| 276 | 276 | $control = $cell; |
| 277 | - $control->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']); |
|
| 277 | + $control->attachEventHandler('OnDataBinding', [$this, 'dataBindColumn']); |
|
| 278 | 278 | break; |
| 279 | 279 | case TListItemType::Item: |
| 280 | 280 | case TListItemType::AlternatingItem: |
| 281 | 281 | case TListItemType::SelectedItem: |
| 282 | 282 | if($this->getDataTextField() !== '' || $this->getDataValueField() !== '') |
| 283 | - $cell->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']); |
|
| 283 | + $cell->attachEventHandler('OnDataBinding', [$this, 'dataBindColumn']); |
|
| 284 | 284 | break; |
| 285 | 285 | default: |
| 286 | 286 | parent::initializeCell($cell, $columnIndex, $itemType); |
@@ -404,8 +404,7 @@ discard block |
||
| 404 | 404 | $this->setPageCount($targetControl->getPageCount()); |
| 405 | 405 | $this->setCurrentPageIndex($targetControl->getCurrentPageIndex()); |
| 406 | 406 | $this->buildPager(); |
| 407 | - } |
|
| 408 | - else |
|
| 407 | + } else |
|
| 409 | 408 | $this->_pageCount = 0; |
| 410 | 409 | } |
| 411 | 410 | |
@@ -467,15 +466,13 @@ discard block |
||
| 467 | 466 | $button->setCssClass($this->getButtonCssClass()); |
| 468 | 467 | return $button; |
| 469 | 468 | } |
| 470 | - } |
|
| 471 | - else |
|
| 469 | + } else |
|
| 472 | 470 | { |
| 473 | 471 | if($buttonType === TPagerButtonType::ImageButton) |
| 474 | 472 | { |
| 475 | 473 | $button = new TImageButton; |
| 476 | 474 | $button->setImageUrl($this->getPageImageUrl($text, $commandName)); |
| 477 | - } |
|
| 478 | - else |
|
| 475 | + } else |
|
| 479 | 476 | $button = new TButton; |
| 480 | 477 | if(!$enabled) |
| 481 | 478 | $button->setEnabled(false); |
@@ -530,8 +527,7 @@ discard block |
||
| 530 | 527 | } |
| 531 | 528 | $label = $this->createPagerButton($buttonType, false, $this->getPrevPageText(), self::CMD_PAGE_PREV, ''); |
| 532 | 529 | $controls->add($label); |
| 533 | - } |
|
| 534 | - else |
|
| 530 | + } else |
|
| 535 | 531 | { |
| 536 | 532 | if(($text = $this->getFirstPageText()) !== '') |
| 537 | 533 | { |
@@ -553,8 +549,7 @@ discard block |
||
| 553 | 549 | $label = $this->createPagerButton($buttonType, false, $text, self::CMD_PAGE_LAST, ''); |
| 554 | 550 | $controls->add($label); |
| 555 | 551 | } |
| 556 | - } |
|
| 557 | - else |
|
| 552 | + } else |
|
| 558 | 553 | { |
| 559 | 554 | $button = $this->createPagerButton($buttonType, true, $this->getNextPageText(), self::CMD_PAGE_NEXT, ''); |
| 560 | 555 | $controls->add($button); |
@@ -612,8 +607,7 @@ discard block |
||
| 612 | 607 | { |
| 613 | 608 | $label = $this->createPagerButton($buttonType, false, "$i", self::CMD_PAGE, ''); |
| 614 | 609 | $controls->add($label); |
| 615 | - } |
|
| 616 | - else |
|
| 610 | + } else |
|
| 617 | 611 | { |
| 618 | 612 | $button = $this->createPagerButton($buttonType, true, "$i", self::CMD_PAGE, "$i"); |
| 619 | 613 | $controls->add($button); |
@@ -690,32 +684,27 @@ discard block |
||
| 690 | 684 | $pageIndex = TPropertyValue::ensureInteger($param->getCommandParameter()) - 1; |
| 691 | 685 | $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $pageIndex)); |
| 692 | 686 | return true; |
| 693 | - } |
|
| 694 | - elseif(strcasecmp($command, self::CMD_PAGE_NEXT) === 0) |
|
| 687 | + } elseif(strcasecmp($command, self::CMD_PAGE_NEXT) === 0) |
|
| 695 | 688 | { |
| 696 | 689 | $pageIndex = $this->getCurrentPageIndex() + 1; |
| 697 | 690 | $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $pageIndex)); |
| 698 | 691 | return true; |
| 699 | - } |
|
| 700 | - elseif(strcasecmp($command, self::CMD_PAGE_PREV) === 0) |
|
| 692 | + } elseif(strcasecmp($command, self::CMD_PAGE_PREV) === 0) |
|
| 701 | 693 | { |
| 702 | 694 | $pageIndex = $this->getCurrentPageIndex() - 1; |
| 703 | 695 | $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $pageIndex)); |
| 704 | 696 | return true; |
| 705 | - } |
|
| 706 | - elseif(strcasecmp($command, self::CMD_PAGE_FIRST) === 0) |
|
| 697 | + } elseif(strcasecmp($command, self::CMD_PAGE_FIRST) === 0) |
|
| 707 | 698 | { |
| 708 | 699 | $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, 0)); |
| 709 | 700 | return true; |
| 710 | - } |
|
| 711 | - elseif(strcasecmp($command, self::CMD_PAGE_LAST) === 0) |
|
| 701 | + } elseif(strcasecmp($command, self::CMD_PAGE_LAST) === 0) |
|
| 712 | 702 | { |
| 713 | 703 | $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $this->getPageCount() - 1)); |
| 714 | 704 | return true; |
| 715 | 705 | } |
| 716 | 706 | return false; |
| 717 | - } |
|
| 718 | - else |
|
| 707 | + } else |
|
| 719 | 708 | return false; |
| 720 | 709 | } |
| 721 | 710 | } |
| 722 | 711 | \ No newline at end of file |
@@ -577,12 +577,12 @@ discard block |
||
| 577 | 577 | $pageCount = $this->getPageCount(); |
| 578 | 578 | $pageIndex = $this->getCurrentPageIndex() + 1; |
| 579 | 579 | $maxButtonCount = $this->getPageButtonCount(); |
| 580 | - $buttonCount = $maxButtonCount > $pageCount?$pageCount:$maxButtonCount; |
|
| 580 | + $buttonCount = $maxButtonCount > $pageCount ? $pageCount : $maxButtonCount; |
|
| 581 | 581 | $startPageIndex = 1; |
| 582 | 582 | $endPageIndex = $buttonCount; |
| 583 | 583 | if($pageIndex > $endPageIndex) |
| 584 | 584 | { |
| 585 | - $startPageIndex = ((int)(($pageIndex - 1) / $maxButtonCount)) * $maxButtonCount + 1; |
|
| 585 | + $startPageIndex = ((int) (($pageIndex - 1) / $maxButtonCount)) * $maxButtonCount + 1; |
|
| 586 | 586 | if(($endPageIndex = $startPageIndex + $maxButtonCount - 1) > $pageCount) |
| 587 | 587 | $endPageIndex = $pageCount; |
| 588 | 588 | if($endPageIndex - $startPageIndex + 1 < $maxButtonCount) |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | $controls->add("\n"); |
| 607 | 607 | } |
| 608 | 608 | |
| 609 | - for($i = $startPageIndex;$i <= $endPageIndex;++$i) |
|
| 609 | + for($i = $startPageIndex; $i <= $endPageIndex; ++$i) |
|
| 610 | 610 | { |
| 611 | 611 | if($i === $pageIndex) |
| 612 | 612 | { |
@@ -648,7 +648,7 @@ discard block |
||
| 648 | 648 | $list->dataBind(); |
| 649 | 649 | $list->setSelectedIndex($this->getCurrentPageIndex()); |
| 650 | 650 | $list->setAutoPostBack(true); |
| 651 | - $list->attachEventHandler('OnSelectedIndexChanged', [$this,'listIndexChanged']); |
|
| 651 | + $list->attachEventHandler('OnSelectedIndexChanged', [$this, 'listIndexChanged']); |
|
| 652 | 652 | } |
| 653 | 653 | |
| 654 | 654 | /** |
@@ -74,11 +74,9 @@ |
||
| 74 | 74 | $this->_forControl = $control->getClientID(); |
| 75 | 75 | parent::render($writer); |
| 76 | 76 | } |
| 77 | - } |
|
| 78 | - else |
|
| 77 | + } else |
|
| 79 | 78 | throw new TInvalidDataValueException('label_associatedcontrol_invalid', $aid); |
| 80 | - } |
|
| 81 | - else |
|
| 79 | + } else |
|
| 82 | 80 | parent::render($writer); |
| 83 | 81 | } |
| 84 | 82 | |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | */ |
| 43 | 43 | protected function getTagName() |
| 44 | 44 | { |
| 45 | - return ($this->getForControl() === '')?'span':'label'; |
|
| 45 | + return ($this->getForControl() === '') ? 'span' : 'label'; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -106,8 +106,7 @@ discard block |
||
| 106 | 106 | { |
| 107 | 107 | if($this->getEnableClientScript() && $this->needPostBackScript()) |
| 108 | 108 | $this->renderClientControlScript($writer); |
| 109 | - } |
|
| 110 | - elseif($this->getEnabled()) // in this case, parent will not render 'disabled' |
|
| 109 | + } elseif($this->getEnabled()) // in this case, parent will not render 'disabled' |
|
| 111 | 110 | $writer->addAttribute('disabled', 'disabled'); |
| 112 | 111 | parent::addAttributesToRender($writer); |
| 113 | 112 | } |
@@ -141,8 +140,7 @@ discard block |
||
| 141 | 140 | { |
| 142 | 141 | $group = $this->getValidationGroup(); |
| 143 | 142 | return $this->getPage()->getValidators($group)->getCount() > 0; |
| 144 | - } |
|
| 145 | - else |
|
| 143 | + } else |
|
| 146 | 144 | return false; |
| 147 | 145 | } |
| 148 | 146 | |