@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | abstract public function addToProperty($name, $value, $separator=" "); |
23 | 23 | abstract public function addLabel($caption, $style="label-default", $leftSeparator=" "); |
24 | - abstract public function addContent($content,$before=false); |
|
24 | + abstract public function addContent($content, $before=false); |
|
25 | 25 | abstract public function getField(); |
26 | 26 | abstract public function getDataField(); |
27 | 27 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | } |
31 | 31 | |
32 | 32 | public function addLoading() { |
33 | - if ($this->_hasIcon === false) { |
|
33 | + if ($this->_hasIcon===false) { |
|
34 | 34 | throw new \Exception("Input must have an icon for showing a loader, use addIcon before"); |
35 | 35 | } |
36 | 36 | return $this->addToProperty("class", State::LOADING); |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function labeled($label, $direction=Direction::LEFT, $icon=NULL) { |
46 | 46 | $field=$this->getField(); |
47 | - $labelO=$field->addLabel($label,$direction===Direction::LEFT,$icon); |
|
48 | - $field->addToProperty("class", $direction . " labeled"); |
|
47 | + $labelO=$field->addLabel($label, $direction===Direction::LEFT, $icon); |
|
48 | + $field->addToProperty("class", $direction." labeled"); |
|
49 | 49 | return $labelO; |
50 | 50 | } |
51 | 51 | |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | * @param string $checkboxType |
57 | 57 | * @return HtmlLabel |
58 | 58 | */ |
59 | - public function labeledCheckbox($direction=Direction::LEFT,$caption="",$value=NULL,$checkboxType=NULL){ |
|
60 | - return $this->labeled(new HtmlCheckbox("lbl-ck-".$this->getField()->getIdentifier(),$caption,$value,$checkboxType),$direction); |
|
59 | + public function labeledCheckbox($direction=Direction::LEFT, $caption="", $value=NULL, $checkboxType=NULL) { |
|
60 | + return $this->labeled(new HtmlCheckbox("lbl-ck-".$this->getField()->getIdentifier(), $caption, $value, $checkboxType), $direction); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * @return HtmlLabel |
67 | 67 | */ |
68 | 68 | public function labeledToCorner($icon, $direction=Direction::LEFT) { |
69 | - return $this->labeled("", $direction . " corner", $icon)->toCorner($direction); |
|
69 | + return $this->labeled("", $direction." corner", $icon)->toCorner($direction); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -79,13 +79,13 @@ discard block |
||
79 | 79 | public function addAction($action, $direction=Direction::RIGHT, $icon=NULL, $labeled=false) { |
80 | 80 | $field=$this->getField(); |
81 | 81 | $actionO=$action; |
82 | - if (\is_object($action) === false) { |
|
83 | - $actionO=new HtmlButton("action-" . $this->identifier, $action); |
|
82 | + if (\is_object($action)===false) { |
|
83 | + $actionO=new HtmlButton("action-".$this->identifier, $action); |
|
84 | 84 | if (isset($icon)) |
85 | 85 | $actionO->addIcon($icon, true, $labeled); |
86 | 86 | } |
87 | - $field->addToProperty("class", $direction . " action"); |
|
88 | - $field->addContent($actionO, \strstr($direction, Direction::LEFT) !== false); |
|
87 | + $field->addToProperty("class", $direction." action"); |
|
88 | + $field->addContent($actionO, \strstr($direction, Direction::LEFT)!==false); |
|
89 | 89 | return $actionO; |
90 | 90 | } |
91 | 91 | |
@@ -95,59 +95,59 @@ discard block |
||
95 | 95 | * @param string $direction |
96 | 96 | * @return HtmlLabel |
97 | 97 | */ |
98 | - public function addDropdown($label="", $items=array(),$direction=Direction::RIGHT){ |
|
99 | - $labelO=new HtmlDropdown("dd-".$this->identifier,$label,$items); |
|
100 | - $labelO->asSelect("select-".$this->identifier,false,true); |
|
101 | - return $this->labeled($labelO,$direction); |
|
98 | + public function addDropdown($label="", $items=array(), $direction=Direction::RIGHT) { |
|
99 | + $labelO=new HtmlDropdown("dd-".$this->identifier, $label, $items); |
|
100 | + $labelO->asSelect("select-".$this->identifier, false, true); |
|
101 | + return $this->labeled($labelO, $direction); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | public function setTransparent() { |
105 | 105 | return $this->getField()->addToProperty("class", "transparent"); |
106 | 106 | } |
107 | 107 | |
108 | - public function setReadonly(){ |
|
108 | + public function setReadonly() { |
|
109 | 109 | $this->getDataField()->setProperty("readonly", ""); |
110 | 110 | return $this; |
111 | 111 | } |
112 | 112 | |
113 | - public function setName($name){ |
|
114 | - $this->getDataField()->setProperty("name",$name); |
|
113 | + public function setName($name) { |
|
114 | + $this->getDataField()->setProperty("name", $name); |
|
115 | 115 | return $this; |
116 | 116 | } |
117 | 117 | |
118 | - public function setFluid(){ |
|
119 | - $this->getField()->addToProperty("class","fluid"); |
|
118 | + public function setFluid() { |
|
119 | + $this->getField()->addToProperty("class", "fluid"); |
|
120 | 120 | return $this; |
121 | 121 | } |
122 | 122 | |
123 | 123 | public function setDisabled($disable=true) { |
124 | 124 | $field=$this->getField(); |
125 | - if($disable) |
|
125 | + if ($disable) |
|
126 | 126 | $field->addToProperty("class", "disabled"); |
127 | 127 | return $this; |
128 | 128 | } |
129 | 129 | |
130 | - public function setJsContent($content){ |
|
130 | + public function setJsContent($content) { |
|
131 | 131 | $id=""; |
132 | 132 | $field=$this->getDataField(); |
133 | - if(isset($field)){ |
|
133 | + if (isset($field)) { |
|
134 | 134 | $id=$field->getIdentifier(); |
135 | 135 | } |
136 | - if($id!==''){ |
|
136 | + if ($id!=='') { |
|
137 | 137 | return '$("#'.$id.'").val('.$content.')'; |
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
141 | - public function getJsContent(){ |
|
141 | + public function getJsContent() { |
|
142 | 142 | return $this->setJsContent(""); |
143 | 143 | } |
144 | 144 | |
145 | - public function asFile($caption='', $direction=Direction::RIGHT, $icon='cloud upload alternate', $labeled=false){ |
|
145 | + public function asFile($caption='', $direction=Direction::RIGHT, $icon='cloud upload alternate', $labeled=false) { |
|
146 | 146 | $field=$this->getField(); |
147 | 147 | $field->getDataField()->setProperty('readonly', 'readonly'); |
148 | - $file=new HtmlInput5($this->identifier.'-file','file'); |
|
149 | - $file->setProperty('style','display: none!important;'); |
|
148 | + $file=new HtmlInput5($this->identifier.'-file', 'file'); |
|
149 | + $file->setProperty('style', 'display: none!important;'); |
|
150 | 150 | $field->getField()->content['file']=$file; |
151 | - $this->addAction($caption,$direction,$icon,$labeled); |
|
151 | + $this->addAction($caption, $direction, $icon, $labeled); |
|
152 | 152 | } |
153 | 153 | } |
@@ -6,23 +6,23 @@ discard block |
||
6 | 6 | public static $preventDefault="\nif(event && event.preventDefault) event.preventDefault();\n"; |
7 | 7 | public static $stopPropagation="\nif(event && event.stopPropagation) event.stopPropagation();\n"; |
8 | 8 | |
9 | - public static function draggable($attr="id"){ |
|
9 | + public static function draggable($attr="id") { |
|
10 | 10 | return 'var dt=event.dataTransfer || event.originalEvent.dataTransfer;dt.setData("text/plain",JSON.stringify({id:$(event.target).attr("id"),data:$(event.target).attr("'.$attr.'")}));'; |
11 | 11 | } |
12 | 12 | |
13 | - public static function dropZone($jqueryDone,$jsCallback=""){ |
|
13 | + public static function dropZone($jqueryDone, $jsCallback="") { |
|
14 | 14 | return 'var dt=event.dataTransfer || event.originalEvent.dataTransfer;var _data=JSON.parse(dt.getData("text/plain"));$(event.target).'.$jqueryDone.'($("#"+_data.id));var data=_data.data;'.$jsCallback; |
15 | 15 | } |
16 | 16 | |
17 | - public static function containsCode($expression){ |
|
18 | - return strrpos($expression, 'this')!==false||strrpos($expression, 'event')!==false||strrpos($expression, 'self')!==false; |
|
17 | + public static function containsCode($expression) { |
|
18 | + return strrpos($expression, 'this')!==false || strrpos($expression, 'event')!==false || strrpos($expression, 'self')!==false; |
|
19 | 19 | } |
20 | 20 | |
21 | - public static function isFunction($jsCode){ |
|
21 | + public static function isFunction($jsCode) { |
|
22 | 22 | return JString::startswith($jsCode, "function"); |
23 | 23 | } |
24 | 24 | |
25 | - public static function fileUploadBehavior($id=''){ |
|
25 | + public static function fileUploadBehavior($id='') { |
|
26 | 26 | return "$('input:text, .ui.button', '#{$id}').on('click', function (e) {e.preventDefault();\$('input:file', '#{$id}').click();}); |
27 | 27 | $('input:file', '#{$id}').on('change', function (e) {if(e.target.files.length){var name = e.target.files[0].name;$('input:text', $(e.target).parent()).val(name);}});"; |
28 | 28 | } |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | $value=implode(",", $value); |
56 | 56 | } |
57 | 57 | if (self::containsCode($value)===false) { |
58 | - $value=\str_replace(["\\","\""], ["\\\\","\\\""], $value); |
|
58 | + $value=\str_replace(["\\", "\""], ["\\\\", "\\\""], $value); |
|
59 | 59 | $value='"'.$value.'"'; |
60 | 60 | } |
61 | - return trim($value,"%"); |
|
61 | + return trim($value, "%"); |
|
62 | 62 | } |
63 | 63 | |
64 | - public static function prep_jquery_selector($value){ |
|
65 | - if(JString::startswith($value, '$(')===false){ |
|
64 | + public static function prep_jquery_selector($value) { |
|
65 | + if (JString::startswith($value, '$(')===false) { |
|
66 | 66 | return '$('.self::prep_value($value).')'; |
67 | 67 | } |
68 | 68 | return $value; |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | */ |
30 | 30 | protected $js; |
31 | 31 | |
32 | - public function __construct($autoCompile = true) { |
|
33 | - $this->autoCompile = $autoCompile; |
|
34 | - $this->components = array(); |
|
35 | - $this->htmlComponents = array(); |
|
32 | + public function __construct($autoCompile=true) { |
|
33 | + $this->autoCompile=$autoCompile; |
|
34 | + $this->components=array(); |
|
35 | + $this->htmlComponents=array(); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | public function isAutoCompile() { |
@@ -40,12 +40,12 @@ discard block |
||
40 | 40 | } |
41 | 41 | |
42 | 42 | public function setAutoCompile($autoCompile) { |
43 | - $this->autoCompile = $autoCompile; |
|
43 | + $this->autoCompile=$autoCompile; |
|
44 | 44 | return $this; |
45 | 45 | } |
46 | 46 | |
47 | - public function compile($internal = false) { |
|
48 | - if ($internal === false && $this->autoCompile === true) |
|
47 | + public function compile($internal=false) { |
|
48 | + if ($internal===false && $this->autoCompile===true) |
|
49 | 49 | throw new \Exception("Impossible to compile if autoCompile is set to 'true'"); |
50 | 50 | foreach ($this->components as $component) { |
51 | 51 | $component->compile(); |
@@ -53,20 +53,20 @@ discard block |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | public function setJs(JsUtils $js) { |
56 | - $this->js = $js; |
|
56 | + $this->js=$js; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | public function addComponent(SimpleComponent $component, $attachTo, $params) { |
60 | 60 | if ($this->autoCompile) { |
61 | - if ($attachTo != null) { |
|
62 | - if (! isset($this->components[$attachTo])) { |
|
63 | - $this->components[$attachTo] = $component; |
|
61 | + if ($attachTo!=null) { |
|
62 | + if (!isset($this->components[$attachTo])) { |
|
63 | + $this->components[$attachTo]=$component; |
|
64 | 64 | } else { |
65 | - $this->components[] = $component; |
|
65 | + $this->components[]=$component; |
|
66 | 66 | } |
67 | 67 | $component->attach($attachTo); |
68 | 68 | } else { |
69 | - $this->components[] = $component; |
|
69 | + $this->components[]=$component; |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | if (isset($params)) |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | } |
77 | 77 | |
78 | 78 | public function addHtmlComponent(BaseHtml $htmlComponent) { |
79 | - $this->htmlComponents[$htmlComponent->getIdentifier()] = $htmlComponent; |
|
79 | + $this->htmlComponents[$htmlComponent->getIdentifier()]=$htmlComponent; |
|
80 | 80 | return $htmlComponent; |
81 | 81 | } |
82 | 82 | |
83 | - public function compileHtml(JsUtils $js = NULL, &$view = NULL) { |
|
83 | + public function compileHtml(JsUtils $js=NULL, &$view=NULL) { |
|
84 | 84 | foreach ($this->htmlComponents as $htmlComponent) { |
85 | 85 | $htmlComponent->compile($js, $view); |
86 | 86 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | return array_filter($this->htmlComponents, $callback); |
91 | 91 | } |
92 | 92 | |
93 | - public function getHtmlComponent($identifier){ |
|
93 | + public function getHtmlComponent($identifier) { |
|
94 | 94 | return $this->htmlComponents[$identifier]??''; |
95 | 95 | } |
96 | 96 | } |
@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | * @version 1.001 |
11 | 11 | */ |
12 | 12 | abstract class BaseComponent { |
13 | - public $jquery_code_for_compile=array (); |
|
14 | - protected $params=array (); |
|
13 | + public $jquery_code_for_compile=array(); |
|
14 | + protected $params=array(); |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | public function setParams($params) { |
71 | - foreach ( $params as $k => $v ) { |
|
71 | + foreach ($params as $k => $v) { |
|
72 | 72 | $method="set".ucfirst($k); |
73 | 73 | if (method_exists($this, $method)) |
74 | 74 | $this->$method($v); |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | return $this; |
82 | 82 | } |
83 | 83 | |
84 | - public function addParams($params){ |
|
85 | - foreach ($params as $k=>$v){ |
|
84 | + public function addParams($params) { |
|
85 | + foreach ($params as $k=>$v) { |
|
86 | 86 | $this->setParam($k, $v); |
87 | 87 | } |
88 | 88 | return $this; |
@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | |
91 | 91 | abstract public function getScript(); |
92 | 92 | |
93 | - public function setDebug($value){ |
|
93 | + public function setDebug($value) { |
|
94 | 94 | return $this->setParam("debug", $value); |
95 | 95 | } |
96 | 96 | |
97 | - public function setVerbose($value){ |
|
97 | + public function setVerbose($value) { |
|
98 | 98 | return $this->setParam("verbose", $value); |
99 | 99 | } |
100 | 100 |
@@ -18,11 +18,11 @@ |
||
18 | 18 | $this->uiName='modal'; |
19 | 19 | } |
20 | 20 | |
21 | - public function showDimmer(){ |
|
21 | + public function showDimmer() { |
|
22 | 22 | return $this->addBehavior('hide dimmer'); |
23 | 23 | } |
24 | 24 | |
25 | - public function setInverted(){ |
|
25 | + public function setInverted() { |
|
26 | 26 | $this->params['inverted']=true; |
27 | 27 | } |
28 | 28 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | protected $_popup=NULL; |
26 | 26 | protected $_dimmer=NULL; |
27 | 27 | protected $_toast=NULL; |
28 | - protected $_params=array (); |
|
28 | + protected $_params=array(); |
|
29 | 29 | |
30 | 30 | |
31 | 31 | public function __construct($identifier, $tagName="p", $baseClass="ui", $content=NULL) { |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * @return HtmlDimmer |
82 | 82 | */ |
83 | 83 | public function addDimmer($params=array(), $content=NULL) { |
84 | - $dimmer=new HtmlDimmer("dimmer-" . $this->identifier, $content); |
|
84 | + $dimmer=new HtmlDimmer("dimmer-".$this->identifier, $content); |
|
85 | 85 | $dimmer->setParams($params); |
86 | 86 | $dimmer->setContainer($this); |
87 | 87 | $this->addContent($dimmer); |
@@ -97,12 +97,12 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function addLabel($label, $before=false, $icon=NULL) { |
99 | 99 | $labelO=$label; |
100 | - if (\is_object($label) === false) { |
|
101 | - $labelO=new HtmlLabel("label-" . $this->identifier, $label); |
|
100 | + if (\is_object($label)===false) { |
|
101 | + $labelO=new HtmlLabel("label-".$this->identifier, $label); |
|
102 | 102 | if (isset($icon)) |
103 | 103 | $labelO->addIcon($icon); |
104 | 104 | } else { |
105 | - $labelO->addToPropertyCtrl("class", "label", array ("label" )); |
|
105 | + $labelO->addToPropertyCtrl("class", "label", array("label")); |
|
106 | 106 | } |
107 | 107 | $this->addContent($labelO, $before); |
108 | 108 | return $labelO; |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | * @param string $icon |
117 | 117 | * @return HtmlSemDoubleElement |
118 | 118 | */ |
119 | - public function attachLabel($label,$side=Side::TOP,$direction=Direction::NONE,$icon=NULL){ |
|
120 | - $label=$this->addLabel($label,true,$icon); |
|
121 | - $label->setAttached($side,$direction); |
|
119 | + public function attachLabel($label, $side=Side::TOP, $direction=Direction::NONE, $icon=NULL) { |
|
120 | + $label=$this->addLabel($label, true, $icon); |
|
121 | + $label->setAttached($side, $direction); |
|
122 | 122 | return $this; |
123 | 123 | } |
124 | 124 | |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | * Transforms the element into a link |
127 | 127 | * @return HtmlSemDoubleElement |
128 | 128 | */ |
129 | - public function asLink($href=NULL,$target=NULL) { |
|
129 | + public function asLink($href=NULL, $target=NULL) { |
|
130 | 130 | if (isset($href)) |
131 | 131 | $this->setProperty("href", $href); |
132 | - if(isset($target)) |
|
132 | + if (isset($target)) |
|
133 | 133 | $this->setProperty("target", $target); |
134 | 134 | return $this->setTagName("a"); |
135 | 135 | } |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function jsShowDimmer($show=true) { |
143 | 143 | $status="hide"; |
144 | - if ($show === true) |
|
144 | + if ($show===true) |
|
145 | 145 | $status="show"; |
146 | - return '$("#.' . $this->identifier . ').dimmer("' . $status . '");'; |
|
146 | + return '$("#.'.$this->identifier.').dimmer("'.$status.'");'; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @see BaseHtml::compile() |
152 | 152 | */ |
153 | 153 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
154 | - if (isset($this->_popup)){ |
|
154 | + if (isset($this->_popup)) { |
|
155 | 155 | $this->_popup->compile($js); |
156 | 156 | } |
157 | 157 | return parent::compile($js, $view); |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * @see HtmlDoubleElement::run() |
163 | 163 | */ |
164 | 164 | public function run(JsUtils $js) { |
165 | - $this->_bsComponent=$js->semantic()->generic("#" . $this->identifier); |
|
165 | + $this->_bsComponent=$js->semantic()->generic("#".$this->identifier); |
|
166 | 166 | parent::run($js); |
167 | 167 | $this->addEventsOnRun($js); |
168 | 168 | if (isset($this->_popup)) { |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | * @param boolean $ordered |
180 | 180 | * @return \Ajax\common\html\html5\HtmlList |
181 | 181 | */ |
182 | - public function addList($items,$ordered=false){ |
|
183 | - $list=new HtmlList("list-".$this->identifier,$items); |
|
182 | + public function addList($items, $ordered=false) { |
|
183 | + $list=new HtmlList("list-".$this->identifier, $items); |
|
184 | 184 | $list->setOrdered($ordered); |
185 | 185 | $list->setClass("ui list"); |
186 | 186 | $this->addContent($list); |
@@ -191,14 +191,14 @@ discard block |
||
191 | 191 | * @param ?array $params |
192 | 192 | * @return \Ajax\semantic\components\Toast |
193 | 193 | */ |
194 | - public function asToast($params=NULL){ |
|
194 | + public function asToast($params=NULL) { |
|
195 | 195 | $this->_toast=new Toast(); |
196 | 196 | $this->_toast->attach('#'.$this->_identifier); |
197 | - $this->setProperty('style','display:none;'); |
|
198 | - if(isset($params)){ |
|
197 | + $this->setProperty('style', 'display:none;'); |
|
198 | + if (isset($params)) { |
|
199 | 199 | $this->_toast->setParams($params); |
200 | 200 | } |
201 | - $this->_toast->setParam('onShow','$(".toast-box *").show();'); |
|
201 | + $this->_toast->setParam('onShow', '$(".toast-box *").show();'); |
|
202 | 202 | return $this->_toast; |
203 | 203 | } |
204 | 204 |
@@ -5,8 +5,8 @@ discard block |
||
5 | 5 | use Ajax\common\JsCode; |
6 | 6 | |
7 | 7 | class SimpleExtComponent extends SimpleComponent { |
8 | - protected $events=array (); |
|
9 | - protected $jsCodes=array (); |
|
8 | + protected $events=array(); |
|
9 | + protected $jsCodes=array(); |
|
10 | 10 | |
11 | 11 | public function addEvent($event, $jsCode) { |
12 | 12 | $this->events [$event]=$jsCode; |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | return $this->compileJQueryCode(); |
20 | 20 | } |
21 | 21 | |
22 | - protected function compileJsCodes(){ |
|
23 | - foreach ( $this->jsCodes as $jsCode ) { |
|
24 | - $this->jquery_code_for_compile []=$jsCode->compile(array ( |
|
22 | + protected function compileJsCodes() { |
|
23 | + foreach ($this->jsCodes as $jsCode) { |
|
24 | + $this->jquery_code_for_compile []=$jsCode->compile(array( |
|
25 | 25 | "identifier" => $this->attachTo |
26 | 26 | )); |
27 | 27 | } |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | return $this; |
18 | 18 | } |
19 | 19 | |
20 | - protected function generateParamParts(){ |
|
20 | + protected function generateParamParts() { |
|
21 | 21 | $results=[]; |
22 | - foreach ($this->paramParts as $paramPart){ |
|
22 | + foreach ($this->paramParts as $paramPart) { |
|
23 | 23 | $results[]="{$this->uiName}(".\implode(",", $paramPart).")"; |
24 | 24 | } |
25 | 25 | return \implode(".", $results); |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | |
28 | 28 | public function getScript() { |
29 | 29 | $allParams=$this->params; |
30 | - $this->jquery_code_for_compile=array (); |
|
30 | + $this->jquery_code_for_compile=array(); |
|
31 | 31 | $this->compileJsCodes(); |
32 | 32 | $paramParts=""; |
33 | - if(\sizeof($this->paramParts)>0){ |
|
33 | + if (\sizeof($this->paramParts)>0) { |
|
34 | 34 | $paramParts=".".$this->generateParamParts(); |
35 | 35 | } |
36 | 36 | $this->jquery_code_for_compile []="$( \"".$this->attachTo."\" ).{$this->uiName}(".$this->getParamsAsJSON($allParams).")".$paramParts.";"; |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | return $this; |
44 | 44 | } |
45 | 45 | |
46 | - public function addComponentEvent($event,$jsCode){ |
|
47 | - $jsCode=\str_ireplace("\"","%quote%", $jsCode); |
|
46 | + public function addComponentEvent($event, $jsCode) { |
|
47 | + $jsCode=\str_ireplace("\"", "%quote%", $jsCode); |
|
48 | 48 | return $this->setParam($event, "%function(){".$jsCode."}%"); |
49 | 49 | } |
50 | 50 | |
51 | - public function setJs(JsUtils $js){ |
|
51 | + public function setJs(JsUtils $js) { |
|
52 | 52 | $this->js=$js; |
53 | 53 | $js->semantic()->addComponent($this, $this->attachTo, $this->params); |
54 | 54 | } |
@@ -20,33 +20,33 @@ |
||
20 | 20 | $this->uiName='slider'; |
21 | 21 | } |
22 | 22 | |
23 | - public function close(){ |
|
23 | + public function close() { |
|
24 | 24 | return $this->addBehavior('close'); |
25 | 25 | } |
26 | 26 | |
27 | - public function setInterpretLabel($labels){ |
|
27 | + public function setInterpretLabel($labels) { |
|
28 | 28 | $var="window.document._slider_labels['".JString::cleanIdentifier($this->attachTo)."']"; |
29 | 29 | $this->addCode('window.document._slider_labels=window.document._slider_labels||[];'.$var.'='.\json_encode($labels).';'); |
30 | 30 | $this->params['interpretLabel']='%function(value) {return '.$var.'[value];}%'; |
31 | 31 | } |
32 | 32 | |
33 | - public function setMin($min){ |
|
33 | + public function setMin($min) { |
|
34 | 34 | $this->params['min']=$min; |
35 | 35 | } |
36 | 36 | |
37 | - public function setMax($max){ |
|
37 | + public function setMax($max) { |
|
38 | 38 | $this->params['max']=$max; |
39 | 39 | } |
40 | 40 | |
41 | - public function setStart($start){ |
|
41 | + public function setStart($start) { |
|
42 | 42 | $this->params['start']=$start; |
43 | 43 | } |
44 | 44 | |
45 | - public function setEnd($end){ |
|
45 | + public function setEnd($end) { |
|
46 | 46 | $this->params['end']=$end; |
47 | 47 | } |
48 | 48 | |
49 | - public function setStep($step){ |
|
49 | + public function setStep($step) { |
|
50 | 50 | $this->params['step']=$step; |
51 | 51 | } |
52 | 52 |