@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | use Ajax\semantic\traits\SemanticHtmlElementsTrait; |
21 | 21 | |
22 | 22 | class Semantic extends BaseGui { |
23 | - use SemanticComponentsTrait,SemanticHtmlElementsTrait; |
|
23 | + use SemanticComponentsTrait, SemanticHtmlElementsTrait; |
|
24 | 24 | public function __construct($autoCompile=true) { |
25 | 25 | parent::__construct($autoCompile=true); |
26 | 26 | } |
@@ -31,24 +31,24 @@ discard block |
||
31 | 31 | * @param array $items |
32 | 32 | * @return Ajax\semantic\html\collections\HtmlMenu |
33 | 33 | */ |
34 | - public function htmlMenu($identifier,$items=array()){ |
|
35 | - return $this->addHtmlComponent(new HtmlMenu($identifier,$items)); |
|
34 | + public function htmlMenu($identifier, $items=array()) { |
|
35 | + return $this->addHtmlComponent(new HtmlMenu($identifier, $items)); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /**Adds an icon menu |
39 | 39 | * @param string $identifier |
40 | 40 | * @param array $items icons |
41 | 41 | */ |
42 | - public function htmlIconMenu($identifier,$items=array()){ |
|
43 | - return $this->addHtmlComponent(new HtmlIconMenu($identifier,$items)); |
|
42 | + public function htmlIconMenu($identifier, $items=array()) { |
|
43 | + return $this->addHtmlComponent(new HtmlIconMenu($identifier, $items)); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /**Adds an labeled icon menu |
47 | 47 | * @param string $identifier |
48 | 48 | * @param array $items icons |
49 | 49 | */ |
50 | - public function htmlLabeledIconMenu($identifier,$items=array()){ |
|
51 | - return $this->addHtmlComponent(new HtmlLabeledIconMenu($identifier,$items)); |
|
50 | + public function htmlLabeledIconMenu($identifier, $items=array()) { |
|
51 | + return $this->addHtmlComponent(new HtmlLabeledIconMenu($identifier, $items)); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | * @param string $value |
57 | 57 | * @param array $items |
58 | 58 | */ |
59 | - public function htmlDropdown($identifier, $value="", $items=array()){ |
|
60 | - return $this->addHtmlComponent(new HtmlDropdown($identifier,$value,$items)); |
|
59 | + public function htmlDropdown($identifier, $value="", $items=array()) { |
|
60 | + return $this->addHtmlComponent(new HtmlDropdown($identifier, $value, $items)); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -65,16 +65,16 @@ discard block |
||
65 | 65 | * @param string $identifier |
66 | 66 | * @param string $content |
67 | 67 | */ |
68 | - public function htmlMessage($identifier, $content=""){ |
|
69 | - return $this->addHtmlComponent(new HtmlMessage($identifier,$content)); |
|
68 | + public function htmlMessage($identifier, $content="") { |
|
69 | + return $this->addHtmlComponent(new HtmlMessage($identifier, $content)); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
73 | 73 | * @param string $identifier |
74 | 74 | * @param mixed $content |
75 | 75 | */ |
76 | - public function htmlPopup(BaseHtml $container,$identifier,$content){ |
|
77 | - return $this->addHtmlComponent(new HtmlPopup($container,$identifier,$content)); |
|
76 | + public function htmlPopup(BaseHtml $container, $identifier, $content) { |
|
77 | + return $this->addHtmlComponent(new HtmlPopup($container, $identifier, $content)); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | * @param boolean $createCols |
85 | 85 | * @param boolean $implicitRows |
86 | 86 | */ |
87 | - public function htmlGrid($identifier,$numRows=1,$numCols=NULL,$createCols=true,$implicitRows=false){ |
|
88 | - return $this->addHtmlComponent(new HtmlGrid($identifier,$numRows,$numCols,$createCols,$implicitRows)); |
|
87 | + public function htmlGrid($identifier, $numRows=1, $numCols=NULL, $createCols=true, $implicitRows=false) { |
|
88 | + return $this->addHtmlComponent(new HtmlGrid($identifier, $numRows, $numCols, $createCols, $implicitRows)); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | * @param function $hrefFunction the function who generates the href elements. default : function($e){return $e->getContent()} |
99 | 99 | * @return HtmlBreadcrumb |
100 | 100 | */ |
101 | - public function htmlBreadcrumb( $identifier,$items=array(),$autoActive=true,$startIndex=0,$hrefFunction=NULL){ |
|
102 | - return $this->addHtmlComponent(new HtmlBreadcrumb($identifier,$items,$autoActive,$startIndex,$hrefFunction)); |
|
101 | + public function htmlBreadcrumb($identifier, $items=array(), $autoActive=true, $startIndex=0, $hrefFunction=NULL) { |
|
102 | + return $this->addHtmlComponent(new HtmlBreadcrumb($identifier, $items, $autoActive, $startIndex, $hrefFunction)); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | * @param string $identifier |
117 | 117 | * @return HtmlAccordion |
118 | 118 | */ |
119 | - public function htmlAccordionMenu($identifier,$items=array()) { |
|
120 | - return $this->addHtmlComponent(new HtmlAccordionMenu($identifier,$items)); |
|
119 | + public function htmlAccordionMenu($identifier, $items=array()) { |
|
120 | + return $this->addHtmlComponent(new HtmlAccordionMenu($identifier, $items)); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @param string $identifier |
126 | 126 | * @param array $elements |
127 | 127 | */ |
128 | - public function htmlForm($identifier,$elements=array()) { |
|
129 | - return $this->addHtmlComponent(new HtmlForm($identifier,$elements)); |
|
128 | + public function htmlForm($identifier, $elements=array()) { |
|
129 | + return $this->addHtmlComponent(new HtmlForm($identifier, $elements)); |
|
130 | 130 | } |
131 | 131 | } |
132 | 132 | \ No newline at end of file |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | if (isset($value)) { |
17 | 17 | $value=$this->_prep_value($value); |
18 | 18 | $str="$({$element}).attr(\"$attributeName\",{$value});"; |
19 | - } else |
|
19 | + }else |
|
20 | 20 | $str="$({$element}).attr(\"$attributeName\");"; |
21 | 21 | if ($immediatly) |
22 | 22 | $this->jquery_code_for_compile[]=$str; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @param boolean $immediatly defers the execution if set to false |
31 | 31 | * @return string |
32 | 32 | */ |
33 | - public function after($element='this', $value='', $immediatly=false){ |
|
33 | + public function after($element='this', $value='', $immediatly=false) { |
|
34 | 34 | $element=$this->_prep_element($element); |
35 | 35 | $value=$this->_prep_value($value); |
36 | 36 | $str="$({$element}).after({$value});"; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | $animations="\t\t\t"; |
57 | 57 | if (is_array($params)) { |
58 | - foreach ( $params as $param => $value ) { |
|
58 | + foreach ($params as $param => $value) { |
|
59 | 59 | $animations.=$param.': \''.$value.'\', '; |
60 | 60 | } |
61 | 61 | } |
@@ -348,8 +348,8 @@ discard block |
||
348 | 348 | * @param boolean $immediatly |
349 | 349 | * @return string |
350 | 350 | */ |
351 | - public function _doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param="", $preventDefault=false, $stopPropagation=false, $jsCallback="",$immediatly=true) { |
|
352 | - return $this->_add_event($element, $this->_doJQuery($elementToModify, $jqueryCall, $param, $jsCallback), $event, $preventDefault, $stopPropagation,$immediatly); |
|
351 | + public function _doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param="", $preventDefault=false, $stopPropagation=false, $jsCallback="", $immediatly=true) { |
|
352 | + return $this->_add_event($element, $this->_doJQuery($elementToModify, $jqueryCall, $param, $jsCallback), $event, $preventDefault, $stopPropagation, $immediatly); |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | /** |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | * @param boolean $immediatly |
376 | 376 | * @return String |
377 | 377 | */ |
378 | - public function _execOn($element, $event, $js, $preventDefault=false, $stopPropagation=false,$immediatly=true) { |
|
379 | - return $this->_add_event($element, $this->_exec($js), $event, $preventDefault, $stopPropagation,$immediatly); |
|
378 | + public function _execOn($element, $event, $js, $preventDefault=false, $stopPropagation=false, $immediatly=true) { |
|
379 | + return $this->_add_event($element, $this->_exec($js), $event, $preventDefault, $stopPropagation, $immediatly); |
|
380 | 380 | } |
381 | 381 | } |
382 | 382 | \ No newline at end of file |
@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | * @param string $jsCallback javascript code to execute after the request |
18 | 18 | * @param boolean $hasLoader true for showing ajax loader. default : true |
19 | 19 | */ |
20 | - public function get($url, $responseElement="", $params="{}", $jsCallback=NULL,$hasLoader=true) { |
|
21 | - return $this->js->_get($url, $params, $responseElement, $jsCallback, NULL, $hasLoader,true); |
|
20 | + public function get($url, $responseElement="", $params="{}", $jsCallback=NULL, $hasLoader=true) { |
|
21 | + return $this->js->_get($url, $params, $responseElement, $jsCallback, NULL, $hasLoader, true); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | * @param string $jsCallback javascript code to execute after the request |
30 | 30 | * @param boolean $immediatly |
31 | 31 | */ |
32 | - public function json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document",$immediatly=false) { |
|
33 | - return $this->js->_json($url, $method, $params, $jsCallback, $attr, $context,$immediatly); |
|
32 | + public function json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document", $immediatly=false) { |
|
33 | + return $this->js->_json($url, $method, $params, $jsCallback, $attr, $context, $immediatly); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | * @param string $url the request address |
41 | 41 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true) |
42 | 42 | */ |
43 | - public function jsonOn($event,$element, $url,$parameters=array()) { |
|
44 | - return $this->js->_jsonOn($event, $element, $url,$parameters); |
|
43 | + public function jsonOn($event, $element, $url, $parameters=array()) { |
|
44 | + return $this->js->_jsonOn($event, $element, $url, $parameters); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | * @param string $url the request url |
86 | 86 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true) |
87 | 87 | */ |
88 | - public function jsonArrayOn($event,$element,$maskSelector, $url,$parameters=array()) { |
|
89 | - return $this->js->_jsonArrayOn($event,$element,$maskSelector, $url, $parameters); |
|
88 | + public function jsonArrayOn($event, $element, $maskSelector, $url, $parameters=array()) { |
|
89 | + return $this->js->_jsonArrayOn($event, $element, $maskSelector, $url, $parameters); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @param string $jsCallback javascript code to execute after the request |
99 | 99 | * @param string $attr the html attribute added to the request |
100 | 100 | */ |
101 | - public function getDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL,$attr="id") { |
|
101 | + public function getDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id") { |
|
102 | 102 | return $this->js->_get($url, $params, $responseElement, $jsCallback, $attr, false); |
103 | 103 | } |
104 | 104 | |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | * @param string $jsCallback javascript code to execute after the request |
137 | 137 | * @param boolean $hasLoader true for showing ajax loader. default : true |
138 | 138 | */ |
139 | - public function post($url, $responseElement="", $params="{}", $jsCallback=NULL,$hasLoader=true) { |
|
140 | - return $this->js->_post($url, $params, $responseElement, $jsCallback, NULL, $hasLoader,true); |
|
139 | + public function post($url, $responseElement="", $params="{}", $jsCallback=NULL, $hasLoader=true) { |
|
140 | + return $this->js->_post($url, $params, $responseElement, $jsCallback, NULL, $hasLoader, true); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
@@ -150,8 +150,8 @@ discard block |
||
150 | 150 | * @param string $jsCallback javascript code to execute after the request |
151 | 151 | * @param boolean $hasLoader true for showing ajax loader. default : true |
152 | 152 | */ |
153 | - public function postDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id",$hasLoader=true) { |
|
154 | - return $this->js->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader,false); |
|
153 | + public function postDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id", $hasLoader=true) { |
|
154 | + return $this->js->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, false); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true) |
166 | 166 | */ |
167 | 167 | public function postOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) { |
168 | - return $this->js->_postOn($event, $element, $url, $params, $responseElement, $parameters); |
|
168 | + return $this->js->_postOn($event, $element, $url, $params, $responseElement, $parameters); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -189,8 +189,8 @@ discard block |
||
189 | 189 | * @param string $jsCallback javascript code to execute after the request |
190 | 190 | * @param boolean $hasLoader true for showing ajax loader. default : true |
191 | 191 | */ |
192 | - public function postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL,$hasLoader=true) { |
|
193 | - return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, NULL, $hasLoader,true); |
|
192 | + public function postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $hasLoader=true) { |
|
193 | + return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, NULL, $hasLoader, true); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | /** |
@@ -203,8 +203,8 @@ discard block |
||
203 | 203 | * @param string $attr the html attribute added to the request |
204 | 204 | * @param boolean $hasLoader true for showing ajax loader. default : true |
205 | 205 | */ |
206 | - public function postFormDeferred($url, $form, $responseElement, $validation=false, $jsCallback=NULL,$attr="id",$hasLoader=true) { |
|
207 | - return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader,false); |
|
206 | + public function postFormDeferred($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true) { |
|
207 | + return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader, false); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true) |
219 | 219 | */ |
220 | 220 | public function postFormOn($event, $element, $url, $form, $responseElement="", $parameters=array()) { |
221 | - return $this->js->_postFormOn($event,$element, $url, $form, $responseElement, $parameters); |
|
221 | + return $this->js->_postFormOn($event, $element, $url, $form, $responseElement, $parameters); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | /** |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * @return string |
14 | 14 | */ |
15 | 15 | public function addClass($element='this', $class='', $immediatly=false) { |
16 | - return $this->js->_genericCallValue('addClass',$element, $class, $immediatly); |
|
16 | + return $this->js->_genericCallValue('addClass', $element, $class, $immediatly); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | /** |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | * @param boolean $immediatly defers the execution if set to false |
24 | 24 | * @return string |
25 | 25 | */ |
26 | - public function after($to, $element, $immediatly=false){ |
|
27 | - return $this->js->_genericCallElement('after',$to, $element, $immediatly); |
|
26 | + public function after($to, $element, $immediatly=false) { |
|
27 | + return $this->js->_genericCallElement('after', $to, $element, $immediatly); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | * @param boolean $immediatly defers the execution if set to false |
35 | 35 | * @return string |
36 | 36 | */ |
37 | - public function before($to, $element, $immediatly=false){ |
|
38 | - return $this->js->_genericCallElement('before',$to, $element, $immediatly); |
|
37 | + public function before($to, $element, $immediatly=false) { |
|
38 | + return $this->js->_genericCallElement('before', $to, $element, $immediatly); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | * @param string $value |
56 | 56 | * @param boolean $immediatly defers the execution if set to false |
57 | 57 | */ |
58 | - public function val($element='this',$value='',$immediatly=false){ |
|
59 | - return $this->js->_genericCallValue('val',$element,$value,$immediatly); |
|
58 | + public function val($element='this', $value='', $immediatly=false) { |
|
59 | + return $this->js->_genericCallValue('val', $element, $value, $immediatly); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * @param boolean $immediatly defers the execution if set to false |
67 | 67 | */ |
68 | 68 | public function html($element='this', $value='', $immediatly=false) { |
69 | - return $this->js->_genericCallValue('html',$element, $value, $immediatly); |
|
69 | + return $this->js->_genericCallValue('html', $element, $value, $immediatly); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @return string |
92 | 92 | */ |
93 | 93 | public function append($to, $element, $immediatly=false) { |
94 | - return $this->js->_genericCallElement('append',$to, $element, $immediatly); |
|
94 | + return $this->js->_genericCallElement('append', $to, $element, $immediatly); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @return string |
103 | 103 | */ |
104 | 104 | public function prepend($to, $element, $immediatly=false) { |
105 | - return $this->js->_genericCallElement('prepend',$to, $element, $immediatly); |
|
105 | + return $this->js->_genericCallElement('prepend', $to, $element, $immediatly); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @return string |
154 | 154 | */ |
155 | 155 | public function removeClass($element='this', $class='', $immediatly=false) { |
156 | - return $this->js->_genericCall('removeClass',$element, $class, $immediatly); |
|
156 | + return $this->js->_genericCall('removeClass', $element, $class, $immediatly); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | * @return string |
215 | 215 | */ |
216 | 216 | public function toggleClass($element='this', $class='', $immediatly=false) { |
217 | - return $this->js->_genericCallValue('toggleClass',$element, $class, $immediatly); |
|
217 | + return $this->js->_genericCallValue('toggleClass', $element, $class, $immediatly); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | /** |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | $preventDefault=false; |
291 | 291 | $immediatly=true; |
292 | 292 | extract($parameters); |
293 | - return $this->js->_doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param, $preventDefault, $stopPropagation, $jsCallback,$immediatly); |
|
293 | + return $this->js->_doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param, $preventDefault, $stopPropagation, $jsCallback, $immediatly); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | /** |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | $preventDefault=false; |
318 | 318 | $immediatly=true; |
319 | 319 | extract($parameters); |
320 | - $script=$this->js->_execOn($element, $event, $js, $preventDefault, $stopPropagation,$immediatly); |
|
320 | + $script=$this->js->_execOn($element, $event, $js, $preventDefault, $stopPropagation, $immediatly); |
|
321 | 321 | return $script; |
322 | 322 | } |
323 | 323 | } |
324 | 324 | \ No newline at end of file |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | $loading_notifier='<div class="ajax-loader">'; |
10 | 10 | if ($this->ajaxLoader=='') { |
11 | 11 | $loading_notifier.="Loading..."; |
12 | - } else { |
|
12 | + }else { |
|
13 | 13 | $loading_notifier.=$this->ajaxLoader; |
14 | 14 | } |
15 | 15 | $loading_notifier.='</div>'; |
@@ -17,20 +17,20 @@ discard block |
||
17 | 17 | $retour.="\t\t$({$responseElement}).prepend('{$loading_notifier}');\n"; |
18 | 18 | } |
19 | 19 | |
20 | - public function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
|
21 | - return $this->_ajax("get", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$immediatly); |
|
20 | + public function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) { |
|
21 | + return $this->_ajax("get", $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $immediatly); |
|
22 | 22 | } |
23 | - public function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
|
24 | - return $this->_ajax("post", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$immediatly); |
|
23 | + public function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) { |
|
24 | + return $this->_ajax("post", $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $immediatly); |
|
25 | 25 | } |
26 | 26 | |
27 | - protected function _ajax($method,$url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
|
28 | - if(JString::isNull($params)){$params="{}";} |
|
27 | + protected function _ajax($method, $url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) { |
|
28 | + if (JString::isNull($params)) {$params="{}"; } |
|
29 | 29 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
30 | 30 | $retour=$this->_getAjaxUrl($url, $attr); |
31 | 31 | $responseElement=$this->_getResponseElement($responseElement); |
32 | 32 | $retour.="var self=this;\n"; |
33 | - if($hasLoader===true){ |
|
33 | + if ($hasLoader===true) { |
|
34 | 34 | $this->addLoading($retour, $responseElement); |
35 | 35 | } |
36 | 36 | $retour.="$.".$method."(url,".$params.").done(function( data ) {\n"; |
@@ -40,22 +40,22 @@ discard block |
||
40 | 40 | return $retour; |
41 | 41 | } |
42 | 42 | |
43 | - protected function _getAjaxUrl($url,$attr){ |
|
43 | + protected function _getAjaxUrl($url, $attr) { |
|
44 | 44 | $url=$this->_correctAjaxUrl($url); |
45 | 45 | $retour="url='".$url."';\n"; |
46 | 46 | $slash="/"; |
47 | - if(PhalconUtils::endsWith($url, "/")) |
|
47 | + if (PhalconUtils::endsWith($url, "/")) |
|
48 | 48 | $slash=""; |
49 | - if(JString::isNotNull($attr)){ |
|
49 | + if (JString::isNotNull($attr)) { |
|
50 | 50 | if ($attr=="value") |
51 | 51 | $retour.="url=url+'".$slash."'+$(this).val();\n"; |
52 | - else if($attr!=null && $attr!=="") |
|
52 | + else if ($attr!=null && $attr!=="") |
|
53 | 53 | $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
54 | 54 | } |
55 | 55 | return $retour; |
56 | 56 | } |
57 | 57 | |
58 | - protected function _getOnAjaxDone($responseElement,$jsCallback){ |
|
58 | + protected function _getOnAjaxDone($responseElement, $jsCallback) { |
|
59 | 59 | $retour=""; |
60 | 60 | if ($responseElement!=="") { |
61 | 61 | $retour="\t$({$responseElement}).html( data );\n"; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | return $retour; |
65 | 65 | } |
66 | 66 | |
67 | - protected function _getResponseElement($responseElement){ |
|
67 | + protected function _getResponseElement($responseElement) { |
|
68 | 68 | if ($responseElement!=="") { |
69 | 69 | $responseElement=$this->_prep_value($responseElement); |
70 | 70 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | protected function _correctAjaxUrl($url) { |
75 | 75 | if (PhalconUtils::endsWith($url, "/")) |
76 | 76 | $url=substr($url, 0, strlen($url)-1); |
77 | - if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
|
77 | + if (strncmp($url, 'http://', 7)!=0 && strncmp($url, 'https://', 8)!=0) { |
|
78 | 78 | $url=$this->_di->get("url")->get($url); |
79 | 79 | } |
80 | 80 | return $url; |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @param string $jsCallback javascript code to execute after the request |
89 | 89 | * @param boolean $immediatly |
90 | 90 | */ |
91 | - public function _json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document",$immediatly=false) { |
|
91 | + public function _json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document", $immediatly=false) { |
|
92 | 92 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
93 | 93 | $retour=$this->_getAjaxUrl($url, $attr); |
94 | 94 | $retour.="$.{$method}(url,".$params.").done(function( data ) {\n"; |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @param string $url the request address |
110 | 110 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true) |
111 | 111 | */ |
112 | - public function _jsonOn($event,$element, $url,$parameters=array()) { |
|
112 | + public function _jsonOn($event, $element, $url, $parameters=array()) { |
|
113 | 113 | $preventDefault=true; |
114 | 114 | $stopPropagation=true; |
115 | 115 | $jsCallback=null; |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $params="{}"; |
120 | 120 | $immediatly=true; |
121 | 121 | extract($parameters); |
122 | - return $this->_add_event($element, $this->_json($url,$method, $params,$jsCallback, $attr,$context), $event, $preventDefault, $stopPropagation,$immediatly); |
|
122 | + return $this->_add_event($element, $this->_json($url, $method, $params, $jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation, $immediatly); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -131,19 +131,19 @@ discard block |
||
131 | 131 | * @param string $context jquery DOM element, array container. |
132 | 132 | * @param boolean $immediatly |
133 | 133 | */ |
134 | - public function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context=null,$immediatly=false) { |
|
134 | + public function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context=null, $immediatly=false) { |
|
135 | 135 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
136 | 136 | $retour=$this->_getAjaxUrl($url, $attr); |
137 | - if($context===null){ |
|
137 | + if ($context===null) { |
|
138 | 138 | $appendTo="\t\tnewElm.appendTo($('".$maskSelector."').parent());\n"; |
139 | - $newElm = "$('#'+newId)"; |
|
140 | - }else{ |
|
139 | + $newElm="$('#'+newId)"; |
|
140 | + }else { |
|
141 | 141 | $appendTo="\t\tnewElm.appendTo(".$context.");\n"; |
142 | - $newElm = $context.".find('#'+newId)"; |
|
142 | + $newElm=$context.".find('#'+newId)"; |
|
143 | 143 | } |
144 | 144 | $retour.="var self = $(this);\n$.{$method}(url,".$params.").done(function( data ) {\n"; |
145 | 145 | $retour.="\tdata=$.parseJSON(data);$.each(data, function(index, value) {\n"."\tvar created=false;var maskElm=$('".$maskSelector."').first();maskElm.hide();"."\tvar newId=(maskElm.attr('id') || 'mask')+'-'+index;"."\tvar newElm=".$newElm.";\n"."\tif(!newElm.length){\n"."\t\tnewElm=maskElm.clone();newElm.attr('id',newId);\n"; |
146 | - $retour.= $appendTo; |
|
146 | + $retour.=$appendTo; |
|
147 | 147 | $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 | 148 | $retour.="\t$(document).trigger('jsonReady',[data]);\n"; |
149 | 149 | $retour.="\t".$jsCallback."\n"."});\n"; |
@@ -158,26 +158,26 @@ discard block |
||
158 | 158 | * @param string $url the request address |
159 | 159 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get", "context"=>null) |
160 | 160 | */ |
161 | - public function _jsonArrayOn($event,$element, $maskSelector,$url,$parameters=array()) { |
|
161 | + public function _jsonArrayOn($event, $element, $maskSelector, $url, $parameters=array()) { |
|
162 | 162 | $preventDefault=true; |
163 | 163 | $stopPropagation=true; |
164 | 164 | $jsCallback=null; |
165 | 165 | $attr="id"; |
166 | 166 | $method="get"; |
167 | - $context = null; |
|
167 | + $context=null; |
|
168 | 168 | $params="{}"; |
169 | 169 | $immediatly=true; |
170 | 170 | extract($parameters); |
171 | - return $this->_add_event($element, $this->_jsonArray($maskSelector,$url,$method, $params,$jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation,$immediatly); |
|
171 | + return $this->_add_event($element, $this->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation, $immediatly); |
|
172 | 172 | } |
173 | 173 | |
174 | - public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
|
174 | + public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) { |
|
175 | 175 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
176 | 176 | $retour=$this->_getAjaxUrl($url, $attr); |
177 | 177 | $retour.="\nvar params=$('#".$form."').serialize();\n"; |
178 | 178 | $responseElement=$this->_getResponseElement($responseElement); |
179 | 179 | $retour.="var self=this;\n"; |
180 | - if($hasLoader===true){ |
|
180 | + if ($hasLoader===true) { |
|
181 | 181 | $this->addLoading($retour, $responseElement); |
182 | 182 | } |
183 | 183 | $retour.="$.post(url,params).done(function( data ) {\n"; |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * @param string $responseElement |
205 | 205 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true) |
206 | 206 | */ |
207 | - public function _getOn($event,$element, $url, $params="{}", $responseElement="", $parameters=array()) { |
|
207 | + public function _getOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) { |
|
208 | 208 | $preventDefault=true; |
209 | 209 | $stopPropagation=true; |
210 | 210 | $jsCallback=null; |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | $hasLoader=true; |
213 | 213 | $immediatly=true; |
214 | 214 | extract($parameters); |
215 | - return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr,$hasLoader), $event, $preventDefault, $stopPropagation,$immediatly); |
|
215 | + return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr, $hasLoader), $event, $preventDefault, $stopPropagation, $immediatly); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | /** |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * @param string $responseElement |
226 | 226 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true) |
227 | 227 | */ |
228 | - public function _postOn($event,$element, $url, $params="{}", $responseElement="", $parameters=array()) { |
|
228 | + public function _postOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) { |
|
229 | 229 | $preventDefault=true; |
230 | 230 | $stopPropagation=true; |
231 | 231 | $jsCallback=null; |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | $hasLoader=true; |
234 | 234 | $immediatly=true; |
235 | 235 | extract($parameters); |
236 | - return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr,$hasLoader), $event, $preventDefault, $stopPropagation,$immediatly); |
|
236 | + return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader), $event, $preventDefault, $stopPropagation, $immediatly); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | /** |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | * @param string $responseElement |
247 | 247 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true) |
248 | 248 | */ |
249 | - public function _postFormOn($event,$element, $url, $form, $responseElement="", $parameters=array()) { |
|
249 | + public function _postFormOn($event, $element, $url, $form, $responseElement="", $parameters=array()) { |
|
250 | 250 | $preventDefault=true; |
251 | 251 | $stopPropagation=true; |
252 | 252 | $validation=false; |
@@ -255,6 +255,6 @@ discard block |
||
255 | 255 | $hasLoader=true; |
256 | 256 | $immediatly=true; |
257 | 257 | extract($parameters); |
258 | - return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr,$hasLoader), $event, $preventDefault, $stopPropagation,$immediatly); |
|
258 | + return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader), $event, $preventDefault, $stopPropagation, $immediatly); |
|
259 | 259 | } |
260 | 260 | } |
261 | 261 | \ No newline at end of file |
@@ -44,7 +44,7 @@ |
||
44 | 44 | */ |
45 | 45 | public function _click($element='this', $js=array(), $ret_false=TRUE) { |
46 | 46 | if (!is_array($js)) { |
47 | - $js=array ( |
|
47 | + $js=array( |
|
48 | 48 | $js |
49 | 49 | ); |
50 | 50 | } |
@@ -15,26 +15,26 @@ discard block |
||
15 | 15 | protected $_equalWidth; |
16 | 16 | protected $_name; |
17 | 17 | |
18 | - public function __construct($identifier, $fields=array(),$equalWidth=true) { |
|
18 | + public function __construct($identifier, $fields=array(), $equalWidth=true) { |
|
19 | 19 | parent::__construct($identifier, "div"); |
20 | 20 | $this->_equalWidth=$equalWidth; |
21 | 21 | $this->addItems($fields); |
22 | 22 | } |
23 | 23 | |
24 | - public function addFields($fields=NULL,$label=NULL){ |
|
25 | - if(!$fields instanceof HtmlFormFields){ |
|
26 | - if(\is_array($fields)===false){ |
|
27 | - $fields = \func_get_args(); |
|
24 | + public function addFields($fields=NULL, $label=NULL) { |
|
25 | + if (!$fields instanceof HtmlFormFields) { |
|
26 | + if (\is_array($fields)===false) { |
|
27 | + $fields=\func_get_args(); |
|
28 | 28 | $end=\end($fields); |
29 | - if(\is_string($end)){ |
|
29 | + if (\is_string($end)) { |
|
30 | 30 | $label=$end; |
31 | 31 | \array_pop($fields); |
32 | 32 | }else $label=NULL; |
33 | 33 | } |
34 | 34 | } |
35 | - if(isset($label)) |
|
35 | + if (isset($label)) |
|
36 | 36 | $this->setLabel($label); |
37 | - foreach ($fields as $field){ |
|
37 | + foreach ($fields as $field) { |
|
38 | 38 | $this->addItem($field); |
39 | 39 | } |
40 | 40 | return $this; |
@@ -44,39 +44,39 @@ discard block |
||
44 | 44 | * @param string|HtmlSemDoubleElement $label |
45 | 45 | * @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
46 | 46 | */ |
47 | - public function setLabel($label){ |
|
47 | + public function setLabel($label) { |
|
48 | 48 | $labelO=$label; |
49 | - if(\is_string($label)){ |
|
50 | - $labelO=new HtmlSemDoubleElement("","label","",$label); |
|
49 | + if (\is_string($label)) { |
|
50 | + $labelO=new HtmlSemDoubleElement("", "label", "", $label); |
|
51 | 51 | } |
52 | - $this->insertItem($labelO,0); |
|
52 | + $this->insertItem($labelO, 0); |
|
53 | 53 | return $labelO; |
54 | 54 | } |
55 | - public function addItem($item){ |
|
55 | + public function addItem($item) { |
|
56 | 56 | $item=parent::addItem($item); |
57 | 57 | $item->setContainer($this); |
58 | 58 | return $item; |
59 | 59 | } |
60 | - public function compile(JsUtils $js=NULL,View $view=NULL){ |
|
61 | - if($this->_equalWidth){ |
|
60 | + public function compile(JsUtils $js=NULL, View $view=NULL) { |
|
61 | + if ($this->_equalWidth) { |
|
62 | 62 | $count=$this->count(); |
63 | 63 | $this->addToProperty("class", Wide::getConstants()["W".$count]." fields"); |
64 | 64 | }else |
65 | - $this->addToProperty("class","fields"); |
|
66 | - return parent::compile($js,$view); |
|
65 | + $this->addToProperty("class", "fields"); |
|
66 | + return parent::compile($js, $view); |
|
67 | 67 | } |
68 | 68 | |
69 | - public function setWidth($index,$width){ |
|
69 | + public function setWidth($index, $width) { |
|
70 | 70 | $this->_equalWidth=false; |
71 | 71 | return $this->getItem($index)->setWidth($width); |
72 | 72 | } |
73 | 73 | |
74 | - public function setInline(){ |
|
74 | + public function setInline() { |
|
75 | 75 | $this->_equalWidth=false; |
76 | 76 | $this->addToProperty("class", "inline"); |
77 | 77 | } |
78 | 78 | |
79 | - public function setGrouped(){ |
|
79 | + public function setGrouped() { |
|
80 | 80 | $this->_equalWidth=false; |
81 | 81 | $this->addToProperty("class", "grouped"); |
82 | 82 | } |
@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | return $this; |
91 | 91 | } |
92 | 92 | |
93 | - public static function radios($name,$items=array(),$label=NULL){ |
|
93 | + public static function radios($name, $items=array(), $label=NULL) { |
|
94 | 94 | $fields=array(); |
95 | 95 | $i=0; |
96 | - foreach ($items as $item){ |
|
97 | - $fields[]=new HtmlFormRadio($name."-".$i++,$name,$item,$item); |
|
96 | + foreach ($items as $item) { |
|
97 | + $fields[]=new HtmlFormRadio($name."-".$i++, $name, $item, $item); |
|
98 | 98 | } |
99 | - $radios=new HtmlFormFields("fields-".$name,$fields); |
|
100 | - if(isset($label)) |
|
99 | + $radios=new HtmlFormFields("fields-".$name, $fields); |
|
100 | + if (isset($label)) |
|
101 | 101 | $radios->setLabel($label)->setProperty("for", $name); |
102 | 102 | return $radios; |
103 | 103 | } |
@@ -13,62 +13,62 @@ discard block |
||
13 | 13 | * @author jc |
14 | 14 | * @version 1.001 |
15 | 15 | */ |
16 | -class HtmlForm extends HtmlSemCollection{ |
|
16 | +class HtmlForm extends HtmlSemCollection { |
|
17 | 17 | |
18 | 18 | use FieldsTrait; |
19 | 19 | |
20 | 20 | protected $_fields; |
21 | 21 | |
22 | - public function __construct( $identifier, $elements=array()){ |
|
23 | - parent::__construct( $identifier, "form", "ui form"); |
|
24 | - $this->_states=[State::ERROR,State::SUCCESS,State::WARNING,State::DISABLED]; |
|
22 | + public function __construct($identifier, $elements=array()) { |
|
23 | + parent::__construct($identifier, "form", "ui form"); |
|
24 | + $this->_states=[State::ERROR, State::SUCCESS, State::WARNING, State::DISABLED]; |
|
25 | 25 | $this->setProperty("name", $this->identifier); |
26 | 26 | $this->_fields=array(); |
27 | 27 | $this->addItems($elements); |
28 | 28 | } |
29 | 29 | |
30 | - public function addHeader($title,$niveau=1,$dividing=true){ |
|
31 | - $header=new HtmlHeader("",$niveau,$title); |
|
32 | - if($dividing) |
|
30 | + public function addHeader($title, $niveau=1, $dividing=true) { |
|
31 | + $header=new HtmlHeader("", $niveau, $title); |
|
32 | + if ($dividing) |
|
33 | 33 | $header->setDividing(); |
34 | 34 | return $this->addItem($header); |
35 | 35 | } |
36 | 36 | |
37 | - public function addFields($fields=NULL,$label=NULL){ |
|
38 | - if(isset($fields)){ |
|
39 | - if(!$fields instanceof HtmlFormFields){ |
|
40 | - if(\is_array($fields)===false){ |
|
41 | - $fields = \func_get_args(); |
|
37 | + public function addFields($fields=NULL, $label=NULL) { |
|
38 | + if (isset($fields)) { |
|
39 | + if (!$fields instanceof HtmlFormFields) { |
|
40 | + if (\is_array($fields)===false) { |
|
41 | + $fields=\func_get_args(); |
|
42 | 42 | $end=\end($fields); |
43 | - if(\is_string($end)){ |
|
43 | + if (\is_string($end)) { |
|
44 | 44 | $label=$end; |
45 | 45 | \array_pop($fields); |
46 | 46 | }else $label=NULL; |
47 | 47 | } |
48 | - $this->_fields=\array_merge($this->_fields,$fields); |
|
49 | - $fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count(),$fields); |
|
48 | + $this->_fields=\array_merge($this->_fields, $fields); |
|
49 | + $fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count(), $fields); |
|
50 | 50 | } |
51 | - if(isset($label)) |
|
52 | - $fields=new HtmlFormField("", $fields,$label); |
|
53 | - }else{ |
|
51 | + if (isset($label)) |
|
52 | + $fields=new HtmlFormField("", $fields, $label); |
|
53 | + }else { |
|
54 | 54 | $fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count()); |
55 | 55 | } |
56 | 56 | $this->addItem($fields); |
57 | 57 | return $fields; |
58 | 58 | } |
59 | 59 | |
60 | - public function addItem($item){ |
|
60 | + public function addItem($item) { |
|
61 | 61 | $item=parent::addItem($item); |
62 | - if(\is_subclass_of($item, HtmlFormField::class)===true){ |
|
62 | + if (\is_subclass_of($item, HtmlFormField::class)===true) { |
|
63 | 63 | $this->_fields[]=$item; |
64 | 64 | } |
65 | 65 | return $item; |
66 | 66 | } |
67 | 67 | |
68 | - public function getField($index){ |
|
69 | - if(\is_string($index)){ |
|
68 | + public function getField($index) { |
|
69 | + if (\is_string($index)) { |
|
70 | 70 | $field=$this->getElementById($index, $this->_fields); |
71 | - }else{ |
|
71 | + }else { |
|
72 | 72 | $field=$this->_fields[$index]; |
73 | 73 | } |
74 | 74 | return $field; |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * automatically divide fields to be equal width |
79 | 79 | * @return \Ajax\semantic\html\collections\form\HtmlForm |
80 | 80 | */ |
81 | - public function setEqualWidth(){ |
|
81 | + public function setEqualWidth() { |
|
82 | 82 | return $this->addToProperty("class", "equal width"); |
83 | 83 | } |
84 | 84 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @param HtmlFormField $field |
88 | 88 | * @return \Ajax\common\html\HtmlDoubleElement |
89 | 89 | */ |
90 | - public function addField($field){ |
|
90 | + public function addField($field) { |
|
91 | 91 | return $this->addItem($field); |
92 | 92 | } |
93 | 93 | |
@@ -99,22 +99,22 @@ discard block |
||
99 | 99 | * @param string $type |
100 | 100 | * @return \Ajax\semantic\html\collections\HtmlMessage |
101 | 101 | */ |
102 | - public function addMessage($identifier,$content,$header=NULL,$icon=NULL,$type=NULL){ |
|
103 | - $message=new HtmlMessage($identifier,$content); |
|
104 | - if(isset($header)) |
|
102 | + public function addMessage($identifier, $content, $header=NULL, $icon=NULL, $type=NULL) { |
|
103 | + $message=new HtmlMessage($identifier, $content); |
|
104 | + if (isset($header)) |
|
105 | 105 | $message->addHeader($header); |
106 | - if(isset($icon)) |
|
106 | + if (isset($icon)) |
|
107 | 107 | $message->setIcon($icon); |
108 | - if(isset($type)) |
|
108 | + if (isset($type)) |
|
109 | 109 | $message->setStyle($type); |
110 | 110 | return $this->addItem($message); |
111 | 111 | } |
112 | 112 | |
113 | - public function setLoading(){ |
|
113 | + public function setLoading() { |
|
114 | 114 | return $this->addToProperty("class", "loading"); |
115 | 115 | } |
116 | 116 | |
117 | - public function jsState($state){ |
|
118 | - return $this->jsDoJquery("addClass",$state); |
|
117 | + public function jsState($state) { |
|
118 | + return $this->jsDoJquery("addClass", $state); |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | \ No newline at end of file |
@@ -8,26 +8,26 @@ discard block |
||
8 | 8 | |
9 | 9 | class HtmlFormField extends HtmlSemDoubleElement { |
10 | 10 | protected $_container; |
11 | - public function __construct($identifier, $field,$label=NULL) { |
|
12 | - parent::__construct($identifier, "div","field"); |
|
11 | + public function __construct($identifier, $field, $label=NULL) { |
|
12 | + parent::__construct($identifier, "div", "field"); |
|
13 | 13 | $this->content=array(); |
14 | - $this->_states=[State::ERROR,State::DISABLED]; |
|
15 | - if(isset($label)) |
|
14 | + $this->_states=[State::ERROR, State::DISABLED]; |
|
15 | + if (isset($label)) |
|
16 | 16 | $this->setLabel($label); |
17 | 17 | $this->setField($field); |
18 | 18 | } |
19 | 19 | |
20 | - public function setLabel($label){ |
|
20 | + public function setLabel($label) { |
|
21 | 21 | $labelO=$label; |
22 | - if(\is_string($label)){ |
|
23 | - $labelO=new HtmlSemDoubleElement("","label"); |
|
22 | + if (\is_string($label)) { |
|
23 | + $labelO=new HtmlSemDoubleElement("", "label"); |
|
24 | 24 | $labelO->setContent($label); |
25 | - $labelO->setProperty("for", \str_replace("field-", "",$this->identifier)); |
|
25 | + $labelO->setProperty("for", \str_replace("field-", "", $this->identifier)); |
|
26 | 26 | } |
27 | 27 | $this->content["label"]=$labelO; |
28 | 28 | } |
29 | 29 | |
30 | - public function setField($field){ |
|
30 | + public function setField($field) { |
|
31 | 31 | $this->content["field"]=$field; |
32 | 32 | } |
33 | 33 | |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | * Returns the label or null |
36 | 36 | * @return mixed |
37 | 37 | */ |
38 | - public function getLabel(){ |
|
39 | - if(\array_key_exists("label", $this->content)) |
|
38 | + public function getLabel() { |
|
39 | + if (\array_key_exists("label", $this->content)) |
|
40 | 40 | return $this->content["label"]; |
41 | 41 | } |
42 | 42 | |
@@ -44,14 +44,14 @@ discard block |
||
44 | 44 | * Return the field |
45 | 45 | * @return mixed |
46 | 46 | */ |
47 | - public function getField(){ |
|
47 | + public function getField() { |
|
48 | 48 | return $this->content["field"]; |
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
52 | 52 | * puts the label before or behind |
53 | 53 | */ |
54 | - public function swapLabel(){ |
|
54 | + public function swapLabel() { |
|
55 | 55 | $label=$this->getLabel(); |
56 | 56 | unset($this->content["label"]); |
57 | 57 | $this->content["label"]=$label; |
@@ -62,27 +62,27 @@ discard block |
||
62 | 62 | * @param int $width |
63 | 63 | * @return \Ajax\semantic\html\collections\form\HtmlFormField |
64 | 64 | */ |
65 | - public function setWidth($width){ |
|
66 | - if(\is_int($width)){ |
|
65 | + public function setWidth($width) { |
|
66 | + if (\is_int($width)) { |
|
67 | 67 | $width=Wide::getConstants()["W".$width]; |
68 | 68 | } |
69 | 69 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
70 | - if(isset($this->_container)){ |
|
70 | + if (isset($this->_container)) { |
|
71 | 71 | $this->_container->setEqualWidth(false); |
72 | 72 | } |
73 | - return $this->addToPropertyCtrl("class", "wide",array("wide")); |
|
73 | + return $this->addToPropertyCtrl("class", "wide", array("wide")); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
77 | 77 | * Field displays an error state |
78 | 78 | * @return \Ajax\semantic\html\collections\form\HtmlFormField |
79 | 79 | */ |
80 | - public function setError(){ |
|
80 | + public function setError() { |
|
81 | 81 | return $this->addToProperty("class", "error"); |
82 | 82 | } |
83 | 83 | |
84 | - public function jsState($state){ |
|
85 | - return $this->jsDoJquery("addClass",$state); |
|
84 | + public function jsState($state) { |
|
85 | + return $this->jsDoJquery("addClass", $state); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | public function setContainer($_container) { |