@@ -6,6 +6,9 @@ |
||
6 | 6 | |
7 | 7 | trait CheckboxTrait { |
8 | 8 | |
9 | + /** |
|
10 | + * @param string $name |
|
11 | + */ |
|
9 | 12 | public abstract function addToPropertyCtrl($name, $value, $typeCtrl); |
10 | 13 | |
11 | 14 | public function setType($checkboxType) { |
@@ -6,8 +6,8 @@ discard block |
||
6 | 6 | use Ajax\semantic\html\base\constants\Color; |
7 | 7 | |
8 | 8 | trait BaseTrait { |
9 | - protected $_variations=[ ]; |
|
10 | - protected $_states=[ ]; |
|
9 | + protected $_variations=[]; |
|
10 | + protected $_states=[]; |
|
11 | 11 | protected $_baseClass; |
12 | 12 | |
13 | 13 | protected abstract function setPropertyCtrl($name, $value, $typeCtrl); |
@@ -35,14 +35,14 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | public function setVariations($variations=array()) { |
38 | - foreach ( $variations as $variation ) { |
|
38 | + foreach ($variations as $variation) { |
|
39 | 39 | $this->setVariation($variation); |
40 | 40 | } |
41 | 41 | return $this; |
42 | 42 | } |
43 | 43 | |
44 | 44 | public function setStates($states=array()) { |
45 | - foreach ( $states as $state ) { |
|
45 | + foreach ($states as $state) { |
|
46 | 46 | $this->setState($state); |
47 | 47 | } |
48 | 48 | return $this; |
@@ -15,7 +15,7 @@ |
||
15 | 15 | class HtmlFormCheckbox extends HtmlFormField { |
16 | 16 | use CheckboxTrait; |
17 | 17 | public function __construct($identifier, $label=NULL, $value=NULL, $type=NULL) { |
18 | - parent::__construct("field-".$identifier, new HtmlCheckbox($identifier,$label,$value,$type)); |
|
18 | + parent::__construct("field-".$identifier, new HtmlCheckbox($identifier, $label, $value, $type)); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | public static function slider($identifier, $label="", $value=NULL) { |
@@ -29,13 +29,13 @@ discard block |
||
29 | 29 | if (\is_string($end)) { |
30 | 30 | $label=$end; |
31 | 31 | \array_pop($fields); |
32 | - } else |
|
32 | + }else |
|
33 | 33 | $label=NULL; |
34 | 34 | } |
35 | 35 | } |
36 | 36 | if (isset($label)) |
37 | 37 | $this->setLabel($label); |
38 | - foreach ( $fields as $field ) { |
|
38 | + foreach ($fields as $field) { |
|
39 | 39 | $this->addItem($field); |
40 | 40 | } |
41 | 41 | return $this; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | if ($this->_equalWidth) { |
66 | 66 | $count=$this->count(); |
67 | 67 | $this->addToProperty("class", Wide::getConstants()["W".$count]." fields"); |
68 | - } else |
|
68 | + }else |
|
69 | 69 | $this->addToProperty("class", "fields"); |
70 | 70 | return parent::compile($js, $view); |
71 | 71 | } |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | } |
97 | 97 | |
98 | 98 | public static function radios($name, $items=array(), $label=NULL, $value=null, $type=NULL) { |
99 | - $fields=array (); |
|
99 | + $fields=array(); |
|
100 | 100 | $i=0; |
101 | - foreach ( $items as $val => $caption ) { |
|
101 | + foreach ($items as $val => $caption) { |
|
102 | 102 | $itemO=new HtmlFormRadio($name."-".$i++, $name, $caption, $val, $type); |
103 | 103 | if ($val===$value) { |
104 | 104 | $itemO->getField()->getField()->setProperty("checked", ""); |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | public static function checkeds($name, $items=array(), $label=NULL, $values=array(), $type=NULL) { |
115 | - $fields=array (); |
|
115 | + $fields=array(); |
|
116 | 116 | $i=0; |
117 | - foreach ( $items as $val => $caption ) { |
|
117 | + foreach ($items as $val => $caption) { |
|
118 | 118 | $itemO=new HtmlFormCheckbox($name."-".$i++, $name, $caption, $val, $type); |
119 | 119 | if (\array_search($val, $values)!==false) { |
120 | 120 | $itemO->getField()->getField()->setProperty("checked", ""); |
@@ -29,12 +29,14 @@ discard block |
||
29 | 29 | if (\is_string($end)) { |
30 | 30 | $label=$end; |
31 | 31 | \array_pop($fields); |
32 | - } else |
|
33 | - $label=NULL; |
|
32 | + } else { |
|
33 | + $label=NULL; |
|
34 | + } |
|
34 | 35 | } |
35 | 36 | } |
36 | - if (isset($label)) |
|
37 | - $this->setLabel($label); |
|
37 | + if (isset($label)) { |
|
38 | + $this->setLabel($label); |
|
39 | + } |
|
38 | 40 | foreach ( $fields as $field ) { |
39 | 41 | $this->addItem($field); |
40 | 42 | } |
@@ -65,8 +67,9 @@ discard block |
||
65 | 67 | if ($this->_equalWidth) { |
66 | 68 | $count=$this->count(); |
67 | 69 | $this->addToProperty("class", Wide::getConstants()["W".$count]." fields"); |
68 | - } else |
|
69 | - $this->addToProperty("class", "fields"); |
|
70 | + } else { |
|
71 | + $this->addToProperty("class", "fields"); |
|
72 | + } |
|
70 | 73 | return parent::compile($js, $view); |
71 | 74 | } |
72 | 75 | |
@@ -106,8 +109,9 @@ discard block |
||
106 | 109 | $fields[]=$itemO; |
107 | 110 | } |
108 | 111 | $radios=new HtmlFormFields("fields-".$name, $fields); |
109 | - if (isset($label)) |
|
110 | - $radios->setLabel($label)->setProperty("for", $name); |
|
112 | + if (isset($label)) { |
|
113 | + $radios->setLabel($label)->setProperty("for", $name); |
|
114 | + } |
|
111 | 115 | return $radios; |
112 | 116 | } |
113 | 117 | |
@@ -122,8 +126,9 @@ discard block |
||
122 | 126 | $fields[]=$itemO; |
123 | 127 | } |
124 | 128 | $radios=new HtmlFormFields("fields-".$name, $fields); |
125 | - if (isset($label)) |
|
126 | - $radios->setLabel($label)->setProperty("for", $name); |
|
129 | + if (isset($label)) { |
|
130 | + $radios->setLabel($label)->setProperty("for", $name); |
|
131 | + } |
|
127 | 132 | return $radios; |
128 | 133 | } |
129 | 134 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | use Ajax\semantic\html\base\constants\CheckboxType; |
7 | 7 | |
8 | 8 | abstract class AbstractCheckbox extends HtmlSemDoubleElement { |
9 | - protected $_params=array (); |
|
9 | + protected $_params=array(); |
|
10 | 10 | |
11 | 11 | public function __construct($identifier, $name=NULL, $label=NULL, $value=NULL, $inputType="checkbox", $type="checkbox") { |
12 | 12 | parent::__construct("ck-".$identifier, "div", "ui ".$type); |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | * @return \Ajax\semantic\html\collections\form\AbstractHtmlFormRadioCheckbox |
74 | 74 | */ |
75 | 75 | public function attachEvent($selector, $action=NULL) { |
76 | - if (isset($action)!==false||\is_numeric($action)===true) { |
|
76 | + if (isset($action)!==false || \is_numeric($action)===true) { |
|
77 | 77 | $js='$("#%identifier%").checkbox("attach events", "'.$selector.'", "'.$action.'");'; |
78 | - } else { |
|
78 | + }else { |
|
79 | 79 | $js='$("#%identifier%").checkbox("attach events", "'.$selector.'");'; |
80 | 80 | } |
81 | 81 | $js=\str_replace("%identifier%", $this->identifier, $js); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function attachEvents($events=array()) { |
91 | 91 | if (\is_array($events)) { |
92 | - foreach ( $events as $action => $selector ) { |
|
92 | + foreach ($events as $action => $selector) { |
|
93 | 93 | $this->attachEvent($selector, $action); |
94 | 94 | } |
95 | 95 | } |
@@ -13,8 +13,9 @@ discard block |
||
13 | 13 | $field=new \Ajax\common\html\html5\HtmlInput($identifier, $inputType, $value); |
14 | 14 | $field->setProperty("name", $name); |
15 | 15 | $this->setField($field); |
16 | - if (isset($label)) |
|
17 | - $this->setLabel($label); |
|
16 | + if (isset($label)) { |
|
17 | + $this->setLabel($label); |
|
18 | + } |
|
18 | 19 | } |
19 | 20 | |
20 | 21 | public function setType($checkboxType) { |
@@ -40,8 +41,9 @@ discard block |
||
40 | 41 | * @return mixed |
41 | 42 | */ |
42 | 43 | public function getLabel() { |
43 | - if (\array_key_exists("label", $this->content)) |
|
44 | - return $this->content["label"]; |
|
44 | + if (\array_key_exists("label", $this->content)) { |
|
45 | + return $this->content["label"]; |
|
46 | + } |
|
45 | 47 | } |
46 | 48 | |
47 | 49 | /** |
@@ -14,8 +14,8 @@ discard block |
||
14 | 14 | public function __construct($identifier, $type="text", $value="", $placeholder="") { |
15 | 15 | parent::__construct("div-".$identifier, "div", "ui input"); |
16 | 16 | $this->content=new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder); |
17 | - $this->_states=[ State::DISABLED,State::FOCUS,State::ERROR ]; |
|
18 | - $this->_variations=[ Variation::TRANSPARENT ]; |
|
17 | + $this->_states=[State::DISABLED, State::FOCUS, State::ERROR]; |
|
18 | + $this->_variations=[Variation::TRANSPARENT]; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | public function setFocus() { |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | $labelO=new HtmlLabel("label-".$this->identifier, $label); |
36 | 36 | if (isset($icon)) |
37 | 37 | $labelO->addIcon($icon); |
38 | - } else { |
|
39 | - $labelO->addToPropertyCtrl("class", "label", array ("label" )); |
|
38 | + }else { |
|
39 | + $labelO->addToPropertyCtrl("class", "label", array("label")); |
|
40 | 40 | } |
41 | 41 | $this->addToProperty("class", $direction." labeled"); |
42 | 42 | $this->addContent($labelO, \strstr($direction, Direction::LEFT)!==false); |
@@ -33,8 +33,9 @@ discard block |
||
33 | 33 | $labelO=$label; |
34 | 34 | if (\is_object($label)===false) { |
35 | 35 | $labelO=new HtmlLabel("label-".$this->identifier, $label); |
36 | - if (isset($icon)) |
|
37 | - $labelO->addIcon($icon); |
|
36 | + if (isset($icon)) { |
|
37 | + $labelO->addIcon($icon); |
|
38 | + } |
|
38 | 39 | } else { |
39 | 40 | $labelO->addToPropertyCtrl("class", "label", array ("label" )); |
40 | 41 | } |
@@ -51,8 +52,9 @@ discard block |
||
51 | 52 | $actionO=$action; |
52 | 53 | if (\is_object($action)===false) { |
53 | 54 | $actionO=new HtmlButton("action-".$this->identifier, $action); |
54 | - if (isset($icon)) |
|
55 | - $actionO->addIcon($icon, true, $labeled); |
|
55 | + if (isset($icon)) { |
|
56 | + $actionO->addIcon($icon, true, $labeled); |
|
57 | + } |
|
56 | 58 | } |
57 | 59 | $this->addToProperty("class", $direction." action"); |
58 | 60 | $this->addContent($actionO, \strstr($direction, Direction::LEFT)!==false); |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | if (\is_array($value)) { |
22 | 22 | $item=new HtmlListItem("item-".$this->identifier."-".$count, $value[0]); |
23 | 23 | $item->addIcon($value[1]); |
24 | - } else |
|
24 | + }else |
|
25 | 25 | $item=new HtmlListItem("item-".$this->identifier."-".$count, $value); |
26 | 26 | return $item; |
27 | 27 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | public function asLink() { |
38 | - $this->addToPropertyCtrl("class", "link", array ("link" )); |
|
38 | + $this->addToPropertyCtrl("class", "link", array("link")); |
|
39 | 39 | return $this->contentAs("a"); |
40 | 40 | } |
41 | 41 | |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | $masterO->setClass("item"); |
72 | 72 | $this->addItem($masterO); |
73 | 73 | } |
74 | - $fields=array (); |
|
74 | + $fields=array(); |
|
75 | 75 | $i=0; |
76 | - foreach ( $items as $val => $caption ) { |
|
76 | + foreach ($items as $val => $caption) { |
|
77 | 77 | $itemO=new HtmlFormCheckbox($identifier."-".$i++, $caption, $val, "child"); |
78 | 78 | if (\array_search($val, $values)!==false) { |
79 | 79 | $itemO->getField()->getField()->setProperty("checked", ""); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $list=new HtmlList("", $fields); |
86 | 86 | $list->setClass("list"); |
87 | 87 | $masterO->addContent($list); |
88 | - } else { |
|
88 | + }else { |
|
89 | 89 | $this->addList($fields); |
90 | 90 | } |
91 | 91 | $this->_hasCheckedList=true; |
@@ -21,8 +21,9 @@ |
||
21 | 21 | if (\is_array($value)) { |
22 | 22 | $item=new HtmlListItem("item-".$this->identifier."-".$count, $value[0]); |
23 | 23 | $item->addIcon($value[1]); |
24 | - } else |
|
25 | - $item=new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
24 | + } else { |
|
25 | + $item=new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
26 | + } |
|
26 | 27 | return $item; |
27 | 28 | } |
28 | 29 |