@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function getWidgetID() |
71 | 71 | { |
72 | - return $this->getClientID() . '_0'; |
|
72 | + return $this->getClientID().'_0'; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -111,10 +111,10 @@ discard block |
||
111 | 111 | { |
112 | 112 | $options = $this->getOptions()->toArray(); |
113 | 113 | // overload some events to add information about the items order |
114 | - foreach($options as $event => $implementation) |
|
114 | + foreach ($options as $event => $implementation) |
|
115 | 115 | { |
116 | - if($event == 'sort' || $event == 'stop') |
|
117 | - $options[$event] = new TJavaScriptLiteral('function( event, ui ) { ui.index = jQuery(this).sortable(\'toArray\'); Prado.JuiCallback(' . TJavaScript::encode($this->getUniqueID()) . ', \'' . $event . '\', event, ui, this); }'); |
|
116 | + if ($event == 'sort' || $event == 'stop') |
|
117 | + $options[$event] = new TJavaScriptLiteral('function( event, ui ) { ui.index = jQuery(this).sortable(\'toArray\'); Prado.JuiCallback('.TJavaScript::encode($this->getUniqueID()).', \''.$event.'\', event, ui, this); }'); |
|
118 | 118 | } |
119 | 119 | return $options; |
120 | 120 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $writer->addAttribute('id', $this->getClientID()); |
130 | 130 | $options = TJavaScript::encode($this->getPostBackOptions()); |
131 | 131 | $cs = $this->getPage()->getClientScript(); |
132 | - $code = "jQuery('#" . $this->getWidgetID() . "')." . $this->getWidget() . "(" . $options . ");"; |
|
132 | + $code = "jQuery('#".$this->getWidgetID()."').".$this->getWidget()."(".$options.");"; |
|
133 | 133 | $cs->registerEndScript(sprintf('%08X', crc32($code)), $code); |
134 | 134 | } |
135 | 135 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * Raises the OnActivate event |
148 | 148 | * @param object $params event parameters |
149 | 149 | */ |
150 | - public function onActivate ($params) |
|
150 | + public function onActivate($params) |
|
151 | 151 | { |
152 | 152 | $this->raiseEvent('OnActivate', $this, $params); |
153 | 153 | } |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * Raises the OnBeforeStop event |
157 | 157 | * @param object $params event parameters |
158 | 158 | */ |
159 | - public function onBeforeStop ($params) |
|
159 | + public function onBeforeStop($params) |
|
160 | 160 | { |
161 | 161 | $this->raiseEvent('OnBeforeStop', $this, $params); |
162 | 162 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * Raises the OnChange event |
166 | 166 | * @param object $params event parameters |
167 | 167 | */ |
168 | - public function onChange ($params) |
|
168 | + public function onChange($params) |
|
169 | 169 | { |
170 | 170 | $this->raiseEvent('OnChange', $this, $params); |
171 | 171 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * Raises the OnCreate event |
175 | 175 | * @param object $params event parameters |
176 | 176 | */ |
177 | - public function onCreate ($params) |
|
177 | + public function onCreate($params) |
|
178 | 178 | { |
179 | 179 | $this->raiseEvent('OnCreate', $this, $params); |
180 | 180 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * Raises the OnDeactivate event |
184 | 184 | * @param object $params event parameters |
185 | 185 | */ |
186 | - public function onDeactivate ($params) |
|
186 | + public function onDeactivate($params) |
|
187 | 187 | { |
188 | 188 | $this->raiseEvent('OnDeactivate', $this, $params); |
189 | 189 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * Raises the OnOut event |
193 | 193 | * @param object $params event parameters |
194 | 194 | */ |
195 | - public function onOut ($params) |
|
195 | + public function onOut($params) |
|
196 | 196 | { |
197 | 197 | $this->raiseEvent('OnOut', $this, $params); |
198 | 198 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * Raises the OnOver event |
202 | 202 | * @param object $params event parameters |
203 | 203 | */ |
204 | - public function onOver ($params) |
|
204 | + public function onOver($params) |
|
205 | 205 | { |
206 | 206 | $this->raiseEvent('OnOver', $this, $params); |
207 | 207 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * Raises the OnReceive event |
211 | 211 | * @param object $params event parameters |
212 | 212 | */ |
213 | - public function onReceive ($params) |
|
213 | + public function onReceive($params) |
|
214 | 214 | { |
215 | 215 | $this->raiseEvent('OnReceive', $this, $params); |
216 | 216 | } |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | * Raises the OnRemove event |
220 | 220 | * @param object $params event parameters |
221 | 221 | */ |
222 | - public function onRemove ($params) |
|
222 | + public function onRemove($params) |
|
223 | 223 | { |
224 | 224 | $this->raiseEvent('OnRemove', $this, $params); |
225 | 225 | } |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | * Raises the OnSort event |
229 | 229 | * @param object $params event parameters |
230 | 230 | */ |
231 | - public function onSort ($params) |
|
231 | + public function onSort($params) |
|
232 | 232 | { |
233 | 233 | $this->raiseEvent('OnSort', $this, $params); |
234 | 234 | } |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | * Raises the OnStart event |
238 | 238 | * @param object $params event parameters |
239 | 239 | */ |
240 | - public function onStart ($params) |
|
240 | + public function onStart($params) |
|
241 | 241 | { |
242 | 242 | $this->raiseEvent('OnStart', $this, $params); |
243 | 243 | } |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | * Raises the OnStop event |
247 | 247 | * @param object $params event parameters |
248 | 248 | */ |
249 | - public function OnStop ($params) |
|
249 | + public function OnStop($params) |
|
250 | 250 | { |
251 | 251 | $this->raiseEvent('OnStop', $this, $params); |
252 | 252 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | * Raises the OnUpdate event |
256 | 256 | * @param object $params event parameters |
257 | 257 | */ |
258 | - public function onUpdate ($params) |
|
258 | + public function onUpdate($params) |
|
259 | 259 | { |
260 | 260 | $this->raiseEvent('OnUpdate', $this, $params); |
261 | 261 | } |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | public function dataBind() |
281 | 281 | { |
282 | 282 | parent::dataBind(); |
283 | - if($this->getPage()->getIsCallback()) |
|
283 | + if ($this->getPage()->getIsCallback()) |
|
284 | 284 | $this->renderSortables($this->getResponse()->createHtmlWriter()); |
285 | 285 | } |
286 | 286 | |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | */ |
290 | 290 | public function getSortables() |
291 | 291 | { |
292 | - if($this->_repeater === null) |
|
292 | + if ($this->_repeater === null) |
|
293 | 293 | $this->_repeater = $this->createRepeater(); |
294 | 294 | return $this->_repeater; |
295 | 295 | } |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | protected function createRepeater() |
301 | 301 | { |
302 | 302 | $repeater = new TRepeater; |
303 | - $repeater->setHeaderTemplate(new TJuiSortableTemplate('<ul id="' . $this->getWidgetID() . '">')); |
|
303 | + $repeater->setHeaderTemplate(new TJuiSortableTemplate('<ul id="'.$this->getWidgetID().'">')); |
|
304 | 304 | $repeater->setFooterTemplate(new TJuiSortableTemplate('</ul>')); |
305 | 305 | $repeater->setItemTemplate(new TTemplate('<li id="<%# $this->ItemIndex %>"><%# $this->Data %></li>', null)); |
306 | 306 | $repeater->setEmptyTemplate(new TJuiSortableTemplate('<ul></ul>')); |
@@ -113,8 +113,9 @@ discard block |
||
113 | 113 | // overload some events to add information about the items order |
114 | 114 | foreach($options as $event => $implementation) |
115 | 115 | { |
116 | - if($event == 'sort' || $event == 'stop') |
|
117 | - $options[$event] = new TJavaScriptLiteral('function( event, ui ) { ui.index = jQuery(this).sortable(\'toArray\'); Prado.JuiCallback(' . TJavaScript::encode($this->getUniqueID()) . ', \'' . $event . '\', event, ui, this); }'); |
|
116 | + if($event == 'sort' || $event == 'stop') { |
|
117 | + $options[$event] = new TJavaScriptLiteral('function( event, ui ) { ui.index = jQuery(this).sortable(\'toArray\'); Prado.JuiCallback(' . TJavaScript::encode($this->getUniqueID()) . ', \'' . $event . '\', event, ui, this); }'); |
|
118 | + } |
|
118 | 119 | } |
119 | 120 | return $options; |
120 | 121 | } |
@@ -280,8 +281,9 @@ discard block |
||
280 | 281 | public function dataBind() |
281 | 282 | { |
282 | 283 | parent::dataBind(); |
283 | - if($this->getPage()->getIsCallback()) |
|
284 | - $this->renderSortables($this->getResponse()->createHtmlWriter()); |
|
284 | + if($this->getPage()->getIsCallback()) { |
|
285 | + $this->renderSortables($this->getResponse()->createHtmlWriter()); |
|
286 | + } |
|
285 | 287 | } |
286 | 288 | |
287 | 289 | /** |
@@ -289,8 +291,9 @@ discard block |
||
289 | 291 | */ |
290 | 292 | public function getSortables() |
291 | 293 | { |
292 | - if($this->_repeater === null) |
|
293 | - $this->_repeater = $this->createRepeater(); |
|
294 | + if($this->_repeater === null) { |
|
295 | + $this->_repeater = $this->createRepeater(); |
|
296 | + } |
|
294 | 297 | return $this->_repeater; |
295 | 298 | } |
296 | 299 |
@@ -118,12 +118,12 @@ discard block |
||
118 | 118 | protected function addAttributesToRender($writer) |
119 | 119 | { |
120 | 120 | $cs = $this->getPage()->getClientScript(); |
121 | - if(self::$_first) |
|
121 | + if (self::$_first) |
|
122 | 122 | { |
123 | 123 | $culture = $this->getCurrentCulture(); |
124 | - if($culture != 'en') |
|
124 | + if ($culture != 'en') |
|
125 | 125 | { |
126 | - $url = $this->getPage()->getClientScript()->getPradoScriptAssetUrl('jquery-ui') . "/ui/i18n/datepicker-{$culture}.js"; |
|
126 | + $url = $this->getPage()->getClientScript()->getPradoScriptAssetUrl('jquery-ui')."/ui/i18n/datepicker-{$culture}.js"; |
|
127 | 127 | $cs->registerScriptFile(sprintf('%08X', crc32($url)), $url); |
128 | 128 | } |
129 | 129 | $code = "jQuery(document).ready(function(){jQuery.datepicker.setDefaults(jQuery.datepicker.regional['{$culture}']);});"; |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | } |
133 | 133 | parent::addAttributesToRender($writer); |
134 | 134 | $options = TJavaScript::encode($this->getOptions()->toArray()); |
135 | - $code = "jQuery('#" . $this->getWidgetID() . "')." . $this->getWidget() . "(" . $options . ");"; |
|
135 | + $code = "jQuery('#".$this->getWidgetID()."').".$this->getWidget()."(".$options.");"; |
|
136 | 136 | $cs->registerEndScript(sprintf('%08X', crc32($code)), $code); |
137 | 137 | } |
138 | 138 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | */ |
248 | 248 | public function getTimeStamp() |
249 | 249 | { |
250 | - if(trim($this->getText()) === '') |
|
250 | + if (trim($this->getText()) === '') |
|
251 | 251 | return null; |
252 | 252 | else |
253 | 253 | return $this->getTimeStampFromText(); |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | */ |
260 | 260 | public function setTimeStamp($value) |
261 | 261 | { |
262 | - if($value === null || (is_string($value) && trim($value) === '')) |
|
262 | + if ($value === null || (is_string($value) && trim($value) === '')) |
|
263 | 263 | $this->setText(''); |
264 | 264 | else |
265 | 265 | { |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | protected function getTimeStampFromText() |
277 | 277 | { |
278 | 278 | $pattern = $this->getDateFormat(); |
279 | - $pattern = str_replace(['MMMM', 'MMM'], ['MM','MM'], $pattern); |
|
279 | + $pattern = str_replace(['MMMM', 'MMM'], ['MM', 'MM'], $pattern); |
|
280 | 280 | $formatter = new TSimpleDateFormatter($pattern); |
281 | 281 | return $formatter->parse($this->getText()); |
282 | 282 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | */ |
289 | 289 | public function getValidationPropertyValue() |
290 | 290 | { |
291 | - if(($text = $this->getText()) === '') |
|
291 | + if (($text = $this->getText()) === '') |
|
292 | 292 | return ''; |
293 | 293 | $date = $this->getTimeStamp(); |
294 | 294 | return $date == null ? $text : $date; |
@@ -247,10 +247,11 @@ discard block |
||
247 | 247 | */ |
248 | 248 | public function getTimeStamp() |
249 | 249 | { |
250 | - if(trim($this->getText()) === '') |
|
251 | - return null; |
|
252 | - else |
|
253 | - return $this->getTimeStampFromText(); |
|
250 | + if(trim($this->getText()) === '') { |
|
251 | + return null; |
|
252 | + } else { |
|
253 | + return $this->getTimeStampFromText(); |
|
254 | + } |
|
254 | 255 | } |
255 | 256 | |
256 | 257 | /** |
@@ -259,9 +260,9 @@ discard block |
||
259 | 260 | */ |
260 | 261 | public function setTimeStamp($value) |
261 | 262 | { |
262 | - if($value === null || (is_string($value) && trim($value) === '')) |
|
263 | - $this->setText(''); |
|
264 | - else |
|
263 | + if($value === null || (is_string($value) && trim($value) === '')) { |
|
264 | + $this->setText(''); |
|
265 | + } else |
|
265 | 266 | { |
266 | 267 | $date = TPropertyValue::ensureFloat($value); |
267 | 268 | $formatter = new TSimpleDateFormatter($this->getDateFormat()); |
@@ -288,8 +289,9 @@ discard block |
||
288 | 289 | */ |
289 | 290 | public function getValidationPropertyValue() |
290 | 291 | { |
291 | - if(($text = $this->getText()) === '') |
|
292 | - return ''; |
|
292 | + if(($text = $this->getText()) === '') { |
|
293 | + return ''; |
|
294 | + } |
|
293 | 295 | $date = $this->getTimeStamp(); |
294 | 296 | return $date == null ? $text : $date; |
295 | 297 | } |
@@ -118,7 +118,7 @@ |
||
118 | 118 | $writer->addAttribute('id', $this->getClientID()); |
119 | 119 | $options = TJavaScript::encode($this->getPostBackOptions()); |
120 | 120 | $cs = $this->getPage()->getClientScript(); |
121 | - $code = "jQuery('#" . $this->getWidgetID() . "')." . $this->getWidget() . "(" . $options . ");"; |
|
121 | + $code = "jQuery('#".$this->getWidgetID()."').".$this->getWidget()."(".$options.");"; |
|
122 | 122 | $cs->registerEndScript(sprintf('%08X', crc32($code)), $code); |
123 | 123 | } |
124 | 124 |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $writer->addAttribute('id', $this->getClientID()); |
123 | 123 | $options = TJavaScript::encode($this->getPostBackOptions()); |
124 | 124 | $cs = $this->getPage()->getClientScript(); |
125 | - $code = "jQuery('#" . $this->getWidgetID() . "')." . $this->getWidget() . "(" . $options . ");"; |
|
125 | + $code = "jQuery('#".$this->getWidgetID()."').".$this->getWidget()."(".$options.");"; |
|
126 | 126 | $cs->registerEndScript(sprintf('%08X', crc32($code)), $code); |
127 | 127 | } |
128 | 128 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * Raises the OnCreate event |
141 | 141 | * @param object $params event parameters |
142 | 142 | */ |
143 | - public function onCreate ($params) |
|
143 | + public function onCreate($params) |
|
144 | 144 | { |
145 | 145 | $this->raiseEvent('OnCreate', $this, $params); |
146 | 146 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * Raises the OnDrag event |
150 | 150 | * @param object $params event parameters |
151 | 151 | */ |
152 | - public function onDrag ($params) |
|
152 | + public function onDrag($params) |
|
153 | 153 | { |
154 | 154 | $this->raiseEvent('OnDrag', $this, $params); |
155 | 155 | } |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * Raises the OnStart event |
159 | 159 | * @param object $params event parameters |
160 | 160 | */ |
161 | - public function onStart ($params) |
|
161 | + public function onStart($params) |
|
162 | 162 | { |
163 | 163 | $this->raiseEvent('OnStart', $this, $params); |
164 | 164 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * Raises the OnStop event |
168 | 168 | * @param object $params event parameters |
169 | 169 | */ |
170 | - public function onStop ($params) |
|
170 | + public function onStop($params) |
|
171 | 171 | { |
172 | 172 | $this->raiseEvent('OnStop', $this, $params); |
173 | 173 | } |
@@ -237,20 +237,20 @@ discard block |
||
237 | 237 | public function raiseCallbackEvent($param) |
238 | 238 | { |
239 | 239 | $token = $param->getCallbackParameter(); |
240 | - if(is_array($token) && count($token) == 2) |
|
240 | + if (is_array($token) && count($token) == 2) |
|
241 | 241 | { |
242 | - if($token[1] === '__TJuiAutoComplete_onSuggest__') |
|
242 | + if ($token[1] === '__TJuiAutoComplete_onSuggest__') |
|
243 | 243 | { |
244 | 244 | $parameter = new TJuiAutoCompleteEventParameter($this->getResponse(), $token[0]); |
245 | 245 | $this->onSuggest($parameter); |
246 | 246 | } |
247 | - elseif($token[1] === '__TJuiAutoComplete_onSuggestionSelected__') |
|
247 | + elseif ($token[1] === '__TJuiAutoComplete_onSuggestionSelected__') |
|
248 | 248 | { |
249 | 249 | $parameter = new TJuiAutoCompleteEventParameter($this->getResponse(), null, $token[0]); |
250 | 250 | $this->onSuggestionSelected($parameter); |
251 | 251 | } |
252 | 252 | } |
253 | - elseif($this->getAutoPostBack()) |
|
253 | + elseif ($this->getAutoPostBack()) |
|
254 | 254 | parent::raiseCallbackEvent($param); |
255 | 255 | } |
256 | 256 | |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | public function dataBind() |
294 | 294 | { |
295 | 295 | parent::dataBind(); |
296 | - if($this->getPage()->getIsCallback()) |
|
296 | + if ($this->getPage()->getIsCallback()) |
|
297 | 297 | $this->renderSuggestions($this->getResponse()->createHtmlWriter()); |
298 | 298 | } |
299 | 299 | |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | */ |
303 | 303 | public function getResultPanel() |
304 | 304 | { |
305 | - if($this->_resultPanel === null) |
|
305 | + if ($this->_resultPanel === null) |
|
306 | 306 | $this->_resultPanel = $this->createResultPanel(); |
307 | 307 | return $this->_resultPanel; |
308 | 308 | } |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | */ |
324 | 324 | public function getSuggestions() |
325 | 325 | { |
326 | - if($this->_repeater === null) |
|
326 | + if ($this->_repeater === null) |
|
327 | 327 | $this->_repeater = $this->createRepeater(); |
328 | 328 | return $this->_repeater; |
329 | 329 | } |
@@ -372,16 +372,16 @@ discard block |
||
372 | 372 | */ |
373 | 373 | public function renderSuggestions($writer) |
374 | 374 | { |
375 | - if($this->getActiveControl()->canUpdateClientSide(true)) |
|
375 | + if ($this->getActiveControl()->canUpdateClientSide(true)) |
|
376 | 376 | { |
377 | 377 | $data = []; |
378 | 378 | $items = $this->getSuggestions()->getItems(); |
379 | 379 | $writer = new TTextWriter; |
380 | - for($i = 0; $i < $items->Count; $i++) |
|
380 | + for ($i = 0; $i < $items->Count; $i++) |
|
381 | 381 | { |
382 | 382 | $items->itemAt($i)->render($writer); |
383 | 383 | $item = $writer->flush(); |
384 | - $data[] = [ 'id' => $i, 'label' => $item]; |
|
384 | + $data[] = ['id' => $i, 'label' => $item]; |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | $this->getResponse()->getAdapter()->setResponseData($data); |
@@ -395,19 +395,19 @@ discard block |
||
395 | 395 | { |
396 | 396 | $options = $this->getOptions()->toArray(); |
397 | 397 | |
398 | - if(strlen($separator = $this->getSeparator())) |
|
398 | + if (strlen($separator = $this->getSeparator())) |
|
399 | 399 | $options['Separators'] = $separator; |
400 | 400 | |
401 | - if($this->getAutoPostBack()) |
|
401 | + if ($this->getAutoPostBack()) |
|
402 | 402 | { |
403 | 403 | $options = array_merge($options, parent::getPostBackOptions()); |
404 | 404 | $options['AutoPostBack'] = true; |
405 | 405 | } |
406 | - if(strlen($textCssClass = $this->getTextCssClass())) |
|
406 | + if (strlen($textCssClass = $this->getTextCssClass())) |
|
407 | 407 | $options['textCssClass'] = $textCssClass; |
408 | 408 | $options['minLength'] = $this->getMinChars(); |
409 | 409 | $options['delay'] = $this->getFrequency() * 1000.0; |
410 | - $options['appendTo'] = '#' . $this->getResultPanel()->getClientID(); |
|
410 | + $options['appendTo'] = '#'.$this->getResultPanel()->getClientID(); |
|
411 | 411 | $options['ID'] = $this->getClientID(); |
412 | 412 | $options['EventTarget'] = $this->getUniqueID(); |
413 | 413 | $options['CausesValidation'] = $this->getCausesValidation(); |
@@ -243,15 +243,14 @@ discard block |
||
243 | 243 | { |
244 | 244 | $parameter = new TJuiAutoCompleteEventParameter($this->getResponse(), $token[0]); |
245 | 245 | $this->onSuggest($parameter); |
246 | - } |
|
247 | - elseif($token[1] === '__TJuiAutoComplete_onSuggestionSelected__') |
|
246 | + } elseif($token[1] === '__TJuiAutoComplete_onSuggestionSelected__') |
|
248 | 247 | { |
249 | 248 | $parameter = new TJuiAutoCompleteEventParameter($this->getResponse(), null, $token[0]); |
250 | 249 | $this->onSuggestionSelected($parameter); |
251 | 250 | } |
251 | + } elseif($this->getAutoPostBack()) { |
|
252 | + parent::raiseCallbackEvent($param); |
|
252 | 253 | } |
253 | - elseif($this->getAutoPostBack()) |
|
254 | - parent::raiseCallbackEvent($param); |
|
255 | 254 | } |
256 | 255 | |
257 | 256 | /** |
@@ -293,8 +292,9 @@ discard block |
||
293 | 292 | public function dataBind() |
294 | 293 | { |
295 | 294 | parent::dataBind(); |
296 | - if($this->getPage()->getIsCallback()) |
|
297 | - $this->renderSuggestions($this->getResponse()->createHtmlWriter()); |
|
295 | + if($this->getPage()->getIsCallback()) { |
|
296 | + $this->renderSuggestions($this->getResponse()->createHtmlWriter()); |
|
297 | + } |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | /** |
@@ -302,8 +302,9 @@ discard block |
||
302 | 302 | */ |
303 | 303 | public function getResultPanel() |
304 | 304 | { |
305 | - if($this->_resultPanel === null) |
|
306 | - $this->_resultPanel = $this->createResultPanel(); |
|
305 | + if($this->_resultPanel === null) { |
|
306 | + $this->_resultPanel = $this->createResultPanel(); |
|
307 | + } |
|
307 | 308 | return $this->_resultPanel; |
308 | 309 | } |
309 | 310 | |
@@ -323,8 +324,9 @@ discard block |
||
323 | 324 | */ |
324 | 325 | public function getSuggestions() |
325 | 326 | { |
326 | - if($this->_repeater === null) |
|
327 | - $this->_repeater = $this->createRepeater(); |
|
327 | + if($this->_repeater === null) { |
|
328 | + $this->_repeater = $this->createRepeater(); |
|
329 | + } |
|
328 | 330 | return $this->_repeater; |
329 | 331 | } |
330 | 332 | |
@@ -395,16 +397,18 @@ discard block |
||
395 | 397 | { |
396 | 398 | $options = $this->getOptions()->toArray(); |
397 | 399 | |
398 | - if(strlen($separator = $this->getSeparator())) |
|
399 | - $options['Separators'] = $separator; |
|
400 | + if(strlen($separator = $this->getSeparator())) { |
|
401 | + $options['Separators'] = $separator; |
|
402 | + } |
|
400 | 403 | |
401 | 404 | if($this->getAutoPostBack()) |
402 | 405 | { |
403 | 406 | $options = array_merge($options, parent::getPostBackOptions()); |
404 | 407 | $options['AutoPostBack'] = true; |
405 | 408 | } |
406 | - if(strlen($textCssClass = $this->getTextCssClass())) |
|
407 | - $options['textCssClass'] = $textCssClass; |
|
409 | + if(strlen($textCssClass = $this->getTextCssClass())) { |
|
410 | + $options['textCssClass'] = $textCssClass; |
|
411 | + } |
|
408 | 412 | $options['minLength'] = $this->getMinChars(); |
409 | 413 | $options['delay'] = $this->getFrequency() * 1000.0; |
410 | 414 | $options['appendTo'] = '#' . $this->getResultPanel()->getClientID(); |
@@ -128,7 +128,7 @@ |
||
128 | 128 | $writer->addAttribute('id', $this->getClientID()); |
129 | 129 | $options = TJavaScript::encode($this->getPostBackOptions()); |
130 | 130 | $cs = $this->getPage()->getClientScript(); |
131 | - $code = "jQuery('#" . $this->getWidgetID() . "')." . $this->getWidget() . "(" . $options . ");"; |
|
131 | + $code = "jQuery('#".$this->getWidgetID()."').".$this->getWidget()."(".$options.");"; |
|
132 | 132 | $cs->registerEndScript(sprintf('%08X', crc32($code)), $code); |
133 | 133 | } |
134 | 134 |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | protected function getAssetUrl($file = '') |
75 | 75 | { |
76 | 76 | $base = $this->getPage()->getClientScript()->getPradoScriptAssetUrl('jquery-ui'); |
77 | - return $base . '/' . $file; |
|
77 | + return $base.'/'.$file; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function publishJuiStyle($file) |
86 | 86 | { |
87 | - $url = $this->getAssetUrl(self::CSS_PATH . '/' . $this->getJuiBaseStyle() . '/' . $file); |
|
87 | + $url = $this->getAssetUrl(self::CSS_PATH.'/'.$this->getJuiBaseStyle().'/'.$file); |
|
88 | 88 | $cs = $this->getPage()->getClientScript(); |
89 | - if(!$cs->isStyleSheetFileRegistered($url)) |
|
89 | + if (!$cs->isStyleSheetFileRegistered($url)) |
|
90 | 90 | $cs->registerStyleSheetFile($url, $url); |
91 | 91 | return $url; |
92 | 92 | } |
@@ -86,8 +86,9 @@ |
||
86 | 86 | { |
87 | 87 | $url = $this->getAssetUrl(self::CSS_PATH . '/' . $this->getJuiBaseStyle() . '/' . $file); |
88 | 88 | $cs = $this->getPage()->getClientScript(); |
89 | - if(!$cs->isStyleSheetFileRegistered($url)) |
|
90 | - $cs->registerStyleSheetFile($url, $url); |
|
89 | + if(!$cs->isStyleSheetFileRegistered($url)) { |
|
90 | + $cs->registerStyleSheetFile($url, $url); |
|
91 | + } |
|
91 | 92 | return $url; |
92 | 93 | } |
93 | 94 |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $writer->addAttribute('id', $this->getClientID()); |
143 | 143 | $options = TJavaScript::encode($this->getPostBackOptions()); |
144 | 144 | $cs = $this->getPage()->getClientScript(); |
145 | - $code = "jQuery('#" . $this->getWidgetID() . "')." . $this->getWidget() . "(" . $options . ");"; |
|
145 | + $code = "jQuery('#".$this->getWidgetID()."').".$this->getWidget()."(".$options.");"; |
|
146 | 146 | $cs->registerEndScript(sprintf('%08X', crc32($code)), $code); |
147 | 147 | } |
148 | 148 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * Raises the OnActivate event |
161 | 161 | * @param object $params event parameters |
162 | 162 | */ |
163 | - public function onActivate ($params) |
|
163 | + public function onActivate($params) |
|
164 | 164 | { |
165 | 165 | $this->raiseEvent('OnActivate', $this, $params); |
166 | 166 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * Raises the OnCreate event |
170 | 170 | * @param object $params event parameters |
171 | 171 | */ |
172 | - public function onCreate ($params) |
|
172 | + public function onCreate($params) |
|
173 | 173 | { |
174 | 174 | $this->raiseEvent('OnCreate', $this, $params); |
175 | 175 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | * Raises the OnDeactivate event |
179 | 179 | * @param object $params event parameters |
180 | 180 | */ |
181 | - public function onDeactivate ($params) |
|
181 | + public function onDeactivate($params) |
|
182 | 182 | { |
183 | 183 | $this->raiseEvent('OnDeactivate', $this, $params); |
184 | 184 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * Raises the OnDrop event |
188 | 188 | * @param object $params event parameters |
189 | 189 | */ |
190 | - public function onDrop ($params) |
|
190 | + public function onDrop($params) |
|
191 | 191 | { |
192 | 192 | $this->raiseEvent('OnDrop', $this, $params); |
193 | 193 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * Raises the OnOut event |
197 | 197 | * @param object $params event parameters |
198 | 198 | */ |
199 | - public function OnOut ($params) |
|
199 | + public function OnOut($params) |
|
200 | 200 | { |
201 | 201 | $this->raiseEvent('OnOut', $this, $params); |
202 | 202 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | * Raises the OnOver event |
206 | 206 | * @param object $params event parameters |
207 | 207 | */ |
208 | - public function OnOver ($params) |
|
208 | + public function OnOver($params) |
|
209 | 209 | { |
210 | 210 | $this->raiseEvent('OnOver', $this, $params); |
211 | 211 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function setControl($control) |
62 | 62 | { |
63 | - if(!$control instanceof IJuiOptions) |
|
63 | + if (!$control instanceof IJuiOptions) |
|
64 | 64 | throw new THttpException(500, 'juioptions_control_invalid', $control->ID); |
65 | 65 | $this->_control = $control; |
66 | 66 | } |
@@ -74,25 +74,25 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function __set($name, $value) |
76 | 76 | { |
77 | - if($this->_options === null) |
|
77 | + if ($this->_options === null) |
|
78 | 78 | $this->_options = []; |
79 | 79 | |
80 | - foreach($this->_control->getValidOptions() as $option) |
|
80 | + foreach ($this->_control->getValidOptions() as $option) |
|
81 | 81 | { |
82 | - if(0 == strcasecmp($name, $option)) |
|
82 | + if (0 == strcasecmp($name, $option)) |
|
83 | 83 | { |
84 | 84 | $low = strtolower($value); |
85 | - if($low === 'null') |
|
85 | + if ($low === 'null') |
|
86 | 86 | { |
87 | 87 | $this->_options[$option] = null; |
88 | - } elseif($low === 'true') { |
|
88 | + } elseif ($low === 'true') { |
|
89 | 89 | $this->_options[$option] = true; |
90 | - } elseif($low === 'false') { |
|
90 | + } elseif ($low === 'false') { |
|
91 | 91 | $this->_options[$option] = false; |
92 | - } elseif(is_numeric($value)) { |
|
92 | + } elseif (is_numeric($value)) { |
|
93 | 93 | // trick to get float or integer automatically when needed |
94 | 94 | $this->_options[$option] = $value + 0; |
95 | - } elseif(substr($low, 0, 8) == 'function') { |
|
95 | + } elseif (substr($low, 0, 8) == 'function') { |
|
96 | 96 | $this->_options[$option] = new TJavaScriptLiteral($value); |
97 | 97 | } else { |
98 | 98 | $this->_options[$option] = $value; |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function __get($name) |
114 | 114 | { |
115 | - if($this->_options === null) |
|
115 | + if ($this->_options === null) |
|
116 | 116 | $this->_options = []; |
117 | 117 | |
118 | - foreach($this->_control->getValidOptions() as $option) |
|
118 | + foreach ($this->_control->getValidOptions() as $option) |
|
119 | 119 | { |
120 | - if(0 == strcasecmp($name, $option) && isset($this->_options[$option])) |
|
120 | + if (0 == strcasecmp($name, $option) && isset($this->_options[$option])) |
|
121 | 121 | { |
122 | 122 | return $this->_options[$option]; |
123 | 123 | } |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | { |
142 | 142 | $ret = ($this->_options === null) ? [] : $this->_options; |
143 | 143 | |
144 | - foreach($this->_control->getValidEvents() as $event) |
|
145 | - if($this->_control->hasEventHandler('on' . $event)) |
|
146 | - $ret[$event] = new TJavaScriptLiteral("function( event, ui ) { Prado.JuiCallback(" . TJavaScript::encode($this->_control->getUniqueID()) . ", " . TJavaScript::encode($event) . ", event, ui, this); }"); |
|
144 | + foreach ($this->_control->getValidEvents() as $event) |
|
145 | + if ($this->_control->hasEventHandler('on'.$event)) |
|
146 | + $ret[$event] = new TJavaScriptLiteral("function( event, ui ) { Prado.JuiCallback(".TJavaScript::encode($this->_control->getUniqueID()).", ".TJavaScript::encode($event).", event, ui, this); }"); |
|
147 | 147 | |
148 | 148 | return $ret; |
149 | 149 | } |
@@ -155,10 +155,10 @@ discard block |
||
155 | 155 | public function raiseCallbackEvent($param) |
156 | 156 | { |
157 | 157 | $callbackParam = $param->CallbackParameter; |
158 | - if(isset($callbackParam->event)) |
|
158 | + if (isset($callbackParam->event)) |
|
159 | 159 | { |
160 | - $eventName = 'On' . ucfirst($callbackParam->event); |
|
161 | - if($this->_control->hasEventHandler($eventName)) |
|
160 | + $eventName = 'On'.ucfirst($callbackParam->event); |
|
161 | + if ($this->_control->hasEventHandler($eventName)) |
|
162 | 162 | { |
163 | 163 | $this->_control->$eventName(new TJuiEventParameter( |
164 | 164 | $this->_control->getResponse(), |
@@ -60,8 +60,9 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function setControl($control) |
62 | 62 | { |
63 | - if(!$control instanceof IJuiOptions) |
|
64 | - throw new THttpException(500, 'juioptions_control_invalid', $control->ID); |
|
63 | + if(!$control instanceof IJuiOptions) { |
|
64 | + throw new THttpException(500, 'juioptions_control_invalid', $control->ID); |
|
65 | + } |
|
65 | 66 | $this->_control = $control; |
66 | 67 | } |
67 | 68 | |
@@ -74,8 +75,9 @@ discard block |
||
74 | 75 | */ |
75 | 76 | public function __set($name, $value) |
76 | 77 | { |
77 | - if($this->_options === null) |
|
78 | - $this->_options = []; |
|
78 | + if($this->_options === null) { |
|
79 | + $this->_options = []; |
|
80 | + } |
|
79 | 81 | |
80 | 82 | foreach($this->_control->getValidOptions() as $option) |
81 | 83 | { |
@@ -112,8 +114,9 @@ discard block |
||
112 | 114 | */ |
113 | 115 | public function __get($name) |
114 | 116 | { |
115 | - if($this->_options === null) |
|
116 | - $this->_options = []; |
|
117 | + if($this->_options === null) { |
|
118 | + $this->_options = []; |
|
119 | + } |
|
117 | 120 | |
118 | 121 | foreach($this->_control->getValidOptions() as $option) |
119 | 122 | { |
@@ -141,9 +144,10 @@ discard block |
||
141 | 144 | { |
142 | 145 | $ret = ($this->_options === null) ? [] : $this->_options; |
143 | 146 | |
144 | - foreach($this->_control->getValidEvents() as $event) |
|
145 | - if($this->_control->hasEventHandler('on' . $event)) |
|
147 | + foreach($this->_control->getValidEvents() as $event) { |
|
148 | + if($this->_control->hasEventHandler('on' . $event)) |
|
146 | 149 | $ret[$event] = new TJavaScriptLiteral("function( event, ui ) { Prado.JuiCallback(" . TJavaScript::encode($this->_control->getUniqueID()) . ", " . TJavaScript::encode($event) . ", event, ui, this); }"); |
150 | + } |
|
147 | 151 | |
148 | 152 | return $ret; |
149 | 153 | } |