@@ -17,14 +17,14 @@ discard block |
||
| 17 | 17 | abstract class HtmlViewItem extends HtmlSemDoubleElement { |
| 18 | 18 | use ContentPartTrait; |
| 19 | 19 | |
| 20 | - public function __construct($identifier,$baseClass,$content=NULL) { |
|
| 20 | + public function __construct($identifier, $baseClass, $content=NULL) { |
|
| 21 | 21 | parent::__construct($identifier, "div", $baseClass); |
| 22 | 22 | $this->content=["content"=>new HtmlViewContent("content-".$this->identifier)]; |
| 23 | - if(isset($content)) |
|
| 23 | + if (isset($content)) |
|
| 24 | 24 | $this->setContent($content); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public function setContent($value){ |
|
| 27 | + public function setContent($value) { |
|
| 28 | 28 | if (\is_array($value)) { |
| 29 | 29 | $image=JArray::getValue($value, "image", 0); |
| 30 | 30 | $content=JArray::getValue($value, "content", 1); |
@@ -32,57 +32,57 @@ discard block |
||
| 32 | 32 | if (isset($image)) { |
| 33 | 33 | $this->addImage($image); |
| 34 | 34 | } |
| 35 | - if(isset($content)) |
|
| 35 | + if (isset($content)) |
|
| 36 | 36 | $this->content["content"]->setContent($content); |
| 37 | - if(isset($extra)) |
|
| 37 | + if (isset($extra)) |
|
| 38 | 38 | $this->addExtraContent($extra); |
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | private function createContent($content, $baseClass="content") { |
| 43 | 43 | $count=\sizeof($this->content); |
| 44 | - $result=new HtmlViewContent("content-" . $count . "-" . $this->identifier, $content); |
|
| 44 | + $result=new HtmlViewContent("content-".$count."-".$this->identifier, $content); |
|
| 45 | 45 | $result->setClass($baseClass); |
| 46 | 46 | return $result; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | private function addElementIn($key, $element) { |
| 50 | - if (\array_key_exists($key, $this->content) === false) { |
|
| 50 | + if (\array_key_exists($key, $this->content)===false) { |
|
| 51 | 51 | $this->content[$key]=[]; |
| 52 | 52 | } |
| 53 | - if($this->content[$key] instanceof HtmlViewContent) |
|
| 53 | + if ($this->content[$key] instanceof HtmlViewContent) |
|
| 54 | 54 | $this->content[$key]->addElement($element); |
| 55 | 55 | else |
| 56 | 56 | $this->content[$key][]=$element; |
| 57 | 57 | return $element; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - public function addIcon($icon,$before=true){ |
|
| 61 | - return $this->addElementIn("icon",new HtmlIcon("icon-" . $this->identifier, $icon)); |
|
| 60 | + public function addIcon($icon, $before=true) { |
|
| 61 | + return $this->addElementIn("icon", new HtmlIcon("icon-".$this->identifier, $icon)); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | |
| 65 | 65 | public function addHeader($header, $niveau=4, $type="page") { |
| 66 | 66 | if (!$header instanceof HtmlHeader) { |
| 67 | - $header=new HtmlHeader("header-" . $this->identifier, $niveau, $header, $type); |
|
| 67 | + $header=new HtmlHeader("header-".$this->identifier, $niveau, $header, $type); |
|
| 68 | 68 | } |
| 69 | - return $this->addElementIn("header",$this->createContent($header)); |
|
| 69 | + return $this->addElementIn("header", $this->createContent($header)); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | public function addImage($image, $title="") { |
| 73 | 73 | if (!$image instanceof HtmlImage) { |
| 74 | - $image=new HtmlImage("image-" . $this->identifier, $image, $title); |
|
| 74 | + $image=new HtmlImage("image-".$this->identifier, $image, $title); |
|
| 75 | 75 | } |
| 76 | 76 | $image->setClass("ui image"); |
| 77 | - return $this->content["image"]= $image; |
|
| 77 | + return $this->content["image"]=$image; |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - public function addReveal($visibleContent, $hiddenContent=NULL, $type=RevealType::FADE, $attributeType=NULL,$key="extra-content") { |
|
| 80 | + public function addReveal($visibleContent, $hiddenContent=NULL, $type=RevealType::FADE, $attributeType=NULL, $key="extra-content") { |
|
| 81 | 81 | $reveal=$visibleContent; |
| 82 | 82 | if (!$visibleContent instanceof HtmlReveal) { |
| 83 | - $reveal=new HtmlReveal("reveral-" . $this->identifier, $visibleContent, $hiddenContent, $type, $attributeType); |
|
| 83 | + $reveal=new HtmlReveal("reveral-".$this->identifier, $visibleContent, $hiddenContent, $type, $attributeType); |
|
| 84 | 84 | } |
| 85 | - return $this->content[$key]= $reveal; |
|
| 85 | + return $this->content[$key]=$reveal; |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | public function addRevealImage($visibleContent, $hiddenContent=NULL, $type=RevealType::FADE, $attributeType=NULL) { |
@@ -90,11 +90,11 @@ discard block |
||
| 90 | 90 | if (!$visibleContent instanceof HtmlReveal) { |
| 91 | 91 | return $this->addReveal(new HtmlImage("", $visibleContent), new HtmlImage("", $hiddenContent), $type, $attributeType); |
| 92 | 92 | } |
| 93 | - return $this->content["image"]= $reveal; |
|
| 93 | + return $this->content["image"]=$reveal; |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | public function addExtraContent($content=array()) { |
| 97 | - return $this->content["extra-content"]= $this->createContent($content, "extra content"); |
|
| 97 | + return $this->content["extra-content"]=$this->createContent($content, "extra content"); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /*public function addContent($content=array(), $before=false) { |
@@ -112,23 +112,23 @@ discard block |
||
| 112 | 112 | * @param boolean $before |
| 113 | 113 | * @return HtmlButtonGroups |
| 114 | 114 | */ |
| 115 | - public function addContentButtons($elements=array(), $asIcons=false,$part="extra",$before=false){ |
|
| 116 | - return $this->content["content"]->addContentButtons($elements,$asIcons,$part, $before); |
|
| 115 | + public function addContentButtons($elements=array(), $asIcons=false, $part="extra", $before=false) { |
|
| 116 | + return $this->content["content"]->addContentButtons($elements, $asIcons, $part, $before); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | |
| 120 | 120 | |
| 121 | - public function addItemHeaderContent($header, $metas=array(), $description=NULL,$extra=NULL) { |
|
| 122 | - return $this->content["content"]->addHeaderContent($header, $metas, $description,$extra); |
|
| 121 | + public function addItemHeaderContent($header, $metas=array(), $description=NULL, $extra=NULL) { |
|
| 122 | + return $this->content["content"]->addHeaderContent($header, $metas, $description, $extra); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | public function addItemContent($content=array()) { |
| 126 | 126 | $count=\sizeof($this->content); |
| 127 | - return $this->addElementIn("content", new HtmlViewContent("content-" . $count . "-" . $this->identifier, $content)); |
|
| 127 | + return $this->addElementIn("content", new HtmlViewContent("content-".$count."-".$this->identifier, $content)); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | public function getItemContent() { |
| 131 | - return $this->getPart("content",null,true); |
|
| 131 | + return $this->getPart("content", null, true); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | public function getItemExtraContent() { |
@@ -150,13 +150,13 @@ discard block |
||
| 150 | 150 | * @see HtmlSemDoubleElement::compile() |
| 151 | 151 | */ |
| 152 | 152 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 153 | - $this->content=JArray::sortAssociative($this->content, ["header","image","icon","content","extra-content"]); |
|
| 153 | + $this->content=JArray::sortAssociative($this->content, ["header", "image", "icon", "content", "extra-content"]); |
|
| 154 | 154 | return parent::compile($js, $view); |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - public function asLink($href="",$target=NULL) { |
|
| 157 | + public function asLink($href="", $target=NULL) { |
|
| 158 | 158 | $this->addToProperty("class", "link"); |
| 159 | - if ($href !== "") { |
|
| 159 | + if ($href!=="") { |
|
| 160 | 160 | $this->setProperty("href", $href); |
| 161 | 161 | if (isset($target)) |
| 162 | 162 | $this->setProperty("target", $target); |
@@ -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 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | return $this->addItem($function($object)); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - public function run(JsUtils $js){ |
|
| 62 | + public function run(JsUtils $js) { |
|
| 63 | 63 | $result=parent::run($js); |
| 64 | 64 | return $result->setItemSelector(".item"); |
| 65 | 65 | } |