@@ -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,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 | } |
@@ -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 | /** |
@@ -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 | /** |
@@ -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 | } |
@@ -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,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 | } |
@@ -228,8 +228,9 @@ discard block |
||
| 228 | 228 | public function dataBind() |
| 229 | 229 | { |
| 230 | 230 | parent::dataBind(); |
| 231 | - if($this->getPage()->getIsCallback()) |
|
| 232 | - $this->renderSelectables($this->getResponse()->createHtmlWriter()); |
|
| 231 | + if($this->getPage()->getIsCallback()) { |
|
| 232 | + $this->renderSelectables($this->getResponse()->createHtmlWriter()); |
|
| 233 | + } |
|
| 233 | 234 | } |
| 234 | 235 | |
| 235 | 236 | /** |
@@ -237,8 +238,9 @@ discard block |
||
| 237 | 238 | */ |
| 238 | 239 | public function getSelectables() |
| 239 | 240 | { |
| 240 | - if($this->_repeater === null) |
|
| 241 | - $this->_repeater = $this->createRepeater(); |
|
| 241 | + if($this->_repeater === null) { |
|
| 242 | + $this->_repeater = $this->createRepeater(); |
|
| 243 | + } |
|
| 242 | 244 | return $this->_repeater; |
| 243 | 245 | } |
| 244 | 246 | |