@@ -7,9 +7,9 @@ |
||
| 7 | 7 | |
| 8 | 8 | class HtmlFormInput extends HtmlFormField { |
| 9 | 9 | |
| 10 | - public function __construct($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL) { |
|
| 11 | - if(!isset($placeholder)) |
|
| 10 | + public function __construct($identifier, $label=NULL, $type="text", $value=NULL, $placeholder=NULL) { |
|
| 11 | + if (!isset($placeholder)) |
|
| 12 | 12 | $placeholder=$label; |
| 13 | - parent::__construct("field-".$identifier, new HtmlInput($identifier,$type,$value,$placeholder), $label); |
|
| 13 | + parent::__construct("field-".$identifier, new HtmlInput($identifier, $type, $value, $placeholder), $label); |
|
| 14 | 14 | } |
| 15 | 15 | } |
| 16 | 16 | \ No newline at end of file |
@@ -8,8 +8,9 @@ |
||
| 8 | 8 | class HtmlFormInput extends HtmlFormField { |
| 9 | 9 | |
| 10 | 10 | public function __construct($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL) { |
| 11 | - if(!isset($placeholder)) |
|
| 12 | - $placeholder=$label; |
|
| 11 | + if(!isset($placeholder)) { |
|
| 12 | + $placeholder=$label; |
|
| 13 | + } |
|
| 13 | 14 | parent::__construct("field-".$identifier, new HtmlInput($identifier,$type,$value,$placeholder), $label); |
| 14 | 15 | } |
| 15 | 16 | } |
| 16 | 17 | \ No newline at end of file |
@@ -7,26 +7,26 @@ |
||
| 7 | 7 | |
| 8 | 8 | class HtmlTextarea extends HtmlDoubleElement { |
| 9 | 9 | |
| 10 | - public function __construct($identifier,$value=NULL,$placeholder=NULL,$rows=NULL) { |
|
| 10 | + public function __construct($identifier, $value=NULL, $placeholder=NULL, $rows=NULL) { |
|
| 11 | 11 | parent::__construct($identifier, "textarea"); |
| 12 | 12 | $this->setValue($value); |
| 13 | 13 | $this->setPlaceholder($placeholder); |
| 14 | - if(isset($rows)) |
|
| 14 | + if (isset($rows)) |
|
| 15 | 15 | $this->setRows($rows); |
| 16 | 16 | } |
| 17 | 17 | public function setValue($value) { |
| 18 | - if(isset($value)) |
|
| 18 | + if (isset($value)) |
|
| 19 | 19 | $this->setContent($value); |
| 20 | 20 | return $this; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public function setPlaceholder($value){ |
|
| 24 | - if(JString::isNotNull($value)) |
|
| 23 | + public function setPlaceholder($value) { |
|
| 24 | + if (JString::isNotNull($value)) |
|
| 25 | 25 | $this->setProperty("placeholder", $value); |
| 26 | 26 | return $this; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - public function setRows($count){ |
|
| 29 | + public function setRows($count) { |
|
| 30 | 30 | $this->setProperty("rows", $count); |
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | \ No newline at end of file |
@@ -11,18 +11,21 @@ |
||
| 11 | 11 | parent::__construct($identifier, "textarea"); |
| 12 | 12 | $this->setValue($value); |
| 13 | 13 | $this->setPlaceholder($placeholder); |
| 14 | - if(isset($rows)) |
|
| 15 | - $this->setRows($rows); |
|
| 14 | + if(isset($rows)) { |
|
| 15 | + $this->setRows($rows); |
|
| 16 | + } |
|
| 16 | 17 | } |
| 17 | 18 | public function setValue($value) { |
| 18 | - if(isset($value)) |
|
| 19 | - $this->setContent($value); |
|
| 19 | + if(isset($value)) { |
|
| 20 | + $this->setContent($value); |
|
| 21 | + } |
|
| 20 | 22 | return $this; |
| 21 | 23 | } |
| 22 | 24 | |
| 23 | 25 | public function setPlaceholder($value){ |
| 24 | - if(JString::isNotNull($value)) |
|
| 25 | - $this->setProperty("placeholder", $value); |
|
| 26 | + if(JString::isNotNull($value)) { |
|
| 27 | + $this->setProperty("placeholder", $value); |
|
| 28 | + } |
|
| 26 | 29 | return $this; |
| 27 | 30 | } |
| 28 | 31 | |
@@ -13,35 +13,35 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | abstract class HtmlCollection extends HtmlDoubleElement { |
| 15 | 15 | |
| 16 | - public function __construct($identifier,$tagName="div"){ |
|
| 17 | - parent::__construct($identifier,$tagName); |
|
| 16 | + public function __construct($identifier, $tagName="div") { |
|
| 17 | + parent::__construct($identifier, $tagName); |
|
| 18 | 18 | $this->content=array(); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function addItems($items){ |
|
| 22 | - if(JArray::isAssociative($items)){ |
|
| 23 | - foreach ($items as $k=>$v){ |
|
| 24 | - $this->addItem([$k,$v]); |
|
| 21 | + public function addItems($items) { |
|
| 22 | + if (JArray::isAssociative($items)) { |
|
| 23 | + foreach ($items as $k=>$v) { |
|
| 24 | + $this->addItem([$k, $v]); |
|
| 25 | 25 | } |
| 26 | - }else{ |
|
| 27 | - foreach ($items as $item){ |
|
| 26 | + }else { |
|
| 27 | + foreach ($items as $item) { |
|
| 28 | 28 | $this->addItem($item); |
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - public function setItems($items){ |
|
| 33 | + public function setItems($items) { |
|
| 34 | 34 | $this->content=$items; |
| 35 | 35 | return $this; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public function getItems(){ |
|
| 38 | + public function getItems() { |
|
| 39 | 39 | return $this->content; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - protected function getItemToAdd($item){ |
|
| 42 | + protected function getItemToAdd($item) { |
|
| 43 | 43 | $itemO=$item; |
| 44 | - if($this->createCondition($item)===true){ |
|
| 44 | + if ($this->createCondition($item)===true) { |
|
| 45 | 45 | $itemO=$this->createItem($item); |
| 46 | 46 | } |
| 47 | 47 | return $itemO; |
@@ -52,15 +52,15 @@ discard block |
||
| 52 | 52 | * @param HtmlDoubleElement|string $item |
| 53 | 53 | * @return \Ajax\common\html\HtmlDoubleElement |
| 54 | 54 | */ |
| 55 | - public function addItem($item){ |
|
| 55 | + public function addItem($item) { |
|
| 56 | 56 | $itemO=$this->getItemToAdd($item); |
| 57 | 57 | $this->addContent($itemO); |
| 58 | 58 | return $itemO; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - public function insertItem($item,$position=0){ |
|
| 61 | + public function insertItem($item, $position=0) { |
|
| 62 | 62 | $itemO=$this->getItemToAdd($item); |
| 63 | - \array_splice( $this->content, $position, 0, array($itemO)); |
|
| 63 | + \array_splice($this->content, $position, 0, array($itemO)); |
|
| 64 | 64 | return $itemO; |
| 65 | 65 | } |
| 66 | 66 | |
@@ -83,11 +83,11 @@ discard block |
||
| 83 | 83 | return $this; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - public function removeItem($index){ |
|
| 86 | + public function removeItem($index) { |
|
| 87 | 87 | return array_splice($this->content, $index, 1); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - public function count(){ |
|
| 90 | + public function count() { |
|
| 91 | 91 | return \sizeof($this->content); |
| 92 | 92 | } |
| 93 | 93 | |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | $this->addItem($function($object)); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - public function apply($callBack){ |
|
| 102 | - foreach ($this->content as $item){ |
|
| 101 | + public function apply($callBack) { |
|
| 102 | + foreach ($this->content as $item) { |
|
| 103 | 103 | $callBack($item); |
| 104 | 104 | } |
| 105 | 105 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | protected abstract function createItem($value); |
| 119 | 119 | |
| 120 | - protected function createCondition($value){ |
|
| 120 | + protected function createCondition($value) { |
|
| 121 | 121 | return \is_object($value)===false; |
| 122 | 122 | } |
| 123 | 123 | |
@@ -132,8 +132,8 @@ discard block |
||
| 132 | 132 | return $this->_bsComponent; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - protected function contentAs($tagName){ |
|
| 136 | - foreach ($this->content as $item){ |
|
| 135 | + protected function contentAs($tagName) { |
|
| 136 | + foreach ($this->content as $item) { |
|
| 137 | 137 | $item->setTagName($tagName); |
| 138 | 138 | } |
| 139 | 139 | } |
@@ -11,17 +11,17 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | class HtmlFormRadio extends HtmlFormInput { |
| 13 | 13 | |
| 14 | - public function __construct($identifier, $name=NULL,$label=NULL,$value=NULL) { |
|
| 14 | + public function __construct($identifier, $name=NULL, $label=NULL, $value=NULL) { |
|
| 15 | 15 | parent::__construct($identifier, $label, "radio", $value=NULL); |
| 16 | - if(isset($name)) |
|
| 16 | + if (isset($name)) |
|
| 17 | 17 | $this->getField()->setProperty("name", $name); |
| 18 | - if(isset($label)){ |
|
| 18 | + if (isset($label)) { |
|
| 19 | 19 | $this->swapLabel(); |
| 20 | 20 | $label=$this->getLabel(); |
| 21 | 21 | $label->setClass="hidden"; |
| 22 | - $label->setProperty("tabindex",0); |
|
| 22 | + $label->setProperty("tabindex", 0); |
|
| 23 | 23 | } |
| 24 | 24 | $this->setClass("ui radio checkbox"); |
| 25 | - $this->wrap("<div class='field'>","</div>"); |
|
| 25 | + $this->wrap("<div class='field'>", "</div>"); |
|
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | \ No newline at end of file |
@@ -13,8 +13,9 @@ |
||
| 13 | 13 | |
| 14 | 14 | public function __construct($identifier, $name=NULL,$label=NULL,$value=NULL) { |
| 15 | 15 | parent::__construct($identifier, $label, "radio", $value=NULL); |
| 16 | - if(isset($name)) |
|
| 17 | - $this->getField()->setProperty("name", $name); |
|
| 16 | + if(isset($name)) { |
|
| 17 | + $this->getField()->setProperty("name", $name); |
|
| 18 | + } |
|
| 18 | 19 | if(isset($label)){ |
| 19 | 20 | $this->swapLabel(); |
| 20 | 21 | $label=$this->getLabel(); |
@@ -8,17 +8,17 @@ |
||
| 8 | 8 | class HtmlFormTextarea extends HtmlFormField { |
| 9 | 9 | use TextFieldsTrait; |
| 10 | 10 | |
| 11 | - public function __construct($identifier, $label=NULL,$value=NULL,$placeholder=NULL,$rows=NULL) { |
|
| 12 | - if(!isset($placeholder)) |
|
| 11 | + public function __construct($identifier, $label=NULL, $value=NULL, $placeholder=NULL, $rows=NULL) { |
|
| 12 | + if (!isset($placeholder)) |
|
| 13 | 13 | $placeholder=$label; |
| 14 | - parent::__construct("field-".$identifier, new HtmlTextarea($identifier,$value,$placeholder,$rows), $label); |
|
| 14 | + parent::__construct("field-".$identifier, new HtmlTextarea($identifier, $value, $placeholder, $rows), $label); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * Defines the textarea row count |
| 19 | 19 | * @param int $count |
| 20 | 20 | */ |
| 21 | - public function setRows($count){ |
|
| 21 | + public function setRows($count) { |
|
| 22 | 22 | $this->getField()->setRows($count); |
| 23 | 23 | } |
| 24 | 24 | } |
| 25 | 25 | \ No newline at end of file |
@@ -6,25 +6,25 @@ discard block |
||
| 6 | 6 | use Ajax\semantic\html\base\constants\Wide; |
| 7 | 7 | |
| 8 | 8 | class HtmlFormField extends HtmlSemDoubleElement { |
| 9 | - public function __construct($identifier, $field,$label=NULL) { |
|
| 10 | - parent::__construct($identifier, "div","field"); |
|
| 9 | + public function __construct($identifier, $field, $label=NULL) { |
|
| 10 | + parent::__construct($identifier, "div", "field"); |
|
| 11 | 11 | $this->content=array(); |
| 12 | - if(isset($label)) |
|
| 12 | + if (isset($label)) |
|
| 13 | 13 | $this->setLabel($label); |
| 14 | 14 | $this->setField($field); |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - public function setLabel($label){ |
|
| 17 | + public function setLabel($label) { |
|
| 18 | 18 | $labelO=$label; |
| 19 | - if(\is_string($label)){ |
|
| 20 | - $labelO=new HtmlSemDoubleElement("","label"); |
|
| 19 | + if (\is_string($label)) { |
|
| 20 | + $labelO=new HtmlSemDoubleElement("", "label"); |
|
| 21 | 21 | $labelO->setContent($label); |
| 22 | - $labelO->setProperty("for", \str_replace("field-", "",$this->identifier)); |
|
| 22 | + $labelO->setProperty("for", \str_replace("field-", "", $this->identifier)); |
|
| 23 | 23 | } |
| 24 | 24 | $this->content["label"]=$labelO; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public function setField($field){ |
|
| 27 | + public function setField($field) { |
|
| 28 | 28 | $this->content["field"]=$field; |
| 29 | 29 | } |
| 30 | 30 | |
@@ -32,8 +32,8 @@ discard block |
||
| 32 | 32 | * Returns the label or null |
| 33 | 33 | * @return mixed |
| 34 | 34 | */ |
| 35 | - public function getLabel(){ |
|
| 36 | - if(\array_key_exists("label", $this->content)) |
|
| 35 | + public function getLabel() { |
|
| 36 | + if (\array_key_exists("label", $this->content)) |
|
| 37 | 37 | return $this->content["label"]; |
| 38 | 38 | } |
| 39 | 39 | |
@@ -41,14 +41,14 @@ discard block |
||
| 41 | 41 | * Return the field |
| 42 | 42 | * @return mixed |
| 43 | 43 | */ |
| 44 | - public function getField(){ |
|
| 44 | + public function getField() { |
|
| 45 | 45 | return $this->content["field"]; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * puts the label before or behind |
| 50 | 50 | */ |
| 51 | - public function swapLabel(){ |
|
| 51 | + public function swapLabel() { |
|
| 52 | 52 | $label=$this->getLabel(); |
| 53 | 53 | unset($this->content["label"]); |
| 54 | 54 | $this->content["label"]=$label; |
@@ -59,19 +59,19 @@ discard block |
||
| 59 | 59 | * @param int $width |
| 60 | 60 | * @return \Ajax\semantic\html\collections\form\HtmlFormField |
| 61 | 61 | */ |
| 62 | - public function setWidth($width){ |
|
| 63 | - if(\is_int($width)){ |
|
| 62 | + public function setWidth($width) { |
|
| 63 | + if (\is_int($width)) { |
|
| 64 | 64 | $width=Wide::getConstants()["W".$width]; |
| 65 | 65 | } |
| 66 | 66 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 67 | - return $this->addToPropertyCtrl("class", "wide",array("wide")); |
|
| 67 | + return $this->addToPropertyCtrl("class", "wide", array("wide")); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | 71 | * Field displays an error state |
| 72 | 72 | * @return \Ajax\semantic\html\collections\form\HtmlFormField |
| 73 | 73 | */ |
| 74 | - public function setError(){ |
|
| 74 | + public function setError() { |
|
| 75 | 75 | return $this->addToProperty("class", "error"); |
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | \ No newline at end of file |
@@ -10,57 +10,57 @@ discard block |
||
| 10 | 10 | * @author jc |
| 11 | 11 | * @version 1.001 |
| 12 | 12 | */ |
| 13 | -class HtmlForm extends HtmlSemCollection{ |
|
| 13 | +class HtmlForm extends HtmlSemCollection { |
|
| 14 | 14 | |
| 15 | 15 | use FieldsTrait; |
| 16 | 16 | |
| 17 | 17 | protected $_fields; |
| 18 | 18 | |
| 19 | - public function __construct( $identifier, $elements=array()){ |
|
| 20 | - parent::__construct( $identifier, "form", "ui form"); |
|
| 19 | + public function __construct($identifier, $elements=array()) { |
|
| 20 | + parent::__construct($identifier, "form", "ui form"); |
|
| 21 | 21 | $this->setProperty("name", $this->identifier); |
| 22 | 22 | $this->_fields=array(); |
| 23 | 23 | $this->addItems($elements); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function addHeader($title,$niveau=1,$dividing=true){ |
|
| 27 | - $header=new HtmlHeader("",$niveau,$title); |
|
| 28 | - if($dividing) |
|
| 26 | + public function addHeader($title, $niveau=1, $dividing=true) { |
|
| 27 | + $header=new HtmlHeader("", $niveau, $title); |
|
| 28 | + if ($dividing) |
|
| 29 | 29 | $header->setDividing(); |
| 30 | 30 | return $this->addItem($header); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - public function addFields($fields,$label=NULL){ |
|
| 34 | - if(!$fields instanceof HtmlFormFields){ |
|
| 35 | - if(\is_array($fields)===false){ |
|
| 36 | - $fields = \func_get_args(); |
|
| 33 | + public function addFields($fields, $label=NULL) { |
|
| 34 | + if (!$fields instanceof HtmlFormFields) { |
|
| 35 | + if (\is_array($fields)===false) { |
|
| 36 | + $fields=\func_get_args(); |
|
| 37 | 37 | $end=\end($fields); |
| 38 | - if(\is_string($end)){ |
|
| 38 | + if (\is_string($end)) { |
|
| 39 | 39 | $label=$end; |
| 40 | 40 | \array_pop($fields); |
| 41 | 41 | }else $label=NULL; |
| 42 | 42 | } |
| 43 | - $this->_fields=\array_merge($this->_fields,$fields); |
|
| 44 | - $fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count(),$fields); |
|
| 43 | + $this->_fields=\array_merge($this->_fields, $fields); |
|
| 44 | + $fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count(), $fields); |
|
| 45 | 45 | } |
| 46 | - if(isset($label)) |
|
| 47 | - $fields=new HtmlFormField("", $fields,$label); |
|
| 46 | + if (isset($label)) |
|
| 47 | + $fields=new HtmlFormField("", $fields, $label); |
|
| 48 | 48 | $this->addItem($fields); |
| 49 | 49 | return $fields; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - public function addItem($item){ |
|
| 52 | + public function addItem($item) { |
|
| 53 | 53 | $item=parent::addItem($item); |
| 54 | - if(\is_subclass_of($item, HtmlFormField::class)===true){ |
|
| 54 | + if (\is_subclass_of($item, HtmlFormField::class)===true) { |
|
| 55 | 55 | $this->_fields[]=$item; |
| 56 | 56 | } |
| 57 | 57 | return $item; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - public function getField($index){ |
|
| 61 | - if(\is_string($index)){ |
|
| 60 | + public function getField($index) { |
|
| 61 | + if (\is_string($index)) { |
|
| 62 | 62 | $field=$this->getElementById($index, $this->_fields); |
| 63 | - }else{ |
|
| 63 | + }else { |
|
| 64 | 64 | $field=$this->_fields[$index]; |
| 65 | 65 | } |
| 66 | 66 | return $field; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * automatically divide fields to be equal width |
| 71 | 71 | * @return \Ajax\semantic\html\collections\form\HtmlForm |
| 72 | 72 | */ |
| 73 | - public function setEqualWidth(){ |
|
| 73 | + public function setEqualWidth() { |
|
| 74 | 74 | return $this->addToProperty("class", "equal width"); |
| 75 | 75 | } |
| 76 | 76 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * @param HtmlFormField $field |
| 80 | 80 | * @return \Ajax\common\html\HtmlDoubleElement |
| 81 | 81 | */ |
| 82 | - public function addField($field){ |
|
| 82 | + public function addField($field) { |
|
| 83 | 83 | return $this->addItem($field); |
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | \ No newline at end of file |
@@ -25,8 +25,9 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | public function addHeader($title,$niveau=1,$dividing=true){ |
| 27 | 27 | $header=new HtmlHeader("",$niveau,$title); |
| 28 | - if($dividing) |
|
| 29 | - $header->setDividing(); |
|
| 28 | + if($dividing) { |
|
| 29 | + $header->setDividing(); |
|
| 30 | + } |
|
| 30 | 31 | return $this->addItem($header); |
| 31 | 32 | } |
| 32 | 33 | |
@@ -38,13 +39,16 @@ discard block |
||
| 38 | 39 | if(\is_string($end)){ |
| 39 | 40 | $label=$end; |
| 40 | 41 | \array_pop($fields); |
| 41 | - }else $label=NULL; |
|
| 42 | + } else { |
|
| 43 | + $label=NULL; |
|
| 44 | + } |
|
| 42 | 45 | } |
| 43 | 46 | $this->_fields=\array_merge($this->_fields,$fields); |
| 44 | 47 | $fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count(),$fields); |
| 45 | 48 | } |
| 46 | - if(isset($label)) |
|
| 47 | - $fields=new HtmlFormField("", $fields,$label); |
|
| 49 | + if(isset($label)) { |
|
| 50 | + $fields=new HtmlFormField("", $fields,$label); |
|
| 51 | + } |
|
| 48 | 52 | $this->addItem($fields); |
| 49 | 53 | return $fields; |
| 50 | 54 | } |
@@ -60,7 +64,7 @@ discard block |
||
| 60 | 64 | public function getField($index){ |
| 61 | 65 | if(\is_string($index)){ |
| 62 | 66 | $field=$this->getElementById($index, $this->_fields); |
| 63 | - }else{ |
|
| 67 | + } else{ |
|
| 64 | 68 | $field=$this->_fields[$index]; |
| 65 | 69 | } |
| 66 | 70 | return $field; |
@@ -3,11 +3,11 @@ |
||
| 3 | 3 | namespace Ajax\semantic\html\collections\form; |
| 4 | 4 | |
| 5 | 5 | trait TextFieldsTrait { |
| 6 | - public function setPlaceholder($value){ |
|
| 6 | + public function setPlaceholder($value) { |
|
| 7 | 7 | return $this->getField()->setPlaceholder($value); |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | - public function setValue($value){ |
|
| 10 | + public function setValue($value) { |
|
| 11 | 11 | return $this->getField()->setValue($value); |
| 12 | 12 | } |
| 13 | 13 | } |
| 14 | 14 | \ No newline at end of file |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | protected $_equalWidth; |
| 15 | 15 | protected $_name; |
| 16 | 16 | |
| 17 | - public function __construct($identifier, $fields=array(),$equalWidth=true) { |
|
| 17 | + public function __construct($identifier, $fields=array(), $equalWidth=true) { |
|
| 18 | 18 | parent::__construct($identifier, "div"); |
| 19 | 19 | $this->_equalWidth=$equalWidth; |
| 20 | 20 | $this->addItems($fields); |
@@ -24,35 +24,35 @@ discard block |
||
| 24 | 24 | * @param string|HtmlSemDoubleElement $label |
| 25 | 25 | * @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
| 26 | 26 | */ |
| 27 | - public function setLabel($label){ |
|
| 27 | + public function setLabel($label) { |
|
| 28 | 28 | $labelO=$label; |
| 29 | - if(\is_string($label)){ |
|
| 30 | - $labelO=new HtmlSemDoubleElement("","label","",$label); |
|
| 29 | + if (\is_string($label)) { |
|
| 30 | + $labelO=new HtmlSemDoubleElement("", "label", "", $label); |
|
| 31 | 31 | } |
| 32 | - $this->insertItem($labelO,0); |
|
| 32 | + $this->insertItem($labelO, 0); |
|
| 33 | 33 | return $labelO; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - public function compile(JsUtils $js=NULL,View $view=NULL){ |
|
| 37 | - if($this->_equalWidth){ |
|
| 36 | + public function compile(JsUtils $js=NULL, View $view=NULL) { |
|
| 37 | + if ($this->_equalWidth) { |
|
| 38 | 38 | $count=$this->count(); |
| 39 | 39 | $this->addToProperty("class", Wide::getConstants()["W".$count]." fields"); |
| 40 | 40 | }else |
| 41 | - $this->addToProperty("class","fields"); |
|
| 42 | - return parent::compile($js,$view); |
|
| 41 | + $this->addToProperty("class", "fields"); |
|
| 42 | + return parent::compile($js, $view); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - public function setWidth($index,$width){ |
|
| 45 | + public function setWidth($index, $width) { |
|
| 46 | 46 | $this->_equalWidth=false; |
| 47 | 47 | return $this->getItem($index)->setWidth($width); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - public function setInline(){ |
|
| 50 | + public function setInline() { |
|
| 51 | 51 | $this->_equalWidth=false; |
| 52 | 52 | $this->addToProperty("class", "inline"); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function setGrouped(){ |
|
| 55 | + public function setGrouped() { |
|
| 56 | 56 | $this->_equalWidth=false; |
| 57 | 57 | $this->addToProperty("class", "grouped"); |
| 58 | 58 | } |
@@ -66,14 +66,14 @@ discard block |
||
| 66 | 66 | return $this; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - public static function radios($name,$items=array(),$label=NULL){ |
|
| 69 | + public static function radios($name, $items=array(), $label=NULL) { |
|
| 70 | 70 | $fields=array(); |
| 71 | 71 | $i=0; |
| 72 | - foreach ($items as $item){ |
|
| 73 | - $fields[]=new HtmlFormRadio($name."-".$i++,$name,$item,$item); |
|
| 72 | + foreach ($items as $item) { |
|
| 73 | + $fields[]=new HtmlFormRadio($name."-".$i++, $name, $item, $item); |
|
| 74 | 74 | } |
| 75 | - $radios=new HtmlFormFields("fields-".$name,$fields); |
|
| 76 | - if(isset($label)) |
|
| 75 | + $radios=new HtmlFormFields("fields-".$name, $fields); |
|
| 76 | + if (isset($label)) |
|
| 77 | 77 | $radios->setLabel($label)->setProperty("for", $name); |
| 78 | 78 | return $radios; |
| 79 | 79 | } |
@@ -37,8 +37,9 @@ discard block |
||
| 37 | 37 | if($this->_equalWidth){ |
| 38 | 38 | $count=$this->count(); |
| 39 | 39 | $this->addToProperty("class", Wide::getConstants()["W".$count]." fields"); |
| 40 | - }else |
|
| 41 | - $this->addToProperty("class","fields"); |
|
| 40 | + } else { |
|
| 41 | + $this->addToProperty("class","fields"); |
|
| 42 | + } |
|
| 42 | 43 | return parent::compile($js,$view); |
| 43 | 44 | } |
| 44 | 45 | |
@@ -73,8 +74,9 @@ discard block |
||
| 73 | 74 | $fields[]=new HtmlFormRadio($name."-".$i++,$name,$item,$item); |
| 74 | 75 | } |
| 75 | 76 | $radios=new HtmlFormFields("fields-".$name,$fields); |
| 76 | - if(isset($label)) |
|
| 77 | - $radios->setLabel($label)->setProperty("for", $name); |
|
| 77 | + if(isset($label)) { |
|
| 78 | + $radios->setLabel($label)->setProperty("for", $name); |
|
| 79 | + } |
|
| 78 | 80 | return $radios; |
| 79 | 81 | } |
| 80 | 82 | |