@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | /** |
| 34 | 34 | * Sets the menu type |
| 35 | 35 | * @param string $type one of text,item |
| 36 | - * @return \Ajax\semantic\html\collections\HtmlMenu |
|
| 36 | + * @return HtmlMenu |
|
| 37 | 37 | */ |
| 38 | 38 | public function setType($type="") { |
| 39 | 39 | return $this->addToPropertyCtrl("class", $type, array ("","item","text" )); |
@@ -81,6 +81,7 @@ discard block |
||
| 81 | 81 | * {@inheritDoc} |
| 82 | 82 | * |
| 83 | 83 | * @see \Ajax\common\html\HtmlCollection::insertItem() |
| 84 | + * @param HtmlIcon $item |
|
| 84 | 85 | */ |
| 85 | 86 | public function insertItem($item, $position=0) { |
| 86 | 87 | $item=parent::insertItem($this->getItemToInsert($item), $position); |
@@ -58,9 +58,9 @@ discard block |
||
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | private function afterInsert($item) { |
| 61 | - if (!$item instanceof HtmlMenu && $item->propertyContains("class", "header")===false) |
|
| 62 | - $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
| 63 | - else { |
|
| 61 | + if (!$item instanceof HtmlMenu && $item->propertyContains("class", "header")===false) { |
|
| 62 | + $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
| 63 | + } else { |
|
| 64 | 64 | $this->setSecondary(); |
| 65 | 65 | } |
| 66 | 66 | return $item; |
@@ -75,8 +75,9 @@ discard block |
||
| 75 | 75 | public function addItem($item) { |
| 76 | 76 | $number=$item; |
| 77 | 77 | $item=parent::addItem($this->getItemToInsert($item)); |
| 78 | - if(\is_int($number)) |
|
| 79 | - $item->setProperty("data-page", $number); |
|
| 78 | + if(\is_int($number)) { |
|
| 79 | + $item->setProperty("data-page", $number); |
|
| 80 | + } |
|
| 80 | 81 | return $this->afterInsert($item); |
| 81 | 82 | } |
| 82 | 83 | |
@@ -149,10 +150,11 @@ discard block |
||
| 149 | 150 | } |
| 150 | 151 | |
| 151 | 152 | public function setSecondary($value=true) { |
| 152 | - if($value) |
|
| 153 | - $this->addToProperty("class", "secondary"); |
|
| 154 | - else |
|
| 155 | - $this->removePropertyValue("class", "secondary"); |
|
| 153 | + if($value) { |
|
| 154 | + $this->addToProperty("class", "secondary"); |
|
| 155 | + } else { |
|
| 156 | + $this->removePropertyValue("class", "secondary"); |
|
| 157 | + } |
|
| 156 | 158 | return $this; |
| 157 | 159 | } |
| 158 | 160 | |
@@ -172,8 +174,9 @@ discard block |
||
| 172 | 174 | $this->apply(function (HtmlDoubleElement &$item) { |
| 173 | 175 | $item->setTagName("a"); |
| 174 | 176 | }); |
| 175 | - if ($vertical === true) |
|
| 176 | - $this->setVertical(); |
|
| 177 | + if ($vertical === true) { |
|
| 178 | + $this->setVertical(); |
|
| 179 | + } |
|
| 177 | 180 | return $this->addToProperty("class", "tabular"); |
| 178 | 181 | } |
| 179 | 182 | |
@@ -202,10 +205,11 @@ discard block |
||
| 202 | 205 | */ |
| 203 | 206 | public function fromDatabaseObject($object, $function) { |
| 204 | 207 | $return=$function($object); |
| 205 | - if (\is_array($return)) |
|
| 206 | - $this->addItems($return); |
|
| 207 | - else |
|
| 208 | - $this->addItem($return); |
|
| 208 | + if (\is_array($return)) { |
|
| 209 | + $this->addItems($return); |
|
| 210 | + } else { |
|
| 211 | + $this->addItem($return); |
|
| 212 | + } |
|
| 209 | 213 | } |
| 210 | 214 | |
| 211 | 215 | /** |
@@ -40,12 +40,12 @@ discard block |
||
| 40 | 40 | * @return \Ajax\semantic\html\collections\HtmlMenu |
| 41 | 41 | */ |
| 42 | 42 | public function setType($type="") { |
| 43 | - return $this->addToPropertyCtrl("class", $type, array ("","item","text" )); |
|
| 43 | + return $this->addToPropertyCtrl("class", $type, array("", "item", "text")); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | public function setActiveItem($index) { |
| 47 | 47 | $item=$this->getItem($index); |
| 48 | - if ($item !== null) { |
|
| 48 | + if ($item!==null) { |
|
| 49 | 49 | $item->addToProperty("class", "active"); |
| 50 | 50 | } |
| 51 | 51 | return $this; |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | private function getItemToInsert($item) { |
| 55 | 55 | if ($item instanceof HtmlInput || $item instanceof HtmlImg || $item instanceof HtmlIcon || $item instanceof HtmlButtonGroups || $item instanceof HtmlButton || $item instanceof HtmlLabel) { |
| 56 | - $itemO=new HtmlMenuItem("item-" . $this->identifier . "-" . \sizeof($this->content) , $item); |
|
| 56 | + $itemO=new HtmlMenuItem("item-".$this->identifier."-".\sizeof($this->content), $item); |
|
| 57 | 57 | $item=$itemO; |
| 58 | 58 | } |
| 59 | 59 | return $item; |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | private function afterInsert($item) { |
| 63 | 63 | if (!$item instanceof HtmlMenu && $item->propertyContains("class", "header")===false) |
| 64 | - $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
| 64 | + $item->addToPropertyCtrl("class", "item", array("item")); |
|
| 65 | 65 | else { |
| 66 | 66 | $this->setSecondary(); |
| 67 | 67 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | public function addItem($item) { |
| 78 | 78 | $number=$item; |
| 79 | 79 | $item=parent::addItem($this->getItemToInsert($item)); |
| 80 | - if(\is_int($number)) |
|
| 80 | + if (\is_int($number)) |
|
| 81 | 81 | $item->setProperty("data-page", $number); |
| 82 | 82 | return $this->afterInsert($item); |
| 83 | 83 | } |
@@ -95,15 +95,15 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | public function generateMenuAsItem($menu, $header=null) { |
| 97 | 97 | $count=$this->count(); |
| 98 | - $item=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "div"); |
|
| 98 | + $item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div"); |
|
| 99 | 99 | if (isset($header)) { |
| 100 | - $headerItem=new HtmlSemDoubleElement("item-header-" . $this->identifier . "-" . $count, "div", "header"); |
|
| 100 | + $headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header"); |
|
| 101 | 101 | $headerItem->setContent($header); |
| 102 | 102 | $item->addContent($headerItem); |
| 103 | 103 | $this->_itemHeader=$headerItem; |
| 104 | 104 | } |
| 105 | - if(\is_array($menu)){ |
|
| 106 | - $menu=new HtmlMenu("menu-" . $this->identifier . "-" . $count,$menu); |
|
| 105 | + if (\is_array($menu)) { |
|
| 106 | + $menu=new HtmlMenu("menu-".$this->identifier."-".$count, $menu); |
|
| 107 | 107 | } |
| 108 | 108 | $menu->setClass("menu"); |
| 109 | 109 | $item->addContent($menu); |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $value=new HtmlSemDoubleElement($identifier, "a", "browse item", $value); |
| 119 | 119 | $value->addContent(new HtmlIcon("", "dropdown")); |
| 120 | 120 | $value=$this->addItem($value); |
| 121 | - $popup=new HtmlPopup($value, "popup-" . $this->identifier . "-" . $this->count(), $content); |
|
| 121 | + $popup=new HtmlPopup($value, "popup-".$this->identifier."-".$this->count(), $content); |
|
| 122 | 122 | $popup->setFlowing()->setPosition("bottom left")->setOn("click"); |
| 123 | 123 | $this->wrap("", $popup); |
| 124 | 124 | return $popup; |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | public function addDropdownAsItem($value, $items=NULL) { |
| 128 | 128 | $dd=$value; |
| 129 | 129 | if (\is_string($value)) { |
| 130 | - $dd=new HtmlDropdown("dropdown-" . $this->identifier . "-" . $this->count(), $value, $items); |
|
| 130 | + $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(), $value, $items); |
|
| 131 | 131 | } |
| 132 | 132 | $this->addItem($dd); |
| 133 | 133 | return $dd; |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
| 141 | 141 | */ |
| 142 | 142 | protected function createItem($value) { |
| 143 | - $itemO=new HtmlMenuItem($this->identifier."-item-" . \sizeof($this->content),""); |
|
| 143 | + $itemO=new HtmlMenuItem($this->identifier."-item-".\sizeof($this->content), ""); |
|
| 144 | 144 | $itemO->setTagName("a"); |
| 145 | 145 | $itemO->setContent($value); |
| 146 | 146 | return $itemO; |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | public function setSecondary($value=true) { |
| 154 | - if($value) |
|
| 154 | + if ($value) |
|
| 155 | 155 | $this->addToProperty("class", "secondary"); |
| 156 | 156 | else |
| 157 | 157 | $this->removePropertyValue("class", "secondary"); |
@@ -159,28 +159,28 @@ discard block |
||
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | public function setVertical() { |
| 162 | - return $this->addToPropertyCtrl("class", "vertical", array ("vertical" )); |
|
| 162 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | public function setPosition($value="right") { |
| 166 | - return $this->addToPropertyCtrl("class", $value, array ("right","left" )); |
|
| 166 | + return $this->addToPropertyCtrl("class", $value, array("right", "left")); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | public function setPointing($value=Direction::NONE) { |
| 170 | - return $this->addToPropertyCtrl("class", $value . " pointing", Direction::getConstantValues("pointing")); |
|
| 170 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | public function asTab($vertical=false) { |
| 174 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
| 174 | + $this->apply(function(HtmlDoubleElement&$item) { |
|
| 175 | 175 | $item->setTagName("a"); |
| 176 | 176 | }); |
| 177 | - if ($vertical === true) |
|
| 177 | + if ($vertical===true) |
|
| 178 | 178 | $this->setVertical(); |
| 179 | 179 | return $this->addToProperty("class", "tabular"); |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | public function asPagination() { |
| 183 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
| 183 | + $this->apply(function(HtmlDoubleElement&$item) { |
|
| 184 | 184 | $item->setTagName("a"); |
| 185 | 185 | }); |
| 186 | 186 | return $this->addToProperty("class", "pagination"); |
@@ -217,10 +217,10 @@ discard block |
||
| 217 | 217 | */ |
| 218 | 218 | public function setWidth($width) { |
| 219 | 219 | if (\is_int($width)) { |
| 220 | - $width=Wide::getConstants()["W" . $width]; |
|
| 220 | + $width=Wide::getConstants()["W".$width]; |
|
| 221 | 221 | } |
| 222 | 222 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 223 | - return $this->addToPropertyCtrl("class", "item", array ("item" )); |
|
| 223 | + return $this->addToPropertyCtrl("class", "item", array("item")); |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | public function addImage($identifier, $src="", $alt="") { |
@@ -235,8 +235,8 @@ discard block |
||
| 235 | 235 | return $this->_itemHeader; |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - public function run(JsUtils $js){ |
|
| 239 | - $result= parent::run($js); |
|
| 238 | + public function run(JsUtils $js) { |
|
| 239 | + $result=parent::run($js); |
|
| 240 | 240 | return $result->setItemSelector(".item"); |
| 241 | 241 | } |
| 242 | 242 | } |
| 243 | 243 | \ No newline at end of file |
@@ -11,6 +11,9 @@ |
||
| 11 | 11 | |
| 12 | 12 | abstract class HtmlAbsractItem extends HtmlSemDoubleElement { |
| 13 | 13 | |
| 14 | + /** |
|
| 15 | + * @param string $baseClass |
|
| 16 | + */ |
|
| 14 | 17 | public function __construct($identifier, $baseClass,$content=NULL) { |
| 15 | 18 | parent::__construct($identifier, "div", $baseClass); |
| 16 | 19 | $this->content=array(); |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use Ajax\semantic\html\base\HtmlSemDoubleElement; |
| 6 | 6 | use Ajax\semantic\html\elements\HtmlIcon; |
| 7 | 7 | use Ajax\JsUtils; |
| 8 | - |
|
| 9 | 8 | use Ajax\service\JArray; |
| 10 | 9 | use Ajax\semantic\html\elements\html5\HtmlImg; |
| 11 | 10 | |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | abstract class HtmlAbsractItem extends HtmlSemDoubleElement { |
| 13 | 13 | |
| 14 | - public function __construct($identifier, $baseClass,$content=NULL) { |
|
| 14 | + public function __construct($identifier, $baseClass, $content=NULL) { |
|
| 15 | 15 | parent::__construct($identifier, "div", $baseClass); |
| 16 | 16 | $this->content=array(); |
| 17 | 17 | $this->initContent($content); |
@@ -19,53 +19,53 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | abstract protected function initContent($content); |
| 21 | 21 | |
| 22 | - public function setIcon($icon){ |
|
| 22 | + public function setIcon($icon) { |
|
| 23 | 23 | $this->content["icon"]=new HtmlIcon("icon-".$this->identifier, $icon); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function setImage($image){ |
|
| 26 | + public function setImage($image) { |
|
| 27 | 27 | $image=new HtmlImg("icon-".$this->identifier, $image); |
| 28 | 28 | $image->asAvatar(); |
| 29 | 29 | $this->content["image"]=$image; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - private function createContent(){ |
|
| 33 | - $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier,"div","content"); |
|
| 32 | + private function createContent() { |
|
| 33 | + $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content"); |
|
| 34 | 34 | return $this->content["content"]; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - public function setTitle($title,$description=NULL,$baseClass="title"){ |
|
| 38 | - $title=new HtmlSemDoubleElement("","div",$baseClass,$title); |
|
| 39 | - if(\array_key_exists("content", $this->content)===false){ |
|
| 37 | + public function setTitle($title, $description=NULL, $baseClass="title") { |
|
| 38 | + $title=new HtmlSemDoubleElement("", "div", $baseClass, $title); |
|
| 39 | + if (\array_key_exists("content", $this->content)===false) { |
|
| 40 | 40 | $this->createContent(); |
| 41 | 41 | } |
| 42 | 42 | $this->content["content"]->addContent($title); |
| 43 | - if(isset($description)){ |
|
| 44 | - $description=new HtmlSemDoubleElement("","div","description",$description); |
|
| 43 | + if (isset($description)) { |
|
| 44 | + $description=new HtmlSemDoubleElement("", "div", "description", $description); |
|
| 45 | 45 | $this->content["content"]->addContent($description); |
| 46 | 46 | } |
| 47 | 47 | return $this; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - public function getPart($partName="header"){ |
|
| 51 | - $content=\array_merge($this->content["content"]->getContent(),array(@$this->content["icon"],@$this->content["image"])); |
|
| 50 | + public function getPart($partName="header") { |
|
| 51 | + $content=\array_merge($this->content["content"]->getContent(), array(@$this->content["icon"], @$this->content["image"])); |
|
| 52 | 52 | return $this->getElementByPropertyValue("class", $partName, $content); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function setActive($value=true){ |
|
| 56 | - if($value){ |
|
| 55 | + public function setActive($value=true) { |
|
| 56 | + if ($value) { |
|
| 57 | 57 | $this->setTagName("div"); |
| 58 | 58 | $this->removeProperty("href"); |
| 59 | 59 | $this->addToPropertyCtrl("class", "active", array("active")); |
| 60 | - }else{ |
|
| 60 | + } else { |
|
| 61 | 61 | $this->removePropertyValue("class", "active"); |
| 62 | 62 | } |
| 63 | 63 | return $this; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - public function asLink($href=NULL,$part=NULL){ |
|
| 66 | + public function asLink($href=NULL, $part=NULL) { |
|
| 67 | 67 | $this->setTagName("a"); |
| 68 | - if(isset($href)) |
|
| 68 | + if (isset($href)) |
|
| 69 | 69 | $this->setProperty("href", $href); |
| 70 | 70 | return $this; |
| 71 | 71 | } |
@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 78 | 78 | */ |
| 79 | 79 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 80 | - if(\is_array($this->content) && JArray::isAssociative($this->content)) |
|
| 81 | - $this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]); |
|
| 80 | + if (\is_array($this->content) && JArray::isAssociative($this->content)) |
|
| 81 | + $this->content=JArray::sortAssociative($this->content, ["icon", "image", "content"]); |
|
| 82 | 82 | return parent::compile($js, $view); |
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | \ No newline at end of file |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $this->setTagName("div"); |
| 58 | 58 | $this->removeProperty("href"); |
| 59 | 59 | $this->addToPropertyCtrl("class", "active", array("active")); |
| 60 | - }else{ |
|
| 60 | + } else{ |
|
| 61 | 61 | $this->removePropertyValue("class", "active"); |
| 62 | 62 | } |
| 63 | 63 | return $this; |
@@ -65,8 +65,9 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | public function asLink($href=NULL,$part=NULL){ |
| 67 | 67 | $this->setTagName("a"); |
| 68 | - if(isset($href)) |
|
| 69 | - $this->setProperty("href", $href); |
|
| 68 | + if(isset($href)) { |
|
| 69 | + $this->setProperty("href", $href); |
|
| 70 | + } |
|
| 70 | 71 | return $this; |
| 71 | 72 | } |
| 72 | 73 | |
@@ -77,8 +78,9 @@ discard block |
||
| 77 | 78 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 78 | 79 | */ |
| 79 | 80 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 80 | - if(\is_array($this->content) && JArray::isAssociative($this->content)) |
|
| 81 | - $this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]); |
|
| 81 | + if(\is_array($this->content) && JArray::isAssociative($this->content)) { |
|
| 82 | + $this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]); |
|
| 83 | + } |
|
| 82 | 84 | return parent::compile($js, $view); |
| 83 | 85 | } |
| 84 | 86 | } |
| 85 | 87 | \ No newline at end of file |
@@ -22,6 +22,9 @@ discard block |
||
| 22 | 22 | private $_colSize; |
| 23 | 23 | private $_implicite=false; |
| 24 | 24 | |
| 25 | + /** |
|
| 26 | + * @param string $identifier |
|
| 27 | + */ |
|
| 25 | 28 | public function __construct( $identifier,$numCols=NULL,$colSizing=false,$implicite=false){ |
| 26 | 29 | parent::__construct( $identifier,"div","row"); |
| 27 | 30 | $this->_implicite=$implicite; |
@@ -55,7 +58,7 @@ discard block |
||
| 55 | 58 | /** |
| 56 | 59 | * return the col at $index |
| 57 | 60 | * @param int $index |
| 58 | - * @return \Ajax\semantic\html\collections\HtmlGridCol |
|
| 61 | + * @return \Ajax\common\html\HtmlDoubleElement |
|
| 59 | 62 | */ |
| 60 | 63 | public function getCol($index){ |
| 61 | 64 | return $this->getItem($index); |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use Ajax\semantic\html\base\constants\Wide; |
| 6 | 6 | use Ajax\semantic\html\base\constants\Color; |
| 7 | 7 | use Ajax\JsUtils; |
| 8 | - |
|
| 9 | 8 | use Ajax\semantic\html\base\HtmlSemCollection; |
| 10 | 9 | use Ajax\semantic\html\base\traits\TextAlignmentTrait; |
| 11 | 10 | |
@@ -29,10 +29,11 @@ |
||
| 29 | 29 | if(isset($numCols)){ |
| 30 | 30 | $numCols=min(16,$numCols); |
| 31 | 31 | $numCols=max(1,$numCols); |
| 32 | - if($colSizing) |
|
| 33 | - $width=(int)(16/$numCols); |
|
| 34 | - else |
|
| 35 | - $this->_colSize=16/$numCols; |
|
| 32 | + if($colSizing) { |
|
| 33 | + $width=(int)(16/$numCols); |
|
| 34 | + } else { |
|
| 35 | + $this->_colSize=16/$numCols; |
|
| 36 | + } |
|
| 36 | 37 | for ($i=0;$i<$numCols;$i++){ |
| 37 | 38 | $this->addItem($width); |
| 38 | 39 | } |
@@ -16,24 +16,24 @@ discard block |
||
| 16 | 16 | * @author jc |
| 17 | 17 | * @version 1.001 |
| 18 | 18 | */ |
| 19 | -class HtmlGridRow extends HtmlSemCollection{ |
|
| 19 | +class HtmlGridRow extends HtmlSemCollection { |
|
| 20 | 20 | use TextAlignmentTrait; |
| 21 | 21 | |
| 22 | 22 | private $_colSize; |
| 23 | 23 | private $_implicite=false; |
| 24 | 24 | |
| 25 | - public function __construct( $identifier,$numCols=NULL,$colSizing=false,$implicite=false){ |
|
| 26 | - parent::__construct( $identifier,"div","row"); |
|
| 25 | + public function __construct($identifier, $numCols=NULL, $colSizing=false, $implicite=false) { |
|
| 26 | + parent::__construct($identifier, "div", "row"); |
|
| 27 | 27 | $this->_implicite=$implicite; |
| 28 | 28 | $width=null; |
| 29 | - if(isset($numCols)){ |
|
| 30 | - $numCols=min(16,$numCols); |
|
| 31 | - $numCols=max(1,$numCols); |
|
| 32 | - if($colSizing) |
|
| 29 | + if (isset($numCols)) { |
|
| 30 | + $numCols=min(16, $numCols); |
|
| 31 | + $numCols=max(1, $numCols); |
|
| 32 | + if ($colSizing) |
|
| 33 | 33 | $width=(int)(16/$numCols); |
| 34 | 34 | else |
| 35 | 35 | $this->_colSize=16/$numCols; |
| 36 | - for ($i=0;$i<$numCols;$i++){ |
|
| 36 | + for ($i=0; $i<$numCols; $i++) { |
|
| 37 | 37 | $this->addItem($width); |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -44,12 +44,12 @@ discard block |
||
| 44 | 44 | * @param int $width |
| 45 | 45 | * @return \Ajax\semantic\html\content\HtmlGridRow |
| 46 | 46 | */ |
| 47 | - public function setWidth($width){ |
|
| 48 | - if(\is_int($width)){ |
|
| 47 | + public function setWidth($width) { |
|
| 48 | + if (\is_int($width)) { |
|
| 49 | 49 | $width=Wide::getConstants()["W".$width]; |
| 50 | 50 | } |
| 51 | 51 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 52 | - return $this->addToPropertyCtrl("class", "column",array("column")); |
|
| 52 | + return $this->addToPropertyCtrl("class", "column", array("column")); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -57,29 +57,29 @@ discard block |
||
| 57 | 57 | * @param int $index |
| 58 | 58 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
| 59 | 59 | */ |
| 60 | - public function getCol($index){ |
|
| 60 | + public function getCol($index) { |
|
| 61 | 61 | return $this->getItem($index); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - public function setColsCount($colsCount,$toCreate=true){ |
|
| 64 | + public function setColsCount($colsCount, $toCreate=true) { |
|
| 65 | 65 | $this->setWidth($colsCount); |
| 66 | - if($toCreate===true){ |
|
| 66 | + if ($toCreate===true) { |
|
| 67 | 67 | $count=$this->count(); |
| 68 | - for($i=$count;$i<$colsCount;$i++){ |
|
| 68 | + for ($i=$count; $i<$colsCount; $i++) { |
|
| 69 | 69 | $this->addItem(null); |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | return $this; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - public function addCols($colCount){ |
|
| 76 | - for($i=0;$i<$colCount;$i++){ |
|
| 75 | + public function addCols($colCount) { |
|
| 76 | + for ($i=0; $i<$colCount; $i++) { |
|
| 77 | 77 | $this->addItem(null); |
| 78 | 78 | } |
| 79 | 79 | return $this; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - public function addCol($width=NULL){ |
|
| 82 | + public function addCol($width=NULL) { |
|
| 83 | 83 | return $this->addItem($width); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * stretch the row contents to take up the entire column height |
| 88 | 88 | * @return \Ajax\semantic\html\content\HtmlGridRow |
| 89 | 89 | */ |
| 90 | - public function setStretched(){ |
|
| 90 | + public function setStretched() { |
|
| 91 | 91 | return $this->addToProperty("class", "stretched"); |
| 92 | 92 | } |
| 93 | 93 | |
@@ -95,20 +95,20 @@ discard block |
||
| 95 | 95 | * @param string $color |
| 96 | 96 | * @return \Ajax\semantic\html\content\HtmlGridRow |
| 97 | 97 | */ |
| 98 | - public function setColor($color){ |
|
| 99 | - return $this->addToPropertyCtrl("class", $color,Color::getConstants()); |
|
| 98 | + public function setColor($color) { |
|
| 99 | + return $this->addToPropertyCtrl("class", $color, Color::getConstants()); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - public function setValues($values,$force=false){ |
|
| 102 | + public function setValues($values, $force=false) { |
|
| 103 | 103 | $count=$this->count(); |
| 104 | 104 | $valuesSize=\sizeof($values); |
| 105 | - if($force===true){ |
|
| 106 | - for($i=$count;$i<$valuesSize;$i++){ |
|
| 107 | - $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1),null)); |
|
| 105 | + if ($force===true) { |
|
| 106 | + for ($i=$count; $i<$valuesSize; $i++) { |
|
| 107 | + $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1), null)); |
|
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | - $count=\min(array($this->count(),$valuesSize)); |
|
| 111 | - for($i=0;$i<$count;$i++){ |
|
| 110 | + $count=\min(array($this->count(), $valuesSize)); |
|
| 111 | + for ($i=0; $i<$count; $i++) { |
|
| 112 | 112 | $this->content[$i]->setValue($values[$i]); |
| 113 | 113 | } |
| 114 | 114 | return $this; |
@@ -118,15 +118,15 @@ discard block |
||
| 118 | 118 | * {@inheritDoc} |
| 119 | 119 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 120 | 120 | */ |
| 121 | - protected function createItem($value){ |
|
| 122 | - $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1),$value); |
|
| 121 | + protected function createItem($value) { |
|
| 122 | + $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1), $value); |
|
| 123 | 123 | return $col; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
| 127 | - if($this->_implicite===true){ |
|
| 126 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 127 | + if ($this->_implicite===true) { |
|
| 128 | 128 | $this->_template="%wrapContentBefore%%content%%wrapContentAfter%"; |
| 129 | 129 | } |
| 130 | - return parent::compile($js,$view); |
|
| 130 | + return parent::compile($js, $view); |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | \ No newline at end of file |
@@ -18,6 +18,9 @@ |
||
| 18 | 18 | private $_container; |
| 19 | 19 | private $_row; |
| 20 | 20 | |
| 21 | + /** |
|
| 22 | + * @param string $identifier |
|
| 23 | + */ |
|
| 21 | 24 | public function __construct($identifier) { |
| 22 | 25 | parent::__construct($identifier, "tr", ""); |
| 23 | 26 | $this->_states=[ State::ACTIVE,State::POSITIVE,State::NEGATIVE,State::WARNING,State::ERROR,State::DISABLED ]; |
@@ -105,17 +105,20 @@ discard block |
||
| 105 | 105 | $max=\min($colIndex, $rows[$i]->count()); |
| 106 | 106 | for($j=0; $j < $max; $j++) { |
| 107 | 107 | $rowspan=$rows[$i]->getItem($j)->getRowspan(); |
| 108 | - if ($rowspan + $i > $this->_row) |
|
| 109 | - $pos++; |
|
| 108 | + if ($rowspan + $i > $this->_row) { |
|
| 109 | + $pos++; |
|
| 110 | + } |
|
| 110 | 111 | } |
| 111 | 112 | } |
| 112 | - if ($pos > $colIndex) |
|
| 113 | - return NULL; |
|
| 113 | + if ($pos > $colIndex) { |
|
| 114 | + return NULL; |
|
| 115 | + } |
|
| 114 | 116 | $count=$this->count(); |
| 115 | 117 | for($i=0; $i < $count; $i++) { |
| 116 | 118 | $pos+=$this->content[$i]->getColspan(); |
| 117 | - if ($pos >= $colIndex + 1) |
|
| 118 | - return $i; |
|
| 119 | + if ($pos >= $colIndex + 1) { |
|
| 120 | + return $i; |
|
| 121 | + } |
|
| 119 | 122 | } |
| 120 | 123 | return null; |
| 121 | 124 | } |
@@ -138,8 +141,9 @@ discard block |
||
| 138 | 141 | public function containsStr($needle) { |
| 139 | 142 | $cells=$this->content; |
| 140 | 143 | foreach ( $cells as $cell ) { |
| 141 | - if (\strpos($cell->getContent(), $needle) !== false) |
|
| 142 | - return true; |
|
| 144 | + if (\strpos($cell->getContent(), $needle) !== false) { |
|
| 145 | + return true; |
|
| 146 | + } |
|
| 143 | 147 | } |
| 144 | 148 | return false; |
| 145 | 149 | } |
@@ -20,12 +20,12 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | public function __construct($identifier) { |
| 22 | 22 | parent::__construct($identifier, "tr", ""); |
| 23 | - $this->_states=[ State::ACTIVE,State::POSITIVE,State::NEGATIVE,State::WARNING,State::ERROR,State::DISABLED ]; |
|
| 23 | + $this->_states=[State::ACTIVE, State::POSITIVE, State::NEGATIVE, State::WARNING, State::ERROR, State::DISABLED]; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public function setColCount($colCount) { |
| 27 | 27 | $count=$this->count(); |
| 28 | - for($i=$count; $i < $colCount; $i++) { |
|
| 28 | + for ($i=$count; $i<$colCount; $i++) { |
|
| 29 | 29 | $item=$this->addItem(NULL); |
| 30 | 30 | $item->setTagName($this->_tdTagName); |
| 31 | 31 | } |
@@ -68,13 +68,13 @@ discard block |
||
| 68 | 68 | if (!\is_array($values)) { |
| 69 | 69 | $values=\array_fill(0, $count, $values); |
| 70 | 70 | } else { |
| 71 | - if (JArray::isAssociative($values) === true) { |
|
| 71 | + if (JArray::isAssociative($values)===true) { |
|
| 72 | 72 | $values=\array_values($values); |
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | $count=\min(\sizeof($values), $count); |
| 76 | 76 | |
| 77 | - for($i=0; $i < $count; $i++) { |
|
| 77 | + for ($i=0; $i<$count; $i++) { |
|
| 78 | 78 | $cell=$this->content[$i]; |
| 79 | 79 | $cell->setValue($values[$i]); |
| 80 | 80 | } |
@@ -101,20 +101,20 @@ discard block |
||
| 101 | 101 | public function getColPosition($colIndex) { |
| 102 | 102 | $pos=0; |
| 103 | 103 | $rows=$this->_container->getContent(); |
| 104 | - for($i=0; $i < $this->_row; $i++) { |
|
| 104 | + for ($i=0; $i<$this->_row; $i++) { |
|
| 105 | 105 | $max=\min($colIndex, $rows[$i]->count()); |
| 106 | - for($j=0; $j < $max; $j++) { |
|
| 106 | + for ($j=0; $j<$max; $j++) { |
|
| 107 | 107 | $rowspan=$rows[$i]->getItem($j)->getRowspan(); |
| 108 | - if ($rowspan + $i > $this->_row) |
|
| 108 | + if ($rowspan+$i>$this->_row) |
|
| 109 | 109 | $pos++; |
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | - if ($pos > $colIndex) |
|
| 112 | + if ($pos>$colIndex) |
|
| 113 | 113 | return NULL; |
| 114 | 114 | $count=$this->count(); |
| 115 | - for($i=0; $i < $count; $i++) { |
|
| 115 | + for ($i=0; $i<$count; $i++) { |
|
| 116 | 116 | $pos+=$this->content[$i]->getColspan(); |
| 117 | - if ($pos >= $colIndex + 1) |
|
| 117 | + if ($pos>=$colIndex+1) |
|
| 118 | 118 | return $i; |
| 119 | 119 | } |
| 120 | 120 | return null; |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | public function conditionalCellFormat($callback, $format) { |
| 124 | 124 | $cells=$this->content; |
| 125 | - foreach ( $cells as $cell ) { |
|
| 125 | + foreach ($cells as $cell) { |
|
| 126 | 126 | $cell->conditionalCellFormat($callback, $format); |
| 127 | 127 | } |
| 128 | 128 | return $this; |
@@ -137,8 +137,8 @@ discard block |
||
| 137 | 137 | |
| 138 | 138 | public function containsStr($needle) { |
| 139 | 139 | $cells=$this->content; |
| 140 | - foreach ( $cells as $cell ) { |
|
| 141 | - if (\strpos($cell->getContent(), $needle) !== false) |
|
| 140 | + foreach ($cells as $cell) { |
|
| 141 | + if (\strpos($cell->getContent(), $needle)!==false) |
|
| 142 | 142 | return true; |
| 143 | 143 | } |
| 144 | 144 | return false; |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | |
| 152 | 152 | public function applyCells($callback) { |
| 153 | 153 | $cells=$this->content; |
| 154 | - foreach ( $cells as $cell ) { |
|
| 154 | + foreach ($cells as $cell) { |
|
| 155 | 155 | $cell->apply($callback); |
| 156 | 156 | } |
| 157 | 157 | return $this; |
@@ -13,6 +13,9 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class HtmlIconGroups extends HtmlSemCollection { |
| 15 | 15 | |
| 16 | + /** |
|
| 17 | + * @param string $identifier |
|
| 18 | + */ |
|
| 16 | 19 | public function __construct($identifier, $icons=array(), $size="") { |
| 17 | 20 | parent::__construct($identifier, "i", "icons"); |
| 18 | 21 | $this->addItems($icons); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | $icon=JArray::getValue($value, "icon", 0); |
| 27 | 27 | $size=JArray::getValue($value, "size", 1); |
| 28 | 28 | } |
| 29 | - $iconO=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
| 29 | + $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
|
| 30 | 30 | if (isset($size)) { |
| 31 | 31 | $iconO->setSize($size); |
| 32 | 32 | } |
@@ -34,15 +34,15 @@ discard block |
||
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | protected function createCondition($value) { |
| 37 | - return ($value instanceof HtmlIcon) === false; |
|
| 37 | + return ($value instanceof HtmlIcon)===false; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function getIcon($index) { |
| 41 | 41 | return $this->content[$index]; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public function run(JsUtils $js){ |
|
| 45 | - $result= parent::run($js); |
|
| 44 | + public function run(JsUtils $js) { |
|
| 45 | + $result=parent::run($js); |
|
| 46 | 46 | return $result->setItemSelector("i"); |
| 47 | 47 | } |
| 48 | 48 | |
@@ -10,6 +10,9 @@ discard block |
||
| 10 | 10 | class HtmlList extends HtmlSemCollection { |
| 11 | 11 | protected $_hasCheckedList; |
| 12 | 12 | |
| 13 | + /** |
|
| 14 | + * @param string $identifier |
|
| 15 | + */ |
|
| 13 | 16 | public function __construct($identifier, $items=array()) { |
| 14 | 17 | parent::__construct($identifier, "div", "ui list"); |
| 15 | 18 | $this->addItems($items); |
@@ -22,6 +25,9 @@ discard block |
||
| 22 | 25 | return $item; |
| 23 | 26 | } |
| 24 | 27 | |
| 28 | + /** |
|
| 29 | + * @param integer $niveau |
|
| 30 | + */ |
|
| 25 | 31 | public function addHeader($niveau, $content) { |
| 26 | 32 | $header=new HtmlHeader("header-" . $this->identifier, $niveau, $content, "page"); |
| 27 | 33 | $this->wrap($header); |
@@ -18,17 +18,17 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | protected function createItem($value) { |
| 20 | 20 | $count=$this->count(); |
| 21 | - $item=new HtmlListItem("item-" . $this->identifier . "-" . $count, $value); |
|
| 21 | + $item=new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
| 22 | 22 | return $item; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public function addHeader($niveau, $content) { |
| 26 | - $header=new HtmlHeader("header-" . $this->identifier, $niveau, $content, "page"); |
|
| 26 | + $header=new HtmlHeader("header-".$this->identifier, $niveau, $content, "page"); |
|
| 27 | 27 | $this->wrap($header); |
| 28 | 28 | return $header; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - public function getItemPart($index,$partName="header"){ |
|
| 31 | + public function getItemPart($index, $partName="header") { |
|
| 32 | 32 | return $this->getItem($index)->getPart($partName); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | public function asLink() { |
| 40 | - $this->addToPropertyCtrl("class", "link", array ("link" )); |
|
| 40 | + $this->addToPropertyCtrl("class", "link", array("link")); |
|
| 41 | 41 | return $this->contentAs("a"); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | public function run(JsUtils $js) { |
| 63 | - if ($this->_hasCheckedList === true) { |
|
| 64 | - $jsCode=include dirname(__FILE__) . '/../../components/jsTemplates/tplCheckedList.php'; |
|
| 65 | - $jsCode=\str_replace("%identifier%", "#" . $this->identifier, $jsCode); |
|
| 63 | + if ($this->_hasCheckedList===true) { |
|
| 64 | + $jsCode=include dirname(__FILE__).'/../../components/jsTemplates/tplCheckedList.php'; |
|
| 65 | + $jsCode=\str_replace("%identifier%", "#".$this->identifier, $jsCode); |
|
| 66 | 66 | $this->executeOnRun($jsCode); |
| 67 | 67 | } |
| 68 | 68 | return parent::run($js); |
@@ -86,24 +86,24 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | public function addCheckedList($items=array(), $masterItem=NULL, $values=array()) { |
| 88 | 88 | $count=$this->count(); |
| 89 | - $identifier=$this->identifier . "-" . $count; |
|
| 89 | + $identifier=$this->identifier."-".$count; |
|
| 90 | 90 | if (isset($masterItem)) { |
| 91 | - $masterO=new HtmlFormCheckbox("master-" . $identifier, $masterItem); |
|
| 91 | + $masterO=new HtmlFormCheckbox("master-".$identifier, $masterItem); |
|
| 92 | 92 | $masterO->getHtmlCk()->addToProperty("class", "master"); |
| 93 | 93 | $masterO->setClass("item"); |
| 94 | 94 | $this->addItem($masterO); |
| 95 | 95 | } |
| 96 | - $fields=array (); |
|
| 96 | + $fields=array(); |
|
| 97 | 97 | $i=0; |
| 98 | - foreach ( $items as $val => $caption ) { |
|
| 99 | - $itemO=new HtmlFormCheckbox($identifier . "-" . $i++, $caption, $val, "child"); |
|
| 100 | - if (\array_search($val, $values) !== false) { |
|
| 98 | + foreach ($items as $val => $caption) { |
|
| 99 | + $itemO=new HtmlFormCheckbox($identifier."-".$i++, $caption, $val, "child"); |
|
| 100 | + if (\array_search($val, $values)!==false) { |
|
| 101 | 101 | $itemO->getField()->setProperty("checked", ""); |
| 102 | 102 | } |
| 103 | 103 | $itemO->setClass("item"); |
| 104 | 104 | $fields[]=$itemO; |
| 105 | 105 | } |
| 106 | - if (isset($masterO) === true) { |
|
| 106 | + if (isset($masterO)===true) { |
|
| 107 | 107 | $list=new HtmlList("", $fields); |
| 108 | 108 | $list->setClass("list"); |
| 109 | 109 | $masterO->addContent($list); |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use Ajax\semantic\html\base\HtmlSemCollection; |
| 6 | 6 | use Ajax\semantic\html\content\HtmlStepItem; |
| 7 | 7 | use Ajax\JsUtils; |
| 8 | - |
|
| 9 | 8 | use Ajax\common\html\HtmlDoubleElement; |
| 10 | 9 | use Ajax\semantic\html\base\constants\Side; |
| 11 | 10 | |
@@ -9,11 +9,11 @@ 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 | |
| 15 | - public function __construct( $identifier,$steps=array()){ |
|
| 16 | - parent::__construct( $identifier,"div", "ui steps"); |
|
| 15 | + public function __construct($identifier, $steps=array()) { |
|
| 16 | + parent::__construct($identifier, "div", "ui steps"); |
|
| 17 | 17 | $this->addItems($steps); |
| 18 | 18 | } |
| 19 | 19 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
| 24 | 24 | */ |
| 25 | 25 | protected function createItem($value) { |
| 26 | - $itemO=new HtmlStepItem("item-".\sizeof($this->content),$value); |
|
| 26 | + $itemO=new HtmlStepItem("item-".\sizeof($this->content), $value); |
|
| 27 | 27 | return $itemO; |
| 28 | 28 | } |
| 29 | 29 | |
@@ -31,50 +31,50 @@ discard block |
||
| 31 | 31 | * @param string|array $step |
| 32 | 32 | * @return HtmlStepItem |
| 33 | 33 | */ |
| 34 | - public function addStep($step){ |
|
| 34 | + public function addStep($step) { |
|
| 35 | 35 | return $this->addItem($step); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public function setOrdered(){ |
|
| 38 | + public function setOrdered() { |
|
| 39 | 39 | return $this->addToProperty("class", "ordered"); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - public function isOrdered(){ |
|
| 42 | + public function isOrdered() { |
|
| 43 | 43 | return $this->propertyContains("class", "ordered"); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - public function setVertical(){ |
|
| 46 | + public function setVertical() { |
|
| 47 | 47 | return $this->addToProperty("class", "vertical"); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - protected function defineActiveStep(){ |
|
| 50 | + protected function defineActiveStep() { |
|
| 51 | 51 | $activestep=$this->_activeStep; |
| 52 | 52 | $count=$this->count(); |
| 53 | - if($this->isOrdered()){ |
|
| 54 | - for($i=0;$i<$count;$i++){ |
|
| 53 | + if ($this->isOrdered()) { |
|
| 54 | + for ($i=0; $i<$count; $i++) { |
|
| 55 | 55 | $step=$this->content[$i]; |
| 56 | 56 | $step->removeStatus(); |
| 57 | - if($i<$activestep) |
|
| 57 | + if ($i<$activestep) |
|
| 58 | 58 | $step->setCompleted(); |
| 59 | 59 | elseif ($i===$activestep) |
| 60 | 60 | $step->setActive(); |
| 61 | 61 | else |
| 62 | 62 | $step->setDisabled(); |
| 63 | 63 | } |
| 64 | - }else{ |
|
| 65 | - foreach ($this->content as $step){ |
|
| 64 | + } else { |
|
| 65 | + foreach ($this->content as $step) { |
|
| 66 | 66 | $step->removeStatus(); |
| 67 | 67 | } |
| 68 | - if($activestep<$count) |
|
| 68 | + if ($activestep<$count) |
|
| 69 | 69 | $this->content[$activestep]->setActive(); |
| 70 | 70 | } |
| 71 | 71 | return $this; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 75 | - if(isset($this->_activeStep) && \is_numeric($this->_activeStep)) |
|
| 75 | + if (isset($this->_activeStep) && \is_numeric($this->_activeStep)) |
|
| 76 | 76 | $this->defineActiveStep(); |
| 77 | - return parent::compile($js,$view); |
|
| 77 | + return parent::compile($js, $view); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | public function setActiveStep($_activeStep) { |
@@ -82,15 +82,15 @@ discard block |
||
| 82 | 82 | return $this; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - public function setAttached($side="",HtmlDoubleElement $toElement=NULL){ |
|
| 86 | - if(isset($toElement)){ |
|
| 87 | - $toElement->addToPropertyCtrl("class", "attached",array("attached")); |
|
| 85 | + public function setAttached($side="", HtmlDoubleElement $toElement=NULL) { |
|
| 86 | + if (isset($toElement)) { |
|
| 87 | + $toElement->addToPropertyCtrl("class", "attached", array("attached")); |
|
| 88 | 88 | } |
| 89 | - return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached")); |
|
| 89 | + return $this->addToPropertyCtrl("class", $side." attached", Side::getConstantValues("attached")); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - public function asLink(){ |
|
| 93 | - foreach ($this->content as $step){ |
|
| 92 | + public function asLink() { |
|
| 93 | + foreach ($this->content as $step) { |
|
| 94 | 94 | $step->asLink(); |
| 95 | 95 | } |
| 96 | 96 | return $this; |
@@ -54,26 +54,29 @@ |
||
| 54 | 54 | for($i=0;$i<$count;$i++){ |
| 55 | 55 | $step=$this->content[$i]; |
| 56 | 56 | $step->removeStatus(); |
| 57 | - if($i<$activestep) |
|
| 58 | - $step->setCompleted(); |
|
| 59 | - elseif ($i===$activestep) |
|
| 60 | - $step->setActive(); |
|
| 61 | - else |
|
| 62 | - $step->setDisabled(); |
|
| 57 | + if($i<$activestep) { |
|
| 58 | + $step->setCompleted(); |
|
| 59 | + } elseif ($i===$activestep) { |
|
| 60 | + $step->setActive(); |
|
| 61 | + } else { |
|
| 62 | + $step->setDisabled(); |
|
| 63 | + } |
|
| 63 | 64 | } |
| 64 | - }else{ |
|
| 65 | + } else{ |
|
| 65 | 66 | foreach ($this->content as $step){ |
| 66 | 67 | $step->removeStatus(); |
| 67 | 68 | } |
| 68 | - if($activestep<$count) |
|
| 69 | - $this->content[$activestep]->setActive(); |
|
| 69 | + if($activestep<$count) { |
|
| 70 | + $this->content[$activestep]->setActive(); |
|
| 71 | + } |
|
| 70 | 72 | } |
| 71 | 73 | return $this; |
| 72 | 74 | } |
| 73 | 75 | |
| 74 | 76 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 75 | - if(isset($this->_activeStep) && \is_numeric($this->_activeStep)) |
|
| 76 | - $this->defineActiveStep(); |
|
| 77 | + if(isset($this->_activeStep) && \is_numeric($this->_activeStep)) { |
|
| 78 | + $this->defineActiveStep(); |
|
| 79 | + } |
|
| 77 | 80 | return parent::compile($js,$view); |
| 78 | 81 | } |
| 79 | 82 | |
@@ -12,6 +12,9 @@ |
||
| 12 | 12 | class HtmlStep extends HtmlSemCollection{ |
| 13 | 13 | protected $_activeStep; |
| 14 | 14 | |
| 15 | + /** |
|
| 16 | + * @param string $identifier |
|
| 17 | + */ |
|
| 15 | 18 | public function __construct( $identifier,$steps=array()){ |
| 16 | 19 | parent::__construct( $identifier,"div", "ui steps"); |
| 17 | 20 | $this->addItems($steps); |
@@ -10,6 +10,9 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | protected $params=array(); |
| 12 | 12 | |
| 13 | + /** |
|
| 14 | + * @param string $identifier |
|
| 15 | + */ |
|
| 13 | 16 | public function __construct( $identifier, $tagName="div", $baseClass="ui"){ |
| 14 | 17 | parent::__construct( $identifier, "div", "ui accordion"); |
| 15 | 18 | } |
@@ -29,6 +32,9 @@ discard block |
||
| 29 | 32 | return ($value instanceof HtmlAccordionItem)===false; |
| 30 | 33 | } |
| 31 | 34 | |
| 35 | + /** |
|
| 36 | + * @param string $title |
|
| 37 | + */ |
|
| 32 | 38 | public function addPanel($title,$content){ |
| 33 | 39 | return $this->addItem([$title,$content]); |
| 34 | 40 | } |
@@ -6,31 +6,31 @@ discard block |
||
| 6 | 6 | use Ajax\semantic\html\content\HtmlAccordionItem; |
| 7 | 7 | use Ajax\JsUtils; |
| 8 | 8 | |
| 9 | -class HtmlAccordion extends HtmlSemCollection{ |
|
| 9 | +class HtmlAccordion extends HtmlSemCollection { |
|
| 10 | 10 | |
| 11 | 11 | protected $params=array(); |
| 12 | 12 | |
| 13 | - public function __construct( $identifier, $tagName="div", $baseClass="ui"){ |
|
| 14 | - parent::__construct( $identifier, "div", "ui accordion"); |
|
| 13 | + public function __construct($identifier, $tagName="div", $baseClass="ui") { |
|
| 14 | + parent::__construct($identifier, "div", "ui accordion"); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | |
| 18 | - protected function createItem($value){ |
|
| 18 | + protected function createItem($value) { |
|
| 19 | 19 | $count=$this->count(); |
| 20 | 20 | $title=$value; |
| 21 | 21 | $content=NULL; |
| 22 | - if(\is_array($value)){ |
|
| 23 | - $title=@$value[0];$content=@$value[1]; |
|
| 22 | + if (\is_array($value)) { |
|
| 23 | + $title=@$value[0]; $content=@$value[1]; |
|
| 24 | 24 | } |
| 25 | - return new HtmlAccordionItem("item-".$this->identifier."-".$count, $title,$content); |
|
| 25 | + return new HtmlAccordionItem("item-".$this->identifier."-".$count, $title, $content); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - protected function createCondition($value){ |
|
| 28 | + protected function createCondition($value) { |
|
| 29 | 29 | return ($value instanceof HtmlAccordionItem)===false; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function addPanel($title,$content){ |
|
| 33 | - return $this->addItem([$title,$content]); |
|
| 32 | + public function addPanel($title, $content) { |
|
| 33 | + return $this->addItem([$title, $content]); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | * @param string $action a Phalcon action |
| 43 | 43 | * @param array $params |
| 44 | 44 | */ |
| 45 | - public function forwardPanel(JsUtils $js,$title,$initialController,$controller,$action,$params=array()){ |
|
| 46 | - return $this->addPanel($title, $js->forward($initialController, $controller, $action,$params)); |
|
| 45 | + public function forwardPanel(JsUtils $js, $title, $initialController, $controller, $action, $params=array()) { |
|
| 46 | + return $this->addPanel($title, $js->forward($initialController, $controller, $action, $params)); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -54,30 +54,30 @@ discard block |
||
| 54 | 54 | * @param string $viewName |
| 55 | 55 | * @param $params The parameters to pass to the view |
| 56 | 56 | */ |
| 57 | - public function renderViewPanel(JsUtils $js,$title,$initialController, $viewName, $params=array()) { |
|
| 58 | - return $this->addPanel($title, $js->renderContent($initialController, $viewName,$params)); |
|
| 57 | + public function renderViewPanel(JsUtils $js, $title, $initialController, $viewName, $params=array()) { |
|
| 58 | + return $this->addPanel($title, $js->renderContent($initialController, $viewName, $params)); |
|
| 59 | 59 | } |
| 60 | 60 | /* |
| 61 | 61 | * (non-PHPdoc) |
| 62 | 62 | * @see BaseHtml::run() |
| 63 | 63 | */ |
| 64 | 64 | public function run(JsUtils $js) { |
| 65 | - if(isset($this->_bsComponent)===false) |
|
| 66 | - $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier,$this->params); |
|
| 65 | + if (isset($this->_bsComponent)===false) |
|
| 66 | + $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier, $this->params); |
|
| 67 | 67 | $this->addEventsOnRun($js); |
| 68 | 68 | return $this->_bsComponent; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - public function setStyled(){ |
|
| 71 | + public function setStyled() { |
|
| 72 | 72 | return $this->addToProperty("class", "styled"); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - public function activate($index){ |
|
| 75 | + public function activate($index) { |
|
| 76 | 76 | $this->getItem($index)->setActive(true); |
| 77 | 77 | return $this; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - public function setExclusive($value){ |
|
| 80 | + public function setExclusive($value) { |
|
| 81 | 81 | $this->params["exclusive"]=$value; |
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | \ No newline at end of file |
@@ -34,8 +34,9 @@ |
||
| 34 | 34 | * @see BaseHtml::run() |
| 35 | 35 | */ |
| 36 | 36 | public function run(JsUtils $js) { |
| 37 | - if(isset($this->_bsComponent)===false) |
|
| 38 | - $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier,$this->params); |
|
| 37 | + if(isset($this->_bsComponent)===false) { |
|
| 38 | + $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier,$this->params); |
|
| 39 | + } |
|
| 39 | 40 | $this->addEventsOnRun($js); |
| 40 | 41 | return $this->_bsComponent; |
| 41 | 42 | } |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | * @param string $value default : swing |
| 31 | 31 | */ |
| 32 | 32 | public function setEasing($value) { |
| 33 | - $this->setParamCtrl("easing", $value, array ( |
|
| 33 | + $this->setParamCtrl("easing", $value, array( |
|
| 34 | 34 | "linear", |
| 35 | 35 | "swing", |
| 36 | 36 | "easeInQuad", |