@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function trackChanges() |
| 91 | 91 | { |
| 92 | - foreach($this->_states as $name => $value) |
|
| 92 | + foreach ($this->_states as $name => $value) |
|
| 93 | 93 | { |
| 94 | 94 | $obj = $this->_control->getViewState($name); |
| 95 | 95 | $this->_existingState[$name] = is_object($obj) ? clone($obj) : $obj; |
@@ -102,15 +102,15 @@ discard block |
||
| 102 | 102 | protected function getChanges() |
| 103 | 103 | { |
| 104 | 104 | $changes = []; |
| 105 | - foreach($this->_states as $name => $details) |
|
| 105 | + foreach ($this->_states as $name => $details) |
|
| 106 | 106 | { |
| 107 | 107 | $new = $this->_control->getViewState($name); |
| 108 | 108 | $old = $this->_existingState[$name]; |
| 109 | - if($new !== $old) |
|
| 109 | + if ($new !== $old) |
|
| 110 | 110 | { |
| 111 | 111 | $diff = new $details[0]($new, $old, $this->_nullObject); |
| 112 | - if(($change = $diff->getDifference()) !== $this->_nullObject) |
|
| 113 | - $changes[] = [$details[1],[$change]]; |
|
| 112 | + if (($change = $diff->getDifference()) !== $this->_nullObject) |
|
| 113 | + $changes[] = [$details[1], [$change]]; |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | return $changes; |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | public function respondToChanges() |
| 123 | 123 | { |
| 124 | - foreach($this->getChanges() as $change) |
|
| 124 | + foreach ($this->getChanges() as $change) |
|
| 125 | 125 | call_user_func_array($change[0], $change[1]); |
| 126 | 126 | } |
| 127 | 127 | |
@@ -167,8 +167,8 @@ discard block |
||
| 167 | 167 | */ |
| 168 | 168 | protected function updateVisible($visible) |
| 169 | 169 | { |
| 170 | - if($visible === false) |
|
| 171 | - $this->client()->replaceContent($this->_control, "<span id=\"" . $this->_control->getClientID() . "\" style=\"display:none\" ></span>"); |
|
| 170 | + if ($visible === false) |
|
| 171 | + $this->client()->replaceContent($this->_control, "<span id=\"".$this->_control->getClientID()."\" style=\"display:none\" ></span>"); |
|
| 172 | 172 | else |
| 173 | 173 | $this->client()->replaceContent($this->_control, $this->_control); |
| 174 | 174 | } |
@@ -188,9 +188,9 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | protected function updateStyle($style) |
| 190 | 190 | { |
| 191 | - if($style['CssClass'] !== null) |
|
| 191 | + if ($style['CssClass'] !== null) |
|
| 192 | 192 | $this->client()->setAttribute($this->_control, 'class', $style['CssClass']); |
| 193 | - if(is_array($style['Style']) && count($style['Style']) > 0) |
|
| 193 | + if (is_array($style['Style']) && count($style['Style']) > 0) |
|
| 194 | 194 | $this->client()->setStyle($this->_control, $style['Style']); |
| 195 | 195 | } |
| 196 | 196 | |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | */ |
| 201 | 201 | protected function updateAttributes($attributes) |
| 202 | 202 | { |
| 203 | - foreach($attributes as $name => $value) |
|
| 203 | + foreach ($attributes as $name => $value) |
|
| 204 | 204 | $this->client()->setAttribute($this->_control, $name, $value); |
| 205 | 205 | } |
| 206 | 206 | } |
@@ -109,8 +109,9 @@ discard block |
||
| 109 | 109 | if($new !== $old) |
| 110 | 110 | { |
| 111 | 111 | $diff = new $details[0]($new, $old, $this->_nullObject); |
| 112 | - if(($change = $diff->getDifference()) !== $this->_nullObject) |
|
| 113 | - $changes[] = [$details[1],[$change]]; |
|
| 112 | + if(($change = $diff->getDifference()) !== $this->_nullObject) { |
|
| 113 | + $changes[] = [$details[1],[$change]]; |
|
| 114 | + } |
|
| 114 | 115 | } |
| 115 | 116 | } |
| 116 | 117 | return $changes; |
@@ -121,8 +122,9 @@ discard block |
||
| 121 | 122 | */ |
| 122 | 123 | public function respondToChanges() |
| 123 | 124 | { |
| 124 | - foreach($this->getChanges() as $change) |
|
| 125 | - call_user_func_array($change[0], $change[1]); |
|
| 125 | + foreach($this->getChanges() as $change) { |
|
| 126 | + call_user_func_array($change[0], $change[1]); |
|
| 127 | + } |
|
| 126 | 128 | } |
| 127 | 129 | |
| 128 | 130 | /** |
@@ -167,10 +169,11 @@ discard block |
||
| 167 | 169 | */ |
| 168 | 170 | protected function updateVisible($visible) |
| 169 | 171 | { |
| 170 | - if($visible === false) |
|
| 171 | - $this->client()->replaceContent($this->_control, "<span id=\"" . $this->_control->getClientID() . "\" style=\"display:none\" ></span>"); |
|
| 172 | - else |
|
| 173 | - $this->client()->replaceContent($this->_control, $this->_control); |
|
| 172 | + if($visible === false) { |
|
| 173 | + $this->client()->replaceContent($this->_control, "<span id=\"" . $this->_control->getClientID() . "\" style=\"display:none\" ></span>"); |
|
| 174 | + } else { |
|
| 175 | + $this->client()->replaceContent($this->_control, $this->_control); |
|
| 176 | + } |
|
| 174 | 177 | } |
| 175 | 178 | |
| 176 | 179 | /** |
@@ -188,10 +191,12 @@ discard block |
||
| 188 | 191 | */ |
| 189 | 192 | protected function updateStyle($style) |
| 190 | 193 | { |
| 191 | - if($style['CssClass'] !== null) |
|
| 192 | - $this->client()->setAttribute($this->_control, 'class', $style['CssClass']); |
|
| 193 | - if(is_array($style['Style']) && count($style['Style']) > 0) |
|
| 194 | - $this->client()->setStyle($this->_control, $style['Style']); |
|
| 194 | + if($style['CssClass'] !== null) { |
|
| 195 | + $this->client()->setAttribute($this->_control, 'class', $style['CssClass']); |
|
| 196 | + } |
|
| 197 | + if(is_array($style['Style']) && count($style['Style']) > 0) { |
|
| 198 | + $this->client()->setStyle($this->_control, $style['Style']); |
|
| 199 | + } |
|
| 195 | 200 | } |
| 196 | 201 | |
| 197 | 202 | /** |
@@ -200,7 +205,8 @@ discard block |
||
| 200 | 205 | */ |
| 201 | 206 | protected function updateAttributes($attributes) |
| 202 | 207 | { |
| 203 | - foreach($attributes as $name => $value) |
|
| 204 | - $this->client()->setAttribute($this->_control, $name, $value); |
|
| 208 | + foreach($attributes as $name => $value) { |
|
| 209 | + $this->client()->setAttribute($this->_control, $name, $value); |
|
| 210 | + } |
|
| 205 | 211 | } |
| 206 | 212 | } |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | */ |
| 41 | 41 | public function getClientSide() |
| 42 | 42 | { |
| 43 | - if($this->_clientSide === null) |
|
| 43 | + if ($this->_clientSide === null) |
|
| 44 | 44 | $this->_clientSide = $this->createClientSide(); |
| 45 | 45 | return $this->_clientSide; |
| 46 | 46 | } |
@@ -40,8 +40,9 @@ |
||
| 40 | 40 | */ |
| 41 | 41 | public function getClientSide() |
| 42 | 42 | { |
| 43 | - if($this->_clientSide === null) |
|
| 44 | - $this->_clientSide = $this->createClientSide(); |
|
| 43 | + if($this->_clientSide === null) { |
|
| 44 | + $this->_clientSide = $this->createClientSide(); |
|
| 45 | + } |
|
| 45 | 46 | return $this->_clientSide; |
| 46 | 47 | } |
| 47 | 48 | |
@@ -93,11 +93,11 @@ discard block |
||
| 93 | 93 | */ |
| 94 | 94 | public function setText($value) |
| 95 | 95 | { |
| 96 | - if(parent::getText() === $value) |
|
| 96 | + if (parent::getText() === $value) |
|
| 97 | 97 | return; |
| 98 | 98 | |
| 99 | 99 | parent::setText($value); |
| 100 | - if($this->getActiveControl()->canUpdateClientSide()) |
|
| 100 | + if ($this->getActiveControl()->canUpdateClientSide()) |
|
| 101 | 101 | $this->getPage()->getCallbackClient()->update( |
| 102 | 102 | $this->getDefaultLabelID(), $value); |
| 103 | 103 | } |
@@ -111,11 +111,11 @@ discard block |
||
| 111 | 111 | public function setChecked($value) |
| 112 | 112 | { |
| 113 | 113 | $value = TPropertyValue::ensureBoolean($value); |
| 114 | - if(parent::getChecked() === $value) |
|
| 114 | + if (parent::getChecked() === $value) |
|
| 115 | 115 | return; |
| 116 | 116 | |
| 117 | 117 | parent::setChecked($value); |
| 118 | - if($this->getActiveControl()->canUpdateClientSide()) |
|
| 118 | + if ($this->getActiveControl()->canUpdateClientSide()) |
|
| 119 | 119 | $this->getPage()->getCallbackClient()->check($this, $value); |
| 120 | 120 | } |
| 121 | 121 | |
@@ -181,10 +181,10 @@ discard block |
||
| 181 | 181 | */ |
| 182 | 182 | protected function getDefaultLabelID() |
| 183 | 183 | { |
| 184 | - if($attributes = $this->getViewState('LabelAttributes', null)) |
|
| 184 | + if ($attributes = $this->getViewState('LabelAttributes', null)) |
|
| 185 | 185 | return TCheckBox::getLabelAttributes()->itemAt('id'); |
| 186 | 186 | else |
| 187 | - return $this->getClientID() . '_label'; |
|
| 187 | + return $this->getClientID().'_label'; |
|
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | 190 | |
@@ -93,13 +93,15 @@ discard block |
||
| 93 | 93 | */ |
| 94 | 94 | public function setText($value) |
| 95 | 95 | { |
| 96 | - if(parent::getText() === $value) |
|
| 97 | - return; |
|
| 96 | + if(parent::getText() === $value) { |
|
| 97 | + return; |
|
| 98 | + } |
|
| 98 | 99 | |
| 99 | 100 | parent::setText($value); |
| 100 | - if($this->getActiveControl()->canUpdateClientSide()) |
|
| 101 | - $this->getPage()->getCallbackClient()->update( |
|
| 101 | + if($this->getActiveControl()->canUpdateClientSide()) { |
|
| 102 | + $this->getPage()->getCallbackClient()->update( |
|
| 102 | 103 | $this->getDefaultLabelID(), $value); |
| 104 | + } |
|
| 103 | 105 | } |
| 104 | 106 | |
| 105 | 107 | /** |
@@ -111,12 +113,14 @@ discard block |
||
| 111 | 113 | public function setChecked($value) |
| 112 | 114 | { |
| 113 | 115 | $value = TPropertyValue::ensureBoolean($value); |
| 114 | - if(parent::getChecked() === $value) |
|
| 115 | - return; |
|
| 116 | + if(parent::getChecked() === $value) { |
|
| 117 | + return; |
|
| 118 | + } |
|
| 116 | 119 | |
| 117 | 120 | parent::setChecked($value); |
| 118 | - if($this->getActiveControl()->canUpdateClientSide()) |
|
| 119 | - $this->getPage()->getCallbackClient()->check($this, $value); |
|
| 121 | + if($this->getActiveControl()->canUpdateClientSide()) { |
|
| 122 | + $this->getPage()->getCallbackClient()->check($this, $value); |
|
| 123 | + } |
|
| 120 | 124 | } |
| 121 | 125 | |
| 122 | 126 | /** |
@@ -140,9 +144,10 @@ discard block |
||
| 140 | 144 | protected function renderInputTag($writer, $clientID, $onclick) |
| 141 | 145 | { |
| 142 | 146 | parent::renderInputTag($writer, $clientID, $onclick); |
| 143 | - if ($this->getAutoPostBack()) |
|
| 144 | - $this->getActiveControl()->registerCallbackClientScript( |
|
| 147 | + if ($this->getAutoPostBack()) { |
|
| 148 | + $this->getActiveControl()->registerCallbackClientScript( |
|
| 145 | 149 | $this->getClientClassName(), $this->getPostBackOptions()); |
| 150 | + } |
|
| 146 | 151 | } |
| 147 | 152 | |
| 148 | 153 | /** |
@@ -181,10 +186,11 @@ discard block |
||
| 181 | 186 | */ |
| 182 | 187 | protected function getDefaultLabelID() |
| 183 | 188 | { |
| 184 | - if($attributes = $this->getViewState('LabelAttributes', null)) |
|
| 185 | - return TCheckBox::getLabelAttributes()->itemAt('id'); |
|
| 186 | - else |
|
| 187 | - return $this->getClientID() . '_label'; |
|
| 189 | + if($attributes = $this->getViewState('LabelAttributes', null)) { |
|
| 190 | + return TCheckBox::getLabelAttributes()->itemAt('id'); |
|
| 191 | + } else { |
|
| 192 | + return $this->getClientID() . '_label'; |
|
| 193 | + } |
|
| 188 | 194 | } |
| 189 | 195 | } |
| 190 | 196 | |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | protected function setOption($name, $value, $default = null) |
| 64 | 64 | { |
| 65 | 65 | $value = ($value === null) ? $default : $value; |
| 66 | - if($value !== null) |
|
| 66 | + if ($value !== null) |
|
| 67 | 67 | $this->_options->add($name, $value); |
| 68 | 68 | } |
| 69 | 69 | |
@@ -63,8 +63,9 @@ |
||
| 63 | 63 | protected function setOption($name, $value, $default = null) |
| 64 | 64 | { |
| 65 | 65 | $value = ($value === null) ? $default : $value; |
| 66 | - if($value !== null) |
|
| 67 | - $this->_options->add($name, $value); |
|
| 66 | + if($value !== null) { |
|
| 67 | + $this->_options->add($name, $value); |
|
| 68 | + } |
|
| 68 | 69 | } |
| 69 | 70 | |
| 70 | 71 | /** |
@@ -38,10 +38,10 @@ discard block |
||
| 38 | 38 | protected function initializeHeaderCell($cell, $columnIndex) { |
| 39 | 39 | $text = $this->getHeaderText(); |
| 40 | 40 | |
| 41 | - if(($classPath = $this->getHeaderRenderer()) !== '') { |
|
| 41 | + if (($classPath = $this->getHeaderRenderer()) !== '') { |
|
| 42 | 42 | $control = Prado::createComponent($classPath); |
| 43 | - if($control instanceof \Prado\IDataRenderer) { |
|
| 44 | - if($control instanceof IItemDataRenderer) { |
|
| 43 | + if ($control instanceof \Prado\IDataRenderer) { |
|
| 44 | + if ($control instanceof IItemDataRenderer) { |
|
| 45 | 45 | $item = $cell->getParent(); |
| 46 | 46 | $control->setItemIndex($item->getItemIndex()); |
| 47 | 47 | $control->setItemType($item->getItemType()); |
@@ -50,19 +50,19 @@ discard block |
||
| 50 | 50 | } |
| 51 | 51 | $cell->getControls()->add($control); |
| 52 | 52 | } |
| 53 | - elseif($this->getAllowSorting()) { |
|
| 53 | + elseif ($this->getAllowSorting()) { |
|
| 54 | 54 | $sortExpression = $this->getSortExpression(); |
| 55 | - if(($url = $this->getHeaderImageUrl()) !== '') { |
|
| 55 | + if (($url = $this->getHeaderImageUrl()) !== '') { |
|
| 56 | 56 | $button = new TActiveImageButton; |
| 57 | 57 | $button->setImageUrl($url); |
| 58 | 58 | $button->setCommandName(TDataGrid::CMD_SORT); |
| 59 | 59 | $button->setCommandParameter($sortExpression); |
| 60 | - if($text !== '') |
|
| 60 | + if ($text !== '') |
|
| 61 | 61 | $button->setAlternateText($text); |
| 62 | 62 | $button->setCausesValidation(false); |
| 63 | 63 | $cell->getControls()->add($button); |
| 64 | 64 | } |
| 65 | - elseif($text !== '') { |
|
| 65 | + elseif ($text !== '') { |
|
| 66 | 66 | $button = new TActiveLinkButton; |
| 67 | 67 | $button->setText($text); |
| 68 | 68 | $button->setCommandName(TDataGrid::CMD_SORT); |
@@ -74,14 +74,14 @@ discard block |
||
| 74 | 74 | $cell->setText(' '); |
| 75 | 75 | } |
| 76 | 76 | else { |
| 77 | - if(($url = $this->getHeaderImageUrl()) !== '') { |
|
| 77 | + if (($url = $this->getHeaderImageUrl()) !== '') { |
|
| 78 | 78 | $image = new TActiveImage; |
| 79 | 79 | $image->setImageUrl($url); |
| 80 | - if($text !== '') |
|
| 80 | + if ($text !== '') |
|
| 81 | 81 | $image->setAlternateText($text); |
| 82 | 82 | $cell->getControls()->add($image); |
| 83 | 83 | } |
| 84 | - elseif($text !== '') |
|
| 84 | + elseif ($text !== '') |
|
| 85 | 85 | $cell->setText($text); |
| 86 | 86 | else |
| 87 | 87 | $cell->setText(' '); |
@@ -49,42 +49,41 @@ |
||
| 49 | 49 | $control->setData($text); |
| 50 | 50 | } |
| 51 | 51 | $cell->getControls()->add($control); |
| 52 | - } |
|
| 53 | - elseif($this->getAllowSorting()) { |
|
| 52 | + } elseif($this->getAllowSorting()) { |
|
| 54 | 53 | $sortExpression = $this->getSortExpression(); |
| 55 | 54 | if(($url = $this->getHeaderImageUrl()) !== '') { |
| 56 | 55 | $button = new TActiveImageButton; |
| 57 | 56 | $button->setImageUrl($url); |
| 58 | 57 | $button->setCommandName(TDataGrid::CMD_SORT); |
| 59 | 58 | $button->setCommandParameter($sortExpression); |
| 60 | - if($text !== '') |
|
| 61 | - $button->setAlternateText($text); |
|
| 59 | + if($text !== '') { |
|
| 60 | + $button->setAlternateText($text); |
|
| 61 | + } |
|
| 62 | 62 | $button->setCausesValidation(false); |
| 63 | 63 | $cell->getControls()->add($button); |
| 64 | - } |
|
| 65 | - elseif($text !== '') { |
|
| 64 | + } elseif($text !== '') { |
|
| 66 | 65 | $button = new TActiveLinkButton; |
| 67 | 66 | $button->setText($text); |
| 68 | 67 | $button->setCommandName(TDataGrid::CMD_SORT); |
| 69 | 68 | $button->setCommandParameter($sortExpression); |
| 70 | 69 | $button->setCausesValidation(false); |
| 71 | 70 | $cell->getControls()->add($button); |
| 71 | + } else { |
|
| 72 | + $cell->setText(' '); |
|
| 72 | 73 | } |
| 73 | - else |
|
| 74 | - $cell->setText(' '); |
|
| 75 | - } |
|
| 76 | - else { |
|
| 74 | + } else { |
|
| 77 | 75 | if(($url = $this->getHeaderImageUrl()) !== '') { |
| 78 | 76 | $image = new TActiveImage; |
| 79 | 77 | $image->setImageUrl($url); |
| 80 | - if($text !== '') |
|
| 81 | - $image->setAlternateText($text); |
|
| 78 | + if($text !== '') { |
|
| 79 | + $image->setAlternateText($text); |
|
| 80 | + } |
|
| 82 | 81 | $cell->getControls()->add($image); |
| 83 | - } |
|
| 84 | - elseif($text !== '') |
|
| 85 | - $cell->setText($text); |
|
| 86 | - else |
|
| 87 | - $cell->setText(' '); |
|
| 82 | + } elseif($text !== '') { |
|
| 83 | + $cell->setText($text); |
|
| 84 | + } else { |
|
| 85 | + $cell->setText(' '); |
|
| 86 | + } |
|
| 88 | 87 | } |
| 89 | 88 | } |
| 90 | 89 | } |
| 91 | 90 | \ No newline at end of file |
@@ -32,11 +32,11 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | class TActiveButtonColumn extends TButtonColumn { |
| 34 | 34 | public function initializeCell($cell, $columnIndex, $itemType) { |
| 35 | - if($itemType === TListItemType::Item || $itemType === TListItemType::AlternatingItem || $itemType === TListItemType::SelectedItem || $itemType === TListItemType::EditItem) { |
|
| 35 | + if ($itemType === TListItemType::Item || $itemType === TListItemType::AlternatingItem || $itemType === TListItemType::SelectedItem || $itemType === TListItemType::EditItem) { |
|
| 36 | 36 | $buttonType = $this->getButtonType(); |
| 37 | - if($buttonType === TButtonColumnType::LinkButton) |
|
| 37 | + if ($buttonType === TButtonColumnType::LinkButton) |
|
| 38 | 38 | $button = new TActiveLinkButton; |
| 39 | - elseif($buttonType === TButtonColumnType::PushButton) |
|
| 39 | + elseif ($buttonType === TButtonColumnType::PushButton) |
|
| 40 | 40 | $button = new TActiveButton; |
| 41 | 41 | else // image button |
| 42 | 42 | { |
@@ -48,8 +48,8 @@ discard block |
||
| 48 | 48 | $button->setCommandName($this->getCommandName()); |
| 49 | 49 | $button->setCausesValidation($this->getCausesValidation()); |
| 50 | 50 | $button->setValidationGroup($this->getValidationGroup()); |
| 51 | - if($this->getDataTextField() !== '' || ($buttonType === TButtonColumnType::ImageButton && $this->getDataImageUrlField() !== '')) |
|
| 52 | - $button->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']); |
|
| 51 | + if ($this->getDataTextField() !== '' || ($buttonType === TButtonColumnType::ImageButton && $this->getDataImageUrlField() !== '')) |
|
| 52 | + $button->attachEventHandler('OnDataBinding', [$this, 'dataBindColumn']); |
|
| 53 | 53 | $cell->getControls()->add($button); |
| 54 | 54 | $cell->registerObject('Button', $button); |
| 55 | 55 | } |
@@ -34,11 +34,11 @@ discard block |
||
| 34 | 34 | public function initializeCell($cell, $columnIndex, $itemType) { |
| 35 | 35 | if($itemType === TListItemType::Item || $itemType === TListItemType::AlternatingItem || $itemType === TListItemType::SelectedItem || $itemType === TListItemType::EditItem) { |
| 36 | 36 | $buttonType = $this->getButtonType(); |
| 37 | - if($buttonType === TButtonColumnType::LinkButton) |
|
| 38 | - $button = new TActiveLinkButton; |
|
| 39 | - elseif($buttonType === TButtonColumnType::PushButton) |
|
| 40 | - $button = new TActiveButton; |
|
| 41 | - else // image button |
|
| 37 | + if($buttonType === TButtonColumnType::LinkButton) { |
|
| 38 | + $button = new TActiveLinkButton; |
|
| 39 | + } elseif($buttonType === TButtonColumnType::PushButton) { |
|
| 40 | + $button = new TActiveButton; |
|
| 41 | + } else // image button |
|
| 42 | 42 | { |
| 43 | 43 | $button = new TActiveImageButton; |
| 44 | 44 | $button->setImageUrl($this->getImageUrl()); |
@@ -48,12 +48,13 @@ discard block |
||
| 48 | 48 | $button->setCommandName($this->getCommandName()); |
| 49 | 49 | $button->setCausesValidation($this->getCausesValidation()); |
| 50 | 50 | $button->setValidationGroup($this->getValidationGroup()); |
| 51 | - if($this->getDataTextField() !== '' || ($buttonType === TButtonColumnType::ImageButton && $this->getDataImageUrlField() !== '')) |
|
| 52 | - $button->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']); |
|
| 51 | + if($this->getDataTextField() !== '' || ($buttonType === TButtonColumnType::ImageButton && $this->getDataImageUrlField() !== '')) { |
|
| 52 | + $button->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']); |
|
| 53 | + } |
|
| 53 | 54 | $cell->getControls()->add($button); |
| 54 | 55 | $cell->registerObject('Button', $button); |
| 56 | + } else { |
|
| 57 | + parent::initializeCell($cell, $columnIndex, $itemType); |
|
| 55 | 58 | } |
| 56 | - else |
|
| 57 | - parent::initializeCell($cell, $columnIndex, $itemType); |
|
| 58 | 59 | } |
| 59 | 60 | } |
| 60 | 61 | \ No newline at end of file |
@@ -92,11 +92,11 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function setText($value) |
| 94 | 94 | { |
| 95 | - if(parent::getText() === $value) |
|
| 95 | + if (parent::getText() === $value) |
|
| 96 | 96 | return; |
| 97 | 97 | |
| 98 | 98 | parent::setText($value); |
| 99 | - if($this->getActiveControl()->canUpdateClientSide()) |
|
| 99 | + if ($this->getActiveControl()->canUpdateClientSide()) |
|
| 100 | 100 | $this->getPage()->getCallbackClient()->update( |
| 101 | 101 | $this->getDefaultLabelID(), $value); |
| 102 | 102 | } |
@@ -110,11 +110,11 @@ discard block |
||
| 110 | 110 | public function setChecked($value) |
| 111 | 111 | { |
| 112 | 112 | $value = TPropertyValue::ensureBoolean($value); |
| 113 | - if(parent::getChecked() === $value) |
|
| 113 | + if (parent::getChecked() === $value) |
|
| 114 | 114 | return; |
| 115 | 115 | |
| 116 | 116 | parent::setChecked($value); |
| 117 | - if($this->getActiveControl()->canUpdateClientSide()) |
|
| 117 | + if ($this->getActiveControl()->canUpdateClientSide()) |
|
| 118 | 118 | $this->getPage()->getCallbackClient()->check($this, $value); |
| 119 | 119 | } |
| 120 | 120 | |
@@ -176,10 +176,10 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | protected function getDefaultLabelID() |
| 178 | 178 | { |
| 179 | - if($attributes = $this->getViewState('LabelAttributes', null)) |
|
| 179 | + if ($attributes = $this->getViewState('LabelAttributes', null)) |
|
| 180 | 180 | return $this->getLabelAttributes()->itemAt('id'); |
| 181 | 181 | else |
| 182 | - return $this->getClientID() . '_label'; |
|
| 182 | + return $this->getClientID().'_label'; |
|
| 183 | 183 | } |
| 184 | 184 | } |
| 185 | 185 | |
@@ -92,13 +92,15 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function setText($value) |
| 94 | 94 | { |
| 95 | - if(parent::getText() === $value) |
|
| 96 | - return; |
|
| 95 | + if(parent::getText() === $value) { |
|
| 96 | + return; |
|
| 97 | + } |
|
| 97 | 98 | |
| 98 | 99 | parent::setText($value); |
| 99 | - if($this->getActiveControl()->canUpdateClientSide()) |
|
| 100 | - $this->getPage()->getCallbackClient()->update( |
|
| 100 | + if($this->getActiveControl()->canUpdateClientSide()) { |
|
| 101 | + $this->getPage()->getCallbackClient()->update( |
|
| 101 | 102 | $this->getDefaultLabelID(), $value); |
| 103 | + } |
|
| 102 | 104 | } |
| 103 | 105 | |
| 104 | 106 | /** |
@@ -110,12 +112,14 @@ discard block |
||
| 110 | 112 | public function setChecked($value) |
| 111 | 113 | { |
| 112 | 114 | $value = TPropertyValue::ensureBoolean($value); |
| 113 | - if(parent::getChecked() === $value) |
|
| 114 | - return; |
|
| 115 | + if(parent::getChecked() === $value) { |
|
| 116 | + return; |
|
| 117 | + } |
|
| 115 | 118 | |
| 116 | 119 | parent::setChecked($value); |
| 117 | - if($this->getActiveControl()->canUpdateClientSide()) |
|
| 118 | - $this->getPage()->getCallbackClient()->check($this, $value); |
|
| 120 | + if($this->getActiveControl()->canUpdateClientSide()) { |
|
| 121 | + $this->getPage()->getCallbackClient()->check($this, $value); |
|
| 122 | + } |
|
| 119 | 123 | } |
| 120 | 124 | |
| 121 | 125 | /** |
@@ -135,9 +139,10 @@ discard block |
||
| 135 | 139 | protected function renderInputTag($writer, $clientID, $onclick) |
| 136 | 140 | { |
| 137 | 141 | parent::renderInputTag($writer, $clientID, $onclick); |
| 138 | - if ($this->getAutoPostBack()) |
|
| 139 | - $this->getActiveControl()->registerCallbackClientScript( |
|
| 142 | + if ($this->getAutoPostBack()) { |
|
| 143 | + $this->getActiveControl()->registerCallbackClientScript( |
|
| 140 | 144 | $this->getClientClassName(), $this->getPostBackOptions()); |
| 145 | + } |
|
| 141 | 146 | } |
| 142 | 147 | |
| 143 | 148 | /** |
@@ -176,10 +181,11 @@ discard block |
||
| 176 | 181 | */ |
| 177 | 182 | protected function getDefaultLabelID() |
| 178 | 183 | { |
| 179 | - if($attributes = $this->getViewState('LabelAttributes', null)) |
|
| 180 | - return $this->getLabelAttributes()->itemAt('id'); |
|
| 181 | - else |
|
| 182 | - return $this->getClientID() . '_label'; |
|
| 184 | + if($attributes = $this->getViewState('LabelAttributes', null)) { |
|
| 185 | + return $this->getLabelAttributes()->itemAt('id'); |
|
| 186 | + } else { |
|
| 187 | + return $this->getClientID() . '_label'; |
|
| 188 | + } |
|
| 183 | 189 | } |
| 184 | 190 | } |
| 185 | 191 | |
@@ -45,16 +45,16 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public function initializeCell($cell, $columnIndex, $itemType) |
| 47 | 47 | { |
| 48 | - if($itemType === TListItemType::Item || $itemType === TListItemType::AlternatingItem || $itemType === TListItemType::SelectedItem || $itemType === TListItemType::EditItem) |
|
| 48 | + if ($itemType === TListItemType::Item || $itemType === TListItemType::AlternatingItem || $itemType === TListItemType::SelectedItem || $itemType === TListItemType::EditItem) |
|
| 49 | 49 | { |
| 50 | 50 | $checkBox = new TActiveCheckBox; |
| 51 | - if($this->getReadOnly() || $itemType !== TListItemType::EditItem) |
|
| 51 | + if ($this->getReadOnly() || $itemType !== TListItemType::EditItem) |
|
| 52 | 52 | $checkBox->setEnabled(false); |
| 53 | 53 | $cell->setHorizontalAlign('Center'); |
| 54 | 54 | $cell->getControls()->add($checkBox); |
| 55 | 55 | $cell->registerObject('CheckBox', $checkBox); |
| 56 | - if($this->getDataField() !== '') |
|
| 57 | - $checkBox->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']); |
|
| 56 | + if ($this->getDataField() !== '') |
|
| 57 | + $checkBox->attachEventHandler('OnDataBinding', [$this, 'dataBindColumn']); |
|
| 58 | 58 | } |
| 59 | 59 | else |
| 60 | 60 | parent::initializeCell($cell, $columnIndex, $itemType); |
@@ -64,12 +64,12 @@ discard block |
||
| 64 | 64 | { |
| 65 | 65 | $text = $this->getHeaderText(); |
| 66 | 66 | |
| 67 | - if(($classPath = $this->getHeaderRenderer()) !== '') |
|
| 67 | + if (($classPath = $this->getHeaderRenderer()) !== '') |
|
| 68 | 68 | { |
| 69 | 69 | $control = Prado::createComponent($classPath); |
| 70 | - if($control instanceof \Prado\IDataRenderer) |
|
| 70 | + if ($control instanceof \Prado\IDataRenderer) |
|
| 71 | 71 | { |
| 72 | - if($control instanceof IItemDataRenderer) |
|
| 72 | + if ($control instanceof IItemDataRenderer) |
|
| 73 | 73 | { |
| 74 | 74 | $item = $cell->getParent(); |
| 75 | 75 | $control->setItemIndex($item->getItemIndex()); |
@@ -79,21 +79,21 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | $cell->getControls()->add($control); |
| 81 | 81 | } |
| 82 | - elseif($this->getAllowSorting()) |
|
| 82 | + elseif ($this->getAllowSorting()) |
|
| 83 | 83 | { |
| 84 | 84 | $sortExpression = $this->getSortExpression(); |
| 85 | - if(($url = $this->getHeaderImageUrl()) !== '') |
|
| 85 | + if (($url = $this->getHeaderImageUrl()) !== '') |
|
| 86 | 86 | { |
| 87 | 87 | $button = new TActiveImageButton; |
| 88 | 88 | $button->setImageUrl($url); |
| 89 | 89 | $button->setCommandName(TDataGrid::CMD_SORT); |
| 90 | 90 | $button->setCommandParameter($sortExpression); |
| 91 | - if($text !== '') |
|
| 91 | + if ($text !== '') |
|
| 92 | 92 | $button->setAlternateText($text); |
| 93 | 93 | $button->setCausesValidation(false); |
| 94 | 94 | $cell->getControls()->add($button); |
| 95 | 95 | } |
| 96 | - elseif($text !== '') |
|
| 96 | + elseif ($text !== '') |
|
| 97 | 97 | { |
| 98 | 98 | $button = new TActiveLinkButton; |
| 99 | 99 | $button->setText($text); |
@@ -107,15 +107,15 @@ discard block |
||
| 107 | 107 | } |
| 108 | 108 | else |
| 109 | 109 | { |
| 110 | - if(($url = $this->getHeaderImageUrl()) !== '') |
|
| 110 | + if (($url = $this->getHeaderImageUrl()) !== '') |
|
| 111 | 111 | { |
| 112 | 112 | $image = new TActiveImage; |
| 113 | 113 | $image->setImageUrl($url); |
| 114 | - if($text !== '') |
|
| 114 | + if ($text !== '') |
|
| 115 | 115 | $image->setAlternateText($text); |
| 116 | 116 | $cell->getControls()->add($image); |
| 117 | 117 | } |
| 118 | - elseif($text !== '') |
|
| 118 | + elseif ($text !== '') |
|
| 119 | 119 | $cell->setText($text); |
| 120 | 120 | else |
| 121 | 121 | $cell->setText(' '); |
@@ -48,16 +48,18 @@ discard block |
||
| 48 | 48 | if($itemType === TListItemType::Item || $itemType === TListItemType::AlternatingItem || $itemType === TListItemType::SelectedItem || $itemType === TListItemType::EditItem) |
| 49 | 49 | { |
| 50 | 50 | $checkBox = new TActiveCheckBox; |
| 51 | - if($this->getReadOnly() || $itemType !== TListItemType::EditItem) |
|
| 52 | - $checkBox->setEnabled(false); |
|
| 51 | + if($this->getReadOnly() || $itemType !== TListItemType::EditItem) { |
|
| 52 | + $checkBox->setEnabled(false); |
|
| 53 | + } |
|
| 53 | 54 | $cell->setHorizontalAlign('Center'); |
| 54 | 55 | $cell->getControls()->add($checkBox); |
| 55 | 56 | $cell->registerObject('CheckBox', $checkBox); |
| 56 | - if($this->getDataField() !== '') |
|
| 57 | - $checkBox->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']); |
|
| 57 | + if($this->getDataField() !== '') { |
|
| 58 | + $checkBox->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']); |
|
| 59 | + } |
|
| 60 | + } else { |
|
| 61 | + parent::initializeCell($cell, $columnIndex, $itemType); |
|
| 58 | 62 | } |
| 59 | - else |
|
| 60 | - parent::initializeCell($cell, $columnIndex, $itemType); |
|
| 61 | 63 | } |
| 62 | 64 | |
| 63 | 65 | protected function initializeHeaderCell($cell, $columnIndex) |
@@ -78,8 +80,7 @@ discard block |
||
| 78 | 80 | $control->setData($text); |
| 79 | 81 | } |
| 80 | 82 | $cell->getControls()->add($control); |
| 81 | - } |
|
| 82 | - elseif($this->getAllowSorting()) |
|
| 83 | + } elseif($this->getAllowSorting()) |
|
| 83 | 84 | { |
| 84 | 85 | $sortExpression = $this->getSortExpression(); |
| 85 | 86 | if(($url = $this->getHeaderImageUrl()) !== '') |
@@ -88,12 +89,12 @@ discard block |
||
| 88 | 89 | $button->setImageUrl($url); |
| 89 | 90 | $button->setCommandName(TDataGrid::CMD_SORT); |
| 90 | 91 | $button->setCommandParameter($sortExpression); |
| 91 | - if($text !== '') |
|
| 92 | - $button->setAlternateText($text); |
|
| 92 | + if($text !== '') { |
|
| 93 | + $button->setAlternateText($text); |
|
| 94 | + } |
|
| 93 | 95 | $button->setCausesValidation(false); |
| 94 | 96 | $cell->getControls()->add($button); |
| 95 | - } |
|
| 96 | - elseif($text !== '') |
|
| 97 | + } elseif($text !== '') |
|
| 97 | 98 | { |
| 98 | 99 | $button = new TActiveLinkButton; |
| 99 | 100 | $button->setText($text); |
@@ -101,24 +102,24 @@ discard block |
||
| 101 | 102 | $button->setCommandParameter($sortExpression); |
| 102 | 103 | $button->setCausesValidation(false); |
| 103 | 104 | $cell->getControls()->add($button); |
| 105 | + } else { |
|
| 106 | + $cell->setText(' '); |
|
| 104 | 107 | } |
| 105 | - else |
|
| 106 | - $cell->setText(' '); |
|
| 107 | - } |
|
| 108 | - else |
|
| 108 | + } else |
|
| 109 | 109 | { |
| 110 | 110 | if(($url = $this->getHeaderImageUrl()) !== '') |
| 111 | 111 | { |
| 112 | 112 | $image = new TActiveImage; |
| 113 | 113 | $image->setImageUrl($url); |
| 114 | - if($text !== '') |
|
| 115 | - $image->setAlternateText($text); |
|
| 114 | + if($text !== '') { |
|
| 115 | + $image->setAlternateText($text); |
|
| 116 | + } |
|
| 116 | 117 | $cell->getControls()->add($image); |
| 118 | + } elseif($text !== '') { |
|
| 119 | + $cell->setText($text); |
|
| 120 | + } else { |
|
| 121 | + $cell->setText(' '); |
|
| 117 | 122 | } |
| 118 | - elseif($text !== '') |
|
| 119 | - $cell->setText($text); |
|
| 120 | - else |
|
| 121 | - $cell->setText(' '); |
|
| 122 | 123 | } |
| 123 | 124 | } |
| 124 | 125 | } |
| 125 | 126 | \ No newline at end of file |
@@ -98,14 +98,14 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | public function callClientFunction($function, $params = []) |
| 100 | 100 | { |
| 101 | - if(!is_array($params)) |
|
| 101 | + if (!is_array($params)) |
|
| 102 | 102 | $params = [$params]; |
| 103 | 103 | |
| 104 | - if(count($params) > 0) |
|
| 104 | + if (count($params) > 0) |
|
| 105 | 105 | { |
| 106 | 106 | if ($params[0] instanceof ISurroundable) |
| 107 | 107 | $params[0] = $params[0]->getSurroundingTagID(); |
| 108 | - elseif($params[0] instanceof TControl) |
|
| 108 | + elseif ($params[0] instanceof TControl) |
|
| 109 | 109 | $params[0] = $params[0]->getClientID(); |
| 110 | 110 | } |
| 111 | 111 | $this->_actions->add([$function => $params]); |
@@ -121,10 +121,10 @@ discard block |
||
| 121 | 121 | { |
| 122 | 122 | if ($element instanceof ISurroundable) |
| 123 | 123 | $element = $element->getSurroundingTagID(); |
| 124 | - elseif($element instanceof TControl) |
|
| 124 | + elseif ($element instanceof TControl) |
|
| 125 | 125 | $element = $element->getClientID(); |
| 126 | 126 | |
| 127 | - if(!is_array($params)) |
|
| 127 | + if (!is_array($params)) |
|
| 128 | 128 | $params = [$params]; |
| 129 | 129 | |
| 130 | 130 | $this->_actions->add(['Prado.Element.j' => [$element, $method, $params]]); |
@@ -164,19 +164,19 @@ discard block |
||
| 164 | 164 | $total = $this->getSelectionControlIsListType($control) ? $control->getItemCount() : 1; |
| 165 | 165 | |
| 166 | 166 | // pass the ID to avoid getting the surrounding elements (ISurroundable) |
| 167 | - if($control instanceof TControl) |
|
| 167 | + if ($control instanceof TControl) |
|
| 168 | 168 | $control = $control->getClientID(); |
| 169 | 169 | |
| 170 | 170 | $this->callClientFunction('Prado.Element.select', |
| 171 | - [$control, $type . $method, $value, $total]); |
|
| 171 | + [$control, $type.$method, $value, $total]); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | private function getSelectionControlType($control) |
| 175 | 175 | { |
| 176 | - if(is_string($control)) return 'check'; |
|
| 177 | - if($control instanceof TCheckBoxList) |
|
| 176 | + if (is_string($control)) return 'check'; |
|
| 177 | + if ($control instanceof TCheckBoxList) |
|
| 178 | 178 | return 'check'; |
| 179 | - if($control instanceof TCheckBox) |
|
| 179 | + if ($control instanceof TCheckBox) |
|
| 180 | 180 | return 'check'; |
| 181 | 181 | return 'select'; |
| 182 | 182 | } |
@@ -238,24 +238,24 @@ discard block |
||
| 238 | 238 | public function setListItems($control, $items) |
| 239 | 239 | { |
| 240 | 240 | $options = []; |
| 241 | - if($control instanceof TListControl) |
|
| 241 | + if ($control instanceof TListControl) |
|
| 242 | 242 | { |
| 243 | 243 | $promptText = $control->getPromptText(); |
| 244 | 244 | $promptValue = $control->getPromptValue(); |
| 245 | 245 | |
| 246 | - if($promptValue === '') |
|
| 246 | + if ($promptValue === '') |
|
| 247 | 247 | $promptValue = $promptText; |
| 248 | 248 | |
| 249 | - if($promptValue !== '') |
|
| 249 | + if ($promptValue !== '') |
|
| 250 | 250 | $options[] = [$promptText, $promptValue]; |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | - foreach($items as $item) |
|
| 253 | + foreach ($items as $item) |
|
| 254 | 254 | { |
| 255 | - if($item->getHasAttributes()) |
|
| 256 | - $options[] = [$item->getText(),$item->getValue(), $item->getAttributes()->itemAt('Group')]; |
|
| 255 | + if ($item->getHasAttributes()) |
|
| 256 | + $options[] = [$item->getText(), $item->getValue(), $item->getAttributes()->itemAt('Group')]; |
|
| 257 | 257 | else |
| 258 | - $options[] = [$item->getText(),$item->getValue()]; |
|
| 258 | + $options[] = [$item->getText(), $item->getValue()]; |
|
| 259 | 259 | } |
| 260 | 260 | $this->callClientFunction('Prado.Element.setOptions', [$control, $options]); |
| 261 | 261 | } |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | */ |
| 287 | 287 | public function toggle($element, $effect = null, $options = []) |
| 288 | 288 | { |
| 289 | - switch(strtolower($effect)) |
|
| 289 | + switch (strtolower($effect)) |
|
| 290 | 290 | { |
| 291 | 291 | case 'fade': |
| 292 | 292 | $method = 'fadeToggle'; |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | default: |
| 298 | 298 | $method = 'toggle'; |
| 299 | 299 | // avoid fancy effect by default |
| 300 | - if(!array_key_exists('duration', $options)) |
|
| 300 | + if (!array_key_exists('duration', $options)) |
|
| 301 | 301 | $options['duration'] = 0; |
| 302 | 302 | break; |
| 303 | 303 | } |
@@ -431,12 +431,12 @@ discard block |
||
| 431 | 431 | */ |
| 432 | 432 | protected function replace($element, $content, $self) |
| 433 | 433 | { |
| 434 | - if($content instanceof TControl) |
|
| 434 | + if ($content instanceof TControl) |
|
| 435 | 435 | { |
| 436 | 436 | $boundary = $this->getRenderedContentBoundary($content); |
| 437 | 437 | $content = null; |
| 438 | 438 | } |
| 439 | - elseif($content instanceof THtmlWriter) |
|
| 439 | + elseif ($content instanceof THtmlWriter) |
|
| 440 | 440 | { |
| 441 | 441 | $boundary = $this->getResponseContentBoundary($content); |
| 442 | 442 | $content = null; |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | */ |
| 466 | 466 | public function evaluateScript($writer) |
| 467 | 467 | { |
| 468 | - if($writer instanceof THtmlWriter) |
|
| 468 | + if ($writer instanceof THtmlWriter) |
|
| 469 | 469 | { |
| 470 | 470 | $boundary = $this->getResponseContentBoundary($writer); |
| 471 | 471 | $content = null; |
@@ -485,11 +485,11 @@ discard block |
||
| 485 | 485 | */ |
| 486 | 486 | public function appendScriptBlock($content) |
| 487 | 487 | { |
| 488 | - if($content instanceof TControl) |
|
| 488 | + if ($content instanceof TControl) |
|
| 489 | 489 | { |
| 490 | 490 | $boundary = $this->getRenderedContentBoundary($content); |
| 491 | 491 | } |
| 492 | - elseif($content instanceof THtmlWriter) |
|
| 492 | + elseif ($content instanceof THtmlWriter) |
|
| 493 | 493 | { |
| 494 | 494 | $boundary = $this->getResponseContentBoundary($content); |
| 495 | 495 | } |
@@ -519,9 +519,9 @@ discard block |
||
| 519 | 519 | */ |
| 520 | 520 | private function getResponseContentBoundary($html) |
| 521 | 521 | { |
| 522 | - if($html instanceof THtmlWriter) |
|
| 522 | + if ($html instanceof THtmlWriter) |
|
| 523 | 523 | { |
| 524 | - if($html->getWriter() instanceof TCallbackResponseWriter) |
|
| 524 | + if ($html->getWriter() instanceof TCallbackResponseWriter) |
|
| 525 | 525 | return $html->getWriter()->getBoundary(); |
| 526 | 526 | } |
| 527 | 527 | return null; |
@@ -98,15 +98,17 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | public function callClientFunction($function, $params = []) |
| 100 | 100 | { |
| 101 | - if(!is_array($params)) |
|
| 102 | - $params = [$params]; |
|
| 101 | + if(!is_array($params)) { |
|
| 102 | + $params = [$params]; |
|
| 103 | + } |
|
| 103 | 104 | |
| 104 | 105 | if(count($params) > 0) |
| 105 | 106 | { |
| 106 | - if ($params[0] instanceof ISurroundable) |
|
| 107 | - $params[0] = $params[0]->getSurroundingTagID(); |
|
| 108 | - elseif($params[0] instanceof TControl) |
|
| 109 | - $params[0] = $params[0]->getClientID(); |
|
| 107 | + if ($params[0] instanceof ISurroundable) { |
|
| 108 | + $params[0] = $params[0]->getSurroundingTagID(); |
|
| 109 | + } elseif($params[0] instanceof TControl) { |
|
| 110 | + $params[0] = $params[0]->getClientID(); |
|
| 111 | + } |
|
| 110 | 112 | } |
| 111 | 113 | $this->_actions->add([$function => $params]); |
| 112 | 114 | } |
@@ -119,13 +121,15 @@ discard block |
||
| 119 | 121 | */ |
| 120 | 122 | public function jQuery($element, $method, $params = []) |
| 121 | 123 | { |
| 122 | - if ($element instanceof ISurroundable) |
|
| 123 | - $element = $element->getSurroundingTagID(); |
|
| 124 | - elseif($element instanceof TControl) |
|
| 125 | - $element = $element->getClientID(); |
|
| 124 | + if ($element instanceof ISurroundable) { |
|
| 125 | + $element = $element->getSurroundingTagID(); |
|
| 126 | + } elseif($element instanceof TControl) { |
|
| 127 | + $element = $element->getClientID(); |
|
| 128 | + } |
|
| 126 | 129 | |
| 127 | - if(!is_array($params)) |
|
| 128 | - $params = [$params]; |
|
| 130 | + if(!is_array($params)) { |
|
| 131 | + $params = [$params]; |
|
| 132 | + } |
|
| 129 | 133 | |
| 130 | 134 | $this->_actions->add(['Prado.Element.j' => [$element, $method, $params]]); |
| 131 | 135 | } |
@@ -164,8 +168,9 @@ discard block |
||
| 164 | 168 | $total = $this->getSelectionControlIsListType($control) ? $control->getItemCount() : 1; |
| 165 | 169 | |
| 166 | 170 | // pass the ID to avoid getting the surrounding elements (ISurroundable) |
| 167 | - if($control instanceof TControl) |
|
| 168 | - $control = $control->getClientID(); |
|
| 171 | + if($control instanceof TControl) { |
|
| 172 | + $control = $control->getClientID(); |
|
| 173 | + } |
|
| 169 | 174 | |
| 170 | 175 | $this->callClientFunction('Prado.Element.select', |
| 171 | 176 | [$control, $type . $method, $value, $total]); |
@@ -173,11 +178,15 @@ discard block |
||
| 173 | 178 | |
| 174 | 179 | private function getSelectionControlType($control) |
| 175 | 180 | { |
| 176 | - if(is_string($control)) return 'check'; |
|
| 177 | - if($control instanceof TCheckBoxList) |
|
| 178 | - return 'check'; |
|
| 179 | - if($control instanceof TCheckBox) |
|
| 181 | + if(is_string($control)) { |
|
| 180 | 182 | return 'check'; |
| 183 | + } |
|
| 184 | + if($control instanceof TCheckBoxList) { |
|
| 185 | + return 'check'; |
|
| 186 | + } |
|
| 187 | + if($control instanceof TCheckBox) { |
|
| 188 | + return 'check'; |
|
| 189 | + } |
|
| 181 | 190 | return 'select'; |
| 182 | 191 | } |
| 183 | 192 | |
@@ -225,8 +234,9 @@ discard block |
||
| 225 | 234 | public function setAttribute($control, $name, $value) |
| 226 | 235 | { |
| 227 | 236 | // Attributes should be applied on Surrounding tag, except for 'disabled' attribute |
| 228 | - if ($control instanceof ISurroundable && strtolower($name) !== 'disabled') |
|
| 229 | - $control = $control->getSurroundingTagID(); |
|
| 237 | + if ($control instanceof ISurroundable && strtolower($name) !== 'disabled') { |
|
| 238 | + $control = $control->getSurroundingTagID(); |
|
| 239 | + } |
|
| 230 | 240 | $this->callClientFunction('Prado.Element.setAttribute', [$control, $name, $value]); |
| 231 | 241 | } |
| 232 | 242 | |
@@ -243,19 +253,22 @@ discard block |
||
| 243 | 253 | $promptText = $control->getPromptText(); |
| 244 | 254 | $promptValue = $control->getPromptValue(); |
| 245 | 255 | |
| 246 | - if($promptValue === '') |
|
| 247 | - $promptValue = $promptText; |
|
| 256 | + if($promptValue === '') { |
|
| 257 | + $promptValue = $promptText; |
|
| 258 | + } |
|
| 248 | 259 | |
| 249 | - if($promptValue !== '') |
|
| 250 | - $options[] = [$promptText, $promptValue]; |
|
| 260 | + if($promptValue !== '') { |
|
| 261 | + $options[] = [$promptText, $promptValue]; |
|
| 262 | + } |
|
| 251 | 263 | } |
| 252 | 264 | |
| 253 | 265 | foreach($items as $item) |
| 254 | 266 | { |
| 255 | - if($item->getHasAttributes()) |
|
| 256 | - $options[] = [$item->getText(),$item->getValue(), $item->getAttributes()->itemAt('Group')]; |
|
| 257 | - else |
|
| 258 | - $options[] = [$item->getText(),$item->getValue()]; |
|
| 267 | + if($item->getHasAttributes()) { |
|
| 268 | + $options[] = [$item->getText(),$item->getValue(), $item->getAttributes()->itemAt('Group')]; |
|
| 269 | + } else { |
|
| 270 | + $options[] = [$item->getText(),$item->getValue()]; |
|
| 271 | + } |
|
| 259 | 272 | } |
| 260 | 273 | $this->callClientFunction('Prado.Element.setOptions', [$control, $options]); |
| 261 | 274 | } |
@@ -297,8 +310,9 @@ discard block |
||
| 297 | 310 | default: |
| 298 | 311 | $method = 'toggle'; |
| 299 | 312 | // avoid fancy effect by default |
| 300 | - if(!array_key_exists('duration', $options)) |
|
| 301 | - $options['duration'] = 0; |
|
| 313 | + if(!array_key_exists('duration', $options)) { |
|
| 314 | + $options['duration'] = 0; |
|
| 315 | + } |
|
| 302 | 316 | break; |
| 303 | 317 | } |
| 304 | 318 | $this->jQuery($element, $method, $options); |
@@ -435,14 +449,13 @@ discard block |
||
| 435 | 449 | { |
| 436 | 450 | $boundary = $this->getRenderedContentBoundary($content); |
| 437 | 451 | $content = null; |
| 438 | - } |
|
| 439 | - elseif($content instanceof THtmlWriter) |
|
| 452 | + } elseif($content instanceof THtmlWriter) |
|
| 440 | 453 | { |
| 441 | 454 | $boundary = $this->getResponseContentBoundary($content); |
| 442 | 455 | $content = null; |
| 456 | + } else { |
|
| 457 | + $boundary = null; |
|
| 443 | 458 | } |
| 444 | - else |
|
| 445 | - $boundary = null; |
|
| 446 | 459 | |
| 447 | 460 | $this->callClientFunction('Prado.Element.replace', [$element, $content, $boundary, $self]); |
| 448 | 461 | } |
@@ -488,8 +501,7 @@ discard block |
||
| 488 | 501 | if($content instanceof TControl) |
| 489 | 502 | { |
| 490 | 503 | $boundary = $this->getRenderedContentBoundary($content); |
| 491 | - } |
|
| 492 | - elseif($content instanceof THtmlWriter) |
|
| 504 | + } elseif($content instanceof THtmlWriter) |
|
| 493 | 505 | { |
| 494 | 506 | $boundary = $this->getResponseContentBoundary($content); |
| 495 | 507 | } |
@@ -521,8 +533,9 @@ discard block |
||
| 521 | 533 | { |
| 522 | 534 | if($html instanceof THtmlWriter) |
| 523 | 535 | { |
| 524 | - if($html->getWriter() instanceof TCallbackResponseWriter) |
|
| 525 | - return $html->getWriter()->getBoundary(); |
|
| 536 | + if($html->getWriter() instanceof TCallbackResponseWriter) { |
|
| 537 | + return $html->getWriter()->getBoundary(); |
|
| 538 | + } |
|
| 526 | 539 | } |
| 527 | 540 | return null; |
| 528 | 541 | } |