@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | private function addFunction($jsCode) { |
18 | 18 | if (!Text::startsWith($jsCode, "function")) |
19 | - $jsCode="%function(){" . $jsCode . "}%"; |
|
19 | + $jsCode="%function(){".$jsCode."}%"; |
|
20 | 20 | return $jsCode; |
21 | 21 | } |
22 | 22 | |
@@ -43,6 +43,6 @@ discard block |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | public static function submitButton(JsUtils $js, $url, $form, $responseElement, $caption="Okay") { |
46 | - return new DialogButton($caption, $js->postForm($url, $form, $responseElement) . ";$( this ).dialog( 'close' );"); |
|
46 | + return new DialogButton($caption, $js->postForm($url, $form, $responseElement).";$( this ).dialog( 'close' );"); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | \ No newline at end of file |
@@ -15,8 +15,9 @@ |
||
15 | 15 | class DialogButton extends BaseComponent { |
16 | 16 | |
17 | 17 | private function addFunction($jsCode) { |
18 | - if (!Text::startsWith($jsCode, "function")) |
|
19 | - $jsCode="%function(){" . $jsCode . "}%"; |
|
18 | + if (!Text::startsWith($jsCode, "function")) { |
|
19 | + $jsCode="%function(){" . $jsCode . "}%"; |
|
20 | + } |
|
20 | 21 | return $jsCode; |
21 | 22 | } |
22 | 23 |
@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | public function __construct(JsUtils $js) { |
16 | 16 | parent::__construct($js); |
17 | - $this->params=array ( |
|
17 | + $this->params=array( |
|
18 | 18 | "value" => 50 |
19 | 19 | ); |
20 | 20 | $this->uiName="progressbar"; |
@@ -30,7 +30,7 @@ |
||
30 | 30 | * @param string $value default : swing |
31 | 31 | */ |
32 | 32 | public function setEasing($value) { |
33 | - $this->setParamCtrl("easing", $value, array ( |
|
33 | + $this->setParamCtrl("easing", $value, array( |
|
34 | 34 | "linear", |
35 | 35 | "swing", |
36 | 36 | "easeInQuad", |
@@ -74,7 +74,7 @@ |
||
74 | 74 | protected function setParamCtrl($key, $value, $typeCtrl) { |
75 | 75 | if (!$typeCtrl($value)) { |
76 | 76 | throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key." à la position"); |
77 | - } else |
|
77 | + }else |
|
78 | 78 | $this->setParam($key, $value); |
79 | 79 | } |
80 | 80 |
@@ -74,8 +74,9 @@ |
||
74 | 74 | protected function setParamCtrl($key, $value, $typeCtrl) { |
75 | 75 | if (!$typeCtrl($value)) { |
76 | 76 | throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key." à la position"); |
77 | - } else |
|
78 | - $this->setParam($key, $value); |
|
77 | + } else { |
|
78 | + $this->setParam($key, $value); |
|
79 | + } |
|
79 | 80 | } |
80 | 81 | |
81 | 82 | /* |
@@ -20,6 +20,10 @@ discard block |
||
20 | 20 | protected $attr; |
21 | 21 | |
22 | 22 | |
23 | + /** |
|
24 | + * @param string $identifier |
|
25 | + * @param string $tagName |
|
26 | + */ |
|
23 | 27 | public function __construct($identifier,$tagName){ |
24 | 28 | parent::__construct($identifier,$tagName); |
25 | 29 | $this->root=""; |
@@ -30,7 +34,6 @@ discard block |
||
30 | 34 | * Associate an ajax get to the elements, displayed in $targetSelector |
31 | 35 | * $attr member is used to build each element url |
32 | 36 | * @param string $targetSelector the target of the get |
33 | - * @param string $attr the html attribute used to build the elements url |
|
34 | 37 | * @return HtmlNavElement |
35 | 38 | */ |
36 | 39 | public function autoGetOnClick($targetSelector){ |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | protected $attr; |
20 | 20 | |
21 | 21 | |
22 | - public function __construct($identifier,$tagName){ |
|
23 | - parent::__construct($identifier,$tagName); |
|
22 | + public function __construct($identifier, $tagName) { |
|
23 | + parent::__construct($identifier, $tagName); |
|
24 | 24 | $this->root=""; |
25 | 25 | $this->attr="data-ajax"; |
26 | 26 | } |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | * @param string $attr the html attribute used to build the elements url |
33 | 33 | * @return HtmlNavElement |
34 | 34 | */ |
35 | - public function autoGetOnClick($targetSelector){ |
|
36 | - return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
|
35 | + public function autoGetOnClick($targetSelector) { |
|
36 | + return $this->getOnClick($this->root, $targetSelector, array("attr"=>$this->attr)); |
|
37 | 37 | } |
38 | 38 | |
39 | - public function contentAsString(){ |
|
39 | + public function contentAsString() { |
|
40 | 40 | return implode("", $this->content); |
41 | 41 | } |
42 | 42 | |
@@ -44,15 +44,15 @@ discard block |
||
44 | 44 | * Generate the jquery script to set the elements to the HtmlNavElement |
45 | 45 | * @param JsUtils $jsUtils |
46 | 46 | */ |
47 | - public function jsSetContent(JsUtils $jsUtils){ |
|
48 | - $jsUtils->html("#".$this->identifier,str_replace("\"","'", $this->contentAsString()),true); |
|
47 | + public function jsSetContent(JsUtils $jsUtils) { |
|
48 | + $jsUtils->html("#".$this->identifier, str_replace("\"", "'", $this->contentAsString()), true); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | public function getRoot() { |
52 | 52 | return $this->root; |
53 | 53 | } |
54 | 54 | public function setRoot($root) { |
55 | - $this->root = $root; |
|
55 | + $this->root=$root; |
|
56 | 56 | return $this; |
57 | 57 | } |
58 | 58 | public function getAttr() { |
@@ -65,12 +65,12 @@ discard block |
||
65 | 65 | * @return HtmlNavElement |
66 | 66 | */ |
67 | 67 | public function setAttr($attr) { |
68 | - $this->attr = $attr; |
|
68 | + $this->attr=$attr; |
|
69 | 69 | return $this; |
70 | 70 | } |
71 | 71 | |
72 | 72 | public function __call($method, $args) { |
73 | - if(isset($this->$method) && is_callable($this->$method)) { |
|
73 | + if (isset($this->$method) && is_callable($this->$method)) { |
|
74 | 74 | return call_user_func_array( |
75 | 75 | $this->$method, |
76 | 76 | $args |
@@ -78,6 +78,6 @@ discard block |
||
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
81 | - public abstract function fromDispatcher($dispatcher,$startIndex=0); |
|
81 | + public abstract function fromDispatcher($dispatcher, $startIndex=0); |
|
82 | 82 | |
83 | 83 | } |
84 | 84 | \ No newline at end of file |
@@ -149,7 +149,7 @@ |
||
149 | 149 | $glyph->setGlyphicon($glyphicon); |
150 | 150 | if ($left) { |
151 | 151 | $this->content=$glyph->compile().$separator.$this->content; |
152 | - } else { |
|
152 | + }else { |
|
153 | 153 | $this->content.=$separator.$glyph->compile(); |
154 | 154 | } |
155 | 155 | return $this; |
@@ -52,10 +52,11 @@ discard block |
||
52 | 52 | $this->from=$from; |
53 | 53 | $this->to=$to; |
54 | 54 | $this->urlMask="%page%"; |
55 | - if(!isset($countVisible)) |
|
56 | - $this->countVisible=$to-$from+1; |
|
57 | - else |
|
58 | - $this->countVisible=$countVisible; |
|
55 | + if(!isset($countVisible)) { |
|
56 | + $this->countVisible=$to-$from+1; |
|
57 | + } else { |
|
58 | + $this->countVisible=$countVisible; |
|
59 | + } |
|
59 | 60 | $this->createContent(); |
60 | 61 | } |
61 | 62 | |
@@ -74,7 +75,7 @@ discard block |
||
74 | 75 | $href=new HtmlLink("a-".$this->identifier."-".$count,$url,$content); |
75 | 76 | $href->setProperty($this->attr, $url); |
76 | 77 | $elem->setContent($href); |
77 | - }else{ |
|
78 | + } else{ |
|
78 | 79 | $elem->setContent($content); |
79 | 80 | } |
80 | 81 | $this->content[]=$elem; |
@@ -107,8 +108,9 @@ discard block |
||
107 | 108 | public function _addEvent($event, $jsCode) { |
108 | 109 | foreach ($this->content as $li){ |
109 | 110 | $content=$li->getContent(); |
110 | - if($content instanceof BaseHtml) |
|
111 | - $content->_addEvent($event,$jsCode); |
|
111 | + if($content instanceof BaseHtml) { |
|
112 | + $content->_addEvent($event,$jsCode); |
|
113 | + } |
|
112 | 114 | } |
113 | 115 | } |
114 | 116 | /** |
@@ -146,8 +148,9 @@ discard block |
||
146 | 148 | if (is_int($size)) { |
147 | 149 | return $this->addToPropertyUnique("class", CssRef::sizes("pagination")[$size], CssRef::sizes("pagination")); |
148 | 150 | } |
149 | - if(!PhalconUtils::startsWith($size, "pagination-") && $size!=="") |
|
150 | - $size="pagination-".$size; |
|
151 | + if(!PhalconUtils::startsWith($size, "pagination-") && $size!=="") { |
|
152 | + $size="pagination-".$size; |
|
153 | + } |
|
151 | 154 | return $this->addToPropertyCtrl("class", $size, CssRef::sizes("pagination")); |
152 | 155 | } |
153 | 156 |
@@ -44,70 +44,70 @@ discard block |
||
44 | 44 | /** |
45 | 45 | * @param string $identifier |
46 | 46 | */ |
47 | - public function __construct($identifier,$from=1,$to=1,$active=NULL,$countVisible=NULL){ |
|
48 | - parent::__construct($identifier,"ul"); |
|
47 | + public function __construct($identifier, $from=1, $to=1, $active=NULL, $countVisible=NULL) { |
|
48 | + parent::__construct($identifier, "ul"); |
|
49 | 49 | $this->setProperty("class", "pagination"); |
50 | 50 | $this->active=$active; |
51 | 51 | $this->from=$from; |
52 | 52 | $this->to=$to; |
53 | 53 | $this->urlMask="%page%"; |
54 | - if(!isset($countVisible)) |
|
54 | + if (!isset($countVisible)) |
|
55 | 55 | $this->countVisible=$to-$from+1; |
56 | 56 | else |
57 | 57 | $this->countVisible=$countVisible; |
58 | 58 | $this->createContent(); |
59 | 59 | } |
60 | 60 | |
61 | - private function createElement($num,$content,$disabled=false,$current=false){ |
|
61 | + private function createElement($num, $content, $disabled=false, $current=false) { |
|
62 | 62 | $count=sizeof($this->content)+1; |
63 | - $elem=new HtmlBsDoubleElement("li-".$this->identifier."-".$count,"li"); |
|
64 | - if($disabled){ |
|
63 | + $elem=new HtmlBsDoubleElement("li-".$this->identifier."-".$count, "li"); |
|
64 | + if ($disabled) { |
|
65 | 65 | $elem->setProperty("class", "disabled"); |
66 | 66 | } |
67 | - if($current){ |
|
67 | + if ($current) { |
|
68 | 68 | $content.="<span class='sr-only'>(current)</span>"; |
69 | 69 | $elem->setProperty("class", "active"); |
70 | 70 | } |
71 | - if(!$disabled){ |
|
71 | + if (!$disabled) { |
|
72 | 72 | $url=$this->getUrl($num); |
73 | - $href=new HtmlLink("a-".$this->identifier."-".$count,$url,$content); |
|
73 | + $href=new HtmlLink("a-".$this->identifier."-".$count, $url, $content); |
|
74 | 74 | $href->setProperty($this->attr, $url); |
75 | 75 | $elem->setContent($href); |
76 | - }else{ |
|
76 | + }else { |
|
77 | 77 | $elem->setContent($content); |
78 | 78 | } |
79 | 79 | $this->content[]=$elem; |
80 | 80 | return $this; |
81 | 81 | } |
82 | 82 | |
83 | - protected function createContent(){ |
|
83 | + protected function createContent() { |
|
84 | 84 | $this->content=array(); |
85 | - $this->createElement($this->active-1,"<span aria-hidden='true'>«</span>",$this->active===1); |
|
85 | + $this->createElement($this->active-1, "<span aria-hidden='true'>«</span>", $this->active===1); |
|
86 | 86 | $start=$this->getStart(); |
87 | - $end=min($start+$this->countVisible-1,$this->to); |
|
88 | - for($index=$start;$index<=$end;$index++){ |
|
89 | - $this->createElement($index,$index,false,$index===$this->active); |
|
87 | + $end=min($start+$this->countVisible-1, $this->to); |
|
88 | + for ($index=$start; $index<=$end; $index++) { |
|
89 | + $this->createElement($index, $index, false, $index===$this->active); |
|
90 | 90 | } |
91 | - $this->createElement($this->active+1,"<span aria-hidden='true'>»</span>",$this->active===$this->to); |
|
91 | + $this->createElement($this->active+1, "<span aria-hidden='true'>»</span>", $this->active===$this->to); |
|
92 | 92 | } |
93 | 93 | |
94 | - protected function half(){ |
|
95 | - return (int)($this->countVisible/2); |
|
94 | + protected function half() { |
|
95 | + return (int) ($this->countVisible / 2); |
|
96 | 96 | } |
97 | 97 | |
98 | - protected function getStart(){ |
|
98 | + protected function getStart() { |
|
99 | 99 | $result=1; |
100 | - if($this->countVisible!==$this->to-$this->from+1){ |
|
101 | - $result=max($this->active-$this->half(),$result); |
|
100 | + if ($this->countVisible!==$this->to-$this->from+1) { |
|
101 | + $result=max($this->active-$this->half(), $result); |
|
102 | 102 | } |
103 | 103 | return $result; |
104 | 104 | } |
105 | 105 | |
106 | 106 | public function _addEvent($event, $jsCode) { |
107 | - foreach ($this->content as $li){ |
|
107 | + foreach ($this->content as $li) { |
|
108 | 108 | $content=$li->getContent(); |
109 | - if($content instanceof BaseHtml) |
|
110 | - $content->_addEvent($event,$jsCode); |
|
109 | + if ($content instanceof BaseHtml) |
|
110 | + $content->_addEvent($event, $jsCode); |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | /** |
@@ -115,15 +115,15 @@ discard block |
||
115 | 115 | * @param Dispatcher $dispatcher the request dispatcher |
116 | 116 | * @return \Ajax\bootstrap\html\HtmlPagination |
117 | 117 | */ |
118 | - public function fromDispatcher($dispatcher,$startIndex=0){ |
|
119 | - $items=array($dispatcher->getControllerName(),$dispatcher->getActionName()); |
|
120 | - $items=array_merge($items,$dispatcher->getParams()); |
|
118 | + public function fromDispatcher($dispatcher, $startIndex=0) { |
|
119 | + $items=array($dispatcher->getControllerName(), $dispatcher->getActionName()); |
|
120 | + $items=array_merge($items, $dispatcher->getParams()); |
|
121 | 121 | $url=implode("/", $items); |
122 | - if($this->urlMask==="%page%"){ |
|
122 | + if ($this->urlMask==="%page%") { |
|
123 | 123 | $this->urlMask=preg_replace("/[0-9]/", "%page%", $url); |
124 | 124 | } |
125 | - for($index=$this->from;$index<=$this->to;$index++){ |
|
126 | - if($this->getUrl($index)==$url){ |
|
125 | + for ($index=$this->from; $index<=$this->to; $index++) { |
|
126 | + if ($this->getUrl($index)==$url) { |
|
127 | 127 | $this->setActive($index); |
128 | 128 | break; |
129 | 129 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | return $this; |
132 | 132 | } |
133 | 133 | |
134 | - public function getUrl($index){ |
|
134 | + public function getUrl($index) { |
|
135 | 135 | return str_ireplace("%page%", $index, $this->urlMask); |
136 | 136 | } |
137 | 137 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | if (is_int($size)) { |
146 | 146 | return $this->addToPropertyUnique("class", CssRef::sizes("pagination")[$size], CssRef::sizes("pagination")); |
147 | 147 | } |
148 | - if(!PhalconUtils::startsWith($size, "pagination-") && $size!=="") |
|
148 | + if (!PhalconUtils::startsWith($size, "pagination-") && $size!=="") |
|
149 | 149 | $size="pagination-".$size; |
150 | 150 | return $this->addToPropertyCtrl("class", $size, CssRef::sizes("pagination")); |
151 | 151 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | return $this->from; |
155 | 155 | } |
156 | 156 | public function setFrom($from) { |
157 | - $this->from = $from; |
|
157 | + $this->from=$from; |
|
158 | 158 | $this->createContent(); |
159 | 159 | return $this; |
160 | 160 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | return $this->to; |
163 | 163 | } |
164 | 164 | public function setTo($to) { |
165 | - $this->to = $to; |
|
165 | + $this->to=$to; |
|
166 | 166 | $this->createContent(); |
167 | 167 | return $this; |
168 | 168 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | return $this->active; |
171 | 171 | } |
172 | 172 | public function setActive($active) { |
173 | - $this->active = $active; |
|
173 | + $this->active=$active; |
|
174 | 174 | $this->createContent(); |
175 | 175 | return $this; |
176 | 176 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | return $this->urlMask; |
179 | 179 | } |
180 | 180 | public function setUrlMask($urlMask) { |
181 | - $this->urlMask = $urlMask; |
|
181 | + $this->urlMask=$urlMask; |
|
182 | 182 | $this->createContent(); |
183 | 183 | return $this; |
184 | 184 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | return $this->countVisible; |
187 | 187 | } |
188 | 188 | public function setCountVisible($countVisible) { |
189 | - $this->countVisible = $countVisible; |
|
189 | + $this->countVisible=$countVisible; |
|
190 | 190 | $this->createContent(); |
191 | 191 | return $this; |
192 | 192 | } |
@@ -14,6 +14,11 @@ discard block |
||
14 | 14 | */ |
15 | 15 | class HtmlGridRow extends HtmlDoubleElement { |
16 | 16 | private $cols; |
17 | + |
|
18 | + /** |
|
19 | + * @param string $identifier |
|
20 | + * @param integer $numCols |
|
21 | + */ |
|
17 | 22 | public function __construct($identifier,$numCols=NULL){ |
18 | 23 | parent::__construct($identifier,"div"); |
19 | 24 | $this->setProperty("class", "row"); |
@@ -85,6 +90,11 @@ discard block |
||
85 | 90 | $this->delete($size,$start+1, $width); |
86 | 91 | } |
87 | 92 | } |
93 | + |
|
94 | + /** |
|
95 | + * @param integer $start |
|
96 | + * @param integer $width |
|
97 | + */ |
|
88 | 98 | public function delete($size=CssSize::SIZE_MD,$start,$width){ |
89 | 99 | while($start<sizeof($this->cols)+1 && $width>0){ |
90 | 100 | $col=$this->getColAt($start,false); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | public function getCol($index,$force=true){ |
43 | 43 | if($index<sizeof($this->cols)+1){ |
44 | 44 | $result=$this->cols[$index-1]; |
45 | - }else if ($force){ |
|
45 | + } else if ($force){ |
|
46 | 46 | $result=$this->addColAt(CssSize::SIZE_MD,1,$index); |
47 | 47 | } |
48 | 48 | return $result; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $this->cols = array_values($this->cols); |
96 | 96 | $width=$width-$widthCol; |
97 | 97 | } |
98 | - }else{ |
|
98 | + } else{ |
|
99 | 99 | $width=0; |
100 | 100 | } |
101 | 101 | } |
@@ -14,89 +14,89 @@ |
||
14 | 14 | */ |
15 | 15 | class HtmlGridRow extends HtmlBsDoubleElement { |
16 | 16 | private $cols; |
17 | - public function __construct($identifier,$numCols=NULL){ |
|
18 | - parent::__construct($identifier,"div"); |
|
17 | + public function __construct($identifier, $numCols=NULL) { |
|
18 | + parent::__construct($identifier, "div"); |
|
19 | 19 | $this->setProperty("class", "row"); |
20 | 20 | $this->cols=array(); |
21 | - if(isset($numCols)){ |
|
22 | - $numCols=min(12,$numCols); |
|
23 | - $numCols=max(1,$numCols); |
|
24 | - $width=12/$numCols; |
|
25 | - for ($i=0;$i<$numCols;$i++){ |
|
26 | - $this->addCol(CssSize::SIZE_MD,$width); |
|
21 | + if (isset($numCols)) { |
|
22 | + $numCols=min(12, $numCols); |
|
23 | + $numCols=max(1, $numCols); |
|
24 | + $width=12 / $numCols; |
|
25 | + for ($i=0; $i<$numCols; $i++) { |
|
26 | + $this->addCol(CssSize::SIZE_MD, $width); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | - public function addCol($size=CssSize::SIZE_MD,$width=1){ |
|
32 | - $col=new HtmlGridCol($this->identifier."-col-".(sizeof($this->cols)+1),$size,$width); |
|
31 | + public function addCol($size=CssSize::SIZE_MD, $width=1) { |
|
32 | + $col=new HtmlGridCol($this->identifier."-col-".(sizeof($this->cols)+1), $size, $width); |
|
33 | 33 | $this->cols[]=$col; |
34 | 34 | return $col; |
35 | 35 | } |
36 | 36 | |
37 | - public function addColAt($size=CssSize::SIZE_MD,$width=1,$offset=1){ |
|
38 | - $col=$this->addCol($size,$width); |
|
39 | - return $col->setOffset($size, max($offset,sizeof($this->cols)+1)); |
|
37 | + public function addColAt($size=CssSize::SIZE_MD, $width=1, $offset=1) { |
|
38 | + $col=$this->addCol($size, $width); |
|
39 | + return $col->setOffset($size, max($offset, sizeof($this->cols)+1)); |
|
40 | 40 | } |
41 | 41 | |
42 | - public function getCol($index,$force=true){ |
|
42 | + public function getCol($index, $force=true) { |
|
43 | 43 | $result=null; |
44 | - if($index<sizeof($this->cols)+1){ |
|
44 | + if ($index<sizeof($this->cols)+1) { |
|
45 | 45 | $result=$this->cols[$index-1]; |
46 | - }else if ($force){ |
|
47 | - $result=$this->addColAt(CssSize::SIZE_MD,1,$index); |
|
46 | + }else if ($force) { |
|
47 | + $result=$this->addColAt(CssSize::SIZE_MD, 1, $index); |
|
48 | 48 | } |
49 | 49 | return $result; |
50 | 50 | } |
51 | 51 | |
52 | - public function getColAt($offset,$force=true){ |
|
52 | + public function getColAt($offset, $force=true) { |
|
53 | 53 | $result=null; |
54 | - foreach ($this->cols as $col){ |
|
54 | + foreach ($this->cols as $col) { |
|
55 | 55 | $offsets=$col->getOffsets(); |
56 | - if($result=array_search($offset, $offsets)){ |
|
56 | + if ($result=array_search($offset, $offsets)) { |
|
57 | 57 | break; |
58 | 58 | } |
59 | 59 | } |
60 | - if(!$result || isset($result)==false){ |
|
61 | - $result=$this->getCol($offset,$force); |
|
60 | + if (!$result || isset($result)==false) { |
|
61 | + $result=$this->getCol($offset, $force); |
|
62 | 62 | } |
63 | 63 | return $result; |
64 | 64 | } |
65 | 65 | |
66 | 66 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
67 | 67 | |
68 | - foreach ($this->cols as $col){ |
|
68 | + foreach ($this->cols as $col) { |
|
69 | 69 | $this->addContent($col); |
70 | 70 | } |
71 | - return parent::compile($js,$view); |
|
71 | + return parent::compile($js, $view); |
|
72 | 72 | } |
73 | 73 | public function getCols() { |
74 | 74 | return $this->cols; |
75 | 75 | } |
76 | 76 | |
77 | - public function setContentForAll($content){ |
|
78 | - foreach ($this->cols as $col){ |
|
77 | + public function setContentForAll($content) { |
|
78 | + foreach ($this->cols as $col) { |
|
79 | 79 | $col->setContent($content); |
80 | 80 | } |
81 | 81 | } |
82 | - public function merge($size=CssSize::SIZE_MD,$start,$width){ |
|
83 | - $col=$this->getColAt($start,false); |
|
84 | - if(isset($col)){ |
|
85 | - $col->setWidth($size,$width+1); |
|
86 | - $this->delete($size,$start+1, $width); |
|
82 | + public function merge($size=CssSize::SIZE_MD, $start, $width) { |
|
83 | + $col=$this->getColAt($start, false); |
|
84 | + if (isset($col)) { |
|
85 | + $col->setWidth($size, $width+1); |
|
86 | + $this->delete($size, $start+1, $width); |
|
87 | 87 | } |
88 | 88 | } |
89 | - public function delete($size=CssSize::SIZE_MD,$start,$width){ |
|
90 | - while($start<sizeof($this->cols)+1 && $width>0){ |
|
91 | - $col=$this->getColAt($start,false); |
|
92 | - if(isset($col)){ |
|
89 | + public function delete($size=CssSize::SIZE_MD, $start, $width) { |
|
90 | + while ($start<sizeof($this->cols)+1 && $width>0) { |
|
91 | + $col=$this->getColAt($start, false); |
|
92 | + if (isset($col)) { |
|
93 | 93 | $widthCol=$col->getWidth($size); |
94 | - if($widthCol<=$width){ |
|
94 | + if ($widthCol<=$width) { |
|
95 | 95 | unset($this->cols[$start-1]); |
96 | - $this->cols = array_values($this->cols); |
|
96 | + $this->cols=array_values($this->cols); |
|
97 | 97 | $width=$width-$widthCol; |
98 | 98 | } |
99 | - }else{ |
|
99 | + }else { |
|
100 | 100 | $width=0; |
101 | 101 | } |
102 | 102 | } |
@@ -16,6 +16,10 @@ |
||
16 | 16 | class HtmlGridSystem extends HtmlDoubleElement { |
17 | 17 | private $rows; |
18 | 18 | |
19 | + /** |
|
20 | + * @param string $identifier |
|
21 | + * @param integer $numCols |
|
22 | + */ |
|
19 | 23 | public function __construct($identifier,$numRows=1,$numCols=NULL){ |
20 | 24 | parent::__construct($identifier,"div"); |
21 | 25 | $this->setProperty("class", "container-fluid"); |
@@ -16,11 +16,11 @@ discard block |
||
16 | 16 | class HtmlGridSystem extends HtmlDoubleElement { |
17 | 17 | private $rows; |
18 | 18 | |
19 | - public function __construct($identifier,$numRows=1,$numCols=NULL){ |
|
20 | - parent::__construct($identifier,"div"); |
|
19 | + public function __construct($identifier, $numRows=1, $numCols=NULL) { |
|
20 | + parent::__construct($identifier, "div"); |
|
21 | 21 | $this->setProperty("class", "container-fluid"); |
22 | 22 | $this->rows=array(); |
23 | - $this->setNumRows($numRows,$numCols); |
|
23 | + $this->setNumRows($numRows, $numCols); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | * @param int $numCols |
29 | 29 | * @return \Ajax\bootstrap\html\content\HtmlGridRow |
30 | 30 | */ |
31 | - public function addRow($numCols=NULL){ |
|
32 | - $row=new HtmlGridRow($this->identifier."-row-".(sizeof($this->rows)+1),$numCols); |
|
31 | + public function addRow($numCols=NULL) { |
|
32 | + $row=new HtmlGridRow($this->identifier."-row-".(sizeof($this->rows)+1), $numCols); |
|
33 | 33 | $this->rows[]=$row; |
34 | 34 | return $row; |
35 | 35 | } |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | * @param boolean $force add the row at $index if true |
41 | 41 | * @return \Ajax\bootstrap\html\content\HtmlGridRow |
42 | 42 | */ |
43 | - public function getRow($index,$force=true){ |
|
44 | - if($index<sizeof($this->rows)){ |
|
43 | + public function getRow($index, $force=true) { |
|
44 | + if ($index<sizeof($this->rows)) { |
|
45 | 45 | $result=$this->rows[$index-1]; |
46 | - }else if ($force){ |
|
46 | + }else if ($force) { |
|
47 | 47 | $this->setNumRows($index); |
48 | 48 | $result=$this->rows[$index-1]; |
49 | 49 | } |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | * @param int $numCols |
57 | 57 | * @return \Ajax\bootstrap\html\HtmlGridSystem |
58 | 58 | */ |
59 | - public function setNumRows($numRows,$numCols=NULL){ |
|
60 | - for($i=sizeof($this->rows);$i<$numRows;$i++){ |
|
59 | + public function setNumRows($numRows, $numCols=NULL) { |
|
60 | + for ($i=sizeof($this->rows); $i<$numRows; $i++) { |
|
61 | 61 | $this->addRow($numCols); |
62 | 62 | } |
63 | 63 | return $this; |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | * @param $force add the cell at $row,$col if true |
70 | 70 | * @return HtmlGridCol |
71 | 71 | */ |
72 | - public function getCell($row,$col,$force=true){ |
|
73 | - $row=$this->getRow($row,$force); |
|
74 | - if(isset($row)){ |
|
75 | - $col=$row->getCol($col,$force); |
|
72 | + public function getCell($row, $col, $force=true) { |
|
73 | + $row=$this->getRow($row, $force); |
|
74 | + if (isset($row)) { |
|
75 | + $col=$row->getCol($col, $force); |
|
76 | 76 | } |
77 | 77 | return $col; |
78 | 78 | } |
@@ -82,22 +82,22 @@ discard block |
||
82 | 82 | * @param int $col |
83 | 83 | * @return HtmlGridCol |
84 | 84 | */ |
85 | - public function getCellAt($row,$col,$force=true){ |
|
86 | - $row=$this->getRow($row,$force); |
|
87 | - if(isset($row)){ |
|
88 | - $col=$row->getColAt($col,$force); |
|
85 | + public function getCellAt($row, $col, $force=true) { |
|
86 | + $row=$this->getRow($row, $force); |
|
87 | + if (isset($row)) { |
|
88 | + $col=$row->getColAt($col, $force); |
|
89 | 89 | } |
90 | 90 | return $col; |
91 | 91 | } |
92 | 92 | |
93 | 93 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
94 | - foreach ($this->rows as $row){ |
|
94 | + foreach ($this->rows as $row) { |
|
95 | 95 | $this->addContent($row); |
96 | 96 | } |
97 | - return parent::compile($js,$view); |
|
97 | + return parent::compile($js, $view); |
|
98 | 98 | } |
99 | - public function setContentForAll($content){ |
|
100 | - foreach ($this->rows as $row){ |
|
99 | + public function setContentForAll($content) { |
|
100 | + foreach ($this->rows as $row) { |
|
101 | 101 | $row->setContentForAll($content); |
102 | 102 | } |
103 | 103 | } |
@@ -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 | } |