@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | use Ajax\common\html\traits\BaseHooksTrait; |
21 | 21 | |
22 | 22 | abstract class Widget extends HtmlDoubleElement { |
23 | - use FieldAsTrait,FormTrait,BaseHooksTrait; |
|
23 | + use FieldAsTrait, FormTrait, BaseHooksTrait; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * |
@@ -66,24 +66,24 @@ discard block |
||
66 | 66 | |
67 | 67 | protected $_hasRules; |
68 | 68 | |
69 | - public function __construct($identifier, $model, $modelInstance = NULL) { |
|
69 | + public function __construct($identifier, $model, $modelInstance=NULL) { |
|
70 | 70 | parent::__construct($identifier); |
71 | - $this->_template = "%wrapContentBefore%%content%%wrapContentAfter%"; |
|
71 | + $this->_template="%wrapContentBefore%%content%%wrapContentAfter%"; |
|
72 | 72 | $this->setModel($model); |
73 | 73 | if (isset($modelInstance)) { |
74 | 74 | $this->show($modelInstance); |
75 | 75 | } |
76 | - $this->_generated = false; |
|
76 | + $this->_generated=false; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | protected function _init($instanceViewer, $contentKey, $content, $edition) { |
80 | - $this->_instanceViewer = $instanceViewer; |
|
81 | - $this->content = [ |
|
80 | + $this->_instanceViewer=$instanceViewer; |
|
81 | + $this->content=[ |
|
82 | 82 | $contentKey => $content |
83 | 83 | ]; |
84 | - $this->_self = $content; |
|
85 | - $this->_toolbarPosition = PositionInTable::BEFORETABLE; |
|
86 | - $this->_edition = $edition; |
|
84 | + $this->_self=$content; |
|
85 | + $this->_toolbarPosition=PositionInTable::BEFORETABLE; |
|
86 | + $this->_edition=$edition; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -92,16 +92,16 @@ discard block |
||
92 | 92 | * @return int|string|boolean |
93 | 93 | */ |
94 | 94 | protected function _getIndex($fieldName) { |
95 | - $index = $fieldName; |
|
95 | + $index=$fieldName; |
|
96 | 96 | if (\is_string($fieldName)) { |
97 | - $fields = $this->_instanceViewer->getVisibleProperties(); |
|
98 | - $index = \array_search($fieldName, $fields); |
|
97 | + $fields=$this->_instanceViewer->getVisibleProperties(); |
|
98 | + $index=\array_search($fieldName, $fields); |
|
99 | 99 | } |
100 | 100 | return $index; |
101 | 101 | } |
102 | 102 | |
103 | - protected function _getFieldIdentifier($prefix, $name = "") { |
|
104 | - return $this->identifier . "-{$prefix}-" . $this->_instanceViewer->getIdentifier(); |
|
103 | + protected function _getFieldIdentifier($prefix, $name="") { |
|
104 | + return $this->identifier."-{$prefix}-".$this->_instanceViewer->getIdentifier(); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | protected function _getFieldName($index) { |
@@ -112,13 +112,13 @@ discard block |
||
112 | 112 | return $this->_instanceViewer->getCaption($index); |
113 | 113 | } |
114 | 114 | |
115 | - abstract protected function _setToolbarPosition($table, $captions = NULL); |
|
115 | + abstract protected function _setToolbarPosition($table, $captions=NULL); |
|
116 | 116 | |
117 | 117 | public function show($modelInstance) { |
118 | 118 | if (\is_array($modelInstance)) { |
119 | - $modelInstance = \json_decode(\json_encode($modelInstance), FALSE); |
|
119 | + $modelInstance=\json_decode(\json_encode($modelInstance), FALSE); |
|
120 | 120 | } |
121 | - $this->_modelInstance = $modelInstance; |
|
121 | + $this->_modelInstance=$modelInstance; |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | public function getModel() { |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | public function setModel($_model) { |
129 | - $this->_model = $_model; |
|
129 | + $this->_model=$_model; |
|
130 | 130 | return $this; |
131 | 131 | } |
132 | 132 | |
@@ -135,13 +135,13 @@ discard block |
||
135 | 135 | } |
136 | 136 | |
137 | 137 | public function setInstanceViewer($_instanceViewer) { |
138 | - $this->_instanceViewer = $_instanceViewer; |
|
138 | + $this->_instanceViewer=$_instanceViewer; |
|
139 | 139 | return $this; |
140 | 140 | } |
141 | 141 | |
142 | 142 | abstract public function getHtmlComponent(); |
143 | 143 | |
144 | - public function setAttached($value = true) { |
|
144 | + public function setAttached($value=true) { |
|
145 | 145 | return $this->getHtmlComponent()->setAttached($value); |
146 | 146 | } |
147 | 147 | |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | * @return Widget |
157 | 157 | */ |
158 | 158 | public function afterCompile($index, $callback) { |
159 | - $index = $this->_getIndex($index); |
|
160 | - if ($index !== false) { |
|
159 | + $index=$this->_getIndex($index); |
|
160 | + if ($index!==false) { |
|
161 | 161 | $this->_instanceViewer->afterCompile($index, $callback); |
162 | 162 | } |
163 | 163 | return $this; |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | return $this; |
183 | 183 | } |
184 | 184 | |
185 | - public function addField($field, $key = null) { |
|
185 | + public function addField($field, $key=null) { |
|
186 | 186 | $this->_instanceViewer->addField($field, $key); |
187 | 187 | return $this; |
188 | 188 | } |
@@ -196,10 +196,10 @@ discard block |
||
196 | 196 | return $this->_instanceViewer->visiblePropertiesCount(); |
197 | 197 | } |
198 | 198 | |
199 | - public function addMessage($attributes = NULL, $fieldName = "message") { |
|
199 | + public function addMessage($attributes=NULL, $fieldName="message") { |
|
200 | 200 | $this->_instanceViewer->addField($fieldName); |
201 | - $count = $this->_instanceViewer->visiblePropertiesCount(); |
|
202 | - return $this->fieldAsMessage($count - 1, $attributes); |
|
201 | + $count=$this->_instanceViewer->visiblePropertiesCount(); |
|
202 | + return $this->fieldAsMessage($count-1, $attributes); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | public function addErrorMessage() { |
@@ -208,15 +208,15 @@ discard block |
||
208 | 208 | ], "message"); |
209 | 209 | } |
210 | 210 | |
211 | - public function insertField($index, $field, $key = null) { |
|
212 | - $index = $this->_getIndex($index); |
|
211 | + public function insertField($index, $field, $key=null) { |
|
212 | + $index=$this->_getIndex($index); |
|
213 | 213 | $this->_instanceViewer->insertField($index, $field, $key); |
214 | 214 | return $this; |
215 | 215 | } |
216 | 216 | |
217 | - public function insertInField($index, $field, $key = null) { |
|
218 | - $index = $this->_getIndex($index); |
|
219 | - if ($index !== false) { |
|
217 | + public function insertInField($index, $field, $key=null) { |
|
218 | + $index=$this->_getIndex($index); |
|
219 | + if ($index!==false) { |
|
220 | 220 | $this->_instanceViewer->insertInField($index, $field, $key); |
221 | 221 | } |
222 | 222 | return $this; |
@@ -232,8 +232,8 @@ discard block |
||
232 | 232 | * @return Widget |
233 | 233 | */ |
234 | 234 | public function setValueFunction($index, $callback) { |
235 | - $index = $this->_getIndex($index); |
|
236 | - if ($index !== false) { |
|
235 | + $index=$this->_getIndex($index); |
|
236 | + if ($index!==false) { |
|
237 | 237 | $this->_instanceViewer->setValueFunction($index, $callback); |
238 | 238 | } |
239 | 239 | return $this; |
@@ -249,8 +249,8 @@ discard block |
||
249 | 249 | * @return \Ajax\semantic\html\collections\menus\HtmlMenu |
250 | 250 | */ |
251 | 251 | public function getToolbar() { |
252 | - if (isset($this->_toolbar) === false) { |
|
253 | - $this->_toolbar = new HtmlMenu("toolbar-" . $this->identifier); |
|
252 | + if (isset($this->_toolbar)===false) { |
|
253 | + $this->_toolbar=new HtmlMenu("toolbar-".$this->identifier); |
|
254 | 254 | } |
255 | 255 | return $this->_toolbar; |
256 | 256 | } |
@@ -263,11 +263,11 @@ discard block |
||
263 | 263 | * function to call on $element |
264 | 264 | * @return \Ajax\common\html\HtmlDoubleElement |
265 | 265 | */ |
266 | - public function addInToolbar($element, $callback = NULL) { |
|
267 | - $tb = $this->getToolbar(); |
|
266 | + public function addInToolbar($element, $callback=NULL) { |
|
267 | + $tb=$this->getToolbar(); |
|
268 | 268 | if ($element instanceof BaseWidget) { |
269 | - if ($element->getIdentifier() === "") { |
|
270 | - $element->setIdentifier("tb-item-" . $this->identifier . "-" . $tb->count()); |
|
269 | + if ($element->getIdentifier()==="") { |
|
270 | + $element->setIdentifier("tb-item-".$this->identifier."-".$tb->count()); |
|
271 | 271 | } |
272 | 272 | } |
273 | 273 | if (isset($callback)) { |
@@ -286,8 +286,8 @@ discard block |
||
286 | 286 | * function($element) |
287 | 287 | * @return \Ajax\common\html\HtmlDoubleElement |
288 | 288 | */ |
289 | - public function addItemInToolbar($caption, $icon = NULL, $callback = NULL) { |
|
290 | - $result = $this->addInToolbar($caption, $callback); |
|
289 | + public function addItemInToolbar($caption, $icon=NULL, $callback=NULL) { |
|
290 | + $result=$this->addInToolbar($caption, $callback); |
|
291 | 291 | if (isset($icon) && method_exists($result, "addIcon")) |
292 | 292 | $result->addIcon($icon); |
293 | 293 | return $result; |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * function($element) |
301 | 301 | * @return \Ajax\common\Widget |
302 | 302 | */ |
303 | - public function addItemsInToolbar(array $items, $callback = NULL) { |
|
303 | + public function addItemsInToolbar(array $items, $callback=NULL) { |
|
304 | 304 | if (JArray::isAssociative($items)) { |
305 | 305 | foreach ($items as $icon => $item) { |
306 | 306 | $this->addItemInToolbar($item, $icon, $callback); |
@@ -321,10 +321,10 @@ discard block |
||
321 | 321 | * function($element) |
322 | 322 | * @return \Ajax\common\html\HtmlDoubleElement |
323 | 323 | */ |
324 | - public function addDropdownInToolbar($value, $items, $callback = NULL) { |
|
325 | - $dd = $value; |
|
324 | + public function addDropdownInToolbar($value, $items, $callback=NULL) { |
|
325 | + $dd=$value; |
|
326 | 326 | if (\is_string($value)) { |
327 | - $dd = new HtmlDropdown("dropdown-" . $this->identifier . "-" . $value, $value, $items); |
|
327 | + $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$value, $value, $items); |
|
328 | 328 | } |
329 | 329 | return $this->addInToolbar($dd, $callback); |
330 | 330 | } |
@@ -337,8 +337,8 @@ discard block |
||
337 | 337 | * function($element) |
338 | 338 | * @return \Ajax\common\html\HtmlDoubleElement |
339 | 339 | */ |
340 | - public function addButtonInToolbar($caption, $cssStyle = null, $callback = NULL) { |
|
341 | - $bt = new HtmlButton("bt-" . $caption, $caption, $cssStyle); |
|
340 | + public function addButtonInToolbar($caption, $cssStyle=null, $callback=NULL) { |
|
341 | + $bt=new HtmlButton("bt-".$caption, $caption, $cssStyle); |
|
342 | 342 | return $this->addInToolbar($bt, $callback); |
343 | 343 | } |
344 | 344 | |
@@ -350,8 +350,8 @@ discard block |
||
350 | 350 | * function($element) |
351 | 351 | * @return \Ajax\common\html\HtmlDoubleElement |
352 | 352 | */ |
353 | - public function addButtonsInToolbar(array $captions, $asIcon = false, $callback = NULL) { |
|
354 | - $bts = new HtmlButtonGroups("", $captions, $asIcon); |
|
353 | + public function addButtonsInToolbar(array $captions, $asIcon=false, $callback=NULL) { |
|
354 | + $bts=new HtmlButtonGroups("", $captions, $asIcon); |
|
355 | 355 | return $this->addInToolbar($bts, $callback); |
356 | 356 | } |
357 | 357 | |
@@ -363,14 +363,14 @@ discard block |
||
363 | 363 | * @param boolean $labeled |
364 | 364 | * @return \Ajax\common\html\HtmlDoubleElement |
365 | 365 | */ |
366 | - public function addLabelledIconButtonInToolbar($caption, $icon, $before = true, $labeled = false) { |
|
367 | - $bt = new HtmlButton("", $caption); |
|
366 | + public function addLabelledIconButtonInToolbar($caption, $icon, $before=true, $labeled=false) { |
|
367 | + $bt=new HtmlButton("", $caption); |
|
368 | 368 | $bt->addIcon($icon, $before, $labeled); |
369 | 369 | return $this->addInToolbar($bt); |
370 | 370 | } |
371 | 371 | |
372 | - public function addSubmitInToolbar($identifier, $value, $cssStyle = NULL, $url = NULL, $responseElement = NULL, $parameters = NULL) { |
|
373 | - $button = new HtmlButton($identifier, $value, $cssStyle); |
|
372 | + public function addSubmitInToolbar($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $parameters=NULL) { |
|
373 | + $button=new HtmlButton($identifier, $value, $cssStyle); |
|
374 | 374 | $this->_buttonAsSubmit($button, "click", $url, $responseElement, $parameters); |
375 | 375 | return $this->addInToolbar($button); |
376 | 376 | } |
@@ -393,8 +393,8 @@ discard block |
||
393 | 393 | * @param boolean $_edition |
394 | 394 | * @return \Ajax\common\Widget |
395 | 395 | */ |
396 | - public function setEdition($_edition = true) { |
|
397 | - $this->_edition = $_edition; |
|
396 | + public function setEdition($_edition=true) { |
|
397 | + $this->_edition=$_edition; |
|
398 | 398 | return $this; |
399 | 399 | } |
400 | 400 | |
@@ -423,8 +423,8 @@ discard block |
||
423 | 423 | * @param string|boolean $disable |
424 | 424 | * @return string |
425 | 425 | */ |
426 | - public function jsDisabled($disable = true) { |
|
427 | - return "$('#" . $this->identifier . " .ui.input,#" . $this->identifier . " .ui.dropdown,#" . $this->identifier . " .ui.checkbox').toggleClass('disabled'," . $disable . ");"; |
|
426 | + public function jsDisabled($disable=true) { |
|
427 | + return "$('#".$this->identifier." .ui.input,#".$this->identifier." .ui.dropdown,#".$this->identifier." .ui.checkbox').toggleClass('disabled',".$disable.");"; |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | /** |
@@ -434,8 +434,8 @@ discard block |
||
434 | 434 | * function($element) |
435 | 435 | * @return \Ajax\common\html\HtmlDoubleElement |
436 | 436 | */ |
437 | - public function addEditButtonInToolbar($caption, $callback = NULL) { |
|
438 | - $bt = new HtmlButton($this->identifier . "-editBtn", $caption); |
|
437 | + public function addEditButtonInToolbar($caption, $callback=NULL) { |
|
438 | + $bt=new HtmlButton($this->identifier."-editBtn", $caption); |
|
439 | 439 | $bt->setToggle(); |
440 | 440 | $bt->setActive($this->_edition); |
441 | 441 | $bt->onClick($this->jsDisabled(Javascript::prep_value("!$(event.target).hasClass('active')"))); |
@@ -443,18 +443,18 @@ discard block |
||
443 | 443 | } |
444 | 444 | |
445 | 445 | public function setToolbar(HtmlMenu $_toolbar) { |
446 | - $this->_toolbar = $_toolbar; |
|
446 | + $this->_toolbar=$_toolbar; |
|
447 | 447 | return $this; |
448 | 448 | } |
449 | 449 | |
450 | 450 | public function setToolbarPosition($_toolbarPosition) { |
451 | - $this->_toolbarPosition = $_toolbarPosition; |
|
451 | + $this->_toolbarPosition=$_toolbarPosition; |
|
452 | 452 | return $this; |
453 | 453 | } |
454 | 454 | |
455 | 455 | public function getForm() { |
456 | - if (! isset($this->_form)) { |
|
457 | - $this->_form = new HtmlForm("frm-" . $this->identifier); |
|
456 | + if (!isset($this->_form)) { |
|
457 | + $this->_form=new HtmlForm("frm-".$this->identifier); |
|
458 | 458 | $this->setEdition(true); |
459 | 459 | } |
460 | 460 | return $this->_form; |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | } |
469 | 469 | |
470 | 470 | protected function runForm(JsUtils $js) { |
471 | - $fields = $this->getContentInstances(HtmlFormField::class); |
|
471 | + $fields=$this->getContentInstances(HtmlFormField::class); |
|
472 | 472 | foreach ($fields as $field) { |
473 | 473 | $this->_form->addField($field); |
474 | 474 | } |
@@ -477,10 +477,10 @@ discard block |
||
477 | 477 | |
478 | 478 | protected function _compileForm() { |
479 | 479 | if (isset($this->_form)) { |
480 | - $noValidate = ""; |
|
481 | - if (\sizeof($this->_form->getValidationParams()) > 0) |
|
482 | - $noValidate = "novalidate"; |
|
483 | - $this->wrapContent("<form class='".$this->_form->getProperty('class')."' id='frm-" . $this->identifier . "' name='frm-" . $this->identifier . "' " . $noValidate . ">", "</form>"); |
|
480 | + $noValidate=""; |
|
481 | + if (\sizeof($this->_form->getValidationParams())>0) |
|
482 | + $noValidate="novalidate"; |
|
483 | + $this->wrapContent("<form class='".$this->_form->getProperty('class')."' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">", "</form>"); |
|
484 | 484 | } |
485 | 485 | } |
486 | 486 | |
@@ -502,21 +502,21 @@ discard block |
||
502 | 502 | } |
503 | 503 | |
504 | 504 | public function swapFields($index1, $index2) { |
505 | - $index1 = $this->_getIndex($index1); |
|
506 | - $index2 = $this->_getIndex($index2); |
|
505 | + $index1=$this->_getIndex($index1); |
|
506 | + $index2=$this->_getIndex($index2); |
|
507 | 507 | return $this->_instanceViewer->swapFields($index1, $index2); |
508 | 508 | } |
509 | 509 | |
510 | 510 | public function removeField($index) { |
511 | - $index = $this->_getIndex($index); |
|
512 | - if ($index !== false) { |
|
511 | + $index=$this->_getIndex($index); |
|
512 | + if ($index!==false) { |
|
513 | 513 | $this->_instanceViewer->removeField($index); |
514 | 514 | } |
515 | 515 | return $this; |
516 | 516 | } |
517 | 517 | |
518 | - public function asModal($header = null) { |
|
519 | - $modal = new HtmlModal("modal-" . $this->identifier, $header); |
|
518 | + public function asModal($header=null) { |
|
519 | + $modal=new HtmlModal("modal-".$this->identifier, $header); |
|
520 | 520 | $modal->setContent($this); |
521 | 521 | if (isset($this->_form)) { |
522 | 522 | $this->_form->onSuccess($modal->jsHide()); |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | return $modal; |
525 | 525 | } |
526 | 526 | |
527 | - public function addToProperty($name, $value, $separator = " ") { |
|
527 | + public function addToProperty($name, $value, $separator=" ") { |
|
528 | 528 | return $this->getHtmlComponent()->addToProperty($name, $value, $separator); |
529 | 529 | } |
530 | 530 |
@@ -15,36 +15,36 @@ discard block |
||
15 | 15 | protected $_paramParts=array(); |
16 | 16 | |
17 | 17 | public function __construct($identifier, $header="", $content="", $actions=null) { |
18 | - parent::__construct($identifier, "div","ui modal"); |
|
19 | - if(isset($header)){ |
|
18 | + parent::__construct($identifier, "div", "ui modal"); |
|
19 | + if (isset($header)) { |
|
20 | 20 | $this->setHeader($header); |
21 | 21 | } |
22 | - if(isset($content)){ |
|
22 | + if (isset($content)) { |
|
23 | 23 | $this->setContent($content); |
24 | 24 | } |
25 | - if(isset($actions)){ |
|
25 | + if (isset($actions)) { |
|
26 | 26 | $this->setActions($actions); |
27 | 27 | } |
28 | 28 | } |
29 | 29 | |
30 | 30 | public function setHeader($value) { |
31 | - $this->content["header"]=new HtmlSemDoubleElement("header-" . $this->identifier, "a", "header", $value); |
|
31 | + $this->content["header"]=new HtmlSemDoubleElement("header-".$this->identifier, "a", "header", $value); |
|
32 | 32 | return $this; |
33 | 33 | } |
34 | 34 | |
35 | 35 | public function setContent($value) { |
36 | - $this->content["content"]=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "content", $value); |
|
36 | + $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content", $value); |
|
37 | 37 | return $this; |
38 | 38 | } |
39 | 39 | |
40 | 40 | public function setActions($actions) { |
41 | - $this->content["actions"]=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "actions"); |
|
42 | - if(\is_array($actions)){ |
|
43 | - foreach ($actions as $action){ |
|
41 | + $this->content["actions"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "actions"); |
|
42 | + if (\is_array($actions)) { |
|
43 | + foreach ($actions as $action) { |
|
44 | 44 | $this->addAction($action); |
45 | 45 | } |
46 | 46 | } |
47 | - else{ |
|
47 | + else { |
|
48 | 48 | $this->addAction($actions); |
49 | 49 | } |
50 | 50 | return $this; |
@@ -54,17 +54,17 @@ discard block |
||
54 | 54 | * @param string|BaseHtml $action |
55 | 55 | * @return HtmlButton |
56 | 56 | */ |
57 | - public function addAction($action){ |
|
58 | - if(!$action instanceof BaseHtml){ |
|
57 | + public function addAction($action) { |
|
58 | + if (!$action instanceof BaseHtml) { |
|
59 | 59 | $class=""; |
60 | - if(\array_search($action, ["Okay","Yes","Validate"])!==false){ |
|
60 | + if (\array_search($action, ["Okay", "Yes", "Validate"])!==false) { |
|
61 | 61 | $class="approve"; |
62 | 62 | } |
63 | - if(\array_search($action, ["Close","Cancel","No"])!==false){ |
|
63 | + if (\array_search($action, ["Close", "Cancel", "No"])!==false) { |
|
64 | 64 | $class="cancel"; |
65 | 65 | } |
66 | - $action=new HtmlButton("action-".$this->identifier."-".JArray::count($this->content["actions"]->getContent()),$action); |
|
67 | - if($class!=="") |
|
66 | + $action=new HtmlButton("action-".$this->identifier."-".JArray::count($this->content["actions"]->getContent()), $action); |
|
67 | + if ($class!=="") |
|
68 | 68 | $action->addToProperty("class", $class); |
69 | 69 | } |
70 | 70 | return $this->addElementInPart($action, "actions"); |
@@ -74,66 +74,66 @@ discard block |
||
74 | 74 | * @param int $index |
75 | 75 | * @return HtmlButton |
76 | 76 | */ |
77 | - public function getAction($index){ |
|
77 | + public function getAction($index) { |
|
78 | 78 | return $this->content["actions"]->getContent()[$index]; |
79 | 79 | } |
80 | 80 | |
81 | - public function addContent($content,$before=false){ |
|
82 | - $this->content["content"]->addContent($content,$before); |
|
81 | + public function addContent($content, $before=false) { |
|
82 | + $this->content["content"]->addContent($content, $before); |
|
83 | 83 | return $this; |
84 | 84 | } |
85 | 85 | |
86 | - public function addImageContent($image,$description=NULL){ |
|
86 | + public function addImageContent($image, $description=NULL) { |
|
87 | 87 | $content=$this->content["content"]; |
88 | - if(isset($description)){ |
|
89 | - $description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description); |
|
90 | - $content->addContent($description,true); |
|
88 | + if (isset($description)) { |
|
89 | + $description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description); |
|
90 | + $content->addContent($description, true); |
|
91 | 91 | } |
92 | - if($image!==""){ |
|
93 | - $img=new HtmlImage("image-".$this->identifier,$image,"","medium"); |
|
94 | - $content->addContent($img,true); |
|
95 | - $content->addToProperty("class","image"); |
|
92 | + if ($image!=="") { |
|
93 | + $img=new HtmlImage("image-".$this->identifier, $image, "", "medium"); |
|
94 | + $content->addContent($img, true); |
|
95 | + $content->addToProperty("class", "image"); |
|
96 | 96 | } |
97 | 97 | return $this; |
98 | 98 | } |
99 | 99 | |
100 | - public function addIconContent($icon,$description=NULL){ |
|
100 | + public function addIconContent($icon, $description=NULL) { |
|
101 | 101 | $content=$this->content["content"]; |
102 | - if(isset($description)){ |
|
103 | - $description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description); |
|
104 | - $content->addContent($description,true); |
|
102 | + if (isset($description)) { |
|
103 | + $description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description); |
|
104 | + $content->addContent($description, true); |
|
105 | 105 | } |
106 | - if($icon!==""){ |
|
107 | - $img=new HtmlIcon("image-".$this->identifier,$icon); |
|
108 | - $content->addContent($img,true); |
|
109 | - $content->addToProperty("class","image"); |
|
106 | + if ($icon!=="") { |
|
107 | + $img=new HtmlIcon("image-".$this->identifier, $icon); |
|
108 | + $content->addContent($img, true); |
|
109 | + $content->addToProperty("class", "image"); |
|
110 | 110 | } |
111 | 111 | return $this; |
112 | 112 | } |
113 | 113 | |
114 | - private function addElementInPart($element,$part) { |
|
114 | + private function addElementInPart($element, $part) { |
|
115 | 115 | $this->content[$part]->addContent($element); |
116 | 116 | return $element; |
117 | 117 | } |
118 | 118 | |
119 | - public function showDimmer($value){ |
|
120 | - $value=$value?"show":"hide"; |
|
119 | + public function showDimmer($value) { |
|
120 | + $value=$value ? "show" : "hide"; |
|
121 | 121 | $this->_paramParts[]=["'".$value." dimmer'"]; |
122 | 122 | return $this; |
123 | 123 | } |
124 | 124 | |
125 | - public function setInverted($recursive=true){ |
|
125 | + public function setInverted($recursive=true) { |
|
126 | 126 | $this->_params["inverted"]=true; |
127 | 127 | return $this; |
128 | 128 | } |
129 | 129 | |
130 | - public function setBasic(){ |
|
130 | + public function setBasic() { |
|
131 | 131 | return $this->addToProperty("class", "basic"); |
132 | 132 | } |
133 | 133 | |
134 | 134 | |
135 | - public function setTransition($value){ |
|
136 | - $this->_paramParts[]=["'setting'","'transition'","'".$value."'"]; |
|
135 | + public function setTransition($value) { |
|
136 | + $this->_paramParts[]=["'setting'", "'transition'", "'".$value."'"]; |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | * @param string $viewName |
144 | 144 | * @param array $params The parameters to pass to the view |
145 | 145 | */ |
146 | - public function renderView(JsUtils $js,$initialController,$viewName, $params=array()) { |
|
147 | - return $this->setContent($js->renderContent($initialController, $viewName,$params)); |
|
146 | + public function renderView(JsUtils $js, $initialController, $viewName, $params=array()) { |
|
147 | + return $this->setContent($js->renderContent($initialController, $viewName, $params)); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -155,8 +155,8 @@ discard block |
||
155 | 155 | * @param string $actionName the action name |
156 | 156 | * @param array $params |
157 | 157 | */ |
158 | - public function forward(JsUtils $js,$initialControllerInstance,$controllerName,$actionName,$params=NULL){ |
|
159 | - return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName,$params)); |
|
158 | + public function forward(JsUtils $js, $initialControllerInstance, $controllerName, $actionName, $params=NULL) { |
|
159 | + return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName, $params)); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
167 | 167 | */ |
168 | 168 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
169 | - $this->content=JArray::sortAssociative($this->content, ["header","content","actions" ]); |
|
170 | - if(isset($this->_params["inverted"]) && $this->_params["inverted"]){ |
|
169 | + $this->content=JArray::sortAssociative($this->content, ["header", "content", "actions"]); |
|
170 | + if (isset($this->_params["inverted"]) && $this->_params["inverted"]) { |
|
171 | 171 | parent::setInverted(true); |
172 | 172 | } |
173 | 173 | return parent::compile($js, $view); |
@@ -177,8 +177,8 @@ discard block |
||
177 | 177 | * @see BaseHtml::run() |
178 | 178 | */ |
179 | 179 | public function run(JsUtils $js) { |
180 | - if(isset($this->_bsComponent)===false) |
|
181 | - $this->_bsComponent=$js->semantic()->modal("#".$this->identifier,$this->_params,$this->_paramParts); |
|
180 | + if (isset($this->_bsComponent)===false) |
|
181 | + $this->_bsComponent=$js->semantic()->modal("#".$this->identifier, $this->_params, $this->_paramParts); |
|
182 | 182 | $this->addEventsOnRun($js); |
183 | 183 | return $this->_bsComponent; |
184 | 184 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | return $this->jsDo("hide"); |
192 | 192 | } |
193 | 193 | |
194 | - public function onHidden($js){ |
|
194 | + public function onHidden($js) { |
|
195 | 195 | $this->_params["onHidden"]=$js; |
196 | 196 | } |
197 | 197 | } |
@@ -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(); |
@@ -64,41 +64,41 @@ discard block |
||
64 | 64 | \sort($separators); |
65 | 65 | $size=\sizeof($separators); |
66 | 66 | $nb=0; |
67 | - if($size===1){ |
|
67 | + if ($size===1) { |
|
68 | 68 | $i=-1; |
69 | - foreach ($values as $v){ |
|
70 | - $this->_generateFields($form, [$v], $headers, $i, $wrappers,$nb++); |
|
69 | + foreach ($values as $v) { |
|
70 | + $this->_generateFields($form, [$v], $headers, $i, $wrappers, $nb++); |
|
71 | 71 | $i++; |
72 | 72 | } |
73 | - }else{ |
|
73 | + } else { |
|
74 | 74 | $separators[]=$count; |
75 | - for($i=0;$i<$size;$i++){ |
|
76 | - $fields=\array_slice($values, $separators[$i]+1,$separators[$i+1]-$separators[$i]); |
|
77 | - $this->_generateFields($form, $fields, $headers, $separators[$i], $wrappers,$nb++); |
|
75 | + for ($i=0; $i<$size; $i++) { |
|
76 | + $fields=\array_slice($values, $separators[$i]+1, $separators[$i+1]-$separators[$i]); |
|
77 | + $this->_generateFields($form, $fields, $headers, $separators[$i], $wrappers, $nb++); |
|
78 | 78 | } |
79 | 79 | } |
80 | - if($this->_hasRules && !$this->getForm()->hasValidationParams()){ |
|
80 | + if ($this->_hasRules && !$this->getForm()->hasValidationParams()) { |
|
81 | 81 | $this->setValidationParams(["inline"=>true]); |
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
85 | - protected function _generateFields($form,$values,$headers,$sepFirst,$wrappers,$nb){ |
|
85 | + protected function _generateFields($form, $values, $headers, $sepFirst, $wrappers, $nb) { |
|
86 | 86 | $wrapper=null; |
87 | - if(isset($headers[$sepFirst+1])) |
|
88 | - $form->addHeader($headers[$sepFirst+1],4,true); |
|
89 | - if(isset($wrappers[$sepFirst+1])){ |
|
87 | + if (isset($headers[$sepFirst+1])) |
|
88 | + $form->addHeader($headers[$sepFirst+1], 4, true); |
|
89 | + if (isset($wrappers[$sepFirst+1])) { |
|
90 | 90 | $wrapper=$wrappers[$sepFirst+1]; |
91 | 91 | } |
92 | - if(\sizeof($values)===1){ |
|
92 | + if (\sizeof($values)===1) { |
|
93 | 93 | $added=$form->addField($values[0]); |
94 | - }elseif(\sizeof($values)>1){ |
|
94 | + }elseif (\sizeof($values)>1) { |
|
95 | 95 | $added=$form->addFields($values); |
96 | - }else |
|
96 | + } else |
|
97 | 97 | return; |
98 | - if(isset($wrapper)){ |
|
99 | - $added->wrap($wrapper[0],$wrapper[1]); |
|
98 | + if (isset($wrapper)) { |
|
99 | + $added->wrap($wrapper[0], $wrapper[1]); |
|
100 | 100 | } |
101 | - $this->execHook("onGenerateFields",$added,$nb); |
|
101 | + $this->execHook("onGenerateFields", $added, $nb); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -106,18 +106,18 @@ discard block |
||
106 | 106 | * the generated field is the first parameter |
107 | 107 | * @param callable $callback the fonction to call when a field is generated |
108 | 108 | */ |
109 | - public function onGenerateField($callback){ |
|
110 | - $this->addHook("onGenerateFields",$callback); |
|
109 | + public function onGenerateField($callback) { |
|
110 | + $this->addHook("onGenerateFields", $callback); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
114 | 114 | * @return HtmlForm |
115 | 115 | */ |
116 | - public function getForm(){ |
|
116 | + public function getForm() { |
|
117 | 117 | return $this->content["form"]; |
118 | 118 | } |
119 | 119 | |
120 | - public function addSeparatorAfter($fieldNum){ |
|
120 | + public function addSeparatorAfter($fieldNum) { |
|
121 | 121 | $fieldNum=$this->_getIndex($fieldNum); |
122 | 122 | $this->_instanceViewer->addSeparatorAfter($fieldNum); |
123 | 123 | return $this; |
@@ -132,12 +132,12 @@ discard block |
||
132 | 132 | return $this; |
133 | 133 | } |
134 | 134 | |
135 | - public function fieldAsReset($index,$cssStyle=NULL,$attributes=NULL){ |
|
136 | - return $this->_fieldAs(function($id,$name,$value) use ($cssStyle){ |
|
137 | - $button=new HtmlButton($id,$value,$cssStyle); |
|
135 | + public function fieldAsReset($index, $cssStyle=NULL, $attributes=NULL) { |
|
136 | + return $this->_fieldAs(function($id, $name, $value) use ($cssStyle){ |
|
137 | + $button=new HtmlButton($id, $value, $cssStyle); |
|
138 | 138 | $button->setProperty("type", "reset"); |
139 | 139 | return $button; |
140 | - }, $index,$attributes); |
|
140 | + }, $index, $attributes); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
@@ -156,19 +156,19 @@ discard block |
||
156 | 156 | $this->content[$this->_toolbarPosition]=$this->_toolbar; |
157 | 157 | } |
158 | 158 | |
159 | - public function addDividerBefore($index,$title){ |
|
159 | + public function addDividerBefore($index, $title) { |
|
160 | 160 | $index=$this->_getIndex($index); |
161 | 161 | $this->_instanceViewer->addHeaderDividerBefore($index, $title); |
162 | 162 | return $this; |
163 | 163 | } |
164 | 164 | |
165 | - public function addWrapper($index,$contentBefore,$contentAfter=null){ |
|
165 | + public function addWrapper($index, $contentBefore, $contentAfter=null) { |
|
166 | 166 | $index=$this->_getIndex($index); |
167 | - $this->_instanceViewer->addWrapper($index, $contentBefore,$contentAfter); |
|
167 | + $this->_instanceViewer->addWrapper($index, $contentBefore, $contentAfter); |
|
168 | 168 | return $this; |
169 | 169 | } |
170 | 170 | |
171 | - public function run(JsUtils $js){ |
|
171 | + public function run(JsUtils $js) { |
|
172 | 172 | parent::run($js); |
173 | 173 | } |
174 | 174 |
@@ -16,9 +16,9 @@ discard block |
||
16 | 16 | |
17 | 17 | private $ajaxCall; |
18 | 18 | |
19 | - public function __construct($type, $url, $params, $jsCallback = null, $method = 'post', $parameters = [], $prompt = NULL, $value = NULL) { |
|
19 | + public function __construct($type, $url, $params, $jsCallback=null, $method='post', $parameters=[], $prompt=NULL, $value=NULL) { |
|
20 | 20 | parent::__construct($type, $prompt, $value); |
21 | - $parameters = \array_merge([ |
|
21 | + $parameters=\array_merge([ |
|
22 | 22 | 'async' => false, |
23 | 23 | 'url' => $url, |
24 | 24 | 'params' => $params, |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | 'preventDefault' => false, |
30 | 30 | 'responseElement' => null |
31 | 31 | ], $parameters); |
32 | - $this->ajaxCall = new AjaxCall($method, $parameters); |
|
32 | + $this->ajaxCall=new AjaxCall($method, $parameters); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | public function compile(JsUtils $js) { |
36 | - $js->exec(Rule::custom($this->getType(), "function(value,ruleValue){var result=true;" . $this->ajaxCall->compile($js) . "return result;}"), true); |
|
36 | + $js->exec(Rule::custom($this->getType(), "function(value,ruleValue){var result=true;".$this->ajaxCall->compile($js)."return result;}"), true); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 | \ No newline at end of file |
@@ -15,9 +15,9 @@ |
||
15 | 15 | |
16 | 16 | protected $jsFunction; |
17 | 17 | |
18 | - public function __construct($type, $jsFunction, $prompt = NULL, $value = NULL) { |
|
18 | + public function __construct($type, $jsFunction, $prompt=NULL, $value=NULL) { |
|
19 | 19 | parent::__construct($type, $prompt, $value); |
20 | - $this->jsFunction = $jsFunction; |
|
20 | + $this->jsFunction=$jsFunction; |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | public function compile(JsUtils $js) { |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @version 1.001 |
9 | 9 | * Generates a JSON field validator |
10 | 10 | */ |
11 | -class FieldValidation implements \JsonSerializable{ |
|
11 | +class FieldValidation implements \JsonSerializable { |
|
12 | 12 | /** |
13 | 13 | * @var string |
14 | 14 | */ |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | protected $optional; |
33 | 33 | |
34 | - public function __construct($identifier){ |
|
34 | + public function __construct($identifier) { |
|
35 | 35 | $this->identifier=$identifier; |
36 | 36 | $this->rules=[]; |
37 | 37 | } |
@@ -55,31 +55,31 @@ discard block |
||
55 | 55 | * @param string $value |
56 | 56 | * @return Rule |
57 | 57 | */ |
58 | - public function addRule($type,$prompt=NULL,$value=NULL){ |
|
59 | - if($type instanceof Rule) { |
|
60 | - $rule = $type; |
|
61 | - if($type instanceof CustomRule){ |
|
58 | + public function addRule($type, $prompt=NULL, $value=NULL) { |
|
59 | + if ($type instanceof Rule) { |
|
60 | + $rule=$type; |
|
61 | + if ($type instanceof CustomRule) { |
|
62 | 62 | $this->customRules[]=$type; |
63 | 63 | $this->hasCustomRules=true; |
64 | 64 | } |
65 | - }elseif(\is_array($type)){ |
|
65 | + }elseif (\is_array($type)) { |
|
66 | 66 | $value=JArray::getValue($type, "value", 2); |
67 | 67 | $prompt=JArray::getValue($type, "prompt", 1); |
68 | 68 | $type=JArray::getValue($type, "type", 0); |
69 | - $rule=new Rule($type,$prompt,$value); |
|
70 | - }else { |
|
71 | - $rule = new Rule($type, $prompt, $value); |
|
69 | + $rule=new Rule($type, $prompt, $value); |
|
70 | + } else { |
|
71 | + $rule=new Rule($type, $prompt, $value); |
|
72 | 72 | } |
73 | 73 | $this->rules[]=$rule; |
74 | 74 | return $rule; |
75 | 75 | } |
76 | 76 | |
77 | - public function jsonSerialize(){ |
|
78 | - $result=["identifier"=>$this->identifier,"rules"=>$this->rules]; |
|
79 | - if($this->optional){ |
|
77 | + public function jsonSerialize() { |
|
78 | + $result=["identifier"=>$this->identifier, "rules"=>$this->rules]; |
|
79 | + if ($this->optional) { |
|
80 | 80 | $result["optional"]=true; |
81 | 81 | } |
82 | - if(isset($this->depends)){ |
|
82 | + if (isset($this->depends)) { |
|
83 | 83 | $result["depends"]=$this->depends; |
84 | 84 | } |
85 | 85 | return $result; |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | return $this; |
96 | 96 | } |
97 | 97 | |
98 | - public function compile(JsUtils $js){ |
|
99 | - if($this->hasCustomRules) { |
|
98 | + public function compile(JsUtils $js) { |
|
99 | + if ($this->hasCustomRules) { |
|
100 | 100 | foreach ($this->customRules as $rule) { |
101 | 101 | $rule->compile($js); |
102 | 102 | } |
@@ -16,34 +16,34 @@ discard block |
||
16 | 16 | use FieldTrait; |
17 | 17 | protected $_container; |
18 | 18 | protected $_validation; |
19 | - public function __construct($identifier, $field,$label=NULL) { |
|
20 | - parent::__construct($identifier, "div","field"); |
|
19 | + public function __construct($identifier, $field, $label=NULL) { |
|
20 | + parent::__construct($identifier, "div", "field"); |
|
21 | 21 | $this->content=array(); |
22 | - $this->_states=[State::ERROR,State::DISABLED]; |
|
23 | - if(isset($label) && $label!=="") |
|
22 | + $this->_states=[State::ERROR, State::DISABLED]; |
|
23 | + if (isset($label) && $label!=="") |
|
24 | 24 | $this->setLabel($label); |
25 | 25 | $this->setField($field); |
26 | 26 | $this->_validation=NULL; |
27 | 27 | } |
28 | 28 | |
29 | - public function addPointingLabel($label,$pointing=Direction::NONE){ |
|
30 | - $labelO=new HtmlLabel("",$label); |
|
29 | + public function addPointingLabel($label, $pointing=Direction::NONE) { |
|
30 | + $labelO=new HtmlLabel("", $label); |
|
31 | 31 | $labelO->setPointing($pointing); |
32 | - $this->addContent($labelO,$pointing==="below" || $pointing==="right"); |
|
32 | + $this->addContent($labelO, $pointing==="below" || $pointing==="right"); |
|
33 | 33 | return $labelO; |
34 | 34 | } |
35 | 35 | |
36 | - public function setLabel($label){ |
|
36 | + public function setLabel($label) { |
|
37 | 37 | $labelO=$label; |
38 | - if(\is_string($label)){ |
|
39 | - $labelO=new HtmlSemDoubleElement("","label",""); |
|
38 | + if (\is_string($label)) { |
|
39 | + $labelO=new HtmlSemDoubleElement("", "label", ""); |
|
40 | 40 | $labelO->setContent($label); |
41 | - $labelO->setProperty("for", \str_replace("field-", "",$this->identifier)); |
|
41 | + $labelO->setProperty("for", \str_replace("field-", "", $this->identifier)); |
|
42 | 42 | } |
43 | 43 | $this->content["label"]=$labelO; |
44 | 44 | } |
45 | 45 | |
46 | - public function setField($field){ |
|
46 | + public function setField($field) { |
|
47 | 47 | $this->content["field"]=$field; |
48 | 48 | } |
49 | 49 | |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | * Returns the label or null |
52 | 52 | * @return mixed |
53 | 53 | */ |
54 | - public function getLabel(){ |
|
55 | - if(\array_key_exists("label", $this->content)) |
|
54 | + public function getLabel() { |
|
55 | + if (\array_key_exists("label", $this->content)) |
|
56 | 56 | return $this->content["label"]; |
57 | 57 | } |
58 | 58 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * Return the field |
61 | 61 | * @return mixed |
62 | 62 | */ |
63 | - public function getField(){ |
|
63 | + public function getField() { |
|
64 | 64 | return $this->content["field"]; |
65 | 65 | } |
66 | 66 | |
@@ -68,14 +68,14 @@ discard block |
||
68 | 68 | * Return the field with data |
69 | 69 | * @return mixed |
70 | 70 | */ |
71 | - public function getDataField(){ |
|
71 | + public function getDataField() { |
|
72 | 72 | return $this->content["field"]; |
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
76 | 76 | * puts the label before or behind |
77 | 77 | */ |
78 | - public function swapLabel(){ |
|
78 | + public function swapLabel() { |
|
79 | 79 | $label=$this->getLabel(); |
80 | 80 | unset($this->content["label"]); |
81 | 81 | $this->content["label"]=$label; |
@@ -86,31 +86,31 @@ discard block |
||
86 | 86 | * @param int $width |
87 | 87 | * @return \Ajax\semantic\html\collections\form\HtmlFormField |
88 | 88 | */ |
89 | - public function setWidth($width){ |
|
90 | - if(\is_int($width)){ |
|
89 | + public function setWidth($width) { |
|
90 | + if (\is_int($width)) { |
|
91 | 91 | $width=Wide::getConstants()["W".$width]; |
92 | 92 | } |
93 | 93 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
94 | - if(isset($this->_container)){ |
|
94 | + if (isset($this->_container)) { |
|
95 | 95 | $this->_container->setEqualWidth(false); |
96 | 96 | } |
97 | - return $this->addToPropertyCtrl("class", "wide",array("wide")); |
|
97 | + return $this->addToPropertyCtrl("class", "wide", array("wide")); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
101 | 101 | * Field displays an error state |
102 | 102 | * @return \Ajax\semantic\html\collections\form\HtmlFormField |
103 | 103 | */ |
104 | - public function setError(){ |
|
104 | + public function setError() { |
|
105 | 105 | return $this->addToProperty("class", "error"); |
106 | 106 | } |
107 | 107 | |
108 | - public function setInline(){ |
|
108 | + public function setInline() { |
|
109 | 109 | return $this->addToProperty("class", "inline"); |
110 | 110 | } |
111 | 111 | |
112 | - public function jsState($state){ |
|
113 | - return $this->jsDoJquery("addClass",$state); |
|
112 | + public function jsState($state) { |
|
113 | + return $this->jsDoJquery("addClass", $state); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | public function setContainer($_container) { |
@@ -118,49 +118,49 @@ discard block |
||
118 | 118 | return $this; |
119 | 119 | } |
120 | 120 | |
121 | - public function setReadonly(){ |
|
121 | + public function setReadonly() { |
|
122 | 122 | $this->getDataField()->setProperty("readonly", ""); |
123 | 123 | } |
124 | 124 | |
125 | - public function addRule($type,$prompt=NULL,$value=NULL){ |
|
125 | + public function addRule($type, $prompt=NULL, $value=NULL) { |
|
126 | 126 | $field=$this->getDataField(); |
127 | - if(isset($field)){ |
|
128 | - if(!isset($this->_validation)){ |
|
127 | + if (isset($field)) { |
|
128 | + if (!isset($this->_validation)) { |
|
129 | 129 | $this->_validation=new FieldValidation($field->getIdentifier()); |
130 | 130 | } |
131 | - if($type==="empty"){ |
|
132 | - $this->addToProperty("class","required"); |
|
131 | + if ($type==="empty") { |
|
132 | + $this->addToProperty("class", "required"); |
|
133 | 133 | } |
134 | - $this->_validation->addRule($type,$prompt,$value); |
|
134 | + $this->_validation->addRule($type, $prompt, $value); |
|
135 | 135 | } |
136 | 136 | return $this; |
137 | 137 | } |
138 | 138 | |
139 | - public function setOptional($optional=true){ |
|
139 | + public function setOptional($optional=true) { |
|
140 | 140 | $field=$this->getDataField(); |
141 | - if(isset($field)){ |
|
142 | - if(!isset($this->_validation)){ |
|
141 | + if (isset($field)) { |
|
142 | + if (!isset($this->_validation)) { |
|
143 | 143 | $this->_validation=new FieldValidation($field->getIdentifier()); |
144 | 144 | } |
145 | 145 | $this->_validation->setOptional($optional); |
146 | 146 | } |
147 | 147 | } |
148 | 148 | |
149 | - public function addRules(array $rules){ |
|
150 | - foreach ($rules as $rule){ |
|
149 | + public function addRules(array $rules) { |
|
150 | + foreach ($rules as $rule) { |
|
151 | 151 | $this->addRule($rule); |
152 | 152 | } |
153 | 153 | return $this; |
154 | 154 | } |
155 | 155 | |
156 | - public function setRules(array $rules){ |
|
156 | + public function setRules(array $rules) { |
|
157 | 157 | $this->_validation=null; |
158 | 158 | return $this->addRules($rules); |
159 | 159 | } |
160 | 160 | |
161 | - public function addIcon($icon,$direction=Direction::LEFT){ |
|
161 | + public function addIcon($icon, $direction=Direction::LEFT) { |
|
162 | 162 | $field=$this->getField(); |
163 | - return $field->addIcon($icon,$direction); |
|
163 | + return $field->addIcon($icon, $direction); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | public function getValidation() { |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | } |
173 | 173 | |
174 | 174 | public function run(JsUtils $js) { |
175 | - if(isset($this->_validation)){ |
|
175 | + if (isset($this->_validation)) { |
|
176 | 176 | $this->_validation->compile($js); |
177 | 177 | } |
178 | 178 | return parent::run($js); |
@@ -16,13 +16,13 @@ discard block |
||
16 | 16 | class HtmlTableContent extends HtmlSemCollection { |
17 | 17 | protected $_focusable=false; |
18 | 18 | |
19 | - protected $_tdTagNames = [ |
|
19 | + protected $_tdTagNames=[ |
|
20 | 20 | "thead" => "th", |
21 | 21 | "tbody" => "td", |
22 | 22 | "tfoot" => "th" |
23 | 23 | ]; |
24 | 24 | |
25 | - protected $_merged = false; |
|
25 | + protected $_merged=false; |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @param int $rowCount |
32 | 32 | * @param int $colCount |
33 | 33 | */ |
34 | - public function __construct($identifier, $tagName = "tbody", $rowCount = NULL, $colCount = NULL) { |
|
34 | + public function __construct($identifier, $tagName="tbody", $rowCount=NULL, $colCount=NULL) { |
|
35 | 35 | parent::__construct($identifier, $tagName, ""); |
36 | 36 | if (isset($rowCount) && isset($colCount)) |
37 | 37 | $this->setRowCount($rowCount, $colCount); |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | * @return HtmlTableContent |
45 | 45 | */ |
46 | 46 | public function setRowCount($rowCount, $colCount) { |
47 | - $count = $this->count(); |
|
48 | - for ($i = $count; $i < $rowCount; $i ++) { |
|
47 | + $count=$this->count(); |
|
48 | + for ($i=$count; $i<$rowCount; $i++) { |
|
49 | 49 | $this->addItem($colCount); |
50 | 50 | } |
51 | 51 | return $this; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | public function refreshTR() { |
59 | - $this->_template = "%wrapContentBefore%%content%%wrapContentAfter%"; |
|
59 | + $this->_template="%wrapContentBefore%%content%%wrapContentAfter%"; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -67,14 +67,14 @@ discard block |
||
67 | 67 | * @return HtmlTR |
68 | 68 | */ |
69 | 69 | protected function createItem($value) { |
70 | - $count = $this->count(); |
|
71 | - $tr = new HtmlTR(""); |
|
70 | + $count=$this->count(); |
|
71 | + $tr=new HtmlTR(""); |
|
72 | 72 | $tr->setContainer($this, $count); |
73 | - if($this->_focusable) { |
|
73 | + if ($this->_focusable) { |
|
74 | 74 | $tr->setProperty('tabindex', $count); |
75 | 75 | } |
76 | 76 | $tr->setTdTagName($this->_tdTagNames[$this->tagName]); |
77 | - if (isset($value) === true) { |
|
77 | + if (isset($value)===true) { |
|
78 | 78 | $tr->setColCount($value); |
79 | 79 | } |
80 | 80 | return $tr; |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | return $this->addItem($row); |
103 | 103 | } |
104 | 104 | |
105 | - public function addMergeRow($colCount, $value = null) { |
|
106 | - $row = $this->addRow($colCount); |
|
105 | + public function addMergeRow($colCount, $value=null) { |
|
106 | + $row=$this->addRow($colCount); |
|
107 | 107 | $row->mergeCol(); |
108 | 108 | if (isset($value)) { |
109 | 109 | $row->setValues([ |
@@ -129,11 +129,11 @@ discard block |
||
129 | 129 | * @return HtmlTD|HtmlDoubleElement |
130 | 130 | */ |
131 | 131 | public function getCell($row, $col) { |
132 | - $row = $this->getItem($row); |
|
132 | + $row=$this->getItem($row); |
|
133 | 133 | if (isset($row) && $row instanceof HtmlCollection) { |
134 | - $col = $row->getItem($col); |
|
134 | + $col=$row->getItem($col); |
|
135 | 135 | } else { |
136 | - $col = $row; |
|
136 | + $col=$row; |
|
137 | 137 | } |
138 | 138 | return $col; |
139 | 139 | } |
@@ -154,9 +154,9 @@ discard block |
||
154 | 154 | * @param mixed $value |
155 | 155 | * @return HtmlTableContent |
156 | 156 | */ |
157 | - public function setCellValue($row, $col, $value = "") { |
|
158 | - $cell = $this->getCell($row, $col); |
|
159 | - if (isset($cell) === true) { |
|
157 | + public function setCellValue($row, $col, $value="") { |
|
158 | + $cell=$this->getCell($row, $col); |
|
159 | + if (isset($cell)===true) { |
|
160 | 160 | $cell->setValue($value); |
161 | 161 | } |
162 | 162 | return $this; |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | * |
168 | 168 | * @param mixed $values |
169 | 169 | */ |
170 | - public function setValues($values = array()) { |
|
171 | - return $this->_addOrSetValues($values, function (HtmlTR $row, $_values) { |
|
170 | + public function setValues($values=array()) { |
|
171 | + return $this->_addOrSetValues($values, function(HtmlTR $row, $_values) { |
|
172 | 172 | $row->setValues($_values); |
173 | 173 | }); |
174 | 174 | } |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | * |
179 | 179 | * @param mixed $values |
180 | 180 | */ |
181 | - public function addValues($values = array()) { |
|
182 | - return $this->_addOrSetValues($values, function (HtmlTR $row, $_values) { |
|
181 | + public function addValues($values=array()) { |
|
182 | + return $this->_addOrSetValues($values, function(HtmlTR $row, $_values) { |
|
183 | 183 | $row->addValues($_values); |
184 | 184 | }); |
185 | 185 | } |
@@ -191,42 +191,42 @@ discard block |
||
191 | 191 | * @param callable $callback |
192 | 192 | */ |
193 | 193 | protected function _addOrSetValues($values, $callback) { |
194 | - $count = $this->count(); |
|
195 | - $isArray = true; |
|
196 | - if (! \is_array($values)) { |
|
197 | - $values = \array_fill(0, $count, $values); |
|
198 | - $isArray = false; |
|
194 | + $count=$this->count(); |
|
195 | + $isArray=true; |
|
196 | + if (!\is_array($values)) { |
|
197 | + $values=\array_fill(0, $count, $values); |
|
198 | + $isArray=false; |
|
199 | 199 | } |
200 | - if (JArray::dimension($values) == 1 && $isArray) |
|
201 | - $values = [ |
|
200 | + if (JArray::dimension($values)==1 && $isArray) |
|
201 | + $values=[ |
|
202 | 202 | $values |
203 | 203 | ]; |
204 | 204 | |
205 | - $count = \min(\sizeof($values), $count); |
|
205 | + $count=\min(\sizeof($values), $count); |
|
206 | 206 | |
207 | - for ($i = 0; $i < $count; $i ++) { |
|
208 | - $row = $this->content[$i]; |
|
207 | + for ($i=0; $i<$count; $i++) { |
|
208 | + $row=$this->content[$i]; |
|
209 | 209 | $callback($row, $values[$i]); |
210 | 210 | } |
211 | 211 | return $this; |
212 | 212 | } |
213 | 213 | |
214 | - public function setColValues($colIndex, $values = array()) { |
|
215 | - $count = $this->count(); |
|
216 | - if (! \is_array($values)) { |
|
217 | - $values = \array_fill(0, $count, $values); |
|
214 | + public function setColValues($colIndex, $values=array()) { |
|
215 | + $count=$this->count(); |
|
216 | + if (!\is_array($values)) { |
|
217 | + $values=\array_fill(0, $count, $values); |
|
218 | 218 | } |
219 | - $count = \min(\sizeof($values), $count); |
|
220 | - for ($i = 0; $i < $count; $i ++) { |
|
219 | + $count=\min(\sizeof($values), $count); |
|
220 | + for ($i=0; $i<$count; $i++) { |
|
221 | 221 | $this->getCell($i, $colIndex)->setValue($values[$i]); |
222 | 222 | } |
223 | 223 | return $this; |
224 | 224 | } |
225 | 225 | |
226 | - public function addColVariations($colIndex, $variations = array()) { |
|
227 | - $count = $this->count(); |
|
228 | - for ($i = 0; $i < $count; $i ++) { |
|
229 | - $cell = $this->getCell($i, $colIndex); |
|
226 | + public function addColVariations($colIndex, $variations=array()) { |
|
227 | + $count=$this->count(); |
|
228 | + for ($i=0; $i<$count; $i++) { |
|
229 | + $cell=$this->getCell($i, $colIndex); |
|
230 | 230 | if ($cell instanceof BaseTrait) |
231 | 231 | $cell->addVariations($variations); |
232 | 232 | } |
@@ -234,41 +234,41 @@ discard block |
||
234 | 234 | } |
235 | 235 | |
236 | 236 | public function addPropertyCol($colIndex, $name, $value) { |
237 | - $count = $this->count(); |
|
238 | - for ($i = 0; $i < $count; $i ++) { |
|
239 | - $cell = $this->getCell($i, $colIndex); |
|
237 | + $count=$this->count(); |
|
238 | + for ($i=0; $i<$count; $i++) { |
|
239 | + $cell=$this->getCell($i, $colIndex); |
|
240 | 240 | if (isset($cell)) |
241 | 241 | $cell->addToProperty($name, $value); |
242 | 242 | } |
243 | 243 | return $this; |
244 | 244 | } |
245 | 245 | |
246 | - public function setRowValues($rowIndex, $values = array()) { |
|
247 | - $count = $this->count(); |
|
248 | - if (! \is_array($values)) { |
|
249 | - $values = \array_fill(0, $count, $values); |
|
246 | + public function setRowValues($rowIndex, $values=array()) { |
|
247 | + $count=$this->count(); |
|
248 | + if (!\is_array($values)) { |
|
249 | + $values=\array_fill(0, $count, $values); |
|
250 | 250 | } |
251 | 251 | $this->getItem($rowIndex)->setValues($values); |
252 | 252 | return $this; |
253 | 253 | } |
254 | 254 | |
255 | 255 | private function colAlign($colIndex, $function) { |
256 | - $count = $this->count(); |
|
257 | - for ($i = 0; $i < $count; $i ++) { |
|
258 | - $index = $this->content[$i]->getColPosition($colIndex); |
|
259 | - if ($index !== NULL) |
|
256 | + $count=$this->count(); |
|
257 | + for ($i=0; $i<$count; $i++) { |
|
258 | + $index=$this->content[$i]->getColPosition($colIndex); |
|
259 | + if ($index!==NULL) |
|
260 | 260 | $this->getCell($i, $index)->$function(); |
261 | 261 | } |
262 | 262 | return $this; |
263 | 263 | } |
264 | 264 | |
265 | 265 | private function colAlignFromRight($colIndex, $function) { |
266 | - $count = $this->count(); |
|
267 | - for ($i = 0; $i < $count; $i ++) { |
|
268 | - $maxRow = $this->content[$i]->count(); |
|
269 | - $index = $maxRow - $colIndex - 1; |
|
270 | - if (($cell = $this->getCell($i, $index)) !== NULL) { |
|
271 | - if ($cell->getColspan() == 1) |
|
266 | + $count=$this->count(); |
|
267 | + for ($i=0; $i<$count; $i++) { |
|
268 | + $maxRow=$this->content[$i]->count(); |
|
269 | + $index=$maxRow-$colIndex-1; |
|
270 | + if (($cell=$this->getCell($i, $index))!==NULL) { |
|
271 | + if ($cell->getColspan()==1) |
|
272 | 272 | $cell->$function(); |
273 | 273 | } |
274 | 274 | } |
@@ -314,9 +314,9 @@ discard block |
||
314 | 314 | * @return int |
315 | 315 | */ |
316 | 316 | public function getColCount() { |
317 | - $result = 0; |
|
318 | - if ($this->count() > 0) |
|
319 | - $result = $this->getItem(0)->count(); |
|
317 | + $result=0; |
|
318 | + if ($this->count()>0) |
|
319 | + $result=$this->getItem(0)->count(); |
|
320 | 320 | return $result; |
321 | 321 | } |
322 | 322 | |
@@ -327,10 +327,10 @@ discard block |
||
327 | 327 | * @param int $colIndex |
328 | 328 | * @return HtmlTableContent |
329 | 329 | */ |
330 | - public function delete($rowIndex, $colIndex = NULL) { |
|
330 | + public function delete($rowIndex, $colIndex=NULL) { |
|
331 | 331 | if (isset($colIndex)) { |
332 | - $row = $this->getItem($rowIndex); |
|
333 | - if (isset($row) === true) { |
|
332 | + $row=$this->getItem($rowIndex); |
|
333 | + if (isset($row)===true) { |
|
334 | 334 | $row->delete($colIndex); |
335 | 335 | } |
336 | 336 | } else { |
@@ -340,24 +340,24 @@ discard block |
||
340 | 340 | } |
341 | 341 | |
342 | 342 | public function toDelete($rowIndex, $colIndex) { |
343 | - $row = $this->getItem($rowIndex); |
|
344 | - if (isset($row) === true) |
|
343 | + $row=$this->getItem($rowIndex); |
|
344 | + if (isset($row)===true) |
|
345 | 345 | $row->toDelete($colIndex); |
346 | 346 | return $this; |
347 | 347 | } |
348 | 348 | |
349 | 349 | public function toRowspanned($rowIndex, $colIndex) { |
350 | - $row = $this->getItem($rowIndex); |
|
351 | - if (isset($row) === true) |
|
350 | + $row=$this->getItem($rowIndex); |
|
351 | + if (isset($row)===true) |
|
352 | 352 | $row->toRowspanned($colIndex); |
353 | 353 | return $this; |
354 | 354 | } |
355 | 355 | |
356 | - public function mergeCol($rowIndex = 0, $colIndex = 0) { |
|
356 | + public function mergeCol($rowIndex=0, $colIndex=0) { |
|
357 | 357 | return $this->getItem($rowIndex)->mergeCol($colIndex); |
358 | 358 | } |
359 | 359 | |
360 | - public function mergeRow($rowIndex = 0, $colIndex = 0) { |
|
360 | + public function mergeRow($rowIndex=0, $colIndex=0) { |
|
361 | 361 | return $this->getItem($rowIndex)->mergeRow($colIndex); |
362 | 362 | } |
363 | 363 | |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | * @return HtmlTableContent |
378 | 378 | */ |
379 | 379 | public function conditionalCellFormat($callback, $format) { |
380 | - $rows = $this->content; |
|
380 | + $rows=$this->content; |
|
381 | 381 | foreach ($rows as $row) { |
382 | 382 | $row->conditionalCellFormat($callback, $format); |
383 | 383 | } |
@@ -385,9 +385,9 @@ discard block |
||
385 | 385 | } |
386 | 386 | |
387 | 387 | public function conditionalColFormat($colIndex, $callback, $format) { |
388 | - $rows = $this->content; |
|
388 | + $rows=$this->content; |
|
389 | 389 | foreach ($rows as $row) { |
390 | - $cell = $row->getItem($colIndex); |
|
390 | + $cell=$row->getItem($colIndex); |
|
391 | 391 | $cell->conditionnalCellFormat($callback, $format); |
392 | 392 | } |
393 | 393 | return $this; |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | * @return HtmlTableContent |
401 | 401 | */ |
402 | 402 | public function conditionalRowFormat($callback, $format) { |
403 | - $rows = $this->content; |
|
403 | + $rows=$this->content; |
|
404 | 404 | foreach ($rows as $row) { |
405 | 405 | $row->conditionalRowFormat($callback, $format); |
406 | 406 | } |
@@ -408,9 +408,9 @@ discard block |
||
408 | 408 | } |
409 | 409 | |
410 | 410 | public function hideColumn($colIndex) { |
411 | - $rows = $this->content; |
|
411 | + $rows=$this->content; |
|
412 | 412 | foreach ($rows as $row) { |
413 | - $cell = $row->getItem($colIndex); |
|
413 | + $cell=$row->getItem($colIndex); |
|
414 | 414 | $cell->addToProperty("style", "display:none;"); |
415 | 415 | } |
416 | 416 | return $this; |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | * @return HtmlTableContent |
423 | 423 | */ |
424 | 424 | public function applyCells($callback) { |
425 | - $rows = $this->content; |
|
425 | + $rows=$this->content; |
|
426 | 426 | foreach ($rows as $row) { |
427 | 427 | $row->applyCells($callback); |
428 | 428 | } |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | * @return HtmlTableContent |
436 | 436 | */ |
437 | 437 | public function applyRows($callback) { |
438 | - $rows = $this->content; |
|
438 | + $rows=$this->content; |
|
439 | 439 | foreach ($rows as $row) { |
440 | 440 | $row->apply($callback); |
441 | 441 | } |
@@ -450,28 +450,28 @@ discard block |
||
450 | 450 | * @see https://fomantic-ui.com/collections/table.html#definition needs rowspanned class |
451 | 451 | * @since fomantic-ui 2.4.8 |
452 | 452 | */ |
453 | - public function mergeIdentiqualValues($colIndex, $function = "strip_tags") { |
|
454 | - $rows = $this->content; |
|
455 | - $identiqual = null; |
|
456 | - $counter = 0; |
|
457 | - $cellToMerge = null; |
|
458 | - $functionExists = \function_exists($function); |
|
453 | + public function mergeIdentiqualValues($colIndex, $function="strip_tags") { |
|
454 | + $rows=$this->content; |
|
455 | + $identiqual=null; |
|
456 | + $counter=0; |
|
457 | + $cellToMerge=null; |
|
458 | + $functionExists=\function_exists($function); |
|
459 | 459 | foreach ($rows as $row) { |
460 | - $cell = $row->getItem($colIndex); |
|
461 | - $value = $cell->getContent(); |
|
460 | + $cell=$row->getItem($colIndex); |
|
461 | + $value=$cell->getContent(); |
|
462 | 462 | if ($functionExists) |
463 | - $value = \call_user_func($function, $value); |
|
464 | - if ($value !== $identiqual) { |
|
465 | - if ($counter > 0 && isset($cellToMerge)) { |
|
463 | + $value=\call_user_func($function, $value); |
|
464 | + if ($value!==$identiqual) { |
|
465 | + if ($counter>0 && isset($cellToMerge)) { |
|
466 | 466 | $cellToMerge->setRowspanned($counter); |
467 | 467 | } |
468 | - $counter = 0; |
|
469 | - $cellToMerge = $cell; |
|
470 | - $identiqual = $value; |
|
468 | + $counter=0; |
|
469 | + $cellToMerge=$cell; |
|
470 | + $identiqual=$value; |
|
471 | 471 | } |
472 | - $counter ++; |
|
472 | + $counter++; |
|
473 | 473 | } |
474 | - if ($counter > 0 && isset($cellToMerge)) { |
|
474 | + if ($counter>0 && isset($cellToMerge)) { |
|
475 | 475 | $cellToMerge->setRowspanned($counter); |
476 | 476 | } |
477 | 477 | return $this; |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | } |
483 | 483 | |
484 | 484 | public function _setMerged($value) { |
485 | - $this->_merged = $value; |
|
485 | + $this->_merged=$value; |
|
486 | 486 | return $this; |
487 | 487 | } |
488 | 488 | |
@@ -490,6 +490,6 @@ discard block |
||
490 | 490 | * @param bool $focusable |
491 | 491 | */ |
492 | 492 | public function setFocusable(bool $focusable): void { |
493 | - $this->_focusable = $focusable; |
|
493 | + $this->_focusable=$focusable; |
|
494 | 494 | } |
495 | 495 | } |
@@ -10,9 +10,9 @@ discard block |
||
10 | 10 | */ |
11 | 11 | trait TableTrait { |
12 | 12 | |
13 | - abstract public function addEvent($event, $jsCode, $stopPropagation = false, $preventDefault = false); |
|
13 | + abstract public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false); |
|
14 | 14 | |
15 | - abstract public function getOn($event, $url, $responseElement = "", $parameters = array()); |
|
15 | + abstract public function getOn($event, $url, $responseElement="", $parameters=array()); |
|
16 | 16 | |
17 | 17 | protected function addToPropertyTable($property, $value) { |
18 | 18 | return $this->_self->addToProperty($property, $value); |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | return $this->addToPropertyTable("class", "celled"); |
23 | 23 | } |
24 | 24 | |
25 | - public function setBasic($very = false) { |
|
26 | - $table = $this->_self; |
|
25 | + public function setBasic($very=false) { |
|
26 | + $table=$this->_self; |
|
27 | 27 | if ($very) |
28 | 28 | $table->addToPropertyCtrl("class", "very", array( |
29 | 29 | "very" |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | )); |
34 | 34 | } |
35 | 35 | |
36 | - public function setCompact($very = false) { |
|
37 | - $table = $this->_self; |
|
36 | + public function setCompact($very=false) { |
|
37 | + $table=$this->_self; |
|
38 | 38 | if ($very) |
39 | 39 | $table->addToPropertyCtrl("class", "very", array( |
40 | 40 | "very" |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | return $this->addToPropertyTable("class", "structured"); |
57 | 57 | } |
58 | 58 | |
59 | - public function setSortable($colIndex = NULL) { |
|
60 | - $table = $this->_self; |
|
59 | + public function setSortable($colIndex=NULL) { |
|
60 | + $table=$this->_self; |
|
61 | 61 | if (isset($colIndex) && $table->hasPart("thead")) { |
62 | 62 | $table->getHeader()->sort($colIndex); |
63 | 63 | } |
@@ -80,29 +80,29 @@ discard block |
||
80 | 80 | return $this->addToPropertyTable("class", "striped"); |
81 | 81 | } |
82 | 82 | |
83 | - public function onRowClick($jsCode, $stopPropagation = false, $preventDefault = false) { |
|
83 | + public function onRowClick($jsCode, $stopPropagation=false, $preventDefault=false) { |
|
84 | 84 | return $this->onRow("click", $jsCode, $stopPropagation, $preventDefault); |
85 | 85 | } |
86 | 86 | |
87 | - public function onRow($event, $jsCode, $stopPropagation = false, $preventDefault = false) { |
|
88 | - return $this->_self->addEvent($event . "{{tbody tr}}", $jsCode, $stopPropagation, $preventDefault); |
|
87 | + public function onRow($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
|
88 | + return $this->_self->addEvent($event."{{tbody tr}}", $jsCode, $stopPropagation, $preventDefault); |
|
89 | 89 | } |
90 | 90 | |
91 | - public function getOnRow($event, $url, $responseElement = "", $parameters = array()) { |
|
92 | - $jsCondition = '!$(this).closest("tr").is(":focus")'; |
|
91 | + public function getOnRow($event, $url, $responseElement="", $parameters=array()) { |
|
92 | + $jsCondition='!$(this).closest("tr").is(":focus")'; |
|
93 | 93 | if (isset($parameters['jsCondition'])) { |
94 | - $jsCondition = '(' . $parameters['jsCondition'] . ' && ' . $jsCondition . ')'; |
|
94 | + $jsCondition='('.$parameters['jsCondition'].' && '.$jsCondition.')'; |
|
95 | 95 | } |
96 | - $parameters = \array_merge($parameters, [ |
|
96 | + $parameters=\array_merge($parameters, [ |
|
97 | 97 | "stopPropagation" => false, |
98 | 98 | "preventDefault" => false, |
99 | 99 | "jsCondition" => $jsCondition |
100 | 100 | ]); |
101 | - $selector = "tbody tr"; |
|
101 | + $selector="tbody tr"; |
|
102 | 102 | if (isset($parameters["selector"])) { |
103 | - $selector = $parameters["selector"]; |
|
103 | + $selector=$parameters["selector"]; |
|
104 | 104 | } |
105 | - return $this->_self->getOn($event . "{{" . $selector . "}}", $url, $responseElement, $parameters); |
|
105 | + return $this->_self->getOn($event."{{".$selector."}}", $url, $responseElement, $parameters); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | public function onPageChange($jsCode) { |
@@ -119,10 +119,10 @@ discard block |
||
119 | 119 | return $this->_self->getBsComponent()->getScript(); |
120 | 120 | } |
121 | 121 | |
122 | - public function addEventsOnRun(JsUtils $js = NULL) { |
|
123 | - $script = parent::addEventsOnRun($js); |
|
124 | - $innerScript = $this->_self->getInnerScript(); |
|
125 | - if (! isset($innerScript)) { |
|
122 | + public function addEventsOnRun(JsUtils $js=NULL) { |
|
123 | + $script=parent::addEventsOnRun($js); |
|
124 | + $innerScript=$this->_self->getInnerScript(); |
|
125 | + if (!isset($innerScript)) { |
|
126 | 126 | $this->_self->setInnerScript($script); |
127 | 127 | } |
128 | 128 | return $script; |