@@ -14,6 +14,10 @@ discard block |
||
14 | 14 | */ |
15 | 15 | class HtmlGridRow extends HtmlDoubleElement { |
16 | 16 | private $cols; |
17 | + |
|
18 | + /** |
|
19 | + * @param string $identifier |
|
20 | + */ |
|
17 | 21 | public function __construct($identifier){ |
18 | 22 | parent::__construct($identifier,"div"); |
19 | 23 | $this->setProperty("class", "row"); |
@@ -41,6 +45,9 @@ discard block |
||
41 | 45 | return $result; |
42 | 46 | } |
43 | 47 | |
48 | + /** |
|
49 | + * @param integer $offset |
|
50 | + */ |
|
44 | 51 | public function getColAt($offset,$force=true){ |
45 | 52 | $result=null; |
46 | 53 | foreach ($this->cols as $col){ |
@@ -14,52 +14,52 @@ |
||
14 | 14 | */ |
15 | 15 | class HtmlGridRow extends HtmlDoubleElement { |
16 | 16 | private $cols; |
17 | - public function __construct($identifier){ |
|
18 | - parent::__construct($identifier,"div"); |
|
17 | + public function __construct($identifier) { |
|
18 | + parent::__construct($identifier, "div"); |
|
19 | 19 | $this->setProperty("class", "row"); |
20 | 20 | $this->cols=array(); |
21 | 21 | } |
22 | 22 | |
23 | - public function addCol($size=CssSize::SIZE_MD,$width=1){ |
|
24 | - $col=new HtmlGridCol($this->identifier."-col-".(sizeof($this->cols)+1),$size,$width); |
|
23 | + public function addCol($size=CssSize::SIZE_MD, $width=1) { |
|
24 | + $col=new HtmlGridCol($this->identifier."-col-".(sizeof($this->cols)+1), $size, $width); |
|
25 | 25 | $this->row[]=$col; |
26 | 26 | return $col; |
27 | 27 | } |
28 | 28 | |
29 | - public function addColAt($size=CssSize::SIZE_MD,$width=1,$offset=1){ |
|
30 | - $col=$this->addCol($size,$width); |
|
31 | - return $col->setOffset($size, max($offset,sizeof($this->cols)+1)); |
|
29 | + public function addColAt($size=CssSize::SIZE_MD, $width=1, $offset=1) { |
|
30 | + $col=$this->addCol($size, $width); |
|
31 | + return $col->setOffset($size, max($offset, sizeof($this->cols)+1)); |
|
32 | 32 | } |
33 | 33 | |
34 | - public function getCol($index,$force=true){ |
|
35 | - if($index<sizeof($this->cols)+1){ |
|
34 | + public function getCol($index, $force=true) { |
|
35 | + if ($index<sizeof($this->cols)+1) { |
|
36 | 36 | $result=$this->cols[$index-1]; |
37 | - }else if ($force){ |
|
38 | - $result=$this->addColAt(CssSize::SIZE_MD,1,$index); |
|
37 | + }else if ($force) { |
|
38 | + $result=$this->addColAt(CssSize::SIZE_MD, 1, $index); |
|
39 | 39 | $this->cols[]=$result; |
40 | 40 | } |
41 | 41 | return $result; |
42 | 42 | } |
43 | 43 | |
44 | - public function getColAt($offset,$force=true){ |
|
44 | + public function getColAt($offset, $force=true) { |
|
45 | 45 | $result=null; |
46 | - foreach ($this->cols as $col){ |
|
46 | + foreach ($this->cols as $col) { |
|
47 | 47 | $offsets=$col->getOffsets(); |
48 | - if($result=array_search($offset, $offsets)){ |
|
48 | + if ($result=array_search($offset, $offsets)) { |
|
49 | 49 | break; |
50 | 50 | } |
51 | 51 | } |
52 | - if(!isset($result)){ |
|
53 | - $result=$this->getCol($offset,$force); |
|
52 | + if (!isset($result)) { |
|
53 | + $result=$this->getCol($offset, $force); |
|
54 | 54 | } |
55 | 55 | return $result; |
56 | 56 | } |
57 | 57 | |
58 | 58 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
59 | 59 | |
60 | - foreach ($this->cols as $col){ |
|
60 | + foreach ($this->cols as $col) { |
|
61 | 61 | $this->addContent($col); |
62 | 62 | } |
63 | - return parent::compile($js,$view); |
|
63 | + return parent::compile($js, $view); |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | \ No newline at end of file |
@@ -34,7 +34,7 @@ |
||
34 | 34 | public function getCol($index,$force=true){ |
35 | 35 | if($index<sizeof($this->cols)+1){ |
36 | 36 | $result=$this->cols[$index-1]; |
37 | - }else if ($force){ |
|
37 | + } else if ($force){ |
|
38 | 38 | $result=$this->addColAt(CssSize::SIZE_MD,1,$index); |
39 | 39 | $this->cols[]=$result; |
40 | 40 | } |
@@ -16,6 +16,9 @@ discard block |
||
16 | 16 | class HtmlGridSystem extends HtmlDoubleElement { |
17 | 17 | private $rows; |
18 | 18 | |
19 | + /** |
|
20 | + * @param string $identifier |
|
21 | + */ |
|
19 | 22 | public function __construct($identifier,$numRows=1){ |
20 | 23 | parent::__construct($identifier,"div"); |
21 | 24 | $this->setProperty("class", "container"); |
@@ -46,6 +49,9 @@ discard block |
||
46 | 49 | return $result; |
47 | 50 | } |
48 | 51 | |
52 | + /** |
|
53 | + * @param integer $numRows |
|
54 | + */ |
|
49 | 55 | public function setNumRows($numRows){ |
50 | 56 | for($i=sizeof($this->rows);$i<$numRows;$i++){ |
51 | 57 | $this->addRow(); |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | class HtmlGridSystem extends HtmlDoubleElement { |
17 | 17 | private $rows; |
18 | 18 | |
19 | - public function __construct($identifier,$numRows=1){ |
|
20 | - parent::__construct($identifier,"div"); |
|
19 | + public function __construct($identifier, $numRows=1) { |
|
20 | + parent::__construct($identifier, "div"); |
|
21 | 21 | $this->setProperty("class", "container"); |
22 | 22 | $this->rows=array(); |
23 | 23 | $this->setNumRows($numRows); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | /** |
27 | 27 | * @return \Ajax\bootstrap\html\content\HtmlGridRow |
28 | 28 | */ |
29 | - public function addRow(){ |
|
29 | + public function addRow() { |
|
30 | 30 | $row=new HtmlGridRow($this->identifier."-row-".(sizeof($this->rows)+1)); |
31 | 31 | $this->rows[]=$row; |
32 | 32 | return $row; |
@@ -36,18 +36,18 @@ discard block |
||
36 | 36 | * @param int $index |
37 | 37 | * @return \Ajax\bootstrap\html\content\HtmlGridRow |
38 | 38 | */ |
39 | - public function getRow($index,$force=true){ |
|
40 | - if($index<sizeof($this->rows)){ |
|
39 | + public function getRow($index, $force=true) { |
|
40 | + if ($index<sizeof($this->rows)) { |
|
41 | 41 | $result=$this->rows[$index-1]; |
42 | - }else if ($force){ |
|
42 | + }else if ($force) { |
|
43 | 43 | $this->setNumRows($index); |
44 | 44 | $result=$this->rows[$index-1]; |
45 | 45 | } |
46 | 46 | return $result; |
47 | 47 | } |
48 | 48 | |
49 | - public function setNumRows($numRows){ |
|
50 | - for($i=sizeof($this->rows);$i<$numRows;$i++){ |
|
49 | + public function setNumRows($numRows) { |
|
50 | + for ($i=sizeof($this->rows); $i<$numRows; $i++) { |
|
51 | 51 | $this->addRow(); |
52 | 52 | } |
53 | 53 | return $this; |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | * @param int $col |
59 | 59 | * @return HtmlGridCol |
60 | 60 | */ |
61 | - public function getCell($row,$col,$force=true){ |
|
62 | - $row=$this->getRow($row,$force); |
|
63 | - if(isset($row)){ |
|
64 | - $col=$row->getCol($col,$force); |
|
61 | + public function getCell($row, $col, $force=true) { |
|
62 | + $row=$this->getRow($row, $force); |
|
63 | + if (isset($row)) { |
|
64 | + $col=$row->getCol($col, $force); |
|
65 | 65 | } |
66 | 66 | return $col; |
67 | 67 | } |
@@ -71,18 +71,18 @@ discard block |
||
71 | 71 | * @param int $col |
72 | 72 | * @return HtmlGridCol |
73 | 73 | */ |
74 | - public function getCellAt($row,$col,$force=true){ |
|
75 | - $row=$this->getRow($row,$force); |
|
76 | - if(isset($row)){ |
|
77 | - $col=$row->getColAt($col,$force); |
|
74 | + public function getCellAt($row, $col, $force=true) { |
|
75 | + $row=$this->getRow($row, $force); |
|
76 | + if (isset($row)) { |
|
77 | + $col=$row->getColAt($col, $force); |
|
78 | 78 | } |
79 | 79 | return $col; |
80 | 80 | } |
81 | 81 | |
82 | 82 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
83 | - foreach ($this->rows as $row){ |
|
83 | + foreach ($this->rows as $row) { |
|
84 | 84 | $this->addContent($row); |
85 | 85 | } |
86 | - return parent::compile($js,$view); |
|
86 | + return parent::compile($js, $view); |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | \ No newline at end of file |
@@ -39,7 +39,7 @@ |
||
39 | 39 | public function getRow($index,$force=true){ |
40 | 40 | if($index<sizeof($this->rows)){ |
41 | 41 | $result=$this->rows[$index-1]; |
42 | - }else if ($force){ |
|
42 | + } else if ($force){ |
|
43 | 43 | $this->setNumRows($index); |
44 | 44 | $result=$this->rows[$index-1]; |
45 | 45 | } |
@@ -269,8 +269,8 @@ discard block |
||
269 | 269 | * @param string $tagName container tagName |
270 | 270 | * @return HtmlListgroup |
271 | 271 | */ |
272 | - public function htmlListgroup($identifier,$items=array(),$tagName="ul"){ |
|
273 | - $listGroup=new HtmlListgroup($identifier,$tagName); |
|
272 | + public function htmlListgroup($identifier, $items=array(), $tagName="ul") { |
|
273 | + $listGroup=new HtmlListgroup($identifier, $tagName); |
|
274 | 274 | $listGroup->addItems($items); |
275 | 275 | return $this->addHtmlComponent($listGroup); |
276 | 276 | } |
@@ -295,8 +295,8 @@ discard block |
||
295 | 295 | * @param string $onClick |
296 | 296 | * @return HtmlSplitbutton |
297 | 297 | */ |
298 | - public function htmlSplitbutton($identifier,$value="", $items=array(), $cssStyle="btn-default", $onClick=NULL) { |
|
299 | - return $this->addHtmlComponent(new HtmlSplitbutton($identifier, $value, $items, $cssStyle,$onClick)); |
|
298 | + public function htmlSplitbutton($identifier, $value="", $items=array(), $cssStyle="btn-default", $onClick=NULL) { |
|
299 | + return $this->addHtmlComponent(new HtmlSplitbutton($identifier, $value, $items, $cssStyle, $onClick)); |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | /** |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | * @param string $identifier |
305 | 305 | * @return HtmlInputgroup |
306 | 306 | */ |
307 | - public function htmlInputgroup($identifier){ |
|
307 | + public function htmlInputgroup($identifier) { |
|
308 | 308 | return $this->addHtmlComponent(new HtmlInputgroup($identifier)); |
309 | 309 | } |
310 | 310 | |
@@ -316,8 +316,8 @@ discard block |
||
316 | 316 | * @param function $hrefFunction the function who generates the href elements. default : function($e){return $e->getContent()} |
317 | 317 | * @return HtmlBreadcrumbs |
318 | 318 | */ |
319 | - public function htmlBreadcrumbs($identifier,$elements=array(),$autoActive=true,$hrefFunction=NULL){ |
|
320 | - return $this->addHtmlComponent(new HtmlBreadcrumbs($identifier,$elements,$autoActive,$hrefFunction)); |
|
319 | + public function htmlBreadcrumbs($identifier, $elements=array(), $autoActive=true, $hrefFunction=NULL) { |
|
320 | + return $this->addHtmlComponent(new HtmlBreadcrumbs($identifier, $elements, $autoActive, $hrefFunction)); |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | /** |
@@ -329,8 +329,8 @@ discard block |
||
329 | 329 | * @param int $active The active page |
330 | 330 | * @return HtmlPagination |
331 | 331 | */ |
332 | - public function htmlPagination($identifier,$from=1,$to=1,$active=NULL,$countVisible=NULL){ |
|
333 | - return $this->addHtmlComponent(new HtmlPagination($identifier,$from,$to,$active,$countVisible)); |
|
332 | + public function htmlPagination($identifier, $from=1, $to=1, $active=NULL, $countVisible=NULL) { |
|
333 | + return $this->addHtmlComponent(new HtmlPagination($identifier, $from, $to, $active, $countVisible)); |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | /** |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | * @param int $numRows |
341 | 341 | * @return HtmlGridSystem |
342 | 342 | */ |
343 | - public function htmlGridSystem($identifier,$numRows=1){ |
|
344 | - return $this->addHtmlComponent(new HtmlGridSystem($identifier,$numRows)); |
|
343 | + public function htmlGridSystem($identifier, $numRows=1) { |
|
344 | + return $this->addHtmlComponent(new HtmlGridSystem($identifier, $numRows)); |
|
345 | 345 | } |
346 | 346 | } |
347 | 347 | \ No newline at end of file |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | abstract class BaseHtml extends BaseWidget { |
16 | 16 | protected $_template; |
17 | 17 | protected $tagName; |
18 | - protected $properties=array (); |
|
19 | - protected $events=array (); |
|
18 | + protected $properties=array(); |
|
19 | + protected $events=array(); |
|
20 | 20 | protected $wrapBefore=""; |
21 | 21 | protected $wrapAfter=""; |
22 | 22 | protected $_bsComponent; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | public function addToProperty($name, $value, $separator=" ") { |
57 | 57 | $v=$this->properties [$name]; |
58 | - if (isset($v)&&$v!=="") |
|
58 | + if (isset($v) && $v!=="") |
|
59 | 59 | $v=$v.$separator.$value; |
60 | 60 | else |
61 | 61 | $v=$value; |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | |
71 | 71 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
72 | 72 | $result=$this->getTemplate(); |
73 | - foreach ( $this as $key => $value ) { |
|
74 | - if (PhalconUtils::startsWith($key, "_")===false&&$key!=="events") { |
|
73 | + foreach ($this as $key => $value) { |
|
74 | + if (PhalconUtils::startsWith($key, "_")===false && $key!=="events") { |
|
75 | 75 | if (is_array($value)) { |
76 | 76 | $v=PropertyWrapper::wrap($value, $js); |
77 | - } else { |
|
77 | + }else { |
|
78 | 78 | $v=$value; |
79 | 79 | } |
80 | 80 | $result=str_ireplace("%".$key."%", $v, $result); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | if (isset($view)===true) { |
87 | 87 | $controls=$view->getVar("q"); |
88 | 88 | if (isset($controls)===false) { |
89 | - $controls=array (); |
|
89 | + $controls=array(); |
|
90 | 90 | } |
91 | 91 | $controls [$this->identifier]=$result; |
92 | 92 | $view->setVar("q", $controls); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | if (array_search($value, $typeCtrl)===false) { |
100 | 100 | throw new \Exception("La valeur passée a propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
101 | 101 | } |
102 | - } else { |
|
102 | + }else { |
|
103 | 103 | if (!$typeCtrl($value)) { |
104 | 104 | throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name); |
105 | 105 | } |
@@ -176,28 +176,28 @@ discard block |
||
176 | 176 | } |
177 | 177 | |
178 | 178 | public function fromArray($array) { |
179 | - foreach ( $this as $key => $value ) { |
|
179 | + foreach ($this as $key => $value) { |
|
180 | 180 | if (array_key_exists($key, $array) && !PhalconUtils::startsWith($key, "_")) { |
181 | 181 | $setter="set".ucfirst($key); |
182 | 182 | $this->$setter($array [$key]); |
183 | 183 | unset($array [$key]); |
184 | 184 | } |
185 | 185 | } |
186 | - foreach ( $array as $key => $value ) { |
|
186 | + foreach ($array as $key => $value) { |
|
187 | 187 | if (method_exists($this, $key)) { |
188 | 188 | try { |
189 | 189 | $this->$key($value); |
190 | 190 | unset($array [$key]); |
191 | - } catch ( \Exception $e ) { |
|
191 | + } catch (\Exception $e) { |
|
192 | 192 | // Nothing to do |
193 | 193 | } |
194 | - } else { |
|
194 | + }else { |
|
195 | 195 | $setter="set".ucfirst($key); |
196 | 196 | if (method_exists($this, $setter)) { |
197 | 197 | try { |
198 | 198 | $this->$setter($value); |
199 | 199 | unset($array [$key]); |
200 | - } catch ( \Exception $e ) { |
|
200 | + } catch (\Exception $e) { |
|
201 | 201 | // Nothing to do |
202 | 202 | } |
203 | 203 | } |
@@ -206,21 +206,21 @@ discard block |
||
206 | 206 | return $array; |
207 | 207 | } |
208 | 208 | |
209 | - public function fromDatabaseObjects($objects,$function) { |
|
210 | - if(isset($objects)){ |
|
211 | - foreach ($objects as $object){ |
|
212 | - $this->fromDatabaseObject($object,$function); |
|
209 | + public function fromDatabaseObjects($objects, $function) { |
|
210 | + if (isset($objects)) { |
|
211 | + foreach ($objects as $object) { |
|
212 | + $this->fromDatabaseObject($object, $function); |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 | return $this; |
216 | 216 | } |
217 | 217 | |
218 | - public function fromDatabaseObject($object,$function){ |
|
218 | + public function fromDatabaseObject($object, $function) { |
|
219 | 219 | |
220 | 220 | } |
221 | 221 | |
222 | 222 | public function wrap($before, $after="") { |
223 | - if(isset($before)){ |
|
223 | + if (isset($before)) { |
|
224 | 224 | $this->wrapBefore.=$before; |
225 | 225 | } |
226 | 226 | $this->wrapAfter=$after.$this->wrapAfter; |
@@ -242,13 +242,13 @@ discard block |
||
242 | 242 | if (array_key_exists($event, $this->events)) { |
243 | 243 | if (is_array($this->events [$event])) { |
244 | 244 | $this->events [$event] []=$jsCode; |
245 | - } else { |
|
246 | - $this->events [$event]=array ( |
|
245 | + }else { |
|
246 | + $this->events [$event]=array( |
|
247 | 247 | $this->events [$event], |
248 | 248 | $jsCode |
249 | 249 | ); |
250 | 250 | } |
251 | - } else { |
|
251 | + }else { |
|
252 | 252 | $this->events [$event]=$jsCode; |
253 | 253 | } |
254 | 254 | } |
@@ -267,14 +267,14 @@ discard block |
||
267 | 267 | |
268 | 268 | public function addEventsOnRun(JsUtils $js) { |
269 | 269 | if (isset($this->_bsComponent)) { |
270 | - foreach ( $this->events as $event => $jsCode ) { |
|
270 | + foreach ($this->events as $event => $jsCode) { |
|
271 | 271 | $code=$jsCode; |
272 | 272 | if (is_array($jsCode)) { |
273 | 273 | $code=""; |
274 | - foreach ( $jsCode as $jsC ) { |
|
274 | + foreach ($jsCode as $jsC) { |
|
275 | 275 | if ($jsC instanceof AjaxCall) { |
276 | 276 | $code.="\n".$jsC->compile($js); |
277 | - } else { |
|
277 | + }else { |
|
278 | 278 | $code.="\n".$jsC; |
279 | 279 | } |
280 | 280 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | } |
289 | 289 | |
290 | 290 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
291 | - $params=array ( |
|
291 | + $params=array( |
|
292 | 292 | "url" => $url, |
293 | 293 | "responseElement" => $responseElement |
294 | 294 | ); |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | if (is_array($elements)) { |
328 | 328 | $flag=false; |
329 | 329 | $index=0; |
330 | - while ( !$flag&&$index<sizeof($elements) ) { |
|
330 | + while (!$flag && $index<sizeof($elements)) { |
|
331 | 331 | if ($elements [$index] instanceof BaseHtml) |
332 | 332 | $flag=($elements [$index]->getIdentifier()===$identifier); |
333 | 333 | $index++; |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | return null; |
342 | 342 | } |
343 | 343 | |
344 | - public function __toString(){ |
|
344 | + public function __toString() { |
|
345 | 345 | return $this->compile(); |
346 | 346 | } |
347 | 347 | |
@@ -357,25 +357,25 @@ discard block |
||
357 | 357 | if (is_array($value)) { |
358 | 358 | $value=implode(",", $value); |
359 | 359 | } |
360 | - if (strrpos($value, 'this')===false&&strrpos($value, 'event')===false) { |
|
360 | + if (strrpos($value, 'this')===false && strrpos($value, 'event')===false) { |
|
361 | 361 | $value='"'.$value.'"'; |
362 | 362 | } |
363 | 363 | return $value; |
364 | 364 | } |
365 | 365 | |
366 | - public function jsDoJquery($jqueryCall, $param=""){ |
|
366 | + public function jsDoJquery($jqueryCall, $param="") { |
|
367 | 367 | return "$('#".$this->identifier."').".$jqueryCall."(".$this->_prep_value($param).");"; |
368 | 368 | } |
369 | 369 | |
370 | - public function jsHtml($content=""){ |
|
371 | - return $this->jsDoJquery("html",$content); |
|
370 | + public function jsHtml($content="") { |
|
371 | + return $this->jsDoJquery("html", $content); |
|
372 | 372 | } |
373 | 373 | |
374 | - public function jsShow(){ |
|
374 | + public function jsShow() { |
|
375 | 375 | return $this->jsDoJquery("show"); |
376 | 376 | } |
377 | 377 | |
378 | - public function jsHide(){ |
|
378 | + public function jsHide() { |
|
379 | 379 | return $this->jsDoJquery("hide"); |
380 | 380 | } |
381 | 381 | } |
382 | 382 | \ No newline at end of file |
@@ -15,22 +15,22 @@ discard block |
||
15 | 15 | class HtmlGridCol extends HtmlDoubleElement { |
16 | 16 | private $positions; |
17 | 17 | private $offsets; |
18 | - public function __construct($identifier,$size=CssSize::SIZE_MD,$width=1){ |
|
19 | - parent::__construct($identifier,"div"); |
|
18 | + public function __construct($identifier, $size=CssSize::SIZE_MD, $width=1) { |
|
19 | + parent::__construct($identifier, "div"); |
|
20 | 20 | $this->positions=array(); |
21 | 21 | $this->offsets=array(); |
22 | - $this->addPosition($size,$width); |
|
22 | + $this->addPosition($size, $width); |
|
23 | 23 | } |
24 | - public function addPosition($size=CssSize::SIZE_MD,$width=1){ |
|
24 | + public function addPosition($size=CssSize::SIZE_MD, $width=1) { |
|
25 | 25 | $this->positions[$size]=$width; |
26 | 26 | return $this; |
27 | 27 | } |
28 | - private function _generateClass(){ |
|
28 | + private function _generateClass() { |
|
29 | 29 | $result=array(); |
30 | - foreach ($this->positions as $size=>$width){ |
|
30 | + foreach ($this->positions as $size=>$width) { |
|
31 | 31 | $result[]="col-".$size."-".$width; |
32 | 32 | } |
33 | - foreach ($this->offsets as $size=>$offset){ |
|
33 | + foreach ($this->offsets as $size=>$offset) { |
|
34 | 34 | $result[]="col-".$size."-offset-".$offset; |
35 | 35 | } |
36 | 36 | return implode(" ", $result); |
@@ -38,54 +38,54 @@ discard block |
||
38 | 38 | |
39 | 39 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
40 | 40 | $this->setProperty("class", $this->_generateClass()); |
41 | - return parent::compile($js,$view); |
|
41 | + return parent::compile($js, $view); |
|
42 | 42 | } |
43 | 43 | |
44 | - public function setOffset($size,$offset){ |
|
44 | + public function setOffset($size, $offset) { |
|
45 | 45 | $this->offsets[$size]=$offset; |
46 | 46 | return $this; |
47 | 47 | } |
48 | 48 | |
49 | - public function setOffsetForAll($newOffset){ |
|
50 | - foreach ($this->offsets as &$value){ |
|
49 | + public function setOffsetForAll($newOffset) { |
|
50 | + foreach ($this->offsets as &$value) { |
|
51 | 51 | $value=$newOffset; |
52 | 52 | } |
53 | 53 | unset($value); |
54 | 54 | return $this; |
55 | 55 | } |
56 | 56 | |
57 | - public function setWidthForAll($newWidth){ |
|
58 | - foreach ($this->positions as &$pos){ |
|
57 | + public function setWidthForAll($newWidth) { |
|
58 | + foreach ($this->positions as &$pos) { |
|
59 | 59 | $pos=$newWidth; |
60 | 60 | } |
61 | 61 | unset($pos); |
62 | 62 | return $this; |
63 | 63 | } |
64 | 64 | |
65 | - public function setPosition($size=CssSize::SIZE_MD,$width=1){ |
|
66 | - return $this->addPosition($size,$width); |
|
65 | + public function setPosition($size=CssSize::SIZE_MD, $width=1) { |
|
66 | + return $this->addPosition($size, $width); |
|
67 | 67 | } |
68 | 68 | |
69 | - public function getPosition($size){ |
|
69 | + public function getPosition($size) { |
|
70 | 70 | return @$this->positions[$size]; |
71 | 71 | } |
72 | 72 | |
73 | - public function addClear(){ |
|
74 | - $this->wrap("","<div class='clearfix'></div>"); |
|
73 | + public function addClear() { |
|
74 | + $this->wrap("", "<div class='clearfix'></div>"); |
|
75 | 75 | } |
76 | 76 | public function setOffsets($offsets) { |
77 | - $this->offsets = $offsets; |
|
77 | + $this->offsets=$offsets; |
|
78 | 78 | return $this; |
79 | 79 | } |
80 | 80 | |
81 | - public function copy($identifier){ |
|
81 | + public function copy($identifier) { |
|
82 | 82 | $result=new HtmlGridCol($identifier); |
83 | 83 | $result->setPositions($this->positions); |
84 | 84 | $result->setOffsets($this->offsets); |
85 | 85 | return $result; |
86 | 86 | } |
87 | 87 | public function setPositions($positions) { |
88 | - $this->positions = $positions; |
|
88 | + $this->positions=$positions; |
|
89 | 89 | return $this; |
90 | 90 | } |
91 | 91 | public function getOffsets() { |