@@ -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 | /** |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | protected function _setDi($di) { |
| 47 | 47 | $this->_di=$di; |
| 48 | - if ($this->js!=null&&$di!=null) |
|
| 48 | + if ($this->js!=null && $di!=null) |
|
| 49 | 49 | $this->js->setDi($di); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -120,17 +120,17 @@ discard block |
||
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | public function __construct($params=array()) { |
| 123 | - $defaults=array ( |
|
| 123 | + $defaults=array( |
|
| 124 | 124 | 'driver' => 'Jquery' |
| 125 | 125 | ); |
| 126 | - foreach ( $defaults as $key => $val ) { |
|
| 127 | - if (isset($params[$key])&&$params[$key]!=="") { |
|
| 126 | + foreach ($defaults as $key => $val) { |
|
| 127 | + if (isset($params[$key]) && $params[$key]!=="") { |
|
| 128 | 128 | $defaults[$key]=$params[$key]; |
| 129 | 129 | } |
| 130 | 130 | } |
| 131 | 131 | extract($defaults); |
| 132 | 132 | $this->js=new Jquery(); |
| 133 | - $this->cdns=array (); |
|
| 133 | + $this->cdns=array(); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | public function addToCompile($jsScript) { |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | * @return string |
| 383 | 383 | */ |
| 384 | 384 | public function addClass($element='this', $class='', $immediatly=false) { |
| 385 | - return $this->js->_genericCallValue('addClass',$element, $class, $immediatly); |
|
| 385 | + return $this->js->_genericCallValue('addClass', $element, $class, $immediatly); |
|
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | /** |
@@ -392,8 +392,8 @@ discard block |
||
| 392 | 392 | * @param boolean $immediatly defers the execution if set to false |
| 393 | 393 | * @return string |
| 394 | 394 | */ |
| 395 | - public function after($to, $element, $immediatly=false){ |
|
| 396 | - return $this->js->_genericCallElement('after',$to, $element, $immediatly); |
|
| 395 | + public function after($to, $element, $immediatly=false) { |
|
| 396 | + return $this->js->_genericCallElement('after', $to, $element, $immediatly); |
|
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | /** |
@@ -403,8 +403,8 @@ discard block |
||
| 403 | 403 | * @param boolean $immediatly defers the execution if set to false |
| 404 | 404 | * @return string |
| 405 | 405 | */ |
| 406 | - public function before($to, $element, $immediatly=false){ |
|
| 407 | - return $this->js->_genericCallElement('before',$to, $element, $immediatly); |
|
| 406 | + public function before($to, $element, $immediatly=false) { |
|
| 407 | + return $this->js->_genericCallElement('before', $to, $element, $immediatly); |
|
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | /** |
@@ -424,8 +424,8 @@ discard block |
||
| 424 | 424 | * @param string $value |
| 425 | 425 | * @param boolean $immediatly defers the execution if set to false |
| 426 | 426 | */ |
| 427 | - public function val($element='this',$value='',$immediatly=false){ |
|
| 428 | - return $this->js->_genericCallValue('val',$element,$value,$immediatly); |
|
| 427 | + public function val($element='this', $value='', $immediatly=false) { |
|
| 428 | + return $this->js->_genericCallValue('val', $element, $value, $immediatly); |
|
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | /** |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | * @param boolean $immediatly defers the execution if set to false |
| 436 | 436 | */ |
| 437 | 437 | public function html($element='this', $value='', $immediatly=false) { |
| 438 | - return $this->js->_genericCallValue('html',$element, $value, $immediatly); |
|
| 438 | + return $this->js->_genericCallValue('html', $element, $value, $immediatly); |
|
| 439 | 439 | } |
| 440 | 440 | // -------------------------------------------------------------------- |
| 441 | 441 | /** |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | * @return string |
| 461 | 461 | */ |
| 462 | 462 | public function append($to, $element, $immediatly=false) { |
| 463 | - return $this->js->_genericCallElement('append',$to, $element, $immediatly); |
|
| 463 | + return $this->js->_genericCallElement('append', $to, $element, $immediatly); |
|
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | /** |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | * @return string |
| 472 | 472 | */ |
| 473 | 473 | public function prepend($to, $element, $immediatly=false) { |
| 474 | - return $this->js->_genericCallElement('prepend',$to, $element, $immediatly); |
|
| 474 | + return $this->js->_genericCallElement('prepend', $to, $element, $immediatly); |
|
| 475 | 475 | } |
| 476 | 476 | // -------------------------------------------------------------------- |
| 477 | 477 | /** |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | * @return string |
| 523 | 523 | */ |
| 524 | 524 | public function removeClass($element='this', $class='', $immediatly=false) { |
| 525 | - return $this->js->_genericCall('removeClass',$element, $class, $immediatly); |
|
| 525 | + return $this->js->_genericCall('removeClass', $element, $class, $immediatly); |
|
| 526 | 526 | } |
| 527 | 527 | // -------------------------------------------------------------------- |
| 528 | 528 | /** |
@@ -583,7 +583,7 @@ discard block |
||
| 583 | 583 | * @return string |
| 584 | 584 | */ |
| 585 | 585 | public function toggleClass($element='this', $class='', $immediatly=false) { |
| 586 | - return $this->js->_genericCallValue('toggleClass',$element, $class, $immediatly); |
|
| 586 | + return $this->js->_genericCallValue('toggleClass', $element, $class, $immediatly); |
|
| 587 | 587 | } |
| 588 | 588 | |
| 589 | 589 | /** |
@@ -630,7 +630,7 @@ discard block |
||
| 630 | 630 | */ |
| 631 | 631 | public function compile($view=NULL, $view_var='script_foot', $script_tags=TRUE) { |
| 632 | 632 | $bs=$this->_bootstrap; |
| 633 | - if (isset($bs)&&isset($view)) { |
|
| 633 | + if (isset($bs) && isset($view)) { |
|
| 634 | 634 | $bs->compileHtml($this, $view); |
| 635 | 635 | } |
| 636 | 636 | return $this->js->_compile($view, $view_var, $script_tags); |
@@ -710,27 +710,27 @@ discard block |
||
| 710 | 710 | $json_result=$result->result_array(); |
| 711 | 711 | } elseif (is_array($result)) { |
| 712 | 712 | $json_result=$result; |
| 713 | - } else { |
|
| 713 | + }else { |
|
| 714 | 714 | return $this->_prep_args($result); |
| 715 | 715 | } |
| 716 | - } else { |
|
| 716 | + }else { |
|
| 717 | 717 | return 'null'; |
| 718 | 718 | } |
| 719 | 719 | return $this->_create_json($json_result, $match_array_type); |
| 720 | 720 | } |
| 721 | 721 | |
| 722 | 722 | private function _create_json($json_result, $match_array_type) { |
| 723 | - $json=array (); |
|
| 723 | + $json=array(); |
|
| 724 | 724 | $_is_assoc=TRUE; |
| 725 | - if (!is_array($json_result)&&empty($json_result)) { |
|
| 725 | + if (!is_array($json_result) && empty($json_result)) { |
|
| 726 | 726 | show_error("Generate JSON Failed - Illegal key, value pair."); |
| 727 | 727 | } elseif ($match_array_type) { |
| 728 | 728 | $_is_assoc=$this->_is_associative_array($json_result); |
| 729 | 729 | } |
| 730 | - foreach ( $json_result as $k => $v ) { |
|
| 730 | + foreach ($json_result as $k => $v) { |
|
| 731 | 731 | if ($_is_assoc) { |
| 732 | 732 | $json[]=$this->_prep_args($k, TRUE).':'.$this->generate_json($v, $match_array_type); |
| 733 | - } else { |
|
| 733 | + }else { |
|
| 734 | 734 | $json[]=$this->generate_json($v, $match_array_type); |
| 735 | 735 | } |
| 736 | 736 | } |
@@ -745,7 +745,7 @@ discard block |
||
| 745 | 745 | * @return type |
| 746 | 746 | */ |
| 747 | 747 | public function _is_associative_array($arr) { |
| 748 | - foreach ( array_keys($arr) as $key => $val ) { |
|
| 748 | + foreach (array_keys($arr) as $key => $val) { |
|
| 749 | 749 | if ($key!==$val) { |
| 750 | 750 | return TRUE; |
| 751 | 751 | } |
@@ -764,11 +764,11 @@ discard block |
||
| 764 | 764 | return 'null'; |
| 765 | 765 | } elseif (is_bool($result)) { |
| 766 | 766 | return ($result===TRUE) ? 'true' : 'false'; |
| 767 | - } elseif (is_string($result)||$is_key) { |
|
| 768 | - return '"'.str_replace(array ( |
|
| 769 | - '\\',"\t","\n","\r",'"','/' |
|
| 770 | - ), array ( |
|
| 771 | - '\\\\','\\t','\\n',"\\r",'\"','\/' |
|
| 767 | + } elseif (is_string($result) || $is_key) { |
|
| 768 | + return '"'.str_replace(array( |
|
| 769 | + '\\', "\t", "\n", "\r", '"', '/' |
|
| 770 | + ), array( |
|
| 771 | + '\\\\', '\\t', '\\n', "\\r", '\"', '\/' |
|
| 772 | 772 | ), $result).'"'; |
| 773 | 773 | } elseif (is_scalar($result)) { |
| 774 | 774 | return $result; |
@@ -783,8 +783,8 @@ discard block |
||
| 783 | 783 | * @param string $jsCallback javascript code to execute after the request |
| 784 | 784 | * @param boolean $hasLoader true for showing ajax loader. default : true |
| 785 | 785 | */ |
| 786 | - public function get($url, $responseElement="", $params="{}", $jsCallback=NULL,$hasLoader=true) { |
|
| 787 | - return $this->js->_get($url, $params, $responseElement, $jsCallback, NULL, $hasLoader,true); |
|
| 786 | + public function get($url, $responseElement="", $params="{}", $jsCallback=NULL, $hasLoader=true) { |
|
| 787 | + return $this->js->_get($url, $params, $responseElement, $jsCallback, NULL, $hasLoader, true); |
|
| 788 | 788 | } |
| 789 | 789 | |
| 790 | 790 | /** |
@@ -795,8 +795,8 @@ discard block |
||
| 795 | 795 | * @param string $jsCallback javascript code to execute after the request |
| 796 | 796 | * @param boolean $immediatly |
| 797 | 797 | */ |
| 798 | - public function json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document",$immediatly=false) { |
|
| 799 | - return $this->js->_json($url, $method, $params, $jsCallback, $attr, $context,$immediatly); |
|
| 798 | + public function json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document", $immediatly=false) { |
|
| 799 | + return $this->js->_json($url, $method, $params, $jsCallback, $attr, $context, $immediatly); |
|
| 800 | 800 | } |
| 801 | 801 | |
| 802 | 802 | /** |
@@ -806,8 +806,8 @@ discard block |
||
| 806 | 806 | * @param string $url the request address |
| 807 | 807 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true) |
| 808 | 808 | */ |
| 809 | - public function jsonOn($event,$element, $url,$parameters=array()) { |
|
| 810 | - return $this->js->_jsonOn($event, $element, $url,$parameters); |
|
| 809 | + public function jsonOn($event, $element, $url, $parameters=array()) { |
|
| 810 | + return $this->js->_jsonOn($event, $element, $url, $parameters); |
|
| 811 | 811 | } |
| 812 | 812 | |
| 813 | 813 | /** |
@@ -851,8 +851,8 @@ discard block |
||
| 851 | 851 | * @param string $url the request url |
| 852 | 852 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true) |
| 853 | 853 | */ |
| 854 | - public function jsonArrayOn($event,$element,$maskSelector, $url,$parameters=array()) { |
|
| 855 | - return $this->js->_jsonArrayOn($event,$element,$maskSelector, $url, $parameters); |
|
| 854 | + public function jsonArrayOn($event, $element, $maskSelector, $url, $parameters=array()) { |
|
| 855 | + return $this->js->_jsonArrayOn($event, $element, $maskSelector, $url, $parameters); |
|
| 856 | 856 | } |
| 857 | 857 | |
| 858 | 858 | /** |
@@ -864,7 +864,7 @@ discard block |
||
| 864 | 864 | * @param string $jsCallback javascript code to execute after the request |
| 865 | 865 | * @param string $attr the html attribute added to the request |
| 866 | 866 | */ |
| 867 | - public function getDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL,$attr="id") { |
|
| 867 | + public function getDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id") { |
|
| 868 | 868 | return $this->js->_get($url, $params, $responseElement, $jsCallback, $attr, false); |
| 869 | 869 | } |
| 870 | 870 | |
@@ -902,8 +902,8 @@ discard block |
||
| 902 | 902 | * @param string $jsCallback javascript code to execute after the request |
| 903 | 903 | * @param boolean $hasLoader true for showing ajax loader. default : true |
| 904 | 904 | */ |
| 905 | - public function post($url, $responseElement="", $params="{}", $jsCallback=NULL,$hasLoader=true) { |
|
| 906 | - return $this->js->_post($url, $params, $responseElement, $jsCallback, NULL, $hasLoader,true); |
|
| 905 | + public function post($url, $responseElement="", $params="{}", $jsCallback=NULL, $hasLoader=true) { |
|
| 906 | + return $this->js->_post($url, $params, $responseElement, $jsCallback, NULL, $hasLoader, true); |
|
| 907 | 907 | } |
| 908 | 908 | |
| 909 | 909 | /** |
@@ -916,8 +916,8 @@ discard block |
||
| 916 | 916 | * @param string $jsCallback javascript code to execute after the request |
| 917 | 917 | * @param boolean $hasLoader true for showing ajax loader. default : true |
| 918 | 918 | */ |
| 919 | - public function postDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id",$hasLoader=true) { |
|
| 920 | - return $this->js->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader,false); |
|
| 919 | + public function postDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id", $hasLoader=true) { |
|
| 920 | + return $this->js->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, false); |
|
| 921 | 921 | } |
| 922 | 922 | |
| 923 | 923 | /** |
@@ -931,7 +931,7 @@ discard block |
||
| 931 | 931 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true) |
| 932 | 932 | */ |
| 933 | 933 | public function postOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) { |
| 934 | - return $this->js->_postOn($event, $element, $url, $params, $responseElement, $parameters); |
|
| 934 | + return $this->js->_postOn($event, $element, $url, $params, $responseElement, $parameters); |
|
| 935 | 935 | } |
| 936 | 936 | |
| 937 | 937 | /** |
@@ -955,8 +955,8 @@ discard block |
||
| 955 | 955 | * @param string $jsCallback javascript code to execute after the request |
| 956 | 956 | * @param boolean $hasLoader true for showing ajax loader. default : true |
| 957 | 957 | */ |
| 958 | - public function postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL,$hasLoader=true) { |
|
| 959 | - return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, NULL, $hasLoader,true); |
|
| 958 | + public function postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $hasLoader=true) { |
|
| 959 | + return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, NULL, $hasLoader, true); |
|
| 960 | 960 | } |
| 961 | 961 | |
| 962 | 962 | /** |
@@ -969,8 +969,8 @@ discard block |
||
| 969 | 969 | * @param string $attr the html attribute added to the request |
| 970 | 970 | * @param boolean $hasLoader true for showing ajax loader. default : true |
| 971 | 971 | */ |
| 972 | - public function postFormDeferred($url, $form, $responseElement, $validation=false, $jsCallback=NULL,$attr="id",$hasLoader=true) { |
|
| 973 | - return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader,false); |
|
| 972 | + public function postFormDeferred($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true) { |
|
| 973 | + return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader, false); |
|
| 974 | 974 | } |
| 975 | 975 | |
| 976 | 976 | /** |
@@ -984,7 +984,7 @@ discard block |
||
| 984 | 984 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true) |
| 985 | 985 | */ |
| 986 | 986 | public function postFormOn($event, $element, $url, $form, $responseElement="", $parameters=array()) { |
| 987 | - return $this->js->_postFormOn($event,$element, $url, $form, $responseElement, $parameters); |
|
| 987 | + return $this->js->_postFormOn($event, $element, $url, $form, $responseElement, $parameters); |
|
| 988 | 988 | } |
| 989 | 989 | |
| 990 | 990 | /** |
@@ -1039,7 +1039,7 @@ discard block |
||
| 1039 | 1039 | $preventDefault=false; |
| 1040 | 1040 | $immediatly=true; |
| 1041 | 1041 | extract($parameters); |
| 1042 | - return $this->js->_doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param, $preventDefault, $stopPropagation, $jsCallback,$immediatly); |
|
| 1042 | + return $this->js->_doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param, $preventDefault, $stopPropagation, $jsCallback, $immediatly); |
|
| 1043 | 1043 | } |
| 1044 | 1044 | |
| 1045 | 1045 | /** |
@@ -1066,7 +1066,7 @@ discard block |
||
| 1066 | 1066 | $preventDefault=false; |
| 1067 | 1067 | $immediatly=true; |
| 1068 | 1068 | extract($parameters); |
| 1069 | - $script=$this->js->_execOn($element, $event, $js, $preventDefault, $stopPropagation,$immediatly); |
|
| 1069 | + $script=$this->js->_execOn($element, $event, $js, $preventDefault, $stopPropagation, $immediatly); |
|
| 1070 | 1070 | return $script; |
| 1071 | 1071 | } |
| 1072 | 1072 | |
@@ -1076,7 +1076,7 @@ discard block |
||
| 1076 | 1076 | |
| 1077 | 1077 | public function setCDNs($cdns) { |
| 1078 | 1078 | if (is_array($cdns)===false) { |
| 1079 | - $cdns=array ( |
|
| 1079 | + $cdns=array( |
|
| 1080 | 1080 | $cdns |
| 1081 | 1081 | ); |
| 1082 | 1082 | } |
@@ -1087,9 +1087,9 @@ discard block |
||
| 1087 | 1087 | $hasJQuery=false; |
| 1088 | 1088 | $hasJQueryUI=false; |
| 1089 | 1089 | $hasBootstrap=false; |
| 1090 | - $result=array (); |
|
| 1091 | - foreach ( $this->cdns as $cdn ) { |
|
| 1092 | - switch(get_class($cdn)) { |
|
| 1090 | + $result=array(); |
|
| 1091 | + foreach ($this->cdns as $cdn) { |
|
| 1092 | + switch (get_class($cdn)) { |
|
| 1093 | 1093 | case "Ajax\lib\CDNJQuery": |
| 1094 | 1094 | $hasJQuery=true; |
| 1095 | 1095 | $result[0]=$cdn; |
@@ -1107,10 +1107,10 @@ discard block |
||
| 1107 | 1107 | if ($hasJQuery===false) { |
| 1108 | 1108 | $result[0]=new CDNJQuery("x"); |
| 1109 | 1109 | } |
| 1110 | - if ($hasJQueryUI===false&&isset($this->_ui)) { |
|
| 1110 | + if ($hasJQueryUI===false && isset($this->_ui)) { |
|
| 1111 | 1111 | $result[1]=new CDNGuiGen("x", $template); |
| 1112 | 1112 | } |
| 1113 | - if ($hasBootstrap===false&&isset($this->_bootstrap)) { |
|
| 1113 | + if ($hasBootstrap===false && isset($this->_bootstrap)) { |
|
| 1114 | 1114 | $result[2]=new CDNBootstrap("x"); |
| 1115 | 1115 | } |
| 1116 | 1116 | ksort($result); |
@@ -1124,7 +1124,7 @@ discard block |
||
| 1124 | 1124 | $this->_setDi($di); |
| 1125 | 1125 | } |
| 1126 | 1126 | } |
| 1127 | -} else { |
|
| 1127 | +}else { |
|
| 1128 | 1128 | class JsUtils extends _JsUtils { |
| 1129 | 1129 | |
| 1130 | 1130 | public function setDi(DiInterface $di) { |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | protected function compileEvents() { |
| 68 | - foreach ( $this->events as $event => $jsCode ) { |
|
| 68 | + foreach ($this->events as $event => $jsCode) { |
|
| 69 | 69 | $this->jquery_code_for_compile []="$( \"".$this->collapsed."\" ).on(\"".$event."\" , function (e) {".$jsCode."});"; |
| 70 | 70 | } |
| 71 | 71 | } |
@@ -9,9 +9,9 @@ |
||
| 9 | 9 | * @see \Ajax\bootstrap\components\SimpleBsComponent::getScript() |
| 10 | 10 | */ |
| 11 | 11 | public function getScript() { |
| 12 | - $this->jquery_code_for_compile=array (); |
|
| 13 | - foreach ( $this->jsCodes as $jsCode ) { |
|
| 14 | - $this->jquery_code_for_compile []=$jsCode->compile(array ( |
|
| 12 | + $this->jquery_code_for_compile=array(); |
|
| 13 | + foreach ($this->jsCodes as $jsCode) { |
|
| 14 | + $this->jquery_code_for_compile []=$jsCode->compile(array( |
|
| 15 | 15 | "identifier" => $this->attachTo |
| 16 | 16 | )); |
| 17 | 17 | } |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | if ($value) { |
| 58 | 58 | $this->jsCodes ["draggable"]=new Draggable(); |
| 59 | 59 | $this->setBackdrop(false); |
| 60 | - } else if (array_key_exists("draggable", $this->jsCodes)) { |
|
| 60 | + }else if (array_key_exists("draggable", $this->jsCodes)) { |
|
| 61 | 61 | unset($this->jsCodes ["draggable"]); |
| 62 | 62 | unset($this->params ["backdrop"]); |
| 63 | 63 | } |
@@ -6,8 +6,8 @@ discard block |
||
| 6 | 6 | use Ajax\common\JsCode; |
| 7 | 7 | |
| 8 | 8 | class SimpleBsComponent extends SimpleComponent { |
| 9 | - protected $events=array (); |
|
| 10 | - protected $jsCodes=array (); |
|
| 9 | + protected $events=array(); |
|
| 10 | + protected $jsCodes=array(); |
|
| 11 | 11 | |
| 12 | 12 | public function addEvent($event, $jsCode) { |
| 13 | 13 | $this->events [$event]=$jsCode; |
@@ -15,8 +15,8 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | public function getScript() { |
| 17 | 17 | parent::getScript(); |
| 18 | - foreach ( $this->jsCodes as $jsCode ) { |
|
| 19 | - $this->jquery_code_for_compile []=$jsCode->compile(array ( |
|
| 18 | + foreach ($this->jsCodes as $jsCode) { |
|
| 19 | + $this->jquery_code_for_compile []=$jsCode->compile(array( |
|
| 20 | 20 | "identifier" => $this->attachTo |
| 21 | 21 | )); |
| 22 | 22 | } |
@@ -9,10 +9,10 @@ |
||
| 9 | 9 | * @see \Ajax\common\SimpleComponent::compileEvents() |
| 10 | 10 | */ |
| 11 | 11 | protected function compileEvents() { |
| 12 | - foreach ( $this->events as $event => $jsCode ) { |
|
| 12 | + foreach ($this->events as $event => $jsCode) { |
|
| 13 | 13 | if ($event==="buttonClick") { |
| 14 | 14 | $this->jquery_code_for_compile []="$( \"#split-".preg_replace('/[^a-zA-Z0-9\-.]/s', '', $this->attachTo)."\" ).on(\"click\" , function( event, data ) {".$jsCode."});"; |
| 15 | - } else { |
|
| 15 | + }else { |
|
| 16 | 16 | $this->jquery_code_for_compile []="$( \"".$this->attachTo."\" ).on(\"".$event."\" , function( event, data ) {".$jsCode."});"; |
| 17 | 17 | } |
| 18 | 18 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | public function __construct(JsUtils $js) { |
| 20 | 20 | parent::__construct($js); |
| 21 | - $this->tabs=array (); |
|
| 21 | + $this->tabs=array(); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | public function getTabs() { |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | public function getTab($index) { |
| 38 | - if ($index>0&&$index<sizeof($this->tabs)) |
|
| 38 | + if ($index>0 && $index<sizeof($this->tabs)) |
|
| 39 | 39 | return $this->tabs [$index]; |
| 40 | 40 | } |
| 41 | 41 | |
@@ -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 |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | $this->setClass("panel-group"); |
| 20 | 20 | $this->setRole("tablist"); |
| 21 | 21 | $this->setProperty("aria-multiselectable", "true"); |
| 22 | - $this->content=array (); |
|
| 22 | + $this->content=array(); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public function addPanel($title, $content) { |
@@ -45,8 +45,8 @@ discard block |
||
| 45 | 45 | * @param string $action a Phalcon action |
| 46 | 46 | * @param $params The parameters to pass to the view |
| 47 | 47 | */ |
| 48 | - public function renderContentPanel($title,$view, $controller, $action, $params=NULL) { |
|
| 49 | - $template=$view->getRender($controller, $action, $params, function ($view) { |
|
| 48 | + public function renderContentPanel($title, $view, $controller, $action, $params=NULL) { |
|
| 49 | + $template=$view->getRender($controller, $action, $params, function($view) { |
|
| 50 | 50 | $view->setRenderLevel(View::LEVEL_ACTION_VIEW); |
| 51 | 51 | }); |
| 52 | 52 | return $this->addPanel($title, $template); |
@@ -59,19 +59,19 @@ discard block |
||
| 59 | 59 | * @param string $controller a Phalcon controller |
| 60 | 60 | * @param string $action a Phalcon action |
| 61 | 61 | */ |
| 62 | - public function forwardPanel($title,$initialController,$controller,$action){ |
|
| 63 | - $dispatcher = $initialController->dispatcher; |
|
| 62 | + public function forwardPanel($title, $initialController, $controller, $action) { |
|
| 63 | + $dispatcher=$initialController->dispatcher; |
|
| 64 | 64 | $dispatcher->setControllerName($controller); |
| 65 | 65 | $dispatcher->setActionName($action); |
| 66 | 66 | $dispatcher->dispatch(); |
| 67 | - $template=$initialController->view->getRender($dispatcher->getControllerName(), $dispatcher->getActionName(),$dispatcher->getParams(), function ($view) { |
|
| 67 | + $template=$initialController->view->getRender($dispatcher->getControllerName(), $dispatcher->getActionName(), $dispatcher->getParams(), function($view) { |
|
| 68 | 68 | $view->setRenderLevel(View::LEVEL_ACTION_VIEW); |
| 69 | 69 | }); |
| 70 | 70 | return $this->addPanel($title, $template); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | public function run(JsUtils $js) { |
| 74 | - foreach ( $this->content as $content ) { |
|
| 74 | + foreach ($this->content as $content) { |
|
| 75 | 75 | $content->run($js); |
| 76 | 76 | } |
| 77 | 77 | } |
@@ -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 |
@@ -44,13 +44,13 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | public function addCloseButton() { |
| 46 | 46 | $button=new HtmlButton("close-".$this->identifier); |
| 47 | - $button->setProperties(array ( |
|
| 47 | + $button->setProperties(array( |
|
| 48 | 48 | "class" => "close", |
| 49 | 49 | "data-dismiss" => "alert", |
| 50 | 50 | "aria-label" => "close" |
| 51 | 51 | )); |
| 52 | 52 | $button->setValue('<span aria-hidden="true">×</span>'); |
| 53 | - $this->addToPropertyCtrl("class", "alert-dismissible", array ( |
|
| 53 | + $this->addToPropertyCtrl("class", "alert-dismissible", array( |
|
| 54 | 54 | "alert-dismissible" |
| 55 | 55 | )); |
| 56 | 56 | $this->button=$button; |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * @see \Ajax\bootstrap\html\base\BaseHtml::compile() |
| 80 | 80 | */ |
| 81 | 81 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
| 82 | - if ($this->closeable&&$this->button==="") { |
|
| 82 | + if ($this->closeable && $this->button==="") { |
|
| 83 | 83 | $this->addCloseButton(); |
| 84 | 84 | } |
| 85 | 85 | return parent::compile($js, $view); |