@@ -14,10 +14,11 @@ |
||
14 | 14 | if(isset($numCols)){ |
15 | 15 | $numCols=min(16,$numCols); |
16 | 16 | $numCols=max(1,$numCols); |
17 | - if($colSizing) |
|
18 | - $width=(int)(16/$numCols); |
|
19 | - else |
|
20 | - $this->_colSize=16/$numCols; |
|
17 | + if($colSizing) { |
|
18 | + $width=(int)(16/$numCols); |
|
19 | + } else { |
|
20 | + $this->_colSize=16/$numCols; |
|
21 | + } |
|
21 | 22 | for ($i=0;$i<$numCols;$i++){ |
22 | 23 | $this->addItem($width); |
23 | 24 | } |
@@ -16,6 +16,10 @@ discard block |
||
16 | 16 | class HtmlGridRow extends HtmlCollection{ |
17 | 17 | |
18 | 18 | private $_colSize; |
19 | + |
|
20 | + /** |
|
21 | + * @param string $identifier |
|
22 | + */ |
|
19 | 23 | public function __construct( $identifier,$numCols=NULL,$colSizing=false){ |
20 | 24 | parent::__construct( $identifier,"div"); |
21 | 25 | $this->setClass("row"); |
@@ -49,7 +53,7 @@ discard block |
||
49 | 53 | /** |
50 | 54 | * return the col at $index |
51 | 55 | * @param int $index |
52 | - * @return \Ajax\semantic\html\collections\HtmlGridCol |
|
56 | + * @return \Ajax\common\html\HtmlDoubleElement |
|
53 | 57 | */ |
54 | 58 | public function getCol($index){ |
55 | 59 | return $this->getItem($index); |
@@ -13,21 +13,21 @@ discard block |
||
13 | 13 | * @author jc |
14 | 14 | * @version 1.001 |
15 | 15 | */ |
16 | -class HtmlGridRow extends HtmlCollection{ |
|
16 | +class HtmlGridRow extends HtmlCollection { |
|
17 | 17 | |
18 | 18 | private $_colSize; |
19 | - public function __construct( $identifier,$numCols=NULL,$colSizing=false){ |
|
20 | - parent::__construct( $identifier,"div"); |
|
19 | + public function __construct($identifier, $numCols=NULL, $colSizing=false) { |
|
20 | + parent::__construct($identifier, "div"); |
|
21 | 21 | $this->setClass("row"); |
22 | 22 | $width=null; |
23 | - if(isset($numCols)){ |
|
24 | - $numCols=min(16,$numCols); |
|
25 | - $numCols=max(1,$numCols); |
|
26 | - if($colSizing) |
|
27 | - $width=(int)(16/$numCols); |
|
23 | + if (isset($numCols)) { |
|
24 | + $numCols=min(16, $numCols); |
|
25 | + $numCols=max(1, $numCols); |
|
26 | + if ($colSizing) |
|
27 | + $width=(int) (16 / $numCols); |
|
28 | 28 | else |
29 | - $this->_colSize=16/$numCols; |
|
30 | - for ($i=0;$i<$numCols;$i++){ |
|
29 | + $this->_colSize=16 / $numCols; |
|
30 | + for ($i=0; $i<$numCols; $i++) { |
|
31 | 31 | $this->addItem($width); |
32 | 32 | } |
33 | 33 | } |
@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | * @param int $width |
39 | 39 | * @return \Ajax\semantic\html\content\HtmlGridRow |
40 | 40 | */ |
41 | - public function setWidth($width){ |
|
42 | - if(\is_int($width)){ |
|
41 | + public function setWidth($width) { |
|
42 | + if (\is_int($width)) { |
|
43 | 43 | $width=Wide::getConstants()["W".$width]; |
44 | 44 | } |
45 | 45 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
46 | - return $this->addToPropertyCtrl("class", "column",array("column")); |
|
46 | + return $this->addToPropertyCtrl("class", "column", array("column")); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @param int $index |
52 | 52 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
53 | 53 | */ |
54 | - public function getCol($index){ |
|
54 | + public function getCol($index) { |
|
55 | 55 | return $this->getItem($index); |
56 | 56 | } |
57 | 57 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * stretch the row contents to take up the entire column height |
60 | 60 | * @return \Ajax\semantic\html\content\HtmlGridRow |
61 | 61 | */ |
62 | - public function setStretched(){ |
|
62 | + public function setStretched() { |
|
63 | 63 | return $this->addToProperty("class", "stretched"); |
64 | 64 | } |
65 | 65 | |
@@ -67,23 +67,23 @@ discard block |
||
67 | 67 | * @param string $color |
68 | 68 | * @return \Ajax\semantic\html\content\HtmlGridRow |
69 | 69 | */ |
70 | - public function setColor($color){ |
|
71 | - return $this->addToPropertyCtrl("class", $color,Color::getConstants()); |
|
70 | + public function setColor($color) { |
|
71 | + return $this->addToPropertyCtrl("class", $color, Color::getConstants()); |
|
72 | 72 | } |
73 | 73 | |
74 | - public function setTextAlignment($value=TextAlignment::LEFT){ |
|
75 | - return $this->addToPropertyCtrl("class", $value,TextAlignment::getConstants()); |
|
74 | + public function setTextAlignment($value=TextAlignment::LEFT) { |
|
75 | + return $this->addToPropertyCtrl("class", $value, TextAlignment::getConstants()); |
|
76 | 76 | } |
77 | 77 | |
78 | - public function setValues($values,$force=false){ |
|
78 | + public function setValues($values, $force=false) { |
|
79 | 79 | $count=$this->count(); |
80 | - if($force===true){ |
|
81 | - for($i=$count;$i<\sizeof($values);$i++){ |
|
82 | - $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1),null)); |
|
80 | + if ($force===true) { |
|
81 | + for ($i=$count; $i<\sizeof($values); $i++) { |
|
82 | + $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1), null)); |
|
83 | 83 | } |
84 | 84 | } |
85 | - $count=\min(array($this->count(),\sizeof($values))); |
|
86 | - for($i=0;$i<$count;$i++){ |
|
85 | + $count=\min(array($this->count(), \sizeof($values))); |
|
86 | + for ($i=0; $i<$count; $i++) { |
|
87 | 87 | $this->content[$i]->setValue($values[$i]); |
88 | 88 | } |
89 | 89 | } |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | * {@inheritDoc} |
93 | 93 | * @see \Ajax\common\html\HtmlCollection::createItem() |
94 | 94 | */ |
95 | - protected function createItem($value){ |
|
96 | - $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1),$value); |
|
95 | + protected function createItem($value) { |
|
96 | + $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1), $value); |
|
97 | 97 | return $col; |
98 | 98 | } |
99 | 99 | } |
100 | 100 | \ No newline at end of file |
@@ -6,23 +6,23 @@ discard block |
||
6 | 6 | |
7 | 7 | abstract class HtmlCollection extends HtmlDoubleElement { |
8 | 8 | |
9 | - public function __construct($identifier,$tagName="div"){ |
|
10 | - parent::__construct($identifier,$tagName); |
|
9 | + public function __construct($identifier, $tagName="div") { |
|
10 | + parent::__construct($identifier, $tagName); |
|
11 | 11 | $this->content=array(); |
12 | 12 | } |
13 | 13 | |
14 | - public function addItems($items){ |
|
15 | - foreach ($items as $item){ |
|
14 | + public function addItems($items) { |
|
15 | + foreach ($items as $item) { |
|
16 | 16 | $this->addItem($item); |
17 | 17 | } |
18 | 18 | } |
19 | 19 | |
20 | - public function setItems($items){ |
|
20 | + public function setItems($items) { |
|
21 | 21 | $this->content=$items; |
22 | 22 | return $this; |
23 | 23 | } |
24 | 24 | |
25 | - public function getItems(){ |
|
25 | + public function getItems() { |
|
26 | 26 | return $this->content; |
27 | 27 | } |
28 | 28 | |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | * @param HtmlDoubleElement|string $item |
32 | 32 | * @return \Ajax\common\html\HtmlDoubleElement |
33 | 33 | */ |
34 | - public function addItem($item){ |
|
34 | + public function addItem($item) { |
|
35 | 35 | $itemO=$item; |
36 | - if(\is_object($item)===false){ |
|
36 | + if (\is_object($item)===false) { |
|
37 | 37 | $itemO=$this->createItem($item); |
38 | 38 | } |
39 | 39 | $this->addContent($itemO); |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | return $this; |
60 | 60 | } |
61 | 61 | |
62 | - public function removeItem($index){ |
|
62 | + public function removeItem($index) { |
|
63 | 63 | return array_splice($this->content, $index, 1); |
64 | 64 | } |
65 | 65 | |
66 | - public function count(){ |
|
66 | + public function count() { |
|
67 | 67 | return \sizeof($this->content); |
68 | 68 | } |
69 | 69 |
@@ -45,9 +45,9 @@ |
||
45 | 45 | * @return \Ajax\common\html\HtmlDoubleElement |
46 | 46 | */ |
47 | 47 | public function getItem($index) { |
48 | - if (is_int($index)) |
|
49 | - return $this->content[$index]; |
|
50 | - else { |
|
48 | + if (is_int($index)) { |
|
49 | + return $this->content[$index]; |
|
50 | + } else { |
|
51 | 51 | $elm=$this->getElementById($index, $this->content); |
52 | 52 | return $elm; |
53 | 53 | } |
@@ -25,47 +25,47 @@ |
||
25 | 25 | * @param string $type one of "raised","stacked","piled" default : "" |
26 | 26 | * @return \Ajax\semantic\html\elements\HtmlSegment |
27 | 27 | */ |
28 | - public function setType($type){ |
|
28 | + public function setType($type) { |
|
29 | 29 | return $this->addToPropertyCtrl("class", $type, SegmentType::getConstants()); |
30 | 30 | } |
31 | 31 | |
32 | - public function setSens($sens="vertical"){ |
|
33 | - return $this->addToPropertyCtrl("class", $sens, array("vertical","horizontal")); |
|
32 | + public function setSens($sens="vertical") { |
|
33 | + return $this->addToPropertyCtrl("class", $sens, array("vertical", "horizontal")); |
|
34 | 34 | } |
35 | 35 | |
36 | - public function setInverted(){ |
|
36 | + public function setInverted() { |
|
37 | 37 | return $this->addToProperty("class", "inverted"); |
38 | 38 | } |
39 | 39 | |
40 | - public function setAttached(){ |
|
40 | + public function setAttached() { |
|
41 | 41 | return $this->addToProperty("class", "attached"); |
42 | 42 | } |
43 | 43 | |
44 | - public function setEmphasis($value="secondary"){ |
|
45 | - return $this->addToPropertyCtrl("class", $value, array("secondary","tertiary","")); |
|
44 | + public function setEmphasis($value="secondary") { |
|
45 | + return $this->addToPropertyCtrl("class", $value, array("secondary", "tertiary", "")); |
|
46 | 46 | } |
47 | 47 | |
48 | - public function setCircular(){ |
|
48 | + public function setCircular() { |
|
49 | 49 | return $this->addToProperty("class", "circular"); |
50 | 50 | } |
51 | 51 | |
52 | - public function clear(){ |
|
52 | + public function clear() { |
|
53 | 53 | return $this->addToProperty("class", "clearing"); |
54 | 54 | } |
55 | 55 | |
56 | - public function setFloating($value="left"){ |
|
57 | - return $this->addToPropertyCtrl("class", "floated ".$value,array("floated right","floated left")); |
|
56 | + public function setFloating($value="left") { |
|
57 | + return $this->addToPropertyCtrl("class", "floated ".$value, array("floated right", "floated left")); |
|
58 | 58 | } |
59 | 59 | |
60 | - public function setTextAlignment($value=TextAlignment::LEFT){ |
|
61 | - return $this->addToPropertyCtrl("class", $value,TextAlignment::getConstants()); |
|
60 | + public function setTextAlignment($value=TextAlignment::LEFT) { |
|
61 | + return $this->addToPropertyCtrl("class", $value, TextAlignment::getConstants()); |
|
62 | 62 | } |
63 | 63 | |
64 | - public function setCompact(){ |
|
64 | + public function setCompact() { |
|
65 | 65 | return $this->addToProperty("class", "compact"); |
66 | 66 | } |
67 | 67 | |
68 | - public function setBasic(){ |
|
68 | + public function setBasic() { |
|
69 | 69 | return $this->setProperty("class", "ui basic segment"); |
70 | 70 | } |
71 | 71 |
@@ -101,8 +101,9 @@ discard block |
||
101 | 101 | * @return \Ajax\semantic\html\collections\HtmlGrid |
102 | 102 | */ |
103 | 103 | public function setPadded($value=NULL){ |
104 | - if(isset($value)) |
|
105 | - $this->addToPropertyCtrl("class", $value,array("vertically","horizontally")); |
|
104 | + if(isset($value)) { |
|
105 | + $this->addToPropertyCtrl("class", $value,array("vertically","horizontally")); |
|
106 | + } |
|
106 | 107 | return $this->addToProperty("class", "padded"); |
107 | 108 | } |
108 | 109 | |
@@ -124,8 +125,9 @@ discard block |
||
124 | 125 | * @see \Ajax\common\html\HtmlCollection::createItem() |
125 | 126 | */ |
126 | 127 | protected function createItem($value){ |
127 | - if($this->_createCols===false) |
|
128 | - $value=null; |
|
128 | + if($this->_createCols===false) { |
|
129 | + $value=null; |
|
130 | + } |
|
129 | 131 | $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1),$value,$this->_colSizing); |
130 | 132 | return $item; |
131 | 133 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | /** |
50 | 50 | * return the row at $index |
51 | 51 | * @param int $index |
52 | - * @return \Ajax\semantic\html\collections\HtmlGridRow |
|
52 | + * @return \Ajax\common\html\HtmlDoubleElement |
|
53 | 53 | */ |
54 | 54 | public function getRow($index){ |
55 | 55 | return $this->getItem($index); |
@@ -14,22 +14,22 @@ discard block |
||
14 | 14 | * @author jc |
15 | 15 | * @version 1.001 |
16 | 16 | */ |
17 | -class HtmlGrid extends HtmlCollection{ |
|
17 | +class HtmlGrid extends HtmlCollection { |
|
18 | 18 | |
19 | 19 | private $_createCols; |
20 | 20 | private $_colSizing=true; |
21 | - public function __construct( $identifier,$numRows=1,$numCols=NULL,$createCols=true){ |
|
22 | - parent::__construct( $identifier, "div"); |
|
21 | + public function __construct($identifier, $numRows=1, $numCols=NULL, $createCols=true) { |
|
22 | + parent::__construct($identifier, "div"); |
|
23 | 23 | $this->_createCols=$createCols; |
24 | - if(isset($numCols)){ |
|
24 | + if (isset($numCols)) { |
|
25 | 25 | //if($this->_createCols){ |
26 | 26 | $this->_colSizing=false; |
27 | 27 | //} |
28 | 28 | $cols=Wide::getConstants()["W".$numCols]; |
29 | 29 | $this->setClass($cols." column"); |
30 | 30 | } |
31 | - $this->addToProperty("class","ui grid"); |
|
32 | - $this->setNumRows($numRows,$numCols); |
|
31 | + $this->addToProperty("class", "ui grid"); |
|
32 | + $this->setNumRows($numRows, $numCols); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | * @param int $numCols |
39 | 39 | * @return \Ajax\semantic\html\collections\HtmlGrid |
40 | 40 | */ |
41 | - public function setNumRows($numRows,$numCols=NULL){ |
|
41 | + public function setNumRows($numRows, $numCols=NULL) { |
|
42 | 42 | $count=$this->count(); |
43 | - for($i=$count;$i<$numRows;$i++){ |
|
43 | + for ($i=$count; $i<$numRows; $i++) { |
|
44 | 44 | $this->addItem($numCols); |
45 | 45 | } |
46 | 46 | return $this; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @param int $index |
52 | 52 | * @return \Ajax\semantic\html\collections\HtmlGridRow |
53 | 53 | */ |
54 | - public function getRow($index){ |
|
54 | + public function getRow($index) { |
|
55 | 55 | return $this->getItem($index); |
56 | 56 | } |
57 | 57 | |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | * @param int $col |
61 | 61 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
62 | 62 | */ |
63 | - public function getCell($row,$col){ |
|
63 | + public function getCell($row, $col) { |
|
64 | 64 | $row=$this->getItem($row); |
65 | - if(isset($row)){ |
|
65 | + if (isset($row)) { |
|
66 | 66 | $col=$row->getItem($col); |
67 | 67 | } |
68 | 68 | return $col; |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | * @param boolean $vertically |
74 | 74 | * @return \Ajax\semantic\html\collections\HtmlGrid |
75 | 75 | */ |
76 | - public function setDivided($vertically=false){ |
|
77 | - $value=($vertically===true)?"vertically divided":"divided"; |
|
76 | + public function setDivided($vertically=false) { |
|
77 | + $value=($vertically===true) ? "vertically divided" : "divided"; |
|
78 | 78 | return $this->addToProperty("class", $value); |
79 | 79 | } |
80 | 80 | |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | * @param boolean $internal true for internal cells |
84 | 84 | * @return \Ajax\semantic\html\collections\HtmlGrid |
85 | 85 | */ |
86 | - public function setCelled($internal=false){ |
|
87 | - $value=($internal===true)?"internal celled":"celled"; |
|
86 | + public function setCelled($internal=false) { |
|
87 | + $value=($internal===true) ? "internal celled" : "celled"; |
|
88 | 88 | return $this->addToProperty("class", $value); |
89 | 89 | } |
90 | 90 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * automatically resize all elements to split the available width evenly |
93 | 93 | * @return \Ajax\semantic\html\collections\HtmlGrid |
94 | 94 | */ |
95 | - public function setEqualWidth(){ |
|
95 | + public function setEqualWidth() { |
|
96 | 96 | return $this->addToProperty("class", "equal width"); |
97 | 97 | } |
98 | 98 | |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | * @param string $value |
102 | 102 | * @return \Ajax\semantic\html\collections\HtmlGrid |
103 | 103 | */ |
104 | - public function setPadded($value=NULL){ |
|
105 | - if(isset($value)) |
|
106 | - $this->addToPropertyCtrl("class", $value,array("vertically","horizontally")); |
|
104 | + public function setPadded($value=NULL) { |
|
105 | + if (isset($value)) |
|
106 | + $this->addToPropertyCtrl("class", $value, array("vertically", "horizontally")); |
|
107 | 107 | return $this->addToProperty("class", "padded"); |
108 | 108 | } |
109 | 109 | |
@@ -111,41 +111,41 @@ discard block |
||
111 | 111 | * @param boolean $very |
112 | 112 | * @return \Ajax\semantic\html\collections\HtmlGrid |
113 | 113 | */ |
114 | - public function setRelaxed($very=false){ |
|
115 | - $value=($very===true)?"very relaxed":"relaxed"; |
|
114 | + public function setRelaxed($very=false) { |
|
115 | + $value=($very===true) ? "very relaxed" : "relaxed"; |
|
116 | 116 | return $this->addToProperty("class", $value); |
117 | 117 | } |
118 | 118 | |
119 | - public function setTextAlignment($value=TextAlignment::LEFT){ |
|
120 | - return $this->addToPropertyCtrl("class", $value,TextAlignment::getConstants()); |
|
119 | + public function setTextAlignment($value=TextAlignment::LEFT) { |
|
120 | + return $this->addToPropertyCtrl("class", $value, TextAlignment::getConstants()); |
|
121 | 121 | } |
122 | 122 | |
123 | - public function setVerticalAlignment($value=VerticalAlignment::MIDDLE){ |
|
124 | - return $this->addToPropertyCtrl("class", $value,VerticalAlignment::getConstants()); |
|
123 | + public function setVerticalAlignment($value=VerticalAlignment::MIDDLE) { |
|
124 | + return $this->addToPropertyCtrl("class", $value, VerticalAlignment::getConstants()); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
128 | 128 | * {@inheritDoc} |
129 | 129 | * @see \Ajax\common\html\HtmlCollection::createItem() |
130 | 130 | */ |
131 | - protected function createItem($value){ |
|
132 | - if($this->_createCols===false) |
|
131 | + protected function createItem($value) { |
|
132 | + if ($this->_createCols===false) |
|
133 | 133 | $value=null; |
134 | - $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1),$value,$this->_colSizing); |
|
134 | + $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1), $value, $this->_colSizing); |
|
135 | 135 | return $item; |
136 | 136 | } |
137 | 137 | |
138 | - public function setValues($values){ |
|
138 | + public function setValues($values) { |
|
139 | 139 | $count=$this->count(); |
140 | - if($this->_createCols===false){ |
|
141 | - for($i=$count;$i<\sizeof($values);$i++){ |
|
140 | + if ($this->_createCols===false) { |
|
141 | + for ($i=$count; $i<\sizeof($values); $i++) { |
|
142 | 142 | $colSize=\sizeof($values[$i]); |
143 | - $this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1),$colSize,$this->_colSizing)); |
|
143 | + $this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1), $colSize, $this->_colSizing)); |
|
144 | 144 | } |
145 | 145 | } |
146 | - $count=\min(array($this->count(),\sizeof($values))); |
|
147 | - for($i=0;$i<$count;$i++){ |
|
148 | - $this->content[$i]->setValues($values[$i],$this->_createCols===false); |
|
146 | + $count=\min(array($this->count(), \sizeof($values))); |
|
147 | + for ($i=0; $i<$count; $i++) { |
|
148 | + $this->content[$i]->setValues($values[$i], $this->_createCols===false); |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 |
@@ -5,5 +5,5 @@ |
||
5 | 5 | use Ajax\common\BaseEnum; |
6 | 6 | |
7 | 7 | class TextAlignment extends BaseEnum { |
8 | - const LEFT="left aligned",CENTER="center aligned",RIGHT="right aligned",JUSTIFIED="justified"; |
|
8 | + const LEFT="left aligned", CENTER="center aligned", RIGHT="right aligned", JUSTIFIED="justified"; |
|
9 | 9 | } |
10 | 10 | \ No newline at end of file |
@@ -5,5 +5,5 @@ |
||
5 | 5 | use Ajax\common\BaseEnum; |
6 | 6 | |
7 | 7 | class VerticalAlignment extends BaseEnum { |
8 | - const TOP="top aligned",MIDDLE="middle aligned",BOTTOM="bottom aligned"; |
|
8 | + const TOP="top aligned", MIDDLE="middle aligned", BOTTOM="bottom aligned"; |
|
9 | 9 | } |
10 | 10 | \ No newline at end of file |