@@ -7,16 +7,16 @@ discard block |
||
7 | 7 | trait IconTrait { |
8 | 8 | private $_hasIcon=false; |
9 | 9 | |
10 | - public function addIcon($icon,$direction=Direction::LEFT){ |
|
11 | - if($this->_hasIcon===false){ |
|
10 | + public function addIcon($icon, $direction=Direction::LEFT) { |
|
11 | + if ($this->_hasIcon===false) { |
|
12 | 12 | $iconO=$icon; |
13 | - if(\is_string($icon)){ |
|
13 | + if (\is_string($icon)) { |
|
14 | 14 | $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
15 | 15 | } |
16 | 16 | $this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon")); |
17 | - $this->addContent($iconO,false); |
|
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")); |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | return $iconO; |
25 | 25 | } |
26 | 26 | |
27 | - public function getIcon(){ |
|
28 | - if(\is_array($this->content)){ |
|
29 | - foreach ($this->content as $item){ |
|
30 | - if($item instanceof HtmlIcon) |
|
27 | + public function getIcon() { |
|
28 | + if (\is_array($this->content)) { |
|
29 | + foreach ($this->content as $item) { |
|
30 | + if ($item instanceof HtmlIcon) |
|
31 | 31 | return $item; |
32 | 32 | } |
33 | 33 | } |
@@ -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 |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | protected $_contentSeparator=""; |
23 | 23 | |
24 | 24 | |
25 | - public function __construct($identifier,$tagName,$baseClass){ |
|
26 | - parent::__construct($identifier,$tagName,$baseClass); |
|
25 | + public function __construct($identifier, $tagName, $baseClass) { |
|
26 | + parent::__construct($identifier, $tagName, $baseClass); |
|
27 | 27 | $this->root=""; |
28 | 28 | $this->attr="data-ajax"; |
29 | 29 | } |
@@ -35,11 +35,11 @@ discard block |
||
35 | 35 | * @param string $attr the html attribute used to build the elements url |
36 | 36 | * @return HtmlNavElement |
37 | 37 | */ |
38 | - public function autoGetOnClick($targetSelector){ |
|
39 | - return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
|
38 | + public function autoGetOnClick($targetSelector) { |
|
39 | + return $this->getOnClick($this->root, $targetSelector, array("attr"=>$this->attr)); |
|
40 | 40 | } |
41 | 41 | |
42 | - public function contentAsString(){ |
|
42 | + public function contentAsString() { |
|
43 | 43 | return JArray::implode($this->_contentSeparator, $this->content); |
44 | 44 | } |
45 | 45 | |
@@ -47,15 +47,15 @@ discard block |
||
47 | 47 | * Generate the jquery script to set the elements to the HtmlNavElement |
48 | 48 | * @param JsUtils $jsUtils |
49 | 49 | */ |
50 | - public function jsSetContent(JsUtils $jsUtils){ |
|
51 | - $jsUtils->html("#".$this->identifier,str_replace("\"","'", $this->contentAsString()),true); |
|
50 | + public function jsSetContent(JsUtils $jsUtils) { |
|
51 | + $jsUtils->html("#".$this->identifier, str_replace("\"", "'", $this->contentAsString()), true); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | public function getRoot() { |
55 | 55 | return $this->root; |
56 | 56 | } |
57 | 57 | public function setRoot($root) { |
58 | - $this->root = $root; |
|
58 | + $this->root=$root; |
|
59 | 59 | return $this; |
60 | 60 | } |
61 | 61 | public function getAttr() { |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | * @return HtmlNavElement |
69 | 69 | */ |
70 | 70 | public function setAttr($attr) { |
71 | - $this->attr = $attr; |
|
71 | + $this->attr=$attr; |
|
72 | 72 | return $this; |
73 | 73 | } |
74 | 74 | |
75 | 75 | public function __call($method, $args) { |
76 | - if(isset($this->$method) && is_callable($this->$method)) { |
|
76 | + if (isset($this->$method) && is_callable($this->$method)) { |
|
77 | 77 | return call_user_func_array( |
78 | 78 | $this->$method, |
79 | 79 | $args |
@@ -81,32 +81,32 @@ discard block |
||
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
84 | - public abstract function fromDispatcher($dispatcher,$startIndex=0); |
|
84 | + public abstract function fromDispatcher($dispatcher, $startIndex=0); |
|
85 | 85 | |
86 | 86 | |
87 | - public function setContentDivider($divider,$index=NULL) { |
|
87 | + public function setContentDivider($divider, $index=NULL) { |
|
88 | 88 | $divider="<div class='divider'> {$divider} </div>"; |
89 | 89 | return $this->setDivider($divider, $index); |
90 | 90 | } |
91 | 91 | |
92 | - public function setIconContentDivider($iconContentDivider,$index=NULL) { |
|
92 | + public function setIconContentDivider($iconContentDivider, $index=NULL) { |
|
93 | 93 | $contentDivider="<i class='".$iconContentDivider." icon divider'></i>"; |
94 | 94 | return $this->setDivider($contentDivider, $index); |
95 | 95 | } |
96 | 96 | |
97 | - protected function setDivider($divider,$index){ |
|
98 | - if(isset($index)){ |
|
99 | - if(\is_array($this->_contentSeparator)===false) |
|
100 | - $this->_contentSeparator=array_fill (0, $this->count()-1,$this->_contentSeparator); |
|
97 | + protected function setDivider($divider, $index) { |
|
98 | + if (isset($index)) { |
|
99 | + if (\is_array($this->_contentSeparator)===false) |
|
100 | + $this->_contentSeparator=array_fill(0, $this->count()-1, $this->_contentSeparator); |
|
101 | 101 | $this->_contentSeparator[$index]=$divider; |
102 | - }else{ |
|
102 | + }else { |
|
103 | 103 | $this->_contentSeparator=$divider; |
104 | 104 | } |
105 | 105 | return $this; |
106 | 106 | } |
107 | 107 | |
108 | - protected function getContentDivider($index){ |
|
109 | - if(\is_array($this->_contentSeparator)===true){ |
|
108 | + protected function getContentDivider($index) { |
|
109 | + if (\is_array($this->_contentSeparator)===true) { |
|
110 | 110 | return @$this->_contentSeparator[$index]; |
111 | 111 | } |
112 | 112 | return $this->_contentSeparator; |
@@ -20,21 +20,21 @@ |
||
20 | 20 | public static function getDefaultValue($array, $key, $default) { |
21 | 21 | if (array_key_exists($key, $array)) { |
22 | 22 | return $array [$key]; |
23 | - } else |
|
23 | + }else |
|
24 | 24 | return $default; |
25 | 25 | } |
26 | 26 | |
27 | - public static function implode($glue,$pieces){ |
|
27 | + public static function implode($glue, $pieces) { |
|
28 | 28 | $result=""; |
29 | - if(\is_array($glue)){ |
|
29 | + if (\is_array($glue)) { |
|
30 | 30 | $size=\sizeof($pieces); |
31 | - if($size>0){ |
|
32 | - for($i=0;$i<$size-1;$i++){ |
|
31 | + if ($size>0) { |
|
32 | + for ($i=0; $i<$size-1; $i++) { |
|
33 | 33 | $result.=$pieces[$i].@$glue[$i]; |
34 | 34 | } |
35 | 35 | $result.=$pieces[$size-1]; |
36 | 36 | } |
37 | - }else{ |
|
37 | + }else { |
|
38 | 38 | $result=\implode($glue, $pieces); |
39 | 39 | } |
40 | 40 | return $result; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * @param string $onClick JS Code for click event |
23 | 23 | */ |
24 | 24 | public function __construct($identifier, $value="", $cssStyle=null, $onClick=null) { |
25 | - parent::__construct($identifier, "button","ui button"); |
|
25 | + parent::__construct($identifier, "button", "ui button"); |
|
26 | 26 | $this->content=$value; |
27 | 27 | if (isset($cssStyle)) { |
28 | 28 | $this->setStyle($cssStyle); |
@@ -48,28 +48,28 @@ discard block |
||
48 | 48 | * @return \Ajax\semantic\html\HtmlButton default : "" |
49 | 49 | */ |
50 | 50 | public function setStyle($cssStyle) { |
51 | - return $this->addToProperty("class",$cssStyle); |
|
51 | + return $this->addToProperty("class", $cssStyle); |
|
52 | 52 | } |
53 | 53 | |
54 | - public function setFocusable($value=true){ |
|
55 | - if($value===true) |
|
54 | + public function setFocusable($value=true) { |
|
55 | + if ($value===true) |
|
56 | 56 | $this->setProperty("tabindex", "0"); |
57 | - else{ |
|
57 | + else { |
|
58 | 58 | $this->removeProperty("tabindex"); |
59 | 59 | } |
60 | 60 | return $this; |
61 | 61 | } |
62 | 62 | |
63 | - public function setAnimated($content,$animation=""){ |
|
63 | + public function setAnimated($content, $animation="") { |
|
64 | 64 | $this->setTagName("div"); |
65 | 65 | $this->addToProperty("class", "animated ".$animation); |
66 | - $visible=new HtmlSemDoubleElement("visible-".$this->identifier,"div"); |
|
66 | + $visible=new HtmlSemDoubleElement("visible-".$this->identifier, "div"); |
|
67 | 67 | $visible->setClass("visible content"); |
68 | 68 | $visible->setContent($this->content); |
69 | - $hidden=new HtmlSemDoubleElement("hidden-".$this->identifier,"div"); |
|
69 | + $hidden=new HtmlSemDoubleElement("hidden-".$this->identifier, "div"); |
|
70 | 70 | $hidden->setClass("hidden content"); |
71 | 71 | $hidden->setContent($content); |
72 | - $this->content=array($visible,$hidden); |
|
72 | + $this->content=array($visible, $hidden); |
|
73 | 73 | return $hidden; |
74 | 74 | } |
75 | 75 | |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | * @param string|HtmlIcon $icon |
78 | 78 | * @return \Ajax\semantic\html\elements\HtmlButton |
79 | 79 | */ |
80 | - public function asIcon($icon){ |
|
80 | + public function asIcon($icon) { |
|
81 | 81 | $iconO=$icon; |
82 | - if(\is_string($icon)){ |
|
82 | + if (\is_string($icon)) { |
|
83 | 83 | $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
84 | 84 | } |
85 | 85 | $this->addToProperty("class", "icon"); |
@@ -93,14 +93,14 @@ discard block |
||
93 | 93 | * @param string $before |
94 | 94 | * @return \Ajax\semantic\html\elements\HtmlLabel |
95 | 95 | */ |
96 | - public function addLabel($caption,$before=false){ |
|
96 | + public function addLabel($caption, $before=false) { |
|
97 | 97 | $this->tagName="div"; |
98 | 98 | $this->addToProperty("class", "labeled"); |
99 | - $this->content=new HtmlButton("button-".$this->identifier,$this->content); |
|
99 | + $this->content=new HtmlButton("button-".$this->identifier, $this->content); |
|
100 | 100 | $this->content->setTagName("div"); |
101 | - $label=new HtmlLabel("label-".$this->identifier,$caption,"a"); |
|
101 | + $label=new HtmlLabel("label-".$this->identifier, $caption, "a"); |
|
102 | 102 | $label->setBasic(); |
103 | - $this->addContent($label,$before); |
|
103 | + $this->addContent($label, $before); |
|
104 | 104 | return $label; |
105 | 105 | } |
106 | 106 | /* |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function fromArray($array) { |
111 | 111 | $array=parent::fromArray($array); |
112 | - foreach ( $array as $key => $value ) { |
|
112 | + foreach ($array as $key => $value) { |
|
113 | 113 | $this->setProperty($key, $value); |
114 | 114 | } |
115 | 115 | return $array; |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * show it is currently the active user selection |
120 | 120 | * @return \Ajax\semantic\html\elements\HtmlButton |
121 | 121 | */ |
122 | - public function setActive(){ |
|
122 | + public function setActive() { |
|
123 | 123 | return $this->addToProperty("class", "active"); |
124 | 124 | } |
125 | 125 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * hint towards a positive consequence |
128 | 128 | * @return \Ajax\semantic\html\elements\HtmlButton |
129 | 129 | */ |
130 | - public function setPositive(){ |
|
130 | + public function setPositive() { |
|
131 | 131 | return $this->addToProperty("class", "positive"); |
132 | 132 | } |
133 | 133 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * hint towards a negative consequence |
136 | 136 | * @return \Ajax\semantic\html\elements\HtmlButton |
137 | 137 | */ |
138 | - public function setNegative(){ |
|
138 | + public function setNegative() { |
|
139 | 139 | return $this->addToProperty("class", "negative"); |
140 | 140 | } |
141 | 141 | |
@@ -143,14 +143,14 @@ discard block |
||
143 | 143 | * formatted to toggle on/off |
144 | 144 | * @return \Ajax\semantic\html\elements\HtmlButton |
145 | 145 | */ |
146 | - public function setToggle(){ |
|
146 | + public function setToggle() { |
|
147 | 147 | return $this->addToProperty("class", "toggle"); |
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
151 | 151 | * @return \Ajax\semantic\html\elements\HtmlButton |
152 | 152 | */ |
153 | - public function setCircular(){ |
|
153 | + public function setCircular() { |
|
154 | 154 | return $this->addToProperty("class", "circular"); |
155 | 155 | } |
156 | 156 | |
@@ -158,11 +158,11 @@ discard block |
||
158 | 158 | * button is less pronounced |
159 | 159 | * @return \Ajax\semantic\html\elements\HtmlButton |
160 | 160 | */ |
161 | - public function setBasic(){ |
|
161 | + public function setBasic() { |
|
162 | 162 | return $this->addToProperty("class", "basic"); |
163 | 163 | } |
164 | 164 | |
165 | - public function setEmphasis($value){ |
|
165 | + public function setEmphasis($value) { |
|
166 | 166 | return $this->addToPropertyCtrl("class", $value, Emphasis::getConstants()); |
167 | 167 | } |
168 | 168 | } |
169 | 169 | \ No newline at end of file |