@@ -10,8 +10,9 @@ |
||
| 10 | 10 | use TextFieldsTrait; |
| 11 | 11 | |
| 12 | 12 | public function __construct($identifier, $label=NULL,$value=NULL,$placeholder=NULL,$rows=NULL) { |
| 13 | - if(!isset($placeholder)) |
|
| 14 | - $placeholder=$label; |
|
| 13 | + if(!isset($placeholder)) { |
|
| 14 | + $placeholder=$label; |
|
| 15 | + } |
|
| 15 | 16 | parent::__construct("field-".$identifier, new HtmlTextarea($identifier,$value,$placeholder,$rows), $label); |
| 16 | 17 | $this->_identifier=$identifier; |
| 17 | 18 | } |
@@ -47,8 +47,9 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | public function setVariations($variations) { |
| 49 | 49 | $this->setProperty("class", $this->_baseClass); |
| 50 | - if (\is_string($variations)) |
|
| 51 | - $variations=\explode(" ", $variations); |
|
| 50 | + if (\is_string($variations)) { |
|
| 51 | + $variations=\explode(" ", $variations); |
|
| 52 | + } |
|
| 52 | 53 | foreach ( $variations as $variation ) { |
| 53 | 54 | $this->addVariation($variation); |
| 54 | 55 | } |
@@ -61,8 +62,9 @@ discard block |
||
| 61 | 62 | } |
| 62 | 63 | |
| 63 | 64 | public function addVariations($variations=array()) { |
| 64 | - if (\is_string($variations)) |
|
| 65 | - $variations=\explode(" ", $variations); |
|
| 65 | + if (\is_string($variations)) { |
|
| 66 | + $variations=\explode(" ", $variations); |
|
| 67 | + } |
|
| 66 | 68 | foreach ( $variations as $variation ) { |
| 67 | 69 | $this->addVariation($variation); |
| 68 | 70 | } |
@@ -70,8 +72,9 @@ discard block |
||
| 70 | 72 | } |
| 71 | 73 | |
| 72 | 74 | public function addStates($states=array()) { |
| 73 | - if (\is_string($states)) |
|
| 74 | - $states=\explode(" ", $states); |
|
| 75 | + if (\is_string($states)) { |
|
| 76 | + $states=\explode(" ", $states); |
|
| 77 | + } |
|
| 75 | 78 | foreach ( $states as $state ) { |
| 76 | 79 | $this->addState($state); |
| 77 | 80 | } |
@@ -80,8 +83,9 @@ discard block |
||
| 80 | 83 | |
| 81 | 84 | public function setStates($states) { |
| 82 | 85 | $this->setProperty("class", $this->_baseClass); |
| 83 | - if (\is_string($states)) |
|
| 84 | - $states=\explode(" ", $states); |
|
| 86 | + if (\is_string($states)) { |
|
| 87 | + $states=\explode(" ", $states); |
|
| 88 | + } |
|
| 85 | 89 | foreach ( $states as $state ) { |
| 86 | 90 | $this->addState($state); |
| 87 | 91 | } |
@@ -113,8 +117,9 @@ discard block |
||
| 113 | 117 | * @return HtmlSemDoubleElement |
| 114 | 118 | */ |
| 115 | 119 | public function setDisabled($disable=true) { |
| 116 | - if($disable) |
|
| 117 | - $this->addToProperty("class", "disabled"); |
|
| 120 | + if($disable) { |
|
| 121 | + $this->addToProperty("class", "disabled"); |
|
| 122 | + } |
|
| 118 | 123 | return $this; |
| 119 | 124 | } |
| 120 | 125 | |
@@ -148,14 +153,16 @@ discard block |
||
| 148 | 153 | * @return HtmlSemDoubleElement |
| 149 | 154 | */ |
| 150 | 155 | public function setActive($value=true){ |
| 151 | - if($value) |
|
| 152 | - $this->addToProperty("class", "active"); |
|
| 156 | + if($value) { |
|
| 157 | + $this->addToProperty("class", "active"); |
|
| 158 | + } |
|
| 153 | 159 | return $this; |
| 154 | 160 | } |
| 155 | 161 | |
| 156 | 162 | public function setAttached($value=true){ |
| 157 | - if($value) |
|
| 158 | - $this->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
| 163 | + if($value) { |
|
| 164 | + $this->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
| 165 | + } |
|
| 159 | 166 | return $this; |
| 160 | 167 | } |
| 161 | 168 | |
@@ -191,10 +198,12 @@ discard block |
||
| 191 | 198 | if(isset($array[$key])){ |
| 192 | 199 | $p=JString::replaceAtFirstAndLast($array[$key], $before, "", $after, ""); |
| 193 | 200 | $array[$key]=$before.$p.$value.$after; |
| 194 | - }else |
|
| 195 | - $array[$key]=$before.$value.$after; |
|
| 196 | - }else |
|
| 197 | - $array[$key]=$value; |
|
| 201 | + } else { |
|
| 202 | + $array[$key]=$before.$value.$after; |
|
| 203 | + } |
|
| 204 | + } else { |
|
| 205 | + $array[$key]=$value; |
|
| 206 | + } |
|
| 198 | 207 | return $this; |
| 199 | 208 | } |
| 200 | 209 | } |
| 201 | 210 | \ No newline at end of file |
@@ -47,10 +47,12 @@ discard block |
||
| 47 | 47 | $js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');",["preventDefault"=>false,"stopPropagation"=>true]); |
| 48 | 48 | $js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');",["preventDefault"=>false,"stopPropagation"=>true]); |
| 49 | 49 | } |
| 50 | - if(\is_array($this->_deleteBehavior)) |
|
| 51 | - $this->_generateBehavior("delete",$this->_deleteBehavior, $js); |
|
| 52 | - if(\is_array($this->_editBehavior)) |
|
| 53 | - $this->_generateBehavior("edit",$this->_editBehavior,$js); |
|
| 50 | + if(\is_array($this->_deleteBehavior)) { |
|
| 51 | + $this->_generateBehavior("delete",$this->_deleteBehavior, $js); |
|
| 52 | + } |
|
| 53 | + if(\is_array($this->_editBehavior)) { |
|
| 54 | + $this->_generateBehavior("edit",$this->_editBehavior,$js); |
|
| 55 | + } |
|
| 54 | 56 | return parent::run($js); |
| 55 | 57 | } |
| 56 | 58 | |
@@ -85,12 +87,14 @@ discard block |
||
| 85 | 87 | |
| 86 | 88 | $table->setRowCount(0, \sizeof($captions)); |
| 87 | 89 | $table->setHeaderValues($captions); |
| 88 | - if(isset($this->_compileParts)) |
|
| 89 | - $table->setCompileParts($this->_compileParts); |
|
| 90 | + if(isset($this->_compileParts)) { |
|
| 91 | + $table->setCompileParts($this->_compileParts); |
|
| 92 | + } |
|
| 90 | 93 | |
| 91 | 94 | if(isset($this->_searchField) && isset($js)){ |
| 92 | - if(isset($this->_urls["refresh"])) |
|
| 93 | - $this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]); |
|
| 95 | + if(isset($this->_urls["refresh"])) { |
|
| 96 | + $this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]); |
|
| 97 | + } |
|
| 94 | 98 | } |
| 95 | 99 | |
| 96 | 100 | $this->_generateContent($table); |
@@ -145,8 +149,9 @@ discard block |
||
| 145 | 149 | $menu->floatRight(); |
| 146 | 150 | $menu->setActiveItem($this->_pagination->getPage()-1); |
| 147 | 151 | $footer->setValues($menu); |
| 148 | - if(isset($this->_urls["refresh"])) |
|
| 149 | - $menu->postOnClick($this->_urls["refresh"],"{'p':$(this).attr('data-page')}",$this->getRefreshSelector(),["preventDefault"=>false,"jqueryDone"=>"replaceWith"]); |
|
| 152 | + if(isset($this->_urls["refresh"])) { |
|
| 153 | + $menu->postOnClick($this->_urls["refresh"],"{'p':$(this).attr('data-page')}",$this->getRefreshSelector(),["preventDefault"=>false,"jqueryDone"=>"replaceWith"]); |
|
| 154 | + } |
|
| 150 | 155 | } |
| 151 | 156 | |
| 152 | 157 | protected function _getFieldName($index){ |
@@ -189,7 +194,7 @@ discard block |
||
| 189 | 194 | $hasPart=$table->hasPart($part); |
| 190 | 195 | if($hasPart){ |
| 191 | 196 | $row=$table->getPart($part)->addRow(\sizeof($captions)); |
| 192 | - }else{ |
|
| 197 | + } else{ |
|
| 193 | 198 | $row=$table->getPart($part)->getRow(0); |
| 194 | 199 | } |
| 195 | 200 | $row->mergeCol(); |
@@ -214,7 +219,7 @@ discard block |
||
| 214 | 219 | $this->_urls["refresh"]=JArray::getValue($urls, "refresh",0); |
| 215 | 220 | $this->_urls["edit"]=JArray::getValue($urls, "edit",1); |
| 216 | 221 | $this->_urls["delete"]=JArray::getValue($urls, "delete",2); |
| 217 | - }else{ |
|
| 222 | + } else{ |
|
| 218 | 223 | $this->_urls=["refresh"=>$urls,"edit"=>$urls,"delete"=>$urls]; |
| 219 | 224 | } |
| 220 | 225 | return $this; |
@@ -288,8 +293,9 @@ discard block |
||
| 288 | 293 | |
| 289 | 294 | protected function getTargetSelector() { |
| 290 | 295 | $result=$this->_targetSelector; |
| 291 | - if(!isset($result)) |
|
| 292 | - $result="#".$this->identifier; |
|
| 296 | + if(!isset($result)) { |
|
| 297 | + $result="#".$this->identifier; |
|
| 298 | + } |
|
| 293 | 299 | return $result; |
| 294 | 300 | } |
| 295 | 301 | |
@@ -304,8 +310,9 @@ discard block |
||
| 304 | 310 | } |
| 305 | 311 | |
| 306 | 312 | public function getRefreshSelector() { |
| 307 | - if(isset($this->_refreshSelector)) |
|
| 308 | - return $this->_refreshSelector; |
|
| 313 | + if(isset($this->_refreshSelector)) { |
|
| 314 | + return $this->_refreshSelector; |
|
| 315 | + } |
|
| 309 | 316 | return "#".$this->identifier." tbody"; |
| 310 | 317 | } |
| 311 | 318 | |