@@ -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 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public function setDataSource($value) { |
| 90 | 90 | parent::setDataSource($value); |
| 91 | - if($this->getActiveControl()->canUpdateClientSide()) { |
|
| 91 | + if ($this->getActiveControl()->canUpdateClientSide()) { |
|
| 92 | 92 | $this->renderPager(); |
| 93 | 93 | $this->getPage()->getAdapter()->registerControlToRender($this, $this->getResponse()->createHtmlWriter()); |
| 94 | 94 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | * @return string container id |
| 116 | 116 | */ |
| 117 | 117 | public function getSurroundingTagID() { |
| 118 | - return $this->getClientID() . '_Container'; |
|
| 118 | + return $this->getClientID().'_Container'; |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /** |
@@ -133,8 +133,8 @@ discard block |
||
| 133 | 133 | * @return mixed the button instance |
| 134 | 134 | */ |
| 135 | 135 | protected function createPagerButton($pager, $buttonType, $enabled, $text, $commandName, $commandParameter) { |
| 136 | - if($buttonType === TDataGridPagerButtonType::LinkButton) { |
|
| 137 | - if($enabled) |
|
| 136 | + if ($buttonType === TDataGridPagerButtonType::LinkButton) { |
|
| 137 | + if ($enabled) |
|
| 138 | 138 | $button = new TActiveLinkButton; |
| 139 | 139 | else { |
| 140 | 140 | $button = new TLabel; |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | } |
| 145 | 145 | else { |
| 146 | 146 | $button = new TActiveButton; |
| 147 | - if(!$enabled) |
|
| 147 | + if (!$enabled) |
|
| 148 | 148 | $button->setEnabled(false); |
| 149 | 149 | } |
| 150 | 150 | $button->setText($text); |
@@ -173,9 +173,9 @@ discard block |
||
| 173 | 173 | * @param THtmlWriter writer for the rendering purpose |
| 174 | 174 | */ |
| 175 | 175 | public function render($writer) { |
| 176 | - if($this->getHasPreRendered()) { |
|
| 176 | + if ($this->getHasPreRendered()) { |
|
| 177 | 177 | $this->renderDataGrid($writer); |
| 178 | - if($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getSurroundingTagId(), $writer); |
|
| 178 | + if ($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getSurroundingTagId(), $writer); |
|
| 179 | 179 | } |
| 180 | 180 | else { |
| 181 | 181 | $this->getPage()->getAdapter()->registerControlToRender($this, $writer); |
@@ -189,8 +189,8 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | private function renderPager() { |
| 191 | 191 | $pager = $this->getPage()->findControlsByType('Prado\Web\UI\ActiveControls\TActivePager', false); |
| 192 | - foreach($pager as $item) { |
|
| 193 | - if($item->ControlToPaginate == $this->ID) { |
|
| 192 | + foreach ($pager as $item) { |
|
| 193 | + if ($item->ControlToPaginate == $this->ID) { |
|
| 194 | 194 | $writer = $this->getResponse()->createHtmlWriter(); |
| 195 | 195 | $this->getPage()->getAdapter()->registerControlToRender($item, $writer); |
| 196 | 196 | } |
@@ -134,18 +134,18 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | protected function createPagerButton($pager, $buttonType, $enabled, $text, $commandName, $commandParameter) { |
| 136 | 136 | if($buttonType === TDataGridPagerButtonType::LinkButton) { |
| 137 | - if($enabled) |
|
| 138 | - $button = new TActiveLinkButton; |
|
| 139 | - else { |
|
| 137 | + if($enabled) { |
|
| 138 | + $button = new TActiveLinkButton; |
|
| 139 | + } else { |
|
| 140 | 140 | $button = new TLabel; |
| 141 | 141 | $button->setText($text); |
| 142 | 142 | return $button; |
| 143 | 143 | } |
| 144 | - } |
|
| 145 | - else { |
|
| 144 | + } else { |
|
| 146 | 145 | $button = new TActiveButton; |
| 147 | - if(!$enabled) |
|
| 148 | - $button->setEnabled(false); |
|
| 146 | + if(!$enabled) { |
|
| 147 | + $button->setEnabled(false); |
|
| 148 | + } |
|
| 149 | 149 | } |
| 150 | 150 | $button->setText($text); |
| 151 | 151 | $button->setCommandName($commandName); |
@@ -175,9 +175,10 @@ discard block |
||
| 175 | 175 | public function render($writer) { |
| 176 | 176 | if($this->getHasPreRendered()) { |
| 177 | 177 | $this->renderDataGrid($writer); |
| 178 | - if($this->getActiveControl()->canUpdateClientSide()) $this->getPage()->getCallbackClient()->replaceContent($this->getSurroundingTagId(), $writer); |
|
| 179 | - } |
|
| 180 | - else { |
|
| 178 | + if($this->getActiveControl()->canUpdateClientSide()) { |
|
| 179 | + $this->getPage()->getCallbackClient()->replaceContent($this->getSurroundingTagId(), $writer); |
|
| 180 | + } |
|
| 181 | + } else { |
|
| 181 | 182 | $this->getPage()->getAdapter()->registerControlToRender($this, $writer); |
| 182 | 183 | } |
| 183 | 184 | } |
@@ -30,11 +30,11 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | protected function getCombinedStyle($obj) |
| 32 | 32 | { |
| 33 | - if(!($obj instanceof TStyle)) |
|
| 33 | + if (!($obj instanceof TStyle)) |
|
| 34 | 34 | return []; |
| 35 | 35 | $style = $obj->getStyleFields(); |
| 36 | 36 | $style = array_merge($style, $this->getStyleFromString($obj->getCustomStyle())); |
| 37 | - if($obj->hasFont()) |
|
| 37 | + if ($obj->hasFont()) |
|
| 38 | 38 | $style = array_merge($style, $this->getStyleFromString($obj->getFont()->toString())); |
| 39 | 39 | return $style; |
| 40 | 40 | } |
@@ -46,12 +46,12 @@ discard block |
||
| 46 | 46 | protected function getStyleFromString($string) |
| 47 | 47 | { |
| 48 | 48 | $style = []; |
| 49 | - if(!is_string($string)) return $style; |
|
| 49 | + if (!is_string($string)) return $style; |
|
| 50 | 50 | |
| 51 | - foreach(explode(';', $string) as $sub) |
|
| 51 | + foreach (explode(';', $string) as $sub) |
|
| 52 | 52 | { |
| 53 | 53 | $arr = explode(':', $sub); |
| 54 | - if(isset($arr[1]) && trim($arr[0]) !== '') |
|
| 54 | + if (isset($arr[1]) && trim($arr[0]) !== '') |
|
| 55 | 55 | $style[trim($arr[0])] = trim($arr[1]); |
| 56 | 56 | } |
| 57 | 57 | return $style; |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | protected function getCssClassDiff() |
| 64 | 64 | { |
| 65 | - if($this->_old === null) |
|
| 65 | + if ($this->_old === null) |
|
| 66 | 66 | { |
| 67 | 67 | return ($this->_new !== null) && $this->_new->hasCssClass() |
| 68 | 68 | ? $this->_new->getCssClass() : null; |
@@ -90,13 +90,13 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | public function getDifference() |
| 92 | 92 | { |
| 93 | - if($this->_new === null) |
|
| 93 | + if ($this->_new === null) |
|
| 94 | 94 | return $this->_null; |
| 95 | 95 | else |
| 96 | 96 | { |
| 97 | 97 | $css = $this->getCssClassDiff(); |
| 98 | 98 | $style = $this->getStyleDiff(); |
| 99 | - if(($css !== null) || ($style !== null)) |
|
| 99 | + if (($css !== null) || ($style !== null)) |
|
| 100 | 100 | return ['CssClass' => $css, 'Style' => $style]; |
| 101 | 101 | else |
| 102 | 102 | $this->_null; |
@@ -30,12 +30,14 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | protected function getCombinedStyle($obj) |
| 32 | 32 | { |
| 33 | - if(!($obj instanceof TStyle)) |
|
| 34 | - return []; |
|
| 33 | + if(!($obj instanceof TStyle)) { |
|
| 34 | + return []; |
|
| 35 | + } |
|
| 35 | 36 | $style = $obj->getStyleFields(); |
| 36 | 37 | $style = array_merge($style, $this->getStyleFromString($obj->getCustomStyle())); |
| 37 | - if($obj->hasFont()) |
|
| 38 | - $style = array_merge($style, $this->getStyleFromString($obj->getFont()->toString())); |
|
| 38 | + if($obj->hasFont()) { |
|
| 39 | + $style = array_merge($style, $this->getStyleFromString($obj->getFont()->toString())); |
|
| 40 | + } |
|
| 39 | 41 | return $style; |
| 40 | 42 | } |
| 41 | 43 | |
@@ -46,13 +48,16 @@ discard block |
||
| 46 | 48 | protected function getStyleFromString($string) |
| 47 | 49 | { |
| 48 | 50 | $style = []; |
| 49 | - if(!is_string($string)) return $style; |
|
| 51 | + if(!is_string($string)) { |
|
| 52 | + return $style; |
|
| 53 | + } |
|
| 50 | 54 | |
| 51 | 55 | foreach(explode(';', $string) as $sub) |
| 52 | 56 | { |
| 53 | 57 | $arr = explode(':', $sub); |
| 54 | - if(isset($arr[1]) && trim($arr[0]) !== '') |
|
| 55 | - $style[trim($arr[0])] = trim($arr[1]); |
|
| 58 | + if(isset($arr[1]) && trim($arr[0]) !== '') { |
|
| 59 | + $style[trim($arr[0])] = trim($arr[1]); |
|
| 60 | + } |
|
| 56 | 61 | } |
| 57 | 62 | return $style; |
| 58 | 63 | } |
@@ -66,8 +71,7 @@ discard block |
||
| 66 | 71 | { |
| 67 | 72 | return ($this->_new !== null) && $this->_new->hasCssClass() |
| 68 | 73 | ? $this->_new->getCssClass() : null; |
| 69 | - } |
|
| 70 | - else |
|
| 74 | + } else |
|
| 71 | 75 | { |
| 72 | 76 | return $this->_old->getCssClass() !== $this->_new->getCssClass() ? |
| 73 | 77 | $this->_new->getCssClass() : null; |
@@ -90,16 +94,17 @@ discard block |
||
| 90 | 94 | */ |
| 91 | 95 | public function getDifference() |
| 92 | 96 | { |
| 93 | - if($this->_new === null) |
|
| 94 | - return $this->_null; |
|
| 95 | - else |
|
| 97 | + if($this->_new === null) { |
|
| 98 | + return $this->_null; |
|
| 99 | + } else |
|
| 96 | 100 | { |
| 97 | 101 | $css = $this->getCssClassDiff(); |
| 98 | 102 | $style = $this->getStyleDiff(); |
| 99 | - if(($css !== null) || ($style !== null)) |
|
| 100 | - return ['CssClass' => $css, 'Style' => $style]; |
|
| 101 | - else |
|
| 102 | - $this->_null; |
|
| 103 | + if(($css !== null) || ($style !== null)) { |
|
| 104 | + return ['CssClass' => $css, 'Style' => $style]; |
|
| 105 | + } else { |
|
| 106 | + $this->_null; |
|
| 107 | + } |
|
| 103 | 108 | } |
| 104 | 109 | } |
| 105 | 110 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $list->dataBind(); |
| 108 | 108 | $list->setSelectedIndex($this->getCurrentPageIndex()); |
| 109 | 109 | $list->setAutoPostBack(true); |
| 110 | - $list->attachEventHandler('OnSelectedIndexChanged', [$this,'listIndexChanged']); |
|
| 110 | + $list->attachEventHandler('OnSelectedIndexChanged', [$this, 'listIndexChanged']); |
|
| 111 | 111 | $list->attachEventHandler('OnCallback', [$this, 'handleCallback']); |
| 112 | 112 | } |
| 113 | 113 | |
@@ -125,9 +125,9 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | protected function createPagerButton($buttonType, $enabled, $text, $commandName, $commandParameter) |
| 127 | 127 | { |
| 128 | - if($buttonType === TPagerButtonType::LinkButton) |
|
| 128 | + if ($buttonType === TPagerButtonType::LinkButton) |
|
| 129 | 129 | { |
| 130 | - if($enabled) |
|
| 130 | + if ($enabled) |
|
| 131 | 131 | $button = new TActiveLinkButton; |
| 132 | 132 | else |
| 133 | 133 | { |
@@ -137,11 +137,11 @@ discard block |
||
| 137 | 137 | return $button; |
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | - elseif($buttonType === TPagerButtonType::ImageButton) |
|
| 140 | + elseif ($buttonType === TPagerButtonType::ImageButton) |
|
| 141 | 141 | { |
| 142 | 142 | $button = new TActiveImageButton; |
| 143 | 143 | $button->setImageUrl($this->getPageImageUrl($text, $commandName)); |
| 144 | - if($enabled) |
|
| 144 | + if ($enabled) |
|
| 145 | 145 | $button->Visible = true; |
| 146 | 146 | else |
| 147 | 147 | $button->Visible = false; |
@@ -149,11 +149,11 @@ discard block |
||
| 149 | 149 | else |
| 150 | 150 | { |
| 151 | 151 | $button = new TActiveButton; |
| 152 | - if(!$enabled) |
|
| 152 | + if (!$enabled) |
|
| 153 | 153 | $button->setEnabled(false); |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - if($buttonType === TPagerButtonType::ImageButton) |
|
| 156 | + if ($buttonType === TPagerButtonType::ImageButton) |
|
| 157 | 157 | { |
| 158 | 158 | $button->ImageUrl = $text; |
| 159 | 159 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | * @param mixed $sender |
| 180 | 180 | * @param TCallbackEventParameter $param |
| 181 | 181 | */ |
| 182 | - public function handleCallback ($sender, $param) |
|
| 182 | + public function handleCallback($sender, $param) |
|
| 183 | 183 | { |
| 184 | 184 | // Update all the buttons pagers attached to the same control. |
| 185 | 185 | // Dropdown pagers doesn't need to be re-rendered. |
@@ -198,13 +198,13 @@ discard block |
||
| 198 | 198 | $this->onCallback($param); |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | - public function render ($writer) |
|
| 201 | + public function render($writer) |
|
| 202 | 202 | { |
| 203 | - if($this->getHasPreRendered()) |
|
| 203 | + if ($this->getHasPreRendered()) |
|
| 204 | 204 | { |
| 205 | - $this->setDisplay(($this->getPageCount() == 1)?TDisplayStyle::None:TDisplayStyle::Dynamic); |
|
| 205 | + $this->setDisplay(($this->getPageCount() == 1) ?TDisplayStyle::None : TDisplayStyle::Dynamic); |
|
| 206 | 206 | TWebControl::render($writer); |
| 207 | - if($this->getActiveControl()->canUpdateClientSide()) |
|
| 207 | + if ($this->getActiveControl()->canUpdateClientSide()) |
|
| 208 | 208 | $this->getPage()->getCallbackClient()->replaceContent($this, $writer); |
| 209 | 209 | } |
| 210 | 210 | else |
@@ -127,30 +127,30 @@ discard block |
||
| 127 | 127 | { |
| 128 | 128 | if($buttonType === TPagerButtonType::LinkButton) |
| 129 | 129 | { |
| 130 | - if($enabled) |
|
| 131 | - $button = new TActiveLinkButton; |
|
| 132 | - else |
|
| 130 | + if($enabled) { |
|
| 131 | + $button = new TActiveLinkButton; |
|
| 132 | + } else |
|
| 133 | 133 | { |
| 134 | 134 | $button = new TLabel; |
| 135 | 135 | $button->setText($text); |
| 136 | 136 | $button->setCssClass($this->getButtonCssClass()); |
| 137 | 137 | return $button; |
| 138 | 138 | } |
| 139 | - } |
|
| 140 | - elseif($buttonType === TPagerButtonType::ImageButton) |
|
| 139 | + } elseif($buttonType === TPagerButtonType::ImageButton) |
|
| 141 | 140 | { |
| 142 | 141 | $button = new TActiveImageButton; |
| 143 | 142 | $button->setImageUrl($this->getPageImageUrl($text, $commandName)); |
| 144 | - if($enabled) |
|
| 145 | - $button->Visible = true; |
|
| 146 | - else |
|
| 147 | - $button->Visible = false; |
|
| 148 | - } |
|
| 149 | - else |
|
| 143 | + if($enabled) { |
|
| 144 | + $button->Visible = true; |
|
| 145 | + } else { |
|
| 146 | + $button->Visible = false; |
|
| 147 | + } |
|
| 148 | + } else |
|
| 150 | 149 | { |
| 151 | 150 | $button = new TActiveButton; |
| 152 | - if(!$enabled) |
|
| 153 | - $button->setEnabled(false); |
|
| 151 | + if(!$enabled) { |
|
| 152 | + $button->setEnabled(false); |
|
| 153 | + } |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | if($buttonType === TPagerButtonType::ImageButton) |
@@ -204,10 +204,10 @@ discard block |
||
| 204 | 204 | { |
| 205 | 205 | $this->setDisplay(($this->getPageCount() == 1)?TDisplayStyle::None:TDisplayStyle::Dynamic); |
| 206 | 206 | TWebControl::render($writer); |
| 207 | - if($this->getActiveControl()->canUpdateClientSide()) |
|
| 208 | - $this->getPage()->getCallbackClient()->replaceContent($this, $writer); |
|
| 209 | - } |
|
| 210 | - else |
|
| 207 | + if($this->getActiveControl()->canUpdateClientSide()) { |
|
| 208 | + $this->getPage()->getCallbackClient()->replaceContent($this, $writer); |
|
| 209 | + } |
|
| 210 | + } else |
|
| 211 | 211 | { |
| 212 | 212 | $this->getPage()->getAdapter()->registerControlToRender($this, $writer); |
| 213 | 213 | } |