@@ -359,8 +359,9 @@ discard block |
||
| 359 | 359 | $content = ''; |
| 360 | 360 | if(strlen($header)) |
| 361 | 361 | $content.= $header."<br/>\n"; |
| 362 | - foreach($messages as $message) |
|
| 363 | - $content.="$message<br/>\n"; |
|
| 362 | + foreach($messages as $message) { |
|
| 363 | + $content.="$message<br/>\n"; |
|
| 364 | + } |
|
| 364 | 365 | $writer->write($content); |
| 365 | 366 | } |
| 366 | 367 | |
@@ -375,8 +376,9 @@ discard block |
||
| 375 | 376 | $header=$this->getHeaderText(); |
| 376 | 377 | $messages=$this->getErrorMessages(); |
| 377 | 378 | $content = $header; |
| 378 | - foreach($messages as $message) |
|
| 379 | - $content.= ' '.$message; |
|
| 379 | + foreach($messages as $message) { |
|
| 380 | + $content.= ' '.$message; |
|
| 381 | + } |
|
| 380 | 382 | $writer->write($content); |
| 381 | 383 | } |
| 382 | 384 | |
@@ -394,8 +396,9 @@ discard block |
||
| 394 | 396 | if(count($messages)>0) |
| 395 | 397 | { |
| 396 | 398 | $content .= "<ul>\n"; |
| 397 | - foreach($messages as $message) |
|
| 398 | - $content.= '<li>'.$message."</li>\n"; |
|
| 399 | + foreach($messages as $message) { |
|
| 400 | + $content.= '<li>'.$message."</li>\n"; |
|
| 401 | + } |
|
| 399 | 402 | $content .= "</ul>\n"; |
| 400 | 403 | } |
| 401 | 404 | $writer->write($content); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function getDisplay() |
| 56 | 56 | { |
| 57 | - return $this->getViewState('Display',TValidationSummaryDisplayStyle::Fixed); |
|
| 57 | + return $this->getViewState('Display', TValidationSummaryDisplayStyle::Fixed); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function setDisplay($value) |
| 64 | 64 | { |
| 65 | - $this->setViewState('Display',TPropertyValue::ensureEnum($value,'TValidationSummaryDisplayStyle'),TValidationSummaryDisplayStyle::Fixed); |
|
| 65 | + $this->setViewState('Display', TPropertyValue::ensureEnum($value, 'TValidationSummaryDisplayStyle'), TValidationSummaryDisplayStyle::Fixed); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function getHeaderText() |
| 72 | 72 | { |
| 73 | - return $this->getViewState('HeaderText',''); |
|
| 73 | + return $this->getViewState('HeaderText', ''); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function setHeaderText($value) |
| 81 | 81 | { |
| 82 | - $this->setViewState('HeaderText',$value,''); |
|
| 82 | + $this->setViewState('HeaderText', $value, ''); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public function getDisplayMode() |
| 89 | 89 | { |
| 90 | - return $this->getViewState('DisplayMode',TValidationSummaryDisplayMode::BulletList); |
|
| 90 | + return $this->getViewState('DisplayMode', TValidationSummaryDisplayMode::BulletList); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | public function setDisplayMode($value) |
| 97 | 97 | { |
| 98 | - $this->setViewState('DisplayMode',TPropertyValue::ensureEnum($value,'TValidationSummaryDisplayMode'),TValidationSummaryDisplayMode::BulletList); |
|
| 98 | + $this->setViewState('DisplayMode', TPropertyValue::ensureEnum($value, 'TValidationSummaryDisplayMode'), TValidationSummaryDisplayMode::BulletList); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | public function getEnableClientScript() |
| 105 | 105 | { |
| 106 | - return $this->getViewState('EnableClientScript',true); |
|
| 106 | + return $this->getViewState('EnableClientScript', true); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function setEnableClientScript($value) |
| 113 | 113 | { |
| 114 | - $this->setViewState('EnableClientScript',TPropertyValue::ensureBoolean($value),true); |
|
| 114 | + $this->setViewState('EnableClientScript', TPropertyValue::ensureBoolean($value), true); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | public function getShowMessageBox() |
| 121 | 121 | { |
| 122 | - return $this->getViewState('ShowMessageBox',false); |
|
| 122 | + return $this->getViewState('ShowMessageBox', false); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | public function setShowMessageBox($value) |
| 129 | 129 | { |
| 130 | - $this->setViewState('ShowMessageBox',TPropertyValue::ensureBoolean($value),false); |
|
| 130 | + $this->setViewState('ShowMessageBox', TPropertyValue::ensureBoolean($value), false); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | public function getShowSummary() |
| 137 | 137 | { |
| 138 | - return $this->getViewState('ShowSummary',true); |
|
| 138 | + return $this->getViewState('ShowSummary', true); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | /** |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | public function setShowSummary($value) |
| 145 | 145 | { |
| 146 | - $this->setViewState('ShowSummary',TPropertyValue::ensureBoolean($value),true); |
|
| 146 | + $this->setViewState('ShowSummary', TPropertyValue::ensureBoolean($value), true); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | */ |
| 152 | 152 | public function getScrollToSummary() |
| 153 | 153 | { |
| 154 | - return $this->getViewState('ScrollToSummary',true); |
|
| 154 | + return $this->getViewState('ScrollToSummary', true); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | /** |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | public function setScrollToSummary($value) |
| 161 | 161 | { |
| 162 | - $this->setViewState('ScrollToSummary',TPropertyValue::ensureBoolean($value),true); |
|
| 162 | + $this->setViewState('ScrollToSummary', TPropertyValue::ensureBoolean($value), true); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | */ |
| 168 | 168 | public function getShowAnchor() |
| 169 | 169 | { |
| 170 | - return $this->getViewState('ShowAnchor',false); |
|
| 170 | + return $this->getViewState('ShowAnchor', false); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | public function setShowAnchor($value) |
| 177 | 177 | { |
| 178 | - $this->setViewState('ShowAnchor',TPropertyValue::ensureBoolean($value),false); |
|
| 178 | + $this->setViewState('ShowAnchor', TPropertyValue::ensureBoolean($value), false); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | /** |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | */ |
| 202 | 202 | public function getValidationGroup() |
| 203 | 203 | { |
| 204 | - return $this->getViewState('ValidationGroup',''); |
|
| 204 | + return $this->getViewState('ValidationGroup', ''); |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | /** |
@@ -209,21 +209,21 @@ discard block |
||
| 209 | 209 | */ |
| 210 | 210 | public function setValidationGroup($value) |
| 211 | 211 | { |
| 212 | - $this->setViewState('ValidationGroup',$value,''); |
|
| 212 | + $this->setViewState('ValidationGroup', $value, ''); |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | protected function addAttributesToRender($writer) |
| 216 | 216 | { |
| 217 | - $display=$this->getDisplay(); |
|
| 218 | - $visible=$this->getEnabled(true) && $this->getValidationFailed(); |
|
| 219 | - if(!$visible) |
|
| 217 | + $display = $this->getDisplay(); |
|
| 218 | + $visible = $this->getEnabled(true) && $this->getValidationFailed(); |
|
| 219 | + if (!$visible) |
|
| 220 | 220 | { |
| 221 | - if($display===TValidationSummaryDisplayStyle::None || $display===TValidationSummaryDisplayStyle::Dynamic) |
|
| 222 | - $writer->addStyleAttribute('display','none'); |
|
| 221 | + if ($display === TValidationSummaryDisplayStyle::None || $display === TValidationSummaryDisplayStyle::Dynamic) |
|
| 222 | + $writer->addStyleAttribute('display', 'none'); |
|
| 223 | 223 | else |
| 224 | - $writer->addStyleAttribute('visibility','hidden'); |
|
| 224 | + $writer->addStyleAttribute('visibility', 'hidden'); |
|
| 225 | 225 | } |
| 226 | - $writer->addAttribute('id',$this->getClientID()); |
|
| 226 | + $writer->addAttribute('id', $this->getClientID()); |
|
| 227 | 227 | parent::addAttributesToRender($writer); |
| 228 | 228 | } |
| 229 | 229 | |
@@ -233,15 +233,15 @@ discard block |
||
| 233 | 233 | */ |
| 234 | 234 | protected function renderJsSummary() |
| 235 | 235 | { |
| 236 | - if(!$this->getEnabled(true) || !$this->getEnableClientScript()) |
|
| 236 | + if (!$this->getEnabled(true) || !$this->getEnableClientScript()) |
|
| 237 | 237 | return; |
| 238 | 238 | $cs = $this->getPage()->getClientScript(); |
| 239 | 239 | $cs->registerPradoScript('validator'); |
| 240 | 240 | |
| 241 | 241 | //need to register the validation manager is validation summary is alone. |
| 242 | - $formID=$this->getPage()->getForm()->getClientID(); |
|
| 242 | + $formID = $this->getPage()->getForm()->getClientID(); |
|
| 243 | 243 | $scriptKey = "TBaseValidator:$formID"; |
| 244 | - if($this->getEnableClientScript() && !$cs->isEndScriptRegistered($scriptKey)) |
|
| 244 | + if ($this->getEnableClientScript() && !$cs->isEndScriptRegistered($scriptKey)) |
|
| 245 | 245 | { |
| 246 | 246 | $manager['FormID'] = $formID; |
| 247 | 247 | $options = TJavaScript::encode($manager); |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | |
| 253 | - $options=TJavaScript::encode($this->getClientScriptOptions()); |
|
| 253 | + $options = TJavaScript::encode($this->getClientScriptOptions()); |
|
| 254 | 254 | $script = "new Prado.WebUI.TValidationSummary({$options});"; |
| 255 | 255 | $cs->registerEndScript($this->getClientID(), $script); |
| 256 | 256 | } |
@@ -263,21 +263,21 @@ discard block |
||
| 263 | 263 | { |
| 264 | 264 | $options['ID'] = $this->getClientID(); |
| 265 | 265 | $options['FormID'] = $this->getPage()->getForm()->getClientID(); |
| 266 | - if($this->getShowMessageBox()) |
|
| 267 | - $options['ShowMessageBox']=true; |
|
| 268 | - if(!$this->getShowSummary()) |
|
| 269 | - $options['ShowSummary']=false; |
|
| 266 | + if ($this->getShowMessageBox()) |
|
| 267 | + $options['ShowMessageBox'] = true; |
|
| 268 | + if (!$this->getShowSummary()) |
|
| 269 | + $options['ShowSummary'] = false; |
|
| 270 | 270 | |
| 271 | - $options['ScrollToSummary']=$this->getScrollToSummary(); |
|
| 272 | - $options['HeaderText']=$this->getHeaderText(); |
|
| 273 | - $options['DisplayMode']=$this->getDisplayMode(); |
|
| 271 | + $options['ScrollToSummary'] = $this->getScrollToSummary(); |
|
| 272 | + $options['HeaderText'] = $this->getHeaderText(); |
|
| 273 | + $options['DisplayMode'] = $this->getDisplayMode(); |
|
| 274 | 274 | |
| 275 | 275 | $options['Refresh'] = $this->getAutoUpdate(); |
| 276 | - $options['ValidationGroup'] = $this->getValidationGroup(); |
|
| 276 | + $options['ValidationGroup'] = $this->getValidationGroup(); |
|
| 277 | 277 | $options['Display'] = $this->getDisplay(); |
| 278 | 278 | |
| 279 | - if($this->_clientSide!==null) |
|
| 280 | - $options = array_merge($options,$this->_clientSide->getOptions()->toArray()); |
|
| 279 | + if ($this->_clientSide !== null) |
|
| 280 | + $options = array_merge($options, $this->_clientSide->getOptions()->toArray()); |
|
| 281 | 281 | |
| 282 | 282 | return $options; |
| 283 | 283 | } |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | */ |
| 289 | 289 | public function getClientSide() |
| 290 | 290 | { |
| 291 | - if($this->_clientSide===null) |
|
| 291 | + if ($this->_clientSide === null) |
|
| 292 | 292 | $this->_clientSide = $this->createClientScript(); |
| 293 | 293 | return $this->_clientSide; |
| 294 | 294 | } |
@@ -308,11 +308,11 @@ discard block |
||
| 308 | 308 | */ |
| 309 | 309 | protected function getErrorMessages() |
| 310 | 310 | { |
| 311 | - $validators=$this->getPage()->getValidators($this->getValidationGroup()); |
|
| 311 | + $validators = $this->getPage()->getValidators($this->getValidationGroup()); |
|
| 312 | 312 | $messages = array(); |
| 313 | - foreach($validators as $validator) |
|
| 313 | + foreach ($validators as $validator) |
|
| 314 | 314 | { |
| 315 | - if(!$validator->getIsValid() && ($msg=$validator->getErrorMessage())!=='') |
|
| 315 | + if (!$validator->getIsValid() && ($msg = $validator->getErrorMessage()) !== '') |
|
| 316 | 316 | //$messages[] = $validator->getAnchoredMessage($msg); |
| 317 | 317 | $messages[] = $msg; |
| 318 | 318 | } |
@@ -341,10 +341,10 @@ discard block |
||
| 341 | 341 | public function renderContents($writer) |
| 342 | 342 | { |
| 343 | 343 | $this->renderJsSummary(); |
| 344 | - if($this->getShowSummary()) |
|
| 344 | + if ($this->getShowSummary()) |
|
| 345 | 345 | { |
| 346 | 346 | // $this->setStyle('display:block'); |
| 347 | - switch($this->getDisplayMode()) |
|
| 347 | + switch ($this->getDisplayMode()) |
|
| 348 | 348 | { |
| 349 | 349 | case TValidationSummaryDisplayMode::SimpleList: |
| 350 | 350 | $this->renderList($writer); |
@@ -370,13 +370,13 @@ discard block |
||
| 370 | 370 | */ |
| 371 | 371 | protected function renderList($writer) |
| 372 | 372 | { |
| 373 | - $header=$this->getHeaderText(); |
|
| 374 | - $messages=$this->getErrorMessages(); |
|
| 373 | + $header = $this->getHeaderText(); |
|
| 374 | + $messages = $this->getErrorMessages(); |
|
| 375 | 375 | $content = ''; |
| 376 | - if(strlen($header)) |
|
| 377 | - $content.= $header."<br/>\n"; |
|
| 378 | - foreach($messages as $message) |
|
| 379 | - $content.="$message<br/>\n"; |
|
| 376 | + if (strlen($header)) |
|
| 377 | + $content .= $header . "<br/>\n"; |
|
| 378 | + foreach ($messages as $message) |
|
| 379 | + $content .= "$message<br/>\n"; |
|
| 380 | 380 | $writer->write($content); |
| 381 | 381 | } |
| 382 | 382 | |
@@ -388,11 +388,11 @@ discard block |
||
| 388 | 388 | */ |
| 389 | 389 | protected function renderSingleParagraph($writer) |
| 390 | 390 | { |
| 391 | - $header=$this->getHeaderText(); |
|
| 392 | - $messages=$this->getErrorMessages(); |
|
| 391 | + $header = $this->getHeaderText(); |
|
| 392 | + $messages = $this->getErrorMessages(); |
|
| 393 | 393 | $content = $header; |
| 394 | - foreach($messages as $message) |
|
| 395 | - $content.= ' '.$message; |
|
| 394 | + foreach ($messages as $message) |
|
| 395 | + $content .= ' ' . $message; |
|
| 396 | 396 | $writer->write($content); |
| 397 | 397 | } |
| 398 | 398 | |
@@ -404,14 +404,14 @@ discard block |
||
| 404 | 404 | */ |
| 405 | 405 | protected function renderBulletList($writer) |
| 406 | 406 | { |
| 407 | - $header=$this->getHeaderText(); |
|
| 408 | - $messages=$this->getErrorMessages(); |
|
| 407 | + $header = $this->getHeaderText(); |
|
| 408 | + $messages = $this->getErrorMessages(); |
|
| 409 | 409 | $content = $header; |
| 410 | - if(count($messages)>0) |
|
| 410 | + if (count($messages) > 0) |
|
| 411 | 411 | { |
| 412 | 412 | $content .= "<ul>\n"; |
| 413 | - foreach($messages as $message) |
|
| 414 | - $content.= '<li>'.$message."</li>\n"; |
|
| 413 | + foreach ($messages as $message) |
|
| 414 | + $content .= '<li>' . $message . "</li>\n"; |
|
| 415 | 415 | $content .= "</ul>\n"; |
| 416 | 416 | } |
| 417 | 417 | $writer->write($content); |
@@ -517,10 +517,10 @@ discard block |
||
| 517 | 517 | */ |
| 518 | 518 | class TValidationSummaryDisplayMode extends TEnumerable |
| 519 | 519 | { |
| 520 | - const SimpleList='SimpleList'; |
|
| 521 | - const SingleParagraph='SingleParagraph'; |
|
| 522 | - const BulletList='BulletList'; |
|
| 523 | - const HeaderOnly='HeaderOnly'; |
|
| 520 | + const SimpleList = 'SimpleList'; |
|
| 521 | + const SingleParagraph = 'SingleParagraph'; |
|
| 522 | + const BulletList = 'BulletList'; |
|
| 523 | + const HeaderOnly = 'HeaderOnly'; |
|
| 524 | 524 | } |
| 525 | 525 | |
| 526 | 526 | |
@@ -540,8 +540,8 @@ discard block |
||
| 540 | 540 | */ |
| 541 | 541 | class TValidationSummaryDisplayStyle extends TEnumerable |
| 542 | 542 | { |
| 543 | - const None='None'; |
|
| 544 | - const Dynamic='Dynamic'; |
|
| 545 | - const Fixed='Fixed'; |
|
| 543 | + const None = 'None'; |
|
| 544 | + const Dynamic = 'Dynamic'; |
|
| 545 | + const Fixed = 'Fixed'; |
|
| 546 | 546 | } |
| 547 | 547 | |