@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | */ |
16 | 16 | class HtmlLabelGroups extends HtmlSemCollection { |
17 | 17 | |
18 | - public function __construct($identifier,$labels=array(), $attributes=array()) { |
|
18 | + public function __construct($identifier, $labels=array(), $attributes=array()) { |
|
19 | 19 | parent::__construct($identifier, "div", "ui labels"); |
20 | - $this->_states=\array_merge(Size::getConstants(),Color::getConstants(),["tag","circular"]); |
|
20 | + $this->_states=\array_merge(Size::getConstants(), Color::getConstants(), ["tag", "circular"]); |
|
21 | 21 | $this->addItems($labels); |
22 | 22 | $this->setStates($attributes); |
23 | 23 | } |
@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | $icon=JArray::getValue($value, "icon", 1); |
32 | 32 | $tagName=JArray::getValue($value, "tagName", 2); |
33 | 33 | } |
34 | - $labelO=new HtmlLabel("label-" . $this->identifier, $caption,$icon,$tagName); |
|
34 | + $labelO=new HtmlLabel("label-".$this->identifier, $caption, $icon, $tagName); |
|
35 | 35 | return $labelO; |
36 | 36 | } |
37 | 37 | |
38 | 38 | protected function createCondition($value) { |
39 | - return ($value instanceof HtmlLabel) === false; |
|
39 | + return ($value instanceof HtmlLabel)===false; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | } |
43 | 43 | \ No newline at end of file |
@@ -18,17 +18,17 @@ discard block |
||
18 | 18 | |
19 | 19 | protected function createItem($value) { |
20 | 20 | $count=$this->count(); |
21 | - $item=new HtmlListItem("item-" . $this->identifier . "-" . $count, $value); |
|
21 | + $item=new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
22 | 22 | return $item; |
23 | 23 | } |
24 | 24 | |
25 | 25 | public function addHeader($niveau, $content) { |
26 | - $header=new HtmlHeader("header-" . $this->identifier, $niveau, $content, "page"); |
|
26 | + $header=new HtmlHeader("header-".$this->identifier, $niveau, $content, "page"); |
|
27 | 27 | $this->wrap($header); |
28 | 28 | return $header; |
29 | 29 | } |
30 | 30 | |
31 | - public function getItemPart($index,$partName="header"){ |
|
31 | + public function getItemPart($index, $partName="header") { |
|
32 | 32 | return $this->getItem($index)->getPart($partName); |
33 | 33 | } |
34 | 34 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | } |
38 | 38 | |
39 | 39 | public function asLink() { |
40 | - $this->addToPropertyCtrl("class", "link", array ("link" )); |
|
40 | + $this->addToPropertyCtrl("class", "link", array("link")); |
|
41 | 41 | return $this->contentAs("a"); |
42 | 42 | } |
43 | 43 | |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | public function run(JsUtils $js) { |
63 | - if ($this->_hasCheckedList === true) { |
|
64 | - $jsCode=include dirname(__FILE__) . '/../../components/jsTemplates/tplCheckedList.php'; |
|
65 | - $jsCode=\str_replace("%identifier%", "#" . $this->identifier, $jsCode); |
|
63 | + if ($this->_hasCheckedList===true) { |
|
64 | + $jsCode=include dirname(__FILE__).'/../../components/jsTemplates/tplCheckedList.php'; |
|
65 | + $jsCode=\str_replace("%identifier%", "#".$this->identifier, $jsCode); |
|
66 | 66 | $this->executeOnRun($jsCode); |
67 | 67 | } |
68 | 68 | return parent::run($js); |
@@ -86,28 +86,28 @@ discard block |
||
86 | 86 | |
87 | 87 | public function addCheckedList($items=array(), $masterItem=NULL, $values=array()) { |
88 | 88 | $count=$this->count(); |
89 | - $identifier=$this->identifier . "-" . $count; |
|
89 | + $identifier=$this->identifier."-".$count; |
|
90 | 90 | if (isset($masterItem)) { |
91 | - $masterO=new HtmlFormCheckbox("master-" . $identifier, $masterItem); |
|
91 | + $masterO=new HtmlFormCheckbox("master-".$identifier, $masterItem); |
|
92 | 92 | $masterO->getField()->addToProperty("class", "master"); |
93 | 93 | $masterO->setClass("item"); |
94 | 94 | $this->addItem($masterO); |
95 | 95 | } |
96 | - $fields=array (); |
|
96 | + $fields=array(); |
|
97 | 97 | $i=0; |
98 | - foreach ( $items as $val => $caption ) { |
|
99 | - $itemO=new HtmlFormCheckbox($identifier . "-" . $i++, $caption, $val, "child"); |
|
100 | - if (\array_search($val, $values) !== false) { |
|
98 | + foreach ($items as $val => $caption) { |
|
99 | + $itemO=new HtmlFormCheckbox($identifier."-".$i++, $caption, $val, "child"); |
|
100 | + if (\array_search($val, $values)!==false) { |
|
101 | 101 | $itemO->getField()->getField()->setProperty("checked", ""); |
102 | 102 | } |
103 | 103 | $itemO->setClass("item"); |
104 | 104 | $fields[]=$itemO; |
105 | 105 | } |
106 | - if (isset($masterO) === true) { |
|
106 | + if (isset($masterO)===true) { |
|
107 | 107 | $list=new HtmlList("", $fields); |
108 | 108 | $list->setClass("list"); |
109 | 109 | $masterO->addContent($list); |
110 | - } else { |
|
110 | + }else { |
|
111 | 111 | $this->addList($fields); |
112 | 112 | } |
113 | 113 | $this->_hasCheckedList=true; |
@@ -13,10 +13,10 @@ discard block |
||
13 | 13 | use IconTrait; |
14 | 14 | |
15 | 15 | public function __construct($identifier, $type="text", $value="", $placeholder="") { |
16 | - parent::__construct("div-" . $identifier, "div", "ui input"); |
|
17 | - $this->content=[ "field" => new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder) ]; |
|
18 | - $this->_states=[ State::DISABLED,State::FOCUS,State::ERROR ]; |
|
19 | - $this->_variations=[ Variation::TRANSPARENT ]; |
|
16 | + parent::__construct("div-".$identifier, "div", "ui input"); |
|
17 | + $this->content=["field" => new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder)]; |
|
18 | + $this->_states=[State::DISABLED, State::FOCUS, State::ERROR]; |
|
19 | + $this->_variations=[Variation::TRANSPARENT]; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | public function setFocus() { |
@@ -24,38 +24,38 @@ discard block |
||
24 | 24 | } |
25 | 25 | |
26 | 26 | public function addLoading() { |
27 | - if ($this->_hasIcon === false) { |
|
27 | + if ($this->_hasIcon===false) { |
|
28 | 28 | throw new \Exception("Input must have an icon for showing a loader, use addIcon before"); |
29 | 29 | } |
30 | 30 | return $this->addToProperty("class", State::LOADING); |
31 | 31 | } |
32 | 32 | |
33 | 33 | public function labeled($label, $direction=Direction::LEFT, $icon=NULL) { |
34 | - $labelO=$this->addLabel($label,$direction===Direction::LEFT,$icon); |
|
35 | - $this->addToProperty("class", $direction . " labeled"); |
|
34 | + $labelO=$this->addLabel($label, $direction===Direction::LEFT, $icon); |
|
35 | + $this->addToProperty("class", $direction." labeled"); |
|
36 | 36 | return $labelO; |
37 | 37 | } |
38 | 38 | |
39 | 39 | public function labeledToCorner($icon, $direction=Direction::LEFT) { |
40 | - return $this->labeled("", $direction . " corner", $icon)->toCorner($direction); |
|
40 | + return $this->labeled("", $direction." corner", $icon)->toCorner($direction); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | public function addAction($action, $direction=Direction::RIGHT, $icon=NULL, $labeled=false) { |
44 | 44 | $actionO=$action; |
45 | - if (\is_object($action) === false) { |
|
46 | - $actionO=new HtmlButton("action-" . $this->identifier, $action); |
|
45 | + if (\is_object($action)===false) { |
|
46 | + $actionO=new HtmlButton("action-".$this->identifier, $action); |
|
47 | 47 | if (isset($icon)) |
48 | 48 | $actionO->addIcon($icon, true, $labeled); |
49 | 49 | } |
50 | - $this->addToProperty("class", $direction . " action"); |
|
51 | - $this->addContent($actionO, \strstr($direction, Direction::LEFT) !== false); |
|
50 | + $this->addToProperty("class", $direction." action"); |
|
51 | + $this->addContent($actionO, \strstr($direction, Direction::LEFT)!==false); |
|
52 | 52 | return $actionO; |
53 | 53 | } |
54 | 54 | |
55 | - public function addDropdown($label="", $items=array(),$direction=Direction::RIGHT){ |
|
56 | - $labelO=new HtmlDropdown("dd-".$this->identifier,$label,$items); |
|
57 | - $labelO->asSelect("select-".$this->identifier,false,true); |
|
58 | - return $this->labeled($labelO,$direction); |
|
55 | + public function addDropdown($label="", $items=array(), $direction=Direction::RIGHT) { |
|
56 | + $labelO=new HtmlDropdown("dd-".$this->identifier, $label, $items); |
|
57 | + $labelO->asSelect("select-".$this->identifier, false, true); |
|
58 | + return $this->labeled($labelO, $direction); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | public function getField() { |
@@ -44,8 +44,9 @@ |
||
44 | 44 | $actionO=$action; |
45 | 45 | if (\is_object($action) === false) { |
46 | 46 | $actionO=new HtmlButton("action-" . $this->identifier, $action); |
47 | - if (isset($icon)) |
|
48 | - $actionO->addIcon($icon, true, $labeled); |
|
47 | + if (isset($icon)) { |
|
48 | + $actionO->addIcon($icon, true, $labeled); |
|
49 | + } |
|
49 | 50 | } |
50 | 51 | $this->addToProperty("class", $direction . " action"); |
51 | 52 | $this->addContent($actionO, \strstr($direction, Direction::LEFT) !== false); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @return \Ajax\semantic\html\HtmlIcon |
69 | 69 | */ |
70 | 70 | public function setFlipped($sens="horizontally") { |
71 | - return $this->addToProperty("class", "flipped " . $sens); |
|
71 | + return $this->addToProperty("class", "flipped ".$sens); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @return \Ajax\semantic\html\HtmlIcon |
78 | 78 | */ |
79 | 79 | public function setRotated($sens="clockwise") { |
80 | - return $this->addToProperty("class", "rotated " . $sens); |
|
80 | + return $this->addToProperty("class", "rotated ".$sens); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function asLink($href=NULL) { |
88 | 88 | if (isset($href)) { |
89 | - $this->wrap("<a href='" . $href . "'>", "</a>"); |
|
89 | + $this->wrap("<a href='".$href."'>", "</a>"); |
|
90 | 90 | } |
91 | 91 | return $this->addToProperty("class", "link"); |
92 | 92 | } |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function setBordered($inverted=false) { |
104 | 104 | $invertedStr=""; |
105 | - if ($inverted !== false) |
|
105 | + if ($inverted!==false) |
|
106 | 106 | $invertedStr=" inverted"; |
107 | - return $this->addToProperty("class", "bordered" . $invertedStr); |
|
107 | + return $this->addToProperty("class", "bordered".$invertedStr); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | } |
117 | 117 | |
118 | 118 | public function addLabel($label, $before=false, $icon=NULL) { |
119 | - if($before) |
|
119 | + if ($before) |
|
120 | 120 | $this->wrap($label); |
121 | 121 | else |
122 | 122 | $this->wrap("", $label); |
123 | - if(isset($icon)) |
|
123 | + if (isset($icon)) |
|
124 | 124 | $this->addToIcon($icon); |
125 | 125 | return $this; |
126 | 126 | } |
@@ -102,8 +102,9 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function setBordered($inverted=false) { |
104 | 104 | $invertedStr=""; |
105 | - if ($inverted !== false) |
|
106 | - $invertedStr=" inverted"; |
|
105 | + if ($inverted !== false) { |
|
106 | + $invertedStr=" inverted"; |
|
107 | + } |
|
107 | 108 | return $this->addToProperty("class", "bordered" . $invertedStr); |
108 | 109 | } |
109 | 110 | |
@@ -116,12 +117,14 @@ discard block |
||
116 | 117 | } |
117 | 118 | |
118 | 119 | public function addLabel($label, $before=false, $icon=NULL) { |
119 | - if($before) |
|
120 | - $this->wrap($label); |
|
121 | - else |
|
122 | - $this->wrap("", $label); |
|
123 | - if(isset($icon)) |
|
124 | - $this->addToIcon($icon); |
|
120 | + if($before) { |
|
121 | + $this->wrap($label); |
|
122 | + } else { |
|
123 | + $this->wrap("", $label); |
|
124 | + } |
|
125 | + if(isset($icon)) { |
|
126 | + $this->addToIcon($icon); |
|
127 | + } |
|
125 | 128 | return $this; |
126 | 129 | } |
127 | 130 |
@@ -14,8 +14,9 @@ |
||
14 | 14 | } |
15 | 15 | |
16 | 16 | public function asAvatar($caption=NULL) { |
17 | - if (isset($caption)) |
|
18 | - $this->wrap("", $caption); |
|
17 | + if (isset($caption)) { |
|
18 | + $this->wrap("", $caption); |
|
19 | + } |
|
19 | 20 | return $this->addToProperty("class", "avatar"); |
20 | 21 | } |
21 | 22 | } |
22 | 23 | \ No newline at end of file |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | } |
49 | 49 | |
50 | 50 | public function addDimmer($params=array(), $content=NULL) { |
51 | - $dimmer=new HtmlDimmer("dimmer-" . $this->identifier, $content); |
|
51 | + $dimmer=new HtmlDimmer("dimmer-".$this->identifier, $content); |
|
52 | 52 | $dimmer->setParams($params); |
53 | 53 | $dimmer->setContainer($this); |
54 | 54 | $this->addContent($dimmer); |
@@ -57,20 +57,20 @@ discard block |
||
57 | 57 | |
58 | 58 | public function addLabel($label, $before=false, $icon=NULL) { |
59 | 59 | $labelO=$label; |
60 | - if (\is_object($label) === false) { |
|
61 | - $labelO=new HtmlLabel("label-" . $this->identifier, $label); |
|
60 | + if (\is_object($label)===false) { |
|
61 | + $labelO=new HtmlLabel("label-".$this->identifier, $label); |
|
62 | 62 | if (isset($icon)) |
63 | 63 | $labelO->addIcon($icon); |
64 | - } else { |
|
65 | - $labelO->addToPropertyCtrl("class", "label", array ("label" )); |
|
64 | + }else { |
|
65 | + $labelO->addToPropertyCtrl("class", "label", array("label")); |
|
66 | 66 | } |
67 | 67 | $this->addContent($labelO, $before); |
68 | 68 | return $labelO; |
69 | 69 | } |
70 | 70 | |
71 | - public function attachLabel($label,$side,$direction=Direction::NONE,$icon=NULL){ |
|
72 | - $label=$this->addLabel($label,true,$icon); |
|
73 | - $label->setAttached($side,$direction); |
|
71 | + public function attachLabel($label, $side, $direction=Direction::NONE, $icon=NULL) { |
|
72 | + $label=$this->addLabel($label, true, $icon); |
|
73 | + $label->setAttached($side, $direction); |
|
74 | 74 | return $this; |
75 | 75 | } |
76 | 76 | |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | |
87 | 87 | public function jsShowDimmer($show=true) { |
88 | 88 | $status="hide"; |
89 | - if ($show === true) |
|
89 | + if ($show===true) |
|
90 | 90 | $status="show"; |
91 | - return '$("#.' . $this->identifier . ').dimmer("' . $status . '");'; |
|
91 | + return '$("#.'.$this->identifier.').dimmer("'.$status.'");'; |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | public function compile(JsUtils $js=NULL, $view=NULL) { |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | public function run(JsUtils $js) { |
101 | - $this->_bsComponent=$js->semantic()->generic("#" . $this->identifier); |
|
101 | + $this->_bsComponent=$js->semantic()->generic("#".$this->identifier); |
|
102 | 102 | parent::run($js); |
103 | 103 | $this->addEventsOnRun($js); |
104 | 104 | if (isset($this->_popup)) { |
@@ -31,8 +31,9 @@ discard block |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | public function setPopupAttributes($variation=NULL, $popupEvent=NULL) { |
34 | - if (isset($this->_popup)) |
|
35 | - $this->_popup->setAttributes($variation, $popupEvent); |
|
34 | + if (isset($this->_popup)) { |
|
35 | + $this->_popup->setAttributes($variation, $popupEvent); |
|
36 | + } |
|
36 | 37 | } |
37 | 38 | |
38 | 39 | public function addPopup($title="", $content="", $variation=NULL, $params=array()) { |
@@ -59,8 +60,9 @@ discard block |
||
59 | 60 | $labelO=$label; |
60 | 61 | if (\is_object($label) === false) { |
61 | 62 | $labelO=new HtmlLabel("label-" . $this->identifier, $label); |
62 | - if (isset($icon)) |
|
63 | - $labelO->addIcon($icon); |
|
63 | + if (isset($icon)) { |
|
64 | + $labelO->addIcon($icon); |
|
65 | + } |
|
64 | 66 | } else { |
65 | 67 | $labelO->addToPropertyCtrl("class", "label", array ("label" )); |
66 | 68 | } |
@@ -79,21 +81,24 @@ discard block |
||
79 | 81 | * @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
80 | 82 | */ |
81 | 83 | public function asLink($href=NULL) { |
82 | - if (isset($href)) |
|
83 | - $this->setProperty("href", $href); |
|
84 | + if (isset($href)) { |
|
85 | + $this->setProperty("href", $href); |
|
86 | + } |
|
84 | 87 | return $this->setTagName("a"); |
85 | 88 | } |
86 | 89 | |
87 | 90 | public function jsShowDimmer($show=true) { |
88 | 91 | $status="hide"; |
89 | - if ($show === true) |
|
90 | - $status="show"; |
|
92 | + if ($show === true) { |
|
93 | + $status="show"; |
|
94 | + } |
|
91 | 95 | return '$("#.' . $this->identifier . ').dimmer("' . $status . '");'; |
92 | 96 | } |
93 | 97 | |
94 | 98 | public function compile(JsUtils $js=NULL, $view=NULL) { |
95 | - if (isset($this->_popup)) |
|
96 | - $this->_popup->compile(); |
|
99 | + if (isset($this->_popup)) { |
|
100 | + $this->_popup->compile(); |
|
101 | + } |
|
97 | 102 | return parent::compile($js, $view); |
98 | 103 | } |
99 | 104 |
@@ -2,5 +2,5 @@ |
||
2 | 2 | namespace Ajax\semantic\html\base\constants; |
3 | 3 | use Ajax\common\BaseEnum; |
4 | 4 | abstract class Size extends BaseEnum { |
5 | - const MASSIVE="massive",HUGE="huge",BIG="big",LARGE="large",MEDIUM="",SMALL="small",TINY="tiny",MINI="mini"; |
|
5 | + const MASSIVE="massive", HUGE="huge", BIG="big", LARGE="large", MEDIUM="", SMALL="small", TINY="tiny", MINI="mini"; |
|
6 | 6 | } |
7 | 7 | \ 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 Direction extends BaseEnum { |
5 | - const RIGHT="right", LEFT="left",DOWN="down",UP="up",NONE="",BELOW="below"; |
|
5 | + const RIGHT="right", LEFT="left", DOWN="down", UP="up", NONE="", BELOW="below"; |
|
6 | 6 | } |
7 | 7 | \ No newline at end of file |
@@ -9,27 +9,27 @@ |
||
9 | 9 | class HtmlMenuItem extends HtmlAbsractItem { |
10 | 10 | |
11 | 11 | public function __construct($identifier, $content) { |
12 | - parent::__construct($identifier,"item",$content); |
|
12 | + parent::__construct($identifier, "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 | } |