@@ -16,14 +16,14 @@ discard block |
||
| 16 | 16 | abstract class HtmlViewItem extends HtmlSemDoubleElement { |
| 17 | 17 | use ContentPartTrait; |
| 18 | 18 | |
| 19 | - public function __construct($identifier,$baseClass,$content=NULL) { |
|
| 19 | + public function __construct($identifier, $baseClass, $content=NULL) { |
|
| 20 | 20 | parent::__construct($identifier, "div", $baseClass); |
| 21 | 21 | $this->content=["content"=>new HtmlViewContent("content-".$this->identifier)]; |
| 22 | - if(isset($content)) |
|
| 22 | + if (isset($content)) |
|
| 23 | 23 | $this->setContent($content); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function setContent($value){ |
|
| 26 | + public function setContent($value) { |
|
| 27 | 27 | if (\is_array($value)) { |
| 28 | 28 | $image=JArray::getValue($value, "image", 0); |
| 29 | 29 | $content=JArray::getValue($value, "content", 1); |
@@ -31,57 +31,57 @@ discard block |
||
| 31 | 31 | if (isset($image)) { |
| 32 | 32 | $this->addImage($image); |
| 33 | 33 | } |
| 34 | - if(isset($content)) |
|
| 34 | + if (isset($content)) |
|
| 35 | 35 | $this->content["content"]->setContent($content); |
| 36 | - if(isset($extra)) |
|
| 36 | + if (isset($extra)) |
|
| 37 | 37 | $this->addExtraContent($extra); |
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | private function createContent($content, $baseClass="content") { |
| 42 | 42 | $count=\sizeof($this->content); |
| 43 | - $result=new HtmlViewContent("content-" . $count . "-" . $this->identifier, $content); |
|
| 43 | + $result=new HtmlViewContent("content-".$count."-".$this->identifier, $content); |
|
| 44 | 44 | $result->setClass($baseClass); |
| 45 | 45 | return $result; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | private function addElementIn($key, $element) { |
| 49 | - if (\array_key_exists($key, $this->content) === false) { |
|
| 49 | + if (\array_key_exists($key, $this->content)===false) { |
|
| 50 | 50 | $this->content[$key]=[]; |
| 51 | 51 | } |
| 52 | - if($this->content[$key] instanceof HtmlViewContent) |
|
| 52 | + if ($this->content[$key] instanceof HtmlViewContent) |
|
| 53 | 53 | $this->content[$key]->addElement($element); |
| 54 | 54 | else |
| 55 | 55 | $this->content[$key][]=$element; |
| 56 | 56 | return $element; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - public function addIcon($icon,$before=true){ |
|
| 60 | - return $this->addElementIn("icon",new HtmlIcon("icon-" . $this->identifier, $icon)); |
|
| 59 | + public function addIcon($icon, $before=true) { |
|
| 60 | + return $this->addElementIn("icon", new HtmlIcon("icon-".$this->identifier, $icon)); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | |
| 64 | 64 | public function addHeader($header, $niveau=4, $type="page") { |
| 65 | 65 | if (!$header instanceof HtmlHeader) { |
| 66 | - $header=new HtmlHeader("header-" . $this->identifier, $niveau, $header, $type); |
|
| 66 | + $header=new HtmlHeader("header-".$this->identifier, $niveau, $header, $type); |
|
| 67 | 67 | } |
| 68 | - return $this->addElementIn("header",$this->createContent($header)); |
|
| 68 | + return $this->addElementIn("header", $this->createContent($header)); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | public function addImage($image, $title="") { |
| 72 | 72 | if (!$image instanceof HtmlImage) { |
| 73 | - $image=new HtmlImage("image-" . $this->identifier, $image, $title); |
|
| 73 | + $image=new HtmlImage("image-".$this->identifier, $image, $title); |
|
| 74 | 74 | } |
| 75 | 75 | $image->setClass("ui image"); |
| 76 | - return $this->content["image"]= $image; |
|
| 76 | + return $this->content["image"]=$image; |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - public function addReveal($visibleContent, $hiddenContent=NULL, $type=RevealType::FADE, $attributeType=NULL,$key="extra-content") { |
|
| 79 | + public function addReveal($visibleContent, $hiddenContent=NULL, $type=RevealType::FADE, $attributeType=NULL, $key="extra-content") { |
|
| 80 | 80 | $reveal=$visibleContent; |
| 81 | 81 | if (!$visibleContent instanceof HtmlReveal) { |
| 82 | - $reveal=new HtmlReveal("reveral-" . $this->identifier, $visibleContent, $hiddenContent, $type, $attributeType); |
|
| 82 | + $reveal=new HtmlReveal("reveral-".$this->identifier, $visibleContent, $hiddenContent, $type, $attributeType); |
|
| 83 | 83 | } |
| 84 | - return $this->content[$key]= $reveal; |
|
| 84 | + return $this->content[$key]=$reveal; |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | public function addRevealImage($visibleContent, $hiddenContent=NULL, $type=RevealType::FADE, $attributeType=NULL) { |
@@ -89,11 +89,11 @@ discard block |
||
| 89 | 89 | if (!$visibleContent instanceof HtmlReveal) { |
| 90 | 90 | return $this->addReveal(new HtmlImage("", $visibleContent), new HtmlImage("", $hiddenContent), $type, $attributeType); |
| 91 | 91 | } |
| 92 | - return $this->content["image"]= $reveal; |
|
| 92 | + return $this->content["image"]=$reveal; |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | public function addExtraContent($content=array()) { |
| 96 | - return $this->content["extra-content"]= $this->createContent($content, "extra content"); |
|
| 96 | + return $this->content["extra-content"]=$this->createContent($content, "extra content"); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
@@ -103,23 +103,23 @@ discard block |
||
| 103 | 103 | * @param boolean $before |
| 104 | 104 | * @return HtmlButtonGroups |
| 105 | 105 | */ |
| 106 | - public function addContentButtons($elements=array(), $asIcons=false,$part="extra",$before=false){ |
|
| 107 | - return $this->content["content"]->addContentButtons($elements,$asIcons,$part, $before); |
|
| 106 | + public function addContentButtons($elements=array(), $asIcons=false, $part="extra", $before=false) { |
|
| 107 | + return $this->content["content"]->addContentButtons($elements, $asIcons, $part, $before); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | |
| 111 | 111 | |
| 112 | - public function addItemHeaderContent($header, $metas=array(), $description=NULL,$extra=NULL) { |
|
| 113 | - return $this->content["content"]->addHeaderContent($header, $metas, $description,$extra); |
|
| 112 | + public function addItemHeaderContent($header, $metas=array(), $description=NULL, $extra=NULL) { |
|
| 113 | + return $this->content["content"]->addHeaderContent($header, $metas, $description, $extra); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | public function addItemContent($content=array()) { |
| 117 | 117 | $count=\sizeof($this->content); |
| 118 | - return $this->addElementIn("content", new HtmlViewContent("content-" . $count . "-" . $this->identifier, $content)); |
|
| 118 | + return $this->addElementIn("content", new HtmlViewContent("content-".$count."-".$this->identifier, $content)); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | public function getItemContent() { |
| 122 | - return $this->getPart("content",null,true); |
|
| 122 | + return $this->getPart("content", null, true); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | public function getItemExtraContent() { |
@@ -141,13 +141,13 @@ discard block |
||
| 141 | 141 | * @see HtmlSemDoubleElement::compile() |
| 142 | 142 | */ |
| 143 | 143 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 144 | - $this->content=JArray::sortAssociative($this->content, ["header","image","icon","content","extra-content"]); |
|
| 144 | + $this->content=JArray::sortAssociative($this->content, ["header", "image", "icon", "content", "extra-content"]); |
|
| 145 | 145 | return parent::compile($js, $view); |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - public function asLink($href="",$target=NULL) { |
|
| 148 | + public function asLink($href="", $target=NULL) { |
|
| 149 | 149 | $this->addToProperty("class", "link"); |
| 150 | - if ($href !== "") { |
|
| 150 | + if ($href!=="") { |
|
| 151 | 151 | $this->setProperty("href", $href); |
| 152 | 152 | if (isset($target)) |
| 153 | 153 | $this->setProperty("target", $target); |
@@ -12,34 +12,34 @@ discard block |
||
| 12 | 12 | use Ajax\semantic\html\base\traits\MenuItemTrait; |
| 13 | 13 | |
| 14 | 14 | class HtmlDropdownItem extends HtmlSemDoubleElement { |
| 15 | - use IconTrait,MenuItemTrait; |
|
| 16 | - public function __construct($identifier, $content="",$value=NULL,$image=NULL,$description=NULL) { |
|
| 15 | + use IconTrait, MenuItemTrait; |
|
| 16 | + public function __construct($identifier, $content="", $value=NULL, $image=NULL, $description=NULL) { |
|
| 17 | 17 | parent::__construct($identifier, "a"); |
| 18 | 18 | $this->setClass("item"); |
| 19 | 19 | $this->setContent($content); |
| 20 | - if($value!==NULL) |
|
| 20 | + if ($value!==NULL) |
|
| 21 | 21 | $this->setData($value); |
| 22 | - if($image!==NULL) |
|
| 22 | + if ($image!==NULL) |
|
| 23 | 23 | $this->asMiniAvatar($image); |
| 24 | - if($description!==NULL) |
|
| 24 | + if ($description!==NULL) |
|
| 25 | 25 | $this->setDescription($description); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - public function setDescription($description){ |
|
| 29 | - $descO=new HtmlDoubleElement("desc-".$this->identifier,"span"); |
|
| 28 | + public function setDescription($description) { |
|
| 29 | + $descO=new HtmlDoubleElement("desc-".$this->identifier, "span"); |
|
| 30 | 30 | $descO->setClass("description"); |
| 31 | 31 | $descO->setContent($description); |
| 32 | - return $this->addContent($descO,true); |
|
| 32 | + return $this->addContent($descO, true); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - public function setData($value){ |
|
| 35 | + public function setData($value) { |
|
| 36 | 36 | $this->setProperty("data-value", $value); |
| 37 | 37 | return $this; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - public function asOption(){ |
|
| 40 | + public function asOption() { |
|
| 41 | 41 | $this->tagName="option"; |
| 42 | - if($this->getProperty("data-value")!==null) |
|
| 42 | + if ($this->getProperty("data-value")!==null) |
|
| 43 | 43 | $this->setProperty("value", $this->getProperty("data-value")); |
| 44 | 44 | } |
| 45 | 45 | |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | * @param string $image the image src |
| 48 | 48 | * @return $this |
| 49 | 49 | */ |
| 50 | - public function asMiniAvatar($image){ |
|
| 50 | + public function asMiniAvatar($image) { |
|
| 51 | 51 | $this->tagName="div"; |
| 52 | - $img=new HtmlImg("image-".$this->identifier,$image); |
|
| 52 | + $img=new HtmlImg("image-".$this->identifier, $image); |
|
| 53 | 53 | $img->setClass("ui mini avatar image"); |
| 54 | - $this->addContent($img,true); |
|
| 54 | + $this->addContent($img, true); |
|
| 55 | 55 | return $this; |
| 56 | 56 | } |
| 57 | 57 | |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | * @param string $icon |
| 61 | 61 | * @return HtmlDropdownItem |
| 62 | 62 | */ |
| 63 | - public function asIcon($caption,$icon){ |
|
| 63 | + public function asIcon($caption, $icon) { |
|
| 64 | 64 | $this->setContent($caption); |
| 65 | - $this->addContent(new HtmlIcon("", $icon),true); |
|
| 65 | + $this->addContent(new HtmlIcon("", $icon), true); |
|
| 66 | 66 | return $this; |
| 67 | 67 | } |
| 68 | 68 | |
@@ -71,23 +71,23 @@ discard block |
||
| 71 | 71 | * @param string $color |
| 72 | 72 | * @return HtmlDropdownItem |
| 73 | 73 | */ |
| 74 | - public function asCircularLabel($caption,$color){ |
|
| 74 | + public function asCircularLabel($caption, $color) { |
|
| 75 | 75 | $this->setContent($caption); |
| 76 | 76 | $lbl=new HtmlLabel(""); |
| 77 | 77 | $lbl->setCircular()->setColor($color)->setEmpty(); |
| 78 | - $this->addContent($lbl,true); |
|
| 78 | + $this->addContent($lbl, true); |
|
| 79 | 79 | return $this; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | |
| 83 | 83 | |
| 84 | 84 | public function addMenuItem($items) { |
| 85 | - $menu=new HtmlMenu("menu-" . $this->identifier, $items); |
|
| 85 | + $menu=new HtmlMenu("menu-".$this->identifier, $items); |
|
| 86 | 86 | $content=$this->content; |
| 87 | 87 | $this->setTagName("div"); |
| 88 | 88 | $this->setProperty("class", "item"); |
| 89 | 89 | $icon=new HtmlIcon("", "dropdown"); |
| 90 | - $this->content=[$icon,new HtmlSemDoubleElement("","span","text",$content),$menu]; |
|
| 90 | + $this->content=[$icon, new HtmlSemDoubleElement("", "span", "text", $content), $menu]; |
|
| 91 | 91 | return $menu; |
| 92 | 92 | } |
| 93 | 93 | |
@@ -96,14 +96,14 @@ discard block |
||
| 96 | 96 | * @param string $icon |
| 97 | 97 | * @return HtmlDropdownItem |
| 98 | 98 | */ |
| 99 | - public static function searchInput($placeholder=NULL,$icon=NULL){ |
|
| 100 | - return (new HtmlDropdownItem(""))->asSearchInput($placeholder,$icon); |
|
| 99 | + public static function searchInput($placeholder=NULL, $icon=NULL) { |
|
| 100 | + return (new HtmlDropdownItem(""))->asSearchInput($placeholder, $icon); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
| 104 | 104 | * @return HtmlDropdownItem |
| 105 | 105 | */ |
| 106 | - public static function divider(){ |
|
| 106 | + public static function divider() { |
|
| 107 | 107 | return (new HtmlDropdownItem(""))->asDivider(); |
| 108 | 108 | } |
| 109 | 109 | |
@@ -112,8 +112,8 @@ discard block |
||
| 112 | 112 | * @param string $icon |
| 113 | 113 | * @return HtmlDropdownItem |
| 114 | 114 | */ |
| 115 | - public static function header($caption=NULL,$icon=NULL){ |
|
| 116 | - return (new HtmlDropdownItem(""))->asHeader($caption,$icon); |
|
| 115 | + public static function header($caption=NULL, $icon=NULL) { |
|
| 116 | + return (new HtmlDropdownItem(""))->asHeader($caption, $icon); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
@@ -121,8 +121,8 @@ discard block |
||
| 121 | 121 | * @param string $color |
| 122 | 122 | * @return HtmlDropdownItem |
| 123 | 123 | */ |
| 124 | - public static function circular($caption,$color){ |
|
| 125 | - return (new HtmlDropdownItem(""))->asCircularLabel($caption,$color); |
|
| 124 | + public static function circular($caption, $color) { |
|
| 125 | + return (new HtmlDropdownItem(""))->asCircularLabel($caption, $color); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /** |
@@ -130,8 +130,8 @@ discard block |
||
| 130 | 130 | * @param string $icon |
| 131 | 131 | * @return HtmlDropdownItem |
| 132 | 132 | */ |
| 133 | - public static function icon($caption,$icon){ |
|
| 134 | - return (new HtmlDropdownItem(""))->asIcon($caption,$icon); |
|
| 133 | + public static function icon($caption, $icon) { |
|
| 134 | + return (new HtmlDropdownItem(""))->asIcon($caption, $icon); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** |
@@ -139,8 +139,8 @@ discard block |
||
| 139 | 139 | * @param string $image |
| 140 | 140 | * @return HtmlDropdownItem |
| 141 | 141 | */ |
| 142 | - public static function avatar($caption,$image){ |
|
| 143 | - $dd=new HtmlDropdownItem("",$caption); |
|
| 142 | + public static function avatar($caption, $image) { |
|
| 143 | + $dd=new HtmlDropdownItem("", $caption); |
|
| 144 | 144 | $dd->asMiniAvatar($image); |
| 145 | 145 | return $dd; |
| 146 | 146 | } |
@@ -38,22 +38,22 @@ discard block |
||
| 38 | 38 | return $this->getHtmlCk()->attachEvents($events); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - public function getField(){ |
|
| 41 | + public function getField() { |
|
| 42 | 42 | return $this->content["field"]; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - public function getHtmlCk(){ |
|
| 45 | + public function getHtmlCk() { |
|
| 46 | 46 | return $this->content["field"]; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - public function setName($name){ |
|
| 49 | + public function setName($name) { |
|
| 50 | 50 | $this->getDataField()->setProperty("name", $name); |
| 51 | 51 | return $this; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - public function getDataField(){ |
|
| 55 | - $field= $this->getField(); |
|
| 56 | - if($field instanceof AbstractCheckbox) |
|
| 54 | + public function getDataField() { |
|
| 55 | + $field=$this->getField(); |
|
| 56 | + if ($field instanceof AbstractCheckbox) |
|
| 57 | 57 | $field=$field->getField(); |
| 58 | 58 | return $field; |
| 59 | 59 | } |
@@ -63,10 +63,10 @@ discard block |
||
| 63 | 63 | * @param boolean $value |
| 64 | 64 | * @return $this |
| 65 | 65 | */ |
| 66 | - public function setChecked($value=true){ |
|
| 67 | - if($value===true){ |
|
| 66 | + public function setChecked($value=true) { |
|
| 67 | + if ($value===true) { |
|
| 68 | 68 | $this->getDataField()->setProperty("checked", "checked"); |
| 69 | - }else{ |
|
| 69 | + } else { |
|
| 70 | 70 | $this->getDataField()->removeProperty("checked"); |
| 71 | 71 | } |
| 72 | 72 | return $this; |
@@ -9,25 +9,25 @@ |
||
| 9 | 9 | class HtmlMenuItem extends HtmlSemDoubleElement { |
| 10 | 10 | use MenuItemTrait; |
| 11 | 11 | public function __construct($identifier, $content) { |
| 12 | - parent::__construct($identifier,"div","item",$content); |
|
| 12 | + parent::__construct($identifier, "div", "item", $content); |
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | - protected function initContent($content){ |
|
| 16 | - if(\is_array($content)){ |
|
| 17 | - if(JArray::isAssociative($content)===false){ |
|
| 15 | + protected function initContent($content) { |
|
| 16 | + if (\is_array($content)) { |
|
| 17 | + if (JArray::isAssociative($content)===false) { |
|
| 18 | 18 | $icon=@$content[0]; |
| 19 | 19 | $title=@$content[1]; |
| 20 | - }else{ |
|
| 20 | + } else { |
|
| 21 | 21 | $icon=@$content["icon"]; |
| 22 | 22 | $title=@$content["title"]; |
| 23 | 23 | } |
| 24 | - if(isset($icon)){ |
|
| 24 | + if (isset($icon)) { |
|
| 25 | 25 | $this->addIcon($icon); |
| 26 | 26 | } |
| 27 | - if(isset($title)){ |
|
| 27 | + if (isset($title)) { |
|
| 28 | 28 | $this->setTitle($title); |
| 29 | 29 | } |
| 30 | - }else{ |
|
| 30 | + } else { |
|
| 31 | 31 | $this->setContent($content); |
| 32 | 32 | } |
| 33 | 33 | } |
@@ -27,8 +27,8 @@ discard block |
||
| 27 | 27 | protected $_contentSeparator=""; |
| 28 | 28 | |
| 29 | 29 | |
| 30 | - public function __construct($identifier,$tagName,$baseClass){ |
|
| 31 | - parent::__construct($identifier,$tagName,$baseClass); |
|
| 30 | + public function __construct($identifier, $tagName, $baseClass) { |
|
| 31 | + parent::__construct($identifier, $tagName, $baseClass); |
|
| 32 | 32 | $this->root=""; |
| 33 | 33 | $this->attr="data-ajax"; |
| 34 | 34 | } |
@@ -38,37 +38,37 @@ discard block |
||
| 38 | 38 | * @param string $targetSelector the target of the get |
| 39 | 39 | * @return HtmlSemNavElement |
| 40 | 40 | */ |
| 41 | - public function autoGetOnClick($targetSelector){ |
|
| 42 | - return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
|
| 41 | + public function autoGetOnClick($targetSelector) { |
|
| 42 | + return $this->getOnClick($this->root, $targetSelector, array("attr"=>$this->attr)); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - public function contentAsString(){ |
|
| 45 | + public function contentAsString() { |
|
| 46 | 46 | return JArray::implode($this->_contentSeparator, $this->content); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - public function setContentDivider($divider,$index=NULL) { |
|
| 49 | + public function setContentDivider($divider, $index=NULL) { |
|
| 50 | 50 | $divider="<div class='divider'> {$divider} </div>"; |
| 51 | 51 | return $this->setDivider($divider, $index); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - public function setIconContentDivider($iconContentDivider,$index=NULL) { |
|
| 54 | + public function setIconContentDivider($iconContentDivider, $index=NULL) { |
|
| 55 | 55 | $contentDivider="<i class='".$iconContentDivider." icon divider'></i>"; |
| 56 | 56 | return $this->setDivider($contentDivider, $index); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - protected function setDivider($divider,$index){ |
|
| 60 | - if(isset($index)){ |
|
| 61 | - if(!\is_array($this->_contentSeparator)) |
|
| 62 | - $this->_contentSeparator=array_fill (0, $this->count()-1,$this->_contentSeparator); |
|
| 59 | + protected function setDivider($divider, $index) { |
|
| 60 | + if (isset($index)) { |
|
| 61 | + if (!\is_array($this->_contentSeparator)) |
|
| 62 | + $this->_contentSeparator=array_fill(0, $this->count()-1, $this->_contentSeparator); |
|
| 63 | 63 | $this->_contentSeparator[$index]=$divider; |
| 64 | - }else{ |
|
| 64 | + } else { |
|
| 65 | 65 | $this->_contentSeparator=$divider; |
| 66 | 66 | } |
| 67 | 67 | return $this; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - protected function getContentDivider($index){ |
|
| 71 | - if(\is_array($this->_contentSeparator)){ |
|
| 70 | + protected function getContentDivider($index) { |
|
| 71 | + if (\is_array($this->_contentSeparator)) { |
|
| 72 | 72 | return @$this->_contentSeparator[$index]; |
| 73 | 73 | } |
| 74 | 74 | return $this->_contentSeparator; |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | /** |
| 25 | 25 | * @return HtmlIcon |
| 26 | 26 | */ |
| 27 | - public function getItem($index){ |
|
| 27 | + public function getItem($index) { |
|
| 28 | 28 | return parent::getItem($index); |
| 29 | 29 | } |
| 30 | 30 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $icon=JArray::getValue($value, "icon", 0); |
| 35 | 35 | $size=JArray::getValue($value, "size", 1); |
| 36 | 36 | } |
| 37 | - $iconO=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
| 37 | + $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
|
| 38 | 38 | if (isset($size)) { |
| 39 | 39 | $iconO->setSize($size); |
| 40 | 40 | } |
@@ -42,15 +42,15 @@ discard block |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | protected function createCondition($value) { |
| 45 | - return ($value instanceof HtmlIcon) === false; |
|
| 45 | + return ($value instanceof HtmlIcon)===false; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | public function getIcon($index) { |
| 49 | 49 | return $this->content[$index]; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - public function run(JsUtils $js){ |
|
| 53 | - $result= parent::run($js); |
|
| 52 | + public function run(JsUtils $js) { |
|
| 53 | + $result=parent::run($js); |
|
| 54 | 54 | return $result->setItemSelector("i"); |
| 55 | 55 | } |
| 56 | 56 | |
@@ -59,8 +59,8 @@ discard block |
||
| 59 | 59 | return $this; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - public static function corner($mainIcon,$cornerIcon,$size="huge"){ |
|
| 63 | - $icons=new HtmlIconGroups("icons",[$mainIcon,$cornerIcon],$size); |
|
| 62 | + public static function corner($mainIcon, $cornerIcon, $size="huge") { |
|
| 63 | + $icons=new HtmlIconGroups("icons", [$mainIcon, $cornerIcon], $size); |
|
| 64 | 64 | return $icons->toCorner(1); |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @return HtmlIcon |
| 70 | 70 | */ |
| 71 | 71 | public function setFlipped($sens="horizontally") { |
| 72 | - return $this->addToProperty("class", "flipped " . $sens); |
|
| 72 | + return $this->addToProperty("class", "flipped ".$sens); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * @return HtmlIcon |
| 79 | 79 | */ |
| 80 | 80 | public function setRotated($sens="clockwise") { |
| 81 | - return $this->addToProperty("class", "rotated " . $sens); |
|
| 81 | + return $this->addToProperty("class", "rotated ".$sens); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -87,12 +87,12 @@ discard block |
||
| 87 | 87 | * @param string $target |
| 88 | 88 | * @return HtmlIcon |
| 89 | 89 | */ |
| 90 | - public function asLink($href=NULL,$target=NULL) { |
|
| 90 | + public function asLink($href=NULL, $target=NULL) { |
|
| 91 | 91 | if (isset($href)) { |
| 92 | 92 | $_target=""; |
| 93 | - if(isset($target)) |
|
| 93 | + if (isset($target)) |
|
| 94 | 94 | $_target="target='{$target}'"; |
| 95 | - $this->wrap("<a href='" . $href . "' {$_target}>", "</a>"); |
|
| 95 | + $this->wrap("<a href='".$href."' {$_target}>", "</a>"); |
|
| 96 | 96 | } |
| 97 | 97 | return $this->addToProperty("class", "link"); |
| 98 | 98 | } |
@@ -108,9 +108,9 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function setBordered($inverted=false) { |
| 110 | 110 | $invertedStr=""; |
| 111 | - if ($inverted !== false) |
|
| 111 | + if ($inverted!==false) |
|
| 112 | 112 | $invertedStr=" inverted"; |
| 113 | - return $this->addToProperty("class", "bordered" . $invertedStr); |
|
| 113 | + return $this->addToProperty("class", "bordered".$invertedStr); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /** |
@@ -122,11 +122,11 @@ discard block |
||
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | public function addLabel($label, $before=false, $icon=NULL) { |
| 125 | - if($before) |
|
| 125 | + if ($before) |
|
| 126 | 126 | $this->wrap($label); |
| 127 | 127 | else |
| 128 | 128 | $this->wrap("", $label); |
| 129 | - if(isset($icon)) |
|
| 129 | + if (isset($icon)) |
|
| 130 | 130 | $this->addToIcon($icon); |
| 131 | 131 | return $this; |
| 132 | 132 | } |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | abstract class HtmlViewGroups extends HtmlSemCollection { |
| 11 | 11 | |
| 12 | - public function __construct($identifier, $uiClass,$items=array()) { |
|
| 12 | + public function __construct($identifier, $uiClass, $items=array()) { |
|
| 13 | 13 | parent::__construct($identifier, "div", $uiClass); |
| 14 | 14 | $this->addItems($items); |
| 15 | 15 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * @param int $wide |
| 42 | 42 | */ |
| 43 | 43 | public function setWide($wide) { |
| 44 | - $wide=Wide::getConstants()["W" . $wide]; |
|
| 44 | + $wide=Wide::getConstants()["W".$wide]; |
|
| 45 | 45 | return $this->addToPropertyCtrl("class", $wide, Wide::getConstants()); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | /** |
| 51 | 51 | * @return HtmlViewGroups |
| 52 | 52 | */ |
| 53 | - public function getItem($index){ |
|
| 53 | + public function getItem($index) { |
|
| 54 | 54 | return parent::getItem($index); |
| 55 | 55 | } |
| 56 | 56 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | return $this->addItem($function($object)); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - public function run(JsUtils $js){ |
|
| 68 | + public function run(JsUtils $js) { |
|
| 69 | 69 | $result=parent::run($js); |
| 70 | 70 | return $result->setItemSelector(".item"); |
| 71 | 71 | } |
@@ -29,16 +29,16 @@ discard block |
||
| 29 | 29 | $this->_colSizing=false; |
| 30 | 30 | $this->setWide($numCols); |
| 31 | 31 | } |
| 32 | - if($createCols) |
|
| 32 | + if ($createCols) |
|
| 33 | 33 | $this->setRowsCount($numRows, $numCols); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | public function asSegment() { |
| 37 | - return $this->addToPropertyCtrl("class", "segment", array ("segment" )); |
|
| 37 | + return $this->addToPropertyCtrl("class", "segment", array("segment")); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function asContainer() { |
| 41 | - return $this->addToPropertyCtrl("class", "container", array ("container" )); |
|
| 41 | + return $this->addToPropertyCtrl("class", "container", array("container")); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -46,10 +46,10 @@ discard block |
||
| 46 | 46 | * @param int $wide |
| 47 | 47 | */ |
| 48 | 48 | public function setWide($wide) { |
| 49 | - if(isset(Wide::getConstants()["W" . $wide])){ |
|
| 50 | - $wide=Wide::getConstants()["W" . $wide]; |
|
| 49 | + if (isset(Wide::getConstants()["W".$wide])) { |
|
| 50 | + $wide=Wide::getConstants()["W".$wide]; |
|
| 51 | 51 | $this->addToPropertyCtrl("class", $wide, Wide::getConstants()); |
| 52 | - return $this->addToPropertyCtrl("class", "column", array ("column" )); |
|
| 52 | + return $this->addToPropertyCtrl("class", "column", array("column")); |
|
| 53 | 53 | } |
| 54 | 54 | return $this; |
| 55 | 55 | } |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | * @return mixed |
| 70 | 70 | */ |
| 71 | 71 | public function addRow($colsCount=NULL) { |
| 72 | - $rowCount=$this->rowCount() + 1; |
|
| 72 | + $rowCount=$this->rowCount()+1; |
|
| 73 | 73 | $this->setRowsCount($rowCount, $colsCount, true); |
| 74 | - return $this->content[$rowCount - 1]; |
|
| 74 | + return $this->content[$rowCount-1]; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -80,10 +80,10 @@ discard block |
||
| 80 | 80 | * @return mixed|\Ajax\semantic\html\collections\HtmlGrid |
| 81 | 81 | */ |
| 82 | 82 | public function addCol($width=NULL) { |
| 83 | - $colCount=$this->colCount() + 1; |
|
| 83 | + $colCount=$this->colCount()+1; |
|
| 84 | 84 | $this->setColsCount($colCount, true, $width); |
| 85 | 85 | if ($this->hasOnlyCols($this->count())) |
| 86 | - return $this->content[$colCount - 1]; |
|
| 86 | + return $this->content[$colCount-1]; |
|
| 87 | 87 | return $this; |
| 88 | 88 | } |
| 89 | 89 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 94 | 94 | */ |
| 95 | 95 | public function addCols($sizes=array()) { |
| 96 | - foreach ( $sizes as $size ) { |
|
| 96 | + foreach ($sizes as $size) { |
|
| 97 | 97 | $this->addCol($size); |
| 98 | 98 | } |
| 99 | 99 | return $this; |
@@ -107,19 +107,19 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | public function setRowsCount($rowsCount, $colsCount=NULL, $force=false) { |
| 109 | 109 | $count=$this->count(); |
| 110 | - if ($rowsCount < 2 && $force === false) { |
|
| 111 | - for($i=$count; $i < $colsCount; $i++) { |
|
| 112 | - $this->addItem(new HtmlGridCol("col-" . $this->identifier . "-" . $i)); |
|
| 110 | + if ($rowsCount<2 && $force===false) { |
|
| 111 | + for ($i=$count; $i<$colsCount; $i++) { |
|
| 112 | + $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i)); |
|
| 113 | 113 | } |
| 114 | 114 | } else { |
| 115 | 115 | if ($this->hasOnlyCols($count)) { |
| 116 | 116 | $tmpContent=$this->content; |
| 117 | 117 | $item=$this->addItem($colsCount); |
| 118 | 118 | $item->setContent($tmpContent); |
| 119 | - $this->content=array (); |
|
| 119 | + $this->content=array(); |
|
| 120 | 120 | $count=1; |
| 121 | 121 | } |
| 122 | - for($i=$count; $i < $rowsCount; $i++) { |
|
| 122 | + for ($i=$count; $i<$rowsCount; $i++) { |
|
| 123 | 123 | $this->addItem($colsCount); |
| 124 | 124 | } |
| 125 | 125 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | protected function hasOnlyCols($count) { |
| 130 | - return $count > 0 && $this->content[0] instanceof HtmlGridCol; |
|
| 130 | + return $count>0 && $this->content[0] instanceof HtmlGridCol; |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** |
@@ -141,14 +141,14 @@ discard block |
||
| 141 | 141 | if (isset($width)===false) { |
| 142 | 142 | $this->setWide($numCols); |
| 143 | 143 | } |
| 144 | - if ($toCreate === true) { |
|
| 144 | + if ($toCreate===true) { |
|
| 145 | 145 | $count=$this->count(); |
| 146 | - if ($count == 0 || $this->hasOnlyCols($count)) { |
|
| 147 | - for($i=$count; $i < $numCols; $i++) { |
|
| 148 | - $this->addItem(new HtmlGridCol("col-" . $this->identifier . "-" . $i, $width)); |
|
| 146 | + if ($count==0 || $this->hasOnlyCols($count)) { |
|
| 147 | + for ($i=$count; $i<$numCols; $i++) { |
|
| 148 | + $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i, $width)); |
|
| 149 | 149 | } |
| 150 | 150 | } else { |
| 151 | - for($i=0; $i < $count; $i++) { |
|
| 151 | + for ($i=0; $i<$count; $i++) { |
|
| 152 | 152 | $this->getItem($i)->setColsCount($numCols); |
| 153 | 153 | } |
| 154 | 154 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | /** |
| 169 | 169 | * @return HtmlGridRow |
| 170 | 170 | */ |
| 171 | - public function getItem($index){ |
|
| 171 | + public function getItem($index) { |
|
| 172 | 172 | return parent::getItem($index); |
| 173 | 173 | } |
| 174 | 174 | |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | $count=$this->count(); |
| 192 | 192 | if ($this->hasOnlyCols($count)) |
| 193 | 193 | return $count; |
| 194 | - if ($count > 0) |
|
| 194 | + if ($count>0) |
|
| 195 | 195 | return $this->getItem(0)->count(); |
| 196 | 196 | return 0; |
| 197 | 197 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | * @return HtmlGridCol|HtmlGridRow |
| 204 | 204 | */ |
| 205 | 205 | public function getCell($row, $col) { |
| 206 | - if ($row < 2 && $this->hasOnlyCols($this->count())) |
|
| 206 | + if ($row<2 && $this->hasOnlyCols($this->count())) |
|
| 207 | 207 | return $this->getItem($col); |
| 208 | 208 | $rowO=$this->getItem($row); |
| 209 | 209 | if (isset($rowO)) { |
@@ -218,8 +218,8 @@ discard block |
||
| 218 | 218 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 219 | 219 | */ |
| 220 | 220 | public function setDivided($vertically=false) { |
| 221 | - $value=($vertically === true) ? "vertically divided" : "divided"; |
|
| 222 | - return $this->addToPropertyCtrl("class", $value, array ("divided" )); |
|
| 221 | + $value=($vertically===true) ? "vertically divided" : "divided"; |
|
| 222 | + return $this->addToPropertyCtrl("class", $value, array("divided")); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | /** |
@@ -228,15 +228,15 @@ discard block |
||
| 228 | 228 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 229 | 229 | */ |
| 230 | 230 | public function setCelled($internally=false) { |
| 231 | - $value=($internally === true) ? "internally celled" : "celled"; |
|
| 232 | - return $this->addToPropertyCtrl("class", $value, array ("celled","internally celled" )); |
|
| 231 | + $value=($internally===true) ? "internally celled" : "celled"; |
|
| 232 | + return $this->addToPropertyCtrl("class", $value, array("celled", "internally celled")); |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | /** |
| 236 | 236 | * A grid can have its columns centered |
| 237 | 237 | */ |
| 238 | 238 | public function setCentered() { |
| 239 | - return $this->addToPropertyCtrl("class", "centered", array ("centered" )); |
|
| 239 | + return $this->addToPropertyCtrl("class", "centered", array("centered")); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | /** |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | */ |
| 255 | 255 | public function setPadded($value=NULL) { |
| 256 | 256 | if (isset($value)) |
| 257 | - $this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" )); |
|
| 257 | + $this->addToPropertyCtrl("class", $value, array("vertically", "horizontally")); |
|
| 258 | 258 | return $this->addToProperty("class", "padded"); |
| 259 | 259 | } |
| 260 | 260 | |
@@ -264,12 +264,12 @@ discard block |
||
| 264 | 264 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 265 | 265 | */ |
| 266 | 266 | public function setRelaxed($very=false) { |
| 267 | - $value=($very === true) ? "very relaxed" : "relaxed"; |
|
| 268 | - return $this->addToPropertyCtrl("class", $value, array ("relaxed","very relaxed" )); |
|
| 267 | + $value=($very===true) ? "very relaxed" : "relaxed"; |
|
| 268 | + return $this->addToPropertyCtrl("class", $value, array("relaxed", "very relaxed")); |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | public function setVerticalAlignment($value=VerticalAlignment::MIDDLE) { |
| 272 | - return $this->addToPropertyCtrl("class", $value . " aligned", VerticalAlignment::getConstantValues("aligned")); |
|
| 272 | + return $this->addToPropertyCtrl("class", $value." aligned", VerticalAlignment::getConstantValues("aligned")); |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | /** |
@@ -279,9 +279,9 @@ discard block |
||
| 279 | 279 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 280 | 280 | */ |
| 281 | 281 | protected function createItem($value) { |
| 282 | - if ($this->_createCols === false) |
|
| 282 | + if ($this->_createCols===false) |
|
| 283 | 283 | $value=null; |
| 284 | - $item=new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $value, $this->_colSizing, $this->_implicitRows); |
|
| 284 | + $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1), $value, $this->_colSizing, $this->_implicitRows); |
|
| 285 | 285 | return $item; |
| 286 | 286 | } |
| 287 | 287 | |
@@ -292,20 +292,20 @@ discard block |
||
| 292 | 292 | public function setValues($values, $force=true) { |
| 293 | 293 | $count=$this->count(); |
| 294 | 294 | $valuesSize=\sizeof($values); |
| 295 | - if ($this->_createCols === false || $force === true) { |
|
| 296 | - for($i=$count; $i < $valuesSize; $i++) { |
|
| 295 | + if ($this->_createCols===false || $force===true) { |
|
| 296 | + for ($i=$count; $i<$valuesSize; $i++) { |
|
| 297 | 297 | $colSize=\sizeof($values[$i]); |
| 298 | - $this->addItem(new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $colSize, $this->_colSizing, $this->_implicitRows)); |
|
| 298 | + $this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1), $colSize, $this->_colSizing, $this->_implicitRows)); |
|
| 299 | 299 | } |
| 300 | 300 | } |
| 301 | - $count=\min(array ($this->count(),$valuesSize )); |
|
| 302 | - for($i=0; $i < $count; $i++) { |
|
| 303 | - $this->content[$i]->setValues($values[$i], $this->_createCols === false); |
|
| 301 | + $count=\min(array($this->count(), $valuesSize)); |
|
| 302 | + for ($i=0; $i<$count; $i++) { |
|
| 303 | + $this->content[$i]->setValues($values[$i], $this->_createCols===false); |
|
| 304 | 304 | } |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | - public function setColWidth($numCol,$width){ |
|
| 308 | - foreach ($this->content as $row){ |
|
| 307 | + public function setColWidth($numCol, $width) { |
|
| 308 | + foreach ($this->content as $row) { |
|
| 309 | 309 | $row->getCol($numCol)->setWidth($width); |
| 310 | 310 | } |
| 311 | 311 | return $this; |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | */ |
| 329 | 329 | public function addDivider($afterColIndex, $vertical=true, $content=NULL) { |
| 330 | 330 | $col=$this->getCell(0, $afterColIndex); |
| 331 | - if($col instanceof HtmlGridCol) |
|
| 331 | + if ($col instanceof HtmlGridCol) |
|
| 332 | 332 | $col->addDivider($vertical, $content); |
| 333 | 333 | return $this; |
| 334 | 334 | } |