@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | */ |
302 | 302 | public function getTimeStamp() |
303 | 303 | { |
304 | - if(trim($this->getText()) === '') |
|
304 | + if (trim($this->getText()) === '') |
|
305 | 305 | return null; |
306 | 306 | else |
307 | 307 | return $this->getTimeStampFromText(); |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | */ |
314 | 314 | public function setTimeStamp($value) |
315 | 315 | { |
316 | - if($value === null || (is_string($value) && trim($value) === '')) |
|
316 | + if ($value === null || (is_string($value) && trim($value) === '')) |
|
317 | 317 | $this->setText(''); |
318 | 318 | else |
319 | 319 | { |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | */ |
378 | 378 | public function getClientSide() |
379 | 379 | { |
380 | - if($this->_clientScript === null) |
|
380 | + if ($this->_clientScript === null) |
|
381 | 381 | $this->_clientScript = $this->createClientScript(); |
382 | 382 | return $this->_clientScript; |
383 | 383 | } |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | */ |
398 | 398 | public function getValidationPropertyValue() |
399 | 399 | { |
400 | - if(($text = $this->getText()) === '') |
|
400 | + if (($text = $this->getText()) === '') |
|
401 | 401 | return ''; |
402 | 402 | $date = $this->getTimeStamp(); |
403 | 403 | return $date == null ? $text : $date; |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | */ |
422 | 422 | public function render($writer) |
423 | 423 | { |
424 | - if($this->getInputMode() == TDatePickerInputMode::TextBox) |
|
424 | + if ($this->getInputMode() == TDatePickerInputMode::TextBox) |
|
425 | 425 | { |
426 | 426 | parent::render($writer); |
427 | 427 | $this->renderDatePickerButtons($writer); |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | else |
430 | 430 | { |
431 | 431 | $this->renderDropDownListCalendar($writer); |
432 | - if($this->hasDayPattern()) |
|
432 | + if ($this->hasDayPattern()) |
|
433 | 433 | { |
434 | 434 | $this->renderClientControlScript($writer); |
435 | 435 | $this->renderDatePickerButtons($writer); |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | */ |
443 | 443 | protected function renderDatePickerButtons($writer) |
444 | 444 | { |
445 | - if($this->getShowCalendar()) |
|
445 | + if ($this->getShowCalendar()) |
|
446 | 446 | { |
447 | 447 | switch ($this->getMode()) |
448 | 448 | { |
@@ -466,10 +466,10 @@ discard block |
||
466 | 466 | */ |
467 | 467 | public function loadPostData($key, $values) |
468 | 468 | { |
469 | - if($this->getInputMode() == TDatePickerInputMode::TextBox) |
|
469 | + if ($this->getInputMode() == TDatePickerInputMode::TextBox) |
|
470 | 470 | return parent::loadPostData($key, $values); |
471 | 471 | $value = $this->getDateFromPostData($key, $values); |
472 | - if(!$this->getReadOnly() && $this->getText() !== $value) |
|
472 | + if (!$this->getReadOnly() && $this->getText() !== $value) |
|
473 | 473 | { |
474 | 474 | $this->setText($value); |
475 | 475 | return true; |
@@ -489,26 +489,26 @@ discard block |
||
489 | 489 | $date = @getdate(); |
490 | 490 | |
491 | 491 | $pattern = $this->getDateFormat(); |
492 | - $pattern = str_replace(['MMMM', 'MMM'], ['MM','MM'], $pattern); |
|
492 | + $pattern = str_replace(['MMMM', 'MMM'], ['MM', 'MM'], $pattern); |
|
493 | 493 | $formatter = new TSimpleDateFormatter($pattern); |
494 | 494 | |
495 | 495 | $order = $formatter->getDayMonthYearOrdering(); |
496 | 496 | |
497 | - if(isset($values[$key . '$day'])) { |
|
498 | - $day = intval($values[$key . '$day']); |
|
499 | - } elseif(in_array('day', $order)) { |
|
497 | + if (isset($values[$key.'$day'])) { |
|
498 | + $day = intval($values[$key.'$day']); |
|
499 | + } elseif (in_array('day', $order)) { |
|
500 | 500 | $day = $date['mday']; |
501 | 501 | } else { |
502 | 502 | $day = 1; |
503 | 503 | } |
504 | 504 | |
505 | - if(isset($values[$key . '$month'])) |
|
506 | - $month = intval($values[$key . '$month']) + 1; |
|
505 | + if (isset($values[$key.'$month'])) |
|
506 | + $month = intval($values[$key.'$month']) + 1; |
|
507 | 507 | else |
508 | 508 | $month = $date['mon']; |
509 | 509 | |
510 | - if(isset($values[$key . '$year'])) |
|
511 | - $year = intval($values[$key . '$year']); |
|
510 | + if (isset($values[$key.'$year'])) |
|
511 | + $year = intval($values[$key.'$year']); |
|
512 | 512 | else |
513 | 513 | $year = $date['year']; |
514 | 514 | |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | //$date = @mktime(0, 0, 0, $month, $day, $year); |
520 | 520 | |
521 | 521 | $pattern = $this->getDateFormat(); |
522 | - $pattern = str_replace(['MMMM', 'MMM'], ['MM','MM'], $pattern); |
|
522 | + $pattern = str_replace(['MMMM', 'MMM'], ['MM', 'MM'], $pattern); |
|
523 | 523 | |
524 | 524 | $formatter = new TSimpleDateFormatter($pattern); |
525 | 525 | return $formatter->format($date); |
@@ -535,12 +535,12 @@ discard block |
||
535 | 535 | $options['InputMode'] = $this->getInputMode(); |
536 | 536 | $options['Format'] = $this->getDateFormat(); |
537 | 537 | $options['FirstDayOfWeek'] = $this->getFirstDayOfWeek(); |
538 | - if(($cssClass = $this->getCssClass()) !== '') |
|
538 | + if (($cssClass = $this->getCssClass()) !== '') |
|
539 | 539 | $options['ClassName'] = $cssClass; |
540 | 540 | $options['CalendarStyle'] = $this->getCalendarStyle(); |
541 | 541 | $options['FromYear'] = $this->getFromYear(); |
542 | 542 | $options['UpToYear'] = $this->getUpToYear(); |
543 | - switch($this->getMode()) |
|
543 | + switch ($this->getMode()) |
|
544 | 544 | { |
545 | 545 | case TDatePickerMode::Basic: |
546 | 546 | break; |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | $options['PositionMode'] = $this->getPositionMode(); |
555 | 555 | |
556 | 556 | $options = array_merge($options, $this->getCulturalOptions()); |
557 | - if($this->_clientScript !== null) |
|
557 | + if ($this->_clientScript !== null) |
|
558 | 558 | $options = array_merge($options, |
559 | 559 | $this->_clientScript->getOptions()->toArray()); |
560 | 560 | return $options; |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | */ |
567 | 567 | protected function getCulturalOptions() |
568 | 568 | { |
569 | - if($this->getCurrentCulture() == 'en') |
|
569 | + if ($this->getCurrentCulture() == 'en') |
|
570 | 570 | return []; |
571 | 571 | |
572 | 572 | $date = $this->getLocalizedCalendarInfo(); |
@@ -603,14 +603,14 @@ discard block |
||
603 | 603 | */ |
604 | 604 | protected function renderDropDownListCalendar($writer) |
605 | 605 | { |
606 | - if($this->getMode() == TDatePickerMode::Basic) |
|
606 | + if ($this->getMode() == TDatePickerMode::Basic) |
|
607 | 607 | $this->setMode(TDatePickerMode::ImageButton); |
608 | 608 | parent::addAttributesToRender($writer); |
609 | 609 | $writer->removeAttribute('name'); |
610 | 610 | $writer->removeAttribute('type'); |
611 | 611 | $writer->addAttribute('id', $this->getClientID()); |
612 | 612 | |
613 | - if(strlen($class = $this->getCssClass()) > 0) |
|
613 | + if (strlen($class = $this->getCssClass()) > 0) |
|
614 | 614 | $writer->addAttribute('class', $class); |
615 | 615 | $writer->renderBeginTag('span'); |
616 | 616 | |
@@ -643,13 +643,13 @@ discard block |
||
643 | 643 | { |
644 | 644 | $formatter = new TSimpleDateFormatter($this->getDateFormat()); |
645 | 645 | |
646 | - foreach($formatter->getDayMonthYearOrdering() as $type) |
|
646 | + foreach ($formatter->getDayMonthYearOrdering() as $type) |
|
647 | 647 | { |
648 | - if($type == 'day') |
|
648 | + if ($type == 'day') |
|
649 | 649 | $this->renderCalendarDayOptions($writer, $date->format('j')); |
650 | - elseif($type == 'month') |
|
650 | + elseif ($type == 'month') |
|
651 | 651 | $this->renderCalendarMonthOptions($writer, $date->format('n')); |
652 | - elseif($type == 'year') |
|
652 | + elseif ($type == 'year') |
|
653 | 653 | $this->renderCalendarYearOptions($writer, $date->format('Y')); |
654 | 654 | } |
655 | 655 | } |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | protected function getTimeStampFromText() |
662 | 662 | { |
663 | 663 | $pattern = $this->getDateFormat(); |
664 | - $pattern = str_replace(['MMMM', 'MMM'], ['MM','MM'], $pattern); |
|
664 | + $pattern = str_replace(['MMMM', 'MMM'], ['MM', 'MM'], $pattern); |
|
665 | 665 | $formatter = new TSimpleDateFormatter($pattern); |
666 | 666 | return $formatter->parse($this->getText()); |
667 | 667 | } |
@@ -674,10 +674,10 @@ discard block |
||
674 | 674 | */ |
675 | 675 | private function renderDropDownListOptions($writer, $options, $selected = null) |
676 | 676 | { |
677 | - foreach($options as $k => $v) |
|
677 | + foreach ($options as $k => $v) |
|
678 | 678 | { |
679 | 679 | $writer->addAttribute('value', $k); |
680 | - if($k == $selected) |
|
680 | + if ($k == $selected) |
|
681 | 681 | $writer->addAttribute('selected', 'selected'); |
682 | 682 | $writer->renderBeginTag('option'); |
683 | 683 | $writer->write($v); |
@@ -693,10 +693,10 @@ discard block |
||
693 | 693 | protected function renderCalendarDayOptions($writer, $selected = null) |
694 | 694 | { |
695 | 695 | $days = $this->getDropDownDayOptions(); |
696 | - $writer->addAttribute('id', $this->getClientID() . TControl::CLIENT_ID_SEPARATOR . 'day'); |
|
697 | - $writer->addAttribute('name', $this->getUniqueID() . TControl::ID_SEPARATOR . 'day'); |
|
696 | + $writer->addAttribute('id', $this->getClientID().TControl::CLIENT_ID_SEPARATOR.'day'); |
|
697 | + $writer->addAttribute('name', $this->getUniqueID().TControl::ID_SEPARATOR.'day'); |
|
698 | 698 | $writer->addAttribute('class', 'datepicker_day_options'); |
699 | - if($this->getReadOnly() || !$this->getEnabled(true)) |
|
699 | + if ($this->getReadOnly() || !$this->getEnabled(true)) |
|
700 | 700 | $writer->addAttribute('disabled', 'disabled'); |
701 | 701 | $writer->renderBeginTag('select'); |
702 | 702 | $this->renderDropDownListOptions($writer, $days, $selected); |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | $formatter = new TSimpleDateFormatter($this->getDateFormat()); |
712 | 712 | $days = []; |
713 | 713 | $requiresPadding = $formatter->getDayPattern() === 'dd'; |
714 | - for($i = 1;$i <= 31;$i++) |
|
714 | + for ($i = 1; $i <= 31; $i++) |
|
715 | 715 | { |
716 | 716 | $days[$i] = $requiresPadding ? str_pad($i, 2, '0', STR_PAD_LEFT) : $i; |
717 | 717 | } |
@@ -726,10 +726,10 @@ discard block |
||
726 | 726 | protected function renderCalendarMonthOptions($writer, $selected = null) |
727 | 727 | { |
728 | 728 | $info = $this->getLocalizedCalendarInfo(); |
729 | - $writer->addAttribute('id', $this->getClientID() . TControl::CLIENT_ID_SEPARATOR . 'month'); |
|
730 | - $writer->addAttribute('name', $this->getUniqueID() . TControl::ID_SEPARATOR . 'month'); |
|
729 | + $writer->addAttribute('id', $this->getClientID().TControl::CLIENT_ID_SEPARATOR.'month'); |
|
730 | + $writer->addAttribute('name', $this->getUniqueID().TControl::ID_SEPARATOR.'month'); |
|
731 | 731 | $writer->addAttribute('class', 'datepicker_month_options'); |
732 | - if($this->getReadOnly() || !$this->getEnabled(true)) |
|
732 | + if ($this->getReadOnly() || !$this->getEnabled(true)) |
|
733 | 733 | $writer->addAttribute('disabled', 'disabled'); |
734 | 734 | $writer->renderBeginTag('select'); |
735 | 735 | $this->renderDropDownListOptions($writer, |
@@ -747,16 +747,16 @@ discard block |
||
747 | 747 | protected function getLocalizedMonthNames($info) |
748 | 748 | { |
749 | 749 | $formatter = new TSimpleDateFormatter($this->getDateFormat()); |
750 | - switch($formatter->getMonthPattern()) |
|
750 | + switch ($formatter->getMonthPattern()) |
|
751 | 751 | { |
752 | 752 | case 'MMM': return $info->getAbbreviatedMonthNames(); |
753 | 753 | case 'MM': |
754 | 754 | $array = []; |
755 | - for($i = 1;$i <= 12;$i++) |
|
756 | - $array[$i - 1] = $i < 10 ? '0' . $i : $i; |
|
755 | + for ($i = 1; $i <= 12; $i++) |
|
756 | + $array[$i - 1] = $i < 10 ? '0'.$i : $i; |
|
757 | 757 | return $array; |
758 | 758 | case 'M': |
759 | - $array = []; for($i = 1;$i <= 12;$i++) $array[$i - 1] = $i; |
|
759 | + $array = []; for ($i = 1; $i <= 12; $i++) $array[$i - 1] = $i; |
|
760 | 760 | return $array; |
761 | 761 | default : return $info->getMonthNames(); |
762 | 762 | } |
@@ -770,12 +770,12 @@ discard block |
||
770 | 770 | protected function renderCalendarYearOptions($writer, $selected = null) |
771 | 771 | { |
772 | 772 | $years = []; |
773 | - for($i = $this->getFromYear(); $i <= $this->getUpToYear(); $i++) |
|
773 | + for ($i = $this->getFromYear(); $i <= $this->getUpToYear(); $i++) |
|
774 | 774 | $years[$i] = $i; |
775 | - $writer->addAttribute('id', $this->getClientID() . TControl::CLIENT_ID_SEPARATOR . 'year'); |
|
776 | - $writer->addAttribute('name', $this->getUniqueID() . TControl::ID_SEPARATOR . 'year'); |
|
775 | + $writer->addAttribute('id', $this->getClientID().TControl::CLIENT_ID_SEPARATOR.'year'); |
|
776 | + $writer->addAttribute('name', $this->getUniqueID().TControl::ID_SEPARATOR.'year'); |
|
777 | 777 | $writer->addAttribute('class', 'datepicker_year_options'); |
778 | - if($this->getReadOnly() || !$this->getEnabled(true)) |
|
778 | + if ($this->getReadOnly() || !$this->getEnabled(true)) |
|
779 | 779 | $writer->addAttribute('disabled', 'disabled'); |
780 | 780 | $writer->renderBeginTag('select'); |
781 | 781 | $this->renderDropDownListOptions($writer, $years, $selected); |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | */ |
789 | 789 | protected function getDatePickerButtonID() |
790 | 790 | { |
791 | - return $this->getClientID() . 'button'; |
|
791 | + return $this->getClientID().'button'; |
|
792 | 792 | } |
793 | 793 | |
794 | 794 | /** |
@@ -799,9 +799,9 @@ discard block |
||
799 | 799 | { |
800 | 800 | $writer->addAttribute('id', $this->getDatePickerButtonID()); |
801 | 801 | $writer->addAttribute('type', 'button'); |
802 | - $writer->addAttribute('class', $this->getCssClass() . ' TDatePickerButton'); |
|
802 | + $writer->addAttribute('class', $this->getCssClass().' TDatePickerButton'); |
|
803 | 803 | $writer->addAttribute('value', $this->getButtonText()); |
804 | - if(!$this->getEnabled(true)) |
|
804 | + if (!$this->getEnabled(true)) |
|
805 | 805 | $writer->addAttribute('disabled', 'disabled'); |
806 | 806 | $writer->renderBeginTag("input"); |
807 | 807 | $writer->renderEndTag(); |
@@ -818,8 +818,8 @@ discard block |
||
818 | 818 | $writer->addAttribute('id', $this->getDatePickerButtonID()); |
819 | 819 | $writer->addAttribute('src', $url); |
820 | 820 | $writer->addAttribute('alt', ' '); |
821 | - $writer->addAttribute('class', $this->getCssClass() . ' TDatePickerImageButton'); |
|
822 | - if(!$this->getEnabled(true)) |
|
821 | + $writer->addAttribute('class', $this->getCssClass().' TDatePickerImageButton'); |
|
822 | + if (!$this->getEnabled(true)) |
|
823 | 823 | $writer->addAttribute('disabled', 'disabled'); |
824 | 824 | $writer->addAttribute('type', 'image'); |
825 | 825 | $writer->addAttribute('onclick', 'return false;'); |
@@ -834,7 +834,7 @@ discard block |
||
834 | 834 | protected function getAssetUrl($file = '') |
835 | 835 | { |
836 | 836 | $base = $this->getPage()->getClientScript()->getPradoScriptAssetUrl(); |
837 | - return $base . '/' . self::SCRIPT_PATH . '/' . $file; |
|
837 | + return $base.'/'.self::SCRIPT_PATH.'/'.$file; |
|
838 | 838 | } |
839 | 839 | |
840 | 840 | /** |
@@ -843,9 +843,9 @@ discard block |
||
843 | 843 | */ |
844 | 844 | protected function publishCalendarStyle() |
845 | 845 | { |
846 | - $url = $this->getAssetUrl($this->getCalendarStyle() . '.css'); |
|
846 | + $url = $this->getAssetUrl($this->getCalendarStyle().'.css'); |
|
847 | 847 | $cs = $this->getPage()->getClientScript(); |
848 | - if(!$cs->isStyleSheetFileRegistered($url)) |
|
848 | + if (!$cs->isStyleSheetFileRegistered($url)) |
|
849 | 849 | $cs->registerStyleSheetFile($url, $url); |
850 | 850 | return $url; |
851 | 851 | } |
@@ -865,7 +865,7 @@ discard block |
||
865 | 865 | */ |
866 | 866 | protected function registerCalendarClientScriptPre() |
867 | 867 | { |
868 | - if($this->getShowCalendar()) |
|
868 | + if ($this->getShowCalendar()) |
|
869 | 869 | { |
870 | 870 | $cs = $this->getPage()->getClientScript(); |
871 | 871 | $cs->registerPradoScript("datepicker"); |
@@ -874,10 +874,10 @@ discard block |
||
874 | 874 | |
875 | 875 | protected function renderClientControlScript($writer) |
876 | 876 | { |
877 | - if($this->getShowCalendar()) |
|
877 | + if ($this->getShowCalendar()) |
|
878 | 878 | { |
879 | 879 | $cs = $this->getPage()->getClientScript(); |
880 | - if(!$cs->isEndScriptRegistered('TDatePicker.spacer')) |
|
880 | + if (!$cs->isEndScriptRegistered('TDatePicker.spacer')) |
|
881 | 881 | { |
882 | 882 | $spacer = $this->getAssetUrl('spacer.gif'); |
883 | 883 | $code = "Prado.WebUI.TDatePicker.spacer = '$spacer';"; |
@@ -886,7 +886,7 @@ discard block |
||
886 | 886 | |
887 | 887 | $options = TJavaScript::encode($this->getDatePickerOptions()); |
888 | 888 | $code = "new Prado.WebUI.TDatePicker($options);"; |
889 | - $cs->registerEndScript("prado:" . $this->getClientID(), $code); |
|
889 | + $cs->registerEndScript("prado:".$this->getClientID(), $code); |
|
890 | 890 | } |
891 | 891 | } |
892 | 892 | } |
893 | 893 | \ No newline at end of file |
@@ -301,10 +301,11 @@ discard block |
||
301 | 301 | */ |
302 | 302 | public function getTimeStamp() |
303 | 303 | { |
304 | - if(trim($this->getText()) === '') |
|
305 | - return null; |
|
306 | - else |
|
307 | - return $this->getTimeStampFromText(); |
|
304 | + if(trim($this->getText()) === '') { |
|
305 | + return null; |
|
306 | + } else { |
|
307 | + return $this->getTimeStampFromText(); |
|
308 | + } |
|
308 | 309 | } |
309 | 310 | |
310 | 311 | /** |
@@ -313,9 +314,9 @@ discard block |
||
313 | 314 | */ |
314 | 315 | public function setTimeStamp($value) |
315 | 316 | { |
316 | - if($value === null || (is_string($value) && trim($value) === '')) |
|
317 | - $this->setText(''); |
|
318 | - else |
|
317 | + if($value === null || (is_string($value) && trim($value) === '')) { |
|
318 | + $this->setText(''); |
|
319 | + } else |
|
319 | 320 | { |
320 | 321 | $date = TPropertyValue::ensureFloat($value); |
321 | 322 | $formatter = new TSimpleDateFormatter($this->getDateFormat()); |
@@ -377,8 +378,9 @@ discard block |
||
377 | 378 | */ |
378 | 379 | public function getClientSide() |
379 | 380 | { |
380 | - if($this->_clientScript === null) |
|
381 | - $this->_clientScript = $this->createClientScript(); |
|
381 | + if($this->_clientScript === null) { |
|
382 | + $this->_clientScript = $this->createClientScript(); |
|
383 | + } |
|
382 | 384 | return $this->_clientScript; |
383 | 385 | } |
384 | 386 | |
@@ -397,8 +399,9 @@ discard block |
||
397 | 399 | */ |
398 | 400 | public function getValidationPropertyValue() |
399 | 401 | { |
400 | - if(($text = $this->getText()) === '') |
|
401 | - return ''; |
|
402 | + if(($text = $this->getText()) === '') { |
|
403 | + return ''; |
|
404 | + } |
|
402 | 405 | $date = $this->getTimeStamp(); |
403 | 406 | return $date == null ? $text : $date; |
404 | 407 | } |
@@ -425,8 +428,7 @@ discard block |
||
425 | 428 | { |
426 | 429 | parent::render($writer); |
427 | 430 | $this->renderDatePickerButtons($writer); |
428 | - } |
|
429 | - else |
|
431 | + } else |
|
430 | 432 | { |
431 | 433 | $this->renderDropDownListCalendar($writer); |
432 | 434 | if($this->hasDayPattern()) |
@@ -466,16 +468,17 @@ discard block |
||
466 | 468 | */ |
467 | 469 | public function loadPostData($key, $values) |
468 | 470 | { |
469 | - if($this->getInputMode() == TDatePickerInputMode::TextBox) |
|
470 | - return parent::loadPostData($key, $values); |
|
471 | + if($this->getInputMode() == TDatePickerInputMode::TextBox) { |
|
472 | + return parent::loadPostData($key, $values); |
|
473 | + } |
|
471 | 474 | $value = $this->getDateFromPostData($key, $values); |
472 | 475 | if(!$this->getReadOnly() && $this->getText() !== $value) |
473 | 476 | { |
474 | 477 | $this->setText($value); |
475 | 478 | return true; |
479 | + } else { |
|
480 | + return false; |
|
476 | 481 | } |
477 | - else |
|
478 | - return false; |
|
479 | 482 | } |
480 | 483 | |
481 | 484 | /** |
@@ -502,15 +505,17 @@ discard block |
||
502 | 505 | $day = 1; |
503 | 506 | } |
504 | 507 | |
505 | - if(isset($values[$key . '$month'])) |
|
506 | - $month = intval($values[$key . '$month']) + 1; |
|
507 | - else |
|
508 | - $month = $date['mon']; |
|
508 | + if(isset($values[$key . '$month'])) { |
|
509 | + $month = intval($values[$key . '$month']) + 1; |
|
510 | + } else { |
|
511 | + $month = $date['mon']; |
|
512 | + } |
|
509 | 513 | |
510 | - if(isset($values[$key . '$year'])) |
|
511 | - $year = intval($values[$key . '$year']); |
|
512 | - else |
|
513 | - $year = $date['year']; |
|
514 | + if(isset($values[$key . '$year'])) { |
|
515 | + $year = intval($values[$key . '$year']); |
|
516 | + } else { |
|
517 | + $year = $date['year']; |
|
518 | + } |
|
514 | 519 | |
515 | 520 | $s = new \DateTime; |
516 | 521 | $s->setDate($year, $month, $day); |
@@ -535,8 +540,9 @@ discard block |
||
535 | 540 | $options['InputMode'] = $this->getInputMode(); |
536 | 541 | $options['Format'] = $this->getDateFormat(); |
537 | 542 | $options['FirstDayOfWeek'] = $this->getFirstDayOfWeek(); |
538 | - if(($cssClass = $this->getCssClass()) !== '') |
|
539 | - $options['ClassName'] = $cssClass; |
|
543 | + if(($cssClass = $this->getCssClass()) !== '') { |
|
544 | + $options['ClassName'] = $cssClass; |
|
545 | + } |
|
540 | 546 | $options['CalendarStyle'] = $this->getCalendarStyle(); |
541 | 547 | $options['FromYear'] = $this->getFromYear(); |
542 | 548 | $options['UpToYear'] = $this->getUpToYear(); |
@@ -554,9 +560,10 @@ discard block |
||
554 | 560 | $options['PositionMode'] = $this->getPositionMode(); |
555 | 561 | |
556 | 562 | $options = array_merge($options, $this->getCulturalOptions()); |
557 | - if($this->_clientScript !== null) |
|
558 | - $options = array_merge($options, |
|
563 | + if($this->_clientScript !== null) { |
|
564 | + $options = array_merge($options, |
|
559 | 565 | $this->_clientScript->getOptions()->toArray()); |
566 | + } |
|
560 | 567 | return $options; |
561 | 568 | } |
562 | 569 | |
@@ -566,8 +573,9 @@ discard block |
||
566 | 573 | */ |
567 | 574 | protected function getCulturalOptions() |
568 | 575 | { |
569 | - if($this->getCurrentCulture() == 'en') |
|
570 | - return []; |
|
576 | + if($this->getCurrentCulture() == 'en') { |
|
577 | + return []; |
|
578 | + } |
|
571 | 579 | |
572 | 580 | $date = $this->getLocalizedCalendarInfo(); |
573 | 581 | $options['MonthNames'] = $date->getMonthNames(); |
@@ -603,15 +611,17 @@ discard block |
||
603 | 611 | */ |
604 | 612 | protected function renderDropDownListCalendar($writer) |
605 | 613 | { |
606 | - if($this->getMode() == TDatePickerMode::Basic) |
|
607 | - $this->setMode(TDatePickerMode::ImageButton); |
|
614 | + if($this->getMode() == TDatePickerMode::Basic) { |
|
615 | + $this->setMode(TDatePickerMode::ImageButton); |
|
616 | + } |
|
608 | 617 | parent::addAttributesToRender($writer); |
609 | 618 | $writer->removeAttribute('name'); |
610 | 619 | $writer->removeAttribute('type'); |
611 | 620 | $writer->addAttribute('id', $this->getClientID()); |
612 | 621 | |
613 | - if(strlen($class = $this->getCssClass()) > 0) |
|
614 | - $writer->addAttribute('class', $class); |
|
622 | + if(strlen($class = $this->getCssClass()) > 0) { |
|
623 | + $writer->addAttribute('class', $class); |
|
624 | + } |
|
615 | 625 | $writer->renderBeginTag('span'); |
616 | 626 | |
617 | 627 | $date = new \DateTime; |
@@ -645,12 +655,13 @@ discard block |
||
645 | 655 | |
646 | 656 | foreach($formatter->getDayMonthYearOrdering() as $type) |
647 | 657 | { |
648 | - if($type == 'day') |
|
649 | - $this->renderCalendarDayOptions($writer, $date->format('j')); |
|
650 | - elseif($type == 'month') |
|
651 | - $this->renderCalendarMonthOptions($writer, $date->format('n')); |
|
652 | - elseif($type == 'year') |
|
653 | - $this->renderCalendarYearOptions($writer, $date->format('Y')); |
|
658 | + if($type == 'day') { |
|
659 | + $this->renderCalendarDayOptions($writer, $date->format('j')); |
|
660 | + } elseif($type == 'month') { |
|
661 | + $this->renderCalendarMonthOptions($writer, $date->format('n')); |
|
662 | + } elseif($type == 'year') { |
|
663 | + $this->renderCalendarYearOptions($writer, $date->format('Y')); |
|
664 | + } |
|
654 | 665 | } |
655 | 666 | } |
656 | 667 | |
@@ -677,8 +688,9 @@ discard block |
||
677 | 688 | foreach($options as $k => $v) |
678 | 689 | { |
679 | 690 | $writer->addAttribute('value', $k); |
680 | - if($k == $selected) |
|
681 | - $writer->addAttribute('selected', 'selected'); |
|
691 | + if($k == $selected) { |
|
692 | + $writer->addAttribute('selected', 'selected'); |
|
693 | + } |
|
682 | 694 | $writer->renderBeginTag('option'); |
683 | 695 | $writer->write($v); |
684 | 696 | $writer->renderEndTag(); |
@@ -696,8 +708,9 @@ discard block |
||
696 | 708 | $writer->addAttribute('id', $this->getClientID() . TControl::CLIENT_ID_SEPARATOR . 'day'); |
697 | 709 | $writer->addAttribute('name', $this->getUniqueID() . TControl::ID_SEPARATOR . 'day'); |
698 | 710 | $writer->addAttribute('class', 'datepicker_day_options'); |
699 | - if($this->getReadOnly() || !$this->getEnabled(true)) |
|
700 | - $writer->addAttribute('disabled', 'disabled'); |
|
711 | + if($this->getReadOnly() || !$this->getEnabled(true)) { |
|
712 | + $writer->addAttribute('disabled', 'disabled'); |
|
713 | + } |
|
701 | 714 | $writer->renderBeginTag('select'); |
702 | 715 | $this->renderDropDownListOptions($writer, $days, $selected); |
703 | 716 | $writer->renderEndTag(); |
@@ -729,8 +742,9 @@ discard block |
||
729 | 742 | $writer->addAttribute('id', $this->getClientID() . TControl::CLIENT_ID_SEPARATOR . 'month'); |
730 | 743 | $writer->addAttribute('name', $this->getUniqueID() . TControl::ID_SEPARATOR . 'month'); |
731 | 744 | $writer->addAttribute('class', 'datepicker_month_options'); |
732 | - if($this->getReadOnly() || !$this->getEnabled(true)) |
|
733 | - $writer->addAttribute('disabled', 'disabled'); |
|
745 | + if($this->getReadOnly() || !$this->getEnabled(true)) { |
|
746 | + $writer->addAttribute('disabled', 'disabled'); |
|
747 | + } |
|
734 | 748 | $writer->renderBeginTag('select'); |
735 | 749 | $this->renderDropDownListOptions($writer, |
736 | 750 | $this->getLocalizedMonthNames($info), $selected - 1); |
@@ -752,11 +766,14 @@ discard block |
||
752 | 766 | case 'MMM': return $info->getAbbreviatedMonthNames(); |
753 | 767 | case 'MM': |
754 | 768 | $array = []; |
755 | - for($i = 1;$i <= 12;$i++) |
|
756 | - $array[$i - 1] = $i < 10 ? '0' . $i : $i; |
|
769 | + for($i = 1;$i <= 12;$i++) { |
|
770 | + $array[$i - 1] = $i < 10 ? '0' . $i : $i; |
|
771 | + } |
|
757 | 772 | return $array; |
758 | 773 | case 'M': |
759 | - $array = []; for($i = 1;$i <= 12;$i++) $array[$i - 1] = $i; |
|
774 | + $array = []; for($i = 1;$i <= 12;$i++) { |
|
775 | + $array[$i - 1] = $i; |
|
776 | + } |
|
760 | 777 | return $array; |
761 | 778 | default : return $info->getMonthNames(); |
762 | 779 | } |
@@ -770,13 +787,15 @@ discard block |
||
770 | 787 | protected function renderCalendarYearOptions($writer, $selected = null) |
771 | 788 | { |
772 | 789 | $years = []; |
773 | - for($i = $this->getFromYear(); $i <= $this->getUpToYear(); $i++) |
|
774 | - $years[$i] = $i; |
|
790 | + for($i = $this->getFromYear(); $i <= $this->getUpToYear(); $i++) { |
|
791 | + $years[$i] = $i; |
|
792 | + } |
|
775 | 793 | $writer->addAttribute('id', $this->getClientID() . TControl::CLIENT_ID_SEPARATOR . 'year'); |
776 | 794 | $writer->addAttribute('name', $this->getUniqueID() . TControl::ID_SEPARATOR . 'year'); |
777 | 795 | $writer->addAttribute('class', 'datepicker_year_options'); |
778 | - if($this->getReadOnly() || !$this->getEnabled(true)) |
|
779 | - $writer->addAttribute('disabled', 'disabled'); |
|
796 | + if($this->getReadOnly() || !$this->getEnabled(true)) { |
|
797 | + $writer->addAttribute('disabled', 'disabled'); |
|
798 | + } |
|
780 | 799 | $writer->renderBeginTag('select'); |
781 | 800 | $this->renderDropDownListOptions($writer, $years, $selected); |
782 | 801 | $writer->renderEndTag(); |
@@ -801,8 +820,9 @@ discard block |
||
801 | 820 | $writer->addAttribute('type', 'button'); |
802 | 821 | $writer->addAttribute('class', $this->getCssClass() . ' TDatePickerButton'); |
803 | 822 | $writer->addAttribute('value', $this->getButtonText()); |
804 | - if(!$this->getEnabled(true)) |
|
805 | - $writer->addAttribute('disabled', 'disabled'); |
|
823 | + if(!$this->getEnabled(true)) { |
|
824 | + $writer->addAttribute('disabled', 'disabled'); |
|
825 | + } |
|
806 | 826 | $writer->renderBeginTag("input"); |
807 | 827 | $writer->renderEndTag(); |
808 | 828 | } |
@@ -819,8 +839,9 @@ discard block |
||
819 | 839 | $writer->addAttribute('src', $url); |
820 | 840 | $writer->addAttribute('alt', ' '); |
821 | 841 | $writer->addAttribute('class', $this->getCssClass() . ' TDatePickerImageButton'); |
822 | - if(!$this->getEnabled(true)) |
|
823 | - $writer->addAttribute('disabled', 'disabled'); |
|
842 | + if(!$this->getEnabled(true)) { |
|
843 | + $writer->addAttribute('disabled', 'disabled'); |
|
844 | + } |
|
824 | 845 | $writer->addAttribute('type', 'image'); |
825 | 846 | $writer->addAttribute('onclick', 'return false;'); |
826 | 847 | $writer->renderBeginTag('input'); |
@@ -845,8 +866,9 @@ discard block |
||
845 | 866 | { |
846 | 867 | $url = $this->getAssetUrl($this->getCalendarStyle() . '.css'); |
847 | 868 | $cs = $this->getPage()->getClientScript(); |
848 | - if(!$cs->isStyleSheetFileRegistered($url)) |
|
849 | - $cs->registerStyleSheetFile($url, $url); |
|
869 | + if(!$cs->isStyleSheetFileRegistered($url)) { |
|
870 | + $cs->registerStyleSheetFile($url, $url); |
|
871 | + } |
|
850 | 872 | return $url; |
851 | 873 | } |
852 | 874 |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | $page = $this->getPage(); |
101 | 101 | $page->ensureRenderInForm($this); |
102 | 102 | $writer->addAttribute('type', 'image'); |
103 | - if(($uniqueID = $this->getUniqueID()) !== '') |
|
103 | + if (($uniqueID = $this->getUniqueID()) !== '') |
|
104 | 104 | $writer->addAttribute('name', $uniqueID); |
105 | - if($this->getEnabled(true)) |
|
105 | + if ($this->getEnabled(true)) |
|
106 | 106 | { |
107 | - if($this->getEnableClientScript() && $this->needPostBackScript()) |
|
107 | + if ($this->getEnableClientScript() && $this->needPostBackScript()) |
|
108 | 108 | $this->renderClientControlScript($writer); |
109 | 109 | } |
110 | - elseif($this->getEnabled()) // in this case, parent will not render 'disabled' |
|
110 | + elseif ($this->getEnabled()) // in this case, parent will not render 'disabled' |
|
111 | 111 | $writer->addAttribute('disabled', 'disabled'); |
112 | 112 | parent::addAttributesToRender($writer); |
113 | 113 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | */ |
138 | 138 | protected function canCauseValidation() |
139 | 139 | { |
140 | - if($this->getCausesValidation()) |
|
140 | + if ($this->getCausesValidation()) |
|
141 | 141 | { |
142 | 142 | $group = $this->getValidationGroup(); |
143 | 143 | return $this->getPage()->getValidators($group)->getCount() > 0; |
@@ -195,11 +195,11 @@ discard block |
||
195 | 195 | public function loadPostData($key, $values) |
196 | 196 | { |
197 | 197 | $uid = $this->getUniqueID(); |
198 | - if(isset($values["{$uid}_x"]) && isset($values["{$uid}_y"])) |
|
198 | + if (isset($values["{$uid}_x"]) && isset($values["{$uid}_y"])) |
|
199 | 199 | { |
200 | 200 | $this->_x = intval($values["{$uid}_x"]); |
201 | 201 | $this->_y = intval($values["{$uid}_y"]); |
202 | - if($this->getPage()->getPostBackEventTarget() === null) |
|
202 | + if ($this->getPage()->getPostBackEventTarget() === null) |
|
203 | 203 | $this->getPage()->setPostBackEventTarget($this); |
204 | 204 | $this->_dataChanged = true; |
205 | 205 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | */ |
251 | 251 | public function raisePostBackEvent($param) |
252 | 252 | { |
253 | - if($this->getCausesValidation()) |
|
253 | + if ($this->getCausesValidation()) |
|
254 | 254 | $this->getPage()->validate($this->getValidationGroup()); |
255 | 255 | $this->onClick(new TImageClickEventParameter($this->_x, $this->_y)); |
256 | 256 | $this->onCommand(new \Prado\Web\UI\TCommandEventParameter($this->getCommandName(), $this->getCommandParameter())); |
@@ -100,15 +100,18 @@ discard block |
||
100 | 100 | $page = $this->getPage(); |
101 | 101 | $page->ensureRenderInForm($this); |
102 | 102 | $writer->addAttribute('type', 'image'); |
103 | - if(($uniqueID = $this->getUniqueID()) !== '') |
|
104 | - $writer->addAttribute('name', $uniqueID); |
|
103 | + if(($uniqueID = $this->getUniqueID()) !== '') { |
|
104 | + $writer->addAttribute('name', $uniqueID); |
|
105 | + } |
|
105 | 106 | if($this->getEnabled(true)) |
106 | 107 | { |
107 | - if($this->getEnableClientScript() && $this->needPostBackScript()) |
|
108 | - $this->renderClientControlScript($writer); |
|
109 | - } |
|
110 | - elseif($this->getEnabled()) // in this case, parent will not render 'disabled' |
|
108 | + if($this->getEnableClientScript() && $this->needPostBackScript()) { |
|
109 | + $this->renderClientControlScript($writer); |
|
110 | + } |
|
111 | + } elseif($this->getEnabled()) { |
|
112 | + // in this case, parent will not render 'disabled' |
|
111 | 113 | $writer->addAttribute('disabled', 'disabled'); |
114 | + } |
|
112 | 115 | parent::addAttributesToRender($writer); |
113 | 116 | } |
114 | 117 | |
@@ -141,9 +144,9 @@ discard block |
||
141 | 144 | { |
142 | 145 | $group = $this->getValidationGroup(); |
143 | 146 | return $this->getPage()->getValidators($group)->getCount() > 0; |
147 | + } else { |
|
148 | + return false; |
|
144 | 149 | } |
145 | - else |
|
146 | - return false; |
|
147 | 150 | } |
148 | 151 | |
149 | 152 | /** |
@@ -199,8 +202,9 @@ discard block |
||
199 | 202 | { |
200 | 203 | $this->_x = intval($values["{$uid}_x"]); |
201 | 204 | $this->_y = intval($values["{$uid}_y"]); |
202 | - if($this->getPage()->getPostBackEventTarget() === null) |
|
203 | - $this->getPage()->setPostBackEventTarget($this); |
|
205 | + if($this->getPage()->getPostBackEventTarget() === null) { |
|
206 | + $this->getPage()->setPostBackEventTarget($this); |
|
207 | + } |
|
204 | 208 | $this->_dataChanged = true; |
205 | 209 | } |
206 | 210 | return false; |
@@ -250,8 +254,9 @@ discard block |
||
250 | 254 | */ |
251 | 255 | public function raisePostBackEvent($param) |
252 | 256 | { |
253 | - if($this->getCausesValidation()) |
|
254 | - $this->getPage()->validate($this->getValidationGroup()); |
|
257 | + if($this->getCausesValidation()) { |
|
258 | + $this->getPage()->validate($this->getValidationGroup()); |
|
259 | + } |
|
255 | 260 | $this->onClick(new TImageClickEventParameter($this->_x, $this->_y)); |
256 | 261 | $this->onCommand(new \Prado\Web\UI\TCommandEventParameter($this->getCommandName(), $this->getCommandParameter())); |
257 | 262 | } |
@@ -38,7 +38,7 @@ |
||
38 | 38 | */ |
39 | 39 | public function insertAt($index, $item) |
40 | 40 | { |
41 | - if($item instanceof TDataGridItem) |
|
41 | + if ($item instanceof TDataGridItem) |
|
42 | 42 | parent::insertAt($index, $item); |
43 | 43 | else |
44 | 44 | throw new TInvalidDataTypeException('datagriditemcollection_datagriditem_required'); |
@@ -38,9 +38,10 @@ |
||
38 | 38 | */ |
39 | 39 | public function insertAt($index, $item) |
40 | 40 | { |
41 | - if($item instanceof TDataGridItem) |
|
42 | - parent::insertAt($index, $item); |
|
43 | - else |
|
44 | - throw new TInvalidDataTypeException('datagriditemcollection_datagriditem_required'); |
|
41 | + if($item instanceof TDataGridItem) { |
|
42 | + parent::insertAt($index, $item); |
|
43 | + } else { |
|
44 | + throw new TInvalidDataTypeException('datagriditemcollection_datagriditem_required'); |
|
45 | + } |
|
45 | 46 | } |
46 | 47 | } |
47 | 48 | \ No newline at end of file |
@@ -86,14 +86,14 @@ discard block |
||
86 | 86 | parent::addAttributesToRender($writer); |
87 | 87 | $writer->addAttribute('type', 'file'); |
88 | 88 | $name = $this->getUniqueID(); |
89 | - if($this->getMultiple()) |
|
89 | + if ($this->getMultiple()) |
|
90 | 90 | { |
91 | 91 | $name .= '[]'; |
92 | 92 | $writer->addAttribute('multiple', 'multiple'); |
93 | 93 | } |
94 | 94 | $writer->addAttribute('name', $name); |
95 | 95 | $isEnabled = $this->getEnabled(true); |
96 | - if(!$isEnabled && $this->getEnabled()) // in this case parent will not render 'disabled' |
|
96 | + if (!$isEnabled && $this->getEnabled()) // in this case parent will not render 'disabled' |
|
97 | 97 | $writer->addAttribute('disabled', 'disabled'); |
98 | 98 | } |
99 | 99 | |
@@ -105,15 +105,15 @@ discard block |
||
105 | 105 | public function onPreRender($param) |
106 | 106 | { |
107 | 107 | parent::onPreRender($param); |
108 | - if(($form = $this->getPage()->getForm()) !== null) |
|
108 | + if (($form = $this->getPage()->getForm()) !== null) |
|
109 | 109 | { |
110 | - if($this->getPage()->getIsCallback()) |
|
110 | + if ($this->getPage()->getIsCallback()) |
|
111 | 111 | $this->getPage()->getCallbackClient()->setAttribute($form, 'enctype', 'multipart/form-data'); |
112 | 112 | else |
113 | 113 | $form->setEnctype('multipart/form-data'); |
114 | 114 | } |
115 | 115 | $this->getPage()->getClientScript()->registerHiddenField('MAX_FILE_SIZE', $this->getMaxFileSize()); |
116 | - if($this->getEnabled(true)) |
|
116 | + if ($this->getEnabled(true)) |
|
117 | 117 | $this->getPage()->registerRequiresPostData($this); |
118 | 118 | } |
119 | 119 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function getFileName($index = 0) |
148 | 148 | { |
149 | - return isset($this->_files[$index])?$this->_files[$index]->getFileName():''; |
|
149 | + return isset($this->_files[$index]) ? $this->_files[$index]->getFileName() : ''; |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function getFileSize($index = 0) |
158 | 158 | { |
159 | - return isset($this->_files[$index])?$this->_files[$index]->getFileSize():0; |
|
159 | + return isset($this->_files[$index]) ? $this->_files[$index]->getFileSize() : 0; |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | */ |
168 | 168 | public function getFileType($index = 0) |
169 | 169 | { |
170 | - return isset($this->_files[$index])?$this->_files[$index]->getFileType():''; |
|
170 | + return isset($this->_files[$index]) ? $this->_files[$index]->getFileType() : ''; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function getLocalName($index = 0) |
180 | 180 | { |
181 | - return isset($this->_files[$index])?$this->_files[$index]->getLocalName():''; |
|
181 | + return isset($this->_files[$index]) ? $this->_files[$index]->getLocalName() : ''; |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | */ |
191 | 191 | public function getErrorCode($index = 0) |
192 | 192 | { |
193 | - return isset($this->_files[$index])?$this->_files[$index]->getErrorCode():UPLOAD_ERR_NO_FILE; |
|
193 | + return isset($this->_files[$index]) ? $this->_files[$index]->getErrorCode() : UPLOAD_ERR_NO_FILE; |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | /** |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | */ |
201 | 201 | public function getHasFile($index = 0) |
202 | 202 | { |
203 | - return isset($this->_files[$index])?$this->_files[$index]->getHasFile():false; |
|
203 | + return isset($this->_files[$index]) ? $this->_files[$index]->getHasFile() : false; |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -208,8 +208,8 @@ discard block |
||
208 | 208 | * @return boolean whether all files are uploaded successfully |
209 | 209 | */ |
210 | 210 | public function getHasAllFiles() { |
211 | - foreach($this->_files as $file) |
|
212 | - if(!$file->getHasFile()) |
|
211 | + foreach ($this->_files as $file) |
|
212 | + if (!$file->getHasFile()) |
|
213 | 213 | return false; |
214 | 214 | return true; |
215 | 215 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | */ |
227 | 227 | public function saveAs($fileName, $deleteTempFile = true, $index = 0) |
228 | 228 | { |
229 | - return isset($this->_files[$index])?$this->_files[$index]->saveAs($fileName, $deleteTempFile):false; |
|
229 | + return isset($this->_files[$index]) ? $this->_files[$index]->saveAs($fileName, $deleteTempFile) : false; |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | /** |
@@ -238,11 +238,11 @@ discard block |
||
238 | 238 | */ |
239 | 239 | public function loadPostData($key, $values) |
240 | 240 | { |
241 | - if(isset($_FILES[$key])) |
|
241 | + if (isset($_FILES[$key])) |
|
242 | 242 | { |
243 | - if($this->getMultiple() || is_array($_FILES[$key]['name'])) |
|
243 | + if ($this->getMultiple() || is_array($_FILES[$key]['name'])) |
|
244 | 244 | { |
245 | - foreach($_FILES[$key]['name'] as $index => $name) |
|
245 | + foreach ($_FILES[$key]['name'] as $index => $name) |
|
246 | 246 | $this->_files[$index] = new TFileUploadItem($name, $_FILES[$key]['size'][$index], $_FILES[$key]['type'][$index], $_FILES[$key]['error'][$index], $_FILES[$key]['tmp_name'][$index]); |
247 | 247 | } |
248 | 248 | else |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | */ |
293 | 293 | public function getValidationPropertyValue() |
294 | 294 | { |
295 | - return implode(',', array_map(function($file){return $file->getFileName();}, $this->_files)); |
|
295 | + return implode(',', array_map(function($file) {return $file->getFileName(); }, $this->_files)); |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | /** |
@@ -93,8 +93,10 @@ discard block |
||
93 | 93 | } |
94 | 94 | $writer->addAttribute('name', $name); |
95 | 95 | $isEnabled = $this->getEnabled(true); |
96 | - if(!$isEnabled && $this->getEnabled()) // in this case parent will not render 'disabled' |
|
96 | + if(!$isEnabled && $this->getEnabled()) { |
|
97 | + // in this case parent will not render 'disabled' |
|
97 | 98 | $writer->addAttribute('disabled', 'disabled'); |
99 | + } |
|
98 | 100 | } |
99 | 101 | |
100 | 102 | /** |
@@ -107,14 +109,16 @@ discard block |
||
107 | 109 | parent::onPreRender($param); |
108 | 110 | if(($form = $this->getPage()->getForm()) !== null) |
109 | 111 | { |
110 | - if($this->getPage()->getIsCallback()) |
|
111 | - $this->getPage()->getCallbackClient()->setAttribute($form, 'enctype', 'multipart/form-data'); |
|
112 | - else |
|
113 | - $form->setEnctype('multipart/form-data'); |
|
112 | + if($this->getPage()->getIsCallback()) { |
|
113 | + $this->getPage()->getCallbackClient()->setAttribute($form, 'enctype', 'multipart/form-data'); |
|
114 | + } else { |
|
115 | + $form->setEnctype('multipart/form-data'); |
|
116 | + } |
|
114 | 117 | } |
115 | 118 | $this->getPage()->getClientScript()->registerHiddenField('MAX_FILE_SIZE', $this->getMaxFileSize()); |
116 | - if($this->getEnabled(true)) |
|
117 | - $this->getPage()->registerRequiresPostData($this); |
|
119 | + if($this->getEnabled(true)) { |
|
120 | + $this->getPage()->registerRequiresPostData($this); |
|
121 | + } |
|
118 | 122 | } |
119 | 123 | |
120 | 124 | /** |
@@ -208,9 +212,10 @@ discard block |
||
208 | 212 | * @return boolean whether all files are uploaded successfully |
209 | 213 | */ |
210 | 214 | public function getHasAllFiles() { |
211 | - foreach($this->_files as $file) |
|
212 | - if(!$file->getHasFile()) |
|
215 | + foreach($this->_files as $file) { |
|
216 | + if(!$file->getHasFile()) |
|
213 | 217 | return false; |
218 | + } |
|
214 | 219 | return true; |
215 | 220 | } |
216 | 221 | |
@@ -242,15 +247,16 @@ discard block |
||
242 | 247 | { |
243 | 248 | if($this->getMultiple() || is_array($_FILES[$key]['name'])) |
244 | 249 | { |
245 | - foreach($_FILES[$key]['name'] as $index => $name) |
|
246 | - $this->_files[$index] = new TFileUploadItem($name, $_FILES[$key]['size'][$index], $_FILES[$key]['type'][$index], $_FILES[$key]['error'][$index], $_FILES[$key]['tmp_name'][$index]); |
|
250 | + foreach($_FILES[$key]['name'] as $index => $name) { |
|
251 | + $this->_files[$index] = new TFileUploadItem($name, $_FILES[$key]['size'][$index], $_FILES[$key]['type'][$index], $_FILES[$key]['error'][$index], $_FILES[$key]['tmp_name'][$index]); |
|
252 | + } |
|
253 | + } else { |
|
254 | + $this->_files[0] = new TFileUploadItem($_FILES[$key]['name'], $_FILES[$key]['size'], $_FILES[$key]['type'], $_FILES[$key]['error'], $_FILES[$key]['tmp_name']); |
|
247 | 255 | } |
248 | - else |
|
249 | - $this->_files[0] = new TFileUploadItem($_FILES[$key]['name'], $_FILES[$key]['size'], $_FILES[$key]['type'], $_FILES[$key]['error'], $_FILES[$key]['tmp_name']); |
|
250 | 256 | return $this->_dataChanged = true; |
257 | + } else { |
|
258 | + return false; |
|
251 | 259 | } |
252 | - else |
|
253 | - return false; |
|
254 | 260 | } |
255 | 261 | |
256 | 262 | /** |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | $this->_itemIndex = $itemIndex; |
64 | 64 | $this->_dataSourceIndex = $dataSourceIndex; |
65 | 65 | $this->setItemType($itemType); |
66 | - if($itemType === TListItemType::Header) |
|
66 | + if ($itemType === TListItemType::Header) |
|
67 | 67 | $this->setTableSection(TTableRowSection::Header); |
68 | - elseif($itemType === TListItemType::Footer) |
|
68 | + elseif ($itemType === TListItemType::Footer) |
|
69 | 69 | $this->setTableSection(TTableRowSection::Footer); |
70 | 70 | } |
71 | 71 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | public function bubbleEvent($sender, $param) |
130 | 130 | { |
131 | - if($param instanceof \Prado\Web\UI\TCommandEventParameter) |
|
131 | + if ($param instanceof \Prado\Web\UI\TCommandEventParameter) |
|
132 | 132 | { |
133 | 133 | $this->raiseBubbleEvent($this, new TDataGridCommandEventParameter($this, $sender, $param)); |
134 | 134 | return true; |
@@ -63,10 +63,11 @@ discard block |
||
63 | 63 | $this->_itemIndex = $itemIndex; |
64 | 64 | $this->_dataSourceIndex = $dataSourceIndex; |
65 | 65 | $this->setItemType($itemType); |
66 | - if($itemType === TListItemType::Header) |
|
67 | - $this->setTableSection(TTableRowSection::Header); |
|
68 | - elseif($itemType === TListItemType::Footer) |
|
69 | - $this->setTableSection(TTableRowSection::Footer); |
|
66 | + if($itemType === TListItemType::Header) { |
|
67 | + $this->setTableSection(TTableRowSection::Header); |
|
68 | + } elseif($itemType === TListItemType::Footer) { |
|
69 | + $this->setTableSection(TTableRowSection::Footer); |
|
70 | + } |
|
70 | 71 | } |
71 | 72 | |
72 | 73 | /** |
@@ -132,8 +133,8 @@ discard block |
||
132 | 133 | { |
133 | 134 | $this->raiseBubbleEvent($this, new TDataGridCommandEventParameter($this, $sender, $param)); |
134 | 135 | return true; |
136 | + } else { |
|
137 | + return false; |
|
135 | 138 | } |
136 | - else |
|
137 | - return false; |
|
138 | 139 | } |
139 | 140 | } |
140 | 141 | \ No newline at end of file |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | parent::_getZappableSleepProps($exprops); |
79 | 79 | if ($this->_attributes === null) |
80 | 80 | $exprops[] = "\0Prado\Web\UI\WebControls\TListItem\0_attributes"; |
81 | - if($this->_text === '') |
|
81 | + if ($this->_text === '') |
|
82 | 82 | $exprops[] = "\0Prado\Web\UI\WebControls\TListItem\0_text"; |
83 | - if($this->_value === '') |
|
83 | + if ($this->_value === '') |
|
84 | 84 | $exprops[] = "\0Prado\Web\UI\WebControls\TListItem\0_value"; |
85 | 85 | if ($this->_enabled === true) |
86 | 86 | $exprops[] = "\0Prado\Web\UI\WebControls\TListItem\0_enabled"; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public function getText() |
127 | 127 | { |
128 | - return $this->_text === ''?$this->_value:$this->_text; |
|
128 | + return $this->_text === '' ? $this->_value : $this->_text; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function getValue() |
143 | 143 | { |
144 | - return $this->_value === ''?$this->_text:$this->_value; |
|
144 | + return $this->_value === '' ? $this->_text : $this->_value; |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | */ |
158 | 158 | public function getAttributes() |
159 | 159 | { |
160 | - if(!$this->_attributes) |
|
160 | + if (!$this->_attributes) |
|
161 | 161 | $this->_attributes = new TAttributeCollection; |
162 | 162 | return $this->_attributes; |
163 | 163 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | */ |
177 | 177 | public function hasAttribute($name) |
178 | 178 | { |
179 | - return $this->_attributes?$this->_attributes->contains($name):false; |
|
179 | + return $this->_attributes ? $this->_attributes->contains($name) : false; |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | */ |
185 | 185 | public function getAttribute($name) |
186 | 186 | { |
187 | - return $this->_attributes?$this->_attributes->itemAt($name):null; |
|
187 | + return $this->_attributes ? $this->_attributes->itemAt($name) : null; |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | */ |
204 | 204 | public function removeAttribute($name) |
205 | 205 | { |
206 | - return $this->_attributes?$this->_attributes->remove($name):null; |
|
206 | + return $this->_attributes ? $this->_attributes->remove($name) : null; |
|
207 | 207 | } |
208 | 208 | } |
209 | 209 |
@@ -76,16 +76,21 @@ discard block |
||
76 | 76 | protected function _getZappableSleepProps(&$exprops) |
77 | 77 | { |
78 | 78 | parent::_getZappableSleepProps($exprops); |
79 | - if ($this->_attributes === null) |
|
80 | - $exprops[] = "\0Prado\Web\UI\WebControls\TListItem\0_attributes"; |
|
81 | - if($this->_text === '') |
|
82 | - $exprops[] = "\0Prado\Web\UI\WebControls\TListItem\0_text"; |
|
83 | - if($this->_value === '') |
|
84 | - $exprops[] = "\0Prado\Web\UI\WebControls\TListItem\0_value"; |
|
85 | - if ($this->_enabled === true) |
|
86 | - $exprops[] = "\0Prado\Web\UI\WebControls\TListItem\0_enabled"; |
|
87 | - if ($this->_selected === false) |
|
88 | - $exprops[] = "\0Prado\Web\UI\WebControls\TListItem\0_selected"; |
|
79 | + if ($this->_attributes === null) { |
|
80 | + $exprops[] = "\0Prado\Web\UI\WebControls\TListItem\0_attributes"; |
|
81 | + } |
|
82 | + if($this->_text === '') { |
|
83 | + $exprops[] = "\0Prado\Web\UI\WebControls\TListItem\0_text"; |
|
84 | + } |
|
85 | + if($this->_value === '') { |
|
86 | + $exprops[] = "\0Prado\Web\UI\WebControls\TListItem\0_value"; |
|
87 | + } |
|
88 | + if ($this->_enabled === true) { |
|
89 | + $exprops[] = "\0Prado\Web\UI\WebControls\TListItem\0_enabled"; |
|
90 | + } |
|
91 | + if ($this->_selected === false) { |
|
92 | + $exprops[] = "\0Prado\Web\UI\WebControls\TListItem\0_selected"; |
|
93 | + } |
|
89 | 94 | } |
90 | 95 | |
91 | 96 | /** |
@@ -157,8 +162,9 @@ discard block |
||
157 | 162 | */ |
158 | 163 | public function getAttributes() |
159 | 164 | { |
160 | - if(!$this->_attributes) |
|
161 | - $this->_attributes = new TAttributeCollection; |
|
165 | + if(!$this->_attributes) { |
|
166 | + $this->_attributes = new TAttributeCollection; |
|
167 | + } |
|
162 | 168 | return $this->_attributes; |
163 | 169 | } |
164 | 170 |
@@ -34,7 +34,7 @@ |
||
34 | 34 | */ |
35 | 35 | public function insertAt($index, $item) |
36 | 36 | { |
37 | - if($item instanceof TTableCell) |
|
37 | + if ($item instanceof TTableCell) |
|
38 | 38 | parent::insertAt($index, $item); |
39 | 39 | else |
40 | 40 | throw new TInvalidDataTypeException('tablecellcollection_tablecell_required'); |
@@ -34,9 +34,10 @@ |
||
34 | 34 | */ |
35 | 35 | public function insertAt($index, $item) |
36 | 36 | { |
37 | - if($item instanceof TTableCell) |
|
38 | - parent::insertAt($index, $item); |
|
39 | - else |
|
40 | - throw new TInvalidDataTypeException('tablecellcollection_tablecell_required'); |
|
37 | + if($item instanceof TTableCell) { |
|
38 | + parent::insertAt($index, $item); |
|
39 | + } else { |
|
40 | + throw new TInvalidDataTypeException('tablecellcollection_tablecell_required'); |
|
41 | + } |
|
41 | 42 | } |
42 | 43 | } |
43 | 44 | \ No newline at end of file |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | // may be overwritten in the following |
99 | 99 | parent::addAttributesToRender($writer); |
100 | 100 | |
101 | - if($this->getEnabled(true) && $this->getEnableClientScript()) |
|
101 | + if ($this->getEnabled(true) && $this->getEnableClientScript()) |
|
102 | 102 | { |
103 | 103 | $this->renderLinkButtonHref($writer); |
104 | 104 | $this->renderClientControlScript($writer); |
105 | 105 | } |
106 | - elseif($this->getEnabled()) // in this case, parent will not render 'disabled' |
|
106 | + elseif ($this->getEnabled()) // in this case, parent will not render 'disabled' |
|
107 | 107 | $writer->addAttribute('disabled', 'disabled'); |
108 | 108 | } |
109 | 109 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | protected function renderLinkButtonHref($writer) |
141 | 141 | { |
142 | 142 | //create unique no-op url references |
143 | - $nop = "javascript:;//" . $this->getClientID(); |
|
143 | + $nop = "javascript:;//".$this->getClientID(); |
|
144 | 144 | $writer->addAttribute('href', $nop); |
145 | 145 | } |
146 | 146 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function renderContents($writer) |
180 | 180 | { |
181 | - if(($text = $this->getText()) === '') |
|
181 | + if (($text = $this->getText()) === '') |
|
182 | 182 | parent::renderContents($writer); |
183 | 183 | else |
184 | 184 | $writer->write($text); |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | */ |
303 | 303 | public function raisePostBackEvent($param) |
304 | 304 | { |
305 | - if($this->getCausesValidation()) |
|
305 | + if ($this->getCausesValidation()) |
|
306 | 306 | $this->getPage()->validate($this->getValidationGroup()); |
307 | 307 | $this->onClick(null); |
308 | 308 | $this->onCommand(new \Prado\Web\UI\TCommandEventParameter($this->getCommandName(), $this->getCommandParameter())); |
@@ -102,9 +102,10 @@ discard block |
||
102 | 102 | { |
103 | 103 | $this->renderLinkButtonHref($writer); |
104 | 104 | $this->renderClientControlScript($writer); |
105 | - } |
|
106 | - elseif($this->getEnabled()) // in this case, parent will not render 'disabled' |
|
105 | + } elseif($this->getEnabled()) { |
|
106 | + // in this case, parent will not render 'disabled' |
|
107 | 107 | $writer->addAttribute('disabled', 'disabled'); |
108 | + } |
|
108 | 109 | } |
109 | 110 | |
110 | 111 | /** |
@@ -178,10 +179,11 @@ discard block |
||
178 | 179 | */ |
179 | 180 | public function renderContents($writer) |
180 | 181 | { |
181 | - if(($text = $this->getText()) === '') |
|
182 | - parent::renderContents($writer); |
|
183 | - else |
|
184 | - $writer->write($text); |
|
182 | + if(($text = $this->getText()) === '') { |
|
183 | + parent::renderContents($writer); |
|
184 | + } else { |
|
185 | + $writer->write($text); |
|
186 | + } |
|
185 | 187 | } |
186 | 188 | |
187 | 189 | /** |
@@ -302,8 +304,9 @@ discard block |
||
302 | 304 | */ |
303 | 305 | public function raisePostBackEvent($param) |
304 | 306 | { |
305 | - if($this->getCausesValidation()) |
|
306 | - $this->getPage()->validate($this->getValidationGroup()); |
|
307 | + if($this->getCausesValidation()) { |
|
308 | + $this->getPage()->validate($this->getValidationGroup()); |
|
309 | + } |
|
307 | 310 | $this->onClick(null); |
308 | 311 | $this->onCommand(new \Prado\Web\UI\TCommandEventParameter($this->getCommandName(), $this->getCommandParameter())); |
309 | 312 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | */ |
184 | 184 | public function addParsedObject($object) |
185 | 185 | { |
186 | - if($object instanceof TWizardStep) |
|
186 | + if ($object instanceof TWizardStep) |
|
187 | 187 | $this->getWizardSteps()->add($object); |
188 | 188 | } |
189 | 189 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | */ |
202 | 202 | public function setActiveStep($step) |
203 | 203 | { |
204 | - if(($index = $this->getWizardSteps()->indexOf($step)) < 0) |
|
204 | + if (($index = $this->getWizardSteps()->indexOf($step)) < 0) |
|
205 | 205 | throw new TInvalidOperationException('wizard_step_invalid'); |
206 | 206 | $this->setActiveStepIndex($index); |
207 | 207 | } |
@@ -221,11 +221,11 @@ discard block |
||
221 | 221 | { |
222 | 222 | $value = TPropertyValue::ensureInteger($value); |
223 | 223 | $multiView = $this->getMultiView(); |
224 | - if($multiView->getActiveViewIndex() !== $value) |
|
224 | + if ($multiView->getActiveViewIndex() !== $value) |
|
225 | 225 | { |
226 | 226 | $multiView->setActiveViewIndex($value); |
227 | 227 | $this->_activeStepIndexSet = true; |
228 | - if($this->_sideBarDataList !== null && $this->getSideBarTemplate() !== null) |
|
228 | + if ($this->_sideBarDataList !== null && $this->getSideBarTemplate() !== null) |
|
229 | 229 | { |
230 | 230 | $this->_sideBarDataList->setSelectedItemIndex($this->getActiveStepIndex()); |
231 | 231 | $this->_sideBarDataList->dataBind(); |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | */ |
239 | 239 | public function getWizardSteps() |
240 | 240 | { |
241 | - if($this->_wizardSteps === null) |
|
241 | + if ($this->_wizardSteps === null) |
|
242 | 242 | $this->_wizardSteps = new TWizardStepCollection($this); |
243 | 243 | return $this->_wizardSteps; |
244 | 244 | } |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | */ |
417 | 417 | public function getSideBarButtonStyle() |
418 | 418 | { |
419 | - if(($style = $this->getViewState('SideBarButtonStyle', null)) === null) |
|
419 | + if (($style = $this->getViewState('SideBarButtonStyle', null)) === null) |
|
420 | 420 | { |
421 | 421 | $style = new TStyle; |
422 | 422 | $this->setViewState('SideBarButtonStyle', $style, null); |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | */ |
430 | 430 | public function getNavigationButtonStyle() |
431 | 431 | { |
432 | - if(($style = $this->getViewState('NavigationButtonStyle', null)) === null) |
|
432 | + if (($style = $this->getViewState('NavigationButtonStyle', null)) === null) |
|
433 | 433 | { |
434 | 434 | $style = new TStyle; |
435 | 435 | $this->setViewState('NavigationButtonStyle', $style, null); |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | */ |
443 | 443 | public function getStartNextButtonStyle() |
444 | 444 | { |
445 | - if(($style = $this->getViewState('StartNextButtonStyle', null)) === null) |
|
445 | + if (($style = $this->getViewState('StartNextButtonStyle', null)) === null) |
|
446 | 446 | { |
447 | 447 | $style = new TWizardNavigationButtonStyle; |
448 | 448 | $style->setButtonText('Next'); |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | */ |
457 | 457 | public function getStepNextButtonStyle() |
458 | 458 | { |
459 | - if(($style = $this->getViewState('StepNextButtonStyle', null)) === null) |
|
459 | + if (($style = $this->getViewState('StepNextButtonStyle', null)) === null) |
|
460 | 460 | { |
461 | 461 | $style = new TWizardNavigationButtonStyle; |
462 | 462 | $style->setButtonText('Next'); |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | */ |
471 | 471 | public function getStepPreviousButtonStyle() |
472 | 472 | { |
473 | - if(($style = $this->getViewState('StepPreviousButtonStyle', null)) === null) |
|
473 | + if (($style = $this->getViewState('StepPreviousButtonStyle', null)) === null) |
|
474 | 474 | { |
475 | 475 | $style = new TWizardNavigationButtonStyle; |
476 | 476 | $style->setButtonText('Previous'); |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | */ |
485 | 485 | public function getFinishCompleteButtonStyle() |
486 | 486 | { |
487 | - if(($style = $this->getViewState('FinishCompleteButtonStyle', null)) === null) |
|
487 | + if (($style = $this->getViewState('FinishCompleteButtonStyle', null)) === null) |
|
488 | 488 | { |
489 | 489 | $style = new TWizardNavigationButtonStyle; |
490 | 490 | $style->setButtonText('Complete'); |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | */ |
499 | 499 | public function getFinishPreviousButtonStyle() |
500 | 500 | { |
501 | - if(($style = $this->getViewState('FinishPreviousButtonStyle', null)) === null) |
|
501 | + if (($style = $this->getViewState('FinishPreviousButtonStyle', null)) === null) |
|
502 | 502 | { |
503 | 503 | $style = new TWizardNavigationButtonStyle; |
504 | 504 | $style->setButtonText('Previous'); |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | */ |
513 | 513 | public function getCancelButtonStyle() |
514 | 514 | { |
515 | - if(($style = $this->getViewState('CancelButtonStyle', null)) === null) |
|
515 | + if (($style = $this->getViewState('CancelButtonStyle', null)) === null) |
|
516 | 516 | { |
517 | 517 | $style = new TWizardNavigationButtonStyle; |
518 | 518 | $style->setButtonText('Cancel'); |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | */ |
527 | 527 | public function getSideBarStyle() |
528 | 528 | { |
529 | - if(($style = $this->getViewState('SideBarStyle', null)) === null) |
|
529 | + if (($style = $this->getViewState('SideBarStyle', null)) === null) |
|
530 | 530 | { |
531 | 531 | $style = new TPanelStyle; |
532 | 532 | $this->setViewState('SideBarStyle', $style, null); |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | */ |
540 | 540 | public function getHeaderStyle() |
541 | 541 | { |
542 | - if(($style = $this->getViewState('HeaderStyle', null)) === null) |
|
542 | + if (($style = $this->getViewState('HeaderStyle', null)) === null) |
|
543 | 543 | { |
544 | 544 | $style = new TPanelStyle; |
545 | 545 | $this->setViewState('HeaderStyle', $style, null); |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | */ |
553 | 553 | public function getStepStyle() |
554 | 554 | { |
555 | - if(($style = $this->getViewState('StepStyle', null)) === null) |
|
555 | + if (($style = $this->getViewState('StepStyle', null)) === null) |
|
556 | 556 | { |
557 | 557 | $style = new TPanelStyle; |
558 | 558 | $this->setViewState('StepStyle', $style, null); |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | */ |
566 | 566 | public function getNavigationStyle() |
567 | 567 | { |
568 | - if(($style = $this->getViewState('NavigationStyle', null)) === null) |
|
568 | + if (($style = $this->getViewState('NavigationStyle', null)) === null) |
|
569 | 569 | { |
570 | 570 | $style = new TPanelStyle; |
571 | 571 | $this->setViewState('NavigationStyle', $style, null); |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | public function onCancelButtonClick($param) |
660 | 660 | { |
661 | 661 | $this->raiseEvent('OnCancelButtonClick', $this, $param); |
662 | - if(($url = $this->getCancelDestinationUrl()) !== '') |
|
662 | + if (($url = $this->getCancelDestinationUrl()) !== '') |
|
663 | 663 | $this->getResponse()->redirect($url); |
664 | 664 | } |
665 | 665 | |
@@ -672,7 +672,7 @@ discard block |
||
672 | 672 | public function onCompleteButtonClick($param) |
673 | 673 | { |
674 | 674 | $this->raiseEvent('OnCompleteButtonClick', $this, $param); |
675 | - if(($url = $this->getFinishDestinationUrl()) !== '') |
|
675 | + if (($url = $this->getFinishDestinationUrl()) !== '') |
|
676 | 676 | $this->getResponse()->redirect($url); |
677 | 677 | } |
678 | 678 | |
@@ -715,11 +715,11 @@ discard block |
||
715 | 715 | */ |
716 | 716 | public function getMultiView() |
717 | 717 | { |
718 | - if($this->_multiView === null) |
|
718 | + if ($this->_multiView === null) |
|
719 | 719 | { |
720 | 720 | $this->_multiView = new TMultiView; |
721 | 721 | $this->_multiView->setID('WizardMultiView'); |
722 | - $this->_multiView->attachEventHandler('OnActiveViewChanged', [$this,'onActiveStepChanged']); |
|
722 | + $this->_multiView->attachEventHandler('OnActiveViewChanged', [$this, 'onActiveStepChanged']); |
|
723 | 723 | $this->_multiView->ignoreBubbleEvents(); |
724 | 724 | } |
725 | 725 | return $this->_multiView; |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | */ |
734 | 734 | public function addedWizardStep($step) |
735 | 735 | { |
736 | - if(($wizard = $step->getWizard()) !== null) |
|
736 | + if (($wizard = $step->getWizard()) !== null) |
|
737 | 737 | $wizard->getWizardSteps()->remove($step); |
738 | 738 | $step->setWizard($this); |
739 | 739 | $this->wizardStepsChanged(); |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | parent::onInit($param); |
762 | 762 | $this->ensureChildControls(); |
763 | 763 | $this->setEnsureId(true); |
764 | - if($this->getActiveStepIndex() < 0 && $this->getWizardSteps()->getCount() > 0) |
|
764 | + if ($this->getActiveStepIndex() < 0 && $this->getWizardSteps()->getCount() > 0) |
|
765 | 765 | $this->setActiveStepIndex(0); |
766 | 766 | } |
767 | 767 | |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | { |
774 | 774 | $index = $this->getActiveStepIndex(); |
775 | 775 | $history = $this->getHistory(); |
776 | - if(!$history->getCount() || $history->peek() !== $index) |
|
776 | + if (!$history->getCount() || $history->peek() !== $index) |
|
777 | 777 | $history->push($index); |
778 | 778 | } |
779 | 779 | |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | */ |
783 | 783 | protected function requiresControlsRecreation() |
784 | 784 | { |
785 | - if($this->getChildControlsCreated()) |
|
785 | + if ($this->getChildControlsCreated()) |
|
786 | 786 | $this->setChildControlsCreated(false); |
787 | 787 | } |
788 | 788 | |
@@ -793,9 +793,9 @@ discard block |
||
793 | 793 | public function render($writer) |
794 | 794 | { |
795 | 795 | $this->ensureChildControls(); |
796 | - if($this->getHasControls()) |
|
796 | + if ($this->getHasControls()) |
|
797 | 797 | { |
798 | - if($this->getUseDefaultLayout()) |
|
798 | + if ($this->getUseDefaultLayout()) |
|
799 | 799 | { |
800 | 800 | $this->applyControlProperties(); |
801 | 801 | $this->renderBeginTag($writer); |
@@ -837,9 +837,9 @@ discard block |
||
837 | 837 | */ |
838 | 838 | protected function applyHeaderProperties() |
839 | 839 | { |
840 | - if(($style = $this->getViewState('HeaderStyle', null)) !== null) |
|
840 | + if (($style = $this->getViewState('HeaderStyle', null)) !== null) |
|
841 | 841 | $this->_header->getStyle()->mergeWith($style); |
842 | - if($this->getHeaderTemplate() === null) |
|
842 | + if ($this->getHeaderTemplate() === null) |
|
843 | 843 | { |
844 | 844 | $this->_header->getControls()->clear(); |
845 | 845 | $this->_header->getControls()->add($this->getHeaderText()); |
@@ -852,21 +852,21 @@ discard block |
||
852 | 852 | protected function applySideBarProperties() |
853 | 853 | { |
854 | 854 | $this->_sideBar->setVisible($this->getShowSideBar()); |
855 | - if($this->_sideBarDataList !== null && $this->getShowSideBar()) |
|
855 | + if ($this->_sideBarDataList !== null && $this->getShowSideBar()) |
|
856 | 856 | { |
857 | 857 | $this->_sideBarDataList->setDataSource($this->getWizardSteps()); |
858 | 858 | $this->_sideBarDataList->setSelectedItemIndex($this->getActiveStepIndex()); |
859 | 859 | $this->_sideBarDataList->dataBind(); |
860 | - if(($style = $this->getViewState('SideBarButtonStyle', null)) !== null) |
|
860 | + if (($style = $this->getViewState('SideBarButtonStyle', null)) !== null) |
|
861 | 861 | { |
862 | - foreach($this->_sideBarDataList->getItems() as $item) |
|
862 | + foreach ($this->_sideBarDataList->getItems() as $item) |
|
863 | 863 | { |
864 | - if(($button = $item->findControl('SideBarButton')) !== null) |
|
864 | + if (($button = $item->findControl('SideBarButton')) !== null) |
|
865 | 865 | $button->getStyle()->mergeWith($style); |
866 | 866 | } |
867 | 867 | } |
868 | 868 | } |
869 | - if(($style = $this->getViewState('SideBarStyle', null)) !== null) |
|
869 | + if (($style = $this->getViewState('SideBarStyle', null)) !== null) |
|
870 | 870 | $this->_sideBar->getStyle()->mergeWith($style); |
871 | 871 | } |
872 | 872 | |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | */ |
876 | 876 | protected function applyStepContentProperties() |
877 | 877 | { |
878 | - if(($style = $this->getViewState('StepStyle', null)) !== null) |
|
878 | + if (($style = $this->getViewState('StepStyle', null)) !== null) |
|
879 | 879 | $this->_stepContent->getStyle()->mergeWith($style); |
880 | 880 | } |
881 | 881 | |
@@ -888,9 +888,9 @@ discard block |
||
888 | 888 | $activeStep = $this->getActiveStep(); |
889 | 889 | $activeStepIndex = $this->getActiveStepIndex(); |
890 | 890 | |
891 | - if(!$this->_navigation) |
|
891 | + if (!$this->_navigation) |
|
892 | 892 | return; |
893 | - elseif($activeStepIndex < 0 || $activeStepIndex >= $wizardSteps->getCount()) |
|
893 | + elseif ($activeStepIndex < 0 || $activeStepIndex >= $wizardSteps->getCount()) |
|
894 | 894 | { |
895 | 895 | $this->_navigation->setVisible(false); |
896 | 896 | return; |
@@ -898,11 +898,11 @@ discard block |
||
898 | 898 | |
899 | 899 | // set visibility of different types of navigation panel |
900 | 900 | $showStandard = true; |
901 | - foreach($wizardSteps as $step) |
|
901 | + foreach ($wizardSteps as $step) |
|
902 | 902 | { |
903 | - if(($step instanceof TTemplatedWizardStep) && ($container = $step->getNavigationContainer()) !== null) |
|
903 | + if (($step instanceof TTemplatedWizardStep) && ($container = $step->getNavigationContainer()) !== null) |
|
904 | 904 | { |
905 | - if($activeStep === $step) |
|
905 | + if ($activeStep === $step) |
|
906 | 906 | { |
907 | 907 | $container->setVisible(true); |
908 | 908 | $showStandard = false; |
@@ -912,7 +912,7 @@ discard block |
||
912 | 912 | } |
913 | 913 | } |
914 | 914 | $activeStepType = $this->getStepType($activeStep); |
915 | - if($activeStepType === TWizardStepType::Complete) |
|
915 | + if ($activeStepType === TWizardStepType::Complete) |
|
916 | 916 | { |
917 | 917 | $this->_sideBar->setVisible(false); |
918 | 918 | $this->_header->setVisible(false); |
@@ -921,79 +921,79 @@ discard block |
||
921 | 921 | $this->_stepNavigation->setVisible($showStandard && $activeStepType === TWizardStepType::Step); |
922 | 922 | $this->_finishNavigation->setVisible($showStandard && $activeStepType === TWizardStepType::Finish); |
923 | 923 | |
924 | - if(($navigationStyle = $this->getViewState('NavigationStyle', null)) !== null) |
|
924 | + if (($navigationStyle = $this->getViewState('NavigationStyle', null)) !== null) |
|
925 | 925 | $this->_navigation->getStyle()->mergeWith($navigationStyle); |
926 | 926 | |
927 | 927 | $displayCancelButton = $this->getShowCancelButton(); |
928 | 928 | $cancelButtonStyle = $this->getCancelButtonStyle(); |
929 | 929 | $buttonStyle = $this->getViewState('NavigationButtonStyle', null); |
930 | - if($buttonStyle !== null) |
|
930 | + if ($buttonStyle !== null) |
|
931 | 931 | $cancelButtonStyle->mergeWith($buttonStyle); |
932 | 932 | |
933 | 933 | // apply styles to start navigation buttons |
934 | - if(($cancelButton = $this->_startNavigation->getCancelButton()) !== null) |
|
934 | + if (($cancelButton = $this->_startNavigation->getCancelButton()) !== null) |
|
935 | 935 | { |
936 | 936 | $cancelButton->setVisible($displayCancelButton); |
937 | 937 | $cancelButtonStyle->apply($cancelButton); |
938 | 938 | } |
939 | - if(($button = $this->_startNavigation->getNextButton()) !== null) |
|
939 | + if (($button = $this->_startNavigation->getNextButton()) !== null) |
|
940 | 940 | { |
941 | 941 | $button->setVisible(true); |
942 | 942 | $style = $this->getStartNextButtonStyle(); |
943 | - if($buttonStyle !== null) |
|
943 | + if ($buttonStyle !== null) |
|
944 | 944 | $style->mergeWith($buttonStyle); |
945 | 945 | $style->apply($button); |
946 | - if($activeStepType === TWizardStepType::Start) |
|
946 | + if ($activeStepType === TWizardStepType::Start) |
|
947 | 947 | $this->getPage()->getClientScript()->registerDefaultButton($this, $button); |
948 | 948 | } |
949 | 949 | |
950 | 950 | // apply styles to finish navigation buttons |
951 | - if(($cancelButton = $this->_finishNavigation->getCancelButton()) !== null) |
|
951 | + if (($cancelButton = $this->_finishNavigation->getCancelButton()) !== null) |
|
952 | 952 | { |
953 | 953 | $cancelButton->setVisible($displayCancelButton); |
954 | 954 | $cancelButtonStyle->apply($cancelButton); |
955 | 955 | } |
956 | - if(($button = $this->_finishNavigation->getPreviousButton()) !== null) |
|
956 | + if (($button = $this->_finishNavigation->getPreviousButton()) !== null) |
|
957 | 957 | { |
958 | 958 | $button->setVisible($this->allowNavigationToPreviousStep()); |
959 | 959 | $style = $this->getFinishPreviousButtonStyle(); |
960 | - if($buttonStyle !== null) |
|
960 | + if ($buttonStyle !== null) |
|
961 | 961 | $style->mergeWith($buttonStyle); |
962 | 962 | $style->apply($button); |
963 | 963 | } |
964 | - if(($button = $this->_finishNavigation->getCompleteButton()) !== null) |
|
964 | + if (($button = $this->_finishNavigation->getCompleteButton()) !== null) |
|
965 | 965 | { |
966 | 966 | $button->setVisible(true); |
967 | 967 | $style = $this->getFinishCompleteButtonStyle(); |
968 | - if($buttonStyle !== null) |
|
968 | + if ($buttonStyle !== null) |
|
969 | 969 | $style->mergeWith($buttonStyle); |
970 | 970 | $style->apply($button); |
971 | - if($activeStepType === TWizardStepType::Finish) |
|
971 | + if ($activeStepType === TWizardStepType::Finish) |
|
972 | 972 | $this->getPage()->getClientScript()->registerDefaultButton($this, $button); |
973 | 973 | } |
974 | 974 | |
975 | 975 | // apply styles to step navigation buttons |
976 | - if(($cancelButton = $this->_stepNavigation->getCancelButton()) !== null) |
|
976 | + if (($cancelButton = $this->_stepNavigation->getCancelButton()) !== null) |
|
977 | 977 | { |
978 | 978 | $cancelButton->setVisible($displayCancelButton); |
979 | 979 | $cancelButtonStyle->apply($cancelButton); |
980 | 980 | } |
981 | - if(($button = $this->_stepNavigation->getPreviousButton()) !== null) |
|
981 | + if (($button = $this->_stepNavigation->getPreviousButton()) !== null) |
|
982 | 982 | { |
983 | 983 | $button->setVisible($this->allowNavigationToPreviousStep()); |
984 | 984 | $style = $this->getStepPreviousButtonStyle(); |
985 | - if($buttonStyle !== null) |
|
985 | + if ($buttonStyle !== null) |
|
986 | 986 | $style->mergeWith($buttonStyle); |
987 | 987 | $style->apply($button); |
988 | 988 | } |
989 | - if(($button = $this->_stepNavigation->getNextButton()) !== null) |
|
989 | + if (($button = $this->_stepNavigation->getNextButton()) !== null) |
|
990 | 990 | { |
991 | 991 | $button->setVisible(true); |
992 | 992 | $style = $this->getStepNextButtonStyle(); |
993 | - if($buttonStyle !== null) |
|
993 | + if ($buttonStyle !== null) |
|
994 | 994 | $style->mergeWith($buttonStyle); |
995 | 995 | $style->apply($button); |
996 | - if($activeStepType === TWizardStepType::Step) |
|
996 | + if ($activeStepType === TWizardStepType::Step) |
|
997 | 997 | $this->getPage()->getClientScript()->registerDefaultButton($this, $button); |
998 | 998 | } |
999 | 999 | } |
@@ -1003,7 +1003,7 @@ discard block |
||
1003 | 1003 | */ |
1004 | 1004 | protected function getHistory() |
1005 | 1005 | { |
1006 | - if(($history = $this->getControlState('History', null)) === null) |
|
1006 | + if (($history = $this->getControlState('History', null)) === null) |
|
1007 | 1007 | { |
1008 | 1008 | $history = new TStack; |
1009 | 1009 | $this->setControlState('History', $history); |
@@ -1018,17 +1018,17 @@ discard block |
||
1018 | 1018 | */ |
1019 | 1019 | protected function getStepType($wizardStep) |
1020 | 1020 | { |
1021 | - if(($type = $wizardStep->getStepType()) === TWizardStepType::Auto) |
|
1021 | + if (($type = $wizardStep->getStepType()) === TWizardStepType::Auto) |
|
1022 | 1022 | { |
1023 | 1023 | $steps = $this->getWizardSteps(); |
1024 | - if(($index = $steps->indexOf($wizardStep)) >= 0) |
|
1024 | + if (($index = $steps->indexOf($wizardStep)) >= 0) |
|
1025 | 1025 | { |
1026 | 1026 | $stepCount = $steps->getCount(); |
1027 | - if($stepCount === 1 || ($index < $stepCount - 1 && $steps->itemAt($index + 1)->getStepType() === TWizardStepType::Complete)) |
|
1027 | + if ($stepCount === 1 || ($index < $stepCount - 1 && $steps->itemAt($index + 1)->getStepType() === TWizardStepType::Complete)) |
|
1028 | 1028 | return TWizardStepType::Finish; |
1029 | - elseif($index === 0) |
|
1029 | + elseif ($index === 0) |
|
1030 | 1030 | return TWizardStepType::Start; |
1031 | - elseif($index === $stepCount - 1) |
|
1031 | + elseif ($index === $stepCount - 1) |
|
1032 | 1032 | return TWizardStepType::Finish; |
1033 | 1033 | else |
1034 | 1034 | return TWizardStepType::Step; |
@@ -1075,7 +1075,7 @@ discard block |
||
1075 | 1075 | protected function createHeader() |
1076 | 1076 | { |
1077 | 1077 | $this->_header = new TPanel; |
1078 | - if(($template = $this->getHeaderTemplate()) !== null) |
|
1078 | + if (($template = $this->getHeaderTemplate()) !== null) |
|
1079 | 1079 | $template->instantiateIn($this->_header); |
1080 | 1080 | else |
1081 | 1081 | $this->_header->getControls()->add($this->getHeaderText()); |
@@ -1087,18 +1087,18 @@ discard block |
||
1087 | 1087 | */ |
1088 | 1088 | protected function createSideBar() |
1089 | 1089 | { |
1090 | - if($this->getShowSideBar()) |
|
1090 | + if ($this->getShowSideBar()) |
|
1091 | 1091 | { |
1092 | - if(($template = $this->getSideBarTemplate()) === null) |
|
1092 | + if (($template = $this->getSideBarTemplate()) === null) |
|
1093 | 1093 | $template = new TWizardSideBarTemplate; |
1094 | 1094 | $this->_sideBar = new TPanel; |
1095 | 1095 | $template->instantiateIn($this->_sideBar); |
1096 | 1096 | $this->getControls()->add($this->_sideBar); |
1097 | 1097 | |
1098 | - if(($this->_sideBarDataList = $this->_sideBar->findControl(self::ID_SIDEBAR_LIST)) !== null) |
|
1098 | + if (($this->_sideBarDataList = $this->_sideBar->findControl(self::ID_SIDEBAR_LIST)) !== null) |
|
1099 | 1099 | { |
1100 | - $this->_sideBarDataList->attachEventHandler('OnItemCommand', [$this,'dataListItemCommand']); |
|
1101 | - $this->_sideBarDataList->attachEventHandler('OnItemDataBound', [$this,'dataListItemDataBound']); |
|
1100 | + $this->_sideBarDataList->attachEventHandler('OnItemCommand', [$this, 'dataListItemCommand']); |
|
1101 | + $this->_sideBarDataList->attachEventHandler('OnItemDataBound', [$this, 'dataListItemDataBound']); |
|
1102 | 1102 | $this->_sideBarDataList->setDataSource($this->getWizardSteps()); |
1103 | 1103 | $this->_sideBarDataList->setSelectedItemIndex($this->getActiveStepIndex()); |
1104 | 1104 | $this->_sideBarDataList->dataBind(); |
@@ -1121,7 +1121,7 @@ discard block |
||
1121 | 1121 | public function dataListItemCommand($sender, $param) |
1122 | 1122 | { |
1123 | 1123 | $item = $param->getItem(); |
1124 | - if($param->getCommandName() === self::CMD_MOVETO) |
|
1124 | + if ($param->getCommandName() === self::CMD_MOVETO) |
|
1125 | 1125 | { |
1126 | 1126 | $stepIndex = $this->getActiveStepIndex(); |
1127 | 1127 | $newStepIndex = TPropertyValue::ensureInteger($param->getCommandParameter()); |
@@ -1131,15 +1131,15 @@ discard block |
||
1131 | 1131 | // if the button clicked causes validation which fails, |
1132 | 1132 | // by default we will cancel navigation to the new step |
1133 | 1133 | $button = $param->getCommandSource(); |
1134 | - if(($button instanceof \Prado\Web\UI\IButtonControl) && $button->getCausesValidation() && ($page = $this->getPage()) !== null && !$page->getIsValid()) |
|
1134 | + if (($button instanceof \Prado\Web\UI\IButtonControl) && $button->getCausesValidation() && ($page = $this->getPage()) !== null && !$page->getIsValid()) |
|
1135 | 1135 | $navParam->setCancelNavigation(true); |
1136 | 1136 | |
1137 | 1137 | $this->_activeStepIndexSet = false; |
1138 | 1138 | $this->onSideBarButtonClick($navParam); |
1139 | 1139 | $this->_cancelNavigation = $navParam->getCancelNavigation(); |
1140 | - if(!$this->_cancelNavigation) |
|
1140 | + if (!$this->_cancelNavigation) |
|
1141 | 1141 | { |
1142 | - if(!$this->_activeStepIndexSet && $this->allowNavigationToStep($newStepIndex)) |
|
1142 | + if (!$this->_activeStepIndexSet && $this->allowNavigationToStep($newStepIndex)) |
|
1143 | 1143 | $this->setActiveStepIndex($newStepIndex); |
1144 | 1144 | } |
1145 | 1145 | else |
@@ -1158,14 +1158,14 @@ discard block |
||
1158 | 1158 | { |
1159 | 1159 | $item = $param->getItem(); |
1160 | 1160 | $itemType = $item->getItemType(); |
1161 | - if($itemType === 'Item' || $itemType === 'AlternatingItem' || $itemType === 'SelectedItem' || $itemType === 'EditItem') |
|
1161 | + if ($itemType === 'Item' || $itemType === 'AlternatingItem' || $itemType === 'SelectedItem' || $itemType === 'EditItem') |
|
1162 | 1162 | { |
1163 | - if(($button = $item->findControl(self::ID_SIDEBAR_BUTTON)) !== null) |
|
1163 | + if (($button = $item->findControl(self::ID_SIDEBAR_BUTTON)) !== null) |
|
1164 | 1164 | { |
1165 | 1165 | $step = $item->getData(); |
1166 | - if(($this->getStepType($step) === TWizardStepType::Complete)) |
|
1166 | + if (($this->getStepType($step) === TWizardStepType::Complete)) |
|
1167 | 1167 | $button->setEnabled(false); |
1168 | - if(($title = $step->getTitle()) !== '') |
|
1168 | + if (($title = $step->getTitle()) !== '') |
|
1169 | 1169 | $button->setText($title); |
1170 | 1170 | else |
1171 | 1171 | $button->setText($step->getID(false)); |
@@ -1181,16 +1181,16 @@ discard block |
||
1181 | 1181 | */ |
1182 | 1182 | protected function createStepContent() |
1183 | 1183 | { |
1184 | - foreach($this->getWizardSteps() as $step) |
|
1184 | + foreach ($this->getWizardSteps() as $step) |
|
1185 | 1185 | { |
1186 | - if($step instanceof TTemplatedWizardStep) |
|
1186 | + if ($step instanceof TTemplatedWizardStep) |
|
1187 | 1187 | $step->ensureChildControls(); |
1188 | 1188 | } |
1189 | 1189 | $multiView = $this->getMultiView(); |
1190 | 1190 | $this->_stepContent = new TPanel; |
1191 | 1191 | $this->_stepContent->getControls()->add($multiView); |
1192 | 1192 | $this->getControls()->add($this->_stepContent); |
1193 | - if($multiView->getViews()->getCount()) |
|
1193 | + if ($multiView->getViews()->getCount()) |
|
1194 | 1194 | $multiView->setActiveViewIndex(0); |
1195 | 1195 | } |
1196 | 1196 | |
@@ -1202,12 +1202,12 @@ discard block |
||
1202 | 1202 | $this->_navigation = new TPanel; |
1203 | 1203 | $this->getControls()->add($this->_navigation); |
1204 | 1204 | $controls = $this->_navigation->getControls(); |
1205 | - foreach($this->getWizardSteps() as $step) |
|
1205 | + foreach ($this->getWizardSteps() as $step) |
|
1206 | 1206 | { |
1207 | - if($step instanceof TTemplatedWizardStep) |
|
1207 | + if ($step instanceof TTemplatedWizardStep) |
|
1208 | 1208 | { |
1209 | 1209 | $step->instantiateNavigationTemplate(); |
1210 | - if(($panel = $step->getNavigationContainer()) !== null) |
|
1210 | + if (($panel = $step->getNavigationContainer()) !== null) |
|
1211 | 1211 | $controls->add($panel); |
1212 | 1212 | } |
1213 | 1213 | } |
@@ -1224,7 +1224,7 @@ discard block |
||
1224 | 1224 | */ |
1225 | 1225 | protected function createStartNavigation() |
1226 | 1226 | { |
1227 | - if(($template = $this->getStartNavigationTemplate()) === null) |
|
1227 | + if (($template = $this->getStartNavigationTemplate()) === null) |
|
1228 | 1228 | $template = new TWizardStartNavigationTemplate($this); |
1229 | 1229 | $navigation = new TWizardNavigationContainer; |
1230 | 1230 | $template->instantiateIn($navigation); |
@@ -1236,7 +1236,7 @@ discard block |
||
1236 | 1236 | */ |
1237 | 1237 | protected function createStepNavigation() |
1238 | 1238 | { |
1239 | - if(($template = $this->getStepNavigationTemplate()) === null) |
|
1239 | + if (($template = $this->getStepNavigationTemplate()) === null) |
|
1240 | 1240 | $template = new TWizardStepNavigationTemplate($this); |
1241 | 1241 | $navigation = new TWizardNavigationContainer; |
1242 | 1242 | $template->instantiateIn($navigation); |
@@ -1248,7 +1248,7 @@ discard block |
||
1248 | 1248 | */ |
1249 | 1249 | protected function createFinishNavigation() |
1250 | 1250 | { |
1251 | - if(($template = $this->getFinishNavigationTemplate()) === null) |
|
1251 | + if (($template = $this->getFinishNavigationTemplate()) === null) |
|
1252 | 1252 | $template = new TWizardFinishNavigationTemplate($this); |
1253 | 1253 | $navigation = new TWizardNavigationContainer; |
1254 | 1254 | $template->instantiateIn($navigation); |
@@ -1261,7 +1261,7 @@ discard block |
||
1261 | 1261 | */ |
1262 | 1262 | public function wizardStepsChanged() |
1263 | 1263 | { |
1264 | - if($this->_sideBarDataList !== null) |
|
1264 | + if ($this->_sideBarDataList !== null) |
|
1265 | 1265 | { |
1266 | 1266 | $this->_sideBarDataList->setDataSource($this->getWizardSteps()); |
1267 | 1267 | $this->_sideBarDataList->setSelectedItemIndex($this->getActiveStepIndex()); |
@@ -1277,20 +1277,20 @@ discard block |
||
1277 | 1277 | protected function getPreviousStepIndex($popStack) |
1278 | 1278 | { |
1279 | 1279 | $history = $this->getHistory(); |
1280 | - if($history->getCount() >= 0) |
|
1280 | + if ($history->getCount() >= 0) |
|
1281 | 1281 | { |
1282 | 1282 | $activeStepIndex = $this->getActiveStepIndex(); |
1283 | 1283 | $previousStepIndex = -1; |
1284 | - if($popStack) |
|
1284 | + if ($popStack) |
|
1285 | 1285 | { |
1286 | 1286 | $previousStepIndex = $history->pop(); |
1287 | - if($activeStepIndex === $previousStepIndex && $history->getCount() > 0) |
|
1287 | + if ($activeStepIndex === $previousStepIndex && $history->getCount() > 0) |
|
1288 | 1288 | $previousStepIndex = $history->pop(); |
1289 | 1289 | } |
1290 | 1290 | else |
1291 | 1291 | { |
1292 | 1292 | $previousStepIndex = $history->peek(); |
1293 | - if($activeStepIndex === $previousStepIndex && $history->getCount() > 1) |
|
1293 | + if ($activeStepIndex === $previousStepIndex && $history->getCount() > 1) |
|
1294 | 1294 | { |
1295 | 1295 | $saveIndex = $history->pop(); |
1296 | 1296 | $previousStepIndex = $history->peek(); |
@@ -1308,7 +1308,7 @@ discard block |
||
1308 | 1308 | */ |
1309 | 1309 | protected function allowNavigationToPreviousStep() |
1310 | 1310 | { |
1311 | - if(($index = $this->getPreviousStepIndex(false)) !== -1) |
|
1311 | + if (($index = $this->getPreviousStepIndex(false)) !== -1) |
|
1312 | 1312 | return $this->getWizardSteps()->itemAt($index)->getAllowReturn(); |
1313 | 1313 | else |
1314 | 1314 | return false; |
@@ -1320,7 +1320,7 @@ discard block |
||
1320 | 1320 | */ |
1321 | 1321 | protected function allowNavigationToStep($index) |
1322 | 1322 | { |
1323 | - if($this->getHistory()->contains($index)) |
|
1323 | + if ($this->getHistory()->contains($index)) |
|
1324 | 1324 | return $this->getWizardSteps()->itemAt($index)->getAllowReturn(); |
1325 | 1325 | else |
1326 | 1326 | return true; |
@@ -1336,10 +1336,10 @@ discard block |
||
1336 | 1336 | */ |
1337 | 1337 | public function bubbleEvent($sender, $param) |
1338 | 1338 | { |
1339 | - if($param instanceof \Prado\Web\UI\TCommandEventParameter) |
|
1339 | + if ($param instanceof \Prado\Web\UI\TCommandEventParameter) |
|
1340 | 1340 | { |
1341 | 1341 | $command = $param->getCommandName(); |
1342 | - if(strcasecmp($command, self::CMD_CANCEL) === 0) |
|
1342 | + if (strcasecmp($command, self::CMD_CANCEL) === 0) |
|
1343 | 1343 | { |
1344 | 1344 | $this->onCancelButtonClick($param); |
1345 | 1345 | return true; |
@@ -1348,44 +1348,44 @@ discard block |
||
1348 | 1348 | $type = $this->getStepType($this->getActiveStep()); |
1349 | 1349 | $index = $this->getActiveStepIndex(); |
1350 | 1350 | $navParam = new TWizardNavigationEventParameter($index); |
1351 | - if(($sender instanceof \Prado\Web\UI\IButtonControl) && $sender->getCausesValidation() && ($page = $this->getPage()) !== null && !$page->getIsValid()) |
|
1351 | + if (($sender instanceof \Prado\Web\UI\IButtonControl) && $sender->getCausesValidation() && ($page = $this->getPage()) !== null && !$page->getIsValid()) |
|
1352 | 1352 | $navParam->setCancelNavigation(true); |
1353 | 1353 | |
1354 | 1354 | $handled = false; |
1355 | 1355 | $movePrev = false; |
1356 | 1356 | $this->_activeStepIndexSet = false; |
1357 | 1357 | |
1358 | - if(strcasecmp($command, self::CMD_NEXT) === 0) |
|
1358 | + if (strcasecmp($command, self::CMD_NEXT) === 0) |
|
1359 | 1359 | { |
1360 | - if($type !== TWizardStepType::Start && $type !== TWizardStepType::Step) |
|
1360 | + if ($type !== TWizardStepType::Start && $type !== TWizardStepType::Step) |
|
1361 | 1361 | throw new TInvalidDataValueException('wizard_command_invalid', self::CMD_NEXT); |
1362 | - if($index < $this->getWizardSteps()->getCount() - 1) |
|
1362 | + if ($index < $this->getWizardSteps()->getCount() - 1) |
|
1363 | 1363 | $navParam->setNextStepIndex($index + 1); |
1364 | 1364 | $this->onNextButtonClick($navParam); |
1365 | 1365 | $handled = true; |
1366 | 1366 | } |
1367 | - elseif(strcasecmp($command, self::CMD_PREVIOUS) === 0) |
|
1367 | + elseif (strcasecmp($command, self::CMD_PREVIOUS) === 0) |
|
1368 | 1368 | { |
1369 | - if($type !== TWizardStepType::Finish && $type !== TWizardStepType::Step) |
|
1369 | + if ($type !== TWizardStepType::Finish && $type !== TWizardStepType::Step) |
|
1370 | 1370 | throw new TInvalidDataValueException('wizard_command_invalid', self::CMD_PREVIOUS); |
1371 | 1371 | $movePrev = true; |
1372 | - if(($prevIndex = $this->getPreviousStepIndex(false)) >= 0) |
|
1372 | + if (($prevIndex = $this->getPreviousStepIndex(false)) >= 0) |
|
1373 | 1373 | $navParam->setNextStepIndex($prevIndex); |
1374 | 1374 | $this->onPreviousButtonClick($navParam); |
1375 | 1375 | $handled = true; |
1376 | 1376 | } |
1377 | - elseif(strcasecmp($command, self::CMD_COMPLETE) === 0) |
|
1377 | + elseif (strcasecmp($command, self::CMD_COMPLETE) === 0) |
|
1378 | 1378 | { |
1379 | - if($type !== TWizardStepType::Finish) |
|
1379 | + if ($type !== TWizardStepType::Finish) |
|
1380 | 1380 | throw new TInvalidDataValueException('wizard_command_invalid', self::CMD_COMPLETE); |
1381 | - if($index < $this->getWizardSteps()->getCount() - 1) |
|
1381 | + if ($index < $this->getWizardSteps()->getCount() - 1) |
|
1382 | 1382 | $navParam->setNextStepIndex($index + 1); |
1383 | 1383 | $this->onCompleteButtonClick($navParam); |
1384 | 1384 | $handled = true; |
1385 | 1385 | } |
1386 | - elseif(strcasecmp($command, self::CMD_MOVETO) === 0) |
|
1386 | + elseif (strcasecmp($command, self::CMD_MOVETO) === 0) |
|
1387 | 1387 | { |
1388 | - if($this->_cancelNavigation) // may be set in onSideBarButtonClick |
|
1388 | + if ($this->_cancelNavigation) // may be set in onSideBarButtonClick |
|
1389 | 1389 | $navParam->setCancelNavigation(true); |
1390 | 1390 | $requestedStep = $param->getCommandParameter(); |
1391 | 1391 | if (!is_numeric($requestedStep)) |
@@ -1406,15 +1406,15 @@ discard block |
||
1406 | 1406 | $handled = true; |
1407 | 1407 | } |
1408 | 1408 | |
1409 | - if($handled) |
|
1409 | + if ($handled) |
|
1410 | 1410 | { |
1411 | - if(!$navParam->getCancelNavigation()) |
|
1411 | + if (!$navParam->getCancelNavigation()) |
|
1412 | 1412 | { |
1413 | 1413 | $nextStepIndex = $navParam->getNextStepIndex(); |
1414 | - if(!$this->_activeStepIndexSet && $this->allowNavigationToStep($nextStepIndex)) |
|
1414 | + if (!$this->_activeStepIndexSet && $this->allowNavigationToStep($nextStepIndex)) |
|
1415 | 1415 | { |
1416 | - if($movePrev) |
|
1417 | - $this->getPreviousStepIndex(true); // pop out the previous move from history |
|
1416 | + if ($movePrev) |
|
1417 | + $this->getPreviousStepIndex(true); // pop out the previous move from history |
|
1418 | 1418 | $this->setActiveStepIndex($nextStepIndex); |
1419 | 1419 | } |
1420 | 1420 | } |
@@ -183,8 +183,9 @@ discard block |
||
183 | 183 | */ |
184 | 184 | public function addParsedObject($object) |
185 | 185 | { |
186 | - if($object instanceof TWizardStep) |
|
187 | - $this->getWizardSteps()->add($object); |
|
186 | + if($object instanceof TWizardStep) { |
|
187 | + $this->getWizardSteps()->add($object); |
|
188 | + } |
|
188 | 189 | } |
189 | 190 | |
190 | 191 | /** |
@@ -201,8 +202,9 @@ discard block |
||
201 | 202 | */ |
202 | 203 | public function setActiveStep($step) |
203 | 204 | { |
204 | - if(($index = $this->getWizardSteps()->indexOf($step)) < 0) |
|
205 | - throw new TInvalidOperationException('wizard_step_invalid'); |
|
205 | + if(($index = $this->getWizardSteps()->indexOf($step)) < 0) { |
|
206 | + throw new TInvalidOperationException('wizard_step_invalid'); |
|
207 | + } |
|
206 | 208 | $this->setActiveStepIndex($index); |
207 | 209 | } |
208 | 210 | |
@@ -238,8 +240,9 @@ discard block |
||
238 | 240 | */ |
239 | 241 | public function getWizardSteps() |
240 | 242 | { |
241 | - if($this->_wizardSteps === null) |
|
242 | - $this->_wizardSteps = new TWizardStepCollection($this); |
|
243 | + if($this->_wizardSteps === null) { |
|
244 | + $this->_wizardSteps = new TWizardStepCollection($this); |
|
245 | + } |
|
243 | 246 | return $this->_wizardSteps; |
244 | 247 | } |
245 | 248 | |
@@ -659,8 +662,9 @@ discard block |
||
659 | 662 | public function onCancelButtonClick($param) |
660 | 663 | { |
661 | 664 | $this->raiseEvent('OnCancelButtonClick', $this, $param); |
662 | - if(($url = $this->getCancelDestinationUrl()) !== '') |
|
663 | - $this->getResponse()->redirect($url); |
|
665 | + if(($url = $this->getCancelDestinationUrl()) !== '') { |
|
666 | + $this->getResponse()->redirect($url); |
|
667 | + } |
|
664 | 668 | } |
665 | 669 | |
666 | 670 | /** |
@@ -672,8 +676,9 @@ discard block |
||
672 | 676 | public function onCompleteButtonClick($param) |
673 | 677 | { |
674 | 678 | $this->raiseEvent('OnCompleteButtonClick', $this, $param); |
675 | - if(($url = $this->getFinishDestinationUrl()) !== '') |
|
676 | - $this->getResponse()->redirect($url); |
|
679 | + if(($url = $this->getFinishDestinationUrl()) !== '') { |
|
680 | + $this->getResponse()->redirect($url); |
|
681 | + } |
|
677 | 682 | } |
678 | 683 | |
679 | 684 | /** |
@@ -733,8 +738,9 @@ discard block |
||
733 | 738 | */ |
734 | 739 | public function addedWizardStep($step) |
735 | 740 | { |
736 | - if(($wizard = $step->getWizard()) !== null) |
|
737 | - $wizard->getWizardSteps()->remove($step); |
|
741 | + if(($wizard = $step->getWizard()) !== null) { |
|
742 | + $wizard->getWizardSteps()->remove($step); |
|
743 | + } |
|
738 | 744 | $step->setWizard($this); |
739 | 745 | $this->wizardStepsChanged(); |
740 | 746 | } |
@@ -761,8 +767,9 @@ discard block |
||
761 | 767 | parent::onInit($param); |
762 | 768 | $this->ensureChildControls(); |
763 | 769 | $this->setEnsureId(true); |
764 | - if($this->getActiveStepIndex() < 0 && $this->getWizardSteps()->getCount() > 0) |
|
765 | - $this->setActiveStepIndex(0); |
|
770 | + if($this->getActiveStepIndex() < 0 && $this->getWizardSteps()->getCount() > 0) { |
|
771 | + $this->setActiveStepIndex(0); |
|
772 | + } |
|
766 | 773 | } |
767 | 774 | |
768 | 775 | /** |
@@ -773,8 +780,9 @@ discard block |
||
773 | 780 | { |
774 | 781 | $index = $this->getActiveStepIndex(); |
775 | 782 | $history = $this->getHistory(); |
776 | - if(!$history->getCount() || $history->peek() !== $index) |
|
777 | - $history->push($index); |
|
783 | + if(!$history->getCount() || $history->peek() !== $index) { |
|
784 | + $history->push($index); |
|
785 | + } |
|
778 | 786 | } |
779 | 787 | |
780 | 788 | /** |
@@ -782,8 +790,9 @@ discard block |
||
782 | 790 | */ |
783 | 791 | protected function requiresControlsRecreation() |
784 | 792 | { |
785 | - if($this->getChildControlsCreated()) |
|
786 | - $this->setChildControlsCreated(false); |
|
793 | + if($this->getChildControlsCreated()) { |
|
794 | + $this->setChildControlsCreated(false); |
|
795 | + } |
|
787 | 796 | } |
788 | 797 | |
789 | 798 | /** |
@@ -807,8 +816,7 @@ discard block |
||
807 | 816 | $this->_navigation->renderControl($writer); |
808 | 817 | $writer->write("\n</td></tr></table>\n"); |
809 | 818 | $this->renderEndTag($writer); |
810 | - } |
|
811 | - else |
|
819 | + } else |
|
812 | 820 | { |
813 | 821 | $this->applyControlProperties(); |
814 | 822 | $this->renderBeginTag($writer); |
@@ -837,8 +845,9 @@ discard block |
||
837 | 845 | */ |
838 | 846 | protected function applyHeaderProperties() |
839 | 847 | { |
840 | - if(($style = $this->getViewState('HeaderStyle', null)) !== null) |
|
841 | - $this->_header->getStyle()->mergeWith($style); |
|
848 | + if(($style = $this->getViewState('HeaderStyle', null)) !== null) { |
|
849 | + $this->_header->getStyle()->mergeWith($style); |
|
850 | + } |
|
842 | 851 | if($this->getHeaderTemplate() === null) |
843 | 852 | { |
844 | 853 | $this->_header->getControls()->clear(); |
@@ -861,13 +870,15 @@ discard block |
||
861 | 870 | { |
862 | 871 | foreach($this->_sideBarDataList->getItems() as $item) |
863 | 872 | { |
864 | - if(($button = $item->findControl('SideBarButton')) !== null) |
|
865 | - $button->getStyle()->mergeWith($style); |
|
873 | + if(($button = $item->findControl('SideBarButton')) !== null) { |
|
874 | + $button->getStyle()->mergeWith($style); |
|
875 | + } |
|
866 | 876 | } |
867 | 877 | } |
868 | 878 | } |
869 | - if(($style = $this->getViewState('SideBarStyle', null)) !== null) |
|
870 | - $this->_sideBar->getStyle()->mergeWith($style); |
|
879 | + if(($style = $this->getViewState('SideBarStyle', null)) !== null) { |
|
880 | + $this->_sideBar->getStyle()->mergeWith($style); |
|
881 | + } |
|
871 | 882 | } |
872 | 883 | |
873 | 884 | /** |
@@ -875,8 +886,9 @@ discard block |
||
875 | 886 | */ |
876 | 887 | protected function applyStepContentProperties() |
877 | 888 | { |
878 | - if(($style = $this->getViewState('StepStyle', null)) !== null) |
|
879 | - $this->_stepContent->getStyle()->mergeWith($style); |
|
889 | + if(($style = $this->getViewState('StepStyle', null)) !== null) { |
|
890 | + $this->_stepContent->getStyle()->mergeWith($style); |
|
891 | + } |
|
880 | 892 | } |
881 | 893 | |
882 | 894 | /** |
@@ -888,9 +900,9 @@ discard block |
||
888 | 900 | $activeStep = $this->getActiveStep(); |
889 | 901 | $activeStepIndex = $this->getActiveStepIndex(); |
890 | 902 | |
891 | - if(!$this->_navigation) |
|
892 | - return; |
|
893 | - elseif($activeStepIndex < 0 || $activeStepIndex >= $wizardSteps->getCount()) |
|
903 | + if(!$this->_navigation) { |
|
904 | + return; |
|
905 | + } elseif($activeStepIndex < 0 || $activeStepIndex >= $wizardSteps->getCount()) |
|
894 | 906 | { |
895 | 907 | $this->_navigation->setVisible(false); |
896 | 908 | return; |
@@ -906,9 +918,9 @@ discard block |
||
906 | 918 | { |
907 | 919 | $container->setVisible(true); |
908 | 920 | $showStandard = false; |
921 | + } else { |
|
922 | + $container->setVisible(false); |
|
909 | 923 | } |
910 | - else |
|
911 | - $container->setVisible(false); |
|
912 | 924 | } |
913 | 925 | } |
914 | 926 | $activeStepType = $this->getStepType($activeStep); |
@@ -921,14 +933,16 @@ discard block |
||
921 | 933 | $this->_stepNavigation->setVisible($showStandard && $activeStepType === TWizardStepType::Step); |
922 | 934 | $this->_finishNavigation->setVisible($showStandard && $activeStepType === TWizardStepType::Finish); |
923 | 935 | |
924 | - if(($navigationStyle = $this->getViewState('NavigationStyle', null)) !== null) |
|
925 | - $this->_navigation->getStyle()->mergeWith($navigationStyle); |
|
936 | + if(($navigationStyle = $this->getViewState('NavigationStyle', null)) !== null) { |
|
937 | + $this->_navigation->getStyle()->mergeWith($navigationStyle); |
|
938 | + } |
|
926 | 939 | |
927 | 940 | $displayCancelButton = $this->getShowCancelButton(); |
928 | 941 | $cancelButtonStyle = $this->getCancelButtonStyle(); |
929 | 942 | $buttonStyle = $this->getViewState('NavigationButtonStyle', null); |
930 | - if($buttonStyle !== null) |
|
931 | - $cancelButtonStyle->mergeWith($buttonStyle); |
|
943 | + if($buttonStyle !== null) { |
|
944 | + $cancelButtonStyle->mergeWith($buttonStyle); |
|
945 | + } |
|
932 | 946 | |
933 | 947 | // apply styles to start navigation buttons |
934 | 948 | if(($cancelButton = $this->_startNavigation->getCancelButton()) !== null) |
@@ -940,11 +954,13 @@ discard block |
||
940 | 954 | { |
941 | 955 | $button->setVisible(true); |
942 | 956 | $style = $this->getStartNextButtonStyle(); |
943 | - if($buttonStyle !== null) |
|
944 | - $style->mergeWith($buttonStyle); |
|
957 | + if($buttonStyle !== null) { |
|
958 | + $style->mergeWith($buttonStyle); |
|
959 | + } |
|
945 | 960 | $style->apply($button); |
946 | - if($activeStepType === TWizardStepType::Start) |
|
947 | - $this->getPage()->getClientScript()->registerDefaultButton($this, $button); |
|
961 | + if($activeStepType === TWizardStepType::Start) { |
|
962 | + $this->getPage()->getClientScript()->registerDefaultButton($this, $button); |
|
963 | + } |
|
948 | 964 | } |
949 | 965 | |
950 | 966 | // apply styles to finish navigation buttons |
@@ -957,19 +973,22 @@ discard block |
||
957 | 973 | { |
958 | 974 | $button->setVisible($this->allowNavigationToPreviousStep()); |
959 | 975 | $style = $this->getFinishPreviousButtonStyle(); |
960 | - if($buttonStyle !== null) |
|
961 | - $style->mergeWith($buttonStyle); |
|
976 | + if($buttonStyle !== null) { |
|
977 | + $style->mergeWith($buttonStyle); |
|
978 | + } |
|
962 | 979 | $style->apply($button); |
963 | 980 | } |
964 | 981 | if(($button = $this->_finishNavigation->getCompleteButton()) !== null) |
965 | 982 | { |
966 | 983 | $button->setVisible(true); |
967 | 984 | $style = $this->getFinishCompleteButtonStyle(); |
968 | - if($buttonStyle !== null) |
|
969 | - $style->mergeWith($buttonStyle); |
|
985 | + if($buttonStyle !== null) { |
|
986 | + $style->mergeWith($buttonStyle); |
|
987 | + } |
|
970 | 988 | $style->apply($button); |
971 | - if($activeStepType === TWizardStepType::Finish) |
|
972 | - $this->getPage()->getClientScript()->registerDefaultButton($this, $button); |
|
989 | + if($activeStepType === TWizardStepType::Finish) { |
|
990 | + $this->getPage()->getClientScript()->registerDefaultButton($this, $button); |
|
991 | + } |
|
973 | 992 | } |
974 | 993 | |
975 | 994 | // apply styles to step navigation buttons |
@@ -982,19 +1001,22 @@ discard block |
||
982 | 1001 | { |
983 | 1002 | $button->setVisible($this->allowNavigationToPreviousStep()); |
984 | 1003 | $style = $this->getStepPreviousButtonStyle(); |
985 | - if($buttonStyle !== null) |
|
986 | - $style->mergeWith($buttonStyle); |
|
1004 | + if($buttonStyle !== null) { |
|
1005 | + $style->mergeWith($buttonStyle); |
|
1006 | + } |
|
987 | 1007 | $style->apply($button); |
988 | 1008 | } |
989 | 1009 | if(($button = $this->_stepNavigation->getNextButton()) !== null) |
990 | 1010 | { |
991 | 1011 | $button->setVisible(true); |
992 | 1012 | $style = $this->getStepNextButtonStyle(); |
993 | - if($buttonStyle !== null) |
|
994 | - $style->mergeWith($buttonStyle); |
|
1013 | + if($buttonStyle !== null) { |
|
1014 | + $style->mergeWith($buttonStyle); |
|
1015 | + } |
|
995 | 1016 | $style->apply($button); |
996 | - if($activeStepType === TWizardStepType::Step) |
|
997 | - $this->getPage()->getClientScript()->registerDefaultButton($this, $button); |
|
1017 | + if($activeStepType === TWizardStepType::Step) { |
|
1018 | + $this->getPage()->getClientScript()->registerDefaultButton($this, $button); |
|
1019 | + } |
|
998 | 1020 | } |
999 | 1021 | } |
1000 | 1022 | |
@@ -1024,20 +1046,21 @@ discard block |
||
1024 | 1046 | if(($index = $steps->indexOf($wizardStep)) >= 0) |
1025 | 1047 | { |
1026 | 1048 | $stepCount = $steps->getCount(); |
1027 | - if($stepCount === 1 || ($index < $stepCount - 1 && $steps->itemAt($index + 1)->getStepType() === TWizardStepType::Complete)) |
|
1028 | - return TWizardStepType::Finish; |
|
1029 | - elseif($index === 0) |
|
1030 | - return TWizardStepType::Start; |
|
1031 | - elseif($index === $stepCount - 1) |
|
1032 | - return TWizardStepType::Finish; |
|
1033 | - else |
|
1034 | - return TWizardStepType::Step; |
|
1049 | + if($stepCount === 1 || ($index < $stepCount - 1 && $steps->itemAt($index + 1)->getStepType() === TWizardStepType::Complete)) { |
|
1050 | + return TWizardStepType::Finish; |
|
1051 | + } elseif($index === 0) { |
|
1052 | + return TWizardStepType::Start; |
|
1053 | + } elseif($index === $stepCount - 1) { |
|
1054 | + return TWizardStepType::Finish; |
|
1055 | + } else { |
|
1056 | + return TWizardStepType::Step; |
|
1057 | + } |
|
1058 | + } else { |
|
1059 | + return $type; |
|
1035 | 1060 | } |
1036 | - else |
|
1037 | - return $type; |
|
1061 | + } else { |
|
1062 | + return $type; |
|
1038 | 1063 | } |
1039 | - else |
|
1040 | - return $type; |
|
1041 | 1064 | } |
1042 | 1065 | |
1043 | 1066 | /** |
@@ -1075,10 +1098,11 @@ discard block |
||
1075 | 1098 | protected function createHeader() |
1076 | 1099 | { |
1077 | 1100 | $this->_header = new TPanel; |
1078 | - if(($template = $this->getHeaderTemplate()) !== null) |
|
1079 | - $template->instantiateIn($this->_header); |
|
1080 | - else |
|
1081 | - $this->_header->getControls()->add($this->getHeaderText()); |
|
1101 | + if(($template = $this->getHeaderTemplate()) !== null) { |
|
1102 | + $template->instantiateIn($this->_header); |
|
1103 | + } else { |
|
1104 | + $this->_header->getControls()->add($this->getHeaderText()); |
|
1105 | + } |
|
1082 | 1106 | $this->getControls()->add($this->_header); |
1083 | 1107 | } |
1084 | 1108 | |
@@ -1089,8 +1113,9 @@ discard block |
||
1089 | 1113 | { |
1090 | 1114 | if($this->getShowSideBar()) |
1091 | 1115 | { |
1092 | - if(($template = $this->getSideBarTemplate()) === null) |
|
1093 | - $template = new TWizardSideBarTemplate; |
|
1116 | + if(($template = $this->getSideBarTemplate()) === null) { |
|
1117 | + $template = new TWizardSideBarTemplate; |
|
1118 | + } |
|
1094 | 1119 | $this->_sideBar = new TPanel; |
1095 | 1120 | $template->instantiateIn($this->_sideBar); |
1096 | 1121 | $this->getControls()->add($this->_sideBar); |
@@ -1103,8 +1128,7 @@ discard block |
||
1103 | 1128 | $this->_sideBarDataList->setSelectedItemIndex($this->getActiveStepIndex()); |
1104 | 1129 | $this->_sideBarDataList->dataBind(); |
1105 | 1130 | } |
1106 | - } |
|
1107 | - else |
|
1131 | + } else |
|
1108 | 1132 | { |
1109 | 1133 | $this->_sideBar = new TPanel; |
1110 | 1134 | $this->getControls()->add($this->_sideBar); |
@@ -1131,19 +1155,21 @@ discard block |
||
1131 | 1155 | // if the button clicked causes validation which fails, |
1132 | 1156 | // by default we will cancel navigation to the new step |
1133 | 1157 | $button = $param->getCommandSource(); |
1134 | - if(($button instanceof \Prado\Web\UI\IButtonControl) && $button->getCausesValidation() && ($page = $this->getPage()) !== null && !$page->getIsValid()) |
|
1135 | - $navParam->setCancelNavigation(true); |
|
1158 | + if(($button instanceof \Prado\Web\UI\IButtonControl) && $button->getCausesValidation() && ($page = $this->getPage()) !== null && !$page->getIsValid()) { |
|
1159 | + $navParam->setCancelNavigation(true); |
|
1160 | + } |
|
1136 | 1161 | |
1137 | 1162 | $this->_activeStepIndexSet = false; |
1138 | 1163 | $this->onSideBarButtonClick($navParam); |
1139 | 1164 | $this->_cancelNavigation = $navParam->getCancelNavigation(); |
1140 | 1165 | if(!$this->_cancelNavigation) |
1141 | 1166 | { |
1142 | - if(!$this->_activeStepIndexSet && $this->allowNavigationToStep($newStepIndex)) |
|
1143 | - $this->setActiveStepIndex($newStepIndex); |
|
1167 | + if(!$this->_activeStepIndexSet && $this->allowNavigationToStep($newStepIndex)) { |
|
1168 | + $this->setActiveStepIndex($newStepIndex); |
|
1169 | + } |
|
1170 | + } else { |
|
1171 | + $this->setActiveStepIndex($stepIndex); |
|
1144 | 1172 | } |
1145 | - else |
|
1146 | - $this->setActiveStepIndex($stepIndex); |
|
1147 | 1173 | } |
1148 | 1174 | } |
1149 | 1175 | |
@@ -1163,12 +1189,14 @@ discard block |
||
1163 | 1189 | if(($button = $item->findControl(self::ID_SIDEBAR_BUTTON)) !== null) |
1164 | 1190 | { |
1165 | 1191 | $step = $item->getData(); |
1166 | - if(($this->getStepType($step) === TWizardStepType::Complete)) |
|
1167 | - $button->setEnabled(false); |
|
1168 | - if(($title = $step->getTitle()) !== '') |
|
1169 | - $button->setText($title); |
|
1170 | - else |
|
1171 | - $button->setText($step->getID(false)); |
|
1192 | + if(($this->getStepType($step) === TWizardStepType::Complete)) { |
|
1193 | + $button->setEnabled(false); |
|
1194 | + } |
|
1195 | + if(($title = $step->getTitle()) !== '') { |
|
1196 | + $button->setText($title); |
|
1197 | + } else { |
|
1198 | + $button->setText($step->getID(false)); |
|
1199 | + } |
|
1172 | 1200 | $index = $this->getWizardSteps()->indexOf($step); |
1173 | 1201 | $button->setCommandName(self::CMD_MOVETO); |
1174 | 1202 | $button->setCommandParameter("$index"); |
@@ -1183,15 +1211,17 @@ discard block |
||
1183 | 1211 | { |
1184 | 1212 | foreach($this->getWizardSteps() as $step) |
1185 | 1213 | { |
1186 | - if($step instanceof TTemplatedWizardStep) |
|
1187 | - $step->ensureChildControls(); |
|
1214 | + if($step instanceof TTemplatedWizardStep) { |
|
1215 | + $step->ensureChildControls(); |
|
1216 | + } |
|
1188 | 1217 | } |
1189 | 1218 | $multiView = $this->getMultiView(); |
1190 | 1219 | $this->_stepContent = new TPanel; |
1191 | 1220 | $this->_stepContent->getControls()->add($multiView); |
1192 | 1221 | $this->getControls()->add($this->_stepContent); |
1193 | - if($multiView->getViews()->getCount()) |
|
1194 | - $multiView->setActiveViewIndex(0); |
|
1222 | + if($multiView->getViews()->getCount()) { |
|
1223 | + $multiView->setActiveViewIndex(0); |
|
1224 | + } |
|
1195 | 1225 | } |
1196 | 1226 | |
1197 | 1227 | /** |
@@ -1207,8 +1237,9 @@ discard block |
||
1207 | 1237 | if($step instanceof TTemplatedWizardStep) |
1208 | 1238 | { |
1209 | 1239 | $step->instantiateNavigationTemplate(); |
1210 | - if(($panel = $step->getNavigationContainer()) !== null) |
|
1211 | - $controls->add($panel); |
|
1240 | + if(($panel = $step->getNavigationContainer()) !== null) { |
|
1241 | + $controls->add($panel); |
|
1242 | + } |
|
1212 | 1243 | } |
1213 | 1244 | } |
1214 | 1245 | $this->_startNavigation = $this->createStartNavigation(); |
@@ -1224,8 +1255,9 @@ discard block |
||
1224 | 1255 | */ |
1225 | 1256 | protected function createStartNavigation() |
1226 | 1257 | { |
1227 | - if(($template = $this->getStartNavigationTemplate()) === null) |
|
1228 | - $template = new TWizardStartNavigationTemplate($this); |
|
1258 | + if(($template = $this->getStartNavigationTemplate()) === null) { |
|
1259 | + $template = new TWizardStartNavigationTemplate($this); |
|
1260 | + } |
|
1229 | 1261 | $navigation = new TWizardNavigationContainer; |
1230 | 1262 | $template->instantiateIn($navigation); |
1231 | 1263 | return $navigation; |
@@ -1236,8 +1268,9 @@ discard block |
||
1236 | 1268 | */ |
1237 | 1269 | protected function createStepNavigation() |
1238 | 1270 | { |
1239 | - if(($template = $this->getStepNavigationTemplate()) === null) |
|
1240 | - $template = new TWizardStepNavigationTemplate($this); |
|
1271 | + if(($template = $this->getStepNavigationTemplate()) === null) { |
|
1272 | + $template = new TWizardStepNavigationTemplate($this); |
|
1273 | + } |
|
1241 | 1274 | $navigation = new TWizardNavigationContainer; |
1242 | 1275 | $template->instantiateIn($navigation); |
1243 | 1276 | return $navigation; |
@@ -1248,8 +1281,9 @@ discard block |
||
1248 | 1281 | */ |
1249 | 1282 | protected function createFinishNavigation() |
1250 | 1283 | { |
1251 | - if(($template = $this->getFinishNavigationTemplate()) === null) |
|
1252 | - $template = new TWizardFinishNavigationTemplate($this); |
|
1284 | + if(($template = $this->getFinishNavigationTemplate()) === null) { |
|
1285 | + $template = new TWizardFinishNavigationTemplate($this); |
|
1286 | + } |
|
1253 | 1287 | $navigation = new TWizardNavigationContainer; |
1254 | 1288 | $template->instantiateIn($navigation); |
1255 | 1289 | return $navigation; |
@@ -1284,10 +1318,10 @@ discard block |
||
1284 | 1318 | if($popStack) |
1285 | 1319 | { |
1286 | 1320 | $previousStepIndex = $history->pop(); |
1287 | - if($activeStepIndex === $previousStepIndex && $history->getCount() > 0) |
|
1288 | - $previousStepIndex = $history->pop(); |
|
1289 | - } |
|
1290 | - else |
|
1321 | + if($activeStepIndex === $previousStepIndex && $history->getCount() > 0) { |
|
1322 | + $previousStepIndex = $history->pop(); |
|
1323 | + } |
|
1324 | + } else |
|
1291 | 1325 | { |
1292 | 1326 | $previousStepIndex = $history->peek(); |
1293 | 1327 | if($activeStepIndex === $previousStepIndex && $history->getCount() > 1) |
@@ -1298,9 +1332,9 @@ discard block |
||
1298 | 1332 | } |
1299 | 1333 | } |
1300 | 1334 | return $activeStepIndex === $previousStepIndex ? -1 : $previousStepIndex; |
1335 | + } else { |
|
1336 | + return -1; |
|
1301 | 1337 | } |
1302 | - else |
|
1303 | - return -1; |
|
1304 | 1338 | } |
1305 | 1339 | |
1306 | 1340 | /** |
@@ -1308,10 +1342,11 @@ discard block |
||
1308 | 1342 | */ |
1309 | 1343 | protected function allowNavigationToPreviousStep() |
1310 | 1344 | { |
1311 | - if(($index = $this->getPreviousStepIndex(false)) !== -1) |
|
1312 | - return $this->getWizardSteps()->itemAt($index)->getAllowReturn(); |
|
1313 | - else |
|
1314 | - return false; |
|
1345 | + if(($index = $this->getPreviousStepIndex(false)) !== -1) { |
|
1346 | + return $this->getWizardSteps()->itemAt($index)->getAllowReturn(); |
|
1347 | + } else { |
|
1348 | + return false; |
|
1349 | + } |
|
1315 | 1350 | } |
1316 | 1351 | |
1317 | 1352 | /** |
@@ -1320,10 +1355,11 @@ discard block |
||
1320 | 1355 | */ |
1321 | 1356 | protected function allowNavigationToStep($index) |
1322 | 1357 | { |
1323 | - if($this->getHistory()->contains($index)) |
|
1324 | - return $this->getWizardSteps()->itemAt($index)->getAllowReturn(); |
|
1325 | - else |
|
1326 | - return true; |
|
1358 | + if($this->getHistory()->contains($index)) { |
|
1359 | + return $this->getWizardSteps()->itemAt($index)->getAllowReturn(); |
|
1360 | + } else { |
|
1361 | + return true; |
|
1362 | + } |
|
1327 | 1363 | } |
1328 | 1364 | |
1329 | 1365 | /** |
@@ -1348,8 +1384,9 @@ discard block |
||
1348 | 1384 | $type = $this->getStepType($this->getActiveStep()); |
1349 | 1385 | $index = $this->getActiveStepIndex(); |
1350 | 1386 | $navParam = new TWizardNavigationEventParameter($index); |
1351 | - if(($sender instanceof \Prado\Web\UI\IButtonControl) && $sender->getCausesValidation() && ($page = $this->getPage()) !== null && !$page->getIsValid()) |
|
1352 | - $navParam->setCancelNavigation(true); |
|
1387 | + if(($sender instanceof \Prado\Web\UI\IButtonControl) && $sender->getCausesValidation() && ($page = $this->getPage()) !== null && !$page->getIsValid()) { |
|
1388 | + $navParam->setCancelNavigation(true); |
|
1389 | + } |
|
1353 | 1390 | |
1354 | 1391 | $handled = false; |
1355 | 1392 | $movePrev = false; |
@@ -1357,51 +1394,58 @@ discard block |
||
1357 | 1394 | |
1358 | 1395 | if(strcasecmp($command, self::CMD_NEXT) === 0) |
1359 | 1396 | { |
1360 | - if($type !== TWizardStepType::Start && $type !== TWizardStepType::Step) |
|
1361 | - throw new TInvalidDataValueException('wizard_command_invalid', self::CMD_NEXT); |
|
1362 | - if($index < $this->getWizardSteps()->getCount() - 1) |
|
1363 | - $navParam->setNextStepIndex($index + 1); |
|
1397 | + if($type !== TWizardStepType::Start && $type !== TWizardStepType::Step) { |
|
1398 | + throw new TInvalidDataValueException('wizard_command_invalid', self::CMD_NEXT); |
|
1399 | + } |
|
1400 | + if($index < $this->getWizardSteps()->getCount() - 1) { |
|
1401 | + $navParam->setNextStepIndex($index + 1); |
|
1402 | + } |
|
1364 | 1403 | $this->onNextButtonClick($navParam); |
1365 | 1404 | $handled = true; |
1366 | - } |
|
1367 | - elseif(strcasecmp($command, self::CMD_PREVIOUS) === 0) |
|
1405 | + } elseif(strcasecmp($command, self::CMD_PREVIOUS) === 0) |
|
1368 | 1406 | { |
1369 | - if($type !== TWizardStepType::Finish && $type !== TWizardStepType::Step) |
|
1370 | - throw new TInvalidDataValueException('wizard_command_invalid', self::CMD_PREVIOUS); |
|
1407 | + if($type !== TWizardStepType::Finish && $type !== TWizardStepType::Step) { |
|
1408 | + throw new TInvalidDataValueException('wizard_command_invalid', self::CMD_PREVIOUS); |
|
1409 | + } |
|
1371 | 1410 | $movePrev = true; |
1372 | - if(($prevIndex = $this->getPreviousStepIndex(false)) >= 0) |
|
1373 | - $navParam->setNextStepIndex($prevIndex); |
|
1411 | + if(($prevIndex = $this->getPreviousStepIndex(false)) >= 0) { |
|
1412 | + $navParam->setNextStepIndex($prevIndex); |
|
1413 | + } |
|
1374 | 1414 | $this->onPreviousButtonClick($navParam); |
1375 | 1415 | $handled = true; |
1376 | - } |
|
1377 | - elseif(strcasecmp($command, self::CMD_COMPLETE) === 0) |
|
1416 | + } elseif(strcasecmp($command, self::CMD_COMPLETE) === 0) |
|
1378 | 1417 | { |
1379 | - if($type !== TWizardStepType::Finish) |
|
1380 | - throw new TInvalidDataValueException('wizard_command_invalid', self::CMD_COMPLETE); |
|
1381 | - if($index < $this->getWizardSteps()->getCount() - 1) |
|
1382 | - $navParam->setNextStepIndex($index + 1); |
|
1418 | + if($type !== TWizardStepType::Finish) { |
|
1419 | + throw new TInvalidDataValueException('wizard_command_invalid', self::CMD_COMPLETE); |
|
1420 | + } |
|
1421 | + if($index < $this->getWizardSteps()->getCount() - 1) { |
|
1422 | + $navParam->setNextStepIndex($index + 1); |
|
1423 | + } |
|
1383 | 1424 | $this->onCompleteButtonClick($navParam); |
1384 | 1425 | $handled = true; |
1385 | - } |
|
1386 | - elseif(strcasecmp($command, self::CMD_MOVETO) === 0) |
|
1426 | + } elseif(strcasecmp($command, self::CMD_MOVETO) === 0) |
|
1387 | 1427 | { |
1388 | - if($this->_cancelNavigation) // may be set in onSideBarButtonClick |
|
1428 | + if($this->_cancelNavigation) { |
|
1429 | + // may be set in onSideBarButtonClick |
|
1389 | 1430 | $navParam->setCancelNavigation(true); |
1431 | + } |
|
1390 | 1432 | $requestedStep = $param->getCommandParameter(); |
1391 | 1433 | if (!is_numeric($requestedStep)) |
1392 | 1434 | { |
1393 | 1435 | $requestedIndex = -1; |
1394 | - foreach ($this->getWizardSteps() as $index => $step) |
|
1395 | - if ($step->getId() === $requestedStep) |
|
1436 | + foreach ($this->getWizardSteps() as $index => $step) { |
|
1437 | + if ($step->getId() === $requestedStep) |
|
1396 | 1438 | { |
1397 | 1439 | $requestedIndex = $index; |
1440 | + } |
|
1398 | 1441 | break; |
1399 | 1442 | } |
1400 | - if ($requestedIndex < 0) |
|
1401 | - throw new TConfigurationException('wizard_step_invalid'); |
|
1443 | + if ($requestedIndex < 0) { |
|
1444 | + throw new TConfigurationException('wizard_step_invalid'); |
|
1445 | + } |
|
1446 | + } else { |
|
1447 | + $requestedIndex = TPropertyValue::ensureInteger($requestedStep); |
|
1402 | 1448 | } |
1403 | - else |
|
1404 | - $requestedIndex = TPropertyValue::ensureInteger($requestedStep); |
|
1405 | 1449 | $navParam->setNextStepIndex($requestedIndex); |
1406 | 1450 | $handled = true; |
1407 | 1451 | } |
@@ -1413,13 +1457,15 @@ discard block |
||
1413 | 1457 | $nextStepIndex = $navParam->getNextStepIndex(); |
1414 | 1458 | if(!$this->_activeStepIndexSet && $this->allowNavigationToStep($nextStepIndex)) |
1415 | 1459 | { |
1416 | - if($movePrev) |
|
1417 | - $this->getPreviousStepIndex(true); // pop out the previous move from history |
|
1460 | + if($movePrev) { |
|
1461 | + $this->getPreviousStepIndex(true); |
|
1462 | + } |
|
1463 | + // pop out the previous move from history |
|
1418 | 1464 | $this->setActiveStepIndex($nextStepIndex); |
1419 | 1465 | } |
1466 | + } else { |
|
1467 | + $this->setActiveStepIndex($index); |
|
1420 | 1468 | } |
1421 | - else |
|
1422 | - $this->setActiveStepIndex($index); |
|
1423 | 1469 | return true; |
1424 | 1470 | } |
1425 | 1471 | } |