@@ -30,10 +30,10 @@ |
||
30 | 30 | */ |
31 | 31 | public function setWidth($width) { |
32 | 32 | if (\is_int($width)) { |
33 | - $width=Wide::getConstants()["W" . $width]; |
|
33 | + $width=Wide::getConstants()["W".$width]; |
|
34 | 34 | } |
35 | 35 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
36 | - return $this->addToPropertyCtrl("class", "wide", array ("wide" )); |
|
36 | + return $this->addToPropertyCtrl("class", "wide", array("wide")); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | public function setValue($value) { |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | abstract class BaseHtml extends BaseWidget { |
18 | 18 | protected $_template; |
19 | 19 | protected $tagName; |
20 | - protected $properties=array (); |
|
21 | - protected $_events=array (); |
|
22 | - protected $_wrapBefore=array (); |
|
23 | - protected $_wrapAfter=array (); |
|
20 | + protected $properties=array(); |
|
21 | + protected $_events=array(); |
|
22 | + protected $_wrapBefore=array(); |
|
23 | + protected $_wrapAfter=array(); |
|
24 | 24 | protected $_bsComponent; |
25 | 25 | |
26 | 26 | public function getBsComponent() { |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | protected function getTemplate(JsUtils $js=NULL) { |
36 | - return PropertyWrapper::wrap($this->_wrapBefore, $js) . $this->_template . PropertyWrapper::wrap($this->_wrapAfter, $js); |
|
36 | + return PropertyWrapper::wrap($this->_wrapBefore, $js).$this->_template.PropertyWrapper::wrap($this->_wrapAfter, $js); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | public function getProperties() { |
@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | public function addToProperty($name, $value, $separator=" ") { |
59 | - if ($value !== "" && $this->propertyContains($name, $value) === false) { |
|
59 | + if ($value!=="" && $this->propertyContains($name, $value)===false) { |
|
60 | 60 | $v=@$this->properties[$name]; |
61 | - if (isset($v) && $v !== "") |
|
62 | - $v=$v . $separator . $value; |
|
61 | + if (isset($v) && $v!=="") |
|
62 | + $v=$v.$separator.$value; |
|
63 | 63 | else |
64 | 64 | $v=$value; |
65 | 65 | |
@@ -75,23 +75,23 @@ discard block |
||
75 | 75 | |
76 | 76 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
77 | 77 | $result=$this->getTemplate($js); |
78 | - foreach ( $this as $key => $value ) { |
|
79 | - if (PhalconUtils::startsWith($key, "_") === false && $key !== "events") { |
|
78 | + foreach ($this as $key => $value) { |
|
79 | + if (PhalconUtils::startsWith($key, "_")===false && $key!=="events") { |
|
80 | 80 | if (is_array($value)) { |
81 | 81 | $v=PropertyWrapper::wrap($value, $js); |
82 | - } else { |
|
82 | + }else { |
|
83 | 83 | $v=$value; |
84 | 84 | } |
85 | - $result=str_ireplace("%" . $key . "%", $v, $result); |
|
85 | + $result=str_ireplace("%".$key."%", $v, $result); |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | if (isset($js)) { |
89 | 89 | $this->run($js); |
90 | 90 | } |
91 | - if (isset($view) === true) { |
|
91 | + if (isset($view)===true) { |
|
92 | 92 | $controls=$view->getVar("q"); |
93 | - if (isset($controls) === false) { |
|
94 | - $controls=array (); |
|
93 | + if (isset($controls)===false) { |
|
94 | + $controls=array(); |
|
95 | 95 | } |
96 | 96 | $controls[$this->identifier]=$result; |
97 | 97 | $view->setVar("q", $controls); |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | |
102 | 102 | protected function ctrl($name, $value, $typeCtrl) { |
103 | 103 | if (is_array($typeCtrl)) { |
104 | - if (array_search($value, $typeCtrl) === false) { |
|
105 | - throw new \Exception("La valeur passée a propriété `" . $name . "` ne fait pas partie des valeurs possibles : {" . implode(",", $typeCtrl) . "}"); |
|
104 | + if (array_search($value, $typeCtrl)===false) { |
|
105 | + throw new \Exception("La valeur passée a propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
106 | 106 | } |
107 | - } else { |
|
107 | + }else { |
|
108 | 108 | if (!$typeCtrl($value)) { |
109 | - throw new \Exception("La fonction " . $typeCtrl . " a retourné faux pour l'affectation de la propriété " . $name); |
|
109 | + throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | return true; |
@@ -121,13 +121,13 @@ discard block |
||
121 | 121 | } |
122 | 122 | |
123 | 123 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
124 | - if ($this->ctrl($name, $value, $typeCtrl) === true) |
|
124 | + if ($this->ctrl($name, $value, $typeCtrl)===true) |
|
125 | 125 | return $this->setProperty($name, $value); |
126 | 126 | return $this; |
127 | 127 | } |
128 | 128 | |
129 | 129 | protected function setMemberCtrl(&$name, $value, $typeCtrl) { |
130 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
130 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
131 | 131 | return $name=$value; |
132 | 132 | } |
133 | 133 | return $this; |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | protected function addToMemberUnique(&$name, $value, $typeCtrl, $separator=" ") { |
137 | 137 | if (is_array($typeCtrl)) { |
138 | 138 | $this->removeOldValues($name, $typeCtrl); |
139 | - $name.=$separator . $value; |
|
139 | + $name.=$separator.$value; |
|
140 | 140 | } |
141 | 141 | return $this; |
142 | 142 | } |
@@ -158,17 +158,17 @@ discard block |
||
158 | 158 | } |
159 | 159 | |
160 | 160 | protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") { |
161 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
161 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
162 | 162 | if (is_array($typeCtrl)) { |
163 | 163 | $this->removeOldValues($name, $typeCtrl); |
164 | 164 | } |
165 | - $name.=$separator . $value; |
|
165 | + $name.=$separator.$value; |
|
166 | 166 | } |
167 | 167 | return $this; |
168 | 168 | } |
169 | 169 | |
170 | 170 | protected function addToMember(&$name, $value, $separator=" ") { |
171 | - $name=str_ireplace($value, "", $name) . $separator . $value; |
|
171 | + $name=str_ireplace($value, "", $name).$separator.$value; |
|
172 | 172 | return $this; |
173 | 173 | } |
174 | 174 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | } |
187 | 187 | |
188 | 188 | public function addToPropertyCtrlCheck($name, $value, $typeCtrl) { |
189 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
189 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
190 | 190 | return $this->addToProperty($name, $value); |
191 | 191 | } |
192 | 192 | return $this; |
@@ -214,28 +214,28 @@ discard block |
||
214 | 214 | } |
215 | 215 | |
216 | 216 | public function fromArray($array) { |
217 | - foreach ( $this as $key => $value ) { |
|
217 | + foreach ($this as $key => $value) { |
|
218 | 218 | if (array_key_exists($key, $array) && !PhalconUtils::startsWith($key, "_")) { |
219 | - $setter="set" . ucfirst($key); |
|
219 | + $setter="set".ucfirst($key); |
|
220 | 220 | $this->$setter($array[$key]); |
221 | 221 | unset($array[$key]); |
222 | 222 | } |
223 | 223 | } |
224 | - foreach ( $array as $key => $value ) { |
|
224 | + foreach ($array as $key => $value) { |
|
225 | 225 | if (method_exists($this, $key)) { |
226 | 226 | try { |
227 | 227 | $this->$key($value); |
228 | 228 | unset($array[$key]); |
229 | - } catch ( \Exception $e ) { |
|
229 | + } catch (\Exception $e) { |
|
230 | 230 | // Nothing to do |
231 | 231 | } |
232 | - } else { |
|
233 | - $setter="set" . ucfirst($key); |
|
232 | + }else { |
|
233 | + $setter="set".ucfirst($key); |
|
234 | 234 | if (method_exists($this, $setter)) { |
235 | 235 | try { |
236 | 236 | $this->$setter($value); |
237 | 237 | unset($array[$key]); |
238 | - } catch ( \Exception $e ) { |
|
238 | + } catch (\Exception $e) { |
|
239 | 239 | // Nothing to do |
240 | 240 | } |
241 | 241 | } |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | |
247 | 247 | public function fromDatabaseObjects($objects, $function) { |
248 | 248 | if (isset($objects)) { |
249 | - foreach ( $objects as $object ) { |
|
249 | + foreach ($objects as $object) { |
|
250 | 250 | $this->fromDatabaseObject($object, $function); |
251 | 251 | } |
252 | 252 | } |
@@ -265,11 +265,11 @@ discard block |
||
265 | 265 | } |
266 | 266 | |
267 | 267 | public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
268 | - if ($stopPropagation === true) { |
|
269 | - $jsCode="event.stopPropagation();" . $jsCode; |
|
268 | + if ($stopPropagation===true) { |
|
269 | + $jsCode="event.stopPropagation();".$jsCode; |
|
270 | 270 | } |
271 | - if ($preventDefault === true) { |
|
272 | - $jsCode="event.preventDefault();" . $jsCode; |
|
271 | + if ($preventDefault===true) { |
|
272 | + $jsCode="event.preventDefault();".$jsCode; |
|
273 | 273 | } |
274 | 274 | return $this->_addEvent($event, $jsCode); |
275 | 275 | } |
@@ -278,10 +278,10 @@ discard block |
||
278 | 278 | if (array_key_exists($event, $this->_events)) { |
279 | 279 | if (is_array($this->_events[$event])) { |
280 | 280 | $this->_events[$event][]=$jsCode; |
281 | - } else { |
|
282 | - $this->_events[$event]=array ($this->_events[$event],$jsCode ); |
|
281 | + }else { |
|
282 | + $this->_events[$event]=array($this->_events[$event], $jsCode); |
|
283 | 283 | } |
284 | - } else { |
|
284 | + }else { |
|
285 | 285 | $this->_events[$event]=$jsCode; |
286 | 286 | } |
287 | 287 | return $this; |
@@ -301,15 +301,15 @@ discard block |
||
301 | 301 | |
302 | 302 | public function addEventsOnRun(JsUtils $js) { |
303 | 303 | if (isset($this->_bsComponent)) { |
304 | - foreach ( $this->_events as $event => $jsCode ) { |
|
304 | + foreach ($this->_events as $event => $jsCode) { |
|
305 | 305 | $code=$jsCode; |
306 | 306 | if (is_array($jsCode)) { |
307 | 307 | $code=""; |
308 | - foreach ( $jsCode as $jsC ) { |
|
308 | + foreach ($jsCode as $jsC) { |
|
309 | 309 | if ($jsC instanceof AjaxCall) { |
310 | - $code.="\n" . $jsC->compile($js); |
|
311 | - } else { |
|
312 | - $code.="\n" . $jsC; |
|
310 | + $code.="\n".$jsC->compile($js); |
|
311 | + }else { |
|
312 | + $code.="\n".$jsC; |
|
313 | 313 | } |
314 | 314 | } |
315 | 315 | } elseif ($jsCode instanceof AjaxCall) { |
@@ -317,12 +317,12 @@ discard block |
||
317 | 317 | } |
318 | 318 | $this->_bsComponent->addEvent($event, $code); |
319 | 319 | } |
320 | - $this->_events=array (); |
|
320 | + $this->_events=array(); |
|
321 | 321 | } |
322 | 322 | } |
323 | 323 | |
324 | 324 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
325 | - $params=array ("url" => $url,"responseElement" => $responseElement ); |
|
325 | + $params=array("url" => $url, "responseElement" => $responseElement); |
|
326 | 326 | $params=array_merge($params, $parameters); |
327 | 327 | $this->_addEvent($event, new AjaxCall($operation, $params)); |
328 | 328 | return $this; |
@@ -358,15 +358,15 @@ discard block |
||
358 | 358 | if (is_array($elements)) { |
359 | 359 | $flag=false; |
360 | 360 | $index=0; |
361 | - while ( !$flag && $index < sizeof($elements) ) { |
|
361 | + while (!$flag && $index<sizeof($elements)) { |
|
362 | 362 | if ($elements[$index] instanceof BaseHtml) |
363 | - $flag=($elements[$index]->getIdentifier() === $identifier); |
|
363 | + $flag=($elements[$index]->getIdentifier()===$identifier); |
|
364 | 364 | $index++; |
365 | 365 | } |
366 | - if ($flag === true) |
|
367 | - return $elements[$index - 1]; |
|
366 | + if ($flag===true) |
|
367 | + return $elements[$index-1]; |
|
368 | 368 | } elseif ($elements instanceof BaseHtml) { |
369 | - if ($elements->getIdentifier() === $identifier) |
|
369 | + if ($elements->getIdentifier()===$identifier) |
|
370 | 370 | return $elements; |
371 | 371 | } |
372 | 372 | return null; |
@@ -388,14 +388,14 @@ discard block |
||
388 | 388 | if (is_array($value)) { |
389 | 389 | $value=implode(",", $value); |
390 | 390 | } |
391 | - if (strrpos($value, 'this') === false && strrpos($value, 'event') === false) { |
|
392 | - $value='"' . $value . '"'; |
|
391 | + if (strrpos($value, 'this')===false && strrpos($value, 'event')===false) { |
|
392 | + $value='"'.$value.'"'; |
|
393 | 393 | } |
394 | 394 | return $value; |
395 | 395 | } |
396 | 396 | |
397 | 397 | public function jsDoJquery($jqueryCall, $param="") { |
398 | - return "$('#" . $this->identifier . "')." . $jqueryCall . "(" . $this->_prep_value($param) . ");"; |
|
398 | + return "$('#".$this->identifier."').".$jqueryCall."(".$this->_prep_value($param).");"; |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | public function executeOnRun($jsCode) { |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | class JArray { |
6 | 6 | |
7 | 7 | public static function isAssociative($array) { |
8 | - return (array_values($array) !== $array); |
|
8 | + return (array_values($array)!==$array); |
|
9 | 9 | // return (array_keys($array)!==range(0, count($array)-1)); |
10 | 10 | } |
11 | 11 | |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | return $array[$key]; |
15 | 15 | } |
16 | 16 | $values=array_values($array); |
17 | - if ($pos < sizeof($values)) |
|
17 | + if ($pos<sizeof($values)) |
|
18 | 18 | return $values[$pos]; |
19 | 19 | } |
20 | 20 | |
@@ -22,12 +22,12 @@ discard block |
||
22 | 22 | $result=NULL; |
23 | 23 | if (array_key_exists($key, $array)) { |
24 | 24 | $result=$array[$key]; |
25 | - if ($condition($result) === true) |
|
25 | + if ($condition($result)===true) |
|
26 | 26 | return $result; |
27 | 27 | } |
28 | 28 | $values=array_values($array); |
29 | - foreach ( $values as $val ) { |
|
30 | - if ($condition($val) === true) |
|
29 | + foreach ($values as $val) { |
|
30 | + if ($condition($val)===true) |
|
31 | 31 | return $val; |
32 | 32 | } |
33 | 33 | return $result; |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | public static function getDefaultValue($array, $key, $default=NULL) { |
37 | 37 | if (array_key_exists($key, $array)) { |
38 | 38 | return $array[$key]; |
39 | - } else |
|
39 | + }else |
|
40 | 40 | return $default; |
41 | 41 | } |
42 | 42 | |
@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | $result=""; |
45 | 45 | if (\is_array($glue)) { |
46 | 46 | $size=\sizeof($pieces); |
47 | - if ($size > 0) { |
|
48 | - for($i=0; $i < $size - 1; $i++) { |
|
49 | - $result.=$pieces[$i] . @$glue[$i]; |
|
47 | + if ($size>0) { |
|
48 | + for ($i=0; $i<$size-1; $i++) { |
|
49 | + $result.=$pieces[$i].@$glue[$i]; |
|
50 | 50 | } |
51 | - $result.=$pieces[$size - 1]; |
|
51 | + $result.=$pieces[$size-1]; |
|
52 | 52 | } |
53 | - } else { |
|
53 | + }else { |
|
54 | 54 | $result=\implode($glue, $pieces); |
55 | 55 | } |
56 | 56 | return $result; |
@@ -58,16 +58,16 @@ discard block |
||
58 | 58 | |
59 | 59 | public static function dimension($array) { |
60 | 60 | if (is_array(reset($array))) { |
61 | - $return=self::dimension(reset($array)) + 1; |
|
62 | - } else { |
|
61 | + $return=self::dimension(reset($array))+1; |
|
62 | + }else { |
|
63 | 63 | $return=1; |
64 | 64 | } |
65 | 65 | return $return; |
66 | 66 | } |
67 | 67 | |
68 | 68 | public static function sortAssociative($array, $sortedKeys=array()) { |
69 | - $newArray=array (); |
|
70 | - foreach ( $sortedKeys as $key ) { |
|
69 | + $newArray=array(); |
|
70 | + foreach ($sortedKeys as $key) { |
|
71 | 71 | if (\array_key_exists($key, $array)) { |
72 | 72 | $newArray[$key]=$array[$key]; |
73 | 73 | } |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | |
20 | 20 | public function __construct($identifier, $rowCount, $colCount) { |
21 | 21 | parent::__construct($identifier, "table", "ui table"); |
22 | - $this->content=array (); |
|
22 | + $this->content=array(); |
|
23 | 23 | $this->setRowCount($rowCount, $colCount); |
24 | - $this->_variations=[ Variation::CELLED,Variation::PADDED,Variation::COMPACT ]; |
|
24 | + $this->_variations=[Variation::CELLED, Variation::PADDED, Variation::COMPACT]; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | * @return HtmlTableContent |
31 | 31 | */ |
32 | 32 | private function getPart($key) { |
33 | - if (\array_key_exists($key, $this->content) === false) { |
|
33 | + if (\array_key_exists($key, $this->content)===false) { |
|
34 | 34 | $this->content[$key]=new HtmlTableContent("", $key); |
35 | - if ($key !== "tbody") { |
|
35 | + if ($key!=="tbody") { |
|
36 | 36 | $this->content[$key]->setRowCount(1, $this->_colCount); |
37 | 37 | } |
38 | 38 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @return boolean |
70 | 70 | */ |
71 | 71 | public function hasPart($key) { |
72 | - return \array_key_exists($key, $this->content) === true; |
|
72 | + return \array_key_exists($key, $this->content)===true; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -148,10 +148,10 @@ discard block |
||
148 | 148 | |
149 | 149 | private function colAlign($colIndex, $function) { |
150 | 150 | if (\is_array($colIndex)) { |
151 | - foreach ( $colIndex as $cIndex ) { |
|
151 | + foreach ($colIndex as $cIndex) { |
|
152 | 152 | $this->colAlign($cIndex, $function); |
153 | 153 | } |
154 | - } else { |
|
154 | + }else { |
|
155 | 155 | if ($this->hasPart("thead")) { |
156 | 156 | $this->getHeader()->$function($colIndex); |
157 | 157 | } |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | |
167 | 167 | public function setBasic($very=false) { |
168 | 168 | if ($very) |
169 | - $this->addToPropertyCtrl("class", "very", array ("very" )); |
|
170 | - return $this->addToPropertyCtrl("class", "basic", array ("basic" )); |
|
169 | + $this->addToPropertyCtrl("class", "very", array("very")); |
|
170 | + return $this->addToPropertyCtrl("class", "basic", array("basic")); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | public function setCollapsing() { |
@@ -228,9 +228,9 @@ discard block |
||
228 | 228 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
229 | 229 | */ |
230 | 230 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
231 | - $this->content=JArray::sortAssociative($this->content, [ "thead","tbody","tfoot" ]); |
|
231 | + $this->content=JArray::sortAssociative($this->content, ["thead", "tbody", "tfoot"]); |
|
232 | 232 | if ($this->propertyContains("class", "sortable")) { |
233 | - $this->addEvent("execute", "$('#" . $this->identifier . "').tablesort();"); |
|
233 | + $this->addEvent("execute", "$('#".$this->identifier."').tablesort();"); |
|
234 | 234 | } |
235 | 235 | return parent::compile($js, $view); |
236 | 236 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | $result=$function($object); |
246 | 246 | if (\is_array($result)) { |
247 | 247 | return $this->addRow($function($object)); |
248 | - } else { |
|
248 | + }else { |
|
249 | 249 | return $this->getBody()->_addRow($result); |
250 | 250 | } |
251 | 251 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * |
12 | 12 | */ |
13 | 13 | class HtmlTableContent extends HtmlSemCollection { |
14 | - protected $_tdTagNames=[ "thead" => "th","tbody" => "td","tfoot" => "th" ]; |
|
14 | + protected $_tdTagNames=["thead" => "th", "tbody" => "td", "tfoot" => "th"]; |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function setRowCount($rowCount, $colCount) { |
36 | 36 | $count=$this->count(); |
37 | - for($i=$count; $i < $rowCount; $i++) { |
|
37 | + for ($i=$count; $i<$rowCount; $i++) { |
|
38 | 38 | $this->addItem($colCount); |
39 | 39 | } |
40 | 40 | /* |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $tr=new HtmlTR("", $value); |
63 | 63 | $tr->setContainer($this, $count); |
64 | 64 | $tr->setTdTagName($this->_tdTagNames[$this->tagName]); |
65 | - if (isset($value) === true) { |
|
65 | + if (isset($value)===true) { |
|
66 | 66 | $tr->setColCount($value); |
67 | 67 | } |
68 | 68 | return $tr; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function setCellValue($row, $col, $value="") { |
114 | 114 | $cell=$this->getCell($row, $col); |
115 | - if (isset($cell) === true) { |
|
115 | + if (isset($cell)===true) { |
|
116 | 116 | $cell->setValue($value); |
117 | 117 | } |
118 | 118 | return $this; |
@@ -125,16 +125,16 @@ discard block |
||
125 | 125 | public function setValues($values=array()) { |
126 | 126 | $count=$this->count(); |
127 | 127 | $isArray=true; |
128 | - if (\is_array($values) === false) { |
|
128 | + if (\is_array($values)===false) { |
|
129 | 129 | $values=\array_fill(0, $count, $values); |
130 | 130 | $isArray=false; |
131 | 131 | } |
132 | - if (JArray::dimension($values) == 1 && $isArray) |
|
133 | - $values=[ $values ]; |
|
132 | + if (JArray::dimension($values)==1 && $isArray) |
|
133 | + $values=[$values]; |
|
134 | 134 | |
135 | 135 | $count=\min(\sizeof($values), $count); |
136 | 136 | |
137 | - for($i=0; $i < $count; $i++) { |
|
137 | + for ($i=0; $i<$count; $i++) { |
|
138 | 138 | $row=$this->content[$i]; |
139 | 139 | $row->setValues($values[$i]); |
140 | 140 | } |
@@ -143,11 +143,11 @@ discard block |
||
143 | 143 | |
144 | 144 | public function setColValues($colIndex, $values=array()) { |
145 | 145 | $count=$this->count(); |
146 | - if (\is_array($values) === false) { |
|
146 | + if (\is_array($values)===false) { |
|
147 | 147 | $values=\array_fill(0, $count, $values); |
148 | 148 | } |
149 | 149 | $count=\min(\sizeof($values), $count); |
150 | - for($i=0; $i < $count; $i++) { |
|
150 | + for ($i=0; $i<$count; $i++) { |
|
151 | 151 | $this->getCell($i, $colIndex)->setValue($values[$i]); |
152 | 152 | } |
153 | 153 | return $this; |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | public function addColVariations($colIndex, $variations=array()) { |
157 | 157 | $count=$this->count(); |
158 | - for($i=0; $i < $count; $i++) { |
|
158 | + for ($i=0; $i<$count; $i++) { |
|
159 | 159 | $this->getCell($i, $colIndex)->addVariations($variations); |
160 | 160 | } |
161 | 161 | return $this; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | |
164 | 164 | public function setRowValues($rowIndex, $values=array()) { |
165 | 165 | $count=$this->count(); |
166 | - if (\is_array($values) === false) { |
|
166 | + if (\is_array($values)===false) { |
|
167 | 167 | $values=\array_fill(0, $count, $values); |
168 | 168 | } |
169 | 169 | $this->getItem($rowIndex)->setValues($values); |
@@ -172,9 +172,9 @@ discard block |
||
172 | 172 | |
173 | 173 | private function colAlign($colIndex, $function) { |
174 | 174 | $count=$this->count(); |
175 | - for($i=0; $i < $count; $i++) { |
|
175 | + for ($i=0; $i<$count; $i++) { |
|
176 | 176 | $index=$this->content[$i]->getColPosition($colIndex); |
177 | - if ($index !== NULL) |
|
177 | + if ($index!==NULL) |
|
178 | 178 | $this->getCell($i, $index)->$function(); |
179 | 179 | } |
180 | 180 | return $this; |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | */ |
207 | 207 | public function getColCount() { |
208 | 208 | $result=0; |
209 | - if ($this->count() > 0) |
|
209 | + if ($this->count()>0) |
|
210 | 210 | $result=$this->getItem(0)->getColCount(); |
211 | 211 | return $result; |
212 | 212 | } |
@@ -220,10 +220,10 @@ discard block |
||
220 | 220 | public function delete($rowIndex, $colIndex=NULL) { |
221 | 221 | if (isset($colIndex)) { |
222 | 222 | $row=$this->getItem($rowIndex); |
223 | - if (isset($row) === true) { |
|
223 | + if (isset($row)===true) { |
|
224 | 224 | $row->delete($colIndex); |
225 | 225 | } |
226 | - } else { |
|
226 | + }else { |
|
227 | 227 | $this->removeItem($rowIndex); |
228 | 228 | } |
229 | 229 | return $this; |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | */ |
253 | 253 | public function conditionalCellFormat($callback, $format) { |
254 | 254 | $rows=$this->content; |
255 | - foreach ( $rows as $row ) { |
|
255 | + foreach ($rows as $row) { |
|
256 | 256 | $row->conditionalCellFormat($callback, $format); |
257 | 257 | } |
258 | 258 | return $this; |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | */ |
266 | 266 | public function conditionalRowFormat($callback, $format) { |
267 | 267 | $rows=$this->content; |
268 | - foreach ( $rows as $row ) { |
|
268 | + foreach ($rows as $row) { |
|
269 | 269 | $row->conditionalRowFormat($callback, $format); |
270 | 270 | } |
271 | 271 | return $this; |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | */ |
278 | 278 | public function applyCells($callback) { |
279 | 279 | $rows=$this->content; |
280 | - foreach ( $rows as $row ) { |
|
280 | + foreach ($rows as $row) { |
|
281 | 281 | $row->applyCells($callback); |
282 | 282 | } |
283 | 283 | return $this; |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | */ |
290 | 290 | public function applyRows($callback) { |
291 | 291 | $rows=$this->content; |
292 | - foreach ( $rows as $row ) { |
|
292 | + foreach ($rows as $row) { |
|
293 | 293 | $row->apply($callback); |
294 | 294 | } |
295 | 295 | return $this; |
@@ -20,12 +20,12 @@ discard block |
||
20 | 20 | |
21 | 21 | public function __construct($identifier) { |
22 | 22 | parent::__construct($identifier, "tr", ""); |
23 | - $this->_states=[ State::ACTIVE,State::POSITIVE,State::NEGATIVE,State::WARNING,State::ERROR,State::DISABLED ]; |
|
23 | + $this->_states=[State::ACTIVE, State::POSITIVE, State::NEGATIVE, State::WARNING, State::ERROR, State::DISABLED]; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | public function setColCount($colCount) { |
27 | 27 | $count=$this->count(); |
28 | - for($i=$count; $i < $colCount; $i++) { |
|
28 | + for ($i=$count; $i<$colCount; $i++) { |
|
29 | 29 | $item=$this->addItem(NULL); |
30 | 30 | $item->setTagName($this->_tdTagName); |
31 | 31 | } |
@@ -65,16 +65,16 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function setValues($values=array()) { |
67 | 67 | $count=$this->count(); |
68 | - if (\is_array($values) === false) { |
|
68 | + if (\is_array($values)===false) { |
|
69 | 69 | $values=\array_fill(0, $count, $values); |
70 | - } else { |
|
71 | - if (JArray::isAssociative($values) === true) { |
|
70 | + }else { |
|
71 | + if (JArray::isAssociative($values)===true) { |
|
72 | 72 | $values=\array_values($values); |
73 | 73 | } |
74 | 74 | } |
75 | 75 | $count=\min(\sizeof($values), $count); |
76 | 76 | |
77 | - for($i=0; $i < $count; $i++) { |
|
77 | + for ($i=0; $i<$count; $i++) { |
|
78 | 78 | $cell=$this->content[$i]; |
79 | 79 | $cell->setValue($values[$i]); |
80 | 80 | } |
@@ -101,20 +101,20 @@ discard block |
||
101 | 101 | public function getColPosition($colIndex) { |
102 | 102 | $pos=0; |
103 | 103 | $rows=$this->_container->getContent(); |
104 | - for($i=0; $i < $this->_row; $i++) { |
|
104 | + for ($i=0; $i<$this->_row; $i++) { |
|
105 | 105 | $max=\min($colIndex, $rows[$i]->count()); |
106 | - for($j=0; $j < $max; $j++) { |
|
106 | + for ($j=0; $j<$max; $j++) { |
|
107 | 107 | $rowspan=$rows[$i]->getItem($j)->getRowspan(); |
108 | - if ($rowspan + $i > $this->_row) |
|
108 | + if ($rowspan+$i>$this->_row) |
|
109 | 109 | $pos++; |
110 | 110 | } |
111 | 111 | } |
112 | - if ($pos > $colIndex) |
|
112 | + if ($pos>$colIndex) |
|
113 | 113 | return NULL; |
114 | 114 | $count=$this->count(); |
115 | - for($i=0; $i < $count; $i++) { |
|
115 | + for ($i=0; $i<$count; $i++) { |
|
116 | 116 | $pos+=$this->content[$i]->getColspan(); |
117 | - if ($pos >= $colIndex + 1) |
|
117 | + if ($pos>=$colIndex+1) |
|
118 | 118 | return $i; |
119 | 119 | } |
120 | 120 | return null; |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | |
123 | 123 | public function conditionalCellFormat($callback, $format) { |
124 | 124 | $cells=$this->content; |
125 | - foreach ( $cells as $cell ) { |
|
125 | + foreach ($cells as $cell) { |
|
126 | 126 | $cell->conditionalCellFormat($callback, $format); |
127 | 127 | } |
128 | 128 | return $this; |
@@ -137,8 +137,8 @@ discard block |
||
137 | 137 | |
138 | 138 | public function containsStr($needle) { |
139 | 139 | $cells=$this->content; |
140 | - foreach ( $cells as $cell ) { |
|
141 | - if (\strpos($cell->getContent(), $needle) !== false) |
|
140 | + foreach ($cells as $cell) { |
|
141 | + if (\strpos($cell->getContent(), $needle)!==false) |
|
142 | 142 | return true; |
143 | 143 | } |
144 | 144 | return false; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | |
152 | 152 | public function applyCells($callback) { |
153 | 153 | $cells=$this->content; |
154 | - foreach ( $cells as $cell ) { |
|
154 | + foreach ($cells as $cell) { |
|
155 | 155 | $cell->apply($callback); |
156 | 156 | } |
157 | 157 | return $this; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | use Ajax\semantic\html\elements\html5\HtmlLink; |
11 | 11 | |
12 | 12 | class HtmlTD extends HtmlSemDoubleElement { |
13 | - use TextAlignmentTrait,TableElementTrait; |
|
13 | + use TextAlignmentTrait, TableElementTrait; |
|
14 | 14 | private $_container; |
15 | 15 | private $_row; |
16 | 16 | private $_col; |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function __construct($identifier, $content=NULL, $tagName="td") { |
25 | 25 | parent::__construct($identifier, $tagName, "", $content); |
26 | - $this->_variations=[ Variation::COLLAPSING ]; |
|
27 | - $this->_states=[ State::ACTIVE,State::POSITIVE,State::NEGATIVE,State::WARNING,State::ERROR,State::DISABLED ]; |
|
26 | + $this->_variations=[Variation::COLLAPSING]; |
|
27 | + $this->_states=[State::ACTIVE, State::POSITIVE, State::NEGATIVE, State::WARNING, State::ERROR, State::DISABLED]; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | public function setContainer($container, $row, $col) { |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | } |
40 | 40 | |
41 | 41 | public function setRowspan($rowspan) { |
42 | - $to=min($this->_container->count(), $this->_row + $rowspan - 1); |
|
43 | - for($i=$to; $i > $this->_row; $i--) { |
|
42 | + $to=min($this->_container->count(), $this->_row+$rowspan-1); |
|
43 | + for ($i=$to; $i>$this->_row; $i--) { |
|
44 | 44 | $this->_container->delete($i, $this->_col); |
45 | 45 | } |
46 | 46 | $this->setProperty("rowspan", $rowspan); |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | public function setColspan($colspan) { |
59 | - $to=min($this->_container->getRow($this->_row)->count(), $this->_col + $colspan - 1); |
|
60 | - for($i=$to; $i > $this->_col; $i--) { |
|
61 | - $this->_container->delete($this->_row, $this->_col + 1); |
|
59 | + $to=min($this->_container->getRow($this->_row)->count(), $this->_col+$colspan-1); |
|
60 | + for ($i=$to; $i>$this->_col; $i--) { |
|
61 | + $this->_container->delete($this->_row, $this->_col+1); |
|
62 | 62 | } |
63 | 63 | $this->setProperty("colspan", $colspan); |
64 | 64 | return $this->_container; |
@@ -8,24 +8,24 @@ discard block |
||
8 | 8 | use Phalcon\Mvc\View; |
9 | 9 | |
10 | 10 | class HtmlProgress extends HtmlSemDoubleElement { |
11 | - private $_params=array (); |
|
11 | + private $_params=array(); |
|
12 | 12 | |
13 | 13 | public function __construct($identifier, $value=NULL, $label=NULL) { |
14 | 14 | parent::__construct($identifier, "div", "ui progress"); |
15 | - if (isset($value) === true) |
|
15 | + if (isset($value)===true) |
|
16 | 16 | $this->setProperty("data-percent", $value); |
17 | 17 | $this->createBar(); |
18 | - if (isset($label) === true) |
|
18 | + if (isset($label)===true) |
|
19 | 19 | $this->setLabel($label); |
20 | 20 | } |
21 | 21 | |
22 | 22 | public function setLabel($label) { |
23 | - $this->content["label"]=new HtmlSemDoubleElement("lbl-" . $this->identifier, "div", "label", $label); |
|
23 | + $this->content["label"]=new HtmlSemDoubleElement("lbl-".$this->identifier, "div", "label", $label); |
|
24 | 24 | return $this; |
25 | 25 | } |
26 | 26 | |
27 | 27 | private function createBar() { |
28 | - $bar=new HtmlSemDoubleElement("bar-" . $this->identifier, "div", "bar", new HtmlSemDoubleElement("progress-" . $this->identifier, "div", "progress")); |
|
28 | + $bar=new HtmlSemDoubleElement("bar-".$this->identifier, "div", "bar", new HtmlSemDoubleElement("progress-".$this->identifier, "div", "progress")); |
|
29 | 29 | $this->content["bar"]=$bar; |
30 | 30 | return $this; |
31 | 31 | } |
@@ -45,20 +45,20 @@ discard block |
||
45 | 45 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
46 | 46 | */ |
47 | 47 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
48 | - $this->content=JArray::sortAssociative($this->content, [ "bar","label" ]); |
|
48 | + $this->content=JArray::sortAssociative($this->content, ["bar", "label"]); |
|
49 | 49 | return parent::compile($js, $view); |
50 | 50 | } |
51 | 51 | |
52 | 52 | public function jsSetValue($value) { |
53 | - return '$("#' . $this->identifier . '").progress({value:' . $value . '});'; |
|
53 | + return '$("#'.$this->identifier.'").progress({value:'.$value.'});'; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | public function jsIncValue() { |
57 | - return '$("#' . $this->identifier . '").progress("increment");'; |
|
57 | + return '$("#'.$this->identifier.'").progress("increment");'; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | public function jsDecValue() { |
61 | - return '$("#' . $this->identifier . '").progress("decrement");'; |
|
61 | + return '$("#'.$this->identifier.'").progress("decrement");'; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @return HtmlProgress |
73 | 73 | */ |
74 | 74 | public function setTextValues($active=false, $error=false, $success=false, $warning=false, $percent="{percent}%", $ratio="{value} of {total}") { |
75 | - if (\is_array($active) == true) { |
|
75 | + if (\is_array($active)==true) { |
|
76 | 76 | $array=$active; |
77 | 77 | $active=JArray::getDefaultValue($array, "active", false); |
78 | 78 | $success=JArray::getDefaultValue($array, "success", $success); |
@@ -80,12 +80,12 @@ discard block |
||
80 | 80 | $percent=JArray::getDefaultValue($array, "percent", $percent); |
81 | 81 | $ratio=JArray::getDefaultValue($array, "ratio", $ratio); |
82 | 82 | } |
83 | - $this->_params["text"]="%{active : " . \var_export($active, true) . ",error: " . \var_export($error, true) . ",success : " . \var_export($success, true) . ",warning : " . \var_export($warning, true) . ",percent : " . \var_export($percent, true) . ",ratio : " . \var_export($ratio, true) . "}%"; |
|
83 | + $this->_params["text"]="%{active : ".\var_export($active, true).",error: ".\var_export($error, true).",success : ".\var_export($success, true).",warning : ".\var_export($warning, true).",percent : ".\var_export($percent, true).",ratio : ".\var_export($ratio, true)."}%"; |
|
84 | 84 | return $this; |
85 | 85 | } |
86 | 86 | |
87 | 87 | public function onChange($jsCode) { |
88 | - return $this->_params["onChange"]="%function(percent, value, total){" . $jsCode . "}%"; |
|
88 | + return $this->_params["onChange"]="%function(percent, value, total){".$jsCode."}%"; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /* |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | * @see BaseHtml::run() |
94 | 94 | */ |
95 | 95 | public function run(JsUtils $js) { |
96 | - if (isset($this->_bsComponent) === false) |
|
97 | - $this->_bsComponent=$js->semantic()->progress("#" . $this->identifier, $this->_params); |
|
96 | + if (isset($this->_bsComponent)===false) |
|
97 | + $this->_bsComponent=$js->semantic()->progress("#".$this->identifier, $this->_params); |
|
98 | 98 | $this->addEventsOnRun($js); |
99 | 99 | return $this->_bsComponent; |
100 | 100 | } |
@@ -7,8 +7,8 @@ discard block |
||
7 | 7 | use Ajax\semantic\html\base\constants\Direction; |
8 | 8 | |
9 | 9 | trait BaseTrait { |
10 | - protected $_variations=[ ]; |
|
11 | - protected $_states=[ ]; |
|
10 | + protected $_variations=[]; |
|
11 | + protected $_states=[]; |
|
12 | 12 | protected $_baseClass; |
13 | 13 | |
14 | 14 | protected abstract function setPropertyCtrl($name, $value, $typeCtrl); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $this->setProperty("class", $this->_baseClass); |
37 | 37 | if (\is_string($variations)) |
38 | 38 | $variations=\explode(" ", $variations); |
39 | - foreach ( $variations as $variation ) { |
|
39 | + foreach ($variations as $variation) { |
|
40 | 40 | $this->addVariation($variation); |
41 | 41 | } |
42 | 42 | return $this; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | public function addVariations($variations=array()) { |
51 | 51 | if (\is_string($variations)) |
52 | 52 | $variations=\explode(" ", $variations); |
53 | - foreach ( $variations as $variation ) { |
|
53 | + foreach ($variations as $variation) { |
|
54 | 54 | $this->addVariation($variation); |
55 | 55 | } |
56 | 56 | return $this; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | public function addStates($states=array()) { |
60 | 60 | if (\is_string($states)) |
61 | 61 | $states=\explode(" ", $states); |
62 | - foreach ( $states as $state ) { |
|
62 | + foreach ($states as $state) { |
|
63 | 63 | $this->addState($state); |
64 | 64 | } |
65 | 65 | return $this; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $this->setProperty("class", $this->_baseClass); |
70 | 70 | if (\is_string($states)) |
71 | 71 | $states=\explode(" ", $states); |
72 | - foreach ( $states as $state ) { |
|
72 | + foreach ($states as $state) { |
|
73 | 73 | $this->addState($state); |
74 | 74 | } |
75 | 75 | return $this; |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | } |
123 | 123 | |
124 | 124 | public function setFloated($direction="right") { |
125 | - return $this->addToPropertyCtrl("class", $direction . " floated", Direction::getConstantValues("floated")); |
|
125 | + return $this->addToPropertyCtrl("class", $direction." floated", Direction::getConstantValues("floated")); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | public function floatRight() { |