Completed
Push — master ( 70601d...0c3815 )
by Jean-Christophe
03:29
created
Ajax/semantic/components/Popup.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/HtmlGrid.php 3 patches
Doc Comments   +7 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,6 +21,11 @@  discard block
 block discarded – undo
21 21
 	private $_createCols;
22 22
 	private $_colSizing=true;
23 23
 	private $_implicitRows=false;
24
+
25
+	/**
26
+	 * @param string $identifier
27
+	 * @param integer $numCols
28
+	 */
24 29
 	public function __construct( $identifier,$numRows=1,$numCols=NULL,$createCols=true,$implicitRows=false){
25 30
 		parent::__construct( $identifier, "div","ui grid");
26 31
 		$this->_implicitRows=$implicitRows;
@@ -95,7 +100,7 @@  discard block
 block discarded – undo
95 100
 	/**
96 101
 	 * return the row at $index
97 102
 	 * @param int $index
98
-	 * @return \Ajax\semantic\html\collections\HtmlGridRow
103
+	 * @return \Ajax\common\html\HtmlDoubleElement
99 104
 	 */
100 105
 	public function getRow($index){
101 106
 		return $this->getItem($index);
@@ -211,7 +216,7 @@  discard block
 block discarded – undo
211 216
 
212 217
 	/**
213 218
 	 * stretch the row contents to take up the entire column height
214
-	 * @return \Ajax\semantic\html\content\HtmlGridRow
219
+	 * @return HtmlGrid
215 220
 	 */
216 221
 	public function setStretched(){
217 222
 		return $this->addToProperty("class", "stretched");
Please login to merge, or discard this patch.
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -16,31 +16,31 @@  discard block
 block discarded – undo
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
-	public function __construct( $identifier,$numRows=1,$numCols=NULL,$createCols=true,$implicitRows=false){
25
-		parent::__construct( $identifier, "div","ui grid");
24
+	public function __construct($identifier, $numRows=1, $numCols=NULL, $createCols=true, $implicitRows=false) {
25
+		parent::__construct($identifier, "div", "ui grid");
26 26
 		$this->_implicitRows=$implicitRows;
27 27
 		$this->_createCols=$createCols;
28
-		if(isset($numCols)){
28
+		if (isset($numCols)) {
29 29
 			//if($this->_createCols){
30 30
 				$this->_colSizing=false;
31 31
 			//}
32 32
 			$this->setWide($numCols);
33 33
 		}
34
-		$this->setRowsCount($numRows,$numCols);
34
+		$this->setRowsCount($numRows, $numCols);
35 35
 	}
36 36
 
37
-	public function setWide($wide){
37
+	public function setWide($wide) {
38 38
 		$wide=Wide::getConstants()["W".$wide];
39 39
 		$this->addToPropertyCtrl("class", $wide, Wide::getConstants());
40
-		return $this->addToPropertyCtrl("class","column",array("column"));
40
+		return $this->addToPropertyCtrl("class", "column", array("column"));
41 41
 	}
42 42
 
43
-	public function addRow($colsCount=NULL){
43
+	public function addRow($colsCount=NULL) {
44 44
 		return $this->addItem($colsCount);
45 45
 	}
46 46
 
@@ -50,41 +50,41 @@  discard block
 block discarded – undo
50 50
 	 * @param int $colsCount
51 51
 	 * @return \Ajax\semantic\html\collections\HtmlGrid
52 52
 	 */
53
-	public function setRowsCount($rowsCount,$colsCount=NULL){
53
+	public function setRowsCount($rowsCount, $colsCount=NULL) {
54 54
 		$count=$this->count();
55
-		if($rowsCount<2){
56
-			for($i=$count;$i<$colsCount;$i++){
55
+		if ($rowsCount<2) {
56
+			for ($i=$count; $i<$colsCount; $i++) {
57 57
 				$this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i));
58 58
 			}
59
-		}else{
60
-			if($this->hasOnlyCols($count)){
59
+		}else {
60
+			if ($this->hasOnlyCols($count)) {
61 61
 				$tmpContent=$this->content;
62 62
 				$item=$this->addItem($colsCount);
63 63
 				$item->setContent($tmpContent);
64 64
 				$this->content=array();
65 65
 				$count=1;
66 66
 			}
67
-			for($i=$count;$i<$rowsCount;$i++){
67
+			for ($i=$count; $i<$rowsCount; $i++) {
68 68
 				$this->addItem($colsCount);
69 69
 			}
70 70
 		}
71 71
 		return $this;
72 72
 	}
73 73
 
74
-	protected function hasOnlyCols($count){
74
+	protected function hasOnlyCols($count) {
75 75
 		return $count>0 && $this->content[0] instanceof HtmlGridCol;
76 76
 	}
77 77
 
78
-	public function setColsCount($numCols,$toCreate=true){
78
+	public function setColsCount($numCols, $toCreate=true) {
79 79
 		$this->setWide($numCols);
80
-		if($toCreate==true){
80
+		if ($toCreate==true) {
81 81
 			$count=$this->count();
82
-			if($count==0 || $this->hasOnlyCols($count)){
83
-				for($i=$count;$i<$numCols;$i++){
82
+			if ($count==0 || $this->hasOnlyCols($count)) {
83
+				for ($i=$count; $i<$numCols; $i++) {
84 84
 					$this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i));
85 85
 				}
86
-			}else{
87
-				for($i=0;$i<$count;$i++){
86
+			}else {
87
+				for ($i=0; $i<$count; $i++) {
88 88
 					$this->getItem($i)->setNumCols($numCols);
89 89
 				}
90 90
 			}
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	 * @param int $index
98 98
 	 * @return \Ajax\semantic\html\collections\HtmlGridRow
99 99
 	 */
100
-	public function getRow($index){
100
+	public function getRow($index) {
101 101
 		return $this->getItem($index);
102 102
 	}
103 103
 
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
 	 * @param int $col
107 107
 	 * @return \Ajax\semantic\html\collections\HtmlGridCol
108 108
 	 */
109
-	public function getCell($row,$col){
110
-		if($row<2 && $this->hasOnlyCols($this->count()))
109
+	public function getCell($row, $col) {
110
+		if ($row<2 && $this->hasOnlyCols($this->count()))
111 111
 			return $this->getItem($col);
112 112
 		$row=$this->getItem($row);
113
-		if(isset($row)){
113
+		if (isset($row)) {
114 114
 			$col=$row->getItem($col);
115 115
 		}
116 116
 		return $col;
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
 	 * @param boolean $vertically
122 122
 	 * @return \Ajax\semantic\html\collections\HtmlGrid
123 123
 	 */
124
-	public function setDivided($vertically=false){
125
-		$value=($vertically===true)?"vertically divided":"divided";
126
-		return $this->addToPropertyCtrl("class", $value,array("divided"));
124
+	public function setDivided($vertically=false) {
125
+		$value=($vertically===true) ? "vertically divided" : "divided";
126
+		return $this->addToPropertyCtrl("class", $value, array("divided"));
127 127
 	}
128 128
 
129 129
 	/**
@@ -131,16 +131,16 @@  discard block
 block discarded – undo
131 131
 	 * @param boolean $internally true for internal cells
132 132
 	 * @return \Ajax\semantic\html\collections\HtmlGrid
133 133
 	 */
134
-	public function setCelled($internally=false){
135
-		$value=($internally===true)?"internally celled":"celled";
136
-		return $this->addToPropertyCtrl("class", $value,array("celled","internally celled"));
134
+	public function setCelled($internally=false) {
135
+		$value=($internally===true) ? "internally celled" : "celled";
136
+		return $this->addToPropertyCtrl("class", $value, array("celled", "internally celled"));
137 137
 	}
138 138
 
139 139
 	/**
140 140
 	 * automatically resize all elements to split the available width evenly
141 141
 	 * @return \Ajax\semantic\html\collections\HtmlGrid
142 142
 	 */
143
-	public function setEqualWidth(){
143
+	public function setEqualWidth() {
144 144
 		return $this->addToProperty("class", "equal width");
145 145
 	}
146 146
 
@@ -149,9 +149,9 @@  discard block
 block discarded – undo
149 149
 	 * @param string $value
150 150
 	 * @return \Ajax\semantic\html\collections\HtmlGrid
151 151
 	 */
152
-	public function setPadded($value=NULL){
153
-		if(isset($value))
154
-			$this->addToPropertyCtrl("class", $value,array("vertically","horizontally"));
152
+	public function setPadded($value=NULL) {
153
+		if (isset($value))
154
+			$this->addToPropertyCtrl("class", $value, array("vertically", "horizontally"));
155 155
 		return $this->addToProperty("class", "padded");
156 156
 	}
157 157
 
@@ -159,49 +159,49 @@  discard block
 block discarded – undo
159 159
 	 * @param boolean $very
160 160
 	 * @return \Ajax\semantic\html\collections\HtmlGrid
161 161
 	 */
162
-	public function setRelaxed($very=false){
163
-		$value=($very===true)?"very relaxed":"relaxed";
164
-		return $this->addToPropertyCtrl("class", $value,array("relaxed","very relaxed"));
162
+	public function setRelaxed($very=false) {
163
+		$value=($very===true) ? "very relaxed" : "relaxed";
164
+		return $this->addToPropertyCtrl("class", $value, array("relaxed", "very relaxed"));
165 165
 	}
166 166
 
167
-	public function setVerticalAlignment($value=VerticalAlignment::MIDDLE){
168
-		return $this->addToPropertyCtrl("class", $value." aligned",VerticalAlignment::getConstantValues("aligned"));
167
+	public function setVerticalAlignment($value=VerticalAlignment::MIDDLE) {
168
+		return $this->addToPropertyCtrl("class", $value." aligned", VerticalAlignment::getConstantValues("aligned"));
169 169
 	}
170 170
 
171 171
 	/**
172 172
 	 * {@inheritDoc}
173 173
 	 * @see \Ajax\common\html\HtmlCollection::createItem()
174 174
 	 */
175
-	protected function createItem($value){
176
-		if($this->_createCols===false)
175
+	protected function createItem($value) {
176
+		if ($this->_createCols===false)
177 177
 			$value=null;
178
-		$item=new HtmlGridRow($this->identifier."-row-".($this->count()+1),$value,$this->_colSizing,$this->_implicitRows);
178
+		$item=new HtmlGridRow($this->identifier."-row-".($this->count()+1), $value, $this->_colSizing, $this->_implicitRows);
179 179
 		return $item;
180 180
 	}
181 181
 
182
-	public function setValues($values){
182
+	public function setValues($values) {
183 183
 		$count=$this->count();
184
-		if($this->_createCols===false){
185
-			for($i=$count;$i<\sizeof($values);$i++){
184
+		if ($this->_createCols===false) {
185
+			for ($i=$count; $i<\sizeof($values); $i++) {
186 186
 				$colSize=\sizeof($values[$i]);
187
-				$this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1),$colSize,$this->_colSizing,$this->_implicitRows));
187
+				$this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1), $colSize, $this->_colSizing, $this->_implicitRows));
188 188
 			}
189 189
 		}
190
-		$count=\min(array($this->count(),\sizeof($values)));
191
-		for($i=0;$i<$count;$i++){
192
-			$this->content[$i]->setValues($values[$i],$this->_createCols===false);
190
+		$count=\min(array($this->count(), \sizeof($values)));
191
+		for ($i=0; $i<$count; $i++) {
192
+			$this->content[$i]->setValues($values[$i], $this->_createCols===false);
193 193
 		}
194 194
 	}
195 195
 
196
-	public function rowCount(){
196
+	public function rowCount() {
197 197
 		return $this->count();
198 198
 	}
199 199
 
200
-	public function colCount(){
200
+	public function colCount() {
201 201
 		$result=0;
202 202
 		$count=$this->count();
203
-		if($count>0){
204
-			if($this->content[0] instanceof HtmlGridCol)
203
+		if ($count>0) {
204
+			if ($this->content[0] instanceof HtmlGridCol)
205 205
 				$result=$count;
206 206
 			else
207 207
 				$result=$this->content[0]->count();
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	 * stretch the row contents to take up the entire column height
214 214
 	 * @return \Ajax\semantic\html\content\HtmlGridRow
215 215
 	 */
216
-	public function setStretched(){
216
+	public function setStretched() {
217 217
 		return $this->addToProperty("class", "stretched");
218 218
 	}
219 219
 
Please login to merge, or discard this patch.
Braces   +16 added lines, -12 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 			for($i=$count;$i<$colsCount;$i++){
57 57
 				$this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i));
58 58
 			}
59
-		}else{
59
+		} else{
60 60
 			if($this->hasOnlyCols($count)){
61 61
 				$tmpContent=$this->content;
62 62
 				$item=$this->addItem($colsCount);
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 				for($i=$count;$i<$numCols;$i++){
84 84
 					$this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i));
85 85
 				}
86
-			}else{
86
+			} else{
87 87
 				for($i=0;$i<$count;$i++){
88 88
 					$this->getItem($i)->setNumCols($numCols);
89 89
 				}
@@ -107,8 +107,9 @@  discard block
 block discarded – undo
107 107
 	 * @return \Ajax\semantic\html\collections\HtmlGridCol
108 108
 	 */
109 109
 	public function getCell($row,$col){
110
-		if($row<2 && $this->hasOnlyCols($this->count()))
111
-			return $this->getItem($col);
110
+		if($row<2 && $this->hasOnlyCols($this->count())) {
111
+					return $this->getItem($col);
112
+		}
112 113
 		$row=$this->getItem($row);
113 114
 		if(isset($row)){
114 115
 			$col=$row->getItem($col);
@@ -150,8 +151,9 @@  discard block
 block discarded – undo
150 151
 	 * @return \Ajax\semantic\html\collections\HtmlGrid
151 152
 	 */
152 153
 	public function setPadded($value=NULL){
153
-		if(isset($value))
154
-			$this->addToPropertyCtrl("class", $value,array("vertically","horizontally"));
154
+		if(isset($value)) {
155
+					$this->addToPropertyCtrl("class", $value,array("vertically","horizontally"));
156
+		}
155 157
 		return $this->addToProperty("class", "padded");
156 158
 	}
157 159
 
@@ -173,8 +175,9 @@  discard block
 block discarded – undo
173 175
 	 * @see \Ajax\common\html\HtmlCollection::createItem()
174 176
 	 */
175 177
 	protected function createItem($value){
176
-		if($this->_createCols===false)
177
-			$value=null;
178
+		if($this->_createCols===false) {
179
+					$value=null;
180
+		}
178 181
 		$item=new HtmlGridRow($this->identifier."-row-".($this->count()+1),$value,$this->_colSizing,$this->_implicitRows);
179 182
 		return $item;
180 183
 	}
@@ -201,10 +204,11 @@  discard block
 block discarded – undo
201 204
 		$result=0;
202 205
 		$count=$this->count();
203 206
 		if($count>0){
204
-			if($this->content[0] instanceof HtmlGridCol)
205
-				$result=$count;
206
-			else
207
-				$result=$this->content[0]->count();
207
+			if($this->content[0] instanceof HtmlGridCol) {
208
+							$result=$count;
209
+			} else {
210
+							$result=$this->content[0]->count();
211
+			}
208 212
 		}
209 213
 		return $result;
210 214
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlPopup.php 2 patches
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -12,6 +12,10 @@  discard block
 block discarded – undo
12 12
 class HtmlPopup extends HtmlSemDoubleElement {
13 13
 	private $params;
14 14
 	private $_container;
15
+
16
+	/**
17
+	 * @param string $identifier
18
+	 */
15 19
 	public function __construct(BaseHtml $container,$identifier, $content="") {
16 20
 		parent::__construct($identifier, "div");
17 21
 		$this->_container=$container;
@@ -72,6 +76,9 @@  discard block
 block discarded – undo
72 76
 		return $this;
73 77
 	}
74 78
 
79
+	/**
80
+	 * @param string $position
81
+	 */
75 82
 	public function setPosition($position){
76 83
 		$this->params["position"]=$position;
77 84
 		return $this;
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 class HtmlPopup extends HtmlSemDoubleElement {
13 13
 	private $params;
14 14
 	private $_container;
15
-	public function __construct(BaseHtml $container,$identifier, $content="") {
15
+	public function __construct(BaseHtml $container, $identifier, $content="") {
16 16
 		parent::__construct($identifier, "div");
17 17
 		$this->_container=$container;
18 18
 		$this->setClass("ui popup");
@@ -20,21 +20,21 @@  discard block
 block discarded – undo
20 20
 		$this->params=array("on"=>"hover");
21 21
 	}
22 22
 
23
-	public function addList($items=array(),$header=NULL){
24
-		if(!$this->content instanceof HtmlGrid){
25
-			$this->content=new HtmlGrid("grid-".$this->identifier,0);
23
+	public function addList($items=array(), $header=NULL) {
24
+		if (!$this->content instanceof HtmlGrid) {
25
+			$this->content=new HtmlGrid("grid-".$this->identifier, 0);
26 26
 		}
27 27
 		$grid=$this->content;
28 28
 
29 29
 		$colCount=$grid->colCount();
30 30
 		$grid->setNumCols(++$colCount);
31 31
 
32
-		$list=new HtmlList("",$items);
32
+		$list=new HtmlList("", $items);
33 33
 		$list->asLink();
34
-		if(isset($header)){
35
-			$list->addHeader(4,$header);
34
+		if (isset($header)) {
35
+			$list->addHeader(4, $header);
36 36
 		}
37
-		$grid->getCell(0,$colCount-1)->setContent($list);
37
+		$grid->getCell(0, $colCount-1)->setContent($list);
38 38
 		$grid->setDivided()->setRelaxed(true);
39 39
 		return $list;
40 40
 	}
@@ -42,14 +42,14 @@  discard block
 block discarded – undo
42 42
 	/**
43 43
 	 * A popup can have no maximum width and continue to flow to fit its content
44 44
 	 */
45
-	public function setFlowing(){
45
+	public function setFlowing() {
46 46
 		return $this->addToProperty("class", "flowing");
47 47
 	}
48 48
 
49 49
 	/**
50 50
 	 * A popup can provide more basic formatting
51 51
 	 */
52
-	public function setBasic(){
52
+	public function setBasic() {
53 53
 		return $this->addToProperty("class", "basic");
54 54
 	}
55 55
 
@@ -57,22 +57,22 @@  discard block
 block discarded – undo
57 57
 	 * {@inheritDoc}
58 58
 	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run()
59 59
 	 */
60
-	public function run(JsUtils $js){
60
+	public function run(JsUtils $js) {
61 61
 		$this->params["popup"]="#".$this->identifier;
62
-		$js->semantic()->popup("#".$this->_container->getIdentifier(),$this->params);
62
+		$js->semantic()->popup("#".$this->_container->getIdentifier(), $this->params);
63 63
 	}
64 64
 
65
-	public function setOn($event="click"){
65
+	public function setOn($event="click") {
66 66
 		$this->params["on"]=$event;
67 67
 		return $this;
68 68
 	}
69 69
 
70
-	public function setInline($value=true){
70
+	public function setInline($value=true) {
71 71
 		$this->params["inline"]=$value;
72 72
 		return $this;
73 73
 	}
74 74
 
75
-	public function setPosition($position){
75
+	public function setPosition($position) {
76 76
 		$this->params["position"]=$position;
77 77
 		return $this;
78 78
 	}
Please login to merge, or discard this patch.