@@ -13,8 +13,9 @@ |
||
13 | 13 | if(\is_array($value)){ |
14 | 14 | $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))); |
15 | 15 | return $itemO; |
16 | - }else |
|
17 | - return new HtmlFormInput($value); |
|
16 | + } else { |
|
17 | + return new HtmlFormInput($value); |
|
18 | + } |
|
18 | 19 | } |
19 | 20 | |
20 | 21 | public function addInputs($inputs,$fieldslabel=null){ |
@@ -9,26 +9,26 @@ discard block |
||
9 | 9 | use Ajax\semantic\html\collections\form\HtmlFormCheckbox; |
10 | 10 | use Ajax\semantic\html\collections\form\HtmlFormRadio; |
11 | 11 | trait FieldsTrait { |
12 | - public abstract function addFields($fields=NULL,$label=NULL); |
|
12 | + public abstract function addFields($fields=NULL, $label=NULL); |
|
13 | 13 | public abstract function addItem($item); |
14 | 14 | |
15 | - protected function createItem($value){ |
|
16 | - if(\is_array($value)){ |
|
17 | - $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))); |
|
15 | + protected function createItem($value) { |
|
16 | + if (\is_array($value)) { |
|
17 | + $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))); |
|
18 | 18 | return $itemO; |
19 | 19 | }else |
20 | 20 | return new HtmlFormInput($value); |
21 | 21 | } |
22 | 22 | |
23 | - public function addInputs($inputs,$fieldslabel=null){ |
|
23 | + public function addInputs($inputs, $fieldslabel=null) { |
|
24 | 24 | $fields=array(); |
25 | - foreach ($inputs as $input){ |
|
25 | + foreach ($inputs as $input) { |
|
26 | 26 | \extract($input); |
27 | - $f=new HtmlFormInput("",""); |
|
27 | + $f=new HtmlFormInput("", ""); |
|
28 | 28 | $f->fromArray($input); |
29 | 29 | $fields[]=$f; |
30 | 30 | } |
31 | - return $this->addFields($fields,$fieldslabel); |
|
31 | + return $this->addFields($fields, $fieldslabel); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -39,23 +39,23 @@ discard block |
||
39 | 39 | * @param boolean $multiple |
40 | 40 | * @return \Ajax\common\html\HtmlDoubleElement |
41 | 41 | */ |
42 | - public function addDropdown($identifier,$items=array(), $label=NULL,$value=NULL,$multiple=false){ |
|
43 | - return $this->addItem(new HtmlFormDropdown($identifier,$items,$label,$value,$multiple)); |
|
42 | + public function addDropdown($identifier, $items=array(), $label=NULL, $value=NULL, $multiple=false) { |
|
43 | + return $this->addItem(new HtmlFormDropdown($identifier, $items, $label, $value, $multiple)); |
|
44 | 44 | } |
45 | 45 | |
46 | - public function addInput($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL){ |
|
47 | - return $this->addItem(new HtmlFormInput($identifier,$label,$type,$value,$placeholder)); |
|
46 | + public function addInput($identifier, $label=NULL, $type="text", $value=NULL, $placeholder=NULL) { |
|
47 | + return $this->addItem(new HtmlFormInput($identifier, $label, $type, $value, $placeholder)); |
|
48 | 48 | } |
49 | 49 | |
50 | - public function addButton($identifier,$value,$cssStyle=NULL,$onClick=NULL){ |
|
51 | - return $this->addItem(new HtmlButton($identifier,$value,$cssStyle,$onClick)); |
|
50 | + public function addButton($identifier, $value, $cssStyle=NULL, $onClick=NULL) { |
|
51 | + return $this->addItem(new HtmlButton($identifier, $value, $cssStyle, $onClick)); |
|
52 | 52 | } |
53 | 53 | |
54 | - public function addCheckbox($identifier, $label=NULL,$value=NULL,$type=NULL){ |
|
55 | - return $this->addItem(new HtmlFormCheckbox($identifier,$label,$value,$type)); |
|
54 | + public function addCheckbox($identifier, $label=NULL, $value=NULL, $type=NULL) { |
|
55 | + return $this->addItem(new HtmlFormCheckbox($identifier, $label, $value, $type)); |
|
56 | 56 | } |
57 | 57 | |
58 | - public function addRadio($identifier, $name,$label=NULL,$value=NULL){ |
|
59 | - return $this->addItem(new HtmlFormRadio($identifier,$name,$label,$value)); |
|
58 | + public function addRadio($identifier, $name, $label=NULL, $value=NULL) { |
|
59 | + return $this->addItem(new HtmlFormRadio($identifier, $name, $label, $value)); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | \ No newline at end of file |
@@ -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 |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | * @param boolean $asIcons |
36 | 36 | * @return HtmlButtonGroups |
37 | 37 | */ |
38 | - public function htmlButtonGroups($identifier,$elements=array(),$asIcons=false){ |
|
39 | - return $this->addHtmlComponent(new HtmlButtonGroups($identifier, $elements,$asIcons)); |
|
38 | + public function htmlButtonGroups($identifier, $elements=array(), $asIcons=false) { |
|
39 | + return $this->addHtmlComponent(new HtmlButtonGroups($identifier, $elements, $asIcons)); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param string $content |
46 | 46 | * @return HtmlContainer |
47 | 47 | */ |
48 | - public function htmlContainer($identifier,$content=""){ |
|
48 | + public function htmlContainer($identifier, $content="") { |
|
49 | 49 | return $this->addHtmlComponent(new HtmlContainer($identifier, $content)); |
50 | 50 | } |
51 | 51 | |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | * @param string $content |
55 | 55 | * @return HtmlDivider |
56 | 56 | */ |
57 | - public function htmlDivider($identifier,$content="",$tagName="div"){ |
|
58 | - return $this->addHtmlComponent(new HtmlDivider($identifier, $content,$tagName)); |
|
57 | + public function htmlDivider($identifier, $content="", $tagName="div") { |
|
58 | + return $this->addHtmlComponent(new HtmlDivider($identifier, $content, $tagName)); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | * @param string $type |
66 | 66 | * @return HtmlHeader |
67 | 67 | */ |
68 | - public function htmlHeader($identifier,$niveau=1,$content=NULL,$type="page"){ |
|
69 | - return $this->addHtmlComponent(new HtmlHeader($identifier,$niveau,$content,$type)); |
|
68 | + public function htmlHeader($identifier, $niveau=1, $content=NULL, $type="page") { |
|
69 | + return $this->addHtmlComponent(new HtmlHeader($identifier, $niveau, $content, $type)); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param string $icon |
75 | 75 | * @return HtmlIcon |
76 | 76 | */ |
77 | - public function htmlIcon($identifier,$icon){ |
|
77 | + public function htmlIcon($identifier, $icon) { |
|
78 | 78 | return $this->addHtmlComponent(new HtmlIcon($identifier, $icon)); |
79 | 79 | } |
80 | 80 | |
@@ -84,14 +84,14 @@ discard block |
||
84 | 84 | * @param array $icons |
85 | 85 | * @return HtmlIconGroups |
86 | 86 | */ |
87 | - public function htmlIconGroups($identifier,$size="",$icons=array()){ |
|
88 | - $group=new HtmlIconGroups($identifier,$size); |
|
89 | - if(JArray::isAssociative($icons)){ |
|
90 | - foreach ($icons as $icon=>$size){ |
|
91 | - $group->add($icon,$size); |
|
87 | + public function htmlIconGroups($identifier, $size="", $icons=array()) { |
|
88 | + $group=new HtmlIconGroups($identifier, $size); |
|
89 | + if (JArray::isAssociative($icons)) { |
|
90 | + foreach ($icons as $icon=>$size) { |
|
91 | + $group->add($icon, $size); |
|
92 | 92 | } |
93 | - }else{ |
|
94 | - foreach ($icons as $icon){ |
|
93 | + }else { |
|
94 | + foreach ($icons as $icon) { |
|
95 | 95 | $group->add($icon); |
96 | 96 | } |
97 | 97 | } |
@@ -106,8 +106,8 @@ discard block |
||
106 | 106 | * @param string $placeholder |
107 | 107 | * @return HtmlInput |
108 | 108 | */ |
109 | - public function htmlInput($identifier,$type="text",$value="",$placeholder=""){ |
|
110 | - return $this->addHtmlComponent(new HtmlInput($identifier,$type,$value,$placeholder)); |
|
109 | + public function htmlInput($identifier, $type="text", $value="", $placeholder="") { |
|
110 | + return $this->addHtmlComponent(new HtmlInput($identifier, $type, $value, $placeholder)); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | * @param string $tagName |
117 | 117 | * @return HtmlLabel |
118 | 118 | */ |
119 | - public function htmlLabel($identifier,$content="",$tagName="div"){ |
|
120 | - return $this->addHtmlComponent(new HtmlLabel($identifier, $content,$tagName)); |
|
119 | + public function htmlLabel($identifier, $content="", $tagName="div") { |
|
120 | + return $this->addHtmlComponent(new HtmlLabel($identifier, $content, $tagName)); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | * @param array $items |
127 | 127 | * @return HtmlList |
128 | 128 | */ |
129 | - public function htmlList($identifier,$items=array()){ |
|
130 | - return $this->addHtmlComponent(new HtmlList($identifier,$items)); |
|
129 | + public function htmlList($identifier, $items=array()) { |
|
130 | + return $this->addHtmlComponent(new HtmlList($identifier, $items)); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | * @param string $content |
137 | 137 | * @return HtmlSegment |
138 | 138 | */ |
139 | - public function htmlSegment($identifier, $content=""){ |
|
140 | - return $this->addHtmlComponent(new HtmlSegment($identifier,$content)); |
|
139 | + public function htmlSegment($identifier, $content="") { |
|
140 | + return $this->addHtmlComponent(new HtmlSegment($identifier, $content)); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @param array $items the segments |
147 | 147 | * @return HtmlSegmentGroups |
148 | 148 | */ |
149 | - public function htmlSegmentGroups($identifier, $items=array()){ |
|
150 | - return $this->addHtmlComponent(new HtmlSegmentGroups($identifier,$items)); |
|
149 | + public function htmlSegmentGroups($identifier, $items=array()) { |
|
150 | + return $this->addHtmlComponent(new HtmlSegmentGroups($identifier, $items)); |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 | \ 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 | } |
@@ -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 | } |
@@ -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 |
@@ -47,6 +47,9 @@ |
||
47 | 47 | return $this->addComponent(new Accordion($this->js), $attachTo, $params); |
48 | 48 | } |
49 | 49 | |
50 | + /** |
|
51 | + * @param string $attachTo |
|
52 | + */ |
|
50 | 53 | public function sticky($attachTo=NULL, $params=NULL) { |
51 | 54 | return $this->addComponent(new Sticky($this->js), $attachTo, $params); |
52 | 55 | } |
@@ -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,33 +16,33 @@ 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 | 38 | /** |
39 | 39 | * Defines the grid width (alias for setWidth) |
40 | 40 | * @param int $wide |
41 | 41 | */ |
42 | - public function setWide($wide){ |
|
42 | + public function setWide($wide) { |
|
43 | 43 | $wide=Wide::getConstants()["W".$wide]; |
44 | 44 | $this->addToPropertyCtrl("class", $wide, Wide::getConstants()); |
45 | - return $this->addToPropertyCtrl("class","column",array("column")); |
|
45 | + return $this->addToPropertyCtrl("class", "column", array("column")); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * @param int $width |
51 | 51 | * @return \Ajax\semantic\html\collections\HtmlGrid |
52 | 52 | */ |
53 | - public function setWidth($width){ |
|
53 | + public function setWidth($width) { |
|
54 | 54 | return $this->setWide($width); |
55 | 55 | } |
56 | 56 | |
@@ -59,9 +59,9 @@ discard block |
||
59 | 59 | * @param int $colsCount number of columns to create |
60 | 60 | * @return mixed |
61 | 61 | */ |
62 | - public function addRow($colsCount=NULL){ |
|
62 | + public function addRow($colsCount=NULL) { |
|
63 | 63 | $rowCount=$this->rowCount()+1; |
64 | - $this->setRowsCount($rowCount,$colsCount,true); |
|
64 | + $this->setRowsCount($rowCount, $colsCount, true); |
|
65 | 65 | return $this->content[$rowCount-1]; |
66 | 66 | } |
67 | 67 | |
@@ -70,10 +70,10 @@ discard block |
||
70 | 70 | * @param int $width with of the column to add |
71 | 71 | * @return mixed|\Ajax\semantic\html\collections\HtmlGrid |
72 | 72 | */ |
73 | - public function addCol($width=NULL){ |
|
73 | + public function addCol($width=NULL) { |
|
74 | 74 | $colCount=$this->colCount()+1; |
75 | - $this->setColsCount($colCount,true,$width); |
|
76 | - if($this->hasOnlyCols($this->count())) |
|
75 | + $this->setColsCount($colCount, true, $width); |
|
76 | + if ($this->hasOnlyCols($this->count())) |
|
77 | 77 | return $this->content[$colCount-1]; |
78 | 78 | return $this; |
79 | 79 | } |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | * @param array $sizes array of width of the columns to create |
83 | 83 | * @return \Ajax\semantic\html\collections\HtmlGrid |
84 | 84 | */ |
85 | - public function addCols($sizes=array()){ |
|
86 | - foreach ($sizes as $size){ |
|
85 | + public function addCols($sizes=array()) { |
|
86 | + foreach ($sizes as $size) { |
|
87 | 87 | $this->addCol($size); |
88 | 88 | } |
89 | 89 | return $this; |
@@ -95,28 +95,28 @@ discard block |
||
95 | 95 | * @param int $colsCount |
96 | 96 | * @return \Ajax\semantic\html\collections\HtmlGrid |
97 | 97 | */ |
98 | - public function setRowsCount($rowsCount,$colsCount=NULL,$force=false){ |
|
98 | + public function setRowsCount($rowsCount, $colsCount=NULL, $force=false) { |
|
99 | 99 | $count=$this->count(); |
100 | - if($rowsCount<2 && $force===false){ |
|
101 | - for($i=$count;$i<$colsCount;$i++){ |
|
100 | + if ($rowsCount<2 && $force===false) { |
|
101 | + for ($i=$count; $i<$colsCount; $i++) { |
|
102 | 102 | $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i)); |
103 | 103 | } |
104 | - }else{ |
|
105 | - if($this->hasOnlyCols($count)){ |
|
104 | + }else { |
|
105 | + if ($this->hasOnlyCols($count)) { |
|
106 | 106 | $tmpContent=$this->content; |
107 | 107 | $item=$this->addItem($colsCount); |
108 | 108 | $item->setContent($tmpContent); |
109 | 109 | $this->content=array(); |
110 | 110 | $count=1; |
111 | 111 | } |
112 | - for($i=$count;$i<$rowsCount;$i++){ |
|
112 | + for ($i=$count; $i<$rowsCount; $i++) { |
|
113 | 113 | $this->addItem($colsCount); |
114 | 114 | } |
115 | 115 | } |
116 | 116 | return $this; |
117 | 117 | } |
118 | 118 | |
119 | - protected function hasOnlyCols($count){ |
|
119 | + protected function hasOnlyCols($count) { |
|
120 | 120 | return $count>0 && $this->content[0] instanceof HtmlGridCol; |
121 | 121 | } |
122 | 122 | |
@@ -127,17 +127,17 @@ discard block |
||
127 | 127 | * @param int $width |
128 | 128 | * @return \Ajax\semantic\html\collections\HtmlGrid |
129 | 129 | */ |
130 | - public function setColsCount($numCols,$toCreate=true,$width=NULL){ |
|
131 | - if(isset($width)===false) |
|
130 | + public function setColsCount($numCols, $toCreate=true, $width=NULL) { |
|
131 | + if (isset($width)===false) |
|
132 | 132 | $this->setWide($numCols); |
133 | - if($toCreate==true){ |
|
133 | + if ($toCreate==true) { |
|
134 | 134 | $count=$this->count(); |
135 | - if($count==0 || $this->hasOnlyCols($count)){ |
|
136 | - for($i=$count;$i<$numCols;$i++){ |
|
137 | - $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i,$width)); |
|
135 | + if ($count==0 || $this->hasOnlyCols($count)) { |
|
136 | + for ($i=$count; $i<$numCols; $i++) { |
|
137 | + $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i, $width)); |
|
138 | 138 | } |
139 | - }else{ |
|
140 | - for($i=0;$i<$count;$i++){ |
|
139 | + }else { |
|
140 | + for ($i=0; $i<$count; $i++) { |
|
141 | 141 | $this->getItem($i)->setColsCount($numCols); |
142 | 142 | } |
143 | 143 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * @param int $index |
151 | 151 | * @return \Ajax\semantic\html\collections\HtmlGridRow |
152 | 152 | */ |
153 | - public function getRow($index){ |
|
153 | + public function getRow($index) { |
|
154 | 154 | return $this->getItem($index); |
155 | 155 | } |
156 | 156 | |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | * Returns the row count |
159 | 159 | * @return int |
160 | 160 | */ |
161 | - public function rowCount(){ |
|
161 | + public function rowCount() { |
|
162 | 162 | $count=$this->count(); |
163 | - if($this->hasOnlyCols($count)) |
|
163 | + if ($this->hasOnlyCols($count)) |
|
164 | 164 | return 0; |
165 | 165 | return $count; |
166 | 166 | } |
@@ -169,11 +169,11 @@ discard block |
||
169 | 169 | * Returns the column count |
170 | 170 | * @return int |
171 | 171 | */ |
172 | - public function colCount(){ |
|
172 | + public function colCount() { |
|
173 | 173 | $count=$this->count(); |
174 | - if($this->hasOnlyCols($count)) |
|
174 | + if ($this->hasOnlyCols($count)) |
|
175 | 175 | return $count; |
176 | - if($count>0) |
|
176 | + if ($count>0) |
|
177 | 177 | return $this->getItem(0)->count(); |
178 | 178 | return 0; |
179 | 179 | } |
@@ -184,11 +184,11 @@ discard block |
||
184 | 184 | * @param int $col |
185 | 185 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
186 | 186 | */ |
187 | - public function getCell($row,$col){ |
|
188 | - if($row<2 && $this->hasOnlyCols($this->count())) |
|
187 | + public function getCell($row, $col) { |
|
188 | + if ($row<2 && $this->hasOnlyCols($this->count())) |
|
189 | 189 | return $this->getItem($col); |
190 | 190 | $row=$this->getItem($row); |
191 | - if(isset($row)){ |
|
191 | + if (isset($row)) { |
|
192 | 192 | $col=$row->getItem($col); |
193 | 193 | } |
194 | 194 | return $col; |
@@ -199,9 +199,9 @@ discard block |
||
199 | 199 | * @param boolean $vertically |
200 | 200 | * @return \Ajax\semantic\html\collections\HtmlGrid |
201 | 201 | */ |
202 | - public function setDivided($vertically=false){ |
|
203 | - $value=($vertically===true)?"vertically divided":"divided"; |
|
204 | - return $this->addToPropertyCtrl("class", $value,array("divided")); |
|
202 | + public function setDivided($vertically=false) { |
|
203 | + $value=($vertically===true) ? "vertically divided" : "divided"; |
|
204 | + return $this->addToPropertyCtrl("class", $value, array("divided")); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
@@ -209,23 +209,23 @@ discard block |
||
209 | 209 | * @param boolean $internally true for internal cells |
210 | 210 | * @return \Ajax\semantic\html\collections\HtmlGrid |
211 | 211 | */ |
212 | - public function setCelled($internally=false){ |
|
213 | - $value=($internally===true)?"internally celled":"celled"; |
|
214 | - return $this->addToPropertyCtrl("class", $value,array("celled","internally celled")); |
|
212 | + public function setCelled($internally=false) { |
|
213 | + $value=($internally===true) ? "internally celled" : "celled"; |
|
214 | + return $this->addToPropertyCtrl("class", $value, array("celled", "internally celled")); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | /** |
218 | 218 | * A grid can have its columns centered |
219 | 219 | */ |
220 | - public function setCentered(){ |
|
221 | - return $this->addToPropertyCtrl("class", "centered",array("centered")); |
|
220 | + public function setCentered() { |
|
221 | + return $this->addToPropertyCtrl("class", "centered", array("centered")); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | /** |
225 | 225 | * automatically resize all elements to split the available width evenly |
226 | 226 | * @return \Ajax\semantic\html\collections\HtmlGrid |
227 | 227 | */ |
228 | - public function setEqualWidth(){ |
|
228 | + public function setEqualWidth() { |
|
229 | 229 | return $this->addToProperty("class", "equal width"); |
230 | 230 | } |
231 | 231 | |
@@ -234,9 +234,9 @@ discard block |
||
234 | 234 | * @param string $value |
235 | 235 | * @return \Ajax\semantic\html\collections\HtmlGrid |
236 | 236 | */ |
237 | - public function setPadded($value=NULL){ |
|
238 | - if(isset($value)) |
|
239 | - $this->addToPropertyCtrl("class", $value,array("vertically","horizontally")); |
|
237 | + public function setPadded($value=NULL) { |
|
238 | + if (isset($value)) |
|
239 | + $this->addToPropertyCtrl("class", $value, array("vertically", "horizontally")); |
|
240 | 240 | return $this->addToProperty("class", "padded"); |
241 | 241 | } |
242 | 242 | |
@@ -244,23 +244,23 @@ discard block |
||
244 | 244 | * @param boolean $very |
245 | 245 | * @return \Ajax\semantic\html\collections\HtmlGrid |
246 | 246 | */ |
247 | - public function setRelaxed($very=false){ |
|
248 | - $value=($very===true)?"very relaxed":"relaxed"; |
|
249 | - return $this->addToPropertyCtrl("class", $value,array("relaxed","very relaxed")); |
|
247 | + public function setRelaxed($very=false) { |
|
248 | + $value=($very===true) ? "very relaxed" : "relaxed"; |
|
249 | + return $this->addToPropertyCtrl("class", $value, array("relaxed", "very relaxed")); |
|
250 | 250 | } |
251 | 251 | |
252 | - public function setVerticalAlignment($value=VerticalAlignment::MIDDLE){ |
|
253 | - return $this->addToPropertyCtrl("class", $value." aligned",VerticalAlignment::getConstantValues("aligned")); |
|
252 | + public function setVerticalAlignment($value=VerticalAlignment::MIDDLE) { |
|
253 | + return $this->addToPropertyCtrl("class", $value." aligned", VerticalAlignment::getConstantValues("aligned")); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | /** |
257 | 257 | * {@inheritDoc} |
258 | 258 | * @see \Ajax\common\html\HtmlCollection::createItem() |
259 | 259 | */ |
260 | - protected function createItem($value){ |
|
261 | - if($this->_createCols===false) |
|
260 | + protected function createItem($value) { |
|
261 | + if ($this->_createCols===false) |
|
262 | 262 | $value=null; |
263 | - $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1),$value,$this->_colSizing,$this->_implicitRows); |
|
263 | + $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1), $value, $this->_colSizing, $this->_implicitRows); |
|
264 | 264 | return $item; |
265 | 265 | } |
266 | 266 | |
@@ -268,17 +268,17 @@ discard block |
||
268 | 268 | * Sets $values to the grid |
269 | 269 | * @param array $values |
270 | 270 | */ |
271 | - public function setValues($values){ |
|
271 | + public function setValues($values) { |
|
272 | 272 | $count=$this->count(); |
273 | - if($this->_createCols===false){ |
|
274 | - for($i=$count;$i<\sizeof($values);$i++){ |
|
273 | + if ($this->_createCols===false) { |
|
274 | + for ($i=$count; $i<\sizeof($values); $i++) { |
|
275 | 275 | $colSize=\sizeof($values[$i]); |
276 | - $this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1),$colSize,$this->_colSizing,$this->_implicitRows)); |
|
276 | + $this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1), $colSize, $this->_colSizing, $this->_implicitRows)); |
|
277 | 277 | } |
278 | 278 | } |
279 | - $count=\min(array($this->count(),\sizeof($values))); |
|
280 | - for($i=0;$i<$count;$i++){ |
|
281 | - $this->content[$i]->setValues($values[$i],$this->_createCols===false); |
|
279 | + $count=\min(array($this->count(), \sizeof($values))); |
|
280 | + for ($i=0; $i<$count; $i++) { |
|
281 | + $this->content[$i]->setValues($values[$i], $this->_createCols===false); |
|
282 | 282 | } |
283 | 283 | } |
284 | 284 | |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | * stretch the row contents to take up the entire column height |
287 | 287 | * @return \Ajax\semantic\html\content\HtmlGridRow |
288 | 288 | */ |
289 | - public function setStretched(){ |
|
289 | + public function setStretched() { |
|
290 | 290 | return $this->addToProperty("class", "stretched"); |
291 | 291 | } |
292 | 292 |