@@ -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 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | * Outputs a jQuery click event |
| 156 | 156 | * |
| 157 | 157 | * @param string $element The element to attach the event to |
| 158 | - * @param mixed $js The code to execute |
|
| 158 | + * @param string $js The code to execute |
|
| 159 | 159 | * @param boolean $ret_false whether or not to return false |
| 160 | 160 | * @return string |
| 161 | 161 | */ |
@@ -220,6 +220,8 @@ discard block |
||
| 220 | 220 | * @param string - element |
| 221 | 221 | * @param string - Javascript code for mouse over |
| 222 | 222 | * @param string - Javascript code for mouse out |
| 223 | + * @param string $over |
|
| 224 | + * @param string $out |
|
| 223 | 225 | * @return string |
| 224 | 226 | */ |
| 225 | 227 | public function _hover($element='this', $over, $out) { |
@@ -803,7 +805,7 @@ discard block |
||
| 803 | 805 | * |
| 804 | 806 | * @param string $element |
| 805 | 807 | * @param array $options |
| 806 | - * @return void |
|
| 808 | + * @return string |
|
| 807 | 809 | */ |
| 808 | 810 | public function sortable($element, $options=array()) { |
| 809 | 811 | if (count($options)>0) { |
@@ -934,6 +936,7 @@ discard block |
||
| 934 | 936 | /** |
| 935 | 937 | * A wrapper for writing document.ready() |
| 936 | 938 | * |
| 939 | + * @param string $js |
|
| 937 | 940 | * @return string |
| 938 | 941 | */ |
| 939 | 942 | public function _document_ready($js) { |
@@ -988,7 +991,7 @@ discard block |
||
| 988 | 991 | /** |
| 989 | 992 | * Ensures the speed parameter is valid for jQuery |
| 990 | 993 | * |
| 991 | - * @param string|int $speed |
|
| 994 | + * @param string $speed |
|
| 992 | 995 | * @return string |
| 993 | 996 | */ |
| 994 | 997 | private function _validate_speed($speed) { |
@@ -1003,6 +1006,10 @@ discard block |
||
| 1003 | 1006 | return $speed; |
| 1004 | 1007 | } |
| 1005 | 1008 | // ------------------------------------------------------------------------ |
| 1009 | + |
|
| 1010 | + /** |
|
| 1011 | + * @param string $retour |
|
| 1012 | + */ |
|
| 1006 | 1013 | protected function addLoading(&$retour, $responseElement) { |
| 1007 | 1014 | $loading_notifier='<div class="ajax-loader">'; |
| 1008 | 1015 | if ($this->ajaxLoader=='') { |
@@ -1015,13 +1022,25 @@ discard block |
||
| 1015 | 1022 | $retour.="\t\t$(\"{$responseElement}\").prepend('{$loading_notifier}');\n"; |
| 1016 | 1023 | } |
| 1017 | 1024 | |
| 1025 | + /** |
|
| 1026 | + * @param string $url |
|
| 1027 | + * @param string $jsCallback |
|
| 1028 | + */ |
|
| 1018 | 1029 | public function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
| 1019 | 1030 | return $this->_ajax("get", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$immediatly); |
| 1020 | 1031 | } |
| 1032 | + |
|
| 1033 | + /** |
|
| 1034 | + * @param string $url |
|
| 1035 | + * @param string $jsCallback |
|
| 1036 | + */ |
|
| 1021 | 1037 | public function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
| 1022 | 1038 | return $this->_ajax("post", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$immediatly); |
| 1023 | 1039 | } |
| 1024 | 1040 | |
| 1041 | + /** |
|
| 1042 | + * @param string $method |
|
| 1043 | + */ |
|
| 1025 | 1044 | protected function _ajax($method,$url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
| 1026 | 1045 | if(JString::isNull($params)){$params="{}";} |
| 1027 | 1046 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
@@ -1036,6 +1055,9 @@ discard block |
||
| 1036 | 1055 | return $retour; |
| 1037 | 1056 | } |
| 1038 | 1057 | |
| 1058 | + /** |
|
| 1059 | + * @param string $attr |
|
| 1060 | + */ |
|
| 1039 | 1061 | protected function _getAjaxUrl($url,$attr){ |
| 1040 | 1062 | $url=$this->_correctAjaxUrl($url); |
| 1041 | 1063 | $retour="url='".$url."';\n"; |
@@ -1105,6 +1127,12 @@ discard block |
||
| 1105 | 1127 | return $retour; |
| 1106 | 1128 | } |
| 1107 | 1129 | |
| 1130 | + /** |
|
| 1131 | + * @param string $url |
|
| 1132 | + * @param string $form |
|
| 1133 | + * @param string $responseElement |
|
| 1134 | + * @param string $jsCallback |
|
| 1135 | + */ |
|
| 1108 | 1136 | public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
| 1109 | 1137 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
| 1110 | 1138 | $retour=$this->_getAjaxUrl($url, $attr); |
@@ -1212,7 +1240,7 @@ discard block |
||
| 1212 | 1240 | * @param string $element |
| 1213 | 1241 | * @param string $elementToModify |
| 1214 | 1242 | * @param string $jqueryCall |
| 1215 | - * @param string|array $param |
|
| 1243 | + * @param string $param |
|
| 1216 | 1244 | * @param boolean $preventDefault |
| 1217 | 1245 | * @param boolean $stopPropagation |
| 1218 | 1246 | * @param string $jsCallback javascript code to execute after the jquery call |
@@ -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) { |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | */ |
| 162 | 162 | public function _click($element='this', $js=array(), $ret_false=TRUE) { |
| 163 | 163 | if (!is_array($js)) { |
| 164 | - $js=array ( |
|
| 164 | + $js=array( |
|
| 165 | 165 | $js |
| 166 | 166 | ); |
| 167 | 167 | } |
@@ -345,12 +345,12 @@ discard block |
||
| 345 | 345 | */ |
| 346 | 346 | public function _output($array_js='') { |
| 347 | 347 | if (!is_array($array_js)) { |
| 348 | - $array_js=array ( |
|
| 348 | + $array_js=array( |
|
| 349 | 349 | $array_js |
| 350 | 350 | ); |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | - foreach ( $array_js as $js ) { |
|
| 353 | + foreach ($array_js as $js) { |
|
| 354 | 354 | $this->jquery_code_for_compile[]="\t$js\n"; |
| 355 | 355 | } |
| 356 | 356 | } |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | if (isset($value)) { |
| 427 | 427 | $value=$this->_prep_value($value); |
| 428 | 428 | $str="$({$element}).attr(\"$attributeName\",{$value});"; |
| 429 | - } else |
|
| 429 | + }else |
|
| 430 | 430 | $str="$({$element}).attr(\"$attributeName\");"; |
| 431 | 431 | if ($immediatly) |
| 432 | 432 | $this->jquery_code_for_compile[]=$str; |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | if (isset($value)) { |
| 445 | 445 | $value=$this->_prep_value($value); |
| 446 | 446 | $str="$({$element}).html({$value});"; |
| 447 | - } else |
|
| 447 | + }else |
|
| 448 | 448 | $str="$({$element}).html();"; |
| 449 | 449 | if ($immediatly) |
| 450 | 450 | $this->jquery_code_for_compile[]=$str; |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | |
| 470 | 470 | $animations="\t\t\t"; |
| 471 | 471 | if (is_array($params)) { |
| 472 | - foreach ( $params as $param => $value ) { |
|
| 472 | + foreach ($params as $param => $value) { |
|
| 473 | 473 | $animations.=$param.': \''.$value.'\', '; |
| 474 | 474 | } |
| 475 | 475 | } |
@@ -807,12 +807,12 @@ discard block |
||
| 807 | 807 | */ |
| 808 | 808 | public function sortable($element, $options=array()) { |
| 809 | 809 | if (count($options)>0) { |
| 810 | - $sort_options=array (); |
|
| 811 | - foreach ( $options as $k => $v ) { |
|
| 810 | + $sort_options=array(); |
|
| 811 | + foreach ($options as $k => $v) { |
|
| 812 | 812 | $sort_options[]="\n\t\t".$k.': '.$v.""; |
| 813 | 813 | } |
| 814 | 814 | $sort_options=implode(",", $sort_options); |
| 815 | - } else { |
|
| 815 | + }else { |
|
| 816 | 816 | $sort_options=''; |
| 817 | 817 | } |
| 818 | 818 | |
@@ -893,7 +893,7 @@ discard block |
||
| 893 | 893 | |
| 894 | 894 | // External references |
| 895 | 895 | $external_scripts=implode('', $this->jquery_code_for_load); |
| 896 | - extract(array ( |
|
| 896 | + extract(array( |
|
| 897 | 897 | 'library_src' => $external_scripts |
| 898 | 898 | )); |
| 899 | 899 | |
@@ -926,7 +926,7 @@ discard block |
||
| 926 | 926 | * @return void |
| 927 | 927 | */ |
| 928 | 928 | public function _clear_compile() { |
| 929 | - $this->jquery_code_for_compile=array (); |
|
| 929 | + $this->jquery_code_for_compile=array(); |
|
| 930 | 930 | } |
| 931 | 931 | |
| 932 | 932 | // -------------------------------------------------------------------- |
@@ -938,12 +938,12 @@ discard block |
||
| 938 | 938 | */ |
| 939 | 939 | public function _document_ready($js) { |
| 940 | 940 | if (!is_array($js)) { |
| 941 | - $js=array ( |
|
| 941 | + $js=array( |
|
| 942 | 942 | $js |
| 943 | 943 | ); |
| 944 | 944 | } |
| 945 | 945 | |
| 946 | - foreach ( $js as $script ) { |
|
| 946 | + foreach ($js as $script) { |
|
| 947 | 947 | $this->jquery_code_for_compile[]=$script; |
| 948 | 948 | } |
| 949 | 949 | } |
@@ -959,7 +959,7 @@ discard block |
||
| 959 | 959 | * @return string |
| 960 | 960 | */ |
| 961 | 961 | public function _prep_element($element) { |
| 962 | - if (strrpos($element, 'this')===false&&strrpos($element, 'event')===false) { |
|
| 962 | + if (strrpos($element, 'this')===false && strrpos($element, 'event')===false) { |
|
| 963 | 963 | $element='"'.$element.'"'; |
| 964 | 964 | } |
| 965 | 965 | return $element; |
@@ -977,7 +977,7 @@ discard block |
||
| 977 | 977 | if (is_array($value)) { |
| 978 | 978 | $value=implode(",", $value); |
| 979 | 979 | } |
| 980 | - if (strrpos($value, 'this')===false&&strrpos($value, 'event')===false) { |
|
| 980 | + if (strrpos($value, 'this')===false && strrpos($value, 'event')===false) { |
|
| 981 | 981 | $value='"'.$value.'"'; |
| 982 | 982 | } |
| 983 | 983 | return $value; |
@@ -992,8 +992,8 @@ discard block |
||
| 992 | 992 | * @return string |
| 993 | 993 | */ |
| 994 | 994 | private function _validate_speed($speed) { |
| 995 | - if (in_array($speed, array ( |
|
| 996 | - 'slow','normal','fast' |
|
| 995 | + if (in_array($speed, array( |
|
| 996 | + 'slow', 'normal', 'fast' |
|
| 997 | 997 | ))) { |
| 998 | 998 | $speed='"'.$speed.'"'; |
| 999 | 999 | } elseif (preg_match("/[^0-9]/", $speed)) { |
@@ -1007,7 +1007,7 @@ discard block |
||
| 1007 | 1007 | $loading_notifier='<div class="ajax-loader">'; |
| 1008 | 1008 | if ($this->ajaxLoader=='') { |
| 1009 | 1009 | $loading_notifier.="Loading..."; |
| 1010 | - } else { |
|
| 1010 | + }else { |
|
| 1011 | 1011 | $loading_notifier.=$this->ajaxLoader; |
| 1012 | 1012 | } |
| 1013 | 1013 | $loading_notifier.='</div>'; |
@@ -1015,18 +1015,18 @@ discard block |
||
| 1015 | 1015 | $retour.="\t\t$(\"{$responseElement}\").prepend('{$loading_notifier}');\n"; |
| 1016 | 1016 | } |
| 1017 | 1017 | |
| 1018 | - public function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
|
| 1019 | - return $this->_ajax("get", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$immediatly); |
|
| 1018 | + public function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) { |
|
| 1019 | + return $this->_ajax("get", $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $immediatly); |
|
| 1020 | 1020 | } |
| 1021 | - public function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
|
| 1022 | - return $this->_ajax("post", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$immediatly); |
|
| 1021 | + public function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) { |
|
| 1022 | + return $this->_ajax("post", $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $immediatly); |
|
| 1023 | 1023 | } |
| 1024 | 1024 | |
| 1025 | - protected function _ajax($method,$url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
|
| 1026 | - if(JString::isNull($params)){$params="{}";} |
|
| 1025 | + protected function _ajax($method, $url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) { |
|
| 1026 | + if (JString::isNull($params)) {$params="{}"; } |
|
| 1027 | 1027 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
| 1028 | 1028 | $retour=$this->_getAjaxUrl($url, $attr); |
| 1029 | - if($hasLoader===true){ |
|
| 1029 | + if ($hasLoader===true) { |
|
| 1030 | 1030 | $this->addLoading($retour, $responseElement); |
| 1031 | 1031 | } |
| 1032 | 1032 | $retour.="$.".$method."(url,".$params.").done(function( data ) {\n"; |
@@ -1036,19 +1036,19 @@ discard block |
||
| 1036 | 1036 | return $retour; |
| 1037 | 1037 | } |
| 1038 | 1038 | |
| 1039 | - protected function _getAjaxUrl($url,$attr){ |
|
| 1039 | + protected function _getAjaxUrl($url, $attr) { |
|
| 1040 | 1040 | $url=$this->_correctAjaxUrl($url); |
| 1041 | 1041 | $retour="url='".$url."';\n"; |
| 1042 | - if(JString::isNotNull($attr)){ |
|
| 1042 | + if (JString::isNotNull($attr)) { |
|
| 1043 | 1043 | if ($attr=="value") |
| 1044 | 1044 | $retour.="url=url+'/'+$(this).val();\n"; |
| 1045 | - else if($attr!=null && $attr!=="") |
|
| 1045 | + else if ($attr!=null && $attr!=="") |
|
| 1046 | 1046 | $retour.="url=url+'/'+$(this).attr('".$attr."');\n"; |
| 1047 | 1047 | } |
| 1048 | 1048 | return $retour; |
| 1049 | 1049 | } |
| 1050 | 1050 | |
| 1051 | - protected function _getOnAjaxDone($responseElement,$jsCallback){ |
|
| 1051 | + protected function _getOnAjaxDone($responseElement, $jsCallback) { |
|
| 1052 | 1052 | $retour=""; |
| 1053 | 1053 | if ($responseElement!=="") { |
| 1054 | 1054 | $responseElement=$this->_prep_value($responseElement); |
@@ -1061,7 +1061,7 @@ discard block |
||
| 1061 | 1061 | protected function _correctAjaxUrl($url) { |
| 1062 | 1062 | if (PhalconUtils::endsWith($url, "/")) |
| 1063 | 1063 | $url=substr($url, 0, strlen($url)-1); |
| 1064 | - if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
|
| 1064 | + if (strncmp($url, 'http://', 7)!=0 && strncmp($url, 'https://', 8)!=0) { |
|
| 1065 | 1065 | $url=$this->_di->get("url")->get($url); |
| 1066 | 1066 | } |
| 1067 | 1067 | return $url; |
@@ -1105,11 +1105,11 @@ discard block |
||
| 1105 | 1105 | return $retour; |
| 1106 | 1106 | } |
| 1107 | 1107 | |
| 1108 | - public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
|
| 1108 | + public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) { |
|
| 1109 | 1109 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
| 1110 | 1110 | $retour=$this->_getAjaxUrl($url, $attr); |
| 1111 | 1111 | $retour.="\nvar params=$('#".$form."').serialize();\n"; |
| 1112 | - if($hasLoader===true){ |
|
| 1112 | + if ($hasLoader===true) { |
|
| 1113 | 1113 | $this->addLoading($retour, $responseElement); |
| 1114 | 1114 | } |
| 1115 | 1115 | $retour.="$.post(url,params).done(function( data ) {\n"; |
@@ -1136,14 +1136,14 @@ discard block |
||
| 1136 | 1136 | * @param string $responseElement |
| 1137 | 1137 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true) |
| 1138 | 1138 | */ |
| 1139 | - public function _getOn($event,$element, $url, $params="{}", $responseElement="", $parameters=array()) { |
|
| 1139 | + public function _getOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) { |
|
| 1140 | 1140 | $preventDefault=true; |
| 1141 | 1141 | $stopPropagation=true; |
| 1142 | 1142 | $jsCallback=null; |
| 1143 | 1143 | $attr="id"; |
| 1144 | 1144 | $hasLoader=true; |
| 1145 | 1145 | extract($parameters); |
| 1146 | - return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr,$hasLoader), $event, $preventDefault, $stopPropagation); |
|
| 1146 | + return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr, $hasLoader), $event, $preventDefault, $stopPropagation); |
|
| 1147 | 1147 | } |
| 1148 | 1148 | |
| 1149 | 1149 | /** |
@@ -1156,14 +1156,14 @@ discard block |
||
| 1156 | 1156 | * @param string $responseElement |
| 1157 | 1157 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true) |
| 1158 | 1158 | */ |
| 1159 | - public function _postOn($event,$element, $url, $params="{}", $responseElement="", $parameters=array()) { |
|
| 1159 | + public function _postOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) { |
|
| 1160 | 1160 | $preventDefault=true; |
| 1161 | 1161 | $stopPropagation=true; |
| 1162 | 1162 | $jsCallback=null; |
| 1163 | 1163 | $attr="id"; |
| 1164 | 1164 | $hasLoader=true; |
| 1165 | 1165 | extract($parameters); |
| 1166 | - return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr,$hasLoader), $event, $preventDefault, $stopPropagation); |
|
| 1166 | + return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader), $event, $preventDefault, $stopPropagation); |
|
| 1167 | 1167 | } |
| 1168 | 1168 | |
| 1169 | 1169 | /** |
@@ -1176,7 +1176,7 @@ discard block |
||
| 1176 | 1176 | * @param string $responseElement |
| 1177 | 1177 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true) |
| 1178 | 1178 | */ |
| 1179 | - public function _postFormOn($event,$element, $url, $form, $responseElement="", $parameters=array()) { |
|
| 1179 | + public function _postFormOn($event, $element, $url, $form, $responseElement="", $parameters=array()) { |
|
| 1180 | 1180 | $preventDefault=true; |
| 1181 | 1181 | $stopPropagation=true; |
| 1182 | 1182 | $validation=false; |
@@ -1184,7 +1184,7 @@ discard block |
||
| 1184 | 1184 | $attr="id"; |
| 1185 | 1185 | $hasLoader=true; |
| 1186 | 1186 | extract($parameters); |
| 1187 | - return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr,$hasLoader), $event, $preventDefault, $stopPropagation); |
|
| 1187 | + return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader), $event, $preventDefault, $stopPropagation); |
|
| 1188 | 1188 | } |
| 1189 | 1189 | |
| 1190 | 1190 | /** |
@@ -409,8 +409,9 @@ discard block |
||
| 409 | 409 | $element=$this->_prep_element($element); |
| 410 | 410 | $class=$this->_prep_value($class); |
| 411 | 411 | $str="$({$element}).addClass({$class});"; |
| 412 | - if ($immediatly) |
|
| 413 | - $this->jquery_code_for_compile[]=$str; |
|
| 412 | + if ($immediatly) { |
|
| 413 | + $this->jquery_code_for_compile[]=$str; |
|
| 414 | + } |
|
| 414 | 415 | return $str; |
| 415 | 416 | } |
| 416 | 417 | |
@@ -426,10 +427,12 @@ discard block |
||
| 426 | 427 | if (isset($value)) { |
| 427 | 428 | $value=$this->_prep_value($value); |
| 428 | 429 | $str="$({$element}).attr(\"$attributeName\",{$value});"; |
| 429 | - } else |
|
| 430 | - $str="$({$element}).attr(\"$attributeName\");"; |
|
| 431 | - if ($immediatly) |
|
| 432 | - $this->jquery_code_for_compile[]=$str; |
|
| 430 | + } else { |
|
| 431 | + $str="$({$element}).attr(\"$attributeName\");"; |
|
| 432 | + } |
|
| 433 | + if ($immediatly) { |
|
| 434 | + $this->jquery_code_for_compile[]=$str; |
|
| 435 | + } |
|
| 433 | 436 | return $str; |
| 434 | 437 | } |
| 435 | 438 | |
@@ -444,10 +447,12 @@ discard block |
||
| 444 | 447 | if (isset($value)) { |
| 445 | 448 | $value=$this->_prep_value($value); |
| 446 | 449 | $str="$({$element}).html({$value});"; |
| 447 | - } else |
|
| 448 | - $str="$({$element}).html();"; |
|
| 449 | - if ($immediatly) |
|
| 450 | - $this->jquery_code_for_compile[]=$str; |
|
| 450 | + } else { |
|
| 451 | + $str="$({$element}).html();"; |
|
| 452 | + } |
|
| 453 | + if ($immediatly) { |
|
| 454 | + $this->jquery_code_for_compile[]=$str; |
|
| 455 | + } |
|
| 451 | 456 | return $str; |
| 452 | 457 | } |
| 453 | 458 | |
@@ -485,8 +490,9 @@ discard block |
||
| 485 | 490 | |
| 486 | 491 | $str="$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.");"; |
| 487 | 492 | |
| 488 | - if ($immediatly) |
|
| 489 | - $this->jquery_code_for_compile[]=$str; |
|
| 493 | + if ($immediatly) { |
|
| 494 | + $this->jquery_code_for_compile[]=$str; |
|
| 495 | + } |
|
| 490 | 496 | return $str; |
| 491 | 497 | } |
| 492 | 498 | |
@@ -501,8 +507,9 @@ discard block |
||
| 501 | 507 | $to=$this->_prep_element($to); |
| 502 | 508 | $element=$this->_prep_element($element); |
| 503 | 509 | $str="$({$to}).append({$element});"; |
| 504 | - if ($immediatly) |
|
| 505 | - $this->jquery_code_for_compile[]=$str; |
|
| 510 | + if ($immediatly) { |
|
| 511 | + $this->jquery_code_for_compile[]=$str; |
|
| 512 | + } |
|
| 506 | 513 | return $str; |
| 507 | 514 | } |
| 508 | 515 | |
@@ -517,8 +524,9 @@ discard block |
||
| 517 | 524 | $to=$this->_prep_element($to); |
| 518 | 525 | $element=$this->_prep_element($element); |
| 519 | 526 | $str="$({$to}).prepend({$element});"; |
| 520 | - if ($immediatly) |
|
| 521 | - $this->jquery_code_for_compile[]=$str; |
|
| 527 | + if ($immediatly) { |
|
| 528 | + $this->jquery_code_for_compile[]=$str; |
|
| 529 | + } |
|
| 522 | 530 | return $str; |
| 523 | 531 | } |
| 524 | 532 | |
@@ -543,8 +551,9 @@ discard block |
||
| 543 | 551 | |
| 544 | 552 | $str="$({$element}).fadeIn({$speed}{$callback});"; |
| 545 | 553 | |
| 546 | - if ($immediatly) |
|
| 547 | - $this->jquery_code_for_compile[]=$str; |
|
| 554 | + if ($immediatly) { |
|
| 555 | + $this->jquery_code_for_compile[]=$str; |
|
| 556 | + } |
|
| 548 | 557 | return $str; |
| 549 | 558 | } |
| 550 | 559 | |
@@ -569,8 +578,9 @@ discard block |
||
| 569 | 578 | |
| 570 | 579 | $str="$({$element}).fadeOut({$speed}{$callback});"; |
| 571 | 580 | |
| 572 | - if ($immediatly) |
|
| 573 | - $this->jquery_code_for_compile[]=$str; |
|
| 581 | + if ($immediatly) { |
|
| 582 | + $this->jquery_code_for_compile[]=$str; |
|
| 583 | + } |
|
| 574 | 584 | return $str; |
| 575 | 585 | } |
| 576 | 586 | |
@@ -595,8 +605,9 @@ discard block |
||
| 595 | 605 | |
| 596 | 606 | $str="$({$element}).hide({$speed}{$callback});"; |
| 597 | 607 | |
| 598 | - if ($immediatly) |
|
| 599 | - $this->jquery_code_for_compile[]=$str; |
|
| 608 | + if ($immediatly) { |
|
| 609 | + $this->jquery_code_for_compile[]=$str; |
|
| 610 | + } |
|
| 600 | 611 | return $str; |
| 601 | 612 | } |
| 602 | 613 | |
@@ -614,8 +625,9 @@ discard block |
||
| 614 | 625 | $element=$this->_prep_element($element); |
| 615 | 626 | $str="$({$element}).removeClass(\"$class\");"; |
| 616 | 627 | |
| 617 | - if ($immediatly) |
|
| 618 | - $this->jquery_code_for_compile[]=$str; |
|
| 628 | + if ($immediatly) { |
|
| 629 | + $this->jquery_code_for_compile[]=$str; |
|
| 630 | + } |
|
| 619 | 631 | return $str; |
| 620 | 632 | } |
| 621 | 633 | |
@@ -640,8 +652,9 @@ discard block |
||
| 640 | 652 | |
| 641 | 653 | $str="$({$element}).slideUp({$speed}{$callback});"; |
| 642 | 654 | |
| 643 | - if ($immediatly) |
|
| 644 | - $this->jquery_code_for_compile[]=$str; |
|
| 655 | + if ($immediatly) { |
|
| 656 | + $this->jquery_code_for_compile[]=$str; |
|
| 657 | + } |
|
| 645 | 658 | return $str; |
| 646 | 659 | } |
| 647 | 660 | |
@@ -666,8 +679,9 @@ discard block |
||
| 666 | 679 | |
| 667 | 680 | $str="$({$element}).slideDown({$speed}{$callback});"; |
| 668 | 681 | |
| 669 | - if ($immediatly) |
|
| 670 | - $this->jquery_code_for_compile[]=$str; |
|
| 682 | + if ($immediatly) { |
|
| 683 | + $this->jquery_code_for_compile[]=$str; |
|
| 684 | + } |
|
| 671 | 685 | return $str; |
| 672 | 686 | } |
| 673 | 687 | |
@@ -692,8 +706,9 @@ discard block |
||
| 692 | 706 | |
| 693 | 707 | $str="$({$element}).slideToggle({$speed}{$callback});"; |
| 694 | 708 | |
| 695 | - if ($immediatly) |
|
| 696 | - $this->jquery_code_for_compile[]=$str; |
|
| 709 | + if ($immediatly) { |
|
| 710 | + $this->jquery_code_for_compile[]=$str; |
|
| 711 | + } |
|
| 697 | 712 | return $str; |
| 698 | 713 | } |
| 699 | 714 | |
@@ -710,8 +725,9 @@ discard block |
||
| 710 | 725 | $element=$this->_prep_element($element); |
| 711 | 726 | $str="$({$element}).toggle();"; |
| 712 | 727 | |
| 713 | - if ($immediatly) |
|
| 714 | - $this->jquery_code_for_compile[]=$str; |
|
| 728 | + if ($immediatly) { |
|
| 729 | + $this->jquery_code_for_compile[]=$str; |
|
| 730 | + } |
|
| 715 | 731 | return $str; |
| 716 | 732 | } |
| 717 | 733 | |
@@ -729,8 +745,9 @@ discard block |
||
| 729 | 745 | $element=$this->_prep_element($element); |
| 730 | 746 | $str="$({$element}).toggleClass(\"$class\");"; |
| 731 | 747 | |
| 732 | - if ($immediatly) |
|
| 733 | - $this->jquery_code_for_compile[]=$str; |
|
| 748 | + if ($immediatly) { |
|
| 749 | + $this->jquery_code_for_compile[]=$str; |
|
| 750 | + } |
|
| 734 | 751 | return $str; |
| 735 | 752 | } |
| 736 | 753 | |
@@ -744,8 +761,9 @@ discard block |
||
| 744 | 761 | $element=$this->_prep_element($element); |
| 745 | 762 | $str="$({$element}).trigger(\"$event\");"; |
| 746 | 763 | |
| 747 | - if ($immediatly) |
|
| 748 | - $this->jquery_code_for_compile[]=$str; |
|
| 764 | + if ($immediatly) { |
|
| 765 | + $this->jquery_code_for_compile[]=$str; |
|
| 766 | + } |
|
| 749 | 767 | return $str; |
| 750 | 768 | } |
| 751 | 769 | |
@@ -770,8 +788,9 @@ discard block |
||
| 770 | 788 | |
| 771 | 789 | $str="$({$element}).show({$speed}{$callback});"; |
| 772 | 790 | |
| 773 | - if ($immediatly) |
|
| 774 | - $this->jquery_code_for_compile[]=$str; |
|
| 791 | + if ($immediatly) { |
|
| 792 | + $this->jquery_code_for_compile[]=$str; |
|
| 793 | + } |
|
| 775 | 794 | return $str; |
| 776 | 795 | } |
| 777 | 796 | |
@@ -789,8 +808,9 @@ discard block |
||
| 789 | 808 | $str.="else{".$jsCodeIfFalse."}"; |
| 790 | 809 | } |
| 791 | 810 | |
| 792 | - if ($immediatly) |
|
| 793 | - $this->jquery_code_for_compile[]=$str; |
|
| 811 | + if ($immediatly) { |
|
| 812 | + $this->jquery_code_for_compile[]=$str; |
|
| 813 | + } |
|
| 794 | 814 | return $str; |
| 795 | 815 | } |
| 796 | 816 | |
@@ -856,10 +876,11 @@ discard block |
||
| 856 | 876 | if ($stopPropagation===true) { |
| 857 | 877 | $js="event.stopPropagation();\n".$js; |
| 858 | 878 | } |
| 859 | - if (array_search($event, $this->jquery_events)===false) |
|
| 860 | - $event="\n\t$(".$this->_prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
|
| 861 | - else |
|
| 862 | - $event="\n\t$(".$this->_prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
|
| 879 | + if (array_search($event, $this->jquery_events)===false) { |
|
| 880 | + $event="\n\t$(".$this->_prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
|
| 881 | + } else { |
|
| 882 | + $event="\n\t$(".$this->_prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
|
| 883 | + } |
|
| 863 | 884 | $this->jquery_code_for_compile[]=$event; |
| 864 | 885 | return $event; |
| 865 | 886 | } |
@@ -909,8 +930,9 @@ discard block |
||
| 909 | 930 | |
| 910 | 931 | $output=($script_tags===FALSE) ? $script : $this->inline($script); |
| 911 | 932 | |
| 912 | - if ($view!=NULL) |
|
| 913 | - $view->setVar($view_var, $output); |
|
| 933 | + if ($view!=NULL) { |
|
| 934 | + $view->setVar($view_var, $output); |
|
| 935 | + } |
|
| 914 | 936 | return $output; |
| 915 | 937 | } |
| 916 | 938 | |
@@ -1031,8 +1053,9 @@ discard block |
||
| 1031 | 1053 | } |
| 1032 | 1054 | $retour.="$.".$method."(url,".$params.").done(function( data ) {\n"; |
| 1033 | 1055 | $retour.=$this->_getOnAjaxDone($responseElement, $jsCallback)."});\n"; |
| 1034 | - if ($immediatly) |
|
| 1035 | - $this->jquery_code_for_compile[]=$retour; |
|
| 1056 | + if ($immediatly) { |
|
| 1057 | + $this->jquery_code_for_compile[]=$retour; |
|
| 1058 | + } |
|
| 1036 | 1059 | return $retour; |
| 1037 | 1060 | } |
| 1038 | 1061 | |
@@ -1040,10 +1063,11 @@ discard block |
||
| 1040 | 1063 | $url=$this->_correctAjaxUrl($url); |
| 1041 | 1064 | $retour="url='".$url."';\n"; |
| 1042 | 1065 | if(JString::isNotNull($attr)){ |
| 1043 | - if ($attr=="value") |
|
| 1044 | - $retour.="url=url+'/'+$(this).val();\n"; |
|
| 1045 | - else if($attr!=null && $attr!=="") |
|
| 1046 | - $retour.="url=url+'/'+$(this).attr('".$attr."');\n"; |
|
| 1066 | + if ($attr=="value") { |
|
| 1067 | + $retour.="url=url+'/'+$(this).val();\n"; |
|
| 1068 | + } else if($attr!=null && $attr!=="") { |
|
| 1069 | + $retour.="url=url+'/'+$(this).attr('".$attr."');\n"; |
|
| 1070 | + } |
|
| 1047 | 1071 | } |
| 1048 | 1072 | return $retour; |
| 1049 | 1073 | } |
@@ -1059,8 +1083,9 @@ discard block |
||
| 1059 | 1083 | } |
| 1060 | 1084 | |
| 1061 | 1085 | protected function _correctAjaxUrl($url) { |
| 1062 | - if (PhalconUtils::endsWith($url, "/")) |
|
| 1063 | - $url=substr($url, 0, strlen($url)-1); |
|
| 1086 | + if (PhalconUtils::endsWith($url, "/")) { |
|
| 1087 | + $url=substr($url, 0, strlen($url)-1); |
|
| 1088 | + } |
|
| 1064 | 1089 | if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
| 1065 | 1090 | $url=$this->_di->get("url")->get($url); |
| 1066 | 1091 | } |
@@ -1081,8 +1106,9 @@ discard block |
||
| 1081 | 1106 | $retour.="\tdata=$.parseJSON(data);for(var key in data){if($('#'+key).length){ if($('#'+key).is('[value]')) { $('#'+key).val(data[key]);} else { $('#'+key).html(data[key]); }}};\n"; |
| 1082 | 1107 | $retour.="\t".$jsCallback."\n |
| 1083 | 1108 | });\n"; |
| 1084 | - if ($immediatly) |
|
| 1085 | - $this->jquery_code_for_compile[]=$retour; |
|
| 1109 | + if ($immediatly) { |
|
| 1110 | + $this->jquery_code_for_compile[]=$retour; |
|
| 1111 | + } |
|
| 1086 | 1112 | return $retour; |
| 1087 | 1113 | } |
| 1088 | 1114 | |
@@ -1100,8 +1126,9 @@ discard block |
||
| 1100 | 1126 | $retour.="\tdata=$.parseJSON(data);$.each(data, function(index, value) {\n"."\tvar created=false;var maskElm=$('".$maskSelector."').first();maskElm.hide();"."\tvar newId=(maskElm.attr('id') || 'mask')+'-'+index;"."\tvar newElm=$('#'+newId);\n"."\tif(!newElm.length){\n"."\t\tnewElm=maskElm.clone();newElm.attr('id',newId);\n"."\t\tnewElm.appendTo($('".$maskSelector."').parent());\n"."\t}\n"."\tfor(var key in value){\n"."\t\t\tvar html = $('<div />').append($(newElm).clone()).html();\n"."\t\t\tif(html.indexOf('[['+key+']]')>-1){\n"."\t\t\t\tcontent=$(html.split('[['+key+']]').join(value[key]));\n"."\t\t\t\t$(newElm).replaceWith(content);newElm=content;\n"."\t\t\t}\n"."\t\tvar sel='[data-id=\"'+key+'\"]';if($(sel,newElm).length){\n"."\t\t\tvar selElm=$(sel,newElm);\n"."\t\t\t if(selElm.is('[value]')) { selElm.attr('value',value[key]);selElm.val(value[key]);} else { selElm.html(value[key]); }\n"."\t\t}\n"."}\n"."\t$(newElm).show(true);"."});\n"; |
| 1101 | 1127 | |
| 1102 | 1128 | $retour.="\t".$jsCallback."\n"."});\n"; |
| 1103 | - if ($immediatly) |
|
| 1104 | - $this->jquery_code_for_compile[]=$retour; |
|
| 1129 | + if ($immediatly) { |
|
| 1130 | + $this->jquery_code_for_compile[]=$retour; |
|
| 1131 | + } |
|
| 1105 | 1132 | return $retour; |
| 1106 | 1133 | } |
| 1107 | 1134 | |
@@ -1121,8 +1148,9 @@ discard block |
||
| 1121 | 1148 | }});\n"; |
| 1122 | 1149 | $retour.="$('#".$form."').submit();\n"; |
| 1123 | 1150 | } |
| 1124 | - if ($immediatly) |
|
| 1125 | - $this->jquery_code_for_compile[]=$retour; |
|
| 1151 | + if ($immediatly) { |
|
| 1152 | + $this->jquery_code_for_compile[]=$retour; |
|
| 1153 | + } |
|
| 1126 | 1154 | return $retour; |
| 1127 | 1155 | } |
| 1128 | 1156 | |
@@ -1198,11 +1226,13 @@ discard block |
||
| 1198 | 1226 | public function _doJQuery($element, $jqueryCall, $param="", $jsCallback="", $immediatly=false) { |
| 1199 | 1227 | $param=$this->_prep_value($param); |
| 1200 | 1228 | $callback=""; |
| 1201 | - if ($jsCallback!="") |
|
| 1202 | - $callback=", function(event){\n{$jsCallback}\n}"; |
|
| 1229 | + if ($jsCallback!="") { |
|
| 1230 | + $callback=", function(event){\n{$jsCallback}\n}"; |
|
| 1231 | + } |
|
| 1203 | 1232 | $script="$(".$this->_prep_element($element).").".$jqueryCall."(".$param.$callback.");\n"; |
| 1204 | - if ($immediatly) |
|
| 1205 | - $this->jquery_code_for_compile[]=$script; |
|
| 1233 | + if ($immediatly) { |
|
| 1234 | + $this->jquery_code_for_compile[]=$script; |
|
| 1235 | + } |
|
| 1206 | 1236 | return $script; |
| 1207 | 1237 | } |
| 1208 | 1238 | |
@@ -1230,8 +1260,9 @@ discard block |
||
| 1230 | 1260 | */ |
| 1231 | 1261 | public function _exec($js, $immediatly=false) { |
| 1232 | 1262 | $script=$js."\n"; |
| 1233 | - if ($immediatly) |
|
| 1234 | - $this->jquery_code_for_compile[]=$script; |
|
| 1263 | + if ($immediatly) { |
|
| 1264 | + $this->jquery_code_for_compile[]=$script; |
|
| 1265 | + } |
|
| 1235 | 1266 | return $script; |
| 1236 | 1267 | } |
| 1237 | 1268 | |
@@ -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,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) { |
@@ -587,7 +587,7 @@ discard block |
||
| 587 | 587 | */ |
| 588 | 588 | public function compile($view=NULL, $view_var='script_foot', $script_tags=TRUE) { |
| 589 | 589 | $bs=$this->_bootstrap; |
| 590 | - if (isset($bs)&&isset($view)) { |
|
| 590 | + if (isset($bs) && isset($view)) { |
|
| 591 | 591 | $bs->compileHtml($this, $view); |
| 592 | 592 | } |
| 593 | 593 | return $this->js->_compile($view, $view_var, $script_tags); |
@@ -667,27 +667,27 @@ discard block |
||
| 667 | 667 | $json_result=$result->result_array(); |
| 668 | 668 | } elseif (is_array($result)) { |
| 669 | 669 | $json_result=$result; |
| 670 | - } else { |
|
| 670 | + }else { |
|
| 671 | 671 | return $this->_prep_args($result); |
| 672 | 672 | } |
| 673 | - } else { |
|
| 673 | + }else { |
|
| 674 | 674 | return 'null'; |
| 675 | 675 | } |
| 676 | 676 | return $this->_create_json($json_result, $match_array_type); |
| 677 | 677 | } |
| 678 | 678 | |
| 679 | 679 | private function _create_json($json_result, $match_array_type) { |
| 680 | - $json=array (); |
|
| 680 | + $json=array(); |
|
| 681 | 681 | $_is_assoc=TRUE; |
| 682 | - if (!is_array($json_result)&&empty($json_result)) { |
|
| 682 | + if (!is_array($json_result) && empty($json_result)) { |
|
| 683 | 683 | show_error("Generate JSON Failed - Illegal key, value pair."); |
| 684 | 684 | } elseif ($match_array_type) { |
| 685 | 685 | $_is_assoc=$this->_is_associative_array($json_result); |
| 686 | 686 | } |
| 687 | - foreach ( $json_result as $k => $v ) { |
|
| 687 | + foreach ($json_result as $k => $v) { |
|
| 688 | 688 | if ($_is_assoc) { |
| 689 | 689 | $json[]=$this->_prep_args($k, TRUE).':'.$this->generate_json($v, $match_array_type); |
| 690 | - } else { |
|
| 690 | + }else { |
|
| 691 | 691 | $json[]=$this->generate_json($v, $match_array_type); |
| 692 | 692 | } |
| 693 | 693 | } |
@@ -702,7 +702,7 @@ discard block |
||
| 702 | 702 | * @return type |
| 703 | 703 | */ |
| 704 | 704 | public function _is_associative_array($arr) { |
| 705 | - foreach ( array_keys($arr) as $key => $val ) { |
|
| 705 | + foreach (array_keys($arr) as $key => $val) { |
|
| 706 | 706 | if ($key!==$val) { |
| 707 | 707 | return TRUE; |
| 708 | 708 | } |
@@ -721,11 +721,11 @@ discard block |
||
| 721 | 721 | return 'null'; |
| 722 | 722 | } elseif (is_bool($result)) { |
| 723 | 723 | return ($result===TRUE) ? 'true' : 'false'; |
| 724 | - } elseif (is_string($result)||$is_key) { |
|
| 725 | - return '"'.str_replace(array ( |
|
| 726 | - '\\',"\t","\n","\r",'"','/' |
|
| 727 | - ), array ( |
|
| 728 | - '\\\\','\\t','\\n',"\\r",'\"','\/' |
|
| 724 | + } elseif (is_string($result) || $is_key) { |
|
| 725 | + return '"'.str_replace(array( |
|
| 726 | + '\\', "\t", "\n", "\r", '"', '/' |
|
| 727 | + ), array( |
|
| 728 | + '\\\\', '\\t', '\\n', "\\r", '\"', '\/' |
|
| 729 | 729 | ), $result).'"'; |
| 730 | 730 | } elseif (is_scalar($result)) { |
| 731 | 731 | return $result; |
@@ -740,8 +740,8 @@ discard block |
||
| 740 | 740 | * @param string $jsCallback javascript code to execute after the request |
| 741 | 741 | * @param boolean $hasLoader true for showing ajax loader. default : true |
| 742 | 742 | */ |
| 743 | - public function get($url, $responseElement="", $params="{}", $jsCallback=NULL,$hasLoader=true) { |
|
| 744 | - return $this->js->_get($url, $params, $responseElement, $jsCallback, NULL, $hasLoader,true); |
|
| 743 | + public function get($url, $responseElement="", $params="{}", $jsCallback=NULL, $hasLoader=true) { |
|
| 744 | + return $this->js->_get($url, $params, $responseElement, $jsCallback, NULL, $hasLoader, true); |
|
| 745 | 745 | } |
| 746 | 746 | |
| 747 | 747 | /** |
@@ -797,7 +797,7 @@ discard block |
||
| 797 | 797 | * @param string $jsCallback javascript code to execute after the request |
| 798 | 798 | * @param string $attr the html attribute added to the request |
| 799 | 799 | */ |
| 800 | - public function getDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL,$attr="id") { |
|
| 800 | + public function getDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id") { |
|
| 801 | 801 | return $this->js->_get($url, $params, $responseElement, $jsCallback, $attr, false); |
| 802 | 802 | } |
| 803 | 803 | |
@@ -835,8 +835,8 @@ discard block |
||
| 835 | 835 | * @param string $jsCallback javascript code to execute after the request |
| 836 | 836 | * @param boolean $hasLoader true for showing ajax loader. default : true |
| 837 | 837 | */ |
| 838 | - public function post($url, $responseElement="", $params="{}", $jsCallback=NULL,$hasLoader=true) { |
|
| 839 | - return $this->js->_post($url, $params, $responseElement, $jsCallback, NULL, $hasLoader,true); |
|
| 838 | + public function post($url, $responseElement="", $params="{}", $jsCallback=NULL, $hasLoader=true) { |
|
| 839 | + return $this->js->_post($url, $params, $responseElement, $jsCallback, NULL, $hasLoader, true); |
|
| 840 | 840 | } |
| 841 | 841 | |
| 842 | 842 | /** |
@@ -849,8 +849,8 @@ discard block |
||
| 849 | 849 | * @param string $jsCallback javascript code to execute after the request |
| 850 | 850 | * @param boolean $hasLoader true for showing ajax loader. default : true |
| 851 | 851 | */ |
| 852 | - public function postDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id",$hasLoader=true) { |
|
| 853 | - return $this->js->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader,false); |
|
| 852 | + public function postDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id", $hasLoader=true) { |
|
| 853 | + return $this->js->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, false); |
|
| 854 | 854 | } |
| 855 | 855 | |
| 856 | 856 | /** |
@@ -864,7 +864,7 @@ discard block |
||
| 864 | 864 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true) |
| 865 | 865 | */ |
| 866 | 866 | public function postOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) { |
| 867 | - return $this->js->_postOn($event, $element, $url, $params, $responseElement, $parameters); |
|
| 867 | + return $this->js->_postOn($event, $element, $url, $params, $responseElement, $parameters); |
|
| 868 | 868 | } |
| 869 | 869 | |
| 870 | 870 | /** |
@@ -888,8 +888,8 @@ discard block |
||
| 888 | 888 | * @param string $jsCallback javascript code to execute after the request |
| 889 | 889 | * @param boolean $hasLoader true for showing ajax loader. default : true |
| 890 | 890 | */ |
| 891 | - public function postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL,$hasLoader=true) { |
|
| 892 | - return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, NULL, $hasLoader,true); |
|
| 891 | + public function postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $hasLoader=true) { |
|
| 892 | + return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, NULL, $hasLoader, true); |
|
| 893 | 893 | } |
| 894 | 894 | |
| 895 | 895 | /** |
@@ -902,8 +902,8 @@ discard block |
||
| 902 | 902 | * @param string $attr the html attribute added to the request |
| 903 | 903 | * @param boolean $hasLoader true for showing ajax loader. default : true |
| 904 | 904 | */ |
| 905 | - public function postFormDeferred($url, $form, $responseElement, $validation=false, $jsCallback=NULL,$attr="id",$hasLoader=true) { |
|
| 906 | - return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader,false); |
|
| 905 | + public function postFormDeferred($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true) { |
|
| 906 | + return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader, false); |
|
| 907 | 907 | } |
| 908 | 908 | |
| 909 | 909 | /** |
@@ -917,7 +917,7 @@ discard block |
||
| 917 | 917 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true) |
| 918 | 918 | */ |
| 919 | 919 | public function postFormOn($event, $element, $url, $form, $responseElement="", $parameters=array()) { |
| 920 | - return $this->js->_postFormOn($event,$element, $url, $form, $responseElement, $parameters); |
|
| 920 | + return $this->js->_postFormOn($event, $element, $url, $form, $responseElement, $parameters); |
|
| 921 | 921 | } |
| 922 | 922 | |
| 923 | 923 | /** |
@@ -1007,7 +1007,7 @@ discard block |
||
| 1007 | 1007 | |
| 1008 | 1008 | public function setCDNs($cdns) { |
| 1009 | 1009 | if (is_array($cdns)===false) { |
| 1010 | - $cdns=array ( |
|
| 1010 | + $cdns=array( |
|
| 1011 | 1011 | $cdns |
| 1012 | 1012 | ); |
| 1013 | 1013 | } |
@@ -1018,9 +1018,9 @@ discard block |
||
| 1018 | 1018 | $hasJQuery=false; |
| 1019 | 1019 | $hasJQueryUI=false; |
| 1020 | 1020 | $hasBootstrap=false; |
| 1021 | - $result=array (); |
|
| 1022 | - foreach ( $this->cdns as $cdn ) { |
|
| 1023 | - switch(get_class($cdn)) { |
|
| 1021 | + $result=array(); |
|
| 1022 | + foreach ($this->cdns as $cdn) { |
|
| 1023 | + switch (get_class($cdn)) { |
|
| 1024 | 1024 | case "Ajax\lib\CDNJQuery": |
| 1025 | 1025 | $hasJQuery=true; |
| 1026 | 1026 | $result[0]=$cdn; |
@@ -1038,10 +1038,10 @@ discard block |
||
| 1038 | 1038 | if ($hasJQuery===false) { |
| 1039 | 1039 | $result[0]=new CDNJQuery("x"); |
| 1040 | 1040 | } |
| 1041 | - if ($hasJQueryUI===false&&isset($this->_ui)) { |
|
| 1041 | + if ($hasJQueryUI===false && isset($this->_ui)) { |
|
| 1042 | 1042 | $result[1]=new CDNGuiGen("x", $template); |
| 1043 | 1043 | } |
| 1044 | - if ($hasBootstrap===false&&isset($this->_bootstrap)) { |
|
| 1044 | + if ($hasBootstrap===false && isset($this->_bootstrap)) { |
|
| 1045 | 1045 | $result[2]=new CDNBootstrap("x"); |
| 1046 | 1046 | } |
| 1047 | 1047 | ksort($result); |
@@ -1055,7 +1055,7 @@ discard block |
||
| 1055 | 1055 | $this->_setDi($di); |
| 1056 | 1056 | } |
| 1057 | 1057 | } |
| 1058 | -} else { |
|
| 1058 | +}else { |
|
| 1059 | 1059 | class JsUtils extends _JsUtils { |
| 1060 | 1060 | |
| 1061 | 1061 | public function setDi(DiInterface $di) { |
@@ -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 | /** |
@@ -267,8 +267,8 @@ discard block |
||
| 267 | 267 | * @param string $tagName container tagName |
| 268 | 268 | * @return HtmlListgroup |
| 269 | 269 | */ |
| 270 | - public function htmlListgroup($identifier,$items=array(),$tagName="ul"){ |
|
| 271 | - $listGroup=new HtmlListgroup($identifier,$tagName); |
|
| 270 | + public function htmlListgroup($identifier, $items=array(), $tagName="ul") { |
|
| 271 | + $listGroup=new HtmlListgroup($identifier, $tagName); |
|
| 272 | 272 | $listGroup->addItems($items); |
| 273 | 273 | return $this->addHtmlComponent($listGroup); |
| 274 | 274 | } |
@@ -293,8 +293,8 @@ discard block |
||
| 293 | 293 | * @param string $onClick |
| 294 | 294 | * @return HtmlSplitbutton |
| 295 | 295 | */ |
| 296 | - public function htmlSplitbutton($identifier,$value="", $items=array(), $cssStyle="btn-default", $onClick=NULL) { |
|
| 297 | - return $this->addHtmlComponent(new HtmlSplitbutton($identifier, $value, $items, $cssStyle,$onClick)); |
|
| 296 | + public function htmlSplitbutton($identifier, $value="", $items=array(), $cssStyle="btn-default", $onClick=NULL) { |
|
| 297 | + return $this->addHtmlComponent(new HtmlSplitbutton($identifier, $value, $items, $cssStyle, $onClick)); |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | /** |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | * @param string $identifier |
| 303 | 303 | * @return HtmlInputgroup |
| 304 | 304 | */ |
| 305 | - public function htmlInputgroup($identifier){ |
|
| 305 | + public function htmlInputgroup($identifier) { |
|
| 306 | 306 | return $this->addHtmlComponent(new HtmlInputgroup($identifier)); |
| 307 | 307 | } |
| 308 | 308 | |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | * @param function $hrefFunction the function who generates the href elements. default : function($e){return $e->getContent()} |
| 315 | 315 | * @return HtmlBreadcrumbs |
| 316 | 316 | */ |
| 317 | - public function htmlBreadcrumbs($identifier,$elements=array(),$autoActive=true,$hrefFunction=NULL){ |
|
| 318 | - return $this->addHtmlComponent(new HtmlBreadcrumbs($identifier,$elements,$autoActive,$hrefFunction)); |
|
| 317 | + public function htmlBreadcrumbs($identifier, $elements=array(), $autoActive=true, $hrefFunction=NULL) { |
|
| 318 | + return $this->addHtmlComponent(new HtmlBreadcrumbs($identifier, $elements, $autoActive, $hrefFunction)); |
|
| 319 | 319 | } |
| 320 | 320 | } |
| 321 | 321 | \ No newline at end of file |
@@ -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 | } |