@@ -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,59 +19,59 @@ 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 removeIcon(){ |
|
27 | - if(isset($this->content["icon"])) |
|
26 | + public function removeIcon() { |
|
27 | + if (isset($this->content["icon"])) |
|
28 | 28 | unset($this->content["icon"]); |
29 | 29 | return $this; |
30 | 30 | } |
31 | 31 | |
32 | - public function setImage($image){ |
|
32 | + public function setImage($image) { |
|
33 | 33 | $image=new HtmlImg("icon-".$this->identifier, $image); |
34 | 34 | $image->asAvatar(); |
35 | 35 | $this->content["image"]=$image; |
36 | 36 | } |
37 | 37 | |
38 | - private function createContent(){ |
|
39 | - $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier,"div","content"); |
|
38 | + private function createContent() { |
|
39 | + $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content"); |
|
40 | 40 | return $this->content["content"]; |
41 | 41 | } |
42 | 42 | |
43 | - public function setTitle($title,$description=NULL,$baseClass="title"){ |
|
44 | - $title=new HtmlSemDoubleElement("","div",$baseClass,$title); |
|
45 | - if(\array_key_exists("content", $this->content)===false){ |
|
43 | + public function setTitle($title, $description=NULL, $baseClass="title") { |
|
44 | + $title=new HtmlSemDoubleElement("", "div", $baseClass, $title); |
|
45 | + if (\array_key_exists("content", $this->content)===false) { |
|
46 | 46 | $this->createContent(); |
47 | 47 | } |
48 | 48 | $this->content["content"]->addContent($title); |
49 | - if(isset($description)){ |
|
50 | - $description=new HtmlSemDoubleElement("","div","description",$description); |
|
49 | + if (isset($description)) { |
|
50 | + $description=new HtmlSemDoubleElement("", "div", "description", $description); |
|
51 | 51 | $this->content["content"]->addContent($description); |
52 | 52 | } |
53 | 53 | return $this; |
54 | 54 | } |
55 | 55 | |
56 | - public function getPart($partName="header"){ |
|
57 | - $content=\array_merge($this->content["content"]->getContent(),array(@$this->content["icon"],@$this->content["image"])); |
|
56 | + public function getPart($partName="header") { |
|
57 | + $content=\array_merge($this->content["content"]->getContent(), array(@$this->content["icon"], @$this->content["image"])); |
|
58 | 58 | return $this->getElementByPropertyValue("class", $partName, $content); |
59 | 59 | } |
60 | 60 | |
61 | - public function setActive($value=true){ |
|
62 | - if($value){ |
|
61 | + public function setActive($value=true) { |
|
62 | + if ($value) { |
|
63 | 63 | $this->setTagName("div"); |
64 | 64 | $this->removeProperty("href"); |
65 | 65 | $this->addToPropertyCtrl("class", "active", array("active")); |
66 | - }else{ |
|
66 | + } else { |
|
67 | 67 | $this->removePropertyValue("class", "active"); |
68 | 68 | } |
69 | 69 | return $this; |
70 | 70 | } |
71 | 71 | |
72 | - public function asLink($href=NULL,$part=NULL){ |
|
72 | + public function asLink($href=NULL, $part=NULL) { |
|
73 | 73 | $this->setTagName("a"); |
74 | - if(isset($href)) |
|
74 | + if (isset($href)) |
|
75 | 75 | $this->setProperty("href", $href); |
76 | 76 | return $this; |
77 | 77 | } |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
84 | 84 | */ |
85 | 85 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
86 | - if(\is_array($this->content) && JArray::isAssociative($this->content)) |
|
87 | - $this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]); |
|
86 | + if (\is_array($this->content) && JArray::isAssociative($this->content)) |
|
87 | + $this->content=JArray::sortAssociative($this->content, ["icon", "image", "content"]); |
|
88 | 88 | return parent::compile($js, $view); |
89 | 89 | } |
90 | 90 | } |
@@ -24,8 +24,9 @@ discard block |
||
24 | 24 | } |
25 | 25 | |
26 | 26 | public function removeIcon(){ |
27 | - if(isset($this->content["icon"])) |
|
28 | - unset($this->content["icon"]); |
|
27 | + if(isset($this->content["icon"])) { |
|
28 | + unset($this->content["icon"]); |
|
29 | + } |
|
29 | 30 | return $this; |
30 | 31 | } |
31 | 32 | |
@@ -63,7 +64,7 @@ discard block |
||
63 | 64 | $this->setTagName("div"); |
64 | 65 | $this->removeProperty("href"); |
65 | 66 | $this->addToPropertyCtrl("class", "active", array("active")); |
66 | - }else{ |
|
67 | + } else{ |
|
67 | 68 | $this->removePropertyValue("class", "active"); |
68 | 69 | } |
69 | 70 | return $this; |
@@ -71,8 +72,9 @@ discard block |
||
71 | 72 | |
72 | 73 | public function asLink($href=NULL,$part=NULL){ |
73 | 74 | $this->setTagName("a"); |
74 | - if(isset($href)) |
|
75 | - $this->setProperty("href", $href); |
|
75 | + if(isset($href)) { |
|
76 | + $this->setProperty("href", $href); |
|
77 | + } |
|
76 | 78 | return $this; |
77 | 79 | } |
78 | 80 | |
@@ -83,8 +85,9 @@ discard block |
||
83 | 85 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
84 | 86 | */ |
85 | 87 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
86 | - if(\is_array($this->content) && JArray::isAssociative($this->content)) |
|
87 | - $this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]); |
|
88 | + if(\is_array($this->content) && JArray::isAssociative($this->content)) { |
|
89 | + $this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]); |
|
90 | + } |
|
88 | 91 | return parent::compile($js, $view); |
89 | 92 | } |
90 | 93 | } |
@@ -8,54 +8,54 @@ |
||
8 | 8 | class HtmlStepItem extends HtmlAbsractItem { |
9 | 9 | |
10 | 10 | public function __construct($identifier, $content) { |
11 | - parent::__construct($identifier,"step",$content); |
|
11 | + parent::__construct($identifier, "step", $content); |
|
12 | 12 | } |
13 | - protected function initContent($content){ |
|
14 | - if(\is_array($content)){ |
|
15 | - if(JArray::isAssociative($content)===false){ |
|
13 | + protected function initContent($content) { |
|
14 | + if (\is_array($content)) { |
|
15 | + if (JArray::isAssociative($content)===false) { |
|
16 | 16 | $icon=@$content[0]; |
17 | 17 | $title=@$content[1]; |
18 | 18 | $desc=@$content[2]; |
19 | 19 | $status=@$content[3]; |
20 | - }else{ |
|
20 | + } else { |
|
21 | 21 | $icon=@$content["icon"]; |
22 | 22 | $title=@$content["title"]; |
23 | 23 | $desc=@$content["description"]; |
24 | 24 | $status=@$content["status"]; |
25 | 25 | } |
26 | - if(isset($icon)){ |
|
26 | + if (isset($icon)) { |
|
27 | 27 | $this->setIcon($icon); |
28 | 28 | } |
29 | - if(isset($status)){ |
|
29 | + if (isset($status)) { |
|
30 | 30 | $this->setStatus($status); |
31 | 31 | } |
32 | - if(isset($title)){ |
|
33 | - $this->setTitle($title,$desc); |
|
32 | + if (isset($title)) { |
|
33 | + $this->setTitle($title, $desc); |
|
34 | 34 | } |
35 | - }else{ |
|
35 | + } else { |
|
36 | 36 | $this->setContent($content); |
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
40 | - public function setActive($value=true){ |
|
41 | - if($value) |
|
40 | + public function setActive($value=true) { |
|
41 | + if ($value) |
|
42 | 42 | $this->setStatus(StepStatus::ACTIVE); |
43 | 43 | else |
44 | 44 | $this->setStatus(StepStatus::NONE); |
45 | 45 | return $this; |
46 | 46 | } |
47 | 47 | |
48 | - public function setCompleted(){ |
|
48 | + public function setCompleted() { |
|
49 | 49 | $this->removeIcon(); |
50 | - $this->removePropertyValues("class", [StepStatus::COMPLETED,StepStatus::DISABLED]); |
|
50 | + $this->removePropertyValues("class", [StepStatus::COMPLETED, StepStatus::DISABLED]); |
|
51 | 51 | return $this->setStatus(StepStatus::COMPLETED); |
52 | 52 | } |
53 | 53 | |
54 | - public function setStatus($status){ |
|
54 | + public function setStatus($status) { |
|
55 | 55 | return $this->addToPropertyCtrl("class", $status, StepStatus::getConstants()); |
56 | 56 | } |
57 | 57 | |
58 | - public function removeStatus(){ |
|
58 | + public function removeStatus() { |
|
59 | 59 | $this->removePropertyValues("class", StepStatus::getConstants()); |
60 | 60 | } |
61 | 61 | } |