@@ -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 | } |