@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | use Ajax\semantic\html\collections\form\traits\FormTrait; |
19 | 19 | |
20 | 20 | abstract class Widget extends HtmlDoubleElement { |
21 | - use FieldAsTrait,FormTrait; |
|
21 | + use FieldAsTrait, FormTrait; |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * @var string classname |
@@ -51,37 +51,37 @@ discard block |
||
51 | 51 | protected $_generated; |
52 | 52 | |
53 | 53 | |
54 | - public function __construct($identifier,$model,$modelInstance=NULL) { |
|
54 | + public function __construct($identifier, $model, $modelInstance=NULL) { |
|
55 | 55 | parent::__construct($identifier); |
56 | 56 | $this->_template="%wrapContentBefore%%content%%wrapContentAfter%"; |
57 | 57 | $this->setModel($model); |
58 | - if(isset($modelInstance)); |
|
58 | + if (isset($modelInstance)); |
|
59 | 59 | $this->show($modelInstance); |
60 | 60 | $this->_generated=false; |
61 | 61 | } |
62 | 62 | |
63 | - protected function _init($instanceViewer,$contentKey,$content,$edition){ |
|
63 | + protected function _init($instanceViewer, $contentKey, $content, $edition) { |
|
64 | 64 | $this->_instanceViewer=$instanceViewer; |
65 | 65 | $this->content=[$contentKey=>$content]; |
66 | 66 | $this->_toolbarPosition=PositionInTable::BEFORETABLE; |
67 | 67 | $this->_edition=$edition; |
68 | 68 | } |
69 | 69 | |
70 | - protected function _getFieldIdentifier($prefix,$name=""){ |
|
70 | + protected function _getFieldIdentifier($prefix, $name="") { |
|
71 | 71 | return $this->identifier."-{$prefix}-".$this->_instanceViewer->getIdentifier(); |
72 | 72 | } |
73 | 73 | |
74 | - protected function _getFieldName($index){ |
|
74 | + protected function _getFieldName($index) { |
|
75 | 75 | return $this->_instanceViewer->getFieldName($index); |
76 | 76 | } |
77 | 77 | |
78 | - protected function _getFieldCaption($index){ |
|
78 | + protected function _getFieldCaption($index) { |
|
79 | 79 | return $this->_instanceViewer->getCaption($index); |
80 | 80 | } |
81 | 81 | |
82 | - abstract protected function _setToolbarPosition($table,$captions=NULL); |
|
82 | + abstract protected function _setToolbarPosition($table, $captions=NULL); |
|
83 | 83 | |
84 | - public function show($modelInstance){ |
|
84 | + public function show($modelInstance) { |
|
85 | 85 | $this->_modelInstance=$modelInstance; |
86 | 86 | } |
87 | 87 | |
@@ -105,52 +105,52 @@ discard block |
||
105 | 105 | |
106 | 106 | abstract public function getHtmlComponent(); |
107 | 107 | |
108 | - public function setColor($color){ |
|
108 | + public function setColor($color) { |
|
109 | 109 | return $this->getHtmlComponent()->setColor($color); |
110 | 110 | } |
111 | 111 | |
112 | 112 | |
113 | - public function setCaptions($captions){ |
|
113 | + public function setCaptions($captions) { |
|
114 | 114 | $this->_instanceViewer->setCaptions($captions); |
115 | 115 | return $this; |
116 | 116 | } |
117 | 117 | |
118 | - public function setFields($fields){ |
|
118 | + public function setFields($fields) { |
|
119 | 119 | $this->_instanceViewer->setVisibleProperties($fields); |
120 | 120 | return $this; |
121 | 121 | } |
122 | 122 | |
123 | - public function addField($field){ |
|
123 | + public function addField($field) { |
|
124 | 124 | $this->_instanceViewer->addField($field); |
125 | 125 | return $this; |
126 | 126 | } |
127 | 127 | |
128 | - public function addMessage($attributes=NULL,$fieldName="message"){ |
|
128 | + public function addMessage($attributes=NULL, $fieldName="message") { |
|
129 | 129 | $this->_instanceViewer->addField($fieldName); |
130 | 130 | $count=$this->_instanceViewer->visiblePropertiesCount(); |
131 | - return $this->fieldAsMessage($count-1,$attributes); |
|
131 | + return $this->fieldAsMessage($count-1, $attributes); |
|
132 | 132 | } |
133 | 133 | |
134 | - public function addErrorMessage(){ |
|
135 | - return $this->addMessage(["error"=>true],"message"); |
|
134 | + public function addErrorMessage() { |
|
135 | + return $this->addMessage(["error"=>true], "message"); |
|
136 | 136 | } |
137 | 137 | |
138 | - public function insertField($index,$field){ |
|
138 | + public function insertField($index, $field) { |
|
139 | 139 | $this->_instanceViewer->insertField($index, $field); |
140 | 140 | return $this; |
141 | 141 | } |
142 | 142 | |
143 | - public function insertInField($index,$field){ |
|
143 | + public function insertInField($index, $field) { |
|
144 | 144 | $this->_instanceViewer->insertInField($index, $field); |
145 | 145 | return $this; |
146 | 146 | } |
147 | 147 | |
148 | - public function setValueFunction($index,$callback){ |
|
148 | + public function setValueFunction($index, $callback) { |
|
149 | 149 | $this->_instanceViewer->setValueFunction($index, $callback); |
150 | 150 | return $this; |
151 | 151 | } |
152 | 152 | |
153 | - public function setIdentifierFunction($callback){ |
|
153 | + public function setIdentifierFunction($callback) { |
|
154 | 154 | $this->_instanceViewer->setIdentifierFunction($callback); |
155 | 155 | return $this; |
156 | 156 | } |
@@ -158,8 +158,8 @@ discard block |
||
158 | 158 | /** |
159 | 159 | * @return \Ajax\semantic\html\collections\menus\HtmlMenu |
160 | 160 | */ |
161 | - public function getToolbar(){ |
|
162 | - if(isset($this->_toolbar)===false){ |
|
161 | + public function getToolbar() { |
|
162 | + if (isset($this->_toolbar)===false) { |
|
163 | 163 | $this->_toolbar=new HtmlMenu("toolbar-".$this->identifier); |
164 | 164 | } |
165 | 165 | return $this->_toolbar; |
@@ -171,10 +171,10 @@ discard block |
||
171 | 171 | * @param callable $callback function to call on $element |
172 | 172 | * @return \Ajax\common\html\HtmlDoubleElement |
173 | 173 | */ |
174 | - public function addInToolbar($element,$callback=NULL){ |
|
174 | + public function addInToolbar($element, $callback=NULL) { |
|
175 | 175 | $tb=$this->getToolbar(); |
176 | - if(isset($callback)){ |
|
177 | - if(\is_callable($callback)){ |
|
176 | + if (isset($callback)) { |
|
177 | + if (\is_callable($callback)) { |
|
178 | 178 | $callback($element); |
179 | 179 | } |
180 | 180 | } |
@@ -187,9 +187,9 @@ discard block |
||
187 | 187 | * @param callable $callback function($element) |
188 | 188 | * @return \Ajax\common\html\HtmlDoubleElement |
189 | 189 | */ |
190 | - public function addItemInToolbar($caption,$icon=NULL,$callback=NULL){ |
|
191 | - $result=$this->addInToolbar($caption,$callback); |
|
192 | - if(isset($icon)) |
|
190 | + public function addItemInToolbar($caption, $icon=NULL, $callback=NULL) { |
|
191 | + $result=$this->addInToolbar($caption, $callback); |
|
192 | + if (isset($icon)) |
|
193 | 193 | $result->addIcon($icon); |
194 | 194 | return $result; |
195 | 195 | } |
@@ -199,14 +199,14 @@ discard block |
||
199 | 199 | * @param callable $callback function($element) |
200 | 200 | * @return \Ajax\common\Widget |
201 | 201 | */ |
202 | - public function addItemsInToolbar(array $items,$callback=NULL){ |
|
203 | - if(JArray::isAssociative($items)){ |
|
204 | - foreach ($items as $icon=>$item){ |
|
205 | - $this->addItemInToolbar($item,$icon,$callback); |
|
202 | + public function addItemsInToolbar(array $items, $callback=NULL) { |
|
203 | + if (JArray::isAssociative($items)) { |
|
204 | + foreach ($items as $icon=>$item) { |
|
205 | + $this->addItemInToolbar($item, $icon, $callback); |
|
206 | 206 | } |
207 | - }else{ |
|
208 | - foreach ($items as $item){ |
|
209 | - $this->addItemInToolbar($item,null,$callback); |
|
207 | + } else { |
|
208 | + foreach ($items as $item) { |
|
209 | + $this->addItemInToolbar($item, null, $callback); |
|
210 | 210 | } |
211 | 211 | } |
212 | 212 | return $this; |
@@ -218,12 +218,12 @@ discard block |
||
218 | 218 | * @param callable $callback function($element) |
219 | 219 | * @return \Ajax\common\html\HtmlDoubleElement |
220 | 220 | */ |
221 | - public function addDropdownInToolbar($value,$items,$callback=NULL){ |
|
221 | + public function addDropdownInToolbar($value, $items, $callback=NULL) { |
|
222 | 222 | $dd=$value; |
223 | 223 | if (\is_string($value)) { |
224 | - $dd=new HtmlDropdown("dropdown-". $this->identifier."-".$value, $value, $items); |
|
224 | + $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$value, $value, $items); |
|
225 | 225 | } |
226 | - return $this->addInToolbar($dd,$callback); |
|
226 | + return $this->addInToolbar($dd, $callback); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | /** |
@@ -231,9 +231,9 @@ discard block |
||
231 | 231 | * @param callable $callback function($element) |
232 | 232 | * @return \Ajax\common\html\HtmlDoubleElement |
233 | 233 | */ |
234 | - public function addButtonInToolbar($caption,$callback=NULL){ |
|
235 | - $bt=new HtmlButton("bt-".$caption,$caption); |
|
236 | - return $this->addInToolbar($bt,$callback); |
|
234 | + public function addButtonInToolbar($caption, $callback=NULL) { |
|
235 | + $bt=new HtmlButton("bt-".$caption, $caption); |
|
236 | + return $this->addInToolbar($bt, $callback); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | /** |
@@ -242,9 +242,9 @@ discard block |
||
242 | 242 | * @param callable $callback function($element) |
243 | 243 | * @return \Ajax\common\html\HtmlDoubleElement |
244 | 244 | */ |
245 | - public function addButtonsInToolbar(array $captions,$asIcon=false,$callback=NULL){ |
|
246 | - $bts=new HtmlButtonGroups("",$captions,$asIcon); |
|
247 | - return $this->addInToolbar($bts,$callback); |
|
245 | + public function addButtonsInToolbar(array $captions, $asIcon=false, $callback=NULL) { |
|
246 | + $bts=new HtmlButtonGroups("", $captions, $asIcon); |
|
247 | + return $this->addInToolbar($bts, $callback); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | /** |
@@ -254,15 +254,15 @@ discard block |
||
254 | 254 | * @param boolean $labeled |
255 | 255 | * @return \Ajax\common\html\HtmlDoubleElement |
256 | 256 | */ |
257 | - public function addLabelledIconButtonInToolbar($caption,$icon,$before=true,$labeled=false){ |
|
258 | - $bt=new HtmlButton("",$caption); |
|
259 | - $bt->addIcon($icon,$before,$labeled); |
|
257 | + public function addLabelledIconButtonInToolbar($caption, $icon, $before=true, $labeled=false) { |
|
258 | + $bt=new HtmlButton("", $caption); |
|
259 | + $bt->addIcon($icon, $before, $labeled); |
|
260 | 260 | return $this->addInToolbar($bt); |
261 | 261 | } |
262 | 262 | |
263 | - public function addSubmitInToolbar($identifier,$value,$cssStyle=NULL,$url=NULL,$responseElement=NULL){ |
|
264 | - $button=new HtmlButton($identifier,$value,$cssStyle); |
|
265 | - $this->_buttonAsSubmit($button,"click",$url,$responseElement); |
|
263 | + public function addSubmitInToolbar($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL) { |
|
264 | + $button=new HtmlButton($identifier, $value, $cssStyle); |
|
265 | + $this->_buttonAsSubmit($button, "click", $url, $responseElement); |
|
266 | 266 | return $this->addInToolbar($button); |
267 | 267 | } |
268 | 268 | |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | * @param callable $defaultValueFunction function parameters are : $name : the field name, $value : the field value ,$index : the field index, $instance : the active instance of model |
293 | 293 | * @return \Ajax\common\Widget |
294 | 294 | */ |
295 | - public function setDefaultValueFunction($defaultValueFunction){ |
|
295 | + public function setDefaultValueFunction($defaultValueFunction) { |
|
296 | 296 | $this->_instanceViewer->setDefaultValueFunction($defaultValueFunction); |
297 | 297 | return $this; |
298 | 298 | } |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | * @param string|boolean $disable |
302 | 302 | * @return string |
303 | 303 | */ |
304 | - public function jsDisabled($disable=true){ |
|
304 | + public function jsDisabled($disable=true) { |
|
305 | 305 | return "$('#".$this->identifier." .ui.input,#".$this->identifier." .ui.dropdown,#".$this->identifier." .ui.checkbox').toggleClass('disabled',".$disable.");"; |
306 | 306 | } |
307 | 307 | |
@@ -310,12 +310,12 @@ discard block |
||
310 | 310 | * @param callable $callback function($element) |
311 | 311 | * @return \Ajax\common\html\HtmlDoubleElement |
312 | 312 | */ |
313 | - public function addEditButtonInToolbar($caption,$callback=NULL){ |
|
314 | - $bt=new HtmlButton($this->identifier."-editBtn",$caption); |
|
313 | + public function addEditButtonInToolbar($caption, $callback=NULL) { |
|
314 | + $bt=new HtmlButton($this->identifier."-editBtn", $caption); |
|
315 | 315 | $bt->setToggle(); |
316 | 316 | $bt->setActive($this->_edition); |
317 | 317 | $bt->onClick($this->jsDisabled(Javascript::prep_value("!$(event.target).hasClass('active')"))); |
318 | - return $this->addInToolbar($bt,$callback); |
|
318 | + return $this->addInToolbar($bt, $callback); |
|
319 | 319 | } |
320 | 320 | |
321 | 321 | public function setToolbar(HtmlMenu $_toolbar) { |
@@ -329,35 +329,35 @@ discard block |
||
329 | 329 | } |
330 | 330 | |
331 | 331 | public function getForm() { |
332 | - if(!isset($this->_form)){ |
|
332 | + if (!isset($this->_form)) { |
|
333 | 333 | $this->_form=new HtmlForm("frm-".$this->identifier); |
334 | 334 | $this->setEdition(true); |
335 | 335 | } |
336 | 336 | return $this->_form; |
337 | 337 | } |
338 | 338 | |
339 | - public function run(JsUtils $js){ |
|
339 | + public function run(JsUtils $js) { |
|
340 | 340 | $result=parent::run($js); |
341 | - if(isset($this->_form)){ |
|
341 | + if (isset($this->_form)) { |
|
342 | 342 | $result=$this->runForm($js); |
343 | 343 | } |
344 | 344 | return $result; |
345 | 345 | } |
346 | 346 | |
347 | - protected function runForm(JsUtils $js){ |
|
347 | + protected function runForm(JsUtils $js) { |
|
348 | 348 | $fields=$this->getContentInstances(HtmlFormField::class); |
349 | - foreach ($fields as $field){ |
|
349 | + foreach ($fields as $field) { |
|
350 | 350 | $this->_form->addField($field); |
351 | 351 | } |
352 | 352 | return $this->_form->run($js); |
353 | 353 | } |
354 | 354 | |
355 | - protected function _compileForm(){ |
|
356 | - if(isset($this->_form)){ |
|
355 | + protected function _compileForm() { |
|
356 | + if (isset($this->_form)) { |
|
357 | 357 | $noValidate=""; |
358 | - if(\sizeof($this->_form->getValidationParams())>0) |
|
358 | + if (\sizeof($this->_form->getValidationParams())>0) |
|
359 | 359 | $noValidate="novalidate"; |
360 | - $this->wrapContent("<form class='ui form' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">","</form>"); |
|
360 | + $this->wrapContent("<form class='ui form' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">", "</form>"); |
|
361 | 361 | } |
362 | 362 | } |
363 | 363 |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | */ |
21 | 21 | class HtmlForm extends HtmlSemCollection { |
22 | 22 | |
23 | - use FieldsTrait,FormTrait; |
|
23 | + use FieldsTrait, FormTrait; |
|
24 | 24 | /** |
25 | 25 | * @var array |
26 | 26 | */ |
@@ -33,14 +33,14 @@ discard block |
||
33 | 33 | |
34 | 34 | public function __construct($identifier, $elements=array()) { |
35 | 35 | parent::__construct($identifier, "form", "ui form"); |
36 | - $this->_states=[ State::ERROR,State::SUCCESS,State::WARNING,State::DISABLED ]; |
|
36 | + $this->_states=[State::ERROR, State::SUCCESS, State::WARNING, State::DISABLED]; |
|
37 | 37 | $this->setProperty("name", $this->identifier); |
38 | - $this->_fields=array (); |
|
38 | + $this->_fields=array(); |
|
39 | 39 | $this->addItems($elements); |
40 | 40 | $this->_validationParams=[]; |
41 | 41 | } |
42 | 42 | |
43 | - protected function getForm(){ |
|
43 | + protected function getForm() { |
|
44 | 44 | return $this; |
45 | 45 | } |
46 | 46 | |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | * @param string $caption |
62 | 62 | * @return \Ajax\semantic\html\collections\form\HtmlForm |
63 | 63 | */ |
64 | - public function addDivider($caption=NULL){ |
|
65 | - return $this->addContent(new HtmlDivider("",$caption)); |
|
64 | + public function addDivider($caption=NULL) { |
|
65 | + return $this->addContent(new HtmlDivider("", $caption)); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | public function addFields($fields=NULL, $label=NULL) { |
@@ -78,12 +78,12 @@ discard block |
||
78 | 78 | $label=NULL; |
79 | 79 | } |
80 | 80 | $this->_fields=\array_merge($this->_fields, $fields); |
81 | - $fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count(), $fields); |
|
81 | + $fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count(), $fields); |
|
82 | 82 | } |
83 | 83 | if (isset($label)) |
84 | 84 | $fields=new HtmlFormField("", $fields, $label); |
85 | 85 | } else { |
86 | - $fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count()); |
|
86 | + $fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count()); |
|
87 | 87 | } |
88 | 88 | $this->addItem($fields); |
89 | 89 | return $fields; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | public function addItem($item) { |
93 | 93 | $item=parent::addItem($item); |
94 | - if (\is_subclass_of($item, HtmlFormField::class) === true) { |
|
94 | + if (\is_subclass_of($item, HtmlFormField::class)===true) { |
|
95 | 95 | $this->_fields[]=$item; |
96 | 96 | } |
97 | 97 | return $item; |
@@ -145,38 +145,38 @@ discard block |
||
145 | 145 | |
146 | 146 | |
147 | 147 | |
148 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
149 | - if(\sizeof($this->_validationParams)>0) |
|
148 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
149 | + if (\sizeof($this->_validationParams)>0) |
|
150 | 150 | $this->setProperty("novalidate", ""); |
151 | - return parent::compile($js,$view); |
|
151 | + return parent::compile($js, $view); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | public function run(JsUtils $js) { |
155 | - if(isset($js)){ |
|
155 | + if (isset($js)) { |
|
156 | 156 | $compo=$js->semantic()->form("#".$this->identifier); |
157 | - }else{ |
|
157 | + } else { |
|
158 | 158 | $compo=new Form(); |
159 | 159 | $compo->attach("#".$this->identifier); |
160 | 160 | } |
161 | - foreach ($this->_fields as $field){ |
|
162 | - if($field instanceof HtmlFormField){ |
|
161 | + foreach ($this->_fields as $field) { |
|
162 | + if ($field instanceof HtmlFormField) { |
|
163 | 163 | $compo=$this->addCompoValidation($compo, $field); |
164 | 164 | } |
165 | 165 | } |
166 | - foreach ($this->content as $field){ |
|
167 | - if($field instanceof HtmlFormFields){ |
|
166 | + foreach ($this->content as $field) { |
|
167 | + if ($field instanceof HtmlFormFields) { |
|
168 | 168 | $items=$field->getItems(); |
169 | - foreach ($items as $_field){ |
|
170 | - if($_field instanceof HtmlFormField) |
|
169 | + foreach ($items as $_field) { |
|
170 | + if ($_field instanceof HtmlFormField) |
|
171 | 171 | $compo=$this->addCompoValidation($compo, $_field); |
172 | 172 | } |
173 | 173 | } |
174 | 174 | } |
175 | - $this->_runValidationParams($compo,$js); |
|
175 | + $this->_runValidationParams($compo, $js); |
|
176 | 176 | return $this->_bsComponent; |
177 | 177 | } |
178 | 178 | |
179 | - public function addValidationParam($paramName,$paramValue){ |
|
179 | + public function addValidationParam($paramName, $paramValue) { |
|
180 | 180 | $this->_validationParams[$paramName]=$paramValue; |
181 | 181 | return $this; |
182 | 182 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | return $this->_validationParams; |
191 | 191 | } |
192 | 192 | |
193 | - public function removeValidationParam($param){ |
|
193 | + public function removeValidationParam($param) { |
|
194 | 194 | unset($this->_validationParams[$param]); |
195 | 195 | return $this; |
196 | 196 | } |
@@ -6,28 +6,28 @@ discard block |
||
6 | 6 | use Ajax\service\AjaxCall; |
7 | 7 | use Ajax\JsUtils; |
8 | 8 | |
9 | -trait FormTrait{ |
|
9 | +trait FormTrait { |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * @return HtmlForm |
13 | 13 | */ |
14 | 14 | abstract protected function getForm(); |
15 | 15 | |
16 | - protected function addCompoValidation($compo,$field){ |
|
16 | + protected function addCompoValidation($compo, $field) { |
|
17 | 17 | $validation=$field->getValidation(); |
18 | - if(isset($validation)){ |
|
18 | + if (isset($validation)) { |
|
19 | 19 | $validation->setIdentifier($field->getDataField()->getIdentifier()); |
20 | 20 | $compo->addFieldValidation($validation); |
21 | 21 | } |
22 | 22 | return $compo; |
23 | 23 | } |
24 | 24 | |
25 | - protected function _runValidationParams(&$compo,JsUtils $js=NULL){ |
|
25 | + protected function _runValidationParams(&$compo, JsUtils $js=NULL) { |
|
26 | 26 | $form=$this->getForm(); |
27 | 27 | $params=$form->getValidationParams(); |
28 | - if(isset($params["_ajaxSubmit"]) && $params["_ajaxSubmit"] instanceof AjaxCall){ |
|
28 | + if (isset($params["_ajaxSubmit"]) && $params["_ajaxSubmit"] instanceof AjaxCall) { |
|
29 | 29 | $compilation=$params["_ajaxSubmit"]->compile($js); |
30 | - $compilation=str_ireplace("\"","%quote%", $compilation); |
|
30 | + $compilation=str_ireplace("\"", "%quote%", $compilation); |
|
31 | 31 | $this->onSuccess($compilation); |
32 | 32 | $form->removeValidationParam("_ajaxSubmit"); |
33 | 33 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | return $this->getForm()->addToProperty("class", "loading"); |
41 | 41 | } |
42 | 42 | |
43 | - public function addErrorMessage(){ |
|
43 | + public function addErrorMessage() { |
|
44 | 44 | return $this->getForm()->addContent((new HtmlMessage(""))->setError()); |
45 | 45 | } |
46 | 46 | |
@@ -55,35 +55,35 @@ discard block |
||
55 | 55 | * @param string $responseElement |
56 | 56 | * @return \Ajax\semantic\html\collections\form\HtmlForm |
57 | 57 | */ |
58 | - public function submitOn($event,$identifier,$url,$responseElement){ |
|
58 | + public function submitOn($event, $identifier, $url, $responseElement) { |
|
59 | 59 | $form=$this->getForm(); |
60 | 60 | $elem=$form->getElementById($identifier, $form->getContent()); |
61 | - if(isset($elem)){ |
|
62 | - $this->_buttonAsSubmit($elem, $event,$url,$responseElement); |
|
61 | + if (isset($elem)) { |
|
62 | + $this->_buttonAsSubmit($elem, $event, $url, $responseElement); |
|
63 | 63 | } |
64 | 64 | return $form; |
65 | 65 | } |
66 | 66 | |
67 | - public function submitOnClick($identifier,$url,$responseElement){ |
|
67 | + public function submitOnClick($identifier, $url, $responseElement) { |
|
68 | 68 | return $this->submitOn("click", $identifier, $url, $responseElement); |
69 | 69 | } |
70 | 70 | |
71 | - public function addSubmit($identifier,$value,$cssStyle=NULL,$url=NULL,$responseElement=NULL){ |
|
72 | - $bt=$this->getForm()->addButton($identifier, $value,$cssStyle); |
|
73 | - return $this->_buttonAsSubmit($bt, "click",$url,$responseElement); |
|
71 | + public function addSubmit($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL) { |
|
72 | + $bt=$this->getForm()->addButton($identifier, $value, $cssStyle); |
|
73 | + return $this->_buttonAsSubmit($bt, "click", $url, $responseElement); |
|
74 | 74 | } |
75 | 75 | |
76 | - protected function _buttonAsSubmit(&$button,$event,$url,$responseElement=NULL){ |
|
76 | + protected function _buttonAsSubmit(&$button, $event, $url, $responseElement=NULL) { |
|
77 | 77 | $form=$this->getForm(); |
78 | - if(isset($url) && isset($responseElement)){ |
|
78 | + if (isset($url) && isset($responseElement)) { |
|
79 | 79 | $button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');"); |
80 | - $form->addValidationParam("_ajaxSubmit", new AjaxCall("postForm", ["form"=>$form->getIdentifier(),"responseElement"=>$responseElement,"url"=>$url])); |
|
80 | + $form->addValidationParam("_ajaxSubmit", new AjaxCall("postForm", ["form"=>$form->getIdentifier(), "responseElement"=>$responseElement, "url"=>$url])); |
|
81 | 81 | } |
82 | 82 | return $button; |
83 | 83 | } |
84 | 84 | |
85 | - public function addReset($identifier,$value,$cssStyle=NULL){ |
|
86 | - $bt=$this->getForm()->addButton($identifier, $value,$cssStyle); |
|
85 | + public function addReset($identifier, $value, $cssStyle=NULL) { |
|
86 | + $bt=$this->getForm()->addButton($identifier, $value, $cssStyle); |
|
87 | 87 | $bt->setProperty("type", "reset"); |
88 | 88 | return $bt; |
89 | 89 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @param string $jsCode |
94 | 94 | * @return \Ajax\semantic\html\collections\form\HtmlForm |
95 | 95 | */ |
96 | - public function onValid($jsCode){ |
|
96 | + public function onValid($jsCode) { |
|
97 | 97 | $form=$this->getForm(); |
98 | 98 | $form->addValidationParam("onValid", "%function(){".$jsCode."}%"); |
99 | 99 | return $form; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @param string $jsCode can use event and fields parameters |
105 | 105 | * @return HtmlForm |
106 | 106 | */ |
107 | - public function onSuccess($jsCode){ |
|
107 | + public function onSuccess($jsCode) { |
|
108 | 108 | $form=$this->getForm(); |
109 | 109 | $form->addValidationParam("onSuccess", "%function(evt,fields){".$jsCode."}%"); |
110 | 110 | return $form; |
@@ -23,23 +23,23 @@ discard block |
||
23 | 23 | * @property boolean $_edition |
24 | 24 | * @property mixed _modelInstance |
25 | 25 | */ |
26 | -trait FieldAsTrait{ |
|
26 | +trait FieldAsTrait { |
|
27 | 27 | |
28 | - abstract protected function _getFieldIdentifier($prefix,$name=""); |
|
29 | - abstract public function setValueFunction($index,$callback); |
|
28 | + abstract protected function _getFieldIdentifier($prefix, $name=""); |
|
29 | + abstract public function setValueFunction($index, $callback); |
|
30 | 30 | abstract protected function _getFieldName($index); |
31 | 31 | abstract protected function _getFieldCaption($index); |
32 | - abstract protected function _buttonAsSubmit(&$button,$event,$url,$responseElement=NULL); |
|
32 | + abstract protected function _buttonAsSubmit(&$button, $event, $url, $responseElement=NULL); |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * @param HtmlFormField $element |
36 | 36 | * @param array $attributes |
37 | 37 | */ |
38 | - protected function _applyAttributes($element,&$attributes,$index){ |
|
39 | - if(isset($attributes["callback"])){ |
|
38 | + protected function _applyAttributes($element, &$attributes, $index) { |
|
39 | + if (isset($attributes["callback"])) { |
|
40 | 40 | $callback=$attributes["callback"]; |
41 | - if(\is_callable($callback)){ |
|
42 | - $callback($element,$this->_modelInstance,$index); |
|
41 | + if (\is_callable($callback)) { |
|
42 | + $callback($element, $this->_modelInstance, $index); |
|
43 | 43 | unset($attributes["callback"]); |
44 | 44 | } |
45 | 45 | } |
@@ -47,42 +47,42 @@ discard block |
||
47 | 47 | $element->fromArray($attributes); |
48 | 48 | } |
49 | 49 | |
50 | - private function _getLabelField($caption,$icon=NULL){ |
|
51 | - $label=new HtmlLabel($this->_getFieldIdentifier("lbl"),$caption,$icon); |
|
50 | + private function _getLabelField($caption, $icon=NULL) { |
|
51 | + $label=new HtmlLabel($this->_getFieldIdentifier("lbl"), $caption, $icon); |
|
52 | 52 | return $label; |
53 | 53 | } |
54 | 54 | |
55 | - protected function _addRules($element,&$attributes){ |
|
56 | - if(isset($attributes["rules"])){ |
|
55 | + protected function _addRules($element, &$attributes) { |
|
56 | + if (isset($attributes["rules"])) { |
|
57 | 57 | $rules=$attributes["rules"]; |
58 | - if(\is_array($rules)){ |
|
58 | + if (\is_array($rules)) { |
|
59 | 59 | $element->addRules($rules); |
60 | 60 | } |
61 | - else{ |
|
61 | + else { |
|
62 | 62 | $element->addRule($rules); |
63 | 63 | } |
64 | 64 | unset($attributes["rules"]); |
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
68 | - protected function _prepareFormFields(&$field,$name,&$attributes){ |
|
68 | + protected function _prepareFormFields(&$field, $name, &$attributes) { |
|
69 | 69 | $field->setName($name); |
70 | 70 | $this->_addRules($field, $attributes); |
71 | 71 | return $field; |
72 | 72 | } |
73 | 73 | |
74 | - protected function _fieldAs($elementCallback,$index,$attributes=NULL,$prefix=null){ |
|
75 | - $this->setValueFunction($index,function($value) use ($index,&$attributes,$elementCallback,$prefix){ |
|
74 | + protected function _fieldAs($elementCallback, $index, $attributes=NULL, $prefix=null) { |
|
75 | + $this->setValueFunction($index, function($value) use ($index, &$attributes, $elementCallback, $prefix){ |
|
76 | 76 | $caption=$this->_getFieldCaption($index); |
77 | 77 | $name=$this->_getFieldName($index); |
78 | - $id=$this->_getFieldIdentifier($prefix,$name); |
|
79 | - if(isset($attributes["name"])){ |
|
78 | + $id=$this->_getFieldIdentifier($prefix, $name); |
|
79 | + if (isset($attributes["name"])) { |
|
80 | 80 | $name=$attributes["name"]; |
81 | 81 | unset($attributes["name"]); |
82 | 82 | } |
83 | - $element=$elementCallback($id,$name,$value,$caption); |
|
84 | - if(\is_array($attributes)){ |
|
85 | - $this->_applyAttributes($element, $attributes,$index); |
|
83 | + $element=$elementCallback($id, $name, $value, $caption); |
|
84 | + if (\is_array($attributes)) { |
|
85 | + $this->_applyAttributes($element, $attributes, $index); |
|
86 | 86 | } |
87 | 87 | $element->setDisabled(!$this->_edition); |
88 | 88 | return $element; |
@@ -91,153 +91,153 @@ discard block |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | |
94 | - public function fieldAsProgress($index,$label=NULL, $attributes=array()){ |
|
95 | - $this->setValueFunction($index,function($value) use($label,$attributes){ |
|
96 | - $pb=new HtmlProgress($this->_getFieldIdentifier("pb"),$value,$label,$attributes); |
|
94 | + public function fieldAsProgress($index, $label=NULL, $attributes=array()) { |
|
95 | + $this->setValueFunction($index, function($value) use($label, $attributes){ |
|
96 | + $pb=new HtmlProgress($this->_getFieldIdentifier("pb"), $value, $label, $attributes); |
|
97 | 97 | return $pb; |
98 | 98 | }); |
99 | 99 | return $this; |
100 | 100 | } |
101 | 101 | |
102 | - public function fieldAsRating($index,$max=5, $icon=""){ |
|
103 | - $this->setValueFunction($index,function($value) use($max,$icon){ |
|
104 | - $rating=new HtmlRating($this->_getFieldIdentifier("rat"),$value,$max,$icon); |
|
102 | + public function fieldAsRating($index, $max=5, $icon="") { |
|
103 | + $this->setValueFunction($index, function($value) use($max, $icon){ |
|
104 | + $rating=new HtmlRating($this->_getFieldIdentifier("rat"), $value, $max, $icon); |
|
105 | 105 | return $rating; |
106 | 106 | }); |
107 | 107 | return $this; |
108 | 108 | } |
109 | 109 | |
110 | - public function fieldAsLabel($index,$icon=NULL){ |
|
111 | - $this->setValueFunction($index,function($caption) use($icon){ |
|
112 | - $lbl=$this->_getLabelField($caption,$icon); |
|
110 | + public function fieldAsLabel($index, $icon=NULL) { |
|
111 | + $this->setValueFunction($index, function($caption) use($icon){ |
|
112 | + $lbl=$this->_getLabelField($caption, $icon); |
|
113 | 113 | return $lbl; |
114 | 114 | }); |
115 | 115 | return $this; |
116 | 116 | } |
117 | 117 | |
118 | - public function fieldAsHeader($index,$niveau=1,$icon=NULL,$attributes=NULL){ |
|
119 | - return $this->_fieldAs(function($id,$name,$value) use($niveau,$icon){ |
|
120 | - $header=new HtmlHeader($id,$niveau,$value); |
|
121 | - if(isset($icon)) |
|
118 | + public function fieldAsHeader($index, $niveau=1, $icon=NULL, $attributes=NULL) { |
|
119 | + return $this->_fieldAs(function($id, $name, $value) use($niveau, $icon){ |
|
120 | + $header=new HtmlHeader($id, $niveau, $value); |
|
121 | + if (isset($icon)) |
|
122 | 122 | $header->asIcon($icon, $value); |
123 | 123 | return $header; |
124 | - }, $index,$attributes,"header"); |
|
124 | + }, $index, $attributes, "header"); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | |
128 | - public function fieldAsImage($index,$size=Size::MINI,$circular=false){ |
|
129 | - $this->setValueFunction($index,function($img) use($size,$circular){ |
|
130 | - $image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular(); |
|
128 | + public function fieldAsImage($index, $size=Size::MINI, $circular=false) { |
|
129 | + $this->setValueFunction($index, function($img) use($size, $circular){ |
|
130 | + $image=new HtmlImage($this->_getFieldIdentifier("image"), $img); $image->setSize($size); if ($circular)$image->setCircular(); |
|
131 | 131 | return $image; |
132 | 132 | }); |
133 | 133 | return $this; |
134 | 134 | } |
135 | 135 | |
136 | - public function fieldAsAvatar($index,$attributes=NULL){ |
|
137 | - return $this->_fieldAs(function($id,$name,$value){ |
|
138 | - $img=new HtmlImage($id,$value); |
|
136 | + public function fieldAsAvatar($index, $attributes=NULL) { |
|
137 | + return $this->_fieldAs(function($id, $name, $value) { |
|
138 | + $img=new HtmlImage($id, $value); |
|
139 | 139 | $img->asAvatar(); |
140 | 140 | return $img; |
141 | - }, $index,$attributes,"avatar"); |
|
141 | + }, $index, $attributes, "avatar"); |
|
142 | 142 | } |
143 | 143 | |
144 | - public function fieldAsRadio($index,$attributes=NULL){ |
|
145 | - return $this->_fieldAs(function($id,$name,$value){ |
|
146 | - $input= new HtmlRadio($id,$name,$value,$value); |
|
144 | + public function fieldAsRadio($index, $attributes=NULL) { |
|
145 | + return $this->_fieldAs(function($id, $name, $value) { |
|
146 | + $input=new HtmlRadio($id, $name, $value, $value); |
|
147 | 147 | return $input; |
148 | - }, $index,$attributes,"radio"); |
|
148 | + }, $index, $attributes, "radio"); |
|
149 | 149 | } |
150 | 150 | |
151 | - public function fieldAsRadios($index,$elements=[],$attributes=NULL){ |
|
152 | - return $this->_fieldAs(function($id,$name,$value,$caption) use ($elements){ |
|
153 | - return HtmlFormFields::radios($name,$elements,$caption,$value); |
|
154 | - }, $index,$attributes,"radios"); |
|
151 | + public function fieldAsRadios($index, $elements=[], $attributes=NULL) { |
|
152 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($elements){ |
|
153 | + return HtmlFormFields::radios($name, $elements, $caption, $value); |
|
154 | + }, $index, $attributes, "radios"); |
|
155 | 155 | } |
156 | 156 | |
157 | - public function fieldAsInput($index,$attributes=NULL){ |
|
158 | - return $this->_fieldAs(function($id,$name,$value,$caption) use ($attributes){ |
|
159 | - $input= new HtmlFormInput($id,$caption,"text",$value); |
|
157 | + public function fieldAsInput($index, $attributes=NULL) { |
|
158 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes){ |
|
159 | + $input=new HtmlFormInput($id, $caption, "text", $value); |
|
160 | 160 | return $this->_prepareFormFields($input, $name, $attributes); |
161 | - }, $index,$attributes,"input"); |
|
161 | + }, $index, $attributes, "input"); |
|
162 | 162 | } |
163 | 163 | |
164 | - public function fieldAsTextarea($index,$attributes=NULL){ |
|
165 | - return $this->_fieldAs(function($id,$name,$value){ |
|
166 | - $textarea=new HtmlFormTextarea($id,null,$value); |
|
164 | + public function fieldAsTextarea($index, $attributes=NULL) { |
|
165 | + return $this->_fieldAs(function($id, $name, $value) { |
|
166 | + $textarea=new HtmlFormTextarea($id, null, $value); |
|
167 | 167 | $textarea->setName($name); |
168 | 168 | return $textarea; |
169 | - }, $index,$attributes,"textarea"); |
|
169 | + }, $index, $attributes, "textarea"); |
|
170 | 170 | } |
171 | 171 | |
172 | - public function fieldAsHidden($index,$attributes=NULL){ |
|
173 | - if(!\is_array($attributes)){ |
|
172 | + public function fieldAsHidden($index, $attributes=NULL) { |
|
173 | + if (!\is_array($attributes)) { |
|
174 | 174 | $attributes=[]; |
175 | 175 | } |
176 | 176 | $attributes["imputType"]="hidden"; |
177 | - return $this->fieldAsInput($index,$attributes); |
|
177 | + return $this->fieldAsInput($index, $attributes); |
|
178 | 178 | } |
179 | 179 | |
180 | - public function fieldAsCheckbox($index,$attributes=NULL){ |
|
181 | - return $this->_fieldAs(function($id,$name,$value){ |
|
182 | - $input=new HtmlFormCheckbox($id,NULL,$this->_instanceViewer->getIdentifier()); |
|
180 | + public function fieldAsCheckbox($index, $attributes=NULL) { |
|
181 | + return $this->_fieldAs(function($id, $name, $value) { |
|
182 | + $input=new HtmlFormCheckbox($id, NULL, $this->_instanceViewer->getIdentifier()); |
|
183 | 183 | $input->setChecked(JString::isBooleanTrue($value)); |
184 | 184 | $input->setName($name); |
185 | 185 | return $input; |
186 | - }, $index,$attributes,"ck"); |
|
186 | + }, $index, $attributes, "ck"); |
|
187 | 187 | } |
188 | 188 | |
189 | - public function fieldAsDropDown($index,$elements=[],$multiple=false,$attributes=NULL){ |
|
190 | - return $this->_fieldAs(function($id,$name,$value) use($elements,$multiple){ |
|
191 | - $dd=new HtmlFormDropdown($id,$elements,NULL,$value); |
|
192 | - $dd->asSelect($name,$multiple); |
|
189 | + public function fieldAsDropDown($index, $elements=[], $multiple=false, $attributes=NULL) { |
|
190 | + return $this->_fieldAs(function($id, $name, $value) use($elements, $multiple){ |
|
191 | + $dd=new HtmlFormDropdown($id, $elements, NULL, $value); |
|
192 | + $dd->asSelect($name, $multiple); |
|
193 | 193 | return $dd; |
194 | - }, $index,$attributes,"dd"); |
|
194 | + }, $index, $attributes, "dd"); |
|
195 | 195 | } |
196 | 196 | |
197 | - public function fieldAsMessage($index,$attributes=NULL){ |
|
198 | - return $this->_fieldAs(function($id,$name,$value,$caption){ |
|
199 | - $mess= new HtmlMessage("message-".$id,$value); |
|
197 | + public function fieldAsMessage($index, $attributes=NULL) { |
|
198 | + return $this->_fieldAs(function($id, $name, $value, $caption) { |
|
199 | + $mess=new HtmlMessage("message-".$id, $value); |
|
200 | 200 | $mess->addHeader($caption); |
201 | 201 | return $mess; |
202 | - }, $index,$attributes,"message"); |
|
202 | + }, $index, $attributes, "message"); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | /**Change fields type |
206 | 206 | * @param array $types an array or associative array $type=>$attribute |
207 | 207 | */ |
208 | - public function fieldsAs(array $types){ |
|
208 | + public function fieldsAs(array $types) { |
|
209 | 209 | $i=0; |
210 | - if(JArray::isAssociative($types)){ |
|
211 | - foreach ($types as $type=>$attributes){ |
|
212 | - if(\is_int($type)) |
|
213 | - $this->fieldAs($i++,$attributes,[]); |
|
210 | + if (JArray::isAssociative($types)) { |
|
211 | + foreach ($types as $type=>$attributes) { |
|
212 | + if (\is_int($type)) |
|
213 | + $this->fieldAs($i++, $attributes, []); |
|
214 | 214 | else |
215 | - $this->fieldAs($i++,$type,$attributes); |
|
215 | + $this->fieldAs($i++, $type, $attributes); |
|
216 | 216 | } |
217 | - }else{ |
|
218 | - foreach ($types as $type){ |
|
219 | - $this->fieldAs($i++,$type); |
|
217 | + } else { |
|
218 | + foreach ($types as $type) { |
|
219 | + $this->fieldAs($i++, $type); |
|
220 | 220 | } |
221 | 221 | } |
222 | 222 | } |
223 | 223 | |
224 | - public function fieldAs($index,$type,$attributes=NULL){ |
|
224 | + public function fieldAs($index, $type, $attributes=NULL) { |
|
225 | 225 | $method="fieldAs".\ucfirst($type); |
226 | - if(\method_exists($this, $method)){ |
|
227 | - if(!\is_array($attributes)){ |
|
226 | + if (\method_exists($this, $method)) { |
|
227 | + if (!\is_array($attributes)) { |
|
228 | 228 | $attributes=[$index]; |
229 | - }else{ |
|
229 | + } else { |
|
230 | 230 | \array_unshift($attributes, $index); |
231 | 231 | } |
232 | - \call_user_func_array([$this,$method], $attributes); |
|
232 | + \call_user_func_array([$this, $method], $attributes); |
|
233 | 233 | } |
234 | 234 | } |
235 | 235 | |
236 | - public function fieldAsSubmit($index,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$attributes=NULL){ |
|
237 | - return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle){ |
|
238 | - $button=new HtmlButton($id,$value,$cssStyle); |
|
239 | - $this->_buttonAsSubmit($button,"click",$url,$responseElement); |
|
236 | + public function fieldAsSubmit($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL) { |
|
237 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle){ |
|
238 | + $button=new HtmlButton($id, $value, $cssStyle); |
|
239 | + $this->_buttonAsSubmit($button, "click", $url, $responseElement); |
|
240 | 240 | return $button; |
241 | - }, $index,$attributes,"submit"); |
|
241 | + }, $index, $attributes, "submit"); |
|
242 | 242 | } |
243 | 243 | } |
244 | 244 | \ No newline at end of file |
@@ -31,23 +31,23 @@ discard block |
||
31 | 31 | protected $_compileParts; |
32 | 32 | protected $_visibleHover=false; |
33 | 33 | |
34 | - public function run(JsUtils $js){ |
|
35 | - if($this->_hasCheckboxes && isset($js)){ |
|
34 | + public function run(JsUtils $js) { |
|
35 | + if ($this->_hasCheckboxes && isset($js)) { |
|
36 | 36 | $js->execOn("change", "#".$this->identifier." [name='selection[]']", " |
37 | 37 | var \$parentCheckbox=\$('#ck-main-ck-{$this->identifier}'),\$checkbox=\$('#{$this->identifier} [name=\"selection[]\"]'),allChecked=true,allUnchecked=true; |
38 | 38 | \$checkbox.each(function() {if($(this).prop('checked')){allUnchecked = false;}else{allChecked = false;}}); |
39 | 39 | if(allChecked) {\$parentCheckbox.checkbox('set checked');}else if(allUnchecked){\$parentCheckbox.checkbox('set unchecked');}else{\$parentCheckbox.checkbox('set indeterminate');}"); |
40 | 40 | } |
41 | - if($this->_visibleHover){ |
|
42 | - $js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');",["preventDefault"=>false,"stopPropagation"=>true]); |
|
43 | - $js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');",["preventDefault"=>false,"stopPropagation"=>true]); |
|
41 | + if ($this->_visibleHover) { |
|
42 | + $js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');", ["preventDefault"=>false, "stopPropagation"=>true]); |
|
43 | + $js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');", ["preventDefault"=>false, "stopPropagation"=>true]); |
|
44 | 44 | } |
45 | 45 | return parent::run($js); |
46 | 46 | } |
47 | 47 | |
48 | - public function __construct($identifier,$model,$modelInstance=NULL) { |
|
49 | - parent::__construct($identifier, $model,$modelInstance); |
|
50 | - $this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0,0), false); |
|
48 | + public function __construct($identifier, $model, $modelInstance=NULL) { |
|
49 | + parent::__construct($identifier, $model, $modelInstance); |
|
50 | + $this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0, 0), false); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
@@ -59,65 +59,65 @@ discard block |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | |
62 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
63 | - if(!$this->_generated){ |
|
62 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
63 | + if (!$this->_generated) { |
|
64 | 64 | $this->_instanceViewer->setInstance($this->_model); |
65 | 65 | $captions=$this->_instanceViewer->getCaptions(); |
66 | 66 | |
67 | 67 | $table=$this->content["table"]; |
68 | 68 | |
69 | - if($this->_hasCheckboxes){ |
|
69 | + if ($this->_hasCheckboxes) { |
|
70 | 70 | $this->_generateMainCheckbox($captions); |
71 | 71 | } |
72 | 72 | |
73 | 73 | $table->setRowCount(0, \sizeof($captions)); |
74 | 74 | $table->setHeaderValues($captions); |
75 | - if(isset($this->_compileParts)) |
|
75 | + if (isset($this->_compileParts)) |
|
76 | 76 | $table->setCompileParts($this->_compileParts); |
77 | - if(isset($this->_searchField) && isset($js)){ |
|
78 | - $this->_searchField->postOn("change", $this->_urls,"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]); |
|
77 | + if (isset($this->_searchField) && isset($js)) { |
|
78 | + $this->_searchField->postOn("change", $this->_urls, "{'s':$(this).val()}", "#".$this->identifier." tbody", ["preventDefault"=>false, "jqueryDone"=>"replaceWith"]); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | $this->_generateContent($table); |
82 | 82 | |
83 | - if($this->_hasCheckboxes && $table->hasPart("thead")){ |
|
84 | - $table->getHeader()->getCell(0, 0)->addToProperty("class","no-sort"); |
|
83 | + if ($this->_hasCheckboxes && $table->hasPart("thead")) { |
|
84 | + $table->getHeader()->getCell(0, 0)->addToProperty("class", "no-sort"); |
|
85 | 85 | } |
86 | 86 | |
87 | - if(isset($this->_pagination) && $this->_pagination->getVisible()){ |
|
87 | + if (isset($this->_pagination) && $this->_pagination->getVisible()) { |
|
88 | 88 | $this->_generatePagination($table); |
89 | 89 | } |
90 | - if(isset($this->_toolbar)){ |
|
90 | + if (isset($this->_toolbar)) { |
|
91 | 91 | $this->_setToolbarPosition($table, $captions); |
92 | 92 | } |
93 | - $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"table",PositionInTable::AFTERTABLE]); |
|
93 | + $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "table", PositionInTable::AFTERTABLE]); |
|
94 | 94 | $this->_compileForm(); |
95 | 95 | $this->_generated=true; |
96 | 96 | } |
97 | - return parent::compile($js,$view); |
|
97 | + return parent::compile($js, $view); |
|
98 | 98 | } |
99 | 99 | |
100 | - private function _generateMainCheckbox(&$captions){ |
|
101 | - $ck=new HtmlCheckbox("main-ck-".$this->identifier,""); |
|
100 | + private function _generateMainCheckbox(&$captions) { |
|
101 | + $ck=new HtmlCheckbox("main-ck-".$this->identifier, ""); |
|
102 | 102 | $ck->setOnChecked("$('#".$this->identifier." [name=%quote%selection[]%quote%]').prop('checked',true);"); |
103 | 103 | $ck->setOnUnchecked("$('#".$this->identifier." [name=%quote%selection[]%quote%]').prop('checked',false);"); |
104 | 104 | \array_unshift($captions, $ck); |
105 | 105 | } |
106 | 106 | |
107 | - protected function _generateContent($table){ |
|
107 | + protected function _generateContent($table) { |
|
108 | 108 | $objects=$this->_modelInstance; |
109 | - if(isset($this->_pagination)){ |
|
109 | + if (isset($this->_pagination)) { |
|
110 | 110 | $objects=$this->_pagination->getObjects($this->_modelInstance); |
111 | 111 | } |
112 | 112 | InstanceViewer::setIndex(0); |
113 | 113 | $table->fromDatabaseObjects($objects, function($instance) use($table){ |
114 | 114 | $this->_instanceViewer->setInstance($instance); |
115 | 115 | InstanceViewer::$index++; |
116 | - $values= $this->_instanceViewer->getValues(); |
|
117 | - if($this->_hasCheckboxes){ |
|
118 | - $ck=new HtmlCheckbox("ck-".$this->identifier,""); |
|
116 | + $values=$this->_instanceViewer->getValues(); |
|
117 | + if ($this->_hasCheckboxes) { |
|
118 | + $ck=new HtmlCheckbox("ck-".$this->identifier, ""); |
|
119 | 119 | $field=$ck->getField(); |
120 | - $field->setProperty("value",$this->_instanceViewer->getIdentifier()); |
|
120 | + $field->setProperty("value", $this->_instanceViewer->getIdentifier()); |
|
121 | 121 | $field->setProperty("name", "selection[]"); |
122 | 122 | \array_unshift($values, $ck); |
123 | 123 | } |
@@ -128,36 +128,36 @@ discard block |
||
128 | 128 | }); |
129 | 129 | } |
130 | 130 | |
131 | - private function _generatePagination($table){ |
|
131 | + private function _generatePagination($table) { |
|
132 | 132 | $footer=$table->getFooter(); |
133 | 133 | $footer->mergeCol(); |
134 | - $menu=new HtmlPaginationMenu("pagination-".$this->identifier,$this->_pagination->getPagesNumbers()); |
|
134 | + $menu=new HtmlPaginationMenu("pagination-".$this->identifier, $this->_pagination->getPagesNumbers()); |
|
135 | 135 | $menu->floatRight(); |
136 | 136 | $menu->setActiveItem($this->_pagination->getPage()-1); |
137 | 137 | $footer->setValues($menu); |
138 | - $menu->postOnClick($this->_urls,"{'p':$(this).attr('data-page')}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]); |
|
138 | + $menu->postOnClick($this->_urls, "{'p':$(this).attr('data-page')}", "#".$this->identifier." tbody", ["preventDefault"=>false, "jqueryDone"=>"replaceWith"]); |
|
139 | 139 | } |
140 | 140 | |
141 | - protected function _getFieldName($index){ |
|
141 | + protected function _getFieldName($index) { |
|
142 | 142 | return parent::_getFieldName($index)."[]"; |
143 | 143 | } |
144 | 144 | |
145 | - protected function _getFieldCaption($index){ |
|
145 | + protected function _getFieldCaption($index) { |
|
146 | 146 | return null; |
147 | 147 | } |
148 | 148 | |
149 | - protected function _setToolbarPosition($table,$captions=NULL){ |
|
150 | - switch ($this->_toolbarPosition){ |
|
149 | + protected function _setToolbarPosition($table, $captions=NULL) { |
|
150 | + switch ($this->_toolbarPosition) { |
|
151 | 151 | case PositionInTable::BEFORETABLE: |
152 | 152 | case PositionInTable::AFTERTABLE: |
153 | - if(isset($this->_compileParts)===false){ |
|
153 | + if (isset($this->_compileParts)===false) { |
|
154 | 154 | $this->content[$this->_toolbarPosition]=$this->_toolbar; |
155 | 155 | } |
156 | 156 | break; |
157 | 157 | case PositionInTable::HEADER: |
158 | 158 | case PositionInTable::FOOTER: |
159 | 159 | case PositionInTable::BODY: |
160 | - $this->addToolbarRow($this->_toolbarPosition,$table, $captions); |
|
160 | + $this->addToolbarRow($this->_toolbarPosition, $table, $captions); |
|
161 | 161 | break; |
162 | 162 | } |
163 | 163 | } |
@@ -169,23 +169,23 @@ discard block |
||
169 | 169 | * @param callable $callback function called after the field compilation |
170 | 170 | * @return \Ajax\semantic\widgets\datatable\DataTable |
171 | 171 | */ |
172 | - public function afterCompile($index,$callback){ |
|
173 | - $this->_instanceViewer->afterCompile($index,$callback); |
|
172 | + public function afterCompile($index, $callback) { |
|
173 | + $this->_instanceViewer->afterCompile($index, $callback); |
|
174 | 174 | return $this; |
175 | 175 | } |
176 | 176 | |
177 | - private function addToolbarRow($part,$table,$captions){ |
|
177 | + private function addToolbarRow($part, $table, $captions) { |
|
178 | 178 | $hasPart=$table->hasPart($part); |
179 | - if($hasPart){ |
|
179 | + if ($hasPart) { |
|
180 | 180 | $row=$table->getPart($part)->addRow(\sizeof($captions)); |
181 | - }else{ |
|
181 | + } else { |
|
182 | 182 | $row=$table->getPart($part)->getRow(0); |
183 | 183 | } |
184 | 184 | $row->mergeCol(); |
185 | 185 | $row->setValues([$this->_toolbar]); |
186 | 186 | } |
187 | 187 | |
188 | - public function getHtmlComponent(){ |
|
188 | + public function getHtmlComponent() { |
|
189 | 189 | return $this->content["table"]; |
190 | 190 | } |
191 | 191 | |
@@ -198,8 +198,8 @@ discard block |
||
198 | 198 | return $this; |
199 | 199 | } |
200 | 200 | |
201 | - public function paginate($items_per_page=10,$page=1){ |
|
202 | - $this->_pagination=new Pagination($items_per_page,4,$page); |
|
201 | + public function paginate($items_per_page=10, $page=1) { |
|
202 | + $this->_pagination=new Pagination($items_per_page, 4, $page); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | public function getHasCheckboxes() { |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | return $this; |
212 | 212 | } |
213 | 213 | |
214 | - public function refresh($compileParts=["tbody"]){ |
|
214 | + public function refresh($compileParts=["tbody"]) { |
|
215 | 215 | $this->_compileParts=$compileParts; |
216 | 216 | return $this; |
217 | 217 | } |
@@ -221,8 +221,8 @@ discard block |
||
221 | 221 | * @param boolean $visibleHover |
222 | 222 | * @return callable |
223 | 223 | */ |
224 | - private function getFieldButtonCallable($caption,$visibleHover=true,$callback=null){ |
|
225 | - return $this->getCallable("getFieldButton",[$caption,$visibleHover],$callback); |
|
224 | + private function getFieldButtonCallable($caption, $visibleHover=true, $callback=null) { |
|
225 | + return $this->getCallable("getFieldButton", [$caption, $visibleHover], $callback); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
@@ -231,19 +231,19 @@ discard block |
||
231 | 231 | * @param callable $callback |
232 | 232 | * @return callable |
233 | 233 | */ |
234 | - private function getCallable($thisCallback,$parameters,$callback=null){ |
|
235 | - $result=function($instance) use($thisCallback,$parameters,$callback){ |
|
236 | - $object=call_user_func_array(array($this,$thisCallback), $parameters); |
|
237 | - if(isset($callback)){ |
|
238 | - if(\is_callable($callback)){ |
|
239 | - $callback($object,$instance); |
|
234 | + private function getCallable($thisCallback, $parameters, $callback=null) { |
|
235 | + $result=function($instance) use($thisCallback, $parameters, $callback){ |
|
236 | + $object=call_user_func_array(array($this, $thisCallback), $parameters); |
|
237 | + if (isset($callback)) { |
|
238 | + if (\is_callable($callback)) { |
|
239 | + $callback($object, $instance); |
|
240 | 240 | } |
241 | 241 | } |
242 | - if($object instanceof HtmlSemDoubleElement){ |
|
243 | - $object->setProperty("data-ajax",$this->_instanceViewer->getIdentifier()); |
|
244 | - if($object->propertyContains("class","visibleover")){ |
|
242 | + if ($object instanceof HtmlSemDoubleElement) { |
|
243 | + $object->setProperty("data-ajax", $this->_instanceViewer->getIdentifier()); |
|
244 | + if ($object->propertyContains("class", "visibleover")) { |
|
245 | 245 | $this->_visibleHover=true; |
246 | - $object->setProperty("style","visibility:hidden;"); |
|
246 | + $object->setProperty("style", "visibility:hidden;"); |
|
247 | 247 | } |
248 | 248 | } |
249 | 249 | return $object; |
@@ -255,9 +255,9 @@ discard block |
||
255 | 255 | * @param string $caption |
256 | 256 | * @return HtmlButton |
257 | 257 | */ |
258 | - private function getFieldButton($caption,$visibleHover=true){ |
|
259 | - $bt= new HtmlButton("",$caption); |
|
260 | - if($visibleHover) |
|
258 | + private function getFieldButton($caption, $visibleHover=true) { |
|
259 | + $bt=new HtmlButton("", $caption); |
|
260 | + if ($visibleHover) |
|
261 | 261 | $this->_visibleOver($bt); |
262 | 262 | return $bt; |
263 | 263 | } |
@@ -269,8 +269,8 @@ discard block |
||
269 | 269 | * @param boolean $visibleHover |
270 | 270 | * @return \Ajax\semantic\widgets\datatable\DataTable |
271 | 271 | */ |
272 | - public function addFieldButton($caption,$visibleHover=true,$callback=null){ |
|
273 | - $this->addField($this->getCallable("getFieldButton",[$caption,$visibleHover],$callback)); |
|
272 | + public function addFieldButton($caption, $visibleHover=true, $callback=null) { |
|
273 | + $this->addField($this->getCallable("getFieldButton", [$caption, $visibleHover], $callback)); |
|
274 | 274 | return $this; |
275 | 275 | } |
276 | 276 | |
@@ -281,8 +281,8 @@ discard block |
||
281 | 281 | * @param callable $callback |
282 | 282 | * @return \Ajax\semantic\widgets\datatable\DataTable |
283 | 283 | */ |
284 | - public function insertFieldButton($index,$caption,$visibleHover=true,$callback=null){ |
|
285 | - $this->insertField($index, $this->getFieldButtonCallable($caption,$visibleHover,$callback)); |
|
284 | + public function insertFieldButton($index, $caption, $visibleHover=true, $callback=null) { |
|
285 | + $this->insertField($index, $this->getFieldButtonCallable($caption, $visibleHover, $callback)); |
|
286 | 286 | return $this; |
287 | 287 | } |
288 | 288 | |
@@ -293,60 +293,60 @@ discard block |
||
293 | 293 | * @param callable $callback |
294 | 294 | * @return \Ajax\semantic\widgets\datatable\DataTable |
295 | 295 | */ |
296 | - public function insertInFieldButton($index,$caption,$visibleHover=true,$callback=null){ |
|
297 | - $this->insertInField($index, $this->getFieldButtonCallable($caption,$visibleHover,$callback)); |
|
296 | + public function insertInFieldButton($index, $caption, $visibleHover=true, $callback=null) { |
|
297 | + $this->insertInField($index, $this->getFieldButtonCallable($caption, $visibleHover, $callback)); |
|
298 | 298 | return $this; |
299 | 299 | } |
300 | 300 | |
301 | - private function addDefaultButton($icon,$class=null,$visibleHover=true,$callback=null){ |
|
302 | - $this->addField($this->getCallable("getDefaultButton",[$icon,$class,$visibleHover],$callback)); |
|
301 | + private function addDefaultButton($icon, $class=null, $visibleHover=true, $callback=null) { |
|
302 | + $this->addField($this->getCallable("getDefaultButton", [$icon, $class, $visibleHover], $callback)); |
|
303 | 303 | return $this; |
304 | 304 | } |
305 | 305 | |
306 | - private function insertDefaultButtonIn($index,$icon,$class=null,$visibleHover=true,$callback=null){ |
|
307 | - $this->insertInField($index,$this->getCallable("getDefaultButton",[$icon,$class,$visibleHover],$callback)); |
|
306 | + private function insertDefaultButtonIn($index, $icon, $class=null, $visibleHover=true, $callback=null) { |
|
307 | + $this->insertInField($index, $this->getCallable("getDefaultButton", [$icon, $class, $visibleHover], $callback)); |
|
308 | 308 | return $this; |
309 | 309 | } |
310 | 310 | |
311 | - private function getDefaultButton($icon,$class=null,$visibleHover=true){ |
|
312 | - $bt=$this->getFieldButton("",$visibleHover); |
|
311 | + private function getDefaultButton($icon, $class=null, $visibleHover=true) { |
|
312 | + $bt=$this->getFieldButton("", $visibleHover); |
|
313 | 313 | $bt->asIcon($icon); |
314 | - if(isset($class)) |
|
314 | + if (isset($class)) |
|
315 | 315 | $bt->addToProperty("class", $class); |
316 | 316 | return $bt; |
317 | 317 | } |
318 | 318 | |
319 | - public function addDeleteButton($visibleHover=true,$callback=null){ |
|
320 | - return $this->addDefaultButton("remove","delete red basic",$visibleHover,$callback); |
|
319 | + public function addDeleteButton($visibleHover=true, $callback=null) { |
|
320 | + return $this->addDefaultButton("remove", "delete red basic", $visibleHover, $callback); |
|
321 | 321 | } |
322 | 322 | |
323 | - public function addEditButton($visibleHover=true,$callback=null){ |
|
324 | - return $this->addDefaultButton("edit","edit basic",$visibleHover,$callback); |
|
323 | + public function addEditButton($visibleHover=true, $callback=null) { |
|
324 | + return $this->addDefaultButton("edit", "edit basic", $visibleHover, $callback); |
|
325 | 325 | } |
326 | 326 | |
327 | - public function addEditDeleteButtons($visibleHover=true,$callbackEdit=null,$callbackDelete=null){ |
|
328 | - $this->addEditButton($visibleHover,$callbackEdit); |
|
327 | + public function addEditDeleteButtons($visibleHover=true, $callbackEdit=null, $callbackDelete=null) { |
|
328 | + $this->addEditButton($visibleHover, $callbackEdit); |
|
329 | 329 | $index=$this->_instanceViewer->visiblePropertiesCount()-1; |
330 | - $this->insertDeleteButtonIn($index,$visibleHover,$callbackDelete); |
|
330 | + $this->insertDeleteButtonIn($index, $visibleHover, $callbackDelete); |
|
331 | 331 | return $this; |
332 | 332 | } |
333 | 333 | |
334 | - public function insertDeleteButtonIn($index,$visibleHover=true,$callback=null){ |
|
335 | - return $this->insertDefaultButtonIn($index,"remove","delete red basic",$visibleHover,$callback); |
|
334 | + public function insertDeleteButtonIn($index, $visibleHover=true, $callback=null) { |
|
335 | + return $this->insertDefaultButtonIn($index, "remove", "delete red basic", $visibleHover, $callback); |
|
336 | 336 | } |
337 | 337 | |
338 | - public function insertEditButtonIn($index,$visibleHover=true,$callback=null){ |
|
339 | - return $this->insertDefaultButtonIn($index,"edit","edit basic",$visibleHover,$callback); |
|
338 | + public function insertEditButtonIn($index, $visibleHover=true, $callback=null) { |
|
339 | + return $this->insertDefaultButtonIn($index, "edit", "edit basic", $visibleHover, $callback); |
|
340 | 340 | } |
341 | 341 | |
342 | - public function addSearchInToolbar($position=Direction::RIGHT){ |
|
342 | + public function addSearchInToolbar($position=Direction::RIGHT) { |
|
343 | 343 | return $this->addInToolbar($this->getSearchField())->setPosition($position); |
344 | 344 | } |
345 | 345 | |
346 | - public function getSearchField(){ |
|
347 | - if(isset($this->_searchField)===false){ |
|
348 | - $this->_searchField=new HtmlInput("search-".$this->identifier,"search","","Search..."); |
|
349 | - $this->_searchField->addIcon("search",Direction::RIGHT); |
|
346 | + public function getSearchField() { |
|
347 | + if (isset($this->_searchField)===false) { |
|
348 | + $this->_searchField=new HtmlInput("search-".$this->identifier, "search", "", "Search..."); |
|
349 | + $this->_searchField->addIcon("search", Direction::RIGHT); |
|
350 | 350 | } |
351 | 351 | return $this->_searchField; |
352 | 352 | } |
@@ -362,20 +362,20 @@ discard block |
||
362 | 362 | return $this; |
363 | 363 | } |
364 | 364 | |
365 | - public function asForm(){ |
|
365 | + public function asForm() { |
|
366 | 366 | return $this->getForm(); |
367 | 367 | } |
368 | 368 | |
369 | - public function fieldAsSubmit($index,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$attributes=NULL){ |
|
370 | - return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$index){ |
|
371 | - $button=new HtmlButton($id,$value,$cssStyle); |
|
372 | - $button->postOnClick($url,"$(event.target).closest('tr').find(':input').serialize()",$responseElement); |
|
369 | + public function fieldAsSubmit($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL) { |
|
370 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle, $index){ |
|
371 | + $button=new HtmlButton($id, $value, $cssStyle); |
|
372 | + $button->postOnClick($url, "$(event.target).closest('tr').find(':input').serialize()", $responseElement); |
|
373 | 373 | return $this->_visibleOver($button); |
374 | - }, $index,$attributes); |
|
374 | + }, $index, $attributes); |
|
375 | 375 | } |
376 | 376 | |
377 | - protected function _visibleOver($element){ |
|
377 | + protected function _visibleOver($element) { |
|
378 | 378 | $this->_visibleHover=true; |
379 | - return $element->addToProperty("class", "visibleover")->setProperty("style","visibility:hidden;"); |
|
379 | + return $element->addToProperty("class", "visibleover")->setProperty("style", "visibility:hidden;"); |
|
380 | 380 | } |
381 | 381 | } |
382 | 382 | \ No newline at end of file |
@@ -19,45 +19,45 @@ discard block |
||
19 | 19 | class DataElement extends Widget { |
20 | 20 | |
21 | 21 | public function __construct($identifier, $modelInstance=NULL) { |
22 | - parent::__construct($identifier, null,$modelInstance); |
|
23 | - $this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0,2), false); |
|
22 | + parent::__construct($identifier, null, $modelInstance); |
|
23 | + $this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0, 2), false); |
|
24 | 24 | $this->content["table"]->setDefinition(); |
25 | 25 | } |
26 | 26 | |
27 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
28 | - if(!$this->_generated){ |
|
27 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
28 | + if (!$this->_generated) { |
|
29 | 29 | $this->_instanceViewer->setInstance($this->_modelInstance); |
30 | 30 | |
31 | 31 | $table=$this->content["table"]; |
32 | 32 | $this->_generateContent($table); |
33 | 33 | |
34 | - if(isset($this->_toolbar)){ |
|
34 | + if (isset($this->_toolbar)) { |
|
35 | 35 | $this->_setToolbarPosition($table); |
36 | 36 | } |
37 | - $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"table",PositionInTable::AFTERTABLE]); |
|
37 | + $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "table", PositionInTable::AFTERTABLE]); |
|
38 | 38 | $this->_compileForm(); |
39 | 39 | $this->_generated=true; |
40 | 40 | } |
41 | - return parent::compile($js,$view); |
|
41 | + return parent::compile($js, $view); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
45 | 45 | * @param HtmlTable $table |
46 | 46 | */ |
47 | - protected function _generateContent($table){ |
|
47 | + protected function _generateContent($table) { |
|
48 | 48 | $captions=$this->_instanceViewer->getCaptions(); |
49 | - $values= $this->_instanceViewer->getValues(); |
|
49 | + $values=$this->_instanceViewer->getValues(); |
|
50 | 50 | $count=$this->_instanceViewer->count(); |
51 | - for($i=0;$i<$count;$i++){ |
|
52 | - $table->addRow([$captions[$i],$values[$i]]); |
|
51 | + for ($i=0; $i<$count; $i++) { |
|
52 | + $table->addRow([$captions[$i], $values[$i]]); |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | |
56 | - protected function _getFieldName($index){ |
|
56 | + protected function _getFieldName($index) { |
|
57 | 57 | return $this->_instanceViewer->getFieldName($index); |
58 | 58 | } |
59 | 59 | |
60 | - protected function _getFieldCaption($index){ |
|
60 | + protected function _getFieldCaption($index) { |
|
61 | 61 | return null; |
62 | 62 | } |
63 | 63 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | return $this; |
90 | 90 | } |
91 | 91 | |
92 | - public function asForm(){ |
|
92 | + public function asForm() { |
|
93 | 93 | return $this->getForm(); |
94 | 94 | } |
95 | 95 | } |
96 | 96 | \ No newline at end of file |