@@ -13,7 +13,7 @@ |
||
13 | 13 | |
14 | 14 | class HtmlSemSingleElement extends HtmlSingleElement { |
15 | 15 | use BaseTrait; |
16 | - public function __construct($identifier, $tagName="br",$baseClass="ui") { |
|
16 | + public function __construct($identifier, $tagName="br", $baseClass="ui") { |
|
17 | 17 | parent::__construct($identifier, $tagName); |
18 | 18 | $this->_baseClass=$baseClass; |
19 | 19 | $this->setClass($baseClass); |
@@ -5,5 +5,5 @@ |
||
5 | 5 | use Ajax\common\BaseEnum; |
6 | 6 | |
7 | 7 | class TextAlignment extends BaseEnum { |
8 | - const LEFT="left aligned",CENTER="center aligned",RIGHT="right aligned",JUSTIFIED="justified"; |
|
8 | + const LEFT="left aligned", CENTER="center aligned", RIGHT="right aligned", JUSTIFIED="justified"; |
|
9 | 9 | } |
10 | 10 | \ No newline at end of file |
@@ -2,5 +2,5 @@ |
||
2 | 2 | namespace Ajax\semantic\html\base\constants; |
3 | 3 | use Ajax\common\BaseEnum; |
4 | 4 | abstract class Sens extends BaseEnum { |
5 | - const VERTICAL="vertical", HORIZONTAL="horizontal",NONE=""; |
|
5 | + const VERTICAL="vertical", HORIZONTAL="horizontal", NONE=""; |
|
6 | 6 | } |
7 | 7 | \ No newline at end of file |
@@ -5,5 +5,5 @@ |
||
5 | 5 | use Ajax\common\BaseEnum; |
6 | 6 | |
7 | 7 | class VerticalAlignment extends BaseEnum { |
8 | - const TOP="top",MIDDLE="middle",BOTTOM="bottom"; |
|
8 | + const TOP="top", MIDDLE="middle", BOTTOM="bottom"; |
|
9 | 9 | } |
10 | 10 | \ No newline at end of file |
@@ -5,5 +5,5 @@ |
||
5 | 5 | use Ajax\common\BaseEnum; |
6 | 6 | |
7 | 7 | abstract class Side extends BaseEnum { |
8 | - const BOTTOM="bottom",BOTH="",TOP="top"; |
|
8 | + const BOTTOM="bottom", BOTH="", TOP="top"; |
|
9 | 9 | } |
10 | 10 | \ No newline at end of file |
@@ -6,20 +6,20 @@ discard block |
||
6 | 6 | use Ajax\semantic\html\base\HtmlSemCollection; |
7 | 7 | use Ajax\semantic\html\base\constants\Sens; |
8 | 8 | |
9 | -class HtmlSegmentGroups extends HtmlSemCollection{ |
|
9 | +class HtmlSegmentGroups extends HtmlSemCollection { |
|
10 | 10 | |
11 | 11 | |
12 | - public function __construct( $identifier, $items=array()){ |
|
13 | - parent::__construct( $identifier, "div","ui segments"); |
|
12 | + public function __construct($identifier, $items=array()) { |
|
13 | + parent::__construct($identifier, "div", "ui segments"); |
|
14 | 14 | $this->addItems($items); |
15 | 15 | } |
16 | 16 | |
17 | 17 | |
18 | - protected function createItem($value){ |
|
19 | - return new HtmlSegment("segment-".$this->count(),$value); |
|
18 | + protected function createItem($value) { |
|
19 | + return new HtmlSegment("segment-".$this->count(), $value); |
|
20 | 20 | } |
21 | 21 | |
22 | - protected function createCondition($value){ |
|
22 | + protected function createCondition($value) { |
|
23 | 23 | return !($value instanceof HtmlSegment); |
24 | 24 | } |
25 | 25 | |
@@ -28,16 +28,16 @@ discard block |
||
28 | 28 | * @param string $type one of "raised","stacked","piled" default : "" |
29 | 29 | * @return \Ajax\semantic\html\elements\HtmlSegmentGroups |
30 | 30 | */ |
31 | - public function setType($type){ |
|
31 | + public function setType($type) { |
|
32 | 32 | return $this->addToPropertyCtrl("class", $type, SegmentType::getConstants()); |
33 | 33 | } |
34 | 34 | |
35 | - public function setSens($sens=Sens::VERTICAL){ |
|
35 | + public function setSens($sens=Sens::VERTICAL) { |
|
36 | 36 | return $this->addToPropertyCtrl("class", $sens, Sens::getConstants()); |
37 | 37 | } |
38 | 38 | |
39 | - public static function group($identifier,$items=array(),$type="",$sens=Sens::VERTICAL){ |
|
40 | - $group=new HtmlSegmentGroups($identifier,$items); |
|
39 | + public static function group($identifier, $items=array(), $type="", $sens=Sens::VERTICAL) { |
|
40 | + $group=new HtmlSegmentGroups($identifier, $items); |
|
41 | 41 | $group->setSens($sens); |
42 | 42 | return $group->setType($type); |
43 | 43 | } |
@@ -11,6 +11,10 @@ discard block |
||
11 | 11 | |
12 | 12 | class HtmlDropdownItem extends HtmlSemDoubleElement { |
13 | 13 | use IconTrait; |
14 | + |
|
15 | + /** |
|
16 | + * @param string $identifier |
|
17 | + */ |
|
14 | 18 | public function __construct($identifier, $content="",$value=NULL,$image=NULL) { |
15 | 19 | parent::__construct($identifier, "a"); |
16 | 20 | $this->setClass("item"); |
@@ -61,6 +65,9 @@ discard block |
||
61 | 65 | return $this; |
62 | 66 | } |
63 | 67 | |
68 | + /** |
|
69 | + * @param string $content |
|
70 | + */ |
|
64 | 71 | public function setContent($content){ |
65 | 72 | if($content==="-"){ |
66 | 73 | $this->asDivider(); |
@@ -11,30 +11,30 @@ discard block |
||
11 | 11 | |
12 | 12 | class HtmlDropdownItem extends HtmlSemDoubleElement { |
13 | 13 | use IconTrait; |
14 | - public function __construct($identifier, $content="",$value=NULL,$image=NULL) { |
|
14 | + public function __construct($identifier, $content="", $value=NULL, $image=NULL) { |
|
15 | 15 | parent::__construct($identifier, "a"); |
16 | 16 | $this->setClass("item"); |
17 | 17 | $this->setContent($content); |
18 | - if($value!==NULL) |
|
18 | + if ($value!==NULL) |
|
19 | 19 | $this->setData($value); |
20 | - if($image!==NULL) |
|
20 | + if ($image!==NULL) |
|
21 | 21 | $this->asMiniAvatar($image); |
22 | 22 | } |
23 | 23 | |
24 | - public function setDescription($description){ |
|
25 | - $descO=new HtmlDoubleElement("desc-".$this->identifier,"span"); |
|
24 | + public function setDescription($description) { |
|
25 | + $descO=new HtmlDoubleElement("desc-".$this->identifier, "span"); |
|
26 | 26 | $descO->setClass("description"); |
27 | 27 | $descO->setContent($description); |
28 | - return $this->addContent($descO,true); |
|
28 | + return $this->addContent($descO, true); |
|
29 | 29 | } |
30 | 30 | |
31 | - public function setData($value){ |
|
31 | + public function setData($value) { |
|
32 | 32 | $this->setProperty("data-value", $value); |
33 | 33 | } |
34 | 34 | |
35 | - public function asOption(){ |
|
35 | + public function asOption() { |
|
36 | 36 | $this->tagName="option"; |
37 | - if($this->getProperty("data-value")!==null) |
|
37 | + if ($this->getProperty("data-value")!==null) |
|
38 | 38 | $this->setProperty("value", $this->getProperty("data-value")); |
39 | 39 | } |
40 | 40 | |
@@ -42,58 +42,58 @@ discard block |
||
42 | 42 | * @param string $image the image src |
43 | 43 | * @return \Ajax\common\html\html5\HtmlImg |
44 | 44 | */ |
45 | - public function asMiniAvatar($image){ |
|
45 | + public function asMiniAvatar($image) { |
|
46 | 46 | $this->tagName="div"; |
47 | - $img=new HtmlImg("image-".$this->identifier,$image); |
|
47 | + $img=new HtmlImg("image-".$this->identifier, $image); |
|
48 | 48 | $img->setClass("ui mini avatar image"); |
49 | - $this->addContent($img,true); |
|
49 | + $this->addContent($img, true); |
|
50 | 50 | return $img; |
51 | 51 | } |
52 | 52 | |
53 | - public function asSearchInput($placeholder=NULL,$icon=NULL){ |
|
53 | + public function asSearchInput($placeholder=NULL, $icon=NULL) { |
|
54 | 54 | $this->setClass("ui icon search input"); |
55 | 55 | $input=new HtmlInput("search-".$this->identifier); |
56 | - if(isset($placeholder)) |
|
56 | + if (isset($placeholder)) |
|
57 | 57 | $input->setProperty("placeholder", $placeholder); |
58 | 58 | $this->content=$input; |
59 | - if(isset($icon)) |
|
59 | + if (isset($icon)) |
|
60 | 60 | $this->addIcon($icon); |
61 | 61 | return $this; |
62 | 62 | } |
63 | 63 | |
64 | - public function setContent($content){ |
|
65 | - if($content==="-"){ |
|
64 | + public function setContent($content) { |
|
65 | + if ($content==="-") { |
|
66 | 66 | $this->asDivider(); |
67 | - }elseif($content==="-search-"){ |
|
68 | - $values=\explode(",",$content,-1); |
|
69 | - $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."),JArray::getDefaultValue($values, 1, "search")); |
|
67 | + }elseif ($content==="-search-") { |
|
68 | + $values=\explode(",", $content, -1); |
|
69 | + $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."), JArray::getDefaultValue($values, 1, "search")); |
|
70 | 70 | }else |
71 | 71 | parent::setContent($content); |
72 | 72 | return $this; |
73 | 73 | } |
74 | 74 | |
75 | - public function asDivider(){ |
|
75 | + public function asDivider() { |
|
76 | 76 | $this->content=NULL; |
77 | 77 | $this->setClass("divider"); |
78 | 78 | } |
79 | 79 | |
80 | - public function asHeader($caption=NULL,$icon=NULL){ |
|
80 | + public function asHeader($caption=NULL, $icon=NULL) { |
|
81 | 81 | $this->setClass("header"); |
82 | 82 | $this->content=$caption; |
83 | - if(isset($icon)) |
|
84 | - $this->addIcon($icon,true); |
|
83 | + if (isset($icon)) |
|
84 | + $this->addIcon($icon, true); |
|
85 | 85 | return $this; |
86 | 86 | } |
87 | 87 | |
88 | - public static function searchInput($placeholder=NULL,$icon=NULL){ |
|
89 | - return (new HtmlDropdownItem(""))->asSearchInput($placeholder,$icon); |
|
88 | + public static function searchInput($placeholder=NULL, $icon=NULL) { |
|
89 | + return (new HtmlDropdownItem(""))->asSearchInput($placeholder, $icon); |
|
90 | 90 | } |
91 | 91 | |
92 | - public static function divider($placeholder=NULL,$icon=NULL){ |
|
92 | + public static function divider($placeholder=NULL, $icon=NULL) { |
|
93 | 93 | return (new HtmlDropdownItem(""))->asDivider(); |
94 | 94 | } |
95 | 95 | |
96 | - public static function header($caption=NULL,$icon=NULL){ |
|
97 | - return (new HtmlDropdownItem(""))->asHeader($caption,$icon); |
|
96 | + public static function header($caption=NULL, $icon=NULL) { |
|
97 | + return (new HtmlDropdownItem(""))->asHeader($caption, $icon); |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 | \ No newline at end of file |
@@ -15,10 +15,12 @@ discard block |
||
15 | 15 | parent::__construct($identifier, "a"); |
16 | 16 | $this->setClass("item"); |
17 | 17 | $this->setContent($content); |
18 | - if($value!==NULL) |
|
19 | - $this->setData($value); |
|
20 | - if($image!==NULL) |
|
21 | - $this->asMiniAvatar($image); |
|
18 | + if($value!==NULL) { |
|
19 | + $this->setData($value); |
|
20 | + } |
|
21 | + if($image!==NULL) { |
|
22 | + $this->asMiniAvatar($image); |
|
23 | + } |
|
22 | 24 | } |
23 | 25 | |
24 | 26 | public function setDescription($description){ |
@@ -34,8 +36,9 @@ discard block |
||
34 | 36 | |
35 | 37 | public function asOption(){ |
36 | 38 | $this->tagName="option"; |
37 | - if($this->getProperty("data-value")!==null) |
|
38 | - $this->setProperty("value", $this->getProperty("data-value")); |
|
39 | + if($this->getProperty("data-value")!==null) { |
|
40 | + $this->setProperty("value", $this->getProperty("data-value")); |
|
41 | + } |
|
39 | 42 | } |
40 | 43 | |
41 | 44 | /** |
@@ -53,22 +56,25 @@ discard block |
||
53 | 56 | public function asSearchInput($placeholder=NULL,$icon=NULL){ |
54 | 57 | $this->setClass("ui icon search input"); |
55 | 58 | $input=new HtmlInput("search-".$this->identifier); |
56 | - if(isset($placeholder)) |
|
57 | - $input->setProperty("placeholder", $placeholder); |
|
59 | + if(isset($placeholder)) { |
|
60 | + $input->setProperty("placeholder", $placeholder); |
|
61 | + } |
|
58 | 62 | $this->content=$input; |
59 | - if(isset($icon)) |
|
60 | - $this->addIcon($icon); |
|
63 | + if(isset($icon)) { |
|
64 | + $this->addIcon($icon); |
|
65 | + } |
|
61 | 66 | return $this; |
62 | 67 | } |
63 | 68 | |
64 | 69 | public function setContent($content){ |
65 | 70 | if($content==="-"){ |
66 | 71 | $this->asDivider(); |
67 | - }elseif($content==="-search-"){ |
|
72 | + } elseif($content==="-search-"){ |
|
68 | 73 | $values=\explode(",",$content,-1); |
69 | 74 | $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."),JArray::getDefaultValue($values, 1, "search")); |
70 | - }else |
|
71 | - parent::setContent($content); |
|
75 | + } else { |
|
76 | + parent::setContent($content); |
|
77 | + } |
|
72 | 78 | return $this; |
73 | 79 | } |
74 | 80 | |
@@ -80,8 +86,9 @@ discard block |
||
80 | 86 | public function asHeader($caption=NULL,$icon=NULL){ |
81 | 87 | $this->setClass("header"); |
82 | 88 | $this->content=$caption; |
83 | - if(isset($icon)) |
|
84 | - $this->addIcon($icon,true); |
|
89 | + if(isset($icon)) { |
|
90 | + $this->addIcon($icon,true); |
|
91 | + } |
|
85 | 92 | return $this; |
86 | 93 | } |
87 | 94 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | $this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon")); |
17 | 17 | $this->addContent($iconO,false); |
18 | 18 | $this->_hasIcon=true; |
19 | - }else{ |
|
19 | + } else{ |
|
20 | 20 | $iconO=$this->getIcon(); |
21 | 21 | $iconO->setIcon($icon); |
22 | 22 | $this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon")); |
@@ -27,8 +27,9 @@ discard block |
||
27 | 27 | public function getIcon(){ |
28 | 28 | if(\is_array($this->content)){ |
29 | 29 | foreach ($this->content as $item){ |
30 | - if($item instanceof HtmlIcon) |
|
31 | - return $item; |
|
30 | + if($item instanceof HtmlIcon) { |
|
31 | + return $item; |
|
32 | + } |
|
32 | 33 | } |
33 | 34 | } |
34 | 35 | } |
@@ -8,18 +8,18 @@ discard block |
||
8 | 8 | private $_hasIcon=false; |
9 | 9 | |
10 | 10 | protected abstract function addToPropertyCtrl($name, $value, $typeCtrl); |
11 | - public abstract function addContent($content,$before=false); |
|
11 | + public abstract function addContent($content, $before=false); |
|
12 | 12 | |
13 | - public function addIcon($icon,$direction=Direction::LEFT){ |
|
14 | - if($this->_hasIcon===false){ |
|
13 | + public function addIcon($icon, $direction=Direction::LEFT) { |
|
14 | + if ($this->_hasIcon===false) { |
|
15 | 15 | $iconO=$icon; |
16 | - if(\is_string($icon)){ |
|
16 | + if (\is_string($icon)) { |
|
17 | 17 | $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
18 | 18 | } |
19 | 19 | $this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon")); |
20 | - $this->addContent($iconO,false); |
|
20 | + $this->addContent($iconO, false); |
|
21 | 21 | $this->_hasIcon=true; |
22 | - }else{ |
|
22 | + }else { |
|
23 | 23 | $iconO=$this->getIcon(); |
24 | 24 | $iconO->setIcon($icon); |
25 | 25 | $this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon")); |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | return $iconO; |
28 | 28 | } |
29 | 29 | |
30 | - public function getIcon(){ |
|
31 | - if(\is_array($this->content)){ |
|
32 | - foreach ($this->content as $item){ |
|
33 | - if($item instanceof HtmlIcon) |
|
30 | + public function getIcon() { |
|
31 | + if (\is_array($this->content)) { |
|
32 | + foreach ($this->content as $item) { |
|
33 | + if ($item instanceof HtmlIcon) |
|
34 | 34 | return $item; |
35 | 35 | } |
36 | 36 | } |
@@ -7,6 +7,10 @@ |
||
7 | 7 | trait IconTrait { |
8 | 8 | private $_hasIcon=false; |
9 | 9 | |
10 | + /** |
|
11 | + * @param string $name |
|
12 | + * @param string $value |
|
13 | + */ |
|
10 | 14 | protected abstract function addToPropertyCtrl($name, $value, $typeCtrl); |
11 | 15 | public abstract function addContent($content,$before=false); |
12 | 16 |
@@ -5,5 +5,5 @@ |
||
5 | 5 | use Ajax\common\BaseEnum; |
6 | 6 | |
7 | 7 | abstract class Emphasis extends BaseEnum { |
8 | - const PRIMARY="primary",SECONDARY="secondary",TERTIARY="tertiary"; |
|
8 | + const PRIMARY="primary", SECONDARY="secondary", TERTIARY="tertiary"; |
|
9 | 9 | } |
10 | 10 | \ No newline at end of file |