@@ -8,26 +8,26 @@ discard block |
||
8 | 8 | |
9 | 9 | class HtmlFormField extends HtmlSemDoubleElement { |
10 | 10 | protected $_container; |
11 | - public function __construct($identifier, $field,$label=NULL) { |
|
12 | - parent::__construct($identifier, "div","field"); |
|
11 | + public function __construct($identifier, $field, $label=NULL) { |
|
12 | + parent::__construct($identifier, "div", "field"); |
|
13 | 13 | $this->content=array(); |
14 | - $this->_states=[State::ERROR,State::DISABLED]; |
|
15 | - if(isset($label)) |
|
14 | + $this->_states=[State::ERROR, State::DISABLED]; |
|
15 | + if (isset($label)) |
|
16 | 16 | $this->setLabel($label); |
17 | 17 | $this->setField($field); |
18 | 18 | } |
19 | 19 | |
20 | - public function setLabel($label){ |
|
20 | + public function setLabel($label) { |
|
21 | 21 | $labelO=$label; |
22 | - if(\is_string($label)){ |
|
23 | - $labelO=new HtmlSemDoubleElement("","label",""); |
|
22 | + if (\is_string($label)) { |
|
23 | + $labelO=new HtmlSemDoubleElement("", "label", ""); |
|
24 | 24 | $labelO->setContent($label); |
25 | - $labelO->setProperty("for", \str_replace("field-", "",$this->identifier)); |
|
25 | + $labelO->setProperty("for", \str_replace("field-", "", $this->identifier)); |
|
26 | 26 | } |
27 | 27 | $this->content["label"]=$labelO; |
28 | 28 | } |
29 | 29 | |
30 | - public function setField($field){ |
|
30 | + public function setField($field) { |
|
31 | 31 | $this->content["field"]=$field; |
32 | 32 | } |
33 | 33 | |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | * Returns the label or null |
36 | 36 | * @return mixed |
37 | 37 | */ |
38 | - public function getLabel(){ |
|
39 | - if(\array_key_exists("label", $this->content)) |
|
38 | + public function getLabel() { |
|
39 | + if (\array_key_exists("label", $this->content)) |
|
40 | 40 | return $this->content["label"]; |
41 | 41 | } |
42 | 42 | |
@@ -44,14 +44,14 @@ discard block |
||
44 | 44 | * Return the field |
45 | 45 | * @return mixed |
46 | 46 | */ |
47 | - public function getField(){ |
|
47 | + public function getField() { |
|
48 | 48 | return $this->content["field"]; |
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
52 | 52 | * puts the label before or behind |
53 | 53 | */ |
54 | - public function swapLabel(){ |
|
54 | + public function swapLabel() { |
|
55 | 55 | $label=$this->getLabel(); |
56 | 56 | unset($this->content["label"]); |
57 | 57 | $this->content["label"]=$label; |
@@ -62,27 +62,27 @@ discard block |
||
62 | 62 | * @param int $width |
63 | 63 | * @return \Ajax\semantic\html\collections\form\HtmlFormField |
64 | 64 | */ |
65 | - public function setWidth($width){ |
|
66 | - if(\is_int($width)){ |
|
65 | + public function setWidth($width) { |
|
66 | + if (\is_int($width)) { |
|
67 | 67 | $width=Wide::getConstants()["W".$width]; |
68 | 68 | } |
69 | 69 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
70 | - if(isset($this->_container)){ |
|
70 | + if (isset($this->_container)) { |
|
71 | 71 | $this->_container->setEqualWidth(false); |
72 | 72 | } |
73 | - return $this->addToPropertyCtrl("class", "wide",array("wide")); |
|
73 | + return $this->addToPropertyCtrl("class", "wide", array("wide")); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
77 | 77 | * Field displays an error state |
78 | 78 | * @return \Ajax\semantic\html\collections\form\HtmlFormField |
79 | 79 | */ |
80 | - public function setError(){ |
|
80 | + public function setError() { |
|
81 | 81 | return $this->addToProperty("class", "error"); |
82 | 82 | } |
83 | 83 | |
84 | - public function jsState($state){ |
|
85 | - return $this->jsDoJquery("addClass",$state); |
|
84 | + public function jsState($state) { |
|
85 | + return $this->jsDoJquery("addClass", $state); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | public function setContainer($_container) { |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | return $this; |
91 | 91 | } |
92 | 92 | |
93 | - public function setReadonly(){ |
|
93 | + public function setReadonly() { |
|
94 | 94 | $this->getField()->setProperty("readonly", ""); |
95 | 95 | } |
96 | 96 |
@@ -17,12 +17,12 @@ discard block |
||
17 | 17 | * @version 1.001 |
18 | 18 | */ |
19 | 19 | class HtmlSegment extends HtmlSemDoubleElement { |
20 | - use AttachedTrait,TextAlignmentTrait; |
|
20 | + use AttachedTrait, TextAlignmentTrait; |
|
21 | 21 | |
22 | 22 | public function __construct($identifier, $content="") { |
23 | 23 | parent::__construct($identifier, "div", "ui segment"); |
24 | - $this->_variations=\array_merge($this->_variations, [ Variation::PADDED,Variation::COMPACT ]); |
|
25 | - $this->_states=\array_merge($this->_states, [ State::LOADING ]); |
|
24 | + $this->_variations=\array_merge($this->_variations, [Variation::PADDED, Variation::COMPACT]); |
|
25 | + $this->_states=\array_merge($this->_states, [State::LOADING]); |
|
26 | 26 | $this->content=$content; |
27 | 27 | } |
28 | 28 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | public function setSens($sens="vertical") { |
39 | - return $this->addToPropertyCtrl("class", $sens, array ("vertical","horizontal" )); |
|
39 | + return $this->addToPropertyCtrl("class", $sens, array("vertical", "horizontal")); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | public function setEmphasis($value=Emphasis::SECONDARY) { |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | use IconTrait; |
13 | 13 | |
14 | 14 | public function __construct($identifier, $type="text", $value="", $placeholder="") { |
15 | - parent::__construct("div-" . $identifier, "div", "ui input"); |
|
15 | + parent::__construct("div-".$identifier, "div", "ui input"); |
|
16 | 16 | $this->content=new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder); |
17 | - $this->_states=[ State::DISABLED,State::FOCUS,State::ERROR ]; |
|
18 | - $this->_variations=[ Variation::TRANSPARENT ]; |
|
17 | + $this->_states=[State::DISABLED, State::FOCUS, State::ERROR]; |
|
18 | + $this->_variations=[Variation::TRANSPARENT]; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | public function setFocus() { |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | } |
24 | 24 | |
25 | 25 | public function addLoading() { |
26 | - if ($this->_hasIcon === false) { |
|
26 | + if ($this->_hasIcon===false) { |
|
27 | 27 | throw new \Exception("Input must have an icon for showing a loader, use addIcon before"); |
28 | 28 | } |
29 | 29 | return $this->addToProperty("class", State::LOADING); |
@@ -31,31 +31,31 @@ discard block |
||
31 | 31 | |
32 | 32 | public function labeled($label, $direction=Direction::LEFT, $icon=NULL) { |
33 | 33 | $labelO=$label; |
34 | - if (\is_object($label) === false) { |
|
35 | - $labelO=new HtmlLabel("label-" . $this->identifier, $label); |
|
34 | + if (\is_object($label)===false) { |
|
35 | + $labelO=new HtmlLabel("label-".$this->identifier, $label); |
|
36 | 36 | if (isset($icon)) |
37 | 37 | $labelO->addIcon($icon); |
38 | - } else { |
|
39 | - $labelO->addToPropertyCtrl("class", "label", array ("label" )); |
|
38 | + }else { |
|
39 | + $labelO->addToPropertyCtrl("class", "label", array("label")); |
|
40 | 40 | } |
41 | - $this->addToProperty("class", $direction . " labeled"); |
|
42 | - $this->addContent($labelO, \strstr($direction, Direction::LEFT) !== false); |
|
41 | + $this->addToProperty("class", $direction." labeled"); |
|
42 | + $this->addContent($labelO, \strstr($direction, Direction::LEFT)!==false); |
|
43 | 43 | return $labelO; |
44 | 44 | } |
45 | 45 | |
46 | 46 | public function labeledToCorner($label, $direction=Direction::LEFT, $icon=NULL) { |
47 | - return $this->labeled($label, $direction . " corner", $icon)->toCorner($direction); |
|
47 | + return $this->labeled($label, $direction." corner", $icon)->toCorner($direction); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | public function addAction($action, $direction=Direction::LEFT, $icon=NULL, $labeled=false) { |
51 | 51 | $actionO=$action; |
52 | - if (\is_object($action) === false) { |
|
53 | - $actionO=new HtmlButton("action-" . $this->identifier, $action); |
|
52 | + if (\is_object($action)===false) { |
|
53 | + $actionO=new HtmlButton("action-".$this->identifier, $action); |
|
54 | 54 | if (isset($icon)) |
55 | 55 | $actionO->addIcon($icon, true, $labeled); |
56 | 56 | } |
57 | - $this->addToProperty("class", $direction . " action"); |
|
58 | - $this->addContent($actionO, \strstr($direction, Direction::LEFT) !== false); |
|
57 | + $this->addToProperty("class", $direction." action"); |
|
58 | + $this->addContent($actionO, \strstr($direction, Direction::LEFT)!==false); |
|
59 | 59 | return $actionO; |
60 | 60 | } |
61 | 61 | } |
62 | 62 | \ No newline at end of file |
@@ -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 | } |
@@ -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() { |
@@ -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; |