@@ -12,58 +12,58 @@ |
||
12 | 12 | protected $variation; |
13 | 13 | protected $params; |
14 | 14 | protected $semElement; |
15 | - public function __construct($semElement,$title="",$content="",$variation=NULL,$params=array()){ |
|
15 | + public function __construct($semElement, $title="", $content="", $variation=NULL, $params=array()) { |
|
16 | 16 | $this->semElement=$semElement; |
17 | 17 | $this->title=$title; |
18 | 18 | $this->content=$content; |
19 | - $this->setAttributes($variation,$params); |
|
19 | + $this->setAttributes($variation, $params); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | public function setHtml($html) { |
23 | - $this->html= $html; |
|
23 | + $this->html=$html; |
|
24 | 24 | return $this; |
25 | 25 | } |
26 | 26 | |
27 | - public function setAttributes($variation=NULL,$params=array()){ |
|
27 | + public function setAttributes($variation=NULL, $params=array()) { |
|
28 | 28 | $this->variation=$variation; |
29 | 29 | $this->params=$params; |
30 | 30 | } |
31 | 31 | |
32 | - public function onShow($jsCode){ |
|
32 | + public function onShow($jsCode) { |
|
33 | 33 | $this->params["onShow"]=$jsCode; |
34 | 34 | } |
35 | 35 | |
36 | - public function compile(JsUtils $js=NULL){ |
|
37 | - if(JString::isNotNull($this->title)){ |
|
36 | + public function compile(JsUtils $js=NULL) { |
|
37 | + if (JString::isNotNull($this->title)) { |
|
38 | 38 | $this->semElement->addToProperty("data-title", $this->title); |
39 | 39 | } |
40 | - if(JString::isNotNull($this->content)){ |
|
40 | + if (JString::isNotNull($this->content)) { |
|
41 | 41 | $this->semElement->addToProperty("data-content", $this->content); |
42 | 42 | } |
43 | - if(JString::isNotNull($this->html)){ |
|
43 | + if (JString::isNotNull($this->html)) { |
|
44 | 44 | $html=$this->html; |
45 | - if(\is_array($html)){ |
|
45 | + if (\is_array($html)) { |
|
46 | 46 | \array_walk($html, function(&$item) use($js){ |
47 | - if($item instanceof HtmlSemDoubleElement){ |
|
47 | + if ($item instanceof HtmlSemDoubleElement) { |
|
48 | 48 | $comp=$item->compile($js); |
49 | 49 | $bs=$item->run($js); |
50 | - if(isset($bs)) |
|
50 | + if (isset($bs)) |
|
51 | 51 | $this->params['onShow']=$bs->getScript(); |
52 | 52 | $item=$comp; |
53 | 53 | } |
54 | 54 | }); |
55 | - $html=\implode("",$html); |
|
55 | + $html=\implode("", $html); |
|
56 | 56 | } |
57 | 57 | $html=\str_replace("\"", "'", $html); |
58 | 58 | $this->semElement->addToProperty("data-html", $html); |
59 | 59 | } |
60 | - if(JString::isNotNull($this->variation)){ |
|
60 | + if (JString::isNotNull($this->variation)) { |
|
61 | 61 | $this->semElement->addToProperty("data-variation", $this->variation); |
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
65 | - public function run(JsUtils $js){ |
|
66 | - $js->semantic()->popup("#".$this->semElement->getIdentifier(),$this->params); |
|
65 | + public function run(JsUtils $js) { |
|
66 | + $js->semantic()->popup("#".$this->semElement->getIdentifier(), $this->params); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | } |
70 | 70 | \ No newline at end of file |
@@ -9,27 +9,27 @@ |
||
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 | 20 | $desc=@$content[2]; |
21 | - }else{ |
|
21 | + } else { |
|
22 | 22 | $icon=@$content["icon"]; |
23 | 23 | $title=@$content["title"]; |
24 | 24 | $desc=@$content["description"]; |
25 | 25 | } |
26 | - if(isset($icon)===true){ |
|
26 | + if (isset($icon)===true) { |
|
27 | 27 | $this->setIcon($icon); |
28 | 28 | } |
29 | - if(isset($title)===true){ |
|
30 | - $this->setTitle($title,$desc); |
|
29 | + if (isset($title)===true) { |
|
30 | + $this->setTitle($title, $desc); |
|
31 | 31 | } |
32 | - }else{ |
|
32 | + } else { |
|
33 | 33 | $this->setContent($content); |
34 | 34 | } |
35 | 35 | } |
@@ -17,19 +17,19 @@ discard block |
||
17 | 17 | class HtmlCard extends HtmlSemDoubleElement { |
18 | 18 | |
19 | 19 | public function __construct($identifier) { |
20 | - parent::__construct($identifier, "div", "ui card", array ()); |
|
20 | + parent::__construct($identifier, "div", "ui card", array()); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | private function createContent($content, $baseClass="content") { |
24 | 24 | $count=\sizeof($this->content); |
25 | - $result=new HtmlCardContent("content-" . $count . "-" . $this->identifier, $content); |
|
25 | + $result=new HtmlCardContent("content-".$count."-".$this->identifier, $content); |
|
26 | 26 | $result->setClass($baseClass); |
27 | 27 | return $result; |
28 | 28 | } |
29 | 29 | |
30 | 30 | private function addElementInContent($key, $element) { |
31 | - if (\array_key_exists($key, $this->content) === false) { |
|
32 | - $this->content[$key]=array (); |
|
31 | + if (\array_key_exists($key, $this->content)===false) { |
|
32 | + $this->content[$key]=array(); |
|
33 | 33 | } |
34 | 34 | $this->content[$key][]=$element; |
35 | 35 | return $element; |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | |
47 | 47 | public function addHeader($header, $niveau=4, $type="page") { |
48 | 48 | if (!$header instanceof HtmlHeader) { |
49 | - $header=new HtmlHeader("header-" . $this->identifier, $niveau, $header, $type); |
|
49 | + $header=new HtmlHeader("header-".$this->identifier, $niveau, $header, $type); |
|
50 | 50 | } |
51 | 51 | $this->content["header"]=$this->createContent($header); |
52 | 52 | } |
53 | 53 | |
54 | 54 | public function addImage($image, $title="") { |
55 | 55 | if (!$image instanceof HtmlImage) { |
56 | - $image=new HtmlImage("image-" . $this->identifier, $image, $title); |
|
56 | + $image=new HtmlImage("image-".$this->identifier, $image, $title); |
|
57 | 57 | } |
58 | 58 | $image->setClass("image"); |
59 | 59 | return $this->addElementInContent("content", $image); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | public function addReveal($visibleContent, $hiddenContent=NULL, $type=RevealType::FADE, $attributeType=NULL) { |
63 | 63 | $reveal=$visibleContent; |
64 | 64 | if (!$visibleContent instanceof HtmlReveal) { |
65 | - $reveal=new HtmlReveal("reveral-" . $this->identifier, $visibleContent, $hiddenContent, $type, $attributeType); |
|
65 | + $reveal=new HtmlReveal("reveral-".$this->identifier, $visibleContent, $hiddenContent, $type, $attributeType); |
|
66 | 66 | } |
67 | 67 | return $this->addElementInContent("content", $reveal); |
68 | 68 | } |
@@ -91,8 +91,8 @@ discard block |
||
91 | 91 | * @param string $asIcons |
92 | 92 | * @return \Ajax\semantic\html\elements\HtmlButtonGroups |
93 | 93 | */ |
94 | - public function addButtons($elements=array(), $asIcons=false){ |
|
95 | - $buttons=new HtmlButtonGroups("buttons-".$this->identifier,$elements,$asIcons); |
|
94 | + public function addButtons($elements=array(), $asIcons=false) { |
|
95 | + $buttons=new HtmlButtonGroups("buttons-".$this->identifier, $elements, $asIcons); |
|
96 | 96 | $this->addElementInContent("content", $buttons); |
97 | 97 | return $buttons; |
98 | 98 | } |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | |
102 | 102 | public function addCardHeaderContent($header, $metas=array(), $description=NULL) { |
103 | 103 | $count=\sizeof($this->content); |
104 | - return $this->addElementInContent("content", new HtmlCardHeaderContent("content-" . $count . "-" . $this->identifier, $header, $metas, $description)); |
|
104 | + return $this->addElementInContent("content", new HtmlCardHeaderContent("content-".$count."-".$this->identifier, $header, $metas, $description)); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | public function addCardContent($content=array()) { |
108 | 108 | $count=\sizeof($this->content); |
109 | - return $this->addElementInContent("content", new HtmlCardContent("content-" . $count . "-" . $this->identifier, $content)); |
|
109 | + return $this->addElementInContent("content", new HtmlCardContent("content-".$count."-".$this->identifier, $content)); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | public function getCardContent($index=NULL) { |
@@ -132,13 +132,13 @@ discard block |
||
132 | 132 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
133 | 133 | */ |
134 | 134 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
135 | - $this->content=JArray::sortAssociative($this->content, [ "header","image","content","extra-content" ]); |
|
135 | + $this->content=JArray::sortAssociative($this->content, ["header", "image", "content", "extra-content"]); |
|
136 | 136 | return parent::compile($js, $view); |
137 | 137 | } |
138 | 138 | |
139 | 139 | public function asLink($href="") { |
140 | 140 | $this->addToProperty("class", "link"); |
141 | - if ($href !== "") { |
|
141 | + if ($href!=="") { |
|
142 | 142 | $this->setProperty("href", $href); |
143 | 143 | } |
144 | 144 | return $this; |