@@ -14,44 +14,44 @@ discard block |
||
14 | 14 | */ |
15 | 15 | abstract class HtmlCollection extends HtmlDoubleElement { |
16 | 16 | |
17 | - public function __construct($identifier,$tagName="div"){ |
|
18 | - parent::__construct($identifier,$tagName); |
|
17 | + public function __construct($identifier, $tagName="div") { |
|
18 | + parent::__construct($identifier, $tagName); |
|
19 | 19 | $this->content=array(); |
20 | 20 | } |
21 | 21 | |
22 | - public function addItems($items){ |
|
23 | - if(JArray::isAssociative($items)){ |
|
24 | - foreach ($items as $k=>$v){ |
|
25 | - $this->addItem([$k,$v]); |
|
22 | + public function addItems($items) { |
|
23 | + if (JArray::isAssociative($items)) { |
|
24 | + foreach ($items as $k=>$v) { |
|
25 | + $this->addItem([$k, $v]); |
|
26 | 26 | } |
27 | - }else{ |
|
28 | - foreach ($items as $item){ |
|
27 | + } else { |
|
28 | + foreach ($items as $item) { |
|
29 | 29 | $this->addItem($item); |
30 | 30 | } |
31 | 31 | } |
32 | 32 | return $this; |
33 | 33 | } |
34 | 34 | |
35 | - public function setItems($items){ |
|
35 | + public function setItems($items) { |
|
36 | 36 | $this->content=$items; |
37 | 37 | return $this; |
38 | 38 | } |
39 | 39 | |
40 | - public function getItems(){ |
|
40 | + public function getItems() { |
|
41 | 41 | return $this->content; |
42 | 42 | } |
43 | 43 | |
44 | - protected function getItemToAdd($item){ |
|
44 | + protected function getItemToAdd($item) { |
|
45 | 45 | $itemO=$item; |
46 | - if($this->createCondition($item)===true){ |
|
46 | + if ($this->createCondition($item)===true) { |
|
47 | 47 | $itemO=$this->createItem($item); |
48 | 48 | } |
49 | 49 | return $itemO; |
50 | 50 | } |
51 | 51 | |
52 | - protected function setItemIdentifier($item,$classname,$index){ |
|
53 | - if($item instanceof BaseWidget){ |
|
54 | - if(JString::isNull($item->getIdentifier())){ |
|
52 | + protected function setItemIdentifier($item, $classname, $index) { |
|
53 | + if ($item instanceof BaseWidget) { |
|
54 | + if (JString::isNull($item->getIdentifier())) { |
|
55 | 55 | $item->setIdentifier($classname."-".$this->identifier."-".$index); |
56 | 56 | } |
57 | 57 | } |
@@ -62,15 +62,15 @@ discard block |
||
62 | 62 | * @param HtmlDoubleElement|string|array $item |
63 | 63 | * @return \Ajax\common\html\HtmlDoubleElement |
64 | 64 | */ |
65 | - public function addItem($item){ |
|
65 | + public function addItem($item) { |
|
66 | 66 | $itemO=$this->getItemToAdd($item); |
67 | 67 | $this->addContent($itemO); |
68 | 68 | return $itemO; |
69 | 69 | } |
70 | 70 | |
71 | - public function insertItem($item,$position=0){ |
|
71 | + public function insertItem($item, $position=0) { |
|
72 | 72 | $itemO=$this->getItemToAdd($item); |
73 | - \array_splice( $this->content, $position, 0, array($itemO)); |
|
73 | + \array_splice($this->content, $position, 0, array($itemO)); |
|
74 | 74 | return $itemO; |
75 | 75 | } |
76 | 76 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * @return \Ajax\common\html\HtmlDoubleElement |
81 | 81 | */ |
82 | 82 | public function getItem($index) { |
83 | - if (is_int($index)&& isset($this->content[$index])) |
|
83 | + if (is_int($index) && isset($this->content[$index])) |
|
84 | 84 | return $this->content[$index]; |
85 | 85 | else { |
86 | 86 | $elm=$this->getElementById($index, $this->content); |
@@ -93,11 +93,11 @@ discard block |
||
93 | 93 | return $this; |
94 | 94 | } |
95 | 95 | |
96 | - public function removeItem($index){ |
|
96 | + public function removeItem($index) { |
|
97 | 97 | return array_splice($this->content, $index, 1); |
98 | 98 | } |
99 | 99 | |
100 | - public function count(){ |
|
100 | + public function count() { |
|
101 | 101 | return \sizeof($this->content); |
102 | 102 | } |
103 | 103 | |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | return $this->addItem($function($object)); |
109 | 109 | } |
110 | 110 | |
111 | - public function apply($callBack){ |
|
112 | - foreach ($this->content as $item){ |
|
111 | + public function apply($callBack) { |
|
112 | + foreach ($this->content as $item) { |
|
113 | 113 | $callBack($item); |
114 | 114 | } |
115 | 115 | return $this; |
@@ -129,23 +129,23 @@ discard block |
||
129 | 129 | */ |
130 | 130 | abstract protected function createItem($value); |
131 | 131 | |
132 | - protected function createCondition($value){ |
|
132 | + protected function createCondition($value) { |
|
133 | 133 | return !($value instanceof BaseHtml); |
134 | 134 | } |
135 | 135 | |
136 | - protected function contentAs($tagName){ |
|
137 | - foreach ($this->content as $item){ |
|
136 | + protected function contentAs($tagName) { |
|
137 | + foreach ($this->content as $item) { |
|
138 | 138 | $item->setTagName($tagName); |
139 | 139 | } |
140 | 140 | return $this; |
141 | 141 | } |
142 | 142 | |
143 | - public function setProperties($properties){ |
|
143 | + public function setProperties($properties) { |
|
144 | 144 | $i=0; |
145 | - foreach ($properties as $k=>$v){ |
|
145 | + foreach ($properties as $k=>$v) { |
|
146 | 146 | $c=$this->content[$i++]; |
147 | - if(isset($c)) |
|
148 | - $c->setProperty($k,$v); |
|
147 | + if (isset($c)) |
|
148 | + $c->setProperty($k, $v); |
|
149 | 149 | else |
150 | 150 | return $this; |
151 | 151 | } |
@@ -158,15 +158,15 @@ discard block |
||
158 | 158 | * @param array|mixed $values |
159 | 159 | * @return $this |
160 | 160 | */ |
161 | - public function setPropertyValues($property,$values){ |
|
162 | - if(\is_array($values)===false){ |
|
163 | - $values=\array_fill(0, $this->count(),$values); |
|
161 | + public function setPropertyValues($property, $values) { |
|
162 | + if (\is_array($values)===false) { |
|
163 | + $values=\array_fill(0, $this->count(), $values); |
|
164 | 164 | } |
165 | - foreach ($values as $i=>$value){ |
|
166 | - if(isset($this->content[$i])){ |
|
167 | - $this->content[$i]->setProperty($property,$value); |
|
165 | + foreach ($values as $i=>$value) { |
|
166 | + if (isset($this->content[$i])) { |
|
167 | + $this->content[$i]->setProperty($property, $value); |
|
168 | 168 | } |
169 | - else{ |
|
169 | + else { |
|
170 | 170 | return $this; |
171 | 171 | } |
172 | 172 | } |
@@ -179,15 +179,15 @@ discard block |
||
179 | 179 | * @param array|mixed $values |
180 | 180 | * @return $this |
181 | 181 | */ |
182 | - public function addPropertyValues($property,$values){ |
|
183 | - if(\is_array($values)===false){ |
|
184 | - $values=\array_fill(0, $this->count(),$values); |
|
182 | + public function addPropertyValues($property, $values) { |
|
183 | + if (\is_array($values)===false) { |
|
184 | + $values=\array_fill(0, $this->count(), $values); |
|
185 | 185 | } |
186 | - foreach ($values as $i=>$value){ |
|
187 | - if(isset($this->content[$i])){ |
|
188 | - $this->content[$i++]->addToProperty($property,$value); |
|
186 | + foreach ($values as $i=>$value) { |
|
187 | + if (isset($this->content[$i])) { |
|
188 | + $this->content[$i++]->addToProperty($property, $value); |
|
189 | 189 | } |
190 | - else{ |
|
190 | + else { |
|
191 | 191 | return $this; |
192 | 192 | } |
193 | 193 | } |
@@ -197,13 +197,13 @@ discard block |
||
197 | 197 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
198 | 198 | $index=0; |
199 | 199 | $classname=\strtolower(JReflection::shortClassName($this)); |
200 | - foreach ($this->content as $item){ |
|
201 | - $this->setItemIdentifier($item,$classname,$index++); |
|
200 | + foreach ($this->content as $item) { |
|
201 | + $this->setItemIdentifier($item, $classname, $index++); |
|
202 | 202 | } |
203 | - return parent::compile($js,$view); |
|
203 | + return parent::compile($js, $view); |
|
204 | 204 | } |
205 | 205 | |
206 | - public function getItemById($identifier){ |
|
206 | + public function getItemById($identifier) { |
|
207 | 207 | return $this->getElementById($identifier, $this->content); |
208 | 208 | } |
209 | 209 | |
@@ -212,13 +212,13 @@ discard block |
||
212 | 212 | * @param string $target |
213 | 213 | * @return HtmlCollection |
214 | 214 | */ |
215 | - public function asLinks($hrefs=[],$target=NUll) { |
|
216 | - foreach ( $this->content as $index=>$item ) { |
|
217 | - if($item instanceof HtmlDoubleElement){ |
|
215 | + public function asLinks($hrefs=[], $target=NUll) { |
|
216 | + foreach ($this->content as $index=>$item) { |
|
217 | + if ($item instanceof HtmlDoubleElement) { |
|
218 | 218 | $href=""; |
219 | - if(isset($hrefs[$index])) |
|
219 | + if (isset($hrefs[$index])) |
|
220 | 220 | $href=$hrefs[$index]; |
221 | - $item->asLink($href,$target); |
|
221 | + $item->asLink($href, $target); |
|
222 | 222 | } |
223 | 223 | } |
224 | 224 | return $this; |
@@ -230,8 +230,8 @@ discard block |
||
230 | 230 | * @param int $length If length is omitted, removes everything from offset to the end of the array. If length is specified and is positive, then that many elements will be removed. If length is specified and is negative then the end of the removed portion will be that many elements from the end of the array. If length is specified and is zero, no elements will be removed. Tip: to remove everything from offset to the end of the array when replacement is also specified, use count($input) for length. |
231 | 231 | * @return $this |
232 | 232 | */ |
233 | - public function splice($offset,$length=null){ |
|
234 | - $this->content=array_slice($this->content, $offset,$length); |
|
233 | + public function splice($offset, $length=null) { |
|
234 | + $this->content=array_slice($this->content, $offset, $length); |
|
235 | 235 | return $this; |
236 | 236 | } |
237 | 237 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * @author jc |
16 | 16 | * |
17 | 17 | */ |
18 | -trait FormTrait{ |
|
18 | +trait FormTrait { |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @return HtmlForm |
@@ -23,23 +23,23 @@ discard block |
||
23 | 23 | abstract protected function getForm(); |
24 | 24 | |
25 | 25 | |
26 | - protected function addCompoValidation(Form $compo,HtmlFormField $field){ |
|
26 | + protected function addCompoValidation(Form $compo, HtmlFormField $field) { |
|
27 | 27 | $validation=$field->getValidation(); |
28 | - if(isset($validation)){ |
|
28 | + if (isset($validation)) { |
|
29 | 29 | $validation->setIdentifier($field->getDataField()->getIdentifier()); |
30 | 30 | $compo->addFieldValidation($validation); |
31 | 31 | } |
32 | 32 | } |
33 | 33 | |
34 | - protected function addExtraCompoValidation(Form $compo,FieldValidation $validation){ |
|
34 | + protected function addExtraCompoValidation(Form $compo, FieldValidation $validation) { |
|
35 | 35 | $compo->addFieldValidation($validation); |
36 | 36 | } |
37 | 37 | |
38 | - protected function _runValidationParams(Form &$compo,JsUtils $js=NULL){ |
|
38 | + protected function _runValidationParams(Form &$compo, JsUtils $js=NULL) { |
|
39 | 39 | $form=$this->getForm(); |
40 | 40 | $params=$form->getValidationParams(); |
41 | - if(isset($params["_ajaxSubmit"])){ |
|
42 | - $compilation=$this->_compileAjaxSubmit($params["_ajaxSubmit"],$js); |
|
41 | + if (isset($params["_ajaxSubmit"])) { |
|
42 | + $compilation=$this->_compileAjaxSubmit($params["_ajaxSubmit"], $js); |
|
43 | 43 | $this->onSuccess($compilation); |
44 | 44 | $form->removeValidationParam("_ajaxSubmit"); |
45 | 45 | } |
@@ -48,16 +48,16 @@ discard block |
||
48 | 48 | $form->addEventsOnRun($js); |
49 | 49 | } |
50 | 50 | |
51 | - protected function _compileAjaxSubmit($ajaxSubmit,JsUtils $js=null){ |
|
51 | + protected function _compileAjaxSubmit($ajaxSubmit, JsUtils $js=null) { |
|
52 | 52 | $compilation=""; |
53 | - if(\is_array($ajaxSubmit)){ |
|
54 | - foreach ($ajaxSubmit as $ajaxSubmitItem){ |
|
53 | + if (\is_array($ajaxSubmit)) { |
|
54 | + foreach ($ajaxSubmit as $ajaxSubmitItem) { |
|
55 | 55 | $compilation.=$ajaxSubmitItem->compile($js); |
56 | 56 | } |
57 | - }elseif($ajaxSubmit instanceof AjaxCall){ |
|
57 | + }elseif ($ajaxSubmit instanceof AjaxCall) { |
|
58 | 58 | $compilation=$ajaxSubmit->compile($js); |
59 | 59 | } |
60 | - $compilation=str_ireplace("\"","%quote%", $compilation); |
|
60 | + $compilation=str_ireplace("\"", "%quote%", $compilation); |
|
61 | 61 | return $compilation; |
62 | 62 | } |
63 | 63 | |
@@ -70,14 +70,14 @@ discard block |
||
70 | 70 | return $this; |
71 | 71 | } |
72 | 72 | |
73 | - public function setAttached($value=true){ |
|
73 | + public function setAttached($value=true) { |
|
74 | 74 | $form=$this->getForm(); |
75 | - if($value) |
|
76 | - $form->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
75 | + if ($value) |
|
76 | + $form->addToPropertyCtrl("class", "attached", array("attached")); |
|
77 | 77 | return $form; |
78 | 78 | } |
79 | 79 | |
80 | - public function addErrorMessage(){ |
|
80 | + public function addErrorMessage() { |
|
81 | 81 | return $this->getForm()->addContent((new HtmlMessage(""))->setError()); |
82 | 82 | } |
83 | 83 | |
@@ -93,48 +93,48 @@ discard block |
||
93 | 93 | * @param array $parameters |
94 | 94 | * @return HtmlForm |
95 | 95 | */ |
96 | - public function submitOn($event,$identifierOrElement,$url,$responseElement,$parameters=NULL){ |
|
96 | + public function submitOn($event, $identifierOrElement, $url, $responseElement, $parameters=NULL) { |
|
97 | 97 | $form=$this->getForm(); |
98 | - if($identifierOrElement instanceof BaseHtml) |
|
98 | + if ($identifierOrElement instanceof BaseHtml) |
|
99 | 99 | $elem=$identifierOrElement; |
100 | 100 | else |
101 | 101 | $elem=$form->getElementById($identifierOrElement, $form->getContent()); |
102 | - if(isset($elem)){ |
|
103 | - $this->_buttonAsSubmit($elem, $event,$url,$responseElement,$parameters); |
|
102 | + if (isset($elem)) { |
|
103 | + $this->_buttonAsSubmit($elem, $event, $url, $responseElement, $parameters); |
|
104 | 104 | } |
105 | 105 | return $form; |
106 | 106 | } |
107 | 107 | |
108 | - public function submitOnClick($identifier,$url,$responseElement,$parameters=NULL){ |
|
109 | - return $this->submitOn("click", $identifier, $url, $responseElement,$parameters); |
|
108 | + public function submitOnClick($identifier, $url, $responseElement, $parameters=NULL) { |
|
109 | + return $this->submitOn("click", $identifier, $url, $responseElement, $parameters); |
|
110 | 110 | } |
111 | 111 | |
112 | - public function addSubmit($identifier,$value,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$parameters=NULL){ |
|
113 | - $bt=$this->getForm()->addButton($identifier, $value,$cssStyle); |
|
114 | - return $this->_buttonAsSubmit($bt, "click",$url,$responseElement,$parameters); |
|
112 | + public function addSubmit($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $parameters=NULL) { |
|
113 | + $bt=$this->getForm()->addButton($identifier, $value, $cssStyle); |
|
114 | + return $this->_buttonAsSubmit($bt, "click", $url, $responseElement, $parameters); |
|
115 | 115 | } |
116 | 116 | |
117 | - protected function _buttonAsSubmit(BaseHtml &$button,$event,$url,$responseElement=NULL,$parameters=NULL){ |
|
117 | + protected function _buttonAsSubmit(BaseHtml &$button, $event, $url, $responseElement=NULL, $parameters=NULL) { |
|
118 | 118 | $form=$this->getForm(); |
119 | - if(isset($url) && isset($responseElement)){ |
|
120 | - $button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');",true,true); |
|
121 | - $this->setSubmitParams($url,$responseElement,$parameters); |
|
119 | + if (isset($url) && isset($responseElement)) { |
|
120 | + $button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');", true, true); |
|
121 | + $this->setSubmitParams($url, $responseElement, $parameters); |
|
122 | 122 | } |
123 | 123 | return $button; |
124 | 124 | } |
125 | 125 | |
126 | - public function setSubmitParams($url,$responseElement=NULL,$parameters=NULL){ |
|
126 | + public function setSubmitParams($url, $responseElement=NULL, $parameters=NULL) { |
|
127 | 127 | $form=$this->getForm(); |
128 | - $params=["form"=>$form->getIdentifier(),"responseElement"=>$responseElement,"url"=>$url,"stopPropagation"=>true]; |
|
129 | - if(\is_array($parameters)){ |
|
130 | - $params=\array_merge($params,$parameters); |
|
128 | + $params=["form"=>$form->getIdentifier(), "responseElement"=>$responseElement, "url"=>$url, "stopPropagation"=>true]; |
|
129 | + if (\is_array($parameters)) { |
|
130 | + $params=\array_merge($params, $parameters); |
|
131 | 131 | } |
132 | 132 | $form->addValidationParam("_ajaxSubmit", new AjaxCall("postForm", $params)); |
133 | 133 | return $this; |
134 | 134 | } |
135 | 135 | |
136 | - public function addReset($identifier,$value,$cssStyle=NULL){ |
|
137 | - $bt=$this->getForm()->addButton($identifier, $value,$cssStyle); |
|
136 | + public function addReset($identifier, $value, $cssStyle=NULL) { |
|
137 | + $bt=$this->getForm()->addButton($identifier, $value, $cssStyle); |
|
138 | 138 | $bt->setProperty("type", "reset"); |
139 | 139 | return $bt; |
140 | 140 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * @param string $jsCode |
145 | 145 | * @return \Ajax\semantic\html\collections\form\HtmlForm |
146 | 146 | */ |
147 | - public function onValid($jsCode){ |
|
147 | + public function onValid($jsCode) { |
|
148 | 148 | $form=$this->getForm(); |
149 | 149 | $form->addValidationParam("onValid", "%function(){".$jsCode."}%"); |
150 | 150 | return $form; |
@@ -155,35 +155,35 @@ discard block |
||
155 | 155 | * @param string $jsCode can use event and fields parameters |
156 | 156 | * @return HtmlForm |
157 | 157 | */ |
158 | - public function onSuccess($jsCode){ |
|
158 | + public function onSuccess($jsCode) { |
|
159 | 159 | $form=$this->getForm(); |
160 | - $form->addValidationParam("onSuccess", $jsCode,"%function(event,fields){","}%"); |
|
160 | + $form->addValidationParam("onSuccess", $jsCode, "%function(event,fields){", "}%"); |
|
161 | 161 | return $form; |
162 | 162 | } |
163 | 163 | |
164 | - public function addExtraFieldRules($fieldname,$rules){ |
|
164 | + public function addExtraFieldRules($fieldname, $rules) { |
|
165 | 165 | $form=$this->getForm(); |
166 | 166 | $fv=$form->getExtraFieldValidation($fieldname); |
167 | - foreach ($rules as $rule){ |
|
167 | + foreach ($rules as $rule) { |
|
168 | 168 | $fv->addRule($rule); |
169 | 169 | } |
170 | 170 | } |
171 | 171 | |
172 | - public function addExtraFieldRule($fieldname,$type,$prompt=NULL,$value=NULL){ |
|
172 | + public function addExtraFieldRule($fieldname, $type, $prompt=NULL, $value=NULL) { |
|
173 | 173 | $form=$this->getForm(); |
174 | 174 | $fv=$form->getExtraFieldValidation($fieldname); |
175 | - $fv->addRule($type,$prompt,$value); |
|
175 | + $fv->addRule($type, $prompt, $value); |
|
176 | 176 | } |
177 | 177 | |
178 | - public function setOptional($fieldname,$optional=true){ |
|
178 | + public function setOptional($fieldname, $optional=true) { |
|
179 | 179 | $form=$this->getForm(); |
180 | 180 | $fv=$form->getExtraFieldValidation($fieldname); |
181 | 181 | $fv->setOptional($optional); |
182 | 182 | } |
183 | 183 | |
184 | - public function setActionTarget(string $action, string $target){ |
|
184 | + public function setActionTarget(string $action, string $target) { |
|
185 | 185 | $form=$this->getForm(); |
186 | - $form->setProperty('data-target',$target); |
|
187 | - $form->setProperty('action',$action); |
|
186 | + $form->setProperty('data-target', $target); |
|
187 | + $form->setProperty('action', $action); |
|
188 | 188 | } |
189 | 189 | } |
@@ -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 |
@@ -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 | } |
@@ -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 | } |
@@ -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 | } |
@@ -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; |
@@ -14,15 +14,15 @@ discard block |
||
14 | 14 | * @property boolean $_visibleHover |
15 | 15 | * @property InstanceViewer $_instanceViewer |
16 | 16 | */ |
17 | -trait DataTableFieldAsTrait{ |
|
18 | - protected $_buttons=["display","edit","delete"]; |
|
17 | +trait DataTableFieldAsTrait { |
|
18 | + protected $_buttons=["display", "edit", "delete"]; |
|
19 | 19 | protected $_buttonsColumn; |
20 | - abstract public function addField($field,$key=null); |
|
21 | - abstract public function insertField($index,$field,$key=null); |
|
22 | - abstract public function insertInField($index,$field,$key=null); |
|
23 | - abstract public function fieldAs($index,$type,$attributes=NULL); |
|
20 | + abstract public function addField($field, $key=null); |
|
21 | + abstract public function insertField($index, $field, $key=null); |
|
22 | + abstract public function insertInField($index, $field, $key=null); |
|
23 | + abstract public function fieldAs($index, $type, $attributes=NULL); |
|
24 | 24 | abstract protected function cleanIdentifier($id); |
25 | - abstract protected function _fieldAs($elementCallback,&$index,$attributes=NULL,$prefix=null); |
|
25 | + abstract protected function _fieldAs($elementCallback, &$index, $attributes=NULL, $prefix=null); |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * @param string $caption |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | * @param boolean $visibleHover |
31 | 31 | * @return callable |
32 | 32 | */ |
33 | - private function getFieldButtonCallable($caption,$visibleHover=true,$callback=null){ |
|
34 | - return $this->getCallable("getFieldButton",[$caption,$visibleHover],$callback); |
|
33 | + private function getFieldButtonCallable($caption, $visibleHover=true, $callback=null) { |
|
34 | + return $this->getCallable("getFieldButton", [$caption, $visibleHover], $callback); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -40,20 +40,20 @@ discard block |
||
40 | 40 | * @param callable $callback |
41 | 41 | * @return callable |
42 | 42 | */ |
43 | - private function getCallable($thisCallback,$parameters,$callback=null){ |
|
44 | - $result=function($instance) use($thisCallback,$parameters,$callback){ |
|
45 | - $object=call_user_func_array(array($this,$thisCallback), $parameters); |
|
46 | - if(isset($callback)){ |
|
47 | - if(\is_callable($callback)){ |
|
48 | - $callback($object,$instance,$this->_instanceViewer->count()+1); |
|
43 | + private function getCallable($thisCallback, $parameters, $callback=null) { |
|
44 | + $result=function($instance) use($thisCallback, $parameters, $callback){ |
|
45 | + $object=call_user_func_array(array($this, $thisCallback), $parameters); |
|
46 | + if (isset($callback)) { |
|
47 | + if (\is_callable($callback)) { |
|
48 | + $callback($object, $instance, $this->_instanceViewer->count()+1); |
|
49 | 49 | } |
50 | 50 | } |
51 | - if($object instanceof HtmlSemDoubleElement){ |
|
51 | + if ($object instanceof HtmlSemDoubleElement) { |
|
52 | 52 | $id=$this->_instanceViewer->getIdentifier(); |
53 | - $object->setProperty("data-ajax",$id); |
|
54 | - if($object->propertyContains("class","visibleover")){ |
|
53 | + $object->setProperty("data-ajax", $id); |
|
54 | + if ($object->propertyContains("class", "visibleover")) { |
|
55 | 55 | $this->_visibleHover=true; |
56 | - $object->setProperty("style","visibility:hidden;"); |
|
56 | + $object->setProperty("style", "visibility:hidden;"); |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | return $object; |
@@ -65,17 +65,17 @@ discard block |
||
65 | 65 | * @param string $caption |
66 | 66 | * @return HtmlButton |
67 | 67 | */ |
68 | - private function getFieldButton($caption,$visibleHover=true,$icon=null){ |
|
68 | + private function getFieldButton($caption, $visibleHover=true, $icon=null) { |
|
69 | 69 | $id=$this->_instanceViewer->getIdentifier(); |
70 | - $bt= new HtmlButton($this->cleanIdentifier($icon??$caption).'-'.$id,$caption); |
|
71 | - if($visibleHover) |
|
70 | + $bt=new HtmlButton($this->cleanIdentifier($icon ?? $caption).'-'.$id, $caption); |
|
71 | + if ($visibleHover) |
|
72 | 72 | $this->_visibleOver($bt); |
73 | 73 | return $bt; |
74 | 74 | } |
75 | 75 | |
76 | - private function getFieldButtons($buttons,$visibleHover=true){ |
|
77 | - $bts=new HtmlButtonGroups("",$buttons); |
|
78 | - if($visibleHover) |
|
76 | + private function getFieldButtons($buttons, $visibleHover=true) { |
|
77 | + $bts=new HtmlButtonGroups("", $buttons); |
|
78 | + if ($visibleHover) |
|
79 | 79 | $this->_visibleOver($bts); |
80 | 80 | return $bts; |
81 | 81 | } |
@@ -89,19 +89,19 @@ discard block |
||
89 | 89 | * @param array $attributes associative array (<b>ajax</b> key is for ajax post) |
90 | 90 | * @return DataTable |
91 | 91 | */ |
92 | - public function fieldAsSubmit($index,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$attributes=NULL){ |
|
93 | - return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$attributes){ |
|
94 | - $button=new HtmlButton($id,$value,$cssStyle); |
|
95 | - $button->postOnClick($url,"$(event.target).closest('tr').find(':input').serialize()",$responseElement,$attributes["ajax"]); |
|
96 | - if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"]) |
|
92 | + public function fieldAsSubmit($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL) { |
|
93 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle, $attributes){ |
|
94 | + $button=new HtmlButton($id, $value, $cssStyle); |
|
95 | + $button->postOnClick($url, "$(event.target).closest('tr').find(':input').serialize()", $responseElement, $attributes["ajax"]); |
|
96 | + if (!isset($attributes["visibleHover"]) || $attributes["visibleHover"]) |
|
97 | 97 | $this->_visibleOver($button); |
98 | 98 | return $button; |
99 | - }, $index,$attributes); |
|
99 | + }, $index, $attributes); |
|
100 | 100 | } |
101 | 101 | |
102 | - protected function _visibleOver(BaseHtml $element){ |
|
102 | + protected function _visibleOver(BaseHtml $element) { |
|
103 | 103 | $this->_visibleHover=true; |
104 | - return $element->addToProperty("class", "visibleover")->setProperty("style","visibility:hidden;"); |
|
104 | + return $element->addToProperty("class", "visibleover")->setProperty("style", "visibility:hidden;"); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | * @param boolean $visibleHover |
112 | 112 | * @return DataTable |
113 | 113 | */ |
114 | - public function addFieldButton($caption,$visibleHover=true,$callback=null){ |
|
115 | - $this->addField($this->getCallable("getFieldButton",[$caption,$visibleHover],$callback)); |
|
114 | + public function addFieldButton($caption, $visibleHover=true, $callback=null) { |
|
115 | + $this->addField($this->getCallable("getFieldButton", [$caption, $visibleHover], $callback)); |
|
116 | 116 | return $this; |
117 | 117 | } |
118 | 118 | |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | * @param boolean $visibleHover |
124 | 124 | * @return DataTable |
125 | 125 | */ |
126 | - public function addFieldButtons($buttons,$visibleHover=true,$callback=null){ |
|
127 | - $this->addField($this->getCallable("getFieldButtons",[$buttons,$visibleHover],$callback)); |
|
126 | + public function addFieldButtons($buttons, $visibleHover=true, $callback=null) { |
|
127 | + $this->addField($this->getCallable("getFieldButtons", [$buttons, $visibleHover], $callback)); |
|
128 | 128 | return $this; |
129 | 129 | } |
130 | 130 | |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | * @param callable $callback |
136 | 136 | * @return DataTable |
137 | 137 | */ |
138 | - public function insertFieldButton($index,$caption,$visibleHover=true,$callback=null){ |
|
139 | - $this->insertField($index, $this->getFieldButtonCallable($caption,$visibleHover,$callback)); |
|
138 | + public function insertFieldButton($index, $caption, $visibleHover=true, $callback=null) { |
|
139 | + $this->insertField($index, $this->getFieldButtonCallable($caption, $visibleHover, $callback)); |
|
140 | 140 | return $this; |
141 | 141 | } |
142 | 142 | |
@@ -147,25 +147,25 @@ discard block |
||
147 | 147 | * @param callable $callback |
148 | 148 | * @return DataTable |
149 | 149 | */ |
150 | - public function insertInFieldButton($index,$caption,$visibleHover=true,$callback=null,$key=null){ |
|
151 | - $this->insertInField($index, $this->getFieldButtonCallable($caption,$visibleHover,$callback),$key); |
|
150 | + public function insertInFieldButton($index, $caption, $visibleHover=true, $callback=null, $key=null) { |
|
151 | + $this->insertInField($index, $this->getFieldButtonCallable($caption, $visibleHover, $callback), $key); |
|
152 | 152 | return $this; |
153 | 153 | } |
154 | 154 | |
155 | - public function addDefaultButton($icon,$class=null,$visibleHover=true,$callback=null,$key=null){ |
|
156 | - $this->addField($this->getCallable("getDefaultButton",[$icon,$class,$visibleHover],$callback),$key); |
|
155 | + public function addDefaultButton($icon, $class=null, $visibleHover=true, $callback=null, $key=null) { |
|
156 | + $this->addField($this->getCallable("getDefaultButton", [$icon, $class, $visibleHover], $callback), $key); |
|
157 | 157 | return $this; |
158 | 158 | } |
159 | 159 | |
160 | - public function insertDefaultButtonIn($index,$icon,$class=null,$visibleHover=true,$callback=null,$key=null){ |
|
161 | - $this->insertInField($index,$this->getCallable("getDefaultButton",[$icon,$class,$visibleHover],$callback),$key); |
|
160 | + public function insertDefaultButtonIn($index, $icon, $class=null, $visibleHover=true, $callback=null, $key=null) { |
|
161 | + $this->insertInField($index, $this->getCallable("getDefaultButton", [$icon, $class, $visibleHover], $callback), $key); |
|
162 | 162 | return $this; |
163 | 163 | } |
164 | 164 | |
165 | - private function getDefaultButton($icon,$class=null,$visibleHover=true){ |
|
166 | - $bt=$this->getFieldButton("",$visibleHover,$icon); |
|
165 | + private function getDefaultButton($icon, $class=null, $visibleHover=true) { |
|
166 | + $bt=$this->getFieldButton("", $visibleHover, $icon); |
|
167 | 167 | $bt->asIcon($icon); |
168 | - if(isset($class)) |
|
168 | + if (isset($class)) |
|
169 | 169 | $bt->addClass($class); |
170 | 170 | return $bt; |
171 | 171 | } |
@@ -177,9 +177,9 @@ discard block |
||
177 | 177 | * @param callable $callback this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object |
178 | 178 | * @return DataTable |
179 | 179 | */ |
180 | - public function addDeleteButton($visibleHover=true,$deleteBehavior=[],$callback=null){ |
|
180 | + public function addDeleteButton($visibleHover=true, $deleteBehavior=[], $callback=null) { |
|
181 | 181 | $this->_deleteBehavior=$deleteBehavior; |
182 | - return $this->addDefaultButton("remove","_delete red basic",$visibleHover,$callback,"delete"); |
|
182 | + return $this->addDefaultButton("remove", "_delete red basic", $visibleHover, $callback, "delete"); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | /** |
@@ -189,9 +189,9 @@ discard block |
||
189 | 189 | * @param callable $callback this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object |
190 | 190 | * @return DataTable |
191 | 191 | */ |
192 | - public function addEditButton($visibleHover=true,$editBehavior=[],$callback=null){ |
|
192 | + public function addEditButton($visibleHover=true, $editBehavior=[], $callback=null) { |
|
193 | 193 | $this->_editBehavior=$editBehavior; |
194 | - return $this->addDefaultButton("edit","_edit basic",$visibleHover,$callback,"edit"); |
|
194 | + return $this->addDefaultButton("edit", "_edit basic", $visibleHover, $callback, "edit"); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | /** |
@@ -201,9 +201,9 @@ discard block |
||
201 | 201 | * @param callable $callback this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object |
202 | 202 | * @return DataTable |
203 | 203 | */ |
204 | - public function addDisplayButton($visibleHover=true,$displayBehavior=[],$callback=null){ |
|
204 | + public function addDisplayButton($visibleHover=true, $displayBehavior=[], $callback=null) { |
|
205 | 205 | $this->_displayBehavior=$displayBehavior; |
206 | - return $this->addDefaultButton("eye","_display basic",$visibleHover,$callback,"display"); |
|
206 | + return $this->addDefaultButton("eye", "_display basic", $visibleHover, $callback, "display"); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | /** |
@@ -214,10 +214,10 @@ discard block |
||
214 | 214 | * @param callable $callbackDelete this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object |
215 | 215 | * @return DataTable |
216 | 216 | */ |
217 | - public function addEditDeleteButtons($visibleHover=true,$behavior=[],$callbackEdit=null,$callbackDelete=null){ |
|
218 | - $this->addEditButton($visibleHover,$behavior,$callbackEdit); |
|
217 | + public function addEditDeleteButtons($visibleHover=true, $behavior=[], $callbackEdit=null, $callbackDelete=null) { |
|
218 | + $this->addEditButton($visibleHover, $behavior, $callbackEdit); |
|
219 | 219 | $index=$this->_instanceViewer->visiblePropertiesCount()-1; |
220 | - $this->insertDeleteButtonIn($index,$visibleHover,$behavior,$callbackDelete); |
|
220 | + $this->insertDeleteButtonIn($index, $visibleHover, $behavior, $callbackDelete); |
|
221 | 221 | return $this; |
222 | 222 | } |
223 | 223 | |
@@ -230,28 +230,28 @@ discard block |
||
230 | 230 | * @param callable $callbackDelete this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object |
231 | 231 | * @return DataTable |
232 | 232 | */ |
233 | - public function addAllButtons($visibleHover=true,$behavior=[],$callbackDisplay=null,$callbackEdit=null,$callbackDelete=null){ |
|
234 | - $this->addDisplayButton($visibleHover,$behavior,$callbackDisplay); |
|
233 | + public function addAllButtons($visibleHover=true, $behavior=[], $callbackDisplay=null, $callbackEdit=null, $callbackDelete=null) { |
|
234 | + $this->addDisplayButton($visibleHover, $behavior, $callbackDisplay); |
|
235 | 235 | $index=$this->_instanceViewer->visiblePropertiesCount()-1; |
236 | 236 | $this->_buttonsColumn=$index; |
237 | - $this->insertEditButtonIn($index,$visibleHover,$behavior,$callbackEdit); |
|
238 | - $this->insertDeleteButtonIn($index,$visibleHover,$behavior,$callbackDelete); |
|
237 | + $this->insertEditButtonIn($index, $visibleHover, $behavior, $callbackEdit); |
|
238 | + $this->insertDeleteButtonIn($index, $visibleHover, $behavior, $callbackDelete); |
|
239 | 239 | return $this; |
240 | 240 | } |
241 | 241 | |
242 | - public function insertDeleteButtonIn($index,$visibleHover=true,$deleteBehavior=[],$callback=null){ |
|
242 | + public function insertDeleteButtonIn($index, $visibleHover=true, $deleteBehavior=[], $callback=null) { |
|
243 | 243 | $this->_deleteBehavior=$deleteBehavior; |
244 | - return $this->insertDefaultButtonIn($index,"remove","_delete red basic",$visibleHover,$callback,"delete"); |
|
244 | + return $this->insertDefaultButtonIn($index, "remove", "_delete red basic", $visibleHover, $callback, "delete"); |
|
245 | 245 | } |
246 | 246 | |
247 | - public function insertEditButtonIn($index,$visibleHover=true,$editBehavior=[],$callback=null){ |
|
247 | + public function insertEditButtonIn($index, $visibleHover=true, $editBehavior=[], $callback=null) { |
|
248 | 248 | $this->_editBehavior=$editBehavior; |
249 | - return $this->insertDefaultButtonIn($index,"edit","_edit basic",$visibleHover,$callback,"edit"); |
|
249 | + return $this->insertDefaultButtonIn($index, "edit", "_edit basic", $visibleHover, $callback, "edit"); |
|
250 | 250 | } |
251 | 251 | |
252 | - public function insertDisplayButtonIn($index,$visibleHover=true,$displayBehavior=[],$callback=null){ |
|
252 | + public function insertDisplayButtonIn($index, $visibleHover=true, $displayBehavior=[], $callback=null) { |
|
253 | 253 | $this->_displayBehavior=$displayBehavior; |
254 | - return $this->insertDefaultButtonIn($index,"eye","_display basic",$visibleHover,$callback,"display"); |
|
254 | + return $this->insertDefaultButtonIn($index, "eye", "_display basic", $visibleHover, $callback, "display"); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | /** |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | * @param array $_buttons |
266 | 266 | */ |
267 | 267 | public function setButtons($_buttons) { |
268 | - $this->_buttons = $_buttons; |
|
268 | + $this->_buttons=$_buttons; |
|
269 | 269 | return $this; |
270 | 270 | } |
271 | 271 |
@@ -29,17 +29,17 @@ discard block |
||
29 | 29 | |
30 | 30 | protected $groupByFields; |
31 | 31 | |
32 | - public static $index = 0; |
|
32 | + public static $index=0; |
|
33 | 33 | |
34 | - public function __construct($identifier, $instance = NULL, $captions = NULL) { |
|
35 | - $this->widgetIdentifier = $identifier; |
|
36 | - $this->values = []; |
|
37 | - $this->afterCompile = []; |
|
34 | + public function __construct($identifier, $instance=NULL, $captions=NULL) { |
|
35 | + $this->widgetIdentifier=$identifier; |
|
36 | + $this->values=[]; |
|
37 | + $this->afterCompile=[]; |
|
38 | 38 | if (isset($instance)) |
39 | 39 | $this->setInstance($instance); |
40 | 40 | $this->setCaptions($captions); |
41 | - $this->captionCallback = NULL; |
|
42 | - $this->defaultValueFunction = function ($name, $value) { |
|
41 | + $this->captionCallback=NULL; |
|
42 | + $this->defaultValueFunction=function($name, $value) { |
|
43 | 43 | return $value; |
44 | 44 | }; |
45 | 45 | } |
@@ -66,47 +66,47 @@ discard block |
||
66 | 66 | } |
67 | 67 | |
68 | 68 | public function getValues() { |
69 | - $values = []; |
|
70 | - $index = 0; |
|
71 | - $count = $this->count(); |
|
72 | - $hasGroupby = is_array($this->groupByFields); |
|
73 | - if (! $hasGroupby) { |
|
74 | - while ($index < $count) { |
|
75 | - $values[] = $this->getValue($index ++); |
|
69 | + $values=[]; |
|
70 | + $index=0; |
|
71 | + $count=$this->count(); |
|
72 | + $hasGroupby=is_array($this->groupByFields); |
|
73 | + if (!$hasGroupby) { |
|
74 | + while ($index<$count) { |
|
75 | + $values[]=$this->getValue($index++); |
|
76 | 76 | } |
77 | 77 | } else { |
78 | - while ($index < $count) { |
|
79 | - if (array_search($index, $this->groupByFields) === false) { |
|
80 | - $values[] = $this->getValue($index); |
|
78 | + while ($index<$count) { |
|
79 | + if (array_search($index, $this->groupByFields)===false) { |
|
80 | + $values[]=$this->getValue($index); |
|
81 | 81 | } |
82 | - $index ++; |
|
82 | + $index++; |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | return $values; |
86 | 86 | } |
87 | 87 | |
88 | - public function getIdentifier($index = NULL) { |
|
89 | - if (! isset($index)) |
|
90 | - $index = self::$index; |
|
91 | - $value = $index; |
|
88 | + public function getIdentifier($index=NULL) { |
|
89 | + if (!isset($index)) |
|
90 | + $index=self::$index; |
|
91 | + $value=$index; |
|
92 | 92 | if (isset($this->values["identifier"])) { |
93 | 93 | if (\is_string($this->values["identifier"])) |
94 | - $value = JReflection::callMethod($this->instance, $this->values["identifier"], []); |
|
94 | + $value=JReflection::callMethod($this->instance, $this->values["identifier"], []); |
|
95 | 95 | else |
96 | - $value = $this->values["identifier"]($index, $this->instance); |
|
96 | + $value=$this->values["identifier"]($index, $this->instance); |
|
97 | 97 | } |
98 | 98 | return $value; |
99 | 99 | } |
100 | 100 | |
101 | 101 | public function getValue($index) { |
102 | - $property = $this->properties[$index]; |
|
102 | + $property=$this->properties[$index]; |
|
103 | 103 | return $this->_getValue($property, $index); |
104 | 104 | } |
105 | 105 | |
106 | 106 | protected function _beforeAddProperty($index, &$field) {} |
107 | 107 | |
108 | 108 | protected function _getDefaultValue($name, $value, $index) { |
109 | - $func = $this->defaultValueFunction; |
|
109 | + $func=$this->defaultValueFunction; |
|
110 | 110 | return $func($name, $value, $index, $this->instance); |
111 | 111 | } |
112 | 112 | |
@@ -116,27 +116,27 @@ discard block |
||
116 | 116 | } |
117 | 117 | |
118 | 118 | protected function _getValue($property, $index) { |
119 | - $value = null; |
|
120 | - $propertyName = $property; |
|
119 | + $value=null; |
|
120 | + $propertyName=$property; |
|
121 | 121 | if ($property instanceof \ReflectionProperty) { |
122 | - $value = $this->_getPropertyValue($property); |
|
123 | - $propertyName = $property->getName(); |
|
124 | - } elseif (\is_callable($property) && \array_search($property, ['system','date']) === false){ |
|
125 | - try{ |
|
126 | - $value = $property($this->instance); |
|
127 | - }catch(\Error $e){} |
|
122 | + $value=$this->_getPropertyValue($property); |
|
123 | + $propertyName=$property->getName(); |
|
124 | + } elseif (\is_callable($property) && \array_search($property, ['system', 'date'])===false) { |
|
125 | + try { |
|
126 | + $value=$property($this->instance); |
|
127 | + }catch (\Error $e) {} |
|
128 | 128 | } |
129 | 129 | elseif (\is_array($property)) { |
130 | - $values = \array_map(function ($v) use ($index) { |
|
130 | + $values=\array_map(function($v) use ($index) { |
|
131 | 131 | return $this->_getValue($v, $index); |
132 | 132 | }, $property); |
133 | - $value = \implode('', $values); |
|
133 | + $value=\implode('', $values); |
|
134 | 134 | } elseif (\is_string($property)) { |
135 | - $value = ''; |
|
135 | + $value=''; |
|
136 | 136 | if (isset($this->instance->{$property})) { |
137 | - $value = $this->instance->{$property}; |
|
138 | - } elseif (\method_exists($this->instance, $getter = JReflection::getterName($property))) { |
|
139 | - $value = JReflection::callMethod($this->instance, $getter, []); |
|
137 | + $value=$this->instance->{$property}; |
|
138 | + } elseif (\method_exists($this->instance, $getter=JReflection::getterName($property))) { |
|
139 | + $value=JReflection::callMethod($this->instance, $getter, []); |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | |
@@ -145,9 +145,9 @@ discard block |
||
145 | 145 | |
146 | 146 | protected function _postGetValue($index, $propertyName, $value) { |
147 | 147 | if (isset($this->values[$index])) { |
148 | - $value = $this->values[$index]($value, $this->instance, $index, self::$index); |
|
148 | + $value=$this->values[$index]($value, $this->instance, $index, self::$index); |
|
149 | 149 | } else { |
150 | - $value = $this->_getDefaultValue($propertyName, $value, $index); |
|
150 | + $value=$this->_getDefaultValue($propertyName, $value, $index); |
|
151 | 151 | } |
152 | 152 | if (isset($this->afterCompile[$index])) { |
153 | 153 | if (\is_callable($this->afterCompile[$index])) { |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | return $value; |
158 | 158 | } |
159 | 159 | |
160 | - public function insertField($index, $field, $key = null) { |
|
160 | + public function insertField($index, $field, $key=null) { |
|
161 | 161 | if (isset($key)) { |
162 | 162 | array_splice($this->visibleProperties, $index, 0, [ |
163 | 163 | $key => $field |
@@ -171,29 +171,29 @@ discard block |
||
171 | 171 | public function sortColumnContent($index, $array) { |
172 | 172 | if (isset($this->visibleProperties[$index])) { |
173 | 173 | if (is_array($this->visibleProperties[$index])) { |
174 | - $this->visibleProperties[$index] = JArray::sortAssociative($this->visibleProperties[$index], $array); |
|
174 | + $this->visibleProperties[$index]=JArray::sortAssociative($this->visibleProperties[$index], $array); |
|
175 | 175 | } |
176 | 176 | } |
177 | 177 | return $this; |
178 | 178 | } |
179 | 179 | |
180 | - public function insertInField($index, $field, $key = null) { |
|
181 | - $vb = $this->visibleProperties; |
|
180 | + public function insertInField($index, $field, $key=null) { |
|
181 | + $vb=$this->visibleProperties; |
|
182 | 182 | if (isset($vb[$index])) { |
183 | 183 | if (isset($key)) { |
184 | 184 | if (\is_array($vb[$index])) { |
185 | - $this->visibleProperties[$index][$key] = $field; |
|
185 | + $this->visibleProperties[$index][$key]=$field; |
|
186 | 186 | } else { |
187 | - $this->visibleProperties[$index] = [ |
|
187 | + $this->visibleProperties[$index]=[ |
|
188 | 188 | $vb[$index], |
189 | 189 | $key => $field |
190 | 190 | ]; |
191 | 191 | } |
192 | 192 | } else { |
193 | 193 | if (\is_array($vb[$index])) { |
194 | - $this->visibleProperties[$index][] = $field; |
|
194 | + $this->visibleProperties[$index][]=$field; |
|
195 | 195 | } else { |
196 | - $this->visibleProperties[$index] = [ |
|
196 | + $this->visibleProperties[$index]=[ |
|
197 | 197 | $vb[$index], |
198 | 198 | $field |
199 | 199 | ]; |
@@ -205,19 +205,19 @@ discard block |
||
205 | 205 | return $this; |
206 | 206 | } |
207 | 207 | |
208 | - public function addField($field, $key = null) { |
|
208 | + public function addField($field, $key=null) { |
|
209 | 209 | if (isset($key)) { |
210 | - $this->visibleProperties[] = [ |
|
210 | + $this->visibleProperties[]=[ |
|
211 | 211 | $key => $field |
212 | 212 | ]; |
213 | 213 | } else { |
214 | - $this->visibleProperties[] = $field; |
|
214 | + $this->visibleProperties[]=$field; |
|
215 | 215 | } |
216 | 216 | return $this; |
217 | 217 | } |
218 | 218 | |
219 | 219 | public function addFields($fields) { |
220 | - $this->visibleProperties = \array_merge($this->visibleProperties, $fields); |
|
220 | + $this->visibleProperties=\array_merge($this->visibleProperties, $fields); |
|
221 | 221 | return $this; |
222 | 222 | } |
223 | 223 | |
@@ -234,37 +234,37 @@ discard block |
||
234 | 234 | } |
235 | 235 | |
236 | 236 | public function getFieldName($index) { |
237 | - $property = $this->getProperty($index); |
|
237 | + $property=$this->getProperty($index); |
|
238 | 238 | if ($property instanceof \ReflectionProperty) { |
239 | - $result = $property->getName(); |
|
239 | + $result=$property->getName(); |
|
240 | 240 | } elseif (\is_callable($property)) { |
241 | - $result = $this->visibleProperties[$index]; |
|
241 | + $result=$this->visibleProperties[$index]; |
|
242 | 242 | } else { |
243 | - $result = $property; |
|
243 | + $result=$property; |
|
244 | 244 | } |
245 | 245 | return $result; |
246 | 246 | } |
247 | 247 | |
248 | 248 | protected function showableProperty(\ReflectionProperty $rProperty) { |
249 | - return JString::startswith($rProperty->getName(), "_") === false; |
|
249 | + return JString::startswith($rProperty->getName(), "_")===false; |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | public function setInstance($instance) { |
253 | 253 | if (\is_string($instance) && \class_exists($instance)) { |
254 | - $instance = new $instance(); |
|
254 | + $instance=new $instance(); |
|
255 | 255 | } |
256 | - $this->instance = $instance; |
|
257 | - $this->properties = []; |
|
258 | - try{ |
|
259 | - $this->reflect = new \ReflectionClass($instance); |
|
260 | - if (JArray::count($this->visibleProperties) === 0) { |
|
261 | - $this->properties = $this->getDefaultProperties(); |
|
256 | + $this->instance=$instance; |
|
257 | + $this->properties=[]; |
|
258 | + try { |
|
259 | + $this->reflect=new \ReflectionClass($instance); |
|
260 | + if (JArray::count($this->visibleProperties)===0) { |
|
261 | + $this->properties=$this->getDefaultProperties(); |
|
262 | 262 | } else { |
263 | 263 | foreach ($this->visibleProperties as $property) { |
264 | 264 | $this->setInstanceProperty($property); |
265 | 265 | } |
266 | 266 | } |
267 | - }catch (\Throwable $th){ |
|
267 | + }catch (\Throwable $th) { |
|
268 | 268 | |
269 | 269 | } |
270 | 270 | return $this; |
@@ -272,56 +272,56 @@ discard block |
||
272 | 272 | |
273 | 273 | private function setInstanceProperty($property) { |
274 | 274 | if (\is_callable($property)) { |
275 | - $this->properties[] = $property; |
|
275 | + $this->properties[]=$property; |
|
276 | 276 | } elseif (\is_string($property)) { |
277 | 277 | try { |
278 | 278 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
279 | - $rProperty = $this->reflect->getProperty($property); |
|
280 | - $this->properties[] = $rProperty; |
|
281 | - } catch (\Exception $e) { |
|
279 | + $rProperty=$this->reflect->getProperty($property); |
|
280 | + $this->properties[]=$rProperty; |
|
281 | + }catch (\Exception $e) { |
|
282 | 282 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
283 | - $this->properties[] = $property; |
|
283 | + $this->properties[]=$property; |
|
284 | 284 | } |
285 | 285 | } elseif (\is_int($property)) { |
286 | - $props = $this->getDefaultProperties(); |
|
286 | + $props=$this->getDefaultProperties(); |
|
287 | 287 | if (isset($props[$property])) |
288 | - $this->properties[] = $props[$property]; |
|
288 | + $this->properties[]=$props[$property]; |
|
289 | 289 | else |
290 | - $this->properties[] = $property; |
|
290 | + $this->properties[]=$property; |
|
291 | 291 | } else { |
292 | - $this->properties[] = $property; |
|
292 | + $this->properties[]=$property; |
|
293 | 293 | } |
294 | 294 | } |
295 | 295 | |
296 | 296 | protected function getDefaultProperties() { |
297 | - $result = []; |
|
298 | - $properties = $this->reflect->getProperties(); |
|
297 | + $result=[]; |
|
298 | + $properties=$this->reflect->getProperties(); |
|
299 | 299 | foreach ($properties as $property) { |
300 | - $showable = $this->showableProperty($property); |
|
301 | - if ($showable !== false) { |
|
302 | - $result[] = $property; |
|
300 | + $showable=$this->showableProperty($property); |
|
301 | + if ($showable!==false) { |
|
302 | + $result[]=$property; |
|
303 | 303 | } |
304 | 304 | } |
305 | 305 | return $result; |
306 | 306 | } |
307 | 307 | |
308 | 308 | public function setVisibleProperties($visibleProperties) { |
309 | - $this->visibleProperties = $visibleProperties; |
|
309 | + $this->visibleProperties=$visibleProperties; |
|
310 | 310 | return $this; |
311 | 311 | } |
312 | 312 | |
313 | 313 | public function setValueFunction($index, $callback) { |
314 | - $this->values[$index] = $callback; |
|
314 | + $this->values[$index]=$callback; |
|
315 | 315 | return $this; |
316 | 316 | } |
317 | 317 | |
318 | 318 | public function setIdentifierFunction($callback) { |
319 | - $this->values["identifier"] = $callback; |
|
319 | + $this->values["identifier"]=$callback; |
|
320 | 320 | return $this; |
321 | 321 | } |
322 | 322 | |
323 | 323 | public static function setIndex($index) { |
324 | - self::$index = $index; |
|
324 | + self::$index=$index; |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | public function getProperties() { |
@@ -341,43 +341,43 @@ discard block |
||
341 | 341 | } |
342 | 342 | |
343 | 343 | public function getCaptions() { |
344 | - $hasGroupby = is_array($this->groupByFields); |
|
345 | - $count = $this->count(); |
|
346 | - $moreAdded = false; |
|
344 | + $hasGroupby=is_array($this->groupByFields); |
|
345 | + $count=$this->count(); |
|
346 | + $moreAdded=false; |
|
347 | 347 | if (isset($this->captions)) { |
348 | - $captions = \array_values($this->captions); |
|
349 | - $gbSize = $hasGroupby ? sizeof($this->groupByFields) : 0; |
|
350 | - $captionsSize = \sizeof($captions); |
|
351 | - for ($i = $captionsSize; $i < $count - $gbSize; $i ++) { |
|
352 | - $captions[] = ""; |
|
353 | - $moreAdded = true; |
|
348 | + $captions=\array_values($this->captions); |
|
349 | + $gbSize=$hasGroupby ? sizeof($this->groupByFields) : 0; |
|
350 | + $captionsSize=\sizeof($captions); |
|
351 | + for ($i=$captionsSize; $i<$count-$gbSize; $i++) { |
|
352 | + $captions[]=""; |
|
353 | + $moreAdded=true; |
|
354 | 354 | } |
355 | 355 | } else { |
356 | - $captions = []; |
|
357 | - $index = 0; |
|
358 | - while ($index < $count) { |
|
359 | - $captions[] = $this->getCaption($index ++); |
|
356 | + $captions=[]; |
|
357 | + $index=0; |
|
358 | + while ($index<$count) { |
|
359 | + $captions[]=$this->getCaption($index++); |
|
360 | 360 | } |
361 | 361 | } |
362 | - if ($hasGroupby && sizeof($captions) >= $count && ! $moreAdded) { |
|
363 | - $captions = JArray::removeByKeys($captions, $this->groupByFields); |
|
362 | + if ($hasGroupby && sizeof($captions)>=$count && !$moreAdded) { |
|
363 | + $captions=JArray::removeByKeys($captions, $this->groupByFields); |
|
364 | 364 | } |
365 | 365 | if (isset($this->captionCallback) && \is_callable($this->captionCallback)) { |
366 | - $callback = $this->captionCallback; |
|
366 | + $callback=$this->captionCallback; |
|
367 | 367 | $callback($captions, $this->instance); |
368 | 368 | } |
369 | 369 | return $captions; |
370 | 370 | } |
371 | 371 | |
372 | 372 | public function setCaption($index, $caption) { |
373 | - if (isset($this->captions) === false) |
|
374 | - $this->captions = []; |
|
375 | - $this->captions[$index] = $caption; |
|
373 | + if (isset($this->captions)===false) |
|
374 | + $this->captions=[]; |
|
375 | + $this->captions[$index]=$caption; |
|
376 | 376 | return $this; |
377 | 377 | } |
378 | 378 | |
379 | 379 | public function setCaptions($captions) { |
380 | - $this->captions = $captions; |
|
380 | + $this->captions=$captions; |
|
381 | 381 | return $this; |
382 | 382 | } |
383 | 383 | |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | * @return InstanceViewer |
393 | 393 | */ |
394 | 394 | public function afterCompile($index, $callback) { |
395 | - $this->afterCompile[$index] = $callback; |
|
395 | + $this->afterCompile[$index]=$callback; |
|
396 | 396 | return $this; |
397 | 397 | } |
398 | 398 | |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | * @return \Ajax\semantic\widgets\base\InstanceViewer |
405 | 405 | */ |
406 | 406 | public function setCaptionCallback($captionCallback) { |
407 | - $this->captionCallback = $captionCallback; |
|
407 | + $this->captionCallback=$captionCallback; |
|
408 | 408 | return $this; |
409 | 409 | } |
410 | 410 | |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | * @return \Ajax\semantic\widgets\base\InstanceViewer |
417 | 417 | */ |
418 | 418 | public function setDefaultValueFunction($defaultValueFunction) { |
419 | - $this->defaultValueFunction = $defaultValueFunction; |
|
419 | + $this->defaultValueFunction=$defaultValueFunction; |
|
420 | 420 | return $this; |
421 | 421 | } |
422 | 422 | |
@@ -425,8 +425,8 @@ discard block |
||
425 | 425 | } |
426 | 426 | |
427 | 427 | public function getSimpleProperties() { |
428 | - return array_filter($this->visibleProperties, function ($item) { |
|
429 | - return ! (is_array($item) || is_object($item)); |
|
428 | + return array_filter($this->visibleProperties, function($item) { |
|
429 | + return !(is_array($item) || is_object($item)); |
|
430 | 430 | }); |
431 | 431 | } |
432 | 432 | |
@@ -451,10 +451,10 @@ discard block |
||
451 | 451 | * @param mixed $groupByFields |
452 | 452 | */ |
453 | 453 | public function setGroupByFields($groupByFields) { |
454 | - $this->groupByFields = $groupByFields; |
|
454 | + $this->groupByFields=$groupByFields; |
|
455 | 455 | } |
456 | 456 | |
457 | - public function addGroupBy($groupByField){ |
|
457 | + public function addGroupBy($groupByField) { |
|
458 | 458 | $this->groupByFields[]=$groupByField; |
459 | 459 | } |
460 | 460 |