@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * @param int $max |
14 | 14 | * @param string $icon star or heart |
15 | 15 | */ |
16 | - public function __construct($identifier, $value,$max=5,$icon="") { |
|
16 | + public function __construct($identifier, $value, $max=5, $icon="") { |
|
17 | 17 | parent::__construct($identifier, "div", "ui {$icon} rating"); |
18 | 18 | $this->setValue($value); |
19 | 19 | $this->setMax($max); |
@@ -23,11 +23,11 @@ discard block |
||
23 | 23 | * {@inheritDoc} |
24 | 24 | * @see \Ajax\common\html\HtmlDoubleElement::setValue() |
25 | 25 | */ |
26 | - public function setValue($value){ |
|
26 | + public function setValue($value) { |
|
27 | 27 | $this->setProperty("data-rating", $value); |
28 | 28 | } |
29 | 29 | |
30 | - public function setMax($max){ |
|
30 | + public function setMax($max) { |
|
31 | 31 | $this->setProperty("data-max-rating", $max); |
32 | 32 | } |
33 | 33 | |
@@ -35,20 +35,20 @@ discard block |
||
35 | 35 | * {@inheritDoc} |
36 | 36 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run() |
37 | 37 | */ |
38 | - public function run(JsUtils $js){ |
|
38 | + public function run(JsUtils $js) { |
|
39 | 39 | parent::run($js); |
40 | - return $js->semantic()->rating("#".$this->identifier,$this->_params); |
|
40 | + return $js->semantic()->rating("#".$this->identifier, $this->_params); |
|
41 | 41 | } |
42 | 42 | |
43 | - public function asStar(){ |
|
43 | + public function asStar() { |
|
44 | 44 | return $this->setIcon(); |
45 | 45 | } |
46 | 46 | |
47 | - public function asHeart(){ |
|
47 | + public function asHeart() { |
|
48 | 48 | return $this->setIcon("heart"); |
49 | 49 | } |
50 | 50 | |
51 | - public function setIcon($icon="star"){ |
|
52 | - return $this->addToPropertyCtrl("class", $icon, ["star","heart",""]); |
|
51 | + public function setIcon($icon="star") { |
|
52 | + return $this->addToPropertyCtrl("class", $icon, ["star", "heart", ""]); |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | \ No newline at end of file |
@@ -13,7 +13,7 @@ |
||
13 | 13 | * @param int $rowCount |
14 | 14 | * @param int $colCount |
15 | 15 | */ |
16 | - public function htmlTable($identifier, $rowCount, $colCount){ |
|
16 | + public function htmlTable($identifier, $rowCount, $colCount) { |
|
17 | 17 | return $this->addHtmlComponent(new HtmlTable($identifier, $rowCount, $colCount)); |
18 | 18 | } |
19 | 19 | } |
20 | 20 | \ No newline at end of file |
@@ -15,7 +15,7 @@ |
||
15 | 15 | class HtmlFormCheckbox extends HtmlFormField { |
16 | 16 | use CheckboxTrait; |
17 | 17 | public function __construct($identifier, $label=NULL, $value=NULL, $type=NULL) { |
18 | - parent::__construct("field-".$identifier, new HtmlCheckbox($identifier,$label,$value,$type)); |
|
18 | + parent::__construct("field-".$identifier, new HtmlCheckbox($identifier, $label, $value, $type)); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | public static function slider($identifier, $label="", $value=NULL) { |
@@ -29,13 +29,13 @@ discard block |
||
29 | 29 | if (\is_string($end)) { |
30 | 30 | $label=$end; |
31 | 31 | \array_pop($fields); |
32 | - } else |
|
32 | + }else |
|
33 | 33 | $label=NULL; |
34 | 34 | } |
35 | 35 | } |
36 | 36 | if (isset($label)) |
37 | 37 | $this->setLabel($label); |
38 | - foreach ( $fields as $field ) { |
|
38 | + foreach ($fields as $field) { |
|
39 | 39 | $this->addItem($field); |
40 | 40 | } |
41 | 41 | return $this; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | if ($this->_equalWidth) { |
66 | 66 | $count=$this->count(); |
67 | 67 | $this->addToProperty("class", Wide::getConstants()["W".$count]." fields"); |
68 | - } else |
|
68 | + }else |
|
69 | 69 | $this->addToProperty("class", "fields"); |
70 | 70 | return parent::compile($js, $view); |
71 | 71 | } |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | } |
97 | 97 | |
98 | 98 | public static function radios($name, $items=array(), $label=NULL, $value=null, $type=NULL) { |
99 | - $fields=array (); |
|
99 | + $fields=array(); |
|
100 | 100 | $i=0; |
101 | - foreach ( $items as $val => $caption ) { |
|
101 | + foreach ($items as $val => $caption) { |
|
102 | 102 | $itemO=new HtmlFormRadio($name."-".$i++, $name, $caption, $val, $type); |
103 | 103 | if ($val===$value) { |
104 | 104 | $itemO->getField()->getField()->setProperty("checked", ""); |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | public static function checkeds($name, $items=array(), $label=NULL, $values=array(), $type=NULL) { |
115 | - $fields=array (); |
|
115 | + $fields=array(); |
|
116 | 116 | $i=0; |
117 | - foreach ( $items as $val => $caption ) { |
|
117 | + foreach ($items as $val => $caption) { |
|
118 | 118 | $itemO=new HtmlFormCheckbox($name."-".$i++, $name, $caption, $val, $type); |
119 | 119 | if (\array_search($val, $values)!==false) { |
120 | 120 | $itemO->getField()->getField()->setProperty("checked", ""); |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | use Ajax\semantic\html\base\constants\CheckboxType; |
7 | 7 | |
8 | 8 | abstract class AbstractCheckbox extends HtmlSemDoubleElement { |
9 | - protected $_params=array (); |
|
9 | + protected $_params=array(); |
|
10 | 10 | |
11 | 11 | public function __construct($identifier, $name=NULL, $label=NULL, $value=NULL, $inputType="checkbox", $type="checkbox") { |
12 | 12 | parent::__construct("ck-".$identifier, "div", "ui ".$type); |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | * @return \Ajax\semantic\html\collections\form\AbstractHtmlFormRadioCheckbox |
74 | 74 | */ |
75 | 75 | public function attachEvent($selector, $action=NULL) { |
76 | - if (isset($action)!==false||\is_numeric($action)===true) { |
|
76 | + if (isset($action)!==false || \is_numeric($action)===true) { |
|
77 | 77 | $js='$("#%identifier%").checkbox("attach events", "'.$selector.'", "'.$action.'");'; |
78 | - } else { |
|
78 | + }else { |
|
79 | 79 | $js='$("#%identifier%").checkbox("attach events", "'.$selector.'");'; |
80 | 80 | } |
81 | 81 | $js=\str_replace("%identifier%", $this->identifier, $js); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function attachEvents($events=array()) { |
91 | 91 | if (\is_array($events)) { |
92 | - foreach ( $events as $action => $selector ) { |
|
92 | + foreach ($events as $action => $selector) { |
|
93 | 93 | $this->attachEvent($selector, $action); |
94 | 94 | } |
95 | 95 | } |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | * @return \Ajax\semantic\html\collections\HtmlMenu |
35 | 35 | */ |
36 | 36 | public function setType($type="") { |
37 | - return $this->addToPropertyCtrl("class", $type, array ("","item","text" )); |
|
37 | + return $this->addToPropertyCtrl("class", $type, array("", "item", "text")); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | public function setActiveItem($index) { |
41 | 41 | $item=$this->getItem($index); |
42 | - if ($item !== null) { |
|
42 | + if ($item!==null) { |
|
43 | 43 | $item->addToProperty("class", "active"); |
44 | 44 | } |
45 | 45 | return $this; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | private function getItemToInsert($item) { |
49 | 49 | if ($item instanceof HtmlInput || $item instanceof HtmlImg || $item instanceof HtmlIcon) { |
50 | - $itemO=new HtmlSemDoubleElement("item-" . $this->identifier, "div", ""); |
|
50 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier, "div", ""); |
|
51 | 51 | $itemO->setContent($item); |
52 | 52 | $item=$itemO; |
53 | 53 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | private function afterInsert($item) { |
58 | 58 | if (!$item instanceof HtmlMenu) |
59 | - $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
59 | + $item->addToPropertyCtrl("class", "item", array("item")); |
|
60 | 60 | else { |
61 | 61 | $this->setSecondary(); |
62 | 62 | } |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | |
88 | 88 | public function generateMenuAsItem($menu, $header=null) { |
89 | 89 | $count=$this->count(); |
90 | - $item=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "div"); |
|
90 | + $item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div"); |
|
91 | 91 | if (isset($header)) { |
92 | - $headerItem=new HtmlSemDoubleElement("item-header-" . $this->identifier . "-" . $count, "div", "header"); |
|
92 | + $headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header"); |
|
93 | 93 | $headerItem->setContent($header); |
94 | 94 | $item->addContent($headerItem); |
95 | 95 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $value=new HtmlSemDoubleElement($identifier, "a", "browse item", $value); |
107 | 107 | $value->addContent(new HtmlIcon("", "dropdown")); |
108 | 108 | $value=$this->addItem($value); |
109 | - $popup=new HtmlPopup($value, "popup-" . $this->identifier . "-" . $this->count(), $content); |
|
109 | + $popup=new HtmlPopup($value, "popup-".$this->identifier."-".$this->count(), $content); |
|
110 | 110 | $popup->setFlowing()->setPosition("bottom left")->setOn("click"); |
111 | 111 | $this->wrap("", $popup); |
112 | 112 | return $popup; |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | public function addDropdownAsItem($value, $items=NULL) { |
116 | 116 | $dd=$value; |
117 | 117 | if (\is_string($value)) { |
118 | - $dd=new HtmlDropdown("dropdown-" . $this->identifier . "-" . $this->count(), $value, $items); |
|
118 | + $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(), $value, $items); |
|
119 | 119 | } |
120 | 120 | return $this->addItem($dd); |
121 | 121 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
128 | 128 | */ |
129 | 129 | protected function createItem($value) { |
130 | - $itemO=new HtmlLink("item-" . \sizeof($this->content), "", $value); |
|
130 | + $itemO=new HtmlLink("item-".\sizeof($this->content), "", $value); |
|
131 | 131 | return $itemO->setClass("item"); |
132 | 132 | } |
133 | 133 | |
@@ -140,28 +140,28 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | public function setVertical() { |
143 | - return $this->addToPropertyCtrl("class", "vertical", array ("vertical" )); |
|
143 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | public function setPosition($value="right") { |
147 | - return $this->addToPropertyCtrl("class", $value, array ("right","left" )); |
|
147 | + return $this->addToPropertyCtrl("class", $value, array("right", "left")); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | public function setPointing($value=Direction::NONE) { |
151 | - return $this->addToPropertyCtrl("class", $value . " pointing", Direction::getConstantValues("pointing")); |
|
151 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | public function asTab($vertical=false) { |
155 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
155 | + $this->apply(function(HtmlDoubleElement & $item) { |
|
156 | 156 | $item->setTagName("a"); |
157 | 157 | }); |
158 | - if ($vertical === true) |
|
158 | + if ($vertical===true) |
|
159 | 159 | $this->setVertical(); |
160 | 160 | return $this->addToProperty("class", "tabular"); |
161 | 161 | } |
162 | 162 | |
163 | 163 | public function asPagination() { |
164 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
164 | + $this->apply(function(HtmlDoubleElement & $item) { |
|
165 | 165 | $item->setTagName("a"); |
166 | 166 | }); |
167 | 167 | return $this->addToProperty("class", "pagination"); |
@@ -198,10 +198,10 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public function setWidth($width) { |
200 | 200 | if (\is_int($width)) { |
201 | - $width=Wide::getConstants()["W" . $width]; |
|
201 | + $width=Wide::getConstants()["W".$width]; |
|
202 | 202 | } |
203 | 203 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
204 | - return $this->addToPropertyCtrl("class", "item", array ("item" )); |
|
204 | + return $this->addToPropertyCtrl("class", "item", array("item")); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | public function addImage($identifier, $src="", $alt="") { |
@@ -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) { |
@@ -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 | } |