@@ -15,9 +15,9 @@ |
||
15 | 15 | |
16 | 16 | protected $jsFunction; |
17 | 17 | |
18 | - public function __construct($type, $jsFunction, $prompt = NULL, $value = NULL) { |
|
18 | + public function __construct($type, $jsFunction, $prompt=NULL, $value=NULL) { |
|
19 | 19 | parent::__construct($type, $prompt, $value); |
20 | - $this->jsFunction = $jsFunction; |
|
20 | + $this->jsFunction=$jsFunction; |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | public function compile(JsUtils $js) { |
@@ -10,7 +10,7 @@ |
||
10 | 10 | */ |
11 | 11 | class HtmlRail extends HtmlSemDoubleElement { |
12 | 12 | |
13 | - public function __construct($identifier, $content = NULL) { |
|
13 | + public function __construct($identifier, $content=NULL) { |
|
14 | 14 | parent::__construct($identifier, 'div', 'ui rail', $content); |
15 | 15 | } |
16 | 16 |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param string $onClick |
46 | 46 | * @return HtmlButton |
47 | 47 | */ |
48 | - public function htmlButton($identifier, $value = null, $cssStyle = null, $onClick = null) { |
|
48 | + public function htmlButton($identifier, $value=null, $cssStyle=null, $onClick=null) { |
|
49 | 49 | return $this->addHtmlComponent(new HtmlButton($identifier, $value, $cssStyle, $onClick)); |
50 | 50 | } |
51 | 51 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @param boolean $asIcons |
60 | 60 | * @return HtmlButtonGroups |
61 | 61 | */ |
62 | - public function htmlButtonGroups($identifier, $elements = array(), $asIcons = false) { |
|
62 | + public function htmlButtonGroups($identifier, $elements=array(), $asIcons=false) { |
|
63 | 63 | return $this->addHtmlComponent(new HtmlButtonGroups($identifier, $elements, $asIcons)); |
64 | 64 | } |
65 | 65 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @param string $content |
73 | 73 | * @return HtmlContainer |
74 | 74 | */ |
75 | - public function htmlContainer($identifier, $content = "") { |
|
75 | + public function htmlContainer($identifier, $content="") { |
|
76 | 76 | return $this->addHtmlComponent(new HtmlContainer($identifier, $content)); |
77 | 77 | } |
78 | 78 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @param string $content |
86 | 86 | * @return HtmlDivider |
87 | 87 | */ |
88 | - public function htmlDivider($identifier, $content = "", $tagName = "div") { |
|
88 | + public function htmlDivider($identifier, $content="", $tagName="div") { |
|
89 | 89 | return $this->addHtmlComponent(new HtmlDivider($identifier, $content, $tagName)); |
90 | 90 | } |
91 | 91 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @param string $type |
101 | 101 | * @return HtmlHeader |
102 | 102 | */ |
103 | - public function htmlHeader($identifier, $niveau = 1, $content = NULL, $type = "page") { |
|
103 | + public function htmlHeader($identifier, $niveau=1, $content=NULL, $type="page") { |
|
104 | 104 | return $this->addHtmlComponent(new HtmlHeader($identifier, $niveau, $content, $type)); |
105 | 105 | } |
106 | 106 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @param string $size |
129 | 129 | * @return HtmlImage |
130 | 130 | */ |
131 | - public function htmlImage($identifier, $src = "", $alt = "", $size = NULL) { |
|
131 | + public function htmlImage($identifier, $src="", $alt="", $size=NULL) { |
|
132 | 132 | return $this->addHtmlComponent(new HtmlImage($identifier, $src, $alt, $size)); |
133 | 133 | } |
134 | 134 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @param string $size |
143 | 143 | * @return HtmlIconGroups |
144 | 144 | */ |
145 | - public function htmlIconGroups($identifier, $icons = array(), $size = "") { |
|
145 | + public function htmlIconGroups($identifier, $icons=array(), $size="") { |
|
146 | 146 | return $this->addHtmlComponent(new HtmlIconGroups($identifier, $icons, $size)); |
147 | 147 | } |
148 | 148 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @param string $placeholder |
158 | 158 | * @return HtmlInput |
159 | 159 | */ |
160 | - public function htmlInput($identifier, $type = "text", $value = "", $placeholder = "") { |
|
160 | + public function htmlInput($identifier, $type="text", $value="", $placeholder="") { |
|
161 | 161 | return $this->addHtmlComponent(new HtmlInput($identifier, $type, $value, $placeholder)); |
162 | 162 | } |
163 | 163 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * @param string $tagName |
172 | 172 | * @return HtmlLabel |
173 | 173 | */ |
174 | - public function htmlLabel($identifier, $content = "", $icon = NULL, $tagName = "div") { |
|
174 | + public function htmlLabel($identifier, $content="", $icon=NULL, $tagName="div") { |
|
175 | 175 | return $this->addHtmlComponent(new HtmlLabel($identifier, $content, $icon, $tagName)); |
176 | 176 | } |
177 | 177 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * @param array $attributes |
183 | 183 | * @return HtmlLabelGroups |
184 | 184 | */ |
185 | - public function htmlLabelGroups($identifier, $labels = array(), $attributes = array()) { |
|
185 | + public function htmlLabelGroups($identifier, $labels=array(), $attributes=array()) { |
|
186 | 186 | return $this->addHtmlComponent(new HtmlLabelGroups($identifier, $labels, $attributes)); |
187 | 187 | } |
188 | 188 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | * @param array $items |
194 | 194 | * @return HtmlList |
195 | 195 | */ |
196 | - public function htmlList($identifier, $items = array()) { |
|
196 | + public function htmlList($identifier, $items=array()) { |
|
197 | 197 | return $this->addHtmlComponent(new HtmlList($identifier, $items)); |
198 | 198 | } |
199 | 199 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * @param string $content |
205 | 205 | * @return HtmlSegment |
206 | 206 | */ |
207 | - public function htmlSegment($identifier, $content = "") { |
|
207 | + public function htmlSegment($identifier, $content="") { |
|
208 | 208 | return $this->addHtmlComponent(new HtmlSegment($identifier, $content)); |
209 | 209 | } |
210 | 210 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * the segments |
217 | 217 | * @return HtmlSegmentGroups |
218 | 218 | */ |
219 | - public function htmlSegmentGroups($identifier, $items = array()) { |
|
219 | + public function htmlSegmentGroups($identifier, $items=array()) { |
|
220 | 220 | return $this->addHtmlComponent(new HtmlSegmentGroups($identifier, $items)); |
221 | 221 | } |
222 | 222 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * @param Direction|string $attributeType |
231 | 231 | * @return HtmlReveal |
232 | 232 | */ |
233 | - public function htmlReveal($identifier, $visibleContent, $hiddenContent, $type = RevealType::FADE, $attributeType = NULL) { |
|
233 | + public function htmlReveal($identifier, $visibleContent, $hiddenContent, $type=RevealType::FADE, $attributeType=NULL) { |
|
234 | 234 | return $this->addHtmlComponent(new HtmlReveal($identifier, $visibleContent, $hiddenContent, $type, $attributeType)); |
235 | 235 | } |
236 | 236 | |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | * @param array $steps |
242 | 242 | * @return HtmlStep |
243 | 243 | */ |
244 | - public function htmlStep($identifier, $steps = array()) { |
|
244 | + public function htmlStep($identifier, $steps=array()) { |
|
245 | 245 | return $this->addHtmlComponent(new HtmlStep($identifier, $steps)); |
246 | 246 | } |
247 | 247 | |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | * @param mixed $content |
276 | 276 | * @return HtmlRail |
277 | 277 | */ |
278 | - public function htmlRail($identifier, $content = null) { |
|
278 | + public function htmlRail($identifier, $content=null) { |
|
279 | 279 | return $this->addHtmlComponent(new HtmlRail($identifier, $content)); |
280 | 280 | } |
281 | 281 | } |
@@ -13,19 +13,19 @@ discard block |
||
13 | 13 | */ |
14 | 14 | protected $content; |
15 | 15 | |
16 | - protected $wrapContentBefore = ""; |
|
16 | + protected $wrapContentBefore=""; |
|
17 | 17 | |
18 | - protected $wrapContentAfter = ""; |
|
18 | + protected $wrapContentAfter=""; |
|
19 | 19 | |
20 | 20 | protected $_editableContent; |
21 | 21 | |
22 | - public function __construct($identifier, $tagName = "p") { |
|
22 | + public function __construct($identifier, $tagName="p") { |
|
23 | 23 | parent::__construct($identifier, $tagName); |
24 | - $this->_template = '<%tagName% id="%identifier%" %properties%>%wrapContentBefore%%content%%wrapContentAfter%</%tagName%>'; |
|
24 | + $this->_template='<%tagName% id="%identifier%" %properties%>%wrapContentBefore%%content%%wrapContentAfter%</%tagName%>'; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | public function setContent($content) { |
28 | - $this->content = $content; |
|
28 | + $this->content=$content; |
|
29 | 29 | return $this; |
30 | 30 | } |
31 | 31 | |
@@ -33,19 +33,19 @@ discard block |
||
33 | 33 | return $this->content; |
34 | 34 | } |
35 | 35 | |
36 | - public function addContent($content, $before = false) { |
|
37 | - if (! \is_array($this->content)) { |
|
36 | + public function addContent($content, $before=false) { |
|
37 | + if (!\is_array($this->content)) { |
|
38 | 38 | if (isset($this->content)) |
39 | - $this->content = array( |
|
39 | + $this->content=array( |
|
40 | 40 | $this->content |
41 | 41 | ); |
42 | 42 | else |
43 | - $this->content = array(); |
|
43 | + $this->content=array(); |
|
44 | 44 | } |
45 | 45 | if ($before) |
46 | 46 | \array_unshift($this->content, $content); |
47 | 47 | else |
48 | - $this->content[] = $content; |
|
48 | + $this->content[]=$content; |
|
49 | 49 | return $this; |
50 | 50 | } |
51 | 51 | |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | |
69 | 69 | public function setValue($value) {} |
70 | 70 | |
71 | - public function wrapContent($before, $after = "") { |
|
72 | - $this->wrapContentBefore .= $before; |
|
73 | - $this->wrapContentAfter = $after . $this->wrapContentAfter; |
|
71 | + public function wrapContent($before, $after="") { |
|
72 | + $this->wrapContentBefore.=$before; |
|
73 | + $this->wrapContentAfter=$after.$this->wrapContentAfter; |
|
74 | 74 | return $this; |
75 | 75 | } |
76 | 76 | |
@@ -89,14 +89,14 @@ discard block |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | protected function _getContentInstances($class, $content) { |
92 | - $instances = []; |
|
92 | + $instances=[]; |
|
93 | 93 | if ($content instanceof $class) { |
94 | - $instances[] = $content; |
|
94 | + $instances[]=$content; |
|
95 | 95 | } elseif ($content instanceof HtmlDoubleElement) { |
96 | - $instances = \array_merge($instances, $content->getContentInstances($class)); |
|
96 | + $instances=\array_merge($instances, $content->getContentInstances($class)); |
|
97 | 97 | } elseif (\is_array($content)) { |
98 | 98 | foreach ($content as $element) { |
99 | - $instances = \array_merge($instances, $this->_getContentInstances($class, $element)); |
|
99 | + $instances=\array_merge($instances, $this->_getContentInstances($class, $element)); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | return $instances; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @return HtmlDoubleElement |
109 | 109 | */ |
110 | - public function asLink($href = NULL, $target = NULL) { |
|
110 | + public function asLink($href=NULL, $target=NULL) { |
|
111 | 111 | if (isset($href)) |
112 | 112 | $this->setProperty("href", $href); |
113 | 113 | if (isset($target)) |
@@ -122,28 +122,28 @@ discard block |
||
122 | 122 | return \strip_tags($this->content); |
123 | 123 | } |
124 | 124 | |
125 | - public function asEditable(HtmlFormField $field, $asForm = false, $setValueProperty = "val()") { |
|
126 | - $idF = $field->getIdentifier(); |
|
127 | - $idE = $idF; |
|
125 | + public function asEditable(HtmlFormField $field, $asForm=false, $setValueProperty="val()") { |
|
126 | + $idF=$field->getIdentifier(); |
|
127 | + $idE=$idF; |
|
128 | 128 | if ($asForm) { |
129 | - $frm = new HtmlForm("frm-" . $field->getIdentifier()); |
|
129 | + $frm=new HtmlForm("frm-".$field->getIdentifier()); |
|
130 | 130 | $frm->setProperty("onsubmit", "return false;"); |
131 | - $fields = $frm->addFields(); |
|
132 | - $idE = $frm->getIdentifier(); |
|
131 | + $fields=$frm->addFields(); |
|
132 | + $idE=$frm->getIdentifier(); |
|
133 | 133 | $fields->addItem($field); |
134 | - $fields->addButtonIcon("bt-okay", "check", "green mini", "\$('#" . $idE . "').trigger('validate',{value: $('#'+idF+' input').val()});"); |
|
135 | - $fields->addButtonIcon("bt-cancel", "close", "mini", "\$('#" . $idE . "').trigger('endEdit');"); |
|
136 | - $this->_editableContent = $frm; |
|
137 | - $keypress = ""; |
|
138 | - $focusOut = ""; |
|
134 | + $fields->addButtonIcon("bt-okay", "check", "green mini", "\$('#".$idE."').trigger('validate',{value: $('#'+idF+' input').val()});"); |
|
135 | + $fields->addButtonIcon("bt-cancel", "close", "mini", "\$('#".$idE."').trigger('endEdit');"); |
|
136 | + $this->_editableContent=$frm; |
|
137 | + $keypress=""; |
|
138 | + $focusOut=""; |
|
139 | 139 | } else { |
140 | - $focusOut = "if(e.relatedTarget==null)elm.trigger('endEdit');"; |
|
141 | - $this->_editableContent = $field; |
|
142 | - $keypress = "$('#" . $idF . "').keyup(function(e){if(e.which == 13) {\$('#" . $idE . "').trigger('validate',{value: $('#'+idF+' input').val()});}if(e.keyCode===27) {\$('#" . $idE . "').trigger('endEdit');}});"; |
|
140 | + $focusOut="if(e.relatedTarget==null)elm.trigger('endEdit');"; |
|
141 | + $this->_editableContent=$field; |
|
142 | + $keypress="$('#".$idF."').keyup(function(e){if(e.which == 13) {\$('#".$idE."').trigger('validate',{value: $('#'+idF+' input').val()});}if(e.keyCode===27) {\$('#".$idE."').trigger('endEdit');}});"; |
|
143 | 143 | } |
144 | 144 | $this->_editableContent->setProperty("style", "display:none;"); |
145 | - $this->onCreate("let idF='" . $idF . "';let idE='" . $idE . "';let elm=$('#'+idE);let self=$('#" . $this->getIdentifier() . "');" . $keypress . "elm.on('validate',function(){self.html($('#'+idE+' input')." . $setValueProperty . ");elm.trigger('endEdit');});elm.on('endEdit',function(){self.show();$(this).hide();});elm.focusout(function(e){" . $focusOut . "});"); |
|
146 | - $this->onClick("let self=$(this);self.hide();" . $field->setJsContent("self.html()") . ";$('#" . $idF . " input').trigger('change');elm.show();$('#'+idE+' input').focus();"); |
|
145 | + $this->onCreate("let idF='".$idF."';let idE='".$idE."';let elm=$('#'+idE);let self=$('#".$this->getIdentifier()."');".$keypress."elm.on('validate',function(){self.html($('#'+idE+' input').".$setValueProperty.");elm.trigger('endEdit');});elm.on('endEdit',function(){self.show();$(this).hide();});elm.focusout(function(e){".$focusOut."});"); |
|
146 | + $this->onClick("let self=$(this);self.hide();".$field->setJsContent("self.html()").";$('#".$idF." input').trigger('change');elm.show();$('#'+idE+' input').focus();"); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -151,8 +151,8 @@ discard block |
||
151 | 151 | * {@inheritdoc} |
152 | 152 | * @see \Ajax\common\html\BaseHtml::compile_once() |
153 | 153 | */ |
154 | - protected function compile_once(\Ajax\JsUtils $js = NULL, &$view = NULL) { |
|
155 | - if (! $this->_compiled && isset($this->_editableContent)) { |
|
154 | + protected function compile_once(\Ajax\JsUtils $js=NULL, &$view=NULL) { |
|
155 | + if (!$this->_compiled && isset($this->_editableContent)) { |
|
156 | 156 | $this->wrap("", $this->_editableContent); |
157 | 157 | } |
158 | 158 | parent::compile_once($js, $view); |
@@ -35,17 +35,19 @@ discard block |
||
35 | 35 | |
36 | 36 | public function addContent($content, $before = false) { |
37 | 37 | if (! \is_array($this->content)) { |
38 | - if (isset($this->content)) |
|
39 | - $this->content = array( |
|
38 | + if (isset($this->content)) { |
|
39 | + $this->content = array( |
|
40 | 40 | $this->content |
41 | 41 | ); |
42 | - else |
|
43 | - $this->content = array(); |
|
42 | + } else { |
|
43 | + $this->content = array(); |
|
44 | + } |
|
45 | + } |
|
46 | + if ($before) { |
|
47 | + \array_unshift($this->content, $content); |
|
48 | + } else { |
|
49 | + $this->content[] = $content; |
|
44 | 50 | } |
45 | - if ($before) |
|
46 | - \array_unshift($this->content, $content); |
|
47 | - else |
|
48 | - $this->content[] = $content; |
|
49 | 51 | return $this; |
50 | 52 | } |
51 | 53 | |
@@ -108,10 +110,12 @@ discard block |
||
108 | 110 | * @return HtmlDoubleElement |
109 | 111 | */ |
110 | 112 | public function asLink($href = NULL, $target = NULL) { |
111 | - if (isset($href)) |
|
112 | - $this->setProperty("href", $href); |
|
113 | - if (isset($target)) |
|
114 | - $this->setProperty("target", $target); |
|
113 | + if (isset($href)) { |
|
114 | + $this->setProperty("href", $href); |
|
115 | + } |
|
116 | + if (isset($target)) { |
|
117 | + $this->setProperty("target", $target); |
|
118 | + } |
|
115 | 119 | return $this->setTagName("a"); |
116 | 120 | } |
117 | 121 |
@@ -24,39 +24,39 @@ discard block |
||
24 | 24 | private $_inverted; |
25 | 25 | |
26 | 26 | public function __construct($identifier, $modelInstance=NULL) { |
27 | - parent::__construct($identifier, null,$modelInstance); |
|
27 | + parent::__construct($identifier, null, $modelInstance); |
|
28 | 28 | $this->_form=new HtmlForm($identifier); |
29 | 29 | $this->_init(new FormInstanceViewer($identifier), 'form', $this->_form, true); |
30 | 30 | } |
31 | 31 | |
32 | - protected function _getFieldIdentifier($prefix,$name=''){ |
|
32 | + protected function _getFieldIdentifier($prefix, $name='') { |
|
33 | 33 | return $this->identifier."-{$name}-".$this->_instanceViewer->getIdentifier(); |
34 | 34 | } |
35 | 35 | |
36 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
37 | - if(!$this->_generated){ |
|
36 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
37 | + if (!$this->_generated) { |
|
38 | 38 | $this->_instanceViewer->setInstance($this->_modelInstance); |
39 | 39 | |
40 | 40 | $form=$this->content['form']; |
41 | 41 | $this->_generateContent($form); |
42 | 42 | |
43 | - if(isset($this->_toolbar)){ |
|
43 | + if (isset($this->_toolbar)) { |
|
44 | 44 | $this->_setToolbarPosition($form); |
45 | 45 | } |
46 | - $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,'form',PositionInTable::AFTERTABLE]); |
|
47 | - if($this->_inverted){ |
|
46 | + $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, 'form', PositionInTable::AFTERTABLE]); |
|
47 | + if ($this->_inverted) { |
|
48 | 48 | $this->content['form']->setInverted(true); |
49 | 49 | } |
50 | 50 | $this->_generated=true; |
51 | 51 | } |
52 | - return parent::compile($js,$view); |
|
52 | + return parent::compile($js, $view); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
56 | 56 | * @param HtmlForm $form |
57 | 57 | */ |
58 | - protected function _generateContent($form){ |
|
59 | - $values= $this->_instanceViewer->getValues(); |
|
58 | + protected function _generateContent($form) { |
|
59 | + $values=$this->_instanceViewer->getValues(); |
|
60 | 60 | $count=$this->_instanceViewer->count(); |
61 | 61 | $separators=$this->_instanceViewer->getSeparators(); |
62 | 62 | $headers=$this->_instanceViewer->getHeaders(); |
@@ -65,42 +65,42 @@ discard block |
||
65 | 65 | \sort($separators); |
66 | 66 | $size=\count($separators); |
67 | 67 | $nb=0; |
68 | - if($size===1){ |
|
68 | + if ($size===1) { |
|
69 | 69 | $i=-1; |
70 | - foreach ($values as $k=>$v){ |
|
71 | - $this->_generateFields($form, [$v], $headers, $i, $wrappers,$nb++,$names[$k]??''); |
|
70 | + foreach ($values as $k=>$v) { |
|
71 | + $this->_generateFields($form, [$v], $headers, $i, $wrappers, $nb++, $names[$k] ?? ''); |
|
72 | 72 | $i++; |
73 | 73 | } |
74 | - }else{ |
|
74 | + } else { |
|
75 | 75 | $separators[]=$count; |
76 | - for($i=0;$i<$size;$i++){ |
|
77 | - $fields=\array_slice($values, $separators[$i]+1,$separators[$i+1]-$separators[$i]); |
|
78 | - $this->_generateFields($form, $fields, $headers, $separators[$i], $wrappers,$nb++,$names[$i]??''); |
|
76 | + for ($i=0; $i<$size; $i++) { |
|
77 | + $fields=\array_slice($values, $separators[$i]+1, $separators[$i+1]-$separators[$i]); |
|
78 | + $this->_generateFields($form, $fields, $headers, $separators[$i], $wrappers, $nb++, $names[$i] ?? ''); |
|
79 | 79 | } |
80 | 80 | } |
81 | - if($this->_hasRules && !$this->getForm()->hasValidationParams()){ |
|
81 | + if ($this->_hasRules && !$this->getForm()->hasValidationParams()) { |
|
82 | 82 | $this->setValidationParams(['inline'=>true]); |
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | - protected function _generateFields($form, $values, $headers, $sepFirst, $wrappers, $nb, $name){ |
|
86 | + protected function _generateFields($form, $values, $headers, $sepFirst, $wrappers, $nb, $name) { |
|
87 | 87 | $wrapper=null; |
88 | - if(isset($headers[$sepFirst+1])) |
|
89 | - $form->addHeader($headers[$sepFirst+1],4,true); |
|
90 | - if(isset($wrappers[$sepFirst+1])){ |
|
88 | + if (isset($headers[$sepFirst+1])) |
|
89 | + $form->addHeader($headers[$sepFirst+1], 4, true); |
|
90 | + if (isset($wrappers[$sepFirst+1])) { |
|
91 | 91 | $wrapper=$wrappers[$sepFirst+1]; |
92 | 92 | } |
93 | 93 | $count=\count($values); |
94 | - if($count===1){ |
|
94 | + if ($count===1) { |
|
95 | 95 | $added=$form->addField($values[0]); |
96 | - }elseif($count>1){ |
|
96 | + }elseif ($count>1) { |
|
97 | 97 | $added=$form->addFields($values); |
98 | - }else |
|
98 | + } else |
|
99 | 99 | return; |
100 | - if(isset($wrapper)){ |
|
101 | - $added->wrap($wrapper[0],$wrapper[1]); |
|
100 | + if (isset($wrapper)) { |
|
101 | + $added->wrap($wrapper[0], $wrapper[1]); |
|
102 | 102 | } |
103 | - $this->execHook('onGenerateFields',$added,$nb,$name); |
|
103 | + $this->execHook('onGenerateFields', $added, $nb, $name); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -108,18 +108,18 @@ discard block |
||
108 | 108 | * the generated field is the first parameter |
109 | 109 | * @param callable $callback the fonction to call when a field is generated |
110 | 110 | */ |
111 | - public function onGenerateField($callback){ |
|
112 | - $this->addHook('onGenerateFields',$callback); |
|
111 | + public function onGenerateField($callback) { |
|
112 | + $this->addHook('onGenerateFields', $callback); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
116 | 116 | * @return HtmlForm |
117 | 117 | */ |
118 | - public function getForm(){ |
|
118 | + public function getForm() { |
|
119 | 119 | return $this->content['form']; |
120 | 120 | } |
121 | 121 | |
122 | - public function addSeparatorAfter($fieldNum){ |
|
122 | + public function addSeparatorAfter($fieldNum) { |
|
123 | 123 | $fieldNum=$this->_getIndex($fieldNum); |
124 | 124 | $this->_instanceViewer->addSeparatorAfter($fieldNum); |
125 | 125 | return $this; |
@@ -134,12 +134,12 @@ discard block |
||
134 | 134 | return $this; |
135 | 135 | } |
136 | 136 | |
137 | - public function fieldAsReset($index,$cssStyle=NULL,$attributes=NULL){ |
|
138 | - return $this->_fieldAs(function($id,$name,$value) use ($cssStyle){ |
|
139 | - $button=new HtmlButton($id,$value,$cssStyle); |
|
137 | + public function fieldAsReset($index, $cssStyle=NULL, $attributes=NULL) { |
|
138 | + return $this->_fieldAs(function($id, $name, $value) use ($cssStyle){ |
|
139 | + $button=new HtmlButton($id, $value, $cssStyle); |
|
140 | 140 | $button->setProperty('type', 'reset'); |
141 | 141 | return $button; |
142 | - }, $index,$attributes); |
|
142 | + }, $index, $attributes); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
@@ -158,19 +158,19 @@ discard block |
||
158 | 158 | $this->content[$this->_toolbarPosition]=$this->_toolbar; |
159 | 159 | } |
160 | 160 | |
161 | - public function addDividerBefore($index,$title){ |
|
161 | + public function addDividerBefore($index, $title) { |
|
162 | 162 | $index=$this->_getIndex($index); |
163 | 163 | $this->_instanceViewer->addHeaderDividerBefore($index, $title); |
164 | 164 | return $this; |
165 | 165 | } |
166 | 166 | |
167 | - public function addWrapper($index,$contentBefore,$contentAfter=null){ |
|
167 | + public function addWrapper($index, $contentBefore, $contentAfter=null) { |
|
168 | 168 | $index=$this->_getIndex($index); |
169 | - $this->_instanceViewer->addWrapper($index, $contentBefore,$contentAfter); |
|
169 | + $this->_instanceViewer->addWrapper($index, $contentBefore, $contentAfter); |
|
170 | 170 | return $this; |
171 | 171 | } |
172 | 172 | |
173 | - public function run(JsUtils $js){ |
|
173 | + public function run(JsUtils $js) { |
|
174 | 174 | parent::run($js); |
175 | 175 | } |
176 | 176 |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $this->_generateFields($form, [$v], $headers, $i, $wrappers,$nb++,$names[$k]??''); |
72 | 72 | $i++; |
73 | 73 | } |
74 | - }else{ |
|
74 | + } else{ |
|
75 | 75 | $separators[]=$count; |
76 | 76 | for($i=0;$i<$size;$i++){ |
77 | 77 | $fields=\array_slice($values, $separators[$i]+1,$separators[$i+1]-$separators[$i]); |
@@ -85,18 +85,20 @@ discard block |
||
85 | 85 | |
86 | 86 | protected function _generateFields($form, $values, $headers, $sepFirst, $wrappers, $nb, $name){ |
87 | 87 | $wrapper=null; |
88 | - if(isset($headers[$sepFirst+1])) |
|
89 | - $form->addHeader($headers[$sepFirst+1],4,true); |
|
88 | + if(isset($headers[$sepFirst+1])) { |
|
89 | + $form->addHeader($headers[$sepFirst+1],4,true); |
|
90 | + } |
|
90 | 91 | if(isset($wrappers[$sepFirst+1])){ |
91 | 92 | $wrapper=$wrappers[$sepFirst+1]; |
92 | 93 | } |
93 | 94 | $count=\count($values); |
94 | 95 | if($count===1){ |
95 | 96 | $added=$form->addField($values[0]); |
96 | - }elseif($count>1){ |
|
97 | + } elseif($count>1){ |
|
97 | 98 | $added=$form->addFields($values); |
98 | - }else |
|
99 | - return; |
|
99 | + } else { |
|
100 | + return; |
|
101 | + } |
|
100 | 102 | if(isset($wrapper)){ |
101 | 103 | $added->wrap($wrapper[0],$wrapper[1]); |
102 | 104 | } |
@@ -7,20 +7,20 @@ discard block |
||
7 | 7 | |
8 | 8 | class HtmlFormDropdown extends HtmlFormField { |
9 | 9 | |
10 | - public function __construct($identifier, $items = array(), $label = NULL, $value = "", $multiple = false, $associative = true) { |
|
11 | - parent::__construct("field-" . $identifier, (new HtmlDropdown("dropdown-" . $identifier, $value, $items, $associative))->asSelect($identifier, $multiple), $label); |
|
12 | - $this->_identifier = $identifier; |
|
10 | + public function __construct($identifier, $items=array(), $label=NULL, $value="", $multiple=false, $associative=true) { |
|
11 | + parent::__construct("field-".$identifier, (new HtmlDropdown("dropdown-".$identifier, $value, $items, $associative))->asSelect($identifier, $multiple), $label); |
|
12 | + $this->_identifier=$identifier; |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | public function setItems($items) { |
16 | 16 | return $this->getField()->setItems($items); |
17 | 17 | } |
18 | 18 | |
19 | - public function addItem($item, $value = NULL, $image = NULL) { |
|
19 | + public function addItem($item, $value=NULL, $image=NULL) { |
|
20 | 20 | return $this->getField()->addItem($item, $value, $image); |
21 | 21 | } |
22 | 22 | |
23 | - public static function multipleDropdown($identifier, $items = array(), $label = NULL, $value = "", $associative = true) { |
|
23 | + public static function multipleDropdown($identifier, $items=array(), $label=NULL, $value="", $associative=true) { |
|
24 | 24 | return new HtmlFormDropdown($identifier, $items, $label, $value, true, $associative); |
25 | 25 | } |
26 | 26 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | return $this->getField()->getInput(); |
33 | 33 | } |
34 | 34 | |
35 | - public function asSelect($name = NULL, $multiple = false, $selection = true) { |
|
35 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
36 | 36 | $this->getField()->asSelect($name, $multiple, $selection); |
37 | 37 | return $this; |
38 | 38 | } |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | * @param boolean $floating |
43 | 43 | * @return HtmlDropdown |
44 | 44 | */ |
45 | - public function asButton($floating = false) { |
|
46 | - $field = $this->content["field"]; |
|
47 | - $label = $this->content["label"]; |
|
45 | + public function asButton($floating=false) { |
|
46 | + $field=$this->content["field"]; |
|
47 | + $label=$this->content["label"]; |
|
48 | 48 | $field->addContent($label); |
49 | - $this->content = [ |
|
49 | + $this->content=[ |
|
50 | 50 | "field" => $field |
51 | 51 | ]; |
52 | 52 | $this->content["field"]->asButton($floating); |
@@ -61,15 +61,15 @@ discard block |
||
61 | 61 | * @param boolean $labeled |
62 | 62 | * @return mixed|HtmlButton |
63 | 63 | */ |
64 | - public function addAction($action, $direction = Direction::RIGHT, $icon = NULL, $labeled = false) { |
|
64 | + public function addAction($action, $direction=Direction::RIGHT, $icon=NULL, $labeled=false) { |
|
65 | 65 | $this->getField()->setStyle('display:inline-block; width: auto'); |
66 | - $actionO = $action; |
|
67 | - if (\is_object($action) === false) { |
|
68 | - $actionO = new HtmlButton("action-" . $this->identifier, $action); |
|
66 | + $actionO=$action; |
|
67 | + if (\is_object($action)===false) { |
|
68 | + $actionO=new HtmlButton("action-".$this->identifier, $action); |
|
69 | 69 | if (isset($icon)) |
70 | 70 | $actionO->addIcon($icon, true, $labeled); |
71 | 71 | } |
72 | - $this->addContent($actionO, \strstr($direction, Direction::LEFT) !== false); |
|
72 | + $this->addContent($actionO, \strstr($direction, Direction::LEFT)!==false); |
|
73 | 73 | return $actionO; |
74 | 74 | } |
75 | 75 | } |
@@ -66,8 +66,9 @@ |
||
66 | 66 | $actionO = $action; |
67 | 67 | if (\is_object($action) === false) { |
68 | 68 | $actionO = new HtmlButton("action-" . $this->identifier, $action); |
69 | - if (isset($icon)) |
|
70 | - $actionO->addIcon($icon, true, $labeled); |
|
69 | + if (isset($icon)) { |
|
70 | + $actionO->addIcon($icon, true, $labeled); |
|
71 | + } |
|
71 | 72 | } |
72 | 73 | $this->addContent($actionO, \strstr($direction, Direction::LEFT) !== false); |
73 | 74 | return $actionO; |
@@ -29,12 +29,12 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @var string|array |
31 | 31 | */ |
32 | - protected $_contentSeparator = ""; |
|
32 | + protected $_contentSeparator=""; |
|
33 | 33 | |
34 | 34 | public function __construct($identifier, $tagName, $baseClass) { |
35 | 35 | parent::__construct($identifier, $tagName, $baseClass); |
36 | - $this->root = ""; |
|
37 | - $this->attr = "data-ajax"; |
|
36 | + $this->root=""; |
|
37 | + $this->attr="data-ajax"; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -54,23 +54,23 @@ discard block |
||
54 | 54 | return JArray::implode($this->_contentSeparator, $this->content); |
55 | 55 | } |
56 | 56 | |
57 | - public function setContentDivider($divider, $index = NULL) { |
|
58 | - $divider = "<div class='divider'> {$divider} </div>"; |
|
57 | + public function setContentDivider($divider, $index=NULL) { |
|
58 | + $divider="<div class='divider'> {$divider} </div>"; |
|
59 | 59 | return $this->setDivider($divider, $index); |
60 | 60 | } |
61 | 61 | |
62 | - public function setIconContentDivider($iconContentDivider, $index = NULL) { |
|
63 | - $contentDivider = "<i class='" . $iconContentDivider . " icon divider'></i>"; |
|
62 | + public function setIconContentDivider($iconContentDivider, $index=NULL) { |
|
63 | + $contentDivider="<i class='".$iconContentDivider." icon divider'></i>"; |
|
64 | 64 | return $this->setDivider($contentDivider, $index); |
65 | 65 | } |
66 | 66 | |
67 | 67 | protected function setDivider($divider, $index) { |
68 | 68 | if (isset($index)) { |
69 | - if (! \is_array($this->_contentSeparator)) |
|
70 | - $this->_contentSeparator = array_fill(0, $this->count() - 1, $this->_contentSeparator); |
|
71 | - $this->_contentSeparator[$index] = $divider; |
|
69 | + if (!\is_array($this->_contentSeparator)) |
|
70 | + $this->_contentSeparator=array_fill(0, $this->count()-1, $this->_contentSeparator); |
|
71 | + $this->_contentSeparator[$index]=$divider; |
|
72 | 72 | } else { |
73 | - $this->_contentSeparator = $divider; |
|
73 | + $this->_contentSeparator=$divider; |
|
74 | 74 | } |
75 | 75 | return $this; |
76 | 76 | } |
@@ -66,8 +66,9 @@ |
||
66 | 66 | |
67 | 67 | protected function setDivider($divider, $index) { |
68 | 68 | if (isset($index)) { |
69 | - if (! \is_array($this->_contentSeparator)) |
|
70 | - $this->_contentSeparator = array_fill(0, $this->count() - 1, $this->_contentSeparator); |
|
69 | + if (! \is_array($this->_contentSeparator)) { |
|
70 | + $this->_contentSeparator = array_fill(0, $this->count() - 1, $this->_contentSeparator); |
|
71 | + } |
|
71 | 72 | $this->_contentSeparator[$index] = $divider; |
72 | 73 | } else { |
73 | 74 | $this->_contentSeparator = $divider; |
@@ -16,11 +16,11 @@ discard block |
||
16 | 16 | */ |
17 | 17 | class HtmlModal extends HtmlSemDoubleElement { |
18 | 18 | |
19 | - protected $_params = []; |
|
19 | + protected $_params=[]; |
|
20 | 20 | |
21 | - protected $_paramParts = []; |
|
21 | + protected $_paramParts=[]; |
|
22 | 22 | |
23 | - public function __construct($identifier, $header = '', $content = '', $actions = null) { |
|
23 | + public function __construct($identifier, $header='', $content='', $actions=null) { |
|
24 | 24 | parent::__construct($identifier, 'div', 'ui modal'); |
25 | 25 | if (isset($header)) { |
26 | 26 | $this->setHeader($header); |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | public function setHeader($value) { |
37 | - $this->content['header'] = new HtmlSemDoubleElement('header-' . $this->identifier, 'a', 'header', $value); |
|
37 | + $this->content['header']=new HtmlSemDoubleElement('header-'.$this->identifier, 'a', 'header', $value); |
|
38 | 38 | return $this; |
39 | 39 | } |
40 | 40 | |
41 | 41 | public function setContent($value) { |
42 | - $this->content['content'] = new HtmlSemDoubleElement('content-' . $this->identifier, 'div', 'content', $value); |
|
42 | + $this->content['content']=new HtmlSemDoubleElement('content-'.$this->identifier, 'div', 'content', $value); |
|
43 | 43 | return $this; |
44 | 44 | } |
45 | 45 | |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | * @return HtmlButton[] |
51 | 51 | */ |
52 | 52 | public function setActions($actions): array { |
53 | - $this->content['actions'] = new HtmlSemDoubleElement('content-' . $this->identifier, 'div', 'actions'); |
|
54 | - $r = []; |
|
53 | + $this->content['actions']=new HtmlSemDoubleElement('content-'.$this->identifier, 'div', 'actions'); |
|
54 | + $r=[]; |
|
55 | 55 | if (\is_array($actions)) { |
56 | 56 | foreach ($actions as $action) { |
57 | - $r[] = $this->addAction($action); |
|
57 | + $r[]=$this->addAction($action); |
|
58 | 58 | } |
59 | 59 | } else { |
60 | - $r[] = $this->addAction($actions); |
|
60 | + $r[]=$this->addAction($actions); |
|
61 | 61 | } |
62 | 62 | return $r; |
63 | 63 | } |
@@ -68,24 +68,24 @@ discard block |
||
68 | 68 | * @return HtmlButton |
69 | 69 | */ |
70 | 70 | public function addAction($action) { |
71 | - if (! $action instanceof BaseHtml) { |
|
72 | - $class = ''; |
|
71 | + if (!$action instanceof BaseHtml) { |
|
72 | + $class=''; |
|
73 | 73 | if (\array_search($action, [ |
74 | 74 | 'Okay', |
75 | 75 | 'Yes', |
76 | 76 | 'Validate' |
77 | - ]) !== false) { |
|
78 | - $class = 'approve'; |
|
77 | + ])!==false) { |
|
78 | + $class='approve'; |
|
79 | 79 | } |
80 | 80 | if (\array_search($action, [ |
81 | 81 | 'Close', |
82 | 82 | 'Cancel', |
83 | 83 | 'No' |
84 | - ]) !== false) { |
|
85 | - $class = 'cancel'; |
|
84 | + ])!==false) { |
|
85 | + $class='cancel'; |
|
86 | 86 | } |
87 | - $action = new HtmlButton('action-' . $this->identifier . '-' . JArray::count($this->content['actions']->getContent()), $action); |
|
88 | - if ($class !== '') |
|
87 | + $action=new HtmlButton('action-'.$this->identifier.'-'.JArray::count($this->content['actions']->getContent()), $action); |
|
88 | + if ($class!=='') |
|
89 | 89 | $action->addToProperty('class', $class); |
90 | 90 | } |
91 | 91 | return $this->addElementInPart($action, 'actions'); |
@@ -100,33 +100,33 @@ discard block |
||
100 | 100 | return $this->content['actions']->getContent()[$index]; |
101 | 101 | } |
102 | 102 | |
103 | - public function addContent($content, $before = false) { |
|
103 | + public function addContent($content, $before=false) { |
|
104 | 104 | $this->content['content']->addContent($content, $before); |
105 | 105 | return $this; |
106 | 106 | } |
107 | 107 | |
108 | - public function addImageContent($image, $description = NULL) { |
|
109 | - $content = $this->content['content']; |
|
108 | + public function addImageContent($image, $description=NULL) { |
|
109 | + $content=$this->content['content']; |
|
110 | 110 | if (isset($description)) { |
111 | - $description = new HtmlSemDoubleElement('description-' . $this->identifier, 'div', 'description', $description); |
|
111 | + $description=new HtmlSemDoubleElement('description-'.$this->identifier, 'div', 'description', $description); |
|
112 | 112 | $content->addContent($description, true); |
113 | 113 | } |
114 | - if ($image !== '') { |
|
115 | - $img = new HtmlImage('image-' . $this->identifier, $image, '', 'medium'); |
|
114 | + if ($image!=='') { |
|
115 | + $img=new HtmlImage('image-'.$this->identifier, $image, '', 'medium'); |
|
116 | 116 | $content->addContent($img, true); |
117 | 117 | $content->addToProperty('class', 'image'); |
118 | 118 | } |
119 | 119 | return $this; |
120 | 120 | } |
121 | 121 | |
122 | - public function addIconContent($icon, $description = NULL) { |
|
123 | - $content = $this->content['content']; |
|
122 | + public function addIconContent($icon, $description=NULL) { |
|
123 | + $content=$this->content['content']; |
|
124 | 124 | if (isset($description)) { |
125 | - $description = new HtmlSemDoubleElement('description-' . $this->identifier, 'div', 'description', $description); |
|
125 | + $description=new HtmlSemDoubleElement('description-'.$this->identifier, 'div', 'description', $description); |
|
126 | 126 | $content->addContent($description, true); |
127 | 127 | } |
128 | - if ($icon !== '') { |
|
129 | - $img = new HtmlIcon('image-' . $this->identifier, $icon); |
|
128 | + if ($icon!=='') { |
|
129 | + $img=new HtmlIcon('image-'.$this->identifier, $icon); |
|
130 | 130 | $content->addContent($img, true); |
131 | 131 | $content->addToProperty('class', 'image'); |
132 | 132 | } |
@@ -139,15 +139,15 @@ discard block |
||
139 | 139 | } |
140 | 140 | |
141 | 141 | public function showDimmer($value) { |
142 | - $value = $value ? 'show' : 'hide'; |
|
143 | - $this->_paramParts[] = [ |
|
144 | - "'" . $value . " dimmer'" |
|
142 | + $value=$value ? 'show' : 'hide'; |
|
143 | + $this->_paramParts[]=[ |
|
144 | + "'".$value." dimmer'" |
|
145 | 145 | ]; |
146 | 146 | return $this; |
147 | 147 | } |
148 | 148 | |
149 | - public function setInverted($recursive = true) { |
|
150 | - $this->_params['inverted'] = true; |
|
149 | + public function setInverted($recursive=true) { |
|
150 | + $this->_params['inverted']=true; |
|
151 | 151 | return $this; |
152 | 152 | } |
153 | 153 | |
@@ -156,10 +156,10 @@ discard block |
||
156 | 156 | } |
157 | 157 | |
158 | 158 | public function setTransition($value) { |
159 | - $this->_paramParts[] = [ |
|
159 | + $this->_paramParts[]=[ |
|
160 | 160 | "'setting'", |
161 | 161 | "'transition'", |
162 | - "'" . $value . "'" |
|
162 | + "'".$value."'" |
|
163 | 163 | ]; |
164 | 164 | } |
165 | 165 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * @param array $params |
173 | 173 | * The parameters to pass to the view |
174 | 174 | */ |
175 | - public function renderView(JsUtils $js, $initialController, $viewName, $params = array()) { |
|
175 | + public function renderView(JsUtils $js, $initialController, $viewName, $params=array()) { |
|
176 | 176 | return $this->setContent($js->renderContent($initialController, $viewName, $params)); |
177 | 177 | } |
178 | 178 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * the action name |
188 | 188 | * @param array $params |
189 | 189 | */ |
190 | - public function forward(JsUtils $js, $initialControllerInstance, $controllerName, $actionName, $params = NULL) { |
|
190 | + public function forward(JsUtils $js, $initialControllerInstance, $controllerName, $actionName, $params=NULL) { |
|
191 | 191 | return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName, $params)); |
192 | 192 | } |
193 | 193 | |
@@ -197,8 +197,8 @@ discard block |
||
197 | 197 | * |
198 | 198 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
199 | 199 | */ |
200 | - public function compile(JsUtils $js = NULL, &$view = NULL) { |
|
201 | - $this->content = JArray::sortAssociative($this->content, [ |
|
200 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
201 | + $this->content=JArray::sortAssociative($this->content, [ |
|
202 | 202 | 'header', |
203 | 203 | 'content', |
204 | 204 | 'actions' |
@@ -214,14 +214,14 @@ discard block |
||
214 | 214 | * @see BaseHtml::run() |
215 | 215 | */ |
216 | 216 | public function run(JsUtils $js) { |
217 | - if (isset($this->_bsComponent) === false) |
|
218 | - $this->_bsComponent = $js->semantic()->modal('#' . $this->identifier, $this->_params, $this->_paramParts); |
|
217 | + if (isset($this->_bsComponent)===false) |
|
218 | + $this->_bsComponent=$js->semantic()->modal('#'.$this->identifier, $this->_params, $this->_paramParts); |
|
219 | 219 | $this->addEventsOnRun($js); |
220 | 220 | return $this->_bsComponent; |
221 | 221 | } |
222 | 222 | |
223 | 223 | public function jsDo($behavior) { |
224 | - return "$('#" . $this->identifier . "').modal('" . $behavior . "');"; |
|
224 | + return "$('#".$this->identifier."').modal('".$behavior."');"; |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | public function jsHide() { |
@@ -229,6 +229,6 @@ discard block |
||
229 | 229 | } |
230 | 230 | |
231 | 231 | public function onHidden($js) { |
232 | - $this->_params['onHidden'] = $js; |
|
232 | + $this->_params['onHidden']=$js; |
|
233 | 233 | } |
234 | 234 | } |
@@ -85,8 +85,9 @@ discard block |
||
85 | 85 | $class = 'cancel'; |
86 | 86 | } |
87 | 87 | $action = new HtmlButton('action-' . $this->identifier . '-' . JArray::count($this->content['actions']->getContent()), $action); |
88 | - if ($class !== '') |
|
89 | - $action->addToProperty('class', $class); |
|
88 | + if ($class !== '') { |
|
89 | + $action->addToProperty('class', $class); |
|
90 | + } |
|
90 | 91 | } |
91 | 92 | return $this->addElementInPart($action, 'actions'); |
92 | 93 | } |
@@ -214,8 +215,9 @@ discard block |
||
214 | 215 | * @see BaseHtml::run() |
215 | 216 | */ |
216 | 217 | public function run(JsUtils $js) { |
217 | - if (isset($this->_bsComponent) === false) |
|
218 | - $this->_bsComponent = $js->semantic()->modal('#' . $this->identifier, $this->_params, $this->_paramParts); |
|
218 | + if (isset($this->_bsComponent) === false) { |
|
219 | + $this->_bsComponent = $js->semantic()->modal('#' . $this->identifier, $this->_params, $this->_paramParts); |
|
220 | + } |
|
219 | 221 | $this->addEventsOnRun($js); |
220 | 222 | return $this->_bsComponent; |
221 | 223 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * |
21 | 21 | * @var integer the start index for href generation |
22 | 22 | */ |
23 | - protected $startIndex = 0; |
|
23 | + protected $startIndex=0; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @var boolean if set to true, the path of the elements is absolute |
34 | 34 | */ |
35 | - protected $absolutePaths = false; |
|
35 | + protected $absolutePaths=false; |
|
36 | 36 | |
37 | 37 | /** |
38 | 38 | * |
@@ -49,16 +49,16 @@ discard block |
||
49 | 49 | * @param callable $hrefFunction |
50 | 50 | * the function who generates the href elements. default : function($e){return $e->getContent()} |
51 | 51 | */ |
52 | - public function __construct($identifier, $items = array(), $autoActive = true, $startIndex = 0, $hrefFunction = NULL) { |
|
52 | + public function __construct($identifier, $items=array(), $autoActive=true, $startIndex=0, $hrefFunction=NULL) { |
|
53 | 53 | parent::__construct($identifier, "div", "ui breadcrumb"); |
54 | - $this->startIndex = $startIndex; |
|
55 | - $this->autoActive = $autoActive; |
|
56 | - $this->_contentSeparator = "<div class='divider'> / </div>"; |
|
57 | - $this->_hrefFunction = function (HtmlSemDoubleElement $e) { |
|
54 | + $this->startIndex=$startIndex; |
|
55 | + $this->autoActive=$autoActive; |
|
56 | + $this->_contentSeparator="<div class='divider'> / </div>"; |
|
57 | + $this->_hrefFunction=function(HtmlSemDoubleElement $e) { |
|
58 | 58 | return $e->getContent(); |
59 | 59 | }; |
60 | 60 | if (isset($hrefFunction)) { |
61 | - $this->_hrefFunction = $hrefFunction; |
|
61 | + $this->_hrefFunction=$hrefFunction; |
|
62 | 62 | } |
63 | 63 | $this->addItems($items); |
64 | 64 | } |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @param int $index |
90 | 90 | */ |
91 | - public function setActive($index = null) { |
|
92 | - if (! isset($index)) { |
|
93 | - $index = sizeof($this->content) - 1; |
|
91 | + public function setActive($index=null) { |
|
92 | + if (!isset($index)) { |
|
93 | + $index=sizeof($this->content)-1; |
|
94 | 94 | } |
95 | - $activeItem = $this->content[$index]; |
|
95 | + $activeItem=$this->content[$index]; |
|
96 | 96 | $activeItem->addToProperty("class", "active"); |
97 | 97 | $activeItem->setTagName("div"); |
98 | 98 | } |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | * the request dispatcher |
106 | 106 | * @return HtmlBreadcrumb |
107 | 107 | */ |
108 | - public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex = 0) { |
|
109 | - $this->startIndex = $startIndex; |
|
108 | + public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0) { |
|
109 | + $this->startIndex=$startIndex; |
|
110 | 110 | return $this->addItems($js->fromDispatcher($dispatcher)); |
111 | 111 | } |
112 | 112 | |
@@ -117,16 +117,16 @@ discard block |
||
117 | 117 | * @param string $separator |
118 | 118 | * @return string |
119 | 119 | */ |
120 | - public function getHref($index = null, $separator = "/") { |
|
121 | - if (! isset($index)) { |
|
122 | - $index = sizeof($this->content); |
|
120 | + public function getHref($index=null, $separator="/") { |
|
121 | + if (!isset($index)) { |
|
122 | + $index=sizeof($this->content); |
|
123 | 123 | } |
124 | - if ($this->absolutePaths === true) { |
|
124 | + if ($this->absolutePaths===true) { |
|
125 | 125 | return $this->_hrefFunction($this->content[$index]); |
126 | 126 | } else { |
127 | - return $this->root . implode($separator, array_slice(array_map(function ($e) { |
|
127 | + return $this->root.implode($separator, array_slice(array_map(function($e) { |
|
128 | 128 | return $this->_hrefFunction($e); |
129 | - }, $this->content), $this->startIndex, $index + 1)); |
|
129 | + }, $this->content), $this->startIndex, $index+1)); |
|
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
@@ -138,17 +138,17 @@ discard block |
||
138 | 138 | * @return HtmlBreadcrumb |
139 | 139 | */ |
140 | 140 | public function setHrefFunction($_hrefFunction) { |
141 | - $this->_hrefFunction = $_hrefFunction; |
|
141 | + $this->_hrefFunction=$_hrefFunction; |
|
142 | 142 | return $this; |
143 | 143 | } |
144 | 144 | |
145 | 145 | public function setStartIndex($startIndex) { |
146 | - $this->startIndex = $startIndex; |
|
146 | + $this->startIndex=$startIndex; |
|
147 | 147 | return $this; |
148 | 148 | } |
149 | 149 | |
150 | 150 | public function setAutoActive($autoActive) { |
151 | - $this->autoActive = $autoActive; |
|
151 | + $this->autoActive=$autoActive; |
|
152 | 152 | return $this; |
153 | 153 | } |
154 | 154 | |
@@ -156,13 +156,13 @@ discard block |
||
156 | 156 | * (non-PHPdoc) |
157 | 157 | * @see \Ajax\bootstrap\html\BaseHtml::compile() |
158 | 158 | */ |
159 | - public function compile(JsUtils $js = NULL, &$view = NULL) { |
|
159 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
160 | 160 | if ($this->autoActive) { |
161 | 161 | $this->setActive(); |
162 | 162 | } |
163 | - $count = $this->count(); |
|
164 | - for ($i = 1; $i < $count; $i ++) { |
|
165 | - $this->content[$i]->wrap($this->getContentDivider($i - 1)); |
|
163 | + $count=$this->count(); |
|
164 | + for ($i=1; $i<$count; $i++) { |
|
165 | + $this->content[$i]->wrap($this->getContentDivider($i-1)); |
|
166 | 166 | } |
167 | 167 | return parent::compile($js, $view); |
168 | 168 | } |
@@ -171,16 +171,16 @@ discard block |
||
171 | 171 | * (non-PHPdoc) |
172 | 172 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
173 | 173 | */ |
174 | - public function on($event, $jsCode, $stopPropagation = false, $preventDefault = false) { |
|
174 | + public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
|
175 | 175 | foreach ($this->content as $element) { |
176 | 176 | $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
177 | 177 | } |
178 | 178 | return $this; |
179 | 179 | } |
180 | 180 | |
181 | - public function _ajaxOn($operation, $event, $url, $responseElement = "", $parameters = array()) { |
|
181 | + public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
|
182 | 182 | foreach ($this->content as $element) { |
183 | - if ($element->getProperty($this->attr) != NULL) { |
|
183 | + if ($element->getProperty($this->attr)!=NULL) { |
|
184 | 184 | $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
185 | 185 | } |
186 | 186 | } |
@@ -194,10 +194,10 @@ discard block |
||
194 | 194 | * @see \Ajax\common\html\HtmlCollection::createItem() |
195 | 195 | */ |
196 | 196 | protected function createItem($value) { |
197 | - $count = $this->count(); |
|
198 | - $itemO = new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "a", "section"); |
|
197 | + $count=$this->count(); |
|
198 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "a", "section"); |
|
199 | 199 | if (\is_array($value)) { |
200 | - @list ($text, $href) = $value; |
|
200 | + @list ($text, $href)=$value; |
|
201 | 201 | $itemO->setContent($text); |
202 | 202 | $itemO->setProperty('href', $href); |
203 | 203 | } else { |
@@ -207,16 +207,16 @@ discard block |
||
207 | 207 | } |
208 | 208 | |
209 | 209 | public function addIconAt($icon, $index) { |
210 | - $item = $this->getItem($index); |
|
210 | + $item=$this->getItem($index); |
|
211 | 211 | if (isset($item)) { |
212 | - $icon = new HtmlIcon("icon-" . $this->identifier, $icon); |
|
212 | + $icon=new HtmlIcon("icon-".$this->identifier, $icon); |
|
213 | 213 | $item->wrapContent($icon); |
214 | 214 | } |
215 | 215 | } |
216 | 216 | |
217 | 217 | public function addItem($item) { |
218 | - $count = $this->count(); |
|
219 | - $itemO = parent::addItem($item); |
|
218 | + $count=$this->count(); |
|
219 | + $itemO=parent::addItem($item); |
|
220 | 220 | $this->addToPropertyCtrl("class", "section", array( |
221 | 221 | "section" |
222 | 222 | )); |
@@ -229,9 +229,9 @@ discard block |
||
229 | 229 | } |
230 | 230 | |
231 | 231 | public function setAbsolutePaths($absolutePaths) { |
232 | - $this->absolutePaths = $absolutePaths; |
|
233 | - $size = \sizeof($this->content); |
|
234 | - for ($i = 0; $i < $size; $i ++) { |
|
232 | + $this->absolutePaths=$absolutePaths; |
|
233 | + $size=\sizeof($this->content); |
|
234 | + for ($i=0; $i<$size; $i++) { |
|
235 | 235 | $this->content[$i]->setProperty($this->attr, $this->getHref($i)); |
236 | 236 | } |
237 | 237 | return $this; |