@@ -16,163 +16,163 @@ discard block |
||
16 | 16 | |
17 | 17 | public static $index=0; |
18 | 18 | |
19 | - public function __construct($identifier,$instance=NULL,$captions=NULL){ |
|
19 | + public function __construct($identifier, $instance=NULL, $captions=NULL) { |
|
20 | 20 | $this->widgetIdentifier=$identifier; |
21 | 21 | $this->values=[]; |
22 | 22 | $this->afterCompile=[]; |
23 | - if(isset($instance)) |
|
23 | + if (isset($instance)) |
|
24 | 24 | $this->setInstance($instance); |
25 | 25 | $this->setCaptions($captions); |
26 | 26 | $this->captionCallback=NULL; |
27 | 27 | } |
28 | 28 | |
29 | - public function getValues(){ |
|
29 | + public function getValues() { |
|
30 | 30 | $values=[]; |
31 | 31 | $index=0; |
32 | 32 | $count=$this->count(); |
33 | - while($index<$count){ |
|
33 | + while ($index<$count) { |
|
34 | 34 | $values[]=$this->getValue($index++); |
35 | 35 | } |
36 | 36 | return $values; |
37 | 37 | } |
38 | 38 | |
39 | - public function getIdentifier(){ |
|
39 | + public function getIdentifier() { |
|
40 | 40 | $value=self::$index; |
41 | - if(isset($this->values["identifier"])) |
|
42 | - $value=$this->values["identifier"](self::$index,$this->instance); |
|
41 | + if (isset($this->values["identifier"])) |
|
42 | + $value=$this->values["identifier"](self::$index, $this->instance); |
|
43 | 43 | return $value; |
44 | 44 | } |
45 | 45 | |
46 | - public function getValue($index){ |
|
46 | + public function getValue($index) { |
|
47 | 47 | $property=$this->properties[$index]; |
48 | 48 | return $this->_getValue($property, $index); |
49 | 49 | } |
50 | 50 | |
51 | - protected function _beforeAddProperty($index,&$field){ |
|
51 | + protected function _beforeAddProperty($index, &$field) { |
|
52 | 52 | |
53 | 53 | } |
54 | 54 | |
55 | - protected function _getDefaultValue($name,$value,$index){ |
|
55 | + protected function _getDefaultValue($name, $value, $index) { |
|
56 | 56 | return $value; |
57 | 57 | } |
58 | 58 | |
59 | - protected function _getValue($property,$index){ |
|
60 | - if($property instanceof \ReflectionProperty){ |
|
59 | + protected function _getValue($property, $index) { |
|
60 | + if ($property instanceof \ReflectionProperty) { |
|
61 | 61 | $property->setAccessible(true); |
62 | 62 | $value=$property->getValue($this->instance); |
63 | - if(isset($this->values[$index])){ |
|
64 | - $value= $this->values[$index]($value,$this->instance,$index); |
|
65 | - }else{ |
|
66 | - $value=$this->_getDefaultValue($property->getName(),$value, $index); |
|
63 | + if (isset($this->values[$index])) { |
|
64 | + $value=$this->values[$index]($value, $this->instance, $index); |
|
65 | + } else { |
|
66 | + $value=$this->_getDefaultValue($property->getName(), $value, $index); |
|
67 | 67 | } |
68 | - }else{ |
|
69 | - if(\is_callable($property)) |
|
68 | + } else { |
|
69 | + if (\is_callable($property)) |
|
70 | 70 | $value=$property($this->instance); |
71 | - elseif(\is_array($property)){ |
|
72 | - $values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property); |
|
71 | + elseif (\is_array($property)) { |
|
72 | + $values=\array_map(function($v) use ($index){return $this->_getValue($v, $index); }, $property); |
|
73 | 73 | $value=\implode("", $values); |
74 | - }else{ |
|
75 | - if(isset($this->values[$index])){ |
|
76 | - $value= $this->values[$index]($property,$this->instance,$index); |
|
77 | - }else{ |
|
74 | + } else { |
|
75 | + if (isset($this->values[$index])) { |
|
76 | + $value=$this->values[$index]($property, $this->instance, $index); |
|
77 | + } else { |
|
78 | 78 | $value=$property; |
79 | 79 | } |
80 | 80 | } |
81 | 81 | } |
82 | - if(isset($this->afterCompile[$index])){ |
|
83 | - if(\is_callable($this->afterCompile[$index])){ |
|
84 | - $this->afterCompile[$index]($value,$this->instance,$index); |
|
82 | + if (isset($this->afterCompile[$index])) { |
|
83 | + if (\is_callable($this->afterCompile[$index])) { |
|
84 | + $this->afterCompile[$index]($value, $this->instance, $index); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | return $value; |
88 | 88 | } |
89 | 89 | |
90 | - public function insertField($index,$field){ |
|
91 | - array_splice( $this->visibleProperties, $index, 0, $field ); |
|
90 | + public function insertField($index, $field) { |
|
91 | + array_splice($this->visibleProperties, $index, 0, $field); |
|
92 | 92 | return $this; |
93 | 93 | } |
94 | 94 | |
95 | - public function insertInField($index,$field){ |
|
95 | + public function insertInField($index, $field) { |
|
96 | 96 | $vb=$this->visibleProperties; |
97 | - if(isset($vb[$index])){ |
|
98 | - if(\is_array($vb[$index])){ |
|
97 | + if (isset($vb[$index])) { |
|
98 | + if (\is_array($vb[$index])) { |
|
99 | 99 | $this->visibleProperties[$index][]=$field; |
100 | - }else{ |
|
101 | - $this->visibleProperties[$index]=[$vb[$index],$field]; |
|
100 | + } else { |
|
101 | + $this->visibleProperties[$index]=[$vb[$index], $field]; |
|
102 | 102 | } |
103 | - }else{ |
|
103 | + } else { |
|
104 | 104 | return $this->insertField($index, $field); |
105 | 105 | } |
106 | 106 | return $this; |
107 | 107 | } |
108 | 108 | |
109 | - public function addField($field){ |
|
109 | + public function addField($field) { |
|
110 | 110 | $this->visibleProperties[]=$field; |
111 | 111 | return $this; |
112 | 112 | } |
113 | 113 | |
114 | - public function count(){ |
|
114 | + public function count() { |
|
115 | 115 | return \sizeof($this->properties); |
116 | 116 | } |
117 | 117 | |
118 | - public function visiblePropertiesCount(){ |
|
118 | + public function visiblePropertiesCount() { |
|
119 | 119 | return \sizeof($this->visibleProperties); |
120 | 120 | } |
121 | 121 | |
122 | - public function getProperty($index){ |
|
122 | + public function getProperty($index) { |
|
123 | 123 | return $this->properties[$index]; |
124 | 124 | } |
125 | 125 | |
126 | - protected function showableProperty(\ReflectionProperty $rProperty){ |
|
127 | - return JString::startswith($rProperty->getName(),"_")===false; |
|
126 | + protected function showableProperty(\ReflectionProperty $rProperty) { |
|
127 | + return JString::startswith($rProperty->getName(), "_")===false; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | public function setInstance($instance) { |
131 | - if(\is_string($instance)){ |
|
131 | + if (\is_string($instance)) { |
|
132 | 132 | $instance=new $instance(); |
133 | 133 | } |
134 | 134 | $this->instance=$instance; |
135 | 135 | $this->properties=[]; |
136 | 136 | $this->reflect=new \ReflectionClass($instance); |
137 | - if(\sizeof($this->visibleProperties)===0){ |
|
137 | + if (\sizeof($this->visibleProperties)===0) { |
|
138 | 138 | $this->properties=$this->getDefaultProperties(); |
139 | - }else{ |
|
140 | - foreach ($this->visibleProperties as $property){ |
|
139 | + } else { |
|
140 | + foreach ($this->visibleProperties as $property) { |
|
141 | 141 | $this->setInstanceProperty($property); |
142 | 142 | } |
143 | 143 | } |
144 | 144 | return $this; |
145 | 145 | } |
146 | 146 | |
147 | - private function setInstanceProperty($property){ |
|
148 | - if(\is_callable($property)){ |
|
147 | + private function setInstanceProperty($property) { |
|
148 | + if (\is_callable($property)) { |
|
149 | 149 | $this->properties[]=$property; |
150 | - }elseif(\is_string($property)){ |
|
151 | - try{ |
|
150 | + }elseif (\is_string($property)) { |
|
151 | + try { |
|
152 | 152 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
153 | 153 | $rProperty=$this->reflect->getProperty($property); |
154 | 154 | $this->properties[]=$rProperty; |
155 | - }catch(\Exception $e){ |
|
155 | + }catch (\Exception $e) { |
|
156 | 156 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
157 | 157 | $this->properties[]=$property; |
158 | 158 | } |
159 | - }elseif(\is_int($property)){ |
|
159 | + }elseif (\is_int($property)) { |
|
160 | 160 | $props=$this->getDefaultProperties(); |
161 | - if(isset($props[$property])) |
|
161 | + if (isset($props[$property])) |
|
162 | 162 | $this->properties[]=$props[$property]; |
163 | 163 | else |
164 | 164 | $this->properties[]=$property; |
165 | - }else{ |
|
165 | + } else { |
|
166 | 166 | $this->properties[]=$property; |
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
170 | - protected function getDefaultProperties(){ |
|
170 | + protected function getDefaultProperties() { |
|
171 | 171 | $result=[]; |
172 | 172 | $properties=$this->reflect->getProperties(); |
173 | - foreach ($properties as $property){ |
|
173 | + foreach ($properties as $property) { |
|
174 | 174 | $showable=$this->showableProperty($property); |
175 | - if($showable!==false){ |
|
175 | + if ($showable!==false) { |
|
176 | 176 | $result[]=$property; |
177 | 177 | } |
178 | 178 | } |
@@ -184,12 +184,12 @@ discard block |
||
184 | 184 | return $this; |
185 | 185 | } |
186 | 186 | |
187 | - public function setValueFunction($index,$callback){ |
|
187 | + public function setValueFunction($index, $callback) { |
|
188 | 188 | $this->values[$index]=$callback; |
189 | 189 | return $this; |
190 | 190 | } |
191 | 191 | |
192 | - public function setIdentifierFunction($callback){ |
|
192 | + public function setIdentifierFunction($callback) { |
|
193 | 193 | $this->values["identifier"]=$callback; |
194 | 194 | return $this; |
195 | 195 | } |
@@ -202,41 +202,41 @@ discard block |
||
202 | 202 | return $this->properties; |
203 | 203 | } |
204 | 204 | |
205 | - public function getCaption($index){ |
|
206 | - if(isset($this->captions[$index])){ |
|
205 | + public function getCaption($index) { |
|
206 | + if (isset($this->captions[$index])) { |
|
207 | 207 | return $this->captions[$index]; |
208 | 208 | } |
209 | - if($this->properties[$index] instanceof \ReflectionProperty) |
|
209 | + if ($this->properties[$index] instanceof \ReflectionProperty) |
|
210 | 210 | return $this->properties[$index]->getName(); |
211 | - elseif(\is_callable($this->properties[$index])) |
|
211 | + elseif (\is_callable($this->properties[$index])) |
|
212 | 212 | return ""; |
213 | 213 | else |
214 | 214 | return $this->properties[$index]; |
215 | 215 | } |
216 | 216 | |
217 | - public function getCaptions(){ |
|
218 | - if(isset($this->captions)){ |
|
219 | - $captions= $this->captions; |
|
220 | - for($i=\sizeof($captions);$i<$this->count();$i++){ |
|
217 | + public function getCaptions() { |
|
218 | + if (isset($this->captions)) { |
|
219 | + $captions=$this->captions; |
|
220 | + for ($i=\sizeof($captions); $i<$this->count(); $i++) { |
|
221 | 221 | $captions[]=""; |
222 | 222 | } |
223 | - }else{ |
|
223 | + } else { |
|
224 | 224 | $captions=[]; |
225 | 225 | $index=0; |
226 | 226 | $count=$this->count(); |
227 | - while($index<$count){ |
|
227 | + while ($index<$count) { |
|
228 | 228 | $captions[]=$this->getCaption($index++); |
229 | 229 | } |
230 | 230 | } |
231 | - if(isset($this->captionCallback) && \is_callable($this->captionCallback)){ |
|
231 | + if (isset($this->captionCallback) && \is_callable($this->captionCallback)) { |
|
232 | 232 | $callback=$this->captionCallback; |
233 | - $callback($captions,$this->instance); |
|
233 | + $callback($captions, $this->instance); |
|
234 | 234 | } |
235 | 235 | return $captions; |
236 | 236 | } |
237 | 237 | |
238 | - public function setCaption($index,$caption){ |
|
239 | - if(isset($this->captions)===false) |
|
238 | + public function setCaption($index, $caption) { |
|
239 | + if (isset($this->captions)===false) |
|
240 | 240 | $this->captions=[]; |
241 | 241 | $this->captions[$index]=$caption; |
242 | 242 | return $this; |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | * @param callable $callback function called after the field compilation |
255 | 255 | * @return \Ajax\semantic\widgets\datatable\InstanceViewer |
256 | 256 | */ |
257 | - public function afterCompile($index,$callback){ |
|
257 | + public function afterCompile($index, $callback) { |
|
258 | 258 | $this->afterCompile[$index]=$callback; |
259 | 259 | return $this; |
260 | 260 | } |
@@ -20,8 +20,9 @@ discard block |
||
20 | 20 | $this->widgetIdentifier=$identifier; |
21 | 21 | $this->values=[]; |
22 | 22 | $this->afterCompile=[]; |
23 | - if(isset($instance)) |
|
24 | - $this->setInstance($instance); |
|
23 | + if(isset($instance)) { |
|
24 | + $this->setInstance($instance); |
|
25 | + } |
|
25 | 26 | $this->setCaptions($captions); |
26 | 27 | $this->captionCallback=NULL; |
27 | 28 | } |
@@ -38,8 +39,9 @@ discard block |
||
38 | 39 | |
39 | 40 | public function getIdentifier(){ |
40 | 41 | $value=self::$index; |
41 | - if(isset($this->values["identifier"])) |
|
42 | - $value=$this->values["identifier"](self::$index,$this->instance); |
|
42 | + if(isset($this->values["identifier"])) { |
|
43 | + $value=$this->values["identifier"](self::$index,$this->instance); |
|
44 | + } |
|
43 | 45 | return $value; |
44 | 46 | } |
45 | 47 | |
@@ -62,19 +64,19 @@ discard block |
||
62 | 64 | $value=$property->getValue($this->instance); |
63 | 65 | if(isset($this->values[$index])){ |
64 | 66 | $value= $this->values[$index]($value,$this->instance,$index); |
65 | - }else{ |
|
67 | + } else{ |
|
66 | 68 | $value=$this->_getDefaultValue($property->getName(),$value, $index); |
67 | 69 | } |
68 | - }else{ |
|
69 | - if(\is_callable($property)) |
|
70 | - $value=$property($this->instance); |
|
71 | - elseif(\is_array($property)){ |
|
70 | + } else{ |
|
71 | + if(\is_callable($property)) { |
|
72 | + $value=$property($this->instance); |
|
73 | + } elseif(\is_array($property)){ |
|
72 | 74 | $values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property); |
73 | 75 | $value=\implode("", $values); |
74 | - }else{ |
|
76 | + } else{ |
|
75 | 77 | if(isset($this->values[$index])){ |
76 | 78 | $value= $this->values[$index]($property,$this->instance,$index); |
77 | - }else{ |
|
79 | + } else{ |
|
78 | 80 | $value=$property; |
79 | 81 | } |
80 | 82 | } |
@@ -97,10 +99,10 @@ discard block |
||
97 | 99 | if(isset($vb[$index])){ |
98 | 100 | if(\is_array($vb[$index])){ |
99 | 101 | $this->visibleProperties[$index][]=$field; |
100 | - }else{ |
|
102 | + } else{ |
|
101 | 103 | $this->visibleProperties[$index]=[$vb[$index],$field]; |
102 | 104 | } |
103 | - }else{ |
|
105 | + } else{ |
|
104 | 106 | return $this->insertField($index, $field); |
105 | 107 | } |
106 | 108 | return $this; |
@@ -136,7 +138,7 @@ discard block |
||
136 | 138 | $this->reflect=new \ReflectionClass($instance); |
137 | 139 | if(\sizeof($this->visibleProperties)===0){ |
138 | 140 | $this->properties=$this->getDefaultProperties(); |
139 | - }else{ |
|
141 | + } else{ |
|
140 | 142 | foreach ($this->visibleProperties as $property){ |
141 | 143 | $this->setInstanceProperty($property); |
142 | 144 | } |
@@ -147,22 +149,23 @@ discard block |
||
147 | 149 | private function setInstanceProperty($property){ |
148 | 150 | if(\is_callable($property)){ |
149 | 151 | $this->properties[]=$property; |
150 | - }elseif(\is_string($property)){ |
|
152 | + } elseif(\is_string($property)){ |
|
151 | 153 | try{ |
152 | 154 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
153 | 155 | $rProperty=$this->reflect->getProperty($property); |
154 | 156 | $this->properties[]=$rProperty; |
155 | - }catch(\Exception $e){ |
|
157 | + } catch(\Exception $e){ |
|
156 | 158 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
157 | 159 | $this->properties[]=$property; |
158 | 160 | } |
159 | - }elseif(\is_int($property)){ |
|
161 | + } elseif(\is_int($property)){ |
|
160 | 162 | $props=$this->getDefaultProperties(); |
161 | - if(isset($props[$property])) |
|
162 | - $this->properties[]=$props[$property]; |
|
163 | - else |
|
164 | - $this->properties[]=$property; |
|
165 | - }else{ |
|
163 | + if(isset($props[$property])) { |
|
164 | + $this->properties[]=$props[$property]; |
|
165 | + } else { |
|
166 | + $this->properties[]=$property; |
|
167 | + } |
|
168 | + } else{ |
|
166 | 169 | $this->properties[]=$property; |
167 | 170 | } |
168 | 171 | } |
@@ -206,12 +209,13 @@ discard block |
||
206 | 209 | if(isset($this->captions[$index])){ |
207 | 210 | return $this->captions[$index]; |
208 | 211 | } |
209 | - if($this->properties[$index] instanceof \ReflectionProperty) |
|
210 | - return $this->properties[$index]->getName(); |
|
211 | - elseif(\is_callable($this->properties[$index])) |
|
212 | - return ""; |
|
213 | - else |
|
214 | - return $this->properties[$index]; |
|
212 | + if($this->properties[$index] instanceof \ReflectionProperty) { |
|
213 | + return $this->properties[$index]->getName(); |
|
214 | + } elseif(\is_callable($this->properties[$index])) { |
|
215 | + return ""; |
|
216 | + } else { |
|
217 | + return $this->properties[$index]; |
|
218 | + } |
|
215 | 219 | } |
216 | 220 | |
217 | 221 | public function getCaptions(){ |
@@ -220,7 +224,7 @@ discard block |
||
220 | 224 | for($i=\sizeof($captions);$i<$this->count();$i++){ |
221 | 225 | $captions[]=""; |
222 | 226 | } |
223 | - }else{ |
|
227 | + } else{ |
|
224 | 228 | $captions=[]; |
225 | 229 | $index=0; |
226 | 230 | $count=$this->count(); |
@@ -236,8 +240,9 @@ discard block |
||
236 | 240 | } |
237 | 241 | |
238 | 242 | public function setCaption($index,$caption){ |
239 | - if(isset($this->captions)===false) |
|
240 | - $this->captions=[]; |
|
243 | + if(isset($this->captions)===false) { |
|
244 | + $this->captions=[]; |
|
245 | + } |
|
241 | 246 | $this->captions[$index]=$caption; |
242 | 247 | return $this; |
243 | 248 | } |
@@ -13,6 +13,9 @@ |
||
13 | 13 | */ |
14 | 14 | class HtmlIconGroups extends HtmlSemCollection { |
15 | 15 | |
16 | + /** |
|
17 | + * @param string $identifier |
|
18 | + */ |
|
16 | 19 | public function __construct($identifier, $icons=array(), $size="") { |
17 | 20 | parent::__construct($identifier, "i", "icons"); |
18 | 21 | $this->addItems($icons); |
@@ -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 |
@@ -4,7 +4,7 @@ |
||
4 | 4 | |
5 | 5 | trait HtmlLinkTrait { |
6 | 6 | |
7 | - abstract public function setProperty($name,$value); |
|
7 | + abstract public function setProperty($name, $value); |
|
8 | 8 | abstract public function getProperty($name); |
9 | 9 | |
10 | 10 | public function setHref($value) { |
@@ -14,8 +14,8 @@ |
||
14 | 14 | */ |
15 | 15 | public function setAttachment($toElement, $side=Side::BOTH) { |
16 | 16 | if (isset($toElement)) { |
17 | - $toElement->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
17 | + $toElement->addToPropertyCtrl("class", "attached", array("attached")); |
|
18 | 18 | } |
19 | - return $this->addToPropertyCtrl("class", $side . " attached", Side::getConstantValues("attached")); |
|
19 | + return $this->addToPropertyCtrl("class", $side." attached", Side::getConstantValues("attached")); |
|
20 | 20 | } |
21 | 21 | } |
22 | 22 | \ No newline at end of file |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | trait LabeledIconTrait { |
14 | 14 | |
15 | 15 | abstract public function addToProperty($name, $value, $separator=" "); |
16 | - abstract public function addContent($content,$before=false); |
|
16 | + abstract public function addContent($content, $before=false); |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Adds an icon before or after |
@@ -22,17 +22,17 @@ discard block |
||
22 | 22 | * @param boolean $labeled |
23 | 23 | * @return \Ajax\semantic\html\elements\HtmlIcon |
24 | 24 | */ |
25 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
25 | + public function addIcon($icon, $before=true, $labeled=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 | - if($labeled!==false){ |
|
31 | - $direction=($before===true)?Direction::LEFT:Direction::RIGHT; |
|
30 | + if ($labeled!==false) { |
|
31 | + $direction=($before===true) ? Direction::LEFT : Direction::RIGHT; |
|
32 | 32 | $this->addToProperty("class", $direction." labeled icon"); |
33 | 33 | $this->tagName="div"; |
34 | 34 | } |
35 | - $this->addContent($iconO,$before); |
|
35 | + $this->addContent($iconO, $before); |
|
36 | 36 | return $iconO; |
37 | 37 | } |
38 | 38 | } |
39 | 39 | \ No newline at end of file |
@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | } |
19 | 19 | |
20 | 20 | public function setContent($content) { |
21 | - $this->content=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "content", new HtmlSemDoubleElement("", "div", "center", $content)); |
|
21 | + $this->content=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content", new HtmlSemDoubleElement("", "div", "center", $content)); |
|
22 | 22 | return $this; |
23 | 23 | } |
24 | 24 | |
25 | 25 | public function asIcon($icon, $title, $subHeader=NULL) { |
26 | - $header=new HtmlHeader("header-" . $this->identifier); |
|
26 | + $header=new HtmlHeader("header-".$this->identifier); |
|
27 | 27 | $header->asIcon($icon, $title, $subHeader); |
28 | - if ($this->_inverted === false) |
|
28 | + if ($this->_inverted===false) |
|
29 | 29 | $header->setInverted(); |
30 | 30 | return $this->setContent($header); |
31 | 31 | } |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | |
43 | 43 | public function run(JsUtils $js) { |
44 | 44 | if ($this->_container instanceof HtmlSingleElement) |
45 | - $this->_bsComponent=$js->semantic()->dimmer("#" . $this->_container->getIdentifier(), $this->_params); |
|
45 | + $this->_bsComponent=$js->semantic()->dimmer("#".$this->_container->getIdentifier(), $this->_params); |
|
46 | 46 | return parent::run($js); |
47 | 47 | } |
48 | 48 | |
49 | 49 | public function jsShow() { |
50 | 50 | if (isset($this->_container)) |
51 | - return '$("#.' . $this->_container->getIdentifier() . ').dimmer("show");'; |
|
51 | + return '$("#.'.$this->_container->getIdentifier().').dimmer("show");'; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | public function setBlurring() { |
@@ -25,8 +25,9 @@ discard block |
||
25 | 25 | public function asIcon($icon, $title, $subHeader=NULL) { |
26 | 26 | $header=new HtmlHeader("header-" . $this->identifier); |
27 | 27 | $header->asIcon($icon, $title, $subHeader); |
28 | - if ($this->_inverted === false) |
|
29 | - $header->setInverted(); |
|
28 | + if ($this->_inverted === false) { |
|
29 | + $header->setInverted(); |
|
30 | + } |
|
30 | 31 | return $this->setContent($header); |
31 | 32 | } |
32 | 33 | |
@@ -41,14 +42,16 @@ discard block |
||
41 | 42 | } |
42 | 43 | |
43 | 44 | public function run(JsUtils $js) { |
44 | - if ($this->_container instanceof HtmlSingleElement) |
|
45 | - $this->_bsComponent=$js->semantic()->dimmer("#" . $this->_container->getIdentifier(), $this->_params); |
|
45 | + if ($this->_container instanceof HtmlSingleElement) { |
|
46 | + $this->_bsComponent=$js->semantic()->dimmer("#" . $this->_container->getIdentifier(), $this->_params); |
|
47 | + } |
|
46 | 48 | return parent::run($js); |
47 | 49 | } |
48 | 50 | |
49 | 51 | public function jsShow() { |
50 | - if (isset($this->_container)) |
|
51 | - return '$("#.' . $this->_container->getIdentifier() . ').dimmer("show");'; |
|
52 | + if (isset($this->_container)) { |
|
53 | + return '$("#.' . $this->_container->getIdentifier() . ').dimmer("show");'; |
|
54 | + } |
|
52 | 55 | } |
53 | 56 | |
54 | 57 | public function setBlurring() { |
@@ -8,12 +8,12 @@ discard block |
||
8 | 8 | use Ajax\semantic\html\base\constants\Direction; |
9 | 9 | |
10 | 10 | class HtmlSearch extends HtmlSemDoubleElement { |
11 | - private $_elements=array (); |
|
12 | - private $_searchFields=array ("title" ); |
|
11 | + private $_elements=array(); |
|
12 | + private $_searchFields=array("title"); |
|
13 | 13 | private $_local=false; |
14 | 14 | |
15 | 15 | public function __construct($identifier, $placeholder=NULL, $icon=NULL) { |
16 | - parent::__construct("search-" . $identifier, "div", "ui search", array ()); |
|
16 | + parent::__construct("search-".$identifier, "div", "ui search", array()); |
|
17 | 17 | $this->createField($placeholder, $icon); |
18 | 18 | $this->createResult(); |
19 | 19 | $this->_params["type"]="standard"; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | private function createResult() { |
35 | - $this->content["result"]=new HtmlSemDoubleElement("results-" . $this->identifier, "div", "results"); |
|
35 | + $this->content["result"]=new HtmlSemDoubleElement("results-".$this->identifier, "div", "results"); |
|
36 | 36 | return $this->content["result"]; |
37 | 37 | } |
38 | 38 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | public function setUrl($url) { |
52 | - $this->_params["apiSettings"]="%{url: %quote%" . $url . "%quote%}%"; |
|
52 | + $this->_params["apiSettings"]="%{url: %quote%".$url."%quote%}%"; |
|
53 | 53 | return $this; |
54 | 54 | } |
55 | 55 | |
@@ -72,16 +72,16 @@ discard block |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | public function run(JsUtils $js) { |
75 | - $this->_params["onSelect"]='%function(result,response){$(%quote%#' . $this->identifier . '%quote%).trigger(%quote%onSelect%quote%, {%quote%result%quote%: result, %quote%response%quote%:response} );}%'; |
|
75 | + $this->_params["onSelect"]='%function(result,response){$(%quote%#'.$this->identifier.'%quote%).trigger(%quote%onSelect%quote%, {%quote%result%quote%: result, %quote%response%quote%:response} );}%'; |
|
76 | 76 | $searchFields=\json_encode($this->_searchFields); |
77 | 77 | $searchFields=str_ireplace("\"", "%quote%", $searchFields); |
78 | - $this->_params["searchFields"]="%" . $searchFields . "%"; |
|
79 | - if ($this->_local === true) { |
|
78 | + $this->_params["searchFields"]="%".$searchFields."%"; |
|
79 | + if ($this->_local===true) { |
|
80 | 80 | $this->_params["source"]="%content%"; |
81 | - $this->addEvent("beforeExecute", "var content=" . $this->resultsToJson() . ";"); |
|
81 | + $this->addEvent("beforeExecute", "var content=".$this->resultsToJson().";"); |
|
82 | 82 | } |
83 | - if (isset($this->_bsComponent) === false) { |
|
84 | - $this->_bsComponent=$js->semantic()->search("#" . $this->identifier, $this->_params); |
|
83 | + if (isset($this->_bsComponent)===false) { |
|
84 | + $this->_bsComponent=$js->semantic()->search("#".$this->identifier, $this->_params); |
|
85 | 85 | } |
86 | 86 | $this->addEventsOnRun($js); |
87 | 87 | return $this->_bsComponent; |
@@ -21,10 +21,12 @@ |
||
21 | 21 | |
22 | 22 | private function createField($placeholder=NULL, $icon=NULL) { |
23 | 23 | $field=new HtmlInput($this->identifier); |
24 | - if (isset($placeholder)) |
|
25 | - $field->setPlaceholder($placeholder); |
|
26 | - if (isset($icon)) |
|
27 | - $field->addIcon($icon, Direction::RIGHT); |
|
24 | + if (isset($placeholder)) { |
|
25 | + $field->setPlaceholder($placeholder); |
|
26 | + } |
|
27 | + if (isset($icon)) { |
|
28 | + $field->addIcon($icon, Direction::RIGHT); |
|
29 | + } |
|
28 | 30 | //TODO check getField |
29 | 31 | $field->getDataField()->setClass("prompt"); |
30 | 32 | $this->content["field"]=$field; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | trait JqueryEventsTrait { |
13 | - abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true); |
|
13 | + abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true); |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Blur |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function _click($element='this', $js=array(), $ret_false=TRUE) { |
54 | 54 | if (!is_array($js)) { |
55 | - $js=array ( |
|
55 | + $js=array( |
|
56 | 56 | $js |
57 | 57 | ); |
58 | 58 | } |
@@ -16,18 +16,39 @@ discard block |
||
16 | 16 | protected $_states=[ ]; |
17 | 17 | protected $_baseClass; |
18 | 18 | |
19 | + /** |
|
20 | + * @param string $name |
|
21 | + */ |
|
19 | 22 | abstract protected function setPropertyCtrl($name, $value, $typeCtrl); |
20 | 23 | |
24 | + /** |
|
25 | + * @param string $name |
|
26 | + */ |
|
21 | 27 | abstract protected function addToPropertyCtrl($name, $value, $typeCtrl); |
22 | 28 | |
29 | + /** |
|
30 | + * @param string $name |
|
31 | + */ |
|
23 | 32 | abstract protected function addToPropertyCtrlCheck($name, $value, $typeCtrl); |
24 | 33 | |
34 | + /** |
|
35 | + * @param string $name |
|
36 | + */ |
|
25 | 37 | abstract public function addToProperty($name, $value, $separator=" "); |
26 | 38 | |
39 | + /** |
|
40 | + * @param string $name |
|
41 | + */ |
|
27 | 42 | abstract public function setProperty($name, $value); |
28 | 43 | |
44 | + /** |
|
45 | + * @param HtmlIcon $content |
|
46 | + */ |
|
29 | 47 | abstract public function addContent($content,$before=false); |
30 | 48 | |
49 | + /** |
|
50 | + * @param string $jsCode |
|
51 | + */ |
|
31 | 52 | abstract public function onCreate($jsCode); |
32 | 53 | |
33 | 54 | public function addVariation($variation) { |
@@ -108,7 +129,7 @@ discard block |
||
108 | 129 | /** |
109 | 130 | * show it is currently unable to be interacted with |
110 | 131 | * @param boolean $disable |
111 | - * @return \Ajax\semantic\html\elements\HtmlSemDoubleElement |
|
132 | + * @return BaseTrait |
|
112 | 133 | */ |
113 | 134 | public function setDisabled($disable=true) { |
114 | 135 | if($disable) |
@@ -12,8 +12,8 @@ discard block |
||
12 | 12 | * @property string $identifier |
13 | 13 | */ |
14 | 14 | trait BaseTrait { |
15 | - protected $_variations=[ ]; |
|
16 | - protected $_states=[ ]; |
|
15 | + protected $_variations=[]; |
|
16 | + protected $_states=[]; |
|
17 | 17 | protected $_baseClass; |
18 | 18 | |
19 | 19 | abstract protected function setPropertyCtrl($name, $value, $typeCtrl); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | abstract public function setProperty($name, $value); |
28 | 28 | |
29 | - abstract public function addContent($content,$before=false); |
|
29 | + abstract public function addContent($content, $before=false); |
|
30 | 30 | |
31 | 31 | abstract public function onCreate($jsCode); |
32 | 32 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $this->setProperty("class", $this->_baseClass); |
48 | 48 | if (\is_string($variations)) |
49 | 49 | $variations=\explode(" ", $variations); |
50 | - foreach ( $variations as $variation ) { |
|
50 | + foreach ($variations as $variation) { |
|
51 | 51 | $this->addVariation($variation); |
52 | 52 | } |
53 | 53 | return $this; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | public function addVariations($variations=array()) { |
62 | 62 | if (\is_string($variations)) |
63 | 63 | $variations=\explode(" ", $variations); |
64 | - foreach ( $variations as $variation ) { |
|
64 | + foreach ($variations as $variation) { |
|
65 | 65 | $this->addVariation($variation); |
66 | 66 | } |
67 | 67 | return $this; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | public function addStates($states=array()) { |
71 | 71 | if (\is_string($states)) |
72 | 72 | $states=\explode(" ", $states); |
73 | - foreach ( $states as $state ) { |
|
73 | + foreach ($states as $state) { |
|
74 | 74 | $this->addState($state); |
75 | 75 | } |
76 | 76 | return $this; |
@@ -80,17 +80,17 @@ discard block |
||
80 | 80 | $this->setProperty("class", $this->_baseClass); |
81 | 81 | if (\is_string($states)) |
82 | 82 | $states=\explode(" ", $states); |
83 | - foreach ( $states as $state ) { |
|
83 | + foreach ($states as $state) { |
|
84 | 84 | $this->addState($state); |
85 | 85 | } |
86 | 86 | return $this; |
87 | 87 | } |
88 | 88 | |
89 | 89 | public function addIcon($icon, $before=true) { |
90 | - return $this->addContent(new HtmlIcon("icon-" . $this->identifier, $icon), $before); |
|
90 | + return $this->addContent(new HtmlIcon("icon-".$this->identifier, $icon), $before); |
|
91 | 91 | } |
92 | 92 | |
93 | - public function addSticky($context="body"){ |
|
93 | + public function addSticky($context="body") { |
|
94 | 94 | $this->onCreate("$('#".$this->identifier."').sticky({ context: '".$context."'});"); |
95 | 95 | return $this; |
96 | 96 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @return \Ajax\semantic\html\elements\HtmlSemDoubleElement |
112 | 112 | */ |
113 | 113 | public function setDisabled($disable=true) { |
114 | - if($disable) |
|
114 | + if ($disable) |
|
115 | 115 | $this->addToProperty("class", "disabled"); |
116 | 116 | return $this; |
117 | 117 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * |
138 | 138 | * @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
139 | 139 | */ |
140 | - public function asHeader(){ |
|
140 | + public function asHeader() { |
|
141 | 141 | return $this->addToProperty("class", "header"); |
142 | 142 | } |
143 | 143 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | * show it is currently the active user selection |
146 | 146 | * @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
147 | 147 | */ |
148 | - public function setActive($value=true){ |
|
148 | + public function setActive($value=true) { |
|
149 | 149 | return $this->addToProperty("class", "active"); |
150 | 150 | } |
151 | 151 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | } |
162 | 162 | |
163 | 163 | public function setFloated($direction="right") { |
164 | - return $this->addToPropertyCtrl("class", $direction . " floated", Direction::getConstantValues("floated")); |
|
164 | + return $this->addToPropertyCtrl("class", $direction." floated", Direction::getConstantValues("floated")); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | public function floatRight() { |
@@ -45,8 +45,9 @@ discard block |
||
45 | 45 | |
46 | 46 | public function setVariations($variations) { |
47 | 47 | $this->setProperty("class", $this->_baseClass); |
48 | - if (\is_string($variations)) |
|
49 | - $variations=\explode(" ", $variations); |
|
48 | + if (\is_string($variations)) { |
|
49 | + $variations=\explode(" ", $variations); |
|
50 | + } |
|
50 | 51 | foreach ( $variations as $variation ) { |
51 | 52 | $this->addVariation($variation); |
52 | 53 | } |
@@ -59,8 +60,9 @@ discard block |
||
59 | 60 | } |
60 | 61 | |
61 | 62 | public function addVariations($variations=array()) { |
62 | - if (\is_string($variations)) |
|
63 | - $variations=\explode(" ", $variations); |
|
63 | + if (\is_string($variations)) { |
|
64 | + $variations=\explode(" ", $variations); |
|
65 | + } |
|
64 | 66 | foreach ( $variations as $variation ) { |
65 | 67 | $this->addVariation($variation); |
66 | 68 | } |
@@ -68,8 +70,9 @@ discard block |
||
68 | 70 | } |
69 | 71 | |
70 | 72 | public function addStates($states=array()) { |
71 | - if (\is_string($states)) |
|
72 | - $states=\explode(" ", $states); |
|
73 | + if (\is_string($states)) { |
|
74 | + $states=\explode(" ", $states); |
|
75 | + } |
|
73 | 76 | foreach ( $states as $state ) { |
74 | 77 | $this->addState($state); |
75 | 78 | } |
@@ -78,8 +81,9 @@ discard block |
||
78 | 81 | |
79 | 82 | public function setStates($states) { |
80 | 83 | $this->setProperty("class", $this->_baseClass); |
81 | - if (\is_string($states)) |
|
82 | - $states=\explode(" ", $states); |
|
84 | + if (\is_string($states)) { |
|
85 | + $states=\explode(" ", $states); |
|
86 | + } |
|
83 | 87 | foreach ( $states as $state ) { |
84 | 88 | $this->addState($state); |
85 | 89 | } |
@@ -111,8 +115,9 @@ discard block |
||
111 | 115 | * @return \Ajax\semantic\html\elements\HtmlSemDoubleElement |
112 | 116 | */ |
113 | 117 | public function setDisabled($disable=true) { |
114 | - if($disable) |
|
115 | - $this->addToProperty("class", "disabled"); |
|
118 | + if($disable) { |
|
119 | + $this->addToProperty("class", "disabled"); |
|
120 | + } |
|
116 | 121 | return $this; |
117 | 122 | } |
118 | 123 |