@@ -20,6 +20,9 @@ |
||
20 | 20 | protected $_tabsType="tabs"; |
21 | 21 | protected $stacked=""; |
22 | 22 | |
23 | + /** |
|
24 | + * @param string $identifier |
|
25 | + */ |
|
23 | 26 | public function __construct($identifier, $tagName="ul") { |
24 | 27 | parent::__construct($identifier, $tagName); |
25 | 28 | $this->_template="<%tagName% %properties%>%tabs%</%tagName%>%content%"; |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | use Phalcon\Mvc\View; |
17 | 17 | |
18 | 18 | class HtmlTabs extends HtmlDoubleElement { |
19 | - protected $tabs=array (); |
|
19 | + protected $tabs=array(); |
|
20 | 20 | protected $_tabsType="tabs"; |
21 | 21 | protected $stacked=""; |
22 | 22 | |
@@ -27,25 +27,25 @@ discard block |
||
27 | 27 | } |
28 | 28 | |
29 | 29 | protected function addTab_($tab, $index=null) { |
30 | - if($tab instanceof HtmlDropdown){ |
|
30 | + if ($tab instanceof HtmlDropdown) { |
|
31 | 31 | $tab->setMTagName("li"); |
32 | 32 | } |
33 | 33 | if (isset($index)) { |
34 | - $inserted=array ( |
|
34 | + $inserted=array( |
|
35 | 35 | $tab |
36 | 36 | ); |
37 | 37 | array_splice($this->tabs, $index, 0, $inserted); |
38 | - } else |
|
38 | + }else |
|
39 | 39 | $this->tabs []=$tab; |
40 | 40 | } |
41 | 41 | |
42 | - public function setActive($index){ |
|
43 | - for ($i=0;$i<sizeof($this->tabs);$i++){ |
|
42 | + public function setActive($index) { |
|
43 | + for ($i=0; $i<sizeof($this->tabs); $i++) { |
|
44 | 44 | $this->tabs[$i]->setActive($i==$index); |
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
48 | - public function disable($index){ |
|
48 | + public function disable($index) { |
|
49 | 49 | $this->tabs[$index]->disable(); |
50 | 50 | } |
51 | 51 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $tab=new HtmlTabItem("tab-".$this->identifier."-".$iid); |
60 | 60 | $tab->fromArray($element); |
61 | 61 | $this->addTab_($tab, $index); |
62 | - } else { |
|
62 | + }else { |
|
63 | 63 | $this->addTab_($tab, $index); |
64 | 64 | } |
65 | 65 | return $tab; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | } |
77 | 77 | |
78 | 78 | public function addTabs($tabs) { |
79 | - foreach ( $tabs as $tab ) { |
|
79 | + foreach ($tabs as $tab) { |
|
80 | 80 | $this->addTab($tab); |
81 | 81 | } |
82 | 82 | return $this; |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function run(JsUtils $js) { |
108 | 108 | $this->_bsComponent=new Tabs($js); |
109 | - foreach ( $this->tabs as $tab ) { |
|
109 | + foreach ($this->tabs as $tab) { |
|
110 | 110 | $this->_bsComponent->addTab($tab->run($js)); |
111 | 111 | } |
112 | 112 | $this->addEventsOnRun($js); |
@@ -115,11 +115,11 @@ discard block |
||
115 | 115 | |
116 | 116 | public function createTabContents() { |
117 | 117 | $tabContent=new HtmlTabContent("tabcontent-".$this->identifier); |
118 | - foreach ( $this->tabs as $tab ) { |
|
118 | + foreach ($this->tabs as $tab) { |
|
119 | 119 | if ($tab instanceof HtmlTabItem) |
120 | 120 | $tabContent->addTabItem($tab->getHref()); |
121 | 121 | elseif ($tab instanceof HtmlDropdown) { |
122 | - foreach ( $tab->getItems() as $dropdownItem ) { |
|
122 | + foreach ($tab->getItems() as $dropdownItem) { |
|
123 | 123 | $tabContent->addTabItem($dropdownItem->getHref()); |
124 | 124 | } |
125 | 125 | } |
@@ -154,21 +154,21 @@ discard block |
||
154 | 154 | if (sizeof($this->content->getTabItems())>0) { |
155 | 155 | $this->content->getTabItem(0)->addToProperty("class", "fade in"); |
156 | 156 | $size=sizeof($this->tabs); |
157 | - for($index=0; $index<$size; $index++) { |
|
157 | + for ($index=0; $index<$size; $index++) { |
|
158 | 158 | $this->content->getTabItem($index)->addToProperty("class", "fade"); |
159 | 159 | } |
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
163 | - public function on($event, $jsCode,$stopPropagation=false,$preventDefault=false){ |
|
164 | - foreach ($this->tabs as $tab){ |
|
165 | - $tab->on($event,$jsCode,$stopPropagation,$preventDefault); |
|
163 | + public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
|
164 | + foreach ($this->tabs as $tab) { |
|
165 | + $tab->on($event, $jsCode, $stopPropagation, $preventDefault); |
|
166 | 166 | } |
167 | 167 | return $this; |
168 | 168 | } |
169 | 169 | |
170 | - public function setStacked($stacked=true){ |
|
171 | - if($stacked) |
|
170 | + public function setStacked($stacked=true) { |
|
171 | + if ($stacked) |
|
172 | 172 | $this->stacked="nav-stacked"; |
173 | 173 | else $this->stacked=""; |
174 | 174 | } |
@@ -35,8 +35,9 @@ discard block |
||
35 | 35 | $tab |
36 | 36 | ); |
37 | 37 | array_splice($this->tabs, $index, 0, $inserted); |
38 | - } else |
|
39 | - $this->tabs []=$tab; |
|
38 | + } else { |
|
39 | + $this->tabs []=$tab; |
|
40 | + } |
|
40 | 41 | } |
41 | 42 | |
42 | 43 | public function setActive($index){ |
@@ -116,9 +117,9 @@ discard block |
||
116 | 117 | public function createTabContents() { |
117 | 118 | $tabContent=new HtmlTabContent("tabcontent-".$this->identifier); |
118 | 119 | foreach ( $this->tabs as $tab ) { |
119 | - if ($tab instanceof HtmlTabItem) |
|
120 | - $tabContent->addTabItem($tab->getHref()); |
|
121 | - elseif ($tab instanceof HtmlDropdown) { |
|
120 | + if ($tab instanceof HtmlTabItem) { |
|
121 | + $tabContent->addTabItem($tab->getHref()); |
|
122 | + } elseif ($tab instanceof HtmlDropdown) { |
|
122 | 123 | foreach ( $tab->getItems() as $dropdownItem ) { |
123 | 124 | $tabContent->addTabItem($dropdownItem->getHref()); |
124 | 125 | } |
@@ -137,8 +138,9 @@ discard block |
||
137 | 138 | |
138 | 139 | public function setContentToTab($index, $text) { |
139 | 140 | $tabContentItem=$this->content->getTabItem($index); |
140 | - if (isset($tabContentItem)) |
|
141 | - $tabContentItem->setContent($text); |
|
141 | + if (isset($tabContentItem)) { |
|
142 | + $tabContentItem->setContent($text); |
|
143 | + } |
|
142 | 144 | } |
143 | 145 | |
144 | 146 | public function countTabs() { |
@@ -146,8 +148,9 @@ discard block |
||
146 | 148 | } |
147 | 149 | |
148 | 150 | public function getTabItem($index) { |
149 | - if ($index<sizeof($this->content->get)) |
|
150 | - return $this->content; |
|
151 | + if ($index<sizeof($this->content->get)) { |
|
152 | + return $this->content; |
|
153 | + } |
|
151 | 154 | } |
152 | 155 | |
153 | 156 | public function fadeEffect() { |
@@ -168,9 +171,11 @@ discard block |
||
168 | 171 | } |
169 | 172 | |
170 | 173 | public function setStacked($stacked=true){ |
171 | - if($stacked) |
|
172 | - $this->stacked="nav-stacked"; |
|
173 | - else $this->stacked=""; |
|
174 | + if($stacked) { |
|
175 | + $this->stacked="nav-stacked"; |
|
176 | + } else { |
|
177 | + $this->stacked=""; |
|
178 | + } |
|
174 | 179 | } |
175 | 180 | |
176 | 181 | /* (non-PHPdoc) |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Ajax\bootstrap\html\phalcon\PhBsElement; |
6 | 6 | use Phalcon\Forms\Element\Select; |
7 | -use Ajax\bootstrap\html\base\HtmlDoubleElement; |
|
8 | 7 | use Ajax\bootstrap\html\html5\HtmlSelect; |
9 | 8 | |
10 | 9 | class PhBsSelect extends PhBsElement { |
@@ -13,7 +13,7 @@ |
||
13 | 13 | parent::__construct($name, $attributes); |
14 | 14 | $list=new HtmlSelect($name); |
15 | 15 | $list->setTagName("select"); |
16 | - $this->renderer=new PhBsRenderer(new Select($name, array (), $attributes), $list); |
|
16 | + $this->renderer=new PhBsRenderer(new Select($name, array(), $attributes), $list); |
|
17 | 17 | $this->setOptions($options); |
18 | 18 | } |
19 | 19 |
@@ -676,6 +676,9 @@ discard block |
||
676 | 676 | return $this->_create_json($json_result, $match_array_type); |
677 | 677 | } |
678 | 678 | |
679 | + /** |
|
680 | + * @param boolean $match_array_type |
|
681 | + */ |
|
679 | 682 | private function _create_json($json_result, $match_array_type) { |
680 | 683 | $json=array (); |
681 | 684 | $_is_assoc=TRUE; |
@@ -699,7 +702,7 @@ discard block |
||
699 | 702 | * Checks for an associative array |
700 | 703 | * |
701 | 704 | * @param type |
702 | - * @return type |
|
705 | + * @return boolean |
|
703 | 706 | */ |
704 | 707 | public function _is_associative_array($arr) { |
705 | 708 | foreach ( array_keys($arr) as $key => $val ) { |
@@ -939,7 +942,7 @@ discard block |
||
939 | 942 | * @param string $jqueryCall the JQuery callback |
940 | 943 | * @param mixed $param array or string parameters |
941 | 944 | * @param string $jsCallback javascript code to execute after the jquery call |
942 | - * @return mixed |
|
945 | + * @return string |
|
943 | 946 | */ |
944 | 947 | public function doJQuery($element, $jqueryCall, $param="", $jsCallback="") { |
945 | 948 | return $this->js->_doJQuery($element, $jqueryCall, $param, $jsCallback, true); |
@@ -951,7 +954,7 @@ discard block |
||
951 | 954 | * @param string $jqueryCall the JQuery callback |
952 | 955 | * @param mixed $param array or string parameters |
953 | 956 | * @param string $jsCallback javascript code to execute after the jquery call |
954 | - * @return mixed |
|
957 | + * @return string |
|
955 | 958 | */ |
956 | 959 | public function doJQueryDeferred($element, $jqueryCall, $param="", $jsCallback="") { |
957 | 960 | return $this->js->_doJQuery($element, $jqueryCall, $param, $jsCallback, false); |
@@ -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 |