@@ -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) { |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | public function setClass($classNames) { |
| 16 | - if(is_array($classNames)){ |
|
| 16 | + if (is_array($classNames)) { |
|
| 17 | 17 | $classNames=implode(" ", $classNames); |
| 18 | 18 | } |
| 19 | 19 | $this->setProperty("class", $classNames); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function fromArray($array) { |
| 42 | 42 | $array=parent::fromArray($array); |
| 43 | - foreach ( $array as $key => $value ) { |
|
| 43 | + foreach ($array as $key => $value) { |
|
| 44 | 44 | $this->setProperty($key, $value); |
| 45 | 45 | } |
| 46 | 46 | return $array; |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | private $default; |
| 17 | 17 | private $options; |
| 18 | 18 | |
| 19 | - public function __construct($identifier, $caption,$default=NULL) { |
|
| 19 | + public function __construct($identifier, $caption, $default=NULL) { |
|
| 20 | 20 | parent::__construct($identifier, "select"); |
| 21 | 21 | $this->setProperty("name", $identifier); |
| 22 | 22 | $this->setProperty("class", "form-control"); |
@@ -25,21 +25,21 @@ discard block |
||
| 25 | 25 | $this->options=array(); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - public function addOption($element,$value="",$selected=false){ |
|
| 29 | - if($element instanceof HtmlOption){ |
|
| 28 | + public function addOption($element, $value="", $selected=false) { |
|
| 29 | + if ($element instanceof HtmlOption) { |
|
| 30 | 30 | $option=$element; |
| 31 | - }else{ |
|
| 32 | - $option=new HtmlOption($this->identifier."-".count($this->options), $element,$value); |
|
| 31 | + }else { |
|
| 32 | + $option=new HtmlOption($this->identifier."-".count($this->options), $element, $value); |
|
| 33 | 33 | } |
| 34 | - if($selected || $option->getValue()==$this->getProperty("value")){ |
|
| 34 | + if ($selected || $option->getValue()==$this->getProperty("value")) { |
|
| 35 | 35 | $option->select(); |
| 36 | 36 | } |
| 37 | 37 | $this->options[]=$option; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function setValue($value) { |
| 41 | - foreach ( $this->options as $option ) { |
|
| 42 | - if (strcasecmp($option->getValue(),$value)===0) { |
|
| 41 | + foreach ($this->options as $option) { |
|
| 42 | + if (strcasecmp($option->getValue(), $value)===0) { |
|
| 43 | 43 | $option->setProperty("selected", ""); |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -52,23 +52,23 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
| 54 | 54 | $this->content=array(); |
| 55 | - if(isset($this->default)){ |
|
| 55 | + if (isset($this->default)) { |
|
| 56 | 56 | $default=new HtmlOption("", $this->default); |
| 57 | 57 | $this->content[]=$default; |
| 58 | 58 | } |
| 59 | - foreach ($this->options as $option){ |
|
| 59 | + foreach ($this->options as $option) { |
|
| 60 | 60 | $this->content[]=$option; |
| 61 | 61 | } |
| 62 | 62 | return parent::compile($js, $view); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - public function fromArray($array){ |
|
| 66 | - if(JArray::isAssociative($array)){ |
|
| 67 | - foreach ($array as $k=>$v){ |
|
| 65 | + public function fromArray($array) { |
|
| 66 | + if (JArray::isAssociative($array)) { |
|
| 67 | + foreach ($array as $k=>$v) { |
|
| 68 | 68 | $this->addOption($v, $k); |
| 69 | 69 | } |
| 70 | - }else{ |
|
| 71 | - foreach ($array as $v){ |
|
| 70 | + }else { |
|
| 71 | + foreach ($array as $v) { |
|
| 72 | 72 | $this->addOption($v, $v); |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $this->addOption($function($object)); |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - public function setSize($size){ |
|
| 104 | + public function setSize($size) { |
|
| 105 | 105 | return $this->setProperty("size", $size); |
| 106 | 106 | } |
| 107 | 107 | } |
@@ -21,14 +21,14 @@ discard block |
||
| 21 | 21 | protected $_bootstrap; |
| 22 | 22 | protected $libraryFile; |
| 23 | 23 | protected $_javascript_folder='js'; |
| 24 | - protected $jquery_code_for_load=array (); |
|
| 25 | - protected $jquery_code_for_compile=array (); |
|
| 24 | + protected $jquery_code_for_load=array(); |
|
| 25 | + protected $jquery_code_for_compile=array(); |
|
| 26 | 26 | protected $jquery_corner_active=FALSE; |
| 27 | 27 | protected $jquery_table_sorter_active=FALSE; |
| 28 | 28 | protected $jquery_table_sorter_pager_active=FALSE; |
| 29 | 29 | protected $ajaxLoader='<span></span><span></span><span></span><span></span><span></span>'; |
| 30 | - protected $jquery_events=array ( |
|
| 31 | - "bind","blur","change","click","dblclick","delegate","die","error","focus","focusin","focusout","hover","keydown","keypress","keyup","live","load","mousedown","mousseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","off","on","one","ready","resize","scroll","select","submit","toggle","trigger","triggerHandler","undind","undelegate","unload" |
|
| 30 | + protected $jquery_events=array( |
|
| 31 | + "bind", "blur", "change", "click", "dblclick", "delegate", "die", "error", "focus", "focusin", "focusout", "hover", "keydown", "keypress", "keyup", "live", "load", "mousedown", "mousseenter", "mouseleave", "mousemove", "mouseout", "mouseover", "mouseup", "off", "on", "one", "ready", "resize", "scroll", "select", "submit", "toggle", "trigger", "triggerHandler", "undind", "undelegate", "unload" |
|
| 32 | 32 | ); |
| 33 | 33 | |
| 34 | 34 | public function setDi($di) { |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | public function __construct($params) { |
| 53 | 53 | $this->params=array(); |
| 54 | - foreach ( $params as $key => $val ) { |
|
| 54 | + foreach ($params as $key => $val) { |
|
| 55 | 55 | $this->params[$key]=$params[$key]; |
| 56 | 56 | } |
| 57 | 57 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | */ |
| 166 | 166 | public function _click($element='this', $js=array(), $ret_false=TRUE) { |
| 167 | 167 | if (!is_array($js)) { |
| 168 | - $js=array ( |
|
| 168 | + $js=array( |
|
| 169 | 169 | $js |
| 170 | 170 | ); |
| 171 | 171 | } |
@@ -360,12 +360,12 @@ discard block |
||
| 360 | 360 | */ |
| 361 | 361 | public function _output($array_js='') { |
| 362 | 362 | if (!is_array($array_js)) { |
| 363 | - $array_js=array ( |
|
| 363 | + $array_js=array( |
|
| 364 | 364 | $array_js |
| 365 | 365 | ); |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | - foreach ( $array_js as $js ) { |
|
| 368 | + foreach ($array_js as $js) { |
|
| 369 | 369 | $this->jquery_code_for_compile[]="\t$js\n"; |
| 370 | 370 | } |
| 371 | 371 | } |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | * @param boolean $immediatly defers the execution if set to false |
| 421 | 421 | * @return string |
| 422 | 422 | */ |
| 423 | - public function after($element='this', $value='', $immediatly=false){ |
|
| 423 | + public function after($element='this', $value='', $immediatly=false) { |
|
| 424 | 424 | $element=$this->_prep_element($element); |
| 425 | 425 | $value=$this->_prep_value($value); |
| 426 | 426 | $str="$({$element}).after({$value});"; |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | if (isset($value)) { |
| 442 | 442 | $value=$this->_prep_value($value); |
| 443 | 443 | $str="$({$element}).attr(\"$attributeName\",{$value});"; |
| 444 | - } else |
|
| 444 | + }else |
|
| 445 | 445 | $str="$({$element}).attr(\"$attributeName\");"; |
| 446 | 446 | if ($immediatly) |
| 447 | 447 | $this->jquery_code_for_compile[]=$str; |
@@ -455,12 +455,12 @@ discard block |
||
| 455 | 455 | * @param string $param |
| 456 | 456 | * @param boolean $immediatly delayed if false |
| 457 | 457 | */ |
| 458 | - public function _genericCallValue($jQueryCall,$element='this', $param="", $immediatly=false) { |
|
| 458 | + public function _genericCallValue($jQueryCall, $element='this', $param="", $immediatly=false) { |
|
| 459 | 459 | $element=$this->_prep_element($element); |
| 460 | 460 | if (isset($param)) { |
| 461 | 461 | $param=$this->_prep_value($param); |
| 462 | 462 | $str="$({$element}).{$jQueryCall}({$param});"; |
| 463 | - } else |
|
| 463 | + }else |
|
| 464 | 464 | $str="$({$element}).{$jQueryCall}();"; |
| 465 | 465 | if ($immediatly) |
| 466 | 466 | $this->jquery_code_for_compile[]=$str; |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | * @param boolean $immediatly delayed if false |
| 475 | 475 | * @return string |
| 476 | 476 | */ |
| 477 | - public function _genericCallElement($jQueryCall,$to='this', $element, $immediatly=false) { |
|
| 477 | + public function _genericCallElement($jQueryCall, $to='this', $element, $immediatly=false) { |
|
| 478 | 478 | $to=$this->_prep_element($to); |
| 479 | 479 | $element=$this->_prep_element($element); |
| 480 | 480 | $str="$({$to}).{$jQueryCall}({$element});"; |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | |
| 501 | 501 | $animations="\t\t\t"; |
| 502 | 502 | if (is_array($params)) { |
| 503 | - foreach ( $params as $param => $value ) { |
|
| 503 | + foreach ($params as $param => $value) { |
|
| 504 | 504 | $animations.=$param.': \''.$value.'\', '; |
| 505 | 505 | } |
| 506 | 506 | } |
@@ -772,12 +772,12 @@ discard block |
||
| 772 | 772 | */ |
| 773 | 773 | public function sortable($element, $options=array()) { |
| 774 | 774 | if (count($options)>0) { |
| 775 | - $sort_options=array (); |
|
| 776 | - foreach ( $options as $k => $v ) { |
|
| 775 | + $sort_options=array(); |
|
| 776 | + foreach ($options as $k => $v) { |
|
| 777 | 777 | $sort_options[]="\n\t\t".$k.': '.$v.""; |
| 778 | 778 | } |
| 779 | 779 | $sort_options=implode(",", $sort_options); |
| 780 | - } else { |
|
| 780 | + }else { |
|
| 781 | 781 | $sort_options=''; |
| 782 | 782 | } |
| 783 | 783 | |
@@ -811,7 +811,7 @@ discard block |
||
| 811 | 811 | * @param boolean $stopPropagation Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event. |
| 812 | 812 | * @return string |
| 813 | 813 | */ |
| 814 | - public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true) { |
|
| 814 | + public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true) { |
|
| 815 | 815 | if (is_array($js)) { |
| 816 | 816 | $js=implode("\n\t\t", $js); |
| 817 | 817 | } |
@@ -825,7 +825,7 @@ discard block |
||
| 825 | 825 | $event="\n\t$(".$this->_prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
| 826 | 826 | else |
| 827 | 827 | $event="\n\t$(".$this->_prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
| 828 | - if($immediatly) |
|
| 828 | + if ($immediatly) |
|
| 829 | 829 | $this->jquery_code_for_compile[]=$event; |
| 830 | 830 | return $event; |
| 831 | 831 | } |
@@ -859,7 +859,7 @@ discard block |
||
| 859 | 859 | |
| 860 | 860 | // External references |
| 861 | 861 | $external_scripts=implode('', $this->jquery_code_for_load); |
| 862 | - extract(array ( |
|
| 862 | + extract(array( |
|
| 863 | 863 | 'library_src' => $external_scripts |
| 864 | 864 | )); |
| 865 | 865 | |
@@ -874,7 +874,7 @@ discard block |
||
| 874 | 874 | $script.='});'; |
| 875 | 875 | |
| 876 | 876 | $this->jquery_code_for_compile=array(); |
| 877 | - if($this->params["debug"]==false){ |
|
| 877 | + if ($this->params["debug"]==false) { |
|
| 878 | 878 | $script=$this->minify($script); |
| 879 | 879 | } |
| 880 | 880 | $output=($script_tags===FALSE) ? $script : $this->inline($script); |
@@ -896,7 +896,7 @@ discard block |
||
| 896 | 896 | * @return void |
| 897 | 897 | */ |
| 898 | 898 | public function _clear_compile() { |
| 899 | - $this->jquery_code_for_compile=array (); |
|
| 899 | + $this->jquery_code_for_compile=array(); |
|
| 900 | 900 | } |
| 901 | 901 | |
| 902 | 902 | // -------------------------------------------------------------------- |
@@ -908,12 +908,12 @@ discard block |
||
| 908 | 908 | */ |
| 909 | 909 | public function _document_ready($js) { |
| 910 | 910 | if (!is_array($js)) { |
| 911 | - $js=array ( |
|
| 911 | + $js=array( |
|
| 912 | 912 | $js |
| 913 | 913 | ); |
| 914 | 914 | } |
| 915 | 915 | |
| 916 | - foreach ( $js as $script ) { |
|
| 916 | + foreach ($js as $script) { |
|
| 917 | 917 | $this->jquery_code_for_compile[]=$script; |
| 918 | 918 | } |
| 919 | 919 | } |
@@ -929,7 +929,7 @@ discard block |
||
| 929 | 929 | * @return string |
| 930 | 930 | */ |
| 931 | 931 | public function _prep_element($element) { |
| 932 | - if (strrpos($element, 'this')===false&&strrpos($element, 'event')===false&&strrpos($element, 'self')===false) { |
|
| 932 | + if (strrpos($element, 'this')===false && strrpos($element, 'event')===false && strrpos($element, 'self')===false) { |
|
| 933 | 933 | $element='"'.addslashes($element).'"'; |
| 934 | 934 | } |
| 935 | 935 | return $element; |
@@ -947,7 +947,7 @@ discard block |
||
| 947 | 947 | if (is_array($value)) { |
| 948 | 948 | $value=implode(",", $value); |
| 949 | 949 | } |
| 950 | - if (strrpos($value, 'this')===false&&strrpos($value, 'event')===false&&strrpos($value, 'self')===false) { |
|
| 950 | + if (strrpos($value, 'this')===false && strrpos($value, 'event')===false && strrpos($value, 'self')===false) { |
|
| 951 | 951 | $value='"'.$value.'"'; |
| 952 | 952 | } |
| 953 | 953 | return $value; |
@@ -962,8 +962,8 @@ discard block |
||
| 962 | 962 | * @return string |
| 963 | 963 | */ |
| 964 | 964 | private function _validate_speed($speed) { |
| 965 | - if (in_array($speed, array ( |
|
| 966 | - 'slow','normal','fast' |
|
| 965 | + if (in_array($speed, array( |
|
| 966 | + 'slow', 'normal', 'fast' |
|
| 967 | 967 | ))) { |
| 968 | 968 | $speed='"'.$speed.'"'; |
| 969 | 969 | } elseif (preg_match("/[^0-9]/", $speed)) { |
@@ -977,7 +977,7 @@ discard block |
||
| 977 | 977 | $loading_notifier='<div class="ajax-loader">'; |
| 978 | 978 | if ($this->ajaxLoader=='') { |
| 979 | 979 | $loading_notifier.="Loading..."; |
| 980 | - } else { |
|
| 980 | + }else { |
|
| 981 | 981 | $loading_notifier.=$this->ajaxLoader; |
| 982 | 982 | } |
| 983 | 983 | $loading_notifier.='</div>'; |
@@ -985,20 +985,20 @@ discard block |
||
| 985 | 985 | $retour.="\t\t$({$responseElement}).prepend('{$loading_notifier}');\n"; |
| 986 | 986 | } |
| 987 | 987 | |
| 988 | - public function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
|
| 989 | - return $this->_ajax("get", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$immediatly); |
|
| 988 | + public function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) { |
|
| 989 | + return $this->_ajax("get", $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $immediatly); |
|
| 990 | 990 | } |
| 991 | - public function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
|
| 992 | - return $this->_ajax("post", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$immediatly); |
|
| 991 | + public function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) { |
|
| 992 | + return $this->_ajax("post", $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $immediatly); |
|
| 993 | 993 | } |
| 994 | 994 | |
| 995 | - protected function _ajax($method,$url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
|
| 996 | - if(JString::isNull($params)){$params="{}";} |
|
| 995 | + protected function _ajax($method, $url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) { |
|
| 996 | + if (JString::isNull($params)) {$params="{}"; } |
|
| 997 | 997 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
| 998 | 998 | $retour=$this->_getAjaxUrl($url, $attr); |
| 999 | 999 | $responseElement=$this->_getResponseElement($responseElement); |
| 1000 | 1000 | $retour.="var self=this;\n"; |
| 1001 | - if($hasLoader===true){ |
|
| 1001 | + if ($hasLoader===true) { |
|
| 1002 | 1002 | $this->addLoading($retour, $responseElement); |
| 1003 | 1003 | } |
| 1004 | 1004 | $retour.="$.".$method."(url,".$params.").done(function( data ) {\n"; |
@@ -1008,22 +1008,22 @@ discard block |
||
| 1008 | 1008 | return $retour; |
| 1009 | 1009 | } |
| 1010 | 1010 | |
| 1011 | - protected function _getAjaxUrl($url,$attr){ |
|
| 1011 | + protected function _getAjaxUrl($url, $attr) { |
|
| 1012 | 1012 | $url=$this->_correctAjaxUrl($url); |
| 1013 | 1013 | $retour="url='".$url."';\n"; |
| 1014 | 1014 | $slash="/"; |
| 1015 | - if(PhalconUtils::endsWith($url, "/")) |
|
| 1015 | + if (PhalconUtils::endsWith($url, "/")) |
|
| 1016 | 1016 | $slash=""; |
| 1017 | - if(JString::isNotNull($attr)){ |
|
| 1017 | + if (JString::isNotNull($attr)) { |
|
| 1018 | 1018 | if ($attr=="value") |
| 1019 | 1019 | $retour.="url=url+'".$slash."'+$(this).val();\n"; |
| 1020 | - else if($attr!=null && $attr!=="") |
|
| 1020 | + else if ($attr!=null && $attr!=="") |
|
| 1021 | 1021 | $retour.="url=url+'".$slash."'+$(this).attr('".$attr."');\n"; |
| 1022 | 1022 | } |
| 1023 | 1023 | return $retour; |
| 1024 | 1024 | } |
| 1025 | 1025 | |
| 1026 | - protected function _getOnAjaxDone($responseElement,$jsCallback){ |
|
| 1026 | + protected function _getOnAjaxDone($responseElement, $jsCallback) { |
|
| 1027 | 1027 | $retour=""; |
| 1028 | 1028 | if ($responseElement!=="") { |
| 1029 | 1029 | $retour="\t$({$responseElement}).html( data );\n"; |
@@ -1032,7 +1032,7 @@ discard block |
||
| 1032 | 1032 | return $retour; |
| 1033 | 1033 | } |
| 1034 | 1034 | |
| 1035 | - protected function _getResponseElement($responseElement){ |
|
| 1035 | + protected function _getResponseElement($responseElement) { |
|
| 1036 | 1036 | if ($responseElement!=="") { |
| 1037 | 1037 | $responseElement=$this->_prep_value($responseElement); |
| 1038 | 1038 | } |
@@ -1042,7 +1042,7 @@ discard block |
||
| 1042 | 1042 | protected function _correctAjaxUrl($url) { |
| 1043 | 1043 | if (PhalconUtils::endsWith($url, "/")) |
| 1044 | 1044 | $url=substr($url, 0, strlen($url)-1); |
| 1045 | - if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
|
| 1045 | + if (strncmp($url, 'http://', 7)!=0 && strncmp($url, 'https://', 8)!=0) { |
|
| 1046 | 1046 | $url=$this->_di->get("url")->get($url); |
| 1047 | 1047 | } |
| 1048 | 1048 | return $url; |
@@ -1056,7 +1056,7 @@ discard block |
||
| 1056 | 1056 | * @param string $jsCallback javascript code to execute after the request |
| 1057 | 1057 | * @param boolean $immediatly |
| 1058 | 1058 | */ |
| 1059 | - public function _json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document",$immediatly=false) { |
|
| 1059 | + public function _json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document", $immediatly=false) { |
|
| 1060 | 1060 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
| 1061 | 1061 | $retour=$this->_getAjaxUrl($url, $attr); |
| 1062 | 1062 | $retour.="$.{$method}(url,".$params.").done(function( data ) {\n"; |
@@ -1077,7 +1077,7 @@ discard block |
||
| 1077 | 1077 | * @param string $url the request address |
| 1078 | 1078 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true) |
| 1079 | 1079 | */ |
| 1080 | - public function _jsonOn($event,$element, $url,$parameters=array()) { |
|
| 1080 | + public function _jsonOn($event, $element, $url, $parameters=array()) { |
|
| 1081 | 1081 | $preventDefault=true; |
| 1082 | 1082 | $stopPropagation=true; |
| 1083 | 1083 | $jsCallback=null; |
@@ -1087,7 +1087,7 @@ discard block |
||
| 1087 | 1087 | $params="{}"; |
| 1088 | 1088 | $immediatly=true; |
| 1089 | 1089 | extract($parameters); |
| 1090 | - return $this->_add_event($element, $this->_json($url,$method, $params,$jsCallback, $attr,$context), $event, $preventDefault, $stopPropagation,$immediatly); |
|
| 1090 | + return $this->_add_event($element, $this->_json($url, $method, $params, $jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation, $immediatly); |
|
| 1091 | 1091 | } |
| 1092 | 1092 | |
| 1093 | 1093 | /** |
@@ -1099,19 +1099,19 @@ discard block |
||
| 1099 | 1099 | * @param string $context jquery DOM element, array container. |
| 1100 | 1100 | * @param boolean $immediatly |
| 1101 | 1101 | */ |
| 1102 | - public function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context=null,$immediatly=false) { |
|
| 1102 | + public function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context=null, $immediatly=false) { |
|
| 1103 | 1103 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
| 1104 | 1104 | $retour=$this->_getAjaxUrl($url, $attr); |
| 1105 | - if($context===null){ |
|
| 1105 | + if ($context===null) { |
|
| 1106 | 1106 | $appendTo="\t\tnewElm.appendTo($('".$maskSelector."').parent());\n"; |
| 1107 | - $newElm = "$('#'+newId)"; |
|
| 1108 | - }else{ |
|
| 1107 | + $newElm="$('#'+newId)"; |
|
| 1108 | + }else { |
|
| 1109 | 1109 | $appendTo="\t\tnewElm.appendTo(".$context.");\n"; |
| 1110 | - $newElm = $context.".find('#'+newId)"; |
|
| 1110 | + $newElm=$context.".find('#'+newId)"; |
|
| 1111 | 1111 | } |
| 1112 | 1112 | $retour.="var self = $(this);\n$.{$method}(url,".$params.").done(function( data ) {\n"; |
| 1113 | 1113 | $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=".$newElm.";\n"."\tif(!newElm.length){\n"."\t\tnewElm=maskElm.clone();newElm.attr('id',newId);\n"; |
| 1114 | - $retour.= $appendTo; |
|
| 1114 | + $retour.=$appendTo; |
|
| 1115 | 1115 | $retour.="\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"."\t$(newElm).removeClass('hide');"."});\n"; |
| 1116 | 1116 | $retour.="\t$(document).trigger('jsonReady',[data]);\n"; |
| 1117 | 1117 | $retour.="\t".$jsCallback."\n"."});\n"; |
@@ -1126,26 +1126,26 @@ discard block |
||
| 1126 | 1126 | * @param string $url the request address |
| 1127 | 1127 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get", "context"=>null) |
| 1128 | 1128 | */ |
| 1129 | - public function _jsonArrayOn($event,$element, $maskSelector,$url,$parameters=array()) { |
|
| 1129 | + public function _jsonArrayOn($event, $element, $maskSelector, $url, $parameters=array()) { |
|
| 1130 | 1130 | $preventDefault=true; |
| 1131 | 1131 | $stopPropagation=true; |
| 1132 | 1132 | $jsCallback=null; |
| 1133 | 1133 | $attr="id"; |
| 1134 | 1134 | $method="get"; |
| 1135 | - $context = null; |
|
| 1135 | + $context=null; |
|
| 1136 | 1136 | $params="{}"; |
| 1137 | 1137 | $immediatly=true; |
| 1138 | 1138 | extract($parameters); |
| 1139 | - return $this->_add_event($element, $this->_jsonArray($maskSelector,$url,$method, $params,$jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation,$immediatly); |
|
| 1139 | + return $this->_add_event($element, $this->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation, $immediatly); |
|
| 1140 | 1140 | } |
| 1141 | 1141 | |
| 1142 | - public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
|
| 1142 | + public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) { |
|
| 1143 | 1143 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
| 1144 | 1144 | $retour=$this->_getAjaxUrl($url, $attr); |
| 1145 | 1145 | $retour.="\nvar params=$('#".$form."').serialize();\n"; |
| 1146 | 1146 | $responseElement=$this->_getResponseElement($responseElement); |
| 1147 | 1147 | $retour.="var self=this;\n"; |
| 1148 | - if($hasLoader===true){ |
|
| 1148 | + if ($hasLoader===true) { |
|
| 1149 | 1149 | $this->addLoading($retour, $responseElement); |
| 1150 | 1150 | } |
| 1151 | 1151 | $retour.="$.post(url,params).done(function( data ) {\n"; |
@@ -1172,7 +1172,7 @@ discard block |
||
| 1172 | 1172 | * @param string $responseElement |
| 1173 | 1173 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true) |
| 1174 | 1174 | */ |
| 1175 | - public function _getOn($event,$element, $url, $params="{}", $responseElement="", $parameters=array()) { |
|
| 1175 | + public function _getOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) { |
|
| 1176 | 1176 | $preventDefault=true; |
| 1177 | 1177 | $stopPropagation=true; |
| 1178 | 1178 | $jsCallback=null; |
@@ -1180,7 +1180,7 @@ discard block |
||
| 1180 | 1180 | $hasLoader=true; |
| 1181 | 1181 | $immediatly=true; |
| 1182 | 1182 | extract($parameters); |
| 1183 | - return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr,$hasLoader), $event, $preventDefault, $stopPropagation,$immediatly); |
|
| 1183 | + return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr, $hasLoader), $event, $preventDefault, $stopPropagation, $immediatly); |
|
| 1184 | 1184 | } |
| 1185 | 1185 | |
| 1186 | 1186 | /** |
@@ -1193,7 +1193,7 @@ discard block |
||
| 1193 | 1193 | * @param string $responseElement |
| 1194 | 1194 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true) |
| 1195 | 1195 | */ |
| 1196 | - public function _postOn($event,$element, $url, $params="{}", $responseElement="", $parameters=array()) { |
|
| 1196 | + public function _postOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) { |
|
| 1197 | 1197 | $preventDefault=true; |
| 1198 | 1198 | $stopPropagation=true; |
| 1199 | 1199 | $jsCallback=null; |
@@ -1201,7 +1201,7 @@ discard block |
||
| 1201 | 1201 | $hasLoader=true; |
| 1202 | 1202 | $immediatly=true; |
| 1203 | 1203 | extract($parameters); |
| 1204 | - return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr,$hasLoader), $event, $preventDefault, $stopPropagation,$immediatly); |
|
| 1204 | + return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader), $event, $preventDefault, $stopPropagation, $immediatly); |
|
| 1205 | 1205 | } |
| 1206 | 1206 | |
| 1207 | 1207 | /** |
@@ -1214,7 +1214,7 @@ discard block |
||
| 1214 | 1214 | * @param string $responseElement |
| 1215 | 1215 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true) |
| 1216 | 1216 | */ |
| 1217 | - public function _postFormOn($event,$element, $url, $form, $responseElement="", $parameters=array()) { |
|
| 1217 | + public function _postFormOn($event, $element, $url, $form, $responseElement="", $parameters=array()) { |
|
| 1218 | 1218 | $preventDefault=true; |
| 1219 | 1219 | $stopPropagation=true; |
| 1220 | 1220 | $validation=false; |
@@ -1223,7 +1223,7 @@ discard block |
||
| 1223 | 1223 | $hasLoader=true; |
| 1224 | 1224 | $immediatly=true; |
| 1225 | 1225 | extract($parameters); |
| 1226 | - return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr,$hasLoader), $event, $preventDefault, $stopPropagation,$immediatly); |
|
| 1226 | + return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader), $event, $preventDefault, $stopPropagation, $immediatly); |
|
| 1227 | 1227 | } |
| 1228 | 1228 | |
| 1229 | 1229 | /** |
@@ -1259,8 +1259,8 @@ discard block |
||
| 1259 | 1259 | * @param boolean $immediatly |
| 1260 | 1260 | * @return string |
| 1261 | 1261 | */ |
| 1262 | - public function _doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param="", $preventDefault=false, $stopPropagation=false, $jsCallback="",$immediatly=true) { |
|
| 1263 | - return $this->_add_event($element, $this->_doJQuery($elementToModify, $jqueryCall, $param, $jsCallback), $event, $preventDefault, $stopPropagation,$immediatly); |
|
| 1262 | + public function _doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param="", $preventDefault=false, $stopPropagation=false, $jsCallback="", $immediatly=true) { |
|
| 1263 | + return $this->_add_event($element, $this->_doJQuery($elementToModify, $jqueryCall, $param, $jsCallback), $event, $preventDefault, $stopPropagation, $immediatly); |
|
| 1264 | 1264 | } |
| 1265 | 1265 | |
| 1266 | 1266 | /** |
@@ -1286,12 +1286,12 @@ discard block |
||
| 1286 | 1286 | * @param boolean $immediatly |
| 1287 | 1287 | * @return String |
| 1288 | 1288 | */ |
| 1289 | - public function _execOn($element, $event, $js, $preventDefault=false, $stopPropagation=false,$immediatly=true) { |
|
| 1290 | - return $this->_add_event($element, $this->_exec($js), $event, $preventDefault, $stopPropagation,$immediatly); |
|
| 1289 | + public function _execOn($element, $event, $js, $preventDefault=false, $stopPropagation=false, $immediatly=true) { |
|
| 1290 | + return $this->_add_event($element, $this->_exec($js), $event, $preventDefault, $stopPropagation, $immediatly); |
|
| 1291 | 1291 | } |
| 1292 | 1292 | |
| 1293 | 1293 | private function minify($input) { |
| 1294 | - if(trim($input) === "") return $input; |
|
| 1294 | + if (trim($input)==="") return $input; |
|
| 1295 | 1295 | return preg_replace( |
| 1296 | 1296 | array( |
| 1297 | 1297 | // Remove comment(s) |
@@ -41,15 +41,15 @@ discard block |
||
| 41 | 41 | * @param boolean $autoActive sets the last element's class to <b>active</b> if true |
| 42 | 42 | * @param function $hrefFunction the function who generates the href elements. default : function($e){return $e->getContent()} |
| 43 | 43 | */ |
| 44 | - public function __construct($identifier,$elements=array(),$autoActive=true,$startIndex=0,$hrefFunction=NULL){ |
|
| 45 | - parent::__construct($identifier,"ol"); |
|
| 44 | + public function __construct($identifier, $elements=array(), $autoActive=true, $startIndex=0, $hrefFunction=NULL) { |
|
| 45 | + parent::__construct($identifier, "ol"); |
|
| 46 | 46 | $this->startIndex=$startIndex; |
| 47 | 47 | $this->setProperty("class", "breadcrumb"); |
| 48 | 48 | $this->content=array(); |
| 49 | 49 | $this->autoActive=$autoActive; |
| 50 | 50 | $this->absolutePaths; |
| 51 | - $this->_hrefFunction=function ($e){return $e->getContent();}; |
|
| 52 | - if(isset($hrefFunction)){ |
|
| 51 | + $this->_hrefFunction=function($e) {return $e->getContent(); }; |
|
| 52 | + if (isset($hrefFunction)) { |
|
| 53 | 53 | $this->_hrefFunction=$hrefFunction; |
| 54 | 54 | } |
| 55 | 55 | $this->addElements($elements); |
@@ -60,43 +60,43 @@ discard block |
||
| 60 | 60 | * @param string $href |
| 61 | 61 | * @return \Ajax\bootstrap\html\HtmlLink |
| 62 | 62 | */ |
| 63 | - public function addElement($element,$href="",$glyph=NULL){ |
|
| 63 | + public function addElement($element, $href="", $glyph=NULL) { |
|
| 64 | 64 | $size=sizeof($this->content); |
| 65 | - if(is_array($element)){ |
|
| 65 | + if (is_array($element)) { |
|
| 66 | 66 | $elm=new HtmlLink("lnk-".$this->identifier."-".$size); |
| 67 | 67 | $elm->fromArray($element); |
| 68 | - }else if($element instanceof HtmlLink){ |
|
| 68 | + }else if ($element instanceof HtmlLink) { |
|
| 69 | 69 | $elm=$element; |
| 70 | - }else{ |
|
| 71 | - $elm=new HtmlLink("lnk-".$this->identifier."-".$size,$href,$element); |
|
| 72 | - if(isset($glyph)){ |
|
| 70 | + }else { |
|
| 71 | + $elm=new HtmlLink("lnk-".$this->identifier."-".$size, $href, $element); |
|
| 72 | + if (isset($glyph)) { |
|
| 73 | 73 | $elm->wrapContentWithGlyph($glyph); |
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | - $elm->wrap("<li>","</li>"); |
|
| 76 | + $elm->wrap("<li>", "</li>"); |
|
| 77 | 77 | $this->content[]=$elm; |
| 78 | 78 | $elm->setProperty($this->attr, $this->getHref($size)); |
| 79 | 79 | return $elm; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - public function setActive($index=null){ |
|
| 83 | - if(!isset($index)){ |
|
| 82 | + public function setActive($index=null) { |
|
| 83 | + if (!isset($index)) { |
|
| 84 | 84 | $index=sizeof($this->content)-1; |
| 85 | 85 | } |
| 86 | - $li=new HtmlDoubleElement("","li"); |
|
| 86 | + $li=new HtmlDoubleElement("", "li"); |
|
| 87 | 87 | $li->setClass("active"); |
| 88 | 88 | $li->setContent($this->content[$index]->getContent()); |
| 89 | 89 | $this->content[$index]=$li; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - public function addElements($elements){ |
|
| 93 | - foreach ( $elements as $element ) { |
|
| 92 | + public function addElements($elements) { |
|
| 93 | + foreach ($elements as $element) { |
|
| 94 | 94 | $this->addElement($element); |
| 95 | 95 | } |
| 96 | 96 | return $this; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - public function fromArray($array){ |
|
| 99 | + public function fromArray($array) { |
|
| 100 | 100 | $array=parent::fromArray($array); |
| 101 | 101 | $this->addElements($array); |
| 102 | 102 | return $array; |
@@ -108,14 +108,14 @@ discard block |
||
| 108 | 108 | * @param string $separator |
| 109 | 109 | * @return string |
| 110 | 110 | */ |
| 111 | - public function getHref($index=null,$separator="/"){ |
|
| 112 | - if(!isset($index)){ |
|
| 111 | + public function getHref($index=null, $separator="/") { |
|
| 112 | + if (!isset($index)) { |
|
| 113 | 113 | $index=sizeof($this->content); |
| 114 | 114 | } |
| 115 | - if($this->absolutePaths===true){ |
|
| 115 | + if ($this->absolutePaths===true) { |
|
| 116 | 116 | return $this->_hrefFunction($this->content[$index]); |
| 117 | - }else{ |
|
| 118 | - return $this->root.implode($separator, array_slice(array_map(function($e){return $this->_hrefFunction($e);}, $this->content),$this->startIndex,$index+1)); |
|
| 117 | + }else { |
|
| 118 | + return $this->root.implode($separator, array_slice(array_map(function($e) {return $this->_hrefFunction($e); }, $this->content), $this->startIndex, $index+1)); |
|
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * @see \Ajax\bootstrap\html\BaseHtml::compile() |
| 125 | 125 | */ |
| 126 | 126 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
| 127 | - if($this->autoActive){ |
|
| 127 | + if ($this->autoActive) { |
|
| 128 | 128 | $this->setActive(); |
| 129 | 129 | } |
| 130 | 130 | return parent::compile($js, $view); |
@@ -142,19 +142,19 @@ discard block |
||
| 142 | 142 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
| 143 | 143 | */ |
| 144 | 144 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
| 145 | - foreach ($this->content as $element){ |
|
| 146 | - $element->on($event,$jsCode,$stopPropagation,$preventDefault); |
|
| 145 | + foreach ($this->content as $element) { |
|
| 146 | + $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
|
| 147 | 147 | } |
| 148 | 148 | return $this; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | public function setAutoActive($autoActive) { |
| 152 | - $this->autoActive = $autoActive; |
|
| 152 | + $this->autoActive=$autoActive; |
|
| 153 | 153 | return $this; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
| 157 | - foreach ($this->content as $element){ |
|
| 157 | + foreach ($this->content as $element) { |
|
| 158 | 158 | $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
| 159 | 159 | } |
| 160 | 160 | return $this; |
@@ -167,18 +167,18 @@ discard block |
||
| 167 | 167 | * @param string $attr the html attribute used to build the elements url |
| 168 | 168 | * @return HtmlBreadcrumbs |
| 169 | 169 | */ |
| 170 | - public function autoGetOnClick($targetSelector){ |
|
| 171 | - return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
|
| 170 | + public function autoGetOnClick($targetSelector) { |
|
| 171 | + return $this->getOnClick($this->root, $targetSelector, array("attr"=>$this->attr)); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - public function contentAsString(){ |
|
| 175 | - if($this->autoActive){ |
|
| 174 | + public function contentAsString() { |
|
| 175 | + if ($this->autoActive) { |
|
| 176 | 176 | $this->setActive(); |
| 177 | 177 | } |
| 178 | 178 | return parent::contentAsString(); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - public function getElement($index){ |
|
| 181 | + public function getElement($index) { |
|
| 182 | 182 | return $this->content[$index]; |
| 183 | 183 | } |
| 184 | 184 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | * @param mixed $glyph |
| 188 | 188 | * @param int $index |
| 189 | 189 | */ |
| 190 | - public function addGlyph($glyph,$index=0){ |
|
| 190 | + public function addGlyph($glyph, $index=0) { |
|
| 191 | 191 | $elm=$this->getElement($index); |
| 192 | 192 | return $elm->wrapContentWithGlyph($glyph); |
| 193 | 193 | } |
@@ -197,13 +197,13 @@ discard block |
||
| 197 | 197 | * @param Dispatcher $dispatcher the request dispatcher |
| 198 | 198 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
| 199 | 199 | */ |
| 200 | - public function fromDispatcher($dispatcher){ |
|
| 200 | + public function fromDispatcher($dispatcher) { |
|
| 201 | 201 | $params=$dispatcher->getParams(); |
| 202 | 202 | $action=$dispatcher->getActionName(); |
| 203 | 203 | $items=array($dispatcher->getControllerName()); |
| 204 | - if(\sizeof($params)>0 || \strtolower($action)!="index" ){ |
|
| 204 | + if (\sizeof($params)>0 || \strtolower($action)!="index") { |
|
| 205 | 205 | $items[]=$action; |
| 206 | - $items=array_merge($items,$params); |
|
| 206 | + $items=array_merge($items, $params); |
|
| 207 | 207 | } |
| 208 | 208 | return $this->addElements($items); |
| 209 | 209 | } |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
| 216 | 216 | */ |
| 217 | 217 | public function setHrefFunction($_hrefFunction) { |
| 218 | - $this->_hrefFunction = $_hrefFunction; |
|
| 218 | + $this->_hrefFunction=$_hrefFunction; |
|
| 219 | 219 | return $this; |
| 220 | 220 | } |
| 221 | 221 | |
@@ -32,12 +32,12 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | public function addContent($content) { |
| 34 | 34 | if (is_array($this->content)===false) { |
| 35 | - $newContent=array (); |
|
| 35 | + $newContent=array(); |
|
| 36 | 36 | if (isset($this->content)) |
| 37 | 37 | $newContent []=$this->content; |
| 38 | 38 | $newContent []=$content; |
| 39 | 39 | $this->content=$newContent; |
| 40 | - } else { |
|
| 40 | + }else { |
|
| 41 | 41 | $this->content []=$content; |
| 42 | 42 | } |
| 43 | 43 | return $this; |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | parent::run($js); |
| 52 | 52 | if ($this->content instanceof HtmlDoubleElement) { |
| 53 | 53 | $this->content->run($js); |
| 54 | - } else if (is_array($this->content)) { |
|
| 55 | - foreach ( $this->content as $itemContent ) { |
|
| 54 | + }else if (is_array($this->content)) { |
|
| 55 | + foreach ($this->content as $itemContent) { |
|
| 56 | 56 | if ($itemContent instanceof HtmlDoubleElement) { |
| 57 | 57 | $itemContent->run($js); |
| 58 | 58 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | return $this; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - public function addGlyph($glyphicon,$index=0){ |
|
| 77 | + public function addGlyph($glyphicon, $index=0) { |
|
| 78 | 78 | $glyph=new HtmlGlyphicon(""); |
| 79 | 79 | $glyph->setGlyphicon($glyphicon); |
| 80 | 80 | $this->addContent($glyph); |
@@ -90,12 +90,12 @@ discard block |
||
| 90 | 90 | return $this; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - public function wrapContentWithGlyph($glyphBefore,$glyphAfter=""){ |
|
| 93 | + public function wrapContentWithGlyph($glyphBefore, $glyphAfter="") { |
|
| 94 | 94 | $before=HtmlGlyphicon::getGlyphicon($glyphBefore)." "; |
| 95 | 95 | $after=""; |
| 96 | - if($glyphAfter!==""){ |
|
| 96 | + if ($glyphAfter!=="") { |
|
| 97 | 97 | $after=" ".HtmlGlyphicon::getGlyphicon($glyphAfter); |
| 98 | 98 | } |
| 99 | - return $this->wrapContent($before,$after); |
|
| 99 | + return $this->wrapContent($before, $after); |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | \ No newline at end of file |
@@ -29,11 +29,11 @@ discard block |
||
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public function setActive($value) { |
| 32 | - if(is_array($this->content)){ |
|
| 33 | - foreach ($this->content as $pb){ |
|
| 32 | + if (is_array($this->content)) { |
|
| 33 | + foreach ($this->content as $pb) { |
|
| 34 | 34 | $pb->setActive($value); |
| 35 | 35 | } |
| 36 | - }else{ |
|
| 36 | + }else { |
|
| 37 | 37 | if ($value===true) |
| 38 | 38 | $this->active="active"; |
| 39 | 39 | else |
@@ -43,11 +43,11 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | public function setStriped($value) { |
| 46 | - if(is_array($this->content)){ |
|
| 47 | - foreach ($this->content as $pb){ |
|
| 46 | + if (is_array($this->content)) { |
|
| 47 | + foreach ($this->content as $pb) { |
|
| 48 | 48 | $pb->setStriped($value); |
| 49 | 49 | } |
| 50 | - }else{ |
|
| 50 | + }else { |
|
| 51 | 51 | if ($value===true) |
| 52 | 52 | $this->striped="progress-bar-striped"; |
| 53 | 53 | else |
@@ -57,11 +57,11 @@ discard block |
||
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | public function showCaption($value) { |
| 60 | - if(is_array($this->content)){ |
|
| 61 | - foreach ($this->content as $pb){ |
|
| 60 | + if (is_array($this->content)) { |
|
| 61 | + foreach ($this->content as $pb) { |
|
| 62 | 62 | $pb->showCaption($value); |
| 63 | 63 | } |
| 64 | - }else{ |
|
| 64 | + }else { |
|
| 65 | 65 | if ($value===true) |
| 66 | 66 | $this->caption="%value%%"; |
| 67 | 67 | else |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $progressBar->setStriped($this->striped!=="" || $progressBar->isStriped()); |
| 82 | 82 | $progressBar->setActive($this->active==="active" || $progressBar->isActive()); |
| 83 | 83 | if (is_array($this->content)===false) { |
| 84 | - $this->content=array (); |
|
| 84 | + $this->content=array(); |
|
| 85 | 85 | } |
| 86 | 86 | $this->content []=$progressBar; |
| 87 | 87 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | * @return \Ajax\bootstrap\html\HtmlProgressbar default : "" |
| 126 | 126 | */ |
| 127 | 127 | public function setStyle($cssStyle) { |
| 128 | - return $this->setMemberCtrl($this->style,CssRef::getStyle($cssStyle, "progress-bar"), CssRef::Styles("progress-bar")); |
|
| 128 | + return $this->setMemberCtrl($this->style, CssRef::getStyle($cssStyle, "progress-bar"), CssRef::Styles("progress-bar")); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /* |
@@ -134,10 +134,10 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
| 136 | 136 | $actualStyle=$this->style; |
| 137 | - if(isset($this->styleLimits)&& JArray::isAssociative($this->styleLimits)){ |
|
| 138 | - foreach ($this->styleLimits as $k=>$v){ |
|
| 137 | + if (isset($this->styleLimits) && JArray::isAssociative($this->styleLimits)) { |
|
| 138 | + foreach ($this->styleLimits as $k=>$v) { |
|
| 139 | 139 | $actualStyle=$k; |
| 140 | - if($v>=$this->value) |
|
| 140 | + if ($v>=$this->value) |
|
| 141 | 141 | break; |
| 142 | 142 | else |
| 143 | 143 | $actualStyle=$this->style; |
@@ -269,8 +269,8 @@ discard block |
||
| 269 | 269 | * @param string $tagName container tagName |
| 270 | 270 | * @return HtmlListgroup |
| 271 | 271 | */ |
| 272 | - public function htmlListgroup($identifier,$items=array(),$tagName="ul"){ |
|
| 273 | - $listGroup=new HtmlListgroup($identifier,$tagName); |
|
| 272 | + public function htmlListgroup($identifier, $items=array(), $tagName="ul") { |
|
| 273 | + $listGroup=new HtmlListgroup($identifier, $tagName); |
|
| 274 | 274 | $listGroup->addItems($items); |
| 275 | 275 | return $this->addHtmlComponent($listGroup); |
| 276 | 276 | } |
@@ -295,8 +295,8 @@ discard block |
||
| 295 | 295 | * @param string $onClick |
| 296 | 296 | * @return HtmlSplitbutton |
| 297 | 297 | */ |
| 298 | - public function htmlSplitbutton($identifier,$value="", $items=array(), $cssStyle="btn-default", $onClick=NULL) { |
|
| 299 | - return $this->addHtmlComponent(new HtmlSplitbutton($identifier, $value, $items, $cssStyle,$onClick)); |
|
| 298 | + public function htmlSplitbutton($identifier, $value="", $items=array(), $cssStyle="btn-default", $onClick=NULL) { |
|
| 299 | + return $this->addHtmlComponent(new HtmlSplitbutton($identifier, $value, $items, $cssStyle, $onClick)); |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | /** |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | * @param string $identifier |
| 305 | 305 | * @return HtmlInputgroup |
| 306 | 306 | */ |
| 307 | - public function htmlInputgroup($identifier){ |
|
| 307 | + public function htmlInputgroup($identifier) { |
|
| 308 | 308 | return $this->addHtmlComponent(new HtmlInputgroup($identifier)); |
| 309 | 309 | } |
| 310 | 310 | |
@@ -316,8 +316,8 @@ discard block |
||
| 316 | 316 | * @param function $hrefFunction the function who generates the href elements. default : function($e){return $e->getContent()} |
| 317 | 317 | * @return HtmlBreadcrumbs |
| 318 | 318 | */ |
| 319 | - public function htmlBreadcrumbs($identifier,$elements=array(),$autoActive=true,$startIndex=0,$hrefFunction=NULL){ |
|
| 320 | - return $this->addHtmlComponent(new HtmlBreadcrumbs($identifier,$elements,$autoActive,$startIndex,$hrefFunction)); |
|
| 319 | + public function htmlBreadcrumbs($identifier, $elements=array(), $autoActive=true, $startIndex=0, $hrefFunction=NULL) { |
|
| 320 | + return $this->addHtmlComponent(new HtmlBreadcrumbs($identifier, $elements, $autoActive, $startIndex, $hrefFunction)); |
|
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | /** |
@@ -329,8 +329,8 @@ discard block |
||
| 329 | 329 | * @param int $active The active page |
| 330 | 330 | * @return HtmlPagination |
| 331 | 331 | */ |
| 332 | - public function htmlPagination($identifier,$from=1,$to=1,$active=NULL,$countVisible=NULL){ |
|
| 333 | - return $this->addHtmlComponent(new HtmlPagination($identifier,$from,$to,$active,$countVisible)); |
|
| 332 | + public function htmlPagination($identifier, $from=1, $to=1, $active=NULL, $countVisible=NULL) { |
|
| 333 | + return $this->addHtmlComponent(new HtmlPagination($identifier, $from, $to, $active, $countVisible)); |
|
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | /** |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | * @param int $numCols |
| 342 | 342 | * @return HtmlGridSystem |
| 343 | 343 | */ |
| 344 | - public function htmlGridSystem($identifier,$numRows=1,$numCols=NULL){ |
|
| 345 | - return $this->addHtmlComponent(new HtmlGridSystem($identifier,$numRows,$numCols)); |
|
| 344 | + public function htmlGridSystem($identifier, $numRows=1, $numCols=NULL) { |
|
| 345 | + return $this->addHtmlComponent(new HtmlGridSystem($identifier, $numRows, $numCols)); |
|
| 346 | 346 | } |
| 347 | 347 | } |
| 348 | 348 | \ No newline at end of file |