@@ -719,6 +719,9 @@ discard block |
||
| 719 | 719 | return $this->_create_json($json_result, $match_array_type); |
| 720 | 720 | } |
| 721 | 721 | |
| 722 | + /** |
|
| 723 | + * @param boolean $match_array_type |
|
| 724 | + */ |
|
| 722 | 725 | private function _create_json($json_result, $match_array_type) { |
| 723 | 726 | $json=array (); |
| 724 | 727 | $_is_assoc=TRUE; |
@@ -742,7 +745,7 @@ discard block |
||
| 742 | 745 | * Checks for an associative array |
| 743 | 746 | * |
| 744 | 747 | * @param type |
| 745 | - * @return type |
|
| 748 | + * @return boolean |
|
| 746 | 749 | */ |
| 747 | 750 | public function _is_associative_array($arr) { |
| 748 | 751 | foreach ( array_keys($arr) as $key => $val ) { |
@@ -5,6 +5,10 @@ discard block |
||
| 5 | 5 | use Ajax\service\JString; |
| 6 | 6 | use Ajax\service\PhalconUtils; |
| 7 | 7 | trait JqueryAjaxTrait { |
| 8 | + |
|
| 9 | + /** |
|
| 10 | + * @param string $retour |
|
| 11 | + */ |
|
| 8 | 12 | protected function addLoading(&$retour, $responseElement) { |
| 9 | 13 | $loading_notifier='<div class="ajax-loader">'; |
| 10 | 14 | if ($this->ajaxLoader=='') { |
@@ -17,13 +21,23 @@ discard block |
||
| 17 | 21 | $retour.="\t\t$({$responseElement}).prepend('{$loading_notifier}');\n"; |
| 18 | 22 | } |
| 19 | 23 | |
| 24 | + /** |
|
| 25 | + * @param string $url |
|
| 26 | + */ |
|
| 20 | 27 | public function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
| 21 | 28 | return $this->_ajax("get", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$immediatly); |
| 22 | 29 | } |
| 30 | + |
|
| 31 | + /** |
|
| 32 | + * @param string $url |
|
| 33 | + */ |
|
| 23 | 34 | public function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
| 24 | 35 | return $this->_ajax("post", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$immediatly); |
| 25 | 36 | } |
| 26 | 37 | |
| 38 | + /** |
|
| 39 | + * @param string $method |
|
| 40 | + */ |
|
| 27 | 41 | protected function _ajax($method,$url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
| 28 | 42 | if(JString::isNull($params)){$params="{}";} |
| 29 | 43 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
@@ -40,6 +54,9 @@ discard block |
||
| 40 | 54 | return $retour; |
| 41 | 55 | } |
| 42 | 56 | |
| 57 | + /** |
|
| 58 | + * @param string $attr |
|
| 59 | + */ |
|
| 43 | 60 | protected function _getAjaxUrl($url,$attr){ |
| 44 | 61 | $url=$this->_correctAjaxUrl($url); |
| 45 | 62 | $retour="url='".$url."';\n"; |
@@ -171,6 +188,11 @@ discard block |
||
| 171 | 188 | return $this->_add_event($element, $this->_jsonArray($maskSelector,$url,$method, $params,$jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation,$immediatly); |
| 172 | 189 | } |
| 173 | 190 | |
| 191 | + /** |
|
| 192 | + * @param string $url |
|
| 193 | + * @param string $form |
|
| 194 | + * @param string $responseElement |
|
| 195 | + */ |
|
| 174 | 196 | public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
| 175 | 197 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
| 176 | 198 | $retour=$this->_getAjaxUrl($url, $attr); |
@@ -35,8 +35,9 @@ discard block |
||
| 35 | 35 | } |
| 36 | 36 | $retour.="$.".$method."(url,".$params.").done(function( data ) {\n"; |
| 37 | 37 | $retour.=$this->_getOnAjaxDone($responseElement, $jsCallback)."});\n"; |
| 38 | - if ($immediatly) |
|
| 39 | - $this->jquery_code_for_compile[]=$retour; |
|
| 38 | + if ($immediatly) { |
|
| 39 | + $this->jquery_code_for_compile[]=$retour; |
|
| 40 | + } |
|
| 40 | 41 | return $retour; |
| 41 | 42 | } |
| 42 | 43 | |
@@ -44,13 +45,15 @@ discard block |
||
| 44 | 45 | $url=$this->_correctAjaxUrl($url); |
| 45 | 46 | $retour="url='".$url."';\n"; |
| 46 | 47 | $slash="/"; |
| 47 | - if(PhalconUtils::endsWith($url, "/")) |
|
| 48 | - $slash=""; |
|
| 48 | + if(PhalconUtils::endsWith($url, "/")) { |
|
| 49 | + $slash=""; |
|
| 50 | + } |
|
| 49 | 51 | if(JString::isNotNull($attr)){ |
| 50 | - if ($attr=="value") |
|
| 51 | - $retour.="url=url+'".$slash."'+$(this).val();\n"; |
|
| 52 | - else if($attr!=null && $attr!=="") |
|
| 53 | - $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
| 52 | + if ($attr=="value") { |
|
| 53 | + $retour.="url=url+'".$slash."'+$(this).val();\n"; |
|
| 54 | + } else if($attr!=null && $attr!=="") { |
|
| 55 | + $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
| 56 | + } |
|
| 54 | 57 | } |
| 55 | 58 | return $retour; |
| 56 | 59 | } |
@@ -72,8 +75,9 @@ discard block |
||
| 72 | 75 | } |
| 73 | 76 | |
| 74 | 77 | protected function _correctAjaxUrl($url) { |
| 75 | - if (PhalconUtils::endsWith($url, "/")) |
|
| 76 | - $url=substr($url, 0, strlen($url)-1); |
|
| 78 | + if (PhalconUtils::endsWith($url, "/")) { |
|
| 79 | + $url=substr($url, 0, strlen($url)-1); |
|
| 80 | + } |
|
| 77 | 81 | if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
| 78 | 82 | $url=$this->_di->get("url")->get($url); |
| 79 | 83 | } |
@@ -97,8 +101,9 @@ discard block |
||
| 97 | 101 | $retour.="\t".$jsCallback."\n". |
| 98 | 102 | "\t$(document).trigger('jsonReady',[data]);\n". |
| 99 | 103 | "});\n"; |
| 100 | - if ($immediatly) |
|
| 101 | - $this->jquery_code_for_compile[]=$retour; |
|
| 104 | + if ($immediatly) { |
|
| 105 | + $this->jquery_code_for_compile[]=$retour; |
|
| 106 | + } |
|
| 102 | 107 | return $retour; |
| 103 | 108 | } |
| 104 | 109 | |
@@ -137,7 +142,7 @@ discard block |
||
| 137 | 142 | if($context===null){ |
| 138 | 143 | $appendTo="\t\tnewElm.appendTo($('".$maskSelector."').parent());\n"; |
| 139 | 144 | $newElm = "$('#'+newId)"; |
| 140 | - }else{ |
|
| 145 | + } else{ |
|
| 141 | 146 | $appendTo="\t\tnewElm.appendTo(".$context.");\n"; |
| 142 | 147 | $newElm = $context.".find('#'+newId)"; |
| 143 | 148 | } |
@@ -147,8 +152,9 @@ discard block |
||
| 147 | 152 | $retour.="\t}\n"."\tfor(var key in value){\n"."\t\t\tvar html = $('<div />').append($(newElm).clone()).html();\n"."\t\t\tif(html.indexOf('[['+key+']]')>-1){\n"."\t\t\t\tcontent=$(html.split('[['+key+']]').join(value[key]));\n"."\t\t\t\t$(newElm).replaceWith(content);newElm=content;\n"."\t\t\t}\n"."\t\tvar sel='[data-id=\"'+key+'\"]';if($(sel,newElm).length){\n"."\t\t\tvar selElm=$(sel,newElm);\n"."\t\t\t if(selElm.is('[value]')) { selElm.attr('value',value[key]);selElm.val(value[key]);} else { selElm.html(value[key]); }\n"."\t\t}\n"."}\n"."\t$(newElm).show(true);"."\n"."\t$(newElm).removeClass('hide');"."});\n"; |
| 148 | 153 | $retour.="\t$(document).trigger('jsonReady',[data]);\n"; |
| 149 | 154 | $retour.="\t".$jsCallback."\n"."});\n"; |
| 150 | - if ($immediatly) |
|
| 151 | - $this->jquery_code_for_compile[]=$retour; |
|
| 155 | + if ($immediatly) { |
|
| 156 | + $this->jquery_code_for_compile[]=$retour; |
|
| 157 | + } |
|
| 152 | 158 | return $retour; |
| 153 | 159 | } |
| 154 | 160 | /** |
@@ -189,8 +195,9 @@ discard block |
||
| 189 | 195 | }});\n"; |
| 190 | 196 | $retour.="$('#".$form."').submit();\n"; |
| 191 | 197 | } |
| 192 | - if ($immediatly) |
|
| 193 | - $this->jquery_code_for_compile[]=$retour; |
|
| 198 | + if ($immediatly) { |
|
| 199 | + $this->jquery_code_for_compile[]=$retour; |
|
| 200 | + } |
|
| 194 | 201 | return $retour; |
| 195 | 202 | } |
| 196 | 203 | |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | * |
| 208 | 208 | * @param string $element |
| 209 | 209 | * @param array $options |
| 210 | - * @return void |
|
| 210 | + * @return string |
|
| 211 | 211 | */ |
| 212 | 212 | public function sortable($element, $options=array()) { |
| 213 | 213 | if (count($options)>0) { |
@@ -351,6 +351,7 @@ discard block |
||
| 351 | 351 | /** |
| 352 | 352 | * A wrapper for writing document.ready() |
| 353 | 353 | * |
| 354 | + * @param string $js |
|
| 354 | 355 | * @return string |
| 355 | 356 | */ |
| 356 | 357 | public function _document_ready($js) { |
@@ -420,6 +421,9 @@ discard block |
||
| 420 | 421 | return $speed; |
| 421 | 422 | } |
| 422 | 423 | |
| 424 | + /** |
|
| 425 | + * @param string $input |
|
| 426 | + */ |
|
| 423 | 427 | private function minify($input) { |
| 424 | 428 | if(trim($input) === "") return $input; |
| 425 | 429 | return preg_replace( |
@@ -173,10 +173,12 @@ discard block |
||
| 173 | 173 | if (isset($param)) { |
| 174 | 174 | $param=$this->_prep_value($param); |
| 175 | 175 | $str="$({$element}).{$jQueryCall}({$param});"; |
| 176 | - } else |
|
| 177 | - $str="$({$element}).{$jQueryCall}();"; |
|
| 178 | - if ($immediatly) |
|
| 179 | - $this->jquery_code_for_compile[]=$str; |
|
| 176 | + } else { |
|
| 177 | + $str="$({$element}).{$jQueryCall}();"; |
|
| 178 | + } |
|
| 179 | + if ($immediatly) { |
|
| 180 | + $this->jquery_code_for_compile[]=$str; |
|
| 181 | + } |
|
| 180 | 182 | return $str; |
| 181 | 183 | } |
| 182 | 184 | /** |
@@ -191,8 +193,9 @@ discard block |
||
| 191 | 193 | $to=$this->_prep_element($to); |
| 192 | 194 | $element=$this->_prep_element($element); |
| 193 | 195 | $str="$({$to}).{$jQueryCall}({$element});"; |
| 194 | - if ($immediatly) |
|
| 195 | - $this->jquery_code_for_compile[]=$str; |
|
| 196 | + if ($immediatly) { |
|
| 197 | + $this->jquery_code_for_compile[]=$str; |
|
| 198 | + } |
|
| 196 | 199 | return $str; |
| 197 | 200 | } |
| 198 | 201 | // -------------------------------------------------------------------- |
@@ -260,12 +263,14 @@ discard block |
||
| 260 | 263 | if ($stopPropagation===true) { |
| 261 | 264 | $js="event.stopPropagation();\n".$js; |
| 262 | 265 | } |
| 263 | - if (array_search($event, $this->jquery_events)===false) |
|
| 264 | - $event="\n\t$(".$this->_prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
|
| 265 | - else |
|
| 266 | - $event="\n\t$(".$this->_prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
|
| 267 | - if($immediatly) |
|
| 268 | - $this->jquery_code_for_compile[]=$event; |
|
| 266 | + if (array_search($event, $this->jquery_events)===false) { |
|
| 267 | + $event="\n\t$(".$this->_prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
|
| 268 | + } else { |
|
| 269 | + $event="\n\t$(".$this->_prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
|
| 270 | + } |
|
| 271 | + if($immediatly) { |
|
| 272 | + $this->jquery_code_for_compile[]=$event; |
|
| 273 | + } |
|
| 269 | 274 | return $event; |
| 270 | 275 | } |
| 271 | 276 | |
@@ -326,8 +331,9 @@ discard block |
||
| 326 | 331 | } |
| 327 | 332 | $output=($script_tags===FALSE) ? $script : $this->inline($script); |
| 328 | 333 | |
| 329 | - if ($view!=NULL) |
|
| 330 | - $view->setVar($view_var, $output); |
|
| 334 | + if ($view!=NULL) { |
|
| 335 | + $view->setVar($view_var, $output); |
|
| 336 | + } |
|
| 331 | 337 | return $output; |
| 332 | 338 | } |
| 333 | 339 | |
@@ -421,7 +427,9 @@ discard block |
||
| 421 | 427 | } |
| 422 | 428 | |
| 423 | 429 | private function minify($input) { |
| 424 | - if(trim($input) === "") return $input; |
|
| 430 | + if(trim($input) === "") { |
|
| 431 | + return $input; |
|
| 432 | + } |
|
| 425 | 433 | return preg_replace( |
| 426 | 434 | array( |
| 427 | 435 | // Remove comment(s) |
@@ -93,7 +93,6 @@ |
||
| 93 | 93 | /** |
| 94 | 94 | * Return a new Semantic Html Breadcrumb |
| 95 | 95 | * @param string $identifier |
| 96 | - * @param array $elements |
|
| 97 | 96 | * @param boolean $autoActive sets the last element's class to <b>active</b> if true. default : true |
| 98 | 97 | * @param function $hrefFunction the function who generates the href elements. default : function($e){return $e->getContent()} |
| 99 | 98 | * @return HtmlBreadcrumb |
@@ -25,10 +25,16 @@ |
||
| 25 | 25 | return $this->addComponent(new Popup($this->js), $attachTo, $params); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | + /** |
|
| 29 | + * @param string $attachTo |
|
| 30 | + */ |
|
| 28 | 31 | public function dropdown($attachTo=NULL, $params=NULL) { |
| 29 | 32 | return $this->addComponent(new Dropdown($this->js), $attachTo, $params); |
| 30 | 33 | } |
| 31 | 34 | |
| 35 | + /** |
|
| 36 | + * @param string $attachTo |
|
| 37 | + */ |
|
| 32 | 38 | public function accordion($attachTo=NULL, $params=NULL) { |
| 33 | 39 | return $this->addComponent(new Accordion($this->js), $attachTo, $params); |
| 34 | 40 | } |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | 62 | * @param string $identifier |
| 63 | - * @param number $niveau |
|
| 63 | + * @param integer $niveau |
|
| 64 | 64 | * @param mixed $content |
| 65 | 65 | * @param string $type |
| 66 | 66 | * @return HtmlHeader |
@@ -16,10 +16,12 @@ discard block |
||
| 16 | 16 | if (isset($value)) { |
| 17 | 17 | $value=$this->_prep_value($value); |
| 18 | 18 | $str="$({$element}).attr(\"$attributeName\",{$value});"; |
| 19 | - } else |
|
| 20 | - $str="$({$element}).attr(\"$attributeName\");"; |
|
| 21 | - if ($immediatly) |
|
| 22 | - $this->jquery_code_for_compile[]=$str; |
|
| 19 | + } else { |
|
| 20 | + $str="$({$element}).attr(\"$attributeName\");"; |
|
| 21 | + } |
|
| 22 | + if ($immediatly) { |
|
| 23 | + $this->jquery_code_for_compile[]=$str; |
|
| 24 | + } |
|
| 23 | 25 | return $str; |
| 24 | 26 | } |
| 25 | 27 | |
@@ -34,8 +36,9 @@ discard block |
||
| 34 | 36 | $element=$this->_prep_element($element); |
| 35 | 37 | $value=$this->_prep_value($value); |
| 36 | 38 | $str="$({$element}).after({$value});"; |
| 37 | - if ($immediatly) |
|
| 38 | - $this->jquery_code_for_compile[]=$str; |
|
| 39 | + if ($immediatly) { |
|
| 40 | + $this->jquery_code_for_compile[]=$str; |
|
| 41 | + } |
|
| 39 | 42 | return $str; |
| 40 | 43 | } |
| 41 | 44 | |
@@ -71,8 +74,9 @@ discard block |
||
| 71 | 74 | |
| 72 | 75 | $str="$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.");"; |
| 73 | 76 | |
| 74 | - if ($immediatly) |
|
| 75 | - $this->jquery_code_for_compile[]=$str; |
|
| 77 | + if ($immediatly) { |
|
| 78 | + $this->jquery_code_for_compile[]=$str; |
|
| 79 | + } |
|
| 76 | 80 | return $str; |
| 77 | 81 | } |
| 78 | 82 | |
@@ -97,8 +101,9 @@ discard block |
||
| 97 | 101 | |
| 98 | 102 | $str="$({$element}).fadeIn({$speed}{$callback});"; |
| 99 | 103 | |
| 100 | - if ($immediatly) |
|
| 101 | - $this->jquery_code_for_compile[]=$str; |
|
| 104 | + if ($immediatly) { |
|
| 105 | + $this->jquery_code_for_compile[]=$str; |
|
| 106 | + } |
|
| 102 | 107 | return $str; |
| 103 | 108 | } |
| 104 | 109 | |
@@ -123,8 +128,9 @@ discard block |
||
| 123 | 128 | |
| 124 | 129 | $str="$({$element}).fadeOut({$speed}{$callback});"; |
| 125 | 130 | |
| 126 | - if ($immediatly) |
|
| 127 | - $this->jquery_code_for_compile[]=$str; |
|
| 131 | + if ($immediatly) { |
|
| 132 | + $this->jquery_code_for_compile[]=$str; |
|
| 133 | + } |
|
| 128 | 134 | return $str; |
| 129 | 135 | } |
| 130 | 136 | |
@@ -149,8 +155,9 @@ discard block |
||
| 149 | 155 | |
| 150 | 156 | $str="$({$element}).hide({$speed}{$callback});"; |
| 151 | 157 | |
| 152 | - if ($immediatly) |
|
| 153 | - $this->jquery_code_for_compile[]=$str; |
|
| 158 | + if ($immediatly) { |
|
| 159 | + $this->jquery_code_for_compile[]=$str; |
|
| 160 | + } |
|
| 154 | 161 | return $str; |
| 155 | 162 | } |
| 156 | 163 | |
@@ -177,8 +184,9 @@ discard block |
||
| 177 | 184 | |
| 178 | 185 | $str="$({$element}).slideUp({$speed}{$callback});"; |
| 179 | 186 | |
| 180 | - if ($immediatly) |
|
| 181 | - $this->jquery_code_for_compile[]=$str; |
|
| 187 | + if ($immediatly) { |
|
| 188 | + $this->jquery_code_for_compile[]=$str; |
|
| 189 | + } |
|
| 182 | 190 | return $str; |
| 183 | 191 | } |
| 184 | 192 | |
@@ -203,8 +211,9 @@ discard block |
||
| 203 | 211 | |
| 204 | 212 | $str="$({$element}).slideDown({$speed}{$callback});"; |
| 205 | 213 | |
| 206 | - if ($immediatly) |
|
| 207 | - $this->jquery_code_for_compile[]=$str; |
|
| 214 | + if ($immediatly) { |
|
| 215 | + $this->jquery_code_for_compile[]=$str; |
|
| 216 | + } |
|
| 208 | 217 | return $str; |
| 209 | 218 | } |
| 210 | 219 | |
@@ -229,8 +238,9 @@ discard block |
||
| 229 | 238 | |
| 230 | 239 | $str="$({$element}).slideToggle({$speed}{$callback});"; |
| 231 | 240 | |
| 232 | - if ($immediatly) |
|
| 233 | - $this->jquery_code_for_compile[]=$str; |
|
| 241 | + if ($immediatly) { |
|
| 242 | + $this->jquery_code_for_compile[]=$str; |
|
| 243 | + } |
|
| 234 | 244 | return $str; |
| 235 | 245 | } |
| 236 | 246 | |
@@ -247,8 +257,9 @@ discard block |
||
| 247 | 257 | $element=$this->_prep_element($element); |
| 248 | 258 | $str="$({$element}).toggle();"; |
| 249 | 259 | |
| 250 | - if ($immediatly) |
|
| 251 | - $this->jquery_code_for_compile[]=$str; |
|
| 260 | + if ($immediatly) { |
|
| 261 | + $this->jquery_code_for_compile[]=$str; |
|
| 262 | + } |
|
| 252 | 263 | return $str; |
| 253 | 264 | } |
| 254 | 265 | |
@@ -264,8 +275,9 @@ discard block |
||
| 264 | 275 | $element=$this->_prep_element($element); |
| 265 | 276 | $str="$({$element}).trigger(\"$event\");"; |
| 266 | 277 | |
| 267 | - if ($immediatly) |
|
| 268 | - $this->jquery_code_for_compile[]=$str; |
|
| 278 | + if ($immediatly) { |
|
| 279 | + $this->jquery_code_for_compile[]=$str; |
|
| 280 | + } |
|
| 269 | 281 | return $str; |
| 270 | 282 | } |
| 271 | 283 | |
@@ -290,8 +302,9 @@ discard block |
||
| 290 | 302 | |
| 291 | 303 | $str="$({$element}).show({$speed}{$callback});"; |
| 292 | 304 | |
| 293 | - if ($immediatly) |
|
| 294 | - $this->jquery_code_for_compile[]=$str; |
|
| 305 | + if ($immediatly) { |
|
| 306 | + $this->jquery_code_for_compile[]=$str; |
|
| 307 | + } |
|
| 295 | 308 | return $str; |
| 296 | 309 | } |
| 297 | 310 | |
@@ -309,8 +322,9 @@ discard block |
||
| 309 | 322 | $str.="else{".$jsCodeIfFalse."}"; |
| 310 | 323 | } |
| 311 | 324 | |
| 312 | - if ($immediatly) |
|
| 313 | - $this->jquery_code_for_compile[]=$str; |
|
| 325 | + if ($immediatly) { |
|
| 326 | + $this->jquery_code_for_compile[]=$str; |
|
| 327 | + } |
|
| 314 | 328 | return $str; |
| 315 | 329 | } |
| 316 | 330 | |
@@ -327,11 +341,13 @@ discard block |
||
| 327 | 341 | public function _doJQuery($element, $jqueryCall, $param="", $jsCallback="", $immediatly=false) { |
| 328 | 342 | $param=$this->_prep_value($param); |
| 329 | 343 | $callback=""; |
| 330 | - if ($jsCallback!="") |
|
| 331 | - $callback=", function(event){\n{$jsCallback}\n}"; |
|
| 344 | + if ($jsCallback!="") { |
|
| 345 | + $callback=", function(event){\n{$jsCallback}\n}"; |
|
| 346 | + } |
|
| 332 | 347 | $script="$(".$this->_prep_element($element).").".$jqueryCall."(".$param.$callback.");\n"; |
| 333 | - if ($immediatly) |
|
| 334 | - $this->jquery_code_for_compile[]=$script; |
|
| 348 | + if ($immediatly) { |
|
| 349 | + $this->jquery_code_for_compile[]=$script; |
|
| 350 | + } |
|
| 335 | 351 | return $script; |
| 336 | 352 | } |
| 337 | 353 | |
@@ -360,8 +376,9 @@ discard block |
||
| 360 | 376 | */ |
| 361 | 377 | public function _exec($js, $immediatly=false) { |
| 362 | 378 | $script=$js."\n"; |
| 363 | - if ($immediatly) |
|
| 364 | - $this->jquery_code_for_compile[]=$script; |
|
| 379 | + if ($immediatly) { |
|
| 380 | + $this->jquery_code_for_compile[]=$script; |
|
| 381 | + } |
|
| 365 | 382 | return $script; |
| 366 | 383 | } |
| 367 | 384 | |
@@ -29,11 +29,14 @@ discard block |
||
| 29 | 29 | if(\is_string($end)){ |
| 30 | 30 | $label=$end; |
| 31 | 31 | \array_pop($fields); |
| 32 | - }else $label=NULL; |
|
| 32 | + } else { |
|
| 33 | + $label=NULL; |
|
| 34 | + } |
|
| 33 | 35 | } |
| 34 | 36 | } |
| 35 | - if(isset($label)) |
|
| 36 | - $this->setLabel($label); |
|
| 37 | + if(isset($label)) { |
|
| 38 | + $this->setLabel($label); |
|
| 39 | + } |
|
| 37 | 40 | foreach ($fields as $field){ |
| 38 | 41 | $this->addItem($field); |
| 39 | 42 | } |
@@ -61,8 +64,9 @@ discard block |
||
| 61 | 64 | if($this->_equalWidth){ |
| 62 | 65 | $count=$this->count(); |
| 63 | 66 | $this->addToProperty("class", Wide::getConstants()["W".$count]." fields"); |
| 64 | - }else |
|
| 65 | - $this->addToProperty("class","fields"); |
|
| 67 | + } else { |
|
| 68 | + $this->addToProperty("class","fields"); |
|
| 69 | + } |
|
| 66 | 70 | return parent::compile($js,$view); |
| 67 | 71 | } |
| 68 | 72 | |
@@ -97,8 +101,9 @@ discard block |
||
| 97 | 101 | $fields[]=new HtmlFormRadio($name."-".$i++,$name,$item,$item); |
| 98 | 102 | } |
| 99 | 103 | $radios=new HtmlFormFields("fields-".$name,$fields); |
| 100 | - if(isset($label)) |
|
| 101 | - $radios->setLabel($label)->setProperty("for", $name); |
|
| 104 | + if(isset($label)) { |
|
| 105 | + $radios->setLabel($label)->setProperty("for", $name); |
|
| 106 | + } |
|
| 102 | 107 | return $radios; |
| 103 | 108 | } |
| 104 | 109 | |
@@ -29,8 +29,9 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | public function addHeader($title,$niveau=1,$dividing=true){ |
| 31 | 31 | $header=new HtmlHeader("",$niveau,$title); |
| 32 | - if($dividing) |
|
| 33 | - $header->setDividing(); |
|
| 32 | + if($dividing) { |
|
| 33 | + $header->setDividing(); |
|
| 34 | + } |
|
| 34 | 35 | return $this->addItem($header); |
| 35 | 36 | } |
| 36 | 37 | |
@@ -43,14 +44,17 @@ discard block |
||
| 43 | 44 | if(\is_string($end)){ |
| 44 | 45 | $label=$end; |
| 45 | 46 | \array_pop($fields); |
| 46 | - }else $label=NULL; |
|
| 47 | + } else { |
|
| 48 | + $label=NULL; |
|
| 49 | + } |
|
| 47 | 50 | } |
| 48 | 51 | $this->_fields=\array_merge($this->_fields,$fields); |
| 49 | 52 | $fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count(),$fields); |
| 50 | 53 | } |
| 51 | - if(isset($label)) |
|
| 52 | - $fields=new HtmlFormField("", $fields,$label); |
|
| 53 | - }else{ |
|
| 54 | + if(isset($label)) { |
|
| 55 | + $fields=new HtmlFormField("", $fields,$label); |
|
| 56 | + } |
|
| 57 | + } else{ |
|
| 54 | 58 | $fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count()); |
| 55 | 59 | } |
| 56 | 60 | $this->addItem($fields); |
@@ -68,7 +72,7 @@ discard block |
||
| 68 | 72 | public function getField($index){ |
| 69 | 73 | if(\is_string($index)){ |
| 70 | 74 | $field=$this->getElementById($index, $this->_fields); |
| 71 | - }else{ |
|
| 75 | + } else{ |
|
| 72 | 76 | $field=$this->_fields[$index]; |
| 73 | 77 | } |
| 74 | 78 | return $field; |
@@ -101,12 +105,15 @@ discard block |
||
| 101 | 105 | */ |
| 102 | 106 | public function addMessage($identifier,$content,$header=NULL,$icon=NULL,$type=NULL){ |
| 103 | 107 | $message=new HtmlMessage($identifier,$content); |
| 104 | - if(isset($header)) |
|
| 105 | - $message->addHeader($header); |
|
| 106 | - if(isset($icon)) |
|
| 107 | - $message->setIcon($icon); |
|
| 108 | - if(isset($type)) |
|
| 109 | - $message->setStyle($type); |
|
| 108 | + if(isset($header)) { |
|
| 109 | + $message->addHeader($header); |
|
| 110 | + } |
|
| 111 | + if(isset($icon)) { |
|
| 112 | + $message->setIcon($icon); |
|
| 113 | + } |
|
| 114 | + if(isset($type)) { |
|
| 115 | + $message->setStyle($type); |
|
| 116 | + } |
|
| 110 | 117 | return $this->addItem($message); |
| 111 | 118 | } |
| 112 | 119 | |