@@ -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 | } |
@@ -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,13 +193,13 @@ 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){ |
|
| 196 | + public function asLinks($hrefs=[], $target=NUll) { |
|
| 197 | + foreach ($this->content as $index=>$item) { |
|
| 198 | + if ($item instanceof HtmlDoubleElement) { |
|
| 199 | 199 | $href=""; |
| 200 | - if(isset($hrefs[$index])) |
|
| 200 | + if (isset($hrefs[$index])) |
|
| 201 | 201 | $href=$hrefs[$index]; |
| 202 | - $item->asLink($href,$target); |
|
| 202 | + $item->asLink($href, $target); |
|
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | 205 | return $this; |
@@ -9,12 +9,12 @@ discard block |
||
| 9 | 9 | use Ajax\common\html\HtmlDoubleElement; |
| 10 | 10 | use Ajax\semantic\html\base\constants\Side; |
| 11 | 11 | |
| 12 | -class HtmlStep extends HtmlSemCollection{ |
|
| 12 | +class HtmlStep extends HtmlSemCollection { |
|
| 13 | 13 | protected $_activeStep; |
| 14 | 14 | protected $_startStep; |
| 15 | 15 | |
| 16 | - public function __construct( $identifier,$steps=array()){ |
|
| 17 | - parent::__construct( $identifier,"div", "ui steps"); |
|
| 16 | + public function __construct($identifier, $steps=array()) { |
|
| 17 | + parent::__construct($identifier, "div", "ui steps"); |
|
| 18 | 18 | $this->addItems($steps); |
| 19 | 19 | } |
| 20 | 20 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
| 25 | 25 | */ |
| 26 | 26 | protected function createItem($value) { |
| 27 | - $itemO=new HtmlStepItem("item-".\sizeof($this->content),$value); |
|
| 27 | + $itemO=new HtmlStepItem("item-".\sizeof($this->content), $value); |
|
| 28 | 28 | return $itemO; |
| 29 | 29 | } |
| 30 | 30 | |
@@ -32,50 +32,50 @@ discard block |
||
| 32 | 32 | * @param string|array $step |
| 33 | 33 | * @return HtmlStepItem |
| 34 | 34 | */ |
| 35 | - public function addStep($step){ |
|
| 35 | + public function addStep($step) { |
|
| 36 | 36 | return $this->addItem($step); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - public function setOrdered(){ |
|
| 39 | + public function setOrdered() { |
|
| 40 | 40 | return $this->addToProperty("class", "ordered"); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public function isOrdered(){ |
|
| 43 | + public function isOrdered() { |
|
| 44 | 44 | return $this->propertyContains("class", "ordered"); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - public function setVertical(){ |
|
| 47 | + public function setVertical() { |
|
| 48 | 48 | return $this->addToProperty("class", "vertical"); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - protected function defineActiveStep(){ |
|
| 51 | + protected function defineActiveStep() { |
|
| 52 | 52 | $activestep=$this->_activeStep; |
| 53 | 53 | $count=$this->count(); |
| 54 | - if(!$this->isOrdered()){ |
|
| 55 | - for($i=$this->_startStep;$i<$count;$i++){ |
|
| 54 | + if (!$this->isOrdered()) { |
|
| 55 | + for ($i=$this->_startStep; $i<$count; $i++) { |
|
| 56 | 56 | $step=$this->content[$i]; |
| 57 | 57 | $step->removeStatus(); |
| 58 | - if($i<$activestep) |
|
| 58 | + if ($i<$activestep) |
|
| 59 | 59 | $step->setCompleted(); |
| 60 | 60 | elseif ($i===$activestep) |
| 61 | 61 | $step->setActive(); |
| 62 | 62 | else |
| 63 | 63 | $step->setDisabled(); |
| 64 | 64 | } |
| 65 | - }else{ |
|
| 66 | - foreach ($this->content as $step){ |
|
| 65 | + } else { |
|
| 66 | + foreach ($this->content as $step) { |
|
| 67 | 67 | $step->removeStatus(); |
| 68 | 68 | } |
| 69 | - if($activestep<$count) |
|
| 69 | + if ($activestep<$count) |
|
| 70 | 70 | $this->content[$activestep]->setActive(); |
| 71 | 71 | } |
| 72 | 72 | return $this; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 76 | - if(isset($this->_activeStep) && \is_numeric($this->_activeStep)) |
|
| 76 | + if (isset($this->_activeStep) && \is_numeric($this->_activeStep)) |
|
| 77 | 77 | $this->defineActiveStep(); |
| 78 | - return parent::compile($js,$view); |
|
| 78 | + return parent::compile($js, $view); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | public function setActiveStep($_activeStep) { |
@@ -83,11 +83,11 @@ discard block |
||
| 83 | 83 | return $this; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - public function setAttached($side="",HtmlDoubleElement $toElement=NULL){ |
|
| 87 | - if(isset($toElement)){ |
|
| 88 | - $toElement->addToPropertyCtrl("class", "attached",array("attached")); |
|
| 86 | + public function setAttached($side="", HtmlDoubleElement $toElement=NULL) { |
|
| 87 | + if (isset($toElement)) { |
|
| 88 | + $toElement->addToPropertyCtrl("class", "attached", array("attached")); |
|
| 89 | 89 | } |
| 90 | - return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached")); |
|
| 90 | + return $this->addToPropertyCtrl("class", $side." attached", Side::getConstantValues("attached")); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | public function setStartStep($_startStep) { |
@@ -19,17 +19,17 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | protected function createItem($value) { |
| 21 | 21 | $count=$this->count(); |
| 22 | - $item=new HtmlListItem("item-" . $this->identifier . "-" . $count, $value); |
|
| 22 | + $item=new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
| 23 | 23 | return $item; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public function addHeader($niveau, $content) { |
| 27 | - $header=new HtmlHeader("header-" . $this->identifier, $niveau, $content, "page"); |
|
| 27 | + $header=new HtmlHeader("header-".$this->identifier, $niveau, $content, "page"); |
|
| 28 | 28 | $this->wrap($header); |
| 29 | 29 | return $header; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function getItemPart($index,$partName="header"){ |
|
| 32 | + public function getItemPart($index, $partName="header") { |
|
| 33 | 33 | return $this->getItem($index)->getPart($partName); |
| 34 | 34 | } |
| 35 | 35 | |
@@ -37,9 +37,9 @@ discard block |
||
| 37 | 37 | return $this->contentAs($tagName); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - public function asLinks($hrefs=[],$target=NUll) { |
|
| 41 | - $this->addToPropertyCtrl("class", "link", array ("link" )); |
|
| 42 | - return parent::asLinks($hrefs,$target); |
|
| 40 | + public function asLinks($hrefs=[], $target=NUll) { |
|
| 41 | + $this->addToPropertyCtrl("class", "link", array("link")); |
|
| 42 | + return parent::asLinks($hrefs, $target); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | public function addList($items=array()) { |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | return $this->addItem($list); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - protected function getItemToAdd($item){ |
|
| 51 | + protected function getItemToAdd($item) { |
|
| 52 | 52 | $itemO=parent::getItemToAdd($item); |
| 53 | - if($itemO instanceof AbstractCheckbox) |
|
| 53 | + if ($itemO instanceof AbstractCheckbox) |
|
| 54 | 54 | $itemO->addClass("item"); |
| 55 | 55 | return $itemO; |
| 56 | 56 | } |
@@ -68,9 +68,9 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | public function run(JsUtils $js) { |
| 71 | - if ($this->_hasCheckedList === true) { |
|
| 72 | - $jsCode=include dirname(__FILE__) . '/../../components/jsTemplates/tplCheckedList.php'; |
|
| 73 | - $jsCode=\str_replace("%identifier%", "#" . $this->identifier, $jsCode); |
|
| 71 | + if ($this->_hasCheckedList===true) { |
|
| 72 | + $jsCode=include dirname(__FILE__).'/../../components/jsTemplates/tplCheckedList.php'; |
|
| 73 | + $jsCode=\str_replace("%identifier%", "#".$this->identifier, $jsCode); |
|
| 74 | 74 | $this->executeOnRun($jsCode); |
| 75 | 75 | } |
| 76 | 76 | return parent::run($js); |
@@ -100,42 +100,42 @@ discard block |
||
| 100 | 100 | * @param string $notAllChecked |
| 101 | 101 | * @return HtmlList |
| 102 | 102 | */ |
| 103 | - public function addCheckedList($items=array(), $masterItem=NULL, $values=array(),$notAllChecked=false,$name=null) { |
|
| 103 | + public function addCheckedList($items=array(), $masterItem=NULL, $values=array(), $notAllChecked=false, $name=null) { |
|
| 104 | 104 | $count=$this->count(); |
| 105 | - $identifier=$this->identifier . "-" . $count; |
|
| 105 | + $identifier=$this->identifier."-".$count; |
|
| 106 | 106 | if (isset($masterItem)) { |
| 107 | - if(\is_array($masterItem)){ |
|
| 108 | - $masterO=new HtmlFormCheckbox("master-" . $identifier, @$masterItem[0],@$masterItem[1]); |
|
| 109 | - if(isset($name)) |
|
| 107 | + if (\is_array($masterItem)) { |
|
| 108 | + $masterO=new HtmlFormCheckbox("master-".$identifier, @$masterItem[0], @$masterItem[1]); |
|
| 109 | + if (isset($name)) |
|
| 110 | 110 | $masterO->setName($name); |
| 111 | - if(isset($masterItem[1])){ |
|
| 112 | - if(\array_search($masterItem[1], $values)!==false){ |
|
| 111 | + if (isset($masterItem[1])) { |
|
| 112 | + if (\array_search($masterItem[1], $values)!==false) { |
|
| 113 | 113 | $masterO->getDataField()->setProperty("checked", ""); |
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | - }else{ |
|
| 117 | - $masterO=new HtmlFormCheckbox("master-" . $identifier, $masterItem); |
|
| 116 | + } else { |
|
| 117 | + $masterO=new HtmlFormCheckbox("master-".$identifier, $masterItem); |
|
| 118 | 118 | } |
| 119 | - if($notAllChecked){ |
|
| 119 | + if ($notAllChecked) { |
|
| 120 | 120 | $masterO->getDataField()->addClass("_notAllChecked"); |
| 121 | 121 | } |
| 122 | 122 | $masterO->getHtmlCk()->addToProperty("class", "master"); |
| 123 | 123 | $masterO->setClass("item"); |
| 124 | 124 | $this->addItem($masterO); |
| 125 | 125 | } |
| 126 | - $fields=array (); |
|
| 126 | + $fields=array(); |
|
| 127 | 127 | $i=0; |
| 128 | - foreach ( $items as $val => $caption ) { |
|
| 129 | - $itemO=new HtmlFormCheckbox($identifier . "-" . $i++, $caption, $val, "child"); |
|
| 130 | - if (\array_search($val, $values) !== false) { |
|
| 128 | + foreach ($items as $val => $caption) { |
|
| 129 | + $itemO=new HtmlFormCheckbox($identifier."-".$i++, $caption, $val, "child"); |
|
| 130 | + if (\array_search($val, $values)!==false) { |
|
| 131 | 131 | $itemO->getDataField()->setProperty("checked", ""); |
| 132 | 132 | } |
| 133 | - if(isset($name)) |
|
| 133 | + if (isset($name)) |
|
| 134 | 134 | $itemO->setName($name); |
| 135 | 135 | $itemO->setClass("item"); |
| 136 | 136 | $fields[]=$itemO; |
| 137 | 137 | } |
| 138 | - if (isset($masterO) === true) { |
|
| 138 | + if (isset($masterO)===true) { |
|
| 139 | 139 | $list=new HtmlList("", $fields); |
| 140 | 140 | $list->setClass("list"); |
| 141 | 141 | $masterO->addContent($list); |
@@ -146,12 +146,12 @@ discard block |
||
| 146 | 146 | return $this; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - public function setIcons($icons){ |
|
| 150 | - if(!\is_array($icons)){ |
|
| 149 | + public function setIcons($icons) { |
|
| 150 | + if (!\is_array($icons)) { |
|
| 151 | 151 | $icons=\array_fill(0, \sizeof($this->content), $icons); |
| 152 | 152 | } |
| 153 | - $max=\min(\sizeof($icons),\sizeof($this->content)); |
|
| 154 | - for($i=0;$i<$max;$i++){ |
|
| 153 | + $max=\min(\sizeof($icons), \sizeof($this->content)); |
|
| 154 | + for ($i=0; $i<$max; $i++) { |
|
| 155 | 155 | $this->content[$i]->addIcon($icons[$i]); |
| 156 | 156 | } |
| 157 | 157 | return $this; |