@@ -719,6 +719,9 @@ discard block |
||
| 719 | 719 | return $this->_create_json($json_result, $match_array_type); |
| 720 | 720 | } |
| 721 | 721 | |
| 722 | + /** |
|
| 723 | + * @param boolean $match_array_type |
|
| 724 | + */ |
|
| 722 | 725 | private function _create_json($json_result, $match_array_type) { |
| 723 | 726 | $json=array (); |
| 724 | 727 | $_is_assoc=TRUE; |
@@ -742,7 +745,7 @@ discard block |
||
| 742 | 745 | * Checks for an associative array |
| 743 | 746 | * |
| 744 | 747 | * @param type |
| 745 | - * @return type |
|
| 748 | + * @return boolean |
|
| 746 | 749 | */ |
| 747 | 750 | public function _is_associative_array($arr) { |
| 748 | 751 | foreach ( array_keys($arr) as $key => $val ) { |
@@ -50,8 +50,9 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | protected function _setDi($di) { |
| 52 | 52 | $this->_di=$di; |
| 53 | - if ($this->js!=null&&$di!=null) |
|
| 54 | - $this->js->setDi($di); |
|
| 53 | + if ($this->js!=null&&$di!=null) { |
|
| 54 | + $this->js->setDi($di); |
|
| 55 | + } |
|
| 55 | 56 | } |
| 56 | 57 | |
| 57 | 58 | /** |
@@ -1130,12 +1131,14 @@ discard block |
||
| 1130 | 1131 | $result[1]=$cdn; |
| 1131 | 1132 | break; |
| 1132 | 1133 | case "Ajax\lib\CDNCoreCss": |
| 1133 | - if($cdn->getFramework()==="Bootstrap") |
|
| 1134 | - $hasBootstrap=true; |
|
| 1135 | - elseif($cdn->getFramework()==="Semantic") |
|
| 1136 | - $hasSemantic=true; |
|
| 1137 | - if($hasSemantic || $hasBootstrap) |
|
| 1138 | - $result[2]=$cdn; |
|
| 1134 | + if($cdn->getFramework()==="Bootstrap") { |
|
| 1135 | + $hasBootstrap=true; |
|
| 1136 | + } elseif($cdn->getFramework()==="Semantic") { |
|
| 1137 | + $hasSemantic=true; |
|
| 1138 | + } |
|
| 1139 | + if($hasSemantic || $hasBootstrap) { |
|
| 1140 | + $result[2]=$cdn; |
|
| 1141 | + } |
|
| 1139 | 1142 | break; |
| 1140 | 1143 | } |
| 1141 | 1144 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * JsUtils Class : Phalcon service to be injected |
| 26 | 26 | */ |
| 27 | 27 | abstract class _JsUtils implements InjectionAwareInterface { |
| 28 | - use JsUtilsEventsTrait,JsUtilsActionsTrait,JsUtilsAjaxTrait; |
|
| 28 | + use JsUtilsEventsTrait, JsUtilsActionsTrait, JsUtilsAjaxTrait; |
|
| 29 | 29 | |
| 30 | 30 | protected $_di; |
| 31 | 31 | protected $js; |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | protected function _setDi($di) { |
| 56 | 56 | $this->_di=$di; |
| 57 | - if ($this->js!=null&&$di!=null) |
|
| 57 | + if ($this->js!=null && $di!=null) |
|
| 58 | 58 | $this->js->setDi($di); |
| 59 | 59 | } |
| 60 | 60 | |
@@ -147,18 +147,18 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | |
| 149 | 149 | public function __construct($params=array()) { |
| 150 | - $defaults=array ( |
|
| 150 | + $defaults=array( |
|
| 151 | 151 | 'driver' => 'Jquery', |
| 152 | 152 | 'debug' => true |
| 153 | 153 | ); |
| 154 | - foreach ( $defaults as $key => $val ) { |
|
| 155 | - if (isset($params[$key])&&$params[$key]!=="") { |
|
| 154 | + foreach ($defaults as $key => $val) { |
|
| 155 | + if (isset($params[$key]) && $params[$key]!=="") { |
|
| 156 | 156 | $defaults[$key]=$params[$key]; |
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | extract($defaults); |
| 160 | 160 | $this->js=new Jquery($defaults); |
| 161 | - $this->cdns=array (); |
|
| 161 | + $this->cdns=array(); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | public function addToCompile($jsScript) { |
@@ -196,11 +196,11 @@ discard block |
||
| 196 | 196 | */ |
| 197 | 197 | public function compile($view=NULL, $view_var='script_foot', $script_tags=TRUE) { |
| 198 | 198 | $bs=$this->_bootstrap; |
| 199 | - if (isset($bs)&&isset($view)) { |
|
| 199 | + if (isset($bs) && isset($view)) { |
|
| 200 | 200 | $bs->compileHtml($this, $view); |
| 201 | 201 | } |
| 202 | 202 | $sem=$this->_semantic; |
| 203 | - if (isset($sem)&&isset($view)) { |
|
| 203 | + if (isset($sem) && isset($view)) { |
|
| 204 | 204 | $sem->compileHtml($this, $view); |
| 205 | 205 | } |
| 206 | 206 | return $this->js->_compile($view, $view_var, $script_tags); |
@@ -280,27 +280,27 @@ discard block |
||
| 280 | 280 | $json_result=$result->result_array(); |
| 281 | 281 | } elseif (is_array($result)) { |
| 282 | 282 | $json_result=$result; |
| 283 | - } else { |
|
| 283 | + }else { |
|
| 284 | 284 | return $this->_prep_args($result); |
| 285 | 285 | } |
| 286 | - } else { |
|
| 286 | + }else { |
|
| 287 | 287 | return 'null'; |
| 288 | 288 | } |
| 289 | 289 | return $this->_create_json($json_result, $match_array_type); |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | private function _create_json($json_result, $match_array_type) { |
| 293 | - $json=array (); |
|
| 293 | + $json=array(); |
|
| 294 | 294 | $_is_assoc=TRUE; |
| 295 | - if (!is_array($json_result)&&empty($json_result)) { |
|
| 295 | + if (!is_array($json_result) && empty($json_result)) { |
|
| 296 | 296 | show_error("Generate JSON Failed - Illegal key, value pair."); |
| 297 | 297 | } elseif ($match_array_type) { |
| 298 | 298 | $_is_assoc=$this->_is_associative_array($json_result); |
| 299 | 299 | } |
| 300 | - foreach ( $json_result as $k => $v ) { |
|
| 300 | + foreach ($json_result as $k => $v) { |
|
| 301 | 301 | if ($_is_assoc) { |
| 302 | 302 | $json[]=$this->_prep_args($k, TRUE).':'.$this->generate_json($v, $match_array_type); |
| 303 | - } else { |
|
| 303 | + }else { |
|
| 304 | 304 | $json[]=$this->generate_json($v, $match_array_type); |
| 305 | 305 | } |
| 306 | 306 | } |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | * @return type |
| 316 | 316 | */ |
| 317 | 317 | public function _is_associative_array($arr) { |
| 318 | - foreach ( array_keys($arr) as $key => $val ) { |
|
| 318 | + foreach (array_keys($arr) as $key => $val) { |
|
| 319 | 319 | if ($key!==$val) { |
| 320 | 320 | return TRUE; |
| 321 | 321 | } |
@@ -334,11 +334,11 @@ discard block |
||
| 334 | 334 | return 'null'; |
| 335 | 335 | } elseif (is_bool($result)) { |
| 336 | 336 | return ($result===TRUE) ? 'true' : 'false'; |
| 337 | - } elseif (is_string($result)||$is_key) { |
|
| 338 | - return '"'.str_replace(array ( |
|
| 339 | - '\\',"\t","\n","\r",'"','/' |
|
| 340 | - ), array ( |
|
| 341 | - '\\\\','\\t','\\n',"\\r",'\"','\/' |
|
| 337 | + } elseif (is_string($result) || $is_key) { |
|
| 338 | + return '"'.str_replace(array( |
|
| 339 | + '\\', "\t", "\n", "\r", '"', '/' |
|
| 340 | + ), array( |
|
| 341 | + '\\\\', '\\t', '\\n', "\\r", '\"', '\/' |
|
| 342 | 342 | ), $result).'"'; |
| 343 | 343 | } elseif (is_scalar($result)) { |
| 344 | 344 | return $result; |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | |
| 352 | 352 | public function setCDNs($cdns) { |
| 353 | 353 | if (is_array($cdns)===false) { |
| 354 | - $cdns=array ( |
|
| 354 | + $cdns=array( |
|
| 355 | 355 | $cdns |
| 356 | 356 | ); |
| 357 | 357 | } |
@@ -363,9 +363,9 @@ discard block |
||
| 363 | 363 | $hasJQueryUI=false; |
| 364 | 364 | $hasBootstrap=false; |
| 365 | 365 | $hasSemantic=false; |
| 366 | - $result=array (); |
|
| 367 | - foreach ( $this->cdns as $cdn ) { |
|
| 368 | - switch(get_class($cdn)) { |
|
| 366 | + $result=array(); |
|
| 367 | + foreach ($this->cdns as $cdn) { |
|
| 368 | + switch (get_class($cdn)) { |
|
| 369 | 369 | case "Ajax\lib\CDNJQuery": |
| 370 | 370 | $hasJQuery=true; |
| 371 | 371 | $result[0]=$cdn; |
@@ -375,11 +375,11 @@ discard block |
||
| 375 | 375 | $result[1]=$cdn; |
| 376 | 376 | break; |
| 377 | 377 | case "Ajax\lib\CDNCoreCss": |
| 378 | - if($cdn->getFramework()==="Bootstrap") |
|
| 378 | + if ($cdn->getFramework()==="Bootstrap") |
|
| 379 | 379 | $hasBootstrap=true; |
| 380 | - elseif($cdn->getFramework()==="Semantic") |
|
| 380 | + elseif ($cdn->getFramework()==="Semantic") |
|
| 381 | 381 | $hasSemantic=true; |
| 382 | - if($hasSemantic || $hasBootstrap) |
|
| 382 | + if ($hasSemantic || $hasBootstrap) |
|
| 383 | 383 | $result[2]=$cdn; |
| 384 | 384 | break; |
| 385 | 385 | } |
@@ -387,14 +387,14 @@ discard block |
||
| 387 | 387 | if ($hasJQuery===false) { |
| 388 | 388 | $result[0]=new CDNJQuery("x"); |
| 389 | 389 | } |
| 390 | - if ($hasJQueryUI===false&&isset($this->_ui)) { |
|
| 390 | + if ($hasJQueryUI===false && isset($this->_ui)) { |
|
| 391 | 391 | $result[1]=new CDNGuiGen("x", $template); |
| 392 | 392 | } |
| 393 | - if ($hasBootstrap===false&&isset($this->_bootstrap)) { |
|
| 394 | - $result[2]=new CDNCoreCss("Bootstrap","x"); |
|
| 393 | + if ($hasBootstrap===false && isset($this->_bootstrap)) { |
|
| 394 | + $result[2]=new CDNCoreCss("Bootstrap", "x"); |
|
| 395 | 395 | } |
| 396 | - if ($hasSemantic===false&&isset($this->_semantic)) { |
|
| 397 | - $result[2]=new CDNCoreCss("Semantic","x"); |
|
| 396 | + if ($hasSemantic===false && isset($this->_semantic)) { |
|
| 397 | + $result[2]=new CDNCoreCss("Semantic", "x"); |
|
| 398 | 398 | } |
| 399 | 399 | ksort($result); |
| 400 | 400 | return implode("\n", $result); |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | $this->_setDi($di); |
| 408 | 408 | } |
| 409 | 409 | } |
| 410 | -} else { |
|
| 410 | +}else { |
|
| 411 | 411 | class JsUtils extends _JsUtils { |
| 412 | 412 | |
| 413 | 413 | public function setDi(DiInterface $di) { |
@@ -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 | } |
| 143 | 143 | } |
@@ -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,8 +140,9 @@ 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; |
|
| 143 | + if($v>$this->value) { |
|
| 144 | + break; |
|
| 145 | + } |
|
| 142 | 146 | } |
| 143 | 147 | } |
| 144 | 148 | $this->style=$actualStyle; |
@@ -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 |
@@ -7,6 +7,9 @@ |
||
| 7 | 7 | |
| 8 | 8 | class PropertyWrapper { |
| 9 | 9 | |
| 10 | + /** |
|
| 11 | + * @param \Ajax\JsUtils $js |
|
| 12 | + */ |
|
| 10 | 13 | public static function wrap($input, $js=NULL, $separator=' ', $valueQuote='"') { |
| 11 | 14 | $output=""; |
| 12 | 15 | if (is_string($input)) { |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | $value1=reset($input); |
| 18 | 18 | if (is_object($value1)) { |
| 19 | 19 | $output=PropertyWrapper::wrapObjects($input, $js, $separator=' '); |
| 20 | - } else |
|
| 20 | + }else |
|
| 21 | 21 | $output=PropertyWrapper::wrapStrings($input, $separator=' ', $valueQuote='"'); |
| 22 | 22 | } |
| 23 | 23 | } |
@@ -26,17 +26,17 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | public static function wrapStrings($input, $separator=' ', $valueQuote='"') { |
| 28 | 28 | if (JArray::isAssociative($input)===true) { |
| 29 | - $result=implode($separator, array_map(function ($v, $k) use($valueQuote) { |
|
| 29 | + $result=implode($separator, array_map(function($v, $k) use($valueQuote) { |
|
| 30 | 30 | return $k.'='.$valueQuote.$v.$valueQuote; |
| 31 | 31 | }, $input, array_keys($input))); |
| 32 | - } else { |
|
| 32 | + }else { |
|
| 33 | 33 | $result=implode($separator, array_values($input)); |
| 34 | 34 | } |
| 35 | 35 | return $result; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | public static function wrapObjects($input, $js=NULL, $separator=' ') { |
| 39 | - return implode($separator, array_map(function ($v) use($js) { |
|
| 39 | + return implode($separator, array_map(function($v) use($js) { |
|
| 40 | 40 | return $v->compile($js); |
| 41 | 41 | }, $input)); |
| 42 | 42 | } |
@@ -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 |
@@ -23,19 +23,19 @@ |
||
| 23 | 23 | return $this; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function addGlyph($glyphicon,$before=true){ |
|
| 26 | + public function addGlyph($glyphicon, $before=true) { |
|
| 27 | 27 | $glyph=new HtmlGlyphicon(""); |
| 28 | 28 | $glyph->setGlyphicon($glyphicon); |
| 29 | - $this->addContent($glyph,$before); |
|
| 29 | + $this->addContent($glyph, $before); |
|
| 30 | 30 | return $this; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - public function wrapContentWithGlyph($glyphBefore,$glyphAfter=""){ |
|
| 33 | + public function wrapContentWithGlyph($glyphBefore, $glyphAfter="") { |
|
| 34 | 34 | $before=HtmlGlyphicon::getGlyphicon($glyphBefore)." "; |
| 35 | 35 | $after=""; |
| 36 | - if($glyphAfter!==""){ |
|
| 36 | + if ($glyphAfter!=="") { |
|
| 37 | 37 | $after=" ".HtmlGlyphicon::getGlyphicon($glyphAfter); |
| 38 | 38 | } |
| 39 | - return $this->wrapContent($before,$after); |
|
| 39 | + return $this->wrapContent($before, $after); |
|
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | \ No newline at end of file |
@@ -27,15 +27,15 @@ discard block |
||
| 27 | 27 | return $this->content; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - public function addContent($content,$before=false) { |
|
| 30 | + public function addContent($content, $before=false) { |
|
| 31 | 31 | if (is_array($this->content)===false) { |
| 32 | - if(isset($this->content)) |
|
| 33 | - $this->content=array ($this->content); |
|
| 32 | + if (isset($this->content)) |
|
| 33 | + $this->content=array($this->content); |
|
| 34 | 34 | else |
| 35 | 35 | $this->content=array(); |
| 36 | 36 | } |
| 37 | - if($before) |
|
| 38 | - array_unshift($this->content,$content); |
|
| 37 | + if ($before) |
|
| 38 | + array_unshift($this->content, $content); |
|
| 39 | 39 | else |
| 40 | 40 | $this->content []=$content; |
| 41 | 41 | return $this; |
@@ -49,8 +49,8 @@ discard block |
||
| 49 | 49 | parent::run($js); |
| 50 | 50 | if ($this->content instanceof HtmlDoubleElement) { |
| 51 | 51 | $this->content->run($js); |
| 52 | - } else if (is_array($this->content)) { |
|
| 53 | - foreach ( $this->content as $itemContent ) { |
|
| 52 | + }else if (is_array($this->content)) { |
|
| 53 | + foreach ($this->content as $itemContent) { |
|
| 54 | 54 | if ($itemContent instanceof HtmlDoubleElement) { |
| 55 | 55 | $itemContent->run($js); |
| 56 | 56 | } |
@@ -29,15 +29,17 @@ |
||
| 29 | 29 | |
| 30 | 30 | public function addContent($content,$before=false) { |
| 31 | 31 | if (is_array($this->content)===false) { |
| 32 | - if(isset($this->content)) |
|
| 33 | - $this->content=array ($this->content); |
|
| 34 | - else |
|
| 35 | - $this->content=array(); |
|
| 32 | + if(isset($this->content)) { |
|
| 33 | + $this->content=array ($this->content); |
|
| 34 | + } else { |
|
| 35 | + $this->content=array(); |
|
| 36 | + } |
|
| 37 | + } |
|
| 38 | + if($before) { |
|
| 39 | + array_unshift($this->content,$content); |
|
| 40 | + } else { |
|
| 41 | + $this->content []=$content; |
|
| 36 | 42 | } |
| 37 | - if($before) |
|
| 38 | - array_unshift($this->content,$content); |
|
| 39 | - else |
|
| 40 | - $this->content []=$content; |
|
| 41 | 43 | return $this; |
| 42 | 44 | } |
| 43 | 45 | |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | public function setClass($classNames) { |
| 16 | - if(is_array($classNames)){ |
|
| 16 | + if (is_array($classNames)) { |
|
| 17 | 17 | $classNames=implode(" ", $classNames); |
| 18 | 18 | } |
| 19 | 19 | $this->setProperty("class", $classNames); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function fromArray($array) { |
| 42 | 42 | $array=parent::fromArray($array); |
| 43 | - foreach ( $array as $key => $value ) { |
|
| 43 | + foreach ($array as $key => $value) { |
|
| 44 | 44 | $this->setProperty($key, $value); |
| 45 | 45 | } |
| 46 | 46 | return $array; |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | class HtmlOption extends HtmlDoubleElement { |
| 11 | 11 | protected $value; |
| 12 | 12 | protected $selected; |
| 13 | - public function __construct($identifier,$caption,$value="") { |
|
| 13 | + public function __construct($identifier, $caption, $value="") { |
|
| 14 | 14 | parent::__construct($identifier, "option"); |
| 15 | 15 | $this->_template='<option id="%identifier%" value="%value%" %selected% %properties%>%content%</option>'; |
| 16 | 16 | $this->content=$caption; |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | $this->selected=""; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function select(){ |
|
| 21 | + public function select() { |
|
| 22 | 22 | $this->selected="selected"; |
| 23 | 23 | return $this; |
| 24 | 24 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | return $this->value; |
| 28 | 28 | } |
| 29 | 29 | public function setValue($value) { |
| 30 | - $this->value = $value; |
|
| 30 | + $this->value=$value; |
|
| 31 | 31 | return $this; |
| 32 | 32 | } |
| 33 | 33 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | private $default; |
| 17 | 17 | private $options; |
| 18 | 18 | |
| 19 | - public function __construct($identifier, $caption,$default=NULL) { |
|
| 19 | + public function __construct($identifier, $caption, $default=NULL) { |
|
| 20 | 20 | parent::__construct($identifier, "select"); |
| 21 | 21 | $this->setProperty("name", $identifier); |
| 22 | 22 | $this->setProperty("class", "form-control"); |
@@ -25,21 +25,21 @@ discard block |
||
| 25 | 25 | $this->options=array(); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - public function addOption($element,$value="",$selected=false){ |
|
| 29 | - if($element instanceof HtmlOption){ |
|
| 28 | + public function addOption($element, $value="", $selected=false) { |
|
| 29 | + if ($element instanceof HtmlOption) { |
|
| 30 | 30 | $option=$element; |
| 31 | - }else{ |
|
| 32 | - $option=new HtmlOption($this->identifier."-".count($this->options), $element,$value); |
|
| 31 | + }else { |
|
| 32 | + $option=new HtmlOption($this->identifier."-".count($this->options), $element, $value); |
|
| 33 | 33 | } |
| 34 | - if($selected || $option->getValue()==$this->getProperty("value")){ |
|
| 34 | + if ($selected || $option->getValue()==$this->getProperty("value")) { |
|
| 35 | 35 | $option->select(); |
| 36 | 36 | } |
| 37 | 37 | $this->options[]=$option; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function setValue($value) { |
| 41 | - foreach ( $this->options as $option ) { |
|
| 42 | - if (strcasecmp($option->getValue(),$value)===0) { |
|
| 41 | + foreach ($this->options as $option) { |
|
| 42 | + if (strcasecmp($option->getValue(), $value)===0) { |
|
| 43 | 43 | $option->setProperty("selected", ""); |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -52,23 +52,23 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
| 54 | 54 | $this->content=array(); |
| 55 | - if(isset($this->default)){ |
|
| 55 | + if (isset($this->default)) { |
|
| 56 | 56 | $default=new HtmlOption("", $this->default); |
| 57 | 57 | $this->content[]=$default; |
| 58 | 58 | } |
| 59 | - foreach ($this->options as $option){ |
|
| 59 | + foreach ($this->options as $option) { |
|
| 60 | 60 | $this->content[]=$option; |
| 61 | 61 | } |
| 62 | 62 | return parent::compile($js, $view); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - public function fromArray($array){ |
|
| 66 | - if(JArray::isAssociative($array)){ |
|
| 67 | - foreach ($array as $k=>$v){ |
|
| 65 | + public function fromArray($array) { |
|
| 66 | + if (JArray::isAssociative($array)) { |
|
| 67 | + foreach ($array as $k=>$v) { |
|
| 68 | 68 | $this->addOption($v, $k); |
| 69 | 69 | } |
| 70 | - }else{ |
|
| 71 | - foreach ($array as $v){ |
|
| 70 | + }else { |
|
| 71 | + foreach ($array as $v) { |
|
| 72 | 72 | $this->addOption($v, $v); |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $this->addOption($function($object)); |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - public function setSize($size){ |
|
| 104 | + public function setSize($size) { |
|
| 105 | 105 | return $this->setProperty("size", $size); |
| 106 | 106 | } |
| 107 | 107 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | public function addOption($element,$value="",$selected=false){ |
| 29 | 29 | if($element instanceof HtmlOption){ |
| 30 | 30 | $option=$element; |
| 31 | - }else{ |
|
| 31 | + } else{ |
|
| 32 | 32 | $option=new HtmlOption($this->identifier."-".count($this->options), $element,$value); |
| 33 | 33 | } |
| 34 | 34 | if($selected || $option->getValue()==$this->getProperty("value")){ |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | foreach ($array as $k=>$v){ |
| 68 | 68 | $this->addOption($v, $k); |
| 69 | 69 | } |
| 70 | - }else{ |
|
| 70 | + } else{ |
|
| 71 | 71 | foreach ($array as $v){ |
| 72 | 72 | $this->addOption($v, $v); |
| 73 | 73 | } |