@@ -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 |
@@ -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 |
@@ -35,14 +35,14 @@ discard block |
||
35 | 35 | * @param boolean $autoActive sets the last element's class to <b>active</b> if true |
36 | 36 | * @param function $hrefFunction the function who generates the href elements. default : function($e){return $e->getContent()} |
37 | 37 | */ |
38 | - public function __construct($identifier,$elements=array(),$autoActive=true,$hrefFunction=NULL){ |
|
39 | - parent::__construct($identifier,"ol"); |
|
38 | + public function __construct($identifier, $elements=array(), $autoActive=true, $hrefFunction=NULL) { |
|
39 | + parent::__construct($identifier, "ol"); |
|
40 | 40 | $this->setProperty("class", "breadcrumb"); |
41 | 41 | $this->content=array(); |
42 | 42 | $this->autoActive=$autoActive; |
43 | 43 | $this->absolutePaths; |
44 | - $this->_hrefFunction=function ($e){return $e->getContent();}; |
|
45 | - if(isset($hrefFunction)){ |
|
44 | + $this->_hrefFunction=function($e) {return $e->getContent(); }; |
|
45 | + if (isset($hrefFunction)) { |
|
46 | 46 | $this->_hrefFunction=$hrefFunction; |
47 | 47 | } |
48 | 48 | $this->addElements($elements); |
@@ -53,43 +53,43 @@ discard block |
||
53 | 53 | * @param string $href |
54 | 54 | * @return \Ajax\bootstrap\html\HtmlLink |
55 | 55 | */ |
56 | - public function addElement($element,$href="",$glyph=NULL){ |
|
56 | + public function addElement($element, $href="", $glyph=NULL) { |
|
57 | 57 | $size=sizeof($this->content); |
58 | - if(is_array($element)){ |
|
58 | + if (is_array($element)) { |
|
59 | 59 | $elm=new HtmlLink("lnk-".$this->identifier."-".$size); |
60 | 60 | $elm->fromArray($element); |
61 | - }else if($element instanceof HtmlLink){ |
|
61 | + }else if ($element instanceof HtmlLink) { |
|
62 | 62 | $elm=$element; |
63 | - }else{ |
|
64 | - $elm=new HtmlLink("lnk-".$this->identifier."-".$size,$href,$element); |
|
65 | - if(isset($glyph)){ |
|
63 | + }else { |
|
64 | + $elm=new HtmlLink("lnk-".$this->identifier."-".$size, $href, $element); |
|
65 | + if (isset($glyph)) { |
|
66 | 66 | $elm->wrapContentWithGlyph($glyph); |
67 | 67 | } |
68 | 68 | } |
69 | - $elm->wrap("<li>","</li>"); |
|
69 | + $elm->wrap("<li>", "</li>"); |
|
70 | 70 | $this->content[]=$elm; |
71 | 71 | $elm->setProperty($this->attr, $this->getHref($size)); |
72 | 72 | return $elm; |
73 | 73 | } |
74 | 74 | |
75 | - public function setActive($index=null){ |
|
76 | - if(!isset($index)){ |
|
75 | + public function setActive($index=null) { |
|
76 | + if (!isset($index)) { |
|
77 | 77 | $index=sizeof($this->content)-1; |
78 | 78 | } |
79 | - $li=new HtmlDoubleElement("","li"); |
|
79 | + $li=new HtmlDoubleElement("", "li"); |
|
80 | 80 | $li->setClass("active"); |
81 | 81 | $li->setContent($this->content[$index]->getContent()); |
82 | 82 | $this->content[$index]=$li; |
83 | 83 | } |
84 | 84 | |
85 | - public function addElements($elements){ |
|
86 | - foreach ( $elements as $element ) { |
|
85 | + public function addElements($elements) { |
|
86 | + foreach ($elements as $element) { |
|
87 | 87 | $this->addElement($element); |
88 | 88 | } |
89 | 89 | return $this; |
90 | 90 | } |
91 | 91 | |
92 | - public function fromArray($array){ |
|
92 | + public function fromArray($array) { |
|
93 | 93 | $array=parent::fromArray($array); |
94 | 94 | $this->addElements($array); |
95 | 95 | return $array; |
@@ -101,14 +101,14 @@ discard block |
||
101 | 101 | * @param string $separator |
102 | 102 | * @return string |
103 | 103 | */ |
104 | - public function getHref($index=null,$separator="/"){ |
|
105 | - if(!isset($index)){ |
|
104 | + public function getHref($index=null, $separator="/") { |
|
105 | + if (!isset($index)) { |
|
106 | 106 | $index=sizeof($this->content); |
107 | 107 | } |
108 | - if($this->absolutePaths===true){ |
|
108 | + if ($this->absolutePaths===true) { |
|
109 | 109 | return $this->_hrefFunction($this->content[$index]); |
110 | - }else{ |
|
111 | - return $this->root.implode($separator, array_slice(array_map(function($e){return $this->_hrefFunction($e);}, $this->content),0,$index+1)); |
|
110 | + }else { |
|
111 | + return $this->root.implode($separator, array_slice(array_map(function($e) {return $this->_hrefFunction($e); }, $this->content), 0, $index+1)); |
|
112 | 112 | } |
113 | 113 | } |
114 | 114 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @see \Ajax\bootstrap\html\BaseHtml::compile() |
118 | 118 | */ |
119 | 119 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
120 | - if($this->autoActive){ |
|
120 | + if ($this->autoActive) { |
|
121 | 121 | $this->setActive(); |
122 | 122 | } |
123 | 123 | return parent::compile($js, $view); |
@@ -135,19 +135,19 @@ discard block |
||
135 | 135 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
136 | 136 | */ |
137 | 137 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
138 | - foreach ($this->content as $element){ |
|
139 | - $element->on($event,$jsCode,$stopPropagation,$preventDefault); |
|
138 | + foreach ($this->content as $element) { |
|
139 | + $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
|
140 | 140 | } |
141 | 141 | return $this; |
142 | 142 | } |
143 | 143 | |
144 | 144 | public function setAutoActive($autoActive) { |
145 | - $this->autoActive = $autoActive; |
|
145 | + $this->autoActive=$autoActive; |
|
146 | 146 | return $this; |
147 | 147 | } |
148 | 148 | |
149 | 149 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
150 | - foreach ($this->content as $element){ |
|
150 | + foreach ($this->content as $element) { |
|
151 | 151 | $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
152 | 152 | } |
153 | 153 | return $this; |
@@ -160,18 +160,18 @@ discard block |
||
160 | 160 | * @param string $attr the html attribute used to build the elements url |
161 | 161 | * @return HtmlBreadcrumbs |
162 | 162 | */ |
163 | - public function autoGetOnClick($targetSelector){ |
|
164 | - return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
|
163 | + public function autoGetOnClick($targetSelector) { |
|
164 | + return $this->getOnClick($this->root, $targetSelector, array("attr"=>$this->attr)); |
|
165 | 165 | } |
166 | 166 | |
167 | - public function contentAsString(){ |
|
168 | - if($this->autoActive){ |
|
167 | + public function contentAsString() { |
|
168 | + if ($this->autoActive) { |
|
169 | 169 | $this->setActive(); |
170 | 170 | } |
171 | 171 | return parent::contentAsString(); |
172 | 172 | } |
173 | 173 | |
174 | - public function getElement($index){ |
|
174 | + public function getElement($index) { |
|
175 | 175 | return $this->content[$index]; |
176 | 176 | } |
177 | 177 | |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | * @param mixed $glyph |
181 | 181 | * @param int $index |
182 | 182 | */ |
183 | - public function addGlyph($glyph,$index){ |
|
183 | + public function addGlyph($glyph, $index) { |
|
184 | 184 | $elm=$this->getElement($index); |
185 | 185 | return $elm->wrapContentWithGlyph($glyph); |
186 | 186 | } |
@@ -190,9 +190,9 @@ discard block |
||
190 | 190 | * @param Dispatcher $dispatcher the request dispatcher |
191 | 191 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
192 | 192 | */ |
193 | - public function fromDispatcher($dispatcher){ |
|
194 | - $items=array($dispatcher->getControllerName(),$dispatcher->getActionName()); |
|
195 | - $items=array_merge($items,$dispatcher->getParams()); |
|
193 | + public function fromDispatcher($dispatcher) { |
|
194 | + $items=array($dispatcher->getControllerName(), $dispatcher->getActionName()); |
|
195 | + $items=array_merge($items, $dispatcher->getParams()); |
|
196 | 196 | return $this->addElements($items); |
197 | 197 | } |
198 | 198 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
204 | 204 | */ |
205 | 205 | public function setHrefFunction($_hrefFunction) { |
206 | - $this->_hrefFunction = $_hrefFunction; |
|
206 | + $this->_hrefFunction=$_hrefFunction; |
|
207 | 207 | return $this; |
208 | 208 | } |
209 | 209 |
@@ -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; |
@@ -45,70 +45,70 @@ discard block |
||
45 | 45 | /** |
46 | 46 | * @param string $identifier |
47 | 47 | */ |
48 | - public function __construct($identifier,$from=1,$to=1,$active=NULL,$countVisible=NULL){ |
|
49 | - parent::__construct($identifier,"ul"); |
|
48 | + public function __construct($identifier, $from=1, $to=1, $active=NULL, $countVisible=NULL) { |
|
49 | + parent::__construct($identifier, "ul"); |
|
50 | 50 | $this->setProperty("class", "pagination"); |
51 | 51 | $this->active=$active; |
52 | 52 | $this->from=$from; |
53 | 53 | $this->to=$to; |
54 | 54 | $this->urlMask="%page%"; |
55 | - if(!isset($countVisible)) |
|
55 | + if (!isset($countVisible)) |
|
56 | 56 | $this->countVisible=$to-$from+1; |
57 | 57 | else |
58 | 58 | $this->countVisible=$countVisible; |
59 | 59 | $this->createContent(); |
60 | 60 | } |
61 | 61 | |
62 | - private function createElement($num,$content,$disabled=false,$current=false){ |
|
62 | + private function createElement($num, $content, $disabled=false, $current=false) { |
|
63 | 63 | $count=sizeof($this->content)+1; |
64 | - $elem=new HtmlDoubleElement("li-".$this->identifier."-".$count,"li"); |
|
65 | - if($disabled){ |
|
64 | + $elem=new HtmlDoubleElement("li-".$this->identifier."-".$count, "li"); |
|
65 | + if ($disabled) { |
|
66 | 66 | $elem->setProperty("class", "disabled"); |
67 | 67 | } |
68 | - if($current){ |
|
68 | + if ($current) { |
|
69 | 69 | $content.="<span class='sr-only'>(current)</span>"; |
70 | 70 | $elem->setProperty("class", "active"); |
71 | 71 | } |
72 | - if(!$disabled){ |
|
72 | + if (!$disabled) { |
|
73 | 73 | $url=$this->getUrl($num); |
74 | - $href=new HtmlLink("a-".$this->identifier."-".$count,$url,$content); |
|
74 | + $href=new HtmlLink("a-".$this->identifier."-".$count, $url, $content); |
|
75 | 75 | $href->setProperty($this->attr, $url); |
76 | 76 | $elem->setContent($href); |
77 | - }else{ |
|
77 | + }else { |
|
78 | 78 | $elem->setContent($content); |
79 | 79 | } |
80 | 80 | $this->content[]=$elem; |
81 | 81 | return $this; |
82 | 82 | } |
83 | 83 | |
84 | - protected function createContent(){ |
|
84 | + protected function createContent() { |
|
85 | 85 | $this->content=array(); |
86 | - $this->createElement($this->active-1,"<span aria-hidden='true'>«</span>",$this->active===1); |
|
86 | + $this->createElement($this->active-1, "<span aria-hidden='true'>«</span>", $this->active===1); |
|
87 | 87 | $start=$this->getStart(); |
88 | - $end=min($start+$this->countVisible-1,$this->to); |
|
89 | - for($index=$start;$index<=$end;$index++){ |
|
90 | - $this->createElement($index,$index,false,$index===$this->active); |
|
88 | + $end=min($start+$this->countVisible-1, $this->to); |
|
89 | + for ($index=$start; $index<=$end; $index++) { |
|
90 | + $this->createElement($index, $index, false, $index===$this->active); |
|
91 | 91 | } |
92 | - $this->createElement($this->active+1,"<span aria-hidden='true'>»</span>",$this->active===$this->to); |
|
92 | + $this->createElement($this->active+1, "<span aria-hidden='true'>»</span>", $this->active===$this->to); |
|
93 | 93 | } |
94 | 94 | |
95 | - protected function half(){ |
|
96 | - return (int)($this->countVisible/2); |
|
95 | + protected function half() { |
|
96 | + return (int) ($this->countVisible / 2); |
|
97 | 97 | } |
98 | 98 | |
99 | - protected function getStart(){ |
|
99 | + protected function getStart() { |
|
100 | 100 | $result=1; |
101 | - if($this->countVisible!==$this->to-$this->from+1){ |
|
102 | - $result=max($this->active-$this->half(),$result); |
|
101 | + if ($this->countVisible!==$this->to-$this->from+1) { |
|
102 | + $result=max($this->active-$this->half(), $result); |
|
103 | 103 | } |
104 | 104 | return $result; |
105 | 105 | } |
106 | 106 | |
107 | 107 | public function _addEvent($event, $jsCode) { |
108 | - foreach ($this->content as $li){ |
|
108 | + foreach ($this->content as $li) { |
|
109 | 109 | $content=$li->getContent(); |
110 | - if($content instanceof BaseHtml) |
|
111 | - $content->_addEvent($event,$jsCode); |
|
110 | + if ($content instanceof BaseHtml) |
|
111 | + $content->_addEvent($event, $jsCode); |
|
112 | 112 | } |
113 | 113 | } |
114 | 114 | /** |
@@ -116,15 +116,15 @@ discard block |
||
116 | 116 | * @param Dispatcher $dispatcher the request dispatcher |
117 | 117 | * @return \Ajax\bootstrap\html\HtmlPagination |
118 | 118 | */ |
119 | - public function fromDispatcher($dispatcher){ |
|
120 | - $items=array($dispatcher->getControllerName(),$dispatcher->getActionName()); |
|
121 | - $items=array_merge($items,$dispatcher->getParams()); |
|
119 | + public function fromDispatcher($dispatcher) { |
|
120 | + $items=array($dispatcher->getControllerName(), $dispatcher->getActionName()); |
|
121 | + $items=array_merge($items, $dispatcher->getParams()); |
|
122 | 122 | $url=implode("/", $items); |
123 | - if($this->urlMask==="%page%"){ |
|
123 | + if ($this->urlMask==="%page%") { |
|
124 | 124 | $this->urlMask=preg_replace("/[0-9]/", "%page%", $url); |
125 | 125 | } |
126 | - for($index=$this->from;$index<=$this->to;$index++){ |
|
127 | - if($this->getUrl($index)==$url){ |
|
126 | + for ($index=$this->from; $index<=$this->to; $index++) { |
|
127 | + if ($this->getUrl($index)==$url) { |
|
128 | 128 | $this->setActive($index); |
129 | 129 | break; |
130 | 130 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | return $this; |
133 | 133 | } |
134 | 134 | |
135 | - public function getUrl($index){ |
|
135 | + public function getUrl($index) { |
|
136 | 136 | return str_ireplace("%page%", $index, $this->urlMask); |
137 | 137 | } |
138 | 138 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | if (is_int($size)) { |
147 | 147 | return $this->addToPropertyUnique("class", CssRef::sizes("pagination")[$size], CssRef::sizes("pagination")); |
148 | 148 | } |
149 | - if(!PhalconUtils::startsWith($size, "pagination-") && $size!=="") |
|
149 | + if (!PhalconUtils::startsWith($size, "pagination-") && $size!=="") |
|
150 | 150 | $size="pagination-".$size; |
151 | 151 | return $this->addToPropertyCtrl("class", $size, CssRef::sizes("pagination")); |
152 | 152 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | return $this->from; |
156 | 156 | } |
157 | 157 | public function setFrom($from) { |
158 | - $this->from = $from; |
|
158 | + $this->from=$from; |
|
159 | 159 | $this->createContent(); |
160 | 160 | return $this; |
161 | 161 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | return $this->to; |
164 | 164 | } |
165 | 165 | public function setTo($to) { |
166 | - $this->to = $to; |
|
166 | + $this->to=$to; |
|
167 | 167 | $this->createContent(); |
168 | 168 | return $this; |
169 | 169 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | return $this->active; |
172 | 172 | } |
173 | 173 | public function setActive($active) { |
174 | - $this->active = $active; |
|
174 | + $this->active=$active; |
|
175 | 175 | $this->createContent(); |
176 | 176 | return $this; |
177 | 177 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | return $this->urlMask; |
180 | 180 | } |
181 | 181 | public function setUrlMask($urlMask) { |
182 | - $this->urlMask = $urlMask; |
|
182 | + $this->urlMask=$urlMask; |
|
183 | 183 | $this->createContent(); |
184 | 184 | return $this; |
185 | 185 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | return $this->countVisible; |
188 | 188 | } |
189 | 189 | public function setCountVisible($countVisible) { |
190 | - $this->countVisible = $countVisible; |
|
190 | + $this->countVisible=$countVisible; |
|
191 | 191 | $this->createContent(); |
192 | 192 | return $this; |
193 | 193 | } |
@@ -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; |
@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | protected $attr; |
21 | 21 | |
22 | 22 | |
23 | - public function __construct($identifier,$tagName){ |
|
24 | - parent::__construct($identifier,$tagName); |
|
23 | + public function __construct($identifier, $tagName) { |
|
24 | + parent::__construct($identifier, $tagName); |
|
25 | 25 | $this->root=""; |
26 | 26 | $this->attr="data-ajax"; |
27 | 27 | } |
@@ -33,11 +33,11 @@ discard block |
||
33 | 33 | * @param string $attr the html attribute used to build the elements url |
34 | 34 | * @return HtmlNavElement |
35 | 35 | */ |
36 | - public function autoGetOnClick($targetSelector){ |
|
37 | - return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
|
36 | + public function autoGetOnClick($targetSelector) { |
|
37 | + return $this->getOnClick($this->root, $targetSelector, array("attr"=>$this->attr)); |
|
38 | 38 | } |
39 | 39 | |
40 | - public function contentAsString(){ |
|
40 | + public function contentAsString() { |
|
41 | 41 | return implode("", $this->content); |
42 | 42 | } |
43 | 43 | |
@@ -45,15 +45,15 @@ discard block |
||
45 | 45 | * Generate the jquery script to set the elements to the HtmlNavElement |
46 | 46 | * @param JsUtils $jsUtils |
47 | 47 | */ |
48 | - public function jsSetContent(JsUtils $jsUtils){ |
|
49 | - $jsUtils->html("#".$this->identifier,str_replace("\"","'", $this->contentAsString()),true); |
|
48 | + public function jsSetContent(JsUtils $jsUtils) { |
|
49 | + $jsUtils->html("#".$this->identifier, str_replace("\"", "'", $this->contentAsString()), true); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | public function getRoot() { |
53 | 53 | return $this->root; |
54 | 54 | } |
55 | 55 | public function setRoot($root) { |
56 | - $this->root = $root; |
|
56 | + $this->root=$root; |
|
57 | 57 | return $this; |
58 | 58 | } |
59 | 59 | public function getAttr() { |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | * @return HtmlNavElement |
67 | 67 | */ |
68 | 68 | public function setAttr($attr) { |
69 | - $this->attr = $attr; |
|
69 | + $this->attr=$attr; |
|
70 | 70 | return $this; |
71 | 71 | } |
72 | 72 | |
73 | 73 | public function __call($method, $args) { |
74 | - if(isset($this->$method) && is_callable($this->$method)) { |
|
74 | + if (isset($this->$method) && is_callable($this->$method)) { |
|
75 | 75 | return call_user_func_array( |
76 | 76 | $this->$method, |
77 | 77 | $args |