@@ -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 | } |
@@ -36,12 +36,12 @@ discard block |
||
| 36 | 36 | { |
| 37 | 37 | $text = $this->getHeaderText(); |
| 38 | 38 | |
| 39 | - if(($classPath = $this->getHeaderRenderer()) !== '') |
|
| 39 | + if (($classPath = $this->getHeaderRenderer()) !== '') |
|
| 40 | 40 | { |
| 41 | 41 | $control = Prado::createComponent($classPath); |
| 42 | - if($control instanceof \Prado\IDataRenderer) |
|
| 42 | + if ($control instanceof \Prado\IDataRenderer) |
|
| 43 | 43 | { |
| 44 | - if($control instanceof IItemDataRenderer) |
|
| 44 | + if ($control instanceof IItemDataRenderer) |
|
| 45 | 45 | { |
| 46 | 46 | $item = $cell->getParent(); |
| 47 | 47 | $control->setItemIndex($item->getItemIndex()); |
@@ -51,21 +51,21 @@ discard block |
||
| 51 | 51 | } |
| 52 | 52 | $cell->getControls()->add($control); |
| 53 | 53 | } |
| 54 | - elseif($this->getAllowSorting()) |
|
| 54 | + elseif ($this->getAllowSorting()) |
|
| 55 | 55 | { |
| 56 | 56 | $sortExpression = $this->getSortExpression(); |
| 57 | - if(($url = $this->getHeaderImageUrl()) !== '') |
|
| 57 | + if (($url = $this->getHeaderImageUrl()) !== '') |
|
| 58 | 58 | { |
| 59 | 59 | $button = new TActiveImageButton; |
| 60 | 60 | $button->setImageUrl($url); |
| 61 | 61 | $button->setCommandName(TDataGrid::CMD_SORT); |
| 62 | 62 | $button->setCommandParameter($sortExpression); |
| 63 | - if($text !== '') |
|
| 63 | + if ($text !== '') |
|
| 64 | 64 | $button->setAlternateText($text); |
| 65 | 65 | $button->setCausesValidation(false); |
| 66 | 66 | $cell->getControls()->add($button); |
| 67 | 67 | } |
| 68 | - elseif($text !== '') |
|
| 68 | + elseif ($text !== '') |
|
| 69 | 69 | { |
| 70 | 70 | $button = new TActiveLinkButton; |
| 71 | 71 | $button->setText($text); |
@@ -79,15 +79,15 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | else |
| 81 | 81 | { |
| 82 | - if(($url = $this->getHeaderImageUrl()) !== '') |
|
| 82 | + if (($url = $this->getHeaderImageUrl()) !== '') |
|
| 83 | 83 | { |
| 84 | 84 | $image = new TActiveImage; |
| 85 | 85 | $image->setImageUrl($url); |
| 86 | - if($text !== '') |
|
| 86 | + if ($text !== '') |
|
| 87 | 87 | $image->setAlternateText($text); |
| 88 | 88 | $cell->getControls()->add($image); |
| 89 | 89 | } |
| 90 | - elseif($text !== '') |
|
| 90 | + elseif ($text !== '') |
|
| 91 | 91 | $cell->setText($text); |
| 92 | 92 | else |
| 93 | 93 | $cell->setText(' '); |
@@ -50,8 +50,7 @@ discard block |
||
| 50 | 50 | $control->setData($text); |
| 51 | 51 | } |
| 52 | 52 | $cell->getControls()->add($control); |
| 53 | - } |
|
| 54 | - elseif($this->getAllowSorting()) |
|
| 53 | + } elseif($this->getAllowSorting()) |
|
| 55 | 54 | { |
| 56 | 55 | $sortExpression = $this->getSortExpression(); |
| 57 | 56 | if(($url = $this->getHeaderImageUrl()) !== '') |
@@ -60,12 +59,12 @@ discard block |
||
| 60 | 59 | $button->setImageUrl($url); |
| 61 | 60 | $button->setCommandName(TDataGrid::CMD_SORT); |
| 62 | 61 | $button->setCommandParameter($sortExpression); |
| 63 | - if($text !== '') |
|
| 64 | - $button->setAlternateText($text); |
|
| 62 | + if($text !== '') { |
|
| 63 | + $button->setAlternateText($text); |
|
| 64 | + } |
|
| 65 | 65 | $button->setCausesValidation(false); |
| 66 | 66 | $cell->getControls()->add($button); |
| 67 | - } |
|
| 68 | - elseif($text !== '') |
|
| 67 | + } elseif($text !== '') |
|
| 69 | 68 | { |
| 70 | 69 | $button = new TActiveLinkButton; |
| 71 | 70 | $button->setText($text); |
@@ -73,24 +72,24 @@ discard block |
||
| 73 | 72 | $button->setCommandParameter($sortExpression); |
| 74 | 73 | $button->setCausesValidation(false); |
| 75 | 74 | $cell->getControls()->add($button); |
| 75 | + } else { |
|
| 76 | + $cell->setText(' '); |
|
| 76 | 77 | } |
| 77 | - else |
|
| 78 | - $cell->setText(' '); |
|
| 79 | - } |
|
| 80 | - else |
|
| 78 | + } else |
|
| 81 | 79 | { |
| 82 | 80 | if(($url = $this->getHeaderImageUrl()) !== '') |
| 83 | 81 | { |
| 84 | 82 | $image = new TActiveImage; |
| 85 | 83 | $image->setImageUrl($url); |
| 86 | - if($text !== '') |
|
| 87 | - $image->setAlternateText($text); |
|
| 84 | + if($text !== '') { |
|
| 85 | + $image->setAlternateText($text); |
|
| 86 | + } |
|
| 88 | 87 | $cell->getControls()->add($image); |
| 88 | + } elseif($text !== '') { |
|
| 89 | + $cell->setText($text); |
|
| 90 | + } else { |
|
| 91 | + $cell->setText(' '); |
|
| 89 | 92 | } |
| 90 | - elseif($text !== '') |
|
| 91 | - $cell->setText($text); |
|
| 92 | - else |
|
| 93 | - $cell->setText(' '); |
|
| 94 | 93 | } |
| 95 | 94 | } |
| 96 | 95 | |
@@ -107,9 +107,10 @@ |
||
| 107 | 107 | { |
| 108 | 108 | parent::addAttributesToRender($writer); |
| 109 | 109 | $writer->addAttribute('id', $this->getClientID()); |
| 110 | - if ($this->getAutoPostBack()) |
|
| 111 | - $this->getActiveControl()->registerCallbackClientScript( |
|
| 110 | + if ($this->getAutoPostBack()) { |
|
| 111 | + $this->getActiveControl()->registerCallbackClientScript( |
|
| 112 | 112 | $this->getClientClassName(), $this->getPostBackOptions()); |
| 113 | + } |
|
| 113 | 114 | } |
| 114 | 115 | |
| 115 | 116 | /** |
@@ -41,15 +41,15 @@ discard block |
||
| 41 | 41 | $this->_items = []; |
| 42 | 42 | $this->_expressions = []; |
| 43 | 43 | $this->_statements = []; |
| 44 | - foreach($items as $id => $item) |
|
| 44 | + foreach ($items as $id => $item) |
|
| 45 | 45 | { |
| 46 | - if(is_array($item)) |
|
| 46 | + if (is_array($item)) |
|
| 47 | 47 | { |
| 48 | - if($item[0] === self::TYPE_EXPRESSION) |
|
| 48 | + if ($item[0] === self::TYPE_EXPRESSION) |
|
| 49 | 49 | $this->_expressions[$id] = $item[1]; |
| 50 | - elseif($item[0] === self::TYPE_STATEMENTS) |
|
| 50 | + elseif ($item[0] === self::TYPE_STATEMENTS) |
|
| 51 | 51 | $this->_statements[$id] = $item[1]; |
| 52 | - elseif($item[0] === self::TYPE_DATABINDING) |
|
| 52 | + elseif ($item[0] === self::TYPE_DATABINDING) |
|
| 53 | 53 | $this->_bindings[$id] = $item[1]; |
| 54 | 54 | $this->_items[$id] = ''; |
| 55 | 55 | } |
@@ -79,10 +79,10 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function evaluateDynamicContent() |
| 81 | 81 | { |
| 82 | - $context = $this->_container === null?$this:$this->_container; |
|
| 83 | - foreach($this->_expressions as $id => $expression) |
|
| 82 | + $context = $this->_container === null ? $this : $this->_container; |
|
| 83 | + foreach ($this->_expressions as $id => $expression) |
|
| 84 | 84 | $this->_items[$id] = $context->evaluateExpression($expression); |
| 85 | - foreach($this->_statements as $id => $statement) |
|
| 85 | + foreach ($this->_statements as $id => $statement) |
|
| 86 | 86 | $this->_items[$id] = $context->evaluateStatements($statement); |
| 87 | 87 | } |
| 88 | 88 | |
@@ -92,8 +92,8 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function dataBind() |
| 94 | 94 | { |
| 95 | - $context = $this->_container === null?$this:$this->_container; |
|
| 96 | - foreach($this->_bindings as $id => $binding) |
|
| 95 | + $context = $this->_container === null ? $this : $this->_container; |
|
| 96 | + foreach ($this->_bindings as $id => $binding) |
|
| 97 | 97 | $this->_items[$id] = $context->evaluateExpression($binding); |
| 98 | 98 | } |
| 99 | 99 | |
@@ -45,16 +45,17 @@ discard block |
||
| 45 | 45 | { |
| 46 | 46 | if(is_array($item)) |
| 47 | 47 | { |
| 48 | - if($item[0] === self::TYPE_EXPRESSION) |
|
| 49 | - $this->_expressions[$id] = $item[1]; |
|
| 50 | - elseif($item[0] === self::TYPE_STATEMENTS) |
|
| 51 | - $this->_statements[$id] = $item[1]; |
|
| 52 | - elseif($item[0] === self::TYPE_DATABINDING) |
|
| 53 | - $this->_bindings[$id] = $item[1]; |
|
| 48 | + if($item[0] === self::TYPE_EXPRESSION) { |
|
| 49 | + $this->_expressions[$id] = $item[1]; |
|
| 50 | + } elseif($item[0] === self::TYPE_STATEMENTS) { |
|
| 51 | + $this->_statements[$id] = $item[1]; |
|
| 52 | + } elseif($item[0] === self::TYPE_DATABINDING) { |
|
| 53 | + $this->_bindings[$id] = $item[1]; |
|
| 54 | + } |
|
| 54 | 55 | $this->_items[$id] = ''; |
| 56 | + } else { |
|
| 57 | + $this->_items[$id] = $item; |
|
| 55 | 58 | } |
| 56 | - else |
|
| 57 | - $this->_items[$id] = $item; |
|
| 58 | 59 | } |
| 59 | 60 | } |
| 60 | 61 | |
@@ -80,10 +81,12 @@ discard block |
||
| 80 | 81 | public function evaluateDynamicContent() |
| 81 | 82 | { |
| 82 | 83 | $context = $this->_container === null?$this:$this->_container; |
| 83 | - foreach($this->_expressions as $id => $expression) |
|
| 84 | - $this->_items[$id] = $context->evaluateExpression($expression); |
|
| 85 | - foreach($this->_statements as $id => $statement) |
|
| 86 | - $this->_items[$id] = $context->evaluateStatements($statement); |
|
| 84 | + foreach($this->_expressions as $id => $expression) { |
|
| 85 | + $this->_items[$id] = $context->evaluateExpression($expression); |
|
| 86 | + } |
|
| 87 | + foreach($this->_statements as $id => $statement) { |
|
| 88 | + $this->_items[$id] = $context->evaluateStatements($statement); |
|
| 89 | + } |
|
| 87 | 90 | } |
| 88 | 91 | |
| 89 | 92 | /** |
@@ -93,8 +96,9 @@ discard block |
||
| 93 | 96 | public function dataBind() |
| 94 | 97 | { |
| 95 | 98 | $context = $this->_container === null?$this:$this->_container; |
| 96 | - foreach($this->_bindings as $id => $binding) |
|
| 97 | - $this->_items[$id] = $context->evaluateExpression($binding); |
|
| 99 | + foreach($this->_bindings as $id => $binding) { |
|
| 100 | + $this->_items[$id] = $context->evaluateExpression($binding); |
|
| 101 | + } |
|
| 98 | 102 | } |
| 99 | 103 | |
| 100 | 104 | /** |
@@ -66,10 +66,10 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function getTemplate() |
| 68 | 68 | { |
| 69 | - if($this->_localTemplate === null) |
|
| 69 | + if ($this->_localTemplate === null) |
|
| 70 | 70 | { |
| 71 | 71 | $class = get_class($this); |
| 72 | - if(!isset(self::$_template[$class])) |
|
| 72 | + if (!isset(self::$_template[$class])) |
|
| 73 | 73 | self::$_template[$class] = $this->loadTemplate(); |
| 74 | 74 | return self::$_template[$class]; |
| 75 | 75 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | public function getIsSourceTemplateControl() |
| 97 | 97 | { |
| 98 | - if(($template = $this->getTemplate()) !== null) |
|
| 98 | + if (($template = $this->getTemplate()) !== null) |
|
| 99 | 99 | return $template->getIsSourceTemplate(); |
| 100 | 100 | else |
| 101 | 101 | return false; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function getTemplateDirectory() |
| 108 | 108 | { |
| 109 | - if(($template = $this->getTemplate()) !== null) |
|
| 109 | + if (($template = $this->getTemplate()) !== null) |
|
| 110 | 110 | return $template->getContextPath(); |
| 111 | 111 | else |
| 112 | 112 | return ''; |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | protected function loadTemplate() |
| 120 | 120 | { |
| 121 | - Prado::trace("Loading template " . get_class($this), '\Prado\Web\UI\TTemplateControl'); |
|
| 121 | + Prado::trace("Loading template ".get_class($this), '\Prado\Web\UI\TTemplateControl'); |
|
| 122 | 122 | $template = $this->getService()->getTemplateManager()->getTemplateByClassName(get_class($this)); |
| 123 | 123 | return $template; |
| 124 | 124 | } |
@@ -130,11 +130,11 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | public function createChildControls() |
| 132 | 132 | { |
| 133 | - if($tpl = $this->getTemplate()) |
|
| 133 | + if ($tpl = $this->getTemplate()) |
|
| 134 | 134 | { |
| 135 | - foreach($tpl->getDirective() as $name => $value) |
|
| 135 | + foreach ($tpl->getDirective() as $name => $value) |
|
| 136 | 136 | { |
| 137 | - if(is_string($value)) |
|
| 137 | + if (is_string($value)) |
|
| 138 | 138 | $this->setSubProperty($name, $value); |
| 139 | 139 | else |
| 140 | 140 | throw new TConfigurationException('templatecontrol_directive_invalid', get_class($this), $name); |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | public function registerContent($id, TContent $object) |
| 152 | 152 | { |
| 153 | - if(isset($this->_contents[$id])) |
|
| 153 | + if (isset($this->_contents[$id])) |
|
| 154 | 154 | throw new TConfigurationException('templatecontrol_contentid_duplicated', $id); |
| 155 | 155 | else |
| 156 | 156 | $this->_contents[$id] = $object; |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | public function registerContentPlaceHolder($id, TContentPlaceHolder $object) |
| 166 | 166 | { |
| 167 | - if(isset($this->_placeholders[$id])) |
|
| 167 | + if (isset($this->_placeholders[$id])) |
|
| 168 | 168 | throw new TConfigurationException('templatecontrol_placeholderid_duplicated', $id); |
| 169 | 169 | else |
| 170 | 170 | $this->_placeholders[$id] = $object; |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | public function injectContent($id, $content) |
| 204 | 204 | { |
| 205 | - if(isset($this->_placeholders[$id])) |
|
| 205 | + if (isset($this->_placeholders[$id])) |
|
| 206 | 206 | { |
| 207 | 207 | $placeholder = $this->_placeholders[$id]; |
| 208 | 208 | $controls = $placeholder->getParent()->getControls(); |
@@ -224,19 +224,19 @@ discard block |
||
| 224 | 224 | protected function initRecursive($namingContainer = null) |
| 225 | 225 | { |
| 226 | 226 | $this->ensureChildControls(); |
| 227 | - if($this->_masterClass !== '') |
|
| 227 | + if ($this->_masterClass !== '') |
|
| 228 | 228 | { |
| 229 | 229 | $master = Prado::createComponent($this->_masterClass); |
| 230 | - if(!($master instanceof TTemplateControl)) |
|
| 230 | + if (!($master instanceof TTemplateControl)) |
|
| 231 | 231 | throw new TInvalidDataValueException('templatecontrol_mastercontrol_invalid'); |
| 232 | 232 | $this->_master = $master; |
| 233 | 233 | $this->getControls()->clear(); |
| 234 | 234 | $this->getControls()->add($master); |
| 235 | 235 | $master->ensureChildControls(); |
| 236 | - foreach($this->_contents as $id => $content) |
|
| 236 | + foreach ($this->_contents as $id => $content) |
|
| 237 | 237 | $master->injectContent($id, $content); |
| 238 | 238 | } |
| 239 | - elseif(!empty($this->_contents)) |
|
| 239 | + elseif (!empty($this->_contents)) |
|
| 240 | 240 | throw new TConfigurationException('templatecontrol_mastercontrol_required', get_class($this)); |
| 241 | 241 | parent::initRecursive($namingContainer); |
| 242 | 242 | } |
@@ -69,12 +69,13 @@ discard block |
||
| 69 | 69 | if($this->_localTemplate === null) |
| 70 | 70 | { |
| 71 | 71 | $class = get_class($this); |
| 72 | - if(!isset(self::$_template[$class])) |
|
| 73 | - self::$_template[$class] = $this->loadTemplate(); |
|
| 72 | + if(!isset(self::$_template[$class])) { |
|
| 73 | + self::$_template[$class] = $this->loadTemplate(); |
|
| 74 | + } |
|
| 74 | 75 | return self::$_template[$class]; |
| 76 | + } else { |
|
| 77 | + return $this->_localTemplate; |
|
| 75 | 78 | } |
| 76 | - else |
|
| 77 | - return $this->_localTemplate; |
|
| 78 | 79 | } |
| 79 | 80 | |
| 80 | 81 | /** |
@@ -95,10 +96,11 @@ discard block |
||
| 95 | 96 | */ |
| 96 | 97 | public function getIsSourceTemplateControl() |
| 97 | 98 | { |
| 98 | - if(($template = $this->getTemplate()) !== null) |
|
| 99 | - return $template->getIsSourceTemplate(); |
|
| 100 | - else |
|
| 101 | - return false; |
|
| 99 | + if(($template = $this->getTemplate()) !== null) { |
|
| 100 | + return $template->getIsSourceTemplate(); |
|
| 101 | + } else { |
|
| 102 | + return false; |
|
| 103 | + } |
|
| 102 | 104 | } |
| 103 | 105 | |
| 104 | 106 | /** |
@@ -106,10 +108,11 @@ discard block |
||
| 106 | 108 | */ |
| 107 | 109 | public function getTemplateDirectory() |
| 108 | 110 | { |
| 109 | - if(($template = $this->getTemplate()) !== null) |
|
| 110 | - return $template->getContextPath(); |
|
| 111 | - else |
|
| 112 | - return ''; |
|
| 111 | + if(($template = $this->getTemplate()) !== null) { |
|
| 112 | + return $template->getContextPath(); |
|
| 113 | + } else { |
|
| 114 | + return ''; |
|
| 115 | + } |
|
| 113 | 116 | } |
| 114 | 117 | |
| 115 | 118 | /** |
@@ -134,10 +137,11 @@ discard block |
||
| 134 | 137 | { |
| 135 | 138 | foreach($tpl->getDirective() as $name => $value) |
| 136 | 139 | { |
| 137 | - if(is_string($value)) |
|
| 138 | - $this->setSubProperty($name, $value); |
|
| 139 | - else |
|
| 140 | - throw new TConfigurationException('templatecontrol_directive_invalid', get_class($this), $name); |
|
| 140 | + if(is_string($value)) { |
|
| 141 | + $this->setSubProperty($name, $value); |
|
| 142 | + } else { |
|
| 143 | + throw new TConfigurationException('templatecontrol_directive_invalid', get_class($this), $name); |
|
| 144 | + } |
|
| 141 | 145 | } |
| 142 | 146 | $tpl->instantiateIn($this); |
| 143 | 147 | } |
@@ -150,10 +154,11 @@ discard block |
||
| 150 | 154 | */ |
| 151 | 155 | public function registerContent($id, TContent $object) |
| 152 | 156 | { |
| 153 | - if(isset($this->_contents[$id])) |
|
| 154 | - throw new TConfigurationException('templatecontrol_contentid_duplicated', $id); |
|
| 155 | - else |
|
| 156 | - $this->_contents[$id] = $object; |
|
| 157 | + if(isset($this->_contents[$id])) { |
|
| 158 | + throw new TConfigurationException('templatecontrol_contentid_duplicated', $id); |
|
| 159 | + } else { |
|
| 160 | + $this->_contents[$id] = $object; |
|
| 161 | + } |
|
| 157 | 162 | } |
| 158 | 163 | |
| 159 | 164 | /** |
@@ -164,10 +169,11 @@ discard block |
||
| 164 | 169 | */ |
| 165 | 170 | public function registerContentPlaceHolder($id, TContentPlaceHolder $object) |
| 166 | 171 | { |
| 167 | - if(isset($this->_placeholders[$id])) |
|
| 168 | - throw new TConfigurationException('templatecontrol_placeholderid_duplicated', $id); |
|
| 169 | - else |
|
| 170 | - $this->_placeholders[$id] = $object; |
|
| 172 | + if(isset($this->_placeholders[$id])) { |
|
| 173 | + throw new TConfigurationException('templatecontrol_placeholderid_duplicated', $id); |
|
| 174 | + } else { |
|
| 175 | + $this->_placeholders[$id] = $object; |
|
| 176 | + } |
|
| 171 | 177 | } |
| 172 | 178 | |
| 173 | 179 | /** |
@@ -208,9 +214,9 @@ discard block |
||
| 208 | 214 | $controls = $placeholder->getParent()->getControls(); |
| 209 | 215 | $loc = $controls->remove($placeholder); |
| 210 | 216 | $controls->insertAt($loc, $content); |
| 217 | + } else { |
|
| 218 | + throw new TConfigurationException('templatecontrol_placeholder_inexistent', $id); |
|
| 211 | 219 | } |
| 212 | - else |
|
| 213 | - throw new TConfigurationException('templatecontrol_placeholder_inexistent', $id); |
|
| 214 | 220 | } |
| 215 | 221 | |
| 216 | 222 | /** |
@@ -227,17 +233,19 @@ discard block |
||
| 227 | 233 | if($this->_masterClass !== '') |
| 228 | 234 | { |
| 229 | 235 | $master = Prado::createComponent($this->_masterClass); |
| 230 | - if(!($master instanceof TTemplateControl)) |
|
| 231 | - throw new TInvalidDataValueException('templatecontrol_mastercontrol_invalid'); |
|
| 236 | + if(!($master instanceof TTemplateControl)) { |
|
| 237 | + throw new TInvalidDataValueException('templatecontrol_mastercontrol_invalid'); |
|
| 238 | + } |
|
| 232 | 239 | $this->_master = $master; |
| 233 | 240 | $this->getControls()->clear(); |
| 234 | 241 | $this->getControls()->add($master); |
| 235 | 242 | $master->ensureChildControls(); |
| 236 | - foreach($this->_contents as $id => $content) |
|
| 237 | - $master->injectContent($id, $content); |
|
| 243 | + foreach($this->_contents as $id => $content) { |
|
| 244 | + $master->injectContent($id, $content); |
|
| 245 | + } |
|
| 246 | + } elseif(!empty($this->_contents)) { |
|
| 247 | + throw new TConfigurationException('templatecontrol_mastercontrol_required', get_class($this)); |
|
| 238 | 248 | } |
| 239 | - elseif(!empty($this->_contents)) |
|
| 240 | - throw new TConfigurationException('templatecontrol_mastercontrol_required', get_class($this)); |
|
| 241 | 249 | parent::initRecursive($namingContainer); |
| 242 | 250 | } |
| 243 | 251 | |
@@ -258,14 +266,14 @@ discard block |
||
| 258 | 266 | if ($key != "RELATIONS") |
| 259 | 267 | { |
| 260 | 268 | $control = $this->{$key}; |
| 261 | - if ($control instanceof TTextBox) |
|
| 262 | - $control->Text = $arObj->{$key}; |
|
| 263 | - elseif ($control instanceof TCheckBox) |
|
| 264 | - $control->Checked = (boolean) $arObj->{$key}; |
|
| 265 | - elseif ($control instanceof TDatePicker) |
|
| 266 | - $control->Date = $arObj->{$key}; |
|
| 267 | - } |
|
| 268 | - else |
|
| 269 | + if ($control instanceof TTextBox) { |
|
| 270 | + $control->Text = $arObj->{$key}; |
|
| 271 | + } elseif ($control instanceof TCheckBox) { |
|
| 272 | + $control->Checked = (boolean) $arObj->{$key}; |
|
| 273 | + } elseif ($control instanceof TDatePicker) { |
|
| 274 | + $control->Date = $arObj->{$key}; |
|
| 275 | + } |
|
| 276 | + } else |
|
| 269 | 277 | { |
| 270 | 278 | foreach ($objAttrs["RELATIONS"] as $relKey => $relValues) |
| 271 | 279 | { |
@@ -287,11 +295,11 @@ discard block |
||
| 287 | 295 | } |
| 288 | 296 | break; |
| 289 | 297 | } |
| 290 | - } |
|
| 291 | - catch (Exception $ex) |
|
| 298 | + } catch (Exception $ex) |
|
| 292 | 299 | { |
| 293 | - if ($throwExceptions) |
|
| 294 | - throw $ex; |
|
| 300 | + if ($throwExceptions) { |
|
| 301 | + throw $ex; |
|
| 302 | + } |
|
| 295 | 303 | } |
| 296 | 304 | } |
| 297 | 305 | } |
@@ -309,20 +317,22 @@ discard block |
||
| 309 | 317 | { |
| 310 | 318 | try |
| 311 | 319 | { |
| 312 | - if ($key == "RELATIONS") |
|
| 313 | - break; |
|
| 320 | + if ($key == "RELATIONS") { |
|
| 321 | + break; |
|
| 322 | + } |
|
| 314 | 323 | $control = $this->{$key}; |
| 315 | - if ($control instanceof TTextBox) |
|
| 316 | - $arObj->{$key} = $control->Text; |
|
| 317 | - elseif ($control instanceof TCheckBox) |
|
| 318 | - $arObj->{$key} = $control->Checked; |
|
| 319 | - elseif ($control instanceof TDatePicker) |
|
| 320 | - $arObj->{$key} = $control->Date; |
|
| 321 | - } |
|
| 322 | - catch (Exception $ex) |
|
| 324 | + if ($control instanceof TTextBox) { |
|
| 325 | + $arObj->{$key} = $control->Text; |
|
| 326 | + } elseif ($control instanceof TCheckBox) { |
|
| 327 | + $arObj->{$key} = $control->Checked; |
|
| 328 | + } elseif ($control instanceof TDatePicker) { |
|
| 329 | + $arObj->{$key} = $control->Date; |
|
| 330 | + } |
|
| 331 | + } catch (Exception $ex) |
|
| 323 | 332 | { |
| 324 | - if ($throwExceptions) |
|
| 325 | - throw $ex; |
|
| 333 | + if ($throwExceptions) { |
|
| 334 | + throw $ex; |
|
| 335 | + } |
|
| 326 | 336 | } |
| 327 | 337 | } |
| 328 | 338 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | $writer->addAttribute('id', $this->getClientID()); |
| 126 | 126 | $options = TJavaScript::encode($this->getPostBackOptions()); |
| 127 | 127 | $cs = $this->getPage()->getClientScript(); |
| 128 | - $code = "jQuery('#" . $this->getWidgetID() . "')." . $this->getWidget() . "(" . $options . ");"; |
|
| 128 | + $code = "jQuery('#".$this->getWidgetID()."').".$this->getWidget()."(".$options.");"; |
|
| 129 | 129 | $cs->registerEndScript(sprintf('%08X', crc32($code)), $code); |
| 130 | 130 | } |
| 131 | 131 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * Raises the OnCreate event |
| 144 | 144 | * @param object $params event parameters |
| 145 | 145 | */ |
| 146 | - public function onCreate ($params) |
|
| 146 | + public function onCreate($params) |
|
| 147 | 147 | { |
| 148 | 148 | $this->raiseEvent('OnCreate', $this, $params); |
| 149 | 149 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | * Raises the OnResize event |
| 153 | 153 | * @param object $params event parameters |
| 154 | 154 | */ |
| 155 | - public function onResize ($params) |
|
| 155 | + public function onResize($params) |
|
| 156 | 156 | { |
| 157 | 157 | $this->raiseEvent('OnResize', $this, $params); |
| 158 | 158 | } |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | * Raises the OnStart event |
| 162 | 162 | * @param object $params event parameters |
| 163 | 163 | */ |
| 164 | - public function onStart ($params) |
|
| 164 | + public function onStart($params) |
|
| 165 | 165 | { |
| 166 | 166 | $this->raiseEvent('OnStart', $this, $params); |
| 167 | 167 | } |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | * Raises the OnStop event |
| 171 | 171 | * @param object $params event parameters |
| 172 | 172 | */ |
| 173 | - public function onStop ($params) |
|
| 173 | + public function onStop($params) |
|
| 174 | 174 | { |
| 175 | 175 | $this->raiseEvent('OnStop', $this, $params); |
| 176 | 176 | } |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | { |
| 66 | 66 | return [ |
| 67 | 67 | 'text' => $this->getText(), |
| 68 | - 'click' => new TJavaScriptLiteral("function(){new Prado.Callback('" . $this->getUniqueID() . "', 'onClick');}" |
|
| 69 | - )] ; |
|
| 68 | + 'click' => new TJavaScriptLiteral("function(){new Prado.Callback('".$this->getUniqueID()."', 'onClick');}" |
|
| 69 | + )]; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * Raises the OnClick event |
| 90 | 90 | * @param object $params event parameters |
| 91 | 91 | */ |
| 92 | - public function onClick ($params) |
|
| 92 | + public function onClick($params) |
|
| 93 | 93 | { |
| 94 | 94 | $this->raiseEvent('OnClick', $this, $params); |
| 95 | 95 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | public function raiseCallbackEvent($param) |
| 103 | 103 | { |
| 104 | - if($param->CallbackParameter === 'onClick') |
|
| 104 | + if ($param->CallbackParameter === 'onClick') |
|
| 105 | 105 | $this->onClick($param); |
| 106 | 106 | } |
| 107 | 107 | |
@@ -101,8 +101,9 @@ |
||
| 101 | 101 | */ |
| 102 | 102 | public function raiseCallbackEvent($param) |
| 103 | 103 | { |
| 104 | - if($param->CallbackParameter === 'onClick') |
|
| 105 | - $this->onClick($param); |
|
| 104 | + if($param->CallbackParameter === 'onClick') { |
|
| 105 | + $this->onClick($param); |
|
| 106 | + } |
|
| 106 | 107 | } |
| 107 | 108 | |
| 108 | 109 | } |
| 109 | 110 | \ No newline at end of file |
@@ -76,7 +76,7 @@ |
||
| 76 | 76 | $name = strtolower(substr($name, 0, $pos)); |
| 77 | 77 | |
| 78 | 78 | $cp = $this->getCallbackParameter(); |
| 79 | - if(!isset($cp->$name) || $cp->$name == '') |
|
| 79 | + if (!isset($cp->$name) || $cp->$name == '') |
|
| 80 | 80 | return null; |
| 81 | 81 | |
| 82 | 82 | return $this->getControl($cp->$name); |
@@ -76,8 +76,9 @@ |
||
| 76 | 76 | $name = strtolower(substr($name, 0, $pos)); |
| 77 | 77 | |
| 78 | 78 | $cp = $this->getCallbackParameter(); |
| 79 | - if(!isset($cp->$name) || $cp->$name == '') |
|
| 80 | - return null; |
|
| 79 | + if(!isset($cp->$name) || $cp->$name == '') { |
|
| 80 | + return null; |
|
| 81 | + } |
|
| 81 | 82 | |
| 82 | 83 | return $this->getControl($cp->$name); |
| 83 | 84 | } |