@@ -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 |
@@ -36,7 +36,7 @@ |
||
36 | 36 | foreach ($icons as $icon=>$size){ |
37 | 37 | $group->addIcon($icon,$size); |
38 | 38 | } |
39 | - }else{ |
|
39 | + } else{ |
|
40 | 40 | foreach ($icons as $icon){ |
41 | 41 | $group->addIcon($icon); |
42 | 42 | } |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @param boolean $asIcons |
43 | 43 | * @return HtmlButtonGroups |
44 | 44 | */ |
45 | - public function htmlButtonGroups($identifier,$elements=array(),$asIcons=false){ |
|
46 | - return $this->addHtmlComponent(new HtmlButtonGroups($identifier, $elements,$asIcons)); |
|
45 | + public function htmlButtonGroups($identifier, $elements=array(), $asIcons=false) { |
|
46 | + return $this->addHtmlComponent(new HtmlButtonGroups($identifier, $elements, $asIcons)); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @param string $content |
53 | 53 | * @return HtmlContainer |
54 | 54 | */ |
55 | - public function htmlContainer($identifier,$content=""){ |
|
55 | + public function htmlContainer($identifier, $content="") { |
|
56 | 56 | return $this->addHtmlComponent(new HtmlContainer($identifier, $content)); |
57 | 57 | } |
58 | 58 | |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | * @param string $content |
62 | 62 | * @return HtmlDivider |
63 | 63 | */ |
64 | - public function htmlDivider($identifier,$content="",$tagName="div"){ |
|
65 | - return $this->addHtmlComponent(new HtmlDivider($identifier, $content,$tagName)); |
|
64 | + public function htmlDivider($identifier, $content="", $tagName="div") { |
|
65 | + return $this->addHtmlComponent(new HtmlDivider($identifier, $content, $tagName)); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | * @param string $type |
73 | 73 | * @return HtmlHeader |
74 | 74 | */ |
75 | - public function htmlHeader($identifier,$niveau=1,$content=NULL,$type="page"){ |
|
76 | - return $this->addHtmlComponent(new HtmlHeader($identifier,$niveau,$content,$type)); |
|
75 | + public function htmlHeader($identifier, $niveau=1, $content=NULL, $type="page") { |
|
76 | + return $this->addHtmlComponent(new HtmlHeader($identifier, $niveau, $content, $type)); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * @param string $icon |
82 | 82 | * @return HtmlIcon |
83 | 83 | */ |
84 | - public function htmlIcon($identifier,$icon){ |
|
84 | + public function htmlIcon($identifier, $icon) { |
|
85 | 85 | return $this->addHtmlComponent(new HtmlIcon($identifier, $icon)); |
86 | 86 | } |
87 | 87 | |
@@ -91,14 +91,14 @@ discard block |
||
91 | 91 | * @param array $icons |
92 | 92 | * @return HtmlIconGroups |
93 | 93 | */ |
94 | - public function htmlIconGroups($identifier,$size="",$icons=array()){ |
|
95 | - $group=new HtmlIconGroups($identifier,$size); |
|
96 | - if(JArray::isAssociative($icons)){ |
|
97 | - foreach ($icons as $icon=>$size){ |
|
98 | - $group->add($icon,$size); |
|
94 | + public function htmlIconGroups($identifier, $size="", $icons=array()) { |
|
95 | + $group=new HtmlIconGroups($identifier, $size); |
|
96 | + if (JArray::isAssociative($icons)) { |
|
97 | + foreach ($icons as $icon=>$size) { |
|
98 | + $group->add($icon, $size); |
|
99 | 99 | } |
100 | - }else{ |
|
101 | - foreach ($icons as $icon){ |
|
100 | + }else { |
|
101 | + foreach ($icons as $icon) { |
|
102 | 102 | $group->add($icon); |
103 | 103 | } |
104 | 104 | } |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | * @param string $placeholder |
114 | 114 | * @return HtmlInput |
115 | 115 | */ |
116 | - public function htmlInput($identifier,$type="text",$value="",$placeholder=""){ |
|
117 | - return $this->addHtmlComponent(new HtmlInput($identifier,$type,$value,$placeholder)); |
|
116 | + public function htmlInput($identifier, $type="text", $value="", $placeholder="") { |
|
117 | + return $this->addHtmlComponent(new HtmlInput($identifier, $type, $value, $placeholder)); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | * @param string $tagName |
124 | 124 | * @return HtmlLabel |
125 | 125 | */ |
126 | - public function htmlLabel($identifier,$content="",$tagName="div"){ |
|
127 | - return $this->addHtmlComponent(new HtmlLabel($identifier, $content,$tagName)); |
|
126 | + public function htmlLabel($identifier, $content="", $tagName="div") { |
|
127 | + return $this->addHtmlComponent(new HtmlLabel($identifier, $content, $tagName)); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | * @param array $items |
134 | 134 | * @return HtmlList |
135 | 135 | */ |
136 | - public function htmlList($identifier,$items=array()){ |
|
137 | - return $this->addHtmlComponent(new HtmlList($identifier,$items)); |
|
136 | + public function htmlList($identifier, $items=array()) { |
|
137 | + return $this->addHtmlComponent(new HtmlList($identifier, $items)); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | * @param string $content |
144 | 144 | * @return HtmlSegment |
145 | 145 | */ |
146 | - public function htmlSegment($identifier, $content=""){ |
|
147 | - return $this->addHtmlComponent(new HtmlSegment($identifier,$content)); |
|
146 | + public function htmlSegment($identifier, $content="") { |
|
147 | + return $this->addHtmlComponent(new HtmlSegment($identifier, $content)); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -153,8 +153,8 @@ discard block |
||
153 | 153 | * @param array $items the segments |
154 | 154 | * @return HtmlSegmentGroups |
155 | 155 | */ |
156 | - public function htmlSegmentGroups($identifier, $items=array()){ |
|
157 | - return $this->addHtmlComponent(new HtmlSegmentGroups($identifier,$items)); |
|
156 | + public function htmlSegmentGroups($identifier, $items=array()) { |
|
157 | + return $this->addHtmlComponent(new HtmlSegmentGroups($identifier, $items)); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -164,11 +164,11 @@ discard block |
||
164 | 164 | * @param RevealType|string $type |
165 | 165 | * @param Direction|string $attributeType |
166 | 166 | */ |
167 | - public function htmlReveal($identifier, $visibleContent,$hiddenContent,$type=RevealType::FADE,$attributeType=NULL){ |
|
168 | - return $this->addHtmlComponent(new HtmlReveal($identifier,$visibleContent,$hiddenContent,$type,$attributeType)); |
|
167 | + public function htmlReveal($identifier, $visibleContent, $hiddenContent, $type=RevealType::FADE, $attributeType=NULL) { |
|
168 | + return $this->addHtmlComponent(new HtmlReveal($identifier, $visibleContent, $hiddenContent, $type, $attributeType)); |
|
169 | 169 | } |
170 | 170 | |
171 | - public function htmlStep($identifier, $steps=array()){ |
|
172 | - return $this->addHtmlComponent(new HtmlStep($identifier,$steps)); |
|
171 | + public function htmlStep($identifier, $steps=array()) { |
|
172 | + return $this->addHtmlComponent(new HtmlStep($identifier, $steps)); |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | \ No newline at end of file |
@@ -3,7 +3,16 @@ |
||
3 | 3 | namespace Ajax\common\traits; |
4 | 4 | |
5 | 5 | trait JqueryEventsTrait { |
6 | + |
|
7 | + /** |
|
8 | + * @param string $element |
|
9 | + */ |
|
6 | 10 | public abstract function _prep_element($element); |
11 | + |
|
12 | + /** |
|
13 | + * @param string $element |
|
14 | + * @param string $event |
|
15 | + */ |
|
7 | 16 | public abstract function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true); |
8 | 17 | |
9 | 18 | /** |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | trait JqueryEventsTrait { |
6 | 6 | public abstract function _prep_element($element); |
7 | - public abstract function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true); |
|
7 | + public abstract function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true); |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Blur |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function _click($element='this', $js=array(), $ret_false=TRUE) { |
48 | 48 | if (!is_array($js)) { |
49 | - $js=array ( |
|
49 | + $js=array( |
|
50 | 50 | $js |
51 | 51 | ); |
52 | 52 | } |
@@ -21,6 +21,9 @@ discard block |
||
21 | 21 | protected $params=array("action"=>"nothing","on"=>"hover"); |
22 | 22 | protected $input; |
23 | 23 | |
24 | + /** |
|
25 | + * @param string $identifier |
|
26 | + */ |
|
24 | 27 | public function __construct($identifier, $value="", $items=array()) { |
25 | 28 | parent::__construct($identifier, "div"); |
26 | 29 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
@@ -47,7 +50,7 @@ discard block |
||
47 | 50 | /** |
48 | 51 | * Insert an item at a position |
49 | 52 | * @param mixed $item |
50 | - * @param number $position |
|
53 | + * @param integer $position |
|
51 | 54 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
52 | 55 | */ |
53 | 56 | public function insertItem($item,$position=0){ |
@@ -196,6 +199,9 @@ discard block |
||
196 | 199 | } |
197 | 200 | } |
198 | 201 | |
202 | + /** |
|
203 | + * @param string $action |
|
204 | + */ |
|
199 | 205 | public function setAction($action){ |
200 | 206 | $this->params["action"]=$action; |
201 | 207 | } |
@@ -17,31 +17,31 @@ discard block |
||
17 | 17 | } |
18 | 18 | protected $mClass="menu"; |
19 | 19 | protected $mTagName="div"; |
20 | - protected $items=array (); |
|
21 | - protected $_params=array("action"=>"nothing","on"=>"hover"); |
|
20 | + protected $items=array(); |
|
21 | + protected $_params=array("action"=>"nothing", "on"=>"hover"); |
|
22 | 22 | protected $input; |
23 | 23 | |
24 | 24 | public function __construct($identifier, $value="", $items=array()) { |
25 | 25 | parent::__construct($identifier, "div"); |
26 | 26 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
27 | 27 | $this->setProperty("class", "ui dropdown"); |
28 | - $content=new HtmlSemDoubleElement("text-".$this->identifier,"div"); |
|
28 | + $content=new HtmlSemDoubleElement("text-".$this->identifier, "div"); |
|
29 | 29 | $content->setClass("text"); |
30 | 30 | $content->setContent($value); |
31 | - $content->wrap("",new HtmlIcon("", "dropdown")); |
|
31 | + $content->wrap("", new HtmlIcon("", "dropdown")); |
|
32 | 32 | $this->content=array($content); |
33 | 33 | $this->tagName="div"; |
34 | 34 | $this->addItems($items); |
35 | 35 | } |
36 | 36 | |
37 | - public function addItem($item,$value=NULL,$image=NULL){ |
|
38 | - $itemO=$this->beforeAddItem($item,$value,$image); |
|
37 | + public function addItem($item, $value=NULL, $image=NULL) { |
|
38 | + $itemO=$this->beforeAddItem($item, $value, $image); |
|
39 | 39 | $this->items[]=$itemO; |
40 | 40 | return $itemO; |
41 | 41 | } |
42 | 42 | |
43 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
44 | - $this->addIconP($icon,$before,$labeled); |
|
43 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
44 | + $this->addIconP($icon, $before, $labeled); |
|
45 | 45 | return $this->getElementById("text-".$this->identifier, $this->content)->setWrapAfter(""); |
46 | 46 | } |
47 | 47 | /** |
@@ -50,20 +50,20 @@ discard block |
||
50 | 50 | * @param number $position |
51 | 51 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
52 | 52 | */ |
53 | - public function insertItem($item,$position=0){ |
|
53 | + public function insertItem($item, $position=0) { |
|
54 | 54 | $itemO=$this->beforeAddItem($item); |
55 | - $start = array_slice($this->items, 0, $position); |
|
56 | - $end = array_slice($this->items, $position); |
|
57 | - $start[] = $item; |
|
55 | + $start=array_slice($this->items, 0, $position); |
|
56 | + $end=array_slice($this->items, $position); |
|
57 | + $start[]=$item; |
|
58 | 58 | $this->items=array_merge($start, $end); |
59 | 59 | return $itemO; |
60 | 60 | } |
61 | 61 | |
62 | - protected function beforeAddItem($item,$value=NULL,$image=NULL){ |
|
62 | + protected function beforeAddItem($item, $value=NULL, $image=NULL) { |
|
63 | 63 | $itemO=$item; |
64 | - if(!$item instanceof HtmlDropdownItem){ |
|
65 | - $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image); |
|
66 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
64 | + if (!$item instanceof HtmlDropdownItem) { |
|
65 | + $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image); |
|
66 | + }elseif ($itemO instanceof HtmlDropdownItem) { |
|
67 | 67 | $this->addToProperty("class", "vertical"); |
68 | 68 | } |
69 | 69 | return $itemO; |
@@ -76,76 +76,76 @@ discard block |
||
76 | 76 | $this->addItem($function($object)); |
77 | 77 | } |
78 | 78 | |
79 | - public function addInput($name){ |
|
80 | - if(!isset($name)) |
|
79 | + public function addInput($name) { |
|
80 | + if (!isset($name)) |
|
81 | 81 | $name="input-".$this->identifier; |
82 | 82 | $this->setAction("activate"); |
83 | - $this->input=new HtmlInput($name,"hidden"); |
|
83 | + $this->input=new HtmlInput($name, "hidden"); |
|
84 | 84 | } |
85 | 85 | |
86 | - public function addItems($items){ |
|
87 | - if(JArray::isAssociative($items)){ |
|
88 | - foreach ($items as $k=>$v){ |
|
86 | + public function addItems($items) { |
|
87 | + if (JArray::isAssociative($items)) { |
|
88 | + foreach ($items as $k=>$v) { |
|
89 | 89 | $this->addItem($v)->setData($k); |
90 | 90 | } |
91 | - }else{ |
|
92 | - foreach ($items as $item){ |
|
91 | + }else { |
|
92 | + foreach ($items as $item) { |
|
93 | 93 | $this->addItem($item); |
94 | 94 | } |
95 | 95 | } |
96 | 96 | } |
97 | 97 | |
98 | - public function count(){ |
|
98 | + public function count() { |
|
99 | 99 | return \sizeof($this->items); |
100 | 100 | } |
101 | 101 | /** |
102 | 102 | * @param boolean $dropdown |
103 | 103 | */ |
104 | - public function asDropdown($dropdown){ |
|
105 | - if($dropdown===false){ |
|
104 | + public function asDropdown($dropdown) { |
|
105 | + if ($dropdown===false) { |
|
106 | 106 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
107 | 107 | $dropdown="menu"; |
108 | - }else{ |
|
108 | + }else { |
|
109 | 109 | $dropdown="dropdown"; |
110 | 110 | $this->mClass="menu"; |
111 | 111 | } |
112 | - return $this->addToPropertyCtrl("class", $dropdown,array("menu","dropdown")); |
|
112 | + return $this->addToPropertyCtrl("class", $dropdown, array("menu", "dropdown")); |
|
113 | 113 | } |
114 | 114 | |
115 | - public function setVertical(){ |
|
116 | - return $this->addToPropertyCtrl("class", "vertical",array("vertical")); |
|
115 | + public function setVertical() { |
|
116 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
117 | 117 | } |
118 | 118 | |
119 | - public function setSimple(){ |
|
120 | - return $this->addToPropertyCtrl("class", "simple",array("simple")); |
|
119 | + public function setSimple() { |
|
120 | + return $this->addToPropertyCtrl("class", "simple", array("simple")); |
|
121 | 121 | } |
122 | 122 | |
123 | - public function asButton($floating=false){ |
|
124 | - if($floating) |
|
123 | + public function asButton($floating=false) { |
|
124 | + if ($floating) |
|
125 | 125 | $this->addToProperty("class", "floating"); |
126 | 126 | return $this->addToProperty("class", "button"); |
127 | 127 | } |
128 | 128 | |
129 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
130 | - if(isset($name)) |
|
129 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
130 | + if (isset($name)) |
|
131 | 131 | $this->addInput($name); |
132 | - if($multiple) |
|
132 | + if ($multiple) |
|
133 | 133 | $this->addToProperty("class", "multiple"); |
134 | 134 | if ($selection) |
135 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
135 | + $this->addToPropertyCtrl("class", "selection", array("selection")); |
|
136 | 136 | return $this; |
137 | 137 | } |
138 | 138 | |
139 | - public function asSearch($name=NULL,$multiple=false,$selection=false){ |
|
140 | - $this->asSelect($name,$multiple,$selection); |
|
139 | + public function asSearch($name=NULL, $multiple=false, $selection=false) { |
|
140 | + $this->asSelect($name, $multiple, $selection); |
|
141 | 141 | return $this->addToProperty("class", "search"); |
142 | 142 | } |
143 | 143 | |
144 | - public function setSelect($name=NULL,$multiple=false){ |
|
145 | - if(!isset($name)) |
|
144 | + public function setSelect($name=NULL, $multiple=false) { |
|
145 | + if (!isset($name)) |
|
146 | 146 | $name="select-".$this->identifier; |
147 | 147 | $this->input=null; |
148 | - if($multiple){ |
|
148 | + if ($multiple) { |
|
149 | 149 | $this->setProperty("multiple", true); |
150 | 150 | $this->addToProperty("class", "multiple"); |
151 | 151 | } |
@@ -153,32 +153,32 @@ discard block |
||
153 | 153 | $this->tagName="select"; |
154 | 154 | $this->setProperty("name", $name); |
155 | 155 | $this->content=null; |
156 | - foreach ($this->items as $item){ |
|
156 | + foreach ($this->items as $item) { |
|
157 | 157 | $item->asOption(); |
158 | 158 | } |
159 | 159 | return $this; |
160 | 160 | } |
161 | 161 | |
162 | - public function asSubmenu($pointing=NULL){ |
|
162 | + public function asSubmenu($pointing=NULL) { |
|
163 | 163 | $this->setClass("ui dropdown link item"); |
164 | - if(isset($pointing)){ |
|
164 | + if (isset($pointing)) { |
|
165 | 165 | $this->setPointing($pointing); |
166 | 166 | } |
167 | 167 | return $this; |
168 | 168 | } |
169 | 169 | |
170 | - public function setPointing($value=Direction::NONE){ |
|
171 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
170 | + public function setPointing($value=Direction::NONE) { |
|
171 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
172 | 172 | } |
173 | 173 | |
174 | - public function setValue($value){ |
|
175 | - if(isset($this->input)){ |
|
174 | + public function setValue($value) { |
|
175 | + if (isset($this->input)) { |
|
176 | 176 | $this->input->setProperty("value", $value); |
177 | - }else{ |
|
177 | + }else { |
|
178 | 178 | $this->setProperty("value", $value); |
179 | 179 | } |
180 | 180 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
181 | - if(isset($textElement)) |
|
181 | + if (isset($textElement)) |
|
182 | 182 | $textElement->setContent($value); |
183 | 183 | return $this; |
184 | 184 | } |
@@ -188,19 +188,19 @@ discard block |
||
188 | 188 | * @see BaseHtml::run() |
189 | 189 | */ |
190 | 190 | public function run(JsUtils $js) { |
191 | - if($this->propertyContains("class", "simple")===false){ |
|
192 | - if(isset($this->_bsComponent)===false) |
|
193 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
191 | + if ($this->propertyContains("class", "simple")===false) { |
|
192 | + if (isset($this->_bsComponent)===false) |
|
193 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->_params); |
|
194 | 194 | $this->addEventsOnRun($js); |
195 | 195 | return $this->_bsComponent; |
196 | 196 | } |
197 | 197 | } |
198 | 198 | |
199 | - public function setAction($action){ |
|
199 | + public function setAction($action) { |
|
200 | 200 | $this->_params["action"]=$action; |
201 | 201 | } |
202 | 202 | |
203 | - public function setFullTextSearch($value){ |
|
203 | + public function setFullTextSearch($value) { |
|
204 | 204 | $this->_params["fullTextSearch"]=$value; |
205 | 205 | } |
206 | 206 | } |
207 | 207 | \ No newline at end of file |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $itemO=$item; |
64 | 64 | if(!$item instanceof HtmlDropdownItem){ |
65 | 65 | $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image); |
66 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
66 | + } elseif($itemO instanceof HtmlDropdownItem){ |
|
67 | 67 | $this->addToProperty("class", "vertical"); |
68 | 68 | } |
69 | 69 | return $itemO; |
@@ -77,8 +77,9 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | public function addInput($name){ |
80 | - if(!isset($name)) |
|
81 | - $name="input-".$this->identifier; |
|
80 | + if(!isset($name)) { |
|
81 | + $name="input-".$this->identifier; |
|
82 | + } |
|
82 | 83 | $this->setAction("activate"); |
83 | 84 | $this->input=new HtmlInput($name,"hidden"); |
84 | 85 | } |
@@ -88,7 +89,7 @@ discard block |
||
88 | 89 | foreach ($items as $k=>$v){ |
89 | 90 | $this->addItem($v)->setData($k); |
90 | 91 | } |
91 | - }else{ |
|
92 | + } else{ |
|
92 | 93 | foreach ($items as $item){ |
93 | 94 | $this->addItem($item); |
94 | 95 | } |
@@ -105,7 +106,7 @@ discard block |
||
105 | 106 | if($dropdown===false){ |
106 | 107 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
107 | 108 | $dropdown="menu"; |
108 | - }else{ |
|
109 | + } else{ |
|
109 | 110 | $dropdown="dropdown"; |
110 | 111 | $this->mClass="menu"; |
111 | 112 | } |
@@ -121,18 +122,22 @@ discard block |
||
121 | 122 | } |
122 | 123 | |
123 | 124 | public function asButton($floating=false){ |
124 | - if($floating) |
|
125 | - $this->addToProperty("class", "floating"); |
|
125 | + if($floating) { |
|
126 | + $this->addToProperty("class", "floating"); |
|
127 | + } |
|
126 | 128 | return $this->addToProperty("class", "button"); |
127 | 129 | } |
128 | 130 | |
129 | 131 | public function asSelect($name=NULL,$multiple=false,$selection=true){ |
130 | - if(isset($name)) |
|
131 | - $this->addInput($name); |
|
132 | - if($multiple) |
|
133 | - $this->addToProperty("class", "multiple"); |
|
134 | - if ($selection) |
|
135 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
132 | + if(isset($name)) { |
|
133 | + $this->addInput($name); |
|
134 | + } |
|
135 | + if($multiple) { |
|
136 | + $this->addToProperty("class", "multiple"); |
|
137 | + } |
|
138 | + if ($selection) { |
|
139 | + $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
140 | + } |
|
136 | 141 | return $this; |
137 | 142 | } |
138 | 143 | |
@@ -142,8 +147,9 @@ discard block |
||
142 | 147 | } |
143 | 148 | |
144 | 149 | public function setSelect($name=NULL,$multiple=false){ |
145 | - if(!isset($name)) |
|
146 | - $name="select-".$this->identifier; |
|
150 | + if(!isset($name)) { |
|
151 | + $name="select-".$this->identifier; |
|
152 | + } |
|
147 | 153 | $this->input=null; |
148 | 154 | if($multiple){ |
149 | 155 | $this->setProperty("multiple", true); |
@@ -174,12 +180,13 @@ discard block |
||
174 | 180 | public function setValue($value){ |
175 | 181 | if(isset($this->input)){ |
176 | 182 | $this->input->setProperty("value", $value); |
177 | - }else{ |
|
183 | + } else{ |
|
178 | 184 | $this->setProperty("value", $value); |
179 | 185 | } |
180 | 186 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
181 | - if(isset($textElement)) |
|
182 | - $textElement->setContent($value); |
|
187 | + if(isset($textElement)) { |
|
188 | + $textElement->setContent($value); |
|
189 | + } |
|
183 | 190 | return $this; |
184 | 191 | } |
185 | 192 | |
@@ -189,8 +196,9 @@ discard block |
||
189 | 196 | */ |
190 | 197 | public function run(JsUtils $js) { |
191 | 198 | if($this->propertyContains("class", "simple")===false){ |
192 | - if(isset($this->_bsComponent)===false) |
|
193 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
199 | + if(isset($this->_bsComponent)===false) { |
|
200 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
201 | + } |
|
194 | 202 | $this->addEventsOnRun($js); |
195 | 203 | return $this->_bsComponent; |
196 | 204 | } |
@@ -16,6 +16,9 @@ |
||
16 | 16 | |
17 | 17 | trait BootstrapComponentsTrait { |
18 | 18 | |
19 | + /** |
|
20 | + * @param string|null $attachTo |
|
21 | + */ |
|
19 | 22 | public abstract function addComponent(SimpleComponent $component, $attachTo, $params); |
20 | 23 | /** |
21 | 24 | * |
@@ -11,7 +11,6 @@ |
||
11 | 11 | use Ajax\bootstrap\components\Tab; |
12 | 12 | use Ajax\bootstrap\components\Carousel; |
13 | 13 | use Ajax\bootstrap\components\Collapse; |
14 | -use Ajax\Bootstrap; |
|
15 | 14 | use Ajax\common\components\SimpleComponent; |
16 | 15 | |
17 | 16 | trait BootstrapComponentsTrait { |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | return $this->setParam("onShow", "%function(){".$jsCode."}%"); |
31 | 31 | } |
32 | 32 | |
33 | - public function setExclusive($value){ |
|
33 | + public function setExclusive($value) { |
|
34 | 34 | return $this->setParam("exclusive", $value); |
35 | 35 | } |
36 | 36 | |
@@ -39,15 +39,15 @@ discard block |
||
39 | 39 | * @param string $popup the css selector of the popup |
40 | 40 | * @return \Ajax\semantic\components\Popup |
41 | 41 | */ |
42 | - public function setPopup($popup){ |
|
42 | + public function setPopup($popup) { |
|
43 | 43 | return $this->setParam("popup", $popup); |
44 | 44 | } |
45 | 45 | |
46 | - public function setInline($value){ |
|
46 | + public function setInline($value) { |
|
47 | 47 | return $this->setParam("inline", $value); |
48 | 48 | } |
49 | 49 | |
50 | - public function setPosition($value){ |
|
50 | + public function setPosition($value) { |
|
51 | 51 | return $this->setParam("position", $value); |
52 | 52 | } |
53 | 53 | //TODO other events implementation |
@@ -8,13 +8,13 @@ discard block |
||
8 | 8 | class HtmlSticky extends HtmlSemDoubleElement { |
9 | 9 | private $_params=array(); |
10 | 10 | |
11 | - public function __construct($identifier,$context=NULL,$content=NULL) { |
|
11 | + public function __construct($identifier, $context=NULL, $content=NULL) { |
|
12 | 12 | parent::__construct($identifier, "div", "ui sticky", $content); |
13 | - if(isset($content)) |
|
13 | + if (isset($content)) |
|
14 | 14 | $this->setContext($context); |
15 | 15 | } |
16 | 16 | |
17 | - public function setContext($context){ |
|
17 | + public function setContext($context) { |
|
18 | 18 | $this->_params["context"]=$context; |
19 | 19 | return $this; |
20 | 20 | } |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | * {@inheritDoc} |
24 | 24 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run() |
25 | 25 | */ |
26 | - public function run(JsUtils $js){ |
|
26 | + public function run(JsUtils $js) { |
|
27 | 27 | parent::run($js); |
28 | - return $js->semantic()->sticky("#".$this->identifier,$this->_params); |
|
28 | + return $js->semantic()->sticky("#".$this->identifier, $this->_params); |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | \ No newline at end of file |
@@ -10,8 +10,9 @@ |
||
10 | 10 | |
11 | 11 | public function __construct($identifier,$context=NULL,$content=NULL) { |
12 | 12 | parent::__construct($identifier, "div", "ui sticky", $content); |
13 | - if(isset($content)) |
|
14 | - $this->setContext($context); |
|
13 | + if(isset($content)) { |
|
14 | + $this->setContext($context); |
|
15 | + } |
|
15 | 16 | } |
16 | 17 | |
17 | 18 | public function setContext($context){ |
@@ -49,8 +49,9 @@ discard block |
||
49 | 49 | public function addCol($width=NULL){ |
50 | 50 | $colCount=$this->colCount()+1; |
51 | 51 | $this->setColsCount($colCount,true,$width); |
52 | - if($this->hasOnlyCols($this->count())) |
|
53 | - return $this->content[$colCount-1]; |
|
52 | + if($this->hasOnlyCols($this->count())) { |
|
53 | + return $this->content[$colCount-1]; |
|
54 | + } |
|
54 | 55 | return $this; |
55 | 56 | } |
56 | 57 | |
@@ -73,7 +74,7 @@ discard block |
||
73 | 74 | for($i=$count;$i<$colsCount;$i++){ |
74 | 75 | $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i)); |
75 | 76 | } |
76 | - }else{ |
|
77 | + } else{ |
|
77 | 78 | if($this->hasOnlyCols($count)){ |
78 | 79 | $tmpContent=$this->content; |
79 | 80 | $item=$this->addItem($colsCount); |
@@ -93,15 +94,16 @@ discard block |
||
93 | 94 | } |
94 | 95 | |
95 | 96 | public function setColsCount($numCols,$toCreate=true,$width=NULL){ |
96 | - if(isset($width)===false) |
|
97 | - $this->setWide($numCols); |
|
97 | + if(isset($width)===false) { |
|
98 | + $this->setWide($numCols); |
|
99 | + } |
|
98 | 100 | if($toCreate==true){ |
99 | 101 | $count=$this->count(); |
100 | 102 | if($count==0 || $this->hasOnlyCols($count)){ |
101 | 103 | for($i=$count;$i<$numCols;$i++){ |
102 | 104 | $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i,$width)); |
103 | 105 | } |
104 | - }else{ |
|
106 | + } else{ |
|
105 | 107 | for($i=0;$i<$count;$i++){ |
106 | 108 | $this->getItem($i)->setColsCount($numCols); |
107 | 109 | } |
@@ -121,17 +123,20 @@ discard block |
||
121 | 123 | |
122 | 124 | public function rowCount(){ |
123 | 125 | $count=$this->count(); |
124 | - if($this->hasOnlyCols($count)) |
|
125 | - return 0; |
|
126 | + if($this->hasOnlyCols($count)) { |
|
127 | + return 0; |
|
128 | + } |
|
126 | 129 | return $count; |
127 | 130 | } |
128 | 131 | |
129 | 132 | public function colCount(){ |
130 | 133 | $count=$this->count(); |
131 | - if($this->hasOnlyCols($count)) |
|
132 | - return $count; |
|
133 | - if($count>0) |
|
134 | - return $this->getItem(0)->count(); |
|
134 | + if($this->hasOnlyCols($count)) { |
|
135 | + return $count; |
|
136 | + } |
|
137 | + if($count>0) { |
|
138 | + return $this->getItem(0)->count(); |
|
139 | + } |
|
135 | 140 | return 0; |
136 | 141 | } |
137 | 142 | |
@@ -141,8 +146,9 @@ discard block |
||
141 | 146 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
142 | 147 | */ |
143 | 148 | public function getCell($row,$col){ |
144 | - if($row<2 && $this->hasOnlyCols($this->count())) |
|
145 | - return $this->getItem($col); |
|
149 | + if($row<2 && $this->hasOnlyCols($this->count())) { |
|
150 | + return $this->getItem($col); |
|
151 | + } |
|
146 | 152 | $row=$this->getItem($row); |
147 | 153 | if(isset($row)){ |
148 | 154 | $col=$row->getItem($col); |
@@ -191,8 +197,9 @@ discard block |
||
191 | 197 | * @return \Ajax\semantic\html\collections\HtmlGrid |
192 | 198 | */ |
193 | 199 | public function setPadded($value=NULL){ |
194 | - if(isset($value)) |
|
195 | - $this->addToPropertyCtrl("class", $value,array("vertically","horizontally")); |
|
200 | + if(isset($value)) { |
|
201 | + $this->addToPropertyCtrl("class", $value,array("vertically","horizontally")); |
|
202 | + } |
|
196 | 203 | return $this->addToProperty("class", "padded"); |
197 | 204 | } |
198 | 205 | |
@@ -214,8 +221,9 @@ discard block |
||
214 | 221 | * @see \Ajax\common\html\HtmlCollection::createItem() |
215 | 222 | */ |
216 | 223 | protected function createItem($value){ |
217 | - if($this->_createCols===false) |
|
218 | - $value=null; |
|
224 | + if($this->_createCols===false) { |
|
225 | + $value=null; |
|
226 | + } |
|
219 | 227 | $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1),$value,$this->_colSizing,$this->_implicitRows); |
220 | 228 | return $item; |
221 | 229 | } |
@@ -22,6 +22,10 @@ discard block |
||
22 | 22 | private $_colSizing=true; |
23 | 23 | private $_implicitRows=false; |
24 | 24 | |
25 | + /** |
|
26 | + * @param string $identifier |
|
27 | + * @param integer $numCols |
|
28 | + */ |
|
25 | 29 | public function __construct( $identifier,$numRows=1,$numCols=NULL,$createCols=true,$implicitRows=false){ |
26 | 30 | parent::__construct( $identifier, "div","ui grid"); |
27 | 31 | $this->_implicitRows=$implicitRows; |
@@ -148,7 +152,7 @@ discard block |
||
148 | 152 | /** |
149 | 153 | * return the row at $index |
150 | 154 | * @param int $index |
151 | - * @return \Ajax\semantic\html\collections\HtmlGridRow |
|
155 | + * @return \Ajax\common\html\HtmlDoubleElement |
|
152 | 156 | */ |
153 | 157 | public function getRow($index){ |
154 | 158 | return $this->getItem($index); |
@@ -284,7 +288,7 @@ discard block |
||
284 | 288 | |
285 | 289 | /** |
286 | 290 | * stretch the row contents to take up the entire column height |
287 | - * @return \Ajax\semantic\html\content\HtmlGridRow |
|
291 | + * @return HtmlGrid |
|
288 | 292 | */ |
289 | 293 | public function setStretched(){ |
290 | 294 | return $this->addToProperty("class", "stretched"); |
@@ -16,26 +16,26 @@ discard block |
||
16 | 16 | * @author jc |
17 | 17 | * @version 1.001 |
18 | 18 | */ |
19 | -class HtmlGrid extends HtmlSemCollection{ |
|
19 | +class HtmlGrid extends HtmlSemCollection { |
|
20 | 20 | use TextAlignmentTrait; |
21 | 21 | private $_createCols; |
22 | 22 | private $_colSizing=true; |
23 | 23 | private $_implicitRows=false; |
24 | 24 | |
25 | - public function __construct( $identifier,$numRows=1,$numCols=NULL,$createCols=true,$implicitRows=false){ |
|
26 | - parent::__construct( $identifier, "div","ui grid"); |
|
25 | + public function __construct($identifier, $numRows=1, $numCols=NULL, $createCols=true, $implicitRows=false) { |
|
26 | + parent::__construct($identifier, "div", "ui grid"); |
|
27 | 27 | $this->_implicitRows=$implicitRows; |
28 | 28 | $this->_createCols=$createCols; |
29 | - if(isset($numCols)){ |
|
29 | + if (isset($numCols)) { |
|
30 | 30 | //if($this->_createCols){ |
31 | 31 | $this->_colSizing=false; |
32 | 32 | //} |
33 | 33 | $this->setWide($numCols); |
34 | 34 | } |
35 | - $this->setRowsCount($numRows,$numCols); |
|
35 | + $this->setRowsCount($numRows, $numCols); |
|
36 | 36 | } |
37 | 37 | |
38 | - public function asSegment(){ |
|
38 | + public function asSegment() { |
|
39 | 39 | return $this->addToPropertyCtrl("class", "segment", array("segment")); |
40 | 40 | } |
41 | 41 | |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | * Defines the grid width (alias for setWidth) |
44 | 44 | * @param int $wide |
45 | 45 | */ |
46 | - public function setWide($wide){ |
|
46 | + public function setWide($wide) { |
|
47 | 47 | $wide=Wide::getConstants()["W".$wide]; |
48 | 48 | $this->addToPropertyCtrl("class", $wide, Wide::getConstants()); |
49 | - return $this->addToPropertyCtrl("class","column",array("column")); |
|
49 | + return $this->addToPropertyCtrl("class", "column", array("column")); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @param int $width |
55 | 55 | * @return \Ajax\semantic\html\collections\HtmlGrid |
56 | 56 | */ |
57 | - public function setWidth($width){ |
|
57 | + public function setWidth($width) { |
|
58 | 58 | return $this->setWide($width); |
59 | 59 | } |
60 | 60 | |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | * @param int $colsCount number of columns to create |
64 | 64 | * @return mixed |
65 | 65 | */ |
66 | - public function addRow($colsCount=NULL){ |
|
66 | + public function addRow($colsCount=NULL) { |
|
67 | 67 | $rowCount=$this->rowCount()+1; |
68 | - $this->setRowsCount($rowCount,$colsCount,true); |
|
68 | + $this->setRowsCount($rowCount, $colsCount, true); |
|
69 | 69 | return $this->content[$rowCount-1]; |
70 | 70 | } |
71 | 71 | |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | * @param int $width with of the column to add |
75 | 75 | * @return mixed|\Ajax\semantic\html\collections\HtmlGrid |
76 | 76 | */ |
77 | - public function addCol($width=NULL){ |
|
77 | + public function addCol($width=NULL) { |
|
78 | 78 | $colCount=$this->colCount()+1; |
79 | - $this->setColsCount($colCount,true,$width); |
|
80 | - if($this->hasOnlyCols($this->count())) |
|
79 | + $this->setColsCount($colCount, true, $width); |
|
80 | + if ($this->hasOnlyCols($this->count())) |
|
81 | 81 | return $this->content[$colCount-1]; |
82 | 82 | return $this; |
83 | 83 | } |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | * @param array $sizes array of width of the columns to create |
87 | 87 | * @return \Ajax\semantic\html\collections\HtmlGrid |
88 | 88 | */ |
89 | - public function addCols($sizes=array()){ |
|
90 | - foreach ($sizes as $size){ |
|
89 | + public function addCols($sizes=array()) { |
|
90 | + foreach ($sizes as $size) { |
|
91 | 91 | $this->addCol($size); |
92 | 92 | } |
93 | 93 | return $this; |
@@ -99,28 +99,28 @@ discard block |
||
99 | 99 | * @param int $colsCount |
100 | 100 | * @return \Ajax\semantic\html\collections\HtmlGrid |
101 | 101 | */ |
102 | - public function setRowsCount($rowsCount,$colsCount=NULL,$force=false){ |
|
102 | + public function setRowsCount($rowsCount, $colsCount=NULL, $force=false) { |
|
103 | 103 | $count=$this->count(); |
104 | - if($rowsCount<2 && $force===false){ |
|
105 | - for($i=$count;$i<$colsCount;$i++){ |
|
104 | + if ($rowsCount<2 && $force===false) { |
|
105 | + for ($i=$count; $i<$colsCount; $i++) { |
|
106 | 106 | $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i)); |
107 | 107 | } |
108 | - }else{ |
|
109 | - if($this->hasOnlyCols($count)){ |
|
108 | + }else { |
|
109 | + if ($this->hasOnlyCols($count)) { |
|
110 | 110 | $tmpContent=$this->content; |
111 | 111 | $item=$this->addItem($colsCount); |
112 | 112 | $item->setContent($tmpContent); |
113 | 113 | $this->content=array(); |
114 | 114 | $count=1; |
115 | 115 | } |
116 | - for($i=$count;$i<$rowsCount;$i++){ |
|
116 | + for ($i=$count; $i<$rowsCount; $i++) { |
|
117 | 117 | $this->addItem($colsCount); |
118 | 118 | } |
119 | 119 | } |
120 | 120 | return $this; |
121 | 121 | } |
122 | 122 | |
123 | - protected function hasOnlyCols($count){ |
|
123 | + protected function hasOnlyCols($count) { |
|
124 | 124 | return $count>0 && $this->content[0] instanceof HtmlGridCol; |
125 | 125 | } |
126 | 126 | |
@@ -131,17 +131,17 @@ discard block |
||
131 | 131 | * @param int $width |
132 | 132 | * @return \Ajax\semantic\html\collections\HtmlGrid |
133 | 133 | */ |
134 | - public function setColsCount($numCols,$toCreate=true,$width=NULL){ |
|
135 | - if(isset($width)===false) |
|
134 | + public function setColsCount($numCols, $toCreate=true, $width=NULL) { |
|
135 | + if (isset($width)===false) |
|
136 | 136 | $this->setWide($numCols); |
137 | - if($toCreate==true){ |
|
137 | + if ($toCreate==true) { |
|
138 | 138 | $count=$this->count(); |
139 | - if($count==0 || $this->hasOnlyCols($count)){ |
|
140 | - for($i=$count;$i<$numCols;$i++){ |
|
141 | - $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i,$width)); |
|
139 | + if ($count==0 || $this->hasOnlyCols($count)) { |
|
140 | + for ($i=$count; $i<$numCols; $i++) { |
|
141 | + $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i, $width)); |
|
142 | 142 | } |
143 | - }else{ |
|
144 | - for($i=0;$i<$count;$i++){ |
|
143 | + }else { |
|
144 | + for ($i=0; $i<$count; $i++) { |
|
145 | 145 | $this->getItem($i)->setColsCount($numCols); |
146 | 146 | } |
147 | 147 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @param int $index |
155 | 155 | * @return \Ajax\semantic\html\collections\HtmlGridRow |
156 | 156 | */ |
157 | - public function getRow($index){ |
|
157 | + public function getRow($index) { |
|
158 | 158 | return $this->getItem($index); |
159 | 159 | } |
160 | 160 | |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | * Returns the row count |
163 | 163 | * @return int |
164 | 164 | */ |
165 | - public function rowCount(){ |
|
165 | + public function rowCount() { |
|
166 | 166 | $count=$this->count(); |
167 | - if($this->hasOnlyCols($count)) |
|
167 | + if ($this->hasOnlyCols($count)) |
|
168 | 168 | return 0; |
169 | 169 | return $count; |
170 | 170 | } |
@@ -173,11 +173,11 @@ discard block |
||
173 | 173 | * Returns the column count |
174 | 174 | * @return int |
175 | 175 | */ |
176 | - public function colCount(){ |
|
176 | + public function colCount() { |
|
177 | 177 | $count=$this->count(); |
178 | - if($this->hasOnlyCols($count)) |
|
178 | + if ($this->hasOnlyCols($count)) |
|
179 | 179 | return $count; |
180 | - if($count>0) |
|
180 | + if ($count>0) |
|
181 | 181 | return $this->getItem(0)->count(); |
182 | 182 | return 0; |
183 | 183 | } |
@@ -188,11 +188,11 @@ discard block |
||
188 | 188 | * @param int $col |
189 | 189 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
190 | 190 | */ |
191 | - public function getCell($row,$col){ |
|
192 | - if($row<2 && $this->hasOnlyCols($this->count())) |
|
191 | + public function getCell($row, $col) { |
|
192 | + if ($row<2 && $this->hasOnlyCols($this->count())) |
|
193 | 193 | return $this->getItem($col); |
194 | 194 | $row=$this->getItem($row); |
195 | - if(isset($row)){ |
|
195 | + if (isset($row)) { |
|
196 | 196 | $col=$row->getItem($col); |
197 | 197 | } |
198 | 198 | return $col; |
@@ -203,9 +203,9 @@ discard block |
||
203 | 203 | * @param boolean $vertically |
204 | 204 | * @return \Ajax\semantic\html\collections\HtmlGrid |
205 | 205 | */ |
206 | - public function setDivided($vertically=false){ |
|
207 | - $value=($vertically===true)?"vertically divided":"divided"; |
|
208 | - return $this->addToPropertyCtrl("class", $value,array("divided")); |
|
206 | + public function setDivided($vertically=false) { |
|
207 | + $value=($vertically===true) ? "vertically divided" : "divided"; |
|
208 | + return $this->addToPropertyCtrl("class", $value, array("divided")); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
@@ -213,23 +213,23 @@ discard block |
||
213 | 213 | * @param boolean $internally true for internal cells |
214 | 214 | * @return \Ajax\semantic\html\collections\HtmlGrid |
215 | 215 | */ |
216 | - public function setCelled($internally=false){ |
|
217 | - $value=($internally===true)?"internally celled":"celled"; |
|
218 | - return $this->addToPropertyCtrl("class", $value,array("celled","internally celled")); |
|
216 | + public function setCelled($internally=false) { |
|
217 | + $value=($internally===true) ? "internally celled" : "celled"; |
|
218 | + return $this->addToPropertyCtrl("class", $value, array("celled", "internally celled")); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | /** |
222 | 222 | * A grid can have its columns centered |
223 | 223 | */ |
224 | - public function setCentered(){ |
|
225 | - return $this->addToPropertyCtrl("class", "centered",array("centered")); |
|
224 | + public function setCentered() { |
|
225 | + return $this->addToPropertyCtrl("class", "centered", array("centered")); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
229 | 229 | * automatically resize all elements to split the available width evenly |
230 | 230 | * @return \Ajax\semantic\html\collections\HtmlGrid |
231 | 231 | */ |
232 | - public function setEqualWidth(){ |
|
232 | + public function setEqualWidth() { |
|
233 | 233 | return $this->addToProperty("class", "equal width"); |
234 | 234 | } |
235 | 235 | |
@@ -238,9 +238,9 @@ discard block |
||
238 | 238 | * @param string $value |
239 | 239 | * @return \Ajax\semantic\html\collections\HtmlGrid |
240 | 240 | */ |
241 | - public function setPadded($value=NULL){ |
|
242 | - if(isset($value)) |
|
243 | - $this->addToPropertyCtrl("class", $value,array("vertically","horizontally")); |
|
241 | + public function setPadded($value=NULL) { |
|
242 | + if (isset($value)) |
|
243 | + $this->addToPropertyCtrl("class", $value, array("vertically", "horizontally")); |
|
244 | 244 | return $this->addToProperty("class", "padded"); |
245 | 245 | } |
246 | 246 | |
@@ -248,23 +248,23 @@ discard block |
||
248 | 248 | * @param boolean $very |
249 | 249 | * @return \Ajax\semantic\html\collections\HtmlGrid |
250 | 250 | */ |
251 | - public function setRelaxed($very=false){ |
|
252 | - $value=($very===true)?"very relaxed":"relaxed"; |
|
253 | - return $this->addToPropertyCtrl("class", $value,array("relaxed","very relaxed")); |
|
251 | + public function setRelaxed($very=false) { |
|
252 | + $value=($very===true) ? "very relaxed" : "relaxed"; |
|
253 | + return $this->addToPropertyCtrl("class", $value, array("relaxed", "very relaxed")); |
|
254 | 254 | } |
255 | 255 | |
256 | - public function setVerticalAlignment($value=VerticalAlignment::MIDDLE){ |
|
257 | - return $this->addToPropertyCtrl("class", $value." aligned",VerticalAlignment::getConstantValues("aligned")); |
|
256 | + public function setVerticalAlignment($value=VerticalAlignment::MIDDLE) { |
|
257 | + return $this->addToPropertyCtrl("class", $value." aligned", VerticalAlignment::getConstantValues("aligned")); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | /** |
261 | 261 | * {@inheritDoc} |
262 | 262 | * @see \Ajax\common\html\HtmlCollection::createItem() |
263 | 263 | */ |
264 | - protected function createItem($value){ |
|
265 | - if($this->_createCols===false) |
|
264 | + protected function createItem($value) { |
|
265 | + if ($this->_createCols===false) |
|
266 | 266 | $value=null; |
267 | - $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1),$value,$this->_colSizing,$this->_implicitRows); |
|
267 | + $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1), $value, $this->_colSizing, $this->_implicitRows); |
|
268 | 268 | return $item; |
269 | 269 | } |
270 | 270 | |
@@ -272,17 +272,17 @@ discard block |
||
272 | 272 | * Sets $values to the grid |
273 | 273 | * @param array $values |
274 | 274 | */ |
275 | - public function setValues($values,$force=true){ |
|
275 | + public function setValues($values, $force=true) { |
|
276 | 276 | $count=$this->count(); |
277 | - if($this->_createCols===false || $force===true){ |
|
278 | - for($i=$count;$i<\sizeof($values);$i++){ |
|
277 | + if ($this->_createCols===false || $force===true) { |
|
278 | + for ($i=$count; $i<\sizeof($values); $i++) { |
|
279 | 279 | $colSize=\sizeof($values[$i]); |
280 | - $this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1),$colSize,$this->_colSizing,$this->_implicitRows)); |
|
280 | + $this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1), $colSize, $this->_colSizing, $this->_implicitRows)); |
|
281 | 281 | } |
282 | 282 | } |
283 | - $count=\min(array($this->count(),\sizeof($values))); |
|
284 | - for($i=0;$i<$count;$i++){ |
|
285 | - $this->content[$i]->setValues($values[$i],$this->_createCols===false); |
|
283 | + $count=\min(array($this->count(), \sizeof($values))); |
|
284 | + for ($i=0; $i<$count; $i++) { |
|
285 | + $this->content[$i]->setValues($values[$i], $this->_createCols===false); |
|
286 | 286 | } |
287 | 287 | } |
288 | 288 | |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | * stretch the row contents to take up the entire column height |
291 | 291 | * @return \Ajax\semantic\html\content\HtmlGridRow |
292 | 292 | */ |
293 | - public function setStretched(){ |
|
293 | + public function setStretched() { |
|
294 | 294 | return $this->addToProperty("class", "stretched"); |
295 | 295 | } |
296 | 296 |
@@ -8,13 +8,13 @@ |
||
8 | 8 | class HtmlFormInput extends HtmlFormField { |
9 | 9 | use TextFieldsTrait; |
10 | 10 | |
11 | - public function __construct($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL) { |
|
12 | - if(!isset($placeholder) && $type==="text") |
|
11 | + public function __construct($identifier, $label=NULL, $type="text", $value=NULL, $placeholder=NULL) { |
|
12 | + if (!isset($placeholder) && $type==="text") |
|
13 | 13 | $placeholder=$label; |
14 | - parent::__construct("field-".$identifier, new HtmlInput($identifier,$type,$value,$placeholder), $label); |
|
14 | + parent::__construct("field-".$identifier, new HtmlInput($identifier, $type, $value, $placeholder), $label); |
|
15 | 15 | } |
16 | 16 | |
17 | - public function setReadonly(){ |
|
17 | + public function setReadonly() { |
|
18 | 18 | $this->getField()->setProperty("readonly", ""); |
19 | 19 | } |
20 | 20 | } |
21 | 21 | \ No newline at end of file |
@@ -9,8 +9,9 @@ |
||
9 | 9 | use TextFieldsTrait; |
10 | 10 | |
11 | 11 | public function __construct($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL) { |
12 | - if(!isset($placeholder) && $type==="text") |
|
13 | - $placeholder=$label; |
|
12 | + if(!isset($placeholder) && $type==="text") { |
|
13 | + $placeholder=$label; |
|
14 | + } |
|
14 | 15 | parent::__construct("field-".$identifier, new HtmlInput($identifier,$type,$value,$placeholder), $label); |
15 | 16 | } |
16 | 17 |