@@ -9,13 +9,13 @@ |
||
9 | 9 | use Ajax\semantic\html\collections\form\traits\FieldTrait; |
10 | 10 | |
11 | 11 | class HtmlInput extends HtmlSemDoubleElement { |
12 | - use IconTrait,TextFieldsTrait,FieldTrait; |
|
12 | + use IconTrait, TextFieldsTrait, FieldTrait; |
|
13 | 13 | |
14 | 14 | public function __construct($identifier, $type="text", $value="", $placeholder="") { |
15 | - parent::__construct("div-" . $identifier, "div", "ui input"); |
|
16 | - $this->content=[ "field" => new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder) ]; |
|
17 | - $this->_states=[ State::DISABLED,State::FOCUS,State::ERROR ]; |
|
18 | - $this->_variations=[ Variation::TRANSPARENT ]; |
|
15 | + parent::__construct("div-".$identifier, "div", "ui input"); |
|
16 | + $this->content=["field" => new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder)]; |
|
17 | + $this->_states=[State::DISABLED, State::FOCUS, State::ERROR]; |
|
18 | + $this->_variations=[Variation::TRANSPARENT]; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | public function getField() { |
@@ -12,34 +12,34 @@ discard block |
||
12 | 12 | class HtmlFormField extends HtmlSemDoubleElement { |
13 | 13 | protected $_container; |
14 | 14 | protected $_validation; |
15 | - public function __construct($identifier, $field,$label=NULL) { |
|
16 | - parent::__construct($identifier, "div","field"); |
|
15 | + public function __construct($identifier, $field, $label=NULL) { |
|
16 | + parent::__construct($identifier, "div", "field"); |
|
17 | 17 | $this->content=array(); |
18 | - $this->_states=[State::ERROR,State::DISABLED]; |
|
19 | - if(isset($label)) |
|
18 | + $this->_states=[State::ERROR, State::DISABLED]; |
|
19 | + if (isset($label)) |
|
20 | 20 | $this->setLabel($label); |
21 | 21 | $this->setField($field); |
22 | 22 | $this->_validation=NULL; |
23 | 23 | } |
24 | 24 | |
25 | - public function addPointingLabel($label,$pointing=Direction::NONE){ |
|
26 | - $labelO=new HtmlLabel("",$label); |
|
25 | + public function addPointingLabel($label, $pointing=Direction::NONE) { |
|
26 | + $labelO=new HtmlLabel("", $label); |
|
27 | 27 | $labelO->setPointing($pointing); |
28 | - $this->addContent($labelO,$pointing==="below" || $pointing==="right"); |
|
28 | + $this->addContent($labelO, $pointing==="below" || $pointing==="right"); |
|
29 | 29 | return $labelO; |
30 | 30 | } |
31 | 31 | |
32 | - public function setLabel($label){ |
|
32 | + public function setLabel($label) { |
|
33 | 33 | $labelO=$label; |
34 | - if(\is_string($label)){ |
|
35 | - $labelO=new HtmlSemDoubleElement("","label",""); |
|
34 | + if (\is_string($label)) { |
|
35 | + $labelO=new HtmlSemDoubleElement("", "label", ""); |
|
36 | 36 | $labelO->setContent($label); |
37 | - $labelO->setProperty("for", \str_replace("field-", "",$this->identifier)); |
|
37 | + $labelO->setProperty("for", \str_replace("field-", "", $this->identifier)); |
|
38 | 38 | } |
39 | 39 | $this->content["label"]=$labelO; |
40 | 40 | } |
41 | 41 | |
42 | - public function setField($field){ |
|
42 | + public function setField($field) { |
|
43 | 43 | $this->content["field"]=$field; |
44 | 44 | } |
45 | 45 | |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | * Returns the label or null |
48 | 48 | * @return mixed |
49 | 49 | */ |
50 | - public function getLabel(){ |
|
51 | - if(\array_key_exists("label", $this->content)) |
|
50 | + public function getLabel() { |
|
51 | + if (\array_key_exists("label", $this->content)) |
|
52 | 52 | return $this->content["label"]; |
53 | 53 | } |
54 | 54 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * Return the field |
57 | 57 | * @return mixed |
58 | 58 | */ |
59 | - public function getField(){ |
|
59 | + public function getField() { |
|
60 | 60 | return $this->content["field"]; |
61 | 61 | } |
62 | 62 | |
@@ -64,14 +64,14 @@ discard block |
||
64 | 64 | * Return the field with data |
65 | 65 | * @return mixed |
66 | 66 | */ |
67 | - public function getDataField(){ |
|
67 | + public function getDataField() { |
|
68 | 68 | return $this->content["field"]; |
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
72 | 72 | * puts the label before or behind |
73 | 73 | */ |
74 | - public function swapLabel(){ |
|
74 | + public function swapLabel() { |
|
75 | 75 | $label=$this->getLabel(); |
76 | 76 | unset($this->content["label"]); |
77 | 77 | $this->content["label"]=$label; |
@@ -82,31 +82,31 @@ discard block |
||
82 | 82 | * @param int $width |
83 | 83 | * @return \Ajax\semantic\html\collections\form\HtmlFormField |
84 | 84 | */ |
85 | - public function setWidth($width){ |
|
86 | - if(\is_int($width)){ |
|
85 | + public function setWidth($width) { |
|
86 | + if (\is_int($width)) { |
|
87 | 87 | $width=Wide::getConstants()["W".$width]; |
88 | 88 | } |
89 | 89 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
90 | - if(isset($this->_container)){ |
|
90 | + if (isset($this->_container)) { |
|
91 | 91 | $this->_container->setEqualWidth(false); |
92 | 92 | } |
93 | - return $this->addToPropertyCtrl("class", "wide",array("wide")); |
|
93 | + return $this->addToPropertyCtrl("class", "wide", array("wide")); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
97 | 97 | * Field displays an error state |
98 | 98 | * @return \Ajax\semantic\html\collections\form\HtmlFormField |
99 | 99 | */ |
100 | - public function setError(){ |
|
100 | + public function setError() { |
|
101 | 101 | return $this->addToProperty("class", "error"); |
102 | 102 | } |
103 | 103 | |
104 | - public function setInline(){ |
|
104 | + public function setInline() { |
|
105 | 105 | return $this->addToProperty("class", "inline"); |
106 | 106 | } |
107 | 107 | |
108 | - public function jsState($state){ |
|
109 | - return $this->jsDoJquery("addClass",$state); |
|
108 | + public function jsState($state) { |
|
109 | + return $this->jsDoJquery("addClass", $state); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | public function setContainer($_container) { |
@@ -114,23 +114,23 @@ discard block |
||
114 | 114 | return $this; |
115 | 115 | } |
116 | 116 | |
117 | - public function setReadonly(){ |
|
117 | + public function setReadonly() { |
|
118 | 118 | $this->getField()->setProperty("readonly", ""); |
119 | 119 | } |
120 | 120 | |
121 | - public function addRule($type,$prompt=NULL,$value=NULL){ |
|
121 | + public function addRule($type, $prompt=NULL, $value=NULL) { |
|
122 | 122 | $field=$this->getDataField(); |
123 | - if(isset($field)){ |
|
124 | - if(!isset($this->_validation)){ |
|
123 | + if (isset($field)) { |
|
124 | + if (!isset($this->_validation)) { |
|
125 | 125 | $this->_validation=new FieldValidation($field->getIdentifier()); |
126 | 126 | } |
127 | - $this->_validation->addRule($type,$prompt,$value); |
|
127 | + $this->_validation->addRule($type, $prompt, $value); |
|
128 | 128 | } |
129 | 129 | return $this; |
130 | 130 | } |
131 | 131 | |
132 | - public function addRules(array $rules){ |
|
133 | - foreach ($rules as $rule){ |
|
132 | + public function addRules(array $rules) { |
|
133 | + foreach ($rules as $rule) { |
|
134 | 134 | $this->addRule($rule); |
135 | 135 | } |
136 | 136 | return $this; |
@@ -9,17 +9,17 @@ |
||
9 | 9 | class HtmlFormTextarea extends HtmlFormField { |
10 | 10 | use TextFieldsTrait; |
11 | 11 | |
12 | - public function __construct($identifier, $label=NULL,$value=NULL,$placeholder=NULL,$rows=NULL) { |
|
13 | - if(!isset($placeholder)) |
|
12 | + public function __construct($identifier, $label=NULL, $value=NULL, $placeholder=NULL, $rows=NULL) { |
|
13 | + if (!isset($placeholder)) |
|
14 | 14 | $placeholder=$label; |
15 | - parent::__construct("field-".$identifier, new HtmlTextarea($identifier,$value,$placeholder,$rows), $label); |
|
15 | + parent::__construct("field-".$identifier, new HtmlTextarea($identifier, $value, $placeholder, $rows), $label); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Defines the textarea row count |
20 | 20 | * @param int $count |
21 | 21 | */ |
22 | - public function setRows($count){ |
|
22 | + public function setRows($count) { |
|
23 | 23 | $this->getField()->setRows($count); |
24 | 24 | } |
25 | 25 |
@@ -7,17 +7,17 @@ |
||
7 | 7 | use Ajax\semantic\html\elements\HtmlInput; |
8 | 8 | |
9 | 9 | class HtmlFormInput extends HtmlFormField { |
10 | - use TextFieldsTrait,FieldTrait; |
|
10 | + use TextFieldsTrait, FieldTrait; |
|
11 | 11 | |
12 | - public function __construct($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL) { |
|
13 | - if(!isset($placeholder) && $type==="text") |
|
12 | + public function __construct($identifier, $label=NULL, $type="text", $value=NULL, $placeholder=NULL) { |
|
13 | + if (!isset($placeholder) && $type==="text") |
|
14 | 14 | $placeholder=$label; |
15 | - parent::__construct("field-".$identifier, new HtmlInput($identifier,$type,$value,$placeholder), $label); |
|
15 | + parent::__construct("field-".$identifier, new HtmlInput($identifier, $type, $value, $placeholder), $label); |
|
16 | 16 | } |
17 | 17 | |
18 | - public function getDataField(){ |
|
19 | - $field= $this->getField(); |
|
20 | - if($field instanceof HtmlInput) |
|
18 | + public function getDataField() { |
|
19 | + $field=$this->getField(); |
|
20 | + if ($field instanceof HtmlInput) |
|
21 | 21 | $field=$field->getField(); |
22 | 22 | return $field; |
23 | 23 | } |
@@ -11,33 +11,33 @@ discard block |
||
11 | 11 | use Ajax\semantic\html\collections\form\HtmlFormField; |
12 | 12 | |
13 | 13 | trait FieldsTrait { |
14 | - public abstract function addFields($fields=NULL,$label=NULL); |
|
14 | + public abstract function addFields($fields=NULL, $label=NULL); |
|
15 | 15 | public abstract function addItem($item); |
16 | 16 | |
17 | - protected function createItem($value){ |
|
18 | - if(\is_array($value)){ |
|
19 | - $itemO=new HtmlFormInput(JArray::getDefaultValue($value, "id",""),JArray::getDefaultValue($value, "label",null),JArray::getDefaultValue($value, "type", "text"),JArray::getDefaultValue($value, "value",""),JArray::getDefaultValue($value, "placeholder",JArray::getDefaultValue($value, "label",null))); |
|
17 | + protected function createItem($value) { |
|
18 | + if (\is_array($value)) { |
|
19 | + $itemO=new HtmlFormInput(JArray::getDefaultValue($value, "id", ""), JArray::getDefaultValue($value, "label", null), JArray::getDefaultValue($value, "type", "text"), JArray::getDefaultValue($value, "value", ""), JArray::getDefaultValue($value, "placeholder", JArray::getDefaultValue($value, "label", null))); |
|
20 | 20 | return $itemO; |
21 | - }elseif(\is_object($value)){ |
|
21 | + }elseif (\is_object($value)) { |
|
22 | 22 | $itemO=new HtmlFormField("field-".$this->identifier, $value); |
23 | 23 | return $itemO; |
24 | - }else |
|
24 | + } else |
|
25 | 25 | return new HtmlFormInput($value); |
26 | 26 | } |
27 | 27 | |
28 | - protected function createCondition($value){ |
|
28 | + protected function createCondition($value) { |
|
29 | 29 | return \is_object($value)===false || $value instanceof \Ajax\semantic\html\elements\HtmlInput; |
30 | 30 | } |
31 | 31 | |
32 | - public function addInputs($inputs,$fieldslabel=null){ |
|
32 | + public function addInputs($inputs, $fieldslabel=null) { |
|
33 | 33 | $fields=array(); |
34 | - foreach ($inputs as $input){ |
|
34 | + foreach ($inputs as $input) { |
|
35 | 35 | \extract($input); |
36 | - $f=new HtmlFormInput("",""); |
|
36 | + $f=new HtmlFormInput("", ""); |
|
37 | 37 | $f->fromArray($input); |
38 | 38 | $fields[]=$f; |
39 | 39 | } |
40 | - return $this->addFields($fields,$fieldslabel); |
|
40 | + return $this->addFields($fields, $fieldslabel); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -48,27 +48,27 @@ discard block |
||
48 | 48 | * @param boolean $multiple |
49 | 49 | * @return \Ajax\common\html\HtmlDoubleElement |
50 | 50 | */ |
51 | - public function addDropdown($identifier,$items=array(), $label=NULL,$value=NULL,$multiple=false){ |
|
52 | - return $this->addItem(new HtmlFormDropdown($identifier,$items,$label,$value,$multiple)); |
|
51 | + public function addDropdown($identifier, $items=array(), $label=NULL, $value=NULL, $multiple=false) { |
|
52 | + return $this->addItem(new HtmlFormDropdown($identifier, $items, $label, $value, $multiple)); |
|
53 | 53 | } |
54 | 54 | |
55 | - public function addInput($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL){ |
|
56 | - return $this->addItem(new HtmlFormInput($identifier,$label,$type,$value,$placeholder)); |
|
55 | + public function addInput($identifier, $label=NULL, $type="text", $value=NULL, $placeholder=NULL) { |
|
56 | + return $this->addItem(new HtmlFormInput($identifier, $label, $type, $value, $placeholder)); |
|
57 | 57 | } |
58 | 58 | |
59 | - public function addPassword($identifier, $label=NULL){ |
|
60 | - return $this->addItem(new HtmlFormInput($identifier,$label,"password","","")); |
|
59 | + public function addPassword($identifier, $label=NULL) { |
|
60 | + return $this->addItem(new HtmlFormInput($identifier, $label, "password", "", "")); |
|
61 | 61 | } |
62 | 62 | |
63 | - public function addButton($identifier,$value,$cssStyle=NULL,$onClick=NULL){ |
|
64 | - return $this->addItem(new HtmlButton($identifier,$value,$cssStyle,$onClick)); |
|
63 | + public function addButton($identifier, $value, $cssStyle=NULL, $onClick=NULL) { |
|
64 | + return $this->addItem(new HtmlButton($identifier, $value, $cssStyle, $onClick)); |
|
65 | 65 | } |
66 | 66 | |
67 | - public function addCheckbox($identifier, $label=NULL,$value=NULL,$type=NULL){ |
|
68 | - return $this->addItem(new HtmlFormCheckbox($identifier,$label,$value,$type)); |
|
67 | + public function addCheckbox($identifier, $label=NULL, $value=NULL, $type=NULL) { |
|
68 | + return $this->addItem(new HtmlFormCheckbox($identifier, $label, $value, $type)); |
|
69 | 69 | } |
70 | 70 | |
71 | - public function addRadio($identifier, $name,$label=NULL,$value=NULL){ |
|
72 | - return $this->addItem(new HtmlFormRadio($identifier,$name,$label,$value)); |
|
71 | + public function addRadio($identifier, $name, $label=NULL, $value=NULL) { |
|
72 | + return $this->addItem(new HtmlFormRadio($identifier, $name, $label, $value)); |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | \ No newline at end of file |
@@ -37,12 +37,12 @@ discard block |
||
37 | 37 | * @return \Ajax\semantic\html\collections\HtmlMenu |
38 | 38 | */ |
39 | 39 | public function setType($type="") { |
40 | - return $this->addToPropertyCtrl("class", $type, array ("","item","text" )); |
|
40 | + return $this->addToPropertyCtrl("class", $type, array("", "item", "text")); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | public function setActiveItem($index) { |
44 | 44 | $item=$this->getItem($index); |
45 | - if ($item !== null) { |
|
45 | + if ($item!==null) { |
|
46 | 46 | $item->addToProperty("class", "active"); |
47 | 47 | } |
48 | 48 | return $this; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | private function getItemToInsert($item) { |
52 | 52 | if ($item instanceof HtmlInput || $item instanceof HtmlImg || $item instanceof HtmlIcon || $item instanceof HtmlButton || ($item instanceof HtmlDropdown && $this->propertyContains("class", "vertical")===false)) { |
53 | - $itemO=new HtmlMenuItem("item-" . $this->identifier . "-" . \sizeof($this->content) , $item); |
|
53 | + $itemO=new HtmlMenuItem("item-".$this->identifier."-".\sizeof($this->content), $item); |
|
54 | 54 | $item=$itemO; |
55 | 55 | } |
56 | 56 | return $item; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | private function afterInsert($item) { |
60 | 60 | if (!$item instanceof HtmlMenu && $item->propertyContains("class", "header")===false) |
61 | - $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
61 | + $item->addToPropertyCtrl("class", "item", array("item")); |
|
62 | 62 | else { |
63 | 63 | $this->setSecondary(); |
64 | 64 | } |
@@ -89,15 +89,15 @@ discard block |
||
89 | 89 | |
90 | 90 | public function generateMenuAsItem($menu, $header=null) { |
91 | 91 | $count=$this->count(); |
92 | - $item=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "div"); |
|
92 | + $item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div"); |
|
93 | 93 | if (isset($header)) { |
94 | - $headerItem=new HtmlSemDoubleElement("item-header-" . $this->identifier . "-" . $count, "div", "header"); |
|
94 | + $headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header"); |
|
95 | 95 | $headerItem->setContent($header); |
96 | 96 | $item->addContent($headerItem); |
97 | 97 | $this->_itemHeader=$headerItem; |
98 | 98 | } |
99 | - if(\is_array($menu)){ |
|
100 | - $menu=new HtmlMenu("menu-" . $this->identifier . "-" . $count,$menu); |
|
99 | + if (\is_array($menu)) { |
|
100 | + $menu=new HtmlMenu("menu-".$this->identifier."-".$count, $menu); |
|
101 | 101 | } |
102 | 102 | $menu->setClass("menu"); |
103 | 103 | $item->addContent($menu); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $value=new HtmlSemDoubleElement($identifier, "a", "browse item", $value); |
113 | 113 | $value->addContent(new HtmlIcon("", "dropdown")); |
114 | 114 | $value=$this->addItem($value); |
115 | - $popup=new HtmlPopup($value, "popup-" . $this->identifier . "-" . $this->count(), $content); |
|
115 | + $popup=new HtmlPopup($value, "popup-".$this->identifier."-".$this->count(), $content); |
|
116 | 116 | $popup->setFlowing()->setPosition("bottom left")->setOn("click"); |
117 | 117 | $this->wrap("", $popup); |
118 | 118 | return $popup; |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | public function addDropdownAsItem($value, $items=NULL) { |
122 | 122 | $dd=$value; |
123 | 123 | if (\is_string($value)) { |
124 | - $dd=new HtmlDropdown("dropdown-" . $this->identifier . "-" . $this->count(), $value, $items); |
|
124 | + $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(), $value, $items); |
|
125 | 125 | } |
126 | 126 | $this->addItem($dd); |
127 | 127 | return $dd; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
135 | 135 | */ |
136 | 136 | protected function createItem($value) { |
137 | - $itemO=new HtmlMenuItem($this->identifier."-item-" . \sizeof($this->content),""); |
|
137 | + $itemO=new HtmlMenuItem($this->identifier."-item-".\sizeof($this->content), ""); |
|
138 | 138 | $itemO->setTagName("a"); |
139 | 139 | $itemO->setContent($value); |
140 | 140 | return $itemO; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | } |
146 | 146 | |
147 | 147 | public function setSecondary($value=true) { |
148 | - if($value) |
|
148 | + if ($value) |
|
149 | 149 | $this->addToProperty("class", "secondary"); |
150 | 150 | else |
151 | 151 | $this->removePropertyValue("class", "secondary"); |
@@ -153,28 +153,28 @@ discard block |
||
153 | 153 | } |
154 | 154 | |
155 | 155 | public function setVertical() { |
156 | - return $this->addToPropertyCtrl("class", "vertical", array ("vertical" )); |
|
156 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | public function setPosition($value="right") { |
160 | - return $this->addToPropertyCtrl("class", $value, array ("right","left" )); |
|
160 | + return $this->addToPropertyCtrl("class", $value, array("right", "left")); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | public function setPointing($value=Direction::NONE) { |
164 | - return $this->addToPropertyCtrl("class", $value . " pointing", Direction::getConstantValues("pointing")); |
|
164 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | public function asTab($vertical=false) { |
168 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
168 | + $this->apply(function(HtmlDoubleElement&$item) { |
|
169 | 169 | $item->setTagName("a"); |
170 | 170 | }); |
171 | - if ($vertical === true) |
|
171 | + if ($vertical===true) |
|
172 | 172 | $this->setVertical(); |
173 | 173 | return $this->addToProperty("class", "tabular"); |
174 | 174 | } |
175 | 175 | |
176 | 176 | public function asPagination() { |
177 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
177 | + $this->apply(function(HtmlDoubleElement&$item) { |
|
178 | 178 | $item->setTagName("a"); |
179 | 179 | }); |
180 | 180 | return $this->addToProperty("class", "pagination"); |
@@ -211,10 +211,10 @@ discard block |
||
211 | 211 | */ |
212 | 212 | public function setWidth($width) { |
213 | 213 | if (\is_int($width)) { |
214 | - $width=Wide::getConstants()["W" . $width]; |
|
214 | + $width=Wide::getConstants()["W".$width]; |
|
215 | 215 | } |
216 | 216 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
217 | - return $this->addToPropertyCtrl("class", "item", array ("item" )); |
|
217 | + return $this->addToPropertyCtrl("class", "item", array("item")); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | public function addImage($identifier, $src="", $alt="") { |
@@ -36,11 +36,11 @@ discard block |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | public function asSegment() { |
39 | - return $this->addToPropertyCtrl("class", "segment", array ("segment" )); |
|
39 | + return $this->addToPropertyCtrl("class", "segment", array("segment")); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | public function asContainer() { |
43 | - return $this->addToPropertyCtrl("class", "container", array ("container" )); |
|
43 | + return $this->addToPropertyCtrl("class", "container", array("container")); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -48,10 +48,10 @@ discard block |
||
48 | 48 | * @param int $wide |
49 | 49 | */ |
50 | 50 | public function setWide($wide) { |
51 | - if(isset(Wide::getConstants()["W" . $wide])){ |
|
52 | - $wide=Wide::getConstants()["W" . $wide]; |
|
51 | + if (isset(Wide::getConstants()["W".$wide])) { |
|
52 | + $wide=Wide::getConstants()["W".$wide]; |
|
53 | 53 | $this->addToPropertyCtrl("class", $wide, Wide::getConstants()); |
54 | - return $this->addToPropertyCtrl("class", "column", array ("column" )); |
|
54 | + return $this->addToPropertyCtrl("class", "column", array("column")); |
|
55 | 55 | } |
56 | 56 | return $this; |
57 | 57 | } |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | * @return mixed |
72 | 72 | */ |
73 | 73 | public function addRow($colsCount=NULL) { |
74 | - $rowCount=$this->rowCount() + 1; |
|
74 | + $rowCount=$this->rowCount()+1; |
|
75 | 75 | $this->setRowsCount($rowCount, $colsCount, true); |
76 | - return $this->content[$rowCount - 1]; |
|
76 | + return $this->content[$rowCount-1]; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | * @return mixed|\Ajax\semantic\html\collections\HtmlGrid |
83 | 83 | */ |
84 | 84 | public function addCol($width=NULL) { |
85 | - $colCount=$this->colCount() + 1; |
|
85 | + $colCount=$this->colCount()+1; |
|
86 | 86 | $this->setColsCount($colCount, true, $width); |
87 | 87 | if ($this->hasOnlyCols($this->count())) |
88 | - return $this->content[$colCount - 1]; |
|
88 | + return $this->content[$colCount-1]; |
|
89 | 89 | return $this; |
90 | 90 | } |
91 | 91 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @return \Ajax\semantic\html\collections\HtmlGrid |
96 | 96 | */ |
97 | 97 | public function addCols($sizes=array()) { |
98 | - foreach ( $sizes as $size ) { |
|
98 | + foreach ($sizes as $size) { |
|
99 | 99 | $this->addCol($size); |
100 | 100 | } |
101 | 101 | return $this; |
@@ -109,19 +109,19 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function setRowsCount($rowsCount, $colsCount=NULL, $force=false) { |
111 | 111 | $count=$this->count(); |
112 | - if ($rowsCount < 2 && $force === false) { |
|
113 | - for($i=$count; $i < $colsCount; $i++) { |
|
114 | - $this->addItem(new HtmlGridCol("col-" . $this->identifier . "-" . $i)); |
|
112 | + if ($rowsCount<2 && $force===false) { |
|
113 | + for ($i=$count; $i<$colsCount; $i++) { |
|
114 | + $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i)); |
|
115 | 115 | } |
116 | 116 | } else { |
117 | 117 | if ($this->hasOnlyCols($count)) { |
118 | 118 | $tmpContent=$this->content; |
119 | 119 | $item=$this->addItem($colsCount); |
120 | 120 | $item->setContent($tmpContent); |
121 | - $this->content=array (); |
|
121 | + $this->content=array(); |
|
122 | 122 | $count=1; |
123 | 123 | } |
124 | - for($i=$count; $i < $rowsCount; $i++) { |
|
124 | + for ($i=$count; $i<$rowsCount; $i++) { |
|
125 | 125 | $this->addItem($colsCount); |
126 | 126 | } |
127 | 127 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | } |
130 | 130 | |
131 | 131 | protected function hasOnlyCols($count) { |
132 | - return $count > 0 && $this->content[0] instanceof HtmlGridCol; |
|
132 | + return $count>0 && $this->content[0] instanceof HtmlGridCol; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -143,14 +143,14 @@ discard block |
||
143 | 143 | if (isset($width)==false) { |
144 | 144 | $this->setWide($numCols); |
145 | 145 | } |
146 | - if ($toCreate == true) { |
|
146 | + if ($toCreate==true) { |
|
147 | 147 | $count=$this->count(); |
148 | - if ($count == 0 || $this->hasOnlyCols($count)) { |
|
149 | - for($i=$count; $i < $numCols; $i++) { |
|
150 | - $this->addItem(new HtmlGridCol("col-" . $this->identifier . "-" . $i, $width)); |
|
148 | + if ($count==0 || $this->hasOnlyCols($count)) { |
|
149 | + for ($i=$count; $i<$numCols; $i++) { |
|
150 | + $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i, $width)); |
|
151 | 151 | } |
152 | 152 | } else { |
153 | - for($i=0; $i < $count; $i++) { |
|
153 | + for ($i=0; $i<$count; $i++) { |
|
154 | 154 | $this->getItem($i)->setColsCount($numCols); |
155 | 155 | } |
156 | 156 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $count=$this->count(); |
187 | 187 | if ($this->hasOnlyCols($count)) |
188 | 188 | return $count; |
189 | - if ($count > 0) |
|
189 | + if ($count>0) |
|
190 | 190 | return $this->getItem(0)->count(); |
191 | 191 | return 0; |
192 | 192 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
199 | 199 | */ |
200 | 200 | public function getCell($row, $col) { |
201 | - if ($row < 2 && $this->hasOnlyCols($this->count())) |
|
201 | + if ($row<2 && $this->hasOnlyCols($this->count())) |
|
202 | 202 | return $this->getItem($col); |
203 | 203 | $row=$this->getItem($row); |
204 | 204 | if (isset($row)) { |
@@ -213,8 +213,8 @@ discard block |
||
213 | 213 | * @return \Ajax\semantic\html\collections\HtmlGrid |
214 | 214 | */ |
215 | 215 | public function setDivided($vertically=false) { |
216 | - $value=($vertically === true) ? "vertically divided" : "divided"; |
|
217 | - return $this->addToPropertyCtrl("class", $value, array ("divided" )); |
|
216 | + $value=($vertically===true) ? "vertically divided" : "divided"; |
|
217 | + return $this->addToPropertyCtrl("class", $value, array("divided")); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | /** |
@@ -223,15 +223,15 @@ discard block |
||
223 | 223 | * @return \Ajax\semantic\html\collections\HtmlGrid |
224 | 224 | */ |
225 | 225 | public function setCelled($internally=false) { |
226 | - $value=($internally === true) ? "internally celled" : "celled"; |
|
227 | - return $this->addToPropertyCtrl("class", $value, array ("celled","internally celled" )); |
|
226 | + $value=($internally===true) ? "internally celled" : "celled"; |
|
227 | + return $this->addToPropertyCtrl("class", $value, array("celled", "internally celled")); |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | /** |
231 | 231 | * A grid can have its columns centered |
232 | 232 | */ |
233 | 233 | public function setCentered() { |
234 | - return $this->addToPropertyCtrl("class", "centered", array ("centered" )); |
|
234 | + return $this->addToPropertyCtrl("class", "centered", array("centered")); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | /** |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | */ |
250 | 250 | public function setPadded($value=NULL) { |
251 | 251 | if (isset($value)) |
252 | - $this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" )); |
|
252 | + $this->addToPropertyCtrl("class", $value, array("vertically", "horizontally")); |
|
253 | 253 | return $this->addToProperty("class", "padded"); |
254 | 254 | } |
255 | 255 | |
@@ -259,12 +259,12 @@ discard block |
||
259 | 259 | * @return \Ajax\semantic\html\collections\HtmlGrid |
260 | 260 | */ |
261 | 261 | public function setRelaxed($very=false) { |
262 | - $value=($very === true) ? "very relaxed" : "relaxed"; |
|
263 | - return $this->addToPropertyCtrl("class", $value, array ("relaxed","very relaxed" )); |
|
262 | + $value=($very===true) ? "very relaxed" : "relaxed"; |
|
263 | + return $this->addToPropertyCtrl("class", $value, array("relaxed", "very relaxed")); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | public function setVerticalAlignment($value=VerticalAlignment::MIDDLE) { |
267 | - return $this->addToPropertyCtrl("class", $value . " aligned", VerticalAlignment::getConstantValues("aligned")); |
|
267 | + return $this->addToPropertyCtrl("class", $value." aligned", VerticalAlignment::getConstantValues("aligned")); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | /** |
@@ -274,9 +274,9 @@ discard block |
||
274 | 274 | * @see \Ajax\common\html\HtmlCollection::createItem() |
275 | 275 | */ |
276 | 276 | protected function createItem($value) { |
277 | - if ($this->_createCols === false) |
|
277 | + if ($this->_createCols===false) |
|
278 | 278 | $value=null; |
279 | - $item=new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $value, $this->_colSizing, $this->_implicitRows); |
|
279 | + $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1), $value, $this->_colSizing, $this->_implicitRows); |
|
280 | 280 | return $item; |
281 | 281 | } |
282 | 282 | |
@@ -286,15 +286,15 @@ discard block |
||
286 | 286 | */ |
287 | 287 | public function setValues($values, $force=true) { |
288 | 288 | $count=$this->count(); |
289 | - if ($this->_createCols === false || $force === true) { |
|
290 | - for($i=$count; $i < \sizeof($values); $i++) { |
|
289 | + if ($this->_createCols===false || $force===true) { |
|
290 | + for ($i=$count; $i<\sizeof($values); $i++) { |
|
291 | 291 | $colSize=\sizeof($values[$i]); |
292 | - $this->addItem(new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $colSize, $this->_colSizing, $this->_implicitRows)); |
|
292 | + $this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1), $colSize, $this->_colSizing, $this->_implicitRows)); |
|
293 | 293 | } |
294 | 294 | } |
295 | - $count=\min(array ($this->count(),\sizeof($values) )); |
|
296 | - for($i=0; $i < $count; $i++) { |
|
297 | - $this->content[$i]->setValues($values[$i], $this->_createCols === false); |
|
295 | + $count=\min(array($this->count(), \sizeof($values))); |
|
296 | + for ($i=0; $i<$count; $i++) { |
|
297 | + $this->content[$i]->setValues($values[$i], $this->_createCols===false); |
|
298 | 298 | } |
299 | 299 | } |
300 | 300 |
@@ -33,17 +33,17 @@ discard block |
||
33 | 33 | return $this->getHtmlCk()->attachEvents($events); |
34 | 34 | } |
35 | 35 | |
36 | - public function getField(){ |
|
36 | + public function getField() { |
|
37 | 37 | return $this->content["field"]->getField(); |
38 | 38 | } |
39 | 39 | |
40 | - public function getHtmlCk(){ |
|
40 | + public function getHtmlCk() { |
|
41 | 41 | return $this->content["field"]; |
42 | 42 | } |
43 | 43 | |
44 | - public function getDataField(){ |
|
45 | - $field= $this->getField(); |
|
46 | - if($field instanceof AbstractCheckbox) |
|
44 | + public function getDataField() { |
|
45 | + $field=$this->getField(); |
|
46 | + if ($field instanceof AbstractCheckbox) |
|
47 | 47 | $field=$field->getField(); |
48 | 48 | return $field; |
49 | 49 | } |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | * @param boolean $value |
54 | 54 | * @return \Ajax\semantic\html\collections\form\traits\CheckboxTrait |
55 | 55 | */ |
56 | - public function setChecked($value=true){ |
|
57 | - if($value===true){ |
|
56 | + public function setChecked($value=true) { |
|
57 | + if ($value===true) { |
|
58 | 58 | $this->getDataField()->setProperty("checked", "checked"); |
59 | - }else{ |
|
59 | + } else { |
|
60 | 60 | $this->getDataField()->removeProperty("checked"); |
61 | 61 | } |
62 | 62 | return $this; |
@@ -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); |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | $this->setLabel($label); |
18 | 18 | } |
19 | 19 | |
20 | - public function setChecked($value=true){ |
|
21 | - if($value===true){ |
|
20 | + public function setChecked($value=true) { |
|
21 | + if ($value===true) { |
|
22 | 22 | $this->getField()->setProperty("checked", "checked"); |
23 | - }else{ |
|
23 | + } else { |
|
24 | 24 | $this->getField()->removeProperty("checked"); |
25 | 25 | } |
26 | 26 | return $this; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @return \Ajax\semantic\html\collections\form\AbstractHtmlFormRadioCheckbox |
83 | 83 | */ |
84 | 84 | public function attachEvent($selector, $action=NULL) { |
85 | - if (isset($action)!==false||\is_numeric($action)===true) { |
|
85 | + if (isset($action)!==false || \is_numeric($action)===true) { |
|
86 | 86 | $js='$("#%identifier%").checkbox("attach events", "'.$selector.'", "'.$action.'");'; |
87 | 87 | } else { |
88 | 88 | $js='$("#%identifier%").checkbox("attach events", "'.$selector.'");'; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function attachEvents($events=array()) { |
100 | 100 | if (\is_array($events)) { |
101 | - foreach ( $events as $action => $selector ) { |
|
101 | + foreach ($events as $action => $selector) { |
|
102 | 102 | $this->attachEvent($selector, $action); |
103 | 103 | } |
104 | 104 | } |