@@ -409,8 +409,9 @@ discard block |
||
409 | 409 | $element=$this->_prep_element($element); |
410 | 410 | $class=$this->_prep_value($class); |
411 | 411 | $str="$({$element}).addClass({$class});"; |
412 | - if ($immediatly) |
|
413 | - $this->jquery_code_for_compile[]=$str; |
|
412 | + if ($immediatly) { |
|
413 | + $this->jquery_code_for_compile[]=$str; |
|
414 | + } |
|
414 | 415 | return $str; |
415 | 416 | } |
416 | 417 | |
@@ -426,10 +427,12 @@ discard block |
||
426 | 427 | if (isset($value)) { |
427 | 428 | $value=$this->_prep_value($value); |
428 | 429 | $str="$({$element}).attr(\"$attributeName\",{$value});"; |
429 | - } else |
|
430 | - $str="$({$element}).attr(\"$attributeName\");"; |
|
431 | - if ($immediatly) |
|
432 | - $this->jquery_code_for_compile[]=$str; |
|
430 | + } else { |
|
431 | + $str="$({$element}).attr(\"$attributeName\");"; |
|
432 | + } |
|
433 | + if ($immediatly) { |
|
434 | + $this->jquery_code_for_compile[]=$str; |
|
435 | + } |
|
433 | 436 | return $str; |
434 | 437 | } |
435 | 438 | |
@@ -444,10 +447,12 @@ discard block |
||
444 | 447 | if (isset($value)) { |
445 | 448 | $value=$this->_prep_value($value); |
446 | 449 | $str="$({$element}).html({$value});"; |
447 | - } else |
|
448 | - $str="$({$element}).html();"; |
|
449 | - if ($immediatly) |
|
450 | - $this->jquery_code_for_compile[]=$str; |
|
450 | + } else { |
|
451 | + $str="$({$element}).html();"; |
|
452 | + } |
|
453 | + if ($immediatly) { |
|
454 | + $this->jquery_code_for_compile[]=$str; |
|
455 | + } |
|
451 | 456 | return $str; |
452 | 457 | } |
453 | 458 | |
@@ -485,8 +490,9 @@ discard block |
||
485 | 490 | |
486 | 491 | $str="$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.");"; |
487 | 492 | |
488 | - if ($immediatly) |
|
489 | - $this->jquery_code_for_compile[]=$str; |
|
493 | + if ($immediatly) { |
|
494 | + $this->jquery_code_for_compile[]=$str; |
|
495 | + } |
|
490 | 496 | return $str; |
491 | 497 | } |
492 | 498 | |
@@ -501,8 +507,9 @@ discard block |
||
501 | 507 | $to=$this->_prep_element($to); |
502 | 508 | $element=$this->_prep_element($element); |
503 | 509 | $str="$({$to}).append({$element});"; |
504 | - if ($immediatly) |
|
505 | - $this->jquery_code_for_compile[]=$str; |
|
510 | + if ($immediatly) { |
|
511 | + $this->jquery_code_for_compile[]=$str; |
|
512 | + } |
|
506 | 513 | return $str; |
507 | 514 | } |
508 | 515 | |
@@ -517,8 +524,9 @@ discard block |
||
517 | 524 | $to=$this->_prep_element($to); |
518 | 525 | $element=$this->_prep_element($element); |
519 | 526 | $str="$({$to}).prepend({$element});"; |
520 | - if ($immediatly) |
|
521 | - $this->jquery_code_for_compile[]=$str; |
|
527 | + if ($immediatly) { |
|
528 | + $this->jquery_code_for_compile[]=$str; |
|
529 | + } |
|
522 | 530 | return $str; |
523 | 531 | } |
524 | 532 | |
@@ -543,8 +551,9 @@ discard block |
||
543 | 551 | |
544 | 552 | $str="$({$element}).fadeIn({$speed}{$callback});"; |
545 | 553 | |
546 | - if ($immediatly) |
|
547 | - $this->jquery_code_for_compile[]=$str; |
|
554 | + if ($immediatly) { |
|
555 | + $this->jquery_code_for_compile[]=$str; |
|
556 | + } |
|
548 | 557 | return $str; |
549 | 558 | } |
550 | 559 | |
@@ -569,8 +578,9 @@ discard block |
||
569 | 578 | |
570 | 579 | $str="$({$element}).fadeOut({$speed}{$callback});"; |
571 | 580 | |
572 | - if ($immediatly) |
|
573 | - $this->jquery_code_for_compile[]=$str; |
|
581 | + if ($immediatly) { |
|
582 | + $this->jquery_code_for_compile[]=$str; |
|
583 | + } |
|
574 | 584 | return $str; |
575 | 585 | } |
576 | 586 | |
@@ -595,8 +605,9 @@ discard block |
||
595 | 605 | |
596 | 606 | $str="$({$element}).hide({$speed}{$callback});"; |
597 | 607 | |
598 | - if ($immediatly) |
|
599 | - $this->jquery_code_for_compile[]=$str; |
|
608 | + if ($immediatly) { |
|
609 | + $this->jquery_code_for_compile[]=$str; |
|
610 | + } |
|
600 | 611 | return $str; |
601 | 612 | } |
602 | 613 | |
@@ -614,8 +625,9 @@ discard block |
||
614 | 625 | $element=$this->_prep_element($element); |
615 | 626 | $str="$({$element}).removeClass(\"$class\");"; |
616 | 627 | |
617 | - if ($immediatly) |
|
618 | - $this->jquery_code_for_compile[]=$str; |
|
628 | + if ($immediatly) { |
|
629 | + $this->jquery_code_for_compile[]=$str; |
|
630 | + } |
|
619 | 631 | return $str; |
620 | 632 | } |
621 | 633 | |
@@ -640,8 +652,9 @@ discard block |
||
640 | 652 | |
641 | 653 | $str="$({$element}).slideUp({$speed}{$callback});"; |
642 | 654 | |
643 | - if ($immediatly) |
|
644 | - $this->jquery_code_for_compile[]=$str; |
|
655 | + if ($immediatly) { |
|
656 | + $this->jquery_code_for_compile[]=$str; |
|
657 | + } |
|
645 | 658 | return $str; |
646 | 659 | } |
647 | 660 | |
@@ -666,8 +679,9 @@ discard block |
||
666 | 679 | |
667 | 680 | $str="$({$element}).slideDown({$speed}{$callback});"; |
668 | 681 | |
669 | - if ($immediatly) |
|
670 | - $this->jquery_code_for_compile[]=$str; |
|
682 | + if ($immediatly) { |
|
683 | + $this->jquery_code_for_compile[]=$str; |
|
684 | + } |
|
671 | 685 | return $str; |
672 | 686 | } |
673 | 687 | |
@@ -692,8 +706,9 @@ discard block |
||
692 | 706 | |
693 | 707 | $str="$({$element}).slideToggle({$speed}{$callback});"; |
694 | 708 | |
695 | - if ($immediatly) |
|
696 | - $this->jquery_code_for_compile[]=$str; |
|
709 | + if ($immediatly) { |
|
710 | + $this->jquery_code_for_compile[]=$str; |
|
711 | + } |
|
697 | 712 | return $str; |
698 | 713 | } |
699 | 714 | |
@@ -710,8 +725,9 @@ discard block |
||
710 | 725 | $element=$this->_prep_element($element); |
711 | 726 | $str="$({$element}).toggle();"; |
712 | 727 | |
713 | - if ($immediatly) |
|
714 | - $this->jquery_code_for_compile[]=$str; |
|
728 | + if ($immediatly) { |
|
729 | + $this->jquery_code_for_compile[]=$str; |
|
730 | + } |
|
715 | 731 | return $str; |
716 | 732 | } |
717 | 733 | |
@@ -729,8 +745,9 @@ discard block |
||
729 | 745 | $element=$this->_prep_element($element); |
730 | 746 | $str="$({$element}).toggleClass(\"$class\");"; |
731 | 747 | |
732 | - if ($immediatly) |
|
733 | - $this->jquery_code_for_compile[]=$str; |
|
748 | + if ($immediatly) { |
|
749 | + $this->jquery_code_for_compile[]=$str; |
|
750 | + } |
|
734 | 751 | return $str; |
735 | 752 | } |
736 | 753 | |
@@ -744,8 +761,9 @@ discard block |
||
744 | 761 | $element=$this->_prep_element($element); |
745 | 762 | $str="$({$element}).trigger(\"$event\");"; |
746 | 763 | |
747 | - if ($immediatly) |
|
748 | - $this->jquery_code_for_compile[]=$str; |
|
764 | + if ($immediatly) { |
|
765 | + $this->jquery_code_for_compile[]=$str; |
|
766 | + } |
|
749 | 767 | return $str; |
750 | 768 | } |
751 | 769 | |
@@ -770,8 +788,9 @@ discard block |
||
770 | 788 | |
771 | 789 | $str="$({$element}).show({$speed}{$callback});"; |
772 | 790 | |
773 | - if ($immediatly) |
|
774 | - $this->jquery_code_for_compile[]=$str; |
|
791 | + if ($immediatly) { |
|
792 | + $this->jquery_code_for_compile[]=$str; |
|
793 | + } |
|
775 | 794 | return $str; |
776 | 795 | } |
777 | 796 | |
@@ -789,8 +808,9 @@ discard block |
||
789 | 808 | $str.="else{".$jsCodeIfFalse."}"; |
790 | 809 | } |
791 | 810 | |
792 | - if ($immediatly) |
|
793 | - $this->jquery_code_for_compile[]=$str; |
|
811 | + if ($immediatly) { |
|
812 | + $this->jquery_code_for_compile[]=$str; |
|
813 | + } |
|
794 | 814 | return $str; |
795 | 815 | } |
796 | 816 | |
@@ -856,10 +876,11 @@ discard block |
||
856 | 876 | if ($stopPropagation===true) { |
857 | 877 | $js="event.stopPropagation();\n".$js; |
858 | 878 | } |
859 | - if (array_search($event, $this->jquery_events)===false) |
|
860 | - $event="\n\t$(".$this->_prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
|
861 | - else |
|
862 | - $event="\n\t$(".$this->_prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
|
879 | + if (array_search($event, $this->jquery_events)===false) { |
|
880 | + $event="\n\t$(".$this->_prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
|
881 | + } else { |
|
882 | + $event="\n\t$(".$this->_prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
|
883 | + } |
|
863 | 884 | $this->jquery_code_for_compile[]=$event; |
864 | 885 | return $event; |
865 | 886 | } |
@@ -909,8 +930,9 @@ discard block |
||
909 | 930 | |
910 | 931 | $output=($script_tags===FALSE) ? $script : $this->inline($script); |
911 | 932 | |
912 | - if ($view!=NULL) |
|
913 | - $view->setVar($view_var, $output); |
|
933 | + if ($view!=NULL) { |
|
934 | + $view->setVar($view_var, $output); |
|
935 | + } |
|
914 | 936 | return $output; |
915 | 937 | } |
916 | 938 | |
@@ -1031,8 +1053,9 @@ discard block |
||
1031 | 1053 | } |
1032 | 1054 | $retour.="$.".$method."(url,".$params.").done(function( data ) {\n"; |
1033 | 1055 | $retour.=$this->_getOnAjaxDone($responseElement, $jsCallback)."});\n"; |
1034 | - if ($immediatly) |
|
1035 | - $this->jquery_code_for_compile[]=$retour; |
|
1056 | + if ($immediatly) { |
|
1057 | + $this->jquery_code_for_compile[]=$retour; |
|
1058 | + } |
|
1036 | 1059 | return $retour; |
1037 | 1060 | } |
1038 | 1061 | |
@@ -1040,10 +1063,11 @@ discard block |
||
1040 | 1063 | $url=$this->_correctAjaxUrl($url); |
1041 | 1064 | $retour="url='".$url."';\n"; |
1042 | 1065 | if(JString::isNotNull($attr)){ |
1043 | - if ($attr=="value") |
|
1044 | - $retour.="url=url+'/'+$(this).val();\n"; |
|
1045 | - else if($attr!=null && $attr!=="") |
|
1046 | - $retour.="url=url+'/'+$(this).attr('".$attr."');\n"; |
|
1066 | + if ($attr=="value") { |
|
1067 | + $retour.="url=url+'/'+$(this).val();\n"; |
|
1068 | + } else if($attr!=null && $attr!=="") { |
|
1069 | + $retour.="url=url+'/'+$(this).attr('".$attr."');\n"; |
|
1070 | + } |
|
1047 | 1071 | } |
1048 | 1072 | return $retour; |
1049 | 1073 | } |
@@ -1059,8 +1083,9 @@ discard block |
||
1059 | 1083 | } |
1060 | 1084 | |
1061 | 1085 | protected function _correctAjaxUrl($url) { |
1062 | - if (PhalconUtils::endsWith($url, "/")) |
|
1063 | - $url=substr($url, 0, strlen($url)-1); |
|
1086 | + if (PhalconUtils::endsWith($url, "/")) { |
|
1087 | + $url=substr($url, 0, strlen($url)-1); |
|
1088 | + } |
|
1064 | 1089 | if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
1065 | 1090 | $url=$this->_di->get("url")->get($url); |
1066 | 1091 | } |
@@ -1081,8 +1106,9 @@ discard block |
||
1081 | 1106 | $retour.="\tdata=$.parseJSON(data);for(var key in data){if($('#'+key).length){ if($('#'+key).is('[value]')) { $('#'+key).val(data[key]);} else { $('#'+key).html(data[key]); }}};\n"; |
1082 | 1107 | $retour.="\t".$jsCallback."\n |
1083 | 1108 | });\n"; |
1084 | - if ($immediatly) |
|
1085 | - $this->jquery_code_for_compile[]=$retour; |
|
1109 | + if ($immediatly) { |
|
1110 | + $this->jquery_code_for_compile[]=$retour; |
|
1111 | + } |
|
1086 | 1112 | return $retour; |
1087 | 1113 | } |
1088 | 1114 | |
@@ -1100,8 +1126,9 @@ discard block |
||
1100 | 1126 | $retour.="\tdata=$.parseJSON(data);$.each(data, function(index, value) {\n"."\tvar created=false;var maskElm=$('".$maskSelector."').first();maskElm.hide();"."\tvar newId=(maskElm.attr('id') || 'mask')+'-'+index;"."\tvar newElm=$('#'+newId);\n"."\tif(!newElm.length){\n"."\t\tnewElm=maskElm.clone();newElm.attr('id',newId);\n"."\t\tnewElm.appendTo($('".$maskSelector."').parent());\n"."\t}\n"."\tfor(var key in value){\n"."\t\t\tvar html = $('<div />').append($(newElm).clone()).html();\n"."\t\t\tif(html.indexOf('[['+key+']]')>-1){\n"."\t\t\t\tcontent=$(html.split('[['+key+']]').join(value[key]));\n"."\t\t\t\t$(newElm).replaceWith(content);newElm=content;\n"."\t\t\t}\n"."\t\tvar sel='[data-id=\"'+key+'\"]';if($(sel,newElm).length){\n"."\t\t\tvar selElm=$(sel,newElm);\n"."\t\t\t if(selElm.is('[value]')) { selElm.attr('value',value[key]);selElm.val(value[key]);} else { selElm.html(value[key]); }\n"."\t\t}\n"."}\n"."\t$(newElm).show(true);"."});\n"; |
1101 | 1127 | |
1102 | 1128 | $retour.="\t".$jsCallback."\n"."});\n"; |
1103 | - if ($immediatly) |
|
1104 | - $this->jquery_code_for_compile[]=$retour; |
|
1129 | + if ($immediatly) { |
|
1130 | + $this->jquery_code_for_compile[]=$retour; |
|
1131 | + } |
|
1105 | 1132 | return $retour; |
1106 | 1133 | } |
1107 | 1134 | |
@@ -1121,8 +1148,9 @@ discard block |
||
1121 | 1148 | }});\n"; |
1122 | 1149 | $retour.="$('#".$form."').submit();\n"; |
1123 | 1150 | } |
1124 | - if ($immediatly) |
|
1125 | - $this->jquery_code_for_compile[]=$retour; |
|
1151 | + if ($immediatly) { |
|
1152 | + $this->jquery_code_for_compile[]=$retour; |
|
1153 | + } |
|
1126 | 1154 | return $retour; |
1127 | 1155 | } |
1128 | 1156 | |
@@ -1198,11 +1226,13 @@ discard block |
||
1198 | 1226 | public function _doJQuery($element, $jqueryCall, $param="", $jsCallback="", $immediatly=false) { |
1199 | 1227 | $param=$this->_prep_value($param); |
1200 | 1228 | $callback=""; |
1201 | - if ($jsCallback!="") |
|
1202 | - $callback=", function(event){\n{$jsCallback}\n}"; |
|
1229 | + if ($jsCallback!="") { |
|
1230 | + $callback=", function(event){\n{$jsCallback}\n}"; |
|
1231 | + } |
|
1203 | 1232 | $script="$(".$this->_prep_element($element).").".$jqueryCall."(".$param.$callback.");\n"; |
1204 | - if ($immediatly) |
|
1205 | - $this->jquery_code_for_compile[]=$script; |
|
1233 | + if ($immediatly) { |
|
1234 | + $this->jquery_code_for_compile[]=$script; |
|
1235 | + } |
|
1206 | 1236 | return $script; |
1207 | 1237 | } |
1208 | 1238 | |
@@ -1230,8 +1260,9 @@ discard block |
||
1230 | 1260 | */ |
1231 | 1261 | public function _exec($js, $immediatly=false) { |
1232 | 1262 | $script=$js."\n"; |
1233 | - if ($immediatly) |
|
1234 | - $this->jquery_code_for_compile[]=$script; |
|
1263 | + if ($immediatly) { |
|
1264 | + $this->jquery_code_for_compile[]=$script; |
|
1265 | + } |
|
1235 | 1266 | return $script; |
1236 | 1267 | } |
1237 | 1268 |
@@ -45,8 +45,9 @@ |
||
45 | 45 | |
46 | 46 | protected function _setDi($di) { |
47 | 47 | $this->_di=$di; |
48 | - if ($this->js!=null&&$di!=null) |
|
49 | - $this->js->setDi($di); |
|
48 | + if ($this->js!=null&&$di!=null) { |
|
49 | + $this->js->setDi($di); |
|
50 | + } |
|
50 | 51 | } |
51 | 52 | |
52 | 53 | /** |
@@ -35,8 +35,9 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | public function getTab($index) { |
38 | - if ($index>0&&$index<sizeof($this->tabs)) |
|
39 | - return $this->tabs [$index]; |
|
38 | + if ($index>0&&$index<sizeof($this->tabs)) { |
|
39 | + return $this->tabs [$index]; |
|
40 | + } |
|
40 | 41 | } |
41 | 42 | |
42 | 43 | public function show($index) { |
@@ -52,8 +53,9 @@ discard block |
||
52 | 53 | */ |
53 | 54 | public function onShow($index, $jsCode) { |
54 | 55 | $tab=$this->getTab($index); |
55 | - if (isset($tab)) |
|
56 | - return $tab->onShow($jsCode); |
|
56 | + if (isset($tab)) { |
|
57 | + return $tab->onShow($jsCode); |
|
58 | + } |
|
57 | 59 | } |
58 | 60 | |
59 | 61 | /** |
@@ -64,8 +66,9 @@ discard block |
||
64 | 66 | */ |
65 | 67 | public function onShown($index, $jsCode) { |
66 | 68 | $tab=$this->getTab($index); |
67 | - if (isset($tab)) |
|
68 | - return $tab->onShown($jsCode); |
|
69 | + if (isset($tab)) { |
|
70 | + return $tab->onShown($jsCode); |
|
71 | + } |
|
69 | 72 | } |
70 | 73 | |
71 | 74 | /** |
@@ -76,8 +79,9 @@ discard block |
||
76 | 79 | */ |
77 | 80 | public function onHide($index, $jsCode) { |
78 | 81 | $tab=$this->getTab($index); |
79 | - if (isset($tab)) |
|
80 | - return $tab->onShow($jsCode); |
|
82 | + if (isset($tab)) { |
|
83 | + return $tab->onShow($jsCode); |
|
84 | + } |
|
81 | 85 | } |
82 | 86 | |
83 | 87 | /** |
@@ -88,7 +92,8 @@ discard block |
||
88 | 92 | */ |
89 | 93 | public function onHidden($index, $jsCode) { |
90 | 94 | $tab=$this->getTab($index); |
91 | - if (isset($tab)) |
|
92 | - return $tab->onShow($jsCode); |
|
95 | + if (isset($tab)) { |
|
96 | + return $tab->onShow($jsCode); |
|
97 | + } |
|
93 | 98 | } |
94 | 99 | } |
95 | 100 | \ No newline at end of file |
@@ -77,7 +77,8 @@ |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | public function getPanel($index) { |
80 | - if ($index<sizeof($this->content)) |
|
81 | - return $this->content [$index]; |
|
80 | + if ($index<sizeof($this->content)) { |
|
81 | + return $this->content [$index]; |
|
82 | + } |
|
82 | 83 | } |
83 | 84 | } |
84 | 85 | \ No newline at end of file |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | if(is_array($element)){ |
68 | 68 | $elm=new HtmlLink("lnk-".$this->identifier."-".$size); |
69 | 69 | $elm->fromArray($element); |
70 | - }else if($element instanceof HtmlLink){ |
|
70 | + } else if($element instanceof HtmlLink){ |
|
71 | 71 | $elm=$element; |
72 | - }else{ |
|
72 | + } else{ |
|
73 | 73 | $elm=new HtmlLink("lnk-".$this->identifier."-".$size,$href,$element); |
74 | 74 | if(isset($glyph)){ |
75 | 75 | $elm->wrapContentWithGlyph($glyph); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | } |
117 | 117 | if($this->absolutePaths===true){ |
118 | 118 | return $this->_hrefFunction($this->content[$index]); |
119 | - }else{ |
|
119 | + } else{ |
|
120 | 120 | return $this->root.implode($separator, array_slice(array_map(function($e){return $this->_hrefFunction($e);}, $this->content),0,$index+1)); |
121 | 121 | } |
122 | 122 | } |
@@ -44,8 +44,9 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | public function setStyle($value) { |
47 | - foreach ( $this->elements as $element ) |
|
48 | - $element->setStyle($value); |
|
47 | + foreach ( $this->elements as $element ) { |
|
48 | + $element->setStyle($value); |
|
49 | + } |
|
49 | 50 | } |
50 | 51 | |
51 | 52 | private function dropdownAsButton($bt) { |
@@ -70,16 +71,18 @@ discard block |
||
70 | 71 | } elseif ($element instanceof HtmlButton) { |
71 | 72 | $this->elements[]=$element; |
72 | 73 | } elseif (is_array($element)) { |
73 | - if (array_key_exists("glyph", $element)) |
|
74 | - $bt=new HtmlGlyphButton($this->identifier."-button-".$iid); |
|
75 | - elseif (array_key_exists("btnCaption", $element)) { |
|
76 | - if (array_key_exists("split", $element)) |
|
77 | - $bt=new HtmlSplitbutton($this->identifier."-dropdown-".$iid); |
|
78 | - else |
|
79 | - $bt=new HtmlDropdown($this->identifier."-dropdown-".$iid); |
|
74 | + if (array_key_exists("glyph", $element)) { |
|
75 | + $bt=new HtmlGlyphButton($this->identifier."-button-".$iid); |
|
76 | + } elseif (array_key_exists("btnCaption", $element)) { |
|
77 | + if (array_key_exists("split", $element)) { |
|
78 | + $bt=new HtmlSplitbutton($this->identifier."-dropdown-".$iid); |
|
79 | + } else { |
|
80 | + $bt=new HtmlDropdown($this->identifier."-dropdown-".$iid); |
|
81 | + } |
|
80 | 82 | $this->dropdownAsButton($bt); |
81 | - } else |
|
82 | - $bt=new HtmlButton($this->identifier."-button-".$iid); |
|
83 | + } else { |
|
84 | + $bt=new HtmlButton($this->identifier."-button-".$iid); |
|
85 | + } |
|
83 | 86 | $bt->fromArray($element); |
84 | 87 | $this->elements[]=$bt; |
85 | 88 | $result=$bt; |
@@ -110,8 +113,9 @@ discard block |
||
110 | 113 | public function setAlignment($value) { |
111 | 114 | if (is_int($value)) { |
112 | 115 | $value=CssRef::alignment("btn-group")[$value]; |
113 | - } else |
|
114 | - $value="btn-group-".$value; |
|
116 | + } else { |
|
117 | + $value="btn-group-".$value; |
|
118 | + } |
|
115 | 119 | if (strstr($value, "justified")) { |
116 | 120 | foreach ( $this->elements as $element ) { |
117 | 121 | $element->wrap('<div class="btn-group" role="group">', '</div>'); |
@@ -126,9 +130,9 @@ discard block |
||
126 | 130 | * @return HtmlButton |
127 | 131 | */ |
128 | 132 | public function getElement($index) { |
129 | - if (is_int($index)) |
|
130 | - return $this->elements[$index]; |
|
131 | - else { |
|
133 | + if (is_int($index)) { |
|
134 | + return $this->elements[$index]; |
|
135 | + } else { |
|
132 | 136 | $elm=$this->getElementById($index, $this->elements); |
133 | 137 | return $elm; |
134 | 138 | } |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | */ |
46 | 46 | private function getLastButtonGroup() { |
47 | 47 | $nb=sizeof($this->elements); |
48 | - if ($nb>0) |
|
49 | - $bg=$this->elements [$nb-1]; |
|
50 | - else { |
|
48 | + if ($nb>0) { |
|
49 | + $bg=$this->elements [$nb-1]; |
|
50 | + } else { |
|
51 | 51 | $bg=new HtmlButtongroups($this->identifier."-buttongroups-".$nb); |
52 | 52 | $this->elements []=$bg; |
53 | 53 | } |
@@ -65,8 +65,9 @@ discard block |
||
65 | 65 | public function getLastGroup() { |
66 | 66 | $bg=null; |
67 | 67 | $nb=sizeof($this->elements); |
68 | - if ($nb>0) |
|
69 | - $bg=$this->elements [$nb-1]; |
|
68 | + if ($nb>0) { |
|
69 | + $bg=$this->elements [$nb-1]; |
|
70 | + } |
|
70 | 71 | return $bg; |
71 | 72 | } |
72 | 73 |
@@ -75,27 +75,30 @@ |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | private function getGlyph($sens="left") { |
78 | - if (array_key_exists($sens, $this->_glyphs)) |
|
79 | - return $this->_glyphs [$sens]; |
|
78 | + if (array_key_exists($sens, $this->_glyphs)) { |
|
79 | + return $this->_glyphs [$sens]; |
|
80 | + } |
|
80 | 81 | return "glyphicon-chevron-".$sens; |
81 | 82 | } |
82 | 83 | |
83 | 84 | public function setRightGlyph($glyphicon) { |
84 | 85 | $glyphs=CssRef::glyphIcons(); |
85 | - if (array_search($glyphicon, $glyphs)!==false) |
|
86 | - $this->_glyphs ["right"]=$glyphicon; |
|
86 | + if (array_search($glyphicon, $glyphs)!==false) { |
|
87 | + $this->_glyphs ["right"]=$glyphicon; |
|
88 | + } |
|
87 | 89 | } |
88 | 90 | |
89 | 91 | public function setLeftGlyph($glyphicon) { |
90 | 92 | $glyphs=CssRef::glyphIcons(); |
91 | - if (array_search($glyphicon, $glyphs)!==false) |
|
92 | - $this->_glyphs ["left"]=$glyphicon; |
|
93 | + if (array_search($glyphicon, $glyphs)!==false) { |
|
94 | + $this->_glyphs ["left"]=$glyphicon; |
|
95 | + } |
|
93 | 96 | } |
94 | 97 | |
95 | 98 | public function addImage($imageSrc, $imageAlt="", $caption=NULL, $description=NULL) { |
96 | 99 | if(is_array($imageSrc)){ |
97 | 100 | $this->addImage($imageSrc[0],@$imageSrc[1],@$imageSrc[2],@$imageSrc[3]); |
98 | - }else{ |
|
101 | + } else{ |
|
99 | 102 | $image=new HtmlCarouselItem("item-".$this->identifier); |
100 | 103 | $image->setImageSrc($this->_base.$imageSrc); |
101 | 104 | $image->setImageAlt($imageAlt); |
@@ -24,17 +24,19 @@ discard block |
||
24 | 24 | |
25 | 25 | public function attachTo($identifier) { |
26 | 26 | $this->element->setProperty("aria-controls", $identifier); |
27 | - if ($this->element->getTagName()==="a") |
|
28 | - $this->element->setProperty("href", "#".$identifier); |
|
29 | - else |
|
30 | - $this->element->setProperty("data-target", "#".$identifier); |
|
27 | + if ($this->element->getTagName()==="a") { |
|
28 | + $this->element->setProperty("href", "#".$identifier); |
|
29 | + } else { |
|
30 | + $this->element->setProperty("data-target", "#".$identifier); |
|
31 | + } |
|
31 | 32 | } |
32 | 33 | |
33 | 34 | public function getAttachedZone() { |
34 | 35 | $id=$this->element->getProperty("aria-controls"); |
35 | - if (!isset($id)) |
|
36 | - if ($this->element->getTagName()==="a") |
|
36 | + if (!isset($id)) { |
|
37 | + if ($this->element->getTagName()==="a") |
|
37 | 38 | $id=$this->element->getProperty("href"); |
39 | + } |
|
38 | 40 | if (!isset($id)||$id==="#") { |
39 | 41 | $id="collapse-".$this->element->getIdentifier(); |
40 | 42 | $this->attachTo($id); |
@@ -49,8 +51,9 @@ discard block |
||
49 | 51 | } |
50 | 52 | |
51 | 53 | public function createCollapsedZone($content="", $attachTo=NULL) { |
52 | - if (isset($attachTo)) |
|
53 | - $this->attachTo($attachTo); |
|
54 | + if (isset($attachTo)) { |
|
55 | + $this->attachTo($attachTo); |
|
56 | + } |
|
54 | 57 | $collapsedZone=new HtmlDoubleElement($this->getAttachedZone()); |
55 | 58 | $collapsedZone->setProperty("class", "collapse"); |
56 | 59 | $collapsedZone->setContent($content); |