@@ -164,7 +164,6 @@ discard block |
||
164 | 164 | * Associate an ajax get to the breadcrumbs elements, displayed in $targetSelector |
165 | 165 | * $attr member is used to build each element url |
166 | 166 | * @param string $targetSelector the target of the get |
167 | - * @param string $attr the html attribute used to build the elements url |
|
168 | 167 | * @return HtmlBreadcrumbs |
169 | 168 | */ |
170 | 169 | public function autoGetOnClick($targetSelector){ |
@@ -178,6 +177,9 @@ discard block |
||
178 | 177 | return parent::contentAsString(); |
179 | 178 | } |
180 | 179 | |
180 | + /** |
|
181 | + * @param integer $index |
|
182 | + */ |
|
181 | 183 | public function getElement($index){ |
182 | 184 | return $this->content[$index]; |
183 | 185 | } |
@@ -41,15 +41,15 @@ discard block |
||
41 | 41 | * @param boolean $autoActive sets the last element's class to <b>active</b> if true |
42 | 42 | * @param function $hrefFunction the function who generates the href elements. default : function($e){return $e->getContent()} |
43 | 43 | */ |
44 | - public function __construct($identifier,$elements=array(),$autoActive=true,$startIndex=0,$hrefFunction=NULL){ |
|
45 | - parent::__construct($identifier,"ol"); |
|
44 | + public function __construct($identifier, $elements=array(), $autoActive=true, $startIndex=0, $hrefFunction=NULL) { |
|
45 | + parent::__construct($identifier, "ol"); |
|
46 | 46 | $this->startIndex=$startIndex; |
47 | 47 | $this->setProperty("class", "breadcrumb"); |
48 | 48 | $this->content=array(); |
49 | 49 | $this->autoActive=$autoActive; |
50 | 50 | $this->absolutePaths; |
51 | - $this->_hrefFunction=function ($e){return $e->getContent();}; |
|
52 | - if(isset($hrefFunction)){ |
|
51 | + $this->_hrefFunction=function($e) {return $e->getContent(); }; |
|
52 | + if (isset($hrefFunction)) { |
|
53 | 53 | $this->_hrefFunction=$hrefFunction; |
54 | 54 | } |
55 | 55 | $this->addElements($elements); |
@@ -60,43 +60,43 @@ discard block |
||
60 | 60 | * @param string $href |
61 | 61 | * @return \Ajax\bootstrap\html\HtmlLink |
62 | 62 | */ |
63 | - public function addElement($element,$href="",$glyph=NULL){ |
|
63 | + public function addElement($element, $href="", $glyph=NULL) { |
|
64 | 64 | $size=sizeof($this->content); |
65 | - if(is_array($element)){ |
|
65 | + if (is_array($element)) { |
|
66 | 66 | $elm=new HtmlLink("lnk-".$this->identifier."-".$size); |
67 | 67 | $elm->fromArray($element); |
68 | - }else if($element instanceof HtmlLink){ |
|
68 | + }else if ($element instanceof HtmlLink) { |
|
69 | 69 | $elm=$element; |
70 | - }else{ |
|
71 | - $elm=new HtmlLink("lnk-".$this->identifier."-".$size,$href,$element); |
|
72 | - if(isset($glyph)){ |
|
70 | + }else { |
|
71 | + $elm=new HtmlLink("lnk-".$this->identifier."-".$size, $href, $element); |
|
72 | + if (isset($glyph)) { |
|
73 | 73 | $elm->wrapContentWithGlyph($glyph); |
74 | 74 | } |
75 | 75 | } |
76 | - $elm->wrap("<li>","</li>"); |
|
76 | + $elm->wrap("<li>", "</li>"); |
|
77 | 77 | $this->content[]=$elm; |
78 | 78 | $elm->setProperty($this->attr, $this->getHref($size)); |
79 | 79 | return $elm; |
80 | 80 | } |
81 | 81 | |
82 | - public function setActive($index=null){ |
|
83 | - if(!isset($index)){ |
|
82 | + public function setActive($index=null) { |
|
83 | + if (!isset($index)) { |
|
84 | 84 | $index=sizeof($this->content)-1; |
85 | 85 | } |
86 | - $li=new HtmlDoubleElement("","li"); |
|
86 | + $li=new HtmlDoubleElement("", "li"); |
|
87 | 87 | $li->setClass("active"); |
88 | 88 | $li->setContent($this->content[$index]->getContent()); |
89 | 89 | $this->content[$index]=$li; |
90 | 90 | } |
91 | 91 | |
92 | - public function addElements($elements){ |
|
93 | - foreach ( $elements as $element ) { |
|
92 | + public function addElements($elements) { |
|
93 | + foreach ($elements as $element) { |
|
94 | 94 | $this->addElement($element); |
95 | 95 | } |
96 | 96 | return $this; |
97 | 97 | } |
98 | 98 | |
99 | - public function fromArray($array){ |
|
99 | + public function fromArray($array) { |
|
100 | 100 | $array=parent::fromArray($array); |
101 | 101 | $this->addElements($array); |
102 | 102 | return $array; |
@@ -108,14 +108,14 @@ discard block |
||
108 | 108 | * @param string $separator |
109 | 109 | * @return string |
110 | 110 | */ |
111 | - public function getHref($index=null,$separator="/"){ |
|
112 | - if(!isset($index)){ |
|
111 | + public function getHref($index=null, $separator="/") { |
|
112 | + if (!isset($index)) { |
|
113 | 113 | $index=sizeof($this->content); |
114 | 114 | } |
115 | - if($this->absolutePaths===true){ |
|
115 | + if ($this->absolutePaths===true) { |
|
116 | 116 | return $this->_hrefFunction($this->content[$index]); |
117 | - }else{ |
|
118 | - return $this->root.implode($separator, array_slice(array_map(function($e){return $this->_hrefFunction($e);}, $this->content),$this->startIndex,$index+1)); |
|
117 | + }else { |
|
118 | + return $this->root.implode($separator, array_slice(array_map(function($e) {return $this->_hrefFunction($e); }, $this->content), $this->startIndex, $index+1)); |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @see \Ajax\bootstrap\html\BaseHtml::compile() |
125 | 125 | */ |
126 | 126 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
127 | - if($this->autoActive){ |
|
127 | + if ($this->autoActive) { |
|
128 | 128 | $this->setActive(); |
129 | 129 | } |
130 | 130 | return parent::compile($js, $view); |
@@ -142,19 +142,19 @@ discard block |
||
142 | 142 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
143 | 143 | */ |
144 | 144 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
145 | - foreach ($this->content as $element){ |
|
146 | - $element->on($event,$jsCode,$stopPropagation,$preventDefault); |
|
145 | + foreach ($this->content as $element) { |
|
146 | + $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
|
147 | 147 | } |
148 | 148 | return $this; |
149 | 149 | } |
150 | 150 | |
151 | 151 | public function setAutoActive($autoActive) { |
152 | - $this->autoActive = $autoActive; |
|
152 | + $this->autoActive=$autoActive; |
|
153 | 153 | return $this; |
154 | 154 | } |
155 | 155 | |
156 | 156 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
157 | - foreach ($this->content as $element){ |
|
157 | + foreach ($this->content as $element) { |
|
158 | 158 | $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
159 | 159 | } |
160 | 160 | return $this; |
@@ -167,18 +167,18 @@ discard block |
||
167 | 167 | * @param string $attr the html attribute used to build the elements url |
168 | 168 | * @return HtmlBreadcrumbs |
169 | 169 | */ |
170 | - public function autoGetOnClick($targetSelector){ |
|
171 | - return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
|
170 | + public function autoGetOnClick($targetSelector) { |
|
171 | + return $this->getOnClick($this->root, $targetSelector, array("attr"=>$this->attr)); |
|
172 | 172 | } |
173 | 173 | |
174 | - public function contentAsString(){ |
|
175 | - if($this->autoActive){ |
|
174 | + public function contentAsString() { |
|
175 | + if ($this->autoActive) { |
|
176 | 176 | $this->setActive(); |
177 | 177 | } |
178 | 178 | return parent::contentAsString(); |
179 | 179 | } |
180 | 180 | |
181 | - public function getElement($index){ |
|
181 | + public function getElement($index) { |
|
182 | 182 | return $this->content[$index]; |
183 | 183 | } |
184 | 184 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * @param mixed $glyph |
188 | 188 | * @param int $index |
189 | 189 | */ |
190 | - public function addGlyph($glyph,$index=0){ |
|
190 | + public function addGlyph($glyph, $index=0) { |
|
191 | 191 | $elm=$this->getElement($index); |
192 | 192 | return $elm->wrapContentWithGlyph($glyph); |
193 | 193 | } |
@@ -197,13 +197,13 @@ discard block |
||
197 | 197 | * @param Dispatcher $dispatcher the request dispatcher |
198 | 198 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
199 | 199 | */ |
200 | - public function fromDispatcher($dispatcher){ |
|
200 | + public function fromDispatcher($dispatcher) { |
|
201 | 201 | $params=$dispatcher->getParams(); |
202 | 202 | $action=$dispatcher->getActionName(); |
203 | 203 | $items=array($dispatcher->getControllerName()); |
204 | - if(\sizeof($params)>0 || \strtolower($action)!="index" ){ |
|
204 | + if (\sizeof($params)>0 || \strtolower($action)!="index") { |
|
205 | 205 | $items[]=$action; |
206 | - $items=array_merge($items,$params); |
|
206 | + $items=array_merge($items, $params); |
|
207 | 207 | } |
208 | 208 | return $this->addElements($items); |
209 | 209 | } |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
216 | 216 | */ |
217 | 217 | public function setHrefFunction($_hrefFunction) { |
218 | - $this->_hrefFunction = $_hrefFunction; |
|
218 | + $this->_hrefFunction=$_hrefFunction; |
|
219 | 219 | return $this; |
220 | 220 | } |
221 | 221 |
@@ -19,6 +19,9 @@ discard block |
||
19 | 19 | protected $style=""; |
20 | 20 | protected $styleLimits=null; |
21 | 21 | |
22 | + /** |
|
23 | + * @param string $identifier |
|
24 | + */ |
|
22 | 25 | public function __construct($identifier, $style="info", $value=0, $max=100, $min=0) { |
23 | 26 | parent::__construct($identifier); |
24 | 27 | $this->_template=include 'templates/tplProgressbar.php'; |
@@ -28,6 +31,9 @@ discard block |
||
28 | 31 | $this->setStyle($style); |
29 | 32 | } |
30 | 33 | |
34 | + /** |
|
35 | + * @param boolean $value |
|
36 | + */ |
|
31 | 37 | public function setActive($value) { |
32 | 38 | if(is_array($this->content)){ |
33 | 39 | foreach ($this->content as $pb){ |
@@ -42,6 +48,9 @@ discard block |
||
42 | 48 | return $this; |
43 | 49 | } |
44 | 50 | |
51 | + /** |
|
52 | + * @param boolean $value |
|
53 | + */ |
|
45 | 54 | public function setStriped($value) { |
46 | 55 | if(is_array($this->content)){ |
47 | 56 | foreach ($this->content as $pb){ |
@@ -56,6 +65,9 @@ discard block |
||
56 | 65 | return $this; |
57 | 66 | } |
58 | 67 | |
68 | + /** |
|
69 | + * @param boolean $value |
|
70 | + */ |
|
59 | 71 | public function showCaption($value) { |
60 | 72 | if(is_array($this->content)){ |
61 | 73 | foreach ($this->content as $pb){ |
@@ -113,6 +125,9 @@ discard block |
||
113 | 125 | return $this->isStacked; |
114 | 126 | } |
115 | 127 | |
128 | + /** |
|
129 | + * @param boolean $isStacked |
|
130 | + */ |
|
116 | 131 | public function setIsStacked($isStacked) { |
117 | 132 | $this->isStacked=$isStacked; |
118 | 133 | return $this; |
@@ -121,7 +136,7 @@ discard block |
||
121 | 136 | /** |
122 | 137 | * define the progressbar style |
123 | 138 | * avaible values : "success","info","warning","danger" |
124 | - * @param string|int $cssStyle |
|
139 | + * @param string $cssStyle |
|
125 | 140 | * @return \Ajax\bootstrap\html\HtmlProgressbar default : "" |
126 | 141 | */ |
127 | 142 | public function setStyle($cssStyle) { |
@@ -29,11 +29,11 @@ discard block |
||
29 | 29 | } |
30 | 30 | |
31 | 31 | public function setActive($value) { |
32 | - if(is_array($this->content)){ |
|
33 | - foreach ($this->content as $pb){ |
|
32 | + if (is_array($this->content)) { |
|
33 | + foreach ($this->content as $pb) { |
|
34 | 34 | $pb->setActive($value); |
35 | 35 | } |
36 | - }else{ |
|
36 | + }else { |
|
37 | 37 | if ($value===true) |
38 | 38 | $this->active="active"; |
39 | 39 | else |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | public function setStriped($value) { |
46 | - if(is_array($this->content)){ |
|
47 | - foreach ($this->content as $pb){ |
|
46 | + if (is_array($this->content)) { |
|
47 | + foreach ($this->content as $pb) { |
|
48 | 48 | $pb->setStriped($value); |
49 | 49 | } |
50 | - }else{ |
|
50 | + }else { |
|
51 | 51 | if ($value===true) |
52 | 52 | $this->striped="progress-bar-striped"; |
53 | 53 | else |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | public function showCaption($value) { |
60 | - if(is_array($this->content)){ |
|
61 | - foreach ($this->content as $pb){ |
|
60 | + if (is_array($this->content)) { |
|
61 | + foreach ($this->content as $pb) { |
|
62 | 62 | $pb->showCaption($value); |
63 | 63 | } |
64 | - }else{ |
|
64 | + }else { |
|
65 | 65 | if ($value===true) |
66 | 66 | $this->caption="%value%%"; |
67 | 67 | else |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $progressBar->setStriped($this->striped!=="" || $progressBar->isStriped()); |
82 | 82 | $progressBar->setActive($this->active==="active" || $progressBar->isActive()); |
83 | 83 | if (is_array($this->content)===false) { |
84 | - $this->content=array (); |
|
84 | + $this->content=array(); |
|
85 | 85 | } |
86 | 86 | $this->content []=$progressBar; |
87 | 87 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @return \Ajax\bootstrap\html\HtmlProgressbar default : "" |
126 | 126 | */ |
127 | 127 | public function setStyle($cssStyle) { |
128 | - return $this->setMemberCtrl($this->style,CssRef::getStyle($cssStyle, "progress-bar"), CssRef::Styles("progress-bar")); |
|
128 | + return $this->setMemberCtrl($this->style, CssRef::getStyle($cssStyle, "progress-bar"), CssRef::Styles("progress-bar")); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /* |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
136 | 136 | $actualStyle=$this->style; |
137 | - if(isset($this->styleLimits)&& JArray::isAssociative($this->styleLimits)){ |
|
138 | - foreach ($this->styleLimits as $k=>$v){ |
|
137 | + if (isset($this->styleLimits) && JArray::isAssociative($this->styleLimits)) { |
|
138 | + foreach ($this->styleLimits as $k=>$v) { |
|
139 | 139 | $actualStyle=$k; |
140 | - if($v>=$this->value) |
|
140 | + if ($v>=$this->value) |
|
141 | 141 | break; |
142 | 142 | else |
143 | 143 | $actualStyle=$this->style; |
@@ -33,11 +33,12 @@ discard block |
||
33 | 33 | foreach ($this->content as $pb){ |
34 | 34 | $pb->setActive($value); |
35 | 35 | } |
36 | - }else{ |
|
37 | - if ($value===true) |
|
38 | - $this->active="active"; |
|
39 | - else |
|
40 | - $this->active=""; |
|
36 | + } else{ |
|
37 | + if ($value===true) { |
|
38 | + $this->active="active"; |
|
39 | + } else { |
|
40 | + $this->active=""; |
|
41 | + } |
|
41 | 42 | } |
42 | 43 | return $this; |
43 | 44 | } |
@@ -47,11 +48,12 @@ discard block |
||
47 | 48 | foreach ($this->content as $pb){ |
48 | 49 | $pb->setStriped($value); |
49 | 50 | } |
50 | - }else{ |
|
51 | - if ($value===true) |
|
52 | - $this->striped="progress-bar-striped"; |
|
53 | - else |
|
54 | - $this->striped=""; |
|
51 | + } else{ |
|
52 | + if ($value===true) { |
|
53 | + $this->striped="progress-bar-striped"; |
|
54 | + } else { |
|
55 | + $this->striped=""; |
|
56 | + } |
|
55 | 57 | } |
56 | 58 | return $this; |
57 | 59 | } |
@@ -61,11 +63,12 @@ discard block |
||
61 | 63 | foreach ($this->content as $pb){ |
62 | 64 | $pb->showCaption($value); |
63 | 65 | } |
64 | - }else{ |
|
65 | - if ($value===true) |
|
66 | - $this->caption="%value%%"; |
|
67 | - else |
|
68 | - $this->caption='<span class="sr-only">%value%% Complete (%style%)</span>'; |
|
66 | + } else{ |
|
67 | + if ($value===true) { |
|
68 | + $this->caption="%value%%"; |
|
69 | + } else { |
|
70 | + $this->caption='<span class="sr-only">%value%% Complete (%style%)</span>'; |
|
71 | + } |
|
69 | 72 | } |
70 | 73 | return $this; |
71 | 74 | } |
@@ -137,10 +140,11 @@ discard block |
||
137 | 140 | if(isset($this->styleLimits)&& JArray::isAssociative($this->styleLimits)){ |
138 | 141 | foreach ($this->styleLimits as $k=>$v){ |
139 | 142 | $actualStyle=$k; |
140 | - if($v>=$this->value) |
|
141 | - break; |
|
142 | - else |
|
143 | - $actualStyle=$this->style; |
|
143 | + if($v>=$this->value) { |
|
144 | + break; |
|
145 | + } else { |
|
146 | + $actualStyle=$this->style; |
|
147 | + } |
|
144 | 148 | } |
145 | 149 | } |
146 | 150 | $this->style=$actualStyle; |
@@ -32,12 +32,12 @@ discard block |
||
32 | 32 | |
33 | 33 | public function addContent($content) { |
34 | 34 | if (is_array($this->content)===false) { |
35 | - $newContent=array (); |
|
35 | + $newContent=array(); |
|
36 | 36 | if (isset($this->content)) |
37 | 37 | $newContent []=$this->content; |
38 | 38 | $newContent []=$content; |
39 | 39 | $this->content=$newContent; |
40 | - } else { |
|
40 | + }else { |
|
41 | 41 | $this->content []=$content; |
42 | 42 | } |
43 | 43 | return $this; |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | parent::run($js); |
52 | 52 | if ($this->content instanceof HtmlDoubleElement) { |
53 | 53 | $this->content->run($js); |
54 | - } else if (is_array($this->content)) { |
|
55 | - foreach ( $this->content as $itemContent ) { |
|
54 | + }else if (is_array($this->content)) { |
|
55 | + foreach ($this->content as $itemContent) { |
|
56 | 56 | if ($itemContent instanceof HtmlDoubleElement) { |
57 | 57 | $itemContent->run($js); |
58 | 58 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | return $this; |
75 | 75 | } |
76 | 76 | |
77 | - public function addGlyph($glyphicon,$index=0){ |
|
77 | + public function addGlyph($glyphicon, $index=0) { |
|
78 | 78 | $glyph=new HtmlGlyphicon(""); |
79 | 79 | $glyph->setGlyphicon($glyphicon); |
80 | 80 | $this->addContent($glyph); |
@@ -90,12 +90,12 @@ discard block |
||
90 | 90 | return $this; |
91 | 91 | } |
92 | 92 | |
93 | - public function wrapContentWithGlyph($glyphBefore,$glyphAfter=""){ |
|
93 | + public function wrapContentWithGlyph($glyphBefore, $glyphAfter="") { |
|
94 | 94 | $before=HtmlGlyphicon::getGlyphicon($glyphBefore)." "; |
95 | 95 | $after=""; |
96 | - if($glyphAfter!==""){ |
|
96 | + if ($glyphAfter!=="") { |
|
97 | 97 | $after=" ".HtmlGlyphicon::getGlyphicon($glyphAfter); |
98 | 98 | } |
99 | - return $this->wrapContent($before,$after); |
|
99 | + return $this->wrapContent($before, $after); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | \ No newline at end of file |
@@ -17,8 +17,9 @@ discard block |
||
17 | 17 | $value1=reset($input); |
18 | 18 | if (is_object($value1)) { |
19 | 19 | $output=PropertyWrapper::wrapObjects($input, $js, $separator=' '); |
20 | - } else |
|
21 | - $output=PropertyWrapper::wrapStrings($input, $separator=' ', $valueQuote='"'); |
|
20 | + } else { |
|
21 | + $output=PropertyWrapper::wrapStrings($input, $separator=' ', $valueQuote='"'); |
|
22 | + } |
|
22 | 23 | } |
23 | 24 | } |
24 | 25 | return $output; |
@@ -37,10 +38,11 @@ discard block |
||
37 | 38 | |
38 | 39 | public static function wrapObjects($input, $js=NULL, $separator=' ') { |
39 | 40 | return implode($separator, array_map(function ($v) use($js) { |
40 | - if (is_object($v)) |
|
41 | - return $v->compile($js); |
|
42 | - else |
|
43 | - return $v; |
|
41 | + if (is_object($v)) { |
|
42 | + return $v->compile($js); |
|
43 | + } else { |
|
44 | + return $v; |
|
45 | + } |
|
44 | 46 | }, $input)); |
45 | 47 | } |
46 | 48 | } |
47 | 49 | \ No newline at end of file |
@@ -424,8 +424,9 @@ discard block |
||
424 | 424 | $element=$this->_prep_element($element); |
425 | 425 | $value=$this->_prep_value($value); |
426 | 426 | $str="$({$element}).after({$value});"; |
427 | - if ($immediatly) |
|
428 | - $this->jquery_code_for_compile[]=$str; |
|
427 | + if ($immediatly) { |
|
428 | + $this->jquery_code_for_compile[]=$str; |
|
429 | + } |
|
429 | 430 | return $str; |
430 | 431 | } |
431 | 432 | |
@@ -441,10 +442,12 @@ discard block |
||
441 | 442 | if (isset($value)) { |
442 | 443 | $value=$this->_prep_value($value); |
443 | 444 | $str="$({$element}).attr(\"$attributeName\",{$value});"; |
444 | - } else |
|
445 | - $str="$({$element}).attr(\"$attributeName\");"; |
|
446 | - if ($immediatly) |
|
447 | - $this->jquery_code_for_compile[]=$str; |
|
445 | + } else { |
|
446 | + $str="$({$element}).attr(\"$attributeName\");"; |
|
447 | + } |
|
448 | + if ($immediatly) { |
|
449 | + $this->jquery_code_for_compile[]=$str; |
|
450 | + } |
|
448 | 451 | return $str; |
449 | 452 | } |
450 | 453 | |
@@ -460,10 +463,12 @@ discard block |
||
460 | 463 | if (isset($param)) { |
461 | 464 | $param=$this->_prep_value($param); |
462 | 465 | $str="$({$element}).{$jQueryCall}({$param});"; |
463 | - } else |
|
464 | - $str="$({$element}).{$jQueryCall}();"; |
|
465 | - if ($immediatly) |
|
466 | - $this->jquery_code_for_compile[]=$str; |
|
466 | + } else { |
|
467 | + $str="$({$element}).{$jQueryCall}();"; |
|
468 | + } |
|
469 | + if ($immediatly) { |
|
470 | + $this->jquery_code_for_compile[]=$str; |
|
471 | + } |
|
467 | 472 | return $str; |
468 | 473 | } |
469 | 474 | /** |
@@ -478,8 +483,9 @@ discard block |
||
478 | 483 | $to=$this->_prep_element($to); |
479 | 484 | $element=$this->_prep_element($element); |
480 | 485 | $str="$({$to}).{$jQueryCall}({$element});"; |
481 | - if ($immediatly) |
|
482 | - $this->jquery_code_for_compile[]=$str; |
|
486 | + if ($immediatly) { |
|
487 | + $this->jquery_code_for_compile[]=$str; |
|
488 | + } |
|
483 | 489 | return $str; |
484 | 490 | } |
485 | 491 | // -------------------------------------------------------------------- |
@@ -516,8 +522,9 @@ discard block |
||
516 | 522 | |
517 | 523 | $str="$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.");"; |
518 | 524 | |
519 | - if ($immediatly) |
|
520 | - $this->jquery_code_for_compile[]=$str; |
|
525 | + if ($immediatly) { |
|
526 | + $this->jquery_code_for_compile[]=$str; |
|
527 | + } |
|
521 | 528 | return $str; |
522 | 529 | } |
523 | 530 | |
@@ -542,8 +549,9 @@ discard block |
||
542 | 549 | |
543 | 550 | $str="$({$element}).fadeIn({$speed}{$callback});"; |
544 | 551 | |
545 | - if ($immediatly) |
|
546 | - $this->jquery_code_for_compile[]=$str; |
|
552 | + if ($immediatly) { |
|
553 | + $this->jquery_code_for_compile[]=$str; |
|
554 | + } |
|
547 | 555 | return $str; |
548 | 556 | } |
549 | 557 | |
@@ -568,8 +576,9 @@ discard block |
||
568 | 576 | |
569 | 577 | $str="$({$element}).fadeOut({$speed}{$callback});"; |
570 | 578 | |
571 | - if ($immediatly) |
|
572 | - $this->jquery_code_for_compile[]=$str; |
|
579 | + if ($immediatly) { |
|
580 | + $this->jquery_code_for_compile[]=$str; |
|
581 | + } |
|
573 | 582 | return $str; |
574 | 583 | } |
575 | 584 | |
@@ -594,8 +603,9 @@ discard block |
||
594 | 603 | |
595 | 604 | $str="$({$element}).hide({$speed}{$callback});"; |
596 | 605 | |
597 | - if ($immediatly) |
|
598 | - $this->jquery_code_for_compile[]=$str; |
|
606 | + if ($immediatly) { |
|
607 | + $this->jquery_code_for_compile[]=$str; |
|
608 | + } |
|
599 | 609 | return $str; |
600 | 610 | } |
601 | 611 | |
@@ -622,8 +632,9 @@ discard block |
||
622 | 632 | |
623 | 633 | $str="$({$element}).slideUp({$speed}{$callback});"; |
624 | 634 | |
625 | - if ($immediatly) |
|
626 | - $this->jquery_code_for_compile[]=$str; |
|
635 | + if ($immediatly) { |
|
636 | + $this->jquery_code_for_compile[]=$str; |
|
637 | + } |
|
627 | 638 | return $str; |
628 | 639 | } |
629 | 640 | |
@@ -648,8 +659,9 @@ discard block |
||
648 | 659 | |
649 | 660 | $str="$({$element}).slideDown({$speed}{$callback});"; |
650 | 661 | |
651 | - if ($immediatly) |
|
652 | - $this->jquery_code_for_compile[]=$str; |
|
662 | + if ($immediatly) { |
|
663 | + $this->jquery_code_for_compile[]=$str; |
|
664 | + } |
|
653 | 665 | return $str; |
654 | 666 | } |
655 | 667 | |
@@ -674,8 +686,9 @@ discard block |
||
674 | 686 | |
675 | 687 | $str="$({$element}).slideToggle({$speed}{$callback});"; |
676 | 688 | |
677 | - if ($immediatly) |
|
678 | - $this->jquery_code_for_compile[]=$str; |
|
689 | + if ($immediatly) { |
|
690 | + $this->jquery_code_for_compile[]=$str; |
|
691 | + } |
|
679 | 692 | return $str; |
680 | 693 | } |
681 | 694 | |
@@ -692,8 +705,9 @@ discard block |
||
692 | 705 | $element=$this->_prep_element($element); |
693 | 706 | $str="$({$element}).toggle();"; |
694 | 707 | |
695 | - if ($immediatly) |
|
696 | - $this->jquery_code_for_compile[]=$str; |
|
708 | + if ($immediatly) { |
|
709 | + $this->jquery_code_for_compile[]=$str; |
|
710 | + } |
|
697 | 711 | return $str; |
698 | 712 | } |
699 | 713 | |
@@ -709,8 +723,9 @@ discard block |
||
709 | 723 | $element=$this->_prep_element($element); |
710 | 724 | $str="$({$element}).trigger(\"$event\");"; |
711 | 725 | |
712 | - if ($immediatly) |
|
713 | - $this->jquery_code_for_compile[]=$str; |
|
726 | + if ($immediatly) { |
|
727 | + $this->jquery_code_for_compile[]=$str; |
|
728 | + } |
|
714 | 729 | return $str; |
715 | 730 | } |
716 | 731 | |
@@ -735,8 +750,9 @@ discard block |
||
735 | 750 | |
736 | 751 | $str="$({$element}).show({$speed}{$callback});"; |
737 | 752 | |
738 | - if ($immediatly) |
|
739 | - $this->jquery_code_for_compile[]=$str; |
|
753 | + if ($immediatly) { |
|
754 | + $this->jquery_code_for_compile[]=$str; |
|
755 | + } |
|
740 | 756 | return $str; |
741 | 757 | } |
742 | 758 | |
@@ -754,8 +770,9 @@ discard block |
||
754 | 770 | $str.="else{".$jsCodeIfFalse."}"; |
755 | 771 | } |
756 | 772 | |
757 | - if ($immediatly) |
|
758 | - $this->jquery_code_for_compile[]=$str; |
|
773 | + if ($immediatly) { |
|
774 | + $this->jquery_code_for_compile[]=$str; |
|
775 | + } |
|
759 | 776 | return $str; |
760 | 777 | } |
761 | 778 | |
@@ -821,12 +838,14 @@ discard block |
||
821 | 838 | if ($stopPropagation===true) { |
822 | 839 | $js="event.stopPropagation();\n".$js; |
823 | 840 | } |
824 | - if (array_search($event, $this->jquery_events)===false) |
|
825 | - $event="\n\t$(".$this->_prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
|
826 | - else |
|
827 | - $event="\n\t$(".$this->_prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
|
828 | - if($immediatly) |
|
829 | - $this->jquery_code_for_compile[]=$event; |
|
841 | + if (array_search($event, $this->jquery_events)===false) { |
|
842 | + $event="\n\t$(".$this->_prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
|
843 | + } else { |
|
844 | + $event="\n\t$(".$this->_prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
|
845 | + } |
|
846 | + if($immediatly) { |
|
847 | + $this->jquery_code_for_compile[]=$event; |
|
848 | + } |
|
830 | 849 | return $event; |
831 | 850 | } |
832 | 851 | |
@@ -879,8 +898,9 @@ discard block |
||
879 | 898 | } |
880 | 899 | $output=($script_tags===FALSE) ? $script : $this->inline($script); |
881 | 900 | |
882 | - if ($view!=NULL) |
|
883 | - $view->setVar($view_var, $output); |
|
901 | + if ($view!=NULL) { |
|
902 | + $view->setVar($view_var, $output); |
|
903 | + } |
|
884 | 904 | return $output; |
885 | 905 | } |
886 | 906 | |
@@ -1003,8 +1023,9 @@ discard block |
||
1003 | 1023 | } |
1004 | 1024 | $retour.="$.".$method."(url,".$params.").done(function( data ) {\n"; |
1005 | 1025 | $retour.=$this->_getOnAjaxDone($responseElement, $jsCallback)."});\n"; |
1006 | - if ($immediatly) |
|
1007 | - $this->jquery_code_for_compile[]=$retour; |
|
1026 | + if ($immediatly) { |
|
1027 | + $this->jquery_code_for_compile[]=$retour; |
|
1028 | + } |
|
1008 | 1029 | return $retour; |
1009 | 1030 | } |
1010 | 1031 | |
@@ -1012,13 +1033,15 @@ discard block |
||
1012 | 1033 | $url=$this->_correctAjaxUrl($url); |
1013 | 1034 | $retour="url='".$url."';\n"; |
1014 | 1035 | $slash="/"; |
1015 | - if(PhalconUtils::endsWith($url, "/")) |
|
1016 | - $slash=""; |
|
1036 | + if(PhalconUtils::endsWith($url, "/")) { |
|
1037 | + $slash=""; |
|
1038 | + } |
|
1017 | 1039 | if(JString::isNotNull($attr)){ |
1018 | - if ($attr=="value") |
|
1019 | - $retour.="url=url+'".$slash."'+$(this).val();\n"; |
|
1020 | - else if($attr!=null && $attr!=="") |
|
1021 | - $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
1040 | + if ($attr=="value") { |
|
1041 | + $retour.="url=url+'".$slash."'+$(this).val();\n"; |
|
1042 | + } else if($attr!=null && $attr!=="") { |
|
1043 | + $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
1044 | + } |
|
1022 | 1045 | } |
1023 | 1046 | return $retour; |
1024 | 1047 | } |
@@ -1040,8 +1063,9 @@ discard block |
||
1040 | 1063 | } |
1041 | 1064 | |
1042 | 1065 | protected function _correctAjaxUrl($url) { |
1043 | - if (PhalconUtils::endsWith($url, "/")) |
|
1044 | - $url=substr($url, 0, strlen($url)-1); |
|
1066 | + if (PhalconUtils::endsWith($url, "/")) { |
|
1067 | + $url=substr($url, 0, strlen($url)-1); |
|
1068 | + } |
|
1045 | 1069 | if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
1046 | 1070 | $url=$this->_di->get("url")->get($url); |
1047 | 1071 | } |
@@ -1065,8 +1089,9 @@ discard block |
||
1065 | 1089 | $retour.="\t".$jsCallback."\n". |
1066 | 1090 | "\t$(document).trigger('jsonReady',[data]);\n". |
1067 | 1091 | "});\n"; |
1068 | - if ($immediatly) |
|
1069 | - $this->jquery_code_for_compile[]=$retour; |
|
1092 | + if ($immediatly) { |
|
1093 | + $this->jquery_code_for_compile[]=$retour; |
|
1094 | + } |
|
1070 | 1095 | return $retour; |
1071 | 1096 | } |
1072 | 1097 | |
@@ -1105,7 +1130,7 @@ discard block |
||
1105 | 1130 | if($context===null){ |
1106 | 1131 | $appendTo="\t\tnewElm.appendTo($('".$maskSelector."').parent());\n"; |
1107 | 1132 | $newElm = "$('#'+newId)"; |
1108 | - }else{ |
|
1133 | + } else{ |
|
1109 | 1134 | $appendTo="\t\tnewElm.appendTo(".$context.");\n"; |
1110 | 1135 | $newElm = $context.".find('#'+newId)"; |
1111 | 1136 | } |
@@ -1115,8 +1140,9 @@ discard block |
||
1115 | 1140 | $retour.="\t}\n"."\tfor(var key in value){\n"."\t\t\tvar html = $('<div />').append($(newElm).clone()).html();\n"."\t\t\tif(html.indexOf('[['+key+']]')>-1){\n"."\t\t\t\tcontent=$(html.split('[['+key+']]').join(value[key]));\n"."\t\t\t\t$(newElm).replaceWith(content);newElm=content;\n"."\t\t\t}\n"."\t\tvar sel='[data-id=\"'+key+'\"]';if($(sel,newElm).length){\n"."\t\t\tvar selElm=$(sel,newElm);\n"."\t\t\t if(selElm.is('[value]')) { selElm.attr('value',value[key]);selElm.val(value[key]);} else { selElm.html(value[key]); }\n"."\t\t}\n"."}\n"."\t$(newElm).show(true);"."\n"."\t$(newElm).removeClass('hide');"."});\n"; |
1116 | 1141 | $retour.="\t$(document).trigger('jsonReady',[data]);\n"; |
1117 | 1142 | $retour.="\t".$jsCallback."\n"."});\n"; |
1118 | - if ($immediatly) |
|
1119 | - $this->jquery_code_for_compile[]=$retour; |
|
1143 | + if ($immediatly) { |
|
1144 | + $this->jquery_code_for_compile[]=$retour; |
|
1145 | + } |
|
1120 | 1146 | return $retour; |
1121 | 1147 | } |
1122 | 1148 | /** |
@@ -1157,8 +1183,9 @@ discard block |
||
1157 | 1183 | }});\n"; |
1158 | 1184 | $retour.="$('#".$form."').submit();\n"; |
1159 | 1185 | } |
1160 | - if ($immediatly) |
|
1161 | - $this->jquery_code_for_compile[]=$retour; |
|
1186 | + if ($immediatly) { |
|
1187 | + $this->jquery_code_for_compile[]=$retour; |
|
1188 | + } |
|
1162 | 1189 | return $retour; |
1163 | 1190 | } |
1164 | 1191 | |
@@ -1238,11 +1265,13 @@ discard block |
||
1238 | 1265 | public function _doJQuery($element, $jqueryCall, $param="", $jsCallback="", $immediatly=false) { |
1239 | 1266 | $param=$this->_prep_value($param); |
1240 | 1267 | $callback=""; |
1241 | - if ($jsCallback!="") |
|
1242 | - $callback=", function(event){\n{$jsCallback}\n}"; |
|
1268 | + if ($jsCallback!="") { |
|
1269 | + $callback=", function(event){\n{$jsCallback}\n}"; |
|
1270 | + } |
|
1243 | 1271 | $script="$(".$this->_prep_element($element).").".$jqueryCall."(".$param.$callback.");\n"; |
1244 | - if ($immediatly) |
|
1245 | - $this->jquery_code_for_compile[]=$script; |
|
1272 | + if ($immediatly) { |
|
1273 | + $this->jquery_code_for_compile[]=$script; |
|
1274 | + } |
|
1246 | 1275 | return $script; |
1247 | 1276 | } |
1248 | 1277 | |
@@ -1271,8 +1300,9 @@ discard block |
||
1271 | 1300 | */ |
1272 | 1301 | public function _exec($js, $immediatly=false) { |
1273 | 1302 | $script=$js."\n"; |
1274 | - if ($immediatly) |
|
1275 | - $this->jquery_code_for_compile[]=$script; |
|
1303 | + if ($immediatly) { |
|
1304 | + $this->jquery_code_for_compile[]=$script; |
|
1305 | + } |
|
1276 | 1306 | return $script; |
1277 | 1307 | } |
1278 | 1308 | |
@@ -1291,7 +1321,9 @@ discard block |
||
1291 | 1321 | } |
1292 | 1322 | |
1293 | 1323 | private function minify($input) { |
1294 | - if(trim($input) === "") return $input; |
|
1324 | + if(trim($input) === "") { |
|
1325 | + return $input; |
|
1326 | + } |
|
1295 | 1327 | return preg_replace( |
1296 | 1328 | array( |
1297 | 1329 | // Remove comment(s) |
@@ -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,$startIndex=0,$hrefFunction=NULL){ |
|
320 | - return $this->addHtmlComponent(new HtmlBreadcrumbs($identifier,$elements,$autoActive,$startIndex,$hrefFunction)); |
|
319 | + public function htmlBreadcrumbs($identifier, $elements=array(), $autoActive=true, $startIndex=0, $hrefFunction=NULL) { |
|
320 | + return $this->addHtmlComponent(new HtmlBreadcrumbs($identifier, $elements, $autoActive, $startIndex, $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 | /** |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | * @param int $numCols |
342 | 342 | * @return HtmlGridSystem |
343 | 343 | */ |
344 | - public function htmlGridSystem($identifier,$numRows=1,$numCols=NULL){ |
|
345 | - return $this->addHtmlComponent(new HtmlGridSystem($identifier,$numRows,$numCols)); |
|
344 | + public function htmlGridSystem($identifier, $numRows=1, $numCols=NULL) { |
|
345 | + return $this->addHtmlComponent(new HtmlGridSystem($identifier, $numRows, $numCols)); |
|
346 | 346 | } |
347 | 347 | } |
348 | 348 | \ No newline at end of file |