@@ -17,10 +17,10 @@ |
||
| 17 | 17 | * {@inheritDoc} |
| 18 | 18 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run() |
| 19 | 19 | */ |
| 20 | - public function run(JsUtils $js){ |
|
| 21 | - if(!isset($this->_bsComponent)){ |
|
| 22 | - if(isset($this->_timeout)){ |
|
| 23 | - $js->exec("setTimeout(function() { $('#{$this->identifier}').transition({$this->_closeTransition}); }, {$this->_timeout});",true); |
|
| 20 | + public function run(JsUtils $js) { |
|
| 21 | + if (!isset($this->_bsComponent)) { |
|
| 22 | + if (isset($this->_timeout)) { |
|
| 23 | + $js->exec("setTimeout(function() { $('#{$this->identifier}').transition({$this->_closeTransition}); }, {$this->_timeout});", true); |
|
| 24 | 24 | } |
| 25 | 25 | } |
| 26 | 26 | return parent::run($js); |
@@ -330,8 +330,9 @@ discard block |
||
| 330 | 330 | $result= $this->getBody()->_addRow($result); |
| 331 | 331 | } |
| 332 | 332 | if(isset($this->_afterCompileEvents["onNewRow"])){ |
| 333 | - if(\is_callable($this->_afterCompileEvents["onNewRow"])) |
|
| 334 | - $this->_afterCompileEvents["onNewRow"]($result,$object); |
|
| 333 | + if(\is_callable($this->_afterCompileEvents["onNewRow"])) { |
|
| 334 | + $this->_afterCompileEvents["onNewRow"]($result,$object); |
|
| 335 | + } |
|
| 335 | 336 | } |
| 336 | 337 | return $result; |
| 337 | 338 | } |
@@ -353,8 +354,9 @@ discard block |
||
| 353 | 354 | |
| 354 | 355 | public function run(JsUtils $js){ |
| 355 | 356 | $result= parent::run($js); |
| 356 | - if(isset($this->_footer)) |
|
| 357 | - $this->_footer->run($js); |
|
| 357 | + if(isset($this->_footer)) { |
|
| 358 | + $this->_footer->run($js); |
|
| 359 | + } |
|
| 358 | 360 | return $result; |
| 359 | 361 | } |
| 360 | 362 | |
@@ -394,8 +396,9 @@ discard block |
||
| 394 | 396 | |
| 395 | 397 | public function setColWidth($colIndex,$width){ |
| 396 | 398 | $part=$this->_getFirstPart(); |
| 397 | - if($part!==null && $part->count()>0) |
|
| 398 | - $part->getCell(0, $colIndex)->setWidth($width); |
|
| 399 | + if($part!==null && $part->count()>0) { |
|
| 400 | + $part->getCell(0, $colIndex)->setWidth($width); |
|
| 401 | + } |
|
| 399 | 402 | return $this; |
| 400 | 403 | } |
| 401 | 404 | |
@@ -28,10 +28,10 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | public function __construct($identifier, $rowCount, $colCount) { |
| 30 | 30 | parent::__construct($identifier, "table", "ui table"); |
| 31 | - $this->content=array (); |
|
| 31 | + $this->content=array(); |
|
| 32 | 32 | $this->setRowCount($rowCount, $colCount); |
| 33 | - $this->_variations=[ Variation::CELLED,Variation::PADDED,Variation::COMPACT ]; |
|
| 34 | - $this->_compileParts=["thead","tbody","tfoot"]; |
|
| 33 | + $this->_variations=[Variation::CELLED, Variation::PADDED, Variation::COMPACT]; |
|
| 34 | + $this->_compileParts=["thead", "tbody", "tfoot"]; |
|
| 35 | 35 | $this->_afterCompileEvents=[]; |
| 36 | 36 | } |
| 37 | 37 | |
@@ -41,17 +41,17 @@ discard block |
||
| 41 | 41 | * @return HtmlTableContent |
| 42 | 42 | */ |
| 43 | 43 | public function getPart($key) { |
| 44 | - if (\array_key_exists($key, $this->content) === false) { |
|
| 44 | + if (\array_key_exists($key, $this->content)===false) { |
|
| 45 | 45 | $this->content[$key]=new HtmlTableContent("", $key); |
| 46 | - if ($key !== "tbody") { |
|
| 46 | + if ($key!=="tbody") { |
|
| 47 | 47 | $this->content[$key]->setRowCount(1, $this->_colCount); |
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | return $this->content[$key]; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - protected function _getFirstPart(){ |
|
| 54 | - if(isset($this->content["thead"])){ |
|
| 53 | + protected function _getFirstPart() { |
|
| 54 | + if (isset($this->content["thead"])) { |
|
| 55 | 55 | return $this->content["thead"]; |
| 56 | 56 | } |
| 57 | 57 | return $this->content["tbody"]; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * @return boolean |
| 97 | 97 | */ |
| 98 | 98 | public function hasPart($key) { |
| 99 | - return \array_key_exists($key, $this->content) === true; |
|
| 99 | + return \array_key_exists($key, $this->content)===true; |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -229,8 +229,8 @@ discard block |
||
| 229 | 229 | return $this->colAlign($colIndex, "colLeft"); |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | - public function setColAlignment($colIndex,$alignment){ |
|
| 233 | - switch ($alignment){ |
|
| 232 | + public function setColAlignment($colIndex, $alignment) { |
|
| 233 | + switch ($alignment) { |
|
| 234 | 234 | case TextAlignment::LEFT: |
| 235 | 235 | $function="colLeft"; |
| 236 | 236 | break; |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | |
| 249 | 249 | private function colAlign($colIndex, $function) { |
| 250 | 250 | if (\is_array($colIndex)) { |
| 251 | - foreach ( $colIndex as $cIndex ) { |
|
| 251 | + foreach ($colIndex as $cIndex) { |
|
| 252 | 252 | $this->colAlign($cIndex, $function); |
| 253 | 253 | } |
| 254 | 254 | } else { |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | * @see HtmlSemDoubleElement::compile() |
| 310 | 310 | */ |
| 311 | 311 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 312 | - if(\sizeof($this->_compileParts)<3){ |
|
| 312 | + if (\sizeof($this->_compileParts)<3) { |
|
| 313 | 313 | $this->_template="%content%"; |
| 314 | 314 | $this->refresh(); |
| 315 | 315 | } |
@@ -318,11 +318,11 @@ discard block |
||
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | protected function compile_once(JsUtils $js=NULL, &$view=NULL) { |
| 321 | - parent::compile_once($js,$view); |
|
| 321 | + parent::compile_once($js, $view); |
|
| 322 | 322 | if ($this->propertyContains("class", "sortable")) { |
| 323 | - $this->addEvent("execute", "$('#" . $this->identifier . "').tablesort().data('tablesort').sort($('th.default-sort'));"); |
|
| 323 | + $this->addEvent("execute", "$('#".$this->identifier."').tablesort().data('tablesort').sort($('th.default-sort'));"); |
|
| 324 | 324 | } |
| 325 | - if(isset($this->_activeRowSelector)){ |
|
| 325 | + if (isset($this->_activeRowSelector)) { |
|
| 326 | 326 | $this->_activeRowSelector->compile(); |
| 327 | 327 | } |
| 328 | 328 | } |
@@ -336,13 +336,13 @@ discard block |
||
| 336 | 336 | public function fromDatabaseObject($object, $function) { |
| 337 | 337 | $result=$function($object); |
| 338 | 338 | if (\is_array($result)) { |
| 339 | - $result= $this->addRow($function($object)); |
|
| 339 | + $result=$this->addRow($function($object)); |
|
| 340 | 340 | } else { |
| 341 | - $result= $this->getBody()->_addRow($result); |
|
| 341 | + $result=$this->getBody()->_addRow($result); |
|
| 342 | 342 | } |
| 343 | - if(isset($this->_afterCompileEvents["onNewRow"])){ |
|
| 344 | - if(\is_callable($this->_afterCompileEvents["onNewRow"])) |
|
| 345 | - $this->_afterCompileEvents["onNewRow"]($result,$object); |
|
| 343 | + if (isset($this->_afterCompileEvents["onNewRow"])) { |
|
| 344 | + if (\is_callable($this->_afterCompileEvents["onNewRow"])) |
|
| 345 | + $this->_afterCompileEvents["onNewRow"]($result, $object); |
|
| 346 | 346 | } |
| 347 | 347 | return $result; |
| 348 | 348 | } |
@@ -357,14 +357,14 @@ discard block |
||
| 357 | 357 | return $this; |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | - public function refresh(){ |
|
| 360 | + public function refresh() { |
|
| 361 | 361 | $this->_footer=$this->getFooter(); |
| 362 | 362 | $this->addEvent("execute", '$("#'.$this->identifier.' tfoot").replaceWith("'.\addslashes($this->_footer).'");'); |
| 363 | 363 | } |
| 364 | 364 | |
| 365 | - public function run(JsUtils $js){ |
|
| 366 | - $result= parent::run($js); |
|
| 367 | - if(isset($this->_footer)) |
|
| 365 | + public function run(JsUtils $js) { |
|
| 366 | + $result=parent::run($js); |
|
| 367 | + if (isset($this->_footer)) |
|
| 368 | 368 | $this->_footer->run($js); |
| 369 | 369 | return $result; |
| 370 | 370 | } |
@@ -387,47 +387,47 @@ discard block |
||
| 387 | 387 | * @param boolean $multiple |
| 388 | 388 | * @return HtmlTable |
| 389 | 389 | */ |
| 390 | - public function setActiveRowSelector($class="active",$event="click",$multiple=false){ |
|
| 391 | - $this->_activeRowSelector=new ActiveRow($this,$class,$event,$multiple); |
|
| 390 | + public function setActiveRowSelector($class="active", $event="click", $multiple=false) { |
|
| 391 | + $this->_activeRowSelector=new ActiveRow($this, $class, $event, $multiple); |
|
| 392 | 392 | return $this; |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | - public function hideColumn($colIndex){ |
|
| 396 | - if(isset($this->content["thead"])){ |
|
| 395 | + public function hideColumn($colIndex) { |
|
| 396 | + if (isset($this->content["thead"])) { |
|
| 397 | 397 | $this->content["thead"]->hideColumn($colIndex); |
| 398 | 398 | } |
| 399 | 399 | $this->content["tbody"]->hideColumn($colIndex); |
| 400 | - if(isset($this->content["tfoot"])){ |
|
| 400 | + if (isset($this->content["tfoot"])) { |
|
| 401 | 401 | $this->content["tfoot"]->hideColumn($colIndex); |
| 402 | 402 | } |
| 403 | 403 | return $this; |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | - public function setColWidth($colIndex,$width){ |
|
| 406 | + public function setColWidth($colIndex, $width) { |
|
| 407 | 407 | $part=$this->_getFirstPart(); |
| 408 | - if($part!==null && $part->count()>0) |
|
| 408 | + if ($part!==null && $part->count()>0) |
|
| 409 | 409 | $part->getCell(0, $colIndex)->setWidth($width); |
| 410 | 410 | return $this; |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | - public function setColWidths($widths){ |
|
| 413 | + public function setColWidths($widths) { |
|
| 414 | 414 | $part=$this->_getFirstPart(); |
| 415 | - if($part!==null && $part->count()>0){ |
|
| 415 | + if ($part!==null && $part->count()>0) { |
|
| 416 | 416 | $count=$part->getColCount(); |
| 417 | - if(!\is_array($widths)){ |
|
| 417 | + if (!\is_array($widths)) { |
|
| 418 | 418 | $widths=\array_fill(0, $count, $widths); |
| 419 | 419 | } |
| 420 | - $max=\min(\sizeof($widths),$count); |
|
| 421 | - for($i=0;$i<$max;$i++){ |
|
| 420 | + $max=\min(\sizeof($widths), $count); |
|
| 421 | + for ($i=0; $i<$max; $i++) { |
|
| 422 | 422 | $part->getCell(0, $i)->setWidth($widths[$i]); |
| 423 | 423 | } |
| 424 | 424 | } |
| 425 | 425 | return $this; |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | - public function mergeIdentiqualValues($colIndex,$function="strip_tags"){ |
|
| 428 | + public function mergeIdentiqualValues($colIndex, $function="strip_tags") { |
|
| 429 | 429 | $body=$this->getBody(); |
| 430 | - $body->mergeIdentiqualValues($colIndex,$function); |
|
| 430 | + $body->mergeIdentiqualValues($colIndex, $function); |
|
| 431 | 431 | return $this; |
| 432 | 432 | } |
| 433 | 433 | } |
@@ -22,15 +22,17 @@ |
||
| 22 | 22 | |
| 23 | 23 | public function setBasic($very=false) { |
| 24 | 24 | $table=$this->_self; |
| 25 | - if ($very) |
|
| 26 | - $table->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 25 | + if ($very) { |
|
| 26 | + $table->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 27 | + } |
|
| 27 | 28 | return $table->addToPropertyCtrl("class", "basic", array ("basic" )); |
| 28 | 29 | } |
| 29 | 30 | |
| 30 | 31 | public function setCompact($very=false) { |
| 31 | 32 | $table=$this->_self; |
| 32 | - if ($very) |
|
| 33 | - $table->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 33 | + if ($very) { |
|
| 34 | + $table->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 35 | + } |
|
| 34 | 36 | return $table->addToPropertyCtrl("class", "compact", array ("compact" )); |
| 35 | 37 | } |
| 36 | 38 | |
@@ -7,12 +7,12 @@ discard block |
||
| 7 | 7 | * @author jc |
| 8 | 8 | * @property HtmlTable $_self |
| 9 | 9 | */ |
| 10 | -trait TableTrait{ |
|
| 10 | +trait TableTrait { |
|
| 11 | 11 | |
| 12 | 12 | abstract public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false); |
| 13 | 13 | abstract public function getOn($event, $url, $responseElement="", $parameters=array()); |
| 14 | 14 | |
| 15 | - protected function addToPropertyTable($property,$value){ |
|
| 15 | + protected function addToPropertyTable($property, $value) { |
|
| 16 | 16 | return $this->_self->addToProperty($property, $value); |
| 17 | 17 | } |
| 18 | 18 | |
@@ -23,15 +23,15 @@ discard block |
||
| 23 | 23 | public function setBasic($very=false) { |
| 24 | 24 | $table=$this->_self; |
| 25 | 25 | if ($very) |
| 26 | - $table->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 27 | - return $table->addToPropertyCtrl("class", "basic", array ("basic" )); |
|
| 26 | + $table->addToPropertyCtrl("class", "very", array("very")); |
|
| 27 | + return $table->addToPropertyCtrl("class", "basic", array("basic")); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | public function setCompact($very=false) { |
| 31 | 31 | $table=$this->_self; |
| 32 | 32 | if ($very) |
| 33 | - $table->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 34 | - return $table->addToPropertyCtrl("class", "compact", array ("compact" )); |
|
| 33 | + $table->addToPropertyCtrl("class", "very", array("very")); |
|
| 34 | + return $table->addToPropertyCtrl("class", "compact", array("compact")); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | public function setCollapsing() { |
@@ -70,16 +70,16 @@ discard block |
||
| 70 | 70 | return $this->addToPropertyTable("class", "striped"); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - public function onRowClick($jsCode, $stopPropagation=false, $preventDefault=false){ |
|
| 74 | - return $this->onRow("click", $jsCode,$stopPropagation,$preventDefault); |
|
| 73 | + public function onRowClick($jsCode, $stopPropagation=false, $preventDefault=false) { |
|
| 74 | + return $this->onRow("click", $jsCode, $stopPropagation, $preventDefault); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - public function onRow($event,$jsCode, $stopPropagation=false, $preventDefault=false){ |
|
| 78 | - return $this->_self->addEvent($event."{{tr}}",$jsCode,$stopPropagation,$preventDefault); |
|
| 77 | + public function onRow($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
|
| 78 | + return $this->_self->addEvent($event."{{tr}}", $jsCode, $stopPropagation, $preventDefault); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - public function getOnRow($event, $url, $responseElement="", $parameters=array()){ |
|
| 82 | - $parameters=\array_merge($parameters,["stopPropagation"=>false,"preventDefault"=>false]); |
|
| 83 | - return $this->_self->getOn($event."{{tbody tr}}", $url,$responseElement,$parameters); |
|
| 81 | + public function getOnRow($event, $url, $responseElement="", $parameters=array()) { |
|
| 82 | + $parameters=\array_merge($parameters, ["stopPropagation"=>false, "preventDefault"=>false]); |
|
| 83 | + return $this->_self->getOn($event."{{tbody tr}}", $url, $responseElement, $parameters); |
|
| 84 | 84 | } |
| 85 | 85 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $this->_generateFields($form, [$v], $headers, $i, $wrappers); |
| 64 | 64 | $i++; |
| 65 | 65 | } |
| 66 | - }else{ |
|
| 66 | + } else{ |
|
| 67 | 67 | $separators[]=$count; |
| 68 | 68 | for($i=0;$i<$size;$i++){ |
| 69 | 69 | $fields=\array_slice($values, $separators[$i]+1,$separators[$i+1]-$separators[$i]); |
@@ -74,17 +74,19 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | protected function _generateFields($form,$values,$headers,$sepFirst,$wrappers){ |
| 76 | 76 | $wrapper=null; |
| 77 | - if(isset($headers[$sepFirst+1])) |
|
| 78 | - $form->addHeader($headers[$sepFirst+1],4,true); |
|
| 77 | + if(isset($headers[$sepFirst+1])) { |
|
| 78 | + $form->addHeader($headers[$sepFirst+1],4,true); |
|
| 79 | + } |
|
| 79 | 80 | if(isset($wrappers[$sepFirst+1])){ |
| 80 | 81 | $wrapper=$wrappers[$sepFirst+1]; |
| 81 | 82 | } |
| 82 | 83 | if(\sizeof($values)===1){ |
| 83 | 84 | $added=$form->addField($values[0]); |
| 84 | - }elseif(\sizeof($values)>1){ |
|
| 85 | + } elseif(\sizeof($values)>1){ |
|
| 85 | 86 | $added=$form->addFields($values); |
| 86 | - }else |
|
| 87 | - return; |
|
| 87 | + } else { |
|
| 88 | + return; |
|
| 89 | + } |
|
| 88 | 90 | if(isset($wrapper)){ |
| 89 | 91 | $added->wrap($wrapper[0],$wrapper[1]); |
| 90 | 92 | } |
@@ -21,83 +21,83 @@ discard block |
||
| 21 | 21 | use BaseTrait; |
| 22 | 22 | |
| 23 | 23 | public function __construct($identifier, $modelInstance=NULL) { |
| 24 | - parent::__construct($identifier, null,$modelInstance); |
|
| 24 | + parent::__construct($identifier, null, $modelInstance); |
|
| 25 | 25 | $this->_form=new HtmlForm($identifier); |
| 26 | 26 | $this->_init(new FormInstanceViewer($identifier), "form", $this->_form, true); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - protected function _getFieldIdentifier($prefix,$name=""){ |
|
| 29 | + protected function _getFieldIdentifier($prefix, $name="") { |
|
| 30 | 30 | return $this->identifier."-{$name}-".$this->_instanceViewer->getIdentifier(); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
| 34 | - if(!$this->_generated){ |
|
| 33 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 34 | + if (!$this->_generated) { |
|
| 35 | 35 | $this->_instanceViewer->setInstance($this->_modelInstance); |
| 36 | 36 | |
| 37 | 37 | $form=$this->content["form"]; |
| 38 | 38 | $this->_generateContent($form); |
| 39 | 39 | |
| 40 | - if(isset($this->_toolbar)){ |
|
| 40 | + if (isset($this->_toolbar)) { |
|
| 41 | 41 | $this->_setToolbarPosition($form); |
| 42 | 42 | } |
| 43 | - $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"form",PositionInTable::AFTERTABLE]); |
|
| 43 | + $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "form", PositionInTable::AFTERTABLE]); |
|
| 44 | 44 | $this->_generated=true; |
| 45 | 45 | } |
| 46 | - return parent::compile($js,$view); |
|
| 46 | + return parent::compile($js, $view); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * @param HtmlForm $form |
| 51 | 51 | */ |
| 52 | - protected function _generateContent($form){ |
|
| 53 | - $values= $this->_instanceViewer->getValues(); |
|
| 52 | + protected function _generateContent($form) { |
|
| 53 | + $values=$this->_instanceViewer->getValues(); |
|
| 54 | 54 | $count=$this->_instanceViewer->count(); |
| 55 | 55 | $separators=$this->_instanceViewer->getSeparators(); |
| 56 | 56 | $headers=$this->_instanceViewer->getHeaders(); |
| 57 | 57 | $wrappers=$this->_instanceViewer->getWrappers(); |
| 58 | 58 | \sort($separators); |
| 59 | 59 | $size=\sizeof($separators); |
| 60 | - if($size===1){ |
|
| 60 | + if ($size===1) { |
|
| 61 | 61 | $i=-1; |
| 62 | - foreach ($values as $v){ |
|
| 62 | + foreach ($values as $v) { |
|
| 63 | 63 | $this->_generateFields($form, [$v], $headers, $i, $wrappers); |
| 64 | 64 | $i++; |
| 65 | 65 | } |
| 66 | - }else{ |
|
| 66 | + } else { |
|
| 67 | 67 | $separators[]=$count; |
| 68 | - for($i=0;$i<$size;$i++){ |
|
| 69 | - $fields=\array_slice($values, $separators[$i]+1,$separators[$i+1]-$separators[$i]); |
|
| 68 | + for ($i=0; $i<$size; $i++) { |
|
| 69 | + $fields=\array_slice($values, $separators[$i]+1, $separators[$i+1]-$separators[$i]); |
|
| 70 | 70 | $this->_generateFields($form, $fields, $headers, $separators[$i], $wrappers); |
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - protected function _generateFields($form,$values,$headers,$sepFirst,$wrappers){ |
|
| 75 | + protected function _generateFields($form, $values, $headers, $sepFirst, $wrappers) { |
|
| 76 | 76 | $wrapper=null; |
| 77 | - if(isset($headers[$sepFirst+1])) |
|
| 78 | - $form->addHeader($headers[$sepFirst+1],4,true); |
|
| 79 | - if(isset($wrappers[$sepFirst+1])){ |
|
| 77 | + if (isset($headers[$sepFirst+1])) |
|
| 78 | + $form->addHeader($headers[$sepFirst+1], 4, true); |
|
| 79 | + if (isset($wrappers[$sepFirst+1])) { |
|
| 80 | 80 | $wrapper=$wrappers[$sepFirst+1]; |
| 81 | 81 | } |
| 82 | - if(\sizeof($values)===1){ |
|
| 82 | + if (\sizeof($values)===1) { |
|
| 83 | 83 | $added=$form->addField($values[0]); |
| 84 | - }elseif(\sizeof($values)>1){ |
|
| 84 | + }elseif (\sizeof($values)>1) { |
|
| 85 | 85 | $added=$form->addFields($values); |
| 86 | - }else |
|
| 86 | + } else |
|
| 87 | 87 | return; |
| 88 | - if(isset($wrapper)){ |
|
| 89 | - $added->wrap($wrapper[0],$wrapper[1]); |
|
| 88 | + if (isset($wrapper)) { |
|
| 89 | + $added->wrap($wrapper[0], $wrapper[1]); |
|
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
| 94 | 94 | * @return HtmlForm |
| 95 | 95 | */ |
| 96 | - public function getForm(){ |
|
| 96 | + public function getForm() { |
|
| 97 | 97 | return $this->content["form"]; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - public function addSeparatorAfter($fieldNum){ |
|
| 100 | + public function addSeparatorAfter($fieldNum) { |
|
| 101 | 101 | $fieldNum=$this->_getIndex($fieldNum); |
| 102 | 102 | $this->_instanceViewer->addSeparatorAfter($fieldNum); |
| 103 | 103 | return $this; |
@@ -112,12 +112,12 @@ discard block |
||
| 112 | 112 | return $this; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - public function fieldAsReset($index,$cssStyle=NULL,$attributes=NULL){ |
|
| 116 | - return $this->_fieldAs(function($id,$name,$value) use ($cssStyle){ |
|
| 117 | - $button=new HtmlButton($id,$value,$cssStyle); |
|
| 115 | + public function fieldAsReset($index, $cssStyle=NULL, $attributes=NULL) { |
|
| 116 | + return $this->_fieldAs(function($id, $name, $value) use ($cssStyle){ |
|
| 117 | + $button=new HtmlButton($id, $value, $cssStyle); |
|
| 118 | 118 | $button->setProperty("type", "reset"); |
| 119 | 119 | return $button; |
| 120 | - }, $index,$attributes); |
|
| 120 | + }, $index, $attributes); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | /** |
@@ -136,19 +136,19 @@ discard block |
||
| 136 | 136 | $this->content[$this->_toolbarPosition]=$this->_toolbar; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - public function addDividerBefore($index,$title){ |
|
| 139 | + public function addDividerBefore($index, $title) { |
|
| 140 | 140 | $index=$this->_getIndex($index); |
| 141 | 141 | $this->_instanceViewer->addHeaderDividerBefore($index, $title); |
| 142 | 142 | return $this; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - public function addWrapper($index,$contentBefore,$contentAfter=null){ |
|
| 145 | + public function addWrapper($index, $contentBefore, $contentAfter=null) { |
|
| 146 | 146 | $index=$this->_getIndex($index); |
| 147 | - $this->_instanceViewer->addWrapper($index, $contentBefore,$contentAfter); |
|
| 147 | + $this->_instanceViewer->addWrapper($index, $contentBefore, $contentAfter); |
|
| 148 | 148 | return $this; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - public function run(JsUtils $js){ |
|
| 151 | + public function run(JsUtils $js) { |
|
| 152 | 152 | parent::run($js); |
| 153 | 153 | } |
| 154 | 154 | } |
@@ -8,11 +8,11 @@ |
||
| 8 | 8 | class HtmlCardGroups extends HtmlViewGroups { |
| 9 | 9 | |
| 10 | 10 | public function __construct($identifier, $cards=array()) { |
| 11 | - parent::__construct($identifier, "ui cards",$cards); |
|
| 11 | + parent::__construct($identifier, "ui cards", $cards); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | - protected function createElement(){ |
|
| 15 | - return new HtmlCard("card-" . $this->count()); |
|
| 14 | + protected function createElement() { |
|
| 15 | + return new HtmlCard("card-".$this->count()); |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | public function newItem($identifier) { |
@@ -9,11 +9,11 @@ |
||
| 9 | 9 | class HtmlItems extends HtmlViewGroups { |
| 10 | 10 | |
| 11 | 11 | public function __construct($identifier, $items=[]) { |
| 12 | - parent::__construct($identifier, "ui items",$items); |
|
| 12 | + parent::__construct($identifier, "ui items", $items); |
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | - protected function createElement(){ |
|
| 16 | - return new HtmlItem("item-" . $this->count()); |
|
| 15 | + protected function createElement() { |
|
| 16 | + return new HtmlItem("item-".$this->count()); |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | public function newItem($identifier) { |
@@ -6,24 +6,24 @@ |
||
| 6 | 6 | * @author jc |
| 7 | 7 | * @property mixed $content |
| 8 | 8 | */ |
| 9 | -trait ContentPartTrait{ |
|
| 10 | - public function addElementInPart($element,$partKey,$before=false,$force=false){ |
|
| 11 | - $part=$this->getPart($partKey,null,$force); |
|
| 12 | - if($part instanceof HtmlSemDoubleElement){ |
|
| 9 | +trait ContentPartTrait { |
|
| 10 | + public function addElementInPart($element, $partKey, $before=false, $force=false) { |
|
| 11 | + $part=$this->getPart($partKey, null, $force); |
|
| 12 | + if ($part instanceof HtmlSemDoubleElement) { |
|
| 13 | 13 | $this->content[$partKey]=$part; |
| 14 | - $part->addContent($element,$before); |
|
| 14 | + $part->addContent($element, $before); |
|
| 15 | 15 | } |
| 16 | 16 | return $this; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - public function getPart($partKey, $index=NULL,$force=false) { |
|
| 19 | + public function getPart($partKey, $index=NULL, $force=false) { |
|
| 20 | 20 | if (\array_key_exists($partKey, $this->content)) { |
| 21 | 21 | if (isset($index)) |
| 22 | 22 | return $this->content[$partKey][$index]; |
| 23 | 23 | return $this->content[$partKey]; |
| 24 | 24 | } |
| 25 | - if($force){ |
|
| 26 | - return new HtmlSemDoubleElement($partKey."-".$this->identifier,"div",$partKey); |
|
| 25 | + if ($force) { |
|
| 26 | + return new HtmlSemDoubleElement($partKey."-".$this->identifier, "div", $partKey); |
|
| 27 | 27 | } |
| 28 | 28 | return NULL; |
| 29 | 29 | } |
@@ -18,8 +18,9 @@ |
||
| 18 | 18 | |
| 19 | 19 | public function getPart($partKey, $index=NULL,$force=false) { |
| 20 | 20 | if (\array_key_exists($partKey, $this->content)) { |
| 21 | - if (isset($index)) |
|
| 22 | - return $this->content[$partKey][$index]; |
|
| 21 | + if (isset($index)) { |
|
| 22 | + return $this->content[$partKey][$index]; |
|
| 23 | + } |
|
| 23 | 24 | return $this->content[$partKey]; |
| 24 | 25 | } |
| 25 | 26 | if($force){ |
@@ -19,8 +19,9 @@ discard block |
||
| 19 | 19 | public function __construct($identifier,$baseClass,$content=NULL) { |
| 20 | 20 | parent::__construct($identifier, "div", $baseClass); |
| 21 | 21 | $this->content=["content"=>new HtmlViewContent("content-".$this->identifier)]; |
| 22 | - if(isset($content)) |
|
| 23 | - $this->setContent($content); |
|
| 22 | + if(isset($content)) { |
|
| 23 | + $this->setContent($content); |
|
| 24 | + } |
|
| 24 | 25 | } |
| 25 | 26 | |
| 26 | 27 | public function setContent($value){ |
@@ -31,10 +32,12 @@ discard block |
||
| 31 | 32 | if (isset($image)) { |
| 32 | 33 | $this->addImage($image); |
| 33 | 34 | } |
| 34 | - if(isset($content)) |
|
| 35 | - $this->content["content"]->setContent($content); |
|
| 36 | - if(isset($extra)) |
|
| 37 | - $this->addExtraContent($extra); |
|
| 35 | + if(isset($content)) { |
|
| 36 | + $this->content["content"]->setContent($content); |
|
| 37 | + } |
|
| 38 | + if(isset($extra)) { |
|
| 39 | + $this->addExtraContent($extra); |
|
| 40 | + } |
|
| 38 | 41 | } |
| 39 | 42 | } |
| 40 | 43 | |
@@ -49,10 +52,11 @@ discard block |
||
| 49 | 52 | if (\array_key_exists($key, $this->content) === false) { |
| 50 | 53 | $this->content[$key]=[]; |
| 51 | 54 | } |
| 52 | - if($this->content[$key] instanceof HtmlViewContent) |
|
| 53 | - $this->content[$key]->addElement($element); |
|
| 54 | - else |
|
| 55 | - $this->content[$key][]=$element; |
|
| 55 | + if($this->content[$key] instanceof HtmlViewContent) { |
|
| 56 | + $this->content[$key]->addElement($element); |
|
| 57 | + } else { |
|
| 58 | + $this->content[$key][]=$element; |
|
| 59 | + } |
|
| 56 | 60 | return $element; |
| 57 | 61 | } |
| 58 | 62 | |
@@ -153,8 +157,9 @@ discard block |
||
| 153 | 157 | $this->addToProperty("class", "link"); |
| 154 | 158 | if ($href !== "") { |
| 155 | 159 | $this->setProperty("href", $href); |
| 156 | - if (isset($target)) |
|
| 157 | - $this->setProperty("target", $target); |
|
| 160 | + if (isset($target)) { |
|
| 161 | + $this->setProperty("target", $target); |
|
| 162 | + } |
|
| 158 | 163 | } |
| 159 | 164 | return $this; |
| 160 | 165 | } |
@@ -16,14 +16,14 @@ discard block |
||
| 16 | 16 | abstract class HtmlViewItem extends HtmlSemDoubleElement { |
| 17 | 17 | use ContentPartTrait; |
| 18 | 18 | |
| 19 | - public function __construct($identifier,$baseClass,$content=NULL) { |
|
| 19 | + public function __construct($identifier, $baseClass, $content=NULL) { |
|
| 20 | 20 | parent::__construct($identifier, "div", $baseClass); |
| 21 | 21 | $this->content=["content"=>new HtmlViewContent("content-".$this->identifier)]; |
| 22 | - if(isset($content)) |
|
| 22 | + if (isset($content)) |
|
| 23 | 23 | $this->setContent($content); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function setContent($value){ |
|
| 26 | + public function setContent($value) { |
|
| 27 | 27 | if (\is_array($value)) { |
| 28 | 28 | $image=JArray::getValue($value, "image", 0); |
| 29 | 29 | $content=JArray::getValue($value, "content", 1); |
@@ -31,57 +31,57 @@ discard block |
||
| 31 | 31 | if (isset($image)) { |
| 32 | 32 | $this->addImage($image); |
| 33 | 33 | } |
| 34 | - if(isset($content)) |
|
| 34 | + if (isset($content)) |
|
| 35 | 35 | $this->content["content"]->setContent($content); |
| 36 | - if(isset($extra)) |
|
| 36 | + if (isset($extra)) |
|
| 37 | 37 | $this->addExtraContent($extra); |
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | private function createContent($content, $baseClass="content") { |
| 42 | 42 | $count=\sizeof($this->content); |
| 43 | - $result=new HtmlViewContent("content-" . $count . "-" . $this->identifier, $content); |
|
| 43 | + $result=new HtmlViewContent("content-".$count."-".$this->identifier, $content); |
|
| 44 | 44 | $result->setClass($baseClass); |
| 45 | 45 | return $result; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | private function addElementIn($key, $element) { |
| 49 | - if (\array_key_exists($key, $this->content) === false) { |
|
| 49 | + if (\array_key_exists($key, $this->content)===false) { |
|
| 50 | 50 | $this->content[$key]=[]; |
| 51 | 51 | } |
| 52 | - if($this->content[$key] instanceof HtmlViewContent) |
|
| 52 | + if ($this->content[$key] instanceof HtmlViewContent) |
|
| 53 | 53 | $this->content[$key]->addElement($element); |
| 54 | 54 | else |
| 55 | 55 | $this->content[$key][]=$element; |
| 56 | 56 | return $element; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - public function addIcon($icon,$before=true){ |
|
| 60 | - return $this->addElementIn("icon",new HtmlIcon("icon-" . $this->identifier, $icon)); |
|
| 59 | + public function addIcon($icon, $before=true) { |
|
| 60 | + return $this->addElementIn("icon", new HtmlIcon("icon-".$this->identifier, $icon)); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | |
| 64 | 64 | public function addHeader($header, $niveau=4, $type="page") { |
| 65 | 65 | if (!$header instanceof HtmlHeader) { |
| 66 | - $header=new HtmlHeader("header-" . $this->identifier, $niveau, $header, $type); |
|
| 66 | + $header=new HtmlHeader("header-".$this->identifier, $niveau, $header, $type); |
|
| 67 | 67 | } |
| 68 | - return $this->addElementIn("header",$this->createContent($header)); |
|
| 68 | + return $this->addElementIn("header", $this->createContent($header)); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | public function addImage($image, $title="") { |
| 72 | 72 | if (!$image instanceof HtmlImage) { |
| 73 | - $image=new HtmlImage("image-" . $this->identifier, $image, $title); |
|
| 73 | + $image=new HtmlImage("image-".$this->identifier, $image, $title); |
|
| 74 | 74 | } |
| 75 | 75 | $image->setClass("ui image"); |
| 76 | - return $this->content["image"]= $image; |
|
| 76 | + return $this->content["image"]=$image; |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - public function addReveal($visibleContent, $hiddenContent=NULL, $type=RevealType::FADE, $attributeType=NULL,$key="extra-content") { |
|
| 79 | + public function addReveal($visibleContent, $hiddenContent=NULL, $type=RevealType::FADE, $attributeType=NULL, $key="extra-content") { |
|
| 80 | 80 | $reveal=$visibleContent; |
| 81 | 81 | if (!$visibleContent instanceof HtmlReveal) { |
| 82 | - $reveal=new HtmlReveal("reveral-" . $this->identifier, $visibleContent, $hiddenContent, $type, $attributeType); |
|
| 82 | + $reveal=new HtmlReveal("reveral-".$this->identifier, $visibleContent, $hiddenContent, $type, $attributeType); |
|
| 83 | 83 | } |
| 84 | - return $this->content[$key]= $reveal; |
|
| 84 | + return $this->content[$key]=$reveal; |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | public function addRevealImage($visibleContent, $hiddenContent=NULL, $type=RevealType::FADE, $attributeType=NULL) { |
@@ -89,11 +89,11 @@ discard block |
||
| 89 | 89 | if (!$visibleContent instanceof HtmlReveal) { |
| 90 | 90 | return $this->addReveal(new HtmlImage("", $visibleContent), new HtmlImage("", $hiddenContent), $type, $attributeType); |
| 91 | 91 | } |
| 92 | - return $this->content["image"]= $reveal; |
|
| 92 | + return $this->content["image"]=$reveal; |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | public function addExtraContent($content=array()) { |
| 96 | - return $this->content["extra-content"]= $this->createContent($content, "extra content"); |
|
| 96 | + return $this->content["extra-content"]=$this->createContent($content, "extra content"); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
@@ -103,23 +103,23 @@ discard block |
||
| 103 | 103 | * @param boolean $before |
| 104 | 104 | * @return HtmlButtonGroups |
| 105 | 105 | */ |
| 106 | - public function addContentButtons($elements=array(), $asIcons=false,$part="extra",$before=false){ |
|
| 107 | - return $this->content["content"]->addContentButtons($elements,$asIcons,$part, $before); |
|
| 106 | + public function addContentButtons($elements=array(), $asIcons=false, $part="extra", $before=false) { |
|
| 107 | + return $this->content["content"]->addContentButtons($elements, $asIcons, $part, $before); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | |
| 111 | 111 | |
| 112 | - public function addItemHeaderContent($header, $metas=array(), $description=NULL,$extra=NULL) { |
|
| 113 | - return $this->content["content"]->addHeaderContent($header, $metas, $description,$extra); |
|
| 112 | + public function addItemHeaderContent($header, $metas=array(), $description=NULL, $extra=NULL) { |
|
| 113 | + return $this->content["content"]->addHeaderContent($header, $metas, $description, $extra); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | public function addItemContent($content=array()) { |
| 117 | 117 | $count=\sizeof($this->content); |
| 118 | - return $this->addElementIn("content", new HtmlViewContent("content-" . $count . "-" . $this->identifier, $content)); |
|
| 118 | + return $this->addElementIn("content", new HtmlViewContent("content-".$count."-".$this->identifier, $content)); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | public function getItemContent() { |
| 122 | - return $this->getPart("content",null,true); |
|
| 122 | + return $this->getPart("content", null, true); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | public function getItemExtraContent() { |
@@ -141,13 +141,13 @@ discard block |
||
| 141 | 141 | * @see HtmlSemDoubleElement::compile() |
| 142 | 142 | */ |
| 143 | 143 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 144 | - $this->content=JArray::sortAssociative($this->content, ["header","image","icon","content","extra-content"]); |
|
| 144 | + $this->content=JArray::sortAssociative($this->content, ["header", "image", "icon", "content", "extra-content"]); |
|
| 145 | 145 | return parent::compile($js, $view); |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - public function asLink($href="",$target=NULL) { |
|
| 148 | + public function asLink($href="", $target=NULL) { |
|
| 149 | 149 | $this->addToProperty("class", "link"); |
| 150 | - if ($href !== "") { |
|
| 150 | + if ($href!=="") { |
|
| 151 | 151 | $this->setProperty("href", $href); |
| 152 | 152 | if (isset($target)) |
| 153 | 153 | $this->setProperty("target", $target); |
@@ -64,8 +64,7 @@ discard block |
||
| 64 | 64 | $rules=$attributes["rules"]; |
| 65 | 65 | if(\is_array($rules)){ |
| 66 | 66 | $element->addRules($rules); |
| 67 | - } |
|
| 68 | - else{ |
|
| 67 | + } else{ |
|
| 69 | 68 | $element->addRule($rules); |
| 70 | 69 | } |
| 71 | 70 | unset($attributes["rules"]); |
@@ -117,8 +116,9 @@ discard block |
||
| 117 | 116 | public function fieldAsLabel($index,$icon=NULL,$attributes=NULL){ |
| 118 | 117 | return $this->_fieldAs(function($id,$name,$value) use($icon){ |
| 119 | 118 | $lbl=new HtmlLabel($id,$value); |
| 120 | - if(isset($icon)) |
|
| 121 | - $lbl->addIcon($icon); |
|
| 119 | + if(isset($icon)) { |
|
| 120 | + $lbl->addIcon($icon); |
|
| 121 | + } |
|
| 122 | 122 | return $lbl; |
| 123 | 123 | }, $index,$attributes,"label"); |
| 124 | 124 | } |
@@ -126,8 +126,9 @@ discard block |
||
| 126 | 126 | public function fieldAsHeader($index,$niveau=1,$icon=NULL,$attributes=NULL){ |
| 127 | 127 | return $this->_fieldAs(function($id,$name,$value) use($niveau,$icon){ |
| 128 | 128 | $header=new HtmlHeader($id,$niveau,$value); |
| 129 | - if(isset($icon)) |
|
| 130 | - $header->asIcon($icon, $value); |
|
| 129 | + if(isset($icon)) { |
|
| 130 | + $header->asIcon($icon, $value); |
|
| 131 | + } |
|
| 131 | 132 | return $header; |
| 132 | 133 | }, $index,$attributes,"header"); |
| 133 | 134 | } |
@@ -135,7 +136,9 @@ discard block |
||
| 135 | 136 | |
| 136 | 137 | public function fieldAsImage($index,$size=Size::MINI,$circular=false){ |
| 137 | 138 | $this->setValueFunction($index,function($img) use($size,$circular){ |
| 138 | - $image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular(); |
|
| 139 | + $image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular) { |
|
| 140 | + $image->setCircular(); |
|
| 141 | + } |
|
| 139 | 142 | return $image; |
| 140 | 143 | }); |
| 141 | 144 | return $this; |
@@ -194,8 +197,9 @@ discard block |
||
| 194 | 197 | |
| 195 | 198 | public function fieldAsCheckbox($index,$attributes=NULL){ |
| 196 | 199 | return $this->_fieldAs(function($id,$name,$value,$caption) use($attributes){ |
| 197 | - if($caption===null || $caption==="") |
|
| 198 | - $caption=""; |
|
| 200 | + if($caption===null || $caption==="") { |
|
| 201 | + $caption=""; |
|
| 202 | + } |
|
| 199 | 203 | $input=new HtmlFormCheckbox($id,$caption,$this->_instanceViewer->getIdentifier()); |
| 200 | 204 | $input->setChecked(JString::isBooleanTrue($value)); |
| 201 | 205 | return $this->_prepareFormFields($input, $name, $attributes); |
@@ -232,14 +236,14 @@ discard block |
||
| 232 | 236 | $i=0; |
| 233 | 237 | if(JArray::isAssociative($types)){ |
| 234 | 238 | foreach ($types as $type=>$attributes){ |
| 235 | - if(\is_int($type)) |
|
| 236 | - $this->fieldAs($i++,$attributes,[]); |
|
| 237 | - else{ |
|
| 239 | + if(\is_int($type)) { |
|
| 240 | + $this->fieldAs($i++,$attributes,[]); |
|
| 241 | + } else{ |
|
| 238 | 242 | $type=preg_replace('/\d/', '', $type ); |
| 239 | 243 | $this->fieldAs($i++,$type,$attributes); |
| 240 | 244 | } |
| 241 | 245 | } |
| 242 | - }else{ |
|
| 246 | + } else{ |
|
| 243 | 247 | foreach ($types as $type){ |
| 244 | 248 | $this->fieldAs($i++,$type); |
| 245 | 249 | } |
@@ -251,7 +255,7 @@ discard block |
||
| 251 | 255 | if(\method_exists($this, $method)){ |
| 252 | 256 | if(!\is_array($attributes)){ |
| 253 | 257 | $attributes=[$index]; |
| 254 | - }else{ |
|
| 258 | + } else{ |
|
| 255 | 259 | \array_unshift($attributes, $index); |
| 256 | 260 | } |
| 257 | 261 | \call_user_func_array([$this,$method], $attributes); |
@@ -30,23 +30,23 @@ discard block |
||
| 30 | 30 | * @property boolean $_edition |
| 31 | 31 | * @property mixed _modelInstance |
| 32 | 32 | */ |
| 33 | -trait FieldAsTrait{ |
|
| 33 | +trait FieldAsTrait { |
|
| 34 | 34 | |
| 35 | - abstract protected function _getFieldIdentifier($prefix,$name=""); |
|
| 36 | - abstract public function setValueFunction($index,$callback); |
|
| 35 | + abstract protected function _getFieldIdentifier($prefix, $name=""); |
|
| 36 | + abstract public function setValueFunction($index, $callback); |
|
| 37 | 37 | abstract protected function _getFieldName($index); |
| 38 | 38 | abstract protected function _getFieldCaption($index); |
| 39 | - abstract protected function _buttonAsSubmit(BaseHtml &$button,$event,$url,$responseElement=NULL,$parameters=NULL); |
|
| 39 | + abstract protected function _buttonAsSubmit(BaseHtml &$button, $event, $url, $responseElement=NULL, $parameters=NULL); |
|
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | 42 | * @param HtmlFormField $element |
| 43 | 43 | * @param array $attributes |
| 44 | 44 | */ |
| 45 | - protected function _applyAttributes(BaseHtml $element,&$attributes,$index,$instance=null){ |
|
| 46 | - if(isset($attributes["jsCallback"])){ |
|
| 45 | + protected function _applyAttributes(BaseHtml $element, &$attributes, $index, $instance=null) { |
|
| 46 | + if (isset($attributes["jsCallback"])) { |
|
| 47 | 47 | $callback=$attributes["jsCallback"]; |
| 48 | - if(\is_callable($callback)){ |
|
| 49 | - $callback($element,$instance,$index,InstanceViewer::$index); |
|
| 48 | + if (\is_callable($callback)) { |
|
| 49 | + $callback($element, $instance, $index, InstanceViewer::$index); |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | unset($attributes["rules"]); |
@@ -55,43 +55,43 @@ discard block |
||
| 55 | 55 | $element->fromArray($attributes); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - private function _getLabelField($caption,$icon=NULL){ |
|
| 59 | - $label=new HtmlLabel($this->_getFieldIdentifier("lbl"),$caption,$icon); |
|
| 58 | + private function _getLabelField($caption, $icon=NULL) { |
|
| 59 | + $label=new HtmlLabel($this->_getFieldIdentifier("lbl"), $caption, $icon); |
|
| 60 | 60 | return $label; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | |
| 64 | - protected function _addRules(HtmlFormField $element,&$attributes){ |
|
| 65 | - if(isset($attributes["rules"])){ |
|
| 64 | + protected function _addRules(HtmlFormField $element, &$attributes) { |
|
| 65 | + if (isset($attributes["rules"])) { |
|
| 66 | 66 | $rules=$attributes["rules"]; |
| 67 | - if(\is_array($rules)){ |
|
| 67 | + if (\is_array($rules)) { |
|
| 68 | 68 | $element->addRules($rules); |
| 69 | 69 | } |
| 70 | - else{ |
|
| 70 | + else { |
|
| 71 | 71 | $element->addRule($rules); |
| 72 | 72 | } |
| 73 | 73 | unset($attributes["rules"]); |
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - protected function _prepareFormFields(HtmlFormField &$field,$name,&$attributes){ |
|
| 77 | + protected function _prepareFormFields(HtmlFormField &$field, $name, &$attributes) { |
|
| 78 | 78 | $field->setName($name); |
| 79 | 79 | $this->_addRules($field, $attributes); |
| 80 | 80 | return $field; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - protected function _fieldAs($elementCallback,&$index,$attributes=NULL,$prefix=null){ |
|
| 84 | - $this->setValueFunction($index,function($value,$instance,$index,$rowIndex) use (&$attributes,$elementCallback,$prefix){ |
|
| 83 | + protected function _fieldAs($elementCallback, &$index, $attributes=NULL, $prefix=null) { |
|
| 84 | + $this->setValueFunction($index, function($value, $instance, $index, $rowIndex) use (&$attributes, $elementCallback, $prefix){ |
|
| 85 | 85 | $caption=$this->_getFieldCaption($index); |
| 86 | 86 | $name=$this->_getFieldName($index); |
| 87 | - $id=$this->_getFieldIdentifier($prefix,$name); |
|
| 88 | - if(isset($attributes["name"])){ |
|
| 87 | + $id=$this->_getFieldIdentifier($prefix, $name); |
|
| 88 | + if (isset($attributes["name"])) { |
|
| 89 | 89 | $name=$attributes["name"]; |
| 90 | 90 | unset($attributes["name"]); |
| 91 | 91 | } |
| 92 | - $element=$elementCallback($id,$name,$value,$caption); |
|
| 93 | - if(\is_array($attributes)){ |
|
| 94 | - $this->_applyAttributes($element, $attributes,$index,$instance); |
|
| 92 | + $element=$elementCallback($id, $name, $value, $caption); |
|
| 93 | + if (\is_array($attributes)) { |
|
| 94 | + $this->_applyAttributes($element, $attributes, $index, $instance); |
|
| 95 | 95 | } |
| 96 | 96 | $element->setDisabled(!$this->_edition); |
| 97 | 97 | return $element; |
@@ -100,197 +100,197 @@ discard block |
||
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | |
| 103 | - public function fieldAsProgress($index,$label=NULL, $attributes=array()){ |
|
| 104 | - $this->setValueFunction($index,function($value) use($label,$attributes){ |
|
| 105 | - $pb=new HtmlProgress($this->_getFieldIdentifier("pb"),$value,$label,$attributes); |
|
| 103 | + public function fieldAsProgress($index, $label=NULL, $attributes=array()) { |
|
| 104 | + $this->setValueFunction($index, function($value) use($label, $attributes){ |
|
| 105 | + $pb=new HtmlProgress($this->_getFieldIdentifier("pb"), $value, $label, $attributes); |
|
| 106 | 106 | return $pb; |
| 107 | 107 | }); |
| 108 | 108 | return $this; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - public function fieldAsRating($index,$max=5, $icon=""){ |
|
| 112 | - $this->setValueFunction($index,function($value) use($max,$icon){ |
|
| 113 | - $rating=new HtmlRating($this->_getFieldIdentifier("rat"),$value,$max,$icon); |
|
| 111 | + public function fieldAsRating($index, $max=5, $icon="") { |
|
| 112 | + $this->setValueFunction($index, function($value) use($max, $icon){ |
|
| 113 | + $rating=new HtmlRating($this->_getFieldIdentifier("rat"), $value, $max, $icon); |
|
| 114 | 114 | return $rating; |
| 115 | 115 | }); |
| 116 | 116 | return $this; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - public function fieldAsLabel($index,$icon=NULL,$attributes=NULL){ |
|
| 120 | - return $this->_fieldAs(function($id,$name,$value) use($icon){ |
|
| 121 | - $lbl=new HtmlLabel($id,$value); |
|
| 122 | - if(isset($icon)) |
|
| 119 | + public function fieldAsLabel($index, $icon=NULL, $attributes=NULL) { |
|
| 120 | + return $this->_fieldAs(function($id, $name, $value) use($icon){ |
|
| 121 | + $lbl=new HtmlLabel($id, $value); |
|
| 122 | + if (isset($icon)) |
|
| 123 | 123 | $lbl->addIcon($icon); |
| 124 | 124 | return $lbl; |
| 125 | - }, $index,$attributes,"label"); |
|
| 125 | + }, $index, $attributes, "label"); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - public function fieldAsHeader($index,$niveau=1,$icon=NULL,$attributes=NULL){ |
|
| 129 | - return $this->_fieldAs(function($id,$name,$value) use($niveau,$icon){ |
|
| 130 | - $header=new HtmlHeader($id,$niveau,$value); |
|
| 131 | - if(isset($icon)) |
|
| 128 | + public function fieldAsHeader($index, $niveau=1, $icon=NULL, $attributes=NULL) { |
|
| 129 | + return $this->_fieldAs(function($id, $name, $value) use($niveau, $icon){ |
|
| 130 | + $header=new HtmlHeader($id, $niveau, $value); |
|
| 131 | + if (isset($icon)) |
|
| 132 | 132 | $header->asIcon($icon, $value); |
| 133 | 133 | return $header; |
| 134 | - }, $index,$attributes,"header"); |
|
| 134 | + }, $index, $attributes, "header"); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | |
| 138 | - public function fieldAsImage($index,$size=Size::MINI,$circular=false){ |
|
| 139 | - $this->setValueFunction($index,function($img) use($size,$circular){ |
|
| 140 | - $image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular(); |
|
| 138 | + public function fieldAsImage($index, $size=Size::MINI, $circular=false) { |
|
| 139 | + $this->setValueFunction($index, function($img) use($size, $circular){ |
|
| 140 | + $image=new HtmlImage($this->_getFieldIdentifier("image"), $img); $image->setSize($size); if ($circular)$image->setCircular(); |
|
| 141 | 141 | return $image; |
| 142 | 142 | }); |
| 143 | 143 | return $this; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - public function fieldAsFlag($index){ |
|
| 147 | - $this->setValueFunction($index,function($flag){ |
|
| 148 | - $flag=new HtmlFlag($this->_getFieldIdentifier("flag"),$flag); |
|
| 146 | + public function fieldAsFlag($index) { |
|
| 147 | + $this->setValueFunction($index, function($flag) { |
|
| 148 | + $flag=new HtmlFlag($this->_getFieldIdentifier("flag"), $flag); |
|
| 149 | 149 | return $flag; |
| 150 | 150 | }); |
| 151 | 151 | return $this; |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - public function fieldAsIcon($index){ |
|
| 155 | - $this->setValueFunction($index,function($icon){ |
|
| 156 | - $icon=new HtmlIcon($this->_getFieldIdentifier("icon"),$icon); |
|
| 154 | + public function fieldAsIcon($index) { |
|
| 155 | + $this->setValueFunction($index, function($icon) { |
|
| 156 | + $icon=new HtmlIcon($this->_getFieldIdentifier("icon"), $icon); |
|
| 157 | 157 | return $icon; |
| 158 | 158 | }); |
| 159 | 159 | return $this; |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - public function fieldAsAvatar($index,$attributes=NULL){ |
|
| 163 | - return $this->_fieldAs(function($id,$name,$value){ |
|
| 164 | - $img=new HtmlImage($id,$value); |
|
| 162 | + public function fieldAsAvatar($index, $attributes=NULL) { |
|
| 163 | + return $this->_fieldAs(function($id, $name, $value) { |
|
| 164 | + $img=new HtmlImage($id, $value); |
|
| 165 | 165 | $img->asAvatar(); |
| 166 | 166 | return $img; |
| 167 | - }, $index,$attributes,"avatar"); |
|
| 167 | + }, $index, $attributes, "avatar"); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - public function fieldAsRadio($index,$attributes=NULL){ |
|
| 171 | - return $this->_fieldAs(function($id,$name,$value) use($attributes){ |
|
| 172 | - $input= new HtmlFormRadio($id,$name,$value,$value); |
|
| 170 | + public function fieldAsRadio($index, $attributes=NULL) { |
|
| 171 | + return $this->_fieldAs(function($id, $name, $value) use($attributes){ |
|
| 172 | + $input=new HtmlFormRadio($id, $name, $value, $value); |
|
| 173 | 173 | return $this->_prepareFormFields($input, $name, $attributes); |
| 174 | - }, $index,$attributes,"radio"); |
|
| 174 | + }, $index, $attributes, "radio"); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - public function fieldAsRadios($index,$elements=[],$attributes=NULL){ |
|
| 178 | - return $this->_fieldAs(function($id,$name,$value,$caption) use ($elements){ |
|
| 179 | - return HtmlFormFields::radios($name,$elements,$caption,$value); |
|
| 180 | - }, $index,$attributes,"radios"); |
|
| 177 | + public function fieldAsRadios($index, $elements=[], $attributes=NULL) { |
|
| 178 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($elements){ |
|
| 179 | + return HtmlFormFields::radios($name, $elements, $caption, $value); |
|
| 180 | + }, $index, $attributes, "radios"); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - public function fieldAsInput($index,$attributes=NULL){ |
|
| 184 | - return $this->_fieldAs(function($id,$name,$value,$caption) use ($attributes){ |
|
| 185 | - $input= new HtmlFormInput($id,$caption,"text",$value); |
|
| 183 | + public function fieldAsInput($index, $attributes=NULL) { |
|
| 184 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes){ |
|
| 185 | + $input=new HtmlFormInput($id, $caption, "text", $value); |
|
| 186 | 186 | return $this->_prepareFormFields($input, $name, $attributes); |
| 187 | - }, $index,$attributes,"input"); |
|
| 187 | + }, $index, $attributes, "input"); |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | - public function fieldAsTextarea($index,$attributes=NULL){ |
|
| 191 | - return $this->_fieldAs(function($id,$name,$value,$caption) use ($attributes){ |
|
| 192 | - $textarea=new HtmlFormTextarea($id,$caption,$value); |
|
| 190 | + public function fieldAsTextarea($index, $attributes=NULL) { |
|
| 191 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes){ |
|
| 192 | + $textarea=new HtmlFormTextarea($id, $caption, $value); |
|
| 193 | 193 | return $this->_prepareFormFields($textarea, $name, $attributes); |
| 194 | - }, $index,$attributes,"textarea"); |
|
| 194 | + }, $index, $attributes, "textarea"); |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - public function fieldAsElement($index,$tagName="div",$baseClass="",$attributes=NULL){ |
|
| 198 | - return $this->_fieldAs(function($id,$name,$value,$caption) use ($attributes,$tagName,$baseClass){ |
|
| 199 | - $div=new HtmlSemDoubleElement($id,$tagName,$baseClass); |
|
| 197 | + public function fieldAsElement($index, $tagName="div", $baseClass="", $attributes=NULL) { |
|
| 198 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes, $tagName, $baseClass){ |
|
| 199 | + $div=new HtmlSemDoubleElement($id, $tagName, $baseClass); |
|
| 200 | 200 | $div->setContent(\htmlentities($value)); |
| 201 | - $textarea=new HtmlFormField("field-".$id, $div,$caption); |
|
| 201 | + $textarea=new HtmlFormField("field-".$id, $div, $caption); |
|
| 202 | 202 | return $this->_prepareFormFields($textarea, $name, $attributes); |
| 203 | - }, $index,$attributes,"element"); |
|
| 203 | + }, $index, $attributes, "element"); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | |
| 207 | - public function fieldAsHidden($index,$attributes=NULL){ |
|
| 208 | - if(!\is_array($attributes)){ |
|
| 207 | + public function fieldAsHidden($index, $attributes=NULL) { |
|
| 208 | + if (!\is_array($attributes)) { |
|
| 209 | 209 | $attributes=[]; |
| 210 | 210 | } |
| 211 | 211 | $attributes["inputType"]="hidden"; |
| 212 | 212 | $attributes["style"]="display:none;"; |
| 213 | - return $this->fieldAsInput($index,$attributes); |
|
| 213 | + return $this->fieldAsInput($index, $attributes); |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | - public function fieldAsCheckbox($index,$attributes=NULL){ |
|
| 217 | - return $this->_fieldAs(function($id,$name,$value,$caption) use($attributes){ |
|
| 218 | - if($caption===null || $caption==="") |
|
| 216 | + public function fieldAsCheckbox($index, $attributes=NULL) { |
|
| 217 | + return $this->_fieldAs(function($id, $name, $value, $caption) use($attributes){ |
|
| 218 | + if ($caption===null || $caption==="") |
|
| 219 | 219 | $caption=""; |
| 220 | - $input=new HtmlFormCheckbox($id,$caption,$this->_instanceViewer->getIdentifier()); |
|
| 220 | + $input=new HtmlFormCheckbox($id, $caption, $this->_instanceViewer->getIdentifier()); |
|
| 221 | 221 | $input->setChecked(JString::isBooleanTrue($value)); |
| 222 | 222 | return $this->_prepareFormFields($input, $name, $attributes); |
| 223 | - }, $index,$attributes,"ck"); |
|
| 223 | + }, $index, $attributes, "ck"); |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - public function fieldAsDropDown($index,$elements=[],$multiple=false,$attributes=NULL){ |
|
| 227 | - return $this->_fieldAs(function($id,$name,$value,$caption) use($elements,$multiple,$attributes){ |
|
| 228 | - $dd=new HtmlFormDropdown($id,$elements,$caption,$value); |
|
| 229 | - $dd->asSelect($name,$multiple); |
|
| 226 | + public function fieldAsDropDown($index, $elements=[], $multiple=false, $attributes=NULL) { |
|
| 227 | + return $this->_fieldAs(function($id, $name, $value, $caption) use($elements, $multiple, $attributes){ |
|
| 228 | + $dd=new HtmlFormDropdown($id, $elements, $caption, $value); |
|
| 229 | + $dd->asSelect($name, $multiple); |
|
| 230 | 230 | return $this->_prepareFormFields($dd, $name, $attributes); |
| 231 | - }, $index,$attributes,"dd"); |
|
| 231 | + }, $index, $attributes, "dd"); |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - public function fieldAsMessage($index,$attributes=NULL){ |
|
| 235 | - return $this->_fieldAs(function($id,$name,$value,$caption){ |
|
| 236 | - $mess= new HtmlMessage("message-".$id,$caption); |
|
| 234 | + public function fieldAsMessage($index, $attributes=NULL) { |
|
| 235 | + return $this->_fieldAs(function($id, $name, $value, $caption) { |
|
| 236 | + $mess=new HtmlMessage("message-".$id, $caption); |
|
| 237 | 237 | $mess->addHeader($value); |
| 238 | 238 | return $mess; |
| 239 | - }, $index,$attributes,"message"); |
|
| 239 | + }, $index, $attributes, "message"); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - public function fieldAsLink($index,$attributes=NULL){ |
|
| 243 | - return $this->_fieldAs(function($id,$name,$value,$caption){ |
|
| 244 | - $lnk= new HtmlLink("message-".$id,"#",$caption); |
|
| 242 | + public function fieldAsLink($index, $attributes=NULL) { |
|
| 243 | + return $this->_fieldAs(function($id, $name, $value, $caption) { |
|
| 244 | + $lnk=new HtmlLink("message-".$id, "#", $caption); |
|
| 245 | 245 | return $lnk; |
| 246 | - }, $index,$attributes,"link"); |
|
| 246 | + }, $index, $attributes, "link"); |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | /**Change fields type |
| 250 | 250 | * @param array $types an array or associative array $type=>$attributes |
| 251 | 251 | */ |
| 252 | - public function fieldsAs(array $types){ |
|
| 252 | + public function fieldsAs(array $types) { |
|
| 253 | 253 | $i=0; |
| 254 | - if(JArray::isAssociative($types)){ |
|
| 255 | - foreach ($types as $type=>$attributes){ |
|
| 256 | - if(\is_int($type)) |
|
| 257 | - $this->fieldAs($i++,$attributes,[]); |
|
| 258 | - else{ |
|
| 259 | - $type=preg_replace('/\d/', '', $type ); |
|
| 260 | - $this->fieldAs($i++,$type,$attributes); |
|
| 254 | + if (JArray::isAssociative($types)) { |
|
| 255 | + foreach ($types as $type=>$attributes) { |
|
| 256 | + if (\is_int($type)) |
|
| 257 | + $this->fieldAs($i++, $attributes, []); |
|
| 258 | + else { |
|
| 259 | + $type=preg_replace('/\d/', '', $type); |
|
| 260 | + $this->fieldAs($i++, $type, $attributes); |
|
| 261 | 261 | } |
| 262 | 262 | } |
| 263 | - }else{ |
|
| 264 | - foreach ($types as $type){ |
|
| 265 | - $this->fieldAs($i++,$type); |
|
| 263 | + } else { |
|
| 264 | + foreach ($types as $type) { |
|
| 265 | + $this->fieldAs($i++, $type); |
|
| 266 | 266 | } |
| 267 | 267 | } |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | - public function fieldAs($index,$type,$attributes=NULL){ |
|
| 270 | + public function fieldAs($index, $type, $attributes=NULL) { |
|
| 271 | 271 | $method="fieldAs".\ucfirst($type); |
| 272 | - if(\method_exists($this, $method)){ |
|
| 273 | - if(!\is_array($attributes)){ |
|
| 272 | + if (\method_exists($this, $method)) { |
|
| 273 | + if (!\is_array($attributes)) { |
|
| 274 | 274 | $attributes=[$index]; |
| 275 | - }else{ |
|
| 275 | + } else { |
|
| 276 | 276 | \array_unshift($attributes, $index); |
| 277 | 277 | } |
| 278 | - \call_user_func_array([$this,$method], $attributes); |
|
| 278 | + \call_user_func_array([$this, $method], $attributes); |
|
| 279 | 279 | } |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | - public function fieldAsSubmit($index,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$attributes=NULL){ |
|
| 283 | - return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$attributes){ |
|
| 284 | - $button=new HtmlButton($id,$caption,$cssStyle); |
|
| 285 | - $this->_buttonAsSubmit($button,"click",$url,$responseElement,@$attributes["ajax"]); |
|
| 282 | + public function fieldAsSubmit($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL) { |
|
| 283 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle, $attributes){ |
|
| 284 | + $button=new HtmlButton($id, $caption, $cssStyle); |
|
| 285 | + $this->_buttonAsSubmit($button, "click", $url, $responseElement, @$attributes["ajax"]); |
|
| 286 | 286 | return $button; |
| 287 | - }, $index,$attributes,"submit"); |
|
| 287 | + }, $index, $attributes, "submit"); |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | - public function fieldAsButton($index,$cssStyle=NULL,$attributes=NULL){ |
|
| 291 | - return $this->_fieldAs(function($id,$name,$value,$caption) use ($cssStyle){ |
|
| 292 | - $button=new HtmlButton($id,$value,$cssStyle); |
|
| 290 | + public function fieldAsButton($index, $cssStyle=NULL, $attributes=NULL) { |
|
| 291 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($cssStyle){ |
|
| 292 | + $button=new HtmlButton($id, $value, $cssStyle); |
|
| 293 | 293 | return $button; |
| 294 | - }, $index,$attributes,"button"); |
|
| 294 | + }, $index, $attributes, "button"); |
|
| 295 | 295 | } |
| 296 | 296 | } |