@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | */ |
88 | 88 | protected function evaluateDataTypeCheck($value) |
89 | 89 | { |
90 | - if($value == '') |
|
90 | + if ($value == '') |
|
91 | 91 | return true; |
92 | 92 | |
93 | - switch($this->getDataType()) |
|
93 | + switch ($this->getDataType()) |
|
94 | 94 | { |
95 | 95 | case TValidationDataType::Integer: |
96 | 96 | return preg_match('/^[-+]?[0-9]+$/', trim($value)); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | return preg_match('/^[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?$/', trim($value)); |
99 | 99 | case TValidationDataType::Date: |
100 | 100 | $dateFormat = $this->getDateFormat(); |
101 | - if(strlen($dateFormat)) |
|
101 | + if (strlen($dateFormat)) |
|
102 | 102 | { |
103 | 103 | $formatter = new TSimpleDateFormatter($dateFormat); |
104 | 104 | return $formatter->isValidDate($value); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | { |
118 | 118 | $options = parent::getClientScriptOptions(); |
119 | 119 | $options['DataType'] = $this->getDataType(); |
120 | - if(($dateFormat = $this->getDateFormat()) !== '') |
|
120 | + if (($dateFormat = $this->getDateFormat()) !== '') |
|
121 | 121 | $options['DateFormat'] = $dateFormat; |
122 | 122 | return $options; |
123 | 123 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public function evaluateIsValid() |
133 | 133 | { |
134 | - if(($value = $this->getValidationValue($this->getValidationTarget())) === '') |
|
134 | + if (($value = $this->getValidationValue($this->getValidationTarget())) === '') |
|
135 | 135 | return true; |
136 | 136 | |
137 | 137 | return $this->evaluateDataTypeCheck($value); |
@@ -87,8 +87,9 @@ discard block |
||
87 | 87 | */ |
88 | 88 | protected function evaluateDataTypeCheck($value) |
89 | 89 | { |
90 | - if($value == '') |
|
91 | - return true; |
|
90 | + if($value == '') { |
|
91 | + return true; |
|
92 | + } |
|
92 | 93 | |
93 | 94 | switch($this->getDataType()) |
94 | 95 | { |
@@ -102,9 +103,9 @@ discard block |
||
102 | 103 | { |
103 | 104 | $formatter = new TSimpleDateFormatter($dateFormat); |
104 | 105 | return $formatter->isValidDate($value); |
106 | + } else { |
|
107 | + return strtotime($value) > 0; |
|
105 | 108 | } |
106 | - else |
|
107 | - return strtotime($value) > 0; |
|
108 | 109 | } |
109 | 110 | return true; |
110 | 111 | } |
@@ -117,8 +118,9 @@ discard block |
||
117 | 118 | { |
118 | 119 | $options = parent::getClientScriptOptions(); |
119 | 120 | $options['DataType'] = $this->getDataType(); |
120 | - if(($dateFormat = $this->getDateFormat()) !== '') |
|
121 | - $options['DateFormat'] = $dateFormat; |
|
121 | + if(($dateFormat = $this->getDateFormat()) !== '') { |
|
122 | + $options['DateFormat'] = $dateFormat; |
|
123 | + } |
|
122 | 124 | return $options; |
123 | 125 | } |
124 | 126 | |
@@ -131,8 +133,9 @@ discard block |
||
131 | 133 | */ |
132 | 134 | public function evaluateIsValid() |
133 | 135 | { |
134 | - if(($value = $this->getValidationValue($this->getValidationTarget())) === '') |
|
135 | - return true; |
|
136 | + if(($value = $this->getValidationValue($this->getValidationTarget())) === '') { |
|
137 | + return true; |
|
138 | + } |
|
136 | 139 | |
137 | 140 | return $this->evaluateDataTypeCheck($value); |
138 | 141 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | public function setTitle($value) |
63 | 63 | { |
64 | 64 | $this->setViewState('Title', $value, ''); |
65 | - if($this->_wizard) |
|
65 | + if ($this->_wizard) |
|
66 | 66 | $this->_wizard->wizardStepsChanged(); |
67 | 67 | } |
68 | 68 | |
@@ -96,10 +96,10 @@ discard block |
||
96 | 96 | public function setStepType($type) |
97 | 97 | { |
98 | 98 | $type = TPropertyValue::ensureEnum($type, 'Prado\\Web\\UI\\WebControls\\TWizardStepType'); |
99 | - if($type !== $this->getStepType()) |
|
99 | + if ($type !== $this->getStepType()) |
|
100 | 100 | { |
101 | 101 | $this->setViewState('StepType', $type, TWizardStepType::Auto); |
102 | - if($this->_wizard) |
|
102 | + if ($this->_wizard) |
|
103 | 103 | $this->_wizard->wizardStepsChanged(); |
104 | 104 | } |
105 | 105 | } |
@@ -62,8 +62,9 @@ discard block |
||
62 | 62 | public function setTitle($value) |
63 | 63 | { |
64 | 64 | $this->setViewState('Title', $value, ''); |
65 | - if($this->_wizard) |
|
66 | - $this->_wizard->wizardStepsChanged(); |
|
65 | + if($this->_wizard) { |
|
66 | + $this->_wizard->wizardStepsChanged(); |
|
67 | + } |
|
67 | 68 | } |
68 | 69 | |
69 | 70 | /** |
@@ -99,8 +100,9 @@ discard block |
||
99 | 100 | if($type !== $this->getStepType()) |
100 | 101 | { |
101 | 102 | $this->setViewState('StepType', $type, TWizardStepType::Auto); |
102 | - if($this->_wizard) |
|
103 | - $this->_wizard->wizardStepsChanged(); |
|
103 | + if($this->_wizard) { |
|
104 | + $this->_wizard->wizardStepsChanged(); |
|
105 | + } |
|
104 | 106 | } |
105 | 107 | } |
106 | 108 | } |
107 | 109 | \ No newline at end of file |
@@ -62,7 +62,7 @@ |
||
62 | 62 | */ |
63 | 63 | public function insertAt($index, $item) |
64 | 64 | { |
65 | - if($item instanceof TDataGridColumn) |
|
65 | + if ($item instanceof TDataGridColumn) |
|
66 | 66 | { |
67 | 67 | $item->setOwner($this->_o); |
68 | 68 | parent::insertAt($index, $item); |
@@ -66,8 +66,8 @@ |
||
66 | 66 | { |
67 | 67 | $item->setOwner($this->_o); |
68 | 68 | parent::insertAt($index, $item); |
69 | + } else { |
|
70 | + throw new TInvalidDataTypeException('datagridcolumncollection_datagridcolumn_required'); |
|
69 | 71 | } |
70 | - else |
|
71 | - throw new TInvalidDataTypeException('datagridcolumncollection_datagridcolumn_required'); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | \ No newline at end of file |
@@ -47,7 +47,7 @@ |
||
47 | 47 | */ |
48 | 48 | public function bubbleEvent($sender, $param) |
49 | 49 | { |
50 | - if($param instanceof \Prado\Web\UI\TCommandEventParameter) |
|
50 | + if ($param instanceof \Prado\Web\UI\TCommandEventParameter) |
|
51 | 51 | { |
52 | 52 | $this->raiseBubbleEvent($this, new TDataGridCommandEventParameter($this, $sender, $param)); |
53 | 53 | return true; |
@@ -51,9 +51,9 @@ |
||
51 | 51 | { |
52 | 52 | $this->raiseBubbleEvent($this, new TDataGridCommandEventParameter($this, $sender, $param)); |
53 | 53 | return true; |
54 | + } else { |
|
55 | + return false; |
|
54 | 56 | } |
55 | - else |
|
56 | - return false; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | public function loadState() |
75 | 75 | { |
76 | 76 | parent::loadState(); |
77 | - if($this->getEnableViewState(true)) |
|
77 | + if ($this->getEnableViewState(true)) |
|
78 | 78 | { |
79 | 79 | $this->getControls()->clear(); |
80 | 80 | $this->buildPager(); |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | */ |
325 | 325 | public function setPageButtonCount($value) |
326 | 326 | { |
327 | - if(($value = TPropertyValue::ensureInteger($value)) < 1) |
|
327 | + if (($value = TPropertyValue::ensureInteger($value)) < 1) |
|
328 | 328 | throw new TInvalidDataValueException('pager_pagebuttoncount_invalid'); |
329 | 329 | $this->setViewState('PageButtonCount', $value, 10); |
330 | 330 | } |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | */ |
344 | 344 | protected function setCurrentPageIndex($value) |
345 | 345 | { |
346 | - if(($value = TPropertyValue::ensureInteger($value)) < 0) |
|
346 | + if (($value = TPropertyValue::ensureInteger($value)) < 0) |
|
347 | 347 | throw new TInvalidDataValueException('pager_currentpageindex_invalid'); |
348 | 348 | $this->setViewState('CurrentPageIndex', $value, 0); |
349 | 349 | } |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | */ |
363 | 363 | protected function setPageCount($value) |
364 | 364 | { |
365 | - if(($value = TPropertyValue::ensureInteger($value)) < 0) |
|
365 | + if (($value = TPropertyValue::ensureInteger($value)) < 0) |
|
366 | 366 | throw new TInvalidDataValueException('pager_pagecount_invalid'); |
367 | 367 | $this->setViewState('PageCount', $value, 0); |
368 | 368 | } |
@@ -394,10 +394,10 @@ discard block |
||
394 | 394 | parent::onPreRender($param); |
395 | 395 | |
396 | 396 | $controlID = $this->getControlToPaginate(); |
397 | - if(($targetControl = $this->getNamingContainer()->findControl($controlID)) === null || !($targetControl instanceof TDataBoundControl)) |
|
397 | + if (($targetControl = $this->getNamingContainer()->findControl($controlID)) === null || !($targetControl instanceof TDataBoundControl)) |
|
398 | 398 | throw new TConfigurationException('pager_controltopaginate_invalid', $controlID); |
399 | 399 | |
400 | - if($targetControl->getAllowPaging()) |
|
400 | + if ($targetControl->getAllowPaging()) |
|
401 | 401 | { |
402 | 402 | $this->_pageCount = $targetControl->getPageCount(); |
403 | 403 | $this->getControls()->clear(); |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | */ |
418 | 418 | public function render($writer) |
419 | 419 | { |
420 | - if($this->_pageCount > 1) |
|
420 | + if ($this->_pageCount > 1) |
|
421 | 421 | parent::render($writer); |
422 | 422 | } |
423 | 423 | |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | */ |
429 | 429 | protected function buildPager() |
430 | 430 | { |
431 | - switch($this->getMode()) |
|
431 | + switch ($this->getMode()) |
|
432 | 432 | { |
433 | 433 | case TPagerMode::NextPrev: |
434 | 434 | $this->buildNextPrevPager(); |
@@ -456,9 +456,9 @@ discard block |
||
456 | 456 | */ |
457 | 457 | protected function createPagerButton($buttonType, $enabled, $text, $commandName, $commandParameter) |
458 | 458 | { |
459 | - if($buttonType === TPagerButtonType::LinkButton) |
|
459 | + if ($buttonType === TPagerButtonType::LinkButton) |
|
460 | 460 | { |
461 | - if($enabled) |
|
461 | + if ($enabled) |
|
462 | 462 | $button = new TLinkButton; |
463 | 463 | else |
464 | 464 | { |
@@ -470,14 +470,14 @@ discard block |
||
470 | 470 | } |
471 | 471 | else |
472 | 472 | { |
473 | - if($buttonType === TPagerButtonType::ImageButton) |
|
473 | + if ($buttonType === TPagerButtonType::ImageButton) |
|
474 | 474 | { |
475 | 475 | $button = new TImageButton; |
476 | 476 | $button->setImageUrl($this->getPageImageUrl($text, $commandName)); |
477 | 477 | } |
478 | 478 | else |
479 | 479 | $button = new TButton; |
480 | - if(!$enabled) |
|
480 | + if (!$enabled) |
|
481 | 481 | $button->setEnabled(false); |
482 | 482 | } |
483 | 483 | $button->setText($text); |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | */ |
496 | 496 | protected function getPageImageUrl($text, $commandName) |
497 | 497 | { |
498 | - switch($commandName) |
|
498 | + switch ($commandName) |
|
499 | 499 | { |
500 | 500 | case self::CMD_PAGE: |
501 | 501 | $url = $this->getNumericPageImageUrl(); |
@@ -520,9 +520,9 @@ discard block |
||
520 | 520 | { |
521 | 521 | $buttonType = $this->getButtonType(); |
522 | 522 | $controls = $this->getControls(); |
523 | - if($this->getIsFirstPage()) |
|
523 | + if ($this->getIsFirstPage()) |
|
524 | 524 | { |
525 | - if(($text = $this->getFirstPageText()) !== '') |
|
525 | + if (($text = $this->getFirstPageText()) !== '') |
|
526 | 526 | { |
527 | 527 | $label = $this->createPagerButton($buttonType, false, $text, self::CMD_PAGE_FIRST, ''); |
528 | 528 | $controls->add($label); |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | } |
534 | 534 | else |
535 | 535 | { |
536 | - if(($text = $this->getFirstPageText()) !== '') |
|
536 | + if (($text = $this->getFirstPageText()) !== '') |
|
537 | 537 | { |
538 | 538 | $button = $this->createPagerButton($buttonType, true, $text, self::CMD_PAGE_FIRST, ''); |
539 | 539 | $controls->add($button); |
@@ -543,11 +543,11 @@ discard block |
||
543 | 543 | $controls->add($button); |
544 | 544 | } |
545 | 545 | $controls->add("\n"); |
546 | - if($this->getIsLastPage()) |
|
546 | + if ($this->getIsLastPage()) |
|
547 | 547 | { |
548 | 548 | $label = $this->createPagerButton($buttonType, false, $this->getNextPageText(), self::CMD_PAGE_NEXT, ''); |
549 | 549 | $controls->add($label); |
550 | - if(($text = $this->getLastPageText()) !== '') |
|
550 | + if (($text = $this->getLastPageText()) !== '') |
|
551 | 551 | { |
552 | 552 | $controls->add("\n"); |
553 | 553 | $label = $this->createPagerButton($buttonType, false, $text, self::CMD_PAGE_LAST, ''); |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | { |
559 | 559 | $button = $this->createPagerButton($buttonType, true, $this->getNextPageText(), self::CMD_PAGE_NEXT, ''); |
560 | 560 | $controls->add($button); |
561 | - if(($text = $this->getLastPageText()) !== '') |
|
561 | + if (($text = $this->getLastPageText()) !== '') |
|
562 | 562 | { |
563 | 563 | $controls->add("\n"); |
564 | 564 | $button = $this->createPagerButton($buttonType, true, $text, self::CMD_PAGE_LAST, ''); |
@@ -577,24 +577,24 @@ 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 | - if($pageIndex > $endPageIndex) |
|
583 | + if ($pageIndex > $endPageIndex) |
|
584 | 584 | { |
585 | - $startPageIndex = ((int)(($pageIndex - 1) / $maxButtonCount)) * $maxButtonCount + 1; |
|
586 | - if(($endPageIndex = $startPageIndex + $maxButtonCount - 1) > $pageCount) |
|
585 | + $startPageIndex = ((int) (($pageIndex - 1) / $maxButtonCount)) * $maxButtonCount + 1; |
|
586 | + if (($endPageIndex = $startPageIndex + $maxButtonCount - 1) > $pageCount) |
|
587 | 587 | $endPageIndex = $pageCount; |
588 | - if($endPageIndex - $startPageIndex + 1 < $maxButtonCount) |
|
588 | + if ($endPageIndex - $startPageIndex + 1 < $maxButtonCount) |
|
589 | 589 | { |
590 | - if(($startPageIndex = $endPageIndex - $maxButtonCount + 1) < 1) |
|
590 | + if (($startPageIndex = $endPageIndex - $maxButtonCount + 1) < 1) |
|
591 | 591 | $startPageIndex = 1; |
592 | 592 | } |
593 | 593 | } |
594 | 594 | |
595 | - if($startPageIndex > 1) |
|
595 | + if ($startPageIndex > 1) |
|
596 | 596 | { |
597 | - if(($text = $this->getFirstPageText()) !== '') |
|
597 | + if (($text = $this->getFirstPageText()) !== '') |
|
598 | 598 | { |
599 | 599 | $button = $this->createPagerButton($buttonType, true, $text, self::CMD_PAGE_FIRST, ''); |
600 | 600 | $controls->add($button); |
@@ -606,9 +606,9 @@ 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 | - if($i === $pageIndex) |
|
611 | + if ($i === $pageIndex) |
|
612 | 612 | { |
613 | 613 | $label = $this->createPagerButton($buttonType, false, "$i", self::CMD_PAGE, ''); |
614 | 614 | $controls->add($label); |
@@ -618,17 +618,17 @@ discard block |
||
618 | 618 | $button = $this->createPagerButton($buttonType, true, "$i", self::CMD_PAGE, "$i"); |
619 | 619 | $controls->add($button); |
620 | 620 | } |
621 | - if($i < $endPageIndex) |
|
621 | + if ($i < $endPageIndex) |
|
622 | 622 | $controls->add("\n"); |
623 | 623 | } |
624 | 624 | |
625 | - if($pageCount > $endPageIndex) |
|
625 | + if ($pageCount > $endPageIndex) |
|
626 | 626 | { |
627 | 627 | $controls->add("\n"); |
628 | 628 | $nextPageIndex = $endPageIndex + 1; |
629 | 629 | $button = $this->createPagerButton($buttonType, true, $this->getNextPageText(), self::CMD_PAGE, "$nextPageIndex"); |
630 | 630 | $controls->add($button); |
631 | - if(($text = $this->getLastPageText()) !== '') |
|
631 | + if (($text = $this->getLastPageText()) !== '') |
|
632 | 632 | { |
633 | 633 | $controls->add("\n"); |
634 | 634 | $button = $this->createPagerButton($buttonType, true, $text, self::CMD_PAGE_LAST, ''); |
@@ -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 | /** |
@@ -682,33 +682,33 @@ discard block |
||
682 | 682 | */ |
683 | 683 | public function bubbleEvent($sender, $param) |
684 | 684 | { |
685 | - if($param instanceof \Prado\Web\UI\TCommandEventParameter) |
|
685 | + if ($param instanceof \Prado\Web\UI\TCommandEventParameter) |
|
686 | 686 | { |
687 | 687 | $command = $param->getCommandName(); |
688 | - if(strcasecmp($command, self::CMD_PAGE) === 0) |
|
688 | + if (strcasecmp($command, self::CMD_PAGE) === 0) |
|
689 | 689 | { |
690 | 690 | $pageIndex = TPropertyValue::ensureInteger($param->getCommandParameter()) - 1; |
691 | 691 | $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $pageIndex)); |
692 | 692 | return true; |
693 | 693 | } |
694 | - elseif(strcasecmp($command, self::CMD_PAGE_NEXT) === 0) |
|
694 | + elseif (strcasecmp($command, self::CMD_PAGE_NEXT) === 0) |
|
695 | 695 | { |
696 | 696 | $pageIndex = $this->getCurrentPageIndex() + 1; |
697 | 697 | $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $pageIndex)); |
698 | 698 | return true; |
699 | 699 | } |
700 | - elseif(strcasecmp($command, self::CMD_PAGE_PREV) === 0) |
|
700 | + elseif (strcasecmp($command, self::CMD_PAGE_PREV) === 0) |
|
701 | 701 | { |
702 | 702 | $pageIndex = $this->getCurrentPageIndex() - 1; |
703 | 703 | $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $pageIndex)); |
704 | 704 | return true; |
705 | 705 | } |
706 | - elseif(strcasecmp($command, self::CMD_PAGE_FIRST) === 0) |
|
706 | + elseif (strcasecmp($command, self::CMD_PAGE_FIRST) === 0) |
|
707 | 707 | { |
708 | 708 | $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, 0)); |
709 | 709 | return true; |
710 | 710 | } |
711 | - elseif(strcasecmp($command, self::CMD_PAGE_LAST) === 0) |
|
711 | + elseif (strcasecmp($command, self::CMD_PAGE_LAST) === 0) |
|
712 | 712 | { |
713 | 713 | $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $this->getPageCount() - 1)); |
714 | 714 | return true; |
@@ -324,8 +324,9 @@ discard block |
||
324 | 324 | */ |
325 | 325 | public function setPageButtonCount($value) |
326 | 326 | { |
327 | - if(($value = TPropertyValue::ensureInteger($value)) < 1) |
|
328 | - throw new TInvalidDataValueException('pager_pagebuttoncount_invalid'); |
|
327 | + if(($value = TPropertyValue::ensureInteger($value)) < 1) { |
|
328 | + throw new TInvalidDataValueException('pager_pagebuttoncount_invalid'); |
|
329 | + } |
|
329 | 330 | $this->setViewState('PageButtonCount', $value, 10); |
330 | 331 | } |
331 | 332 | |
@@ -343,8 +344,9 @@ discard block |
||
343 | 344 | */ |
344 | 345 | protected function setCurrentPageIndex($value) |
345 | 346 | { |
346 | - if(($value = TPropertyValue::ensureInteger($value)) < 0) |
|
347 | - throw new TInvalidDataValueException('pager_currentpageindex_invalid'); |
|
347 | + if(($value = TPropertyValue::ensureInteger($value)) < 0) { |
|
348 | + throw new TInvalidDataValueException('pager_currentpageindex_invalid'); |
|
349 | + } |
|
348 | 350 | $this->setViewState('CurrentPageIndex', $value, 0); |
349 | 351 | } |
350 | 352 | |
@@ -362,8 +364,9 @@ discard block |
||
362 | 364 | */ |
363 | 365 | protected function setPageCount($value) |
364 | 366 | { |
365 | - if(($value = TPropertyValue::ensureInteger($value)) < 0) |
|
366 | - throw new TInvalidDataValueException('pager_pagecount_invalid'); |
|
367 | + if(($value = TPropertyValue::ensureInteger($value)) < 0) { |
|
368 | + throw new TInvalidDataValueException('pager_pagecount_invalid'); |
|
369 | + } |
|
367 | 370 | $this->setViewState('PageCount', $value, 0); |
368 | 371 | } |
369 | 372 | |
@@ -394,8 +397,9 @@ discard block |
||
394 | 397 | parent::onPreRender($param); |
395 | 398 | |
396 | 399 | $controlID = $this->getControlToPaginate(); |
397 | - if(($targetControl = $this->getNamingContainer()->findControl($controlID)) === null || !($targetControl instanceof TDataBoundControl)) |
|
398 | - throw new TConfigurationException('pager_controltopaginate_invalid', $controlID); |
|
400 | + if(($targetControl = $this->getNamingContainer()->findControl($controlID)) === null || !($targetControl instanceof TDataBoundControl)) { |
|
401 | + throw new TConfigurationException('pager_controltopaginate_invalid', $controlID); |
|
402 | + } |
|
399 | 403 | |
400 | 404 | if($targetControl->getAllowPaging()) |
401 | 405 | { |
@@ -404,9 +408,9 @@ discard block |
||
404 | 408 | $this->setPageCount($targetControl->getPageCount()); |
405 | 409 | $this->setCurrentPageIndex($targetControl->getCurrentPageIndex()); |
406 | 410 | $this->buildPager(); |
411 | + } else { |
|
412 | + $this->_pageCount = 0; |
|
407 | 413 | } |
408 | - else |
|
409 | - $this->_pageCount = 0; |
|
410 | 414 | } |
411 | 415 | |
412 | 416 | /** |
@@ -417,8 +421,9 @@ discard block |
||
417 | 421 | */ |
418 | 422 | public function render($writer) |
419 | 423 | { |
420 | - if($this->_pageCount > 1) |
|
421 | - parent::render($writer); |
|
424 | + if($this->_pageCount > 1) { |
|
425 | + parent::render($writer); |
|
426 | + } |
|
422 | 427 | } |
423 | 428 | |
424 | 429 | /** |
@@ -458,27 +463,27 @@ discard block |
||
458 | 463 | { |
459 | 464 | if($buttonType === TPagerButtonType::LinkButton) |
460 | 465 | { |
461 | - if($enabled) |
|
462 | - $button = new TLinkButton; |
|
463 | - else |
|
466 | + if($enabled) { |
|
467 | + $button = new TLinkButton; |
|
468 | + } else |
|
464 | 469 | { |
465 | 470 | $button = new TLabel; |
466 | 471 | $button->setText($text); |
467 | 472 | $button->setCssClass($this->getButtonCssClass()); |
468 | 473 | return $button; |
469 | 474 | } |
470 | - } |
|
471 | - else |
|
475 | + } else |
|
472 | 476 | { |
473 | 477 | if($buttonType === TPagerButtonType::ImageButton) |
474 | 478 | { |
475 | 479 | $button = new TImageButton; |
476 | 480 | $button->setImageUrl($this->getPageImageUrl($text, $commandName)); |
481 | + } else { |
|
482 | + $button = new TButton; |
|
483 | + } |
|
484 | + if(!$enabled) { |
|
485 | + $button->setEnabled(false); |
|
477 | 486 | } |
478 | - else |
|
479 | - $button = new TButton; |
|
480 | - if(!$enabled) |
|
481 | - $button->setEnabled(false); |
|
482 | 487 | } |
483 | 488 | $button->setText($text); |
484 | 489 | $button->setCommandName($commandName); |
@@ -530,8 +535,7 @@ discard block |
||
530 | 535 | } |
531 | 536 | $label = $this->createPagerButton($buttonType, false, $this->getPrevPageText(), self::CMD_PAGE_PREV, ''); |
532 | 537 | $controls->add($label); |
533 | - } |
|
534 | - else |
|
538 | + } else |
|
535 | 539 | { |
536 | 540 | if(($text = $this->getFirstPageText()) !== '') |
537 | 541 | { |
@@ -553,8 +557,7 @@ discard block |
||
553 | 557 | $label = $this->createPagerButton($buttonType, false, $text, self::CMD_PAGE_LAST, ''); |
554 | 558 | $controls->add($label); |
555 | 559 | } |
556 | - } |
|
557 | - else |
|
560 | + } else |
|
558 | 561 | { |
559 | 562 | $button = $this->createPagerButton($buttonType, true, $this->getNextPageText(), self::CMD_PAGE_NEXT, ''); |
560 | 563 | $controls->add($button); |
@@ -583,12 +586,14 @@ discard block |
||
583 | 586 | if($pageIndex > $endPageIndex) |
584 | 587 | { |
585 | 588 | $startPageIndex = ((int)(($pageIndex - 1) / $maxButtonCount)) * $maxButtonCount + 1; |
586 | - if(($endPageIndex = $startPageIndex + $maxButtonCount - 1) > $pageCount) |
|
587 | - $endPageIndex = $pageCount; |
|
589 | + if(($endPageIndex = $startPageIndex + $maxButtonCount - 1) > $pageCount) { |
|
590 | + $endPageIndex = $pageCount; |
|
591 | + } |
|
588 | 592 | if($endPageIndex - $startPageIndex + 1 < $maxButtonCount) |
589 | 593 | { |
590 | - if(($startPageIndex = $endPageIndex - $maxButtonCount + 1) < 1) |
|
591 | - $startPageIndex = 1; |
|
594 | + if(($startPageIndex = $endPageIndex - $maxButtonCount + 1) < 1) { |
|
595 | + $startPageIndex = 1; |
|
596 | + } |
|
592 | 597 | } |
593 | 598 | } |
594 | 599 | |
@@ -612,14 +617,14 @@ discard block |
||
612 | 617 | { |
613 | 618 | $label = $this->createPagerButton($buttonType, false, "$i", self::CMD_PAGE, ''); |
614 | 619 | $controls->add($label); |
615 | - } |
|
616 | - else |
|
620 | + } else |
|
617 | 621 | { |
618 | 622 | $button = $this->createPagerButton($buttonType, true, "$i", self::CMD_PAGE, "$i"); |
619 | 623 | $controls->add($button); |
620 | 624 | } |
621 | - if($i < $endPageIndex) |
|
622 | - $controls->add("\n"); |
|
625 | + if($i < $endPageIndex) { |
|
626 | + $controls->add("\n"); |
|
627 | + } |
|
623 | 628 | } |
624 | 629 | |
625 | 630 | if($pageCount > $endPageIndex) |
@@ -690,32 +695,28 @@ discard block |
||
690 | 695 | $pageIndex = TPropertyValue::ensureInteger($param->getCommandParameter()) - 1; |
691 | 696 | $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $pageIndex)); |
692 | 697 | return true; |
693 | - } |
|
694 | - elseif(strcasecmp($command, self::CMD_PAGE_NEXT) === 0) |
|
698 | + } elseif(strcasecmp($command, self::CMD_PAGE_NEXT) === 0) |
|
695 | 699 | { |
696 | 700 | $pageIndex = $this->getCurrentPageIndex() + 1; |
697 | 701 | $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $pageIndex)); |
698 | 702 | return true; |
699 | - } |
|
700 | - elseif(strcasecmp($command, self::CMD_PAGE_PREV) === 0) |
|
703 | + } elseif(strcasecmp($command, self::CMD_PAGE_PREV) === 0) |
|
701 | 704 | { |
702 | 705 | $pageIndex = $this->getCurrentPageIndex() - 1; |
703 | 706 | $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $pageIndex)); |
704 | 707 | return true; |
705 | - } |
|
706 | - elseif(strcasecmp($command, self::CMD_PAGE_FIRST) === 0) |
|
708 | + } elseif(strcasecmp($command, self::CMD_PAGE_FIRST) === 0) |
|
707 | 709 | { |
708 | 710 | $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, 0)); |
709 | 711 | return true; |
710 | - } |
|
711 | - elseif(strcasecmp($command, self::CMD_PAGE_LAST) === 0) |
|
712 | + } elseif(strcasecmp($command, self::CMD_PAGE_LAST) === 0) |
|
712 | 713 | { |
713 | 714 | $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $this->getPageCount() - 1)); |
714 | 715 | return true; |
715 | 716 | } |
716 | 717 | return false; |
718 | + } else { |
|
719 | + return false; |
|
717 | 720 | } |
718 | - else |
|
719 | - return false; |
|
720 | 721 | } |
721 | 722 | } |
722 | 723 | \ No newline at end of file |
@@ -171,10 +171,10 @@ discard block |
||
171 | 171 | protected function evaluateIsValid() |
172 | 172 | { |
173 | 173 | $value = $this->getValidationValue($this->getValidationTarget()); |
174 | - if($value === '') |
|
174 | + if ($value === '') |
|
175 | 175 | return true; |
176 | 176 | |
177 | - switch($this->getDataType()) |
|
177 | + switch ($this->getDataType()) |
|
178 | 178 | { |
179 | 179 | case TRangeValidationDataType::Integer: |
180 | 180 | return $this->isValidInteger($value); |
@@ -201,9 +201,9 @@ discard block |
||
201 | 201 | |
202 | 202 | $valid = preg_match('/^[-+]?[0-9]+$/', trim($value)); |
203 | 203 | $value = intval($value); |
204 | - if($minValue !== '') |
|
204 | + if ($minValue !== '') |
|
205 | 205 | $valid = $valid && $this->isGreaterThan($value, intval($minValue)); |
206 | - if($maxValue !== '') |
|
206 | + if ($maxValue !== '') |
|
207 | 207 | $valid = $valid && $this->isLessThan($value, intval($maxValue)); |
208 | 208 | return $valid; |
209 | 209 | } |
@@ -230,9 +230,9 @@ discard block |
||
230 | 230 | |
231 | 231 | $valid = preg_match('/^[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?$/', trim($value)); |
232 | 232 | $value = floatval($value); |
233 | - if($minValue !== '') |
|
233 | + if ($minValue !== '') |
|
234 | 234 | $valid = $valid && $this->isGreaterThan($value, floatval($minValue)); |
235 | - if($maxValue !== '') |
|
235 | + if ($maxValue !== '') |
|
236 | 236 | $valid = $valid && $this->isLessThan($value, floatval($maxValue)); |
237 | 237 | return $valid; |
238 | 238 | } |
@@ -251,22 +251,22 @@ discard block |
||
251 | 251 | $valid = true; |
252 | 252 | |
253 | 253 | $dateFormat = $this->getDateFormat(); |
254 | - if($dateFormat !== '') |
|
254 | + if ($dateFormat !== '') |
|
255 | 255 | { |
256 | 256 | $formatter = new TSimpleDateFormatter($dateFormat); |
257 | 257 | $value = $formatter->parse($value); |
258 | - if($minValue !== '') |
|
258 | + if ($minValue !== '') |
|
259 | 259 | $valid = $valid && $this->isGreaterThan($value, $formatter->parse($minValue)); |
260 | - if($maxValue !== '') |
|
260 | + if ($maxValue !== '') |
|
261 | 261 | $valid = $valid && $this->isLessThan($value, $formatter->parse($maxValue)); |
262 | 262 | return $valid; |
263 | 263 | } |
264 | 264 | else |
265 | 265 | { |
266 | 266 | $value = strtotime($value); |
267 | - if($minValue !== '') |
|
267 | + if ($minValue !== '') |
|
268 | 268 | $valid = $valid && $this->isGreaterThan($value, strtotime($minValue)); |
269 | - if($maxValue !== '') |
|
269 | + if ($maxValue !== '') |
|
270 | 270 | $valid = $valid && $this->isLessThan($value, strtotime($maxValue)); |
271 | 271 | return $valid; |
272 | 272 | } |
@@ -284,9 +284,9 @@ discard block |
||
284 | 284 | $maxValue = $this->getMaxValue(); |
285 | 285 | |
286 | 286 | $valid = true; |
287 | - if($minValue !== '') |
|
287 | + if ($minValue !== '') |
|
288 | 288 | $valid = $valid && $this->isGreaterThan(strcmp($value, $minValue), 0); |
289 | - if($maxValue !== '') |
|
289 | + if ($maxValue !== '') |
|
290 | 290 | $valid = $valid && $this->isLessThan(strcmp($value, $maxValue), 0); |
291 | 291 | return $valid; |
292 | 292 | } |
@@ -302,18 +302,18 @@ discard block |
||
302 | 302 | |
303 | 303 | $valid = true; |
304 | 304 | $charset = $this->getCharset(); |
305 | - if($charset === '') |
|
305 | + if ($charset === '') |
|
306 | 306 | { |
307 | 307 | $app = $this->getApplication()->getGlobalization(); |
308 | 308 | $charset = $app ? $app->getCharset() : null; |
309 | - if(!$charset) |
|
309 | + if (!$charset) |
|
310 | 310 | $charset = 'UTF-8'; |
311 | 311 | } |
312 | 312 | |
313 | 313 | $length = iconv_strlen($value, $charset); |
314 | - if($minValue !== '') |
|
314 | + if ($minValue !== '') |
|
315 | 315 | $valid = $valid && $this->isGreaterThan($length, intval($minValue)); |
316 | - if($maxValue !== '') |
|
316 | + if ($maxValue !== '') |
|
317 | 317 | $valid = $valid && $this->isLessThan($length, intval($maxValue)); |
318 | 318 | return $valid; |
319 | 319 | } |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | $options['MaxValue'] = $this->getMaxValue(); |
330 | 330 | $options['DataType'] = $this->getDataType(); |
331 | 331 | $options['StrictComparison'] = $this->getStrictComparison(); |
332 | - if(($dateFormat = $this->getDateFormat()) !== '') |
|
332 | + if (($dateFormat = $this->getDateFormat()) !== '') |
|
333 | 333 | $options['DateFormat'] = $dateFormat; |
334 | 334 | return $options; |
335 | 335 | } |
@@ -171,8 +171,9 @@ discard block |
||
171 | 171 | protected function evaluateIsValid() |
172 | 172 | { |
173 | 173 | $value = $this->getValidationValue($this->getValidationTarget()); |
174 | - if($value === '') |
|
175 | - return true; |
|
174 | + if($value === '') { |
|
175 | + return true; |
|
176 | + } |
|
176 | 177 | |
177 | 178 | switch($this->getDataType()) |
178 | 179 | { |
@@ -201,10 +202,12 @@ discard block |
||
201 | 202 | |
202 | 203 | $valid = preg_match('/^[-+]?[0-9]+$/', trim($value)); |
203 | 204 | $value = intval($value); |
204 | - if($minValue !== '') |
|
205 | - $valid = $valid && $this->isGreaterThan($value, intval($minValue)); |
|
206 | - if($maxValue !== '') |
|
207 | - $valid = $valid && $this->isLessThan($value, intval($maxValue)); |
|
205 | + if($minValue !== '') { |
|
206 | + $valid = $valid && $this->isGreaterThan($value, intval($minValue)); |
|
207 | + } |
|
208 | + if($maxValue !== '') { |
|
209 | + $valid = $valid && $this->isLessThan($value, intval($maxValue)); |
|
210 | + } |
|
208 | 211 | return $valid; |
209 | 212 | } |
210 | 213 | |
@@ -230,10 +233,12 @@ discard block |
||
230 | 233 | |
231 | 234 | $valid = preg_match('/^[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?$/', trim($value)); |
232 | 235 | $value = floatval($value); |
233 | - if($minValue !== '') |
|
234 | - $valid = $valid && $this->isGreaterThan($value, floatval($minValue)); |
|
235 | - if($maxValue !== '') |
|
236 | - $valid = $valid && $this->isLessThan($value, floatval($maxValue)); |
|
236 | + if($minValue !== '') { |
|
237 | + $valid = $valid && $this->isGreaterThan($value, floatval($minValue)); |
|
238 | + } |
|
239 | + if($maxValue !== '') { |
|
240 | + $valid = $valid && $this->isLessThan($value, floatval($maxValue)); |
|
241 | + } |
|
237 | 242 | return $valid; |
238 | 243 | } |
239 | 244 | |
@@ -255,19 +260,22 @@ discard block |
||
255 | 260 | { |
256 | 261 | $formatter = new TSimpleDateFormatter($dateFormat); |
257 | 262 | $value = $formatter->parse($value); |
258 | - if($minValue !== '') |
|
259 | - $valid = $valid && $this->isGreaterThan($value, $formatter->parse($minValue)); |
|
260 | - if($maxValue !== '') |
|
261 | - $valid = $valid && $this->isLessThan($value, $formatter->parse($maxValue)); |
|
263 | + if($minValue !== '') { |
|
264 | + $valid = $valid && $this->isGreaterThan($value, $formatter->parse($minValue)); |
|
265 | + } |
|
266 | + if($maxValue !== '') { |
|
267 | + $valid = $valid && $this->isLessThan($value, $formatter->parse($maxValue)); |
|
268 | + } |
|
262 | 269 | return $valid; |
263 | - } |
|
264 | - else |
|
270 | + } else |
|
265 | 271 | { |
266 | 272 | $value = strtotime($value); |
267 | - if($minValue !== '') |
|
268 | - $valid = $valid && $this->isGreaterThan($value, strtotime($minValue)); |
|
269 | - if($maxValue !== '') |
|
270 | - $valid = $valid && $this->isLessThan($value, strtotime($maxValue)); |
|
273 | + if($minValue !== '') { |
|
274 | + $valid = $valid && $this->isGreaterThan($value, strtotime($minValue)); |
|
275 | + } |
|
276 | + if($maxValue !== '') { |
|
277 | + $valid = $valid && $this->isLessThan($value, strtotime($maxValue)); |
|
278 | + } |
|
271 | 279 | return $valid; |
272 | 280 | } |
273 | 281 | } |
@@ -284,10 +292,12 @@ discard block |
||
284 | 292 | $maxValue = $this->getMaxValue(); |
285 | 293 | |
286 | 294 | $valid = true; |
287 | - if($minValue !== '') |
|
288 | - $valid = $valid && $this->isGreaterThan(strcmp($value, $minValue), 0); |
|
289 | - if($maxValue !== '') |
|
290 | - $valid = $valid && $this->isLessThan(strcmp($value, $maxValue), 0); |
|
295 | + if($minValue !== '') { |
|
296 | + $valid = $valid && $this->isGreaterThan(strcmp($value, $minValue), 0); |
|
297 | + } |
|
298 | + if($maxValue !== '') { |
|
299 | + $valid = $valid && $this->isLessThan(strcmp($value, $maxValue), 0); |
|
300 | + } |
|
291 | 301 | return $valid; |
292 | 302 | } |
293 | 303 | |
@@ -306,15 +316,18 @@ discard block |
||
306 | 316 | { |
307 | 317 | $app = $this->getApplication()->getGlobalization(); |
308 | 318 | $charset = $app ? $app->getCharset() : null; |
309 | - if(!$charset) |
|
310 | - $charset = 'UTF-8'; |
|
319 | + if(!$charset) { |
|
320 | + $charset = 'UTF-8'; |
|
321 | + } |
|
311 | 322 | } |
312 | 323 | |
313 | 324 | $length = iconv_strlen($value, $charset); |
314 | - if($minValue !== '') |
|
315 | - $valid = $valid && $this->isGreaterThan($length, intval($minValue)); |
|
316 | - if($maxValue !== '') |
|
317 | - $valid = $valid && $this->isLessThan($length, intval($maxValue)); |
|
325 | + if($minValue !== '') { |
|
326 | + $valid = $valid && $this->isGreaterThan($length, intval($minValue)); |
|
327 | + } |
|
328 | + if($maxValue !== '') { |
|
329 | + $valid = $valid && $this->isLessThan($length, intval($maxValue)); |
|
330 | + } |
|
318 | 331 | return $valid; |
319 | 332 | } |
320 | 333 | |
@@ -329,8 +342,9 @@ discard block |
||
329 | 342 | $options['MaxValue'] = $this->getMaxValue(); |
330 | 343 | $options['DataType'] = $this->getDataType(); |
331 | 344 | $options['StrictComparison'] = $this->getStrictComparison(); |
332 | - if(($dateFormat = $this->getDateFormat()) !== '') |
|
333 | - $options['DateFormat'] = $dateFormat; |
|
345 | + if(($dateFormat = $this->getDateFormat()) !== '') { |
|
346 | + $options['DateFormat'] = $dateFormat; |
|
347 | + } |
|
334 | 348 | return $options; |
335 | 349 | } |
336 | 350 | } |
337 | 351 | \ No newline at end of file |
@@ -49,7 +49,7 @@ |
||
49 | 49 | */ |
50 | 50 | public function insertAt($index, $item) |
51 | 51 | { |
52 | - if($item instanceof TWizardStep) |
|
52 | + if ($item instanceof TWizardStep) |
|
53 | 53 | { |
54 | 54 | parent::insertAt($index, $item); |
55 | 55 | $this->_wizard->getMultiView()->getViews()->insertAt($index, $item); |
@@ -54,9 +54,9 @@ |
||
54 | 54 | parent::insertAt($index, $item); |
55 | 55 | $this->_wizard->getMultiView()->getViews()->insertAt($index, $item); |
56 | 56 | $this->_wizard->addedWizardStep($item); |
57 | + } else { |
|
58 | + throw new TInvalidDataTypeException('wizardstepcollection_wizardstep_required'); |
|
57 | 59 | } |
58 | - else |
|
59 | - throw new TInvalidDataTypeException('wizardstepcollection_wizardstep_required'); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -133,7 +133,7 @@ |
||
133 | 133 | */ |
134 | 134 | public function bubbleEvent($sender, $param) |
135 | 135 | { |
136 | - if($param instanceof \Prado\Web\UI\TCommandEventParameter) |
|
136 | + if ($param instanceof \Prado\Web\UI\TCommandEventParameter) |
|
137 | 137 | { |
138 | 138 | $this->raiseBubbleEvent($this, new TDataListCommandEventParameter($this, $sender, $param)); |
139 | 139 | return true; |
@@ -137,8 +137,8 @@ |
||
137 | 137 | { |
138 | 138 | $this->raiseBubbleEvent($this, new TDataListCommandEventParameter($this, $sender, $param)); |
139 | 139 | return true; |
140 | + } else { |
|
141 | + return false; |
|
140 | 142 | } |
141 | - else |
|
142 | - return false; |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | \ No newline at end of file |
@@ -206,13 +206,13 @@ discard block |
||
206 | 206 | */ |
207 | 207 | public function initializeCell($cell, $columnIndex, $itemType) |
208 | 208 | { |
209 | - if($itemType === TListItemType::Item || $itemType === TListItemType::AlternatingItem || $itemType === TListItemType::SelectedItem) |
|
209 | + if ($itemType === TListItemType::Item || $itemType === TListItemType::AlternatingItem || $itemType === TListItemType::SelectedItem) |
|
210 | 210 | { |
211 | 211 | $button = $this->createButton('Edit', $this->getEditText(), false, ''); |
212 | 212 | $cell->getControls()->add($button); |
213 | 213 | $cell->registerObject('EditButton', $button); |
214 | 214 | } |
215 | - elseif($itemType === TListItemType::EditItem) |
|
215 | + elseif ($itemType === TListItemType::EditItem) |
|
216 | 216 | { |
217 | 217 | $controls = $cell->getControls(); |
218 | 218 | $button = $this->createButton('Update', $this->getUpdateText(), $this->getCausesValidation(), $this->getValidationGroup()); |
@@ -238,16 +238,16 @@ discard block |
||
238 | 238 | */ |
239 | 239 | protected function createButton($commandName, $text, $causesValidation, $validationGroup) |
240 | 240 | { |
241 | - if($this->getButtonType() === TButtonColumnType::LinkButton) |
|
241 | + if ($this->getButtonType() === TButtonColumnType::LinkButton) |
|
242 | 242 | $button = new TLinkButton; |
243 | - elseif($this->getButtonType() === TButtonColumnType::PushButton) |
|
243 | + elseif ($this->getButtonType() === TButtonColumnType::PushButton) |
|
244 | 244 | $button = new TButton; |
245 | 245 | else // image buttons |
246 | 246 | { |
247 | 247 | $button = new TImageButton; |
248 | - if(strcasecmp($commandName, 'Update') === 0) |
|
248 | + if (strcasecmp($commandName, 'Update') === 0) |
|
249 | 249 | $url = $this->getUpdateImageUrl(); |
250 | - elseif(strcasecmp($commandName, 'Cancel') === 0) |
|
250 | + elseif (strcasecmp($commandName, 'Cancel') === 0) |
|
251 | 251 | $url = $this->getCancelImageUrl(); |
252 | 252 | else |
253 | 253 | $url = $this->getEditImageUrl(); |
@@ -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,9 +221,9 @@ discard block |
||
222 | 221 | $button = $this->createButton('Cancel', $this->getCancelText(), false, ''); |
223 | 222 | $controls->add($button); |
224 | 223 | $cell->registerObject('CancelButton', $button); |
224 | + } else { |
|
225 | + parent::initializeCell($cell, $columnIndex, $itemType); |
|
225 | 226 | } |
226 | - else |
|
227 | - parent::initializeCell($cell, $columnIndex, $itemType); |
|
228 | 227 | } |
229 | 228 | |
230 | 229 | /** |
@@ -238,19 +237,20 @@ discard block |
||
238 | 237 | */ |
239 | 238 | protected function createButton($commandName, $text, $causesValidation, $validationGroup) |
240 | 239 | { |
241 | - if($this->getButtonType() === TButtonColumnType::LinkButton) |
|
242 | - $button = new TLinkButton; |
|
243 | - elseif($this->getButtonType() === TButtonColumnType::PushButton) |
|
244 | - $button = new TButton; |
|
245 | - else // image buttons |
|
240 | + if($this->getButtonType() === TButtonColumnType::LinkButton) { |
|
241 | + $button = new TLinkButton; |
|
242 | + } elseif($this->getButtonType() === TButtonColumnType::PushButton) { |
|
243 | + $button = new TButton; |
|
244 | + } else // image buttons |
|
246 | 245 | { |
247 | 246 | $button = new TImageButton; |
248 | - if(strcasecmp($commandName, 'Update') === 0) |
|
249 | - $url = $this->getUpdateImageUrl(); |
|
250 | - elseif(strcasecmp($commandName, 'Cancel') === 0) |
|
251 | - $url = $this->getCancelImageUrl(); |
|
252 | - else |
|
253 | - $url = $this->getEditImageUrl(); |
|
247 | + if(strcasecmp($commandName, 'Update') === 0) { |
|
248 | + $url = $this->getUpdateImageUrl(); |
|
249 | + } elseif(strcasecmp($commandName, 'Cancel') === 0) { |
|
250 | + $url = $this->getCancelImageUrl(); |
|
251 | + } else { |
|
252 | + $url = $this->getEditImageUrl(); |
|
253 | + } |
|
254 | 254 | $button->setImageUrl($url); |
255 | 255 | } |
256 | 256 | $button->setText($text); |