@@ -32,16 +32,16 @@ discard block |
||
32 | 32 | // } |
33 | 33 | $this->setWide($numCols); |
34 | 34 | } |
35 | - if($createCols) |
|
35 | + if ($createCols) |
|
36 | 36 | $this->setRowsCount($numRows, $numCols); |
37 | 37 | } |
38 | 38 | |
39 | 39 | public function asSegment() { |
40 | - return $this->addToPropertyCtrl("class", "segment", array ("segment" )); |
|
40 | + return $this->addToPropertyCtrl("class", "segment", array("segment")); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | public function asContainer() { |
44 | - return $this->addToPropertyCtrl("class", "container", array ("container" )); |
|
44 | + return $this->addToPropertyCtrl("class", "container", array("container")); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -49,10 +49,10 @@ discard block |
||
49 | 49 | * @param int $wide |
50 | 50 | */ |
51 | 51 | public function setWide($wide) { |
52 | - if(isset(Wide::getConstants()["W" . $wide])){ |
|
53 | - $wide=Wide::getConstants()["W" . $wide]; |
|
52 | + if (isset(Wide::getConstants()["W".$wide])) { |
|
53 | + $wide=Wide::getConstants()["W".$wide]; |
|
54 | 54 | $this->addToPropertyCtrl("class", $wide, Wide::getConstants()); |
55 | - return $this->addToPropertyCtrl("class", "column", array ("column" )); |
|
55 | + return $this->addToPropertyCtrl("class", "column", array("column")); |
|
56 | 56 | } |
57 | 57 | return $this; |
58 | 58 | } |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | * @return mixed |
73 | 73 | */ |
74 | 74 | public function addRow($colsCount=NULL) { |
75 | - $rowCount=$this->rowCount() + 1; |
|
75 | + $rowCount=$this->rowCount()+1; |
|
76 | 76 | $this->setRowsCount($rowCount, $colsCount, true); |
77 | - return $this->content[$rowCount - 1]; |
|
77 | + return $this->content[$rowCount-1]; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -83,10 +83,10 @@ discard block |
||
83 | 83 | * @return mixed|\Ajax\semantic\html\collections\HtmlGrid |
84 | 84 | */ |
85 | 85 | public function addCol($width=NULL) { |
86 | - $colCount=$this->colCount() + 1; |
|
86 | + $colCount=$this->colCount()+1; |
|
87 | 87 | $this->setColsCount($colCount, true, $width); |
88 | 88 | if ($this->hasOnlyCols($this->count())) |
89 | - return $this->content[$colCount - 1]; |
|
89 | + return $this->content[$colCount-1]; |
|
90 | 90 | return $this; |
91 | 91 | } |
92 | 92 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @return \Ajax\semantic\html\collections\HtmlGrid |
97 | 97 | */ |
98 | 98 | public function addCols($sizes=array()) { |
99 | - foreach ( $sizes as $size ) { |
|
99 | + foreach ($sizes as $size) { |
|
100 | 100 | $this->addCol($size); |
101 | 101 | } |
102 | 102 | return $this; |
@@ -110,19 +110,19 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public function setRowsCount($rowsCount, $colsCount=NULL, $force=false) { |
112 | 112 | $count=$this->count(); |
113 | - if ($rowsCount < 2 && $force === false) { |
|
114 | - for($i=$count; $i < $colsCount; $i++) { |
|
115 | - $this->addItem(new HtmlGridCol("col-" . $this->identifier . "-" . $i)); |
|
113 | + if ($rowsCount<2 && $force===false) { |
|
114 | + for ($i=$count; $i<$colsCount; $i++) { |
|
115 | + $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i)); |
|
116 | 116 | } |
117 | 117 | } else { |
118 | 118 | if ($this->hasOnlyCols($count)) { |
119 | 119 | $tmpContent=$this->content; |
120 | 120 | $item=$this->addItem($colsCount); |
121 | 121 | $item->setContent($tmpContent); |
122 | - $this->content=array (); |
|
122 | + $this->content=array(); |
|
123 | 123 | $count=1; |
124 | 124 | } |
125 | - for($i=$count; $i < $rowsCount; $i++) { |
|
125 | + for ($i=$count; $i<$rowsCount; $i++) { |
|
126 | 126 | $this->addItem($colsCount); |
127 | 127 | } |
128 | 128 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | } |
131 | 131 | |
132 | 132 | protected function hasOnlyCols($count) { |
133 | - return $count > 0 && $this->content[0] instanceof HtmlGridCol; |
|
133 | + return $count>0 && $this->content[0] instanceof HtmlGridCol; |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -144,14 +144,14 @@ discard block |
||
144 | 144 | if (isset($width)===false) { |
145 | 145 | $this->setWide($numCols); |
146 | 146 | } |
147 | - if ($toCreate === true) { |
|
147 | + if ($toCreate===true) { |
|
148 | 148 | $count=$this->count(); |
149 | - if ($count == 0 || $this->hasOnlyCols($count)) { |
|
150 | - for($i=$count; $i < $numCols; $i++) { |
|
151 | - $this->addItem(new HtmlGridCol("col-" . $this->identifier . "-" . $i, $width)); |
|
149 | + if ($count==0 || $this->hasOnlyCols($count)) { |
|
150 | + for ($i=$count; $i<$numCols; $i++) { |
|
151 | + $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i, $width)); |
|
152 | 152 | } |
153 | 153 | } else { |
154 | - for($i=0; $i < $count; $i++) { |
|
154 | + for ($i=0; $i<$count; $i++) { |
|
155 | 155 | $this->getItem($i)->setColsCount($numCols); |
156 | 156 | } |
157 | 157 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $count=$this->count(); |
188 | 188 | if ($this->hasOnlyCols($count)) |
189 | 189 | return $count; |
190 | - if ($count > 0) |
|
190 | + if ($count>0) |
|
191 | 191 | return $this->getItem(0)->count(); |
192 | 192 | return 0; |
193 | 193 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
200 | 200 | */ |
201 | 201 | public function getCell($row, $col) { |
202 | - if ($row < 2 && $this->hasOnlyCols($this->count())) |
|
202 | + if ($row<2 && $this->hasOnlyCols($this->count())) |
|
203 | 203 | return $this->getItem($col); |
204 | 204 | $row=$this->getItem($row); |
205 | 205 | if (isset($row)) { |
@@ -214,8 +214,8 @@ discard block |
||
214 | 214 | * @return \Ajax\semantic\html\collections\HtmlGrid |
215 | 215 | */ |
216 | 216 | public function setDivided($vertically=false) { |
217 | - $value=($vertically === true) ? "vertically divided" : "divided"; |
|
218 | - return $this->addToPropertyCtrl("class", $value, array ("divided" )); |
|
217 | + $value=($vertically===true) ? "vertically divided" : "divided"; |
|
218 | + return $this->addToPropertyCtrl("class", $value, array("divided")); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | /** |
@@ -224,15 +224,15 @@ discard block |
||
224 | 224 | * @return \Ajax\semantic\html\collections\HtmlGrid |
225 | 225 | */ |
226 | 226 | public function setCelled($internally=false) { |
227 | - $value=($internally === true) ? "internally celled" : "celled"; |
|
228 | - return $this->addToPropertyCtrl("class", $value, array ("celled","internally celled" )); |
|
227 | + $value=($internally===true) ? "internally celled" : "celled"; |
|
228 | + return $this->addToPropertyCtrl("class", $value, array("celled", "internally celled")); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | /** |
232 | 232 | * A grid can have its columns centered |
233 | 233 | */ |
234 | 234 | public function setCentered() { |
235 | - return $this->addToPropertyCtrl("class", "centered", array ("centered" )); |
|
235 | + return $this->addToPropertyCtrl("class", "centered", array("centered")); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | /** |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | */ |
251 | 251 | public function setPadded($value=NULL) { |
252 | 252 | if (isset($value)) |
253 | - $this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" )); |
|
253 | + $this->addToPropertyCtrl("class", $value, array("vertically", "horizontally")); |
|
254 | 254 | return $this->addToProperty("class", "padded"); |
255 | 255 | } |
256 | 256 | |
@@ -260,12 +260,12 @@ discard block |
||
260 | 260 | * @return \Ajax\semantic\html\collections\HtmlGrid |
261 | 261 | */ |
262 | 262 | public function setRelaxed($very=false) { |
263 | - $value=($very === true) ? "very relaxed" : "relaxed"; |
|
264 | - return $this->addToPropertyCtrl("class", $value, array ("relaxed","very relaxed" )); |
|
263 | + $value=($very===true) ? "very relaxed" : "relaxed"; |
|
264 | + return $this->addToPropertyCtrl("class", $value, array("relaxed", "very relaxed")); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | public function setVerticalAlignment($value=VerticalAlignment::MIDDLE) { |
268 | - return $this->addToPropertyCtrl("class", $value . " aligned", VerticalAlignment::getConstantValues("aligned")); |
|
268 | + return $this->addToPropertyCtrl("class", $value." aligned", VerticalAlignment::getConstantValues("aligned")); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | /** |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | * @see \Ajax\common\html\HtmlCollection::createItem() |
276 | 276 | */ |
277 | 277 | protected function createItem($value) { |
278 | - if ($this->_createCols === false) |
|
278 | + if ($this->_createCols===false) |
|
279 | 279 | $value=null; |
280 | - $item=new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $value, $this->_colSizing, $this->_implicitRows); |
|
280 | + $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1), $value, $this->_colSizing, $this->_implicitRows); |
|
281 | 281 | return $item; |
282 | 282 | } |
283 | 283 | |
@@ -288,15 +288,15 @@ discard block |
||
288 | 288 | public function setValues($values, $force=true) { |
289 | 289 | $count=$this->count(); |
290 | 290 | $valuesSize=\sizeof($values); |
291 | - if ($this->_createCols === false || $force === true) { |
|
292 | - for($i=$count; $i < $valuesSize; $i++) { |
|
291 | + if ($this->_createCols===false || $force===true) { |
|
292 | + for ($i=$count; $i<$valuesSize; $i++) { |
|
293 | 293 | $colSize=\sizeof($values[$i]); |
294 | - $this->addItem(new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $colSize, $this->_colSizing, $this->_implicitRows)); |
|
294 | + $this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1), $colSize, $this->_colSizing, $this->_implicitRows)); |
|
295 | 295 | } |
296 | 296 | } |
297 | - $count=\min(array ($this->count(),$valuesSize )); |
|
298 | - for($i=0; $i < $count; $i++) { |
|
299 | - $this->content[$i]->setValues($values[$i], $this->_createCols === false); |
|
297 | + $count=\min(array($this->count(), $valuesSize)); |
|
298 | + for ($i=0; $i<$count; $i++) { |
|
299 | + $this->content[$i]->setValues($values[$i], $this->_createCols===false); |
|
300 | 300 | } |
301 | 301 | } |
302 | 302 |
@@ -15,11 +15,11 @@ discard block |
||
15 | 15 | * @version 1.3 |
16 | 16 | */ |
17 | 17 | abstract class BaseHtml extends BaseWidget { |
18 | - use BaseHtmlEventsTrait,BaseHtmlPropertiesTrait; |
|
18 | + use BaseHtmlEventsTrait, BaseHtmlPropertiesTrait; |
|
19 | 19 | protected $_template; |
20 | 20 | protected $tagName; |
21 | - protected $_wrapBefore=array (); |
|
22 | - protected $_wrapAfter=array (); |
|
21 | + protected $_wrapBefore=array(); |
|
22 | + protected $_wrapAfter=array(); |
|
23 | 23 | protected $_bsComponent; |
24 | 24 | |
25 | 25 | /** |
@@ -29,14 +29,14 @@ discard block |
||
29 | 29 | */ |
30 | 30 | abstract public function run(JsUtils $js); |
31 | 31 | |
32 | - private function _callSetter($setter,$key,$value,&$array){ |
|
32 | + private function _callSetter($setter, $key, $value, &$array) { |
|
33 | 33 | $result=false; |
34 | 34 | if (method_exists($this, $setter) && !JString::startswith($key, "_")) { |
35 | 35 | try { |
36 | 36 | $this->$setter($value); |
37 | 37 | unset($array[$key]); |
38 | 38 | $result=true; |
39 | - } catch ( \Exception $e ) { |
|
39 | + }catch (\Exception $e) { |
|
40 | 40 | $result=false; |
41 | 41 | } |
42 | 42 | } |
@@ -44,17 +44,17 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | protected function getTemplate(JsUtils $js=NULL) { |
47 | - return PropertyWrapper::wrap($this->_wrapBefore, $js) . $this->_template . PropertyWrapper::wrap($this->_wrapAfter, $js); |
|
47 | + return PropertyWrapper::wrap($this->_wrapBefore, $js).$this->_template.PropertyWrapper::wrap($this->_wrapAfter, $js); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | protected function ctrl($name, $value, $typeCtrl) { |
51 | 51 | if (\is_array($typeCtrl)) { |
52 | - if (array_search($value, $typeCtrl) === false) { |
|
53 | - throw new \Exception("La valeur passée `" . $value . "` à la propriété `" . $name . "` ne fait pas partie des valeurs possibles : {" . implode(",", $typeCtrl) . "}"); |
|
52 | + if (array_search($value, $typeCtrl)===false) { |
|
53 | + throw new \Exception("La valeur passée `".$value."` à la propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
54 | 54 | } |
55 | 55 | } else { |
56 | 56 | if (!$typeCtrl($value)) { |
57 | - throw new \Exception("La fonction " . $typeCtrl . " a retourné faux pour l'affectation de la propriété " . $name); |
|
57 | + throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name); |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | return true; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | |
65 | 65 | protected function setMemberCtrl(&$name, $value, $typeCtrl) { |
66 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
66 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
67 | 67 | return $name=$value; |
68 | 68 | } |
69 | 69 | return $this; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | protected function addToMemberUnique(&$name, $value, $typeCtrl, $separator=" ") { |
73 | 73 | if (\is_array($typeCtrl)) { |
74 | 74 | $this->removeOldValues($name, $typeCtrl); |
75 | - $name.=$separator . $value; |
|
75 | + $name.=$separator.$value; |
|
76 | 76 | } |
77 | 77 | return $this; |
78 | 78 | } |
@@ -80,17 +80,17 @@ discard block |
||
80 | 80 | |
81 | 81 | |
82 | 82 | protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") { |
83 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
83 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
84 | 84 | if (\is_array($typeCtrl)) { |
85 | 85 | $this->removeOldValues($name, $typeCtrl); |
86 | 86 | } |
87 | - $name.=$separator . $value; |
|
87 | + $name.=$separator.$value; |
|
88 | 88 | } |
89 | 89 | return $this; |
90 | 90 | } |
91 | 91 | |
92 | 92 | protected function addToMember(&$name, $value, $separator=" ") { |
93 | - $name=str_ireplace($value, "", $name) . $separator . $value; |
|
93 | + $name=str_ireplace($value, "", $name).$separator.$value; |
|
94 | 94 | return $this; |
95 | 95 | } |
96 | 96 | |
@@ -101,17 +101,17 @@ discard block |
||
101 | 101 | $oldValue=trim($oldValue); |
102 | 102 | } |
103 | 103 | |
104 | - protected function _getElementBy($callback,$elements){ |
|
104 | + protected function _getElementBy($callback, $elements) { |
|
105 | 105 | if (\is_array($elements)) { |
106 | 106 | $flag=false; |
107 | 107 | $index=0; |
108 | - while ( !$flag && $index < sizeof($elements) ) { |
|
108 | + while (!$flag && $index<sizeof($elements)) { |
|
109 | 109 | if ($elements[$index] instanceof BaseHtml) |
110 | 110 | $flag=($callback($elements[$index])); |
111 | 111 | $index++; |
112 | 112 | } |
113 | - if ($flag === true) |
|
114 | - return $elements[$index - 1]; |
|
113 | + if ($flag===true) |
|
114 | + return $elements[$index-1]; |
|
115 | 115 | } elseif ($elements instanceof BaseHtml) { |
116 | 116 | if ($callback($elements)) |
117 | 117 | return $elements; |
@@ -139,13 +139,13 @@ discard block |
||
139 | 139 | } |
140 | 140 | |
141 | 141 | public function fromArray($array) { |
142 | - foreach ( $this as $key => $value ) { |
|
143 | - if(array_key_exists($key, $array)===true) |
|
144 | - $this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array); |
|
142 | + foreach ($this as $key => $value) { |
|
143 | + if (array_key_exists($key, $array)===true) |
|
144 | + $this->_callSetter("set".ucfirst($key), $key, $array[$key], $array); |
|
145 | 145 | } |
146 | - foreach ( $array as $key => $value ) { |
|
147 | - if($this->_callSetter($key, $key, $value, $array)===false){ |
|
148 | - $this->_callSetter("set" . ucfirst($key), $key, $value, $array); |
|
146 | + foreach ($array as $key => $value) { |
|
147 | + if ($this->_callSetter($key, $key, $value, $array)===false) { |
|
148 | + $this->_callSetter("set".ucfirst($key), $key, $value, $array); |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | return $array; |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | public function fromDatabaseObjects($objects, $function) { |
155 | 155 | if (isset($objects)) { |
156 | - foreach ( $objects as $object ) { |
|
156 | + foreach ($objects as $object) { |
|
157 | 157 | $this->fromDatabaseObject($object, $function); |
158 | 158 | } |
159 | 159 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | |
175 | 175 | |
176 | 176 | public function getElementById($identifier, $elements) { |
177 | - return $this->_getElementBy(function($element) use ($identifier){return $element->getIdentifier()===$identifier;}, $elements); |
|
177 | + return $this->_getElementBy(function($element) use ($identifier){return $element->getIdentifier()===$identifier; }, $elements); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | public function getBsComponent() { |
@@ -188,19 +188,19 @@ discard block |
||
188 | 188 | |
189 | 189 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
190 | 190 | $result=$this->getTemplate($js); |
191 | - foreach ( $this as $key => $value ) { |
|
192 | - if (JString::startswith($key, "_") === false && $key !== "events") { |
|
191 | + foreach ($this as $key => $value) { |
|
192 | + if (JString::startswith($key, "_")===false && $key!=="events") { |
|
193 | 193 | if (\is_array($value)) { |
194 | 194 | $v=PropertyWrapper::wrap($value, $js); |
195 | 195 | } else { |
196 | 196 | $v=$value; |
197 | 197 | } |
198 | - $result=str_ireplace("%" . $key . "%", $v, $result); |
|
198 | + $result=str_ireplace("%".$key."%", $v, $result); |
|
199 | 199 | } |
200 | 200 | } |
201 | 201 | if (isset($js)===true) { |
202 | 202 | $this->run($js); |
203 | - if (isset($view) === true) { |
|
203 | + if (isset($view)===true) { |
|
204 | 204 | $js->addViewElement($this->_identifier, $result, $view); |
205 | 205 | } |
206 | 206 | } |
@@ -11,9 +11,9 @@ discard block |
||
11 | 11 | * @property SimpleExtComponent $_bsComponent |
12 | 12 | * @property string identifier |
13 | 13 | */ |
14 | -trait BaseHtmlEventsTrait{ |
|
14 | +trait BaseHtmlEventsTrait { |
|
15 | 15 | |
16 | - protected $_events=array (); |
|
16 | + protected $_events=array(); |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * @param string $event |
@@ -23,11 +23,11 @@ discard block |
||
23 | 23 | * @return \Ajax\common\html\BaseHtml |
24 | 24 | */ |
25 | 25 | public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
26 | - if ($stopPropagation === true) { |
|
27 | - $jsCode=Javascript::$stopPropagation . $jsCode; |
|
26 | + if ($stopPropagation===true) { |
|
27 | + $jsCode=Javascript::$stopPropagation.$jsCode; |
|
28 | 28 | } |
29 | - if ($preventDefault === true) { |
|
30 | - $jsCode=Javascript::$preventDefault . $jsCode; |
|
29 | + if ($preventDefault===true) { |
|
30 | + $jsCode=Javascript::$preventDefault.$jsCode; |
|
31 | 31 | } |
32 | 32 | return $this->_addEvent($event, $jsCode); |
33 | 33 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | if (\is_array($this->_events[$event])) { |
43 | 43 | $this->_events[$event][]=$jsCode; |
44 | 44 | } else { |
45 | - $this->_events[$event]=array ($this->_events[$event],$jsCode ); |
|
45 | + $this->_events[$event]=array($this->_events[$event], $jsCode); |
|
46 | 46 | } |
47 | 47 | } else { |
48 | 48 | $this->_events[$event]=$jsCode; |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | return $this->onClick($jsCode); |
70 | 70 | } |
71 | 71 | |
72 | - public function onCreate($jsCode){ |
|
73 | - if(isset($this->_events["_create"])){ |
|
72 | + public function onCreate($jsCode) { |
|
73 | + if (isset($this->_events["_create"])) { |
|
74 | 74 | $this->_events["_create"][]=$jsCode; |
75 | - }else{ |
|
75 | + } else { |
|
76 | 76 | $this->_events["_create"]=[$jsCode]; |
77 | 77 | } |
78 | 78 | return $this; |
@@ -81,15 +81,15 @@ discard block |
||
81 | 81 | public function addEventsOnRun(JsUtils $js=NULL) { |
82 | 82 | $this->_eventsOnCreate($js); |
83 | 83 | if (isset($this->_bsComponent)) { |
84 | - foreach ( $this->_events as $event => $jsCode ) { |
|
84 | + foreach ($this->_events as $event => $jsCode) { |
|
85 | 85 | $code=$jsCode; |
86 | 86 | if (\is_array($jsCode)) { |
87 | 87 | $code=""; |
88 | - foreach ( $jsCode as $jsC ) { |
|
88 | + foreach ($jsCode as $jsC) { |
|
89 | 89 | if ($jsC instanceof AjaxCall) { |
90 | - $code.="\n" . $jsC->compile($js); |
|
90 | + $code.="\n".$jsC->compile($js); |
|
91 | 91 | } else { |
92 | - $code.="\n" . $jsC; |
|
92 | + $code.="\n".$jsC; |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | } elseif ($jsCode instanceof AjaxCall) { |
@@ -97,18 +97,18 @@ discard block |
||
97 | 97 | } |
98 | 98 | $this->_bsComponent->addEvent($event, $code); |
99 | 99 | } |
100 | - $this->_events=array (); |
|
100 | + $this->_events=array(); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | - protected function _eventsOnCreate(JsUtils $js=NULL){ |
|
105 | - if(isset($this->_events["_create"])){ |
|
104 | + protected function _eventsOnCreate(JsUtils $js=NULL) { |
|
105 | + if (isset($this->_events["_create"])) { |
|
106 | 106 | $create=$this->_events["_create"]; |
107 | - if(\is_array($create)){ |
|
107 | + if (\is_array($create)) { |
|
108 | 108 | $create=\implode("", $create); |
109 | 109 | } |
110 | - if(isset($js) && $create!=="") |
|
111 | - $js->exec($create,true); |
|
110 | + if (isset($js) && $create!=="") |
|
111 | + $js->exec($create, true); |
|
112 | 112 | unset($this->_events["_create"]); |
113 | 113 | } |
114 | 114 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @return BaseHtml |
123 | 123 | */ |
124 | 124 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
125 | - $params=array ("url" => $url,"responseElement" => $responseElement ); |
|
125 | + $params=array("url" => $url, "responseElement" => $responseElement); |
|
126 | 126 | $params=array_merge($params, $parameters); |
127 | 127 | $this->_addEvent($event, new AjaxCall($operation, $params)); |
128 | 128 | return $this; |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | public function jsDoJquery($jqueryCall, $param="") { |
158 | - return "$('#" . $this->identifier . "')." . $jqueryCall . "(" . Javascript::prep_value($param) . ");"; |
|
158 | + return "$('#".$this->identifier."').".$jqueryCall."(".Javascript::prep_value($param).");"; |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | public function executeOnRun($jsCode) { |
@@ -175,6 +175,6 @@ discard block |
||
175 | 175 | } |
176 | 176 | |
177 | 177 | public function jsToggle($value) { |
178 | - return $this->jsDoJquery("hide",$value); |
|
178 | + return $this->jsDoJquery("hide", $value); |
|
179 | 179 | } |
180 | 180 | } |
@@ -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->_identifier=$identifier; |
18 | 18 | $this->createField($placeholder, $icon); |
19 | 19 | $this->createResult(); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | private function createResult() { |
36 | - $this->content["result"]=new HtmlSemDoubleElement("results-" . $this->identifier, "div", "results"); |
|
36 | + $this->content["result"]=new HtmlSemDoubleElement("results-".$this->identifier, "div", "results"); |
|
37 | 37 | return $this->content["result"]; |
38 | 38 | } |
39 | 39 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | public function setUrl($url) { |
53 | - $this->_params["apiSettings"]="%{url: %quote%" . $url . "%quote%}%"; |
|
53 | + $this->_params["apiSettings"]="%{url: %quote%".$url."%quote%}%"; |
|
54 | 54 | return $this; |
55 | 55 | } |
56 | 56 | |
@@ -73,16 +73,16 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | public function run(JsUtils $js) { |
76 | - $this->_params["onSelect"]='%function(result,response){$(%quote%#' . $this->identifier . '%quote%).trigger(%quote%onSelect%quote%, {%quote%result%quote%: result, %quote%response%quote%:response} );}%'; |
|
76 | + $this->_params["onSelect"]='%function(result,response){$(%quote%#'.$this->identifier.'%quote%).trigger(%quote%onSelect%quote%, {%quote%result%quote%: result, %quote%response%quote%:response} );}%'; |
|
77 | 77 | $searchFields=\json_encode($this->_searchFields); |
78 | 78 | $searchFields=str_ireplace("\"", "%quote%", $searchFields); |
79 | - $this->_params["searchFields"]="%" . $searchFields . "%"; |
|
80 | - if ($this->_local === true) { |
|
79 | + $this->_params["searchFields"]="%".$searchFields."%"; |
|
80 | + if ($this->_local===true) { |
|
81 | 81 | $this->_params["source"]="%content%"; |
82 | - $this->addEvent("beforeExecute", "var content=" . $this->resultsToJson() . ";"); |
|
82 | + $this->addEvent("beforeExecute", "var content=".$this->resultsToJson().";"); |
|
83 | 83 | } |
84 | - if (isset($this->_bsComponent) === false) { |
|
85 | - $this->_bsComponent=$js->semantic()->search("#" . $this->identifier, $this->_params); |
|
84 | + if (isset($this->_bsComponent)===false) { |
|
85 | + $this->_bsComponent=$js->semantic()->search("#".$this->identifier, $this->_params); |
|
86 | 86 | } |
87 | 87 | $this->addEventsOnRun($js); |
88 | 88 | return $this->_bsComponent; |
@@ -15,7 +15,7 @@ |
||
15 | 15 | class HtmlFormCheckbox extends HtmlFormField { |
16 | 16 | use CheckboxTrait; |
17 | 17 | public function __construct($identifier, $label=NULL, $value=NULL, $type=NULL) { |
18 | - parent::__construct("field-".$identifier, new HtmlCheckbox($identifier,$label,$value,$type)); |
|
18 | + parent::__construct("field-".$identifier, new HtmlCheckbox($identifier, $label, $value, $type)); |
|
19 | 19 | $this->_identifier=$identifier; |
20 | 20 | } |
21 | 21 |
@@ -8,17 +8,17 @@ |
||
8 | 8 | class HtmlFormInput extends HtmlFormField { |
9 | 9 | use TextFieldsTrait; |
10 | 10 | |
11 | - public function __construct($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL) { |
|
12 | - if(!isset($placeholder) && $type==="text") |
|
11 | + public function __construct($identifier, $label=NULL, $type="text", $value=NULL, $placeholder=NULL) { |
|
12 | + if (!isset($placeholder) && $type==="text") |
|
13 | 13 | $placeholder=$label; |
14 | - parent::__construct("field-".$identifier, new HtmlInput($identifier,$type,$value,$placeholder), $label); |
|
14 | + parent::__construct("field-".$identifier, new HtmlInput($identifier, $type, $value, $placeholder), $label); |
|
15 | 15 | $this->_identifier=$identifier; |
16 | 16 | } |
17 | 17 | |
18 | - public function getDataField(){ |
|
19 | - $field= $this->getField(); |
|
18 | + public function getDataField() { |
|
19 | + $field=$this->getField(); |
|
20 | 20 | //TODO check getField |
21 | - if($field instanceof HtmlInput) |
|
21 | + if ($field instanceof HtmlInput) |
|
22 | 22 | $field=$field->getDataField(); |
23 | 23 | return $field; |
24 | 24 | } |
@@ -9,8 +9,9 @@ discard block |
||
9 | 9 | use TextFieldsTrait; |
10 | 10 | |
11 | 11 | public function __construct($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL) { |
12 | - if(!isset($placeholder) && $type==="text") |
|
13 | - $placeholder=$label; |
|
12 | + if(!isset($placeholder) && $type==="text") { |
|
13 | + $placeholder=$label; |
|
14 | + } |
|
14 | 15 | parent::__construct("field-".$identifier, new HtmlInput($identifier,$type,$value,$placeholder), $label); |
15 | 16 | $this->_identifier=$identifier; |
16 | 17 | } |
@@ -18,8 +19,9 @@ discard block |
||
18 | 19 | public function getDataField(){ |
19 | 20 | $field= $this->getField(); |
20 | 21 | //TODO check getField |
21 | - if($field instanceof HtmlInput) |
|
22 | - $field=$field->getDataField(); |
|
22 | + if($field instanceof HtmlInput) { |
|
23 | + $field=$field->getDataField(); |
|
24 | + } |
|
23 | 25 | return $field; |
24 | 26 | } |
25 | 27 | } |
26 | 28 | \ No newline at end of file |
@@ -9,10 +9,10 @@ discard block |
||
9 | 9 | class HtmlFormTextarea extends HtmlFormField { |
10 | 10 | use TextFieldsTrait; |
11 | 11 | |
12 | - public function __construct($identifier, $label=NULL,$value=NULL,$placeholder=NULL,$rows=NULL) { |
|
13 | - if(!isset($placeholder)) |
|
12 | + public function __construct($identifier, $label=NULL, $value=NULL, $placeholder=NULL, $rows=NULL) { |
|
13 | + if (!isset($placeholder)) |
|
14 | 14 | $placeholder=$label; |
15 | - parent::__construct("field-".$identifier, new HtmlTextarea($identifier,$value,$placeholder,$rows), $label); |
|
15 | + parent::__construct("field-".$identifier, new HtmlTextarea($identifier, $value, $placeholder, $rows), $label); |
|
16 | 16 | $this->_identifier=$identifier; |
17 | 17 | } |
18 | 18 | |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * Defines the textarea row count |
21 | 21 | * @param int $count |
22 | 22 | */ |
23 | - public function setRows($count){ |
|
23 | + public function setRows($count) { |
|
24 | 24 | $this->getField()->setRows($count); |
25 | 25 | } |
26 | 26 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | return $this->content["field"]; |
29 | 29 | } |
30 | 30 | |
31 | - public function setName($name){ |
|
32 | - $this->getDataField()->setProperty("name",$name); |
|
31 | + public function setName($name) { |
|
32 | + $this->getDataField()->setProperty("name", $name); |
|
33 | 33 | } |
34 | 34 | } |
35 | 35 | \ No newline at end of file |
@@ -10,8 +10,9 @@ |
||
10 | 10 | use TextFieldsTrait; |
11 | 11 | |
12 | 12 | public function __construct($identifier, $label=NULL,$value=NULL,$placeholder=NULL,$rows=NULL) { |
13 | - if(!isset($placeholder)) |
|
14 | - $placeholder=$label; |
|
13 | + if(!isset($placeholder)) { |
|
14 | + $placeholder=$label; |
|
15 | + } |
|
15 | 16 | parent::__construct("field-".$identifier, new HtmlTextarea($identifier,$value,$placeholder,$rows), $label); |
16 | 17 | $this->_identifier=$identifier; |
17 | 18 | } |
@@ -7,26 +7,26 @@ |
||
7 | 7 | |
8 | 8 | class HtmlFormDropdown extends HtmlFormField { |
9 | 9 | |
10 | - public function __construct($identifier,$items=array(), $label=NULL,$value=NULL,$multiple=false,$associative=true) { |
|
11 | - parent::__construct("field-".$identifier, (new HtmlDropdown("dropdown-".$identifier,$value,$items,$associative))->asSelect($identifier,$multiple), $label); |
|
10 | + public function __construct($identifier, $items=array(), $label=NULL, $value=NULL, $multiple=false, $associative=true) { |
|
11 | + parent::__construct("field-".$identifier, (new HtmlDropdown("dropdown-".$identifier, $value, $items, $associative))->asSelect($identifier, $multiple), $label); |
|
12 | 12 | $this->_identifier=$identifier; |
13 | 13 | } |
14 | 14 | |
15 | - public function setItems($items){ |
|
15 | + public function setItems($items) { |
|
16 | 16 | return $this->getField()->setItems($items); |
17 | 17 | } |
18 | - public function addItem($item,$value=NULL,$image=NULL){ |
|
19 | - return $this->getField()->addItem($item,$value,$image); |
|
18 | + public function addItem($item, $value=NULL, $image=NULL) { |
|
19 | + return $this->getField()->addItem($item, $value, $image); |
|
20 | 20 | } |
21 | - public static function multipleDropdown($identifier,$items=array(), $label=NULL,$value=NULL,$associative=true){ |
|
22 | - return new HtmlFormDropdown($identifier,$items,$label,$value,true,$associative); |
|
21 | + public static function multipleDropdown($identifier, $items=array(), $label=NULL, $value=NULL, $associative=true) { |
|
22 | + return new HtmlFormDropdown($identifier, $items, $label, $value, true, $associative); |
|
23 | 23 | } |
24 | 24 | |
25 | - public function getDataField(){ |
|
25 | + public function getDataField() { |
|
26 | 26 | return $this->getField()->getInput(); |
27 | 27 | } |
28 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
29 | - $this->getField()->asSelect($name,$multiple,$selection); |
|
28 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
29 | + $this->getField()->asSelect($name, $multiple, $selection); |
|
30 | 30 | return $this; |
31 | 31 | } |
32 | 32 | } |
33 | 33 | \ No newline at end of file |
@@ -10,14 +10,14 @@ discard block |
||
10 | 10 | use Ajax\JsUtils; |
11 | 11 | |
12 | 12 | class HtmlInput extends HtmlSemDoubleElement { |
13 | - use IconTrait,TextFieldsTrait,FieldTrait; |
|
13 | + use IconTrait, TextFieldsTrait, FieldTrait; |
|
14 | 14 | |
15 | 15 | public function __construct($identifier, $type="text", $value="", $placeholder="") { |
16 | - parent::__construct("div-" . $identifier, "div", "ui input"); |
|
16 | + parent::__construct("div-".$identifier, "div", "ui input"); |
|
17 | 17 | $this->_identifier=$identifier; |
18 | - $this->content=[ "field" => new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder) ]; |
|
19 | - $this->_states=[ State::DISABLED,State::FOCUS,State::ERROR ]; |
|
20 | - $this->_variations=[ Variation::TRANSPARENT ]; |
|
18 | + $this->content=["field" => new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder)]; |
|
19 | + $this->_states=[State::DISABLED, State::FOCUS, State::ERROR]; |
|
20 | + $this->_variations=[Variation::TRANSPARENT]; |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | public function getField() { |
@@ -37,11 +37,11 @@ discard block |
||
37 | 37 | |
38 | 38 | public function run(JsUtils $js) { |
39 | 39 | $result=parent::run($js); |
40 | - $result->attach("#" . $this->getDataField()->getIdentifier()); |
|
40 | + $result->attach("#".$this->getDataField()->getIdentifier()); |
|
41 | 41 | return $result; |
42 | 42 | } |
43 | 43 | |
44 | - public function setTransparent(){ |
|
44 | + public function setTransparent() { |
|
45 | 45 | return $this->addToProperty("class", "transparent"); |
46 | 46 | } |
47 | 47 | } |
48 | 48 | \ No newline at end of file |