@@ -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 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | use Ajax\semantic\traits\SemanticHtmlModulesTrait; |
24 | 24 | |
25 | 25 | class Semantic extends BaseGui { |
26 | - use SemanticComponentsTrait,SemanticHtmlElementsTrait,SemanticHtmlCollectionsTrait, |
|
26 | + use SemanticComponentsTrait, SemanticHtmlElementsTrait, SemanticHtmlCollectionsTrait, |
|
27 | 27 | SemanticHtmlModulesTrait; |
28 | 28 | |
29 | 29 | public function __construct($autoCompile=true) { |
@@ -36,24 +36,24 @@ discard block |
||
36 | 36 | * @param array $items |
37 | 37 | * @return Ajax\semantic\html\collections\HtmlMenu |
38 | 38 | */ |
39 | - public function htmlMenu($identifier,$items=array()){ |
|
40 | - return $this->addHtmlComponent(new HtmlMenu($identifier,$items)); |
|
39 | + public function htmlMenu($identifier, $items=array()) { |
|
40 | + return $this->addHtmlComponent(new HtmlMenu($identifier, $items)); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /**Adds an icon menu |
44 | 44 | * @param string $identifier |
45 | 45 | * @param array $items icons |
46 | 46 | */ |
47 | - public function htmlIconMenu($identifier,$items=array()){ |
|
48 | - return $this->addHtmlComponent(new HtmlIconMenu($identifier,$items)); |
|
47 | + public function htmlIconMenu($identifier, $items=array()) { |
|
48 | + return $this->addHtmlComponent(new HtmlIconMenu($identifier, $items)); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /**Adds an labeled icon menu |
52 | 52 | * @param string $identifier |
53 | 53 | * @param array $items icons |
54 | 54 | */ |
55 | - public function htmlLabeledIconMenu($identifier,$items=array()){ |
|
56 | - return $this->addHtmlComponent(new HtmlLabeledIconMenu($identifier,$items)); |
|
55 | + public function htmlLabeledIconMenu($identifier, $items=array()) { |
|
56 | + return $this->addHtmlComponent(new HtmlLabeledIconMenu($identifier, $items)); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | * @param string $value |
62 | 62 | * @param array $items |
63 | 63 | */ |
64 | - public function htmlDropdown($identifier, $value="", $items=array()){ |
|
65 | - return $this->addHtmlComponent(new HtmlDropdown($identifier,$value,$items)); |
|
64 | + public function htmlDropdown($identifier, $value="", $items=array()) { |
|
65 | + return $this->addHtmlComponent(new HtmlDropdown($identifier, $value, $items)); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -70,16 +70,16 @@ discard block |
||
70 | 70 | * @param string $identifier |
71 | 71 | * @param string $content |
72 | 72 | */ |
73 | - public function htmlMessage($identifier, $content=""){ |
|
74 | - return $this->addHtmlComponent(new HtmlMessage($identifier,$content)); |
|
73 | + public function htmlMessage($identifier, $content="") { |
|
74 | + return $this->addHtmlComponent(new HtmlMessage($identifier, $content)); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
78 | 78 | * @param string $identifier |
79 | 79 | * @param mixed $content |
80 | 80 | */ |
81 | - public function htmlPopup(BaseHtml $container,$identifier,$content){ |
|
82 | - return $this->addHtmlComponent(new HtmlPopup($container,$identifier,$content)); |
|
81 | + public function htmlPopup(BaseHtml $container, $identifier, $content) { |
|
82 | + return $this->addHtmlComponent(new HtmlPopup($container, $identifier, $content)); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | * @param boolean $createCols |
90 | 90 | * @param boolean $implicitRows |
91 | 91 | */ |
92 | - public function htmlGrid($identifier,$numRows=1,$numCols=NULL,$createCols=true,$implicitRows=false){ |
|
93 | - return $this->addHtmlComponent(new HtmlGrid($identifier,$numRows,$numCols,$createCols,$implicitRows)); |
|
92 | + public function htmlGrid($identifier, $numRows=1, $numCols=NULL, $createCols=true, $implicitRows=false) { |
|
93 | + return $this->addHtmlComponent(new HtmlGrid($identifier, $numRows, $numCols, $createCols, $implicitRows)); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | * @param function $hrefFunction the function who generates the href elements. default : function($e){return $e->getContent()} |
104 | 104 | * @return HtmlBreadcrumb |
105 | 105 | */ |
106 | - public function htmlBreadcrumb( $identifier,$items=array(),$autoActive=true,$startIndex=0,$hrefFunction=NULL){ |
|
107 | - return $this->addHtmlComponent(new HtmlBreadcrumb($identifier,$items,$autoActive,$startIndex,$hrefFunction)); |
|
106 | + public function htmlBreadcrumb($identifier, $items=array(), $autoActive=true, $startIndex=0, $hrefFunction=NULL) { |
|
107 | + return $this->addHtmlComponent(new HtmlBreadcrumb($identifier, $items, $autoActive, $startIndex, $hrefFunction)); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | * @param string $identifier |
122 | 122 | * @return HtmlAccordion |
123 | 123 | */ |
124 | - public function htmlAccordionMenu($identifier,$items=array()) { |
|
125 | - return $this->addHtmlComponent(new HtmlAccordionMenu($identifier,$items)); |
|
124 | + public function htmlAccordionMenu($identifier, $items=array()) { |
|
125 | + return $this->addHtmlComponent(new HtmlAccordionMenu($identifier, $items)); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -130,11 +130,11 @@ discard block |
||
130 | 130 | * @param string $identifier |
131 | 131 | * @param array $elements |
132 | 132 | */ |
133 | - public function htmlForm($identifier,$elements=array()) { |
|
134 | - return $this->addHtmlComponent(new HtmlForm($identifier,$elements)); |
|
133 | + public function htmlForm($identifier, $elements=array()) { |
|
134 | + return $this->addHtmlComponent(new HtmlForm($identifier, $elements)); |
|
135 | 135 | } |
136 | 136 | |
137 | - public function htmlSticky($identifier,$content=array()) { |
|
138 | - return $this->addHtmlComponent(new HtmlSticky($identifier,$content)); |
|
137 | + public function htmlSticky($identifier, $content=array()) { |
|
138 | + return $this->addHtmlComponent(new HtmlSticky($identifier, $content)); |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 | \ No newline at end of file |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | return $result; |
27 | 27 | } |
28 | 28 | $values=array_values($array); |
29 | - foreach ( $values as $val ) { |
|
29 | + foreach ($values as $val) { |
|
30 | 30 | if ($condition($val)===true) |
31 | 31 | return $val; |
32 | 32 | } |
@@ -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 | |
@@ -45,12 +45,12 @@ discard block |
||
45 | 45 | if (\is_array($glue)) { |
46 | 46 | $size=\sizeof($pieces); |
47 | 47 | if ($size>0) { |
48 | - for($i=0; $i<$size-1; $i++) { |
|
48 | + for ($i=0; $i<$size-1; $i++) { |
|
49 | 49 | $result.=$pieces[$i].@$glue[$i]; |
50 | 50 | } |
51 | 51 | $result.=$pieces[$size-1]; |
52 | 52 | } |
53 | - } else { |
|
53 | + }else { |
|
54 | 54 | $result=\implode($glue, $pieces); |
55 | 55 | } |
56 | 56 | return $result; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | public static function dimension($array) { |
60 | 60 | if (is_array(reset($array))) { |
61 | 61 | $return=self::dimension(reset($array))+1; |
62 | - } else { |
|
62 | + }else { |
|
63 | 63 | $return=1; |
64 | 64 | } |
65 | 65 | return $return; |
@@ -14,21 +14,24 @@ discard block |
||
14 | 14 | return $array[$key]; |
15 | 15 | } |
16 | 16 | $values=array_values($array); |
17 | - if ($pos<sizeof($values)) |
|
18 | - return $values[$pos]; |
|
17 | + if ($pos<sizeof($values)) { |
|
18 | + return $values[$pos]; |
|
19 | + } |
|
19 | 20 | } |
20 | 21 | |
21 | 22 | public static function getConditionalValue($array, $key, $condition) { |
22 | 23 | $result=NULL; |
23 | 24 | if (array_key_exists($key, $array)) { |
24 | 25 | $result=$array[$key]; |
25 | - if ($condition($result)===true) |
|
26 | - return $result; |
|
26 | + if ($condition($result)===true) { |
|
27 | + return $result; |
|
28 | + } |
|
27 | 29 | } |
28 | 30 | $values=array_values($array); |
29 | 31 | foreach ( $values as $val ) { |
30 | - if ($condition($val)===true) |
|
31 | - return $val; |
|
32 | + if ($condition($val)===true) { |
|
33 | + return $val; |
|
34 | + } |
|
32 | 35 | } |
33 | 36 | return $result; |
34 | 37 | } |
@@ -36,8 +39,9 @@ discard block |
||
36 | 39 | public static function getDefaultValue($array, $key, $default=NULL) { |
37 | 40 | if (array_key_exists($key, $array)) { |
38 | 41 | return $array[$key]; |
39 | - } else |
|
40 | - return $default; |
|
42 | + } else { |
|
43 | + return $default; |
|
44 | + } |
|
41 | 45 | } |
42 | 46 | |
43 | 47 | public static function implode($glue, $pieces) { |
@@ -6,6 +6,9 @@ |
||
6 | 6 | |
7 | 7 | trait CheckboxTrait { |
8 | 8 | |
9 | + /** |
|
10 | + * @param string $name |
|
11 | + */ |
|
9 | 12 | public abstract function addToPropertyCtrl($name, $value, $typeCtrl); |
10 | 13 | |
11 | 14 | public function setType($checkboxType) { |
@@ -6,8 +6,8 @@ discard block |
||
6 | 6 | use Ajax\semantic\html\base\constants\Color; |
7 | 7 | |
8 | 8 | trait BaseTrait { |
9 | - protected $_variations=[ ]; |
|
10 | - protected $_states=[ ]; |
|
9 | + protected $_variations=[]; |
|
10 | + protected $_states=[]; |
|
11 | 11 | protected $_baseClass; |
12 | 12 | |
13 | 13 | protected abstract function setPropertyCtrl($name, $value, $typeCtrl); |
@@ -35,14 +35,14 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | public function setVariations($variations=array()) { |
38 | - foreach ( $variations as $variation ) { |
|
38 | + foreach ($variations as $variation) { |
|
39 | 39 | $this->setVariation($variation); |
40 | 40 | } |
41 | 41 | return $this; |
42 | 42 | } |
43 | 43 | |
44 | 44 | public function setStates($states=array()) { |
45 | - foreach ( $states as $state ) { |
|
45 | + foreach ($states as $state) { |
|
46 | 46 | $this->setState($state); |
47 | 47 | } |
48 | 48 | return $this; |
@@ -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) { |
@@ -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 | } |
@@ -13,8 +13,9 @@ discard block |
||
13 | 13 | $field=new \Ajax\common\html\html5\HtmlInput($identifier, $inputType, $value); |
14 | 14 | $field->setProperty("name", $name); |
15 | 15 | $this->setField($field); |
16 | - if (isset($label)) |
|
17 | - $this->setLabel($label); |
|
16 | + if (isset($label)) { |
|
17 | + $this->setLabel($label); |
|
18 | + } |
|
18 | 19 | } |
19 | 20 | |
20 | 21 | public function setType($checkboxType) { |
@@ -40,8 +41,9 @@ discard block |
||
40 | 41 | * @return mixed |
41 | 42 | */ |
42 | 43 | public function getLabel() { |
43 | - if (\array_key_exists("label", $this->content)) |
|
44 | - return $this->content["label"]; |
|
44 | + if (\array_key_exists("label", $this->content)) { |
|
45 | + return $this->content["label"]; |
|
46 | + } |
|
45 | 47 | } |
46 | 48 | |
47 | 49 | /** |
@@ -14,8 +14,8 @@ discard block |
||
14 | 14 | public function __construct($identifier, $type="text", $value="", $placeholder="") { |
15 | 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() { |
@@ -35,8 +35,8 @@ discard block |
||
35 | 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 | 41 | $this->addToProperty("class", $direction." labeled"); |
42 | 42 | $this->addContent($labelO, \strstr($direction, Direction::LEFT)!==false); |
@@ -33,8 +33,9 @@ discard block |
||
33 | 33 | $labelO=$label; |
34 | 34 | if (\is_object($label)===false) { |
35 | 35 | $labelO=new HtmlLabel("label-".$this->identifier, $label); |
36 | - if (isset($icon)) |
|
37 | - $labelO->addIcon($icon); |
|
36 | + if (isset($icon)) { |
|
37 | + $labelO->addIcon($icon); |
|
38 | + } |
|
38 | 39 | } else { |
39 | 40 | $labelO->addToPropertyCtrl("class", "label", array ("label" )); |
40 | 41 | } |
@@ -51,8 +52,9 @@ discard block |
||
51 | 52 | $actionO=$action; |
52 | 53 | if (\is_object($action)===false) { |
53 | 54 | $actionO=new HtmlButton("action-".$this->identifier, $action); |
54 | - if (isset($icon)) |
|
55 | - $actionO->addIcon($icon, true, $labeled); |
|
55 | + if (isset($icon)) { |
|
56 | + $actionO->addIcon($icon, true, $labeled); |
|
57 | + } |
|
56 | 58 | } |
57 | 59 | $this->addToProperty("class", $direction." action"); |
58 | 60 | $this->addContent($actionO, \strstr($direction, Direction::LEFT)!==false); |