@@ -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 HtmlBsDoubleElement("","li"); |
|
| 86 | + $li=new HtmlBsDoubleElement("", "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,14 +197,14 @@ 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 | - foreach ($params as $p){ |
|
| 207 | - if(\is_object($p)==false) |
|
| 206 | + foreach ($params as $p) { |
|
| 207 | + if (\is_object($p)==false) |
|
| 208 | 208 | $items[]=$p; |
| 209 | 209 | } |
| 210 | 210 | } |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
| 219 | 219 | */ |
| 220 | 220 | public function setHrefFunction($_hrefFunction) { |
| 221 | - $this->_hrefFunction = $_hrefFunction; |
|
| 221 | + $this->_hrefFunction=$_hrefFunction; |
|
| 222 | 222 | return $this; |
| 223 | 223 | } |
| 224 | 224 | |
@@ -65,9 +65,9 @@ discard block |
||
| 65 | 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{ |
|
| 70 | + } else{ |
|
| 71 | 71 | $elm=new HtmlLink("lnk-".$this->identifier."-".$size,$href,$element); |
| 72 | 72 | if(isset($glyph)){ |
| 73 | 73 | $elm->wrapContentWithGlyph($glyph); |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | } |
| 115 | 115 | if($this->absolutePaths===true){ |
| 116 | 116 | return $this->_hrefFunction($this->content[$index]); |
| 117 | - }else{ |
|
| 117 | + } else{ |
|
| 118 | 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 | } |
@@ -204,8 +204,9 @@ discard block |
||
| 204 | 204 | if(\sizeof($params)>0 || \strtolower($action)!="index" ){ |
| 205 | 205 | $items[]=$action; |
| 206 | 206 | foreach ($params as $p){ |
| 207 | - if(\is_object($p)==false) |
|
| 208 | - $items[]=$p; |
|
| 207 | + if(\is_object($p)==false) { |
|
| 208 | + $items[]=$p; |
|
| 209 | + } |
|
| 209 | 210 | } |
| 210 | 211 | } |
| 211 | 212 | return $this->addElements($items); |
@@ -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 |
@@ -48,6 +48,9 @@ discard block |
||
| 48 | 48 | return $this; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | + /** |
|
| 52 | + * @param string $name |
|
| 53 | + */ |
|
| 51 | 54 | public function getProperty($name) { |
| 52 | 55 | if (array_key_exists($name, $this->properties)) |
| 53 | 56 | return $this->properties [$name]; |
@@ -128,6 +131,10 @@ discard block |
||
| 128 | 131 | return $this; |
| 129 | 132 | } |
| 130 | 133 | |
| 134 | + /** |
|
| 135 | + * @param string $name |
|
| 136 | + * @param string[] $typeCtrl |
|
| 137 | + */ |
|
| 131 | 138 | protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") { |
| 132 | 139 | if ($this->ctrl($name, $value, $typeCtrl)===true) { |
| 133 | 140 | if (is_array($typeCtrl)) { |
@@ -152,6 +159,9 @@ discard block |
||
| 152 | 159 | return $this->addToProperty($name, $value); |
| 153 | 160 | } |
| 154 | 161 | |
| 162 | + /** |
|
| 163 | + * @param string $name |
|
| 164 | + */ |
|
| 155 | 165 | public function addToPropertyCtrl($name, $value, $typeCtrl) { |
| 156 | 166 | // if($this->ctrl($name, $value, $typeCtrl)===true){ |
| 157 | 167 | return $this->addToPropertyUnique($name, $value, $typeCtrl); |
@@ -219,6 +229,9 @@ discard block |
||
| 219 | 229 | |
| 220 | 230 | } |
| 221 | 231 | |
| 232 | + /** |
|
| 233 | + * @param string $before |
|
| 234 | + */ |
|
| 222 | 235 | public function wrap($before, $after="") { |
| 223 | 236 | if(isset($before)){ |
| 224 | 237 | $this->wrapBefore.=$before; |
@@ -287,6 +300,9 @@ discard block |
||
| 287 | 300 | } |
| 288 | 301 | } |
| 289 | 302 | |
| 303 | + /** |
|
| 304 | + * @param string $operation |
|
| 305 | + */ |
|
| 290 | 306 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
| 291 | 307 | $params=array ( |
| 292 | 308 | "url" => $url, |
@@ -297,14 +313,23 @@ discard block |
||
| 297 | 313 | return $this; |
| 298 | 314 | } |
| 299 | 315 | |
| 316 | + /** |
|
| 317 | + * @param string $event |
|
| 318 | + */ |
|
| 300 | 319 | public function getOn($event, $url, $responseElement="", $parameters=array()) { |
| 301 | 320 | return $this->_ajaxOn("get", $event, $url, $responseElement, $parameters); |
| 302 | 321 | } |
| 303 | 322 | |
| 323 | + /** |
|
| 324 | + * @param string $url |
|
| 325 | + */ |
|
| 304 | 326 | public function getOnClick($url, $responseElement="", $parameters=array()) { |
| 305 | 327 | return $this->getOn("click", $url, $responseElement, $parameters); |
| 306 | 328 | } |
| 307 | 329 | |
| 330 | + /** |
|
| 331 | + * @param string $event |
|
| 332 | + */ |
|
| 308 | 333 | public function postOn($event, $url, $params="{}", $responseElement="", $parameters=array()) { |
| 309 | 334 | $parameters ["params"]=$params; |
| 310 | 335 | return $this->_ajaxOn("post", $event, $url, $responseElement, $parameters); |
@@ -314,6 +339,9 @@ discard block |
||
| 314 | 339 | return $this->postOn("click", $url, $params, $responseElement, $parameters); |
| 315 | 340 | } |
| 316 | 341 | |
| 342 | + /** |
|
| 343 | + * @param string $event |
|
| 344 | + */ |
|
| 317 | 345 | public function postFormOn($event, $url, $form, $responseElement="", $parameters=array()) { |
| 318 | 346 | $parameters ["form"]=$form; |
| 319 | 347 | return $this->_ajaxOn("postForm", $event, $url, $responseElement, $parameters); |
@@ -363,6 +391,9 @@ discard block |
||
| 363 | 391 | return $value; |
| 364 | 392 | } |
| 365 | 393 | |
| 394 | + /** |
|
| 395 | + * @param string $jqueryCall |
|
| 396 | + */ |
|
| 366 | 397 | public function jsDoJquery($jqueryCall, $param=""){ |
| 367 | 398 | return "$('#".$this->identifier."').".$jqueryCall."(".$this->_prep_value($param).");"; |
| 368 | 399 | } |
@@ -15,8 +15,8 @@ discard block |
||
| 15 | 15 | abstract class BaseHtml extends BaseWidget { |
| 16 | 16 | protected $_template; |
| 17 | 17 | protected $tagName; |
| 18 | - protected $properties=array (); |
|
| 19 | - protected $events=array (); |
|
| 18 | + protected $properties=array(); |
|
| 19 | + protected $events=array(); |
|
| 20 | 20 | protected $wrapBefore=""; |
| 21 | 21 | protected $wrapAfter=""; |
| 22 | 22 | protected $_bsComponent; |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | public function addToProperty($name, $value, $separator=" ") { |
| 57 | 57 | $v=$this->properties [$name]; |
| 58 | - if (isset($v)&&$v!=="") |
|
| 58 | + if (isset($v) && $v!=="") |
|
| 59 | 59 | $v=$v.$separator.$value; |
| 60 | 60 | else |
| 61 | 61 | $v=$value; |
@@ -70,11 +70,11 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
| 72 | 72 | $result=$this->getTemplate(); |
| 73 | - foreach ( $this as $key => $value ) { |
|
| 74 | - if (PhalconUtils::startsWith($key, "_")===false&&$key!=="events") { |
|
| 73 | + foreach ($this as $key => $value) { |
|
| 74 | + if (PhalconUtils::startsWith($key, "_")===false && $key!=="events") { |
|
| 75 | 75 | if (is_array($value)) { |
| 76 | 76 | $v=PropertyWrapper::wrap($value, $js); |
| 77 | - } else { |
|
| 77 | + }else { |
|
| 78 | 78 | $v=$value; |
| 79 | 79 | } |
| 80 | 80 | $result=str_ireplace("%".$key."%", $v, $result); |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | if (isset($view)===true) { |
| 87 | 87 | $controls=$view->getVar("q"); |
| 88 | 88 | if (isset($controls)===false) { |
| 89 | - $controls=array (); |
|
| 89 | + $controls=array(); |
|
| 90 | 90 | } |
| 91 | 91 | $controls [$this->identifier]=$result; |
| 92 | 92 | $view->setVar("q", $controls); |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | if (array_search($value, $typeCtrl)===false) { |
| 100 | 100 | throw new \Exception("La valeur passée a propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
| 101 | 101 | } |
| 102 | - } else { |
|
| 102 | + }else { |
|
| 103 | 103 | if (!$typeCtrl($value)) { |
| 104 | 104 | throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name); |
| 105 | 105 | } |
@@ -176,28 +176,28 @@ discard block |
||
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | public function fromArray($array) { |
| 179 | - foreach ( $this as $key => $value ) { |
|
| 179 | + foreach ($this as $key => $value) { |
|
| 180 | 180 | if (array_key_exists($key, $array) && !PhalconUtils::startsWith($key, "_")) { |
| 181 | 181 | $setter="set".ucfirst($key); |
| 182 | 182 | $this->$setter($array [$key]); |
| 183 | 183 | unset($array [$key]); |
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | - foreach ( $array as $key => $value ) { |
|
| 186 | + foreach ($array as $key => $value) { |
|
| 187 | 187 | if (method_exists($this, $key)) { |
| 188 | 188 | try { |
| 189 | 189 | $this->$key($value); |
| 190 | 190 | unset($array [$key]); |
| 191 | - } catch ( \Exception $e ) { |
|
| 191 | + } catch (\Exception $e) { |
|
| 192 | 192 | // Nothing to do |
| 193 | 193 | } |
| 194 | - } else { |
|
| 194 | + }else { |
|
| 195 | 195 | $setter="set".ucfirst($key); |
| 196 | 196 | if (method_exists($this, $setter)) { |
| 197 | 197 | try { |
| 198 | 198 | $this->$setter($value); |
| 199 | 199 | unset($array [$key]); |
| 200 | - } catch ( \Exception $e ) { |
|
| 200 | + } catch (\Exception $e) { |
|
| 201 | 201 | // Nothing to do |
| 202 | 202 | } |
| 203 | 203 | } |
@@ -206,21 +206,21 @@ discard block |
||
| 206 | 206 | return $array; |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - public function fromDatabaseObjects($objects,$function) { |
|
| 210 | - if(isset($objects)){ |
|
| 211 | - foreach ($objects as $object){ |
|
| 212 | - $this->fromDatabaseObject($object,$function); |
|
| 209 | + public function fromDatabaseObjects($objects, $function) { |
|
| 210 | + if (isset($objects)) { |
|
| 211 | + foreach ($objects as $object) { |
|
| 212 | + $this->fromDatabaseObject($object, $function); |
|
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | 215 | return $this; |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - public function fromDatabaseObject($object,$function){ |
|
| 218 | + public function fromDatabaseObject($object, $function) { |
|
| 219 | 219 | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | public function wrap($before, $after="") { |
| 223 | - if(isset($before)){ |
|
| 223 | + if (isset($before)) { |
|
| 224 | 224 | $this->wrapBefore.=$before; |
| 225 | 225 | } |
| 226 | 226 | $this->wrapAfter=$after.$this->wrapAfter; |
@@ -242,13 +242,13 @@ discard block |
||
| 242 | 242 | if (array_key_exists($event, $this->events)) { |
| 243 | 243 | if (is_array($this->events [$event])) { |
| 244 | 244 | $this->events [$event] []=$jsCode; |
| 245 | - } else { |
|
| 246 | - $this->events [$event]=array ( |
|
| 245 | + }else { |
|
| 246 | + $this->events [$event]=array( |
|
| 247 | 247 | $this->events [$event], |
| 248 | 248 | $jsCode |
| 249 | 249 | ); |
| 250 | 250 | } |
| 251 | - } else { |
|
| 251 | + }else { |
|
| 252 | 252 | $this->events [$event]=$jsCode; |
| 253 | 253 | } |
| 254 | 254 | } |
@@ -267,14 +267,14 @@ discard block |
||
| 267 | 267 | |
| 268 | 268 | public function addEventsOnRun(JsUtils $js) { |
| 269 | 269 | if (isset($this->_bsComponent)) { |
| 270 | - foreach ( $this->events as $event => $jsCode ) { |
|
| 270 | + foreach ($this->events as $event => $jsCode) { |
|
| 271 | 271 | $code=$jsCode; |
| 272 | 272 | if (is_array($jsCode)) { |
| 273 | 273 | $code=""; |
| 274 | - foreach ( $jsCode as $jsC ) { |
|
| 274 | + foreach ($jsCode as $jsC) { |
|
| 275 | 275 | if ($jsC instanceof AjaxCall) { |
| 276 | 276 | $code.="\n".$jsC->compile($js); |
| 277 | - } else { |
|
| 277 | + }else { |
|
| 278 | 278 | $code.="\n".$jsC; |
| 279 | 279 | } |
| 280 | 280 | } |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
| 291 | - $params=array ( |
|
| 291 | + $params=array( |
|
| 292 | 292 | "url" => $url, |
| 293 | 293 | "responseElement" => $responseElement |
| 294 | 294 | ); |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | if (is_array($elements)) { |
| 328 | 328 | $flag=false; |
| 329 | 329 | $index=0; |
| 330 | - while ( !$flag&&$index<sizeof($elements) ) { |
|
| 330 | + while (!$flag && $index<sizeof($elements)) { |
|
| 331 | 331 | if ($elements [$index] instanceof BaseHtml) |
| 332 | 332 | $flag=($elements [$index]->getIdentifier()===$identifier); |
| 333 | 333 | $index++; |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | return null; |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | - public function __toString(){ |
|
| 344 | + public function __toString() { |
|
| 345 | 345 | return $this->compile(); |
| 346 | 346 | } |
| 347 | 347 | |
@@ -357,25 +357,25 @@ discard block |
||
| 357 | 357 | if (is_array($value)) { |
| 358 | 358 | $value=implode(",", $value); |
| 359 | 359 | } |
| 360 | - if (strrpos($value, 'this')===false&&strrpos($value, 'event')===false) { |
|
| 360 | + if (strrpos($value, 'this')===false && strrpos($value, 'event')===false) { |
|
| 361 | 361 | $value='"'.$value.'"'; |
| 362 | 362 | } |
| 363 | 363 | return $value; |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | - public function jsDoJquery($jqueryCall, $param=""){ |
|
| 366 | + public function jsDoJquery($jqueryCall, $param="") { |
|
| 367 | 367 | return "$('#".$this->identifier."').".$jqueryCall."(".$this->_prep_value($param).");"; |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | - public function jsHtml($content=""){ |
|
| 371 | - return $this->jsDoJquery("html",$content); |
|
| 370 | + public function jsHtml($content="") { |
|
| 371 | + return $this->jsDoJquery("html", $content); |
|
| 372 | 372 | } |
| 373 | 373 | |
| 374 | - public function jsShow(){ |
|
| 374 | + public function jsShow() { |
|
| 375 | 375 | return $this->jsDoJquery("show"); |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | - public function jsHide(){ |
|
| 378 | + public function jsHide() { |
|
| 379 | 379 | return $this->jsDoJquery("hide"); |
| 380 | 380 | } |
| 381 | 381 | } |
| 382 | 382 | \ No newline at end of file |
@@ -49,16 +49,18 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | public function getProperty($name) { |
| 52 | - if (array_key_exists($name, $this->properties)) |
|
| 53 | - return $this->properties [$name]; |
|
| 52 | + if (array_key_exists($name, $this->properties)) { |
|
| 53 | + return $this->properties [$name]; |
|
| 54 | + } |
|
| 54 | 55 | } |
| 55 | 56 | |
| 56 | 57 | public function addToProperty($name, $value, $separator=" ") { |
| 57 | 58 | $v=$this->properties [$name]; |
| 58 | - if (isset($v)&&$v!=="") |
|
| 59 | - $v=$v.$separator.$value; |
|
| 60 | - else |
|
| 61 | - $v=$value; |
|
| 59 | + if (isset($v)&&$v!=="") { |
|
| 60 | + $v=$v.$separator.$value; |
|
| 61 | + } else { |
|
| 62 | + $v=$value; |
|
| 63 | + } |
|
| 62 | 64 | |
| 63 | 65 | return $this->setProperty($name, $v); |
| 64 | 66 | } |
@@ -108,8 +110,9 @@ discard block |
||
| 108 | 110 | } |
| 109 | 111 | |
| 110 | 112 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
| 111 | - if ($this->ctrl($name, $value, $typeCtrl)===true) |
|
| 112 | - return $this->setProperty($name, $value); |
|
| 113 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
| 114 | + return $this->setProperty($name, $value); |
|
| 115 | + } |
|
| 113 | 116 | return $this; |
| 114 | 117 | } |
| 115 | 118 | |
@@ -144,8 +147,9 @@ discard block |
||
| 144 | 147 | } |
| 145 | 148 | |
| 146 | 149 | protected function addToPropertyUnique($name, $value, $typeCtrl) { |
| 147 | - if (@class_exists($typeCtrl, true)) |
|
| 148 | - $typeCtrl=$typeCtrl::getConstants(); |
|
| 150 | + if (@class_exists($typeCtrl, true)) { |
|
| 151 | + $typeCtrl=$typeCtrl::getConstants(); |
|
| 152 | + } |
|
| 149 | 153 | if (is_array($typeCtrl)) { |
| 150 | 154 | $this->removeOldValues($this->properties [$name], $typeCtrl); |
| 151 | 155 | } |
@@ -326,15 +330,18 @@ discard block |
||
| 326 | 330 | $flag=false; |
| 327 | 331 | $index=0; |
| 328 | 332 | while ( !$flag&&$index<sizeof($elements) ) { |
| 329 | - if ($elements [$index] instanceof BaseHtml) |
|
| 330 | - $flag=($elements [$index]->getIdentifier()===$identifier); |
|
| 333 | + if ($elements [$index] instanceof BaseHtml) { |
|
| 334 | + $flag=($elements [$index]->getIdentifier()===$identifier); |
|
| 335 | + } |
|
| 331 | 336 | $index++; |
| 332 | 337 | } |
| 333 | - if ($flag===true) |
|
| 334 | - return $elements [$index-1]; |
|
| 338 | + if ($flag===true) { |
|
| 339 | + return $elements [$index-1]; |
|
| 340 | + } |
|
| 335 | 341 | } elseif ($elements instanceof BaseHtml) { |
| 336 | - if ($elements->getIdentifier()===$identifier) |
|
| 337 | - return $elements; |
|
| 342 | + if ($elements->getIdentifier()===$identifier) { |
|
| 343 | + return $elements; |
|
| 344 | + } |
|
| 338 | 345 | } |
| 339 | 346 | return null; |
| 340 | 347 | } |
@@ -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 |
@@ -40,6 +40,7 @@ |
||
| 40 | 40 | /** |
| 41 | 41 | * {@inheritDoc} |
| 42 | 42 | * @see \Ajax\common\html\HtmlSingleElement::setSize() |
| 43 | + * @param string $size |
|
| 43 | 44 | */ |
| 44 | 45 | public function setSize($size) { |
| 45 | 46 | $this->setMemberCtrl($this->size, $size,IconSize::getConstants()); |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | protected $attributes; |
| 18 | 18 | protected $color; |
| 19 | 19 | |
| 20 | - public function __construct($identifier,$icon) { |
|
| 20 | + public function __construct($identifier, $icon) { |
|
| 21 | 21 | parent::__construct($identifier, "i"); |
| 22 | 22 | $this->icon=$icon; |
| 23 | 23 | $this->_template='<i class="%icon% icon %size% %attributes% %color%"></i>'; |
@@ -42,11 +42,11 @@ discard block |
||
| 42 | 42 | * @see \Ajax\common\html\HtmlSingleElement::setSize() |
| 43 | 43 | */ |
| 44 | 44 | public function setSize($size) { |
| 45 | - $this->setMemberCtrl($this->size, $size,IconSize::getConstants()); |
|
| 45 | + $this->setMemberCtrl($this->size, $size, IconSize::getConstants()); |
|
| 46 | 46 | return $this; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - public function setDisabled(){ |
|
| 49 | + public function setDisabled() { |
|
| 50 | 50 | return $this->addToMember($this->attributes, "disabled"); |
| 51 | 51 | } |
| 52 | 52 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * Icon used as a simple loader |
| 55 | 55 | * @return \Ajax\semantic\html\HtmlIcon |
| 56 | 56 | */ |
| 57 | - public function asLoader(){ |
|
| 57 | + public function asLoader() { |
|
| 58 | 58 | return $this->addToMember($this->attributes, "loading"); |
| 59 | 59 | } |
| 60 | 60 | |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * An icon can be fitted, without any space to the left or right of it. |
| 63 | 63 | * @return \Ajax\semantic\html\HtmlIcon |
| 64 | 64 | */ |
| 65 | - public function setFitted(){ |
|
| 65 | + public function setFitted() { |
|
| 66 | 66 | return $this->addToMember($this->attributes, "fitted"); |
| 67 | 67 | } |
| 68 | 68 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * @param string $sens horizontally or vertically |
| 71 | 71 | * @return \Ajax\semantic\html\HtmlIcon |
| 72 | 72 | */ |
| 73 | - public function setFlipped($sens="horizontally"){ |
|
| 73 | + public function setFlipped($sens="horizontally") { |
|
| 74 | 74 | return $this->addToMember($this->attributes, "flipped ".$sens); |
| 75 | 75 | } |
| 76 | 76 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * @param string $sens clockwise or counterclockwise |
| 79 | 79 | * @return \Ajax\semantic\html\HtmlIcon |
| 80 | 80 | */ |
| 81 | - public function setRotated($sens="clockwise"){ |
|
| 81 | + public function setRotated($sens="clockwise") { |
|
| 82 | 82 | return $this->addToMember($this->attributes, "rotated ".$sens); |
| 83 | 83 | } |
| 84 | 84 | |
@@ -86,13 +86,13 @@ discard block |
||
| 86 | 86 | * icon formatted as a link |
| 87 | 87 | * @return \Ajax\semantic\html\HtmlIcon |
| 88 | 88 | */ |
| 89 | - public function asLink(){ |
|
| 89 | + public function asLink() { |
|
| 90 | 90 | return $this->addToMember($this->attributes, "link"); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - public function setCircular($inverted=false){ |
|
| 93 | + public function setCircular($inverted=false) { |
|
| 94 | 94 | $invertedStr=""; |
| 95 | - if($inverted) |
|
| 95 | + if ($inverted) |
|
| 96 | 96 | $invertedStr=" inverted"; |
| 97 | 97 | return $this->addToMember($this->attributes, "circular".$invertedStr); |
| 98 | 98 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | /** |
| 101 | 101 | * @return \Ajax\semantic\html\HtmlIcon |
| 102 | 102 | */ |
| 103 | - public function setInverted(){ |
|
| 103 | + public function setInverted() { |
|
| 104 | 104 | return $this->addToMember($this->attributes, "inverted"); |
| 105 | 105 | } |
| 106 | 106 | |
@@ -108,9 +108,9 @@ discard block |
||
| 108 | 108 | * @param string $inverted |
| 109 | 109 | * @return \Ajax\semantic\html\HtmlIcon |
| 110 | 110 | */ |
| 111 | - public function setBordered($inverted=false){ |
|
| 111 | + public function setBordered($inverted=false) { |
|
| 112 | 112 | $invertedStr=""; |
| 113 | - if($inverted) |
|
| 113 | + if ($inverted) |
|
| 114 | 114 | $invertedStr=" inverted"; |
| 115 | 115 | return $this->addToMember($this->attributes, "bordered".$invertedStr); |
| 116 | 116 | } |
@@ -119,14 +119,14 @@ discard block |
||
| 119 | 119 | * @param string $color |
| 120 | 120 | * @return \Ajax\semantic\html\HtmlIcon |
| 121 | 121 | */ |
| 122 | - public function setColor($color){ |
|
| 122 | + public function setColor($color) { |
|
| 123 | 123 | return $this->setMemberCtrl($this->color, $color, Color::getConstants()); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /** |
| 127 | 127 | * @return \Ajax\semantic\html\HtmlIcon |
| 128 | 128 | */ |
| 129 | - public function toCorner(){ |
|
| 129 | + public function toCorner() { |
|
| 130 | 130 | return $this->addToMember($this->attributes, "corner"); |
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | \ No newline at end of file |
@@ -92,8 +92,9 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | public function setCircular($inverted=false){ |
| 94 | 94 | $invertedStr=""; |
| 95 | - if($inverted) |
|
| 96 | - $invertedStr=" inverted"; |
|
| 95 | + if($inverted) { |
|
| 96 | + $invertedStr=" inverted"; |
|
| 97 | + } |
|
| 97 | 98 | return $this->addToMember($this->attributes, "circular".$invertedStr); |
| 98 | 99 | } |
| 99 | 100 | |
@@ -110,8 +111,9 @@ discard block |
||
| 110 | 111 | */ |
| 111 | 112 | public function setBordered($inverted=false){ |
| 112 | 113 | $invertedStr=""; |
| 113 | - if($inverted) |
|
| 114 | - $invertedStr=" inverted"; |
|
| 114 | + if($inverted) { |
|
| 115 | + $invertedStr=" inverted"; |
|
| 116 | + } |
|
| 115 | 117 | return $this->addToMember($this->attributes, "bordered".$invertedStr); |
| 116 | 118 | } |
| 117 | 119 | |
@@ -26,18 +26,18 @@ |
||
| 26 | 26 | return $this->addHtmlComponent(new HtmlButton($identifier, $value, $cssStyle, $onClick)); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - public function htmlIcon($identifier,$icon){ |
|
| 29 | + public function htmlIcon($identifier, $icon) { |
|
| 30 | 30 | return $this->addHtmlComponent(new HtmlIcon($identifier, $icon)); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - public function htmlGroupIcons($identifier,$size="",$icons=array()){ |
|
| 34 | - $group=new HtmlGroupIcons($identifier,$size); |
|
| 35 | - if(JArray::isAssociative($icons)){ |
|
| 36 | - foreach ($icons as $icon=>$size){ |
|
| 37 | - $group->addIcon($icon,$size); |
|
| 33 | + public function htmlGroupIcons($identifier, $size="", $icons=array()) { |
|
| 34 | + $group=new HtmlGroupIcons($identifier, $size); |
|
| 35 | + if (JArray::isAssociative($icons)) { |
|
| 36 | + foreach ($icons as $icon=>$size) { |
|
| 37 | + $group->addIcon($icon, $size); |
|
| 38 | 38 | } |
| 39 | - }else{ |
|
| 40 | - foreach ($icons as $icon){ |
|
| 39 | + }else { |
|
| 40 | + foreach ($icons as $icon) { |
|
| 41 | 41 | $group->addIcon($icon); |
| 42 | 42 | } |
| 43 | 43 | } |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | foreach ($icons as $icon=>$size){ |
| 37 | 37 | $group->addIcon($icon,$size); |
| 38 | 38 | } |
| 39 | - }else{ |
|
| 39 | + } else{ |
|
| 40 | 40 | foreach ($icons as $icon){ |
| 41 | 41 | $group->addIcon($icon); |
| 42 | 42 | } |
@@ -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 | |