@@ -11,7 +11,6 @@ |
||
11 | 11 | use Ajax\bootstrap\components\Tab; |
12 | 12 | use Ajax\bootstrap\components\Carousel; |
13 | 13 | use Ajax\bootstrap\components\Collapse; |
14 | -use Ajax\Bootstrap; |
|
15 | 14 | use Ajax\common\components\SimpleComponent; |
16 | 15 | |
17 | 16 | trait BootstrapComponentsTrait { |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Ajax\common\html\HtmlDoubleElement; |
6 | 6 | use Ajax\service\JArray; |
7 | -use Ajax\JsUtils; |
|
8 | 7 | |
9 | 8 | /** |
10 | 9 | * Base class for Html collections |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | foreach ($items as $k=>$v){ |
24 | 24 | $this->addItem([$k,$v]); |
25 | 25 | } |
26 | - }else{ |
|
26 | + } else{ |
|
27 | 27 | foreach ($items as $item){ |
28 | 28 | $this->addItem($item); |
29 | 29 | } |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | * @return \Ajax\common\html\HtmlDoubleElement |
72 | 72 | */ |
73 | 73 | public function getItem($index) { |
74 | - if (is_int($index)) |
|
75 | - return $this->content[$index]; |
|
76 | - else { |
|
74 | + if (is_int($index)) { |
|
75 | + return $this->content[$index]; |
|
76 | + } else { |
|
77 | 77 | $elm=$this->getElementById($index, $this->content); |
78 | 78 | return $elm; |
79 | 79 | } |
@@ -3,8 +3,6 @@ |
||
3 | 3 | namespace Ajax\common\traits; |
4 | 4 | |
5 | 5 | use Ajax\service\JString; |
6 | -use Ajax\service\PhalconUtils; |
|
7 | -use Symfony\Component\Config\Definition\Exception\Exception; |
|
8 | 6 | trait JqueryAjaxTrait { |
9 | 7 | |
10 | 8 | protected $ajaxLoader='<span></span><span></span><span></span><span></span><span></span>'; |
@@ -41,8 +41,9 @@ discard block |
||
41 | 41 | } |
42 | 42 | $retour.="$.".$method."(url,".$params.").done(function( data ) {\n"; |
43 | 43 | $retour.=$this->_getOnAjaxDone($responseElement, $jsCallback)."});\n"; |
44 | - if ($immediatly) |
|
45 | - $this->jquery_code_for_compile[]=$retour; |
|
44 | + if ($immediatly) { |
|
45 | + $this->jquery_code_for_compile[]=$retour; |
|
46 | + } |
|
46 | 47 | return $retour; |
47 | 48 | } |
48 | 49 | |
@@ -50,13 +51,15 @@ discard block |
||
50 | 51 | $url=$this->_correctAjaxUrl($url); |
51 | 52 | $retour="url='".$url."';\n"; |
52 | 53 | $slash="/"; |
53 | - if(JString::endswith($url, "/")===true) |
|
54 | - $slash=""; |
|
54 | + if(JString::endswith($url, "/")===true) { |
|
55 | + $slash=""; |
|
56 | + } |
|
55 | 57 | if(JString::isNotNull($attr)){ |
56 | - if ($attr=="value") |
|
57 | - $retour.="url=url+'".$slash."'+$(this).val();\n"; |
|
58 | - else if($attr!=null && $attr!=="") |
|
59 | - $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
58 | + if ($attr=="value") { |
|
59 | + $retour.="url=url+'".$slash."'+$(this).val();\n"; |
|
60 | + } else if($attr!=null && $attr!=="") { |
|
61 | + $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
62 | + } |
|
60 | 63 | } |
61 | 64 | return $retour; |
62 | 65 | } |
@@ -78,8 +81,9 @@ discard block |
||
78 | 81 | } |
79 | 82 | |
80 | 83 | protected function _correctAjaxUrl($url) { |
81 | - if ($url!=="/" && JString::endsWith($url, "/")===true) |
|
82 | - $url=substr($url, 0, strlen($url)-1); |
|
84 | + if ($url!=="/" && JString::endsWith($url, "/")===true) { |
|
85 | + $url=substr($url, 0, strlen($url)-1); |
|
86 | + } |
|
83 | 87 | if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
84 | 88 | $url=$this->jsUtils->getUrl($url); |
85 | 89 | } |
@@ -103,8 +107,9 @@ discard block |
||
103 | 107 | $retour.="\t".$jsCallback."\n". |
104 | 108 | "\t$(document).trigger('jsonReady',[data]);\n". |
105 | 109 | "});\n"; |
106 | - if ($immediatly) |
|
107 | - $this->jquery_code_for_compile[]=$retour; |
|
110 | + if ($immediatly) { |
|
111 | + $this->jquery_code_for_compile[]=$retour; |
|
112 | + } |
|
108 | 113 | return $retour; |
109 | 114 | } |
110 | 115 | |
@@ -143,7 +148,7 @@ discard block |
||
143 | 148 | if($context===null){ |
144 | 149 | $appendTo="\t\tnewElm.appendTo($('".$maskSelector."').parent());\n"; |
145 | 150 | $newElm = "$('#'+newId)"; |
146 | - }else{ |
|
151 | + } else{ |
|
147 | 152 | $appendTo="\t\tnewElm.appendTo(".$context.");\n"; |
148 | 153 | $newElm = $context.".find('#'+newId)"; |
149 | 154 | } |
@@ -153,8 +158,9 @@ discard block |
||
153 | 158 | $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"; |
154 | 159 | $retour.="\t$(document).trigger('jsonReady',[data]);\n"; |
155 | 160 | $retour.="\t".$jsCallback."\n"."});\n"; |
156 | - if ($immediatly) |
|
157 | - $this->jquery_code_for_compile[]=$retour; |
|
161 | + if ($immediatly) { |
|
162 | + $this->jquery_code_for_compile[]=$retour; |
|
163 | + } |
|
158 | 164 | return $retour; |
159 | 165 | } |
160 | 166 | /** |
@@ -195,8 +201,9 @@ discard block |
||
195 | 201 | }});\n"; |
196 | 202 | $retour.="$('#".$form."').submit();\n"; |
197 | 203 | } |
198 | - if ($immediatly) |
|
199 | - $this->jquery_code_for_compile[]=$retour; |
|
204 | + if ($immediatly) { |
|
205 | + $this->jquery_code_for_compile[]=$retour; |
|
206 | + } |
|
200 | 207 | return $retour; |
201 | 208 | } |
202 | 209 |
@@ -5,7 +5,6 @@ |
||
5 | 5 | use Ajax\semantic\html\base\HtmlSemDoubleElement; |
6 | 6 | use Ajax\JsUtils; |
7 | 7 | use Ajax\service\JArray; |
8 | - |
|
9 | 8 | use Ajax\semantic\html\base\constants\State; |
10 | 9 | |
11 | 10 | class HtmlProgress extends HtmlSemDoubleElement { |
@@ -13,11 +13,13 @@ discard block |
||
13 | 13 | |
14 | 14 | public function __construct($identifier, $value=NULL, $label=NULL, $attributes=array()) { |
15 | 15 | parent::__construct($identifier, "div", "ui progress"); |
16 | - if (isset($value) === true) |
|
17 | - $this->setProperty("data-percent", $value); |
|
16 | + if (isset($value) === true) { |
|
17 | + $this->setProperty("data-percent", $value); |
|
18 | + } |
|
18 | 19 | $this->createBar(); |
19 | - if (isset($label) === true) |
|
20 | - $this->setLabel($label); |
|
20 | + if (isset($label) === true) { |
|
21 | + $this->setLabel($label); |
|
22 | + } |
|
21 | 23 | $this->_states=[ State::SUCCESS,State::WARNING,State::ERROR,State::ACTIVE,State::DISABLED ]; |
22 | 24 | $this->addToProperty("class", $attributes); |
23 | 25 | } |
@@ -116,8 +118,9 @@ discard block |
||
116 | 118 | * @see BaseHtml::run() |
117 | 119 | */ |
118 | 120 | public function run(JsUtils $js) { |
119 | - if (isset($this->_bsComponent) === false) |
|
120 | - $this->_bsComponent=$js->semantic()->progress("#" . $this->identifier, $this->_params); |
|
121 | + if (isset($this->_bsComponent) === false) { |
|
122 | + $this->_bsComponent=$js->semantic()->progress("#" . $this->identifier, $this->_params); |
|
123 | + } |
|
121 | 124 | $this->addEventsOnRun($js); |
122 | 125 | return $this->_bsComponent; |
123 | 126 | } |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Ajax\JsUtils; |
6 | 6 | use Phalcon\Text; |
7 | -use Phalcon\Mvc\Url; |
|
8 | 7 | use Ajax\ui\Properties\Position; |
9 | 8 | use Ajax\common\components\SimpleComponent; |
10 | 9 |
@@ -74,8 +74,9 @@ |
||
74 | 74 | protected function setParamCtrl($key, $value, $typeCtrl) { |
75 | 75 | if (!$typeCtrl($value)) { |
76 | 76 | throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key." à la position"); |
77 | - } else |
|
78 | - $this->setParam($key, $value); |
|
77 | + } else { |
|
78 | + $this->setParam($key, $value); |
|
79 | + } |
|
79 | 80 | } |
80 | 81 | |
81 | 82 | /* |
@@ -49,9 +49,9 @@ |
||
49 | 49 | * @return $this |
50 | 50 | */ |
51 | 51 | public function setAnimate($value) { |
52 | - if ($value instanceof Animation) |
|
53 | - $value=$value->getParams(); |
|
54 | - else if (is_string($value)) { |
|
52 | + if ($value instanceof Animation) { |
|
53 | + $value=$value->getParams(); |
|
54 | + } else if (is_string($value)) { |
|
55 | 55 | $animation=new Animation(); |
56 | 56 | $animation->setEasing($value); |
57 | 57 | } |
@@ -15,8 +15,9 @@ |
||
15 | 15 | class DialogButton extends BaseComponent { |
16 | 16 | |
17 | 17 | private function addFunction($jsCode) { |
18 | - if (!Text::startsWith($jsCode, "function")) |
|
19 | - $jsCode="%function(){" . $jsCode . "}%"; |
|
18 | + if (!Text::startsWith($jsCode, "function")) { |
|
19 | + $jsCode="%function(){" . $jsCode . "}%"; |
|
20 | + } |
|
20 | 21 | return $jsCode; |
21 | 22 | } |
22 | 23 |
@@ -81,8 +81,9 @@ |
||
81 | 81 | $vars=get_object_vars($this); |
82 | 82 | $result=array (); |
83 | 83 | foreach ( $vars as $k => $v ) { |
84 | - if (isset($v)) |
|
85 | - $result[$k]=$v; |
|
84 | + if (isset($v)) { |
|
85 | + $result[$k]=$v; |
|
86 | + } |
|
86 | 87 | } |
87 | 88 | return $result; |
88 | 89 | } |