@@ -27,7 +27,7 @@ |
||
27 | 27 | */ |
28 | 28 | public function getDifference() |
29 | 29 | { |
30 | - if(gettype($this->_new) === gettype($this->_old) |
|
30 | + if (gettype($this->_new) === gettype($this->_old) |
|
31 | 31 | && $this->_new === $this->_old) |
32 | 32 | return $this->_null; |
33 | 33 | else |
@@ -28,9 +28,10 @@ |
||
28 | 28 | public function getDifference() |
29 | 29 | { |
30 | 30 | if(gettype($this->_new) === gettype($this->_old) |
31 | - && $this->_new === $this->_old) |
|
32 | - return $this->_null; |
|
33 | - else |
|
34 | - return $this->_new; |
|
31 | + && $this->_new === $this->_old) { |
|
32 | + return $this->_null; |
|
33 | + } else { |
|
34 | + return $this->_new; |
|
35 | + } |
|
35 | 36 | } |
36 | 37 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * TActiveControlAdapter. If you override this class, be sure to set the |
90 | 90 | * adapter appropriately by, for example, by calling this constructor. |
91 | 91 | */ |
92 | - public function __construct(){ |
|
92 | + public function __construct() { |
|
93 | 93 | parent::__construct(); |
94 | 94 | $this->setAdapter(new TActiveControlAdapter($this)); |
95 | 95 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | protected function getAssetUrl($file = '') |
103 | 103 | { |
104 | 104 | $base = $this->getPage()->getClientScript()->getPradoScriptAssetUrl(); |
105 | - return $base . '/' . self::SCRIPT_PATH . '/' . $file; |
|
105 | + return $base.'/'.self::SCRIPT_PATH.'/'.$file; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function onFileUpload($param) |
116 | 116 | { |
117 | - if ($this->_flag->getValue() && $this->getPage()->getIsPostBack() && $param == $this->_target->getUniqueID()){ |
|
117 | + if ($this->_flag->getValue() && $this->getPage()->getIsPostBack() && $param == $this->_target->getUniqueID()) { |
|
118 | 118 | $params = new TActiveFileUploadCallbackParams; |
119 | 119 | // save the files so that they will persist past the end of this return. |
120 | 120 | foreach ($this->getFiles() as $file) { |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | Options = new Object(); |
130 | 130 | Options.clientID = '{$this->getClientID()}'; |
131 | 131 | Options.targetID = '{$this->_target->getUniqueID()}'; |
132 | - Options.errorCode = '" . (int)!$this->getHasAllFiles() . "'; |
|
132 | + Options.errorCode = '".(int) !$this->getHasAllFiles()."'; |
|
133 | 133 | Options.callbackToken = '{$this->pushParamsAndGetToken($params)}'; |
134 | - Options.fileName = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileName') : $this->getFileName(), JSON_HEX_APOS) . "'; |
|
135 | - Options.fileSize = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileSize') : $this->getFileSize(), JSON_HEX_APOS) . "'; |
|
136 | - Options.fileType = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileType') : $this->getFileType(), JSON_HEX_APOS) . "'; |
|
137 | - Options.errorCode = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'errorCode') : $this->getErrorCode(), JSON_HEX_APOS) . "'; |
|
134 | + Options.fileName = '".TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileName') : $this->getFileName(), JSON_HEX_APOS)."'; |
|
135 | + Options.fileSize = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileSize') : $this->getFileSize(), JSON_HEX_APOS)."'; |
|
136 | + Options.fileType = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileType') : $this->getFileType(), JSON_HEX_APOS)."'; |
|
137 | + Options.errorCode = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'errorCode') : $this->getErrorCode(), JSON_HEX_APOS)."'; |
|
138 | 138 | parent.Prado.WebUI.TActiveFileUpload.onFileUpload(Options); |
139 | 139 | </script>"; |
140 | 140 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @return string the path where the uploaded file will be stored temporarily, in namespace format |
147 | 147 | * default "Application.runtime.*" |
148 | 148 | */ |
149 | - public function getTempPath(){ |
|
149 | + public function getTempPath() { |
|
150 | 150 | return $this->getViewState('TempPath', 'Application.runtime.*'); |
151 | 151 | } |
152 | 152 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @param string the path where the uploaded file will be stored temporarily in namespace format |
155 | 155 | * default "Application.runtime.*" |
156 | 156 | */ |
157 | - public function setTempPath($value){ |
|
157 | + public function setTempPath($value) { |
|
158 | 158 | $this->setViewState('TempPath', $value, 'Application.runtime.*'); |
159 | 159 | } |
160 | 160 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * @return boolean a value indicating whether an automatic callback to the server will occur whenever the user modifies the text in the TTextBox control and then tabs out of the component. Defaults to true. |
163 | 163 | * Note: When set to false, you will need to trigger the callback yourself. |
164 | 164 | */ |
165 | - public function getAutoPostBack(){ |
|
165 | + public function getAutoPostBack() { |
|
166 | 166 | return $this->getViewState('AutoPostBack', true); |
167 | 167 | } |
168 | 168 | |
@@ -170,28 +170,28 @@ discard block |
||
170 | 170 | * @param boolean a value indicating whether an automatic callback to the server will occur whenever the user modifies the text in the TTextBox control and then tabs out of the component. Defaults to true. |
171 | 171 | * Note: When set to false, you will need to trigger the callback yourself. |
172 | 172 | */ |
173 | - public function setAutoPostBack($value){ |
|
173 | + public function setAutoPostBack($value) { |
|
174 | 174 | $this->setViewState('AutoPostBack', TPropertyValue::ensureBoolean($value), true); |
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
178 | 178 | * @return string A chuck of javascript that will need to be called if {{@link getAutoPostBack AutoPostBack} is set to false} |
179 | 179 | */ |
180 | - public function getCallbackJavascript(){ |
|
180 | + public function getCallbackJavascript() { |
|
181 | 181 | return "Prado.WebUI.TActiveFileUpload.fileChanged(\"{$this->getClientID()}\")"; |
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
185 | 185 | * @throws TInvalidDataValueException if the {@link getTempPath TempPath} is not writable. |
186 | 186 | */ |
187 | - public function onInit($sender){ |
|
187 | + public function onInit($sender) { |
|
188 | 188 | parent::onInit($sender); |
189 | 189 | |
190 | 190 | if (!Prado::getApplication()->getCache()) |
191 | 191 | if (!Prado::getApplication()->getSecurityManager()) |
192 | 192 | throw new Exception('TActiveFileUpload needs either an application level cache or a security manager to work securely'); |
193 | 193 | |
194 | - if (!is_writable(Prado::getPathOfNamespace($this->getTempPath()))){ |
|
194 | + if (!is_writable(Prado::getPathOfNamespace($this->getTempPath()))) { |
|
195 | 195 | throw new TInvalidDataValueException("activefileupload_temppath_invalid", $this->getTempPath()); |
196 | 196 | } |
197 | 197 | } |
@@ -203,12 +203,12 @@ discard block |
||
203 | 203 | * This method is mainly used by framework and control developers. |
204 | 204 | * @param TCallbackEventParameter the event parameter |
205 | 205 | */ |
206 | - public function raiseCallbackEvent($param){ |
|
206 | + public function raiseCallbackEvent($param) { |
|
207 | 207 | $cp = $param->getCallbackParameter(); |
208 | - if ($key = $cp->targetID == $this->_target->getUniqueID()){ |
|
208 | + if ($key = $cp->targetID == $this->_target->getUniqueID()) { |
|
209 | 209 | |
210 | 210 | $params = $this->popParamsByToken($cp->callbackToken); |
211 | - foreach($params->files as $index => $file) |
|
211 | + foreach ($params->files as $index => $file) |
|
212 | 212 | { |
213 | 213 | $_FILES[$key]['name'][$index] = stripslashes($file['fileName']); |
214 | 214 | $_FILES[$key]['size'][$index] = intval($file['fileSize']); |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | if ($cache = Prado::getApplication()->getCache()) |
238 | 238 | { |
239 | 239 | // this is the most secure method, file info can't be forged from client side, no matter what |
240 | - $token = md5('TActiveFileUpload::Params::' . $this->ClientID . '::' . rand(1000 * 1000, 9999 * 1000)); |
|
240 | + $token = md5('TActiveFileUpload::Params::'.$this->ClientID.'::'.rand(1000 * 1000, 9999 * 1000)); |
|
241 | 241 | $cache->set($token, serialize($params), 5 * 60); // expire in 5 minutes - the callback should arrive back in seconds, actually |
242 | 242 | } |
243 | 243 | elseif ($mgr = Prado::getApplication()->getSecurityManager()) |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | { |
281 | 281 | parent::onPreRender($param); |
282 | 282 | |
283 | - if(!$this->getPage()->getIsPostBack() && isset($_GET['TActiveFileUpload_InputId']) && isset($_GET['TActiveFileUpload_TargetId']) && $_GET['TActiveFileUpload_InputId'] == $this->getClientID()) |
|
283 | + if (!$this->getPage()->getIsPostBack() && isset($_GET['TActiveFileUpload_InputId']) && isset($_GET['TActiveFileUpload_TargetId']) && $_GET['TActiveFileUpload_InputId'] == $this->getClientID()) |
|
284 | 284 | { |
285 | 285 | $params = new TActiveFileUploadCallbackParams; |
286 | 286 | foreach ($this->getFiles() as $file) { |
@@ -295,12 +295,12 @@ discard block |
||
295 | 295 | Options = new Object(); |
296 | 296 | Options.clientID = '{$_GET['TActiveFileUpload_InputId']}'; |
297 | 297 | Options.targetID = '{$_GET['TActiveFileUpload_TargetId']}'; |
298 | - Options.errorCode = '" . (int)!$this->getHasAllFiles() . "'; |
|
298 | + Options.errorCode = '".(int) !$this->getHasAllFiles()."'; |
|
299 | 299 | Options.callbackToken = '{$this->pushParamsAndGetToken($params)}'; |
300 | - Options.fileName = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileName') : $this->getFileName(), JSON_HEX_APOS) . "'; |
|
301 | - Options.fileSize = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileSize') : $this->getFileSize(), JSON_HEX_APOS) . "'; |
|
302 | - Options.fileType = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileType') : $this->getFileType(), JSON_HEX_APOS) . "'; |
|
303 | - Options.errorCode = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'errorCode') : $this->getErrorCode(), JSON_HEX_APOS) . "'; |
|
300 | + Options.fileName = '".TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileName') : $this->getFileName(), JSON_HEX_APOS)."'; |
|
301 | + Options.fileSize = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileSize') : $this->getFileSize(), JSON_HEX_APOS)."'; |
|
302 | + Options.fileType = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileType') : $this->getFileType(), JSON_HEX_APOS)."'; |
|
303 | + Options.errorCode = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'errorCode') : $this->getErrorCode(), JSON_HEX_APOS)."'; |
|
304 | 304 | parent.Prado.WebUI.TActiveFileUpload.onFileUpload(Options); |
305 | 305 | </script>"; |
306 | 306 | } |
@@ -343,11 +343,11 @@ discard block |
||
343 | 343 | /** |
344 | 344 | * Removes localfile on ending of the callback. |
345 | 345 | */ |
346 | - public function onUnload($param){ |
|
346 | + public function onUnload($param) { |
|
347 | 347 | if ($this->getPage()->getIsCallback()) |
348 | 348 | { |
349 | - foreach($this->getFiles() as $file) |
|
350 | - if($file->getHasFile() && file_exists($file->getLocalName())){ |
|
349 | + foreach ($this->getFiles() as $file) |
|
350 | + if ($file->getHasFile() && file_exists($file->getLocalName())) { |
|
351 | 351 | unlink($file->getLocalName()); |
352 | 352 | } |
353 | 353 | } |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | /** |
358 | 358 | * @return TBaseActiveCallbackControl standard callback control options. |
359 | 359 | */ |
360 | - public function getActiveControl(){ |
|
360 | + public function getActiveControl() { |
|
361 | 361 | return $this->getAdapter()->getBaseActiveControl(); |
362 | 362 | } |
363 | 363 | |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | * Adds ID attribute, and renders the javascript for active component. |
374 | 374 | * @param THtmlWriter the writer used for the rendering purpose |
375 | 375 | */ |
376 | - public function addAttributesToRender($writer){ |
|
376 | + public function addAttributesToRender($writer) { |
|
377 | 377 | parent::addAttributesToRender($writer); |
378 | 378 | $writer->addAttribute('id', $this->getClientID()); |
379 | 379 | |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | /** |
384 | 384 | * @return string corresponding javascript class name for this control. |
385 | 385 | */ |
386 | - protected function getClientClassName(){ |
|
386 | + protected function getClientClassName() { |
|
387 | 387 | return 'Prado.WebUI.TActiveFileUpload'; |
388 | 388 | } |
389 | 389 | |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | * completeID => complete client ID, |
398 | 398 | * errorID => error client ID) |
399 | 399 | */ |
400 | - protected function getClientOptions(){ |
|
400 | + protected function getClientOptions() { |
|
401 | 401 | $options['ID'] = $this->getClientID(); |
402 | 402 | $options['EventTarget'] = $this->getUniqueID(); |
403 | 403 | |
@@ -419,8 +419,8 @@ discard block |
||
419 | 419 | * If true, you will not be able to save the uploaded file again. |
420 | 420 | * @return boolean true if the file saving is successful |
421 | 421 | */ |
422 | - public function saveAs($fileName, $deleteTempFile = true, $index = 0){ |
|
423 | - if (($this->getErrorCode($index) === UPLOAD_ERR_OK) && (file_exists($this->getLocalName($index)))){ |
|
422 | + public function saveAs($fileName, $deleteTempFile = true, $index = 0) { |
|
423 | + if (($this->getErrorCode($index) === UPLOAD_ERR_OK) && (file_exists($this->getLocalName($index)))) { |
|
424 | 424 | if ($deleteTempFile) |
425 | 425 | return rename($this->getLocalName($index), $fileName); |
426 | 426 | else |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | * @return TImage the image displayed when an upload |
434 | 434 | * completes successfully. |
435 | 435 | */ |
436 | - public function getSuccessImage(){ |
|
436 | + public function getSuccessImage() { |
|
437 | 437 | $this->ensureChildControls(); |
438 | 438 | return $this->_success; |
439 | 439 | } |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | * @return TImage the image displayed when an upload |
443 | 443 | * does not complete successfully. |
444 | 444 | */ |
445 | - public function getErrorImage(){ |
|
445 | + public function getErrorImage() { |
|
446 | 446 | $this->ensureChildControls(); |
447 | 447 | return $this->_error; |
448 | 448 | } |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | * @return TImage the image displayed when an upload |
452 | 452 | * is in progress. |
453 | 453 | */ |
454 | - public function getBusyImage(){ |
|
454 | + public function getBusyImage() { |
|
455 | 455 | $this->ensureChildControls(); |
456 | 456 | return $this->_busy; |
457 | 457 | } |
@@ -187,9 +187,10 @@ discard block |
||
187 | 187 | public function onInit($sender){ |
188 | 188 | parent::onInit($sender); |
189 | 189 | |
190 | - if (!Prado::getApplication()->getCache()) |
|
191 | - if (!Prado::getApplication()->getSecurityManager()) |
|
190 | + if (!Prado::getApplication()->getCache()) { |
|
191 | + if (!Prado::getApplication()->getSecurityManager()) |
|
192 | 192 | throw new Exception('TActiveFileUpload needs either an application level cache or a security manager to work securely'); |
193 | + } |
|
193 | 194 | |
194 | 195 | if (!is_writable(Prado::getPathOfNamespace($this->getTempPath()))){ |
195 | 196 | throw new TInvalidDataValueException("activefileupload_temppath_invalid", $this->getTempPath()); |
@@ -239,14 +240,13 @@ discard block |
||
239 | 240 | // this is the most secure method, file info can't be forged from client side, no matter what |
240 | 241 | $token = md5('TActiveFileUpload::Params::' . $this->ClientID . '::' . rand(1000 * 1000, 9999 * 1000)); |
241 | 242 | $cache->set($token, serialize($params), 5 * 60); // expire in 5 minutes - the callback should arrive back in seconds, actually |
242 | - } |
|
243 | - elseif ($mgr = Prado::getApplication()->getSecurityManager()) |
|
243 | + } elseif ($mgr = Prado::getApplication()->getSecurityManager()) |
|
244 | 244 | { |
245 | 245 | // this is a less secure method, file info can be still forged from client side, but only if attacker knows the secret application key |
246 | 246 | $token = urlencode(base64_encode($mgr->encrypt(serialize($params)))); |
247 | - } |
|
248 | - else |
|
249 | - throw new Exception('TActiveFileUpload needs either an application level cache or a security manager to work securely'); |
|
247 | + } else { |
|
248 | + throw new Exception('TActiveFileUpload needs either an application level cache or a security manager to work securely'); |
|
249 | + } |
|
250 | 250 | |
251 | 251 | return $token; |
252 | 252 | } |
@@ -259,14 +259,13 @@ discard block |
||
259 | 259 | assert($v != ''); |
260 | 260 | $cache->delete($token); // remove it from cache so it can't be used again and won't take up space either |
261 | 261 | $params = unserialize($v); |
262 | - } |
|
263 | - elseif ($mgr = Prado::getApplication()->getSecurityManager()) |
|
262 | + } elseif ($mgr = Prado::getApplication()->getSecurityManager()) |
|
264 | 263 | { |
265 | 264 | $v = $mgr->decrypt(base64_decode(urldecode($token))); |
266 | 265 | $params = unserialize($v); |
267 | - } |
|
268 | - else |
|
269 | - throw new Exception('TActiveFileUpload needs either an application level cache or a security manager to work securely'); |
|
266 | + } else { |
|
267 | + throw new Exception('TActiveFileUpload needs either an application level cache or a security manager to work securely'); |
|
268 | + } |
|
270 | 269 | |
271 | 270 | assert($params instanceof TActiveFileUploadCallbackParams); |
272 | 271 | |
@@ -346,10 +345,11 @@ discard block |
||
346 | 345 | public function onUnload($param){ |
347 | 346 | if ($this->getPage()->getIsCallback()) |
348 | 347 | { |
349 | - foreach($this->getFiles() as $file) |
|
350 | - if($file->getHasFile() && file_exists($file->getLocalName())){ |
|
348 | + foreach($this->getFiles() as $file) { |
|
349 | + if($file->getHasFile() && file_exists($file->getLocalName())){ |
|
351 | 350 | unlink($file->getLocalName()); |
352 | 351 | } |
352 | + } |
|
353 | 353 | } |
354 | 354 | parent::onUnload($param); |
355 | 355 | } |
@@ -421,12 +421,14 @@ discard block |
||
421 | 421 | */ |
422 | 422 | public function saveAs($fileName, $deleteTempFile = true, $index = 0){ |
423 | 423 | if (($this->getErrorCode($index) === UPLOAD_ERR_OK) && (file_exists($this->getLocalName($index)))){ |
424 | - if ($deleteTempFile) |
|
425 | - return rename($this->getLocalName($index), $fileName); |
|
426 | - else |
|
427 | - return copy($this->getLocalName($index), $fileName); |
|
428 | - } else |
|
429 | - return false; |
|
424 | + if ($deleteTempFile) { |
|
425 | + return rename($this->getLocalName($index), $fileName); |
|
426 | + } else { |
|
427 | + return copy($this->getLocalName($index), $fileName); |
|
428 | + } |
|
429 | + } else { |
|
430 | + return false; |
|
431 | + } |
|
430 | 432 | } |
431 | 433 | |
432 | 434 | /** |
@@ -42,10 +42,10 @@ discard block |
||
42 | 42 | protected function initializeHeaderCell($cell, $columnIndex) { |
43 | 43 | $text = $this->getHeaderText(); |
44 | 44 | |
45 | - if(($classPath = $this->getHeaderRenderer()) !== '') { |
|
45 | + if (($classPath = $this->getHeaderRenderer()) !== '') { |
|
46 | 46 | $control = Prado::createComponent($classPath); |
47 | - if($control instanceof \Prado\IDataRenderer) { |
|
48 | - if($control instanceof IItemDataRenderer) { |
|
47 | + if ($control instanceof \Prado\IDataRenderer) { |
|
48 | + if ($control instanceof IItemDataRenderer) { |
|
49 | 49 | $item = $cell->getParent(); |
50 | 50 | $control->setItemIndex($item->getItemIndex()); |
51 | 51 | $control->setItemType($item->getItemType()); |
@@ -54,21 +54,21 @@ discard block |
||
54 | 54 | } |
55 | 55 | $cell->getControls()->add($control); |
56 | 56 | } |
57 | - elseif($this->getAllowSorting()) { |
|
57 | + elseif ($this->getAllowSorting()) { |
|
58 | 58 | $sortExpression = $this->getSortExpression(); |
59 | - if(($url = $this->getHeaderImageUrl()) !== '') { |
|
59 | + if (($url = $this->getHeaderImageUrl()) !== '') { |
|
60 | 60 | $button = new TActiveImageButton; |
61 | 61 | $button->setImageUrl($url); |
62 | 62 | $button->setCommandName(TDataGrid::CMD_SORT); |
63 | 63 | $button->setCommandParameter($sortExpression); |
64 | - if($text !== '') { |
|
64 | + if ($text !== '') { |
|
65 | 65 | $button->setAlternateText($text); |
66 | 66 | $button->setToolTip($text); |
67 | 67 | } |
68 | 68 | $button->setCausesValidation(false); |
69 | 69 | $cell->getControls()->add($button); |
70 | 70 | } |
71 | - elseif($text !== '') { |
|
71 | + elseif ($text !== '') { |
|
72 | 72 | $button = new TActiveLinkButton; |
73 | 73 | $button->setText($text); |
74 | 74 | $button->setCommandName(TDataGrid::CMD_SORT); |
@@ -80,16 +80,16 @@ discard block |
||
80 | 80 | $cell->setText(' '); |
81 | 81 | } |
82 | 82 | else { |
83 | - if(($url = $this->getHeaderImageUrl()) !== '') { |
|
83 | + if (($url = $this->getHeaderImageUrl()) !== '') { |
|
84 | 84 | $image = new TActiveImage; |
85 | 85 | $image->setImageUrl($url); |
86 | - if($text !== '') { |
|
86 | + if ($text !== '') { |
|
87 | 87 | $image->setAlternateText($text); |
88 | 88 | $image->setToolTip($text); |
89 | 89 | } |
90 | 90 | $cell->getControls()->add($image); |
91 | 91 | } |
92 | - elseif($text !== '') |
|
92 | + elseif ($text !== '') |
|
93 | 93 | $cell->setText($text); |
94 | 94 | else |
95 | 95 | $cell->setText(' '); |
@@ -53,8 +53,7 @@ discard block |
||
53 | 53 | $control->setData($text); |
54 | 54 | } |
55 | 55 | $cell->getControls()->add($control); |
56 | - } |
|
57 | - elseif($this->getAllowSorting()) { |
|
56 | + } elseif($this->getAllowSorting()) { |
|
58 | 57 | $sortExpression = $this->getSortExpression(); |
59 | 58 | if(($url = $this->getHeaderImageUrl()) !== '') { |
60 | 59 | $button = new TActiveImageButton; |
@@ -67,19 +66,17 @@ discard block |
||
67 | 66 | } |
68 | 67 | $button->setCausesValidation(false); |
69 | 68 | $cell->getControls()->add($button); |
70 | - } |
|
71 | - elseif($text !== '') { |
|
69 | + } elseif($text !== '') { |
|
72 | 70 | $button = new TActiveLinkButton; |
73 | 71 | $button->setText($text); |
74 | 72 | $button->setCommandName(TDataGrid::CMD_SORT); |
75 | 73 | $button->setCommandParameter($sortExpression); |
76 | 74 | $button->setCausesValidation(false); |
77 | 75 | $cell->getControls()->add($button); |
76 | + } else { |
|
77 | + $cell->setText(' '); |
|
78 | 78 | } |
79 | - else |
|
80 | - $cell->setText(' '); |
|
81 | - } |
|
82 | - else { |
|
79 | + } else { |
|
83 | 80 | if(($url = $this->getHeaderImageUrl()) !== '') { |
84 | 81 | $image = new TActiveImage; |
85 | 82 | $image->setImageUrl($url); |
@@ -88,11 +85,11 @@ discard block |
||
88 | 85 | $image->setToolTip($text); |
89 | 86 | } |
90 | 87 | $cell->getControls()->add($image); |
91 | - } |
|
92 | - elseif($text !== '') |
|
93 | - $cell->setText($text); |
|
94 | - else |
|
95 | - $cell->setText(' '); |
|
88 | + } elseif($text !== '') { |
|
89 | + $cell->setText($text); |
|
90 | + } else { |
|
91 | + $cell->setText(' '); |
|
92 | + } |
|
96 | 93 | } |
97 | 94 | } |
98 | 95 | } |
99 | 96 | \ No newline at end of file |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | public function insertAt($index, $value) |
95 | 95 | { |
96 | 96 | parent::insertAt($index, $value); |
97 | - if($this->canUpdateClientSide()) |
|
97 | + if ($this->canUpdateClientSide()) |
|
98 | 98 | $this->_hasChanged = true; |
99 | 99 | } |
100 | 100 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | public function removeAt($index) |
106 | 106 | { |
107 | 107 | parent::removeAt($index); |
108 | - if($this->canUpdateClientSide()) |
|
108 | + if ($this->canUpdateClientSide()) |
|
109 | 109 | $this->_hasChanged = true; |
110 | 110 | } |
111 | 111 | } |
112 | 112 | \ No newline at end of file |
@@ -94,8 +94,9 @@ discard block |
||
94 | 94 | public function insertAt($index, $value) |
95 | 95 | { |
96 | 96 | parent::insertAt($index, $value); |
97 | - if($this->canUpdateClientSide()) |
|
98 | - $this->_hasChanged = true; |
|
97 | + if($this->canUpdateClientSide()) { |
|
98 | + $this->_hasChanged = true; |
|
99 | + } |
|
99 | 100 | } |
100 | 101 | |
101 | 102 | /** |
@@ -105,7 +106,8 @@ discard block |
||
105 | 106 | public function removeAt($index) |
106 | 107 | { |
107 | 108 | parent::removeAt($index); |
108 | - if($this->canUpdateClientSide()) |
|
109 | - $this->_hasChanged = true; |
|
109 | + if($this->canUpdateClientSide()) { |
|
110 | + $this->_hasChanged = true; |
|
111 | + } |
|
110 | 112 | } |
111 | 113 | } |
112 | 114 | \ No newline at end of file |
@@ -44,18 +44,18 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function setSelectedIndex($index) |
46 | 46 | { |
47 | - if($this->canUpdateClientSide()) |
|
47 | + if ($this->canUpdateClientSide()) |
|
48 | 48 | { |
49 | 49 | $this->updateListItems(); |
50 | 50 | // if a prompt is set, we mimic the postback behaviour of not counting it |
51 | 51 | // in the index. We assume the prompt is _always_ the first item (Issue #368) |
52 | 52 | $promptValue = $this->getControl()->getPromptValue(); |
53 | - if($promptValue === '') |
|
53 | + if ($promptValue === '') |
|
54 | 54 | $promptValue = $this->getControl()->getPromptText(); |
55 | - if($promptValue !== '') |
|
55 | + if ($promptValue !== '') |
|
56 | 56 | $index++; |
57 | 57 | |
58 | - if($index >= 0 && $index <= $this->getControl()->getItemCount()) |
|
58 | + if ($index >= 0 && $index <= $this->getControl()->getItemCount()) |
|
59 | 59 | $this->getPage()->getCallbackClient()->select( |
60 | 60 | $this->getControl(), 'Index', $index); |
61 | 61 | } |
@@ -67,25 +67,25 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function setSelectedIndices($indices) |
69 | 69 | { |
70 | - if($this->canUpdateClientSide()) |
|
70 | + if ($this->canUpdateClientSide()) |
|
71 | 71 | { |
72 | 72 | $this->updateListItems(); |
73 | 73 | $n = $this->getControl()->getItemCount(); |
74 | 74 | |
75 | 75 | $promptValue = $this->getControl()->getPromptValue(); |
76 | - if($promptValue === '') |
|
76 | + if ($promptValue === '') |
|
77 | 77 | $promptValue = $this->getControl()->getPromptText(); |
78 | 78 | |
79 | 79 | $list = []; |
80 | - foreach($indices as $index) |
|
80 | + foreach ($indices as $index) |
|
81 | 81 | { |
82 | 82 | $index = intval($index); |
83 | - if($promptValue !== '') |
|
83 | + if ($promptValue !== '') |
|
84 | 84 | $index++; |
85 | - if($index >= 0 && $index <= $n) |
|
85 | + if ($index >= 0 && $index <= $n) |
|
86 | 86 | $list[] = $index; |
87 | 87 | } |
88 | - if(count($list) > 0) |
|
88 | + if (count($list) > 0) |
|
89 | 89 | $this->getPage()->getCallbackClient()->select( |
90 | 90 | $this->getControl(), 'Indices', $list); |
91 | 91 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function setSelectedValue($value) |
99 | 99 | { |
100 | - if($this->canUpdateClientSide()) |
|
100 | + if ($this->canUpdateClientSide()) |
|
101 | 101 | { |
102 | 102 | $this->updateListItems(); |
103 | 103 | $this->getPage()->getCallbackClient()->select( |
@@ -111,13 +111,13 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function setSelectedValues($values) |
113 | 113 | { |
114 | - if($this->canUpdateClientSide()) |
|
114 | + if ($this->canUpdateClientSide()) |
|
115 | 115 | { |
116 | 116 | $this->updateListItems(); |
117 | 117 | $list = []; |
118 | - foreach($values as $value) |
|
118 | + foreach ($values as $value) |
|
119 | 119 | $list[] = $value; |
120 | - if(count($list) > 0) |
|
120 | + if (count($list) > 0) |
|
121 | 121 | $this->getPage()->getCallbackClient()->select( |
122 | 122 | $this->getControl(), 'Values', $list); |
123 | 123 | } |
@@ -128,10 +128,10 @@ discard block |
||
128 | 128 | */ |
129 | 129 | public function clearSelection() |
130 | 130 | { |
131 | - if($this->canUpdateClientSide()) |
|
131 | + if ($this->canUpdateClientSide()) |
|
132 | 132 | { |
133 | 133 | $this->updateListItems(); |
134 | - if($this->getControl() instanceof TActiveDropDownList) |
|
134 | + if ($this->getControl() instanceof TActiveDropDownList) |
|
135 | 135 | { |
136 | 136 | // clearing a TActiveDropDownList's selection actually doesn't select the first item; |
137 | 137 | // we mimic the postback behaviour selecting it (Issue #368) |
@@ -147,10 +147,10 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function updateListItems() |
149 | 149 | { |
150 | - if($this->canUpdateClientSide()) |
|
150 | + if ($this->canUpdateClientSide()) |
|
151 | 151 | { |
152 | 152 | $items = $this->getControl()->getItems(); |
153 | - if($items instanceof TActiveListItemCollection |
|
153 | + if ($items instanceof TActiveListItemCollection |
|
154 | 154 | && $items->getListHasChanged()) |
155 | 155 | { |
156 | 156 | $items->updateClientSide(); |
@@ -50,14 +50,17 @@ discard block |
||
50 | 50 | // if a prompt is set, we mimic the postback behaviour of not counting it |
51 | 51 | // in the index. We assume the prompt is _always_ the first item (Issue #368) |
52 | 52 | $promptValue = $this->getControl()->getPromptValue(); |
53 | - if($promptValue === '') |
|
54 | - $promptValue = $this->getControl()->getPromptText(); |
|
55 | - if($promptValue !== '') |
|
56 | - $index++; |
|
53 | + if($promptValue === '') { |
|
54 | + $promptValue = $this->getControl()->getPromptText(); |
|
55 | + } |
|
56 | + if($promptValue !== '') { |
|
57 | + $index++; |
|
58 | + } |
|
57 | 59 | |
58 | - if($index >= 0 && $index <= $this->getControl()->getItemCount()) |
|
59 | - $this->getPage()->getCallbackClient()->select( |
|
60 | + if($index >= 0 && $index <= $this->getControl()->getItemCount()) { |
|
61 | + $this->getPage()->getCallbackClient()->select( |
|
60 | 62 | $this->getControl(), 'Index', $index); |
63 | + } |
|
61 | 64 | } |
62 | 65 | } |
63 | 66 | |
@@ -73,21 +76,25 @@ discard block |
||
73 | 76 | $n = $this->getControl()->getItemCount(); |
74 | 77 | |
75 | 78 | $promptValue = $this->getControl()->getPromptValue(); |
76 | - if($promptValue === '') |
|
77 | - $promptValue = $this->getControl()->getPromptText(); |
|
79 | + if($promptValue === '') { |
|
80 | + $promptValue = $this->getControl()->getPromptText(); |
|
81 | + } |
|
78 | 82 | |
79 | 83 | $list = []; |
80 | 84 | foreach($indices as $index) |
81 | 85 | { |
82 | 86 | $index = intval($index); |
83 | - if($promptValue !== '') |
|
84 | - $index++; |
|
85 | - if($index >= 0 && $index <= $n) |
|
86 | - $list[] = $index; |
|
87 | + if($promptValue !== '') { |
|
88 | + $index++; |
|
89 | + } |
|
90 | + if($index >= 0 && $index <= $n) { |
|
91 | + $list[] = $index; |
|
92 | + } |
|
87 | 93 | } |
88 | - if(count($list) > 0) |
|
89 | - $this->getPage()->getCallbackClient()->select( |
|
94 | + if(count($list) > 0) { |
|
95 | + $this->getPage()->getCallbackClient()->select( |
|
90 | 96 | $this->getControl(), 'Indices', $list); |
97 | + } |
|
91 | 98 | } |
92 | 99 | } |
93 | 100 | |
@@ -115,11 +122,13 @@ discard block |
||
115 | 122 | { |
116 | 123 | $this->updateListItems(); |
117 | 124 | $list = []; |
118 | - foreach($values as $value) |
|
119 | - $list[] = $value; |
|
120 | - if(count($list) > 0) |
|
121 | - $this->getPage()->getCallbackClient()->select( |
|
125 | + foreach($values as $value) { |
|
126 | + $list[] = $value; |
|
127 | + } |
|
128 | + if(count($list) > 0) { |
|
129 | + $this->getPage()->getCallbackClient()->select( |
|
122 | 130 | $this->getControl(), 'Values', $list); |
131 | + } |
|
123 | 132 | } |
124 | 133 | } |
125 | 134 |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | public function setDataSource($value) |
58 | 58 | { |
59 | 59 | parent::setDataSource($value); |
60 | - if($this->getActiveControl()->canUpdateClientSide()) { |
|
60 | + if ($this->getActiveControl()->canUpdateClientSide()) { |
|
61 | 61 | $this->renderPager(); |
62 | 62 | $this->getPage()->getAdapter()->registerControlToRender($this, $this->getResponse()->createHtmlWriter()); |
63 | 63 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | protected function getContainerID() |
71 | 71 | { |
72 | - return $this->ClientID . '_Container'; |
|
72 | + return $this->ClientID.'_Container'; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function render($writer) |
82 | 82 | { |
83 | - if($this->getHasPreRendered()) { |
|
83 | + if ($this->getHasPreRendered()) { |
|
84 | 84 | $this->renderDataList($writer); |
85 | - if($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getContainerID(), $writer); |
|
85 | + if ($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getContainerID(), $writer); |
|
86 | 86 | } |
87 | 87 | else { |
88 | 88 | $this->getPage()->getAdapter()->registerControlToRender($this, $writer); |
@@ -97,9 +97,9 @@ discard block |
||
97 | 97 | private function renderPager() |
98 | 98 | { |
99 | 99 | $pager = $this->getPage()->findControlsByType('Prado\Web\UI\ActiveControls\TActivePager', false); |
100 | - foreach($pager as $item) |
|
100 | + foreach ($pager as $item) |
|
101 | 101 | { |
102 | - if($item->ControlToPaginate == $this->ID) { |
|
102 | + if ($item->ControlToPaginate == $this->ID) { |
|
103 | 103 | $writer = $this->getResponse()->createHtmlWriter(); |
104 | 104 | $this->getPage()->getAdapter()->registerControlToRender($item, $writer); |
105 | 105 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | private function renderDataList($writer) |
115 | 115 | { |
116 | - $writer->write('<span id="' . $this->getContainerID() . '">'); |
|
116 | + $writer->write('<span id="'.$this->getContainerID().'">'); |
|
117 | 117 | parent::render($writer); |
118 | 118 | $writer->write('</span>'); |
119 | 119 | } |
@@ -82,9 +82,10 @@ |
||
82 | 82 | { |
83 | 83 | if($this->getHasPreRendered()) { |
84 | 84 | $this->renderDataList($writer); |
85 | - if($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getContainerID(), $writer); |
|
86 | - } |
|
87 | - else { |
|
85 | + if($this->getActiveControl()->canUpdateClientSide()) { |
|
86 | + $this->getPage()->getCallbackClient()->replaceContent($this->getContainerID(), $writer); |
|
87 | + } |
|
88 | + } else { |
|
88 | 89 | $this->getPage()->getAdapter()->registerControlToRender($this, $writer); |
89 | 90 | } |
90 | 91 | } |
@@ -64,9 +64,9 @@ |
||
64 | 64 | */ |
65 | 65 | public function setText($value) { |
66 | 66 | parent::setText($value); |
67 | - if($this->getActiveControl()->canUpdateClientSide() && $this->getHasLoadedPostData()) |
|
67 | + if ($this->getActiveControl()->canUpdateClientSide() && $this->getHasLoadedPostData()) |
|
68 | 68 | { |
69 | - if($this->getEnableVisualEdit()) |
|
69 | + if ($this->getEnableVisualEdit()) |
|
70 | 70 | { |
71 | 71 | $value = str_ireplace(["\r\n", "\n"], "", $value); |
72 | 72 | $command = "tinyMCE.getInstanceById('{$this->getClientID()}').execCommand('mceSetContent',false,'{$value}')"; |
@@ -71,9 +71,9 @@ |
||
71 | 71 | $value = str_ireplace(["\r\n", "\n"], "", $value); |
72 | 72 | $command = "tinyMCE.getInstanceById('{$this->getClientID()}').execCommand('mceSetContent',false,'{$value}')"; |
73 | 73 | $this->getPage()->getCallbackClient()->evaluateScript($command); |
74 | + } else { |
|
75 | + $this->getPage()->getCallbackClient()->setValue($this, $value); |
|
74 | 76 | } |
75 | - else |
|
76 | - $this->getPage()->getCallbackClient()->setValue($this, $value); |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | { |
83 | 83 | $value = TPropertyValue::ensureBoolean($value); |
84 | 84 | $this->setViewState('DisplayTextBox', $value, false); |
85 | - if($this->getActiveControl()->canUpdateClientSide()) |
|
85 | + if ($this->getActiveControl()->canUpdateClientSide()) |
|
86 | 86 | $this->callClientFunction('setDisplayTextBox', $value); |
87 | 87 | } |
88 | 88 | |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | protected function callClientFunction($func, $value) |
103 | 103 | { |
104 | 104 | $client = $this->getPage()->getCallbackClient(); |
105 | - $code = $this->getClientClassName() . '.' . $func; |
|
106 | - $client->callClientFunction($code, [$this,$value]); |
|
105 | + $code = $this->getClientClassName().'.'.$func; |
|
106 | + $client->callClientFunction($code, [$this, $value]); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -128,8 +128,8 @@ discard block |
||
128 | 128 | protected function getExternalControlID() |
129 | 129 | { |
130 | 130 | $extID = $this->getEditTriggerControlID(); |
131 | - if($extID === null) return ''; |
|
132 | - if(($control = $this->findControl($extID)) !== null) |
|
131 | + if ($extID === null) return ''; |
|
132 | + if (($control = $this->findControl($extID)) !== null) |
|
133 | 133 | return $control->getClientID(); |
134 | 134 | return $extID; |
135 | 135 | } |
@@ -141,11 +141,11 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function setText($value) |
143 | 143 | { |
144 | - if(TTextBox::getText() === $value) |
|
144 | + if (TTextBox::getText() === $value) |
|
145 | 145 | return; |
146 | 146 | |
147 | 147 | TTextBox::setText($value); |
148 | - if($this->getActiveControl()->canUpdateClientSide()) |
|
148 | + if ($this->getActiveControl()->canUpdateClientSide()) |
|
149 | 149 | { |
150 | 150 | $client = $this->getPage()->getCallbackClient(); |
151 | 151 | $client->update($this->getLabelClientID(), $value); |
@@ -158,10 +158,10 @@ discard block |
||
158 | 158 | * @param boolean value |
159 | 159 | * @since 3.1.2 |
160 | 160 | */ |
161 | - public function setReadOnly ($value) |
|
161 | + public function setReadOnly($value) |
|
162 | 162 | { |
163 | 163 | $value = TPropertyValue::ensureBoolean($value); |
164 | - if(TTextBox::getReadOnly() === $value) |
|
164 | + if (TTextBox::getReadOnly() === $value) |
|
165 | 165 | return; |
166 | 166 | |
167 | 167 | TTextBox::setReadOnly($value); |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public function renderContents($writer) |
187 | 187 | { |
188 | - if(($text = $this->getText()) === '') |
|
188 | + if (($text = $this->getText()) === '') |
|
189 | 189 | parent::renderContents($writer); |
190 | 190 | else |
191 | 191 | $writer->write($text); |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | */ |
197 | 197 | protected function getLabelClientID() |
198 | 198 | { |
199 | - return $this->getClientID() . '__label'; |
|
199 | + return $this->getClientID().'__label'; |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | /** |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | public function onCallback($param) |
210 | 210 | { |
211 | 211 | $action = $param->getCallbackParameter(); |
212 | - if(is_array($action) && $action[0] === '__InlineEditor_loadExternalText__') |
|
212 | + if (is_array($action) && $action[0] === '__InlineEditor_loadExternalText__') |
|
213 | 213 | { |
214 | 214 | $parameter = new TCallbackEventParameter($this->getResponse(), $action[1]); |
215 | 215 | $this->onLoadingText($parameter); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | $options['AutoHide'] = $this->getAutoHideTextBox() == false ? '' : true; |
230 | 230 | $options['AutoPostBack'] = $this->getAutoPostBack() == false ? '' : true; |
231 | 231 | $options['Columns'] = $this->getColumns(); |
232 | - if($this->getTextMode() === 'MultiLine') |
|
232 | + if ($this->getTextMode() === 'MultiLine') |
|
233 | 233 | { |
234 | 234 | $options['Rows'] = $this->getRows(); |
235 | 235 | $options['Wrap'] = $this->getWrap() == false ? '' : true; |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | $options['MaxLength'] = $length > 0 ? $length : ''; |
241 | 241 | } |
242 | 242 | |
243 | - if($this->hasEventHandler('OnLoadingText')) |
|
243 | + if ($this->hasEventHandler('OnLoadingText')) |
|
244 | 244 | $options['LoadTextOnEdit'] = true; |
245 | 245 | |
246 | 246 | $options['ReadOnly'] = $this->getReadOnly(); |
@@ -82,8 +82,9 @@ discard block |
||
82 | 82 | { |
83 | 83 | $value = TPropertyValue::ensureBoolean($value); |
84 | 84 | $this->setViewState('DisplayTextBox', $value, false); |
85 | - if($this->getActiveControl()->canUpdateClientSide()) |
|
86 | - $this->callClientFunction('setDisplayTextBox', $value); |
|
85 | + if($this->getActiveControl()->canUpdateClientSide()) { |
|
86 | + $this->callClientFunction('setDisplayTextBox', $value); |
|
87 | + } |
|
87 | 88 | } |
88 | 89 | |
89 | 90 | /** |
@@ -128,9 +129,12 @@ discard block |
||
128 | 129 | protected function getExternalControlID() |
129 | 130 | { |
130 | 131 | $extID = $this->getEditTriggerControlID(); |
131 | - if($extID === null) return ''; |
|
132 | - if(($control = $this->findControl($extID)) !== null) |
|
133 | - return $control->getClientID(); |
|
132 | + if($extID === null) { |
|
133 | + return ''; |
|
134 | + } |
|
135 | + if(($control = $this->findControl($extID)) !== null) { |
|
136 | + return $control->getClientID(); |
|
137 | + } |
|
134 | 138 | return $extID; |
135 | 139 | } |
136 | 140 | |
@@ -141,8 +145,9 @@ discard block |
||
141 | 145 | */ |
142 | 146 | public function setText($value) |
143 | 147 | { |
144 | - if(TTextBox::getText() === $value) |
|
145 | - return; |
|
148 | + if(TTextBox::getText() === $value) { |
|
149 | + return; |
|
150 | + } |
|
146 | 151 | |
147 | 152 | TTextBox::setText($value); |
148 | 153 | if($this->getActiveControl()->canUpdateClientSide()) |
@@ -161,8 +166,9 @@ discard block |
||
161 | 166 | public function setReadOnly ($value) |
162 | 167 | { |
163 | 168 | $value = TPropertyValue::ensureBoolean($value); |
164 | - if(TTextBox::getReadOnly() === $value) |
|
165 | - return; |
|
169 | + if(TTextBox::getReadOnly() === $value) { |
|
170 | + return; |
|
171 | + } |
|
166 | 172 | |
167 | 173 | TTextBox::setReadOnly($value); |
168 | 174 | if ($this->getActiveControl()->canUpdateClientSide()) |
@@ -185,10 +191,11 @@ discard block |
||
185 | 191 | */ |
186 | 192 | public function renderContents($writer) |
187 | 193 | { |
188 | - if(($text = $this->getText()) === '') |
|
189 | - parent::renderContents($writer); |
|
190 | - else |
|
191 | - $writer->write($text); |
|
194 | + if(($text = $this->getText()) === '') { |
|
195 | + parent::renderContents($writer); |
|
196 | + } else { |
|
197 | + $writer->write($text); |
|
198 | + } |
|
192 | 199 | } |
193 | 200 | |
194 | 201 | /** |
@@ -233,15 +240,15 @@ discard block |
||
233 | 240 | { |
234 | 241 | $options['Rows'] = $this->getRows(); |
235 | 242 | $options['Wrap'] = $this->getWrap() == false ? '' : true; |
236 | - } |
|
237 | - else |
|
243 | + } else |
|
238 | 244 | { |
239 | 245 | $length = $this->getMaxLength(); |
240 | 246 | $options['MaxLength'] = $length > 0 ? $length : ''; |
241 | 247 | } |
242 | 248 | |
243 | - if($this->hasEventHandler('OnLoadingText')) |
|
244 | - $options['LoadTextOnEdit'] = true; |
|
249 | + if($this->hasEventHandler('OnLoadingText')) { |
|
250 | + $options['LoadTextOnEdit'] = true; |
|
251 | + } |
|
245 | 252 | |
246 | 253 | $options['ReadOnly'] = $this->getReadOnly(); |
247 | 254 | return $options; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function setDataSource($value) { |
63 | 63 | parent::setDataSource($value); |
64 | - if($this->getActiveControl()->canUpdateClientSide()) { |
|
64 | + if ($this->getActiveControl()->canUpdateClientSide()) { |
|
65 | 65 | $this->renderPager(); |
66 | 66 | $this->getPage()->getAdapter()->registerControlToRender($this, $this->getResponse()->createHtmlWriter()); |
67 | 67 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @return string container id |
89 | 89 | */ |
90 | 90 | public function getSurroundingTagID() { |
91 | - return $this->getClientID() . '_Container'; |
|
91 | + return $this->getClientID().'_Container'; |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -98,9 +98,9 @@ discard block |
||
98 | 98 | * @param THtmlWriter writer for the rendering purpose |
99 | 99 | */ |
100 | 100 | public function render($writer) { |
101 | - if($this->getHasPreRendered()) { |
|
101 | + if ($this->getHasPreRendered()) { |
|
102 | 102 | $this->renderRepeater($writer); |
103 | - if($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getSurroundingTagId(), $writer); |
|
103 | + if ($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getSurroundingTagId(), $writer); |
|
104 | 104 | } |
105 | 105 | else { |
106 | 106 | $this->getPage()->getAdapter()->registerControlToRender($this, $writer); |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | */ |
115 | 115 | private function renderPager() { |
116 | 116 | $pager = $this->getPage()->findControlsByType('Prado\Web\UI\ActiveControls\TActivePager', false); |
117 | - foreach($pager as $item) { |
|
118 | - if($item->ControlToPaginate == $this->ID) { |
|
117 | + foreach ($pager as $item) { |
|
118 | + if ($item->ControlToPaginate == $this->ID) { |
|
119 | 119 | $writer = $this->getResponse()->createHtmlWriter(); |
120 | 120 | $this->getPage()->getAdapter()->registerControlToRender($item, $writer); |
121 | 121 | } |
@@ -100,9 +100,10 @@ |
||
100 | 100 | public function render($writer) { |
101 | 101 | if($this->getHasPreRendered()) { |
102 | 102 | $this->renderRepeater($writer); |
103 | - if($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getSurroundingTagId(), $writer); |
|
104 | - } |
|
105 | - else { |
|
103 | + if($this->getActiveControl()->canUpdateClientSide()) { |
|
104 | + $this->getPage()->getCallbackClient()->replaceContent($this->getSurroundingTagId(), $writer); |
|
105 | + } |
|
106 | + } else { |
|
106 | 107 | $this->getPage()->getAdapter()->registerControlToRender($this, $writer); |
107 | 108 | } |
108 | 109 | } |