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