@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | private $default; |
14 | 14 | private $options; |
15 | 15 | |
16 | - public function __construct($identifier, $caption="",$default=NULL) { |
|
16 | + public function __construct($identifier, $caption="", $default=NULL) { |
|
17 | 17 | parent::__construct($identifier, "select"); |
18 | 18 | $this->setProperty("name", $identifier); |
19 | 19 | $this->setProperty("class", "form-control"); |
@@ -22,21 +22,21 @@ discard block |
||
22 | 22 | $this->options=array(); |
23 | 23 | } |
24 | 24 | |
25 | - public function addOption($element,$value="",$selected=false){ |
|
26 | - if($element instanceof HtmlOption){ |
|
25 | + public function addOption($element, $value="", $selected=false) { |
|
26 | + if ($element instanceof HtmlOption) { |
|
27 | 27 | $option=$element; |
28 | - }else{ |
|
29 | - $option=new HtmlOption($this->identifier."-".count($this->options), $element,$value); |
|
28 | + } else { |
|
29 | + $option=new HtmlOption($this->identifier."-".count($this->options), $element, $value); |
|
30 | 30 | } |
31 | - if($selected || $option->getValue()==$this->getProperty("value")){ |
|
31 | + if ($selected || $option->getValue()==$this->getProperty("value")) { |
|
32 | 32 | $option->select(); |
33 | 33 | } |
34 | 34 | $this->options[]=$option; |
35 | 35 | } |
36 | 36 | |
37 | 37 | public function setValue($value) { |
38 | - foreach ( $this->options as $option ) { |
|
39 | - if (strcasecmp($option->getValue(),$value)===0) { |
|
38 | + foreach ($this->options as $option) { |
|
39 | + if (strcasecmp($option->getValue(), $value)===0) { |
|
40 | 40 | $option->setProperty("selected", ""); |
41 | 41 | } |
42 | 42 | } |
@@ -49,23 +49,23 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
51 | 51 | $this->content=array(); |
52 | - if(isset($this->default)){ |
|
52 | + if (isset($this->default)) { |
|
53 | 53 | $default=new HtmlOption("", $this->default); |
54 | 54 | $this->content[]=$default; |
55 | 55 | } |
56 | - foreach ($this->options as $option){ |
|
56 | + foreach ($this->options as $option) { |
|
57 | 57 | $this->content[]=$option; |
58 | 58 | } |
59 | 59 | return parent::compile($js, $view); |
60 | 60 | } |
61 | 61 | |
62 | - public function fromArray($array){ |
|
63 | - if(JArray::isAssociative($array)){ |
|
64 | - foreach ($array as $k=>$v){ |
|
62 | + public function fromArray($array) { |
|
63 | + if (JArray::isAssociative($array)) { |
|
64 | + foreach ($array as $k=>$v) { |
|
65 | 65 | $this->addOption($v, $k); |
66 | 66 | } |
67 | - }else{ |
|
68 | - foreach ($array as $v){ |
|
67 | + } else { |
|
68 | + foreach ($array as $v) { |
|
69 | 69 | $this->addOption($v, $v); |
70 | 70 | } |
71 | 71 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $this->addOption($function($object)); |
99 | 99 | } |
100 | 100 | |
101 | - public function setSize($size){ |
|
101 | + public function setSize($size) { |
|
102 | 102 | return $this->setProperty("size", $size); |
103 | 103 | } |
104 | 104 | } |
@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | * @return $this |
28 | 28 | */ |
29 | 29 | public function setOnShow($jsCode) { |
30 | - $jsCode=str_ireplace("\"","%quote%", $jsCode); |
|
30 | + $jsCode=str_ireplace("\"", "%quote%", $jsCode); |
|
31 | 31 | return $this->setParam("onShow", "%function(){".$jsCode."}%"); |
32 | 32 | } |
33 | 33 | |
34 | - public function setExclusive($value){ |
|
34 | + public function setExclusive($value) { |
|
35 | 35 | return $this->setParam("exclusive", $value); |
36 | 36 | } |
37 | 37 | |
@@ -40,15 +40,15 @@ discard block |
||
40 | 40 | * @param string $popup the css selector of the popup |
41 | 41 | * @return \Ajax\semantic\components\Popup |
42 | 42 | */ |
43 | - public function setPopup($popup){ |
|
43 | + public function setPopup($popup) { |
|
44 | 44 | return $this->setParam("popup", $popup); |
45 | 45 | } |
46 | 46 | |
47 | - public function setInline($value){ |
|
47 | + public function setInline($value) { |
|
48 | 48 | return $this->setParam("inline", $value); |
49 | 49 | } |
50 | 50 | |
51 | - public function setPosition($value){ |
|
51 | + public function setPosition($value) { |
|
52 | 52 | return $this->setParam("position", $value); |
53 | 53 | } |
54 | 54 | //TODO other events implementation |
@@ -5,13 +5,13 @@ |
||
5 | 5 | |
6 | 6 | class HtmlShapeItem extends HtmlSemDoubleElement { |
7 | 7 | public function __construct($identifier, $content) { |
8 | - parent::__construct($identifier,"div","side",$content); |
|
8 | + parent::__construct($identifier, "div", "side", $content); |
|
9 | 9 | } |
10 | 10 | |
11 | - public function setActive($value=true){ |
|
12 | - if($value){ |
|
11 | + public function setActive($value=true) { |
|
12 | + if ($value) { |
|
13 | 13 | $this->addToPropertyCtrl("class", "active", ["active"]); |
14 | - }else{ |
|
14 | + } else { |
|
15 | 15 | $this->removePropertyValue("class", "active"); |
16 | 16 | } |
17 | 17 | return $this; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @param int $colCount |
19 | 19 | * @return HtmlTable |
20 | 20 | */ |
21 | - public function htmlTable($identifier, $rowCount, $colCount){ |
|
21 | + public function htmlTable($identifier, $rowCount, $colCount) { |
|
22 | 22 | return $this->addHtmlComponent(new HtmlTable($identifier, $rowCount, $colCount)); |
23 | 23 | } |
24 | 24 | |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | * @param $styles string|array|NULL |
30 | 30 | * @return HtmlMessage |
31 | 31 | */ |
32 | - public function htmlMessage($identifier, $content="",$styles=NULL) { |
|
33 | - $msg= $this->addHtmlComponent(new HtmlMessage($identifier, $content)); |
|
34 | - if(isset($msg)) |
|
32 | + public function htmlMessage($identifier, $content="", $styles=NULL) { |
|
33 | + $msg=$this->addHtmlComponent(new HtmlMessage($identifier, $content)); |
|
34 | + if (isset($msg)) |
|
35 | 35 | $msg->setStyle($styles); |
36 | 36 | return $msg; |
37 | 37 | } |
@@ -127,8 +127,8 @@ discard block |
||
127 | 127 | * @param string|array $params |
128 | 128 | * @return Modal |
129 | 129 | */ |
130 | - public function modal($attachTo=NULL, $params=NULL,$paramsParts=NULL) { |
|
131 | - $result= $this->addComponent(new Modal($this->js), $attachTo, $params); |
|
130 | + public function modal($attachTo=NULL, $params=NULL, $paramsParts=NULL) { |
|
131 | + $result=$this->addComponent(new Modal($this->js), $attachTo, $params); |
|
132 | 132 | $result->setParamParts($paramsParts); |
133 | 133 | return $result; |
134 | 134 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * @return Tab |
140 | 140 | */ |
141 | 141 | public function tab($attachTo=NULL, $params=NULL) { |
142 | - $result= $this->addComponent(new Tab($this->js), $attachTo, $params); |
|
142 | + $result=$this->addComponent(new Tab($this->js), $attachTo, $params); |
|
143 | 143 | return $result; |
144 | 144 | } |
145 | 145 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @return Shape |
150 | 150 | */ |
151 | 151 | public function shape($attachTo=NULL, $params=NULL) { |
152 | - $result= $this->addComponent(new Shape($this->js), $attachTo, $params); |
|
152 | + $result=$this->addComponent(new Shape($this->js), $attachTo, $params); |
|
153 | 153 | return $result; |
154 | 154 | } |
155 | 155 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | * @return Form |
160 | 160 | */ |
161 | 161 | public function form($attachTo=NULL, $params=NULL) { |
162 | - $result= $this->addComponent(new Form($this->js), $attachTo, $params); |
|
162 | + $result=$this->addComponent(new Form($this->js), $attachTo, $params); |
|
163 | 163 | return $result; |
164 | 164 | } |
165 | 165 |
@@ -12,9 +12,9 @@ discard block |
||
12 | 12 | $this->paramParts=array(); |
13 | 13 | } |
14 | 14 | |
15 | - protected function generateParamParts(){ |
|
15 | + protected function generateParamParts() { |
|
16 | 16 | $results=[]; |
17 | - foreach ($this->paramParts as $paramPart){ |
|
17 | + foreach ($this->paramParts as $paramPart) { |
|
18 | 18 | $results[]="{$this->uiName}(".\implode(",", $paramPart).")"; |
19 | 19 | } |
20 | 20 | return \implode(".", $results); |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | |
23 | 23 | public function getScript() { |
24 | 24 | $allParams=$this->params; |
25 | - $this->jquery_code_for_compile=array (); |
|
25 | + $this->jquery_code_for_compile=array(); |
|
26 | 26 | $paramParts=""; |
27 | - if(\sizeof($this->paramParts)>0){ |
|
27 | + if (\sizeof($this->paramParts)>0) { |
|
28 | 28 | $paramParts=".".$this->generateParamParts(); |
29 | 29 | } |
30 | 30 | $this->jquery_code_for_compile []="$( \"".$this->attachTo."\" ).{$this->uiName}(".$this->getParamsAsJSON($allParams).")".$paramParts.";"; |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | return $this; |
38 | 38 | } |
39 | 39 | |
40 | - public function addComponentEvent($event,$jsCode){ |
|
41 | - $jsCode=str_ireplace("\"","%quote%", $jsCode); |
|
40 | + public function addComponentEvent($event, $jsCode) { |
|
41 | + $jsCode=str_ireplace("\"", "%quote%", $jsCode); |
|
42 | 42 | return $this->setParam($event, "%function(){".$jsCode."}%"); |
43 | 43 | } |
44 | 44 |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * @version 1.001 |
8 | 8 | * Generates a JSON field validator |
9 | 9 | */ |
10 | -class FieldValidation implements \JsonSerializable{ |
|
10 | +class FieldValidation implements \JsonSerializable { |
|
11 | 11 | /** |
12 | 12 | * @var string |
13 | 13 | */ |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | protected $optional; |
26 | 26 | |
27 | - public function __construct($identifier){ |
|
27 | + public function __construct($identifier) { |
|
28 | 28 | $this->identifier=$identifier; |
29 | 29 | $this->rules=[]; |
30 | 30 | } |
@@ -42,20 +42,20 @@ discard block |
||
42 | 42 | return $this->rules; |
43 | 43 | } |
44 | 44 | |
45 | - public function addRule($type,$prompt=NULL,$value=NULL){ |
|
46 | - if($type instanceof Rule) |
|
45 | + public function addRule($type, $prompt=NULL, $value=NULL) { |
|
46 | + if ($type instanceof Rule) |
|
47 | 47 | $this->rules[]=$type; |
48 | - else if(\is_array($type)){ |
|
48 | + else if (\is_array($type)) { |
|
49 | 49 | $value=JArray::getValue($type, "value", 2); |
50 | 50 | $prompt=JArray::getValue($type, "prompt", 1); |
51 | 51 | $type=JArray::getValue($type, "type", 0); |
52 | - $this->rules[]=new Rule($type,$prompt,$value); |
|
53 | - }else |
|
54 | - $this->rules[]=new Rule($type,$prompt,$value); |
|
52 | + $this->rules[]=new Rule($type, $prompt, $value); |
|
53 | + } else |
|
54 | + $this->rules[]=new Rule($type, $prompt, $value); |
|
55 | 55 | } |
56 | 56 | |
57 | - public function jsonSerialize(){ |
|
58 | - return ["identifier"=>$this->identifier,"rules"=>$this->rules]; |
|
57 | + public function jsonSerialize() { |
|
58 | + return ["identifier"=>$this->identifier, "rules"=>$this->rules]; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | public function setDepends($depends) { |
@@ -6,19 +6,19 @@ |
||
6 | 6 | |
7 | 7 | abstract public function getDataField(); |
8 | 8 | abstract public function addToProperty($name, $value, $separator=" "); |
9 | - public function setPlaceholder($value){ |
|
9 | + public function setPlaceholder($value) { |
|
10 | 10 | $this->getDataField()->setPlaceholder($value); |
11 | 11 | return $this; |
12 | 12 | } |
13 | 13 | |
14 | - public function setValue($value){ |
|
14 | + public function setValue($value) { |
|
15 | 15 | $this->getDataField()->setValue($value); |
16 | 16 | return $this; |
17 | 17 | } |
18 | 18 | |
19 | - public function setInputType($type){ |
|
20 | - if($type==="hidden") |
|
21 | - $this->addToProperty("style","display:none;"); |
|
19 | + public function setInputType($type) { |
|
20 | + if ($type==="hidden") |
|
21 | + $this->addToProperty("style", "display:none;"); |
|
22 | 22 | $this->getDataField()->setInputType($type); |
23 | 23 | return $this; |
24 | 24 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @return HtmlModal |
87 | 87 | */ |
88 | 88 | public function htmlModal($identifier, $header="", $content="", $actions=array()) { |
89 | - return $this->addHtmlComponent(new HtmlModal($identifier, $header,$content,$actions)); |
|
89 | + return $this->addHtmlComponent(new HtmlModal($identifier, $header, $content, $actions)); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | * @param boolean $associative |
118 | 118 | * @return HtmlDropdown |
119 | 119 | */ |
120 | - public function htmlDropdown($identifier, $value="", $items=array(),$associative=true) { |
|
121 | - return $this->addHtmlComponent(new HtmlDropdown($identifier, $value, $items,$associative)); |
|
120 | + public function htmlDropdown($identifier, $value="", $items=array(), $associative=true) { |
|
121 | + return $this->addHtmlComponent(new HtmlDropdown($identifier, $value, $items, $associative)); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |