@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @param string $event |
22 | 22 | * @param boolean $multiple |
23 | 23 | */ |
24 | - public function __construct($table,$class="active",$event="click",$multiple=false){ |
|
24 | + public function __construct($table, $class="active", $event="click", $multiple=false) { |
|
25 | 25 | $this->table=$table; |
26 | 26 | $this->class=$class; |
27 | 27 | $this->event=$event; |
@@ -55,12 +55,12 @@ discard block |
||
55 | 55 | return $this; |
56 | 56 | } |
57 | 57 | |
58 | - public function compile(){ |
|
58 | + public function compile() { |
|
59 | 59 | $multiple=""; |
60 | - if(!$this->multiple){ |
|
60 | + if (!$this->multiple) { |
|
61 | 61 | $multiple="$(this).closest('tbody').children('tr').removeClass('".$this->class."');"; |
62 | 62 | } |
63 | - $this->table->onRow($this->event, $multiple."$(this).toggleClass('".$this->class."');",false,false); |
|
63 | + $this->table->onRow($this->event, $multiple."$(this).toggleClass('".$this->class."');", false, false); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | } |
67 | 67 | \ No newline at end of file |
@@ -21,7 +21,7 @@ |
||
21 | 21 | return $this->setParam("context", $value); |
22 | 22 | } |
23 | 23 | |
24 | - public function setOffset($offset=0){ |
|
24 | + public function setOffset($offset=0) { |
|
25 | 25 | return $this->setParam("offset", $offset); |
26 | 26 | } |
27 | 27 |
@@ -13,28 +13,28 @@ discard block |
||
13 | 13 | * @author jc |
14 | 14 | * |
15 | 15 | */ |
16 | -trait FormTrait{ |
|
16 | +trait FormTrait { |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * @return HtmlForm |
20 | 20 | */ |
21 | 21 | abstract protected function getForm(); |
22 | 22 | |
23 | - protected function addCompoValidation($compo,$field){ |
|
23 | + protected function addCompoValidation($compo, $field) { |
|
24 | 24 | $validation=$field->getValidation(); |
25 | - if(isset($validation)){ |
|
25 | + if (isset($validation)) { |
|
26 | 26 | $validation->setIdentifier($field->getDataField()->getIdentifier()); |
27 | 27 | $compo->addFieldValidation($validation); |
28 | 28 | } |
29 | 29 | return $compo; |
30 | 30 | } |
31 | 31 | |
32 | - protected function _runValidationParams(&$compo,JsUtils $js=NULL){ |
|
32 | + protected function _runValidationParams(&$compo, JsUtils $js=NULL) { |
|
33 | 33 | $form=$this->getForm(); |
34 | 34 | $params=$form->getValidationParams(); |
35 | - if(isset($params["_ajaxSubmit"]) && $params["_ajaxSubmit"] instanceof AjaxCall){ |
|
35 | + if (isset($params["_ajaxSubmit"]) && $params["_ajaxSubmit"] instanceof AjaxCall) { |
|
36 | 36 | $compilation=$params["_ajaxSubmit"]->compile($js); |
37 | - $compilation=str_ireplace("\"","%quote%", $compilation); |
|
37 | + $compilation=str_ireplace("\"", "%quote%", $compilation); |
|
38 | 38 | $this->onSuccess($compilation); |
39 | 39 | $form->removeValidationParam("_ajaxSubmit"); |
40 | 40 | } |
@@ -52,14 +52,14 @@ discard block |
||
52 | 52 | return $this; |
53 | 53 | } |
54 | 54 | |
55 | - public function setAttached($value=true){ |
|
55 | + public function setAttached($value=true) { |
|
56 | 56 | $form=$this->getForm(); |
57 | - if($value) |
|
58 | - $form->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
57 | + if ($value) |
|
58 | + $form->addToPropertyCtrl("class", "attached", array("attached")); |
|
59 | 59 | return $form; |
60 | 60 | } |
61 | 61 | |
62 | - public function addErrorMessage(){ |
|
62 | + public function addErrorMessage() { |
|
63 | 63 | return $this->getForm()->addContent((new HtmlMessage(""))->setError()); |
64 | 64 | } |
65 | 65 | |
@@ -75,41 +75,41 @@ discard block |
||
75 | 75 | * @param array $parameters |
76 | 76 | * @return HtmlForm |
77 | 77 | */ |
78 | - public function submitOn($event,$identifierOrElement,$url,$responseElement,$parameters=NULL){ |
|
78 | + public function submitOn($event, $identifierOrElement, $url, $responseElement, $parameters=NULL) { |
|
79 | 79 | $form=$this->getForm(); |
80 | - if($identifierOrElement instanceof BaseHtml) |
|
80 | + if ($identifierOrElement instanceof BaseHtml) |
|
81 | 81 | $elem=$identifierOrElement; |
82 | 82 | else |
83 | 83 | $elem=$form->getElementById($identifierOrElement, $form->getContent()); |
84 | - if(isset($elem)){ |
|
85 | - $this->_buttonAsSubmit($elem, $event,$url,$responseElement,$parameters); |
|
84 | + if (isset($elem)) { |
|
85 | + $this->_buttonAsSubmit($elem, $event, $url, $responseElement, $parameters); |
|
86 | 86 | } |
87 | 87 | return $form; |
88 | 88 | } |
89 | 89 | |
90 | - public function submitOnClick($identifier,$url,$responseElement,$parameters=NULL){ |
|
91 | - return $this->submitOn("click", $identifier, $url, $responseElement,$parameters); |
|
90 | + public function submitOnClick($identifier, $url, $responseElement, $parameters=NULL) { |
|
91 | + return $this->submitOn("click", $identifier, $url, $responseElement, $parameters); |
|
92 | 92 | } |
93 | 93 | |
94 | - public function addSubmit($identifier,$value,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$parameters=NULL){ |
|
95 | - $bt=$this->getForm()->addButton($identifier, $value,$cssStyle); |
|
96 | - return $this->_buttonAsSubmit($bt, "click",$url,$responseElement,$parameters); |
|
94 | + public function addSubmit($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $parameters=NULL) { |
|
95 | + $bt=$this->getForm()->addButton($identifier, $value, $cssStyle); |
|
96 | + return $this->_buttonAsSubmit($bt, "click", $url, $responseElement, $parameters); |
|
97 | 97 | } |
98 | 98 | |
99 | - protected function _buttonAsSubmit(BaseHtml &$button,$event,$url,$responseElement=NULL,$parameters=NULL){ |
|
99 | + protected function _buttonAsSubmit(BaseHtml&$button, $event, $url, $responseElement=NULL, $parameters=NULL) { |
|
100 | 100 | $form=$this->getForm(); |
101 | - if(isset($url) && isset($responseElement)){ |
|
102 | - $button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');",true,true); |
|
103 | - $params=["form"=>$form->getIdentifier(),"responseElement"=>$responseElement,"url"=>$url,"stopPropagation"=>true]; |
|
104 | - if(\is_array($parameters)) |
|
105 | - $params=\array_merge($params,$parameters); |
|
101 | + if (isset($url) && isset($responseElement)) { |
|
102 | + $button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');", true, true); |
|
103 | + $params=["form"=>$form->getIdentifier(), "responseElement"=>$responseElement, "url"=>$url, "stopPropagation"=>true]; |
|
104 | + if (\is_array($parameters)) |
|
105 | + $params=\array_merge($params, $parameters); |
|
106 | 106 | $form->addValidationParam("_ajaxSubmit", new AjaxCall("postForm", $params)); |
107 | 107 | } |
108 | 108 | return $button; |
109 | 109 | } |
110 | 110 | |
111 | - public function addReset($identifier,$value,$cssStyle=NULL){ |
|
112 | - $bt=$this->getForm()->addButton($identifier, $value,$cssStyle); |
|
111 | + public function addReset($identifier, $value, $cssStyle=NULL) { |
|
112 | + $bt=$this->getForm()->addButton($identifier, $value, $cssStyle); |
|
113 | 113 | $bt->setProperty("type", "reset"); |
114 | 114 | return $bt; |
115 | 115 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * @param string $jsCode |
120 | 120 | * @return \Ajax\semantic\html\collections\form\HtmlForm |
121 | 121 | */ |
122 | - public function onValid($jsCode){ |
|
122 | + public function onValid($jsCode) { |
|
123 | 123 | $form=$this->getForm(); |
124 | 124 | $form->addValidationParam("onValid", "%function(){".$jsCode."}%"); |
125 | 125 | return $form; |
@@ -130,9 +130,9 @@ discard block |
||
130 | 130 | * @param string $jsCode can use event and fields parameters |
131 | 131 | * @return HtmlForm |
132 | 132 | */ |
133 | - public function onSuccess($jsCode){ |
|
133 | + public function onSuccess($jsCode) { |
|
134 | 134 | $form=$this->getForm(); |
135 | - $form->addValidationParam("onSuccess", $jsCode,"%function(event,fields){","}%"); |
|
135 | + $form->addValidationParam("onSuccess", $jsCode, "%function(event,fields){", "}%"); |
|
136 | 136 | return $form; |
137 | 137 | } |
138 | 138 | } |
139 | 139 | \ No newline at end of file |
@@ -54,8 +54,9 @@ discard block |
||
54 | 54 | |
55 | 55 | public function setAttached($value=true){ |
56 | 56 | $form=$this->getForm(); |
57 | - if($value) |
|
58 | - $form->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
57 | + if($value) { |
|
58 | + $form->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
59 | + } |
|
59 | 60 | return $form; |
60 | 61 | } |
61 | 62 | |
@@ -77,10 +78,11 @@ discard block |
||
77 | 78 | */ |
78 | 79 | public function submitOn($event,$identifierOrElement,$url,$responseElement,$parameters=NULL){ |
79 | 80 | $form=$this->getForm(); |
80 | - if($identifierOrElement instanceof BaseHtml) |
|
81 | - $elem=$identifierOrElement; |
|
82 | - else |
|
83 | - $elem=$form->getElementById($identifierOrElement, $form->getContent()); |
|
81 | + if($identifierOrElement instanceof BaseHtml) { |
|
82 | + $elem=$identifierOrElement; |
|
83 | + } else { |
|
84 | + $elem=$form->getElementById($identifierOrElement, $form->getContent()); |
|
85 | + } |
|
84 | 86 | if(isset($elem)){ |
85 | 87 | $this->_buttonAsSubmit($elem, $event,$url,$responseElement,$parameters); |
86 | 88 | } |
@@ -101,8 +103,9 @@ discard block |
||
101 | 103 | if(isset($url) && isset($responseElement)){ |
102 | 104 | $button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');",true,true); |
103 | 105 | $params=["form"=>$form->getIdentifier(),"responseElement"=>$responseElement,"url"=>$url,"stopPropagation"=>true]; |
104 | - if(\is_array($parameters)) |
|
105 | - $params=\array_merge($params,$parameters); |
|
106 | + if(\is_array($parameters)) { |
|
107 | + $params=\array_merge($params,$parameters); |
|
108 | + } |
|
106 | 109 | $form->addValidationParam("_ajaxSubmit", new AjaxCall("postForm", $params)); |
107 | 110 | } |
108 | 111 | return $button; |
@@ -7,50 +7,50 @@ |
||
7 | 7 | |
8 | 8 | class HtmlSticky extends HtmlSemDoubleElement { |
9 | 9 | |
10 | - public function __construct($identifier,$context=NULL,$content=NULL) { |
|
10 | + public function __construct($identifier, $context=NULL, $content=NULL) { |
|
11 | 11 | parent::__construct($identifier, "div", "ui sticky", $content); |
12 | - if(isset($content)) |
|
12 | + if (isset($content)) |
|
13 | 13 | $this->setContext($context); |
14 | 14 | } |
15 | 15 | |
16 | - public function setContext($context){ |
|
16 | + public function setContext($context) { |
|
17 | 17 | $this->_params["context"]=$context; |
18 | 18 | return $this; |
19 | 19 | } |
20 | 20 | |
21 | - public function setFixed($value=NULL){ |
|
21 | + public function setFixed($value=NULL) { |
|
22 | 22 | $fixed="fixed"; |
23 | - if(isset($value)) |
|
23 | + if (isset($value)) |
|
24 | 24 | $fixed.=" ".$value; |
25 | - return $this->addToProperty("class",$fixed); |
|
25 | + return $this->addToProperty("class", $fixed); |
|
26 | 26 | } |
27 | 27 | |
28 | - public function setBound($value=NULL){ |
|
28 | + public function setBound($value=NULL) { |
|
29 | 29 | $bound="bound"; |
30 | - if(isset($value)) |
|
30 | + if (isset($value)) |
|
31 | 31 | $bound.=" ".$value; |
32 | - return $this->addToProperty("class",$bound); |
|
32 | + return $this->addToProperty("class", $bound); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
36 | 36 | * {@inheritDoc} |
37 | 37 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run() |
38 | 38 | */ |
39 | - public function run(JsUtils $js){ |
|
39 | + public function run(JsUtils $js) { |
|
40 | 40 | parent::run($js); |
41 | - return $js->semantic()->sticky("#".$this->identifier,$this->_params); |
|
41 | + return $js->semantic()->sticky("#".$this->identifier, $this->_params); |
|
42 | 42 | } |
43 | 43 | |
44 | - public function setOffset($offset=0){ |
|
44 | + public function setOffset($offset=0) { |
|
45 | 45 | $this->_params["offset"]=$offset; |
46 | 46 | return $this; |
47 | 47 | } |
48 | 48 | |
49 | 49 | |
50 | 50 | |
51 | - public function setDebug($verbose=NULL){ |
|
51 | + public function setDebug($verbose=NULL) { |
|
52 | 52 | $this->_params["debug"]=true; |
53 | - if(isset($verbose)) |
|
53 | + if (isset($verbose)) |
|
54 | 54 | $this->_params["verbose"]=true; |
55 | 55 | return $this; |
56 | 56 | } |
@@ -9,8 +9,9 @@ discard block |
||
9 | 9 | |
10 | 10 | public function __construct($identifier,$context=NULL,$content=NULL) { |
11 | 11 | parent::__construct($identifier, "div", "ui sticky", $content); |
12 | - if(isset($content)) |
|
13 | - $this->setContext($context); |
|
12 | + if(isset($content)) { |
|
13 | + $this->setContext($context); |
|
14 | + } |
|
14 | 15 | } |
15 | 16 | |
16 | 17 | public function setContext($context){ |
@@ -20,15 +21,17 @@ discard block |
||
20 | 21 | |
21 | 22 | public function setFixed($value=NULL){ |
22 | 23 | $fixed="fixed"; |
23 | - if(isset($value)) |
|
24 | - $fixed.=" ".$value; |
|
24 | + if(isset($value)) { |
|
25 | + $fixed.=" ".$value; |
|
26 | + } |
|
25 | 27 | return $this->addToProperty("class",$fixed); |
26 | 28 | } |
27 | 29 | |
28 | 30 | public function setBound($value=NULL){ |
29 | 31 | $bound="bound"; |
30 | - if(isset($value)) |
|
31 | - $bound.=" ".$value; |
|
32 | + if(isset($value)) { |
|
33 | + $bound.=" ".$value; |
|
34 | + } |
|
32 | 35 | return $this->addToProperty("class",$bound); |
33 | 36 | } |
34 | 37 | |
@@ -50,8 +53,9 @@ discard block |
||
50 | 53 | |
51 | 54 | public function setDebug($verbose=NULL){ |
52 | 55 | $this->_params["debug"]=true; |
53 | - if(isset($verbose)) |
|
54 | - $this->_params["verbose"]=true; |
|
56 | + if(isset($verbose)) { |
|
57 | + $this->_params["verbose"]=true; |
|
58 | + } |
|
55 | 59 | return $this; |
56 | 60 | } |
57 | 61 | } |
58 | 62 | \ No newline at end of file |
@@ -19,10 +19,10 @@ discard block |
||
19 | 19 | $this->setLabel($label); |
20 | 20 | } |
21 | 21 | |
22 | - public function setChecked($value=true){ |
|
23 | - if($value===true){ |
|
22 | + public function setChecked($value=true) { |
|
23 | + if ($value===true) { |
|
24 | 24 | $this->getField()->setProperty("checked", "checked"); |
25 | - }else{ |
|
25 | + } else { |
|
26 | 26 | $this->getField()->removeProperty("checked"); |
27 | 27 | } |
28 | 28 | return $this; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @return \Ajax\semantic\html\collections\form\AbstractHtmlFormRadioCheckbox |
85 | 85 | */ |
86 | 86 | public function attachEvent($selector, $action=NULL) { |
87 | - if (isset($action)||\is_numeric($action)===true) { |
|
87 | + if (isset($action) || \is_numeric($action)===true) { |
|
88 | 88 | $js='$("#%identifier%").checkbox("attach events", "'.$selector.'", "'.$action.'");'; |
89 | 89 | } else { |
90 | 90 | $js='$("#%identifier%").checkbox("attach events", "'.$selector.'");'; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function attachEvents($events=array()) { |
102 | 102 | if (\is_array($events)) { |
103 | - foreach ( $events as $action => $selector ) { |
|
103 | + foreach ($events as $action => $selector) { |
|
104 | 104 | $this->attachEvent($selector, $action); |
105 | 105 | } |
106 | 106 | } |
@@ -111,24 +111,24 @@ discard block |
||
111 | 111 | return $this->addToProperty("class", "fitted"); |
112 | 112 | } |
113 | 113 | |
114 | - public function setOnChecked($jsCode){ |
|
114 | + public function setOnChecked($jsCode) { |
|
115 | 115 | $this->_params["onChecked"]=$jsCode; |
116 | 116 | return $this; |
117 | 117 | } |
118 | 118 | |
119 | - public function setOnUnchecked($jsCode){ |
|
119 | + public function setOnUnchecked($jsCode) { |
|
120 | 120 | $this->_params["onUnchecked"]=$jsCode; |
121 | 121 | return $this; |
122 | 122 | } |
123 | 123 | |
124 | - public function setOnChange($jsCode){ |
|
124 | + public function setOnChange($jsCode) { |
|
125 | 125 | $this->_params["onChange"]=$jsCode; |
126 | 126 | return $this; |
127 | 127 | } |
128 | 128 | |
129 | 129 | public function run(JsUtils $js) { |
130 | - if(!isset($this->_bsComponent)) |
|
131 | - $this->_bsComponent=$js->semantic()->checkbox("#" . $this->identifier, $this->_params); |
|
130 | + if (!isset($this->_bsComponent)) |
|
131 | + $this->_bsComponent=$js->semantic()->checkbox("#".$this->identifier, $this->_params); |
|
132 | 132 | return parent::run($js); |
133 | 133 | } |
134 | 134 | } |
135 | 135 | \ No newline at end of file |
@@ -15,14 +15,15 @@ discard block |
||
15 | 15 | $field=new \Ajax\common\html\html5\HtmlInput($identifier, $inputType, $value); |
16 | 16 | $field->setProperty("name", $name); |
17 | 17 | $this->setField($field); |
18 | - if (isset($label)) |
|
19 | - $this->setLabel($label); |
|
18 | + if (isset($label)) { |
|
19 | + $this->setLabel($label); |
|
20 | + } |
|
20 | 21 | } |
21 | 22 | |
22 | 23 | public function setChecked($value=true){ |
23 | 24 | if($value===true){ |
24 | 25 | $this->getField()->setProperty("checked", "checked"); |
25 | - }else{ |
|
26 | + } else{ |
|
26 | 27 | $this->getField()->removeProperty("checked"); |
27 | 28 | } |
28 | 29 | return $this; |
@@ -51,8 +52,9 @@ discard block |
||
51 | 52 | * @return mixed |
52 | 53 | */ |
53 | 54 | public function getLabel() { |
54 | - if (\array_key_exists("label", $this->content)) |
|
55 | - return $this->content["label"]; |
|
55 | + if (\array_key_exists("label", $this->content)) { |
|
56 | + return $this->content["label"]; |
|
57 | + } |
|
56 | 58 | } |
57 | 59 | |
58 | 60 | /** |
@@ -127,8 +129,9 @@ discard block |
||
127 | 129 | } |
128 | 130 | |
129 | 131 | public function run(JsUtils $js) { |
130 | - if(!isset($this->_bsComponent)) |
|
131 | - $this->_bsComponent=$js->semantic()->checkbox("#" . $this->identifier, $this->_params); |
|
132 | + if(!isset($this->_bsComponent)) { |
|
133 | + $this->_bsComponent=$js->semantic()->checkbox("#" . $this->identifier, $this->_params); |
|
134 | + } |
|
132 | 135 | return parent::run($js); |
133 | 136 | } |
134 | 137 | } |
135 | 138 | \ No newline at end of file |