@@ -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; |
@@ -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() { |
@@ -20,7 +20,7 @@ |
||
20 | 20 | * @see \Ajax\bootstrap\html\base\HtmlSingleElement::run() |
21 | 21 | */ |
22 | 22 | public function run(JsUtils $js) { |
23 | - $this->_bsComponent=$js->semantic()->generic("#" . $this->identifier); |
|
23 | + $this->_bsComponent=$js->semantic()->generic("#".$this->identifier); |
|
24 | 24 | $this->addEventsOnRun($js); |
25 | 25 | return $this->_bsComponent; |
26 | 26 | } |
@@ -14,8 +14,8 @@ discard block |
||
14 | 14 | |
15 | 15 | public function __construct($identifier, $elements=array(), $asIcons=false) { |
16 | 16 | parent::__construct($identifier, "div", "ui buttons"); |
17 | - $this->content=array (); |
|
18 | - if ($asIcons === true) |
|
17 | + $this->content=array(); |
|
18 | + if ($asIcons===true) |
|
19 | 19 | $this->asIcons(); |
20 | 20 | $this->addElements($elements, $asIcons); |
21 | 21 | } |
@@ -24,25 +24,25 @@ discard block |
||
24 | 24 | $elementO=$element; |
25 | 25 | if (\is_string($element)) { |
26 | 26 | if ($asIcon) { |
27 | - $elementO=new HtmlButton("button-" . $this->identifier . "-" . \sizeof($this->content)); |
|
27 | + $elementO=new HtmlButton("button-".$this->identifier."-".\sizeof($this->content)); |
|
28 | 28 | $elementO->asIcon($element); |
29 | - } else |
|
30 | - $elementO=new HtmlButton("button-" . $this->identifier . "-" . \sizeof($this->content), $element); |
|
29 | + }else |
|
30 | + $elementO=new HtmlButton("button-".$this->identifier."-".\sizeof($this->content), $element); |
|
31 | 31 | } |
32 | 32 | $this->addContent($elementO); |
33 | 33 | } |
34 | 34 | |
35 | 35 | public function addElements($elements, $asIcons=false) { |
36 | - foreach ( $elements as $element ) { |
|
36 | + foreach ($elements as $element) { |
|
37 | 37 | $this->addElement($element, $asIcons); |
38 | 38 | } |
39 | 39 | return $this; |
40 | 40 | } |
41 | 41 | |
42 | 42 | public function insertOr($aferIndex=0, $or="or") { |
43 | - $orElement=new HtmlSemDoubleElement("or-" . $this->identifier, "div", "or"); |
|
43 | + $orElement=new HtmlSemDoubleElement("or-".$this->identifier, "div", "or"); |
|
44 | 44 | $orElement->setProperty("data-text", $or); |
45 | - array_splice($this->content, $aferIndex + 1, 0, array ($orElement )); |
|
45 | + array_splice($this->content, $aferIndex+1, 0, array($orElement)); |
|
46 | 46 | return $this; |
47 | 47 | } |
48 | 48 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | } |
56 | 56 | |
57 | 57 | public function asIcons() { |
58 | - foreach ( $this->content as $item ) { |
|
58 | + foreach ($this->content as $item) { |
|
59 | 59 | $item->asIcon($item->getContent()); |
60 | 60 | } |
61 | 61 | return $this->addToProperty("class", "icons"); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
94 | 94 | */ |
95 | 95 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
96 | - foreach ( $this->content as $element ) { |
|
96 | + foreach ($this->content as $element) { |
|
97 | 97 | $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
98 | 98 | } |
99 | 99 | return $this; |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | |
106 | 106 | public function addClasses($classes=array()) { |
107 | 107 | $i=0; |
108 | - foreach ( $this->content as $button ) { |
|
108 | + foreach ($this->content as $button) { |
|
109 | 109 | $button->addToProperty("class", $classes[$i++]); |
110 | 110 | } |
111 | 111 | return $this; |
@@ -20,7 +20,7 @@ |
||
20 | 20 | * @see \Ajax\bootstrap\html\base\HtmlSingleElement::run() |
21 | 21 | */ |
22 | 22 | public function run(JsUtils $js) { |
23 | - $this->_bsComponent=$js->semantic()->generic("#" . $this->identifier); |
|
23 | + $this->_bsComponent=$js->semantic()->generic("#".$this->identifier); |
|
24 | 24 | $this->addEventsOnRun($js); |
25 | 25 | return $this->_bsComponent; |
26 | 26 | } |
@@ -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() { |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | |
58 | 58 | public function addToProperty($name, $value, $separator=" ") { |
59 | 59 | if (\is_array($value)) { |
60 | - foreach ( $value as $v ) { |
|
60 | + foreach ($value as $v) { |
|
61 | 61 | $this->addToProperty($name, $v, $separator); |
62 | 62 | } |
63 | - } else if ($value !== "" && $this->propertyContains($name, $value) === false) { |
|
63 | + }else if ($value!=="" && $this->propertyContains($name, $value)===false) { |
|
64 | 64 | $v=@$this->properties[$name]; |
65 | - if (isset($v) && $v !== "") |
|
66 | - $v=$v . $separator . $value; |
|
65 | + if (isset($v) && $v!=="") |
|
66 | + $v=$v.$separator.$value; |
|
67 | 67 | else |
68 | 68 | $v=$value; |
69 | 69 | |
@@ -79,23 +79,23 @@ discard block |
||
79 | 79 | |
80 | 80 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
81 | 81 | $result=$this->getTemplate($js); |
82 | - foreach ( $this as $key => $value ) { |
|
83 | - if (PhalconUtils::startsWith($key, "_") === false && $key !== "events") { |
|
82 | + foreach ($this as $key => $value) { |
|
83 | + if (PhalconUtils::startsWith($key, "_")===false && $key!=="events") { |
|
84 | 84 | if (is_array($value)) { |
85 | 85 | $v=PropertyWrapper::wrap($value, $js); |
86 | - } else { |
|
86 | + }else { |
|
87 | 87 | $v=$value; |
88 | 88 | } |
89 | - $result=str_ireplace("%" . $key . "%", $v, $result); |
|
89 | + $result=str_ireplace("%".$key."%", $v, $result); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | if (isset($js)) { |
93 | 93 | $this->run($js); |
94 | 94 | } |
95 | - if (isset($view) === true) { |
|
95 | + if (isset($view)===true) { |
|
96 | 96 | $controls=$view->getVar("q"); |
97 | - if (isset($controls) === false) { |
|
98 | - $controls=array (); |
|
97 | + if (isset($controls)===false) { |
|
98 | + $controls=array(); |
|
99 | 99 | } |
100 | 100 | $controls[$this->identifier]=$result; |
101 | 101 | $view->setVar("q", $controls); |
@@ -105,12 +105,12 @@ discard block |
||
105 | 105 | |
106 | 106 | protected function ctrl($name, $value, $typeCtrl) { |
107 | 107 | if (is_array($typeCtrl)) { |
108 | - if (array_search($value, $typeCtrl) === false) { |
|
109 | - throw new \Exception("La valeur passée a propriété `" . $name . "` ne fait pas partie des valeurs possibles : {" . implode(",", $typeCtrl) . "}"); |
|
108 | + if (array_search($value, $typeCtrl)===false) { |
|
109 | + throw new \Exception("La valeur passée a propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
110 | 110 | } |
111 | - } else { |
|
111 | + }else { |
|
112 | 112 | if (!$typeCtrl($value)) { |
113 | - throw new \Exception("La fonction " . $typeCtrl . " a retourné faux pour l'affectation de la propriété " . $name); |
|
113 | + throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name); |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | return true; |
@@ -125,13 +125,13 @@ discard block |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
128 | - if ($this->ctrl($name, $value, $typeCtrl) === true) |
|
128 | + if ($this->ctrl($name, $value, $typeCtrl)===true) |
|
129 | 129 | return $this->setProperty($name, $value); |
130 | 130 | return $this; |
131 | 131 | } |
132 | 132 | |
133 | 133 | protected function setMemberCtrl(&$name, $value, $typeCtrl) { |
134 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
134 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
135 | 135 | return $name=$value; |
136 | 136 | } |
137 | 137 | return $this; |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | protected function addToMemberUnique(&$name, $value, $typeCtrl, $separator=" ") { |
141 | 141 | if (is_array($typeCtrl)) { |
142 | 142 | $this->removeOldValues($name, $typeCtrl); |
143 | - $name.=$separator . $value; |
|
143 | + $name.=$separator.$value; |
|
144 | 144 | } |
145 | 145 | return $this; |
146 | 146 | } |
@@ -162,17 +162,17 @@ discard block |
||
162 | 162 | } |
163 | 163 | |
164 | 164 | protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") { |
165 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
165 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
166 | 166 | if (is_array($typeCtrl)) { |
167 | 167 | $this->removeOldValues($name, $typeCtrl); |
168 | 168 | } |
169 | - $name.=$separator . $value; |
|
169 | + $name.=$separator.$value; |
|
170 | 170 | } |
171 | 171 | return $this; |
172 | 172 | } |
173 | 173 | |
174 | 174 | protected function addToMember(&$name, $value, $separator=" ") { |
175 | - $name=str_ireplace($value, "", $name) . $separator . $value; |
|
175 | + $name=str_ireplace($value, "", $name).$separator.$value; |
|
176 | 176 | return $this; |
177 | 177 | } |
178 | 178 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | } |
191 | 191 | |
192 | 192 | public function addToPropertyCtrlCheck($name, $value, $typeCtrl) { |
193 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
193 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
194 | 194 | return $this->addToProperty($name, $value); |
195 | 195 | } |
196 | 196 | return $this; |
@@ -218,28 +218,28 @@ discard block |
||
218 | 218 | } |
219 | 219 | |
220 | 220 | public function fromArray($array) { |
221 | - foreach ( $this as $key => $value ) { |
|
221 | + foreach ($this as $key => $value) { |
|
222 | 222 | if (array_key_exists($key, $array) && !PhalconUtils::startsWith($key, "_")) { |
223 | - $setter="set" . ucfirst($key); |
|
223 | + $setter="set".ucfirst($key); |
|
224 | 224 | $this->$setter($array[$key]); |
225 | 225 | unset($array[$key]); |
226 | 226 | } |
227 | 227 | } |
228 | - foreach ( $array as $key => $value ) { |
|
228 | + foreach ($array as $key => $value) { |
|
229 | 229 | if (method_exists($this, $key)) { |
230 | 230 | try { |
231 | 231 | $this->$key($value); |
232 | 232 | unset($array[$key]); |
233 | - } catch ( \Exception $e ) { |
|
233 | + } catch (\Exception $e) { |
|
234 | 234 | // Nothing to do |
235 | 235 | } |
236 | - } else { |
|
237 | - $setter="set" . ucfirst($key); |
|
236 | + }else { |
|
237 | + $setter="set".ucfirst($key); |
|
238 | 238 | if (method_exists($this, $setter)) { |
239 | 239 | try { |
240 | 240 | $this->$setter($value); |
241 | 241 | unset($array[$key]); |
242 | - } catch ( \Exception $e ) { |
|
242 | + } catch (\Exception $e) { |
|
243 | 243 | // Nothing to do |
244 | 244 | } |
245 | 245 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | |
251 | 251 | public function fromDatabaseObjects($objects, $function) { |
252 | 252 | if (isset($objects)) { |
253 | - foreach ( $objects as $object ) { |
|
253 | + foreach ($objects as $object) { |
|
254 | 254 | $this->fromDatabaseObject($object, $function); |
255 | 255 | } |
256 | 256 | } |
@@ -269,11 +269,11 @@ discard block |
||
269 | 269 | } |
270 | 270 | |
271 | 271 | public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
272 | - if ($stopPropagation === true) { |
|
273 | - $jsCode="event.stopPropagation();" . $jsCode; |
|
272 | + if ($stopPropagation===true) { |
|
273 | + $jsCode="event.stopPropagation();".$jsCode; |
|
274 | 274 | } |
275 | - if ($preventDefault === true) { |
|
276 | - $jsCode="event.preventDefault();" . $jsCode; |
|
275 | + if ($preventDefault===true) { |
|
276 | + $jsCode="event.preventDefault();".$jsCode; |
|
277 | 277 | } |
278 | 278 | return $this->_addEvent($event, $jsCode); |
279 | 279 | } |
@@ -282,10 +282,10 @@ discard block |
||
282 | 282 | if (array_key_exists($event, $this->_events)) { |
283 | 283 | if (is_array($this->_events[$event])) { |
284 | 284 | $this->_events[$event][]=$jsCode; |
285 | - } else { |
|
286 | - $this->_events[$event]=array ($this->_events[$event],$jsCode ); |
|
285 | + }else { |
|
286 | + $this->_events[$event]=array($this->_events[$event], $jsCode); |
|
287 | 287 | } |
288 | - } else { |
|
288 | + }else { |
|
289 | 289 | $this->_events[$event]=$jsCode; |
290 | 290 | } |
291 | 291 | return $this; |
@@ -305,15 +305,15 @@ discard block |
||
305 | 305 | |
306 | 306 | public function addEventsOnRun(JsUtils $js) { |
307 | 307 | if (isset($this->_bsComponent)) { |
308 | - foreach ( $this->_events as $event => $jsCode ) { |
|
308 | + foreach ($this->_events as $event => $jsCode) { |
|
309 | 309 | $code=$jsCode; |
310 | 310 | if (is_array($jsCode)) { |
311 | 311 | $code=""; |
312 | - foreach ( $jsCode as $jsC ) { |
|
312 | + foreach ($jsCode as $jsC) { |
|
313 | 313 | if ($jsC instanceof AjaxCall) { |
314 | - $code.="\n" . $jsC->compile($js); |
|
315 | - } else { |
|
316 | - $code.="\n" . $jsC; |
|
314 | + $code.="\n".$jsC->compile($js); |
|
315 | + }else { |
|
316 | + $code.="\n".$jsC; |
|
317 | 317 | } |
318 | 318 | } |
319 | 319 | } elseif ($jsCode instanceof AjaxCall) { |
@@ -321,12 +321,12 @@ discard block |
||
321 | 321 | } |
322 | 322 | $this->_bsComponent->addEvent($event, $code); |
323 | 323 | } |
324 | - $this->_events=array (); |
|
324 | + $this->_events=array(); |
|
325 | 325 | } |
326 | 326 | } |
327 | 327 | |
328 | 328 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
329 | - $params=array ("url" => $url,"responseElement" => $responseElement ); |
|
329 | + $params=array("url" => $url, "responseElement" => $responseElement); |
|
330 | 330 | $params=array_merge($params, $parameters); |
331 | 331 | $this->_addEvent($event, new AjaxCall($operation, $params)); |
332 | 332 | return $this; |
@@ -362,15 +362,15 @@ discard block |
||
362 | 362 | if (is_array($elements)) { |
363 | 363 | $flag=false; |
364 | 364 | $index=0; |
365 | - while ( !$flag && $index < sizeof($elements) ) { |
|
365 | + while (!$flag && $index<sizeof($elements)) { |
|
366 | 366 | if ($elements[$index] instanceof BaseHtml) |
367 | - $flag=($elements[$index]->getIdentifier() === $identifier); |
|
367 | + $flag=($elements[$index]->getIdentifier()===$identifier); |
|
368 | 368 | $index++; |
369 | 369 | } |
370 | - if ($flag === true) |
|
371 | - return $elements[$index - 1]; |
|
370 | + if ($flag===true) |
|
371 | + return $elements[$index-1]; |
|
372 | 372 | } elseif ($elements instanceof BaseHtml) { |
373 | - if ($elements->getIdentifier() === $identifier) |
|
373 | + if ($elements->getIdentifier()===$identifier) |
|
374 | 374 | return $elements; |
375 | 375 | } |
376 | 376 | return null; |
@@ -392,14 +392,14 @@ discard block |
||
392 | 392 | if (is_array($value)) { |
393 | 393 | $value=implode(",", $value); |
394 | 394 | } |
395 | - if (strrpos($value, 'this') === false && strrpos($value, 'event') === false) { |
|
396 | - $value='"' . $value . '"'; |
|
395 | + if (strrpos($value, 'this')===false && strrpos($value, 'event')===false) { |
|
396 | + $value='"'.$value.'"'; |
|
397 | 397 | } |
398 | 398 | return $value; |
399 | 399 | } |
400 | 400 | |
401 | 401 | public function jsDoJquery($jqueryCall, $param="") { |
402 | - return "$('#" . $this->identifier . "')." . $jqueryCall . "(" . $this->_prep_value($param) . ");"; |
|
402 | + return "$('#".$this->identifier."').".$jqueryCall."(".$this->_prep_value($param).");"; |
|
403 | 403 | } |
404 | 404 | |
405 | 405 | public function executeOnRun($jsCode) { |
@@ -9,26 +9,26 @@ discard block |
||
9 | 9 | use Ajax\semantic\html\base\constants\State; |
10 | 10 | |
11 | 11 | class HtmlProgress extends HtmlSemDoubleElement { |
12 | - private $_params=array (); |
|
12 | + private $_params=array(); |
|
13 | 13 | |
14 | 14 | public function __construct($identifier, $value=NULL, $label=NULL, $attributes=array()) { |
15 | 15 | parent::__construct($identifier, "div", "ui progress"); |
16 | - if (isset($value) === true) |
|
16 | + if (isset($value)===true) |
|
17 | 17 | $this->setProperty("data-percent", $value); |
18 | 18 | $this->createBar(); |
19 | - if (isset($label) === true) |
|
19 | + if (isset($label)===true) |
|
20 | 20 | $this->setLabel($label); |
21 | - $this->_states=[ State::SUCCESS,State::WARNING,State::ERROR,State::ACTIVE,State::DISABLED ]; |
|
21 | + $this->_states=[State::SUCCESS, State::WARNING, State::ERROR, State::ACTIVE, State::DISABLED]; |
|
22 | 22 | $this->addToProperty("class", $attributes); |
23 | 23 | } |
24 | 24 | |
25 | 25 | public function setLabel($label) { |
26 | - $this->content["label"]=new HtmlSemDoubleElement("lbl-" . $this->identifier, "div", "label", $label); |
|
26 | + $this->content["label"]=new HtmlSemDoubleElement("lbl-".$this->identifier, "div", "label", $label); |
|
27 | 27 | return $this; |
28 | 28 | } |
29 | 29 | |
30 | 30 | private function createBar() { |
31 | - $bar=new HtmlSemDoubleElement("bar-" . $this->identifier, "div", "bar", new HtmlSemDoubleElement("progress-" . $this->identifier, "div", "progress")); |
|
31 | + $bar=new HtmlSemDoubleElement("bar-".$this->identifier, "div", "bar", new HtmlSemDoubleElement("progress-".$this->identifier, "div", "progress")); |
|
32 | 32 | $this->content["bar"]=$bar; |
33 | 33 | return $this; |
34 | 34 | } |
@@ -68,20 +68,20 @@ discard block |
||
68 | 68 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
69 | 69 | */ |
70 | 70 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
71 | - $this->content=JArray::sortAssociative($this->content, [ "bar","label" ]); |
|
71 | + $this->content=JArray::sortAssociative($this->content, ["bar", "label"]); |
|
72 | 72 | return parent::compile($js, $view); |
73 | 73 | } |
74 | 74 | |
75 | 75 | public function jsSetValue($value) { |
76 | - return '$("#' . $this->identifier . '").progress({value:' . $value . '});'; |
|
76 | + return '$("#'.$this->identifier.'").progress({value:'.$value.'});'; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | public function jsIncValue() { |
80 | - return '$("#' . $this->identifier . '").progress("increment");'; |
|
80 | + return '$("#'.$this->identifier.'").progress("increment");'; |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | public function jsDecValue() { |
84 | - return '$("#' . $this->identifier . '").progress("decrement");'; |
|
84 | + return '$("#'.$this->identifier.'").progress("decrement");'; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @return HtmlProgress |
96 | 96 | */ |
97 | 97 | public function setTextValues($active=false, $error=false, $success=false, $warning=false, $percent="{percent}%", $ratio="{value} of {total}") { |
98 | - if (\is_array($active) == true) { |
|
98 | + if (\is_array($active)==true) { |
|
99 | 99 | $array=$active; |
100 | 100 | $active=JArray::getDefaultValue($array, "active", false); |
101 | 101 | $success=JArray::getDefaultValue($array, "success", $success); |
@@ -103,12 +103,12 @@ discard block |
||
103 | 103 | $percent=JArray::getDefaultValue($array, "percent", $percent); |
104 | 104 | $ratio=JArray::getDefaultValue($array, "ratio", $ratio); |
105 | 105 | } |
106 | - $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) . "}%"; |
|
106 | + $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)."}%"; |
|
107 | 107 | return $this; |
108 | 108 | } |
109 | 109 | |
110 | 110 | public function onChange($jsCode) { |
111 | - return $this->_params["onChange"]="%function(percent, value, total){" . $jsCode . "}%"; |
|
111 | + return $this->_params["onChange"]="%function(percent, value, total){".$jsCode."}%"; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /* |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | * @see BaseHtml::run() |
117 | 117 | */ |
118 | 118 | public function run(JsUtils $js) { |
119 | - if (isset($this->_bsComponent) === false) |
|
120 | - $this->_bsComponent=$js->semantic()->progress("#" . $this->identifier, $this->_params); |
|
119 | + if (isset($this->_bsComponent)===false) |
|
120 | + $this->_bsComponent=$js->semantic()->progress("#".$this->identifier, $this->_params); |
|
121 | 121 | $this->addEventsOnRun($js); |
122 | 122 | return $this->_bsComponent; |
123 | 123 | } |
@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | |
22 | 22 | public function __construct($identifier, $elements=array()) { |
23 | 23 | parent::__construct($identifier, "form", "ui form"); |
24 | - $this->_states=[ State::ERROR,State::SUCCESS,State::WARNING,State::DISABLED ]; |
|
24 | + $this->_states=[State::ERROR, State::SUCCESS, State::WARNING, State::DISABLED]; |
|
25 | 25 | $this->setProperty("name", $this->identifier); |
26 | - $this->_fields=array (); |
|
26 | + $this->_fields=array(); |
|
27 | 27 | $this->addItems($elements); |
28 | 28 | } |
29 | 29 | |
@@ -37,22 +37,22 @@ discard block |
||
37 | 37 | public function addFields($fields=NULL, $label=NULL) { |
38 | 38 | if (isset($fields)) { |
39 | 39 | if (!$fields instanceof HtmlFormFields) { |
40 | - if (\is_array($fields) === false) { |
|
40 | + if (\is_array($fields)===false) { |
|
41 | 41 | $fields=\func_get_args(); |
42 | 42 | $end=\end($fields); |
43 | 43 | if (\is_string($end)) { |
44 | 44 | $label=$end; |
45 | 45 | \array_pop($fields); |
46 | - } else |
|
46 | + }else |
|
47 | 47 | $label=NULL; |
48 | 48 | } |
49 | 49 | $this->_fields=\array_merge($this->_fields, $fields); |
50 | - $fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count(), $fields); |
|
50 | + $fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count(), $fields); |
|
51 | 51 | } |
52 | 52 | if (isset($label)) |
53 | 53 | $fields=new HtmlFormField("", $fields, $label); |
54 | - } else { |
|
55 | - $fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count()); |
|
54 | + }else { |
|
55 | + $fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count()); |
|
56 | 56 | } |
57 | 57 | $this->addItem($fields); |
58 | 58 | return $fields; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | public function addItem($item) { |
62 | 62 | $item=parent::addItem($item); |
63 | - if (\is_subclass_of($item, HtmlFormField::class) === true) { |
|
63 | + if (\is_subclass_of($item, HtmlFormField::class)===true) { |
|
64 | 64 | $this->_fields[]=$item; |
65 | 65 | } |
66 | 66 | return $item; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | public function getField($index) { |
70 | 70 | if (\is_string($index)) { |
71 | 71 | $field=$this->getElementById($index, $this->_fields); |
72 | - } else { |
|
72 | + }else { |
|
73 | 73 | $field=$this->_fields[$index]; |
74 | 74 | } |
75 | 75 | return $field; |