@@ -38,22 +38,22 @@ discard block |
||
38 | 38 | return $this->getHtmlCk()->attachEvents($events); |
39 | 39 | } |
40 | 40 | |
41 | - public function getField(){ |
|
41 | + public function getField() { |
|
42 | 42 | return $this->content["field"]; |
43 | 43 | } |
44 | 44 | |
45 | - public function getHtmlCk(){ |
|
45 | + public function getHtmlCk() { |
|
46 | 46 | return $this->content["field"]; |
47 | 47 | } |
48 | 48 | |
49 | - public function setName($name){ |
|
49 | + public function setName($name) { |
|
50 | 50 | $this->getDataField()->setProperty("name", $name); |
51 | 51 | return $this; |
52 | 52 | } |
53 | 53 | |
54 | - public function getDataField(){ |
|
55 | - $field= $this->getField(); |
|
56 | - if($field instanceof AbstractCheckbox) |
|
54 | + public function getDataField() { |
|
55 | + $field=$this->getField(); |
|
56 | + if ($field instanceof AbstractCheckbox) |
|
57 | 57 | $field=$field->getField(); |
58 | 58 | return $field; |
59 | 59 | } |
@@ -63,10 +63,10 @@ discard block |
||
63 | 63 | * @param boolean $value |
64 | 64 | * @return HtmlFormField |
65 | 65 | */ |
66 | - public function setChecked($value=true){ |
|
67 | - if($value===true){ |
|
66 | + public function setChecked($value=true) { |
|
67 | + if ($value===true) { |
|
68 | 68 | $this->getDataField()->setProperty("checked", "checked"); |
69 | - }else{ |
|
69 | + } else { |
|
70 | 70 | $this->getDataField()->removeProperty("checked"); |
71 | 71 | } |
72 | 72 | return $this; |
@@ -12,9 +12,9 @@ discard block |
||
12 | 12 | * @property string identifier |
13 | 13 | * @property BaseHtml _self |
14 | 14 | */ |
15 | -trait BaseHtmlEventsTrait{ |
|
15 | +trait BaseHtmlEventsTrait { |
|
16 | 16 | |
17 | - protected $_events=array (); |
|
17 | + protected $_events=array(); |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * @param string $event |
@@ -24,11 +24,11 @@ discard block |
||
24 | 24 | * @return BaseHtml |
25 | 25 | */ |
26 | 26 | public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
27 | - if ($stopPropagation === true) { |
|
28 | - $jsCode=Javascript::$stopPropagation . $jsCode; |
|
27 | + if ($stopPropagation===true) { |
|
28 | + $jsCode=Javascript::$stopPropagation.$jsCode; |
|
29 | 29 | } |
30 | - if ($preventDefault === true) { |
|
31 | - $jsCode=Javascript::$preventDefault . $jsCode; |
|
30 | + if ($preventDefault===true) { |
|
31 | + $jsCode=Javascript::$preventDefault.$jsCode; |
|
32 | 32 | } |
33 | 33 | return $this->_addEvent($event, $jsCode); |
34 | 34 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | if (\is_array($this->_events[$event])) { |
44 | 44 | $this->_events[$event][]=$jsCode; |
45 | 45 | } else { |
46 | - $this->_events[$event]=array ($this->_events[$event],$jsCode ); |
|
46 | + $this->_events[$event]=array($this->_events[$event], $jsCode); |
|
47 | 47 | } |
48 | 48 | } else { |
49 | 49 | $this->_events[$event]=$jsCode; |
@@ -70,10 +70,10 @@ discard block |
||
70 | 70 | return $this->onClick($jsCode); |
71 | 71 | } |
72 | 72 | |
73 | - public function onCreate($jsCode){ |
|
74 | - if(isset($this->_events["_create"])){ |
|
73 | + public function onCreate($jsCode) { |
|
74 | + if (isset($this->_events["_create"])) { |
|
75 | 75 | $this->_events["_create"][]=$jsCode; |
76 | - }else{ |
|
76 | + } else { |
|
77 | 77 | $this->_events["_create"]=[$jsCode]; |
78 | 78 | } |
79 | 79 | return $this; |
@@ -82,15 +82,15 @@ discard block |
||
82 | 82 | public function addEventsOnRun(JsUtils $js=NULL) { |
83 | 83 | $this->_eventsOnCreate($js); |
84 | 84 | if (isset($this->_bsComponent)) { |
85 | - foreach ( $this->_events as $event => $jsCode ) { |
|
85 | + foreach ($this->_events as $event => $jsCode) { |
|
86 | 86 | $code=$jsCode; |
87 | 87 | if (\is_array($jsCode)) { |
88 | 88 | $code=""; |
89 | - foreach ( $jsCode as $jsC ) { |
|
89 | + foreach ($jsCode as $jsC) { |
|
90 | 90 | if ($jsC instanceof AjaxCall) { |
91 | - $code.="\n" . $jsC->compile($js); |
|
91 | + $code.="\n".$jsC->compile($js); |
|
92 | 92 | } else { |
93 | - $code.="\n" . $jsC; |
|
93 | + $code.="\n".$jsC; |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | } elseif ($jsCode instanceof AjaxCall) { |
@@ -98,18 +98,18 @@ discard block |
||
98 | 98 | } |
99 | 99 | $this->_bsComponent->addEvent($event, $code); |
100 | 100 | } |
101 | - $this->_events=array (); |
|
101 | + $this->_events=array(); |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | |
105 | - protected function _eventsOnCreate(JsUtils $js=NULL){ |
|
106 | - if(isset($this->_events["_create"])){ |
|
105 | + protected function _eventsOnCreate(JsUtils $js=NULL) { |
|
106 | + if (isset($this->_events["_create"])) { |
|
107 | 107 | $create=$this->_events["_create"]; |
108 | - if(\is_array($create)){ |
|
108 | + if (\is_array($create)) { |
|
109 | 109 | $create=\implode("", $create); |
110 | 110 | } |
111 | - if(isset($js) && $create!=="") |
|
112 | - $js->exec($create,true); |
|
111 | + if (isset($js) && $create!=="") |
|
112 | + $js->exec($create, true); |
|
113 | 113 | unset($this->_events["_create"]); |
114 | 114 | } |
115 | 115 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * @return BaseHtml |
124 | 124 | */ |
125 | 125 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
126 | - $params=array ("url" => $url,"responseElement" => $responseElement ); |
|
126 | + $params=array("url" => $url, "responseElement" => $responseElement); |
|
127 | 127 | $params=array_merge($params, $parameters); |
128 | 128 | $this->_addEvent($event, new AjaxCall($operation, $params)); |
129 | 129 | return $this; |
@@ -139,10 +139,10 @@ discard block |
||
139 | 139 | |
140 | 140 | public function postOn($event, $url, $params="{}", $responseElement="", $parameters=array()) { |
141 | 141 | $allParameters=[]; |
142 | - if(isset($parameters["params"])){ |
|
142 | + if (isset($parameters["params"])) { |
|
143 | 143 | $allParameters[]=JsUtils::_correctParams($parameters["params"]); |
144 | 144 | } |
145 | - if(isset($params)){ |
|
145 | + if (isset($params)) { |
|
146 | 146 | $allParameters[]=JsUtils::_correctParams($params); |
147 | 147 | } |
148 | 148 | $parameters["params"]=\implode("+'&'+", $allParameters); |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | } |
164 | 164 | |
165 | 165 | public function jsDoJquery($jqueryCall, $param="") { |
166 | - return "$('#" . $this->identifier . "')." . $jqueryCall . "(" . Javascript::prep_value($param) . ");"; |
|
166 | + return "$('#".$this->identifier."').".$jqueryCall."(".Javascript::prep_value($param).");"; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | public function executeOnRun($jsCode) { |
@@ -183,6 +183,6 @@ discard block |
||
183 | 183 | } |
184 | 184 | |
185 | 185 | public function jsToggle($value) { |
186 | - return $this->jsDoJquery("toggle",$value); |
|
186 | + return $this->jsDoJquery("toggle", $value); |
|
187 | 187 | } |
188 | 188 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | abstract public function addToProperty($name, $value, $separator=" "); |
21 | 21 | abstract public function addLabel($caption, $style="label-default", $leftSeparator=" "); |
22 | - abstract public function addContent($content,$before=false); |
|
22 | + abstract public function addContent($content, $before=false); |
|
23 | 23 | abstract public function getField(); |
24 | 24 | abstract public function getDataField(); |
25 | 25 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | } |
29 | 29 | |
30 | 30 | public function addLoading() { |
31 | - if ($this->_hasIcon === false) { |
|
31 | + if ($this->_hasIcon===false) { |
|
32 | 32 | throw new \Exception("Input must have an icon for showing a loader, use addIcon before"); |
33 | 33 | } |
34 | 34 | return $this->addToProperty("class", State::LOADING); |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function labeled($label, $direction=Direction::LEFT, $icon=NULL) { |
44 | 44 | $field=$this->getField(); |
45 | - $labelO=$field->addLabel($label,$direction===Direction::LEFT,$icon); |
|
46 | - $field->addToProperty("class", $direction . " labeled"); |
|
45 | + $labelO=$field->addLabel($label, $direction===Direction::LEFT, $icon); |
|
46 | + $field->addToProperty("class", $direction." labeled"); |
|
47 | 47 | return $labelO; |
48 | 48 | } |
49 | 49 | |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | * @param string $checkboxType |
55 | 55 | * @return HtmlLabel |
56 | 56 | */ |
57 | - public function labeledCheckbox($direction=Direction::LEFT,$caption="",$value=NULL,$checkboxType=NULL){ |
|
58 | - return $this->labeled(new HtmlCheckbox("lbl-ck-".$this->getField()->getIdentifier(),$caption,$value,$checkboxType),$direction); |
|
57 | + public function labeledCheckbox($direction=Direction::LEFT, $caption="", $value=NULL, $checkboxType=NULL) { |
|
58 | + return $this->labeled(new HtmlCheckbox("lbl-ck-".$this->getField()->getIdentifier(), $caption, $value, $checkboxType), $direction); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @return HtmlLabel |
65 | 65 | */ |
66 | 66 | public function labeledToCorner($icon, $direction=Direction::LEFT) { |
67 | - return $this->labeled("", $direction . " corner", $icon)->toCorner($direction); |
|
67 | + return $this->labeled("", $direction." corner", $icon)->toCorner($direction); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -77,13 +77,13 @@ discard block |
||
77 | 77 | public function addAction($action, $direction=Direction::RIGHT, $icon=NULL, $labeled=false) { |
78 | 78 | $field=$this->getField(); |
79 | 79 | $actionO=$action; |
80 | - if (\is_object($action) === false) { |
|
81 | - $actionO=new HtmlButton("action-" . $this->identifier, $action); |
|
80 | + if (\is_object($action)===false) { |
|
81 | + $actionO=new HtmlButton("action-".$this->identifier, $action); |
|
82 | 82 | if (isset($icon)) |
83 | 83 | $actionO->addIcon($icon, true, $labeled); |
84 | 84 | } |
85 | - $field->addToProperty("class", $direction . " action"); |
|
86 | - $field->addContent($actionO, \strstr($direction, Direction::LEFT) !== false); |
|
85 | + $field->addToProperty("class", $direction." action"); |
|
86 | + $field->addContent($actionO, \strstr($direction, Direction::LEFT)!==false); |
|
87 | 87 | return $actionO; |
88 | 88 | } |
89 | 89 | |
@@ -93,34 +93,34 @@ discard block |
||
93 | 93 | * @param string $direction |
94 | 94 | * @return HtmlLabel |
95 | 95 | */ |
96 | - public function addDropdown($label="", $items=array(),$direction=Direction::RIGHT){ |
|
97 | - $labelO=new HtmlDropdown("dd-".$this->identifier,$label,$items); |
|
98 | - $labelO->asSelect("select-".$this->identifier,false,true); |
|
99 | - return $this->labeled($labelO,$direction); |
|
96 | + public function addDropdown($label="", $items=array(), $direction=Direction::RIGHT) { |
|
97 | + $labelO=new HtmlDropdown("dd-".$this->identifier, $label, $items); |
|
98 | + $labelO->asSelect("select-".$this->identifier, false, true); |
|
99 | + return $this->labeled($labelO, $direction); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | public function setTransparent() { |
103 | 103 | return $this->getField()->addToProperty("class", "transparent"); |
104 | 104 | } |
105 | 105 | |
106 | - public function setReadonly(){ |
|
106 | + public function setReadonly() { |
|
107 | 107 | $this->getDataField()->setProperty("readonly", ""); |
108 | 108 | return $this; |
109 | 109 | } |
110 | 110 | |
111 | - public function setName($name){ |
|
112 | - $this->getDataField()->setProperty("name",$name); |
|
111 | + public function setName($name) { |
|
112 | + $this->getDataField()->setProperty("name", $name); |
|
113 | 113 | return $this; |
114 | 114 | } |
115 | 115 | |
116 | - public function setFluid(){ |
|
117 | - $this->getField()->addToProperty("class","fluid"); |
|
116 | + public function setFluid() { |
|
117 | + $this->getField()->addToProperty("class", "fluid"); |
|
118 | 118 | return $this; |
119 | 119 | } |
120 | 120 | |
121 | 121 | public function setDisabled($disable=true) { |
122 | 122 | $field=$this->getField(); |
123 | - if($disable) |
|
123 | + if ($disable) |
|
124 | 124 | $field->addToProperty("class", "disabled"); |
125 | 125 | return $this; |
126 | 126 | } |
@@ -14,19 +14,19 @@ discard block |
||
14 | 14 | * @property boolean $_visibleHover |
15 | 15 | * @property InstanceViewer $_instanceViewer |
16 | 16 | */ |
17 | -trait DataTableFieldAsTrait{ |
|
17 | +trait DataTableFieldAsTrait { |
|
18 | 18 | abstract public function addField($field); |
19 | - abstract public function insertField($index,$field); |
|
20 | - abstract public function insertInField($index,$field); |
|
21 | - abstract public function fieldAs($index,$type,$attributes=NULL); |
|
19 | + abstract public function insertField($index, $field); |
|
20 | + abstract public function insertInField($index, $field); |
|
21 | + abstract public function fieldAs($index, $type, $attributes=NULL); |
|
22 | 22 | /** |
23 | 23 | * @param string $caption |
24 | 24 | * @param callable $callback |
25 | 25 | * @param boolean $visibleHover |
26 | 26 | * @return callable |
27 | 27 | */ |
28 | - private function getFieldButtonCallable($caption,$visibleHover=true,$callback=null){ |
|
29 | - return $this->getCallable("getFieldButton",[$caption,$visibleHover],$callback); |
|
28 | + private function getFieldButtonCallable($caption, $visibleHover=true, $callback=null) { |
|
29 | + return $this->getCallable("getFieldButton", [$caption, $visibleHover], $callback); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -35,20 +35,20 @@ discard block |
||
35 | 35 | * @param callable $callback |
36 | 36 | * @return callable |
37 | 37 | */ |
38 | - private function getCallable($thisCallback,$parameters,$callback=null){ |
|
39 | - $result=function($instance) use($thisCallback,$parameters,$callback){ |
|
40 | - $object=call_user_func_array(array($this,$thisCallback), $parameters); |
|
41 | - if(isset($callback)){ |
|
42 | - if(\is_callable($callback)){ |
|
43 | - $callback($object,$instance,$this->_instanceViewer->count()+1); |
|
38 | + private function getCallable($thisCallback, $parameters, $callback=null) { |
|
39 | + $result=function($instance) use($thisCallback, $parameters, $callback){ |
|
40 | + $object=call_user_func_array(array($this, $thisCallback), $parameters); |
|
41 | + if (isset($callback)) { |
|
42 | + if (\is_callable($callback)) { |
|
43 | + $callback($object, $instance, $this->_instanceViewer->count()+1); |
|
44 | 44 | } |
45 | 45 | } |
46 | - if($object instanceof HtmlSemDoubleElement){ |
|
46 | + if ($object instanceof HtmlSemDoubleElement) { |
|
47 | 47 | $id=$this->_instanceViewer->getIdentifier(); |
48 | - $object->setProperty("data-ajax",$id); |
|
49 | - if($object->propertyContains("class","visibleover")){ |
|
48 | + $object->setProperty("data-ajax", $id); |
|
49 | + if ($object->propertyContains("class", "visibleover")) { |
|
50 | 50 | $this->_visibleHover=true; |
51 | - $object->setProperty("style","visibility:hidden;"); |
|
51 | + $object->setProperty("style", "visibility:hidden;"); |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | return $object; |
@@ -60,16 +60,16 @@ discard block |
||
60 | 60 | * @param string $caption |
61 | 61 | * @return HtmlButton |
62 | 62 | */ |
63 | - private function getFieldButton($caption,$visibleHover=true){ |
|
64 | - $bt= new HtmlButton($this->cleanIdentifier($caption),$caption); |
|
65 | - if($visibleHover) |
|
63 | + private function getFieldButton($caption, $visibleHover=true) { |
|
64 | + $bt=new HtmlButton($this->cleanIdentifier($caption), $caption); |
|
65 | + if ($visibleHover) |
|
66 | 66 | $this->_visibleOver($bt); |
67 | 67 | return $bt; |
68 | 68 | } |
69 | 69 | |
70 | - private function getFieldButtons($buttons,$visibleHover=true){ |
|
71 | - $bts=new HtmlButtonGroups("",$buttons); |
|
72 | - if($visibleHover) |
|
70 | + private function getFieldButtons($buttons, $visibleHover=true) { |
|
71 | + $bts=new HtmlButtonGroups("", $buttons); |
|
72 | + if ($visibleHover) |
|
73 | 73 | $this->_visibleOver($bts); |
74 | 74 | return $bts; |
75 | 75 | } |
@@ -83,19 +83,19 @@ discard block |
||
83 | 83 | * @param array $attributes associative array (<b>ajax</b> key is for ajax post) |
84 | 84 | * @return DataTable |
85 | 85 | */ |
86 | - public function fieldAsSubmit($index,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$attributes=NULL){ |
|
87 | - return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$index,$attributes){ |
|
88 | - $button=new HtmlButton($id,$value,$cssStyle); |
|
89 | - $button->postOnClick($url,"$(event.target).closest('tr').find(':input').serialize()",$responseElement,$attributes["ajax"]); |
|
90 | - if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"]) |
|
86 | + public function fieldAsSubmit($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL) { |
|
87 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle, $index, $attributes){ |
|
88 | + $button=new HtmlButton($id, $value, $cssStyle); |
|
89 | + $button->postOnClick($url, "$(event.target).closest('tr').find(':input').serialize()", $responseElement, $attributes["ajax"]); |
|
90 | + if (!isset($attributes["visibleHover"]) || $attributes["visibleHover"]) |
|
91 | 91 | $this->_visibleOver($button); |
92 | 92 | return $button; |
93 | - }, $index,$attributes); |
|
93 | + }, $index, $attributes); |
|
94 | 94 | } |
95 | 95 | |
96 | - protected function _visibleOver(BaseHtml $element){ |
|
96 | + protected function _visibleOver(BaseHtml $element) { |
|
97 | 97 | $this->_visibleHover=true; |
98 | - return $element->addToProperty("class", "visibleover")->setProperty("style","visibility:hidden;"); |
|
98 | + return $element->addToProperty("class", "visibleover")->setProperty("style", "visibility:hidden;"); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | * @param boolean $visibleHover |
106 | 106 | * @return DataTable |
107 | 107 | */ |
108 | - public function addFieldButton($caption,$visibleHover=true,$callback=null){ |
|
109 | - $this->addField($this->getCallable("getFieldButton",[$caption,$visibleHover],$callback)); |
|
108 | + public function addFieldButton($caption, $visibleHover=true, $callback=null) { |
|
109 | + $this->addField($this->getCallable("getFieldButton", [$caption, $visibleHover], $callback)); |
|
110 | 110 | return $this; |
111 | 111 | } |
112 | 112 | |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | * @param boolean $visibleHover |
118 | 118 | * @return DataTable |
119 | 119 | */ |
120 | - public function addFieldButtons($buttons,$visibleHover=true,$callback=null){ |
|
121 | - $this->addField($this->getCallable("getFieldButtons",[$buttons,$visibleHover],$callback)); |
|
120 | + public function addFieldButtons($buttons, $visibleHover=true, $callback=null) { |
|
121 | + $this->addField($this->getCallable("getFieldButtons", [$buttons, $visibleHover], $callback)); |
|
122 | 122 | return $this; |
123 | 123 | } |
124 | 124 | |
@@ -129,8 +129,8 @@ discard block |
||
129 | 129 | * @param callable $callback |
130 | 130 | * @return DataTable |
131 | 131 | */ |
132 | - public function insertFieldButton($index,$caption,$visibleHover=true,$callback=null){ |
|
133 | - $this->insertField($index, $this->getFieldButtonCallable($caption,$visibleHover,$callback)); |
|
132 | + public function insertFieldButton($index, $caption, $visibleHover=true, $callback=null) { |
|
133 | + $this->insertField($index, $this->getFieldButtonCallable($caption, $visibleHover, $callback)); |
|
134 | 134 | return $this; |
135 | 135 | } |
136 | 136 | |
@@ -141,25 +141,25 @@ discard block |
||
141 | 141 | * @param callable $callback |
142 | 142 | * @return DataTable |
143 | 143 | */ |
144 | - public function insertInFieldButton($index,$caption,$visibleHover=true,$callback=null){ |
|
145 | - $this->insertInField($index, $this->getFieldButtonCallable($caption,$visibleHover,$callback)); |
|
144 | + public function insertInFieldButton($index, $caption, $visibleHover=true, $callback=null) { |
|
145 | + $this->insertInField($index, $this->getFieldButtonCallable($caption, $visibleHover, $callback)); |
|
146 | 146 | return $this; |
147 | 147 | } |
148 | 148 | |
149 | - private function addDefaultButton($icon,$class=null,$visibleHover=true,$callback=null){ |
|
150 | - $this->addField($this->getCallable("getDefaultButton",[$icon,$class,$visibleHover],$callback)); |
|
149 | + private function addDefaultButton($icon, $class=null, $visibleHover=true, $callback=null) { |
|
150 | + $this->addField($this->getCallable("getDefaultButton", [$icon, $class, $visibleHover], $callback)); |
|
151 | 151 | return $this; |
152 | 152 | } |
153 | 153 | |
154 | - private function insertDefaultButtonIn($index,$icon,$class=null,$visibleHover=true,$callback=null){ |
|
155 | - $this->insertInField($index,$this->getCallable("getDefaultButton",[$icon,$class,$visibleHover],$callback)); |
|
154 | + private function insertDefaultButtonIn($index, $icon, $class=null, $visibleHover=true, $callback=null) { |
|
155 | + $this->insertInField($index, $this->getCallable("getDefaultButton", [$icon, $class, $visibleHover], $callback)); |
|
156 | 156 | return $this; |
157 | 157 | } |
158 | 158 | |
159 | - private function getDefaultButton($icon,$class=null,$visibleHover=true){ |
|
160 | - $bt=$this->getFieldButton("",$visibleHover); |
|
159 | + private function getDefaultButton($icon, $class=null, $visibleHover=true) { |
|
160 | + $bt=$this->getFieldButton("", $visibleHover); |
|
161 | 161 | $bt->asIcon($icon); |
162 | - if(isset($class)) |
|
162 | + if (isset($class)) |
|
163 | 163 | $bt->addClass($class); |
164 | 164 | return $bt; |
165 | 165 | } |
@@ -171,9 +171,9 @@ discard block |
||
171 | 171 | * @param callable $callback this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object |
172 | 172 | * @return DataTable |
173 | 173 | */ |
174 | - public function addDeleteButton($visibleHover=true,$deleteBehavior=[],$callback=null){ |
|
174 | + public function addDeleteButton($visibleHover=true, $deleteBehavior=[], $callback=null) { |
|
175 | 175 | $this->_deleteBehavior=$deleteBehavior; |
176 | - return $this->addDefaultButton("remove","_delete red basic",$visibleHover,$callback); |
|
176 | + return $this->addDefaultButton("remove", "_delete red basic", $visibleHover, $callback); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
@@ -183,9 +183,9 @@ discard block |
||
183 | 183 | * @param callable $callback this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object |
184 | 184 | * @return DataTable |
185 | 185 | */ |
186 | - public function addEditButton($visibleHover=true,$editBehavior=[],$callback=null){ |
|
186 | + public function addEditButton($visibleHover=true, $editBehavior=[], $callback=null) { |
|
187 | 187 | $this->_editBehavior=$editBehavior; |
188 | - return $this->addDefaultButton("edit","_edit basic",$visibleHover,$callback); |
|
188 | + return $this->addDefaultButton("edit", "_edit basic", $visibleHover, $callback); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | /** |
@@ -196,20 +196,20 @@ discard block |
||
196 | 196 | * @param callable $callbackDelete this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object |
197 | 197 | * @return DataTable |
198 | 198 | */ |
199 | - public function addEditDeleteButtons($visibleHover=true,$behavior=[],$callbackEdit=null,$callbackDelete=null){ |
|
200 | - $this->addEditButton($visibleHover,$behavior,$callbackEdit); |
|
199 | + public function addEditDeleteButtons($visibleHover=true, $behavior=[], $callbackEdit=null, $callbackDelete=null) { |
|
200 | + $this->addEditButton($visibleHover, $behavior, $callbackEdit); |
|
201 | 201 | $index=$this->_instanceViewer->visiblePropertiesCount()-1; |
202 | - $this->insertDeleteButtonIn($index,$visibleHover,$behavior,$callbackDelete); |
|
202 | + $this->insertDeleteButtonIn($index, $visibleHover, $behavior, $callbackDelete); |
|
203 | 203 | return $this; |
204 | 204 | } |
205 | 205 | |
206 | - public function insertDeleteButtonIn($index,$visibleHover=true,$deleteBehavior=[],$callback=null){ |
|
206 | + public function insertDeleteButtonIn($index, $visibleHover=true, $deleteBehavior=[], $callback=null) { |
|
207 | 207 | $this->_deleteBehavior=$deleteBehavior; |
208 | - return $this->insertDefaultButtonIn($index,"remove","_delete red basic",$visibleHover,$callback); |
|
208 | + return $this->insertDefaultButtonIn($index, "remove", "_delete red basic", $visibleHover, $callback); |
|
209 | 209 | } |
210 | 210 | |
211 | - public function insertEditButtonIn($index,$visibleHover=true,$editBehavior=[],$callback=null){ |
|
211 | + public function insertEditButtonIn($index, $visibleHover=true, $editBehavior=[], $callback=null) { |
|
212 | 212 | $this->_editBehavior=$editBehavior; |
213 | - return $this->insertDefaultButtonIn($index,"edit","_edit basic",$visibleHover,$callback); |
|
213 | + return $this->insertDefaultButtonIn($index, "edit", "_edit basic", $visibleHover, $callback); |
|
214 | 214 | } |
215 | 215 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | use BaseTrait; |
23 | 23 | protected $_popup=NULL; |
24 | 24 | protected $_dimmer=NULL; |
25 | - protected $_params=array (); |
|
25 | + protected $_params=array(); |
|
26 | 26 | |
27 | 27 | |
28 | 28 | public function __construct($identifier, $tagName="p", $baseClass="ui", $content=NULL) { |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @return HtmlDimmer |
79 | 79 | */ |
80 | 80 | public function addDimmer($params=array(), $content=NULL) { |
81 | - $dimmer=new HtmlDimmer("dimmer-" . $this->identifier, $content); |
|
81 | + $dimmer=new HtmlDimmer("dimmer-".$this->identifier, $content); |
|
82 | 82 | $dimmer->setParams($params); |
83 | 83 | $dimmer->setContainer($this); |
84 | 84 | $this->addContent($dimmer); |
@@ -94,12 +94,12 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function addLabel($label, $before=false, $icon=NULL) { |
96 | 96 | $labelO=$label; |
97 | - if (\is_object($label) === false) { |
|
98 | - $labelO=new HtmlLabel("label-" . $this->identifier, $label); |
|
97 | + if (\is_object($label)===false) { |
|
98 | + $labelO=new HtmlLabel("label-".$this->identifier, $label); |
|
99 | 99 | if (isset($icon)) |
100 | 100 | $labelO->addIcon($icon); |
101 | 101 | } else { |
102 | - $labelO->addToPropertyCtrl("class", "label", array ("label" )); |
|
102 | + $labelO->addToPropertyCtrl("class", "label", array("label")); |
|
103 | 103 | } |
104 | 104 | $this->addContent($labelO, $before); |
105 | 105 | return $labelO; |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | * @param string $icon |
114 | 114 | * @return HtmlSemDoubleElement |
115 | 115 | */ |
116 | - public function attachLabel($label,$side=Side::TOP,$direction=Direction::NONE,$icon=NULL){ |
|
117 | - $label=$this->addLabel($label,true,$icon); |
|
118 | - $label->setAttached($side,$direction); |
|
116 | + public function attachLabel($label, $side=Side::TOP, $direction=Direction::NONE, $icon=NULL) { |
|
117 | + $label=$this->addLabel($label, true, $icon); |
|
118 | + $label->setAttached($side, $direction); |
|
119 | 119 | return $this; |
120 | 120 | } |
121 | 121 | |
@@ -123,10 +123,10 @@ discard block |
||
123 | 123 | * Transforms the element into a link |
124 | 124 | * @return HtmlSemDoubleElement |
125 | 125 | */ |
126 | - public function asLink($href=NULL,$target=NULL) { |
|
126 | + public function asLink($href=NULL, $target=NULL) { |
|
127 | 127 | if (isset($href)) |
128 | 128 | $this->setProperty("href", $href); |
129 | - if(isset($target)) |
|
129 | + if (isset($target)) |
|
130 | 130 | $this->setProperty("target", $target); |
131 | 131 | return $this->setTagName("a"); |
132 | 132 | } |
@@ -138,9 +138,9 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function jsShowDimmer($show=true) { |
140 | 140 | $status="hide"; |
141 | - if ($show === true) |
|
141 | + if ($show===true) |
|
142 | 142 | $status="show"; |
143 | - return '$("#.' . $this->identifier . ').dimmer("' . $status . '");'; |
|
143 | + return '$("#.'.$this->identifier.').dimmer("'.$status.'");'; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * @see HtmlDoubleElement::run() |
159 | 159 | */ |
160 | 160 | public function run(JsUtils $js) { |
161 | - $this->_bsComponent=$js->semantic()->generic("#" . $this->identifier); |
|
161 | + $this->_bsComponent=$js->semantic()->generic("#".$this->identifier); |
|
162 | 162 | parent::run($js); |
163 | 163 | $this->addEventsOnRun($js); |
164 | 164 | if (isset($this->_popup)) { |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | return $this->_bsComponent; |
168 | 168 | } |
169 | 169 | |
170 | - public function addList($items,$ordered=false){ |
|
171 | - $list=new HtmlList("list-".$this->identifier,$items); |
|
170 | + public function addList($items, $ordered=false) { |
|
171 | + $list=new HtmlList("list-".$this->identifier, $items); |
|
172 | 172 | $list->setOrdered($ordered); |
173 | 173 | $list->setClass("ui list"); |
174 | 174 | $this->addContent($list); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | private function addFunction($jsCode) { |
18 | 18 | if (!Text::startsWith($jsCode, "function")) |
19 | - $jsCode="%function(){" . $jsCode . "}%"; |
|
19 | + $jsCode="%function(){".$jsCode."}%"; |
|
20 | 20 | return $jsCode; |
21 | 21 | } |
22 | 22 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @param array $parameters default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null) |
52 | 52 | * @return DialogButton |
53 | 53 | */ |
54 | - public static function submitButton(JsUtils $js, $url, $form, $responseElement, $caption="Okay",$parameters=[]) { |
|
55 | - return new DialogButton($caption, $js->postFormDeferred($url, $form, $responseElement,$parameters) . ";$( this ).dialog( 'close' );"); |
|
54 | + public static function submitButton(JsUtils $js, $url, $form, $responseElement, $caption="Okay", $parameters=[]) { |
|
55 | + return new DialogButton($caption, $js->postFormDeferred($url, $form, $responseElement, $parameters).";$( this ).dialog( 'close' );"); |
|
56 | 56 | } |
57 | 57 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | $icon=JArray::getValue($value, "icon", 0); |
28 | 28 | $size=JArray::getValue($value, "size", 1); |
29 | 29 | } |
30 | - $iconO=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
30 | + $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
|
31 | 31 | if (isset($size)) { |
32 | 32 | $iconO->setSize($size); |
33 | 33 | } |
@@ -35,15 +35,15 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | protected function createCondition($value) { |
38 | - return ($value instanceof HtmlIcon) === false; |
|
38 | + return ($value instanceof HtmlIcon)===false; |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | public function getIcon($index) { |
42 | 42 | return $this->content[$index]; |
43 | 43 | } |
44 | 44 | |
45 | - public function run(JsUtils $js){ |
|
46 | - $result= parent::run($js); |
|
45 | + public function run(JsUtils $js) { |
|
46 | + $result=parent::run($js); |
|
47 | 47 | return $result->setItemSelector("i"); |
48 | 48 | } |
49 | 49 | |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | return $this; |
53 | 53 | } |
54 | 54 | |
55 | - public static function corner($mainIcon,$cornerIcon,$size="huge"){ |
|
56 | - $icons=new HtmlIconGroups("icons",[$mainIcon,$cornerIcon],$size); |
|
55 | + public static function corner($mainIcon, $cornerIcon, $size="huge") { |
|
56 | + $icons=new HtmlIconGroups("icons", [$mainIcon, $cornerIcon], $size); |
|
57 | 57 | return $icons->toCorner(1); |
58 | 58 | } |
59 | 59 | } |
@@ -7,29 +7,29 @@ discard block |
||
7 | 7 | |
8 | 8 | class HtmlFormDropdown extends HtmlFormField { |
9 | 9 | |
10 | - public function __construct($identifier,$items=array(), $label=NULL,$value="",$multiple=false,$associative=true) { |
|
11 | - parent::__construct("field-".$identifier, (new HtmlDropdown("dropdown-".$identifier,$value,$items,$associative))->asSelect($identifier,$multiple), $label); |
|
10 | + public function __construct($identifier, $items=array(), $label=NULL, $value="", $multiple=false, $associative=true) { |
|
11 | + parent::__construct("field-".$identifier, (new HtmlDropdown("dropdown-".$identifier, $value, $items, $associative))->asSelect($identifier, $multiple), $label); |
|
12 | 12 | $this->_identifier=$identifier; |
13 | 13 | } |
14 | 14 | |
15 | - public function setItems($items){ |
|
15 | + public function setItems($items) { |
|
16 | 16 | return $this->getField()->setItems($items); |
17 | 17 | } |
18 | - public function addItem($item,$value=NULL,$image=NULL){ |
|
19 | - return $this->getField()->addItem($item,$value,$image); |
|
18 | + public function addItem($item, $value=NULL, $image=NULL) { |
|
19 | + return $this->getField()->addItem($item, $value, $image); |
|
20 | 20 | } |
21 | - public static function multipleDropdown($identifier,$items=array(), $label=NULL,$value="",$associative=true){ |
|
22 | - return new HtmlFormDropdown($identifier,$items,$label,$value,true,$associative); |
|
21 | + public static function multipleDropdown($identifier, $items=array(), $label=NULL, $value="", $associative=true) { |
|
22 | + return new HtmlFormDropdown($identifier, $items, $label, $value, true, $associative); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
26 | 26 | * @return HtmlDropdown |
27 | 27 | */ |
28 | - public function getDataField(){ |
|
28 | + public function getDataField() { |
|
29 | 29 | return $this->getField()->getInput(); |
30 | 30 | } |
31 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
32 | - $this->getField()->asSelect($name,$multiple,$selection); |
|
31 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
32 | + $this->getField()->asSelect($name, $multiple, $selection); |
|
33 | 33 | return $this; |
34 | 34 | } |
35 | 35 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @param boolean $floating |
38 | 38 | * @return HtmlDropdown |
39 | 39 | */ |
40 | - public function asButton($floating=false){ |
|
40 | + public function asButton($floating=false) { |
|
41 | 41 | $field=$this->content["field"]; |
42 | 42 | $label=$this->content["label"]; |
43 | 43 | $field->addContent($label); |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * @version 1.001 |
16 | 16 | */ |
17 | 17 | class HtmlMessage extends HtmlSemDoubleElement { |
18 | - use AttachedTrait,HasTimeoutTrait; |
|
18 | + use AttachedTrait, HasTimeoutTrait; |
|
19 | 19 | protected $icon; |
20 | 20 | protected $close; |
21 | 21 | |
@@ -32,39 +32,39 @@ discard block |
||
32 | 32 | * @param string|HtmlSemDoubleElement $header |
33 | 33 | * @return \Ajax\semantic\html\collections\HtmlMessage |
34 | 34 | */ |
35 | - public function addHeader($header){ |
|
35 | + public function addHeader($header) { |
|
36 | 36 | $headerO=$header; |
37 | - if(\is_string($header)){ |
|
38 | - $headerO=new HtmlSemDoubleElement("header-".$this->identifier,"div"); |
|
37 | + if (\is_string($header)) { |
|
38 | + $headerO=new HtmlSemDoubleElement("header-".$this->identifier, "div"); |
|
39 | 39 | $headerO->setClass("header"); |
40 | 40 | $headerO->setContent($header); |
41 | 41 | } |
42 | - return $this->addContent($headerO,true); |
|
42 | + return $this->addContent($headerO, true); |
|
43 | 43 | } |
44 | 44 | |
45 | - public function setHeader($header){ |
|
45 | + public function setHeader($header) { |
|
46 | 46 | return $this->addHeader($header); |
47 | 47 | } |
48 | 48 | |
49 | - public function setIcon($icon){ |
|
49 | + public function setIcon($icon) { |
|
50 | 50 | $this->addToProperty("class", "icon"); |
51 | - $this->wrapContent("<div class='content'>","</div>"); |
|
52 | - if(\is_string($icon)){ |
|
51 | + $this->wrapContent("<div class='content'>", "</div>"); |
|
52 | + if (\is_string($icon)) { |
|
53 | 53 | $this->icon=new HtmlIcon("icon-".$this->identifier, $icon); |
54 | - }else{ |
|
54 | + } else { |
|
55 | 55 | $this->icon=$icon; |
56 | 56 | } |
57 | 57 | return $this; |
58 | 58 | } |
59 | 59 | |
60 | - public function addLoader($loaderIcon="notched circle"){ |
|
60 | + public function addLoader($loaderIcon="notched circle") { |
|
61 | 61 | $this->setIcon($loaderIcon); |
62 | 62 | $this->icon->addToIcon("loading"); |
63 | 63 | return $this; |
64 | 64 | } |
65 | 65 | |
66 | - public function setDismissable($dismiss=true){ |
|
67 | - if($dismiss===true) |
|
66 | + public function setDismissable($dismiss=true) { |
|
67 | + if ($dismiss===true) |
|
68 | 68 | $this->close=new HtmlIcon("close-".$this->identifier, "close"); |
69 | 69 | else |
70 | 70 | $this->close=NULL; |
@@ -75,43 +75,43 @@ discard block |
||
75 | 75 | * {@inheritDoc} |
76 | 76 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run() |
77 | 77 | */ |
78 | - public function run(JsUtils $js){ |
|
79 | - if(!isset($this->_bsComponent)){ |
|
80 | - if(isset($this->close)){ |
|
78 | + public function run(JsUtils $js) { |
|
79 | + if (!isset($this->_bsComponent)) { |
|
80 | + if (isset($this->close)) { |
|
81 | 81 | $js->execOn("click", "#".$this->identifier." .close", "$(this).closest('.message').transition({$this->_closeTransition})"); |
82 | 82 | } |
83 | - if(isset($this->_timeout)){ |
|
84 | - $js->exec("setTimeout(function() { $('#{$this->identifier}').transition({$this->_closeTransition}); }, {$this->_timeout});",true); |
|
83 | + if (isset($this->_timeout)) { |
|
84 | + $js->exec("setTimeout(function() { $('#{$this->identifier}').transition({$this->_closeTransition}); }, {$this->_timeout});", true); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | return parent::run($js); |
88 | 88 | } |
89 | 89 | |
90 | - public function setState($visible=true){ |
|
91 | - $visible=($visible===true)?"visible":"hidden"; |
|
92 | - return $this->addToPropertyCtrl("class", $visible, array("visible","hidden")); |
|
90 | + public function setState($visible=true) { |
|
91 | + $visible=($visible===true) ? "visible" : "hidden"; |
|
92 | + return $this->addToPropertyCtrl("class", $visible, array("visible", "hidden")); |
|
93 | 93 | } |
94 | 94 | |
95 | - public function setVariation($value="floating"){ |
|
96 | - return $this->addToPropertyCtrl("class", $value, array("floating","compact")); |
|
95 | + public function setVariation($value="floating") { |
|
96 | + return $this->addToPropertyCtrl("class", $value, array("floating", "compact")); |
|
97 | 97 | } |
98 | 98 | |
99 | - public function setStyle($style){ |
|
99 | + public function setStyle($style) { |
|
100 | 100 | return $this->addToPropertyCtrl("class", $style, Style::getConstants()); |
101 | 101 | } |
102 | 102 | |
103 | - public function setError(){ |
|
103 | + public function setError() { |
|
104 | 104 | return $this->setStyle("error"); |
105 | 105 | } |
106 | 106 | |
107 | - public function setWarning(){ |
|
107 | + public function setWarning() { |
|
108 | 108 | return $this->setStyle("warning"); |
109 | 109 | } |
110 | 110 | |
111 | - public function setMessage($message){ |
|
112 | - if(\is_array($this->content)){ |
|
111 | + public function setMessage($message) { |
|
112 | + if (\is_array($this->content)) { |
|
113 | 113 | $this->content[\sizeof($this->content)-1]=$message; |
114 | - }else |
|
114 | + } else |
|
115 | 115 | $this->setContent($message); |
116 | 116 | } |
117 | 117 |