Passed
Branch php-cs-fixer (b9836a)
by Fabio
15:58
created
framework/Web/UI/WebControls/TCheckBox.php 2 patches
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	public function loadPostData($key, $values)
67 67
 	{
68 68
 		$checked = $this->getChecked();
69
-		if($newChecked = isset($values[$key]))
69
+		if ($newChecked = isset($values[$key]))
70 70
 			$this->setValue($values[$key]);
71 71
 		$this->setChecked($newChecked);
72 72
 		return $this->_dataChanged = ($newChecked !== $checked);
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public function raisePostDataChangedEvent()
81 81
 	{
82
-		if($this->getAutoPostBack() && $this->getCausesValidation())
82
+		if ($this->getAutoPostBack() && $this->getCausesValidation())
83 83
 			$this->getPage()->validate($this->getValidationGroup());
84 84
 		$this->onCheckedChanged(null);
85 85
 	}
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	public function onPreRender($param)
107 107
 	{
108 108
 		parent::onPreRender($param);
109
-		if($this->getEnabled(true))
109
+		if ($this->getEnabled(true))
110 110
 			$this->getPage()->registerRequiresPostData($this);
111 111
 	}
112 112
 
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 	 */
302 302
 	public function getSurroundingTagID()
303 303
 	{
304
-	return $this->getSpanNeeded() ? $this->getClientID() . '_parent' : $this->getClientID();
304
+	return $this->getSpanNeeded() ? $this->getClientID().'_parent' : $this->getClientID();
305 305
 	}
306 306
 
307 307
 	/**
@@ -313,33 +313,33 @@  discard block
 block discarded – undo
313 313
 	public function render($writer)
314 314
 	{
315 315
 		$this->getPage()->ensureRenderInForm($this);
316
-		if($this->getHasStyle())
316
+		if ($this->getHasStyle())
317 317
 			$this->getStyle()->addAttributesToRender($writer);
318
-		if(($tooltip = $this->getToolTip()) !== '')
318
+		if (($tooltip = $this->getToolTip()) !== '')
319 319
 			$writer->addAttribute('title', $tooltip);
320
-		if($this->getHasAttributes())
320
+		if ($this->getHasAttributes())
321 321
 		{
322 322
 			$attributes = $this->getAttributes();
323 323
 			$value = $attributes->remove('value');
324 324
 			// onclick js should only be added to input tag
325
-			if(($onclick = $attributes->remove('onclick')) === null)
325
+			if (($onclick = $attributes->remove('onclick')) === null)
326 326
 				$onclick = '';
327
-			if($attributes->getCount())
327
+			if ($attributes->getCount())
328 328
 				$writer->addAttributes($attributes);
329
-			if($value !== null)
329
+			if ($value !== null)
330 330
 				$attributes->add('value', $value);
331 331
 		}
332 332
 		else
333 333
 			$onclick = '';
334
-	if($needspan = $this->getSpanNeeded())
334
+	if ($needspan = $this->getSpanNeeded())
335 335
 	{
336 336
 	  $writer->addAttribute('id', $this->getSurroundingTagID());
337 337
 	  $writer->renderBeginTag($this->getSurroundingTag());
338 338
 	}
339 339
 		$clientID = $this->getClientID();
340
-		if(($text = $this->getText()) !== '')
340
+		if (($text = $this->getText()) !== '')
341 341
 		{
342
-			if($this->getTextAlign() === TTextAlign::Left)
342
+			if ($this->getTextAlign() === TTextAlign::Left)
343 343
 			{
344 344
 				$this->renderLabel($writer, $clientID, $text);
345 345
 				$this->renderInputTag($writer, $clientID, $onclick);
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 		}
353 353
 		else
354 354
 			$this->renderInputTag($writer, $clientID, $onclick);
355
-		if($needspan)
355
+		if ($needspan)
356 356
 			$writer->renderEndTag();
357 357
 	}
358 358
 
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 	 */
362 362
 	public function getLabelAttributes()
363 363
 	{
364
-		if($attributes = $this->getViewState('LabelAttributes', null))
364
+		if ($attributes = $this->getViewState('LabelAttributes', null))
365 365
 			return $attributes;
366 366
 		else
367 367
 		{
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 	 */
377 377
 	public function getInputAttributes()
378 378
 	{
379
-		if($attributes = $this->getViewState('InputAttributes', null))
379
+		if ($attributes = $this->getViewState('InputAttributes', null))
380 380
 			return $attributes;
381 381
 		else
382 382
 		{
@@ -391,14 +391,14 @@  discard block
 block discarded – undo
391 391
 	 */
392 392
 	protected function getValueAttribute()
393 393
 	{
394
-		if(($value = $this->getValue()) !== '')
394
+		if (($value = $this->getValue()) !== '')
395 395
 			return $value;
396 396
 		else
397 397
 		{
398 398
 			$attributes = $this->getViewState('InputAttributes', null);
399
-			if($attributes && $attributes->contains('value'))
399
+			if ($attributes && $attributes->contains('value'))
400 400
 				return $attributes->itemAt('value');
401
-			elseif($this->hasAttribute('value'))
401
+			elseif ($this->hasAttribute('value'))
402 402
 				return $this->getAttribute('value');
403 403
 			else
404 404
 				return '';
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 	protected function renderLabel($writer, $clientID, $text)
441 441
 	{
442 442
 		$writer->addAttribute('for', $clientID);
443
-		if($attributes = $this->getViewState('LabelAttributes', null))
443
+		if ($attributes = $this->getViewState('LabelAttributes', null))
444 444
 			$writer->addAttributes($attributes);
445 445
 		$writer->renderBeginTag('label');
446 446
 		$writer->write($text);
@@ -455,22 +455,22 @@  discard block
 block discarded – undo
455 455
 	 */
456 456
 	protected function renderInputTag($writer, $clientID, $onclick)
457 457
 	{
458
-		if($clientID !== '')
458
+		if ($clientID !== '')
459 459
 			$writer->addAttribute('id', $clientID);
460 460
 		$writer->addAttribute('type', 'checkbox');
461
-		if(($value = $this->getValueAttribute()) !== '')
461
+		if (($value = $this->getValueAttribute()) !== '')
462 462
 			$writer->addAttribute('value', $value);
463
-		if(!empty($onclick))
463
+		if (!empty($onclick))
464 464
 			$writer->addAttribute('onclick', $onclick);
465
-		if(($uniqueID = $this->getUniqueID()) !== '')
465
+		if (($uniqueID = $this->getUniqueID()) !== '')
466 466
 			$writer->addAttribute('name', $uniqueID);
467
-		if($this->getChecked())
467
+		if ($this->getChecked())
468 468
 			$writer->addAttribute('checked', 'checked');
469
-		if(!$this->getEnabled(true))
469
+		if (!$this->getEnabled(true))
470 470
 			$writer->addAttribute('disabled', 'disabled');
471 471
 
472 472
 		$page = $this->getPage();
473
-		if($this->getEnabled(true)
473
+		if ($this->getEnabled(true)
474 474
 			&& $this->getEnableClientScript()
475 475
 			&& $this->getAutoPostBack()
476 476
 			&& $page->getClientSupportsJavaScript())
@@ -478,11 +478,11 @@  discard block
 block discarded – undo
478 478
 			$this->renderClientControlScript($writer);
479 479
 		}
480 480
 
481
-		if(($accesskey = $this->getAccessKey()) !== '')
481
+		if (($accesskey = $this->getAccessKey()) !== '')
482 482
 			$writer->addAttribute('accesskey', $accesskey);
483
-		if(($tabindex = $this->getTabIndex()) > 0)
483
+		if (($tabindex = $this->getTabIndex()) > 0)
484 484
 			$writer->addAttribute('tabindex', "$tabindex");
485
-		if($attributes = $this->getViewState('InputAttributes', null))
485
+		if ($attributes = $this->getViewState('InputAttributes', null))
486 486
 			$writer->addAttributes($attributes);
487 487
 		$writer->renderBeginTag('input');
488 488
 		$writer->renderEndTag();
Please login to merge, or discard this patch.
Braces   +78 added lines, -59 removed lines patch added patch discarded remove patch
@@ -66,8 +66,9 @@  discard block
 block discarded – undo
66 66
 	public function loadPostData($key, $values)
67 67
 	{
68 68
 		$checked = $this->getChecked();
69
-		if($newChecked = isset($values[$key]))
70
-			$this->setValue($values[$key]);
69
+		if($newChecked = isset($values[$key])) {
70
+					$this->setValue($values[$key]);
71
+		}
71 72
 		$this->setChecked($newChecked);
72 73
 		return $this->_dataChanged = ($newChecked !== $checked);
73 74
 	}
@@ -79,8 +80,9 @@  discard block
 block discarded – undo
79 80
 	 */
80 81
 	public function raisePostDataChangedEvent()
81 82
 	{
82
-		if($this->getAutoPostBack() && $this->getCausesValidation())
83
-			$this->getPage()->validate($this->getValidationGroup());
83
+		if($this->getAutoPostBack() && $this->getCausesValidation()) {
84
+					$this->getPage()->validate($this->getValidationGroup());
85
+		}
84 86
 		$this->onCheckedChanged(null);
85 87
 	}
86 88
 
@@ -106,8 +108,9 @@  discard block
 block discarded – undo
106 108
 	public function onPreRender($param)
107 109
 	{
108 110
 		parent::onPreRender($param);
109
-		if($this->getEnabled(true))
110
-			$this->getPage()->registerRequiresPostData($this);
111
+		if($this->getEnabled(true)) {
112
+					$this->getPage()->registerRequiresPostData($this);
113
+		}
111 114
 	}
112 115
 
113 116
 	/**
@@ -313,24 +316,29 @@  discard block
 block discarded – undo
313 316
 	public function render($writer)
314 317
 	{
315 318
 		$this->getPage()->ensureRenderInForm($this);
316
-		if($this->getHasStyle())
317
-			$this->getStyle()->addAttributesToRender($writer);
318
-		if(($tooltip = $this->getToolTip()) !== '')
319
-			$writer->addAttribute('title', $tooltip);
319
+		if($this->getHasStyle()) {
320
+					$this->getStyle()->addAttributesToRender($writer);
321
+		}
322
+		if(($tooltip = $this->getToolTip()) !== '') {
323
+					$writer->addAttribute('title', $tooltip);
324
+		}
320 325
 		if($this->getHasAttributes())
321 326
 		{
322 327
 			$attributes = $this->getAttributes();
323 328
 			$value = $attributes->remove('value');
324 329
 			// onclick js should only be added to input tag
325
-			if(($onclick = $attributes->remove('onclick')) === null)
326
-				$onclick = '';
327
-			if($attributes->getCount())
328
-				$writer->addAttributes($attributes);
329
-			if($value !== null)
330
-				$attributes->add('value', $value);
330
+			if(($onclick = $attributes->remove('onclick')) === null) {
331
+							$onclick = '';
332
+			}
333
+			if($attributes->getCount()) {
334
+							$writer->addAttributes($attributes);
335
+			}
336
+			if($value !== null) {
337
+							$attributes->add('value', $value);
338
+			}
339
+		} else {
340
+					$onclick = '';
331 341
 		}
332
-		else
333
-			$onclick = '';
334 342
 	if($needspan = $this->getSpanNeeded())
335 343
 	{
336 344
 	  $writer->addAttribute('id', $this->getSurroundingTagID());
@@ -343,17 +351,17 @@  discard block
 block discarded – undo
343 351
 			{
344 352
 				$this->renderLabel($writer, $clientID, $text);
345 353
 				$this->renderInputTag($writer, $clientID, $onclick);
346
-			}
347
-			else
354
+			} else
348 355
 			{
349 356
 				$this->renderInputTag($writer, $clientID, $onclick);
350 357
 				$this->renderLabel($writer, $clientID, $text);
351 358
 			}
359
+		} else {
360
+					$this->renderInputTag($writer, $clientID, $onclick);
361
+		}
362
+		if($needspan) {
363
+					$writer->renderEndTag();
352 364
 		}
353
-		else
354
-			$this->renderInputTag($writer, $clientID, $onclick);
355
-		if($needspan)
356
-			$writer->renderEndTag();
357 365
 	}
358 366
 
359 367
 	/**
@@ -361,9 +369,9 @@  discard block
 block discarded – undo
361 369
 	 */
362 370
 	public function getLabelAttributes()
363 371
 	{
364
-		if($attributes = $this->getViewState('LabelAttributes', null))
365
-			return $attributes;
366
-		else
372
+		if($attributes = $this->getViewState('LabelAttributes', null)) {
373
+					return $attributes;
374
+		} else
367 375
 		{
368 376
 			$attributes = new TAttributeCollection;
369 377
 			$this->setViewState('LabelAttributes', $attributes, null);
@@ -376,9 +384,9 @@  discard block
 block discarded – undo
376 384
 	 */
377 385
 	public function getInputAttributes()
378 386
 	{
379
-		if($attributes = $this->getViewState('InputAttributes', null))
380
-			return $attributes;
381
-		else
387
+		if($attributes = $this->getViewState('InputAttributes', null)) {
388
+					return $attributes;
389
+		} else
382 390
 		{
383 391
 			$attributes = new TAttributeCollection;
384 392
 			$this->setViewState('InputAttributes', $attributes, null);
@@ -391,17 +399,18 @@  discard block
 block discarded – undo
391 399
 	 */
392 400
 	protected function getValueAttribute()
393 401
 	{
394
-		if(($value = $this->getValue()) !== '')
395
-			return $value;
396
-		else
402
+		if(($value = $this->getValue()) !== '') {
403
+					return $value;
404
+		} else
397 405
 		{
398 406
 			$attributes = $this->getViewState('InputAttributes', null);
399
-			if($attributes && $attributes->contains('value'))
400
-				return $attributes->itemAt('value');
401
-			elseif($this->hasAttribute('value'))
402
-				return $this->getAttribute('value');
403
-			else
404
-				return '';
407
+			if($attributes && $attributes->contains('value')) {
408
+							return $attributes->itemAt('value');
409
+			} elseif($this->hasAttribute('value')) {
410
+							return $this->getAttribute('value');
411
+			} else {
412
+							return '';
413
+			}
405 414
 		}
406 415
 	}
407 416
 
@@ -440,8 +449,9 @@  discard block
 block discarded – undo
440 449
 	protected function renderLabel($writer, $clientID, $text)
441 450
 	{
442 451
 		$writer->addAttribute('for', $clientID);
443
-		if($attributes = $this->getViewState('LabelAttributes', null))
444
-			$writer->addAttributes($attributes);
452
+		if($attributes = $this->getViewState('LabelAttributes', null)) {
453
+					$writer->addAttributes($attributes);
454
+		}
445 455
 		$writer->renderBeginTag('label');
446 456
 		$writer->write($text);
447 457
 		$writer->renderEndTag();
@@ -455,19 +465,25 @@  discard block
 block discarded – undo
455 465
 	 */
456 466
 	protected function renderInputTag($writer, $clientID, $onclick)
457 467
 	{
458
-		if($clientID !== '')
459
-			$writer->addAttribute('id', $clientID);
468
+		if($clientID !== '') {
469
+					$writer->addAttribute('id', $clientID);
470
+		}
460 471
 		$writer->addAttribute('type', 'checkbox');
461
-		if(($value = $this->getValueAttribute()) !== '')
462
-			$writer->addAttribute('value', $value);
463
-		if(!empty($onclick))
464
-			$writer->addAttribute('onclick', $onclick);
465
-		if(($uniqueID = $this->getUniqueID()) !== '')
466
-			$writer->addAttribute('name', $uniqueID);
467
-		if($this->getChecked())
468
-			$writer->addAttribute('checked', 'checked');
469
-		if(!$this->getEnabled(true))
470
-			$writer->addAttribute('disabled', 'disabled');
472
+		if(($value = $this->getValueAttribute()) !== '') {
473
+					$writer->addAttribute('value', $value);
474
+		}
475
+		if(!empty($onclick)) {
476
+					$writer->addAttribute('onclick', $onclick);
477
+		}
478
+		if(($uniqueID = $this->getUniqueID()) !== '') {
479
+					$writer->addAttribute('name', $uniqueID);
480
+		}
481
+		if($this->getChecked()) {
482
+					$writer->addAttribute('checked', 'checked');
483
+		}
484
+		if(!$this->getEnabled(true)) {
485
+					$writer->addAttribute('disabled', 'disabled');
486
+		}
471 487
 
472 488
 		$page = $this->getPage();
473 489
 		if($this->getEnabled(true)
@@ -478,12 +494,15 @@  discard block
 block discarded – undo
478 494
 			$this->renderClientControlScript($writer);
479 495
 		}
480 496
 
481
-		if(($accesskey = $this->getAccessKey()) !== '')
482
-			$writer->addAttribute('accesskey', $accesskey);
483
-		if(($tabindex = $this->getTabIndex()) > 0)
484
-			$writer->addAttribute('tabindex', "$tabindex");
485
-		if($attributes = $this->getViewState('InputAttributes', null))
486
-			$writer->addAttributes($attributes);
497
+		if(($accesskey = $this->getAccessKey()) !== '') {
498
+					$writer->addAttribute('accesskey', $accesskey);
499
+		}
500
+		if(($tabindex = $this->getTabIndex()) > 0) {
501
+					$writer->addAttribute('tabindex', "$tabindex");
502
+		}
503
+		if($attributes = $this->getViewState('InputAttributes', null)) {
504
+					$writer->addAttributes($attributes);
505
+		}
487 506
 		$writer->renderBeginTag('input');
488 507
 		$writer->renderEndTag();
489 508
 	}
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TValidationSummary.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -221,9 +221,9 @@  discard block
 block discarded – undo
221 221
 	{
222 222
 		$display = $this->getDisplay();
223 223
 		$visible = $this->getEnabled(true) && count($this->getErrorMessages()) > 0;
224
-		if(!$visible)
224
+		if (!$visible)
225 225
 		{
226
-			if($display === TValidationSummaryDisplayStyle::None || $display === TValidationSummaryDisplayStyle::Dynamic)
226
+			if ($display === TValidationSummaryDisplayStyle::None || $display === TValidationSummaryDisplayStyle::Dynamic)
227 227
 				$writer->addStyleAttribute('display', 'none');
228 228
 			else
229 229
 				$writer->addStyleAttribute('visibility', 'hidden');
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	 */
239 239
 	protected function renderJsSummary()
240 240
 	{
241
-		if(!$this->getEnabled(true) || !$this->getEnableClientScript())
241
+		if (!$this->getEnabled(true) || !$this->getEnableClientScript())
242 242
 			return;
243 243
 		$cs = $this->getPage()->getClientScript();
244 244
 		$cs->registerPradoScript('validator');
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 		//need to register the validation manager is validation summary is alone.
247 247
 		$formID = $this->getPage()->getForm()->getClientID();
248 248
 		$scriptKey = "TBaseValidator:$formID";
249
-		if($this->getEnableClientScript() && !$cs->isEndScriptRegistered($scriptKey))
249
+		if ($this->getEnableClientScript() && !$cs->isEndScriptRegistered($scriptKey))
250 250
 		{
251 251
 			$manager['FormID'] = $formID;
252 252
 			$options = TJavaScript::encode($manager);
@@ -268,9 +268,9 @@  discard block
 block discarded – undo
268 268
 	{
269 269
 		$options['ID'] = $this->getClientID();
270 270
 		$options['FormID'] = $this->getPage()->getForm()->getClientID();
271
-		if($this->getShowMessageBox())
271
+		if ($this->getShowMessageBox())
272 272
 			$options['ShowMessageBox'] = true;
273
-		if(!$this->getShowSummary())
273
+		if (!$this->getShowSummary())
274 274
 			$options['ShowSummary'] = false;
275 275
 
276 276
 		$options['ScrollToSummary'] = $this->getScrollToSummary();
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 		$options['ValidationGroup'] = $this->getValidationGroup();
282 282
 		$options['Display'] = $this->getDisplay();
283 283
 
284
-		if($this->_clientSide !== null)
284
+		if ($this->_clientSide !== null)
285 285
 			$options = array_merge($options, $this->_clientSide->getOptions()->toArray());
286 286
 
287 287
 		return $options;
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 	 */
294 294
 	public function getClientSide()
295 295
 	{
296
-		if($this->_clientSide === null)
296
+		if ($this->_clientSide === null)
297 297
 			$this->_clientSide = $this->createClientScript();
298 298
 		return $this->_clientSide;
299 299
 	}
@@ -314,9 +314,9 @@  discard block
 block discarded – undo
314 314
 	{
315 315
 		$validators = $this->getPage()->getValidators($this->getValidationGroup());
316 316
 		$messages = [];
317
-		foreach($validators as $validator)
317
+		foreach ($validators as $validator)
318 318
 		{
319
-			if(!$validator->getIsValid() && ($msg = $validator->getErrorMessage()) !== '')
319
+			if (!$validator->getIsValid() && ($msg = $validator->getErrorMessage()) !== '')
320 320
 				//$messages[] = $validator->getAnchoredMessage($msg);
321 321
 				$messages[] = $msg;
322 322
 		}
@@ -330,10 +330,10 @@  discard block
 block discarded – undo
330 330
 	public function renderContents($writer)
331 331
 	{
332 332
 		$this->renderJsSummary();
333
-		if($this->getShowSummary())
333
+		if ($this->getShowSummary())
334 334
 		{
335 335
 //		    $this->setStyle('display:block');
336
-			switch($this->getDisplayMode())
336
+			switch ($this->getDisplayMode())
337 337
 			{
338 338
 				case TValidationSummaryDisplayMode::SimpleList:
339 339
 					$this->renderList($writer);
@@ -362,9 +362,9 @@  discard block
 block discarded – undo
362 362
 		$header = $this->getHeaderText();
363 363
 		$messages = $this->getErrorMessages();
364 364
 		$content = '';
365
-		if(strlen($header))
366
-			$content .= $header . "<br/>\n";
367
-		foreach($messages as $message)
365
+		if (strlen($header))
366
+			$content .= $header."<br/>\n";
367
+		foreach ($messages as $message)
368 368
 			$content .= "$message<br/>\n";
369 369
 		$writer->write($content);
370 370
 	}
@@ -380,8 +380,8 @@  discard block
 block discarded – undo
380 380
 		$header = $this->getHeaderText();
381 381
 		$messages = $this->getErrorMessages();
382 382
 		$content = $header;
383
-		foreach($messages as $message)
384
-			$content .= ' ' . $message;
383
+		foreach ($messages as $message)
384
+			$content .= ' '.$message;
385 385
 		$writer->write($content);
386 386
 	}
387 387
 
@@ -396,11 +396,11 @@  discard block
 block discarded – undo
396 396
 		$header = $this->getHeaderText();
397 397
 		$messages = $this->getErrorMessages();
398 398
 		$content = $header;
399
-		if(count($messages) > 0)
399
+		if (count($messages) > 0)
400 400
 		{
401 401
 			$content .= "<ul>\n";
402
-			foreach($messages as $message)
403
-				$content .= '<li>' . $message . "</li>\n";
402
+			foreach ($messages as $message)
403
+				$content .= '<li>'.$message."</li>\n";
404 404
 			$content .= "</ul>\n";
405 405
 		}
406 406
 		$writer->write($content);
Please login to merge, or discard this patch.
Braces   +35 added lines, -24 removed lines patch added patch discarded remove patch
@@ -223,10 +223,11 @@  discard block
 block discarded – undo
223 223
 		$visible = $this->getEnabled(true) && count($this->getErrorMessages()) > 0;
224 224
 		if(!$visible)
225 225
 		{
226
-			if($display === TValidationSummaryDisplayStyle::None || $display === TValidationSummaryDisplayStyle::Dynamic)
227
-				$writer->addStyleAttribute('display', 'none');
228
-			else
229
-				$writer->addStyleAttribute('visibility', 'hidden');
226
+			if($display === TValidationSummaryDisplayStyle::None || $display === TValidationSummaryDisplayStyle::Dynamic) {
227
+							$writer->addStyleAttribute('display', 'none');
228
+			} else {
229
+							$writer->addStyleAttribute('visibility', 'hidden');
230
+			}
230 231
 		}
231 232
 		$writer->addAttribute('id', $this->getClientID());
232 233
 		parent::addAttributesToRender($writer);
@@ -238,8 +239,9 @@  discard block
 block discarded – undo
238 239
 	 */
239 240
 	protected function renderJsSummary()
240 241
 	{
241
-		if(!$this->getEnabled(true) || !$this->getEnableClientScript())
242
-			return;
242
+		if(!$this->getEnabled(true) || !$this->getEnableClientScript()) {
243
+					return;
244
+		}
243 245
 		$cs = $this->getPage()->getClientScript();
244 246
 		$cs->registerPradoScript('validator');
245 247
 
@@ -268,10 +270,12 @@  discard block
 block discarded – undo
268 270
 	{
269 271
 		$options['ID'] = $this->getClientID();
270 272
 		$options['FormID'] = $this->getPage()->getForm()->getClientID();
271
-		if($this->getShowMessageBox())
272
-			$options['ShowMessageBox'] = true;
273
-		if(!$this->getShowSummary())
274
-			$options['ShowSummary'] = false;
273
+		if($this->getShowMessageBox()) {
274
+					$options['ShowMessageBox'] = true;
275
+		}
276
+		if(!$this->getShowSummary()) {
277
+					$options['ShowSummary'] = false;
278
+		}
275 279
 
276 280
 		$options['ScrollToSummary'] = $this->getScrollToSummary();
277 281
 		$options['HeaderText'] = $this->getHeaderText();
@@ -281,8 +285,9 @@  discard block
 block discarded – undo
281 285
 		$options['ValidationGroup'] = $this->getValidationGroup();
282 286
 		$options['Display'] = $this->getDisplay();
283 287
 
284
-		if($this->_clientSide !== null)
285
-			$options = array_merge($options, $this->_clientSide->getOptions()->toArray());
288
+		if($this->_clientSide !== null) {
289
+					$options = array_merge($options, $this->_clientSide->getOptions()->toArray());
290
+		}
286 291
 
287 292
 		return $options;
288 293
 	}
@@ -293,8 +298,9 @@  discard block
 block discarded – undo
293 298
 	 */
294 299
 	public function getClientSide()
295 300
 	{
296
-		if($this->_clientSide === null)
297
-			$this->_clientSide = $this->createClientScript();
301
+		if($this->_clientSide === null) {
302
+					$this->_clientSide = $this->createClientScript();
303
+		}
298 304
 		return $this->_clientSide;
299 305
 	}
300 306
 
@@ -316,9 +322,10 @@  discard block
 block discarded – undo
316 322
 		$messages = [];
317 323
 		foreach($validators as $validator)
318 324
 		{
319
-			if(!$validator->getIsValid() && ($msg = $validator->getErrorMessage()) !== '')
320
-				//$messages[] = $validator->getAnchoredMessage($msg);
325
+			if(!$validator->getIsValid() && ($msg = $validator->getErrorMessage()) !== '') {
326
+							//$messages[] = $validator->getAnchoredMessage($msg);
321 327
 				$messages[] = $msg;
328
+			}
322 329
 		}
323 330
 		return $messages;
324 331
 	}
@@ -362,10 +369,12 @@  discard block
 block discarded – undo
362 369
 		$header = $this->getHeaderText();
363 370
 		$messages = $this->getErrorMessages();
364 371
 		$content = '';
365
-		if(strlen($header))
366
-			$content .= $header . "<br/>\n";
367
-		foreach($messages as $message)
368
-			$content .= "$message<br/>\n";
372
+		if(strlen($header)) {
373
+					$content .= $header . "<br/>\n";
374
+		}
375
+		foreach($messages as $message) {
376
+					$content .= "$message<br/>\n";
377
+		}
369 378
 		$writer->write($content);
370 379
 	}
371 380
 
@@ -380,8 +389,9 @@  discard block
 block discarded – undo
380 389
 		$header = $this->getHeaderText();
381 390
 		$messages = $this->getErrorMessages();
382 391
 		$content = $header;
383
-		foreach($messages as $message)
384
-			$content .= ' ' . $message;
392
+		foreach($messages as $message) {
393
+					$content .= ' ' . $message;
394
+		}
385 395
 		$writer->write($content);
386 396
 	}
387 397
 
@@ -399,8 +409,9 @@  discard block
 block discarded – undo
399 409
 		if(count($messages) > 0)
400 410
 		{
401 411
 			$content .= "<ul>\n";
402
-			foreach($messages as $message)
403
-				$content .= '<li>' . $message . "</li>\n";
412
+			foreach($messages as $message) {
413
+							$content .= '<li>' . $message . "</li>\n";
414
+			}
404 415
 			$content .= "</ul>\n";
405 416
 		}
406 417
 		$writer->write($content);
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TCheckBoxColumn.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -81,16 +81,16 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	public function initializeCell($cell, $columnIndex, $itemType)
83 83
 	{
84
-		if($itemType === TListItemType::Item || $itemType === TListItemType::AlternatingItem || $itemType === TListItemType::SelectedItem || $itemType === TListItemType::EditItem)
84
+		if ($itemType === TListItemType::Item || $itemType === TListItemType::AlternatingItem || $itemType === TListItemType::SelectedItem || $itemType === TListItemType::EditItem)
85 85
 		{
86 86
 			$checkBox = new TCheckBox;
87
-			if($this->getReadOnly() || $itemType !== TListItemType::EditItem)
87
+			if ($this->getReadOnly() || $itemType !== TListItemType::EditItem)
88 88
 				$checkBox->setEnabled(false);
89 89
 			$cell->setHorizontalAlign('Center');
90 90
 			$cell->getControls()->add($checkBox);
91 91
 			$cell->registerObject('CheckBox', $checkBox);
92
-			if($this->getDataField() !== '')
93
-				$checkBox->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']);
92
+			if ($this->getDataField() !== '')
93
+				$checkBox->attachEventHandler('OnDataBinding', [$this, 'dataBindColumn']);
94 94
 		}
95 95
 		else
96 96
 			parent::initializeCell($cell, $columnIndex, $itemType);
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
 	{
106 106
 		$item = $sender->getNamingContainer();
107 107
 		$data = $item->getData();
108
-		if(($field = $this->getDataField()) !== '')
108
+		if (($field = $this->getDataField()) !== '')
109 109
 			$value = TPropertyValue::ensureBoolean($this->getDataFieldValue($data, $field));
110 110
 		else
111 111
 			$value = TPropertyValue::ensureBoolean($data);
112
-		if($sender instanceof TCheckBox)
112
+		if ($sender instanceof TCheckBox)
113 113
 			$sender->setChecked($value);
114 114
 	}
115 115
 }
Please login to merge, or discard this patch.
Braces   +16 added lines, -12 removed lines patch added patch discarded remove patch
@@ -84,16 +84,18 @@  discard block
 block discarded – undo
84 84
 		if($itemType === TListItemType::Item || $itemType === TListItemType::AlternatingItem || $itemType === TListItemType::SelectedItem || $itemType === TListItemType::EditItem)
85 85
 		{
86 86
 			$checkBox = new TCheckBox;
87
-			if($this->getReadOnly() || $itemType !== TListItemType::EditItem)
88
-				$checkBox->setEnabled(false);
87
+			if($this->getReadOnly() || $itemType !== TListItemType::EditItem) {
88
+							$checkBox->setEnabled(false);
89
+			}
89 90
 			$cell->setHorizontalAlign('Center');
90 91
 			$cell->getControls()->add($checkBox);
91 92
 			$cell->registerObject('CheckBox', $checkBox);
92
-			if($this->getDataField() !== '')
93
-				$checkBox->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']);
93
+			if($this->getDataField() !== '') {
94
+							$checkBox->attachEventHandler('OnDataBinding', [$this,'dataBindColumn']);
95
+			}
96
+		} else {
97
+					parent::initializeCell($cell, $columnIndex, $itemType);
94 98
 		}
95
-		else
96
-			parent::initializeCell($cell, $columnIndex, $itemType);
97 99
 	}
98 100
 
99 101
 	/**
@@ -105,12 +107,14 @@  discard block
 block discarded – undo
105 107
 	{
106 108
 		$item = $sender->getNamingContainer();
107 109
 		$data = $item->getData();
108
-		if(($field = $this->getDataField()) !== '')
109
-			$value = TPropertyValue::ensureBoolean($this->getDataFieldValue($data, $field));
110
-		else
111
-			$value = TPropertyValue::ensureBoolean($data);
112
-		if($sender instanceof TCheckBox)
113
-			$sender->setChecked($value);
110
+		if(($field = $this->getDataField()) !== '') {
111
+					$value = TPropertyValue::ensureBoolean($this->getDataFieldValue($data, $field));
112
+		} else {
113
+					$value = TPropertyValue::ensureBoolean($data);
114
+		}
115
+		if($sender instanceof TCheckBox) {
116
+					$sender->setChecked($value);
117
+		}
114 118
 	}
115 119
 }
116 120
 
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TRatingList.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	public function setRepeatLayout($value)
97 97
 	{
98
-		if($value !== TRepeatLayout::Table)
98
+		if ($value !== TRepeatLayout::Table)
99 99
 			throw new TInvalidDataValueException('ratinglist_table_layout_only');
100 100
 		else
101 101
 			parent::setRepeatLayout($value);
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
 
172 172
 	protected function getCaptionControl()
173 173
 	{
174
-		if(($id = $this->getCaptionID()) !== '')
174
+		if (($id = $this->getCaptionID()) !== '')
175 175
 		{
176
-			if($control = $this->getPage()->findControl($id))
176
+			if ($control = $this->getPage()->findControl($id))
177 177
 				return $control;
178
-			if($control = $this->getNamingContainer()->findControl($id))
178
+			if ($control = $this->getNamingContainer()->findControl($id))
179 179
 				return $control;
180 180
 		}
181 181
 		throw new TInvalidDataValueException(
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 	 */
220 220
 	protected function getRatingStyleCssClass()
221 221
 	{
222
-		return 'TRatingList_' . $this->getRatingStyle();
222
+		return 'TRatingList_'.$this->getRatingStyle();
223 223
 	}
224 224
 
225 225
 	/**
@@ -262,11 +262,11 @@  discard block
 block discarded – undo
262 262
 	 */
263 263
 	protected function getCaptionControlID()
264 264
 	{
265
-		if(($id = $this->getCaptionID()) !== '')
265
+		if (($id = $this->getCaptionID()) !== '')
266 266
 		{
267
-			if($control = $this->getParent()->findControl($id))
267
+			if ($control = $this->getParent()->findControl($id))
268 268
 			{
269
-				if($control->getVisible(true))
269
+				if ($control->getVisible(true))
270 270
 					return $control->getClientID();
271 271
 			}
272 272
 			else
@@ -293,8 +293,8 @@  discard block
 block discarded – undo
293 293
 	protected function publishStyle($style)
294 294
 	{
295 295
 		$cs = $this->getPage()->getClientScript();
296
-		$url = $this->getAssetUrl($style . '.css');
297
-		if(!$cs->isStyleSheetFileRegistered($url))
296
+		$url = $this->getAssetUrl($style.'.css');
297
+		if (!$cs->isStyleSheetFileRegistered($url))
298 298
 			$cs->registerStyleSheetFile($url, $url);
299 299
 		return $url;
300 300
 	}
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 	{
309 309
 		$types = ['blank', 'selected', 'half', 'combined'];
310 310
 		$files = [];
311
-		foreach($types as $type)
311
+		foreach ($types as $type)
312 312
 			$files[$type] = $this->getAssetUrl("{$style}_{$type}{$fileExt}");
313 313
 		return $files;
314 314
 	}
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 	protected function getAssetUrl($file = '')
330 330
 	{
331 331
 		$base = $this->getPage()->getClientScript()->getPradoScriptAssetUrl();
332
-		return $base . '/' . self::SCRIPT_PATH . '/' . $file;
332
+		return $base.'/'.self::SCRIPT_PATH.'/'.$file;
333 333
 	}
334 334
 
335 335
 	/**
Please login to merge, or discard this patch.
Braces   +27 added lines, -20 removed lines patch added patch discarded remove patch
@@ -95,10 +95,11 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	public function setRepeatLayout($value)
97 97
 	{
98
-		if($value !== TRepeatLayout::Table)
99
-			throw new TInvalidDataValueException('ratinglist_table_layout_only');
100
-		else
101
-			parent::setRepeatLayout($value);
98
+		if($value !== TRepeatLayout::Table) {
99
+					throw new TInvalidDataValueException('ratinglist_table_layout_only');
100
+		} else {
101
+					parent::setRepeatLayout($value);
102
+		}
102 103
 	}
103 104
 
104 105
 	/**
@@ -107,10 +108,11 @@  discard block
 block discarded – undo
107 108
 	public function getRating()
108 109
 	{
109 110
 		$rating = $this->getViewState('Rating', null);
110
-		if ($rating === null)
111
-			return $this->getSelectedIndex() + 1;
112
-		else
113
-			return $rating;
111
+		if ($rating === null) {
112
+					return $this->getSelectedIndex() + 1;
113
+		} else {
114
+					return $rating;
115
+		}
114 116
 	}
115 117
 
116 118
 	/**
@@ -173,10 +175,12 @@  discard block
 block discarded – undo
173 175
 	{
174 176
 		if(($id = $this->getCaptionID()) !== '')
175 177
 		{
176
-			if($control = $this->getPage()->findControl($id))
177
-				return $control;
178
-			if($control = $this->getNamingContainer()->findControl($id))
179
-				return $control;
178
+			if($control = $this->getPage()->findControl($id)) {
179
+							return $control;
180
+			}
181
+			if($control = $this->getNamingContainer()->findControl($id)) {
182
+							return $control;
183
+			}
180 184
 		}
181 185
 		throw new TInvalidDataValueException(
182 186
 			'ratinglist_invalid_caption_id', $id, $this->getID());
@@ -266,11 +270,12 @@  discard block
 block discarded – undo
266 270
 		{
267 271
 			if($control = $this->getParent()->findControl($id))
268 272
 			{
269
-				if($control->getVisible(true))
270
-					return $control->getClientID();
273
+				if($control->getVisible(true)) {
274
+									return $control->getClientID();
275
+				}
276
+			} else {
277
+							return $id;
271 278
 			}
272
-			else
273
-				return $id;
274 279
 		}
275 280
 		return '';
276 281
 	}
@@ -294,8 +299,9 @@  discard block
 block discarded – undo
294 299
 	{
295 300
 		$cs = $this->getPage()->getClientScript();
296 301
 		$url = $this->getAssetUrl($style . '.css');
297
-		if(!$cs->isStyleSheetFileRegistered($url))
298
-			$cs->registerStyleSheetFile($url, $url);
302
+		if(!$cs->isStyleSheetFileRegistered($url)) {
303
+					$cs->registerStyleSheetFile($url, $url);
304
+		}
299 305
 		return $url;
300 306
 	}
301 307
 
@@ -308,8 +314,9 @@  discard block
 block discarded – undo
308 314
 	{
309 315
 		$types = ['blank', 'selected', 'half', 'combined'];
310 316
 		$files = [];
311
-		foreach($types as $type)
312
-			$files[$type] = $this->getAssetUrl("{$style}_{$type}{$fileExt}");
317
+		foreach($types as $type) {
318
+					$files[$type] = $this->getAssetUrl("{$style}_{$type}{$fileExt}");
319
+		}
313 320
 		return $files;
314 321
 	}
315 322
 
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TMultiView.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
 	 */
62 62
 	public function addParsedObject($object)
63 63
 	{
64
-		if($object instanceof TView)
64
+		if ($object instanceof TView)
65 65
 			$this->getControls()->add($object);
66
-		elseif(!is_string($object))
66
+		elseif (!is_string($object))
67 67
 			throw new TConfigurationException('multiview_view_required');
68 68
 	}
69 69
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	public function getActiveViewIndex()
83 83
 	{
84
-		if($this->_cachedActiveViewIndex > -1)
84
+		if ($this->_cachedActiveViewIndex > -1)
85 85
 			return $this->_cachedActiveViewIndex;
86 86
 		else
87 87
 			return $this->getControlState('ActiveViewIndex', -1);
@@ -93,17 +93,17 @@  discard block
 block discarded – undo
93 93
 	 */
94 94
 	public function setActiveViewIndex($value)
95 95
 	{
96
-		if(($index = TPropertyValue::ensureInteger($value)) < 0)
96
+		if (($index = TPropertyValue::ensureInteger($value)) < 0)
97 97
 			$index = -1;
98 98
 		$views = $this->getViews();
99 99
 		$count = $views->getCount();
100
-		if($count === 0 && $this->getControlStage() < TControl::CS_CHILD_INITIALIZED)
100
+		if ($count === 0 && $this->getControlStage() < TControl::CS_CHILD_INITIALIZED)
101 101
 			$this->_cachedActiveViewIndex = $index;
102
-		elseif($index < $count)
102
+		elseif ($index < $count)
103 103
 		{
104 104
 			$this->setControlState('ActiveViewIndex', $index, -1);
105 105
 			$this->_cachedActiveViewIndex = -1;
106
-			if($index >= 0)
106
+			if ($index >= 0)
107 107
 				$this->activateView($views->itemAt($index), true);
108 108
 		}
109 109
 		else
@@ -118,12 +118,12 @@  discard block
 block discarded – undo
118 118
 	{
119 119
 		$index = $this->getActiveViewIndex();
120 120
 		$views = $this->getViews();
121
-		if($index >= $views->getCount())
121
+		if ($index >= $views->getCount())
122 122
 			throw new TInvalidDataValueException('multiview_activeviewindex_invalid', $index);
123
-		if($index < 0)
123
+		if ($index < 0)
124 124
 			return null;
125 125
 		$view = $views->itemAt($index);
126
-		if(!$view->getActive())
126
+		if (!$view->getActive())
127 127
 			$this->activateView($view, false);
128 128
 		return $view;
129 129
 	}
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	public function setActiveView($view)
136 136
 	{
137
-		if(($index = $this->getViews()->indexOf($view)) >= 0)
137
+		if (($index = $this->getViews()->indexOf($view)) >= 0)
138 138
 			$this->setActiveViewIndex($index);
139 139
 		else
140 140
 			throw new TInvalidOperationException('multiview_view_inexistent');
@@ -148,24 +148,24 @@  discard block
 block discarded – undo
148 148
 	 */
149 149
 	protected function activateView($view, $triggerViewChangedEvent = true)
150 150
 	{
151
-		if($view->getActive())
151
+		if ($view->getActive())
152 152
 			return;
153 153
 		$triggerEvent = $triggerViewChangedEvent && ($this->getControlStage() >= \Prado\Web\UI\TControl::CS_STATE_LOADED || ($this->getPage() && !$this->getPage()->getIsPostBack()));
154
-		foreach($this->getViews() as $v)
154
+		foreach ($this->getViews() as $v)
155 155
 		{
156
-			if($v === $view)
156
+			if ($v === $view)
157 157
 			{
158 158
 				$view->setActive(true);
159
-				if($triggerEvent)
159
+				if ($triggerEvent)
160 160
 				{
161 161
 					$view->onActivate(null);
162 162
 					$this->onActiveViewChanged(null);
163 163
 				}
164 164
 			}
165
-			elseif($v->getActive())
165
+			elseif ($v->getActive())
166 166
 			{
167 167
 				$v->setActive(false);
168
-				if($triggerEvent)
168
+				if ($triggerEvent)
169 169
 					$v->onDeactivate(null);
170 170
 			}
171 171
 		}
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	public function onInit($param)
198 198
 	{
199 199
 		parent::onInit($param);
200
-		if($this->_cachedActiveViewIndex >= 0)
200
+		if ($this->_cachedActiveViewIndex >= 0)
201 201
 			$this->setActiveViewIndex($this->_cachedActiveViewIndex);
202 202
 	}
203 203
 
@@ -220,23 +220,23 @@  discard block
 block discarded – undo
220 220
 	 */
221 221
 	public function bubbleEvent($sender, $param)
222 222
 	{
223
-		if(!$this->_ignoreBubbleEvents && ($param instanceof \Prado\Web\UI\TCommandEventParameter))
223
+		if (!$this->_ignoreBubbleEvents && ($param instanceof \Prado\Web\UI\TCommandEventParameter))
224 224
 		{
225
-			switch($param->getCommandName())
225
+			switch ($param->getCommandName())
226 226
 			{
227 227
 				case self::CMD_NEXTVIEW:
228
-					if(($index = $this->getActiveViewIndex()) < $this->getViews()->getCount() - 1)
228
+					if (($index = $this->getActiveViewIndex()) < $this->getViews()->getCount() - 1)
229 229
 						$this->setActiveViewIndex($index + 1);
230 230
 					else
231 231
 						$this->setActiveViewIndex(-1);
232 232
 					return true;
233 233
 				case self::CMD_PREVIOUSVIEW:
234
-					if(($index = $this->getActiveViewIndex()) >= 0)
234
+					if (($index = $this->getActiveViewIndex()) >= 0)
235 235
 						$this->setActiveViewIndex($index - 1);
236 236
 					return true;
237 237
 				case self::CMD_SWITCHVIEWID:
238 238
 					$view = $this->findControl($viewID = $param->getCommandParameter());
239
-					if($view !== null && $view->getParent() === $this)
239
+					if ($view !== null && $view->getParent() === $this)
240 240
 					{
241 241
 						$this->setActiveView($view);
242 242
 						return true;
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 	 */
270 270
 	public function render($writer)
271 271
 	{
272
-		if(($view = $this->getActiveView()) !== null)
272
+		if (($view = $this->getActiveView()) !== null)
273 273
 			$view->renderControl($writer);
274 274
 	}
275 275
 }
276 276
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +58 added lines, -45 removed lines patch added patch discarded remove patch
@@ -61,10 +61,11 @@  discard block
 block discarded – undo
61 61
 	 */
62 62
 	public function addParsedObject($object)
63 63
 	{
64
-		if($object instanceof TView)
65
-			$this->getControls()->add($object);
66
-		elseif(!is_string($object))
67
-			throw new TConfigurationException('multiview_view_required');
64
+		if($object instanceof TView) {
65
+					$this->getControls()->add($object);
66
+		} elseif(!is_string($object)) {
67
+					throw new TConfigurationException('multiview_view_required');
68
+		}
68 69
 	}
69 70
 
70 71
 	/**
@@ -81,10 +82,11 @@  discard block
 block discarded – undo
81 82
 	 */
82 83
 	public function getActiveViewIndex()
83 84
 	{
84
-		if($this->_cachedActiveViewIndex > -1)
85
-			return $this->_cachedActiveViewIndex;
86
-		else
87
-			return $this->getControlState('ActiveViewIndex', -1);
85
+		if($this->_cachedActiveViewIndex > -1) {
86
+					return $this->_cachedActiveViewIndex;
87
+		} else {
88
+					return $this->getControlState('ActiveViewIndex', -1);
89
+		}
88 90
 	}
89 91
 
90 92
 	/**
@@ -93,21 +95,23 @@  discard block
 block discarded – undo
93 95
 	 */
94 96
 	public function setActiveViewIndex($value)
95 97
 	{
96
-		if(($index = TPropertyValue::ensureInteger($value)) < 0)
97
-			$index = -1;
98
+		if(($index = TPropertyValue::ensureInteger($value)) < 0) {
99
+					$index = -1;
100
+		}
98 101
 		$views = $this->getViews();
99 102
 		$count = $views->getCount();
100
-		if($count === 0 && $this->getControlStage() < TControl::CS_CHILD_INITIALIZED)
101
-			$this->_cachedActiveViewIndex = $index;
102
-		elseif($index < $count)
103
+		if($count === 0 && $this->getControlStage() < TControl::CS_CHILD_INITIALIZED) {
104
+					$this->_cachedActiveViewIndex = $index;
105
+		} elseif($index < $count)
103 106
 		{
104 107
 			$this->setControlState('ActiveViewIndex', $index, -1);
105 108
 			$this->_cachedActiveViewIndex = -1;
106
-			if($index >= 0)
107
-				$this->activateView($views->itemAt($index), true);
109
+			if($index >= 0) {
110
+							$this->activateView($views->itemAt($index), true);
111
+			}
112
+		} else {
113
+					throw new TInvalidDataValueException('multiview_activeviewindex_invalid', $index);
108 114
 		}
109
-		else
110
-			throw new TInvalidDataValueException('multiview_activeviewindex_invalid', $index);
111 115
 	}
112 116
 
113 117
 	/**
@@ -118,13 +122,16 @@  discard block
 block discarded – undo
118 122
 	{
119 123
 		$index = $this->getActiveViewIndex();
120 124
 		$views = $this->getViews();
121
-		if($index >= $views->getCount())
122
-			throw new TInvalidDataValueException('multiview_activeviewindex_invalid', $index);
123
-		if($index < 0)
124
-			return null;
125
+		if($index >= $views->getCount()) {
126
+					throw new TInvalidDataValueException('multiview_activeviewindex_invalid', $index);
127
+		}
128
+		if($index < 0) {
129
+					return null;
130
+		}
125 131
 		$view = $views->itemAt($index);
126
-		if(!$view->getActive())
127
-			$this->activateView($view, false);
132
+		if(!$view->getActive()) {
133
+					$this->activateView($view, false);
134
+		}
128 135
 		return $view;
129 136
 	}
130 137
 
@@ -134,10 +141,11 @@  discard block
 block discarded – undo
134 141
 	 */
135 142
 	public function setActiveView($view)
136 143
 	{
137
-		if(($index = $this->getViews()->indexOf($view)) >= 0)
138
-			$this->setActiveViewIndex($index);
139
-		else
140
-			throw new TInvalidOperationException('multiview_view_inexistent');
144
+		if(($index = $this->getViews()->indexOf($view)) >= 0) {
145
+					$this->setActiveViewIndex($index);
146
+		} else {
147
+					throw new TInvalidOperationException('multiview_view_inexistent');
148
+		}
141 149
 	}
142 150
 
143 151
 	/**
@@ -148,8 +156,9 @@  discard block
 block discarded – undo
148 156
 	 */
149 157
 	protected function activateView($view, $triggerViewChangedEvent = true)
150 158
 	{
151
-		if($view->getActive())
152
-			return;
159
+		if($view->getActive()) {
160
+					return;
161
+		}
153 162
 		$triggerEvent = $triggerViewChangedEvent && ($this->getControlStage() >= \Prado\Web\UI\TControl::CS_STATE_LOADED || ($this->getPage() && !$this->getPage()->getIsPostBack()));
154 163
 		foreach($this->getViews() as $v)
155 164
 		{
@@ -161,12 +170,12 @@  discard block
 block discarded – undo
161 170
 					$view->onActivate(null);
162 171
 					$this->onActiveViewChanged(null);
163 172
 				}
164
-			}
165
-			elseif($v->getActive())
173
+			} elseif($v->getActive())
166 174
 			{
167 175
 				$v->setActive(false);
168
-				if($triggerEvent)
169
-					$v->onDeactivate(null);
176
+				if($triggerEvent) {
177
+									$v->onDeactivate(null);
178
+				}
170 179
 			}
171 180
 		}
172 181
 	}
@@ -197,8 +206,9 @@  discard block
 block discarded – undo
197 206
 	public function onInit($param)
198 207
 	{
199 208
 		parent::onInit($param);
200
-		if($this->_cachedActiveViewIndex >= 0)
201
-			$this->setActiveViewIndex($this->_cachedActiveViewIndex);
209
+		if($this->_cachedActiveViewIndex >= 0) {
210
+					$this->setActiveViewIndex($this->_cachedActiveViewIndex);
211
+		}
202 212
 	}
203 213
 
204 214
 	/**
@@ -225,14 +235,16 @@  discard block
 block discarded – undo
225 235
 			switch($param->getCommandName())
226 236
 			{
227 237
 				case self::CMD_NEXTVIEW:
228
-					if(($index = $this->getActiveViewIndex()) < $this->getViews()->getCount() - 1)
229
-						$this->setActiveViewIndex($index + 1);
230
-					else
231
-						$this->setActiveViewIndex(-1);
238
+					if(($index = $this->getActiveViewIndex()) < $this->getViews()->getCount() - 1) {
239
+											$this->setActiveViewIndex($index + 1);
240
+					} else {
241
+											$this->setActiveViewIndex(-1);
242
+					}
232 243
 					return true;
233 244
 				case self::CMD_PREVIOUSVIEW:
234
-					if(($index = $this->getActiveViewIndex()) >= 0)
235
-						$this->setActiveViewIndex($index - 1);
245
+					if(($index = $this->getActiveViewIndex()) >= 0) {
246
+											$this->setActiveViewIndex($index - 1);
247
+					}
236 248
 					return true;
237 249
 				case self::CMD_SWITCHVIEWID:
238 250
 					$view = $this->findControl($viewID = $param->getCommandParameter());
@@ -240,9 +252,9 @@  discard block
 block discarded – undo
240 252
 					{
241 253
 						$this->setActiveView($view);
242 254
 						return true;
255
+					} else {
256
+											throw new TInvalidDataValueException('multiview_viewid_invalid', $viewID);
243 257
 					}
244
-					else
245
-						throw new TInvalidDataValueException('multiview_viewid_invalid', $viewID);
246 258
 					break;
247 259
 				case self::CMD_SWITCHVIEWINDEX:
248 260
 					$index = TPropertyValue::ensureInteger($param->getCommandParameter());
@@ -269,7 +281,8 @@  discard block
 block discarded – undo
269 281
 	 */
270 282
 	public function render($writer)
271 283
 	{
272
-		if(($view = $this->getActiveView()) !== null)
273
-			$view->renderControl($writer);
284
+		if(($view = $this->getActiveView()) !== null) {
285
+					$view->renderControl($writer);
286
+		}
274 287
 	}
275 288
 }
276 289
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TConditional.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 */
64 64
 	public function addParsedObject($object)
65 65
 	{
66
-		if($this->_creatingChildren)
66
+		if ($this->_creatingChildren)
67 67
 			parent::addParsedObject($object);
68 68
 	}
69 69
 
@@ -80,16 +80,16 @@  discard block
 block discarded – undo
80 80
 		{
81 81
 			$result = $this->getTemplateControl()->evaluateExpression($this->_condition);
82 82
 		}
83
-		catch(\Exception $e)
83
+		catch (\Exception $e)
84 84
 		{
85 85
 			throw new TInvalidDataValueException('conditional_condition_invalid', $this->_condition, $e->getMessage());
86 86
 		}
87
-		if($result)
87
+		if ($result)
88 88
 		{
89
-			if($this->_trueTemplate)
89
+			if ($this->_trueTemplate)
90 90
 				$this->_trueTemplate->instantiateIn($this->getTemplateControl(), $this);
91 91
 		}
92
-		elseif($this->_falseTemplate)
92
+		elseif ($this->_falseTemplate)
93 93
 			$this->_falseTemplate->instantiateIn($this->getTemplateControl(), $this);
94 94
 		$this->_creatingChildren = false;
95 95
 	}
Please login to merge, or discard this patch.
Braces   +9 added lines, -8 removed lines patch added patch discarded remove patch
@@ -63,8 +63,9 @@  discard block
 block discarded – undo
63 63
 	 */
64 64
 	public function addParsedObject($object)
65 65
 	{
66
-		if($this->_creatingChildren)
67
-			parent::addParsedObject($object);
66
+		if($this->_creatingChildren) {
67
+					parent::addParsedObject($object);
68
+		}
68 69
 	}
69 70
 
70 71
 	/**
@@ -79,18 +80,18 @@  discard block
 block discarded – undo
79 80
 		try
80 81
 		{
81 82
 			$result = $this->getTemplateControl()->evaluateExpression($this->_condition);
82
-		}
83
-		catch(\Exception $e)
83
+		} catch(\Exception $e)
84 84
 		{
85 85
 			throw new TInvalidDataValueException('conditional_condition_invalid', $this->_condition, $e->getMessage());
86 86
 		}
87 87
 		if($result)
88 88
 		{
89
-			if($this->_trueTemplate)
90
-				$this->_trueTemplate->instantiateIn($this->getTemplateControl(), $this);
89
+			if($this->_trueTemplate) {
90
+							$this->_trueTemplate->instantiateIn($this->getTemplateControl(), $this);
91
+			}
92
+		} elseif($this->_falseTemplate) {
93
+					$this->_falseTemplate->instantiateIn($this->getTemplateControl(), $this);
91 94
 		}
92
-		elseif($this->_falseTemplate)
93
-			$this->_falseTemplate->instantiateIn($this->getTemplateControl(), $this);
94 95
 		$this->_creatingChildren = false;
95 96
 	}
96 97
 
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TDataList.php 2 patches
Spacing   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	 */
189 189
 	public function getItems()
190 190
 	{
191
-		if(!$this->_items)
191
+		if (!$this->_items)
192 192
 			$this->_items = new TDataListItemCollection;
193 193
 		return $this->_items;
194 194
 	}
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	 */
199 199
 	public function getItemCount()
200 200
 	{
201
-		return $this->_items?$this->_items->getCount():0;
201
+		return $this->_items ? $this->_items->getCount() : 0;
202 202
 	}
203 203
 
204 204
 	/**
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 	 */
409 409
 	public function setItemTemplate($value)
410 410
 	{
411
-		if($value instanceof ITemplate || $value === null)
411
+		if ($value instanceof ITemplate || $value === null)
412 412
 			$this->_itemTemplate = $value;
413 413
 		else
414 414
 			throw new TInvalidDataTypeException('datalist_template_required', 'ItemTemplate');
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 	 */
420 420
 	public function getItemStyle()
421 421
 	{
422
-		if(($style = $this->getViewState('ItemStyle', null)) === null)
422
+		if (($style = $this->getViewState('ItemStyle', null)) === null)
423 423
 		{
424 424
 			$style = new TTableItemStyle;
425 425
 			$this->setViewState('ItemStyle', $style, null);
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 	 */
442 442
 	public function setAlternatingItemTemplate($value)
443 443
 	{
444
-		if($value instanceof ITemplate || $value === null)
444
+		if ($value instanceof ITemplate || $value === null)
445 445
 			$this->_alternatingItemTemplate = $value;
446 446
 		else
447 447
 			throw new TInvalidDataTypeException('datalist_template_required', 'AlternatingItemType');
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 	 */
453 453
 	public function getAlternatingItemStyle()
454 454
 	{
455
-		if(($style = $this->getViewState('AlternatingItemStyle', null)) === null)
455
+		if (($style = $this->getViewState('AlternatingItemStyle', null)) === null)
456 456
 		{
457 457
 			$style = new TTableItemStyle;
458 458
 			$this->setViewState('AlternatingItemStyle', $style, null);
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 	 */
475 475
 	public function setSelectedItemTemplate($value)
476 476
 	{
477
-		if($value instanceof ITemplate || $value === null)
477
+		if ($value instanceof ITemplate || $value === null)
478 478
 			$this->_selectedItemTemplate = $value;
479 479
 		else
480 480
 			throw new TInvalidDataTypeException('datalist_template_required', 'SelectedItemTemplate');
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 	 */
486 486
 	public function getSelectedItemStyle()
487 487
 	{
488
-		if(($style = $this->getViewState('SelectedItemStyle', null)) === null)
488
+		if (($style = $this->getViewState('SelectedItemStyle', null)) === null)
489 489
 		{
490 490
 			$style = new TTableItemStyle;
491 491
 			$this->setViewState('SelectedItemStyle', $style, null);
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 	 */
508 508
 	public function setEditItemTemplate($value)
509 509
 	{
510
-		if($value instanceof ITemplate || $value === null)
510
+		if ($value instanceof ITemplate || $value === null)
511 511
 			$this->_editItemTemplate = $value;
512 512
 		else
513 513
 			throw new TInvalidDataTypeException('datalist_template_required', 'EditItemTemplate');
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 	 */
519 519
 	public function getEditItemStyle()
520 520
 	{
521
-		if(($style = $this->getViewState('EditItemStyle', null)) === null)
521
+		if (($style = $this->getViewState('EditItemStyle', null)) === null)
522 522
 		{
523 523
 			$style = new TTableItemStyle;
524 524
 			$this->setViewState('EditItemStyle', $style, null);
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 	 */
541 541
 	public function setHeaderTemplate($value)
542 542
 	{
543
-		if($value instanceof ITemplate || $value === null)
543
+		if ($value instanceof ITemplate || $value === null)
544 544
 			$this->_headerTemplate = $value;
545 545
 		else
546 546
 			throw new TInvalidDataTypeException('datalist_template_required', 'HeaderTemplate');
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 	 */
552 552
 	public function getHeaderStyle()
553 553
 	{
554
-		if(($style = $this->getViewState('HeaderStyle', null)) === null)
554
+		if (($style = $this->getViewState('HeaderStyle', null)) === null)
555 555
 		{
556 556
 			$style = new TTableItemStyle;
557 557
 			$this->setViewState('HeaderStyle', $style, null);
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
 	 */
582 582
 	public function setFooterTemplate($value)
583 583
 	{
584
-		if($value instanceof ITemplate || $value === null)
584
+		if ($value instanceof ITemplate || $value === null)
585 585
 			$this->_footerTemplate = $value;
586 586
 		else
587 587
 			throw new TInvalidDataTypeException('datalist_template_required', 'FooterTemplate');
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 	 */
593 593
 	public function getFooterStyle()
594 594
 	{
595
-		if(($style = $this->getViewState('FooterStyle', null)) === null)
595
+		if (($style = $this->getViewState('FooterStyle', null)) === null)
596 596
 		{
597 597
 			$style = new TTableItemStyle;
598 598
 			$this->setViewState('FooterStyle', $style, null);
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 	 */
623 623
 	public function setEmptyTemplate($value)
624 624
 	{
625
-		if($value instanceof ITemplate || $value === null)
625
+		if ($value instanceof ITemplate || $value === null)
626 626
 			$this->_emptyTemplate = $value;
627 627
 		else
628 628
 			throw new TInvalidDataTypeException('datalist_template_required', 'EmptyTemplate');
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
 	 */
643 643
 	public function setSeparatorTemplate($value)
644 644
 	{
645
-		if($value instanceof ITemplate || $value === null)
645
+		if ($value instanceof ITemplate || $value === null)
646 646
 			$this->_separatorTemplate = $value;
647 647
 		else
648 648
 			throw new TInvalidDataTypeException('datalist_template_required', 'SeparatorTemplate');
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 	 */
654 654
 	public function getSeparatorStyle()
655 655
 	{
656
-		if(($style = $this->getViewState('SeparatorStyle', null)) === null)
656
+		if (($style = $this->getViewState('SeparatorStyle', null)) === null)
657 657
 		{
658 658
 			$style = new TTableItemStyle;
659 659
 			$this->setViewState('SeparatorStyle', $style, null);
@@ -679,23 +679,23 @@  discard block
 block discarded – undo
679 679
 	 */
680 680
 	public function setSelectedItemIndex($value)
681 681
 	{
682
-		if(($value = TPropertyValue::ensureInteger($value)) < 0)
682
+		if (($value = TPropertyValue::ensureInteger($value)) < 0)
683 683
 			$value = -1;
684
-		if(($current = $this->getSelectedItemIndex()) !== $value)
684
+		if (($current = $this->getSelectedItemIndex()) !== $value)
685 685
 		{
686 686
 			$this->setViewState('SelectedItemIndex', $value, -1);
687 687
 			$items = $this->getItems();
688 688
 			$itemCount = $items->getCount();
689
-			if($current >= 0 && $current < $itemCount)
689
+			if ($current >= 0 && $current < $itemCount)
690 690
 			{
691 691
 				$item = $items->itemAt($current);
692
-				if(($item instanceof IItemDataRenderer) && $item->getItemType() !== TListItemType::EditItem)
693
-					$item->setItemType($current % 2?TListItemType::AlternatingItem : TListItemType::Item);
692
+				if (($item instanceof IItemDataRenderer) && $item->getItemType() !== TListItemType::EditItem)
693
+					$item->setItemType($current % 2 ?TListItemType::AlternatingItem : TListItemType::Item);
694 694
 			}
695
-			if($value >= 0 && $value < $itemCount)
695
+			if ($value >= 0 && $value < $itemCount)
696 696
 			{
697 697
 				$item = $items->itemAt($value);
698
-				if(($item instanceof IItemDataRenderer) && $item->getItemType() !== TListItemType::EditItem)
698
+				if (($item instanceof IItemDataRenderer) && $item->getItemType() !== TListItemType::EditItem)
699 699
 					$item->setItemType(TListItemType::SelectedItem);
700 700
 			}
701 701
 		}
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
 	{
709 709
 		$index = $this->getSelectedItemIndex();
710 710
 		$items = $this->getItems();
711
-		if($index >= 0 && $index < $items->getCount())
711
+		if ($index >= 0 && $index < $items->getCount())
712 712
 			return $items->itemAt($index);
713 713
 		else
714 714
 			return null;
@@ -720,11 +720,11 @@  discard block
 block discarded – undo
720 720
 	 */
721 721
 	public function getSelectedDataKey()
722 722
 	{
723
-		if($this->getDataKeyField() === '')
723
+		if ($this->getDataKeyField() === '')
724 724
 			throw new TInvalidOperationException('datalist_datakeyfield_required');
725 725
 		$index = $this->getSelectedItemIndex();
726 726
 		$dataKeys = $this->getDataKeys();
727
-		if($index >= 0 && $index < $dataKeys->getCount())
727
+		if ($index >= 0 && $index < $dataKeys->getCount())
728 728
 			return $dataKeys->itemAt($index);
729 729
 		else
730 730
 			return null;
@@ -747,16 +747,16 @@  discard block
 block discarded – undo
747 747
 	 */
748 748
 	public function setEditItemIndex($value)
749 749
 	{
750
-		if(($value = TPropertyValue::ensureInteger($value)) < 0)
750
+		if (($value = TPropertyValue::ensureInteger($value)) < 0)
751 751
 			$value = -1;
752
-		if(($current = $this->getEditItemIndex()) !== $value)
752
+		if (($current = $this->getEditItemIndex()) !== $value)
753 753
 		{
754 754
 			$this->setViewState('EditItemIndex', $value, -1);
755 755
 			$items = $this->getItems();
756 756
 			$itemCount = $items->getCount();
757
-			if($current >= 0 && $current < $itemCount)
758
-				$items->itemAt($current)->setItemType($current % 2?TListItemType::AlternatingItem : TListItemType::Item);
759
-			if($value >= 0 && $value < $itemCount)
757
+			if ($current >= 0 && $current < $itemCount)
758
+				$items->itemAt($current)->setItemType($current % 2 ?TListItemType::AlternatingItem : TListItemType::Item);
759
+			if ($value >= 0 && $value < $itemCount)
760 760
 				$items->itemAt($value)->setItemType(TListItemType::EditItem);
761 761
 		}
762 762
 	}
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
 	{
769 769
 		$index = $this->getEditItemIndex();
770 770
 		$items = $this->getItems();
771
-		if($index >= 0 && $index < $items->getCount())
771
+		if ($index >= 0 && $index < $items->getCount())
772 772
 			return $items->itemAt($index);
773 773
 		else
774 774
 			return null;
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
 	 */
812 812
 	protected function getRepeatInfo()
813 813
 	{
814
-		if(($repeatInfo = $this->getViewState('RepeatInfo', null)) === null)
814
+		if (($repeatInfo = $this->getViewState('RepeatInfo', null)) === null)
815 815
 		{
816 816
 			$repeatInfo = new TRepeatInfo;
817 817
 			$this->setViewState('RepeatInfo', $repeatInfo, null);
@@ -914,33 +914,33 @@  discard block
 block discarded – undo
914 914
 	 */
915 915
 	public function bubbleEvent($sender, $param)
916 916
 	{
917
-		if($param instanceof TDataListCommandEventParameter)
917
+		if ($param instanceof TDataListCommandEventParameter)
918 918
 		{
919 919
 			$this->onItemCommand($param);
920 920
 			$command = $param->getCommandName();
921
-			if(strcasecmp($command, self::CMD_SELECT) === 0)
921
+			if (strcasecmp($command, self::CMD_SELECT) === 0)
922 922
 			{
923
-				if(($item = $param->getItem()) instanceof IItemDataRenderer)
923
+				if (($item = $param->getItem()) instanceof IItemDataRenderer)
924 924
 					$this->setSelectedItemIndex($item->getItemIndex());
925 925
 				$this->onSelectedIndexChanged($param);
926 926
 				return true;
927 927
 			}
928
-			elseif(strcasecmp($command, self::CMD_EDIT) === 0)
928
+			elseif (strcasecmp($command, self::CMD_EDIT) === 0)
929 929
 			{
930 930
 				$this->onEditCommand($param);
931 931
 				return true;
932 932
 			}
933
-			elseif(strcasecmp($command, self::CMD_DELETE) === 0)
933
+			elseif (strcasecmp($command, self::CMD_DELETE) === 0)
934 934
 			{
935 935
 				$this->onDeleteCommand($param);
936 936
 				return true;
937 937
 			}
938
-			elseif(strcasecmp($command, self::CMD_UPDATE) === 0)
938
+			elseif (strcasecmp($command, self::CMD_UPDATE) === 0)
939 939
 			{
940 940
 				$this->onUpdateCommand($param);
941 941
 				return true;
942 942
 			}
943
-			elseif(strcasecmp($command, self::CMD_CANCEL) === 0)
943
+			elseif (strcasecmp($command, self::CMD_CANCEL) === 0)
944 944
 			{
945 945
 				$this->onCancelCommand($param);
946 946
 				return true;
@@ -1073,7 +1073,7 @@  discard block
 block discarded – undo
1073 1073
 	 */
1074 1074
 	public function generateItemStyle($itemType, $index)
1075 1075
 	{
1076
-		if(($item = $this->getItem($itemType, $index)) !== null && ($item instanceof IStyleable) && $item->getHasStyle())
1076
+		if (($item = $this->getItem($itemType, $index)) !== null && ($item instanceof IStyleable) && $item->getHasStyle())
1077 1077
 		{
1078 1078
 			$style = $item->getStyle();
1079 1079
 			$item->clearStyle();
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
 	public function renderItem($writer, $repeatInfo, $itemType, $index)
1095 1095
 	{
1096 1096
 		$item = $this->getItem($itemType, $index);
1097
-		if($repeatInfo->getRepeatLayout() === TRepeatLayout::Raw && get_class($item) === 'TDataListItem')
1097
+		if ($repeatInfo->getRepeatLayout() === TRepeatLayout::Raw && get_class($item) === 'TDataListItem')
1098 1098
 			$item->setTagName('div');
1099 1099
 		$item->renderControl($writer);
1100 1100
 	}
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
 	 */
1107 1107
 	private function getItem($itemType, $index)
1108 1108
 	{
1109
-		switch($itemType)
1109
+		switch ($itemType)
1110 1110
 		{
1111 1111
 			case TListItemType::Item:
1112 1112
 			case TListItemType::AlternatingItem:
@@ -1119,7 +1119,7 @@  discard block
 block discarded – undo
1119 1119
 				return $this->getControls()->itemAt($this->getControls()->getCount() - 1);
1120 1120
 			case TListItemType::Separator:
1121 1121
 				$i = $index + $index + 1;
1122
-				if($this->_headerTemplate !== null || $this->getHeaderRenderer() !== '')
1122
+				if ($this->_headerTemplate !== null || $this->getHeaderRenderer() !== '')
1123 1123
 					$i++;
1124 1124
 				return $this->getControls()->itemAt($i);
1125 1125
 		}
@@ -1135,7 +1135,7 @@  discard block
 block discarded – undo
1135 1135
 	 */
1136 1136
 	private function createItemInternal($itemIndex, $itemType)
1137 1137
 	{
1138
-		if(($item = $this->createItem($itemIndex, $itemType)) !== null)
1138
+		if (($item = $this->createItem($itemIndex, $itemType)) !== null)
1139 1139
 		{
1140 1140
 			$param = new TDataListItemEventParameter($item);
1141 1141
 			$this->onItemCreated($param);
@@ -1156,10 +1156,10 @@  discard block
 block discarded – undo
1156 1156
 	 */
1157 1157
 	private function createItemWithDataInternal($itemIndex, $itemType, $dataItem)
1158 1158
 	{
1159
-		if(($item = $this->createItem($itemIndex, $itemType)) !== null)
1159
+		if (($item = $this->createItem($itemIndex, $itemType)) !== null)
1160 1160
 		{
1161 1161
 			$param = new TDataListItemEventParameter($item);
1162
-			if($item instanceof \Prado\IDataRenderer)
1162
+			if ($item instanceof \Prado\IDataRenderer)
1163 1163
 				$item->setData($dataItem);
1164 1164
 			$this->onItemCreated($param);
1165 1165
 			$this->getControls()->add($item);
@@ -1173,31 +1173,31 @@  discard block
 block discarded – undo
1173 1173
 
1174 1174
 	private function getAlternatingItemDisplay()
1175 1175
 	{
1176
-		if(($classPath = $this->getAlternatingItemRenderer()) === '' && $this->_alternatingItemTemplate === null)
1177
-			return [$this->getItemRenderer(),$this->_itemTemplate];
1176
+		if (($classPath = $this->getAlternatingItemRenderer()) === '' && $this->_alternatingItemTemplate === null)
1177
+			return [$this->getItemRenderer(), $this->_itemTemplate];
1178 1178
 		else
1179
-			return [$classPath,$this->_alternatingItemTemplate];
1179
+			return [$classPath, $this->_alternatingItemTemplate];
1180 1180
 	}
1181 1181
 
1182 1182
 	private function getSelectedItemDisplay($itemIndex)
1183 1183
 	{
1184
-		if(($classPath = $this->getSelectedItemRenderer()) === '' && $this->_selectedItemTemplate === null)
1184
+		if (($classPath = $this->getSelectedItemRenderer()) === '' && $this->_selectedItemTemplate === null)
1185 1185
 		{
1186
-			if($itemIndex % 2 === 0)
1187
-				return [$this->getItemRenderer(),$this->_itemTemplate];
1186
+			if ($itemIndex % 2 === 0)
1187
+				return [$this->getItemRenderer(), $this->_itemTemplate];
1188 1188
 			else
1189 1189
 				return $this->getAlternatingItemDisplay();
1190 1190
 		}
1191 1191
 		else
1192
-			return [$classPath,$this->_selectedItemTemplate];
1192
+			return [$classPath, $this->_selectedItemTemplate];
1193 1193
 	}
1194 1194
 
1195 1195
 	private function getEditItemDisplay($itemIndex)
1196 1196
 	{
1197
-		if(($classPath = $this->getEditItemRenderer()) === '' && $this->_editItemTemplate === null)
1197
+		if (($classPath = $this->getEditItemRenderer()) === '' && $this->_editItemTemplate === null)
1198 1198
 			return $this->getSelectedItemDisplay($itemIndex);
1199 1199
 		else
1200
-			return [$classPath,$this->_editItemTemplate];
1200
+			return [$classPath, $this->_editItemTemplate];
1201 1201
 	}
1202 1202
 
1203 1203
 	/**
@@ -1210,7 +1210,7 @@  discard block
 block discarded – undo
1210 1210
 	{
1211 1211
 		$template = null;
1212 1212
 		$classPath = null;
1213
-		switch($itemType)
1213
+		switch ($itemType)
1214 1214
 		{
1215 1215
 			case TListItemType::Item :
1216 1216
 				$classPath = $this->getItemRenderer();
@@ -1240,16 +1240,16 @@  discard block
 block discarded – undo
1240 1240
 			default:
1241 1241
 				throw new TInvalidDataValueException('datalist_itemtype_unknown', $itemType);
1242 1242
 		}
1243
-		if($classPath !== '')
1243
+		if ($classPath !== '')
1244 1244
 		{
1245 1245
 			$item = Prado::createComponent($classPath);
1246
-			if($item instanceof IItemDataRenderer)
1246
+			if ($item instanceof IItemDataRenderer)
1247 1247
 			{
1248 1248
 				$item->setItemIndex($itemIndex);
1249 1249
 				$item->setItemType($itemType);
1250 1250
 			}
1251 1251
 		}
1252
-		elseif($template !== null)
1252
+		elseif ($template !== null)
1253 1253
 		{
1254 1254
 			$item = new TDataListItem;
1255 1255
 			$item->setItemIndex($itemIndex);
@@ -1267,9 +1267,9 @@  discard block
 block discarded – undo
1267 1267
 	 */
1268 1268
 	protected function createEmptyContent()
1269 1269
 	{
1270
-		if(($classPath = $this->getEmptyRenderer()) !== '')
1270
+		if (($classPath = $this->getEmptyRenderer()) !== '')
1271 1271
 			$this->getControls()->add(Prado::createComponent($classPath));
1272
-		elseif($this->_emptyTemplate !== null)
1272
+		elseif ($this->_emptyTemplate !== null)
1273 1273
 			$this->_emptyTemplate->instantiateIn($this);
1274 1274
 	}
1275 1275
 
@@ -1289,9 +1289,9 @@  discard block
 block discarded – undo
1289 1289
 		$itemStyle = $this->getViewState('ItemStyle', null);
1290 1290
 
1291 1291
 		$alternatingItemStyle = $this->getViewState('AlternatingItemStyle', null);
1292
-		if($itemStyle !== null)
1292
+		if ($itemStyle !== null)
1293 1293
 		{
1294
-			if($alternatingItemStyle === null)
1294
+			if ($alternatingItemStyle === null)
1295 1295
 				$alternatingItemStyle = $itemStyle;
1296 1296
 			else
1297 1297
 				$alternatingItemStyle->mergeWith($itemStyle);
@@ -1300,25 +1300,25 @@  discard block
 block discarded – undo
1300 1300
 		$selectedItemStyle = $this->getViewState('SelectedItemStyle', null);
1301 1301
 
1302 1302
 		$editItemStyle = $this->getViewState('EditItemStyle', null);
1303
-		if($selectedItemStyle !== null)
1303
+		if ($selectedItemStyle !== null)
1304 1304
 		{
1305
-			if($editItemStyle === null)
1305
+			if ($editItemStyle === null)
1306 1306
 				$editItemStyle = $selectedItemStyle;
1307 1307
 			else
1308 1308
 				$editItemStyle->mergeWith($selectedItemStyle);
1309 1309
 		}
1310 1310
 
1311 1311
 		// apply header style if any
1312
-		if($this->_header !== null && $this->_header instanceof IStyleable)
1312
+		if ($this->_header !== null && $this->_header instanceof IStyleable)
1313 1313
 		{
1314
-			if($headerStyle = $this->getViewState('HeaderStyle', null))
1314
+			if ($headerStyle = $this->getViewState('HeaderStyle', null))
1315 1315
 				$this->_header->getStyle()->mergeWith($headerStyle);
1316 1316
 		}
1317 1317
 
1318 1318
 		// apply footer style if any
1319
-		if($this->_footer !== null && $this->_footer instanceof IStyleable)
1319
+		if ($this->_footer !== null && $this->_footer instanceof IStyleable)
1320 1320
 		{
1321
-			if($footerStyle = $this->getViewState('FooterStyle', null))
1321
+			if ($footerStyle = $this->getViewState('FooterStyle', null))
1322 1322
 				$this->_footer->getStyle()->mergeWith($footerStyle);
1323 1323
 		}
1324 1324
 
@@ -1326,28 +1326,28 @@  discard block
 block discarded – undo
1326 1326
 		$editIndex = $this->getEditItemIndex();
1327 1327
 
1328 1328
 		// apply item styles if any
1329
-		foreach($this->getItems() as $index => $item)
1329
+		foreach ($this->getItems() as $index => $item)
1330 1330
 		{
1331
-			if($index === $editIndex)
1331
+			if ($index === $editIndex)
1332 1332
 				$style = $editItemStyle;
1333
-			elseif($index === $selectedIndex)
1333
+			elseif ($index === $selectedIndex)
1334 1334
 				$style = $selectedItemStyle;
1335
-			elseif($index % 2 === 0)
1335
+			elseif ($index % 2 === 0)
1336 1336
 				$style = $itemStyle;
1337 1337
 			else
1338 1338
 				$style = $alternatingItemStyle;
1339
-			if($style && $item instanceof IStyleable)
1339
+			if ($style && $item instanceof IStyleable)
1340 1340
 				$item->getStyle()->mergeWith($style);
1341 1341
 		}
1342 1342
 
1343 1343
 		// apply separator style if any
1344
-		if(($separatorStyle = $this->getViewState('SeparatorStyle', null)) !== null && $this->getHasSeparators())
1344
+		if (($separatorStyle = $this->getViewState('SeparatorStyle', null)) !== null && $this->getHasSeparators())
1345 1345
 		{
1346 1346
 			$controls = $this->getControls();
1347 1347
 			$count = $controls->getCount();
1348
-			for($i = $this->_header?2:1;$i < $count;$i += 2)
1348
+			for ($i = $this->_header ? 2 : 1; $i < $count; $i += 2)
1349 1349
 			{
1350
-				if(($separator = $controls->itemAt($i)) instanceof IStyleable)
1350
+				if (($separator = $controls->itemAt($i)) instanceof IStyleable)
1351 1351
 					$separator->getStyle()->mergeWith($separatorStyle);
1352 1352
 			}
1353 1353
 		}
@@ -1360,7 +1360,7 @@  discard block
 block discarded – undo
1360 1360
 	public function saveState()
1361 1361
 	{
1362 1362
 		parent::saveState();
1363
-		if($this->_items)
1363
+		if ($this->_items)
1364 1364
 			$this->setViewState('ItemCount', $this->_items->getCount(), 0);
1365 1365
 		else
1366 1366
 			$this->clearViewState('ItemCount');
@@ -1373,7 +1373,7 @@  discard block
 block discarded – undo
1373 1373
 	public function loadState()
1374 1374
 	{
1375 1375
 		parent::loadState();
1376
-		if(!$this->getIsDataBound())
1376
+		if (!$this->getIsDataBound())
1377 1377
 			$this->restoreItemsFromViewState();
1378 1378
 		$this->clearViewState('ItemCount');
1379 1379
 	}
@@ -1395,23 +1395,23 @@  discard block
 block discarded – undo
1395 1395
 	protected function restoreItemsFromViewState()
1396 1396
 	{
1397 1397
 		$this->reset();
1398
-		if(($itemCount = $this->getViewState('ItemCount', 0)) > 0)
1398
+		if (($itemCount = $this->getViewState('ItemCount', 0)) > 0)
1399 1399
 		{
1400 1400
 			$items = $this->getItems();
1401 1401
 			$selectedIndex = $this->getSelectedItemIndex();
1402 1402
 			$editIndex = $this->getEditItemIndex();
1403 1403
 			$hasSeparator = $this->_separatorTemplate !== null || $this->getSeparatorRenderer() !== '';
1404 1404
 			$this->_header = $this->createItemInternal(-1, TListItemType::Header);
1405
-			for($i = 0;$i < $itemCount;++$i)
1405
+			for ($i = 0; $i < $itemCount; ++$i)
1406 1406
 			{
1407
-				if($hasSeparator && $i > 0)
1407
+				if ($hasSeparator && $i > 0)
1408 1408
 					$this->createItemInternal($i - 1, TListItemType::Separator);
1409
-				if($i === $editIndex)
1409
+				if ($i === $editIndex)
1410 1410
 					$itemType = TListItemType::EditItem;
1411
-				elseif($i === $selectedIndex)
1411
+				elseif ($i === $selectedIndex)
1412 1412
 					$itemType = TListItemType::SelectedItem;
1413 1413
 				else
1414
-					$itemType = $i % 2?TListItemType::AlternatingItem : TListItemType::Item;
1414
+					$itemType = $i % 2 ?TListItemType::AlternatingItem : TListItemType::Item;
1415 1415
 				$items->add($this->createItemInternal($i, $itemType));
1416 1416
 			}
1417 1417
 			$this->_footer = $this->createItemInternal(-1, TListItemType::Footer);
@@ -1438,26 +1438,26 @@  discard block
 block discarded – undo
1438 1438
 		$hasSeparator = $this->_separatorTemplate !== null || $this->getSeparatorRenderer() !== '';
1439 1439
 		$selectedIndex = $this->getSelectedItemIndex();
1440 1440
 		$editIndex = $this->getEditItemIndex();
1441
-		foreach($data as $key => $dataItem)
1441
+		foreach ($data as $key => $dataItem)
1442 1442
 		{
1443
-			if($keyField !== '')
1443
+			if ($keyField !== '')
1444 1444
 				$keys->add($this->getDataFieldValue($dataItem, $keyField));
1445 1445
 			else
1446 1446
 				$keys->add($key);
1447
-			if($itemIndex === 0)
1447
+			if ($itemIndex === 0)
1448 1448
 				$this->_header = $this->createItemWithDataInternal(-1, TListItemType::Header, null);
1449
-			if($hasSeparator && $itemIndex > 0)
1449
+			if ($hasSeparator && $itemIndex > 0)
1450 1450
 				$this->createItemWithDataInternal($itemIndex - 1, TListItemType::Separator, null);
1451
-			if($itemIndex === $editIndex)
1451
+			if ($itemIndex === $editIndex)
1452 1452
 				$itemType = TListItemType::EditItem;
1453
-			elseif($itemIndex === $selectedIndex)
1453
+			elseif ($itemIndex === $selectedIndex)
1454 1454
 				$itemType = TListItemType::SelectedItem;
1455 1455
 			else
1456
-				$itemType = $itemIndex % 2?TListItemType::AlternatingItem : TListItemType::Item;
1456
+				$itemType = $itemIndex % 2 ?TListItemType::AlternatingItem : TListItemType::Item;
1457 1457
 			$items->add($this->createItemWithDataInternal($itemIndex, $itemType, $dataItem));
1458 1458
 			$itemIndex++;
1459 1459
 		}
1460
-		if($itemIndex > 0)
1460
+		if ($itemIndex > 0)
1461 1461
 			$this->_footer = $this->createItemWithDataInternal(-1, TListItemType::Footer, null);
1462 1462
 		else
1463 1463
 		{
@@ -1474,15 +1474,15 @@  discard block
 block discarded – undo
1474 1474
 	 */
1475 1475
 	public function render($writer)
1476 1476
 	{
1477
-		if($this->getHasControls())
1477
+		if ($this->getHasControls())
1478 1478
 		{
1479
-			if($this->getItemCount() > 0)
1479
+			if ($this->getItemCount() > 0)
1480 1480
 			{
1481 1481
 				$this->applyItemStyles();
1482 1482
 				$repeatInfo = $this->getRepeatInfo();
1483 1483
 				$repeatInfo->renderRepeater($writer, $this);
1484 1484
 			}
1485
-			elseif($this->_emptyTemplate !== null || $this->getEmptyRenderer() !== '')
1485
+			elseif ($this->_emptyTemplate !== null || $this->getEmptyRenderer() !== '')
1486 1486
 				parent::render($writer);
1487 1487
 		}
1488 1488
 	}
Please login to merge, or discard this patch.
Braces   +200 added lines, -163 removed lines patch added patch discarded remove patch
@@ -188,8 +188,9 @@  discard block
 block discarded – undo
188 188
 	 */
189 189
 	public function getItems()
190 190
 	{
191
-		if(!$this->_items)
192
-			$this->_items = new TDataListItemCollection;
191
+		if(!$this->_items) {
192
+					$this->_items = new TDataListItemCollection;
193
+		}
193 194
 		return $this->_items;
194 195
 	}
195 196
 
@@ -408,10 +409,11 @@  discard block
 block discarded – undo
408 409
 	 */
409 410
 	public function setItemTemplate($value)
410 411
 	{
411
-		if($value instanceof ITemplate || $value === null)
412
-			$this->_itemTemplate = $value;
413
-		else
414
-			throw new TInvalidDataTypeException('datalist_template_required', 'ItemTemplate');
412
+		if($value instanceof ITemplate || $value === null) {
413
+					$this->_itemTemplate = $value;
414
+		} else {
415
+					throw new TInvalidDataTypeException('datalist_template_required', 'ItemTemplate');
416
+		}
415 417
 	}
416 418
 
417 419
 	/**
@@ -441,10 +443,11 @@  discard block
 block discarded – undo
441 443
 	 */
442 444
 	public function setAlternatingItemTemplate($value)
443 445
 	{
444
-		if($value instanceof ITemplate || $value === null)
445
-			$this->_alternatingItemTemplate = $value;
446
-		else
447
-			throw new TInvalidDataTypeException('datalist_template_required', 'AlternatingItemType');
446
+		if($value instanceof ITemplate || $value === null) {
447
+					$this->_alternatingItemTemplate = $value;
448
+		} else {
449
+					throw new TInvalidDataTypeException('datalist_template_required', 'AlternatingItemType');
450
+		}
448 451
 	}
449 452
 
450 453
 	/**
@@ -474,10 +477,11 @@  discard block
 block discarded – undo
474 477
 	 */
475 478
 	public function setSelectedItemTemplate($value)
476 479
 	{
477
-		if($value instanceof ITemplate || $value === null)
478
-			$this->_selectedItemTemplate = $value;
479
-		else
480
-			throw new TInvalidDataTypeException('datalist_template_required', 'SelectedItemTemplate');
480
+		if($value instanceof ITemplate || $value === null) {
481
+					$this->_selectedItemTemplate = $value;
482
+		} else {
483
+					throw new TInvalidDataTypeException('datalist_template_required', 'SelectedItemTemplate');
484
+		}
481 485
 	}
482 486
 
483 487
 	/**
@@ -507,10 +511,11 @@  discard block
 block discarded – undo
507 511
 	 */
508 512
 	public function setEditItemTemplate($value)
509 513
 	{
510
-		if($value instanceof ITemplate || $value === null)
511
-			$this->_editItemTemplate = $value;
512
-		else
513
-			throw new TInvalidDataTypeException('datalist_template_required', 'EditItemTemplate');
514
+		if($value instanceof ITemplate || $value === null) {
515
+					$this->_editItemTemplate = $value;
516
+		} else {
517
+					throw new TInvalidDataTypeException('datalist_template_required', 'EditItemTemplate');
518
+		}
514 519
 	}
515 520
 
516 521
 	/**
@@ -540,10 +545,11 @@  discard block
 block discarded – undo
540 545
 	 */
541 546
 	public function setHeaderTemplate($value)
542 547
 	{
543
-		if($value instanceof ITemplate || $value === null)
544
-			$this->_headerTemplate = $value;
545
-		else
546
-			throw new TInvalidDataTypeException('datalist_template_required', 'HeaderTemplate');
548
+		if($value instanceof ITemplate || $value === null) {
549
+					$this->_headerTemplate = $value;
550
+		} else {
551
+					throw new TInvalidDataTypeException('datalist_template_required', 'HeaderTemplate');
552
+		}
547 553
 	}
548 554
 
549 555
 	/**
@@ -581,10 +587,11 @@  discard block
 block discarded – undo
581 587
 	 */
582 588
 	public function setFooterTemplate($value)
583 589
 	{
584
-		if($value instanceof ITemplate || $value === null)
585
-			$this->_footerTemplate = $value;
586
-		else
587
-			throw new TInvalidDataTypeException('datalist_template_required', 'FooterTemplate');
590
+		if($value instanceof ITemplate || $value === null) {
591
+					$this->_footerTemplate = $value;
592
+		} else {
593
+					throw new TInvalidDataTypeException('datalist_template_required', 'FooterTemplate');
594
+		}
588 595
 	}
589 596
 
590 597
 	/**
@@ -622,10 +629,11 @@  discard block
 block discarded – undo
622 629
 	 */
623 630
 	public function setEmptyTemplate($value)
624 631
 	{
625
-		if($value instanceof ITemplate || $value === null)
626
-			$this->_emptyTemplate = $value;
627
-		else
628
-			throw new TInvalidDataTypeException('datalist_template_required', 'EmptyTemplate');
632
+		if($value instanceof ITemplate || $value === null) {
633
+					$this->_emptyTemplate = $value;
634
+		} else {
635
+					throw new TInvalidDataTypeException('datalist_template_required', 'EmptyTemplate');
636
+		}
629 637
 	}
630 638
 
631 639
 	/**
@@ -642,10 +650,11 @@  discard block
 block discarded – undo
642 650
 	 */
643 651
 	public function setSeparatorTemplate($value)
644 652
 	{
645
-		if($value instanceof ITemplate || $value === null)
646
-			$this->_separatorTemplate = $value;
647
-		else
648
-			throw new TInvalidDataTypeException('datalist_template_required', 'SeparatorTemplate');
653
+		if($value instanceof ITemplate || $value === null) {
654
+					$this->_separatorTemplate = $value;
655
+		} else {
656
+					throw new TInvalidDataTypeException('datalist_template_required', 'SeparatorTemplate');
657
+		}
649 658
 	}
650 659
 
651 660
 	/**
@@ -679,8 +688,9 @@  discard block
 block discarded – undo
679 688
 	 */
680 689
 	public function setSelectedItemIndex($value)
681 690
 	{
682
-		if(($value = TPropertyValue::ensureInteger($value)) < 0)
683
-			$value = -1;
691
+		if(($value = TPropertyValue::ensureInteger($value)) < 0) {
692
+					$value = -1;
693
+		}
684 694
 		if(($current = $this->getSelectedItemIndex()) !== $value)
685 695
 		{
686 696
 			$this->setViewState('SelectedItemIndex', $value, -1);
@@ -689,14 +699,16 @@  discard block
 block discarded – undo
689 699
 			if($current >= 0 && $current < $itemCount)
690 700
 			{
691 701
 				$item = $items->itemAt($current);
692
-				if(($item instanceof IItemDataRenderer) && $item->getItemType() !== TListItemType::EditItem)
693
-					$item->setItemType($current % 2?TListItemType::AlternatingItem : TListItemType::Item);
702
+				if(($item instanceof IItemDataRenderer) && $item->getItemType() !== TListItemType::EditItem) {
703
+									$item->setItemType($current % 2?TListItemType::AlternatingItem : TListItemType::Item);
704
+				}
694 705
 			}
695 706
 			if($value >= 0 && $value < $itemCount)
696 707
 			{
697 708
 				$item = $items->itemAt($value);
698
-				if(($item instanceof IItemDataRenderer) && $item->getItemType() !== TListItemType::EditItem)
699
-					$item->setItemType(TListItemType::SelectedItem);
709
+				if(($item instanceof IItemDataRenderer) && $item->getItemType() !== TListItemType::EditItem) {
710
+									$item->setItemType(TListItemType::SelectedItem);
711
+				}
700 712
 			}
701 713
 		}
702 714
 	}
@@ -708,10 +720,11 @@  discard block
 block discarded – undo
708 720
 	{
709 721
 		$index = $this->getSelectedItemIndex();
710 722
 		$items = $this->getItems();
711
-		if($index >= 0 && $index < $items->getCount())
712
-			return $items->itemAt($index);
713
-		else
714
-			return null;
723
+		if($index >= 0 && $index < $items->getCount()) {
724
+					return $items->itemAt($index);
725
+		} else {
726
+					return null;
727
+		}
715 728
 	}
716 729
 
717 730
 	/**
@@ -720,14 +733,16 @@  discard block
 block discarded – undo
720 733
 	 */
721 734
 	public function getSelectedDataKey()
722 735
 	{
723
-		if($this->getDataKeyField() === '')
724
-			throw new TInvalidOperationException('datalist_datakeyfield_required');
736
+		if($this->getDataKeyField() === '') {
737
+					throw new TInvalidOperationException('datalist_datakeyfield_required');
738
+		}
725 739
 		$index = $this->getSelectedItemIndex();
726 740
 		$dataKeys = $this->getDataKeys();
727
-		if($index >= 0 && $index < $dataKeys->getCount())
728
-			return $dataKeys->itemAt($index);
729
-		else
730
-			return null;
741
+		if($index >= 0 && $index < $dataKeys->getCount()) {
742
+					return $dataKeys->itemAt($index);
743
+		} else {
744
+					return null;
745
+		}
731 746
 	}
732 747
 
733 748
 	/**
@@ -747,17 +762,20 @@  discard block
 block discarded – undo
747 762
 	 */
748 763
 	public function setEditItemIndex($value)
749 764
 	{
750
-		if(($value = TPropertyValue::ensureInteger($value)) < 0)
751
-			$value = -1;
765
+		if(($value = TPropertyValue::ensureInteger($value)) < 0) {
766
+					$value = -1;
767
+		}
752 768
 		if(($current = $this->getEditItemIndex()) !== $value)
753 769
 		{
754 770
 			$this->setViewState('EditItemIndex', $value, -1);
755 771
 			$items = $this->getItems();
756 772
 			$itemCount = $items->getCount();
757
-			if($current >= 0 && $current < $itemCount)
758
-				$items->itemAt($current)->setItemType($current % 2?TListItemType::AlternatingItem : TListItemType::Item);
759
-			if($value >= 0 && $value < $itemCount)
760
-				$items->itemAt($value)->setItemType(TListItemType::EditItem);
773
+			if($current >= 0 && $current < $itemCount) {
774
+							$items->itemAt($current)->setItemType($current % 2?TListItemType::AlternatingItem : TListItemType::Item);
775
+			}
776
+			if($value >= 0 && $value < $itemCount) {
777
+							$items->itemAt($value)->setItemType(TListItemType::EditItem);
778
+			}
761 779
 		}
762 780
 	}
763 781
 
@@ -768,10 +786,11 @@  discard block
 block discarded – undo
768 786
 	{
769 787
 		$index = $this->getEditItemIndex();
770 788
 		$items = $this->getItems();
771
-		if($index >= 0 && $index < $items->getCount())
772
-			return $items->itemAt($index);
773
-		else
774
-			return null;
789
+		if($index >= 0 && $index < $items->getCount()) {
790
+					return $items->itemAt($index);
791
+		} else {
792
+					return null;
793
+		}
775 794
 	}
776 795
 
777 796
 	/**
@@ -920,27 +939,24 @@  discard block
 block discarded – undo
920 939
 			$command = $param->getCommandName();
921 940
 			if(strcasecmp($command, self::CMD_SELECT) === 0)
922 941
 			{
923
-				if(($item = $param->getItem()) instanceof IItemDataRenderer)
924
-					$this->setSelectedItemIndex($item->getItemIndex());
942
+				if(($item = $param->getItem()) instanceof IItemDataRenderer) {
943
+									$this->setSelectedItemIndex($item->getItemIndex());
944
+				}
925 945
 				$this->onSelectedIndexChanged($param);
926 946
 				return true;
927
-			}
928
-			elseif(strcasecmp($command, self::CMD_EDIT) === 0)
947
+			} elseif(strcasecmp($command, self::CMD_EDIT) === 0)
929 948
 			{
930 949
 				$this->onEditCommand($param);
931 950
 				return true;
932
-			}
933
-			elseif(strcasecmp($command, self::CMD_DELETE) === 0)
951
+			} elseif(strcasecmp($command, self::CMD_DELETE) === 0)
934 952
 			{
935 953
 				$this->onDeleteCommand($param);
936 954
 				return true;
937
-			}
938
-			elseif(strcasecmp($command, self::CMD_UPDATE) === 0)
955
+			} elseif(strcasecmp($command, self::CMD_UPDATE) === 0)
939 956
 			{
940 957
 				$this->onUpdateCommand($param);
941 958
 				return true;
942
-			}
943
-			elseif(strcasecmp($command, self::CMD_CANCEL) === 0)
959
+			} elseif(strcasecmp($command, self::CMD_CANCEL) === 0)
944 960
 			{
945 961
 				$this->onCancelCommand($param);
946 962
 				return true;
@@ -1078,9 +1094,9 @@  discard block
 block discarded – undo
1078 1094
 			$style = $item->getStyle();
1079 1095
 			$item->clearStyle();
1080 1096
 			return $style;
1097
+		} else {
1098
+					return null;
1081 1099
 		}
1082
-		else
1083
-			return null;
1084 1100
 	}
1085 1101
 
1086 1102
 	/**
@@ -1094,8 +1110,9 @@  discard block
 block discarded – undo
1094 1110
 	public function renderItem($writer, $repeatInfo, $itemType, $index)
1095 1111
 	{
1096 1112
 		$item = $this->getItem($itemType, $index);
1097
-		if($repeatInfo->getRepeatLayout() === TRepeatLayout::Raw && get_class($item) === 'TDataListItem')
1098
-			$item->setTagName('div');
1113
+		if($repeatInfo->getRepeatLayout() === TRepeatLayout::Raw && get_class($item) === 'TDataListItem') {
1114
+					$item->setTagName('div');
1115
+		}
1099 1116
 		$item->renderControl($writer);
1100 1117
 	}
1101 1118
 
@@ -1119,8 +1136,9 @@  discard block
 block discarded – undo
1119 1136
 				return $this->getControls()->itemAt($this->getControls()->getCount() - 1);
1120 1137
 			case TListItemType::Separator:
1121 1138
 				$i = $index + $index + 1;
1122
-				if($this->_headerTemplate !== null || $this->getHeaderRenderer() !== '')
1123
-					$i++;
1139
+				if($this->_headerTemplate !== null || $this->getHeaderRenderer() !== '') {
1140
+									$i++;
1141
+				}
1124 1142
 				return $this->getControls()->itemAt($i);
1125 1143
 		}
1126 1144
 		return null;
@@ -1141,9 +1159,9 @@  discard block
 block discarded – undo
1141 1159
 			$this->onItemCreated($param);
1142 1160
 			$this->getControls()->add($item);
1143 1161
 			return $item;
1162
+		} else {
1163
+					return null;
1144 1164
 		}
1145
-		else
1146
-			return null;
1147 1165
 	}
1148 1166
 
1149 1167
 	/**
@@ -1159,45 +1177,49 @@  discard block
 block discarded – undo
1159 1177
 		if(($item = $this->createItem($itemIndex, $itemType)) !== null)
1160 1178
 		{
1161 1179
 			$param = new TDataListItemEventParameter($item);
1162
-			if($item instanceof \Prado\IDataRenderer)
1163
-				$item->setData($dataItem);
1180
+			if($item instanceof \Prado\IDataRenderer) {
1181
+							$item->setData($dataItem);
1182
+			}
1164 1183
 			$this->onItemCreated($param);
1165 1184
 			$this->getControls()->add($item);
1166 1185
 			$item->dataBind();
1167 1186
 			$this->onItemDataBound($param);
1168 1187
 			return $item;
1188
+		} else {
1189
+					return null;
1169 1190
 		}
1170
-		else
1171
-			return null;
1172 1191
 	}
1173 1192
 
1174 1193
 	private function getAlternatingItemDisplay()
1175 1194
 	{
1176
-		if(($classPath = $this->getAlternatingItemRenderer()) === '' && $this->_alternatingItemTemplate === null)
1177
-			return [$this->getItemRenderer(),$this->_itemTemplate];
1178
-		else
1179
-			return [$classPath,$this->_alternatingItemTemplate];
1195
+		if(($classPath = $this->getAlternatingItemRenderer()) === '' && $this->_alternatingItemTemplate === null) {
1196
+					return [$this->getItemRenderer(),$this->_itemTemplate];
1197
+		} else {
1198
+					return [$classPath,$this->_alternatingItemTemplate];
1199
+		}
1180 1200
 	}
1181 1201
 
1182 1202
 	private function getSelectedItemDisplay($itemIndex)
1183 1203
 	{
1184 1204
 		if(($classPath = $this->getSelectedItemRenderer()) === '' && $this->_selectedItemTemplate === null)
1185 1205
 		{
1186
-			if($itemIndex % 2 === 0)
1187
-				return [$this->getItemRenderer(),$this->_itemTemplate];
1188
-			else
1189
-				return $this->getAlternatingItemDisplay();
1206
+			if($itemIndex % 2 === 0) {
1207
+							return [$this->getItemRenderer(),$this->_itemTemplate];
1208
+			} else {
1209
+							return $this->getAlternatingItemDisplay();
1210
+			}
1211
+		} else {
1212
+					return [$classPath,$this->_selectedItemTemplate];
1190 1213
 		}
1191
-		else
1192
-			return [$classPath,$this->_selectedItemTemplate];
1193 1214
 	}
1194 1215
 
1195 1216
 	private function getEditItemDisplay($itemIndex)
1196 1217
 	{
1197
-		if(($classPath = $this->getEditItemRenderer()) === '' && $this->_editItemTemplate === null)
1198
-			return $this->getSelectedItemDisplay($itemIndex);
1199
-		else
1200
-			return [$classPath,$this->_editItemTemplate];
1218
+		if(($classPath = $this->getEditItemRenderer()) === '' && $this->_editItemTemplate === null) {
1219
+					return $this->getSelectedItemDisplay($itemIndex);
1220
+		} else {
1221
+					return [$classPath,$this->_editItemTemplate];
1222
+		}
1201 1223
 	}
1202 1224
 
1203 1225
 	/**
@@ -1248,16 +1270,15 @@  discard block
 block discarded – undo
1248 1270
 				$item->setItemIndex($itemIndex);
1249 1271
 				$item->setItemType($itemType);
1250 1272
 			}
1251
-		}
1252
-		elseif($template !== null)
1273
+		} elseif($template !== null)
1253 1274
 		{
1254 1275
 			$item = new TDataListItem;
1255 1276
 			$item->setItemIndex($itemIndex);
1256 1277
 			$item->setItemType($itemType);
1257 1278
 			$template->instantiateIn($item);
1279
+		} else {
1280
+					$item = null;
1258 1281
 		}
1259
-		else
1260
-			$item = null;
1261 1282
 
1262 1283
 		return $item;
1263 1284
 	}
@@ -1267,10 +1288,11 @@  discard block
 block discarded – undo
1267 1288
 	 */
1268 1289
 	protected function createEmptyContent()
1269 1290
 	{
1270
-		if(($classPath = $this->getEmptyRenderer()) !== '')
1271
-			$this->getControls()->add(Prado::createComponent($classPath));
1272
-		elseif($this->_emptyTemplate !== null)
1273
-			$this->_emptyTemplate->instantiateIn($this);
1291
+		if(($classPath = $this->getEmptyRenderer()) !== '') {
1292
+					$this->getControls()->add(Prado::createComponent($classPath));
1293
+		} elseif($this->_emptyTemplate !== null) {
1294
+					$this->_emptyTemplate->instantiateIn($this);
1295
+		}
1274 1296
 	}
1275 1297
 
1276 1298
 	/**
@@ -1291,10 +1313,11 @@  discard block
 block discarded – undo
1291 1313
 		$alternatingItemStyle = $this->getViewState('AlternatingItemStyle', null);
1292 1314
 		if($itemStyle !== null)
1293 1315
 		{
1294
-			if($alternatingItemStyle === null)
1295
-				$alternatingItemStyle = $itemStyle;
1296
-			else
1297
-				$alternatingItemStyle->mergeWith($itemStyle);
1316
+			if($alternatingItemStyle === null) {
1317
+							$alternatingItemStyle = $itemStyle;
1318
+			} else {
1319
+							$alternatingItemStyle->mergeWith($itemStyle);
1320
+			}
1298 1321
 		}
1299 1322
 
1300 1323
 		$selectedItemStyle = $this->getViewState('SelectedItemStyle', null);
@@ -1302,24 +1325,27 @@  discard block
 block discarded – undo
1302 1325
 		$editItemStyle = $this->getViewState('EditItemStyle', null);
1303 1326
 		if($selectedItemStyle !== null)
1304 1327
 		{
1305
-			if($editItemStyle === null)
1306
-				$editItemStyle = $selectedItemStyle;
1307
-			else
1308
-				$editItemStyle->mergeWith($selectedItemStyle);
1328
+			if($editItemStyle === null) {
1329
+							$editItemStyle = $selectedItemStyle;
1330
+			} else {
1331
+							$editItemStyle->mergeWith($selectedItemStyle);
1332
+			}
1309 1333
 		}
1310 1334
 
1311 1335
 		// apply header style if any
1312 1336
 		if($this->_header !== null && $this->_header instanceof IStyleable)
1313 1337
 		{
1314
-			if($headerStyle = $this->getViewState('HeaderStyle', null))
1315
-				$this->_header->getStyle()->mergeWith($headerStyle);
1338
+			if($headerStyle = $this->getViewState('HeaderStyle', null)) {
1339
+							$this->_header->getStyle()->mergeWith($headerStyle);
1340
+			}
1316 1341
 		}
1317 1342
 
1318 1343
 		// apply footer style if any
1319 1344
 		if($this->_footer !== null && $this->_footer instanceof IStyleable)
1320 1345
 		{
1321
-			if($footerStyle = $this->getViewState('FooterStyle', null))
1322
-				$this->_footer->getStyle()->mergeWith($footerStyle);
1346
+			if($footerStyle = $this->getViewState('FooterStyle', null)) {
1347
+							$this->_footer->getStyle()->mergeWith($footerStyle);
1348
+			}
1323 1349
 		}
1324 1350
 
1325 1351
 		$selectedIndex = $this->getSelectedItemIndex();
@@ -1328,16 +1354,18 @@  discard block
 block discarded – undo
1328 1354
 		// apply item styles if any
1329 1355
 		foreach($this->getItems() as $index => $item)
1330 1356
 		{
1331
-			if($index === $editIndex)
1332
-				$style = $editItemStyle;
1333
-			elseif($index === $selectedIndex)
1334
-				$style = $selectedItemStyle;
1335
-			elseif($index % 2 === 0)
1336
-				$style = $itemStyle;
1337
-			else
1338
-				$style = $alternatingItemStyle;
1339
-			if($style && $item instanceof IStyleable)
1340
-				$item->getStyle()->mergeWith($style);
1357
+			if($index === $editIndex) {
1358
+							$style = $editItemStyle;
1359
+			} elseif($index === $selectedIndex) {
1360
+							$style = $selectedItemStyle;
1361
+			} elseif($index % 2 === 0) {
1362
+							$style = $itemStyle;
1363
+			} else {
1364
+							$style = $alternatingItemStyle;
1365
+			}
1366
+			if($style && $item instanceof IStyleable) {
1367
+							$item->getStyle()->mergeWith($style);
1368
+			}
1341 1369
 		}
1342 1370
 
1343 1371
 		// apply separator style if any
@@ -1347,8 +1375,9 @@  discard block
 block discarded – undo
1347 1375
 			$count = $controls->getCount();
1348 1376
 			for($i = $this->_header?2:1;$i < $count;$i += 2)
1349 1377
 			{
1350
-				if(($separator = $controls->itemAt($i)) instanceof IStyleable)
1351
-					$separator->getStyle()->mergeWith($separatorStyle);
1378
+				if(($separator = $controls->itemAt($i)) instanceof IStyleable) {
1379
+									$separator->getStyle()->mergeWith($separatorStyle);
1380
+				}
1352 1381
 			}
1353 1382
 		}
1354 1383
 	}
@@ -1360,10 +1389,11 @@  discard block
 block discarded – undo
1360 1389
 	public function saveState()
1361 1390
 	{
1362 1391
 		parent::saveState();
1363
-		if($this->_items)
1364
-			$this->setViewState('ItemCount', $this->_items->getCount(), 0);
1365
-		else
1366
-			$this->clearViewState('ItemCount');
1392
+		if($this->_items) {
1393
+					$this->setViewState('ItemCount', $this->_items->getCount(), 0);
1394
+		} else {
1395
+					$this->clearViewState('ItemCount');
1396
+		}
1367 1397
 	}
1368 1398
 
1369 1399
 	/**
@@ -1373,8 +1403,9 @@  discard block
 block discarded – undo
1373 1403
 	public function loadState()
1374 1404
 	{
1375 1405
 		parent::loadState();
1376
-		if(!$this->getIsDataBound())
1377
-			$this->restoreItemsFromViewState();
1406
+		if(!$this->getIsDataBound()) {
1407
+					$this->restoreItemsFromViewState();
1408
+		}
1378 1409
 		$this->clearViewState('ItemCount');
1379 1410
 	}
1380 1411
 
@@ -1404,20 +1435,22 @@  discard block
 block discarded – undo
1404 1435
 			$this->_header = $this->createItemInternal(-1, TListItemType::Header);
1405 1436
 			for($i = 0;$i < $itemCount;++$i)
1406 1437
 			{
1407
-				if($hasSeparator && $i > 0)
1408
-					$this->createItemInternal($i - 1, TListItemType::Separator);
1409
-				if($i === $editIndex)
1410
-					$itemType = TListItemType::EditItem;
1411
-				elseif($i === $selectedIndex)
1412
-					$itemType = TListItemType::SelectedItem;
1413
-				else
1414
-					$itemType = $i % 2?TListItemType::AlternatingItem : TListItemType::Item;
1438
+				if($hasSeparator && $i > 0) {
1439
+									$this->createItemInternal($i - 1, TListItemType::Separator);
1440
+				}
1441
+				if($i === $editIndex) {
1442
+									$itemType = TListItemType::EditItem;
1443
+				} elseif($i === $selectedIndex) {
1444
+									$itemType = TListItemType::SelectedItem;
1445
+				} else {
1446
+									$itemType = $i % 2?TListItemType::AlternatingItem : TListItemType::Item;
1447
+				}
1415 1448
 				$items->add($this->createItemInternal($i, $itemType));
1416 1449
 			}
1417 1450
 			$this->_footer = $this->createItemInternal(-1, TListItemType::Footer);
1451
+		} else {
1452
+					$this->createEmptyContent();
1418 1453
 		}
1419
-		else
1420
-			$this->createEmptyContent();
1421 1454
 		$this->clearChildState();
1422 1455
 	}
1423 1456
 
@@ -1440,26 +1473,30 @@  discard block
 block discarded – undo
1440 1473
 		$editIndex = $this->getEditItemIndex();
1441 1474
 		foreach($data as $key => $dataItem)
1442 1475
 		{
1443
-			if($keyField !== '')
1444
-				$keys->add($this->getDataFieldValue($dataItem, $keyField));
1445
-			else
1446
-				$keys->add($key);
1447
-			if($itemIndex === 0)
1448
-				$this->_header = $this->createItemWithDataInternal(-1, TListItemType::Header, null);
1449
-			if($hasSeparator && $itemIndex > 0)
1450
-				$this->createItemWithDataInternal($itemIndex - 1, TListItemType::Separator, null);
1451
-			if($itemIndex === $editIndex)
1452
-				$itemType = TListItemType::EditItem;
1453
-			elseif($itemIndex === $selectedIndex)
1454
-				$itemType = TListItemType::SelectedItem;
1455
-			else
1456
-				$itemType = $itemIndex % 2?TListItemType::AlternatingItem : TListItemType::Item;
1476
+			if($keyField !== '') {
1477
+							$keys->add($this->getDataFieldValue($dataItem, $keyField));
1478
+			} else {
1479
+							$keys->add($key);
1480
+			}
1481
+			if($itemIndex === 0) {
1482
+							$this->_header = $this->createItemWithDataInternal(-1, TListItemType::Header, null);
1483
+			}
1484
+			if($hasSeparator && $itemIndex > 0) {
1485
+							$this->createItemWithDataInternal($itemIndex - 1, TListItemType::Separator, null);
1486
+			}
1487
+			if($itemIndex === $editIndex) {
1488
+							$itemType = TListItemType::EditItem;
1489
+			} elseif($itemIndex === $selectedIndex) {
1490
+							$itemType = TListItemType::SelectedItem;
1491
+			} else {
1492
+							$itemType = $itemIndex % 2?TListItemType::AlternatingItem : TListItemType::Item;
1493
+			}
1457 1494
 			$items->add($this->createItemWithDataInternal($itemIndex, $itemType, $dataItem));
1458 1495
 			$itemIndex++;
1459 1496
 		}
1460
-		if($itemIndex > 0)
1461
-			$this->_footer = $this->createItemWithDataInternal(-1, TListItemType::Footer, null);
1462
-		else
1497
+		if($itemIndex > 0) {
1498
+					$this->_footer = $this->createItemWithDataInternal(-1, TListItemType::Footer, null);
1499
+		} else
1463 1500
 		{
1464 1501
 			$this->createEmptyContent();
1465 1502
 			$this->dataBindChildren();
@@ -1481,9 +1518,9 @@  discard block
 block discarded – undo
1481 1518
 				$this->applyItemStyles();
1482 1519
 				$repeatInfo = $this->getRepeatInfo();
1483 1520
 				$repeatInfo->renderRepeater($writer, $this);
1521
+			} elseif($this->_emptyTemplate !== null || $this->getEmptyRenderer() !== '') {
1522
+							parent::render($writer);
1484 1523
 			}
1485
-			elseif($this->_emptyTemplate !== null || $this->getEmptyRenderer() !== '')
1486
-				parent::render($writer);
1487 1524
 		}
1488 1525
 	}
1489 1526
 }
1490 1527
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TReadOnlyDataSource.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
 	public function __construct($dataSource, $dataMember)
29 29
 	{
30
-		if(!is_array($dataSource) && !($dataSource instanceof IDataSource) && !($dataSource instanceof \Traversable))
30
+		if (!is_array($dataSource) && !($dataSource instanceof IDataSource) && !($dataSource instanceof \Traversable))
31 31
 			throw new TInvalidDataTypeException('readonlydatasource_datasource_invalid');
32 32
 		$this->_dataSource = $dataSource;
33 33
 		$this->_dataMember = $dataMember;
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 
36 36
 	public function getView($viewName)
37 37
 	{
38
-		if($this->_dataSource instanceof IDataSource)
38
+		if ($this->_dataSource instanceof IDataSource)
39 39
 			return $this->_dataSource->getView($viewName);
40 40
 		else
41 41
 			return new TReadOnlyDataSourceView($this, $this->_dataMember, $this->_dataSource);
Please login to merge, or discard this patch.
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,17 +27,19 @@
 block discarded – undo
27 27
 
28 28
 	public function __construct($dataSource, $dataMember)
29 29
 	{
30
-		if(!is_array($dataSource) && !($dataSource instanceof IDataSource) && !($dataSource instanceof \Traversable))
31
-			throw new TInvalidDataTypeException('readonlydatasource_datasource_invalid');
30
+		if(!is_array($dataSource) && !($dataSource instanceof IDataSource) && !($dataSource instanceof \Traversable)) {
31
+					throw new TInvalidDataTypeException('readonlydatasource_datasource_invalid');
32
+		}
32 33
 		$this->_dataSource = $dataSource;
33 34
 		$this->_dataMember = $dataMember;
34 35
 	}
35 36
 
36 37
 	public function getView($viewName)
37 38
 	{
38
-		if($this->_dataSource instanceof IDataSource)
39
-			return $this->_dataSource->getView($viewName);
40
-		else
41
-			return new TReadOnlyDataSourceView($this, $this->_dataMember, $this->_dataSource);
39
+		if($this->_dataSource instanceof IDataSource) {
40
+					return $this->_dataSource->getView($viewName);
41
+		} else {
42
+					return new TReadOnlyDataSourceView($this, $this->_dataMember, $this->_dataSource);
43
+		}
42 44
 	}
43 45
 }
44 46
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TStyleSheet.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -104,13 +104,13 @@  discard block
 block discarded – undo
104 104
 		$cs = $this->getPage()->getClientScript();
105 105
 
106 106
 		$styles = preg_split('/,|\s+/', $this->getPradoStyles());
107
-		foreach($styles as $style)
107
+		foreach ($styles as $style)
108 108
 		{
109
-			if(($style = trim($style)) !== '')
109
+			if (($style = trim($style)) !== '')
110 110
 				$cs->registerPradoStyle($style);
111 111
 		}
112 112
 
113
-		if(($url = $this->getStyleSheetUrl()) !== '')
113
+		if (($url = $this->getStyleSheetUrl()) !== '')
114 114
 			$cs->registerStyleSheetFile($url, $url, $this->getMediaType());
115 115
 	}
116 116
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	public function render($writer)
123 123
 	{
124
-		if($this->getHasControls())
124
+		if ($this->getHasControls())
125 125
 		{
126 126
 			$writer->write("<style type=\"text/css\">\n/*<![CDATA[*/\n");
127 127
 			$this->renderChildren($writer);
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -106,12 +106,14 @@
 block discarded – undo
106 106
 		$styles = preg_split('/,|\s+/', $this->getPradoStyles());
107 107
 		foreach($styles as $style)
108 108
 		{
109
-			if(($style = trim($style)) !== '')
110
-				$cs->registerPradoStyle($style);
109
+			if(($style = trim($style)) !== '') {
110
+							$cs->registerPradoStyle($style);
111
+			}
111 112
 		}
112 113
 
113
-		if(($url = $this->getStyleSheetUrl()) !== '')
114
-			$cs->registerStyleSheetFile($url, $url, $this->getMediaType());
114
+		if(($url = $this->getStyleSheetUrl()) !== '') {
115
+					$cs->registerStyleSheetFile($url, $url, $this->getMediaType());
116
+		}
115 117
 	}
116 118
 
117 119
 	/**
Please login to merge, or discard this patch.