@@ -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)) { |
| 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; |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | if ($this->content instanceof HtmlDoubleElement) { |
| 51 | 51 | $this->content->run($js); |
| 52 | 52 | } else if (\is_array($this->content)) { |
| 53 | - foreach ( $this->content as $itemContent ) { |
|
| 53 | + foreach ($this->content as $itemContent) { |
|
| 54 | 54 | if ($itemContent instanceof HtmlDoubleElement) { |
| 55 | 55 | $itemContent->run($js); |
| 56 | 56 | } |
@@ -67,19 +67,19 @@ discard block |
||
| 67 | 67 | return $this; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - public function getContentInstances($class){ |
|
| 71 | - return $this->_getContentInstances($class,$this->content); |
|
| 70 | + public function getContentInstances($class) { |
|
| 71 | + return $this->_getContentInstances($class, $this->content); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - protected function _getContentInstances($class,$content){ |
|
| 74 | + protected function _getContentInstances($class, $content) { |
|
| 75 | 75 | $instances=[]; |
| 76 | - if($content instanceof $class){ |
|
| 76 | + if ($content instanceof $class) { |
|
| 77 | 77 | $instances[]=$content; |
| 78 | - }elseif($content instanceof HtmlDoubleElement){ |
|
| 79 | - $instances=\array_merge($instances,$content->getContentInstances($class)); |
|
| 80 | - }elseif (\is_array($content)){ |
|
| 81 | - foreach ($content as $element){ |
|
| 82 | - $instances=\array_merge($instances,$this->_getContentInstances($class, $element)); |
|
| 78 | + }elseif ($content instanceof HtmlDoubleElement) { |
|
| 79 | + $instances=\array_merge($instances, $content->getContentInstances($class)); |
|
| 80 | + }elseif (\is_array($content)) { |
|
| 81 | + foreach ($content as $element) { |
|
| 82 | + $instances=\array_merge($instances, $this->_getContentInstances($class, $element)); |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | return $instances; |
@@ -89,10 +89,10 @@ discard block |
||
| 89 | 89 | * Transforms the element into a link |
| 90 | 90 | * @return HtmlDoubleElement |
| 91 | 91 | */ |
| 92 | - public function asLink($href=NULL,$target=NULL) { |
|
| 92 | + public function asLink($href=NULL, $target=NULL) { |
|
| 93 | 93 | if (isset($href)) |
| 94 | 94 | $this->setProperty("href", $href); |
| 95 | - if(isset($target)) |
|
| 95 | + if (isset($target)) |
|
| 96 | 96 | $this->setProperty("target", $target); |
| 97 | 97 | return $this->setTagName("a"); |
| 98 | 98 | } |
@@ -29,15 +29,17 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | public function addContent($content,$before=false) { |
| 31 | 31 | if (!\is_array($this->content)) { |
| 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 | |
@@ -75,9 +77,9 @@ discard block |
||
| 75 | 77 | $instances=[]; |
| 76 | 78 | if($content instanceof $class){ |
| 77 | 79 | $instances[]=$content; |
| 78 | - }elseif($content instanceof HtmlDoubleElement){ |
|
| 80 | + } elseif($content instanceof HtmlDoubleElement){ |
|
| 79 | 81 | $instances=\array_merge($instances,$content->getContentInstances($class)); |
| 80 | - }elseif (\is_array($content)){ |
|
| 82 | + } elseif (\is_array($content)){ |
|
| 81 | 83 | foreach ($content as $element){ |
| 82 | 84 | $instances=\array_merge($instances,$this->_getContentInstances($class, $element)); |
| 83 | 85 | } |
@@ -90,10 +92,12 @@ discard block |
||
| 90 | 92 | * @return HtmlDoubleElement |
| 91 | 93 | */ |
| 92 | 94 | public function asLink($href=NULL,$target=NULL) { |
| 93 | - if (isset($href)) |
|
| 94 | - $this->setProperty("href", $href); |
|
| 95 | - if(isset($target)) |
|
| 96 | - $this->setProperty("target", $target); |
|
| 95 | + if (isset($href)) { |
|
| 96 | + $this->setProperty("href", $href); |
|
| 97 | + } |
|
| 98 | + if(isset($target)) { |
|
| 99 | + $this->setProperty("target", $target); |
|
| 100 | + } |
|
| 97 | 101 | return $this->setTagName("a"); |
| 98 | 102 | } |
| 99 | 103 | } |
@@ -14,44 +14,44 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | abstract class HtmlCollection extends HtmlDoubleElement { |
| 16 | 16 | |
| 17 | - public function __construct($identifier,$tagName="div"){ |
|
| 18 | - parent::__construct($identifier,$tagName); |
|
| 17 | + public function __construct($identifier, $tagName="div") { |
|
| 18 | + parent::__construct($identifier, $tagName); |
|
| 19 | 19 | $this->content=array(); |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - public function addItems($items){ |
|
| 23 | - if(JArray::isAssociative($items)){ |
|
| 24 | - foreach ($items as $k=>$v){ |
|
| 25 | - $this->addItem([$k,$v]); |
|
| 22 | + public function addItems($items) { |
|
| 23 | + if (JArray::isAssociative($items)) { |
|
| 24 | + foreach ($items as $k=>$v) { |
|
| 25 | + $this->addItem([$k, $v]); |
|
| 26 | 26 | } |
| 27 | - }else{ |
|
| 28 | - foreach ($items as $item){ |
|
| 27 | + } else { |
|
| 28 | + foreach ($items as $item) { |
|
| 29 | 29 | $this->addItem($item); |
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | return $this; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - public function setItems($items){ |
|
| 35 | + public function setItems($items) { |
|
| 36 | 36 | $this->content=$items; |
| 37 | 37 | return $this; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - public function getItems(){ |
|
| 40 | + public function getItems() { |
|
| 41 | 41 | return $this->content; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - protected function getItemToAdd($item){ |
|
| 44 | + protected function getItemToAdd($item) { |
|
| 45 | 45 | $itemO=$item; |
| 46 | - if($this->createCondition($item)===true){ |
|
| 46 | + if ($this->createCondition($item)===true) { |
|
| 47 | 47 | $itemO=$this->createItem($item); |
| 48 | 48 | } |
| 49 | 49 | return $itemO; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - protected function setItemIdentifier($item,$classname,$index){ |
|
| 53 | - if($item instanceof BaseWidget){ |
|
| 54 | - if(JString::isNull($item->getIdentifier())){ |
|
| 52 | + protected function setItemIdentifier($item, $classname, $index) { |
|
| 53 | + if ($item instanceof BaseWidget) { |
|
| 54 | + if (JString::isNull($item->getIdentifier())) { |
|
| 55 | 55 | $item->setIdentifier($classname."-".$this->identifier."-".$index); |
| 56 | 56 | } |
| 57 | 57 | } |
@@ -62,15 +62,15 @@ discard block |
||
| 62 | 62 | * @param HtmlDoubleElement|string|array $item |
| 63 | 63 | * @return \Ajax\common\html\HtmlDoubleElement |
| 64 | 64 | */ |
| 65 | - public function addItem($item){ |
|
| 65 | + public function addItem($item) { |
|
| 66 | 66 | $itemO=$this->getItemToAdd($item); |
| 67 | 67 | $this->addContent($itemO); |
| 68 | 68 | return $itemO; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - public function insertItem($item,$position=0){ |
|
| 71 | + public function insertItem($item, $position=0) { |
|
| 72 | 72 | $itemO=$this->getItemToAdd($item); |
| 73 | - \array_splice( $this->content, $position, 0, array($itemO)); |
|
| 73 | + \array_splice($this->content, $position, 0, array($itemO)); |
|
| 74 | 74 | return $itemO; |
| 75 | 75 | } |
| 76 | 76 | |
@@ -93,11 +93,11 @@ discard block |
||
| 93 | 93 | return $this; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - public function removeItem($index){ |
|
| 96 | + public function removeItem($index) { |
|
| 97 | 97 | return array_splice($this->content, $index, 1); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - public function count(){ |
|
| 100 | + public function count() { |
|
| 101 | 101 | return \sizeof($this->content); |
| 102 | 102 | } |
| 103 | 103 | |
@@ -108,8 +108,8 @@ discard block |
||
| 108 | 108 | return $this->addItem($function($object)); |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - public function apply($callBack){ |
|
| 112 | - foreach ($this->content as $item){ |
|
| 111 | + public function apply($callBack) { |
|
| 112 | + foreach ($this->content as $item) { |
|
| 113 | 113 | $callBack($item); |
| 114 | 114 | } |
| 115 | 115 | return $this; |
@@ -129,23 +129,23 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | abstract protected function createItem($value); |
| 131 | 131 | |
| 132 | - protected function createCondition($value){ |
|
| 132 | + protected function createCondition($value) { |
|
| 133 | 133 | return \is_object($value)===false; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - protected function contentAs($tagName){ |
|
| 137 | - foreach ($this->content as $item){ |
|
| 136 | + protected function contentAs($tagName) { |
|
| 137 | + foreach ($this->content as $item) { |
|
| 138 | 138 | $item->setTagName($tagName); |
| 139 | 139 | } |
| 140 | 140 | return $this; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - public function setProperties($properties){ |
|
| 143 | + public function setProperties($properties) { |
|
| 144 | 144 | $i=0; |
| 145 | - foreach ($properties as $k=>$v){ |
|
| 145 | + foreach ($properties as $k=>$v) { |
|
| 146 | 146 | $c=$this->content[$i++]; |
| 147 | - if(isset($c)) |
|
| 148 | - $c->setProperty($k,$v); |
|
| 147 | + if (isset($c)) |
|
| 148 | + $c->setProperty($k, $v); |
|
| 149 | 149 | else |
| 150 | 150 | return $this; |
| 151 | 151 | } |
@@ -158,17 +158,17 @@ discard block |
||
| 158 | 158 | * @param array $values |
| 159 | 159 | * @return HtmlCollection |
| 160 | 160 | */ |
| 161 | - public function setPropertyValues($property,$values){ |
|
| 161 | + public function setPropertyValues($property, $values) { |
|
| 162 | 162 | $i=0; |
| 163 | - if(\is_array($values)===false){ |
|
| 164 | - $values=\array_fill(0, $this->count(),$values); |
|
| 163 | + if (\is_array($values)===false) { |
|
| 164 | + $values=\array_fill(0, $this->count(), $values); |
|
| 165 | 165 | } |
| 166 | - foreach ($values as $value){ |
|
| 166 | + foreach ($values as $value) { |
|
| 167 | 167 | $c=$this->content[$i++]; |
| 168 | - if(isset($c)){ |
|
| 169 | - $c->setProperty($property,$value); |
|
| 168 | + if (isset($c)) { |
|
| 169 | + $c->setProperty($property, $value); |
|
| 170 | 170 | } |
| 171 | - else{ |
|
| 171 | + else { |
|
| 172 | 172 | return $this; |
| 173 | 173 | } |
| 174 | 174 | } |
@@ -178,13 +178,13 @@ discard block |
||
| 178 | 178 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 179 | 179 | $index=0; |
| 180 | 180 | $classname=\strtolower(JReflection::shortClassName($this)); |
| 181 | - foreach ($this->content as $item){ |
|
| 182 | - $this->setItemIdentifier($item,$classname,$index++); |
|
| 181 | + foreach ($this->content as $item) { |
|
| 182 | + $this->setItemIdentifier($item, $classname, $index++); |
|
| 183 | 183 | } |
| 184 | - return parent::compile($js,$view); |
|
| 184 | + return parent::compile($js, $view); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - public function getItemById($identifier){ |
|
| 187 | + public function getItemById($identifier) { |
|
| 188 | 188 | return $this->getElementById($identifier, $this->content); |
| 189 | 189 | } |
| 190 | 190 | |
@@ -193,10 +193,10 @@ discard block |
||
| 193 | 193 | * @param string $target |
| 194 | 194 | * @return HtmlCollection |
| 195 | 195 | */ |
| 196 | - public function asLinks($hrefs=[],$target=NUll) { |
|
| 197 | - foreach ( $this->content as $index=>$item ) { |
|
| 198 | - if($item instanceof HtmlDoubleElement && isset($hrefs[$index])) |
|
| 199 | - $item->asLink($hrefs[$index],$target); |
|
| 196 | + public function asLinks($hrefs=[], $target=NUll) { |
|
| 197 | + foreach ($this->content as $index=>$item) { |
|
| 198 | + if ($item instanceof HtmlDoubleElement && isset($hrefs[$index])) |
|
| 199 | + $item->asLink($hrefs[$index], $target); |
|
| 200 | 200 | } |
| 201 | 201 | return $this; |
| 202 | 202 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | foreach ($items as $k=>$v){ |
| 25 | 25 | $this->addItem([$k,$v]); |
| 26 | 26 | } |
| 27 | - }else{ |
|
| 27 | + } else{ |
|
| 28 | 28 | foreach ($items as $item){ |
| 29 | 29 | $this->addItem($item); |
| 30 | 30 | } |
@@ -80,9 +80,9 @@ discard block |
||
| 80 | 80 | * @return \Ajax\common\html\HtmlDoubleElement |
| 81 | 81 | */ |
| 82 | 82 | public function getItem($index) { |
| 83 | - if (is_int($index)) |
|
| 84 | - return $this->content[$index]; |
|
| 85 | - else { |
|
| 83 | + if (is_int($index)) { |
|
| 84 | + return $this->content[$index]; |
|
| 85 | + } else { |
|
| 86 | 86 | $elm=$this->getElementById($index, $this->content); |
| 87 | 87 | return $elm; |
| 88 | 88 | } |
@@ -144,10 +144,11 @@ discard block |
||
| 144 | 144 | $i=0; |
| 145 | 145 | foreach ($properties as $k=>$v){ |
| 146 | 146 | $c=$this->content[$i++]; |
| 147 | - if(isset($c)) |
|
| 148 | - $c->setProperty($k,$v); |
|
| 149 | - else |
|
| 150 | - return $this; |
|
| 147 | + if(isset($c)) { |
|
| 148 | + $c->setProperty($k,$v); |
|
| 149 | + } else { |
|
| 150 | + return $this; |
|
| 151 | + } |
|
| 151 | 152 | } |
| 152 | 153 | return $this; |
| 153 | 154 | } |
@@ -167,8 +168,7 @@ discard block |
||
| 167 | 168 | $c=$this->content[$i++]; |
| 168 | 169 | if(isset($c)){ |
| 169 | 170 | $c->setProperty($property,$value); |
| 170 | - } |
|
| 171 | - else{ |
|
| 171 | + } else{ |
|
| 172 | 172 | return $this; |
| 173 | 173 | } |
| 174 | 174 | } |
@@ -195,8 +195,9 @@ discard block |
||
| 195 | 195 | */ |
| 196 | 196 | public function asLinks($hrefs=[],$target=NUll) { |
| 197 | 197 | foreach ( $this->content as $index=>$item ) { |
| 198 | - if($item instanceof HtmlDoubleElement && isset($hrefs[$index])) |
|
| 199 | - $item->asLink($hrefs[$index],$target); |
|
| 198 | + if($item instanceof HtmlDoubleElement && isset($hrefs[$index])) { |
|
| 199 | + $item->asLink($hrefs[$index],$target); |
|
| 200 | + } |
|
| 200 | 201 | } |
| 201 | 202 | return $this; |
| 202 | 203 | } |
@@ -41,12 +41,12 @@ discard block |
||
| 41 | 41 | * @return HtmlMenu |
| 42 | 42 | */ |
| 43 | 43 | public function setType($type="") { |
| 44 | - return $this->addToPropertyCtrl("class", $type, array ("","item","text" )); |
|
| 44 | + return $this->addToPropertyCtrl("class", $type, array("", "item", "text")); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | public function setActiveItem($index) { |
| 48 | 48 | $item=$this->getItem($index); |
| 49 | - if ($item !== null) { |
|
| 49 | + if ($item!==null) { |
|
| 50 | 50 | $item->addToProperty("class", "active"); |
| 51 | 51 | } |
| 52 | 52 | return $this; |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | private function getItemToInsert($item) { |
| 56 | 56 | if ($item instanceof HtmlInput || $item instanceof HtmlImg || $item instanceof HtmlIcon || $item instanceof HtmlButtonGroups || $item instanceof HtmlButton || $item instanceof HtmlLabel) { |
| 57 | - $itemO=new HtmlMenuItem("item-" . $this->identifier . "-" . \sizeof($this->content) , $item); |
|
| 57 | + $itemO=new HtmlMenuItem("item-".$this->identifier."-".\sizeof($this->content), $item); |
|
| 58 | 58 | $item=$itemO; |
| 59 | 59 | } |
| 60 | 60 | return $item; |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | private function afterInsert($item) { |
| 64 | 64 | if (!$item instanceof HtmlMenu && $item->propertyContains("class", "header")===false) |
| 65 | - $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
| 65 | + $item->addToPropertyCtrl("class", "item", array("item")); |
|
| 66 | 66 | else { |
| 67 | 67 | $this->setSecondary(); |
| 68 | 68 | } |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | public function addItem($item) { |
| 79 | 79 | $number=$item; |
| 80 | 80 | $item=parent::addItem($this->getItemToInsert($item)); |
| 81 | - if(\is_int($number)) |
|
| 81 | + if (\is_int($number)) |
|
| 82 | 82 | $item->setProperty("data-page", $number); |
| 83 | 83 | return $this->afterInsert($item); |
| 84 | 84 | } |
@@ -96,15 +96,15 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | public function generateMenuAsItem($menu, $header=null) { |
| 98 | 98 | $count=$this->count(); |
| 99 | - $item=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "div"); |
|
| 99 | + $item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div"); |
|
| 100 | 100 | if (isset($header)) { |
| 101 | - $headerItem=new HtmlSemDoubleElement("item-header-" . $this->identifier . "-" . $count, "div", "header"); |
|
| 101 | + $headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header"); |
|
| 102 | 102 | $headerItem->setContent($header); |
| 103 | 103 | $item->addContent($headerItem); |
| 104 | 104 | $this->_itemHeader=$headerItem; |
| 105 | 105 | } |
| 106 | - if(\is_array($menu)){ |
|
| 107 | - $menu=new HtmlMenu("menu-" . $this->identifier . "-" . $count,$menu); |
|
| 106 | + if (\is_array($menu)) { |
|
| 107 | + $menu=new HtmlMenu("menu-".$this->identifier."-".$count, $menu); |
|
| 108 | 108 | } |
| 109 | 109 | $menu->setClass("menu"); |
| 110 | 110 | $item->addContent($menu); |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $value=new HtmlSemDoubleElement($identifier, "a", "browse item", $value); |
| 120 | 120 | $value->addContent(new HtmlIcon("", "dropdown")); |
| 121 | 121 | $value=$this->addItem($value); |
| 122 | - $popup=new HtmlPopup($value, "popup-" . $this->identifier . "-" . $this->count(), $content); |
|
| 122 | + $popup=new HtmlPopup($value, "popup-".$this->identifier."-".$this->count(), $content); |
|
| 123 | 123 | $popup->setFlowing()->setPosition("bottom left")->setOn("click"); |
| 124 | 124 | $this->wrap("", $popup); |
| 125 | 125 | return $popup; |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | public function addDropdownAsItem($value, $items=NULL) { |
| 129 | 129 | $dd=$value; |
| 130 | 130 | if (\is_string($value)) { |
| 131 | - $dd=new HtmlDropdown("dropdown-" . $this->identifier . "-" . $this->count(), $value, $items); |
|
| 131 | + $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(), $value, $items); |
|
| 132 | 132 | } |
| 133 | 133 | $this->addItem($dd); |
| 134 | 134 | return $dd; |
@@ -141,14 +141,14 @@ discard block |
||
| 141 | 141 | * @see HtmlCollection::createItem() |
| 142 | 142 | */ |
| 143 | 143 | protected function createItem($value) { |
| 144 | - $itemO=new HtmlMenuItem($this->identifier."-item-" . \sizeof($this->content),""); |
|
| 144 | + $itemO=new HtmlMenuItem($this->identifier."-item-".\sizeof($this->content), ""); |
|
| 145 | 145 | $itemO->setTagName("a"); |
| 146 | 146 | $itemO->setContent($value); |
| 147 | 147 | return $itemO; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | public function setSecondary($value=true) { |
| 151 | - if($value) |
|
| 151 | + if ($value) |
|
| 152 | 152 | $this->addToProperty("class", "secondary"); |
| 153 | 153 | else |
| 154 | 154 | $this->removePropertyValue("class", "secondary"); |
@@ -156,28 +156,28 @@ discard block |
||
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | public function setVertical() { |
| 159 | - return $this->addToPropertyCtrl("class", "vertical", array ("vertical" )); |
|
| 159 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | public function setPosition($value="right") { |
| 163 | - return $this->addToPropertyCtrl("class", $value, array ("right","left" )); |
|
| 163 | + return $this->addToPropertyCtrl("class", $value, array("right", "left")); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | public function setPointing($value=Direction::NONE) { |
| 167 | - return $this->addToPropertyCtrl("class", $value . " pointing", Direction::getConstantValues("pointing")); |
|
| 167 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | public function asTab($vertical=false) { |
| 171 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
| 171 | + $this->apply(function(HtmlDoubleElement &$item) { |
|
| 172 | 172 | $item->setTagName("a"); |
| 173 | 173 | }); |
| 174 | - if ($vertical === true) |
|
| 174 | + if ($vertical===true) |
|
| 175 | 175 | $this->setVertical(); |
| 176 | 176 | return $this->addToProperty("class", "tabular"); |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | public function asPagination() { |
| 180 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
| 180 | + $this->apply(function(HtmlDoubleElement &$item) { |
|
| 181 | 181 | $item->setTagName("a"); |
| 182 | 182 | }); |
| 183 | 183 | return $this->addToProperty("class", "pagination"); |
@@ -214,10 +214,10 @@ discard block |
||
| 214 | 214 | */ |
| 215 | 215 | public function setWidth($width) { |
| 216 | 216 | if (\is_int($width)) { |
| 217 | - $width=Wide::getConstants()["W" . $width]; |
|
| 217 | + $width=Wide::getConstants()["W".$width]; |
|
| 218 | 218 | } |
| 219 | 219 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 220 | - return $this->addToPropertyCtrl("class", "item", array ("item" )); |
|
| 220 | + return $this->addToPropertyCtrl("class", "item", array("item")); |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | public function addImage($identifier, $src="", $alt="") { |
@@ -232,14 +232,14 @@ discard block |
||
| 232 | 232 | return $this->_itemHeader; |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | - public function setHasContainer(){ |
|
| 236 | - return $this->wrapContent("<div class='ui container'>","</div>"); |
|
| 235 | + public function setHasContainer() { |
|
| 236 | + return $this->wrapContent("<div class='ui container'>", "</div>"); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | - public function run(JsUtils $js){ |
|
| 240 | - if($this->identifier!=="" && !isset($this->_bsComponent)) |
|
| 241 | - $this->onClick('if(!$(this).hasClass("dropdown")&&!$(this).hasClass("no-active")){$(this).addClass("active").siblings().removeClass("active");}',false,false); |
|
| 242 | - $result= parent::run($js); |
|
| 239 | + public function run(JsUtils $js) { |
|
| 240 | + if ($this->identifier!=="" && !isset($this->_bsComponent)) |
|
| 241 | + $this->onClick('if(!$(this).hasClass("dropdown")&&!$(this).hasClass("no-active")){$(this).addClass("active").siblings().removeClass("active");}', false, false); |
|
| 242 | + $result=parent::run($js); |
|
| 243 | 243 | return $result->setItemSelector(".item"); |
| 244 | 244 | } |
| 245 | 245 | } |