@@ -17,11 +17,11 @@ discard block |
||
17 | 17 | * @version 1.001 |
18 | 18 | */ |
19 | 19 | class HtmlSegment extends HtmlSemDoubleElement { |
20 | - use AttachedTrait,TextAlignmentTrait; |
|
20 | + use AttachedTrait, TextAlignmentTrait; |
|
21 | 21 | public function __construct($identifier, $content="") { |
22 | - parent::__construct($identifier, "div","ui segment"); |
|
23 | - $this->_variations=\array_merge($this->_variations,[Variation::PADDED,Variation::COMPACT]); |
|
24 | - $this->_states=\array_merge($this->_states,[State::LOADING]); |
|
22 | + parent::__construct($identifier, "div", "ui segment"); |
|
23 | + $this->_variations=\array_merge($this->_variations, [Variation::PADDED, Variation::COMPACT]); |
|
24 | + $this->_states=\array_merge($this->_states, [State::LOADING]); |
|
25 | 25 | $this->content=$content; |
26 | 26 | } |
27 | 27 | |
@@ -30,36 +30,36 @@ discard block |
||
30 | 30 | * @param string $type one of "raised","stacked","piled" default : "" |
31 | 31 | * @return \Ajax\semantic\html\elements\HtmlSegment |
32 | 32 | */ |
33 | - public function setType($type){ |
|
33 | + public function setType($type) { |
|
34 | 34 | return $this->addToPropertyCtrl("class", $type, SegmentType::getConstants()); |
35 | 35 | } |
36 | 36 | |
37 | - public function setSens($sens="vertical"){ |
|
38 | - return $this->addToPropertyCtrl("class", $sens, array("vertical","horizontal")); |
|
37 | + public function setSens($sens="vertical") { |
|
38 | + return $this->addToPropertyCtrl("class", $sens, array("vertical", "horizontal")); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | |
42 | - public function setEmphasis($value=Emphasis::SECONDARY){ |
|
42 | + public function setEmphasis($value=Emphasis::SECONDARY) { |
|
43 | 43 | return $this->addToPropertyCtrl("class", $value, Emphasis::getConstants()); |
44 | 44 | } |
45 | 45 | |
46 | - public function setCircular(){ |
|
46 | + public function setCircular() { |
|
47 | 47 | return $this->addToProperty("class", "circular"); |
48 | 48 | } |
49 | 49 | |
50 | - public function clear(){ |
|
50 | + public function clear() { |
|
51 | 51 | return $this->addToProperty("class", "clearing"); |
52 | 52 | } |
53 | 53 | |
54 | - public function setFloating($value="left"){ |
|
55 | - return $this->addToPropertyCtrl("class", "floated ".$value,array("floated right","floated left")); |
|
54 | + public function setFloating($value="left") { |
|
55 | + return $this->addToPropertyCtrl("class", "floated ".$value, array("floated right", "floated left")); |
|
56 | 56 | } |
57 | 57 | |
58 | - public function setCompact(){ |
|
58 | + public function setCompact() { |
|
59 | 59 | return $this->addToProperty("class", "compact"); |
60 | 60 | } |
61 | 61 | |
62 | - public function setBasic(){ |
|
62 | + public function setBasic() { |
|
63 | 63 | return $this->setProperty("class", "ui basic segment"); |
64 | 64 | } |
65 | 65 |
@@ -10,13 +10,16 @@ |
||
10 | 10 | |
11 | 11 | class HtmlLabel extends HtmlSemDoubleElement { |
12 | 12 | use LabeledIconTrait; |
13 | + |
|
14 | + /** |
|
15 | + * @param string $identifier |
|
16 | + */ |
|
13 | 17 | public function __construct($identifier,$caption="",$tagName="div") { |
14 | 18 | parent::__construct($identifier,$tagName,"ui label"); |
15 | 19 | $this->content=$caption; |
16 | 20 | } |
17 | 21 | |
18 | 22 | /** |
19 | - * @param string $side |
|
20 | 23 | * @return \Ajax\semantic\html\elements\HtmlLabel |
21 | 24 | */ |
22 | 25 | public function setPointing($value=Direction::NONE){ |
@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | |
11 | 11 | class HtmlLabel extends HtmlSemDoubleElement { |
12 | 12 | use LabeledIconTrait; |
13 | - public function __construct($identifier,$caption="",$tagName="div") { |
|
14 | - parent::__construct($identifier,$tagName,"ui label"); |
|
13 | + public function __construct($identifier, $caption="", $tagName="div") { |
|
14 | + parent::__construct($identifier, $tagName, "ui label"); |
|
15 | 15 | $this->content=$caption; |
16 | 16 | } |
17 | 17 | |
@@ -19,33 +19,33 @@ discard block |
||
19 | 19 | * @param string $side |
20 | 20 | * @return \Ajax\semantic\html\elements\HtmlLabel |
21 | 21 | */ |
22 | - public function setPointing($value=Direction::NONE){ |
|
23 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
22 | + public function setPointing($value=Direction::NONE) { |
|
23 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
27 | 27 | * @param string $side |
28 | 28 | * @return \Ajax\semantic\html\elements\HtmlLabel |
29 | 29 | */ |
30 | - public function toCorner($side="left"){ |
|
31 | - return $this->addToPropertyCtrl("class", $side." corner",array("right corner","left corner")); |
|
30 | + public function toCorner($side="left") { |
|
31 | + return $this->addToPropertyCtrl("class", $side." corner", array("right corner", "left corner")); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
35 | 35 | * @return \Ajax\semantic\html\elements\HtmlLabel |
36 | 36 | */ |
37 | - public function asTag(){ |
|
37 | + public function asTag() { |
|
38 | 38 | return $this->addToProperty("class", "tag"); |
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
42 | 42 | * @return \Ajax\semantic\html\elements\HtmlLabel |
43 | 43 | */ |
44 | - public function asLink(){ |
|
44 | + public function asLink() { |
|
45 | 45 | return $this->setTagName("a"); |
46 | 46 | } |
47 | 47 | |
48 | - public function setBasic(){ |
|
48 | + public function setBasic() { |
|
49 | 49 | return $this->addToProperty("class", "basic"); |
50 | 50 | } |
51 | 51 | |
@@ -56,17 +56,17 @@ discard block |
||
56 | 56 | * @param string $before |
57 | 57 | * @return \Ajax\semantic\html\elements\HtmlLabel |
58 | 58 | */ |
59 | - public function addImage($src,$alt="",$before=true){ |
|
59 | + public function addImage($src, $alt="", $before=true) { |
|
60 | 60 | $this->addToProperty("class", "image"); |
61 | - return $this->addContent(new HtmlImg("image-".$this->identifier,$src,$alt),$before); |
|
61 | + return $this->addContent(new HtmlImg("image-".$this->identifier, $src, $alt), $before); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
65 | 65 | * @param string $detail |
66 | 66 | * @return \Ajax\common\html\HtmlDoubleElement |
67 | 67 | */ |
68 | - public function addDetail($detail){ |
|
69 | - $div=new HtmlDoubleElement("detail-".$this->identifier,$this->tagName); |
|
68 | + public function addDetail($detail) { |
|
69 | + $div=new HtmlDoubleElement("detail-".$this->identifier, $this->tagName); |
|
70 | 70 | $div->setClass("detail"); |
71 | 71 | $div->setContent($detail); |
72 | 72 | $this->addContent($div); |
@@ -7,11 +7,11 @@ |
||
7 | 7 | |
8 | 8 | class HtmlInput extends HtmlSingleElement { |
9 | 9 | |
10 | - public function __construct($identifier,$type="text",$value="",$placeholder="") { |
|
10 | + public function __construct($identifier, $type="text", $value="", $placeholder="") { |
|
11 | 11 | parent::__construct($identifier, "input"); |
12 | 12 | $this->setProperty("name", $identifier); |
13 | 13 | $this->setProperty("value", $value); |
14 | - if(JString::isNotNull($placeholder)) |
|
14 | + if (JString::isNotNull($placeholder)) |
|
15 | 15 | $this->setProperty("placeholder", $placeholder); |
16 | 16 | $this->setProperty("type", $type); |
17 | 17 | } |
@@ -11,8 +11,9 @@ |
||
11 | 11 | parent::__construct($identifier, "input"); |
12 | 12 | $this->setProperty("name", $identifier); |
13 | 13 | $this->setProperty("value", $value); |
14 | - if(JString::isNotNull($placeholder)) |
|
15 | - $this->setProperty("placeholder", $placeholder); |
|
14 | + if(JString::isNotNull($placeholder)) { |
|
15 | + $this->setProperty("placeholder", $placeholder); |
|
16 | + } |
|
16 | 17 | $this->setProperty("type", $type); |
17 | 18 | } |
18 | 19 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon")); |
30 | 30 | $this->addContent($iconO,false); |
31 | 31 | $this->_hasIcon=true; |
32 | - }else{ |
|
32 | + } else{ |
|
33 | 33 | $iconO=$this->getIcon(); |
34 | 34 | $iconO->setIcon($icon); |
35 | 35 | $this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon")); |
@@ -40,8 +40,9 @@ discard block |
||
40 | 40 | public function getIcon(){ |
41 | 41 | if(\is_array($this->content)){ |
42 | 42 | foreach ($this->content as $item){ |
43 | - if($item instanceof HtmlIcon) |
|
44 | - return $item; |
|
43 | + if($item instanceof HtmlIcon) { |
|
44 | + return $item; |
|
45 | + } |
|
45 | 46 | } |
46 | 47 | } |
47 | 48 | } |
@@ -57,9 +58,10 @@ discard block |
||
57 | 58 | $labelO=$label; |
58 | 59 | if(\is_object($label)===false){ |
59 | 60 | $labelO=new HtmlLabel("label-".$this->identifier,$label); |
60 | - if(isset($icon)) |
|
61 | - $labelO->addIcon($icon); |
|
62 | - }else{ |
|
61 | + if(isset($icon)) { |
|
62 | + $labelO->addIcon($icon); |
|
63 | + } |
|
64 | + } else{ |
|
63 | 65 | $labelO->addToPropertyCtrl("class", "label", array("label")); |
64 | 66 | } |
65 | 67 | $this->addToProperty("class", $direction." labeled"); |
@@ -75,8 +77,9 @@ discard block |
||
75 | 77 | $actionO=$action; |
76 | 78 | if(\is_object($action)===false){ |
77 | 79 | $actionO=new HtmlButton("action-".$this->identifier,$action); |
78 | - if(isset($icon)) |
|
79 | - $actionO->addIcon($icon,true,$labeled); |
|
80 | + if(isset($icon)) { |
|
81 | + $actionO->addIcon($icon,true,$labeled); |
|
82 | + } |
|
80 | 83 | } |
81 | 84 | $this->addToProperty("class", $direction." action"); |
82 | 85 | $this->addContent($actionO,\strstr($direction,Direction::LEFT)!==false); |
@@ -7,30 +7,30 @@ discard block |
||
7 | 7 | use Ajax\semantic\html\base\constants\Direction; |
8 | 8 | use Ajax\semantic\html\base\constants\Variation; |
9 | 9 | |
10 | -class HtmlInput extends HtmlSemDoubleElement{ |
|
10 | +class HtmlInput extends HtmlSemDoubleElement { |
|
11 | 11 | private $_hasIcon=false; |
12 | 12 | |
13 | - public function __construct($identifier,$type="text",$value="",$placeholder=""){ |
|
14 | - parent::__construct("div-".$identifier,"div","ui input"); |
|
15 | - $this->content=new \Ajax\common\html\html5\HtmlInput($identifier,$type,$value,$placeholder); |
|
16 | - $this->_states=[State::DISABLED,State::FOCUS,State::ERROR]; |
|
13 | + public function __construct($identifier, $type="text", $value="", $placeholder="") { |
|
14 | + parent::__construct("div-".$identifier, "div", "ui input"); |
|
15 | + $this->content=new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder); |
|
16 | + $this->_states=[State::DISABLED, State::FOCUS, State::ERROR]; |
|
17 | 17 | $this->_variations=[Variation::TRANSPARENT]; |
18 | 18 | } |
19 | 19 | |
20 | - public function setFocus(){ |
|
20 | + public function setFocus() { |
|
21 | 21 | $this->addToProperty("class", State::FOCUS); |
22 | 22 | } |
23 | 23 | |
24 | - public function addIcon($icon,$direction=Direction::LEFT){ |
|
25 | - if($this->_hasIcon===false){ |
|
24 | + public function addIcon($icon, $direction=Direction::LEFT) { |
|
25 | + if ($this->_hasIcon===false) { |
|
26 | 26 | $iconO=$icon; |
27 | - if(\is_string($icon)){ |
|
27 | + if (\is_string($icon)) { |
|
28 | 28 | $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
29 | 29 | } |
30 | 30 | $this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon")); |
31 | - $this->addContent($iconO,false); |
|
31 | + $this->addContent($iconO, false); |
|
32 | 32 | $this->_hasIcon=true; |
33 | - }else{ |
|
33 | + }else { |
|
34 | 34 | $iconO=$this->getIcon(); |
35 | 35 | $iconO->setIcon($icon); |
36 | 36 | $this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon")); |
@@ -38,49 +38,49 @@ discard block |
||
38 | 38 | return $iconO; |
39 | 39 | } |
40 | 40 | |
41 | - public function getIcon(){ |
|
42 | - if(\is_array($this->content)){ |
|
43 | - foreach ($this->content as $item){ |
|
44 | - if($item instanceof HtmlIcon) |
|
41 | + public function getIcon() { |
|
42 | + if (\is_array($this->content)) { |
|
43 | + foreach ($this->content as $item) { |
|
44 | + if ($item instanceof HtmlIcon) |
|
45 | 45 | return $item; |
46 | 46 | } |
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
50 | - public function addLoading(){ |
|
51 | - if($this->_hasIcon===false){ |
|
50 | + public function addLoading() { |
|
51 | + if ($this->_hasIcon===false) { |
|
52 | 52 | throw new \Exception("Input must have an icon for showing a loader, use addIcon before"); |
53 | 53 | } |
54 | 54 | return $this->addToProperty("class", State::LOADING); |
55 | 55 | } |
56 | 56 | |
57 | - public function addLabel($label,$direction=Direction::LEFT,$icon=NULL){ |
|
57 | + public function addLabel($label, $direction=Direction::LEFT, $icon=NULL) { |
|
58 | 58 | $labelO=$label; |
59 | - if(\is_object($label)===false){ |
|
60 | - $labelO=new HtmlLabel("label-".$this->identifier,$label); |
|
61 | - if(isset($icon)) |
|
59 | + if (\is_object($label)===false) { |
|
60 | + $labelO=new HtmlLabel("label-".$this->identifier, $label); |
|
61 | + if (isset($icon)) |
|
62 | 62 | $labelO->addIcon($icon); |
63 | - }else{ |
|
63 | + }else { |
|
64 | 64 | $labelO->addToPropertyCtrl("class", "label", array("label")); |
65 | 65 | } |
66 | 66 | $this->addToProperty("class", $direction." labeled"); |
67 | - $this->addContent($labelO,\strstr($direction,Direction::LEFT)!==false); |
|
67 | + $this->addContent($labelO, \strstr($direction, Direction::LEFT)!==false); |
|
68 | 68 | return $labelO; |
69 | 69 | } |
70 | 70 | |
71 | - public function addLabelToCorner($label,$direction=Direction::LEFT,$icon=NULL){ |
|
72 | - return $this->addLabel($label,$direction." corner",$icon)->toCorner($direction); |
|
71 | + public function addLabelToCorner($label, $direction=Direction::LEFT, $icon=NULL) { |
|
72 | + return $this->addLabel($label, $direction." corner", $icon)->toCorner($direction); |
|
73 | 73 | } |
74 | 74 | |
75 | - public function addAction($action,$direction=Direction::LEFT,$icon=NULL,$labeled=false){ |
|
75 | + public function addAction($action, $direction=Direction::LEFT, $icon=NULL, $labeled=false) { |
|
76 | 76 | $actionO=$action; |
77 | - if(\is_object($action)===false){ |
|
78 | - $actionO=new HtmlButton("action-".$this->identifier,$action); |
|
79 | - if(isset($icon)) |
|
80 | - $actionO->addIcon($icon,true,$labeled); |
|
77 | + if (\is_object($action)===false) { |
|
78 | + $actionO=new HtmlButton("action-".$this->identifier, $action); |
|
79 | + if (isset($icon)) |
|
80 | + $actionO->addIcon($icon, true, $labeled); |
|
81 | 81 | } |
82 | 82 | $this->addToProperty("class", $direction." action"); |
83 | - $this->addContent($actionO,\strstr($direction,Direction::LEFT)!==false); |
|
83 | + $this->addContent($actionO, \strstr($direction, Direction::LEFT)!==false); |
|
84 | 84 | return $actionO; |
85 | 85 | } |
86 | 86 |
@@ -5,5 +5,5 @@ |
||
5 | 5 | use Ajax\common\BaseEnum; |
6 | 6 | |
7 | 7 | abstract class State extends BaseEnum { |
8 | - const ACTIVE="active",DISABLED="disabled",ERROR="error",FOCUS="focus",LOADING="loading"; |
|
8 | + const ACTIVE="active", DISABLED="disabled", ERROR="error", FOCUS="focus", LOADING="loading"; |
|
9 | 9 | } |
10 | 10 | \ No newline at end of file |
@@ -13,17 +13,17 @@ |
||
13 | 13 | * @param boolean $labeled |
14 | 14 | * @return \Ajax\semantic\html\elements\HtmlIcon |
15 | 15 | */ |
16 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
16 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
17 | 17 | $iconO=$icon; |
18 | - if(\is_string($icon)){ |
|
18 | + if (\is_string($icon)) { |
|
19 | 19 | $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
20 | 20 | } |
21 | - if($labeled!==false){ |
|
22 | - $direction=($before===true)?Direction::RIGHT:Direction::LEFT; |
|
21 | + if ($labeled!==false) { |
|
22 | + $direction=($before===true) ? Direction::RIGHT : Direction::LEFT; |
|
23 | 23 | $this->addToProperty("class", $direction." labeled icon"); |
24 | 24 | $this->tagName="div"; |
25 | 25 | } |
26 | - $this->addContent($iconO,$before); |
|
26 | + $this->addContent($iconO, $before); |
|
27 | 27 | return $iconO; |
28 | 28 | } |
29 | 29 | } |
30 | 30 | \ No newline at end of file |
@@ -7,15 +7,15 @@ |
||
7 | 7 | |
8 | 8 | class HtmlListItem extends HtmlSemDoubleElement { |
9 | 9 | protected $image; |
10 | - public function __construct($identifier,$content) { |
|
10 | + public function __construct($identifier, $content) { |
|
11 | 11 | parent::__construct($identifier, "div", "item"); |
12 | 12 | $this->_template='<%tagName% id="%identifier%" %properties%>%image%%content%</%tagName%>'; |
13 | 13 | $this->content=$content; |
14 | 14 | } |
15 | - public function addIcon($icon){ |
|
15 | + public function addIcon($icon) { |
|
16 | 16 | $content=$this->content; |
17 | - $this->content=new HtmlSemDoubleElement("content-".$this->identifier,"div","content"); |
|
17 | + $this->content=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content"); |
|
18 | 18 | $this->content->setContent($content); |
19 | - $this->content->addContent(new HtmlIcon("icon".$this->identifier, $icon),true); |
|
19 | + $this->content->addContent(new HtmlIcon("icon".$this->identifier, $icon), true); |
|
20 | 20 | } |
21 | 21 | } |
22 | 22 | \ No newline at end of file |
@@ -5,5 +5,5 @@ |
||
5 | 5 | use Ajax\common\BaseEnum; |
6 | 6 | |
7 | 7 | abstract class Variation extends BaseEnum { |
8 | - const ANIMATED="animated",AVATAR="avatar",COMPACT="compact",FLUID="fluid",INVERTED="inverted",PADDED="padded",TRANSPARENT="transparent"; |
|
8 | + const ANIMATED="animated", AVATAR="avatar", COMPACT="compact", FLUID="fluid", INVERTED="inverted", PADDED="padded", TRANSPARENT="transparent"; |
|
9 | 9 | } |
10 | 10 | \ No newline at end of file |
@@ -5,22 +5,22 @@ |
||
5 | 5 | use Ajax\semantic\html\base\HtmlSemCollection; |
6 | 6 | use Ajax\semantic\html\content\HtmlListItem; |
7 | 7 | |
8 | -class HtmlList extends HtmlSemCollection{ |
|
8 | +class HtmlList extends HtmlSemCollection { |
|
9 | 9 | |
10 | 10 | |
11 | - public function __construct( $identifier, $items=array()){ |
|
12 | - parent::__construct( $identifier, "div", "ui list"); |
|
11 | + public function __construct($identifier, $items=array()) { |
|
12 | + parent::__construct($identifier, "div", "ui list"); |
|
13 | 13 | $this->addItems($items); |
14 | 14 | } |
15 | 15 | |
16 | 16 | |
17 | - protected function createItem($value){ |
|
17 | + protected function createItem($value) { |
|
18 | 18 | $count=$this->count(); |
19 | - if(\is_array($value)){ |
|
19 | + if (\is_array($value)) { |
|
20 | 20 | $item=new HtmlListItem("item-".$this->identifier."-".$count, $value[0]); |
21 | 21 | $item->addIcon($value[1]); |
22 | 22 | }else |
23 | - $item= new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
23 | + $item=new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
24 | 24 | return $item; |
25 | 25 | } |
26 | 26 |
@@ -19,8 +19,9 @@ |
||
19 | 19 | if(\is_array($value)){ |
20 | 20 | $item=new HtmlListItem("item-".$this->identifier."-".$count, $value[0]); |
21 | 21 | $item->addIcon($value[1]); |
22 | - }else |
|
23 | - $item= new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
22 | + } else { |
|
23 | + $item= new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
24 | + } |
|
24 | 25 | return $item; |
25 | 26 | } |
26 | 27 |