Completed
Push — scrutinizer ( c2ef4a )
by Fabio
21:50
created
framework/Web/UI/WebControls/TCheckBoxList.php 4 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	}
155 155
 
156 156
 	/**
157
-	 * @return string the direction of traversing the list, defaults to 'Vertical'
157
+	 * @return TRepeatDirection the direction of traversing the list, defaults to 'Vertical'
158 158
 	 */
159 159
 	public function getRepeatDirection()
160 160
 	{
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	}
171 171
 
172 172
 	/**
173
-	 * @return string how the list should be displayed, using table or using line breaks. Defaults to 'Table'.
173
+	 * @return TRepeatLayout how the list should be displayed, using table or using line breaks. Defaults to 'Table'.
174 174
 	 */
175 175
 	public function getRepeatLayout()
176 176
 	{
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 	/**
450 450
 	 * Returns the value to be validated.
451 451
 	 * This methid is required by IValidatable interface.
452
-	 * @return mixed the value of the property to be validated.
452
+	 * @return string the value of the property to be validated.
453 453
 	 */
454 454
 	public function getValidationPropertyValue()
455 455
 	{
Please login to merge, or discard this patch.
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -45,13 +45,13 @@  discard block
 block discarded – undo
45 45
  * @package System.Web.UI.WebControls
46 46
  * @since 3.0
47 47
  */
48
-class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingContainer, IPostBackDataHandler,  IValidatable
48
+class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingContainer, IPostBackDataHandler, IValidatable
49 49
 {
50 50
 	private $_repeatedControl;
51 51
 	private $_isEnabled;
52
-	private $_changedEventRaised=false;
53
-	private $_dataChanged=false;
54
-	private $_isValid=true;
52
+	private $_changedEventRaised = false;
53
+	private $_dataChanged = false;
54
+	private $_isValid = true;
55 55
 
56 56
 	/**
57 57
 	 * Constructor.
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	public function __construct()
61 61
 	{
62 62
 		parent::__construct();
63
-		$this->_repeatedControl=$this->createRepeatedControl();
63
+		$this->_repeatedControl = $this->createRepeatedControl();
64 64
 		$this->_repeatedControl->setEnableViewState(false);
65 65
 		$this->_repeatedControl->setID('c0');
66 66
 		$this->getControls()->add($this->_repeatedControl);
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
 	 * @param string control ID
83 83
 	 * @return TControl control being found
84 84
 	 */
85
-	public function findControl($id, $real=false)
85
+	public function findControl($id, $real = false)
86 86
 	{
87
-  		if ($real===true)
87
+  		if ($real === true)
88 88
   			return parent::findControl($id);
89 89
 		return $this;
90 90
 	}
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 */
113 113
 	public function getTextAlign()
114 114
 	{
115
-		return $this->getViewState('TextAlign',TTextAlign::Right);
115
+		return $this->getViewState('TextAlign', TTextAlign::Right);
116 116
 	}
117 117
 
118 118
 	/**
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	public function setTextAlign($value)
122 122
 	{
123
-		$this->setViewState('TextAlign',TPropertyValue::ensureEnum($value,'TTextAlign'),TTextAlign::Right);
123
+		$this->setViewState('TextAlign', TPropertyValue::ensureEnum($value, 'TTextAlign'), TTextAlign::Right);
124 124
 	}
125 125
 
126 126
 
@@ -129,10 +129,10 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	protected function getRepeatInfo()
131 131
 	{
132
-		if(($repeatInfo=$this->getViewState('RepeatInfo',null))===null)
132
+		if (($repeatInfo = $this->getViewState('RepeatInfo', null)) === null)
133 133
 		{
134
-			$repeatInfo=new TRepeatInfo;
135
-			$this->setViewState('RepeatInfo',$repeatInfo,null);
134
+			$repeatInfo = new TRepeatInfo;
135
+			$this->setViewState('RepeatInfo', $repeatInfo, null);
136 136
 		}
137 137
 		return $repeatInfo;
138 138
 	}
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	 */
191 191
 	public function getCellSpacing()
192 192
 	{
193
-		if($this->getHasStyle())
193
+		if ($this->getHasStyle())
194 194
 			return $this->getStyle()->getCellSpacing();
195 195
 		else
196 196
 			return -1;
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	 */
211 211
 	public function getCellPadding()
212 212
 	{
213
-		if($this->getHasStyle())
213
+		if ($this->getHasStyle())
214 214
 			return $this->getStyle()->getCellPadding();
215 215
 		else
216 216
 			return -1;
@@ -266,16 +266,16 @@  discard block
 block discarded – undo
266 266
 		// and it's a callback,
267 267
 		// and we can update clientside,
268 268
 		// then update the 'disabled' attribute of the items.
269
-		if(($this instanceof IActiveControl) &&
269
+		if (($this instanceof IActiveControl) &&
270 270
 				$this->getPage()->getIsCallBack() &&
271 271
 				$this->getActiveControl()->canUpdateClientSide())
272 272
 		{
273 273
 			$items = $this->getItems();
274 274
 			$cs = $this->getPage()->getCallbackClient();
275
-			$baseClientID = $this->getClientID().'_c';
276
-			foreach($items as $index=>$item)
275
+			$baseClientID = $this->getClientID() . '_c';
276
+			foreach ($items as $index=>$item)
277 277
 			{
278
-				$cs->setAttribute($baseClientID.$index, 'disabled', $value);
278
+				$cs->setAttribute($baseClientID . $index, 'disabled', $value);
279 279
 			}
280 280
 		}
281 281
 	}
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 	 * @param integer index of the item being rendered
288 288
 	 * @return null
289 289
 	 */
290
-	public function generateItemStyle($itemType,$index)
290
+	public function generateItemStyle($itemType, $index)
291 291
 	{
292 292
 		return null;
293 293
 	}
@@ -300,18 +300,18 @@  discard block
 block discarded – undo
300 300
 	 * @param string item type (Header,Footer,Item,AlternatingItem,SelectedItem,EditItem,Separator,Pager)
301 301
 	 * @param integer zero-based index of the item in the item list
302 302
 	 */
303
-	public function renderItem($writer,$repeatInfo,$itemType,$index)
303
+	public function renderItem($writer, $repeatInfo, $itemType, $index)
304 304
 	{
305
-		$repeatedControl=$this->_repeatedControl;
306
-		$item=$this->getItems()->itemAt($index);
307
-		if($item->getHasAttributes())
305
+		$repeatedControl = $this->_repeatedControl;
306
+		$item = $this->getItems()->itemAt($index);
307
+		if ($item->getHasAttributes())
308 308
 			$repeatedControl->getAttributes()->copyFrom($item->getAttributes());
309
-		else if($repeatedControl->getHasAttributes())
309
+		else if ($repeatedControl->getHasAttributes())
310 310
 			$repeatedControl->getAttributes()->clear();
311 311
 		$repeatedControl->setID("c$index");
312 312
 		$repeatedControl->setText($item->getText());
313 313
 		$repeatedControl->setChecked($item->getSelected());
314
-		$repeatedControl->setAttribute('value',$item->getValue());
314
+		$repeatedControl->setAttribute('value', $item->getValue());
315 315
 		$repeatedControl->setEnabled($this->_isEnabled && $item->getEnabled());
316 316
 		$repeatedControl->setEnableClientScript(false);
317 317
 		$repeatedControl->renderControl($writer);
@@ -324,25 +324,25 @@  discard block
 block discarded – undo
324 324
 	 * @param array the input data collection
325 325
 	 * @return boolean whether the data of the control has been changed
326 326
 	 */
327
-	public function loadPostData($key,$values)
327
+	public function loadPostData($key, $values)
328 328
 	{
329
-		if($this->getEnabled(true))
329
+		if ($this->getEnabled(true))
330 330
 		{
331
-			$index=(int)substr($key,strlen($this->getUniqueID())+2);
331
+			$index = (int) substr($key, strlen($this->getUniqueID()) + 2);
332 332
 			$this->ensureDataBound();
333
-			if($index>=0 && $index<$this->getItemCount())
333
+			if ($index >= 0 && $index < $this->getItemCount())
334 334
 			{
335
-				$item=$this->getItems()->itemAt($index);
336
-				if($item->getEnabled())
335
+				$item = $this->getItems()->itemAt($index);
336
+				if ($item->getEnabled())
337 337
 				{
338
-					$checked=isset($values[$key]);
339
-					if($item->getSelected()!==$checked)
338
+					$checked = isset($values[$key]);
339
+					if ($item->getSelected() !== $checked)
340 340
 					{
341 341
 						$item->setSelected($checked);
342
-						if(!$this->_changedEventRaised)
342
+						if (!$this->_changedEventRaised)
343 343
 						{
344
-							$this->_changedEventRaised=true;
345
-							return $this->_dataChanged=true;
344
+							$this->_changedEventRaised = true;
345
+							return $this->_dataChanged = true;
346 346
 						}
347 347
 					}
348 348
 				}
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 	 */
361 361
 	public function raisePostDataChangedEvent()
362 362
 	{
363
-		if($this->getAutoPostBack() && $this->getCausesValidation())
363
+		if ($this->getAutoPostBack() && $this->getCausesValidation())
364 364
 			$this->getPage()->validate($this->getValidationGroup());
365 365
 		$this->onSelectedIndexChanged(null);
366 366
 	}
@@ -376,9 +376,9 @@  discard block
 block discarded – undo
376 376
 		$this->_repeatedControl->setAutoPostBack($this->getAutoPostBack());
377 377
 		$this->_repeatedControl->setCausesValidation($this->getCausesValidation());
378 378
 		$this->_repeatedControl->setValidationGroup($this->getValidationGroup());
379
-		$page=$this->getPage();
380
-		$n=$this->getItemCount();
381
-		for($i=0;$i<$n;++$i)
379
+		$page = $this->getPage();
380
+		$n = $this->getItemCount();
381
+		for ($i = 0; $i < $n; ++$i)
382 382
 		{
383 383
 			$this->_repeatedControl->setID("c$i");
384 384
 			$page->registerRequiresPostData($this->_repeatedControl);
@@ -390,9 +390,9 @@  discard block
 block discarded – undo
390 390
 	 *
391 391
 	 *@return boolean true if we need a span
392 392
 	 */
393
-	protected function getSpanNeeded ()
393
+	protected function getSpanNeeded()
394 394
 	{
395
-		return $this->getRepeatLayout()===TRepeatLayout::Raw;
395
+		return $this->getRepeatLayout() === TRepeatLayout::Raw;
396 396
 	}
397 397
 
398 398
 	/**
@@ -402,24 +402,24 @@  discard block
 block discarded – undo
402 402
 	 */
403 403
 	public function render($writer)
404 404
 	{
405
-		if($this->getItemCount()>0)
405
+		if ($this->getItemCount() > 0)
406 406
 		{
407
-			if ($needSpan=$this->getSpanNeeded())
407
+			if ($needSpan = $this->getSpanNeeded())
408 408
 			{
409 409
 				$writer->addAttribute('id', $this->getClientId());
410 410
 				$writer->renderBeginTag('span');
411 411
 			}
412
-			$this->_isEnabled=$this->getEnabled(true);
413
-			$repeatInfo=$this->getRepeatInfo();
414
-			$accessKey=$this->getAccessKey();
415
-			$tabIndex=$this->getTabIndex();
412
+			$this->_isEnabled = $this->getEnabled(true);
413
+			$repeatInfo = $this->getRepeatInfo();
414
+			$accessKey = $this->getAccessKey();
415
+			$tabIndex = $this->getTabIndex();
416 416
 			$this->_repeatedControl->setTextAlign($this->getTextAlign());
417 417
 			$this->_repeatedControl->setAccessKey($accessKey);
418 418
 			$this->_repeatedControl->setTabIndex($tabIndex);
419 419
 			$this->setAccessKey('');
420 420
 			$this->setTabIndex(0);
421 421
 			$this->addAttributesToRender($writer);
422
-			$repeatInfo->renderRepeater($writer,$this);
422
+			$repeatInfo->renderRepeater($writer, $this);
423 423
 			$this->setAccessKey($accessKey);
424 424
 			$this->setTabIndex($tabIndex);
425 425
 			if ($needSpan)
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 		}
428 428
 
429 429
 		//checkbox skipped the client control script in addAttributesToRender
430
-		if($this->getEnabled(true)
430
+		if ($this->getEnabled(true)
431 431
 			&& $this->getEnableClientScript()
432 432
 			&& $this->getAutoPostBack()
433 433
 			&& $this->getPage()->getClientSupportsJavaScript())
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 	 */
471 471
 	public function setIsValid($value)
472 472
 	{
473
-	    $this->_isValid=TPropertyValue::ensureBoolean($value);
473
+	    $this->_isValid = TPropertyValue::ensureBoolean($value);
474 474
 	}
475 475
 
476 476
 	/**
Please login to merge, or discard this patch.
Braces   +24 added lines, -18 removed lines patch added patch discarded remove patch
@@ -84,8 +84,9 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	public function findControl($id, $real=false)
86 86
 	{
87
-  		if ($real===true)
88
-  			return parent::findControl($id);
87
+  		if ($real===true) {
88
+  		  			return parent::findControl($id);
89
+  		}
89 90
 		return $this;
90 91
 	}
91 92
 
@@ -190,10 +191,11 @@  discard block
 block discarded – undo
190 191
 	 */
191 192
 	public function getCellSpacing()
192 193
 	{
193
-		if($this->getHasStyle())
194
-			return $this->getStyle()->getCellSpacing();
195
-		else
196
-			return -1;
194
+		if($this->getHasStyle()) {
195
+					return $this->getStyle()->getCellSpacing();
196
+		} else {
197
+					return -1;
198
+		}
197 199
 	}
198 200
 
199 201
 	/**
@@ -210,10 +212,11 @@  discard block
 block discarded – undo
210 212
 	 */
211 213
 	public function getCellPadding()
212 214
 	{
213
-		if($this->getHasStyle())
214
-			return $this->getStyle()->getCellPadding();
215
-		else
216
-			return -1;
215
+		if($this->getHasStyle()) {
216
+					return $this->getStyle()->getCellPadding();
217
+		} else {
218
+					return -1;
219
+		}
217 220
 	}
218 221
 
219 222
 	/**
@@ -304,10 +307,11 @@  discard block
 block discarded – undo
304 307
 	{
305 308
 		$repeatedControl=$this->_repeatedControl;
306 309
 		$item=$this->getItems()->itemAt($index);
307
-		if($item->getHasAttributes())
308
-			$repeatedControl->getAttributes()->copyFrom($item->getAttributes());
309
-		else if($repeatedControl->getHasAttributes())
310
-			$repeatedControl->getAttributes()->clear();
310
+		if($item->getHasAttributes()) {
311
+					$repeatedControl->getAttributes()->copyFrom($item->getAttributes());
312
+		} else if($repeatedControl->getHasAttributes()) {
313
+					$repeatedControl->getAttributes()->clear();
314
+		}
311 315
 		$repeatedControl->setID("c$index");
312 316
 		$repeatedControl->setText($item->getText());
313 317
 		$repeatedControl->setChecked($item->getSelected());
@@ -360,8 +364,9 @@  discard block
 block discarded – undo
360 364
 	 */
361 365
 	public function raisePostDataChangedEvent()
362 366
 	{
363
-		if($this->getAutoPostBack() && $this->getCausesValidation())
364
-			$this->getPage()->validate($this->getValidationGroup());
367
+		if($this->getAutoPostBack() && $this->getCausesValidation()) {
368
+					$this->getPage()->validate($this->getValidationGroup());
369
+		}
365 370
 		$this->onSelectedIndexChanged(null);
366 371
 	}
367 372
 
@@ -422,8 +427,9 @@  discard block
 block discarded – undo
422 427
 			$repeatInfo->renderRepeater($writer,$this);
423 428
 			$this->setAccessKey($accessKey);
424 429
 			$this->setTabIndex($tabIndex);
425
-			if ($needSpan)
426
-				$writer->renderEndTag();
430
+			if ($needSpan) {
431
+							$writer->renderEndTag();
432
+			}
427 433
 		}
428 434
 
429 435
 		//checkbox skipped the client control script in addAttributesToRender
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * TCheckBoxList class file
4
- *
5
- * @author Qiang Xue <[email protected]>
6
- * @link https://github.com/pradosoft/prado
7
- * @copyright Copyright &copy; 2005-2015 The PRADO Group
8
- * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
9
- * @package System.Web.UI.WebControls
10
- */
3
+	 * TCheckBoxList class file
4
+	 *
5
+	 * @author Qiang Xue <[email protected]>
6
+	 * @link https://github.com/pradosoft/prado
7
+	 * @copyright Copyright &copy; 2005-2015 The PRADO Group
8
+	 * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
9
+	 * @package System.Web.UI.WebControls
10
+	 */
11 11
 
12 12
 /**
13 13
  * Includes TListControl class
@@ -463,14 +463,14 @@  discard block
 block discarded – undo
463 463
 	 */
464 464
 	public function getIsValid()
465 465
 	{
466
-	    return $this->_isValid;
466
+		return $this->_isValid;
467 467
 	}
468 468
 	/**
469 469
 	 * @param bool wether this control is valid.
470 470
 	 */
471 471
 	public function setIsValid($value)
472 472
 	{
473
-	    $this->_isValid=TPropertyValue::ensureBoolean($value);
473
+		$this->_isValid=TPropertyValue::ensureBoolean($value);
474 474
 	}
475 475
 
476 476
 	/**
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TCompareValidator.php 4 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -186,6 +186,8 @@
 block discarded – undo
186 186
 	 * Parse the pair of values into the appropriate value type.
187 187
 	 * @param string value one
188 188
 	 * @param string second value
189
+	 * @param string $value1
190
+	 * @param string $value2
189 191
 	 * @return array appropriate type of the value pair, array($value1, $value2);
190 192
 	 */
191 193
 	protected function getComparisonValues($value1, $value2)
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -124,9 +124,9 @@
 block discarded – undo
124 124
 	}
125 125
 
126 126
 	/**
127
-     * Sets the date format for a date validation
128
-     * @param string the date format value
129
-     */
127
+	 * Sets the date format for a date validation
128
+	 * @param string the date format value
129
+	 */
130 130
 	public function setDateFormat($value)
131 131
 	{
132 132
 		$this->setViewState('DateFormat', $value, '');
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	 */
60 60
 	public function getDataType()
61 61
 	{
62
-		return $this->getViewState('DataType',TValidationDataType::String);
62
+		return $this->getViewState('DataType', TValidationDataType::String);
63 63
 	}
64 64
 
65 65
 	/**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public function setDataType($value)
71 71
 	{
72
-		$this->setViewState('DataType',TPropertyValue::ensureEnum($value,'TValidationDataType'),TValidationDataType::String);
72
+		$this->setViewState('DataType', TPropertyValue::ensureEnum($value, 'TValidationDataType'), TValidationDataType::String);
73 73
 	}
74 74
 
75 75
 	/**
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 */
78 78
 	public function getControlToCompare()
79 79
 	{
80
-		return $this->getViewState('ControlToCompare','');
80
+		return $this->getViewState('ControlToCompare', '');
81 81
 	}
82 82
 
83 83
 	/**
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	public function setControlToCompare($value)
88 88
 	{
89
-		$this->setViewState('ControlToCompare',$value,'');
89
+		$this->setViewState('ControlToCompare', $value, '');
90 90
 	}
91 91
 
92 92
 	/**
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	public function getValueToCompare()
96 96
 	{
97
-		return $this->getViewState('ValueToCompare','');
97
+		return $this->getViewState('ValueToCompare', '');
98 98
 	}
99 99
 
100 100
 	/**
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	public function setValueToCompare($value)
105 105
 	{
106
-		$this->setViewState('ValueToCompare',$value,'');
106
+		$this->setViewState('ValueToCompare', $value, '');
107 107
 	}
108 108
 
109 109
 	/**
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	public function getOperator()
113 113
 	{
114
-		return $this->getViewState('Operator',TValidationCompareOperator::Equal);
114
+		return $this->getViewState('Operator', TValidationCompareOperator::Equal);
115 115
 	}
116 116
 
117 117
 	/**
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	public function setOperator($value)
122 122
 	{
123
-		$this->setViewState('Operator',TPropertyValue::ensureEnum($value,'TValidationCompareOperator'),TValidationCompareOperator::Equal);
123
+		$this->setViewState('Operator', TPropertyValue::ensureEnum($value, 'TValidationCompareOperator'), TValidationCompareOperator::Equal);
124 124
 	}
125 125
 
126 126
 	/**
@@ -149,21 +149,21 @@  discard block
 block discarded – undo
149 149
 	 */
150 150
 	public function evaluateIsValid()
151 151
 	{
152
-		if(($value=$this->getValidationValue($this->getValidationTarget()))==='')
152
+		if (($value = $this->getValidationValue($this->getValidationTarget())) === '')
153 153
 			return true;
154 154
 
155
-		if(($controlToCompare=$this->getControlToCompare())!=='')
155
+		if (($controlToCompare = $this->getControlToCompare()) !== '')
156 156
 		{
157
-			if(($control2=$this->findControl($controlToCompare))===null)
157
+			if (($control2 = $this->findControl($controlToCompare)) === null)
158 158
 				throw new TInvalidDataValueException('comparevalidator_controltocompare_invalid');
159
-			if(($value2=$this->getValidationValue($control2))==='')
159
+			if (($value2 = $this->getValidationValue($control2)) === '')
160 160
 				return false;
161 161
 		}
162 162
 		else
163
-			$value2=$this->getValueToCompare();
163
+			$value2 = $this->getValueToCompare();
164 164
 
165 165
 		$values = $this->getComparisonValues($value, $value2);
166
-		switch($this->getOperator())
166
+		switch ($this->getOperator())
167 167
 		{
168 168
 			case TValidationCompareOperator::Equal:
169 169
 				return $values[0] == $values[1];
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	 */
191 191
 	protected function getComparisonValues($value1, $value2)
192 192
 	{
193
-		switch($this->getDataType())
193
+		switch ($this->getDataType())
194 194
 		{
195 195
 			case TValidationDataType::Integer:
196 196
 				return array(intval($value1), intval($value2));
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 				return array(floatval($value1), floatval($value2));
199 199
 			case TValidationDataType::Date:
200 200
 				$dateFormat = $this->getDateFormat();
201
-				if($dateFormat!=='')
201
+				if ($dateFormat !== '')
202 202
 				{
203 203
 					$formatter = Prado::createComponent('System.Util.TSimpleDateFormatter', $dateFormat);
204 204
 					return array($formatter->parse($value1), $formatter->parse($value2));
@@ -216,18 +216,18 @@  discard block
 block discarded – undo
216 216
 	protected function getClientScriptOptions()
217 217
 	{
218 218
 		$options = parent::getClientScriptOptions();
219
-		if(($name=$this->getControlToCompare())!=='')
219
+		if (($name = $this->getControlToCompare()) !== '')
220 220
 		{
221
-			if(($control=$this->findControl($name))!==null)
222
-				$options['ControlToCompare']=$control->getClientID();
221
+			if (($control = $this->findControl($name)) !== null)
222
+				$options['ControlToCompare'] = $control->getClientID();
223 223
 		}
224
-		if(($value=$this->getValueToCompare())!=='')
225
-			$options['ValueToCompare']=$value;
226
-		if(($operator=$this->getOperator())!==TValidationCompareOperator::Equal)
227
-			$options['Operator']=$operator;
228
-		$options['DataType']=$this->getDataType();
229
-		if(($dateFormat=$this->getDateFormat())!=='')
230
-			$options['DateFormat']=$dateFormat;
224
+		if (($value = $this->getValueToCompare()) !== '')
225
+			$options['ValueToCompare'] = $value;
226
+		if (($operator = $this->getOperator()) !== TValidationCompareOperator::Equal)
227
+			$options['Operator'] = $operator;
228
+		$options['DataType'] = $this->getDataType();
229
+		if (($dateFormat = $this->getDateFormat()) !== '')
230
+			$options['DateFormat'] = $dateFormat;
231 231
 		return $options;
232 232
 	}
233 233
 }
@@ -252,11 +252,11 @@  discard block
 block discarded – undo
252 252
  */
253 253
 class TValidationCompareOperator extends TEnumerable
254 254
 {
255
-	const Equal='Equal';
256
-	const NotEqual='NotEqual';
257
-	const GreaterThan='GreaterThan';
258
-	const GreaterThanEqual='GreaterThanEqual';
259
-	const LessThan='LessThan';
260
-	const LessThanEqual='LessThanEqual';
255
+	const Equal = 'Equal';
256
+	const NotEqual = 'NotEqual';
257
+	const GreaterThan = 'GreaterThan';
258
+	const GreaterThanEqual = 'GreaterThanEqual';
259
+	const LessThan = 'LessThan';
260
+	const LessThanEqual = 'LessThanEqual';
261 261
 }
262 262
 
Please login to merge, or discard this patch.
Braces   +25 added lines, -18 removed lines patch added patch discarded remove patch
@@ -149,18 +149,21 @@  discard block
 block discarded – undo
149 149
 	 */
150 150
 	public function evaluateIsValid()
151 151
 	{
152
-		if(($value=$this->getValidationValue($this->getValidationTarget()))==='')
153
-			return true;
152
+		if(($value=$this->getValidationValue($this->getValidationTarget()))==='') {
153
+					return true;
154
+		}
154 155
 
155 156
 		if(($controlToCompare=$this->getControlToCompare())!=='')
156 157
 		{
157
-			if(($control2=$this->findControl($controlToCompare))===null)
158
-				throw new TInvalidDataValueException('comparevalidator_controltocompare_invalid');
159
-			if(($value2=$this->getValidationValue($control2))==='')
160
-				return false;
158
+			if(($control2=$this->findControl($controlToCompare))===null) {
159
+							throw new TInvalidDataValueException('comparevalidator_controltocompare_invalid');
160
+			}
161
+			if(($value2=$this->getValidationValue($control2))==='') {
162
+							return false;
163
+			}
164
+		} else {
165
+					$value2=$this->getValueToCompare();
161 166
 		}
162
-		else
163
-			$value2=$this->getValueToCompare();
164 167
 
165 168
 		$values = $this->getComparisonValues($value, $value2);
166 169
 		switch($this->getOperator())
@@ -202,9 +205,9 @@  discard block
 block discarded – undo
202 205
 				{
203 206
 					$formatter = Prado::createComponent('System.Util.TSimpleDateFormatter', $dateFormat);
204 207
 					return array($formatter->parse($value1), $formatter->parse($value2));
208
+				} else {
209
+									return array(strtotime($value1), strtotime($value2));
205 210
 				}
206
-				else
207
-					return array(strtotime($value1), strtotime($value2));
208 211
 		}
209 212
 		return array($value1, $value2);
210 213
 	}
@@ -218,16 +221,20 @@  discard block
 block discarded – undo
218 221
 		$options = parent::getClientScriptOptions();
219 222
 		if(($name=$this->getControlToCompare())!=='')
220 223
 		{
221
-			if(($control=$this->findControl($name))!==null)
222
-				$options['ControlToCompare']=$control->getClientID();
224
+			if(($control=$this->findControl($name))!==null) {
225
+							$options['ControlToCompare']=$control->getClientID();
226
+			}
227
+		}
228
+		if(($value=$this->getValueToCompare())!=='') {
229
+					$options['ValueToCompare']=$value;
230
+		}
231
+		if(($operator=$this->getOperator())!==TValidationCompareOperator::Equal) {
232
+					$options['Operator']=$operator;
223 233
 		}
224
-		if(($value=$this->getValueToCompare())!=='')
225
-			$options['ValueToCompare']=$value;
226
-		if(($operator=$this->getOperator())!==TValidationCompareOperator::Equal)
227
-			$options['Operator']=$operator;
228 234
 		$options['DataType']=$this->getDataType();
229
-		if(($dateFormat=$this->getDateFormat())!=='')
230
-			$options['DateFormat']=$dateFormat;
235
+		if(($dateFormat=$this->getDateFormat())!=='') {
236
+					$options['DateFormat']=$dateFormat;
237
+		}
231 238
 		return $options;
232 239
 	}
233 240
 }
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TCustomValidator.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -171,6 +171,7 @@
 block discarded – undo
171 171
 	 * Constructor.
172 172
 	 * @param string property value to be validated
173 173
 	 * @param boolean whether the value is valid
174
+	 * @param boolean $isValid
174 175
 	 */
175 176
 	public function __construct($value,$isValid)
176 177
 	{
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	public function getClientValidationFunction()
69 69
 	{
70
-		return $this->getViewState('ClientValidationFunction','');
70
+		return $this->getViewState('ClientValidationFunction', '');
71 71
 	}
72 72
 
73 73
 	/**
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	public function setClientValidationFunction($value)
78 78
 	{
79
-		$this->setViewState('ClientValidationFunction',$value,'');
79
+		$this->setViewState('ClientValidationFunction', $value, '');
80 80
 	}
81 81
 
82 82
 	/**
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	public function evaluateIsValid()
88 88
 	{
89 89
 		$value = '';
90
-		if($this->getValidationTarget()!==null)
91
-			$value=$this->getValidationValue($this->getValidationTarget());
90
+		if ($this->getValidationTarget() !== null)
91
+			$value = $this->getValidationValue($this->getValidationTarget());
92 92
 		return $this->onServerValidate($value);
93 93
 	}
94 94
 
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	public function onServerValidate($value)
105 105
 	{
106
-		$param=new TServerValidateEventParameter($value,true);
107
-		$this->raiseEvent('OnServerValidate',$this,$param);
106
+		$param = new TServerValidateEventParameter($value, true);
107
+		$this->raiseEvent('OnServerValidate', $this, $param);
108 108
 		return $param->getIsValid();
109 109
 	}
110 110
 
@@ -113,10 +113,10 @@  discard block
 block discarded – undo
113 113
 	 */
114 114
 	public function getValidationTarget()
115 115
 	{
116
-		if(($id=$this->getControlToValidate())!=='' && ($control=$this->findControl($id))!==null)
116
+		if (($id = $this->getControlToValidate()) !== '' && ($control = $this->findControl($id)) !== null)
117 117
 			return $control;
118
-		else if(($id=$this->getControlToValidate())!=='')
119
-			throw new TInvalidDataTypeException('basevalidator_validatable_required',get_class($this));
118
+		else if (($id = $this->getControlToValidate()) !== '')
119
+			throw new TInvalidDataTypeException('basevalidator_validatable_required', get_class($this));
120 120
 		else
121 121
 			return null;
122 122
 	}
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 	 */
128 128
 	protected function getClientScriptOptions()
129 129
 	{
130
-		$options=parent::getClientScriptOptions();
131
-		if(($clientJs=$this->getClientValidationFunction())!=='')
132
-			$options['ClientValidationFunction']=$clientJs;
130
+		$options = parent::getClientScriptOptions();
131
+		if (($clientJs = $this->getClientValidationFunction()) !== '')
132
+			$options['ClientValidationFunction'] = $clientJs;
133 133
 		return $options;
134 134
 	}
135 135
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	 */
140 140
 	protected function registerClientScriptValidator()
141 141
 	{
142
-		if($this->getClientValidationFunction()!=='')
142
+		if ($this->getClientValidationFunction() !== '')
143 143
 			parent::registerClientScriptValidator();
144 144
 	}
145 145
 }
@@ -160,21 +160,21 @@  discard block
 block discarded – undo
160 160
 	 * the value to be validated
161 161
 	 * @var string
162 162
 	 */
163
-	private $_value='';
163
+	private $_value = '';
164 164
 	/**
165 165
 	 * whether the value is valid
166 166
 	 * @var boolean
167 167
 	 */
168
-	private $_isValid=true;
168
+	private $_isValid = true;
169 169
 
170 170
 	/**
171 171
 	 * Constructor.
172 172
 	 * @param string property value to be validated
173 173
 	 * @param boolean whether the value is valid
174 174
 	 */
175
-	public function __construct($value,$isValid)
175
+	public function __construct($value, $isValid)
176 176
 	{
177
-		$this->_value=$value;
177
+		$this->_value = $value;
178 178
 		$this->setIsValid($isValid);
179 179
 	}
180 180
 
@@ -199,6 +199,6 @@  discard block
 block discarded – undo
199 199
 	 */
200 200
 	public function setIsValid($value)
201 201
 	{
202
-		$this->_isValid=TPropertyValue::ensureBoolean($value);
202
+		$this->_isValid = TPropertyValue::ensureBoolean($value);
203 203
 	}
204 204
 }
Please login to merge, or discard this patch.
Braces   +16 added lines, -12 removed lines patch added patch discarded remove patch
@@ -87,8 +87,9 @@  discard block
 block discarded – undo
87 87
 	public function evaluateIsValid()
88 88
 	{
89 89
 		$value = '';
90
-		if($this->getValidationTarget()!==null)
91
-			$value=$this->getValidationValue($this->getValidationTarget());
90
+		if($this->getValidationTarget()!==null) {
91
+					$value=$this->getValidationValue($this->getValidationTarget());
92
+		}
92 93
 		return $this->onServerValidate($value);
93 94
 	}
94 95
 
@@ -113,12 +114,13 @@  discard block
 block discarded – undo
113 114
 	 */
114 115
 	public function getValidationTarget()
115 116
 	{
116
-		if(($id=$this->getControlToValidate())!=='' && ($control=$this->findControl($id))!==null)
117
-			return $control;
118
-		else if(($id=$this->getControlToValidate())!=='')
119
-			throw new TInvalidDataTypeException('basevalidator_validatable_required',get_class($this));
120
-		else
121
-			return null;
117
+		if(($id=$this->getControlToValidate())!=='' && ($control=$this->findControl($id))!==null) {
118
+					return $control;
119
+		} else if(($id=$this->getControlToValidate())!=='') {
120
+					throw new TInvalidDataTypeException('basevalidator_validatable_required',get_class($this));
121
+		} else {
122
+					return null;
123
+		}
122 124
 	}
123 125
 
124 126
 	/**
@@ -128,8 +130,9 @@  discard block
 block discarded – undo
128 130
 	protected function getClientScriptOptions()
129 131
 	{
130 132
 		$options=parent::getClientScriptOptions();
131
-		if(($clientJs=$this->getClientValidationFunction())!=='')
132
-			$options['ClientValidationFunction']=$clientJs;
133
+		if(($clientJs=$this->getClientValidationFunction())!=='') {
134
+					$options['ClientValidationFunction']=$clientJs;
135
+		}
133 136
 		return $options;
134 137
 	}
135 138
 
@@ -139,8 +142,9 @@  discard block
 block discarded – undo
139 142
 	 */
140 143
 	protected function registerClientScriptValidator()
141 144
 	{
142
-		if($this->getClientValidationFunction()!=='')
143
-			parent::registerClientScriptValidator();
145
+		if($this->getClientValidationFunction()!=='') {
146
+					parent::registerClientScriptValidator();
147
+		}
144 148
 	}
145 149
 }
146 150
 
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TDataBoundControl.php 3 patches
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -151,6 +151,7 @@  discard block
 block discarded – undo
151 151
 
152 152
 	/**
153 153
 	 * @param boolean if databind has been invoked in this page request
154
+	 * @param boolean $value
154 155
 	 */
155 156
 	protected function setIsDataBound($value)
156 157
 	{
@@ -211,6 +212,7 @@  discard block
 block discarded – undo
211 212
 
212 213
 	/**
213 214
 	 * @param integer the zero-based index of the current page
215
+	 * @param integer $value
214 216
 	 * @throws TInvalidDataValueException if the value is less than 0
215 217
 	 */
216 218
 	public function setCurrentPageIndex($value)
@@ -273,6 +275,7 @@  discard block
 block discarded – undo
273 275
 	 * If true and the control has been prerendered while it uses the data source
274 276
 	 * specified by {@link setDataSourceID}, a databind call will be called by this method.
275 277
 	 * @param boolean whether a databind call is required.
278
+	 * @param boolean $value
276 279
 	 */
277 280
 	protected function setRequiresDataBinding($value)
278 281
 	{
@@ -405,6 +408,9 @@  discard block
 block discarded – undo
405 408
 		return $this->_currentDataSource;
406 409
 	}
407 410
 
411
+	/**
412
+	 * @param Traversable $data
413
+	 */
408 414
 	abstract protected function performDataBinding($data);
409 415
 
410 416
 	/**
@@ -566,6 +572,7 @@  discard block
 block discarded – undo
566 572
 	 * Sets the zero-based index for the item.
567 573
 	 * If the item is not in the item collection (e.g. it is a header item), -1 should be used.
568 574
 	 * @param integer zero-based index of the item.
575
+	 * @return void
569 576
 	 */
570 577
 	public function setItemIndex($value);
571 578
 
@@ -576,6 +583,7 @@  discard block
 block discarded – undo
576 583
 
577 584
 	/**
578 585
 	 * @param TListItemType the item type.
586
+	 * @return void
579 587
 	 */
580 588
 	public function setItemType($value);
581 589
 }
Please login to merge, or discard this patch.
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -43,18 +43,18 @@  discard block
 block discarded – undo
43 43
  */
44 44
 abstract class TDataBoundControl extends TWebControl
45 45
 {
46
-	private $_initialized=false;
47
-	private $_dataSource=null;
48
-	private $_requiresBindToNull=false;
49
-	private $_requiresDataBinding=false;
50
-	private $_prerendered=false;
51
-	private $_currentView=null;
52
-	private $_currentDataSource=null;
53
-	private $_currentViewValid=false;
54
-	private $_currentDataSourceValid=false;
55
-	private $_currentViewIsFromDataSourceID=false;
56
-	private $_parameters=null;
57
-	private $_isDataBound=false;
46
+	private $_initialized = false;
47
+	private $_dataSource = null;
48
+	private $_requiresBindToNull = false;
49
+	private $_requiresDataBinding = false;
50
+	private $_prerendered = false;
51
+	private $_currentView = null;
52
+	private $_currentDataSource = null;
53
+	private $_currentViewValid = false;
54
+	private $_currentDataSourceValid = false;
55
+	private $_currentViewIsFromDataSourceID = false;
56
+	private $_parameters = null;
57
+	private $_isDataBound = false;
58 58
 
59 59
 	/**
60 60
 	 * @return Traversable data source object, defaults to null.
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public function setDataSource($value)
75 75
 	{
76
-		$this->_dataSource=$this->validateDataSource($value);
76
+		$this->_dataSource = $this->validateDataSource($value);
77 77
 		$this->onDataSourceChanged();
78 78
 	}
79 79
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 */
83 83
 	public function getDataSourceID()
84 84
 	{
85
-		return $this->getViewState('DataSourceID','');
85
+		return $this->getViewState('DataSourceID', '');
86 86
 	}
87 87
 
88 88
 	/**
@@ -91,10 +91,10 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public function setDataSourceID($value)
93 93
 	{
94
-		$dsid=$this->getViewState('DataSourceID','');
95
-		if($dsid!=='' && $value==='')
96
-			$this->_requiresBindToNull=true;
97
-		$this->setViewState('DataSourceID',$value,'');
94
+		$dsid = $this->getViewState('DataSourceID', '');
95
+		if ($dsid !== '' && $value === '')
96
+			$this->_requiresBindToNull = true;
97
+		$this->setViewState('DataSourceID', $value, '');
98 98
 		$this->onDataSourceChanged();
99 99
 	}
100 100
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	protected function getUsingDataSourceID()
107 107
 	{
108
-		return $this->getDataSourceID()!=='';
108
+		return $this->getDataSourceID() !== '';
109 109
 	}
110 110
 
111 111
 	/**
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	public function onDataSourceChanged()
116 116
 	{
117
-		$this->_currentViewValid=false;
118
-		$this->_currentDataSourceValid=false;
119
-		if($this->getInitialized())
117
+		$this->_currentViewValid = false;
118
+		$this->_currentDataSourceValid = false;
119
+		if ($this->getInitialized())
120 120
 			$this->setRequiresDataBinding(true);
121 121
 	}
122 122
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	protected function setInitialized($value)
140 140
 	{
141
-		$this->_initialized=TPropertyValue::ensureBoolean($value);
141
+		$this->_initialized = TPropertyValue::ensureBoolean($value);
142 142
 	}
143 143
 
144 144
 	/**
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 */
155 155
 	protected function setIsDataBound($value)
156 156
 	{
157
-		$this->_isDataBound=$value;
157
+		$this->_isDataBound = $value;
158 158
 	}
159 159
 
160 160
 	/**
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 */
171 171
 	public function getAllowPaging()
172 172
 	{
173
-		return $this->getViewState('AllowPaging',false);
173
+		return $this->getViewState('AllowPaging', false);
174 174
 	}
175 175
 
176 176
 	/**
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	 */
179 179
 	public function setAllowPaging($value)
180 180
 	{
181
-		$this->setViewState('AllowPaging',TPropertyValue::ensureBoolean($value),false);
181
+		$this->setViewState('AllowPaging', TPropertyValue::ensureBoolean($value), false);
182 182
 	}
183 183
 
184 184
 	/**
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 */
187 187
 	public function getAllowCustomPaging()
188 188
 	{
189
-		return $this->getViewState('AllowCustomPaging',false);
189
+		return $this->getViewState('AllowCustomPaging', false);
190 190
 	}
191 191
 
192 192
 	/**
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	 */
199 199
 	public function setAllowCustomPaging($value)
200 200
 	{
201
-		$this->setViewState('AllowCustomPaging',TPropertyValue::ensureBoolean($value),false);
201
+		$this->setViewState('AllowCustomPaging', TPropertyValue::ensureBoolean($value), false);
202 202
 	}
203 203
 
204 204
 	/**
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	 */
207 207
 	public function getCurrentPageIndex()
208 208
 	{
209
-		return $this->getViewState('CurrentPageIndex',0);
209
+		return $this->getViewState('CurrentPageIndex', 0);
210 210
 	}
211 211
 
212 212
 	/**
@@ -215,9 +215,9 @@  discard block
 block discarded – undo
215 215
 	 */
216 216
 	public function setCurrentPageIndex($value)
217 217
 	{
218
-		if(($value=TPropertyValue::ensureInteger($value))<0)
219
-			$value=0;
220
-		$this->setViewState('CurrentPageIndex',$value,0);
218
+		if (($value = TPropertyValue::ensureInteger($value)) < 0)
219
+			$value = 0;
220
+		$this->setViewState('CurrentPageIndex', $value, 0);
221 221
 	}
222 222
 
223 223
 	/**
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 	 */
226 226
 	public function getPageSize()
227 227
 	{
228
-		return $this->getViewState('PageSize',10);
228
+		return $this->getViewState('PageSize', 10);
229 229
 	}
230 230
 
231 231
 	/**
@@ -234,9 +234,9 @@  discard block
 block discarded – undo
234 234
 	 */
235 235
 	public function setPageSize($value)
236 236
 	{
237
-		if(($value=TPropertyValue::ensureInteger($value))<1)
238
-			throw new TInvalidDataValueException('databoundcontrol_pagesize_invalid',get_class($this));
239
-		$this->setViewState('PageSize',TPropertyValue::ensureInteger($value),10);
237
+		if (($value = TPropertyValue::ensureInteger($value)) < 1)
238
+			throw new TInvalidDataValueException('databoundcontrol_pagesize_invalid', get_class($this));
239
+		$this->setViewState('PageSize', TPropertyValue::ensureInteger($value), 10);
240 240
 	}
241 241
 
242 242
 	/**
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 	 */
245 245
 	public function getPageCount()
246 246
 	{
247
-		return $this->getViewState('PageCount',1);
247
+		return $this->getViewState('PageCount', 1);
248 248
 	}
249 249
 
250 250
 	/**
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 	 */
254 254
 	public function getVirtualItemCount()
255 255
 	{
256
-		return $this->getViewState('VirtualItemCount',0);
256
+		return $this->getViewState('VirtualItemCount', 0);
257 257
 	}
258 258
 
259 259
 	/**
@@ -263,9 +263,9 @@  discard block
 block discarded – undo
263 263
 	 */
264 264
 	public function setVirtualItemCount($value)
265 265
 	{
266
-		if(($value=TPropertyValue::ensureInteger($value))<0)
267
-			throw new TInvalidDataValueException('databoundcontrol_virtualitemcount_invalid',get_class($this));
268
-		$this->setViewState('VirtualItemCount',$value,0);
266
+		if (($value = TPropertyValue::ensureInteger($value)) < 0)
267
+			throw new TInvalidDataValueException('databoundcontrol_virtualitemcount_invalid', get_class($this));
268
+		$this->setViewState('VirtualItemCount', $value, 0);
269 269
 	}
270 270
 
271 271
 	/**
@@ -276,14 +276,14 @@  discard block
 block discarded – undo
276 276
 	 */
277 277
 	protected function setRequiresDataBinding($value)
278 278
 	{
279
-		$value=TPropertyValue::ensureBoolean($value);
280
-		if($value && $this->_prerendered)
279
+		$value = TPropertyValue::ensureBoolean($value);
280
+		if ($value && $this->_prerendered)
281 281
 		{
282
-			$this->_requiresDataBinding=true;
282
+			$this->_requiresDataBinding = true;
283 283
 			$this->ensureDataBound();
284 284
 		}
285 285
 		else
286
-			$this->_requiresDataBinding=$value;
286
+			$this->_requiresDataBinding = $value;
287 287
 	}
288 288
 
289 289
 	/**
@@ -294,10 +294,10 @@  discard block
 block discarded – undo
294 294
 	 */
295 295
 	protected function ensureDataBound()
296 296
 	{
297
-		if($this->_requiresDataBinding && ($this->getUsingDataSourceID() || $this->_requiresBindToNull))
297
+		if ($this->_requiresDataBinding && ($this->getUsingDataSourceID() || $this->_requiresBindToNull))
298 298
 		{
299 299
 			$this->dataBind();
300
-			$this->_requiresBindToNull=false;
300
+			$this->_requiresBindToNull = false;
301 301
 		}
302 302
 	}
303 303
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 	 */
307 307
 	protected function createPagedDataSource()
308 308
 	{
309
-		$ds=new TPagedDataSource;
309
+		$ds = new TPagedDataSource;
310 310
 		$ds->setCurrentPageIndex($this->getCurrentPageIndex());
311 311
 		$ds->setPageSize($this->getPageSize());
312 312
 		$ds->setAllowPaging($this->getAllowPaging());
@@ -327,21 +327,21 @@  discard block
 block discarded – undo
327 327
 		$this->dataBindProperties();
328 328
 		$this->onDataBinding(null);
329 329
 
330
-		if(($view=$this->getDataSourceView())!==null)
331
-			$data=$view->select($this->getSelectParameters());
330
+		if (($view = $this->getDataSourceView()) !== null)
331
+			$data = $view->select($this->getSelectParameters());
332 332
 		else
333
-			$data=null;
333
+			$data = null;
334 334
 
335
-		if($data instanceof Traversable)
335
+		if ($data instanceof Traversable)
336 336
 		{
337
-			if($this->getAllowPaging())
337
+			if ($this->getAllowPaging())
338 338
 			{
339
-				$ds=$this->createPagedDataSource();
339
+				$ds = $this->createPagedDataSource();
340 340
 				$ds->setDataSource($data);
341
-				$this->setViewState('PageCount',$ds->getPageCount());
342
-				if($ds->getCurrentPageIndex()>=$ds->getPageCount())
341
+				$this->setViewState('PageCount', $ds->getPageCount());
342
+				if ($ds->getCurrentPageIndex() >= $ds->getPageCount())
343 343
 				{
344
-					$ds->setCurrentPageIndex($ds->getPageCount()-1);
344
+					$ds->setCurrentPageIndex($ds->getPageCount() - 1);
345 345
 					$this->setCurrentPageIndex($ds->getCurrentPageIndex());
346 346
 				}
347 347
 				$this->performDataBinding($ds);
@@ -356,51 +356,51 @@  discard block
 block discarded – undo
356 356
 		$this->onDataBound(null);
357 357
 	}
358 358
 
359
-	public function dataSourceViewChanged($sender,$param)
359
+	public function dataSourceViewChanged($sender, $param)
360 360
 	{
361
-		if(!$this->_ignoreDataSourceViewChanged)
361
+		if (!$this->_ignoreDataSourceViewChanged)
362 362
 			$this->setRequiresDataBinding(true);
363 363
 	}
364 364
 
365 365
 	protected function getDataSourceView()
366 366
 	{
367
-		if(!$this->_currentViewValid)
367
+		if (!$this->_currentViewValid)
368 368
 		{
369
-			if($this->_currentView && $this->_currentViewIsFromDataSourceID)
370
-				$this->_currentView->detachEventHandler('DataSourceViewChanged',array($this,'dataSourceViewChanged'));
371
-			if(($dataSource=$this->determineDataSource())!==null)
369
+			if ($this->_currentView && $this->_currentViewIsFromDataSourceID)
370
+				$this->_currentView->detachEventHandler('DataSourceViewChanged', array($this, 'dataSourceViewChanged'));
371
+			if (($dataSource = $this->determineDataSource()) !== null)
372 372
 			{
373
-				if(($view=$dataSource->getView($this->getDataMember()))===null)
374
-					throw new TInvalidDataValueException('databoundcontrol_datamember_invalid',$this->getDataMember());
375
-				if($this->_currentViewIsFromDataSourceID=$this->getUsingDataSourceID())
376
-					$view->attachEventHandler('OnDataSourceViewChanged',array($this,'dataSourceViewChanged'));
377
-				$this->_currentView=$view;
373
+				if (($view = $dataSource->getView($this->getDataMember())) === null)
374
+					throw new TInvalidDataValueException('databoundcontrol_datamember_invalid', $this->getDataMember());
375
+				if ($this->_currentViewIsFromDataSourceID = $this->getUsingDataSourceID())
376
+					$view->attachEventHandler('OnDataSourceViewChanged', array($this, 'dataSourceViewChanged'));
377
+				$this->_currentView = $view;
378 378
 			}
379 379
 			else
380
-				$this->_currentView=null;
381
-			$this->_currentViewValid=true;
380
+				$this->_currentView = null;
381
+			$this->_currentViewValid = true;
382 382
 		}
383 383
 		return $this->_currentView;
384 384
 	}
385 385
 
386 386
 	protected function determineDataSource()
387 387
 	{
388
-		if(!$this->_currentDataSourceValid)
388
+		if (!$this->_currentDataSourceValid)
389 389
 		{
390
-			if(($dsid=$this->getDataSourceID())!=='')
390
+			if (($dsid = $this->getDataSourceID()) !== '')
391 391
 			{
392
-				if(($dataSource=$this->getNamingContainer()->findControl($dsid))===null)
393
-					throw new TInvalidDataValueException('databoundcontrol_datasourceid_inexistent',$dsid);
394
-				else if(!($dataSource instanceof IDataSource))
395
-					throw new TInvalidDataValueException('databoundcontrol_datasourceid_invalid',$dsid);
392
+				if (($dataSource = $this->getNamingContainer()->findControl($dsid)) === null)
393
+					throw new TInvalidDataValueException('databoundcontrol_datasourceid_inexistent', $dsid);
394
+				else if (!($dataSource instanceof IDataSource))
395
+					throw new TInvalidDataValueException('databoundcontrol_datasourceid_invalid', $dsid);
396 396
 				else
397
-					$this->_currentDataSource=$dataSource;
397
+					$this->_currentDataSource = $dataSource;
398 398
 			}
399
-			else if(($dataSource=$this->getDataSource())!==null)
400
-				$this->_currentDataSource=new TReadOnlyDataSource($dataSource,$this->getDataMember());
399
+			else if (($dataSource = $this->getDataSource()) !== null)
400
+				$this->_currentDataSource = new TReadOnlyDataSource($dataSource, $this->getDataMember());
401 401
 			else
402
-				$this->_currentDataSource=null;
403
-			$this->_currentDataSourceValid=true;
402
+				$this->_currentDataSource = null;
403
+			$this->_currentDataSourceValid = true;
404 404
 		}
405 405
 		return $this->_currentDataSource;
406 406
 	}
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 	 */
415 415
 	public function onDataBound($param)
416 416
 	{
417
-		$this->raiseEvent('OnDataBound',$this,$param);
417
+		$this->raiseEvent('OnDataBound', $this, $param);
418 418
 	}
419 419
 
420 420
 	/**
@@ -427,8 +427,8 @@  discard block
 block discarded – undo
427 427
 	public function onInit($param)
428 428
 	{
429 429
 		parent::onInit($param);
430
-		$page=$this->getPage();
431
-		$page->attachEventHandler('OnPreLoad',array($this,'pagePreLoad'));
430
+		$page = $this->getPage();
431
+		$page->attachEventHandler('OnPreLoad', array($this, 'pagePreLoad'));
432 432
 	}
433 433
 
434 434
 	/**
@@ -437,11 +437,11 @@  discard block
 block discarded – undo
437 437
 	 * @param mixed event sender
438 438
 	 * @param TEventParameter event parameter
439 439
 	 */
440
-	public function pagePreLoad($sender,$param)
440
+	public function pagePreLoad($sender, $param)
441 441
 	{
442
-		$this->_initialized=true;
443
-		$isPostBack=$this->getPage()->getIsPostBack();
444
-		if(!$isPostBack || ($isPostBack && (!$this->getEnableViewState(true) || !$this->getIsDataBound())))
442
+		$this->_initialized = true;
443
+		$isPostBack = $this->getPage()->getIsPostBack();
444
+		if (!$isPostBack || ($isPostBack && (!$this->getEnableViewState(true) || !$this->getIsDataBound())))
445 445
 			$this->setRequiresDataBinding(true);
446 446
 	}
447 447
 
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 	 */
453 453
 	public function onPreRender($param)
454 454
 	{
455
-		$this->_prerendered=true;
455
+		$this->_prerendered = true;
456 456
 		$this->ensureDataBound();
457 457
 		parent::onPreRender($param);
458 458
 	}
@@ -466,44 +466,44 @@  discard block
 block discarded – undo
466 466
 	 */
467 467
 	protected function validateDataSource($value)
468 468
 	{
469
-		if(is_string($value))
469
+		if (is_string($value))
470 470
 		{
471
-			$list=new TList;
472
-			foreach(TPropertyValue::ensureArray($value) as $key=>$value)
471
+			$list = new TList;
472
+			foreach (TPropertyValue::ensureArray($value) as $key=>$value)
473 473
 			{
474
-				if(is_array($value))
474
+				if (is_array($value))
475 475
 					$list->add($value);
476 476
 				else
477
-					$list->add(array($value,is_string($key)?$key:$value));
477
+					$list->add(array($value, is_string($key) ? $key : $value));
478 478
 			}
479 479
 			return $list;
480 480
 		}
481
-		else if(is_array($value))
481
+		else if (is_array($value))
482 482
 			return new TMap($value);
483
-		else if($value instanceof TDbDataReader) {
483
+		else if ($value instanceof TDbDataReader) {
484 484
 			// read array from TDbDataReader since it's forward-only stream and can only be traversed once
485 485
 			return $value->readAll();
486 486
 		}
487
-		else if(($value instanceof Traversable) || $value===null)
487
+		else if (($value instanceof Traversable) || $value === null)
488 488
 			return $value;
489 489
 		else
490
-			throw new TInvalidDataTypeException('databoundcontrol_datasource_invalid',get_class($this));
490
+			throw new TInvalidDataTypeException('databoundcontrol_datasource_invalid', get_class($this));
491 491
 	}
492 492
 
493 493
 	public function getDataMember()
494 494
 	{
495
-		return $this->getViewState('DataMember','');
495
+		return $this->getViewState('DataMember', '');
496 496
 	}
497 497
 
498 498
 	public function setDataMember($value)
499 499
 	{
500
-		$this->setViewState('DataMember',$value,'');
500
+		$this->setViewState('DataMember', $value, '');
501 501
 	}
502 502
 
503 503
 	public function getSelectParameters()
504 504
 	{
505
-		if(!$this->_parameters)
506
-			$this->_parameters=new TDataSourceSelectParameters;
505
+		if (!$this->_parameters)
506
+			$this->_parameters = new TDataSourceSelectParameters;
507 507
 		return $this->_parameters;
508 508
 	}
509 509
 }
@@ -530,14 +530,14 @@  discard block
 block discarded – undo
530 530
  */
531 531
 class TListItemType extends TEnumerable
532 532
 {
533
-	const Header='Header';
534
-	const Footer='Footer';
535
-	const Item='Item';
536
-	const Separator='Separator';
537
-	const AlternatingItem='AlternatingItem';
538
-	const EditItem='EditItem';
539
-	const SelectedItem='SelectedItem';
540
-	const Pager='Pager';
533
+	const Header = 'Header';
534
+	const Footer = 'Footer';
535
+	const Item = 'Item';
536
+	const Separator = 'Separator';
537
+	const AlternatingItem = 'AlternatingItem';
538
+	const EditItem = 'EditItem';
539
+	const SelectedItem = 'SelectedItem';
540
+	const Pager = 'Pager';
541 541
 }
542 542
 
543 543
 
Please login to merge, or discard this patch.
Braces   +66 added lines, -54 removed lines patch added patch discarded remove patch
@@ -92,8 +92,9 @@  discard block
 block discarded – undo
92 92
 	public function setDataSourceID($value)
93 93
 	{
94 94
 		$dsid=$this->getViewState('DataSourceID','');
95
-		if($dsid!=='' && $value==='')
96
-			$this->_requiresBindToNull=true;
95
+		if($dsid!=='' && $value==='') {
96
+					$this->_requiresBindToNull=true;
97
+		}
97 98
 		$this->setViewState('DataSourceID',$value,'');
98 99
 		$this->onDataSourceChanged();
99 100
 	}
@@ -116,8 +117,9 @@  discard block
 block discarded – undo
116 117
 	{
117 118
 		$this->_currentViewValid=false;
118 119
 		$this->_currentDataSourceValid=false;
119
-		if($this->getInitialized())
120
-			$this->setRequiresDataBinding(true);
120
+		if($this->getInitialized()) {
121
+					$this->setRequiresDataBinding(true);
122
+		}
121 123
 	}
122 124
 
123 125
 	/**
@@ -215,8 +217,9 @@  discard block
 block discarded – undo
215 217
 	 */
216 218
 	public function setCurrentPageIndex($value)
217 219
 	{
218
-		if(($value=TPropertyValue::ensureInteger($value))<0)
219
-			$value=0;
220
+		if(($value=TPropertyValue::ensureInteger($value))<0) {
221
+					$value=0;
222
+		}
220 223
 		$this->setViewState('CurrentPageIndex',$value,0);
221 224
 	}
222 225
 
@@ -234,8 +237,9 @@  discard block
 block discarded – undo
234 237
 	 */
235 238
 	public function setPageSize($value)
236 239
 	{
237
-		if(($value=TPropertyValue::ensureInteger($value))<1)
238
-			throw new TInvalidDataValueException('databoundcontrol_pagesize_invalid',get_class($this));
240
+		if(($value=TPropertyValue::ensureInteger($value))<1) {
241
+					throw new TInvalidDataValueException('databoundcontrol_pagesize_invalid',get_class($this));
242
+		}
239 243
 		$this->setViewState('PageSize',TPropertyValue::ensureInteger($value),10);
240 244
 	}
241 245
 
@@ -263,8 +267,9 @@  discard block
 block discarded – undo
263 267
 	 */
264 268
 	public function setVirtualItemCount($value)
265 269
 	{
266
-		if(($value=TPropertyValue::ensureInteger($value))<0)
267
-			throw new TInvalidDataValueException('databoundcontrol_virtualitemcount_invalid',get_class($this));
270
+		if(($value=TPropertyValue::ensureInteger($value))<0) {
271
+					throw new TInvalidDataValueException('databoundcontrol_virtualitemcount_invalid',get_class($this));
272
+		}
268 273
 		$this->setViewState('VirtualItemCount',$value,0);
269 274
 	}
270 275
 
@@ -281,9 +286,9 @@  discard block
 block discarded – undo
281 286
 		{
282 287
 			$this->_requiresDataBinding=true;
283 288
 			$this->ensureDataBound();
289
+		} else {
290
+					$this->_requiresDataBinding=$value;
284 291
 		}
285
-		else
286
-			$this->_requiresDataBinding=$value;
287 292
 	}
288 293
 
289 294
 	/**
@@ -327,10 +332,11 @@  discard block
 block discarded – undo
327 332
 		$this->dataBindProperties();
328 333
 		$this->onDataBinding(null);
329 334
 
330
-		if(($view=$this->getDataSourceView())!==null)
331
-			$data=$view->select($this->getSelectParameters());
332
-		else
333
-			$data=null;
335
+		if(($view=$this->getDataSourceView())!==null) {
336
+					$data=$view->select($this->getSelectParameters());
337
+		} else {
338
+					$data=null;
339
+		}
334 340
 
335 341
 		if($data instanceof Traversable)
336 342
 		{
@@ -345,8 +351,7 @@  discard block
 block discarded – undo
345 351
 					$this->setCurrentPageIndex($ds->getCurrentPageIndex());
346 352
 				}
347 353
 				$this->performDataBinding($ds);
348
-			}
349
-			else
354
+			} else
350 355
 			{
351 356
 				$this->clearViewState('PageCount');
352 357
 				$this->performDataBinding($data);
@@ -358,26 +363,30 @@  discard block
 block discarded – undo
358 363
 
359 364
 	public function dataSourceViewChanged($sender,$param)
360 365
 	{
361
-		if(!$this->_ignoreDataSourceViewChanged)
362
-			$this->setRequiresDataBinding(true);
366
+		if(!$this->_ignoreDataSourceViewChanged) {
367
+					$this->setRequiresDataBinding(true);
368
+		}
363 369
 	}
364 370
 
365 371
 	protected function getDataSourceView()
366 372
 	{
367 373
 		if(!$this->_currentViewValid)
368 374
 		{
369
-			if($this->_currentView && $this->_currentViewIsFromDataSourceID)
370
-				$this->_currentView->detachEventHandler('DataSourceViewChanged',array($this,'dataSourceViewChanged'));
375
+			if($this->_currentView && $this->_currentViewIsFromDataSourceID) {
376
+							$this->_currentView->detachEventHandler('DataSourceViewChanged',array($this,'dataSourceViewChanged'));
377
+			}
371 378
 			if(($dataSource=$this->determineDataSource())!==null)
372 379
 			{
373
-				if(($view=$dataSource->getView($this->getDataMember()))===null)
374
-					throw new TInvalidDataValueException('databoundcontrol_datamember_invalid',$this->getDataMember());
375
-				if($this->_currentViewIsFromDataSourceID=$this->getUsingDataSourceID())
376
-					$view->attachEventHandler('OnDataSourceViewChanged',array($this,'dataSourceViewChanged'));
380
+				if(($view=$dataSource->getView($this->getDataMember()))===null) {
381
+									throw new TInvalidDataValueException('databoundcontrol_datamember_invalid',$this->getDataMember());
382
+				}
383
+				if($this->_currentViewIsFromDataSourceID=$this->getUsingDataSourceID()) {
384
+									$view->attachEventHandler('OnDataSourceViewChanged',array($this,'dataSourceViewChanged'));
385
+				}
377 386
 				$this->_currentView=$view;
387
+			} else {
388
+							$this->_currentView=null;
378 389
 			}
379
-			else
380
-				$this->_currentView=null;
381 390
 			$this->_currentViewValid=true;
382 391
 		}
383 392
 		return $this->_currentView;
@@ -389,17 +398,18 @@  discard block
 block discarded – undo
389 398
 		{
390 399
 			if(($dsid=$this->getDataSourceID())!=='')
391 400
 			{
392
-				if(($dataSource=$this->getNamingContainer()->findControl($dsid))===null)
393
-					throw new TInvalidDataValueException('databoundcontrol_datasourceid_inexistent',$dsid);
394
-				else if(!($dataSource instanceof IDataSource))
395
-					throw new TInvalidDataValueException('databoundcontrol_datasourceid_invalid',$dsid);
396
-				else
397
-					$this->_currentDataSource=$dataSource;
401
+				if(($dataSource=$this->getNamingContainer()->findControl($dsid))===null) {
402
+									throw new TInvalidDataValueException('databoundcontrol_datasourceid_inexistent',$dsid);
403
+				} else if(!($dataSource instanceof IDataSource)) {
404
+									throw new TInvalidDataValueException('databoundcontrol_datasourceid_invalid',$dsid);
405
+				} else {
406
+									$this->_currentDataSource=$dataSource;
407
+				}
408
+			} else if(($dataSource=$this->getDataSource())!==null) {
409
+							$this->_currentDataSource=new TReadOnlyDataSource($dataSource,$this->getDataMember());
410
+			} else {
411
+							$this->_currentDataSource=null;
398 412
 			}
399
-			else if(($dataSource=$this->getDataSource())!==null)
400
-				$this->_currentDataSource=new TReadOnlyDataSource($dataSource,$this->getDataMember());
401
-			else
402
-				$this->_currentDataSource=null;
403 413
 			$this->_currentDataSourceValid=true;
404 414
 		}
405 415
 		return $this->_currentDataSource;
@@ -441,8 +451,9 @@  discard block
 block discarded – undo
441 451
 	{
442 452
 		$this->_initialized=true;
443 453
 		$isPostBack=$this->getPage()->getIsPostBack();
444
-		if(!$isPostBack || ($isPostBack && (!$this->getEnableViewState(true) || !$this->getIsDataBound())))
445
-			$this->setRequiresDataBinding(true);
454
+		if(!$isPostBack || ($isPostBack && (!$this->getEnableViewState(true) || !$this->getIsDataBound()))) {
455
+					$this->setRequiresDataBinding(true);
456
+		}
446 457
 	}
447 458
 
448 459
 	/**
@@ -471,23 +482,23 @@  discard block
 block discarded – undo
471 482
 			$list=new TList;
472 483
 			foreach(TPropertyValue::ensureArray($value) as $key=>$value)
473 484
 			{
474
-				if(is_array($value))
475
-					$list->add($value);
476
-				else
477
-					$list->add(array($value,is_string($key)?$key:$value));
485
+				if(is_array($value)) {
486
+									$list->add($value);
487
+				} else {
488
+									$list->add(array($value,is_string($key)?$key:$value));
489
+				}
478 490
 			}
479 491
 			return $list;
480
-		}
481
-		else if(is_array($value))
482
-			return new TMap($value);
483
-		else if($value instanceof TDbDataReader) {
492
+		} else if(is_array($value)) {
493
+					return new TMap($value);
494
+		} else if($value instanceof TDbDataReader) {
484 495
 			// read array from TDbDataReader since it's forward-only stream and can only be traversed once
485 496
 			return $value->readAll();
497
+		} else if(($value instanceof Traversable) || $value===null) {
498
+					return $value;
499
+		} else {
500
+					throw new TInvalidDataTypeException('databoundcontrol_datasource_invalid',get_class($this));
486 501
 		}
487
-		else if(($value instanceof Traversable) || $value===null)
488
-			return $value;
489
-		else
490
-			throw new TInvalidDataTypeException('databoundcontrol_datasource_invalid',get_class($this));
491 502
 	}
492 503
 
493 504
 	public function getDataMember()
@@ -502,8 +513,9 @@  discard block
 block discarded – undo
502 513
 
503 514
 	public function getSelectParameters()
504 515
 	{
505
-		if(!$this->_parameters)
506
-			$this->_parameters=new TDataSourceSelectParameters;
516
+		if(!$this->_parameters) {
517
+					$this->_parameters=new TDataSourceSelectParameters;
518
+		}
507 519
 		return $this->_parameters;
508 520
 	}
509 521
 }
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TDataGrid.php 3 patches
Doc Comments   +24 added lines, -1 removed lines patch added patch discarded remove patch
@@ -534,6 +534,7 @@  discard block
 block discarded – undo
534 534
 	 * If the item to be selected is already in edit mode, it will remain in edit mode.
535 535
 	 * If the index is less than 0, any existing selection will be cleared up.
536 536
 	 * @param integer the selected item index
537
+	 * @param integer $value
537 538
 	 */
538 539
 	public function setSelectedItemIndex($value)
539 540
 	{
@@ -762,6 +763,7 @@  discard block
 block discarded – undo
762 763
 	 * This method is invoked when a button control raises <b>OnCommand</b> event
763 764
 	 * with <b>cancel</b> command name.
764 765
 	 * @param TDataGridCommandEventParameter event parameter
766
+	 * @param TDataGridCommandEventParameter $param
765 767
 	 */
766 768
 	public function onCancelCommand($param)
767 769
 	{
@@ -773,6 +775,7 @@  discard block
 block discarded – undo
773 775
 	 * This method is invoked when a button control raises <b>OnCommand</b> event
774 776
 	 * with <b>delete</b> command name.
775 777
 	 * @param TDataGridCommandEventParameter event parameter
778
+	 * @param TDataGridCommandEventParameter $param
776 779
 	 */
777 780
 	public function onDeleteCommand($param)
778 781
 	{
@@ -784,6 +787,7 @@  discard block
 block discarded – undo
784 787
 	 * This method is invoked when a button control raises <b>OnCommand</b> event
785 788
 	 * with <b>edit</b> command name.
786 789
 	 * @param TDataGridCommandEventParameter event parameter
790
+	 * @param TDataGridCommandEventParameter $param
787 791
 	 */
788 792
 	public function onEditCommand($param)
789 793
 	{
@@ -794,6 +798,7 @@  discard block
 block discarded – undo
794 798
 	 * Raises <b>OnItemCommand</b> event.
795 799
 	 * This method is invoked when a button control raises <b>OnCommand</b> event.
796 800
 	 * @param TDataGridCommandEventParameter event parameter
801
+	 * @param TDataGridCommandEventParameter $param
797 802
 	 */
798 803
 	public function onItemCommand($param)
799 804
 	{
@@ -805,6 +810,7 @@  discard block
 block discarded – undo
805 810
 	 * This method is invoked when a button control raises <b>OnCommand</b> event
806 811
 	 * with <b>sort</b> command name.
807 812
 	 * @param TDataGridSortCommandEventParameter event parameter
813
+	 * @param TDataGridSortCommandEventParameter $param
808 814
 	 */
809 815
 	public function onSortCommand($param)
810 816
 	{
@@ -816,6 +822,7 @@  discard block
 block discarded – undo
816 822
 	 * This method is invoked when a button control raises <b>OnCommand</b> event
817 823
 	 * with <b>update</b> command name.
818 824
 	 * @param TDataGridCommandEventParameter event parameter
825
+	 * @param TDataGridCommandEventParameter $param
819 826
 	 */
820 827
 	public function onUpdateCommand($param)
821 828
 	{
@@ -827,6 +834,7 @@  discard block
 block discarded – undo
827 834
 	 * This method is invoked right after a datagrid item is created and before
828 835
 	 * added to page hierarchy.
829 836
 	 * @param TDataGridItemEventParameter event parameter
837
+	 * @param TDataGridItemEventParameter $param
830 838
 	 */
831 839
 	public function onItemCreated($param)
832 840
 	{
@@ -838,6 +846,7 @@  discard block
 block discarded – undo
838 846
 	 * This method is invoked right after a datagrid pager is created and before
839 847
 	 * added to page hierarchy.
840 848
 	 * @param TDataGridPagerEventParameter event parameter
849
+	 * @param TDataGridPagerEventParameter $param
841 850
 	 */
842 851
 	public function onPagerCreated($param)
843 852
 	{
@@ -849,6 +858,7 @@  discard block
 block discarded – undo
849 858
 	 * This method is invoked for each datagrid item after it performs
850 859
 	 * databinding.
851 860
 	 * @param TDataGridItemEventParameter event parameter
861
+	 * @param TDataGridItemEventParameter $param
852 862
 	 */
853 863
 	public function onItemDataBound($param)
854 864
 	{
@@ -859,6 +869,7 @@  discard block
 block discarded – undo
859 869
 	 * Raises <b>OnPageIndexChanged</b> event.
860 870
 	 * This method is invoked when current page is changed.
861 871
 	 * @param TDataGridPageChangedEventParameter event parameter
872
+	 * @param TDataGridPageChangedEventParameter $param
862 873
 	 */
863 874
 	public function onPageIndexChanged($param)
864 875
 	{
@@ -1155,6 +1166,11 @@  discard block
 block discarded – undo
1155 1166
 		return new TDataGridItem($itemIndex,$dataSourceIndex,$itemType);
1156 1167
 	}
1157 1168
 
1169
+	/**
1170
+	 * @param integer $itemIndex
1171
+	 * @param boolean $dataBind
1172
+	 * @param TList $columns
1173
+	 */
1158 1174
 	private function createItemInternal($itemIndex,$dataSourceIndex,$itemType,$dataBind,$dataItem,$columns)
1159 1175
 	{
1160 1176
 		$item=$this->createItem($itemIndex,$dataSourceIndex,$itemType);
@@ -1180,6 +1196,7 @@  discard block
 block discarded – undo
1180 1196
 	 * Initializes a datagrid item and cells inside it
1181 1197
 	 * @param TDataGrid datagrid item to be initialized
1182 1198
 	 * @param TDataGridColumnCollection datagrid columns to be used to initialize the cells in the item
1199
+	 * @param TDataGridItem $item
1183 1200
 	 */
1184 1201
 	protected function initializeItem($item,$columns)
1185 1202
 	{
@@ -1212,6 +1229,7 @@  discard block
 block discarded – undo
1212 1229
 	/**
1213 1230
 	 * Builds the pager content based on pager style.
1214 1231
 	 * @param TDataGridPager the container for the pager
1232
+	 * @param TDataGridPager $pager
1215 1233
 	 */
1216 1234
 	protected function buildPager($pager)
1217 1235
 	{
@@ -1237,6 +1255,9 @@  discard block
 block discarded – undo
1237 1255
 	 * @param string caption of the button
1238 1256
 	 * @param string CommandName corresponding to the OnCommand event of the button
1239 1257
 	 * @param string CommandParameter corresponding to the OnCommand event of the button
1258
+	 * @param TDataGridPagerButtonType $buttonType
1259
+	 * @param boolean $enabled
1260
+	 * @param string $commandName
1240 1261
 	 * @return mixed the button instance
1241 1262
 	 */
1242 1263
 	protected function createPagerButton($pager,$buttonType,$enabled,$text,$commandName,$commandParameter)
@@ -1881,6 +1902,7 @@  discard block
 block discarded – undo
1881 1902
 	 * Constructor.
1882 1903
 	 * @param TControl the control originally raises the <b>OnCommand</b> event.
1883 1904
 	 * @param integer new page index
1905
+	 * @param integer $newPageIndex
1884 1906
 	 */
1885 1907
 	public function __construct($source,$newPageIndex)
1886 1908
 	{
@@ -1957,7 +1979,7 @@  discard block
 block discarded – undo
1957 1979
 	}
1958 1980
 
1959 1981
 	/**
1960
-	 * @return TListItemType item type.
1982
+	 * @return string item type.
1961 1983
 	 */
1962 1984
 	public function getItemType()
1963 1985
 	{
@@ -2062,6 +2084,7 @@  discard block
 block discarded – undo
2062 2084
 	/**
2063 2085
 	 * Constructor.
2064 2086
 	 * @param TDataGrid datagrid object
2087
+	 * @param TDataGrid $dataGrid
2065 2088
 	 */
2066 2089
 	public function __construct($dataGrid)
2067 2090
 	{
Please login to merge, or discard this patch.
Spacing   +466 added lines, -466 removed lines patch added patch discarded remove patch
@@ -153,68 +153,68 @@  discard block
 block discarded – undo
153 153
 	 * datagrid item types
154 154
 	 * @deprecated deprecated since version 3.0.4. Use TListItemType constants instead.
155 155
 	 */
156
-	const IT_HEADER='Header';
157
-	const IT_FOOTER='Footer';
158
-	const IT_ITEM='Item';
159
-	const IT_SEPARATOR='Separator';
160
-	const IT_ALTERNATINGITEM='AlternatingItem';
161
-	const IT_EDITITEM='EditItem';
162
-	const IT_SELECTEDITEM='SelectedItem';
163
-	const IT_PAGER='Pager';
156
+	const IT_HEADER = 'Header';
157
+	const IT_FOOTER = 'Footer';
158
+	const IT_ITEM = 'Item';
159
+	const IT_SEPARATOR = 'Separator';
160
+	const IT_ALTERNATINGITEM = 'AlternatingItem';
161
+	const IT_EDITITEM = 'EditItem';
162
+	const IT_SELECTEDITEM = 'SelectedItem';
163
+	const IT_PAGER = 'Pager';
164 164
 
165 165
 	/**
166 166
 	 * Command name that TDataGrid understands.
167 167
 	 */
168
-	const CMD_SELECT='Select';
169
-	const CMD_EDIT='Edit';
170
-	const CMD_UPDATE='Update';
171
-	const CMD_DELETE='Delete';
172
-	const CMD_CANCEL='Cancel';
173
-	const CMD_SORT='Sort';
174
-	const CMD_PAGE='Page';
175
-	const CMD_PAGE_NEXT='Next';
176
-	const CMD_PAGE_PREV='Previous';
177
-	const CMD_PAGE_FIRST='First';
178
-	const CMD_PAGE_LAST='Last';
168
+	const CMD_SELECT = 'Select';
169
+	const CMD_EDIT = 'Edit';
170
+	const CMD_UPDATE = 'Update';
171
+	const CMD_DELETE = 'Delete';
172
+	const CMD_CANCEL = 'Cancel';
173
+	const CMD_SORT = 'Sort';
174
+	const CMD_PAGE = 'Page';
175
+	const CMD_PAGE_NEXT = 'Next';
176
+	const CMD_PAGE_PREV = 'Previous';
177
+	const CMD_PAGE_FIRST = 'First';
178
+	const CMD_PAGE_LAST = 'Last';
179 179
 
180 180
 	/**
181 181
 	 * @var TDataGridColumnCollection manually created column collection
182 182
 	 */
183
-	private $_columns=null;
183
+	private $_columns = null;
184 184
 	/**
185 185
 	 * @var TDataGridColumnCollection automatically created column collection
186 186
 	 */
187
-	private $_autoColumns=null;
187
+	private $_autoColumns = null;
188 188
 	/**
189 189
 	 * @var TList all columns including both manually and automatically created columns
190 190
 	 */
191
-	private $_allColumns=null;
191
+	private $_allColumns = null;
192 192
 	/**
193 193
 	 * @var TDataGridItemCollection datagrid item collection
194 194
 	 */
195
-	private $_items=null;
195
+	private $_items = null;
196 196
 	/**
197 197
 	 * @var TDataGridItem header item
198 198
 	 */
199
-	private $_header=null;
199
+	private $_header = null;
200 200
 	/**
201 201
 	 * @var TDataGridItem footer item
202 202
 	 */
203
-	private $_footer=null;
203
+	private $_footer = null;
204 204
 	/**
205 205
 	 * @var TPagedDataSource paged data source object
206 206
 	 */
207
-	private $_pagedDataSource=null;
208
-	private $_topPager=null;
209
-	private $_bottomPager=null;
207
+	private $_pagedDataSource = null;
208
+	private $_topPager = null;
209
+	private $_bottomPager = null;
210 210
 	/**
211 211
 	 * @var ITemplate template used when empty data is bounded
212 212
 	 */
213
-	private $_emptyTemplate=null;
213
+	private $_emptyTemplate = null;
214 214
 	/**
215 215
 	 * @var boolean whether empty template is effective
216 216
 	 */
217
-	private $_useEmptyTemplate=false;
217
+	private $_useEmptyTemplate = false;
218 218
 
219 219
 	/**
220 220
 	 * @return string tag name (table) of the datagrid
@@ -239,10 +239,10 @@  discard block
 block discarded – undo
239 239
 	 */
240 240
 	public function addParsedObject($object)
241 241
 	{
242
-		if($object instanceof TDataGridColumn)
242
+		if ($object instanceof TDataGridColumn)
243 243
 			$this->getColumns()->add($object);
244 244
 		else
245
-			parent::addParsedObject($object);  // this is needed by EmptyTemplate
245
+			parent::addParsedObject($object); // this is needed by EmptyTemplate
246 246
 	}
247 247
 
248 248
 	/**
@@ -250,8 +250,8 @@  discard block
 block discarded – undo
250 250
 	 */
251 251
 	public function getColumns()
252 252
 	{
253
-		if(!$this->_columns)
254
-			$this->_columns=new TDataGridColumnCollection($this);
253
+		if (!$this->_columns)
254
+			$this->_columns = new TDataGridColumnCollection($this);
255 255
 		return $this->_columns;
256 256
 	}
257 257
 
@@ -260,8 +260,8 @@  discard block
 block discarded – undo
260 260
 	 */
261 261
 	public function getAutoColumns()
262 262
 	{
263
-		if(!$this->_autoColumns)
264
-			$this->_autoColumns=new TDataGridColumnCollection($this);
263
+		if (!$this->_autoColumns)
264
+			$this->_autoColumns = new TDataGridColumnCollection($this);
265 265
 		return $this->_autoColumns;
266 266
 	}
267 267
 
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
 	 */
271 271
 	public function getItems()
272 272
 	{
273
-		if(!$this->_items)
274
-			$this->_items=new TDataGridItemCollection;
273
+		if (!$this->_items)
274
+			$this->_items = new TDataGridItemCollection;
275 275
 		return $this->_items;
276 276
 	}
277 277
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 	 */
281 281
 	public function getItemCount()
282 282
 	{
283
-		return $this->_items?$this->_items->getCount():0;
283
+		return $this->_items ? $this->_items->getCount() : 0;
284 284
 	}
285 285
 
286 286
 	/**
@@ -314,10 +314,10 @@  discard block
 block discarded – undo
314 314
 	 */
315 315
 	public function getItemStyle()
316 316
 	{
317
-		if(($style=$this->getViewState('ItemStyle',null))===null)
317
+		if (($style = $this->getViewState('ItemStyle', null)) === null)
318 318
 		{
319
-			$style=new TTableItemStyle;
320
-			$this->setViewState('ItemStyle',$style,null);
319
+			$style = new TTableItemStyle;
320
+			$this->setViewState('ItemStyle', $style, null);
321 321
 		}
322 322
 		return $style;
323 323
 	}
@@ -327,10 +327,10 @@  discard block
 block discarded – undo
327 327
 	 */
328 328
 	public function getAlternatingItemStyle()
329 329
 	{
330
-		if(($style=$this->getViewState('AlternatingItemStyle',null))===null)
330
+		if (($style = $this->getViewState('AlternatingItemStyle', null)) === null)
331 331
 		{
332
-			$style=new TTableItemStyle;
333
-			$this->setViewState('AlternatingItemStyle',$style,null);
332
+			$style = new TTableItemStyle;
333
+			$this->setViewState('AlternatingItemStyle', $style, null);
334 334
 		}
335 335
 		return $style;
336 336
 	}
@@ -340,10 +340,10 @@  discard block
 block discarded – undo
340 340
 	 */
341 341
 	public function getSelectedItemStyle()
342 342
 	{
343
-		if(($style=$this->getViewState('SelectedItemStyle',null))===null)
343
+		if (($style = $this->getViewState('SelectedItemStyle', null)) === null)
344 344
 		{
345
-			$style=new TTableItemStyle;
346
-			$this->setViewState('SelectedItemStyle',$style,null);
345
+			$style = new TTableItemStyle;
346
+			$this->setViewState('SelectedItemStyle', $style, null);
347 347
 		}
348 348
 		return $style;
349 349
 	}
@@ -353,10 +353,10 @@  discard block
 block discarded – undo
353 353
 	 */
354 354
 	public function getEditItemStyle()
355 355
 	{
356
-		if(($style=$this->getViewState('EditItemStyle',null))===null)
356
+		if (($style = $this->getViewState('EditItemStyle', null)) === null)
357 357
 		{
358
-			$style=new TTableItemStyle;
359
-			$this->setViewState('EditItemStyle',$style,null);
358
+			$style = new TTableItemStyle;
359
+			$this->setViewState('EditItemStyle', $style, null);
360 360
 		}
361 361
 		return $style;
362 362
 	}
@@ -366,10 +366,10 @@  discard block
 block discarded – undo
366 366
 	 */
367 367
 	public function getHeaderStyle()
368 368
 	{
369
-		if(($style=$this->getViewState('HeaderStyle',null))===null)
369
+		if (($style = $this->getViewState('HeaderStyle', null)) === null)
370 370
 		{
371
-			$style=new TTableItemStyle;
372
-			$this->setViewState('HeaderStyle',$style,null);
371
+			$style = new TTableItemStyle;
372
+			$this->setViewState('HeaderStyle', $style, null);
373 373
 		}
374 374
 		return $style;
375 375
 	}
@@ -379,10 +379,10 @@  discard block
 block discarded – undo
379 379
 	 */
380 380
 	public function getFooterStyle()
381 381
 	{
382
-		if(($style=$this->getViewState('FooterStyle',null))===null)
382
+		if (($style = $this->getViewState('FooterStyle', null)) === null)
383 383
 		{
384
-			$style=new TTableItemStyle;
385
-			$this->setViewState('FooterStyle',$style,null);
384
+			$style = new TTableItemStyle;
385
+			$this->setViewState('FooterStyle', $style, null);
386 386
 		}
387 387
 		return $style;
388 388
 	}
@@ -392,10 +392,10 @@  discard block
 block discarded – undo
392 392
 	 */
393 393
 	public function getPagerStyle()
394 394
 	{
395
-		if(($style=$this->getViewState('PagerStyle',null))===null)
395
+		if (($style = $this->getViewState('PagerStyle', null)) === null)
396 396
 		{
397
-			$style=new TDataGridPagerStyle;
398
-			$this->setViewState('PagerStyle',$style,null);
397
+			$style = new TDataGridPagerStyle;
398
+			$this->setViewState('PagerStyle', $style, null);
399 399
 		}
400 400
 		return $style;
401 401
 	}
@@ -406,10 +406,10 @@  discard block
 block discarded – undo
406 406
 	 */
407 407
 	public function getTableHeadStyle()
408 408
 	{
409
-		if(($style=$this->getViewState('TableHeadStyle',null))===null)
409
+		if (($style = $this->getViewState('TableHeadStyle', null)) === null)
410 410
 		{
411
-			$style=new TStyle;
412
-			$this->setViewState('TableHeadStyle',$style,null);
411
+			$style = new TStyle;
412
+			$this->setViewState('TableHeadStyle', $style, null);
413 413
 		}
414 414
 		return $style;
415 415
 	}
@@ -420,10 +420,10 @@  discard block
 block discarded – undo
420 420
 	 */
421 421
 	public function getTableBodyStyle()
422 422
 	{
423
-		if(($style=$this->getViewState('TableBodyStyle',null))===null)
423
+		if (($style = $this->getViewState('TableBodyStyle', null)) === null)
424 424
 		{
425
-			$style=new TStyle;
426
-			$this->setViewState('TableBodyStyle',$style,null);
425
+			$style = new TStyle;
426
+			$this->setViewState('TableBodyStyle', $style, null);
427 427
 		}
428 428
 		return $style;
429 429
 	}
@@ -434,10 +434,10 @@  discard block
 block discarded – undo
434 434
 	 */
435 435
 	public function getTableFootStyle()
436 436
 	{
437
-		if(($style=$this->getViewState('TableFootStyle',null))===null)
437
+		if (($style = $this->getViewState('TableFootStyle', null)) === null)
438 438
 		{
439
-			$style=new TStyle;
440
-			$this->setViewState('TableFootStyle',$style,null);
439
+			$style = new TStyle;
440
+			$this->setViewState('TableFootStyle', $style, null);
441 441
 		}
442 442
 		return $style;
443 443
 	}
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 	 */
448 448
 	public function getCaption()
449 449
 	{
450
-		return $this->getViewState('Caption','');
450
+		return $this->getViewState('Caption', '');
451 451
 	}
452 452
 
453 453
 	/**
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 	 */
456 456
 	public function setCaption($value)
457 457
 	{
458
-		$this->setViewState('Caption',$value,'');
458
+		$this->setViewState('Caption', $value, '');
459 459
 	}
460 460
 
461 461
 	/**
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 	 */
464 464
 	public function getCaptionAlign()
465 465
 	{
466
-		return $this->getViewState('CaptionAlign',TTableCaptionAlign::NotSet);
466
+		return $this->getViewState('CaptionAlign', TTableCaptionAlign::NotSet);
467 467
 	}
468 468
 
469 469
 	/**
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 	 */
472 472
 	public function setCaptionAlign($value)
473 473
 	{
474
-		$this->setViewState('CaptionAlign',TPropertyValue::ensureEnum($value,'TTableCaptionAlign'),TTableCaptionAlign::NotSet);
474
+		$this->setViewState('CaptionAlign', TPropertyValue::ensureEnum($value, 'TTableCaptionAlign'), TTableCaptionAlign::NotSet);
475 475
 	}
476 476
 
477 477
 	/**
@@ -511,9 +511,9 @@  discard block
 block discarded – undo
511 511
 	 */
512 512
 	public function getSelectedItem()
513 513
 	{
514
-		$index=$this->getSelectedItemIndex();
515
-		$items=$this->getItems();
516
-		if($index>=0 && $index<$items->getCount())
514
+		$index = $this->getSelectedItemIndex();
515
+		$items = $this->getItems();
516
+		if ($index >= 0 && $index < $items->getCount())
517 517
 			return $items->itemAt($index);
518 518
 		else
519 519
 			return null;
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
 	 */
526 526
 	public function getSelectedItemIndex()
527 527
 	{
528
-		return $this->getViewState('SelectedItemIndex',-1);
528
+		return $this->getViewState('SelectedItemIndex', -1);
529 529
 	}
530 530
 
531 531
 	/**
@@ -537,23 +537,23 @@  discard block
 block discarded – undo
537 537
 	 */
538 538
 	public function setSelectedItemIndex($value)
539 539
 	{
540
-		if(($value=TPropertyValue::ensureInteger($value))<0)
541
-			$value=-1;
542
-		if(($current=$this->getSelectedItemIndex())!==$value)
540
+		if (($value = TPropertyValue::ensureInteger($value)) < 0)
541
+			$value = -1;
542
+		if (($current = $this->getSelectedItemIndex()) !== $value)
543 543
 		{
544
-			$this->setViewState('SelectedItemIndex',$value,-1);
545
-			$items=$this->getItems();
546
-			$itemCount=$items->getCount();
547
-			if($current>=0 && $current<$itemCount)
544
+			$this->setViewState('SelectedItemIndex', $value, -1);
545
+			$items = $this->getItems();
546
+			$itemCount = $items->getCount();
547
+			if ($current >= 0 && $current < $itemCount)
548 548
 			{
549
-				$item=$items->itemAt($current);
550
-				if($item->getItemType()!==TListItemType::EditItem)
551
-					$item->setItemType($current%2?TListItemType::AlternatingItem:TListItemType::Item);
549
+				$item = $items->itemAt($current);
550
+				if ($item->getItemType() !== TListItemType::EditItem)
551
+					$item->setItemType($current % 2 ? TListItemType::AlternatingItem : TListItemType::Item);
552 552
 			}
553
-			if($value>=0 && $value<$itemCount)
553
+			if ($value >= 0 && $value < $itemCount)
554 554
 			{
555
-				$item=$items->itemAt($value);
556
-				if($item->getItemType()!==TListItemType::EditItem)
555
+				$item = $items->itemAt($value);
556
+				if ($item->getItemType() !== TListItemType::EditItem)
557 557
 					$item->setItemType(TListItemType::SelectedItem);
558 558
 			}
559 559
 		}
@@ -564,9 +564,9 @@  discard block
 block discarded – undo
564 564
 	 */
565 565
 	public function getEditItem()
566 566
 	{
567
-		$index=$this->getEditItemIndex();
568
-		$items=$this->getItems();
569
-		if($index>=0 && $index<$items->getCount())
567
+		$index = $this->getEditItemIndex();
568
+		$items = $this->getItems();
569
+		if ($index >= 0 && $index < $items->getCount())
570 570
 			return $items->itemAt($index);
571 571
 		else
572 572
 			return null;
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
 	 */
579 579
 	public function getEditItemIndex()
580 580
 	{
581
-		return $this->getViewState('EditItemIndex',-1);
581
+		return $this->getViewState('EditItemIndex', -1);
582 582
 	}
583 583
 
584 584
 	/**
@@ -589,16 +589,16 @@  discard block
 block discarded – undo
589 589
 	 */
590 590
 	public function setEditItemIndex($value)
591 591
 	{
592
-		if(($value=TPropertyValue::ensureInteger($value))<0)
593
-			$value=-1;
594
-		if(($current=$this->getEditItemIndex())!==$value)
592
+		if (($value = TPropertyValue::ensureInteger($value)) < 0)
593
+			$value = -1;
594
+		if (($current = $this->getEditItemIndex()) !== $value)
595 595
 		{
596
-			$this->setViewState('EditItemIndex',$value,-1);
597
-			$items=$this->getItems();
598
-			$itemCount=$items->getCount();
599
-			if($current>=0 && $current<$itemCount)
600
-				$items->itemAt($current)->setItemType($current%2?TListItemType::AlternatingItem:TListItemType::Item);
601
-			if($value>=0 && $value<$itemCount)
596
+			$this->setViewState('EditItemIndex', $value, -1);
597
+			$items = $this->getItems();
598
+			$itemCount = $items->getCount();
599
+			if ($current >= 0 && $current < $itemCount)
600
+				$items->itemAt($current)->setItemType($current % 2 ? TListItemType::AlternatingItem : TListItemType::Item);
601
+			if ($value >= 0 && $value < $itemCount)
602 602
 				$items->itemAt($value)->setItemType(TListItemType::EditItem);
603 603
 		}
604 604
 	}
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 	 */
609 609
 	public function getAllowSorting()
610 610
 	{
611
-		return $this->getViewState('AllowSorting',false);
611
+		return $this->getViewState('AllowSorting', false);
612 612
 	}
613 613
 
614 614
 	/**
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
 	 */
617 617
 	public function setAllowSorting($value)
618 618
 	{
619
-		$this->setViewState('AllowSorting',TPropertyValue::ensureBoolean($value),false);
619
+		$this->setViewState('AllowSorting', TPropertyValue::ensureBoolean($value), false);
620 620
 	}
621 621
 
622 622
 	/**
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
 	 */
625 625
 	public function getAutoGenerateColumns()
626 626
 	{
627
-		return $this->getViewState('AutoGenerateColumns',true);
627
+		return $this->getViewState('AutoGenerateColumns', true);
628 628
 	}
629 629
 
630 630
 	/**
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 	 */
633 633
 	public function setAutoGenerateColumns($value)
634 634
 	{
635
-		$this->setViewState('AutoGenerateColumns',TPropertyValue::ensureBoolean($value),true);
635
+		$this->setViewState('AutoGenerateColumns', TPropertyValue::ensureBoolean($value), true);
636 636
 	}
637 637
 
638 638
 	/**
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 	 */
641 641
 	public function getShowHeader()
642 642
 	{
643
-		return $this->getViewState('ShowHeader',true);
643
+		return $this->getViewState('ShowHeader', true);
644 644
 	}
645 645
 
646 646
 	/**
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 	 */
649 649
 	public function setShowHeader($value)
650 650
 	{
651
-		$this->setViewState('ShowHeader',TPropertyValue::ensureBoolean($value),true);
651
+		$this->setViewState('ShowHeader', TPropertyValue::ensureBoolean($value), true);
652 652
 	}
653 653
 
654 654
 	/**
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
 	 */
657 657
 	public function getShowFooter()
658 658
 	{
659
-		return $this->getViewState('ShowFooter',false);
659
+		return $this->getViewState('ShowFooter', false);
660 660
 	}
661 661
 
662 662
 	/**
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 	 */
665 665
 	public function setShowFooter($value)
666 666
 	{
667
-		$this->setViewState('ShowFooter',TPropertyValue::ensureBoolean($value),false);
667
+		$this->setViewState('ShowFooter', TPropertyValue::ensureBoolean($value), false);
668 668
 	}
669 669
 
670 670
 	/**
@@ -681,10 +681,10 @@  discard block
 block discarded – undo
681 681
 	 */
682 682
 	public function setEmptyTemplate($value)
683 683
 	{
684
-		if($value instanceof ITemplate || $value===null)
685
-			$this->_emptyTemplate=$value;
684
+		if ($value instanceof ITemplate || $value === null)
685
+			$this->_emptyTemplate = $value;
686 686
 		else
687
-			throw new TInvalidDataTypeException('datagrid_template_required','EmptyTemplate');
687
+			throw new TInvalidDataTypeException('datagrid_template_required', 'EmptyTemplate');
688 688
 	}
689 689
 
690 690
 	/**
@@ -700,57 +700,57 @@  discard block
 block discarded – undo
700 700
 	 * @param TEventParameter event parameter
701 701
 	 * @return boolean whether the event bubbling should stop here.
702 702
 	 */
703
-	public function bubbleEvent($sender,$param)
703
+	public function bubbleEvent($sender, $param)
704 704
 	{
705
-		if($param instanceof TDataGridCommandEventParameter)
705
+		if ($param instanceof TDataGridCommandEventParameter)
706 706
 		{
707 707
 			$this->onItemCommand($param);
708
-			$command=$param->getCommandName();
709
-			if(strcasecmp($command,self::CMD_SELECT)===0)
708
+			$command = $param->getCommandName();
709
+			if (strcasecmp($command, self::CMD_SELECT) === 0)
710 710
 			{
711 711
 				$this->setSelectedItemIndex($param->getItem()->getItemIndex());
712 712
 				$this->onSelectedIndexChanged($param);
713 713
 				return true;
714 714
 			}
715
-			else if(strcasecmp($command,self::CMD_EDIT)===0)
715
+			else if (strcasecmp($command, self::CMD_EDIT) === 0)
716 716
 			{
717 717
 				$this->onEditCommand($param);
718 718
 				return true;
719 719
 			}
720
-			else if(strcasecmp($command,self::CMD_DELETE)===0)
720
+			else if (strcasecmp($command, self::CMD_DELETE) === 0)
721 721
 			{
722 722
 				$this->onDeleteCommand($param);
723 723
 				return true;
724 724
 			}
725
-			else if(strcasecmp($command,self::CMD_UPDATE)===0)
725
+			else if (strcasecmp($command, self::CMD_UPDATE) === 0)
726 726
 			{
727 727
 				$this->onUpdateCommand($param);
728 728
 				return true;
729 729
 			}
730
-			else if(strcasecmp($command,self::CMD_CANCEL)===0)
730
+			else if (strcasecmp($command, self::CMD_CANCEL) === 0)
731 731
 			{
732 732
 				$this->onCancelCommand($param);
733 733
 				return true;
734 734
 			}
735
-			else if(strcasecmp($command,self::CMD_SORT)===0)
735
+			else if (strcasecmp($command, self::CMD_SORT) === 0)
736 736
 			{
737
-				$this->onSortCommand(new TDataGridSortCommandEventParameter($sender,$param));
737
+				$this->onSortCommand(new TDataGridSortCommandEventParameter($sender, $param));
738 738
 				return true;
739 739
 			}
740
-			else if(strcasecmp($command,self::CMD_PAGE)===0)
740
+			else if (strcasecmp($command, self::CMD_PAGE) === 0)
741 741
 			{
742
-				$p=$param->getCommandParameter();
743
-				if(strcasecmp($p,self::CMD_PAGE_NEXT)===0)
744
-					$pageIndex=$this->getCurrentPageIndex()+1;
745
-				else if(strcasecmp($p,self::CMD_PAGE_PREV)===0)
746
-					$pageIndex=$this->getCurrentPageIndex()-1;
747
-				else if(strcasecmp($p,self::CMD_PAGE_FIRST)===0)
748
-					$pageIndex=0;
749
-				else if(strcasecmp($p,self::CMD_PAGE_LAST)===0)
750
-					$pageIndex=$this->getPageCount()-1;
742
+				$p = $param->getCommandParameter();
743
+				if (strcasecmp($p, self::CMD_PAGE_NEXT) === 0)
744
+					$pageIndex = $this->getCurrentPageIndex() + 1;
745
+				else if (strcasecmp($p, self::CMD_PAGE_PREV) === 0)
746
+					$pageIndex = $this->getCurrentPageIndex() - 1;
747
+				else if (strcasecmp($p, self::CMD_PAGE_FIRST) === 0)
748
+					$pageIndex = 0;
749
+				else if (strcasecmp($p, self::CMD_PAGE_LAST) === 0)
750
+					$pageIndex = $this->getPageCount() - 1;
751 751
 				else
752
-					$pageIndex=TPropertyValue::ensureInteger($p)-1;
753
-				$this->onPageIndexChanged(new TDataGridPageChangedEventParameter($sender,$pageIndex));
752
+					$pageIndex = TPropertyValue::ensureInteger($p) - 1;
753
+				$this->onPageIndexChanged(new TDataGridPageChangedEventParameter($sender, $pageIndex));
754 754
 				return true;
755 755
 			}
756 756
 		}
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
 	 */
766 766
 	public function onCancelCommand($param)
767 767
 	{
768
-		$this->raiseEvent('OnCancelCommand',$this,$param);
768
+		$this->raiseEvent('OnCancelCommand', $this, $param);
769 769
 	}
770 770
 
771 771
 	/**
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
 	 */
777 777
 	public function onDeleteCommand($param)
778 778
 	{
779
-		$this->raiseEvent('OnDeleteCommand',$this,$param);
779
+		$this->raiseEvent('OnDeleteCommand', $this, $param);
780 780
 	}
781 781
 
782 782
 	/**
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 	 */
788 788
 	public function onEditCommand($param)
789 789
 	{
790
-		$this->raiseEvent('OnEditCommand',$this,$param);
790
+		$this->raiseEvent('OnEditCommand', $this, $param);
791 791
 	}
792 792
 
793 793
 	/**
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
 	 */
798 798
 	public function onItemCommand($param)
799 799
 	{
800
-		$this->raiseEvent('OnItemCommand',$this,$param);
800
+		$this->raiseEvent('OnItemCommand', $this, $param);
801 801
 	}
802 802
 
803 803
 	/**
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
 	 */
809 809
 	public function onSortCommand($param)
810 810
 	{
811
-		$this->raiseEvent('OnSortCommand',$this,$param);
811
+		$this->raiseEvent('OnSortCommand', $this, $param);
812 812
 	}
813 813
 
814 814
 	/**
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
 	 */
820 820
 	public function onUpdateCommand($param)
821 821
 	{
822
-		$this->raiseEvent('OnUpdateCommand',$this,$param);
822
+		$this->raiseEvent('OnUpdateCommand', $this, $param);
823 823
 	}
824 824
 
825 825
 	/**
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
 	 */
831 831
 	public function onItemCreated($param)
832 832
 	{
833
-		$this->raiseEvent('OnItemCreated',$this,$param);
833
+		$this->raiseEvent('OnItemCreated', $this, $param);
834 834
 	}
835 835
 
836 836
 	/**
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
 	 */
842 842
 	public function onPagerCreated($param)
843 843
 	{
844
-		$this->raiseEvent('OnPagerCreated',$this,$param);
844
+		$this->raiseEvent('OnPagerCreated', $this, $param);
845 845
 	}
846 846
 
847 847
 	/**
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
 	 */
853 853
 	public function onItemDataBound($param)
854 854
 	{
855
-		$this->raiseEvent('OnItemDataBound',$this,$param);
855
+		$this->raiseEvent('OnItemDataBound', $this, $param);
856 856
 	}
857 857
 
858 858
 	/**
@@ -862,7 +862,7 @@  discard block
 block discarded – undo
862 862
 	 */
863 863
 	public function onPageIndexChanged($param)
864 864
 	{
865
-		$this->raiseEvent('OnPageIndexChanged',$this,$param);
865
+		$this->raiseEvent('OnPageIndexChanged', $this, $param);
866 866
 	}
867 867
 
868 868
 	/**
@@ -872,27 +872,27 @@  discard block
 block discarded – undo
872 872
 	public function saveState()
873 873
 	{
874 874
 		parent::saveState();
875
-		if(!$this->getEnableViewState(true))
875
+		if (!$this->getEnableViewState(true))
876 876
 			return;
877
-		if($this->_items)
878
-			$this->setViewState('ItemCount',$this->_items->getCount(),0);
877
+		if ($this->_items)
878
+			$this->setViewState('ItemCount', $this->_items->getCount(), 0);
879 879
 		else
880 880
 			$this->clearViewState('ItemCount');
881
-		if($this->_autoColumns)
881
+		if ($this->_autoColumns)
882 882
 		{
883
-			$state=array();
884
-			foreach($this->_autoColumns as $column)
885
-				$state[]=$column->saveState();
886
-			$this->setViewState('AutoColumns',$state,array());
883
+			$state = array();
884
+			foreach ($this->_autoColumns as $column)
885
+				$state[] = $column->saveState();
886
+			$this->setViewState('AutoColumns', $state, array());
887 887
 		}
888 888
 		else
889 889
 			$this->clearViewState('AutoColumns');
890
-		if($this->_columns)
890
+		if ($this->_columns)
891 891
 		{
892
-			$state=array();
893
-			foreach($this->_columns as $column)
894
-				$state[]=$column->saveState();
895
-			$this->setViewState('Columns',$state,array());
892
+			$state = array();
893
+			foreach ($this->_columns as $column)
894
+				$state[] = $column->saveState();
895
+			$this->setViewState('Columns', $state, array());
896 896
 		}
897 897
 		else
898 898
 			$this->clearViewState('Columns');
@@ -905,28 +905,28 @@  discard block
 block discarded – undo
905 905
 	public function loadState()
906 906
 	{
907 907
 		parent::loadState();
908
-		if(!$this->getEnableViewState(true))
908
+		if (!$this->getEnableViewState(true))
909 909
 			return;
910
-		if(!$this->getIsDataBound())
910
+		if (!$this->getIsDataBound())
911 911
 		{
912
-			$state=$this->getViewState('AutoColumns',array());
913
-			if(!empty($state))
912
+			$state = $this->getViewState('AutoColumns', array());
913
+			if (!empty($state))
914 914
 			{
915
-				$this->_autoColumns=new TDataGridColumnCollection($this);
916
-				foreach($state as $st)
915
+				$this->_autoColumns = new TDataGridColumnCollection($this);
916
+				foreach ($state as $st)
917 917
 				{
918
-					$column=new $this->AutoGenerateColumnName;
918
+					$column = new $this->AutoGenerateColumnName;
919 919
 					$column->loadState($st);
920 920
 					$this->_autoColumns->add($column);
921 921
 				}
922 922
 			}
923 923
 			else
924
-				$this->_autoColumns=null;
925
-			$state=$this->getViewState('Columns',array());
926
-			if($this->_columns && $this->_columns->getCount()===count($state))
924
+				$this->_autoColumns = null;
925
+			$state = $this->getViewState('Columns', array());
926
+			if ($this->_columns && $this->_columns->getCount() === count($state))
927 927
 			{
928
-				$i=0;
929
-				foreach($this->_columns as $column)
928
+				$i = 0;
929
+				foreach ($this->_columns as $column)
930 930
 				{
931 931
 					$column->loadState($state[$i]);
932 932
 					$i++;
@@ -943,11 +943,11 @@  discard block
 block discarded – undo
943 943
 	{
944 944
 		$this->getControls()->clear();
945 945
 		$this->getItems()->clear();
946
-		$this->_header=null;
947
-		$this->_footer=null;
948
-		$this->_topPager=null;
949
-		$this->_bottomPager=null;
950
-		$this->_useEmptyTemplate=false;
946
+		$this->_header = null;
947
+		$this->_footer = null;
948
+		$this->_topPager = null;
949
+		$this->_bottomPager = null;
950
+		$this->_useEmptyTemplate = false;
951 951
 	}
952 952
 
953 953
 	/**
@@ -957,52 +957,52 @@  discard block
 block discarded – undo
957 957
 	{
958 958
 		$this->reset();
959 959
 
960
-		$allowPaging=$this->getAllowPaging();
960
+		$allowPaging = $this->getAllowPaging();
961 961
 
962
-		$itemCount=$this->getViewState('ItemCount',0);
963
-		$dsIndex=$this->getViewState('DataSourceIndex',0);
962
+		$itemCount = $this->getViewState('ItemCount', 0);
963
+		$dsIndex = $this->getViewState('DataSourceIndex', 0);
964 964
 
965
-		$columns=new TList($this->getColumns());
965
+		$columns = new TList($this->getColumns());
966 966
 		$columns->mergeWith($this->_autoColumns);
967
-		$this->_allColumns=$columns;
967
+		$this->_allColumns = $columns;
968 968
 
969
-		$items=$this->getItems();
969
+		$items = $this->getItems();
970 970
 
971
-		if($columns->getCount())
971
+		if ($columns->getCount())
972 972
 		{
973
-			foreach($columns as $column)
973
+			foreach ($columns as $column)
974 974
 				$column->initialize();
975
-			$selectedIndex=$this->getSelectedItemIndex();
976
-			$editIndex=$this->getEditItemIndex();
977
-			for($index=0;$index<$itemCount;++$index)
975
+			$selectedIndex = $this->getSelectedItemIndex();
976
+			$editIndex = $this->getEditItemIndex();
977
+			for ($index = 0; $index < $itemCount; ++$index)
978 978
 			{
979
-				if($index===0)
979
+				if ($index === 0)
980 980
 				{
981
-					if($allowPaging)
982
-						$this->_topPager=$this->createPager();
983
-					$this->_header=$this->createItemInternal(-1,-1,TListItemType::Header,false,null,$columns);
981
+					if ($allowPaging)
982
+						$this->_topPager = $this->createPager();
983
+					$this->_header = $this->createItemInternal(-1, -1, TListItemType::Header, false, null, $columns);
984 984
 				}
985
-				if($index===$editIndex)
986
-					$itemType=TListItemType::EditItem;
987
-				else if($index===$selectedIndex)
988
-					$itemType=TListItemType::SelectedItem;
989
-				else if($index % 2)
990
-					$itemType=TListItemType::AlternatingItem;
985
+				if ($index === $editIndex)
986
+					$itemType = TListItemType::EditItem;
987
+				else if ($index === $selectedIndex)
988
+					$itemType = TListItemType::SelectedItem;
989
+				else if ($index % 2)
990
+					$itemType = TListItemType::AlternatingItem;
991 991
 				else
992
-					$itemType=TListItemType::Item;
993
-				$items->add($this->createItemInternal($index,$dsIndex,$itemType,false,null,$columns));
992
+					$itemType = TListItemType::Item;
993
+				$items->add($this->createItemInternal($index, $dsIndex, $itemType, false, null, $columns));
994 994
 				$dsIndex++;
995 995
 			}
996
-			if($index>0)
996
+			if ($index > 0)
997 997
 			{
998
-				$this->_footer=$this->createItemInternal(-1,-1,TListItemType::Footer,false,null,$columns);
999
-				if($allowPaging)
1000
-					$this->_bottomPager=$this->createPager();
998
+				$this->_footer = $this->createItemInternal(-1, -1, TListItemType::Footer, false, null, $columns);
999
+				if ($allowPaging)
1000
+					$this->_bottomPager = $this->createPager();
1001 1001
 			}
1002 1002
 		}
1003
-		if(!$dsIndex && $this->_emptyTemplate!==null)
1003
+		if (!$dsIndex && $this->_emptyTemplate !== null)
1004 1004
 		{
1005
-			$this->_useEmptyTemplate=true;
1005
+			$this->_useEmptyTemplate = true;
1006 1006
 			$this->_emptyTemplate->instantiateIn($this);
1007 1007
 		}
1008 1008
 	}
@@ -1016,69 +1016,69 @@  discard block
 block discarded – undo
1016 1016
 	protected function performDataBinding($data)
1017 1017
 	{
1018 1018
 		$this->reset();
1019
-		$keys=$this->getDataKeys();
1019
+		$keys = $this->getDataKeys();
1020 1020
 		$keys->clear();
1021
-		$keyField=$this->getDataKeyField();
1021
+		$keyField = $this->getDataKeyField();
1022 1022
 
1023 1023
 		// get all columns
1024
-		if($this->getAutoGenerateColumns())
1024
+		if ($this->getAutoGenerateColumns())
1025 1025
 		{
1026
-			$columns=new TList($this->getColumns());
1027
-			$autoColumns=$this->createAutoColumns($data);
1026
+			$columns = new TList($this->getColumns());
1027
+			$autoColumns = $this->createAutoColumns($data);
1028 1028
 			$columns->mergeWith($autoColumns);
1029 1029
 		}
1030 1030
 		else
1031
-			$columns=$this->getColumns();
1032
-		$this->_allColumns=$columns;
1031
+			$columns = $this->getColumns();
1032
+		$this->_allColumns = $columns;
1033 1033
 
1034
-		$items=$this->getItems();
1034
+		$items = $this->getItems();
1035 1035
 
1036
-		$index=0;
1037
-		$allowPaging=$this->getAllowPaging() && ($data instanceof TPagedDataSource);
1038
-		$dsIndex=$allowPaging?$data->getFirstIndexInPage():0;
1039
-		$this->setViewState('DataSourceIndex',$dsIndex,0);
1040
-		if($columns->getCount())
1036
+		$index = 0;
1037
+		$allowPaging = $this->getAllowPaging() && ($data instanceof TPagedDataSource);
1038
+		$dsIndex = $allowPaging ? $data->getFirstIndexInPage() : 0;
1039
+		$this->setViewState('DataSourceIndex', $dsIndex, 0);
1040
+		if ($columns->getCount())
1041 1041
 		{
1042
-			foreach($columns as $column)
1042
+			foreach ($columns as $column)
1043 1043
 				$column->initialize();
1044 1044
 
1045
-			$selectedIndex=$this->getSelectedItemIndex();
1046
-			$editIndex=$this->getEditItemIndex();
1047
-			foreach($data as $key=>$row)
1045
+			$selectedIndex = $this->getSelectedItemIndex();
1046
+			$editIndex = $this->getEditItemIndex();
1047
+			foreach ($data as $key=>$row)
1048 1048
 			{
1049
-				if($keyField!=='')
1050
-					$keys->add($this->getDataFieldValue($row,$keyField));
1049
+				if ($keyField !== '')
1050
+					$keys->add($this->getDataFieldValue($row, $keyField));
1051 1051
 				else
1052 1052
 					$keys->add($key);
1053
-				if($index===0)
1053
+				if ($index === 0)
1054 1054
 				{
1055
-					if($allowPaging)
1056
-						$this->_topPager=$this->createPager();
1057
-					$this->_header=$this->createItemInternal(-1,-1,TListItemType::Header,true,null,$columns);
1055
+					if ($allowPaging)
1056
+						$this->_topPager = $this->createPager();
1057
+					$this->_header = $this->createItemInternal(-1, -1, TListItemType::Header, true, null, $columns);
1058 1058
 				}
1059
-				if($index===$editIndex)
1060
-					$itemType=TListItemType::EditItem;
1061
-				else if($index===$selectedIndex)
1062
-					$itemType=TListItemType::SelectedItem;
1063
-				else if($index % 2)
1064
-					$itemType=TListItemType::AlternatingItem;
1059
+				if ($index === $editIndex)
1060
+					$itemType = TListItemType::EditItem;
1061
+				else if ($index === $selectedIndex)
1062
+					$itemType = TListItemType::SelectedItem;
1063
+				else if ($index % 2)
1064
+					$itemType = TListItemType::AlternatingItem;
1065 1065
 				else
1066
-					$itemType=TListItemType::Item;
1067
-				$items->add($this->createItemInternal($index,$dsIndex,$itemType,true,$row,$columns));
1066
+					$itemType = TListItemType::Item;
1067
+				$items->add($this->createItemInternal($index, $dsIndex, $itemType, true, $row, $columns));
1068 1068
 				$index++;
1069 1069
 				$dsIndex++;
1070 1070
 			}
1071
-			if($index>0)
1071
+			if ($index > 0)
1072 1072
 			{
1073
-				$this->_footer=$this->createItemInternal(-1,-1,TListItemType::Footer,true,null,$columns);
1074
-				if($allowPaging)
1075
-					$this->_bottomPager=$this->createPager();
1073
+				$this->_footer = $this->createItemInternal(-1, -1, TListItemType::Footer, true, null, $columns);
1074
+				if ($allowPaging)
1075
+					$this->_bottomPager = $this->createPager();
1076 1076
 			}
1077 1077
 		}
1078
-		$this->setViewState('ItemCount',$index,0);
1079
-		if(!$dsIndex && $this->_emptyTemplate!==null)
1078
+		$this->setViewState('ItemCount', $index, 0);
1079
+		if (!$dsIndex && $this->_emptyTemplate !== null)
1080 1080
 		{
1081
-			$this->_useEmptyTemplate=true;
1081
+			$this->_useEmptyTemplate = true;
1082 1082
 			$this->_emptyTemplate->instantiateIn($this);
1083 1083
 			$this->dataBindChildren();
1084 1084
 		}
@@ -1090,39 +1090,39 @@  discard block
 block discarded – undo
1090 1090
 	 */
1091 1091
 	private function groupCells()
1092 1092
 	{
1093
-		if(($columns=$this->_allColumns)===null)
1093
+		if (($columns = $this->_allColumns) === null)
1094 1094
 			return;
1095
-		$items=$this->getItems();
1096
-		foreach($columns as $id=>$column)
1095
+		$items = $this->getItems();
1096
+		foreach ($columns as $id=>$column)
1097 1097
 		{
1098
-			if(!$column->getEnableCellGrouping())
1098
+			if (!$column->getEnableCellGrouping())
1099 1099
 				continue;
1100
-			$prevCell=null;
1101
-			$prevCellText=null;
1102
-			foreach($items as $item)
1100
+			$prevCell = null;
1101
+			$prevCellText = null;
1102
+			foreach ($items as $item)
1103 1103
 			{
1104
-				$itemType=$item->getItemType();
1105
-				$cell=$item->getCells()->itemAt($id);
1106
-				if(!$cell->getVisible())
1104
+				$itemType = $item->getItemType();
1105
+				$cell = $item->getCells()->itemAt($id);
1106
+				if (!$cell->getVisible())
1107 1107
 					continue;
1108
-				if($itemType===TListItemType::Item || $itemType===TListItemType::AlternatingItem || $itemType===TListItemType::SelectedItem)
1108
+				if ($itemType === TListItemType::Item || $itemType === TListItemType::AlternatingItem || $itemType === TListItemType::SelectedItem)
1109 1109
 				{
1110
-					if(($cellText=$this->getCellText($cell))==='')
1110
+					if (($cellText = $this->getCellText($cell)) === '')
1111 1111
 					{
1112
-						$prevCell=null;
1113
-						$prevCellText=null;
1112
+						$prevCell = null;
1113
+						$prevCellText = null;
1114 1114
 						continue;
1115 1115
 					}
1116
-					if($prevCell===null || $prevCellText!==$cellText)
1116
+					if ($prevCell === null || $prevCellText !== $cellText)
1117 1117
 					{
1118
-						$prevCell=$cell;
1119
-						$prevCellText=$cellText;
1118
+						$prevCell = $cell;
1119
+						$prevCellText = $cellText;
1120 1120
 					}
1121 1121
 					else
1122 1122
 					{
1123
-						if(($rowSpan=$prevCell->getRowSpan())===0)
1124
-							$rowSpan=1;
1125
-						$prevCell->setRowSpan($rowSpan+1);
1123
+						if (($rowSpan = $prevCell->getRowSpan()) === 0)
1124
+							$rowSpan = 1;
1125
+						$prevCell->setRowSpan($rowSpan + 1);
1126 1126
 						$cell->setVisible(false);
1127 1127
 					}
1128 1128
 				}
@@ -1132,12 +1132,12 @@  discard block
 block discarded – undo
1132 1132
 
1133 1133
 	private function getCellText($cell)
1134 1134
 	{
1135
-		if(($data=$cell->getText())==='' && $cell->getHasControls())
1135
+		if (($data = $cell->getText()) === '' && $cell->getHasControls())
1136 1136
 		{
1137
-			$controls=$cell->getControls();
1138
-			foreach($controls as $control)
1137
+			$controls = $cell->getControls();
1138
+			foreach ($controls as $control)
1139 1139
 			{
1140
-				if($control instanceof IDataRenderer)
1140
+				if ($control instanceof IDataRenderer)
1141 1141
 					return $control->getData();
1142 1142
 			}
1143 1143
 		}
@@ -1150,17 +1150,17 @@  discard block
 block discarded – undo
1150 1150
 	 * @param TListItemType item type
1151 1151
 	 * @return TDataGridItem created data list item
1152 1152
 	 */
1153
-	protected function createItem($itemIndex,$dataSourceIndex,$itemType)
1153
+	protected function createItem($itemIndex, $dataSourceIndex, $itemType)
1154 1154
 	{
1155
-		return new TDataGridItem($itemIndex,$dataSourceIndex,$itemType);
1155
+		return new TDataGridItem($itemIndex, $dataSourceIndex, $itemType);
1156 1156
 	}
1157 1157
 
1158
-	private function createItemInternal($itemIndex,$dataSourceIndex,$itemType,$dataBind,$dataItem,$columns)
1158
+	private function createItemInternal($itemIndex, $dataSourceIndex, $itemType, $dataBind, $dataItem, $columns)
1159 1159
 	{
1160
-		$item=$this->createItem($itemIndex,$dataSourceIndex,$itemType);
1161
-		$this->initializeItem($item,$columns);
1162
-		$param=new TDataGridItemEventParameter($item);
1163
-		if($dataBind)
1160
+		$item = $this->createItem($itemIndex, $dataSourceIndex, $itemType);
1161
+		$this->initializeItem($item, $columns);
1162
+		$param = new TDataGridItemEventParameter($item);
1163
+		if ($dataBind)
1164 1164
 		{
1165 1165
 			$item->setDataItem($dataItem);
1166 1166
 			$this->onItemCreated($param);
@@ -1181,28 +1181,28 @@  discard block
 block discarded – undo
1181 1181
 	 * @param TDataGrid datagrid item to be initialized
1182 1182
 	 * @param TDataGridColumnCollection datagrid columns to be used to initialize the cells in the item
1183 1183
 	 */
1184
-	protected function initializeItem($item,$columns)
1184
+	protected function initializeItem($item, $columns)
1185 1185
 	{
1186
-		$cells=$item->getCells();
1187
-		$itemType=$item->getItemType();
1188
-		$index=0;
1189
-		foreach($columns as $column)
1186
+		$cells = $item->getCells();
1187
+		$itemType = $item->getItemType();
1188
+		$index = 0;
1189
+		foreach ($columns as $column)
1190 1190
 		{
1191
-			if($itemType===TListItemType::Header)
1192
-				$cell=new TTableHeaderCell;
1191
+			if ($itemType === TListItemType::Header)
1192
+				$cell = new TTableHeaderCell;
1193 1193
 			else
1194
-				$cell=new TTableCell;
1195
-			if(($id=$column->getID())!=='')
1196
-				$item->registerObject($id,$cell);
1194
+				$cell = new TTableCell;
1195
+			if (($id = $column->getID()) !== '')
1196
+				$item->registerObject($id, $cell);
1197 1197
 			$cells->add($cell);
1198
-			$column->initializeCell($cell,$index,$itemType);
1198
+			$column->initializeCell($cell, $index, $itemType);
1199 1199
 			$index++;
1200 1200
 		}
1201 1201
 	}
1202 1202
 
1203 1203
 	protected function createPager()
1204 1204
 	{
1205
-		$pager=new TDataGridPager($this);
1205
+		$pager = new TDataGridPager($this);
1206 1206
 		$this->buildPager($pager);
1207 1207
 		$this->onPagerCreated(new TDataGridPagerEventParameter($pager));
1208 1208
 		$this->getControls()->add($pager);
@@ -1215,7 +1215,7 @@  discard block
 block discarded – undo
1215 1215
 	 */
1216 1216
 	protected function buildPager($pager)
1217 1217
 	{
1218
-		switch($this->getPagerStyle()->getMode())
1218
+		switch ($this->getPagerStyle()->getMode())
1219 1219
 		{
1220 1220
 			case TDataGridPagerMode::NextPrev:
1221 1221
 				$this->buildNextPrevPager($pager);
@@ -1239,23 +1239,23 @@  discard block
 block discarded – undo
1239 1239
 	 * @param string CommandParameter corresponding to the OnCommand event of the button
1240 1240
 	 * @return mixed the button instance
1241 1241
 	 */
1242
-	protected function createPagerButton($pager,$buttonType,$enabled,$text,$commandName,$commandParameter)
1242
+	protected function createPagerButton($pager, $buttonType, $enabled, $text, $commandName, $commandParameter)
1243 1243
 	{
1244
-		if($buttonType===TDataGridPagerButtonType::LinkButton)
1244
+		if ($buttonType === TDataGridPagerButtonType::LinkButton)
1245 1245
 		{
1246
-			if($enabled)
1247
-				$button=new TLinkButton;
1246
+			if ($enabled)
1247
+				$button = new TLinkButton;
1248 1248
 			else
1249 1249
 			{
1250
-				$button=new TLabel;
1250
+				$button = new TLabel;
1251 1251
 				$button->setText($text);
1252 1252
 				return $button;
1253 1253
 			}
1254 1254
 		}
1255 1255
 		else
1256 1256
 		{
1257
-			$button=new TButton;
1258
-			if(!$enabled)
1257
+			$button = new TButton;
1258
+			if (!$enabled)
1259 1259
 				$button->setEnabled(false);
1260 1260
 		}
1261 1261
 		$button->setText($text);
@@ -1271,54 +1271,54 @@  discard block
 block discarded – undo
1271 1271
 	 */
1272 1272
 	protected function buildNextPrevPager($pager)
1273 1273
 	{
1274
-		$style=$this->getPagerStyle();
1275
-		$buttonType=$style->getButtonType();
1276
-		$controls=$pager->getControls();
1277
-		$currentPageIndex=$this->getCurrentPageIndex();
1278
-		if($currentPageIndex===0)
1274
+		$style = $this->getPagerStyle();
1275
+		$buttonType = $style->getButtonType();
1276
+		$controls = $pager->getControls();
1277
+		$currentPageIndex = $this->getCurrentPageIndex();
1278
+		if ($currentPageIndex === 0)
1279 1279
 		{
1280
-			if(($text=$style->getFirstPageText())!=='')
1280
+			if (($text = $style->getFirstPageText()) !== '')
1281 1281
 			{
1282
-				$label=$this->createPagerButton($pager,$buttonType,false,$text,'','');
1282
+				$label = $this->createPagerButton($pager, $buttonType, false, $text, '', '');
1283 1283
 				$controls->add($label);
1284 1284
 				$controls->add("\n");
1285 1285
 			}
1286 1286
 
1287
-			$label=$this->createPagerButton($pager,$buttonType,false,$style->getPrevPageText(),'','');
1287
+			$label = $this->createPagerButton($pager, $buttonType, false, $style->getPrevPageText(), '', '');
1288 1288
 			$controls->add($label);
1289 1289
 		}
1290 1290
 		else
1291 1291
 		{
1292
-			if(($text=$style->getFirstPageText())!=='')
1292
+			if (($text = $style->getFirstPageText()) !== '')
1293 1293
 			{
1294
-				$button=$this->createPagerButton($pager,$buttonType,true,$text,self::CMD_PAGE,self::CMD_PAGE_FIRST);
1294
+				$button = $this->createPagerButton($pager, $buttonType, true, $text, self::CMD_PAGE, self::CMD_PAGE_FIRST);
1295 1295
 				$controls->add($button);
1296 1296
 				$controls->add("\n");
1297 1297
 			}
1298 1298
 
1299
-			$button=$this->createPagerButton($pager,$buttonType,true,$style->getPrevPageText(),self::CMD_PAGE,self::CMD_PAGE_PREV);
1299
+			$button = $this->createPagerButton($pager, $buttonType, true, $style->getPrevPageText(), self::CMD_PAGE, self::CMD_PAGE_PREV);
1300 1300
 			$controls->add($button);
1301 1301
 		}
1302 1302
 		$controls->add("\n");
1303
-		if($currentPageIndex===$this->getPageCount()-1)
1303
+		if ($currentPageIndex === $this->getPageCount() - 1)
1304 1304
 		{
1305
-			$label=$this->createPagerButton($pager,$buttonType,false,$style->getNextPageText(),'','');
1305
+			$label = $this->createPagerButton($pager, $buttonType, false, $style->getNextPageText(), '', '');
1306 1306
 			$controls->add($label);
1307
-			if(($text=$style->getLastPageText())!=='')
1307
+			if (($text = $style->getLastPageText()) !== '')
1308 1308
 			{
1309 1309
 				$controls->add("\n");
1310
-				$label=$this->createPagerButton($pager,$buttonType,false,$text,'','');
1310
+				$label = $this->createPagerButton($pager, $buttonType, false, $text, '', '');
1311 1311
 				$controls->add($label);
1312 1312
 			}
1313 1313
 		}
1314 1314
 		else
1315 1315
 		{
1316
-			$button=$this->createPagerButton($pager,$buttonType,true,$style->getNextPageText(),self::CMD_PAGE,self::CMD_PAGE_NEXT);
1316
+			$button = $this->createPagerButton($pager, $buttonType, true, $style->getNextPageText(), self::CMD_PAGE, self::CMD_PAGE_NEXT);
1317 1317
 			$controls->add($button);
1318
-			if(($text=$style->getLastPageText())!=='')
1318
+			if (($text = $style->getLastPageText()) !== '')
1319 1319
 			{
1320 1320
 				$controls->add("\n");
1321
-				$button=$this->createPagerButton($pager,$buttonType,true,$text,self::CMD_PAGE,self::CMD_PAGE_LAST);
1321
+				$button = $this->createPagerButton($pager, $buttonType, true, $text, self::CMD_PAGE, self::CMD_PAGE_LAST);
1322 1322
 				$controls->add($button);
1323 1323
 			}
1324 1324
 		}
@@ -1330,67 +1330,67 @@  discard block
 block discarded – undo
1330 1330
 	 */
1331 1331
 	protected function buildNumericPager($pager)
1332 1332
 	{
1333
-		$style=$this->getPagerStyle();
1334
-		$buttonType=$style->getButtonType();
1335
-		$controls=$pager->getControls();
1336
-		$pageCount=$this->getPageCount();
1337
-		$pageIndex=$this->getCurrentPageIndex()+1;
1338
-		$maxButtonCount=$style->getPageButtonCount();
1339
-		$buttonCount=$maxButtonCount>$pageCount?$pageCount:$maxButtonCount;
1340
-		$startPageIndex=1;
1341
-		$endPageIndex=$buttonCount;
1342
-		if($pageIndex>$endPageIndex)
1333
+		$style = $this->getPagerStyle();
1334
+		$buttonType = $style->getButtonType();
1335
+		$controls = $pager->getControls();
1336
+		$pageCount = $this->getPageCount();
1337
+		$pageIndex = $this->getCurrentPageIndex() + 1;
1338
+		$maxButtonCount = $style->getPageButtonCount();
1339
+		$buttonCount = $maxButtonCount > $pageCount ? $pageCount : $maxButtonCount;
1340
+		$startPageIndex = 1;
1341
+		$endPageIndex = $buttonCount;
1342
+		if ($pageIndex > $endPageIndex)
1343 1343
 		{
1344
-			$startPageIndex=((int)(($pageIndex-1)/$maxButtonCount))*$maxButtonCount+1;
1345
-			if(($endPageIndex=$startPageIndex+$maxButtonCount-1)>$pageCount)
1346
-				$endPageIndex=$pageCount;
1347
-			if($endPageIndex-$startPageIndex+1<$maxButtonCount)
1344
+			$startPageIndex = ((int) (($pageIndex - 1) / $maxButtonCount)) * $maxButtonCount + 1;
1345
+			if (($endPageIndex = $startPageIndex + $maxButtonCount - 1) > $pageCount)
1346
+				$endPageIndex = $pageCount;
1347
+			if ($endPageIndex - $startPageIndex + 1 < $maxButtonCount)
1348 1348
 			{
1349
-				if(($startPageIndex=$endPageIndex-$maxButtonCount+1)<1)
1350
-					$startPageIndex=1;
1349
+				if (($startPageIndex = $endPageIndex - $maxButtonCount + 1) < 1)
1350
+					$startPageIndex = 1;
1351 1351
 			}
1352 1352
 		}
1353 1353
 
1354
-		if($startPageIndex>1)
1354
+		if ($startPageIndex > 1)
1355 1355
 		{
1356
-			if(($text=$style->getFirstPageText())!=='')
1356
+			if (($text = $style->getFirstPageText()) !== '')
1357 1357
 			{
1358
-				$button=$this->createPagerButton($pager,$buttonType,true,$text,self::CMD_PAGE,self::CMD_PAGE_FIRST);
1358
+				$button = $this->createPagerButton($pager, $buttonType, true, $text, self::CMD_PAGE, self::CMD_PAGE_FIRST);
1359 1359
 				$controls->add($button);
1360 1360
 				$controls->add("\n");
1361 1361
 			}
1362
-			$prevPageIndex=$startPageIndex-1;
1363
-			$button=$this->createPagerButton($pager,$buttonType,true,$style->getPrevPageText(),self::CMD_PAGE,"$prevPageIndex");
1362
+			$prevPageIndex = $startPageIndex - 1;
1363
+			$button = $this->createPagerButton($pager, $buttonType, true, $style->getPrevPageText(), self::CMD_PAGE, "$prevPageIndex");
1364 1364
 			$controls->add($button);
1365 1365
 			$controls->add("\n");
1366 1366
 		}
1367 1367
 
1368
-		for($i=$startPageIndex;$i<=$endPageIndex;++$i)
1368
+		for ($i = $startPageIndex; $i <= $endPageIndex; ++$i)
1369 1369
 		{
1370
-			if($i===$pageIndex)
1370
+			if ($i === $pageIndex)
1371 1371
 			{
1372
-				$label=$this->createPagerButton($pager,$buttonType,false,"$i",'','');
1372
+				$label = $this->createPagerButton($pager, $buttonType, false, "$i", '', '');
1373 1373
 				$controls->add($label);
1374 1374
 			}
1375 1375
 			else
1376 1376
 			{
1377
-				$button=$this->createPagerButton($pager,$buttonType,true,"$i",self::CMD_PAGE,"$i");
1377
+				$button = $this->createPagerButton($pager, $buttonType, true, "$i", self::CMD_PAGE, "$i");
1378 1378
 				$controls->add($button);
1379 1379
 			}
1380
-			if($i<$endPageIndex)
1380
+			if ($i < $endPageIndex)
1381 1381
 				$controls->add("\n");
1382 1382
 		}
1383 1383
 
1384
-		if($pageCount>$endPageIndex)
1384
+		if ($pageCount > $endPageIndex)
1385 1385
 		{
1386 1386
 			$controls->add("\n");
1387
-			$nextPageIndex=$endPageIndex+1;
1388
-			$button=$this->createPagerButton($pager,$buttonType,true,$style->getNextPageText(),self::CMD_PAGE,"$nextPageIndex");
1387
+			$nextPageIndex = $endPageIndex + 1;
1388
+			$button = $this->createPagerButton($pager, $buttonType, true, $style->getNextPageText(), self::CMD_PAGE, "$nextPageIndex");
1389 1389
 			$controls->add($button);
1390
-			if(($text=$style->getLastPageText())!=='')
1390
+			if (($text = $style->getLastPageText()) !== '')
1391 1391
 			{
1392 1392
 				$controls->add("\n");
1393
-				$button=$this->createPagerButton($pager,$buttonType,true,$text,self::CMD_PAGE,self::CMD_PAGE_LAST);
1393
+				$button = $this->createPagerButton($pager, $buttonType, true, $text, self::CMD_PAGE, self::CMD_PAGE_LAST);
1394 1394
 				$controls->add($button);
1395 1395
 			}
1396 1396
 		}
@@ -1403,16 +1403,16 @@  discard block
 block discarded – undo
1403 1403
 	 */
1404 1404
 	protected function createAutoColumns($dataSource)
1405 1405
 	{
1406
-		if(!$dataSource)
1406
+		if (!$dataSource)
1407 1407
 			return null;
1408
-		$autoColumns=$this->getAutoColumns();
1408
+		$autoColumns = $this->getAutoColumns();
1409 1409
 		$autoColumns->clear();
1410
-		foreach($dataSource as $row)
1410
+		foreach ($dataSource as $row)
1411 1411
 		{
1412
-			foreach($row as $key=>$value)
1412
+			foreach ($row as $key=>$value)
1413 1413
 			{
1414
-				$column=new $this->AutoGenerateColumnName;
1415
-				if(is_string($key))
1414
+				$column = new $this->AutoGenerateColumnName;
1415
+				if (is_string($key))
1416 1416
 				{
1417 1417
 					$column->setHeaderText($key);
1418 1418
 					$column->setDataField($key);
@@ -1445,104 +1445,104 @@  discard block
 block discarded – undo
1445 1445
 	 */
1446 1446
 	protected function applyItemStyles()
1447 1447
 	{
1448
-		$itemStyle=$this->getViewState('ItemStyle',null);
1448
+		$itemStyle = $this->getViewState('ItemStyle', null);
1449 1449
 
1450
-		$alternatingItemStyle=$this->getViewState('AlternatingItemStyle',null);
1451
-		if($itemStyle!==null)
1450
+		$alternatingItemStyle = $this->getViewState('AlternatingItemStyle', null);
1451
+		if ($itemStyle !== null)
1452 1452
 		{
1453
-			if($alternatingItemStyle===null)
1454
-				$alternatingItemStyle=$itemStyle;
1453
+			if ($alternatingItemStyle === null)
1454
+				$alternatingItemStyle = $itemStyle;
1455 1455
 			else
1456 1456
 				$alternatingItemStyle->mergeWith($itemStyle);
1457 1457
 		}
1458 1458
 
1459
-		$selectedItemStyle=$this->getViewState('SelectedItemStyle',null);
1459
+		$selectedItemStyle = $this->getViewState('SelectedItemStyle', null);
1460 1460
 
1461
-		$editItemStyle=$this->getViewState('EditItemStyle',null);
1462
-		if($selectedItemStyle!==null)
1461
+		$editItemStyle = $this->getViewState('EditItemStyle', null);
1462
+		if ($selectedItemStyle !== null)
1463 1463
 		{
1464
-			if($editItemStyle===null)
1465
-				$editItemStyle=$selectedItemStyle;
1464
+			if ($editItemStyle === null)
1465
+				$editItemStyle = $selectedItemStyle;
1466 1466
 			else
1467 1467
 				$editItemStyle->mergeWith($selectedItemStyle);
1468 1468
 		}
1469 1469
 
1470
-		$headerStyle=$this->getViewState('HeaderStyle',null);
1471
-		$footerStyle=$this->getViewState('FooterStyle',null);
1472
-		$pagerStyle=$this->getViewState('PagerStyle',null);
1473
-		$separatorStyle=$this->getViewState('SeparatorStyle',null);
1470
+		$headerStyle = $this->getViewState('HeaderStyle', null);
1471
+		$footerStyle = $this->getViewState('FooterStyle', null);
1472
+		$pagerStyle = $this->getViewState('PagerStyle', null);
1473
+		$separatorStyle = $this->getViewState('SeparatorStyle', null);
1474 1474
 
1475
-		foreach($this->getControls() as $index=>$item)
1475
+		foreach ($this->getControls() as $index=>$item)
1476 1476
 		{
1477
-			if(!($item instanceof TDataGridItem) && !($item instanceof TDataGridPager))
1477
+			if (!($item instanceof TDataGridItem) && !($item instanceof TDataGridPager))
1478 1478
 				continue;
1479
-			$itemType=$item->getItemType();
1480
-			switch($itemType)
1479
+			$itemType = $item->getItemType();
1480
+			switch ($itemType)
1481 1481
 			{
1482 1482
 				case TListItemType::Header:
1483
-					if($headerStyle)
1483
+					if ($headerStyle)
1484 1484
 						$item->getStyle()->mergeWith($headerStyle);
1485
-					if(!$this->getShowHeader())
1485
+					if (!$this->getShowHeader())
1486 1486
 						$item->setVisible(false);
1487 1487
 					break;
1488 1488
 				case TListItemType::Footer:
1489
-					if($footerStyle)
1489
+					if ($footerStyle)
1490 1490
 						$item->getStyle()->mergeWith($footerStyle);
1491
-					if(!$this->getShowFooter())
1491
+					if (!$this->getShowFooter())
1492 1492
 						$item->setVisible(false);
1493 1493
 					break;
1494 1494
 				case TListItemType::Separator:
1495
-					if($separatorStyle)
1495
+					if ($separatorStyle)
1496 1496
 						$item->getStyle()->mergeWith($separatorStyle);
1497 1497
 					break;
1498 1498
 				case TListItemType::Item:
1499
-					if($itemStyle)
1499
+					if ($itemStyle)
1500 1500
 						$item->getStyle()->mergeWith($itemStyle);
1501 1501
 					break;
1502 1502
 				case TListItemType::AlternatingItem:
1503
-					if($alternatingItemStyle)
1503
+					if ($alternatingItemStyle)
1504 1504
 						$item->getStyle()->mergeWith($alternatingItemStyle);
1505 1505
 					break;
1506 1506
 				case TListItemType::SelectedItem:
1507
-					if($selectedItemStyle)
1507
+					if ($selectedItemStyle)
1508 1508
 						$item->getStyle()->mergeWith($selectedItemStyle);
1509
-					if($index % 2==1)
1509
+					if ($index % 2 == 1)
1510 1510
 					{
1511
-						if($itemStyle)
1511
+						if ($itemStyle)
1512 1512
 							$item->getStyle()->mergeWith($itemStyle);
1513 1513
 					}
1514 1514
 					else
1515 1515
 					{
1516
-						if($alternatingItemStyle)
1516
+						if ($alternatingItemStyle)
1517 1517
 							$item->getStyle()->mergeWith($alternatingItemStyle);
1518 1518
 					}
1519 1519
 					break;
1520 1520
 				case TListItemType::EditItem:
1521
-					if($editItemStyle)
1521
+					if ($editItemStyle)
1522 1522
 						$item->getStyle()->mergeWith($editItemStyle);
1523
-					if($index % 2==1)
1523
+					if ($index % 2 == 1)
1524 1524
 					{
1525
-						if($itemStyle)
1525
+						if ($itemStyle)
1526 1526
 							$item->getStyle()->mergeWith($itemStyle);
1527 1527
 					}
1528 1528
 					else
1529 1529
 					{
1530
-						if($alternatingItemStyle)
1530
+						if ($alternatingItemStyle)
1531 1531
 							$item->getStyle()->mergeWith($alternatingItemStyle);
1532 1532
 					}
1533 1533
 					break;
1534 1534
 				case TListItemType::Pager:
1535
-					if($pagerStyle)
1535
+					if ($pagerStyle)
1536 1536
 					{
1537 1537
 						$item->getStyle()->mergeWith($pagerStyle);
1538
-						if($index===0)
1538
+						if ($index === 0)
1539 1539
 						{
1540
-							if($pagerStyle->getPosition()===TDataGridPagerPosition::Bottom || !$pagerStyle->getVisible())
1540
+							if ($pagerStyle->getPosition() === TDataGridPagerPosition::Bottom || !$pagerStyle->getVisible())
1541 1541
 								$item->setVisible(false);
1542 1542
 						}
1543 1543
 						else
1544 1544
 						{
1545
-							if($pagerStyle->getPosition()===TDataGridPagerPosition::Top || !$pagerStyle->getVisible())
1545
+							if ($pagerStyle->getPosition() === TDataGridPagerPosition::Top || !$pagerStyle->getVisible())
1546 1546
 								$item->setVisible(false);
1547 1547
 						}
1548 1548
 					}
@@ -1550,25 +1550,25 @@  discard block
 block discarded – undo
1550 1550
 				default:
1551 1551
 					break;
1552 1552
 			}
1553
-			if($this->_columns && $itemType!==TListItemType::Pager)
1553
+			if ($this->_columns && $itemType !== TListItemType::Pager)
1554 1554
 			{
1555
-				$n=$this->_columns->getCount();
1556
-				$cells=$item->getCells();
1557
-				for($i=0;$i<$n;++$i)
1555
+				$n = $this->_columns->getCount();
1556
+				$cells = $item->getCells();
1557
+				for ($i = 0; $i < $n; ++$i)
1558 1558
 				{
1559
-					$cell=$cells->itemAt($i);
1560
-					$column=$this->_columns->itemAt($i);
1561
-					if(!$column->getVisible())
1559
+					$cell = $cells->itemAt($i);
1560
+					$column = $this->_columns->itemAt($i);
1561
+					if (!$column->getVisible())
1562 1562
 						$cell->setVisible(false);
1563 1563
 					else
1564 1564
 					{
1565
-						if($itemType===TListItemType::Header)
1566
-							$style=$column->getHeaderStyle(false);
1567
-						else if($itemType===TListItemType::Footer)
1568
-							$style=$column->getFooterStyle(false);
1565
+						if ($itemType === TListItemType::Header)
1566
+							$style = $column->getHeaderStyle(false);
1567
+						else if ($itemType === TListItemType::Footer)
1568
+							$style = $column->getFooterStyle(false);
1569 1569
 						else
1570
-							$style=$column->getItemStyle(false);
1571
-						if($style!==null)
1570
+							$style = $column->getItemStyle(false);
1571
+						if ($style !== null)
1572 1572
 							$cell->getStyle()->mergeWith($style);
1573 1573
 					}
1574 1574
 				}
@@ -1583,10 +1583,10 @@  discard block
 block discarded – undo
1583 1583
 	public function renderBeginTag($writer)
1584 1584
 	{
1585 1585
 		parent::renderBeginTag($writer);
1586
-		if(($caption=$this->getCaption())!=='')
1586
+		if (($caption = $this->getCaption()) !== '')
1587 1587
 		{
1588
-			if(($align=$this->getCaptionAlign())!==TTableCaptionAlign::NotSet)
1589
-				$writer->addAttribute('align',strtolower($align));
1588
+			if (($align = $this->getCaptionAlign()) !== TTableCaptionAlign::NotSet)
1589
+				$writer->addAttribute('align', strtolower($align));
1590 1590
 			$writer->renderBeginTag('caption');
1591 1591
 			$writer->write($caption);
1592 1592
 			$writer->renderEndTag();
@@ -1599,30 +1599,30 @@  discard block
 block discarded – undo
1599 1599
 	 */
1600 1600
 	public function render($writer)
1601 1601
 	{
1602
-		if($this->getHasControls())
1602
+		if ($this->getHasControls())
1603 1603
 		{
1604 1604
 			$this->groupCells();
1605
-			if($this->_useEmptyTemplate)
1605
+			if ($this->_useEmptyTemplate)
1606 1606
 			{
1607
-				$control=new TWebControl;
1607
+				$control = new TWebControl;
1608 1608
 				$control->setID($this->getClientID());
1609 1609
 				$control->copyBaseAttributes($this);
1610
-				if($this->getHasStyle())
1610
+				if ($this->getHasStyle())
1611 1611
 					$control->getStyle()->copyFrom($this->getStyle());
1612 1612
 				$control->renderBeginTag($writer);
1613 1613
 				$this->renderContents($writer);
1614 1614
 				$control->renderEndTag($writer);
1615 1615
 			}
1616
-			else if($this->getViewState('ItemCount',0)>0)
1616
+			else if ($this->getViewState('ItemCount', 0) > 0)
1617 1617
 			{
1618 1618
 				$this->applyItemStyles();
1619
-				if($this->_topPager)
1619
+				if ($this->_topPager)
1620 1620
 				{
1621 1621
 					$this->_topPager->renderControl($writer);
1622 1622
 					$writer->writeLine();
1623 1623
 				}
1624 1624
 				$this->renderTable($writer);
1625
-				if($this->_bottomPager)
1625
+				if ($this->_bottomPager)
1626 1626
 				{
1627 1627
 					$writer->writeLine();
1628 1628
 					$this->_bottomPager->renderControl($writer);
@@ -1638,27 +1638,27 @@  discard block
 block discarded – undo
1638 1638
 	protected function renderTable($writer)
1639 1639
 	{
1640 1640
 		$this->renderBeginTag($writer);
1641
-		if($this->_header && $this->_header->getVisible())
1641
+		if ($this->_header && $this->_header->getVisible())
1642 1642
 		{
1643 1643
 			$writer->writeLine();
1644
-			if($style=$this->getViewState('TableHeadStyle',null))
1644
+			if ($style = $this->getViewState('TableHeadStyle', null))
1645 1645
 				$style->addAttributesToRender($writer);
1646 1646
 			$writer->renderBeginTag('thead');
1647 1647
 			$this->_header->render($writer);
1648 1648
 			$writer->renderEndTag();
1649 1649
 		}
1650 1650
 		$writer->writeLine();
1651
-		if($style=$this->getViewState('TableBodyStyle',null))
1651
+		if ($style = $this->getViewState('TableBodyStyle', null))
1652 1652
 			$style->addAttributesToRender($writer);
1653 1653
 		$writer->renderBeginTag('tbody');
1654
-		foreach($this->getItems() as $item)
1654
+		foreach ($this->getItems() as $item)
1655 1655
 			$item->renderControl($writer);
1656 1656
 		$writer->renderEndTag();
1657 1657
 
1658
-		if($this->_footer && $this->_footer->getVisible())
1658
+		if ($this->_footer && $this->_footer->getVisible())
1659 1659
 		{
1660 1660
 			$writer->writeLine();
1661
-			if($style=$this->getViewState('TableFootStyle',null))
1661
+			if ($style = $this->getViewState('TableFootStyle', null))
1662 1662
 				$style->addAttributesToRender($writer);
1663 1663
 			$writer->renderBeginTag('tfoot');
1664 1664
 			$this->_footer->render($writer);
@@ -1687,7 +1687,7 @@  discard block
 block discarded – undo
1687 1687
 	 * The TDataGridItem control responsible for the event.
1688 1688
 	 * @var TDataGridItem
1689 1689
 	 */
1690
-	private $_item=null;
1690
+	private $_item = null;
1691 1691
 
1692 1692
 	/**
1693 1693
 	 * Constructor.
@@ -1695,7 +1695,7 @@  discard block
 block discarded – undo
1695 1695
 	 */
1696 1696
 	public function __construct(TDataGridItem $item)
1697 1697
 	{
1698
-		$this->_item=$item;
1698
+		$this->_item = $item;
1699 1699
 	}
1700 1700
 
1701 1701
 	/**
@@ -1724,7 +1724,7 @@  discard block
 block discarded – undo
1724 1724
 	 * The TDataGridPager control responsible for the event.
1725 1725
 	 * @var TDataGridPager
1726 1726
 	 */
1727
-	protected $_pager=null;
1727
+	protected $_pager = null;
1728 1728
 
1729 1729
 	/**
1730 1730
 	 * Constructor.
@@ -1732,7 +1732,7 @@  discard block
 block discarded – undo
1732 1732
 	 */
1733 1733
 	public function __construct(TDataGridPager $pager)
1734 1734
 	{
1735
-		$this->_pager=$pager;
1735
+		$this->_pager = $pager;
1736 1736
 	}
1737 1737
 
1738 1738
 	/**
@@ -1763,11 +1763,11 @@  discard block
 block discarded – undo
1763 1763
 	/**
1764 1764
 	 * @var TDataGridItem the TDataGridItem control responsible for the event.
1765 1765
 	 */
1766
-	private $_item=null;
1766
+	private $_item = null;
1767 1767
 	/**
1768 1768
 	 * @var TControl the control originally raises the <b>Command</b> event.
1769 1769
 	 */
1770
-	private $_source=null;
1770
+	private $_source = null;
1771 1771
 
1772 1772
 	/**
1773 1773
 	 * Constructor.
@@ -1775,11 +1775,11 @@  discard block
 block discarded – undo
1775 1775
 	 * @param TControl original event sender
1776 1776
 	 * @param TCommandEventParameter original event parameter
1777 1777
 	 */
1778
-	public function __construct($item,$source,TCommandEventParameter $param)
1778
+	public function __construct($item, $source, TCommandEventParameter $param)
1779 1779
 	{
1780
-		$this->_item=$item;
1781
-		$this->_source=$source;
1782
-		parent::__construct($param->getCommandName(),$param->getCommandParameter());
1780
+		$this->_item = $item;
1781
+		$this->_source = $source;
1782
+		parent::__construct($param->getCommandName(), $param->getCommandParameter());
1783 1783
 	}
1784 1784
 
1785 1785
 	/**
@@ -1818,21 +1818,21 @@  discard block
 block discarded – undo
1818 1818
 	/**
1819 1819
 	 * @var string sort expression
1820 1820
 	 */
1821
-	private $_sortExpression='';
1821
+	private $_sortExpression = '';
1822 1822
 	/**
1823 1823
 	 * @var TControl original event sender
1824 1824
 	 */
1825
-	private $_source=null;
1825
+	private $_source = null;
1826 1826
 
1827 1827
 	/**
1828 1828
 	 * Constructor.
1829 1829
 	 * @param TControl the control originally raises the <b>OnCommand</b> event.
1830 1830
 	 * @param TDataGridCommandEventParameter command event parameter
1831 1831
 	 */
1832
-	public function __construct($source,TDataGridCommandEventParameter $param)
1832
+	public function __construct($source, TDataGridCommandEventParameter $param)
1833 1833
 	{
1834
-		$this->_source=$source;
1835
-		$this->_sortExpression=$param->getCommandParameter();
1834
+		$this->_source = $source;
1835
+		$this->_sortExpression = $param->getCommandParameter();
1836 1836
 	}
1837 1837
 
1838 1838
 	/**
@@ -1875,17 +1875,17 @@  discard block
 block discarded – undo
1875 1875
 	/**
1876 1876
 	 * @var TControl original event sender
1877 1877
 	 */
1878
-	private $_source=null;
1878
+	private $_source = null;
1879 1879
 
1880 1880
 	/**
1881 1881
 	 * Constructor.
1882 1882
 	 * @param TControl the control originally raises the <b>OnCommand</b> event.
1883 1883
 	 * @param integer new page index
1884 1884
 	 */
1885
-	public function __construct($source,$newPageIndex)
1885
+	public function __construct($source, $newPageIndex)
1886 1886
 	{
1887
-		$this->_source=$source;
1888
-		$this->_newIndex=$newPageIndex;
1887
+		$this->_source = $source;
1888
+		$this->_newIndex = $newPageIndex;
1889 1889
 	}
1890 1890
 
1891 1891
 	/**
@@ -1924,35 +1924,35 @@  discard block
 block discarded – undo
1924 1924
 	/**
1925 1925
 	 * @var integer index of the data item in the Items collection of datagrid
1926 1926
 	 */
1927
-	private $_itemIndex='';
1927
+	private $_itemIndex = '';
1928 1928
 	/**
1929 1929
 	 * @var integer index of the item from the bound data source
1930 1930
 	 */
1931
-	private $_dataSourceIndex=0;
1931
+	private $_dataSourceIndex = 0;
1932 1932
 	/**
1933 1933
 	 * type of the TDataGridItem
1934 1934
 	 * @var string
1935 1935
 	 */
1936
-	private $_itemType='';
1936
+	private $_itemType = '';
1937 1937
 	/**
1938 1938
 	 * value of the data item
1939 1939
 	 * @var mixed
1940 1940
 	 */
1941
-	private $_data=null;
1941
+	private $_data = null;
1942 1942
 
1943 1943
 	/**
1944 1944
 	 * Constructor.
1945 1945
 	 * @param integer zero-based index of the item in the item collection of datagrid
1946 1946
 	 * @param TListItemType item type
1947 1947
 	 */
1948
-	public function __construct($itemIndex,$dataSourceIndex,$itemType)
1948
+	public function __construct($itemIndex, $dataSourceIndex, $itemType)
1949 1949
 	{
1950
-		$this->_itemIndex=$itemIndex;
1951
-		$this->_dataSourceIndex=$dataSourceIndex;
1950
+		$this->_itemIndex = $itemIndex;
1951
+		$this->_dataSourceIndex = $dataSourceIndex;
1952 1952
 		$this->setItemType($itemType);
1953
-		if($itemType===TListItemType::Header)
1953
+		if ($itemType === TListItemType::Header)
1954 1954
 			$this->setTableSection(TTableRowSection::Header);
1955
-		else if($itemType===TListItemType::Footer)
1955
+		else if ($itemType === TListItemType::Footer)
1956 1956
 			$this->setTableSection(TTableRowSection::Footer);
1957 1957
 	}
1958 1958
 
@@ -1969,7 +1969,7 @@  discard block
 block discarded – undo
1969 1969
 	 */
1970 1970
 	public function setItemType($value)
1971 1971
 	{
1972
-		$this->_itemType=TPropertyValue::ensureEnum($value,'TListItemType');
1972
+		$this->_itemType = TPropertyValue::ensureEnum($value, 'TListItemType');
1973 1973
 	}
1974 1974
 
1975 1975
 	/**
@@ -2003,7 +2003,7 @@  discard block
 block discarded – undo
2003 2003
 	 */
2004 2004
 	public function setData($value)
2005 2005
 	{
2006
-		$this->_data=$value;
2006
+		$this->_data = $value;
2007 2007
 	}
2008 2008
 
2009 2009
 	/**
@@ -2033,11 +2033,11 @@  discard block
 block discarded – undo
2033 2033
 	 * @param TEventParameter event parameter
2034 2034
 	 * @return boolean whether the event bubbling should stop here.
2035 2035
 	 */
2036
-	public function bubbleEvent($sender,$param)
2036
+	public function bubbleEvent($sender, $param)
2037 2037
 	{
2038
-		if($param instanceof TCommandEventParameter)
2038
+		if ($param instanceof TCommandEventParameter)
2039 2039
 		{
2040
-			$this->raiseBubbleEvent($this,new TDataGridCommandEventParameter($this,$sender,$param));
2040
+			$this->raiseBubbleEvent($this, new TDataGridCommandEventParameter($this, $sender, $param));
2041 2041
 			return true;
2042 2042
 		}
2043 2043
 		else
@@ -2065,7 +2065,7 @@  discard block
 block discarded – undo
2065 2065
 	 */
2066 2066
 	public function __construct($dataGrid)
2067 2067
 	{
2068
-		$this->_dataGrid=$dataGrid;
2068
+		$this->_dataGrid = $dataGrid;
2069 2069
 	}
2070 2070
 
2071 2071
 	/**
@@ -2075,11 +2075,11 @@  discard block
 block discarded – undo
2075 2075
 	 * @param TEventParameter event parameter
2076 2076
 	 * @return boolean whether the event bubbling should stop here.
2077 2077
 	 */
2078
-	public function bubbleEvent($sender,$param)
2078
+	public function bubbleEvent($sender, $param)
2079 2079
 	{
2080
-		if($param instanceof TCommandEventParameter)
2080
+		if ($param instanceof TCommandEventParameter)
2081 2081
 		{
2082
-			$this->raiseBubbleEvent($this,new TDataGridCommandEventParameter($this,$sender,$param));
2082
+			$this->raiseBubbleEvent($this, new TDataGridCommandEventParameter($this, $sender, $param));
2083 2083
 			return true;
2084 2084
 		}
2085 2085
 		else
@@ -2122,10 +2122,10 @@  discard block
 block discarded – undo
2122 2122
 	 * @param mixed new item
2123 2123
 	 * @throws TInvalidDataTypeException if the item to be inserted is not a TDataGridItem.
2124 2124
 	 */
2125
-	public function insertAt($index,$item)
2125
+	public function insertAt($index, $item)
2126 2126
 	{
2127
-		if($item instanceof TDataGridItem)
2128
-			parent::insertAt($index,$item);
2127
+		if ($item instanceof TDataGridItem)
2128
+			parent::insertAt($index, $item);
2129 2129
 		else
2130 2130
 			throw new TInvalidDataTypeException('datagriditemcollection_datagriditem_required');
2131 2131
 	}
@@ -2154,7 +2154,7 @@  discard block
 block discarded – undo
2154 2154
 	 */
2155 2155
 	public function __construct(TDataGrid $owner)
2156 2156
 	{
2157
-		$this->_o=$owner;
2157
+		$this->_o = $owner;
2158 2158
 	}
2159 2159
 
2160 2160
 	/**
@@ -2172,12 +2172,12 @@  discard block
 block discarded – undo
2172 2172
 	 * @param mixed new item
2173 2173
 	 * @throws TInvalidDataTypeException if the item to be inserted is not a TDataGridColumn.
2174 2174
 	 */
2175
-	public function insertAt($index,$item)
2175
+	public function insertAt($index, $item)
2176 2176
 	{
2177
-		if($item instanceof TDataGridColumn)
2177
+		if ($item instanceof TDataGridColumn)
2178 2178
 		{
2179 2179
 			$item->setOwner($this->_o);
2180
-			parent::insertAt($index,$item);
2180
+			parent::insertAt($index, $item);
2181 2181
 		}
2182 2182
 		else
2183 2183
 			throw new TInvalidDataTypeException('datagridcolumncollection_datagridcolumn_required');
@@ -2198,8 +2198,8 @@  discard block
 block discarded – undo
2198 2198
  */
2199 2199
 class TDataGridPagerMode extends TEnumerable
2200 2200
 {
2201
-	const NextPrev='NextPrev';
2202
-	const Numeric='Numeric';
2201
+	const NextPrev = 'NextPrev';
2202
+	const Numeric = 'Numeric';
2203 2203
 }
2204 2204
 
2205 2205
 
@@ -2217,8 +2217,8 @@  discard block
 block discarded – undo
2217 2217
  */
2218 2218
 class TDataGridPagerButtonType extends TEnumerable
2219 2219
 {
2220
-	const LinkButton='LinkButton';
2221
-	const PushButton='PushButton';
2220
+	const LinkButton = 'LinkButton';
2221
+	const PushButton = 'PushButton';
2222 2222
 }
2223 2223
 
2224 2224
 
@@ -2237,8 +2237,8 @@  discard block
 block discarded – undo
2237 2237
  */
2238 2238
 class TDataGridPagerPosition extends TEnumerable
2239 2239
 {
2240
-	const Bottom='Bottom';
2241
-	const Top='Top';
2242
-	const TopAndBottom='TopAndBottom';
2240
+	const Bottom = 'Bottom';
2241
+	const Top = 'Top';
2242
+	const TopAndBottom = 'TopAndBottom';
2243 2243
 }
2244 2244
 
Please login to merge, or discard this patch.
Braces   +288 added lines, -236 removed lines patch added patch discarded remove patch
@@ -239,10 +239,12 @@  discard block
 block discarded – undo
239 239
 	 */
240 240
 	public function addParsedObject($object)
241 241
 	{
242
-		if($object instanceof TDataGridColumn)
243
-			$this->getColumns()->add($object);
244
-		else
245
-			parent::addParsedObject($object);  // this is needed by EmptyTemplate
242
+		if($object instanceof TDataGridColumn) {
243
+					$this->getColumns()->add($object);
244
+		} else {
245
+					parent::addParsedObject($object);
246
+		}
247
+		// this is needed by EmptyTemplate
246 248
 	}
247 249
 
248 250
 	/**
@@ -250,8 +252,9 @@  discard block
 block discarded – undo
250 252
 	 */
251 253
 	public function getColumns()
252 254
 	{
253
-		if(!$this->_columns)
254
-			$this->_columns=new TDataGridColumnCollection($this);
255
+		if(!$this->_columns) {
256
+					$this->_columns=new TDataGridColumnCollection($this);
257
+		}
255 258
 		return $this->_columns;
256 259
 	}
257 260
 
@@ -260,8 +263,9 @@  discard block
 block discarded – undo
260 263
 	 */
261 264
 	public function getAutoColumns()
262 265
 	{
263
-		if(!$this->_autoColumns)
264
-			$this->_autoColumns=new TDataGridColumnCollection($this);
266
+		if(!$this->_autoColumns) {
267
+					$this->_autoColumns=new TDataGridColumnCollection($this);
268
+		}
265 269
 		return $this->_autoColumns;
266 270
 	}
267 271
 
@@ -270,8 +274,9 @@  discard block
 block discarded – undo
270 274
 	 */
271 275
 	public function getItems()
272 276
 	{
273
-		if(!$this->_items)
274
-			$this->_items=new TDataGridItemCollection;
277
+		if(!$this->_items) {
278
+					$this->_items=new TDataGridItemCollection;
279
+		}
275 280
 		return $this->_items;
276 281
 	}
277 282
 
@@ -513,10 +518,11 @@  discard block
 block discarded – undo
513 518
 	{
514 519
 		$index=$this->getSelectedItemIndex();
515 520
 		$items=$this->getItems();
516
-		if($index>=0 && $index<$items->getCount())
517
-			return $items->itemAt($index);
518
-		else
519
-			return null;
521
+		if($index>=0 && $index<$items->getCount()) {
522
+					return $items->itemAt($index);
523
+		} else {
524
+					return null;
525
+		}
520 526
 	}
521 527
 
522 528
 	/**
@@ -537,8 +543,9 @@  discard block
 block discarded – undo
537 543
 	 */
538 544
 	public function setSelectedItemIndex($value)
539 545
 	{
540
-		if(($value=TPropertyValue::ensureInteger($value))<0)
541
-			$value=-1;
546
+		if(($value=TPropertyValue::ensureInteger($value))<0) {
547
+					$value=-1;
548
+		}
542 549
 		if(($current=$this->getSelectedItemIndex())!==$value)
543 550
 		{
544 551
 			$this->setViewState('SelectedItemIndex',$value,-1);
@@ -547,14 +554,16 @@  discard block
 block discarded – undo
547 554
 			if($current>=0 && $current<$itemCount)
548 555
 			{
549 556
 				$item=$items->itemAt($current);
550
-				if($item->getItemType()!==TListItemType::EditItem)
551
-					$item->setItemType($current%2?TListItemType::AlternatingItem:TListItemType::Item);
557
+				if($item->getItemType()!==TListItemType::EditItem) {
558
+									$item->setItemType($current%2?TListItemType::AlternatingItem:TListItemType::Item);
559
+				}
552 560
 			}
553 561
 			if($value>=0 && $value<$itemCount)
554 562
 			{
555 563
 				$item=$items->itemAt($value);
556
-				if($item->getItemType()!==TListItemType::EditItem)
557
-					$item->setItemType(TListItemType::SelectedItem);
564
+				if($item->getItemType()!==TListItemType::EditItem) {
565
+									$item->setItemType(TListItemType::SelectedItem);
566
+				}
558 567
 			}
559 568
 		}
560 569
 	}
@@ -566,10 +575,11 @@  discard block
 block discarded – undo
566 575
 	{
567 576
 		$index=$this->getEditItemIndex();
568 577
 		$items=$this->getItems();
569
-		if($index>=0 && $index<$items->getCount())
570
-			return $items->itemAt($index);
571
-		else
572
-			return null;
578
+		if($index>=0 && $index<$items->getCount()) {
579
+					return $items->itemAt($index);
580
+		} else {
581
+					return null;
582
+		}
573 583
 	}
574 584
 
575 585
 	/**
@@ -589,17 +599,20 @@  discard block
 block discarded – undo
589 599
 	 */
590 600
 	public function setEditItemIndex($value)
591 601
 	{
592
-		if(($value=TPropertyValue::ensureInteger($value))<0)
593
-			$value=-1;
602
+		if(($value=TPropertyValue::ensureInteger($value))<0) {
603
+					$value=-1;
604
+		}
594 605
 		if(($current=$this->getEditItemIndex())!==$value)
595 606
 		{
596 607
 			$this->setViewState('EditItemIndex',$value,-1);
597 608
 			$items=$this->getItems();
598 609
 			$itemCount=$items->getCount();
599
-			if($current>=0 && $current<$itemCount)
600
-				$items->itemAt($current)->setItemType($current%2?TListItemType::AlternatingItem:TListItemType::Item);
601
-			if($value>=0 && $value<$itemCount)
602
-				$items->itemAt($value)->setItemType(TListItemType::EditItem);
610
+			if($current>=0 && $current<$itemCount) {
611
+							$items->itemAt($current)->setItemType($current%2?TListItemType::AlternatingItem:TListItemType::Item);
612
+			}
613
+			if($value>=0 && $value<$itemCount) {
614
+							$items->itemAt($value)->setItemType(TListItemType::EditItem);
615
+			}
603 616
 		}
604 617
 	}
605 618
 
@@ -681,10 +694,11 @@  discard block
 block discarded – undo
681 694
 	 */
682 695
 	public function setEmptyTemplate($value)
683 696
 	{
684
-		if($value instanceof ITemplate || $value===null)
685
-			$this->_emptyTemplate=$value;
686
-		else
687
-			throw new TInvalidDataTypeException('datagrid_template_required','EmptyTemplate');
697
+		if($value instanceof ITemplate || $value===null) {
698
+					$this->_emptyTemplate=$value;
699
+		} else {
700
+					throw new TInvalidDataTypeException('datagrid_template_required','EmptyTemplate');
701
+		}
688 702
 	}
689 703
 
690 704
 	/**
@@ -711,45 +725,40 @@  discard block
 block discarded – undo
711 725
 				$this->setSelectedItemIndex($param->getItem()->getItemIndex());
712 726
 				$this->onSelectedIndexChanged($param);
713 727
 				return true;
714
-			}
715
-			else if(strcasecmp($command,self::CMD_EDIT)===0)
728
+			} else if(strcasecmp($command,self::CMD_EDIT)===0)
716 729
 			{
717 730
 				$this->onEditCommand($param);
718 731
 				return true;
719
-			}
720
-			else if(strcasecmp($command,self::CMD_DELETE)===0)
732
+			} else if(strcasecmp($command,self::CMD_DELETE)===0)
721 733
 			{
722 734
 				$this->onDeleteCommand($param);
723 735
 				return true;
724
-			}
725
-			else if(strcasecmp($command,self::CMD_UPDATE)===0)
736
+			} else if(strcasecmp($command,self::CMD_UPDATE)===0)
726 737
 			{
727 738
 				$this->onUpdateCommand($param);
728 739
 				return true;
729
-			}
730
-			else if(strcasecmp($command,self::CMD_CANCEL)===0)
740
+			} else if(strcasecmp($command,self::CMD_CANCEL)===0)
731 741
 			{
732 742
 				$this->onCancelCommand($param);
733 743
 				return true;
734
-			}
735
-			else if(strcasecmp($command,self::CMD_SORT)===0)
744
+			} else if(strcasecmp($command,self::CMD_SORT)===0)
736 745
 			{
737 746
 				$this->onSortCommand(new TDataGridSortCommandEventParameter($sender,$param));
738 747
 				return true;
739
-			}
740
-			else if(strcasecmp($command,self::CMD_PAGE)===0)
748
+			} else if(strcasecmp($command,self::CMD_PAGE)===0)
741 749
 			{
742 750
 				$p=$param->getCommandParameter();
743
-				if(strcasecmp($p,self::CMD_PAGE_NEXT)===0)
744
-					$pageIndex=$this->getCurrentPageIndex()+1;
745
-				else if(strcasecmp($p,self::CMD_PAGE_PREV)===0)
746
-					$pageIndex=$this->getCurrentPageIndex()-1;
747
-				else if(strcasecmp($p,self::CMD_PAGE_FIRST)===0)
748
-					$pageIndex=0;
749
-				else if(strcasecmp($p,self::CMD_PAGE_LAST)===0)
750
-					$pageIndex=$this->getPageCount()-1;
751
-				else
752
-					$pageIndex=TPropertyValue::ensureInteger($p)-1;
751
+				if(strcasecmp($p,self::CMD_PAGE_NEXT)===0) {
752
+									$pageIndex=$this->getCurrentPageIndex()+1;
753
+				} else if(strcasecmp($p,self::CMD_PAGE_PREV)===0) {
754
+									$pageIndex=$this->getCurrentPageIndex()-1;
755
+				} else if(strcasecmp($p,self::CMD_PAGE_FIRST)===0) {
756
+									$pageIndex=0;
757
+				} else if(strcasecmp($p,self::CMD_PAGE_LAST)===0) {
758
+									$pageIndex=$this->getPageCount()-1;
759
+				} else {
760
+									$pageIndex=TPropertyValue::ensureInteger($p)-1;
761
+				}
753 762
 				$this->onPageIndexChanged(new TDataGridPageChangedEventParameter($sender,$pageIndex));
754 763
 				return true;
755 764
 			}
@@ -872,30 +881,34 @@  discard block
 block discarded – undo
872 881
 	public function saveState()
873 882
 	{
874 883
 		parent::saveState();
875
-		if(!$this->getEnableViewState(true))
876
-			return;
877
-		if($this->_items)
878
-			$this->setViewState('ItemCount',$this->_items->getCount(),0);
879
-		else
880
-			$this->clearViewState('ItemCount');
884
+		if(!$this->getEnableViewState(true)) {
885
+					return;
886
+		}
887
+		if($this->_items) {
888
+					$this->setViewState('ItemCount',$this->_items->getCount(),0);
889
+		} else {
890
+					$this->clearViewState('ItemCount');
891
+		}
881 892
 		if($this->_autoColumns)
882 893
 		{
883 894
 			$state=array();
884
-			foreach($this->_autoColumns as $column)
885
-				$state[]=$column->saveState();
895
+			foreach($this->_autoColumns as $column) {
896
+							$state[]=$column->saveState();
897
+			}
886 898
 			$this->setViewState('AutoColumns',$state,array());
899
+		} else {
900
+					$this->clearViewState('AutoColumns');
887 901
 		}
888
-		else
889
-			$this->clearViewState('AutoColumns');
890 902
 		if($this->_columns)
891 903
 		{
892 904
 			$state=array();
893
-			foreach($this->_columns as $column)
894
-				$state[]=$column->saveState();
905
+			foreach($this->_columns as $column) {
906
+							$state[]=$column->saveState();
907
+			}
895 908
 			$this->setViewState('Columns',$state,array());
909
+		} else {
910
+					$this->clearViewState('Columns');
896 911
 		}
897
-		else
898
-			$this->clearViewState('Columns');
899 912
 	}
900 913
 
901 914
 	/**
@@ -905,8 +918,9 @@  discard block
 block discarded – undo
905 918
 	public function loadState()
906 919
 	{
907 920
 		parent::loadState();
908
-		if(!$this->getEnableViewState(true))
909
-			return;
921
+		if(!$this->getEnableViewState(true)) {
922
+					return;
923
+		}
910 924
 		if(!$this->getIsDataBound())
911 925
 		{
912 926
 			$state=$this->getViewState('AutoColumns',array());
@@ -919,9 +933,9 @@  discard block
 block discarded – undo
919 933
 					$column->loadState($st);
920 934
 					$this->_autoColumns->add($column);
921 935
 				}
936
+			} else {
937
+							$this->_autoColumns=null;
922 938
 			}
923
-			else
924
-				$this->_autoColumns=null;
925 939
 			$state=$this->getViewState('Columns',array());
926 940
 			if($this->_columns && $this->_columns->getCount()===count($state))
927 941
 			{
@@ -970,34 +984,38 @@  discard block
 block discarded – undo
970 984
 
971 985
 		if($columns->getCount())
972 986
 		{
973
-			foreach($columns as $column)
974
-				$column->initialize();
987
+			foreach($columns as $column) {
988
+							$column->initialize();
989
+			}
975 990
 			$selectedIndex=$this->getSelectedItemIndex();
976 991
 			$editIndex=$this->getEditItemIndex();
977 992
 			for($index=0;$index<$itemCount;++$index)
978 993
 			{
979 994
 				if($index===0)
980 995
 				{
981
-					if($allowPaging)
982
-						$this->_topPager=$this->createPager();
996
+					if($allowPaging) {
997
+											$this->_topPager=$this->createPager();
998
+					}
983 999
 					$this->_header=$this->createItemInternal(-1,-1,TListItemType::Header,false,null,$columns);
984 1000
 				}
985
-				if($index===$editIndex)
986
-					$itemType=TListItemType::EditItem;
987
-				else if($index===$selectedIndex)
988
-					$itemType=TListItemType::SelectedItem;
989
-				else if($index % 2)
990
-					$itemType=TListItemType::AlternatingItem;
991
-				else
992
-					$itemType=TListItemType::Item;
1001
+				if($index===$editIndex) {
1002
+									$itemType=TListItemType::EditItem;
1003
+				} else if($index===$selectedIndex) {
1004
+									$itemType=TListItemType::SelectedItem;
1005
+				} else if($index % 2) {
1006
+									$itemType=TListItemType::AlternatingItem;
1007
+				} else {
1008
+									$itemType=TListItemType::Item;
1009
+				}
993 1010
 				$items->add($this->createItemInternal($index,$dsIndex,$itemType,false,null,$columns));
994 1011
 				$dsIndex++;
995 1012
 			}
996 1013
 			if($index>0)
997 1014
 			{
998 1015
 				$this->_footer=$this->createItemInternal(-1,-1,TListItemType::Footer,false,null,$columns);
999
-				if($allowPaging)
1000
-					$this->_bottomPager=$this->createPager();
1016
+				if($allowPaging) {
1017
+									$this->_bottomPager=$this->createPager();
1018
+				}
1001 1019
 			}
1002 1020
 		}
1003 1021
 		if(!$dsIndex && $this->_emptyTemplate!==null)
@@ -1026,9 +1044,9 @@  discard block
 block discarded – undo
1026 1044
 			$columns=new TList($this->getColumns());
1027 1045
 			$autoColumns=$this->createAutoColumns($data);
1028 1046
 			$columns->mergeWith($autoColumns);
1047
+		} else {
1048
+					$columns=$this->getColumns();
1029 1049
 		}
1030
-		else
1031
-			$columns=$this->getColumns();
1032 1050
 		$this->_allColumns=$columns;
1033 1051
 
1034 1052
 		$items=$this->getItems();
@@ -1039,31 +1057,35 @@  discard block
 block discarded – undo
1039 1057
 		$this->setViewState('DataSourceIndex',$dsIndex,0);
1040 1058
 		if($columns->getCount())
1041 1059
 		{
1042
-			foreach($columns as $column)
1043
-				$column->initialize();
1060
+			foreach($columns as $column) {
1061
+							$column->initialize();
1062
+			}
1044 1063
 
1045 1064
 			$selectedIndex=$this->getSelectedItemIndex();
1046 1065
 			$editIndex=$this->getEditItemIndex();
1047 1066
 			foreach($data as $key=>$row)
1048 1067
 			{
1049
-				if($keyField!=='')
1050
-					$keys->add($this->getDataFieldValue($row,$keyField));
1051
-				else
1052
-					$keys->add($key);
1068
+				if($keyField!=='') {
1069
+									$keys->add($this->getDataFieldValue($row,$keyField));
1070
+				} else {
1071
+									$keys->add($key);
1072
+				}
1053 1073
 				if($index===0)
1054 1074
 				{
1055
-					if($allowPaging)
1056
-						$this->_topPager=$this->createPager();
1075
+					if($allowPaging) {
1076
+											$this->_topPager=$this->createPager();
1077
+					}
1057 1078
 					$this->_header=$this->createItemInternal(-1,-1,TListItemType::Header,true,null,$columns);
1058 1079
 				}
1059
-				if($index===$editIndex)
1060
-					$itemType=TListItemType::EditItem;
1061
-				else if($index===$selectedIndex)
1062
-					$itemType=TListItemType::SelectedItem;
1063
-				else if($index % 2)
1064
-					$itemType=TListItemType::AlternatingItem;
1065
-				else
1066
-					$itemType=TListItemType::Item;
1080
+				if($index===$editIndex) {
1081
+									$itemType=TListItemType::EditItem;
1082
+				} else if($index===$selectedIndex) {
1083
+									$itemType=TListItemType::SelectedItem;
1084
+				} else if($index % 2) {
1085
+									$itemType=TListItemType::AlternatingItem;
1086
+				} else {
1087
+									$itemType=TListItemType::Item;
1088
+				}
1067 1089
 				$items->add($this->createItemInternal($index,$dsIndex,$itemType,true,$row,$columns));
1068 1090
 				$index++;
1069 1091
 				$dsIndex++;
@@ -1071,8 +1093,9 @@  discard block
 block discarded – undo
1071 1093
 			if($index>0)
1072 1094
 			{
1073 1095
 				$this->_footer=$this->createItemInternal(-1,-1,TListItemType::Footer,true,null,$columns);
1074
-				if($allowPaging)
1075
-					$this->_bottomPager=$this->createPager();
1096
+				if($allowPaging) {
1097
+									$this->_bottomPager=$this->createPager();
1098
+				}
1076 1099
 			}
1077 1100
 		}
1078 1101
 		$this->setViewState('ItemCount',$index,0);
@@ -1090,21 +1113,24 @@  discard block
 block discarded – undo
1090 1113
 	 */
1091 1114
 	private function groupCells()
1092 1115
 	{
1093
-		if(($columns=$this->_allColumns)===null)
1094
-			return;
1116
+		if(($columns=$this->_allColumns)===null) {
1117
+					return;
1118
+		}
1095 1119
 		$items=$this->getItems();
1096 1120
 		foreach($columns as $id=>$column)
1097 1121
 		{
1098
-			if(!$column->getEnableCellGrouping())
1099
-				continue;
1122
+			if(!$column->getEnableCellGrouping()) {
1123
+							continue;
1124
+			}
1100 1125
 			$prevCell=null;
1101 1126
 			$prevCellText=null;
1102 1127
 			foreach($items as $item)
1103 1128
 			{
1104 1129
 				$itemType=$item->getItemType();
1105 1130
 				$cell=$item->getCells()->itemAt($id);
1106
-				if(!$cell->getVisible())
1107
-					continue;
1131
+				if(!$cell->getVisible()) {
1132
+									continue;
1133
+				}
1108 1134
 				if($itemType===TListItemType::Item || $itemType===TListItemType::AlternatingItem || $itemType===TListItemType::SelectedItem)
1109 1135
 				{
1110 1136
 					if(($cellText=$this->getCellText($cell))==='')
@@ -1117,11 +1143,11 @@  discard block
 block discarded – undo
1117 1143
 					{
1118 1144
 						$prevCell=$cell;
1119 1145
 						$prevCellText=$cellText;
1120
-					}
1121
-					else
1146
+					} else
1122 1147
 					{
1123
-						if(($rowSpan=$prevCell->getRowSpan())===0)
1124
-							$rowSpan=1;
1148
+						if(($rowSpan=$prevCell->getRowSpan())===0) {
1149
+													$rowSpan=1;
1150
+						}
1125 1151
 						$prevCell->setRowSpan($rowSpan+1);
1126 1152
 						$cell->setVisible(false);
1127 1153
 					}
@@ -1137,8 +1163,9 @@  discard block
 block discarded – undo
1137 1163
 			$controls=$cell->getControls();
1138 1164
 			foreach($controls as $control)
1139 1165
 			{
1140
-				if($control instanceof IDataRenderer)
1141
-					return $control->getData();
1166
+				if($control instanceof IDataRenderer) {
1167
+									return $control->getData();
1168
+				}
1142 1169
 			}
1143 1170
 		}
1144 1171
 		return $data;
@@ -1167,8 +1194,7 @@  discard block
 block discarded – undo
1167 1194
 			$this->getControls()->add($item);
1168 1195
 			$item->dataBind();
1169 1196
 			$this->onItemDataBound($param);
1170
-		}
1171
-		else
1197
+		} else
1172 1198
 		{
1173 1199
 			$this->onItemCreated($param);
1174 1200
 			$this->getControls()->add($item);
@@ -1188,12 +1214,14 @@  discard block
 block discarded – undo
1188 1214
 		$index=0;
1189 1215
 		foreach($columns as $column)
1190 1216
 		{
1191
-			if($itemType===TListItemType::Header)
1192
-				$cell=new TTableHeaderCell;
1193
-			else
1194
-				$cell=new TTableCell;
1195
-			if(($id=$column->getID())!=='')
1196
-				$item->registerObject($id,$cell);
1217
+			if($itemType===TListItemType::Header) {
1218
+							$cell=new TTableHeaderCell;
1219
+			} else {
1220
+							$cell=new TTableCell;
1221
+			}
1222
+			if(($id=$column->getID())!=='') {
1223
+							$item->registerObject($id,$cell);
1224
+			}
1197 1225
 			$cells->add($cell);
1198 1226
 			$column->initializeCell($cell,$index,$itemType);
1199 1227
 			$index++;
@@ -1243,20 +1271,20 @@  discard block
 block discarded – undo
1243 1271
 	{
1244 1272
 		if($buttonType===TDataGridPagerButtonType::LinkButton)
1245 1273
 		{
1246
-			if($enabled)
1247
-				$button=new TLinkButton;
1248
-			else
1274
+			if($enabled) {
1275
+							$button=new TLinkButton;
1276
+			} else
1249 1277
 			{
1250 1278
 				$button=new TLabel;
1251 1279
 				$button->setText($text);
1252 1280
 				return $button;
1253 1281
 			}
1254
-		}
1255
-		else
1282
+		} else
1256 1283
 		{
1257 1284
 			$button=new TButton;
1258
-			if(!$enabled)
1259
-				$button->setEnabled(false);
1285
+			if(!$enabled) {
1286
+							$button->setEnabled(false);
1287
+			}
1260 1288
 		}
1261 1289
 		$button->setText($text);
1262 1290
 		$button->setCommandName($commandName);
@@ -1286,8 +1314,7 @@  discard block
 block discarded – undo
1286 1314
 
1287 1315
 			$label=$this->createPagerButton($pager,$buttonType,false,$style->getPrevPageText(),'','');
1288 1316
 			$controls->add($label);
1289
-		}
1290
-		else
1317
+		} else
1291 1318
 		{
1292 1319
 			if(($text=$style->getFirstPageText())!=='')
1293 1320
 			{
@@ -1310,8 +1337,7 @@  discard block
 block discarded – undo
1310 1337
 				$label=$this->createPagerButton($pager,$buttonType,false,$text,'','');
1311 1338
 				$controls->add($label);
1312 1339
 			}
1313
-		}
1314
-		else
1340
+		} else
1315 1341
 		{
1316 1342
 			$button=$this->createPagerButton($pager,$buttonType,true,$style->getNextPageText(),self::CMD_PAGE,self::CMD_PAGE_NEXT);
1317 1343
 			$controls->add($button);
@@ -1342,12 +1368,14 @@  discard block
 block discarded – undo
1342 1368
 		if($pageIndex>$endPageIndex)
1343 1369
 		{
1344 1370
 			$startPageIndex=((int)(($pageIndex-1)/$maxButtonCount))*$maxButtonCount+1;
1345
-			if(($endPageIndex=$startPageIndex+$maxButtonCount-1)>$pageCount)
1346
-				$endPageIndex=$pageCount;
1371
+			if(($endPageIndex=$startPageIndex+$maxButtonCount-1)>$pageCount) {
1372
+							$endPageIndex=$pageCount;
1373
+			}
1347 1374
 			if($endPageIndex-$startPageIndex+1<$maxButtonCount)
1348 1375
 			{
1349
-				if(($startPageIndex=$endPageIndex-$maxButtonCount+1)<1)
1350
-					$startPageIndex=1;
1376
+				if(($startPageIndex=$endPageIndex-$maxButtonCount+1)<1) {
1377
+									$startPageIndex=1;
1378
+				}
1351 1379
 			}
1352 1380
 		}
1353 1381
 
@@ -1371,14 +1399,14 @@  discard block
 block discarded – undo
1371 1399
 			{
1372 1400
 				$label=$this->createPagerButton($pager,$buttonType,false,"$i",'','');
1373 1401
 				$controls->add($label);
1374
-			}
1375
-			else
1402
+			} else
1376 1403
 			{
1377 1404
 				$button=$this->createPagerButton($pager,$buttonType,true,"$i",self::CMD_PAGE,"$i");
1378 1405
 				$controls->add($button);
1379 1406
 			}
1380
-			if($i<$endPageIndex)
1381
-				$controls->add("\n");
1407
+			if($i<$endPageIndex) {
1408
+							$controls->add("\n");
1409
+			}
1382 1410
 		}
1383 1411
 
1384 1412
 		if($pageCount>$endPageIndex)
@@ -1403,8 +1431,9 @@  discard block
 block discarded – undo
1403 1431
 	 */
1404 1432
 	protected function createAutoColumns($dataSource)
1405 1433
 	{
1406
-		if(!$dataSource)
1407
-			return null;
1434
+		if(!$dataSource) {
1435
+					return null;
1436
+		}
1408 1437
 		$autoColumns=$this->getAutoColumns();
1409 1438
 		$autoColumns->clear();
1410 1439
 		foreach($dataSource as $row)
@@ -1418,8 +1447,7 @@  discard block
 block discarded – undo
1418 1447
 					$column->setDataField($key);
1419 1448
 					$column->setSortExpression($key);
1420 1449
 					$autoColumns->add($column);
1421
-				}
1422
-				else
1450
+				} else
1423 1451
 				{
1424 1452
 					$column->setHeaderText(TListItemType::Item);
1425 1453
 					$column->setDataField($key);
@@ -1450,10 +1478,11 @@  discard block
 block discarded – undo
1450 1478
 		$alternatingItemStyle=$this->getViewState('AlternatingItemStyle',null);
1451 1479
 		if($itemStyle!==null)
1452 1480
 		{
1453
-			if($alternatingItemStyle===null)
1454
-				$alternatingItemStyle=$itemStyle;
1455
-			else
1456
-				$alternatingItemStyle->mergeWith($itemStyle);
1481
+			if($alternatingItemStyle===null) {
1482
+							$alternatingItemStyle=$itemStyle;
1483
+			} else {
1484
+							$alternatingItemStyle->mergeWith($itemStyle);
1485
+			}
1457 1486
 		}
1458 1487
 
1459 1488
 		$selectedItemStyle=$this->getViewState('SelectedItemStyle',null);
@@ -1461,10 +1490,11 @@  discard block
 block discarded – undo
1461 1490
 		$editItemStyle=$this->getViewState('EditItemStyle',null);
1462 1491
 		if($selectedItemStyle!==null)
1463 1492
 		{
1464
-			if($editItemStyle===null)
1465
-				$editItemStyle=$selectedItemStyle;
1466
-			else
1467
-				$editItemStyle->mergeWith($selectedItemStyle);
1493
+			if($editItemStyle===null) {
1494
+							$editItemStyle=$selectedItemStyle;
1495
+			} else {
1496
+							$editItemStyle->mergeWith($selectedItemStyle);
1497
+			}
1468 1498
 		}
1469 1499
 
1470 1500
 		$headerStyle=$this->getViewState('HeaderStyle',null);
@@ -1474,61 +1504,73 @@  discard block
 block discarded – undo
1474 1504
 
1475 1505
 		foreach($this->getControls() as $index=>$item)
1476 1506
 		{
1477
-			if(!($item instanceof TDataGridItem) && !($item instanceof TDataGridPager))
1478
-				continue;
1507
+			if(!($item instanceof TDataGridItem) && !($item instanceof TDataGridPager)) {
1508
+							continue;
1509
+			}
1479 1510
 			$itemType=$item->getItemType();
1480 1511
 			switch($itemType)
1481 1512
 			{
1482 1513
 				case TListItemType::Header:
1483
-					if($headerStyle)
1484
-						$item->getStyle()->mergeWith($headerStyle);
1485
-					if(!$this->getShowHeader())
1486
-						$item->setVisible(false);
1514
+					if($headerStyle) {
1515
+											$item->getStyle()->mergeWith($headerStyle);
1516
+					}
1517
+					if(!$this->getShowHeader()) {
1518
+											$item->setVisible(false);
1519
+					}
1487 1520
 					break;
1488 1521
 				case TListItemType::Footer:
1489
-					if($footerStyle)
1490
-						$item->getStyle()->mergeWith($footerStyle);
1491
-					if(!$this->getShowFooter())
1492
-						$item->setVisible(false);
1522
+					if($footerStyle) {
1523
+											$item->getStyle()->mergeWith($footerStyle);
1524
+					}
1525
+					if(!$this->getShowFooter()) {
1526
+											$item->setVisible(false);
1527
+					}
1493 1528
 					break;
1494 1529
 				case TListItemType::Separator:
1495
-					if($separatorStyle)
1496
-						$item->getStyle()->mergeWith($separatorStyle);
1530
+					if($separatorStyle) {
1531
+											$item->getStyle()->mergeWith($separatorStyle);
1532
+					}
1497 1533
 					break;
1498 1534
 				case TListItemType::Item:
1499
-					if($itemStyle)
1500
-						$item->getStyle()->mergeWith($itemStyle);
1535
+					if($itemStyle) {
1536
+											$item->getStyle()->mergeWith($itemStyle);
1537
+					}
1501 1538
 					break;
1502 1539
 				case TListItemType::AlternatingItem:
1503
-					if($alternatingItemStyle)
1504
-						$item->getStyle()->mergeWith($alternatingItemStyle);
1540
+					if($alternatingItemStyle) {
1541
+											$item->getStyle()->mergeWith($alternatingItemStyle);
1542
+					}
1505 1543
 					break;
1506 1544
 				case TListItemType::SelectedItem:
1507
-					if($selectedItemStyle)
1508
-						$item->getStyle()->mergeWith($selectedItemStyle);
1545
+					if($selectedItemStyle) {
1546
+											$item->getStyle()->mergeWith($selectedItemStyle);
1547
+					}
1509 1548
 					if($index % 2==1)
1510 1549
 					{
1511
-						if($itemStyle)
1512
-							$item->getStyle()->mergeWith($itemStyle);
1513
-					}
1514
-					else
1550
+						if($itemStyle) {
1551
+													$item->getStyle()->mergeWith($itemStyle);
1552
+						}
1553
+					} else
1515 1554
 					{
1516
-						if($alternatingItemStyle)
1517
-							$item->getStyle()->mergeWith($alternatingItemStyle);
1555
+						if($alternatingItemStyle) {
1556
+													$item->getStyle()->mergeWith($alternatingItemStyle);
1557
+						}
1518 1558
 					}
1519 1559
 					break;
1520 1560
 				case TListItemType::EditItem:
1521
-					if($editItemStyle)
1522
-						$item->getStyle()->mergeWith($editItemStyle);
1561
+					if($editItemStyle) {
1562
+											$item->getStyle()->mergeWith($editItemStyle);
1563
+					}
1523 1564
 					if($index % 2==1)
1524 1565
 					{
1525
-						if($itemStyle)
1526
-							$item->getStyle()->mergeWith($itemStyle);
1527
-					}
1528
-					else
1566
+						if($itemStyle) {
1567
+													$item->getStyle()->mergeWith($itemStyle);
1568
+						}
1569
+					} else
1529 1570
 					{
1530
-						if($alternatingItemStyle)
1531
-							$item->getStyle()->mergeWith($alternatingItemStyle);
1571
+						if($alternatingItemStyle) {
1572
+													$item->getStyle()->mergeWith($alternatingItemStyle);
1573
+						}
1532 1574
 					}
1533 1575
 					break;
1534 1576
 				case TListItemType::Pager:
@@ -1537,13 +1579,14 @@  discard block
 block discarded – undo
1537 1579
 						$item->getStyle()->mergeWith($pagerStyle);
1538 1580
 						if($index===0)
1539 1581
 						{
1540
-							if($pagerStyle->getPosition()===TDataGridPagerPosition::Bottom || !$pagerStyle->getVisible())
1541
-								$item->setVisible(false);
1542
-						}
1543
-						else
1582
+							if($pagerStyle->getPosition()===TDataGridPagerPosition::Bottom || !$pagerStyle->getVisible()) {
1583
+															$item->setVisible(false);
1584
+							}
1585
+						} else
1544 1586
 						{
1545
-							if($pagerStyle->getPosition()===TDataGridPagerPosition::Top || !$pagerStyle->getVisible())
1546
-								$item->setVisible(false);
1587
+							if($pagerStyle->getPosition()===TDataGridPagerPosition::Top || !$pagerStyle->getVisible()) {
1588
+															$item->setVisible(false);
1589
+							}
1547 1590
 						}
1548 1591
 					}
1549 1592
 					break;
@@ -1558,18 +1601,20 @@  discard block
 block discarded – undo
1558 1601
 				{
1559 1602
 					$cell=$cells->itemAt($i);
1560 1603
 					$column=$this->_columns->itemAt($i);
1561
-					if(!$column->getVisible())
1562
-						$cell->setVisible(false);
1563
-					else
1604
+					if(!$column->getVisible()) {
1605
+											$cell->setVisible(false);
1606
+					} else
1564 1607
 					{
1565
-						if($itemType===TListItemType::Header)
1566
-							$style=$column->getHeaderStyle(false);
1567
-						else if($itemType===TListItemType::Footer)
1568
-							$style=$column->getFooterStyle(false);
1569
-						else
1570
-							$style=$column->getItemStyle(false);
1571
-						if($style!==null)
1572
-							$cell->getStyle()->mergeWith($style);
1608
+						if($itemType===TListItemType::Header) {
1609
+													$style=$column->getHeaderStyle(false);
1610
+						} else if($itemType===TListItemType::Footer) {
1611
+													$style=$column->getFooterStyle(false);
1612
+						} else {
1613
+													$style=$column->getItemStyle(false);
1614
+						}
1615
+						if($style!==null) {
1616
+													$cell->getStyle()->mergeWith($style);
1617
+						}
1573 1618
 					}
1574 1619
 				}
1575 1620
 			}
@@ -1585,8 +1630,9 @@  discard block
 block discarded – undo
1585 1630
 		parent::renderBeginTag($writer);
1586 1631
 		if(($caption=$this->getCaption())!=='')
1587 1632
 		{
1588
-			if(($align=$this->getCaptionAlign())!==TTableCaptionAlign::NotSet)
1589
-				$writer->addAttribute('align',strtolower($align));
1633
+			if(($align=$this->getCaptionAlign())!==TTableCaptionAlign::NotSet) {
1634
+							$writer->addAttribute('align',strtolower($align));
1635
+			}
1590 1636
 			$writer->renderBeginTag('caption');
1591 1637
 			$writer->write($caption);
1592 1638
 			$writer->renderEndTag();
@@ -1607,13 +1653,13 @@  discard block
 block discarded – undo
1607 1653
 				$control=new TWebControl;
1608 1654
 				$control->setID($this->getClientID());
1609 1655
 				$control->copyBaseAttributes($this);
1610
-				if($this->getHasStyle())
1611
-					$control->getStyle()->copyFrom($this->getStyle());
1656
+				if($this->getHasStyle()) {
1657
+									$control->getStyle()->copyFrom($this->getStyle());
1658
+				}
1612 1659
 				$control->renderBeginTag($writer);
1613 1660
 				$this->renderContents($writer);
1614 1661
 				$control->renderEndTag($writer);
1615
-			}
1616
-			else if($this->getViewState('ItemCount',0)>0)
1662
+			} else if($this->getViewState('ItemCount',0)>0)
1617 1663
 			{
1618 1664
 				$this->applyItemStyles();
1619 1665
 				if($this->_topPager)
@@ -1641,25 +1687,29 @@  discard block
 block discarded – undo
1641 1687
 		if($this->_header && $this->_header->getVisible())
1642 1688
 		{
1643 1689
 			$writer->writeLine();
1644
-			if($style=$this->getViewState('TableHeadStyle',null))
1645
-				$style->addAttributesToRender($writer);
1690
+			if($style=$this->getViewState('TableHeadStyle',null)) {
1691
+							$style->addAttributesToRender($writer);
1692
+			}
1646 1693
 			$writer->renderBeginTag('thead');
1647 1694
 			$this->_header->render($writer);
1648 1695
 			$writer->renderEndTag();
1649 1696
 		}
1650 1697
 		$writer->writeLine();
1651
-		if($style=$this->getViewState('TableBodyStyle',null))
1652
-			$style->addAttributesToRender($writer);
1698
+		if($style=$this->getViewState('TableBodyStyle',null)) {
1699
+					$style->addAttributesToRender($writer);
1700
+		}
1653 1701
 		$writer->renderBeginTag('tbody');
1654
-		foreach($this->getItems() as $item)
1655
-			$item->renderControl($writer);
1702
+		foreach($this->getItems() as $item) {
1703
+					$item->renderControl($writer);
1704
+		}
1656 1705
 		$writer->renderEndTag();
1657 1706
 
1658 1707
 		if($this->_footer && $this->_footer->getVisible())
1659 1708
 		{
1660 1709
 			$writer->writeLine();
1661
-			if($style=$this->getViewState('TableFootStyle',null))
1662
-				$style->addAttributesToRender($writer);
1710
+			if($style=$this->getViewState('TableFootStyle',null)) {
1711
+							$style->addAttributesToRender($writer);
1712
+			}
1663 1713
 			$writer->renderBeginTag('tfoot');
1664 1714
 			$this->_footer->render($writer);
1665 1715
 			$writer->renderEndTag();
@@ -1950,10 +2000,11 @@  discard block
 block discarded – undo
1950 2000
 		$this->_itemIndex=$itemIndex;
1951 2001
 		$this->_dataSourceIndex=$dataSourceIndex;
1952 2002
 		$this->setItemType($itemType);
1953
-		if($itemType===TListItemType::Header)
1954
-			$this->setTableSection(TTableRowSection::Header);
1955
-		else if($itemType===TListItemType::Footer)
1956
-			$this->setTableSection(TTableRowSection::Footer);
2003
+		if($itemType===TListItemType::Header) {
2004
+					$this->setTableSection(TTableRowSection::Header);
2005
+		} else if($itemType===TListItemType::Footer) {
2006
+					$this->setTableSection(TTableRowSection::Footer);
2007
+		}
1957 2008
 	}
1958 2009
 
1959 2010
 	/**
@@ -2039,9 +2090,9 @@  discard block
 block discarded – undo
2039 2090
 		{
2040 2091
 			$this->raiseBubbleEvent($this,new TDataGridCommandEventParameter($this,$sender,$param));
2041 2092
 			return true;
2093
+		} else {
2094
+					return false;
2042 2095
 		}
2043
-		else
2044
-			return false;
2045 2096
 	}
2046 2097
 }
2047 2098
 
@@ -2081,9 +2132,9 @@  discard block
 block discarded – undo
2081 2132
 		{
2082 2133
 			$this->raiseBubbleEvent($this,new TDataGridCommandEventParameter($this,$sender,$param));
2083 2134
 			return true;
2135
+		} else {
2136
+					return false;
2084 2137
 		}
2085
-		else
2086
-			return false;
2087 2138
 	}
2088 2139
 
2089 2140
 	/**
@@ -2124,10 +2175,11 @@  discard block
 block discarded – undo
2124 2175
 	 */
2125 2176
 	public function insertAt($index,$item)
2126 2177
 	{
2127
-		if($item instanceof TDataGridItem)
2128
-			parent::insertAt($index,$item);
2129
-		else
2130
-			throw new TInvalidDataTypeException('datagriditemcollection_datagriditem_required');
2178
+		if($item instanceof TDataGridItem) {
2179
+					parent::insertAt($index,$item);
2180
+		} else {
2181
+					throw new TInvalidDataTypeException('datagriditemcollection_datagriditem_required');
2182
+		}
2131 2183
 	}
2132 2184
 }
2133 2185
 
@@ -2178,9 +2230,9 @@  discard block
 block discarded – undo
2178 2230
 		{
2179 2231
 			$item->setOwner($this->_o);
2180 2232
 			parent::insertAt($index,$item);
2233
+		} else {
2234
+					throw new TInvalidDataTypeException('datagridcolumncollection_datagridcolumn_required');
2181 2235
 		}
2182
-		else
2183
-			throw new TInvalidDataTypeException('datagridcolumncollection_datagridcolumn_required');
2184 2236
 	}
2185 2237
 }
2186 2238
 
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TDataGridColumn.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -281,6 +281,7 @@  discard block
 block discarded – undo
281 281
 	 *
282 282
 	 * @param string the name of the viewstate value to be returned
283 283
 	 * @param mixed the default value. If $key is not found in viewstate, $defaultValue will be returned
284
+	 * @param string $key
284 285
 	 * @return mixed the viewstate value corresponding to $key
285 286
 	 */
286 287
 	protected function getViewState($key,$defaultValue=null)
@@ -295,6 +296,7 @@  discard block
 block discarded – undo
295 296
 	 * @param string the name of the viewstate value
296 297
 	 * @param mixed the viewstate value to be set
297 298
 	 * @param mixed default value. If $value===$defaultValue, the item will be cleared from the viewstate.
299
+	 * @param string $key
298 300
 	 */
299 301
 	protected function setViewState($key,$value,$defaultValue=null)
300 302
 	{
@@ -356,6 +358,7 @@  discard block
 block discarded – undo
356 358
 	 * If the data is a component, the field is used as the name of a property.
357 359
 	 * @param mixed data containing the field of value
358 360
 	 * @param string the data field
361
+	 * @param string $field
359 362
 	 * @return mixed data value at the specified field
360 363
 	 * @throws TInvalidDataValueException if the data or the field is invalid.
361 364
 	 */
@@ -515,6 +518,7 @@  discard block
 block discarded – undo
515 518
 	 * as the first and second parameters in {@link sprintf}.
516 519
 	 * @param string format string
517 520
 	 * @param mixed the data to be formatted
521
+	 * @param string $formatString
518 522
 	 * @return string the formatted result
519 523
 	 */
520 524
 	protected function formatDataValue($formatString,$value)
Please login to merge, or discard this patch.
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
  */
63 63
 abstract class TDataGridColumn extends TApplicationComponent
64 64
 {
65
-	private $_id='';
66
-	private $_owner=null;
67
-	private $_viewState=array();
65
+	private $_id = '';
66
+	private $_owner = null;
67
+	private $_viewState = array();
68 68
 
69 69
 	/**
70 70
 	 * @return string the ID of the column.
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
 	 */
84 84
 	public function setID($value)
85 85
 	{
86
-		if(!preg_match(TControl::ID_FORMAT,$value))
87
-			throw new TInvalidDataValueException('datagridcolumn_id_invalid',get_class($this),$value);
88
-		$this->_id=$value;
86
+		if (!preg_match(TControl::ID_FORMAT, $value))
87
+			throw new TInvalidDataValueException('datagridcolumn_id_invalid', get_class($this), $value);
88
+		$this->_id = $value;
89 89
 	}
90 90
 
91 91
 	/**
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 */
94 94
 	public function getHeaderText()
95 95
 	{
96
-		return $this->getViewState('HeaderText','');
96
+		return $this->getViewState('HeaderText', '');
97 97
 	}
98 98
 
99 99
 	/**
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
 	public function setHeaderText($value)
103 103
 	{
104
-		$this->setViewState('HeaderText',$value,'');
104
+		$this->setViewState('HeaderText', $value, '');
105 105
 	}
106 106
 
107 107
 	/**
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function getHeaderImageUrl()
111 111
 	{
112
-		return $this->getViewState('HeaderImageUrl','');
112
+		return $this->getViewState('HeaderImageUrl', '');
113 113
 	}
114 114
 
115 115
 	/**
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public function setHeaderImageUrl($value)
119 119
 	{
120
-		$this->setViewState('HeaderImageUrl',$value,'');
120
+		$this->setViewState('HeaderImageUrl', $value, '');
121 121
 	}
122 122
 
123 123
 	/**
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	public function getHeaderRenderer()
128 128
 	{
129
-		return $this->getViewState('HeaderRenderer','');
129
+		return $this->getViewState('HeaderRenderer', '');
130 130
 	}
131 131
 
132 132
 	/**
@@ -141,19 +141,19 @@  discard block
 block discarded – undo
141 141
 	 */
142 142
 	public function setHeaderRenderer($value)
143 143
 	{
144
-		$this->setViewState('HeaderRenderer',$value,'');
144
+		$this->setViewState('HeaderRenderer', $value, '');
145 145
 	}
146 146
 
147 147
 	/**
148 148
 	 * @param boolean whether to create a style if previously not existing
149 149
 	 * @return TTableItemStyle the style for header
150 150
 	 */
151
-	public function getHeaderStyle($createStyle=true)
151
+	public function getHeaderStyle($createStyle = true)
152 152
 	{
153
-		if(($style=$this->getViewState('HeaderStyle',null))===null && $createStyle)
153
+		if (($style = $this->getViewState('HeaderStyle', null)) === null && $createStyle)
154 154
 		{
155
-			$style=new TTableItemStyle;
156
-			$this->setViewState('HeaderStyle',$style,null);
155
+			$style = new TTableItemStyle;
156
+			$this->setViewState('HeaderStyle', $style, null);
157 157
 		}
158 158
 		return $style;
159 159
 	}
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 */
164 164
 	public function getFooterText()
165 165
 	{
166
-		return $this->getViewState('FooterText','');
166
+		return $this->getViewState('FooterText', '');
167 167
 	}
168 168
 
169 169
 	/**
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	 */
172 172
 	public function setFooterText($value)
173 173
 	{
174
-		$this->setViewState('FooterText',$value,'');
174
+		$this->setViewState('FooterText', $value, '');
175 175
 	}
176 176
 
177 177
 	/**
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	 */
181 181
 	public function getFooterRenderer()
182 182
 	{
183
-		return $this->getViewState('FooterRenderer','');
183
+		return $this->getViewState('FooterRenderer', '');
184 184
 	}
185 185
 
186 186
 	/**
@@ -195,19 +195,19 @@  discard block
 block discarded – undo
195 195
 	 */
196 196
 	public function setFooterRenderer($value)
197 197
 	{
198
-		$this->setViewState('FooterRenderer',$value,'');
198
+		$this->setViewState('FooterRenderer', $value, '');
199 199
 	}
200 200
 
201 201
 	/**
202 202
 	 * @param boolean whether to create a style if previously not existing
203 203
 	 * @return TTableItemStyle the style for footer
204 204
 	 */
205
-	public function getFooterStyle($createStyle=true)
205
+	public function getFooterStyle($createStyle = true)
206 206
 	{
207
-		if(($style=$this->getViewState('FooterStyle',null))===null && $createStyle)
207
+		if (($style = $this->getViewState('FooterStyle', null)) === null && $createStyle)
208 208
 		{
209
-			$style=new TTableItemStyle;
210
-			$this->setViewState('FooterStyle',$style,null);
209
+			$style = new TTableItemStyle;
210
+			$this->setViewState('FooterStyle', $style, null);
211 211
 		}
212 212
 		return $style;
213 213
 	}
@@ -216,12 +216,12 @@  discard block
 block discarded – undo
216 216
 	 * @param boolean whether to create a style if previously not existing
217 217
 	 * @return TTableItemStyle the style for item
218 218
 	 */
219
-	public function getItemStyle($createStyle=true)
219
+	public function getItemStyle($createStyle = true)
220 220
 	{
221
-		if(($style=$this->getViewState('ItemStyle',null))===null && $createStyle)
221
+		if (($style = $this->getViewState('ItemStyle', null)) === null && $createStyle)
222 222
 		{
223
-			$style=new TTableItemStyle;
224
-			$this->setViewState('ItemStyle',$style,null);
223
+			$style = new TTableItemStyle;
224
+			$this->setViewState('ItemStyle', $style, null);
225 225
 		}
226 226
 		return $style;
227 227
 	}
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	 */
232 232
 	public function getSortExpression()
233 233
 	{
234
-		return $this->getViewState('SortExpression','');
234
+		return $this->getViewState('SortExpression', '');
235 235
 	}
236 236
 
237 237
 	/**
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	 */
240 240
 	public function setSortExpression($value)
241 241
 	{
242
-		$this->setViewState('SortExpression',$value,'');
242
+		$this->setViewState('SortExpression', $value, '');
243 243
 	}
244 244
 
245 245
 	/**
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 	 */
249 249
 	public function getEnableCellGrouping()
250 250
 	{
251
-		return $this->getViewState('EnableCellGrouping',false);
251
+		return $this->getViewState('EnableCellGrouping', false);
252 252
 	}
253 253
 
254 254
 	/**
@@ -257,15 +257,15 @@  discard block
 block discarded – undo
257 257
 	 */
258 258
 	public function setEnableCellGrouping($value)
259 259
 	{
260
-		$this->setViewState('EnableCellGrouping',TPropertyValue::ensureBoolean($value),false);
260
+		$this->setViewState('EnableCellGrouping', TPropertyValue::ensureBoolean($value), false);
261 261
 	}
262 262
 
263 263
 	/**
264 264
 	 * @return boolean whether the column is visible. Defaults to true.
265 265
 	 */
266
-	public function getVisible($checkParents=true)
266
+	public function getVisible($checkParents = true)
267 267
 	{
268
-		return $this->getViewState('Visible',true);
268
+		return $this->getViewState('Visible', true);
269 269
 	}
270 270
 
271 271
 	/**
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 */
274 274
 	public function setVisible($value)
275 275
 	{
276
-		$this->setViewState('Visible',TPropertyValue::ensureBoolean($value),true);
276
+		$this->setViewState('Visible', TPropertyValue::ensureBoolean($value), true);
277 277
 	}
278 278
 
279 279
 	/**
@@ -283,9 +283,9 @@  discard block
 block discarded – undo
283 283
 	 * @param mixed the default value. If $key is not found in viewstate, $defaultValue will be returned
284 284
 	 * @return mixed the viewstate value corresponding to $key
285 285
 	 */
286
-	protected function getViewState($key,$defaultValue=null)
286
+	protected function getViewState($key, $defaultValue = null)
287 287
 	{
288
-		return isset($this->_viewState[$key])?$this->_viewState[$key]:$defaultValue;
288
+		return isset($this->_viewState[$key]) ? $this->_viewState[$key] : $defaultValue;
289 289
 	}
290 290
 
291 291
 	/**
@@ -296,12 +296,12 @@  discard block
 block discarded – undo
296 296
 	 * @param mixed the viewstate value to be set
297 297
 	 * @param mixed default value. If $value===$defaultValue, the item will be cleared from the viewstate.
298 298
 	 */
299
-	protected function setViewState($key,$value,$defaultValue=null)
299
+	protected function setViewState($key, $value, $defaultValue = null)
300 300
 	{
301
-		if($value===$defaultValue)
301
+		if ($value === $defaultValue)
302 302
 			unset($this->_viewState[$key]);
303 303
 		else
304
-			$this->_viewState[$key]=$value;
304
+			$this->_viewState[$key] = $value;
305 305
 	}
306 306
 
307 307
 	/**
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 	 */
311 311
 	public function loadState($state)
312 312
 	{
313
-		$this->_viewState=$state;
313
+		$this->_viewState = $state;
314 314
 	}
315 315
 
316 316
 	/**
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 	 */
336 336
 	public function setOwner(TDataGrid $value)
337 337
 	{
338
-		$this->_owner=$value;
338
+		$this->_owner = $value;
339 339
 	}
340 340
 
341 341
 	/**
@@ -359,9 +359,9 @@  discard block
 block discarded – undo
359 359
 	 * @return mixed data value at the specified field
360 360
 	 * @throws TInvalidDataValueException if the data or the field is invalid.
361 361
 	 */
362
-	protected function getDataFieldValue($data,$field)
362
+	protected function getDataFieldValue($data, $field)
363 363
 	{
364
-		return TDataFieldAccessor::getDataFieldValue($data,$field);
364
+		return TDataFieldAccessor::getDataFieldValue($data, $field);
365 365
 	}
366 366
 
367 367
 
@@ -376,12 +376,12 @@  discard block
 block discarded – undo
376 376
 	 * @param integer the index to the Columns property that the cell resides in.
377 377
 	 * @param string the type of cell (Header,Footer,Item,AlternatingItem,EditItem,SelectedItem)
378 378
 	 */
379
-	public function initializeCell($cell,$columnIndex,$itemType)
379
+	public function initializeCell($cell, $columnIndex, $itemType)
380 380
 	{
381
-		if($itemType===TListItemType::Header)
382
-			$this->initializeHeaderCell($cell,$columnIndex);
383
-		else if($itemType===TListItemType::Footer)
384
-			$this->initializeFooterCell($cell,$columnIndex);
381
+		if ($itemType === TListItemType::Header)
382
+			$this->initializeHeaderCell($cell, $columnIndex);
383
+		else if ($itemType === TListItemType::Footer)
384
+			$this->initializeFooterCell($cell, $columnIndex);
385 385
 	}
386 386
 
387 387
 	/**
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 	 */
393 393
 	public function getAllowSorting()
394 394
 	{
395
-		return $this->getSortExpression()!=='' && (!$this->_owner || $this->_owner->getAllowSorting());
395
+		return $this->getSortExpression() !== '' && (!$this->_owner || $this->_owner->getAllowSorting());
396 396
 	}
397 397
 
398 398
 	/**
@@ -409,42 +409,42 @@  discard block
 block discarded – undo
409 409
 	 * @param TTableCell the cell to be initialized
410 410
 	 * @param integer the index to the Columns property that the cell resides in.
411 411
 	 */
412
-	protected function initializeHeaderCell($cell,$columnIndex)
412
+	protected function initializeHeaderCell($cell, $columnIndex)
413 413
 	{
414
-		$text=$this->getHeaderText();
414
+		$text = $this->getHeaderText();
415 415
 
416
-		if(($classPath=$this->getHeaderRenderer())!=='')
416
+		if (($classPath = $this->getHeaderRenderer()) !== '')
417 417
 		{
418
-			$control=Prado::createComponent($classPath);
418
+			$control = Prado::createComponent($classPath);
419 419
 			$cell->getControls()->add($control);
420
-			if($control instanceof IDataRenderer)
420
+			if ($control instanceof IDataRenderer)
421 421
 			{
422
-				if($control instanceof IItemDataRenderer)
422
+				if ($control instanceof IItemDataRenderer)
423 423
 				{
424
-					$item=$cell->getParent();
424
+					$item = $cell->getParent();
425 425
 					$control->setItemIndex($item->getItemIndex());
426 426
 					$control->setItemType($item->getItemType());
427 427
 				}
428 428
 				$control->setData($text);
429 429
 			}
430 430
 		}
431
-		else if($this->getAllowSorting())
431
+		else if ($this->getAllowSorting())
432 432
 		{
433
-			$sortExpression=$this->getSortExpression();
434
-			if(($url=$this->getHeaderImageUrl())!=='')
433
+			$sortExpression = $this->getSortExpression();
434
+			if (($url = $this->getHeaderImageUrl()) !== '')
435 435
 			{
436
-				$button=Prado::createComponent('System.Web.UI.WebControls.TImageButton');
436
+				$button = Prado::createComponent('System.Web.UI.WebControls.TImageButton');
437 437
 				$button->setImageUrl($url);
438 438
 				$button->setCommandName(TDataGrid::CMD_SORT);
439 439
 				$button->setCommandParameter($sortExpression);
440
-				if($text!=='')
440
+				if ($text !== '')
441 441
 					$button->setAlternateText($text);
442 442
 				$button->setCausesValidation(false);
443 443
 				$cell->getControls()->add($button);
444 444
 			}
445
-			else if($text!=='')
445
+			else if ($text !== '')
446 446
 			{
447
-				$button=Prado::createComponent('System.Web.UI.WebControls.TLinkButton');
447
+				$button = Prado::createComponent('System.Web.UI.WebControls.TLinkButton');
448 448
 				$button->setText($text);
449 449
 				$button->setCommandName(TDataGrid::CMD_SORT);
450 450
 				$button->setCommandParameter($sortExpression);
@@ -456,15 +456,15 @@  discard block
 block discarded – undo
456 456
 		}
457 457
 		else
458 458
 		{
459
-			if(($url=$this->getHeaderImageUrl())!=='')
459
+			if (($url = $this->getHeaderImageUrl()) !== '')
460 460
 			{
461
-				$image=Prado::createComponent('System.Web.UI.WebControls.TImage');
461
+				$image = Prado::createComponent('System.Web.UI.WebControls.TImage');
462 462
 				$image->setImageUrl($url);
463
-				if($text!=='')
463
+				if ($text !== '')
464 464
 					$image->setAlternateText($text);
465 465
 				$cell->getControls()->add($image);
466 466
 			}
467
-			else if($text!=='')
467
+			else if ($text !== '')
468 468
 				$cell->setText($text);
469 469
 			else
470 470
 				$cell->setText('&nbsp;');
@@ -481,25 +481,25 @@  discard block
 block discarded – undo
481 481
 	 * @param TTableCell the cell to be initialized
482 482
 	 * @param integer the index to the Columns property that the cell resides in.
483 483
 	 */
484
-	protected function initializeFooterCell($cell,$columnIndex)
484
+	protected function initializeFooterCell($cell, $columnIndex)
485 485
 	{
486
-		$text=$this->getFooterText();
487
-		if(($classPath=$this->getFooterRenderer())!=='')
486
+		$text = $this->getFooterText();
487
+		if (($classPath = $this->getFooterRenderer()) !== '')
488 488
 		{
489
-			$control=Prado::createComponent($classPath);
489
+			$control = Prado::createComponent($classPath);
490 490
 			$cell->getControls()->add($control);
491
-			if($control instanceof IDataRenderer)
491
+			if ($control instanceof IDataRenderer)
492 492
 			{
493
-				if($control instanceof IItemDataRenderer)
493
+				if ($control instanceof IItemDataRenderer)
494 494
 				{
495
-					$item=$cell->getParent();
495
+					$item = $cell->getParent();
496 496
 					$control->setItemIndex($item->getItemIndex());
497 497
 					$control->setItemType($item->getItemType());
498 498
 				}
499 499
 				$control->setData($text);
500 500
 			}
501 501
 		}
502
-		else if($text!=='')
502
+		else if ($text !== '')
503 503
 			$cell->setText($text);
504 504
 		else
505 505
 			$cell->setText('&nbsp;');
@@ -517,26 +517,26 @@  discard block
 block discarded – undo
517 517
 	 * @param mixed the data to be formatted
518 518
 	 * @return string the formatted result
519 519
 	 */
520
-	protected function formatDataValue($formatString,$value)
520
+	protected function formatDataValue($formatString, $value)
521 521
 	{
522
-		if($formatString==='')
522
+		if ($formatString === '')
523 523
 			return TPropertyValue::ensureString($value);
524
-		else if($formatString[0]==='#')
524
+		else if ($formatString[0] === '#')
525 525
 		{
526
-			$expression=strtr(substr($formatString,1),array('{0}'=>'$value'));
526
+			$expression = strtr(substr($formatString, 1), array('{0}'=>'$value'));
527 527
 			try
528 528
 			{
529
-				if(eval("\$result=$expression;")===false)
529
+				if (eval("\$result=$expression;") === false)
530 530
 					throw new Exception('');
531 531
 				return $result;
532 532
 			}
533
-			catch(Exception $e)
533
+			catch (Exception $e)
534 534
 			{
535
-				throw new TInvalidDataValueException('datagridcolumn_expression_invalid',get_class($this),$expression,$e->getMessage());
535
+				throw new TInvalidDataValueException('datagridcolumn_expression_invalid', get_class($this), $expression, $e->getMessage());
536 536
 			}
537 537
 		}
538 538
 		else
539
-			return sprintf($formatString,$value);
539
+			return sprintf($formatString, $value);
540 540
 	}
541 541
 }
542 542
 
@@ -557,8 +557,8 @@  discard block
 block discarded – undo
557 557
  */
558 558
 class TButtonColumnType extends TEnumerable
559 559
 {
560
-	const LinkButton='LinkButton';
561
-	const PushButton='PushButton';
562
-	const ImageButton='ImageButton';
560
+	const LinkButton = 'LinkButton';
561
+	const PushButton = 'PushButton';
562
+	const ImageButton = 'ImageButton';
563 563
 }
564 564
 
Please login to merge, or discard this patch.
Braces   +41 added lines, -39 removed lines patch added patch discarded remove patch
@@ -83,8 +83,9 @@  discard block
 block discarded – undo
83 83
 	 */
84 84
 	public function setID($value)
85 85
 	{
86
-		if(!preg_match(TControl::ID_FORMAT,$value))
87
-			throw new TInvalidDataValueException('datagridcolumn_id_invalid',get_class($this),$value);
86
+		if(!preg_match(TControl::ID_FORMAT,$value)) {
87
+					throw new TInvalidDataValueException('datagridcolumn_id_invalid',get_class($this),$value);
88
+		}
88 89
 		$this->_id=$value;
89 90
 	}
90 91
 
@@ -298,10 +299,11 @@  discard block
 block discarded – undo
298 299
 	 */
299 300
 	protected function setViewState($key,$value,$defaultValue=null)
300 301
 	{
301
-		if($value===$defaultValue)
302
-			unset($this->_viewState[$key]);
303
-		else
304
-			$this->_viewState[$key]=$value;
302
+		if($value===$defaultValue) {
303
+					unset($this->_viewState[$key]);
304
+		} else {
305
+					$this->_viewState[$key]=$value;
306
+		}
305 307
 	}
306 308
 
307 309
 	/**
@@ -378,10 +380,11 @@  discard block
 block discarded – undo
378 380
 	 */
379 381
 	public function initializeCell($cell,$columnIndex,$itemType)
380 382
 	{
381
-		if($itemType===TListItemType::Header)
382
-			$this->initializeHeaderCell($cell,$columnIndex);
383
-		else if($itemType===TListItemType::Footer)
384
-			$this->initializeFooterCell($cell,$columnIndex);
383
+		if($itemType===TListItemType::Header) {
384
+					$this->initializeHeaderCell($cell,$columnIndex);
385
+		} else if($itemType===TListItemType::Footer) {
386
+					$this->initializeFooterCell($cell,$columnIndex);
387
+		}
385 388
 	}
386 389
 
387 390
 	/**
@@ -427,8 +430,7 @@  discard block
 block discarded – undo
427 430
 				}
428 431
 				$control->setData($text);
429 432
 			}
430
-		}
431
-		else if($this->getAllowSorting())
433
+		} else if($this->getAllowSorting())
432 434
 		{
433 435
 			$sortExpression=$this->getSortExpression();
434 436
 			if(($url=$this->getHeaderImageUrl())!=='')
@@ -437,12 +439,12 @@  discard block
 block discarded – undo
437 439
 				$button->setImageUrl($url);
438 440
 				$button->setCommandName(TDataGrid::CMD_SORT);
439 441
 				$button->setCommandParameter($sortExpression);
440
-				if($text!=='')
441
-					$button->setAlternateText($text);
442
+				if($text!=='') {
443
+									$button->setAlternateText($text);
444
+				}
442 445
 				$button->setCausesValidation(false);
443 446
 				$cell->getControls()->add($button);
444
-			}
445
-			else if($text!=='')
447
+			} else if($text!=='')
446 448
 			{
447 449
 				$button=Prado::createComponent('System.Web.UI.WebControls.TLinkButton');
448 450
 				$button->setText($text);
@@ -450,24 +452,24 @@  discard block
 block discarded – undo
450 452
 				$button->setCommandParameter($sortExpression);
451 453
 				$button->setCausesValidation(false);
452 454
 				$cell->getControls()->add($button);
455
+			} else {
456
+							$cell->setText('&nbsp;');
453 457
 			}
454
-			else
455
-				$cell->setText('&nbsp;');
456
-		}
457
-		else
458
+		} else
458 459
 		{
459 460
 			if(($url=$this->getHeaderImageUrl())!=='')
460 461
 			{
461 462
 				$image=Prado::createComponent('System.Web.UI.WebControls.TImage');
462 463
 				$image->setImageUrl($url);
463
-				if($text!=='')
464
-					$image->setAlternateText($text);
464
+				if($text!=='') {
465
+									$image->setAlternateText($text);
466
+				}
465 467
 				$cell->getControls()->add($image);
468
+			} else if($text!=='') {
469
+							$cell->setText($text);
470
+			} else {
471
+							$cell->setText('&nbsp;');
466 472
 			}
467
-			else if($text!=='')
468
-				$cell->setText($text);
469
-			else
470
-				$cell->setText('&nbsp;');
471 473
 		}
472 474
 	}
473 475
 
@@ -498,11 +500,11 @@  discard block
 block discarded – undo
498 500
 				}
499 501
 				$control->setData($text);
500 502
 			}
503
+		} else if($text!=='') {
504
+					$cell->setText($text);
505
+		} else {
506
+					$cell->setText('&nbsp;');
501 507
 		}
502
-		else if($text!=='')
503
-			$cell->setText($text);
504
-		else
505
-			$cell->setText('&nbsp;');
506 508
 	}
507 509
 
508 510
 	/**
@@ -519,24 +521,24 @@  discard block
 block discarded – undo
519 521
 	 */
520 522
 	protected function formatDataValue($formatString,$value)
521 523
 	{
522
-		if($formatString==='')
523
-			return TPropertyValue::ensureString($value);
524
-		else if($formatString[0]==='#')
524
+		if($formatString==='') {
525
+					return TPropertyValue::ensureString($value);
526
+		} else if($formatString[0]==='#')
525 527
 		{
526 528
 			$expression=strtr(substr($formatString,1),array('{0}'=>'$value'));
527 529
 			try
528 530
 			{
529
-				if(eval("\$result=$expression;")===false)
530
-					throw new Exception('');
531
+				if(eval("\$result=$expression;")===false) {
532
+									throw new Exception('');
533
+				}
531 534
 				return $result;
532
-			}
533
-			catch(Exception $e)
535
+			} catch(Exception $e)
534 536
 			{
535 537
 				throw new TInvalidDataValueException('datagridcolumn_expression_invalid',get_class($this),$expression,$e->getMessage());
536 538
 			}
539
+		} else {
540
+					return sprintf($formatString,$value);
537 541
 		}
538
-		else
539
-			return sprintf($formatString,$value);
540 542
 	}
541 543
 }
542 544
 
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TDataList.php 3 patches
Doc Comments   +11 added lines patch added patch discarded remove patch
@@ -404,6 +404,7 @@  discard block
 block discarded – undo
404 404
 
405 405
 	/**
406 406
 	 * @param ITemplate the template for item
407
+	 * @param TWizardSideBarListItemTemplate $value
407 408
 	 * @throws TInvalidDataTypeException if the input is not an {@link ITemplate} or not null.
408 409
 	 */
409 410
 	public function setItemTemplate($value)
@@ -959,6 +960,7 @@  discard block
 block discarded – undo
959 960
 	 * If you override this method, be sure to call parent's implementation
960 961
 	 * so that event handlers have chance to respond to the event.
961 962
 	 * @param TDataListItemEventParameter event parameter
963
+	 * @param TDataListItemEventParameter $param
962 964
 	 */
963 965
 	public function onItemCreated($param)
964 966
 	{
@@ -973,6 +975,7 @@  discard block
 block discarded – undo
973 975
 	 * If you override this method, be sure to call parent's implementation
974 976
 	 * so that event handlers have chance to respond to the event.
975 977
 	 * @param TDataListItemEventParameter event parameter
978
+	 * @param TDataListItemEventParameter $param
976 979
 	 */
977 980
 	public function onItemDataBound($param)
978 981
 	{
@@ -984,6 +987,7 @@  discard block
 block discarded – undo
984 987
 	 * This method is invoked when a child control of the data list
985 988
 	 * raises an <b>OnCommand</b> event.
986 989
 	 * @param TDataListCommandEventParameter event parameter
990
+	 * @param TDataListCommandEventParameter $param
987 991
 	 */
988 992
 	public function onItemCommand($param)
989 993
 	{
@@ -995,6 +999,7 @@  discard block
 block discarded – undo
995 999
 	 * This method is invoked when a child control of the data list
996 1000
 	 * raises an <b>OnCommand</b> event and the command name is 'edit' (case-insensitive).
997 1001
 	 * @param TDataListCommandEventParameter event parameter
1002
+	 * @param TDataListCommandEventParameter $param
998 1003
 	 */
999 1004
 	public function onEditCommand($param)
1000 1005
 	{
@@ -1006,6 +1011,7 @@  discard block
 block discarded – undo
1006 1011
 	 * This method is invoked when a child control of the data list
1007 1012
 	 * raises an <b>OnCommand</b> event and the command name is 'delete' (case-insensitive).
1008 1013
 	 * @param TDataListCommandEventParameter event parameter
1014
+	 * @param TDataListCommandEventParameter $param
1009 1015
 	 */
1010 1016
 	public function onDeleteCommand($param)
1011 1017
 	{
@@ -1017,6 +1023,7 @@  discard block
 block discarded – undo
1017 1023
 	 * This method is invoked when a child control of the data list
1018 1024
 	 * raises an <b>OnCommand</b> event and the command name is 'update' (case-insensitive).
1019 1025
 	 * @param TDataListCommandEventParameter event parameter
1026
+	 * @param TDataListCommandEventParameter $param
1020 1027
 	 */
1021 1028
 	public function onUpdateCommand($param)
1022 1029
 	{
@@ -1028,6 +1035,7 @@  discard block
 block discarded – undo
1028 1035
 	 * This method is invoked when a child control of the data list
1029 1036
 	 * raises an <b>OnCommand</b> event and the command name is 'cancel' (case-insensitive).
1030 1037
 	 * @param TDataListCommandEventParameter event parameter
1038
+	 * @param TDataListCommandEventParameter $param
1031 1039
 	 */
1032 1040
 	public function onCancelCommand($param)
1033 1041
 	{
@@ -1131,6 +1139,7 @@  discard block
 block discarded – undo
1131 1139
 	 * This method invokes {@link createItem} to create a new datalist item.
1132 1140
 	 * @param integer zero-based item index.
1133 1141
 	 * @param TListItemType item type
1142
+	 * @param integer $itemIndex
1134 1143
 	 * @return TControl the created item, null if item is not created
1135 1144
 	 */
1136 1145
 	private function createItemInternal($itemIndex,$itemType)
@@ -1152,6 +1161,7 @@  discard block
 block discarded – undo
1152 1161
 	 * @param integer zero-based item index.
1153 1162
 	 * @param TListItemType item type
1154 1163
 	 * @param mixed data to be associated with the item
1164
+	 * @param integer $itemIndex
1155 1165
 	 * @return TControl the created item, null if item is not created
1156 1166
 	 */
1157 1167
 	private function createItemWithDataInternal($itemIndex,$itemType,$dataItem)
@@ -1511,6 +1521,7 @@  discard block
 block discarded – undo
1511 1521
 	/**
1512 1522
 	 * Constructor.
1513 1523
 	 * @param TControl DataList item related with the corresponding event
1524
+	 * @param TControl $item
1514 1525
 	 */
1515 1526
 	public function __construct($item)
1516 1527
 	{
Please login to merge, or discard this patch.
Spacing   +289 added lines, -289 removed lines patch added patch discarded remove patch
@@ -153,43 +153,43 @@  discard block
 block discarded – undo
153 153
 	/**
154 154
 	 * Command name that TDataList understands. They are case-insensitive.
155 155
 	 */
156
-	const CMD_SELECT='Select';
157
-	const CMD_EDIT='Edit';
158
-	const CMD_UPDATE='Update';
159
-	const CMD_DELETE='Delete';
160
-	const CMD_CANCEL='Cancel';
156
+	const CMD_SELECT = 'Select';
157
+	const CMD_EDIT = 'Edit';
158
+	const CMD_UPDATE = 'Update';
159
+	const CMD_DELETE = 'Delete';
160
+	const CMD_CANCEL = 'Cancel';
161 161
 
162 162
 	/**
163 163
 	 * @var TDataListItemCollection item list
164 164
 	 */
165
-	private $_items=null;
165
+	private $_items = null;
166 166
 	/**
167 167
 	 * @var Itemplate various item templates
168 168
 	 */
169
-	private $_itemTemplate=null;
170
-	private $_emptyTemplate=null;
171
-	private $_alternatingItemTemplate=null;
172
-	private $_selectedItemTemplate=null;
173
-	private $_editItemTemplate=null;
174
-	private $_headerTemplate=null;
175
-	private $_footerTemplate=null;
176
-	private $_separatorTemplate=null;
169
+	private $_itemTemplate = null;
170
+	private $_emptyTemplate = null;
171
+	private $_alternatingItemTemplate = null;
172
+	private $_selectedItemTemplate = null;
173
+	private $_editItemTemplate = null;
174
+	private $_headerTemplate = null;
175
+	private $_footerTemplate = null;
176
+	private $_separatorTemplate = null;
177 177
 	/**
178 178
 	 * @var TControl header item
179 179
 	 */
180
-	private $_header=null;
180
+	private $_header = null;
181 181
 	/**
182 182
 	 * @var TControl footer item
183 183
 	 */
184
-	private $_footer=null;
184
+	private $_footer = null;
185 185
 
186 186
 	/**
187 187
 	 * @return TDataListItemCollection item list
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
 		return $this->_items;
194 194
 	}
195 195
 
@@ -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
 	/**
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	 */
208 208
 	public function getItemRenderer()
209 209
 	{
210
-		return $this->getViewState('ItemRenderer','');
210
+		return $this->getViewState('ItemRenderer', '');
211 211
 	}
212 212
 
213 213
 	/**
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 */
223 223
 	public function setItemRenderer($value)
224 224
 	{
225
-		$this->setViewState('ItemRenderer',$value,'');
225
+		$this->setViewState('ItemRenderer', $value, '');
226 226
 	}
227 227
 
228 228
 	/**
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	 */
232 232
 	public function getAlternatingItemRenderer()
233 233
 	{
234
-		return $this->getViewState('AlternatingItemRenderer','');
234
+		return $this->getViewState('AlternatingItemRenderer', '');
235 235
 	}
236 236
 
237 237
 	/**
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	 */
247 247
 	public function setAlternatingItemRenderer($value)
248 248
 	{
249
-		$this->setViewState('AlternatingItemRenderer',$value,'');
249
+		$this->setViewState('AlternatingItemRenderer', $value, '');
250 250
 	}
251 251
 
252 252
 	/**
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 	 */
256 256
 	public function getEditItemRenderer()
257 257
 	{
258
-		return $this->getViewState('EditItemRenderer','');
258
+		return $this->getViewState('EditItemRenderer', '');
259 259
 	}
260 260
 
261 261
 	/**
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	 */
271 271
 	public function setEditItemRenderer($value)
272 272
 	{
273
-		$this->setViewState('EditItemRenderer',$value,'');
273
+		$this->setViewState('EditItemRenderer', $value, '');
274 274
 	}
275 275
 
276 276
 	/**
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	 */
280 280
 	public function getSelectedItemRenderer()
281 281
 	{
282
-		return $this->getViewState('SelectedItemRenderer','');
282
+		return $this->getViewState('SelectedItemRenderer', '');
283 283
 	}
284 284
 
285 285
 	/**
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 	 */
295 295
 	public function setSelectedItemRenderer($value)
296 296
 	{
297
-		$this->setViewState('SelectedItemRenderer',$value,'');
297
+		$this->setViewState('SelectedItemRenderer', $value, '');
298 298
 	}
299 299
 
300 300
 	/**
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 	 */
304 304
 	public function getSeparatorRenderer()
305 305
 	{
306
-		return $this->getViewState('SeparatorRenderer','');
306
+		return $this->getViewState('SeparatorRenderer', '');
307 307
 	}
308 308
 
309 309
 	/**
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 	 */
319 319
 	public function setSeparatorRenderer($value)
320 320
 	{
321
-		$this->setViewState('SeparatorRenderer',$value,'');
321
+		$this->setViewState('SeparatorRenderer', $value, '');
322 322
 	}
323 323
 
324 324
 	/**
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 	 */
328 328
 	public function getHeaderRenderer()
329 329
 	{
330
-		return $this->getViewState('HeaderRenderer','');
330
+		return $this->getViewState('HeaderRenderer', '');
331 331
 	}
332 332
 
333 333
 	/**
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 	 */
343 343
 	public function setHeaderRenderer($value)
344 344
 	{
345
-		$this->setViewState('HeaderRenderer',$value,'');
345
+		$this->setViewState('HeaderRenderer', $value, '');
346 346
 	}
347 347
 
348 348
 	/**
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 	 */
352 352
 	public function getFooterRenderer()
353 353
 	{
354
-		return $this->getViewState('FooterRenderer','');
354
+		return $this->getViewState('FooterRenderer', '');
355 355
 	}
356 356
 
357 357
 	/**
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 	 */
367 367
 	public function setFooterRenderer($value)
368 368
 	{
369
-		$this->setViewState('FooterRenderer',$value,'');
369
+		$this->setViewState('FooterRenderer', $value, '');
370 370
 	}
371 371
 
372 372
 	/**
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 	 */
376 376
 	public function getEmptyRenderer()
377 377
 	{
378
-		return $this->getViewState('EmptyRenderer','');
378
+		return $this->getViewState('EmptyRenderer', '');
379 379
 	}
380 380
 
381 381
 	/**
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 	 */
392 392
 	public function setEmptyRenderer($value)
393 393
 	{
394
-		$this->setViewState('EmptyRenderer',$value,'');
394
+		$this->setViewState('EmptyRenderer', $value, '');
395 395
 	}
396 396
 
397 397
 	/**
@@ -408,10 +408,10 @@  discard block
 block discarded – undo
408 408
 	 */
409 409
 	public function setItemTemplate($value)
410 410
 	{
411
-		if($value instanceof ITemplate || $value===null)
412
-			$this->_itemTemplate=$value;
411
+		if ($value instanceof ITemplate || $value === null)
412
+			$this->_itemTemplate = $value;
413 413
 		else
414
-			throw new TInvalidDataTypeException('datalist_template_required','ItemTemplate');
414
+			throw new TInvalidDataTypeException('datalist_template_required', 'ItemTemplate');
415 415
 	}
416 416
 
417 417
 	/**
@@ -419,10 +419,10 @@  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
-			$style=new TTableItemStyle;
425
-			$this->setViewState('ItemStyle',$style,null);
424
+			$style = new TTableItemStyle;
425
+			$this->setViewState('ItemStyle', $style, null);
426 426
 		}
427 427
 		return $style;
428 428
 	}
@@ -441,10 +441,10 @@  discard block
 block discarded – undo
441 441
 	 */
442 442
 	public function setAlternatingItemTemplate($value)
443 443
 	{
444
-		if($value instanceof ITemplate || $value===null)
445
-			$this->_alternatingItemTemplate=$value;
444
+		if ($value instanceof ITemplate || $value === null)
445
+			$this->_alternatingItemTemplate = $value;
446 446
 		else
447
-			throw new TInvalidDataTypeException('datalist_template_required','AlternatingItemType');
447
+			throw new TInvalidDataTypeException('datalist_template_required', 'AlternatingItemType');
448 448
 	}
449 449
 
450 450
 	/**
@@ -452,10 +452,10 @@  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
-			$style=new TTableItemStyle;
458
-			$this->setViewState('AlternatingItemStyle',$style,null);
457
+			$style = new TTableItemStyle;
458
+			$this->setViewState('AlternatingItemStyle', $style, null);
459 459
 		}
460 460
 		return $style;
461 461
 	}
@@ -474,10 +474,10 @@  discard block
 block discarded – undo
474 474
 	 */
475 475
 	public function setSelectedItemTemplate($value)
476 476
 	{
477
-		if($value instanceof ITemplate || $value===null)
478
-			$this->_selectedItemTemplate=$value;
477
+		if ($value instanceof ITemplate || $value === null)
478
+			$this->_selectedItemTemplate = $value;
479 479
 		else
480
-			throw new TInvalidDataTypeException('datalist_template_required','SelectedItemTemplate');
480
+			throw new TInvalidDataTypeException('datalist_template_required', 'SelectedItemTemplate');
481 481
 	}
482 482
 
483 483
 	/**
@@ -485,10 +485,10 @@  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
-			$style=new TTableItemStyle;
491
-			$this->setViewState('SelectedItemStyle',$style,null);
490
+			$style = new TTableItemStyle;
491
+			$this->setViewState('SelectedItemStyle', $style, null);
492 492
 		}
493 493
 		return $style;
494 494
 	}
@@ -507,10 +507,10 @@  discard block
 block discarded – undo
507 507
 	 */
508 508
 	public function setEditItemTemplate($value)
509 509
 	{
510
-		if($value instanceof ITemplate || $value===null)
511
-			$this->_editItemTemplate=$value;
510
+		if ($value instanceof ITemplate || $value === null)
511
+			$this->_editItemTemplate = $value;
512 512
 		else
513
-			throw new TInvalidDataTypeException('datalist_template_required','EditItemTemplate');
513
+			throw new TInvalidDataTypeException('datalist_template_required', 'EditItemTemplate');
514 514
 	}
515 515
 
516 516
 	/**
@@ -518,10 +518,10 @@  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
-			$style=new TTableItemStyle;
524
-			$this->setViewState('EditItemStyle',$style,null);
523
+			$style = new TTableItemStyle;
524
+			$this->setViewState('EditItemStyle', $style, null);
525 525
 		}
526 526
 		return $style;
527 527
 	}
@@ -540,10 +540,10 @@  discard block
 block discarded – undo
540 540
 	 */
541 541
 	public function setHeaderTemplate($value)
542 542
 	{
543
-		if($value instanceof ITemplate || $value===null)
544
-			$this->_headerTemplate=$value;
543
+		if ($value instanceof ITemplate || $value === null)
544
+			$this->_headerTemplate = $value;
545 545
 		else
546
-			throw new TInvalidDataTypeException('datalist_template_required','HeaderTemplate');
546
+			throw new TInvalidDataTypeException('datalist_template_required', 'HeaderTemplate');
547 547
 	}
548 548
 
549 549
 	/**
@@ -551,10 +551,10 @@  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
-			$style=new TTableItemStyle;
557
-			$this->setViewState('HeaderStyle',$style,null);
556
+			$style = new TTableItemStyle;
557
+			$this->setViewState('HeaderStyle', $style, null);
558 558
 		}
559 559
 		return $style;
560 560
 	}
@@ -581,10 +581,10 @@  discard block
 block discarded – undo
581 581
 	 */
582 582
 	public function setFooterTemplate($value)
583 583
 	{
584
-		if($value instanceof ITemplate || $value===null)
585
-			$this->_footerTemplate=$value;
584
+		if ($value instanceof ITemplate || $value === null)
585
+			$this->_footerTemplate = $value;
586 586
 		else
587
-			throw new TInvalidDataTypeException('datalist_template_required','FooterTemplate');
587
+			throw new TInvalidDataTypeException('datalist_template_required', 'FooterTemplate');
588 588
 	}
589 589
 
590 590
 	/**
@@ -592,10 +592,10 @@  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
-			$style=new TTableItemStyle;
598
-			$this->setViewState('FooterStyle',$style,null);
597
+			$style = new TTableItemStyle;
598
+			$this->setViewState('FooterStyle', $style, null);
599 599
 		}
600 600
 		return $style;
601 601
 	}
@@ -622,10 +622,10 @@  discard block
 block discarded – undo
622 622
 	 */
623 623
 	public function setEmptyTemplate($value)
624 624
 	{
625
-		if($value instanceof ITemplate || $value===null)
626
-			$this->_emptyTemplate=$value;
625
+		if ($value instanceof ITemplate || $value === null)
626
+			$this->_emptyTemplate = $value;
627 627
 		else
628
-			throw new TInvalidDataTypeException('datalist_template_required','EmptyTemplate');
628
+			throw new TInvalidDataTypeException('datalist_template_required', 'EmptyTemplate');
629 629
 	}
630 630
 
631 631
 	/**
@@ -642,10 +642,10 @@  discard block
 block discarded – undo
642 642
 	 */
643 643
 	public function setSeparatorTemplate($value)
644 644
 	{
645
-		if($value instanceof ITemplate || $value===null)
646
-			$this->_separatorTemplate=$value;
645
+		if ($value instanceof ITemplate || $value === null)
646
+			$this->_separatorTemplate = $value;
647 647
 		else
648
-			throw new TInvalidDataTypeException('datalist_template_required','SeparatorTemplate');
648
+			throw new TInvalidDataTypeException('datalist_template_required', 'SeparatorTemplate');
649 649
 	}
650 650
 
651 651
 	/**
@@ -653,10 +653,10 @@  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
-			$style=new TTableItemStyle;
659
-			$this->setViewState('SeparatorStyle',$style,null);
658
+			$style = new TTableItemStyle;
659
+			$this->setViewState('SeparatorStyle', $style, null);
660 660
 		}
661 661
 		return $style;
662 662
 	}
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 	 */
668 668
 	public function getSelectedItemIndex()
669 669
 	{
670
-		return $this->getViewState('SelectedItemIndex',-1);
670
+		return $this->getViewState('SelectedItemIndex', -1);
671 671
 	}
672 672
 
673 673
 	/**
@@ -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)
683
-			$value=-1;
684
-		if(($current=$this->getSelectedItemIndex())!==$value)
682
+		if (($value = TPropertyValue::ensureInteger($value)) < 0)
683
+			$value = -1;
684
+		if (($current = $this->getSelectedItemIndex()) !== $value)
685 685
 		{
686
-			$this->setViewState('SelectedItemIndex',$value,-1);
687
-			$items=$this->getItems();
688
-			$itemCount=$items->getCount();
689
-			if($current>=0 && $current<$itemCount)
686
+			$this->setViewState('SelectedItemIndex', $value, -1);
687
+			$items = $this->getItems();
688
+			$itemCount = $items->getCount();
689
+			if ($current >= 0 && $current < $itemCount)
690 690
 			{
691
-				$item=$items->itemAt($current);
692
-				if(($item instanceof IItemDataRenderer) && $item->getItemType()!==TListItemType::EditItem)
693
-					$item->setItemType($current%2?TListItemType::AlternatingItem : TListItemType::Item);
691
+				$item = $items->itemAt($current);
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
-				$item=$items->itemAt($value);
698
-				if(($item instanceof IItemDataRenderer) && $item->getItemType()!==TListItemType::EditItem)
697
+				$item = $items->itemAt($value);
698
+				if (($item instanceof IItemDataRenderer) && $item->getItemType() !== TListItemType::EditItem)
699 699
 					$item->setItemType(TListItemType::SelectedItem);
700 700
 			}
701 701
 		}
@@ -706,9 +706,9 @@  discard block
 block discarded – undo
706 706
 	 */
707 707
 	public function getSelectedItem()
708 708
 	{
709
-		$index=$this->getSelectedItemIndex();
710
-		$items=$this->getItems();
711
-		if($index>=0 && $index<$items->getCount())
709
+		$index = $this->getSelectedItemIndex();
710
+		$items = $this->getItems();
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
-		$index=$this->getSelectedItemIndex();
726
-		$dataKeys=$this->getDataKeys();
727
-		if($index>=0 && $index<$dataKeys->getCount())
725
+		$index = $this->getSelectedItemIndex();
726
+		$dataKeys = $this->getDataKeys();
727
+		if ($index >= 0 && $index < $dataKeys->getCount())
728 728
 			return $dataKeys->itemAt($index);
729 729
 		else
730 730
 			return null;
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
 	 */
737 737
 	public function getEditItemIndex()
738 738
 	{
739
-		return $this->getViewState('EditItemIndex',-1);
739
+		return $this->getViewState('EditItemIndex', -1);
740 740
 	}
741 741
 
742 742
 	/**
@@ -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)
751
-			$value=-1;
752
-		if(($current=$this->getEditItemIndex())!==$value)
750
+		if (($value = TPropertyValue::ensureInteger($value)) < 0)
751
+			$value = -1;
752
+		if (($current = $this->getEditItemIndex()) !== $value)
753 753
 		{
754
-			$this->setViewState('EditItemIndex',$value,-1);
755
-			$items=$this->getItems();
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)
754
+			$this->setViewState('EditItemIndex', $value, -1);
755
+			$items = $this->getItems();
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)
760 760
 				$items->itemAt($value)->setItemType(TListItemType::EditItem);
761 761
 		}
762 762
 	}
@@ -766,9 +766,9 @@  discard block
 block discarded – undo
766 766
 	 */
767 767
 	public function getEditItem()
768 768
 	{
769
-		$index=$this->getEditItemIndex();
770
-		$items=$this->getItems();
771
-		if($index>=0 && $index<$items->getCount())
769
+		$index = $this->getEditItemIndex();
770
+		$items = $this->getItems();
771
+		if ($index >= 0 && $index < $items->getCount())
772 772
 			return $items->itemAt($index);
773 773
 		else
774 774
 			return null;
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
 	 */
780 780
 	public function getShowHeader()
781 781
 	{
782
-		return $this->getViewState('ShowHeader',true);
782
+		return $this->getViewState('ShowHeader', true);
783 783
 	}
784 784
 
785 785
 	/**
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 	 */
788 788
 	public function setShowHeader($value)
789 789
 	{
790
-		$this->setViewState('ShowHeader',TPropertyValue::ensureBoolean($value),true);
790
+		$this->setViewState('ShowHeader', TPropertyValue::ensureBoolean($value), true);
791 791
 	}
792 792
 
793 793
 	/**
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
 	 */
796 796
 	public function getShowFooter()
797 797
 	{
798
-		return $this->getViewState('ShowFooter',true);
798
+		return $this->getViewState('ShowFooter', true);
799 799
 	}
800 800
 
801 801
 	/**
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
 	 */
804 804
 	public function setShowFooter($value)
805 805
 	{
806
-		$this->setViewState('ShowFooter',TPropertyValue::ensureBoolean($value),true);
806
+		$this->setViewState('ShowFooter', TPropertyValue::ensureBoolean($value), true);
807 807
 	}
808 808
 
809 809
 	/**
@@ -811,10 +811,10 @@  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
-			$repeatInfo=new TRepeatInfo;
817
-			$this->setViewState('RepeatInfo',$repeatInfo,null);
816
+			$repeatInfo = new TRepeatInfo;
817
+			$this->setViewState('RepeatInfo', $repeatInfo, null);
818 818
 		}
819 819
 		return $repeatInfo;
820 820
 	}
@@ -912,35 +912,35 @@  discard block
 block discarded – undo
912 912
 	 * @param TEventParameter event parameter
913 913
 	 * @return boolean whether the event bubbling should stop here.
914 914
 	 */
915
-	public function bubbleEvent($sender,$param)
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
-			$command=$param->getCommandName();
921
-			if(strcasecmp($command,self::CMD_SELECT)===0)
920
+			$command = $param->getCommandName();
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
-			else if(strcasecmp($command,self::CMD_EDIT)===0)
928
+			else if (strcasecmp($command, self::CMD_EDIT) === 0)
929 929
 			{
930 930
 				$this->onEditCommand($param);
931 931
 				return true;
932 932
 			}
933
-			else if(strcasecmp($command,self::CMD_DELETE)===0)
933
+			else if (strcasecmp($command, self::CMD_DELETE) === 0)
934 934
 			{
935 935
 				$this->onDeleteCommand($param);
936 936
 				return true;
937 937
 			}
938
-			else if(strcasecmp($command,self::CMD_UPDATE)===0)
938
+			else if (strcasecmp($command, self::CMD_UPDATE) === 0)
939 939
 			{
940 940
 				$this->onUpdateCommand($param);
941 941
 				return true;
942 942
 			}
943
-			else if(strcasecmp($command,self::CMD_CANCEL)===0)
943
+			else if (strcasecmp($command, self::CMD_CANCEL) === 0)
944 944
 			{
945 945
 				$this->onCancelCommand($param);
946 946
 				return true;
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
 	 */
963 963
 	public function onItemCreated($param)
964 964
 	{
965
-		$this->raiseEvent('OnItemCreated',$this,$param);
965
+		$this->raiseEvent('OnItemCreated', $this, $param);
966 966
 	}
967 967
 
968 968
 	/**
@@ -976,7 +976,7 @@  discard block
 block discarded – undo
976 976
 	 */
977 977
 	public function onItemDataBound($param)
978 978
 	{
979
-		$this->raiseEvent('OnItemDataBound',$this,$param);
979
+		$this->raiseEvent('OnItemDataBound', $this, $param);
980 980
 	}
981 981
 
982 982
 	/**
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
 	 */
988 988
 	public function onItemCommand($param)
989 989
 	{
990
-		$this->raiseEvent('OnItemCommand',$this,$param);
990
+		$this->raiseEvent('OnItemCommand', $this, $param);
991 991
 	}
992 992
 
993 993
 	/**
@@ -998,7 +998,7 @@  discard block
 block discarded – undo
998 998
 	 */
999 999
 	public function onEditCommand($param)
1000 1000
 	{
1001
-		$this->raiseEvent('OnEditCommand',$this,$param);
1001
+		$this->raiseEvent('OnEditCommand', $this, $param);
1002 1002
 	}
1003 1003
 
1004 1004
 	/**
@@ -1009,7 +1009,7 @@  discard block
 block discarded – undo
1009 1009
 	 */
1010 1010
 	public function onDeleteCommand($param)
1011 1011
 	{
1012
-		$this->raiseEvent('OnDeleteCommand',$this,$param);
1012
+		$this->raiseEvent('OnDeleteCommand', $this, $param);
1013 1013
 	}
1014 1014
 
1015 1015
 	/**
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
 	 */
1021 1021
 	public function onUpdateCommand($param)
1022 1022
 	{
1023
-		$this->raiseEvent('OnUpdateCommand',$this,$param);
1023
+		$this->raiseEvent('OnUpdateCommand', $this, $param);
1024 1024
 	}
1025 1025
 
1026 1026
 	/**
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
1031 1031
 	 */
1032 1032
 	public function onCancelCommand($param)
1033 1033
 	{
1034
-		$this->raiseEvent('OnCancelCommand',$this,$param);
1034
+		$this->raiseEvent('OnCancelCommand', $this, $param);
1035 1035
 	}
1036 1036
 
1037 1037
 	/**
@@ -1041,7 +1041,7 @@  discard block
 block discarded – undo
1041 1041
 	 */
1042 1042
 	public function getHasHeader()
1043 1043
 	{
1044
-		return ($this->getShowHeader() && ($this->_headerTemplate!==null || $this->getHeaderRenderer()!==''));
1044
+		return ($this->getShowHeader() && ($this->_headerTemplate !== null || $this->getHeaderRenderer() !== ''));
1045 1045
 	}
1046 1046
 
1047 1047
 	/**
@@ -1051,7 +1051,7 @@  discard block
 block discarded – undo
1051 1051
 	 */
1052 1052
 	public function getHasFooter()
1053 1053
 	{
1054
-		return ($this->getShowFooter() && ($this->_footerTemplate!==null || $this->getFooterRenderer()!==''));
1054
+		return ($this->getShowFooter() && ($this->_footerTemplate !== null || $this->getFooterRenderer() !== ''));
1055 1055
 	}
1056 1056
 
1057 1057
 	/**
@@ -1061,7 +1061,7 @@  discard block
 block discarded – undo
1061 1061
 	 */
1062 1062
 	public function getHasSeparators()
1063 1063
 	{
1064
-		return $this->_separatorTemplate!==null || $this->getSeparatorRenderer()!=='';
1064
+		return $this->_separatorTemplate !== null || $this->getSeparatorRenderer() !== '';
1065 1065
 	}
1066 1066
 
1067 1067
 	/**
@@ -1071,11 +1071,11 @@  discard block
 block discarded – undo
1071 1071
 	 * @param integer index of the item being rendered
1072 1072
 	 * @return TStyle item style
1073 1073
 	 */
1074
-	public function generateItemStyle($itemType,$index)
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
-			$style=$item->getStyle();
1078
+			$style = $item->getStyle();
1079 1079
 			$item->clearStyle();
1080 1080
 			return $style;
1081 1081
 		}
@@ -1091,10 +1091,10 @@  discard block
 block discarded – undo
1091 1091
 	 * @param string item type (Header,Footer,Item,AlternatingItem,SelectedItem,EditItem,Separator,Pager)
1092 1092
 	 * @param integer zero-based index of the item in the item list
1093 1093
 	 */
1094
-	public function renderItem($writer,$repeatInfo,$itemType,$index)
1094
+	public function renderItem($writer, $repeatInfo, $itemType, $index)
1095 1095
 	{
1096
-		$item=$this->getItem($itemType,$index);
1097
-		if($repeatInfo->getRepeatLayout()===TRepeatLayout::Raw && get_class($item)==='TDataListItem')
1096
+		$item = $this->getItem($itemType, $index);
1097
+		if ($repeatInfo->getRepeatLayout() === TRepeatLayout::Raw && get_class($item) === 'TDataListItem')
1098 1098
 			$item->setTagName('div');
1099 1099
 		$item->renderControl($writer);
1100 1100
 	}
@@ -1104,9 +1104,9 @@  discard block
 block discarded – undo
1104 1104
 	 * @param integer item index
1105 1105
 	 * @return TControl data list item with the specified item type and index
1106 1106
 	 */
1107
-	private function getItem($itemType,$index)
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:
@@ -1116,10 +1116,10 @@  discard block
 block discarded – undo
1116 1116
 			case TListItemType::Header:
1117 1117
 				return $this->getControls()->itemAt(0);
1118 1118
 			case TListItemType::Footer:
1119
-				return $this->getControls()->itemAt($this->getControls()->getCount()-1);
1119
+				return $this->getControls()->itemAt($this->getControls()->getCount() - 1);
1120 1120
 			case TListItemType::Separator:
1121
-				$i=$index+$index+1;
1122
-				if($this->_headerTemplate!==null || $this->getHeaderRenderer()!=='')
1121
+				$i = $index + $index + 1;
1122
+				if ($this->_headerTemplate !== null || $this->getHeaderRenderer() !== '')
1123 1123
 					$i++;
1124 1124
 				return $this->getControls()->itemAt($i);
1125 1125
 		}
@@ -1133,11 +1133,11 @@  discard block
 block discarded – undo
1133 1133
 	 * @param TListItemType item type
1134 1134
 	 * @return TControl the created item, null if item is not created
1135 1135
 	 */
1136
-	private function createItemInternal($itemIndex,$itemType)
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
-			$param=new TDataListItemEventParameter($item);
1140
+			$param = new TDataListItemEventParameter($item);
1141 1141
 			$this->onItemCreated($param);
1142 1142
 			$this->getControls()->add($item);
1143 1143
 			return $item;
@@ -1154,12 +1154,12 @@  discard block
 block discarded – undo
1154 1154
 	 * @param mixed data to be associated with the item
1155 1155
 	 * @return TControl the created item, null if item is not created
1156 1156
 	 */
1157
-	private function createItemWithDataInternal($itemIndex,$itemType,$dataItem)
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
-			$param=new TDataListItemEventParameter($item);
1162
-			if($item instanceof IDataRenderer)
1161
+			$param = new TDataListItemEventParameter($item);
1162
+			if ($item instanceof 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 array($this->getItemRenderer(),$this->_itemTemplate);
1176
+		if (($classPath = $this->getAlternatingItemRenderer()) === '' && $this->_alternatingItemTemplate === null)
1177
+			return array($this->getItemRenderer(), $this->_itemTemplate);
1178 1178
 		else
1179
-			return array($classPath,$this->_alternatingItemTemplate);
1179
+			return array($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 array($this->getItemRenderer(),$this->_itemTemplate);
1186
+			if ($itemIndex % 2 === 0)
1187
+				return array($this->getItemRenderer(), $this->_itemTemplate);
1188 1188
 			else
1189 1189
 				return $this->getAlternatingItemDisplay();
1190 1190
 		}
1191 1191
 		else
1192
-			return array($classPath,$this->_selectedItemTemplate);
1192
+			return array($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 array($classPath,$this->_editItemTemplate);
1200
+			return array($classPath, $this->_editItemTemplate);
1201 1201
 	}
1202 1202
 
1203 1203
 	/**
@@ -1206,58 +1206,58 @@  discard block
 block discarded – undo
1206 1206
 	 * @param TListItemType item type
1207 1207
 	 * @return TControl created datalist item
1208 1208
 	 */
1209
-	protected function createItem($itemIndex,$itemType)
1209
+	protected function createItem($itemIndex, $itemType)
1210 1210
 	{
1211
-		$template=null;
1212
-		$classPath=null;
1213
-		switch($itemType)
1211
+		$template = null;
1212
+		$classPath = null;
1213
+		switch ($itemType)
1214 1214
 		{
1215 1215
 			case TListItemType::Item :
1216
-				$classPath=$this->getItemRenderer();
1217
-				$template=$this->_itemTemplate;
1216
+				$classPath = $this->getItemRenderer();
1217
+				$template = $this->_itemTemplate;
1218 1218
 				break;
1219 1219
 			case TListItemType::AlternatingItem :
1220
-				list($classPath,$template)=$this->getAlternatingItemDisplay();
1220
+				list($classPath, $template) = $this->getAlternatingItemDisplay();
1221 1221
 				break;
1222 1222
 			case TListItemType::SelectedItem:
1223
-				list($classPath,$template)=$this->getSelectedItemDisplay($itemIndex);
1223
+				list($classPath, $template) = $this->getSelectedItemDisplay($itemIndex);
1224 1224
 				break;
1225 1225
 			case TListItemType::EditItem:
1226
-				list($classPath,$template)=$this->getEditItemDisplay($itemIndex);
1226
+				list($classPath, $template) = $this->getEditItemDisplay($itemIndex);
1227 1227
 				break;
1228 1228
 			case TListItemType::Header :
1229
-				$classPath=$this->getHeaderRenderer();
1230
-				$template=$this->_headerTemplate;
1229
+				$classPath = $this->getHeaderRenderer();
1230
+				$template = $this->_headerTemplate;
1231 1231
 				break;
1232 1232
 			case TListItemType::Footer :
1233
-				$classPath=$this->getFooterRenderer();
1234
-				$template=$this->_footerTemplate;
1233
+				$classPath = $this->getFooterRenderer();
1234
+				$template = $this->_footerTemplate;
1235 1235
 				break;
1236 1236
 			case TListItemType::Separator :
1237
-				$classPath=$this->getSeparatorRenderer();
1238
-				$template=$this->_separatorTemplate;
1237
+				$classPath = $this->getSeparatorRenderer();
1238
+				$template = $this->_separatorTemplate;
1239 1239
 				break;
1240 1240
 			default:
1241
-				throw new TInvalidDataValueException('datalist_itemtype_unknown',$itemType);
1241
+				throw new TInvalidDataValueException('datalist_itemtype_unknown', $itemType);
1242 1242
 		}
1243
-		if($classPath!=='')
1243
+		if ($classPath !== '')
1244 1244
 		{
1245
-			$item=Prado::createComponent($classPath);
1246
-			if($item instanceof IItemDataRenderer)
1245
+			$item = Prado::createComponent($classPath);
1246
+			if ($item instanceof IItemDataRenderer)
1247 1247
 			{
1248 1248
 				$item->setItemIndex($itemIndex);
1249 1249
 				$item->setItemType($itemType);
1250 1250
 			}
1251 1251
 		}
1252
-		else if($template!==null)
1252
+		else if ($template !== null)
1253 1253
 		{
1254
-			$item=new TDataListItem;
1254
+			$item = new TDataListItem;
1255 1255
 			$item->setItemIndex($itemIndex);
1256 1256
 			$item->setItemType($itemType);
1257 1257
 			$template->instantiateIn($item);
1258 1258
 		}
1259 1259
 		else
1260
-			$item=null;
1260
+			$item = null;
1261 1261
 
1262 1262
 		return $item;
1263 1263
 	}
@@ -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
-		else if($this->_emptyTemplate!==null)
1272
+		else if ($this->_emptyTemplate !== null)
1273 1273
 			$this->_emptyTemplate->instantiateIn($this);
1274 1274
 	}
1275 1275
 
@@ -1286,68 +1286,68 @@  discard block
 block discarded – undo
1286 1286
 	 */
1287 1287
 	protected function applyItemStyles()
1288 1288
 	{
1289
-		$itemStyle=$this->getViewState('ItemStyle',null);
1289
+		$itemStyle = $this->getViewState('ItemStyle', null);
1290 1290
 
1291
-		$alternatingItemStyle=$this->getViewState('AlternatingItemStyle',null);
1292
-		if($itemStyle!==null)
1291
+		$alternatingItemStyle = $this->getViewState('AlternatingItemStyle', null);
1292
+		if ($itemStyle !== null)
1293 1293
 		{
1294
-			if($alternatingItemStyle===null)
1295
-				$alternatingItemStyle=$itemStyle;
1294
+			if ($alternatingItemStyle === null)
1295
+				$alternatingItemStyle = $itemStyle;
1296 1296
 			else
1297 1297
 				$alternatingItemStyle->mergeWith($itemStyle);
1298 1298
 		}
1299 1299
 
1300
-		$selectedItemStyle=$this->getViewState('SelectedItemStyle',null);
1300
+		$selectedItemStyle = $this->getViewState('SelectedItemStyle', null);
1301 1301
 
1302
-		$editItemStyle=$this->getViewState('EditItemStyle',null);
1303
-		if($selectedItemStyle!==null)
1302
+		$editItemStyle = $this->getViewState('EditItemStyle', null);
1303
+		if ($selectedItemStyle !== null)
1304 1304
 		{
1305
-			if($editItemStyle===null)
1306
-				$editItemStyle=$selectedItemStyle;
1305
+			if ($editItemStyle === null)
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
 
1325
-		$selectedIndex=$this->getSelectedItemIndex();
1326
-		$editIndex=$this->getEditItemIndex();
1325
+		$selectedIndex = $this->getSelectedItemIndex();
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)
1332
-				$style=$editItemStyle;
1333
-			else if($index===$selectedIndex)
1334
-				$style=$selectedItemStyle;
1335
-			else if($index%2===0)
1336
-				$style=$itemStyle;
1331
+			if ($index === $editIndex)
1332
+				$style = $editItemStyle;
1333
+			else if ($index === $selectedIndex)
1334
+				$style = $selectedItemStyle;
1335
+			else if ($index % 2 === 0)
1336
+				$style = $itemStyle;
1337 1337
 			else
1338
-				$style=$alternatingItemStyle;
1339
-			if($style && $item instanceof IStyleable)
1338
+				$style = $alternatingItemStyle;
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
-			$controls=$this->getControls();
1347
-			$count=$controls->getCount();
1348
-			for($i=$this->_header?2:1;$i<$count;$i+=2)
1346
+			$controls = $this->getControls();
1347
+			$count = $controls->getCount();
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,8 +1360,8 @@  discard block
 block discarded – undo
1360 1360
 	public function saveState()
1361 1361
 	{
1362 1362
 		parent::saveState();
1363
-		if($this->_items)
1364
-			$this->setViewState('ItemCount',$this->_items->getCount(),0);
1363
+		if ($this->_items)
1364
+			$this->setViewState('ItemCount', $this->_items->getCount(), 0);
1365 1365
 		else
1366 1366
 			$this->clearViewState('ItemCount');
1367 1367
 	}
@@ -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
 	}
@@ -1385,8 +1385,8 @@  discard block
 block discarded – undo
1385 1385
 	{
1386 1386
 		$this->getControls()->clear();
1387 1387
 		$this->getItems()->clear();
1388
-		$this->_header=null;
1389
-		$this->_footer=null;
1388
+		$this->_header = null;
1389
+		$this->_footer = null;
1390 1390
 	}
1391 1391
 
1392 1392
 	/**
@@ -1395,26 +1395,26 @@  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
-			$items=$this->getItems();
1401
-			$selectedIndex=$this->getSelectedItemIndex();
1402
-			$editIndex=$this->getEditItemIndex();
1403
-			$hasSeparator=$this->_separatorTemplate!==null || $this->getSeparatorRenderer()!=='';
1404
-			$this->_header=$this->createItemInternal(-1,TListItemType::Header);
1405
-			for($i=0;$i<$itemCount;++$i)
1400
+			$items = $this->getItems();
1401
+			$selectedIndex = $this->getSelectedItemIndex();
1402
+			$editIndex = $this->getEditItemIndex();
1403
+			$hasSeparator = $this->_separatorTemplate !== null || $this->getSeparatorRenderer() !== '';
1404
+			$this->_header = $this->createItemInternal(-1, TListItemType::Header);
1405
+			for ($i = 0; $i < $itemCount; ++$i)
1406 1406
 			{
1407
-				if($hasSeparator && $i>0)
1408
-					$this->createItemInternal($i-1,TListItemType::Separator);
1409
-				if($i===$editIndex)
1410
-					$itemType=TListItemType::EditItem;
1411
-				else if($i===$selectedIndex)
1412
-					$itemType=TListItemType::SelectedItem;
1407
+				if ($hasSeparator && $i > 0)
1408
+					$this->createItemInternal($i - 1, TListItemType::Separator);
1409
+				if ($i === $editIndex)
1410
+					$itemType = TListItemType::EditItem;
1411
+				else if ($i === $selectedIndex)
1412
+					$itemType = TListItemType::SelectedItem;
1413 1413
 				else
1414
-					$itemType=$i%2?TListItemType::AlternatingItem : TListItemType::Item;
1415
-				$items->add($this->createItemInternal($i,$itemType));
1414
+					$itemType = $i % 2 ? TListItemType::AlternatingItem : TListItemType::Item;
1415
+				$items->add($this->createItemInternal($i, $itemType));
1416 1416
 			}
1417
-			$this->_footer=$this->createItemInternal(-1,TListItemType::Footer);
1417
+			$this->_footer = $this->createItemInternal(-1, TListItemType::Footer);
1418 1418
 		}
1419 1419
 		else
1420 1420
 			$this->createEmptyContent();
@@ -1430,41 +1430,41 @@  discard block
 block discarded – undo
1430 1430
 	protected function performDataBinding($data)
1431 1431
 	{
1432 1432
 		$this->reset();
1433
-		$keys=$this->getDataKeys();
1433
+		$keys = $this->getDataKeys();
1434 1434
 		$keys->clear();
1435
-		$keyField=$this->getDataKeyField();
1436
-		$itemIndex=0;
1437
-		$items=$this->getItems();
1438
-		$hasSeparator=$this->_separatorTemplate!==null || $this->getSeparatorRenderer()!=='';
1439
-		$selectedIndex=$this->getSelectedItemIndex();
1440
-		$editIndex=$this->getEditItemIndex();
1441
-		foreach($data as $key=>$dataItem)
1435
+		$keyField = $this->getDataKeyField();
1436
+		$itemIndex = 0;
1437
+		$items = $this->getItems();
1438
+		$hasSeparator = $this->_separatorTemplate !== null || $this->getSeparatorRenderer() !== '';
1439
+		$selectedIndex = $this->getSelectedItemIndex();
1440
+		$editIndex = $this->getEditItemIndex();
1441
+		foreach ($data as $key=>$dataItem)
1442 1442
 		{
1443
-			if($keyField!=='')
1444
-				$keys->add($this->getDataFieldValue($dataItem,$keyField));
1443
+			if ($keyField !== '')
1444
+				$keys->add($this->getDataFieldValue($dataItem, $keyField));
1445 1445
 			else
1446 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
-			else if($itemIndex===$selectedIndex)
1454
-				$itemType=TListItemType::SelectedItem;
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
+			else if ($itemIndex === $selectedIndex)
1454
+				$itemType = TListItemType::SelectedItem;
1455 1455
 			else
1456
-				$itemType=$itemIndex%2?TListItemType::AlternatingItem : TListItemType::Item;
1457
-			$items->add($this->createItemWithDataInternal($itemIndex,$itemType,$dataItem));
1456
+				$itemType = $itemIndex % 2 ? TListItemType::AlternatingItem : TListItemType::Item;
1457
+			$items->add($this->createItemWithDataInternal($itemIndex, $itemType, $dataItem));
1458 1458
 			$itemIndex++;
1459 1459
 		}
1460
-		if($itemIndex>0)
1461
-			$this->_footer=$this->createItemWithDataInternal(-1,TListItemType::Footer,null);
1460
+		if ($itemIndex > 0)
1461
+			$this->_footer = $this->createItemWithDataInternal(-1, TListItemType::Footer, null);
1462 1462
 		else
1463 1463
 		{
1464 1464
 			$this->createEmptyContent();
1465 1465
 			$this->dataBindChildren();
1466 1466
 		}
1467
-		$this->setViewState('ItemCount',$itemIndex,0);
1467
+		$this->setViewState('ItemCount', $itemIndex, 0);
1468 1468
 	}
1469 1469
 
1470 1470
 	/**
@@ -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
-				$repeatInfo=$this->getRepeatInfo();
1483
-				$repeatInfo->renderRepeater($writer,$this);
1482
+				$repeatInfo = $this->getRepeatInfo();
1483
+				$repeatInfo->renderRepeater($writer, $this);
1484 1484
 			}
1485
-			else if($this->_emptyTemplate!==null || $this->getEmptyRenderer()!=='')
1485
+			else if ($this->_emptyTemplate !== null || $this->getEmptyRenderer() !== '')
1486 1486
 				parent::render($writer);
1487 1487
 		}
1488 1488
 	}
@@ -1506,7 +1506,7 @@  discard block
 block discarded – undo
1506 1506
 	 * The datalist item control responsible for the event.
1507 1507
 	 * @var TControl
1508 1508
 	 */
1509
-	private $_item=null;
1509
+	private $_item = null;
1510 1510
 
1511 1511
 	/**
1512 1512
 	 * Constructor.
@@ -1514,7 +1514,7 @@  discard block
 block discarded – undo
1514 1514
 	 */
1515 1515
 	public function __construct($item)
1516 1516
 	{
1517
-		$this->_item=$item;
1517
+		$this->_item = $item;
1518 1518
 	}
1519 1519
 
1520 1520
 	/**
@@ -1545,11 +1545,11 @@  discard block
 block discarded – undo
1545 1545
 	/**
1546 1546
 	 * @var TControl the datalist item control responsible for the event.
1547 1547
 	 */
1548
-	private $_item=null;
1548
+	private $_item = null;
1549 1549
 	/**
1550 1550
 	 * @var TControl the control originally raises the <b>OnCommand</b> event.
1551 1551
 	 */
1552
-	private $_source=null;
1552
+	private $_source = null;
1553 1553
 
1554 1554
 	/**
1555 1555
 	 * Constructor.
@@ -1557,11 +1557,11 @@  discard block
 block discarded – undo
1557 1557
 	 * @param TControl original event sender
1558 1558
 	 * @param TCommandEventParameter original event parameter
1559 1559
 	 */
1560
-	public function __construct($item,$source,TCommandEventParameter $param)
1560
+	public function __construct($item, $source, TCommandEventParameter $param)
1561 1561
 	{
1562
-		$this->_item=$item;
1563
-		$this->_source=$source;
1564
-		parent::__construct($param->getCommandName(),$param->getCommandParameter());
1562
+		$this->_item = $item;
1563
+		$this->_source = $source;
1564
+		parent::__construct($param->getCommandName(), $param->getCommandParameter());
1565 1565
 	}
1566 1566
 
1567 1567
 	/**
@@ -1611,7 +1611,7 @@  discard block
 block discarded – undo
1611 1611
 	 */
1612 1612
 	private $_data;
1613 1613
 
1614
-	private $_tagName='span';
1614
+	private $_tagName = 'span';
1615 1615
 
1616 1616
 	/**
1617 1617
 	 * Returns the tag name used for this control.
@@ -1627,7 +1627,7 @@  discard block
 block discarded – undo
1627 1627
 	 */
1628 1628
 	public function setTagName($value)
1629 1629
 	{
1630
-		$this->_tagName=$value;
1630
+		$this->_tagName = $value;
1631 1631
 	}
1632 1632
 
1633 1633
 	/**
@@ -1653,7 +1653,7 @@  discard block
 block discarded – undo
1653 1653
 	 */
1654 1654
 	public function setItemType($value)
1655 1655
 	{
1656
-		$this->_itemType=TPropertyValue::ensureEnum($value,'TListItemType');
1656
+		$this->_itemType = TPropertyValue::ensureEnum($value, 'TListItemType');
1657 1657
 	}
1658 1658
 
1659 1659
 	/**
@@ -1671,7 +1671,7 @@  discard block
 block discarded – undo
1671 1671
 	 */
1672 1672
 	public function setItemIndex($value)
1673 1673
 	{
1674
-		$this->_itemIndex=TPropertyValue::ensureInteger($value);
1674
+		$this->_itemIndex = TPropertyValue::ensureInteger($value);
1675 1675
 	}
1676 1676
 
1677 1677
 	/**
@@ -1689,7 +1689,7 @@  discard block
 block discarded – undo
1689 1689
 	 */
1690 1690
 	public function setData($value)
1691 1691
 	{
1692
-		$this->_data=$value;
1692
+		$this->_data = $value;
1693 1693
 	}
1694 1694
 
1695 1695
 	/**
@@ -1719,11 +1719,11 @@  discard block
 block discarded – undo
1719 1719
 	 * @param TEventParameter event parameter
1720 1720
 	 * @return boolean whether the event bubbling should stop here.
1721 1721
 	 */
1722
-	public function bubbleEvent($sender,$param)
1722
+	public function bubbleEvent($sender, $param)
1723 1723
 	{
1724
-		if($param instanceof TCommandEventParameter)
1724
+		if ($param instanceof TCommandEventParameter)
1725 1725
 		{
1726
-			$this->raiseBubbleEvent($this,new TDataListCommandEventParameter($this,$sender,$param));
1726
+			$this->raiseBubbleEvent($this, new TDataListCommandEventParameter($this, $sender, $param));
1727 1727
 			return true;
1728 1728
 		}
1729 1729
 		else
@@ -1749,10 +1749,10 @@  discard block
 block discarded – undo
1749 1749
 	 * @param mixed new item
1750 1750
 	 * @throws TInvalidDataTypeException if the item to be inserted is not a TControl descendant.
1751 1751
 	 */
1752
-	public function insertAt($index,$item)
1752
+	public function insertAt($index, $item)
1753 1753
 	{
1754
-		if($item instanceof TControl)
1755
-			parent::insertAt($index,$item);
1754
+		if ($item instanceof TControl)
1755
+			parent::insertAt($index, $item);
1756 1756
 		else
1757 1757
 			throw new TInvalidDataTypeException('datalistitemcollection_datalistitem_required');
1758 1758
 	}
Please login to merge, or discard this patch.
Braces   +207 added lines, -169 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
-			else if(strcasecmp($command,self::CMD_EDIT)===0)
947
+			} else if(strcasecmp($command,self::CMD_EDIT)===0)
929 948
 			{
930 949
 				$this->onEditCommand($param);
931 950
 				return true;
932
-			}
933
-			else if(strcasecmp($command,self::CMD_DELETE)===0)
951
+			} else if(strcasecmp($command,self::CMD_DELETE)===0)
934 952
 			{
935 953
 				$this->onDeleteCommand($param);
936 954
 				return true;
937
-			}
938
-			else if(strcasecmp($command,self::CMD_UPDATE)===0)
955
+			} else if(strcasecmp($command,self::CMD_UPDATE)===0)
939 956
 			{
940 957
 				$this->onUpdateCommand($param);
941 958
 				return true;
942
-			}
943
-			else if(strcasecmp($command,self::CMD_CANCEL)===0)
959
+			} else if(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 IDataRenderer)
1163
-				$item->setData($dataItem);
1180
+			if($item instanceof 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 array($this->getItemRenderer(),$this->_itemTemplate);
1178
-		else
1179
-			return array($classPath,$this->_alternatingItemTemplate);
1195
+		if(($classPath=$this->getAlternatingItemRenderer())==='' && $this->_alternatingItemTemplate===null) {
1196
+					return array($this->getItemRenderer(),$this->_itemTemplate);
1197
+		} else {
1198
+					return array($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 array($this->getItemRenderer(),$this->_itemTemplate);
1188
-			else
1189
-				return $this->getAlternatingItemDisplay();
1206
+			if($itemIndex%2===0) {
1207
+							return array($this->getItemRenderer(),$this->_itemTemplate);
1208
+			} else {
1209
+							return $this->getAlternatingItemDisplay();
1210
+			}
1211
+		} else {
1212
+					return array($classPath,$this->_selectedItemTemplate);
1190 1213
 		}
1191
-		else
1192
-			return array($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 array($classPath,$this->_editItemTemplate);
1218
+		if(($classPath=$this->getEditItemRenderer())==='' && $this->_editItemTemplate===null) {
1219
+					return $this->getSelectedItemDisplay($itemIndex);
1220
+		} else {
1221
+					return array($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
-		else if($template!==null)
1273
+		} else if($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
-		else if($this->_emptyTemplate!==null)
1273
-			$this->_emptyTemplate->instantiateIn($this);
1291
+		if(($classPath=$this->getEmptyRenderer())!=='') {
1292
+					$this->getControls()->add(Prado::createComponent($classPath));
1293
+		} else if($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
-			else if($index===$selectedIndex)
1334
-				$style=$selectedItemStyle;
1335
-			else if($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
+			} else if($index===$selectedIndex) {
1360
+							$style=$selectedItemStyle;
1361
+			} else if($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
-				else if($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
+				} else if($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
-			else if($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
+			} else if($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
+			} else if($this->_emptyTemplate!==null || $this->getEmptyRenderer()!=='') {
1522
+							parent::render($writer);
1484 1523
 			}
1485
-			else if($this->_emptyTemplate!==null || $this->getEmptyRenderer()!=='')
1486
-				parent::render($writer);
1487 1524
 		}
1488 1525
 	}
1489 1526
 }
@@ -1725,9 +1762,9 @@  discard block
 block discarded – undo
1725 1762
 		{
1726 1763
 			$this->raiseBubbleEvent($this,new TDataListCommandEventParameter($this,$sender,$param));
1727 1764
 			return true;
1765
+		} else {
1766
+					return false;
1728 1767
 		}
1729
-		else
1730
-			return false;
1731 1768
 	}
1732 1769
 }
1733 1770
 
@@ -1751,10 +1788,11 @@  discard block
 block discarded – undo
1751 1788
 	 */
1752 1789
 	public function insertAt($index,$item)
1753 1790
 	{
1754
-		if($item instanceof TControl)
1755
-			parent::insertAt($index,$item);
1756
-		else
1757
-			throw new TInvalidDataTypeException('datalistitemcollection_datalistitem_required');
1791
+		if($item instanceof TControl) {
1792
+					parent::insertAt($index,$item);
1793
+		} else {
1794
+					throw new TInvalidDataTypeException('datalistitemcollection_datalistitem_required');
1795
+		}
1758 1796
 	}
1759 1797
 }
1760 1798
 
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TDataSourceControl.php 3 patches
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -20,6 +20,10 @@  discard block
 block discarded – undo
20 20
 {
21 21
 	public function getView($viewName);
22 22
 	public function getViewNames();
23
+
24
+	/**
25
+	 * @return void
26
+	 */
23 27
 	public function onDataSourceChanged($param);
24 28
 }
25 29
 
@@ -95,6 +99,9 @@  discard block
 block discarded – undo
95 99
 	private $_dataSource;
96 100
 	private $_dataMember;
97 101
 
102
+	/**
103
+	 * @param Traversable $dataSource
104
+	 */
98 105
 	public function __construct($dataSource,$dataMember)
99 106
 	{
100 107
 		if(!is_array($dataSource) && !($dataSource instanceof IDataSource) && !($dataSource instanceof Traversable))
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
 	public function onDataSourceChanged($param)
46 46
 	{
47
-		$this->raiseEvent('OnDataSourceChanged',$this,$param);
47
+		$this->raiseEvent('OnDataSourceChanged', $this, $param);
48 48
 	}
49 49
 
50 50
 	public function focus()
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 		throw new TNotSupportedException('datasourcecontrol_skinid_unsupported');
73 73
 	}
74 74
 
75
-	public function getVisible($checkParents=true)
75
+	public function getVisible($checkParents = true)
76 76
 	{
77 77
 		return false;
78 78
 	}
@@ -95,20 +95,20 @@  discard block
 block discarded – undo
95 95
 	private $_dataSource;
96 96
 	private $_dataMember;
97 97
 
98
-	public function __construct($dataSource,$dataMember)
98
+	public function __construct($dataSource, $dataMember)
99 99
 	{
100
-		if(!is_array($dataSource) && !($dataSource instanceof IDataSource) && !($dataSource instanceof Traversable))
100
+		if (!is_array($dataSource) && !($dataSource instanceof IDataSource) && !($dataSource instanceof Traversable))
101 101
 			throw new TInvalidDataTypeException('readonlydatasource_datasource_invalid');
102
-		$this->_dataSource=$dataSource;
103
-		$this->_dataMember=$dataMember;
102
+		$this->_dataSource = $dataSource;
103
+		$this->_dataMember = $dataMember;
104 104
 	}
105 105
 
106 106
 	public function getView($viewName)
107 107
 	{
108
-		if($this->_dataSource instanceof IDataSource)
108
+		if ($this->_dataSource instanceof IDataSource)
109 109
 			return $this->_dataSource->getView($viewName);
110 110
 		else
111
-			return new TReadOnlyDataSourceView($this,$this->_dataMember,$this->_dataSource);
111
+			return new TReadOnlyDataSourceView($this, $this->_dataMember, $this->_dataSource);
112 112
 	}
113 113
 }
114 114
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -97,18 +97,20 @@
 block discarded – undo
97 97
 
98 98
 	public function __construct($dataSource,$dataMember)
99 99
 	{
100
-		if(!is_array($dataSource) && !($dataSource instanceof IDataSource) && !($dataSource instanceof Traversable))
101
-			throw new TInvalidDataTypeException('readonlydatasource_datasource_invalid');
100
+		if(!is_array($dataSource) && !($dataSource instanceof IDataSource) && !($dataSource instanceof Traversable)) {
101
+					throw new TInvalidDataTypeException('readonlydatasource_datasource_invalid');
102
+		}
102 103
 		$this->_dataSource=$dataSource;
103 104
 		$this->_dataMember=$dataMember;
104 105
 	}
105 106
 
106 107
 	public function getView($viewName)
107 108
 	{
108
-		if($this->_dataSource instanceof IDataSource)
109
-			return $this->_dataSource->getView($viewName);
110
-		else
111
-			return new TReadOnlyDataSourceView($this,$this->_dataMember,$this->_dataSource);
109
+		if($this->_dataSource instanceof IDataSource) {
110
+					return $this->_dataSource->getView($viewName);
111
+		} else {
112
+					return new TReadOnlyDataSourceView($this,$this->_dataMember,$this->_dataSource);
113
+		}
112 114
 	}
113 115
 }
114 116
 
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TDatePicker.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -106,6 +106,7 @@  discard block
 block discarded – undo
106 106
 	/**
107 107
 	 * Sets the format of the date string.
108 108
 	 * @param string the format of the date string
109
+	 * @param string $value
109 110
 	 */
110 111
 	public function setDateFormat($value)
111 112
 	{
@@ -245,6 +246,7 @@  discard block
 block discarded – undo
245 246
 
246 247
 	/**
247 248
 	 * @param integer date picker starting year, default is 2000.
249
+	 * @param integer $value
248 250
 	 */
249 251
 	public function setFromYear($value)
250 252
 	{
@@ -354,6 +356,7 @@  discard block
 block discarded – undo
354 356
 
355 357
 	/**
356 358
 	 * @param string date string
359
+	 * @param string $value
357 360
 	 */
358 361
 	public function setDate($value)
359 362
 	{
@@ -731,6 +734,7 @@  discard block
 block discarded – undo
731 734
 	 * "MMMM" will return the month names, "MM" or "MMM" return abbr. month names
732 735
 	 * and "M" return month digits.
733 736
 	 * @param DateTimeFormatInfo localized date format information.
737
+	 * @param DateTimeFormatInfo $info
734 738
 	 * @return array localized month names.
735 739
 	 */
736 740
 	protected function getLocalizedMonthNames($info)
Please login to merge, or discard this patch.
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function getDateFormat()
102 102
 	{
103
-		return $this->getViewState('DateFormat','dd-MM-yyyy');
103
+		return $this->getViewState('DateFormat', 'dd-MM-yyyy');
104 104
 	}
105 105
 
106 106
 	/**
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function setDateFormat($value)
111 111
 	{
112
-		$this->setViewState('DateFormat',$value,'dd-MM-yyyy');
112
+		$this->setViewState('DateFormat', $value, 'dd-MM-yyyy');
113 113
 	}
114 114
 
115 115
 	/**
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public function getShowCalendar()
119 119
 	{
120
-		return $this->getViewState('ShowCalendar',true);
120
+		return $this->getViewState('ShowCalendar', true);
121 121
 	}
122 122
 
123 123
 	/**
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	public function setShowCalendar($value)
128 128
 	{
129
-		$this->setViewState('ShowCalendar',TPropertyValue::ensureBoolean($value),true);
129
+		$this->setViewState('ShowCalendar', TPropertyValue::ensureBoolean($value), true);
130 130
 	}
131 131
 
132 132
 	/**
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 	 */
249 249
 	public function setFromYear($value)
250 250
 	{
251
-		$this->setViewState('FromYear', TPropertyValue::ensureInteger($value), intval(@date('Y'))-5);
251
+		$this->setViewState('FromYear', TPropertyValue::ensureInteger($value), intval(@date('Y')) - 5);
252 252
 	}
253 253
 
254 254
 	/**
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 	 */
257 257
 	public function getFromYear()
258 258
 	{
259
-		return $this->getViewState('FromYear', intval(@date('Y'))-5);
259
+		return $this->getViewState('FromYear', intval(@date('Y')) - 5);
260 260
 	}
261 261
 
262 262
 	/**
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 	 */
265 265
 	public function setUpToYear($value)
266 266
 	{
267
-		$this->setViewState('UpToYear', TPropertyValue::ensureInteger($value), intval(@date('Y'))+10);
267
+		$this->setViewState('UpToYear', TPropertyValue::ensureInteger($value), intval(@date('Y')) + 10);
268 268
 	}
269 269
 
270 270
 	/**
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 	 */
273 273
 	public function getUpToYear()
274 274
 	{
275
-		return $this->getViewState('UpToYear', intval(@date('Y'))+10);
275
+		return $this->getViewState('UpToYear', intval(@date('Y')) + 10);
276 276
 	}
277 277
 
278 278
 	/**
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 	 */
297 297
 	public function getTimeStamp()
298 298
 	{
299
-		if(trim($this->getText())==='')
299
+		if (trim($this->getText()) === '')
300 300
 			return null;
301 301
 		else
302 302
 			return $this->getTimeStampFromText();
@@ -308,12 +308,12 @@  discard block
 block discarded – undo
308 308
 	 */
309 309
 	public function setTimeStamp($value)
310 310
 	{
311
-		if($value===null || (is_string($value) && trim($value)===''))
311
+		if ($value === null || (is_string($value) && trim($value) === ''))
312 312
 			$this->setText('');
313 313
 		else
314 314
 		{
315 315
 			$date = TPropertyValue::ensureFloat($value);
316
-			$formatter = Prado::createComponent('System.Util.TSimpleDateFormatter',$this->getDateFormat());
316
+			$formatter = Prado::createComponent('System.Util.TSimpleDateFormatter', $this->getDateFormat());
317 317
 			$this->setText($formatter->format($date));
318 318
 		}
319 319
 	}
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 	 */
373 373
 	public function getClientSide()
374 374
 	{
375
-		if($this->_clientScript===null)
375
+		if ($this->_clientScript === null)
376 376
 			$this->_clientScript = $this->createClientScript();
377 377
 		return $this->_clientScript;
378 378
 	}
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 	 */
393 393
 	public function getValidationPropertyValue()
394 394
 	{
395
-		if(($text = $this->getText()) === '')
395
+		if (($text = $this->getText()) === '')
396 396
 			return '';
397 397
 		$date = $this->getTimeStamp();
398 398
 		return $date == null ? $text : $date;
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 	 */
417 417
 	public function render($writer)
418 418
 	{
419
-		if($this->getInputMode() == TDatePickerInputMode::TextBox)
419
+		if ($this->getInputMode() == TDatePickerInputMode::TextBox)
420 420
 		{
421 421
 			parent::render($writer);
422 422
 			$this->renderDatePickerButtons($writer);
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 		else
425 425
 		{
426 426
 			$this->renderDropDownListCalendar($writer);
427
-			if($this->hasDayPattern())
427
+			if ($this->hasDayPattern())
428 428
 			{
429 429
 				$this->renderClientControlScript($writer);
430 430
 				$this->renderDatePickerButtons($writer);
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 	 */
438 438
 	protected function renderDatePickerButtons($writer)
439 439
 	{
440
-		if($this->getShowCalendar())
440
+		if ($this->getShowCalendar())
441 441
 		{
442 442
 			switch ($this->getMode())
443 443
 			{
@@ -459,12 +459,12 @@  discard block
 block discarded – undo
459 459
 	 * @param array the input data collection
460 460
 	 * @return boolean whether the data of the component has been changed
461 461
 	 */
462
-	public function loadPostData($key,$values)
462
+	public function loadPostData($key, $values)
463 463
 	{
464
-		if($this->getInputMode() == TDatePickerInputMode::TextBox)
464
+		if ($this->getInputMode() == TDatePickerInputMode::TextBox)
465 465
 			return parent::loadPostData($key, $values);
466 466
 		$value = $this->getDateFromPostData($key, $values);
467
-		if(!$this->getReadOnly() && $this->getText()!==$value)
467
+		if (!$this->getReadOnly() && $this->getText() !== $value)
468 468
 		{
469 469
 			$this->setText($value);
470 470
 			return true;
@@ -483,18 +483,18 @@  discard block
 block discarded – undo
483 483
 	{
484 484
 		$date = @getdate();
485 485
 
486
-		if(isset($values[$key.'$day']))
487
-			$day = intval($values[$key.'$day']);
486
+		if (isset($values[$key . '$day']))
487
+			$day = intval($values[$key . '$day']);
488 488
 		else
489 489
 			$day = $date['mday'];
490 490
 
491
-		if(isset($values[$key.'$month']))
492
-			$month = intval($values[$key.'$month']) + 1;
491
+		if (isset($values[$key . '$month']))
492
+			$month = intval($values[$key . '$month']) + 1;
493 493
 		else
494 494
 			$month = $date['mon'];
495 495
 
496
-		if(isset($values[$key.'$year']))
497
-			$year = intval($values[$key.'$year']);
496
+		if (isset($values[$key . '$year']))
497
+			$year = intval($values[$key . '$year']);
498 498
 		else
499 499
 			$year = $date['year'];
500 500
 
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 		//$date = @mktime(0, 0, 0, $month, $day, $year);
504 504
 
505 505
 		$pattern = $this->getDateFormat();
506
-		$pattern = str_replace(array('MMMM', 'MMM'), array('MM','MM'), $pattern);
506
+		$pattern = str_replace(array('MMMM', 'MMM'), array('MM', 'MM'), $pattern);
507 507
 		$formatter = Prado::createComponent('System.Util.TSimpleDateFormatter', $pattern);
508 508
 		return $formatter->format($date);
509 509
 	}
@@ -518,12 +518,12 @@  discard block
 block discarded – undo
518 518
 		$options['InputMode'] = $this->getInputMode();
519 519
 		$options['Format'] = $this->getDateFormat();
520 520
 		$options['FirstDayOfWeek'] = $this->getFirstDayOfWeek();
521
-		if(($cssClass=$this->getCssClass())!=='')
521
+		if (($cssClass = $this->getCssClass()) !== '')
522 522
 			$options['ClassName'] = $cssClass;
523 523
 		$options['CalendarStyle'] = $this->getCalendarStyle();
524 524
 		$options['FromYear'] = $this->getFromYear();
525 525
 		$options['UpToYear'] = $this->getUpToYear();
526
-		switch($this->getMode())
526
+		switch ($this->getMode())
527 527
 		{
528 528
 			case TDatePickerMode::Basic:
529 529
 				break;
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 		$options['PositionMode'] = $this->getPositionMode();
538 538
 
539 539
 		$options = array_merge($options, $this->getCulturalOptions());
540
-		if($this->_clientScript!==null)
540
+		if ($this->_clientScript !== null)
541 541
 			$options = array_merge($options,
542 542
 				$this->_clientScript->getOptions()->toArray());
543 543
 		return $options;
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 	 */
550 550
 	protected function getCulturalOptions()
551 551
 	{
552
-		if($this->getCurrentCulture() == 'en')
552
+		if ($this->getCurrentCulture() == 'en')
553 553
 			return array();
554 554
 
555 555
 		$date = $this->getLocalizedCalendarInfo();
@@ -587,14 +587,14 @@  discard block
 block discarded – undo
587 587
 	 */
588 588
 	protected function renderDropDownListCalendar($writer)
589 589
 	{
590
-		if($this->getMode() == TDatePickerMode::Basic)
590
+		if ($this->getMode() == TDatePickerMode::Basic)
591 591
 			$this->setMode(TDatePickerMode::ImageButton);
592 592
 		parent::addAttributesToRender($writer);
593 593
 		$writer->removeAttribute('name');
594 594
 		$writer->removeAttribute('type');
595 595
 		$writer->addAttribute('id', $this->getClientID());
596 596
 
597
-		if(strlen($class = $this->getCssClass()) > 0)
597
+		if (strlen($class = $this->getCssClass()) > 0)
598 598
 			$writer->addAttribute('class', $class);
599 599
 		$writer->renderBeginTag('span');
600 600
 
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
 	{
619 619
 		$formatter = Prado::createComponent('System.Util.TSimpleDateFormatter',
620 620
 						$this->getDateFormat());
621
-		return ($formatter->getDayPattern()!==null);
621
+		return ($formatter->getDayPattern() !== null);
622 622
 	}
623 623
 
624 624
 	/**
@@ -631,14 +631,14 @@  discard block
 block discarded – undo
631 631
 		$formatter = Prado::createComponent('System.Util.TSimpleDateFormatter',
632 632
 						$this->getDateFormat());
633 633
 
634
-		foreach($formatter->getDayMonthYearOrdering() as $type)
634
+		foreach ($formatter->getDayMonthYearOrdering() as $type)
635 635
 		{
636
-			if($type == 'day')
637
-				$this->renderCalendarDayOptions($writer,$date['mday']);
638
-			elseif($type == 'month')
639
-				$this->renderCalendarMonthOptions($writer,$date['mon']);
640
-			elseif($type == 'year')
641
-				$this->renderCalendarYearOptions($writer,$date['year']);
636
+			if ($type == 'day')
637
+				$this->renderCalendarDayOptions($writer, $date['mday']);
638
+			elseif ($type == 'month')
639
+				$this->renderCalendarMonthOptions($writer, $date['mon']);
640
+			elseif ($type == 'year')
641
+				$this->renderCalendarYearOptions($writer, $date['year']);
642 642
 		}
643 643
 	}
644 644
 
@@ -649,8 +649,8 @@  discard block
 block discarded – undo
649 649
 	protected function getTimeStampFromText()
650 650
 	{
651 651
 		$pattern = $this->getDateFormat();
652
-		$pattern = str_replace(array('MMMM', 'MMM'), array('MM','MM'), $pattern);
653
-		$formatter = Prado::createComponent('System.Util.TSimpleDateFormatter',$pattern);
652
+		$pattern = str_replace(array('MMMM', 'MMM'), array('MM', 'MM'), $pattern);
653
+		$formatter = Prado::createComponent('System.Util.TSimpleDateFormatter', $pattern);
654 654
 		return $formatter->parse($this->getText());
655 655
 	}
656 656
 
@@ -660,12 +660,12 @@  discard block
 block discarded – undo
660 660
 	 * @param array list of selection options
661 661
 	 * @param mixed selected key.
662 662
 	 */
663
-	private function renderDropDownListOptions($writer,$options,$selected=null)
663
+	private function renderDropDownListOptions($writer, $options, $selected = null)
664 664
 	{
665
-		foreach($options as $k => $v)
665
+		foreach ($options as $k => $v)
666 666
 		{
667 667
 			$writer->addAttribute('value', $k);
668
-			if($k == $selected)
668
+			if ($k == $selected)
669 669
 				$writer->addAttribute('selected', 'selected');
670 670
 			$writer->renderBeginTag('option');
671 671
 			$writer->write($v);
@@ -678,13 +678,13 @@  discard block
 block discarded – undo
678 678
 	 * @param THtmlWriter the writer used for the rendering purpose
679 679
 	 * @param mixed selected day.
680 680
 	 */
681
-	protected function renderCalendarDayOptions($writer, $selected=null)
681
+	protected function renderCalendarDayOptions($writer, $selected = null)
682 682
 	{
683 683
 		$days = $this->getDropDownDayOptions();
684
-		$writer->addAttribute('id', $this->getClientID().TControl::CLIENT_ID_SEPARATOR.'day');
685
-		$writer->addAttribute('name', $this->getUniqueID().TControl::ID_SEPARATOR.'day');
684
+		$writer->addAttribute('id', $this->getClientID() . TControl::CLIENT_ID_SEPARATOR . 'day');
685
+		$writer->addAttribute('name', $this->getUniqueID() . TControl::ID_SEPARATOR . 'day');
686 686
 		$writer->addAttribute('class', 'datepicker_day_options');
687
-		if($this->getReadOnly() || !$this->getEnabled(true))
687
+		if ($this->getReadOnly() || !$this->getEnabled(true))
688 688
 			$writer->addAttribute('disabled', 'disabled');
689 689
 		$writer->renderBeginTag('select');
690 690
 		$this->renderDropDownListOptions($writer, $days, $selected);
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 						$this->getDateFormat());
701 701
 		$days = array();
702 702
 		$requiresPadding = $formatter->getDayPattern() === 'dd';
703
-		for($i=1;$i<=31;$i++)
703
+		for ($i = 1; $i <= 31; $i++)
704 704
 		{
705 705
 			$days[$i] = $requiresPadding ? str_pad($i, 2, '0', STR_PAD_LEFT) : $i;
706 706
 		}
@@ -712,17 +712,17 @@  discard block
 block discarded – undo
712 712
 	 * @param THtmlWriter the writer used for the rendering purpose
713 713
 	 * @param mixed selected month.
714 714
 	 */
715
-	protected function renderCalendarMonthOptions($writer, $selected=null)
715
+	protected function renderCalendarMonthOptions($writer, $selected = null)
716 716
 	{
717 717
 		$info = $this->getLocalizedCalendarInfo();
718
-		$writer->addAttribute('id', $this->getClientID().TControl::CLIENT_ID_SEPARATOR.'month');
719
-		$writer->addAttribute('name', $this->getUniqueID().TControl::ID_SEPARATOR.'month');
718
+		$writer->addAttribute('id', $this->getClientID() . TControl::CLIENT_ID_SEPARATOR . 'month');
719
+		$writer->addAttribute('name', $this->getUniqueID() . TControl::ID_SEPARATOR . 'month');
720 720
 		$writer->addAttribute('class', 'datepicker_month_options');
721
-		if($this->getReadOnly() || !$this->getEnabled(true))
721
+		if ($this->getReadOnly() || !$this->getEnabled(true))
722 722
 			$writer->addAttribute('disabled', 'disabled');
723 723
 		$writer->renderBeginTag('select');
724 724
 		$this->renderDropDownListOptions($writer,
725
-					$this->getLocalizedMonthNames($info), $selected-1);
725
+					$this->getLocalizedMonthNames($info), $selected - 1);
726 726
 		$writer->renderEndTag();
727 727
 	}
728 728
 
@@ -737,16 +737,16 @@  discard block
 block discarded – undo
737 737
 	{
738 738
 		$formatter = Prado::createComponent('System.Util.TSimpleDateFormatter',
739 739
 						$this->getDateFormat());
740
-		switch($formatter->getMonthPattern())
740
+		switch ($formatter->getMonthPattern())
741 741
 		{
742 742
 			case 'MMM': return $info->getAbbreviatedMonthNames();
743 743
 			case 'MM':
744 744
 				$array = array();
745
-				for($i=1;$i<=12;$i++)
746
-						$array[$i-1] = $i < 10 ? '0'.$i : $i;
745
+				for ($i = 1; $i <= 12; $i++)
746
+						$array[$i - 1] = $i < 10 ? '0' . $i : $i;
747 747
 				return $array;
748 748
 			case 'M':
749
-				$array = array(); for($i=1;$i<=12;$i++) $array[$i-1] = $i;
749
+				$array = array(); for ($i = 1; $i <= 12; $i++) $array[$i - 1] = $i;
750 750
 				return $array;
751 751
 			default :	return $info->getMonthNames();
752 752
 		}
@@ -757,15 +757,15 @@  discard block
 block discarded – undo
757 757
 	 * @param THtmlWriter the writer used for the rendering purpose
758 758
 	 * @param mixed selected year.
759 759
 	 */
760
-	protected function renderCalendarYearOptions($writer, $selected=null)
760
+	protected function renderCalendarYearOptions($writer, $selected = null)
761 761
 	{
762 762
 		$years = array();
763
-		for($i = $this->getFromYear(); $i <= $this->getUpToYear(); $i++)
763
+		for ($i = $this->getFromYear(); $i <= $this->getUpToYear(); $i++)
764 764
 			$years[$i] = $i;
765
-		$writer->addAttribute('id', $this->getClientID().TControl::CLIENT_ID_SEPARATOR.'year');
766
-		$writer->addAttribute('name', $this->getUniqueID().TControl::ID_SEPARATOR.'year');
765
+		$writer->addAttribute('id', $this->getClientID() . TControl::CLIENT_ID_SEPARATOR . 'year');
766
+		$writer->addAttribute('name', $this->getUniqueID() . TControl::ID_SEPARATOR . 'year');
767 767
 		$writer->addAttribute('class', 'datepicker_year_options');
768
-		if($this->getReadOnly() || !$this->getEnabled(true))
768
+		if ($this->getReadOnly() || !$this->getEnabled(true))
769 769
 			$writer->addAttribute('disabled', 'disabled');
770 770
 		$writer->renderBeginTag('select');
771 771
 		$this->renderDropDownListOptions($writer, $years, $selected);
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
 	 */
779 779
 	protected function getDatePickerButtonID()
780 780
 	{
781
-		return $this->getClientID().'button';
781
+		return $this->getClientID() . 'button';
782 782
 	}
783 783
 
784 784
 	/**
@@ -789,9 +789,9 @@  discard block
 block discarded – undo
789 789
 	{
790 790
 		$writer->addAttribute('id', $this->getDatePickerButtonID());
791 791
 		$writer->addAttribute('type', 'button');
792
-		$writer->addAttribute('class', $this->getCssClass().' TDatePickerButton');
793
-		$writer->addAttribute('value',$this->getButtonText());
794
-		if(!$this->getEnabled(true))
792
+		$writer->addAttribute('class', $this->getCssClass() . ' TDatePickerButton');
793
+		$writer->addAttribute('value', $this->getButtonText());
794
+		if (!$this->getEnabled(true))
795 795
 			$writer->addAttribute('disabled', 'disabled');
796 796
 		$writer->renderBeginTag("input");
797 797
 		$writer->renderEndTag();
@@ -808,8 +808,8 @@  discard block
 block discarded – undo
808 808
 		$writer->addAttribute('id', $this->getDatePickerButtonID());
809 809
 		$writer->addAttribute('src', $url);
810 810
 		$writer->addAttribute('alt', ' ');
811
-		$writer->addAttribute('class', $this->getCssClass().' TDatePickerImageButton');
812
-		if(!$this->getEnabled(true))
811
+		$writer->addAttribute('class', $this->getCssClass() . ' TDatePickerImageButton');
812
+		if (!$this->getEnabled(true))
813 813
 			$writer->addAttribute('disabled', 'disabled');
814 814
 		$writer->addAttribute('type', 'image');
815 815
 		$writer->addAttribute('onclick', 'return false;');
@@ -821,10 +821,10 @@  discard block
 block discarded – undo
821 821
 	 * @param string date picker asset file in the self::SCRIPT_PATH directory.
822 822
 	 * @return string date picker asset url.
823 823
 	 */
824
-	protected function getAssetUrl($file='')
824
+	protected function getAssetUrl($file = '')
825 825
 	{
826 826
 		$base = $this->getPage()->getClientScript()->getPradoScriptAssetUrl();
827
-		return $base.'/'.self::SCRIPT_PATH.'/'.$file;
827
+		return $base . '/' . self::SCRIPT_PATH . '/' . $file;
828 828
 	}
829 829
 
830 830
 	/**
@@ -833,9 +833,9 @@  discard block
 block discarded – undo
833 833
 	 */
834 834
 	protected function publishCalendarStyle()
835 835
 	{
836
-		$url = $this->getAssetUrl($this->getCalendarStyle().'.css');
836
+		$url = $this->getAssetUrl($this->getCalendarStyle() . '.css');
837 837
 		$cs = $this->getPage()->getClientScript();
838
-		if(!$cs->isStyleSheetFileRegistered($url))
838
+		if (!$cs->isStyleSheetFileRegistered($url))
839 839
 			$cs->registerStyleSheetFile($url, $url);
840 840
 		return $url;
841 841
 	}
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
 	protected function addAttributesToRender($writer)
848 848
 	{
849 849
 		parent::addAttributesToRender($writer);
850
-		$writer->addAttribute('id',$this->getClientID());
850
+		$writer->addAttribute('id', $this->getClientID());
851 851
 	}
852 852
 
853 853
 	/**
@@ -855,7 +855,7 @@  discard block
 block discarded – undo
855 855
 	 */
856 856
 	protected function registerCalendarClientScriptPre()
857 857
 	{
858
-		if($this->getShowCalendar())
858
+		if ($this->getShowCalendar())
859 859
 		{
860 860
 			$cs = $this->getPage()->getClientScript();
861 861
 			$cs->registerPradoScript("datepicker");
@@ -864,10 +864,10 @@  discard block
 block discarded – undo
864 864
 
865 865
 	protected function renderClientControlScript($writer)
866 866
 	{
867
-		if($this->getShowCalendar())
867
+		if ($this->getShowCalendar())
868 868
 		{
869 869
 			$cs = $this->getPage()->getClientScript();
870
-			if(!$cs->isEndScriptRegistered('TDatePicker.spacer'))
870
+			if (!$cs->isEndScriptRegistered('TDatePicker.spacer'))
871 871
 			{
872 872
 				$spacer = $this->getAssetUrl('spacer.gif');
873 873
 				$code = "Prado.WebUI.TDatePicker.spacer = '$spacer';";
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
 
877 877
 			$options = TJavaScript::encode($this->getDatePickerOptions());
878 878
 			$code = "new Prado.WebUI.TDatePicker($options);";
879
-			$cs->registerEndScript("prado:".$this->getClientID(), $code);
879
+			$cs->registerEndScript("prado:" . $this->getClientID(), $code);
880 880
 		}
881 881
 	}
882 882
 }
@@ -932,8 +932,8 @@  discard block
 block discarded – undo
932 932
  */
933 933
 class TDatePickerInputMode extends TEnumerable
934 934
 {
935
-	const TextBox='TextBox';
936
-	const DropDownList='DropDownList';
935
+	const TextBox = 'TextBox';
936
+	const DropDownList = 'DropDownList';
937 937
 }
938 938
 
939 939
 /**
@@ -953,10 +953,10 @@  discard block
 block discarded – undo
953 953
  */
954 954
 class TDatePickerMode extends TEnumerable
955 955
 {
956
-	const Basic='Basic';
957
-	const Clickable='Clickable';
958
-	const Button='Button';
959
-	const ImageButton='ImageButton';
956
+	const Basic = 'Basic';
957
+	const Clickable = 'Clickable';
958
+	const Button = 'Button';
959
+	const ImageButton = 'ImageButton';
960 960
 }
961 961
 
962 962
 /**
@@ -973,6 +973,6 @@  discard block
 block discarded – undo
973 973
  */
974 974
 class TDatePickerPositionMode extends TEnumerable
975 975
 {
976
-	const Top='Top';
977
-	const Bottom='Bottom';
976
+	const Top = 'Top';
977
+	const Bottom = 'Bottom';
978 978
 }
Please login to merge, or discard this patch.
Braces   +87 added lines, -64 removed lines patch added patch discarded remove patch
@@ -296,10 +296,11 @@  discard block
 block discarded – undo
296 296
 	 */
297 297
 	public function getTimeStamp()
298 298
 	{
299
-		if(trim($this->getText())==='')
300
-			return null;
301
-		else
302
-			return $this->getTimeStampFromText();
299
+		if(trim($this->getText())==='') {
300
+					return null;
301
+		} else {
302
+					return $this->getTimeStampFromText();
303
+		}
303 304
 	}
304 305
 
305 306
 	/**
@@ -308,9 +309,9 @@  discard block
 block discarded – undo
308 309
 	 */
309 310
 	public function setTimeStamp($value)
310 311
 	{
311
-		if($value===null || (is_string($value) && trim($value)===''))
312
-			$this->setText('');
313
-		else
312
+		if($value===null || (is_string($value) && trim($value)==='')) {
313
+					$this->setText('');
314
+		} else
314 315
 		{
315 316
 			$date = TPropertyValue::ensureFloat($value);
316 317
 			$formatter = Prado::createComponent('System.Util.TSimpleDateFormatter',$this->getDateFormat());
@@ -372,8 +373,9 @@  discard block
 block discarded – undo
372 373
 	 */
373 374
 	public function getClientSide()
374 375
 	{
375
-		if($this->_clientScript===null)
376
-			$this->_clientScript = $this->createClientScript();
376
+		if($this->_clientScript===null) {
377
+					$this->_clientScript = $this->createClientScript();
378
+		}
377 379
 		return $this->_clientScript;
378 380
 	}
379 381
 
@@ -392,8 +394,9 @@  discard block
 block discarded – undo
392 394
 	 */
393 395
 	public function getValidationPropertyValue()
394 396
 	{
395
-		if(($text = $this->getText()) === '')
396
-			return '';
397
+		if(($text = $this->getText()) === '') {
398
+					return '';
399
+		}
397 400
 		$date = $this->getTimeStamp();
398 401
 		return $date == null ? $text : $date;
399 402
 	}
@@ -420,8 +423,7 @@  discard block
 block discarded – undo
420 423
 		{
421 424
 			parent::render($writer);
422 425
 			$this->renderDatePickerButtons($writer);
423
-		}
424
-		else
426
+		} else
425 427
 		{
426 428
 			$this->renderDropDownListCalendar($writer);
427 429
 			if($this->hasDayPattern())
@@ -461,16 +463,17 @@  discard block
 block discarded – undo
461 463
 	 */
462 464
 	public function loadPostData($key,$values)
463 465
 	{
464
-		if($this->getInputMode() == TDatePickerInputMode::TextBox)
465
-			return parent::loadPostData($key, $values);
466
+		if($this->getInputMode() == TDatePickerInputMode::TextBox) {
467
+					return parent::loadPostData($key, $values);
468
+		}
466 469
 		$value = $this->getDateFromPostData($key, $values);
467 470
 		if(!$this->getReadOnly() && $this->getText()!==$value)
468 471
 		{
469 472
 			$this->setText($value);
470 473
 			return true;
474
+		} else {
475
+					return false;
471 476
 		}
472
-		else
473
-			return false;
474 477
 	}
475 478
 
476 479
 	/**
@@ -483,20 +486,23 @@  discard block
 block discarded – undo
483 486
 	{
484 487
 		$date = @getdate();
485 488
 
486
-		if(isset($values[$key.'$day']))
487
-			$day = intval($values[$key.'$day']);
488
-		else
489
-			$day = $date['mday'];
489
+		if(isset($values[$key.'$day'])) {
490
+					$day = intval($values[$key.'$day']);
491
+		} else {
492
+					$day = $date['mday'];
493
+		}
490 494
 
491
-		if(isset($values[$key.'$month']))
492
-			$month = intval($values[$key.'$month']) + 1;
493
-		else
494
-			$month = $date['mon'];
495
+		if(isset($values[$key.'$month'])) {
496
+					$month = intval($values[$key.'$month']) + 1;
497
+		} else {
498
+					$month = $date['mon'];
499
+		}
495 500
 
496
-		if(isset($values[$key.'$year']))
497
-			$year = intval($values[$key.'$year']);
498
-		else
499
-			$year = $date['year'];
501
+		if(isset($values[$key.'$year'])) {
502
+					$year = intval($values[$key.'$year']);
503
+		} else {
504
+					$year = $date['year'];
505
+		}
500 506
 
501 507
 		$s = Prado::createComponent('System.Util.TDateTimeStamp');
502 508
 		$date = $s->getTimeStamp(0, 0, 0, $month, $day, $year);
@@ -518,8 +524,9 @@  discard block
 block discarded – undo
518 524
 		$options['InputMode'] = $this->getInputMode();
519 525
 		$options['Format'] = $this->getDateFormat();
520 526
 		$options['FirstDayOfWeek'] = $this->getFirstDayOfWeek();
521
-		if(($cssClass=$this->getCssClass())!=='')
522
-			$options['ClassName'] = $cssClass;
527
+		if(($cssClass=$this->getCssClass())!=='') {
528
+					$options['ClassName'] = $cssClass;
529
+		}
523 530
 		$options['CalendarStyle'] = $this->getCalendarStyle();
524 531
 		$options['FromYear'] = $this->getFromYear();
525 532
 		$options['UpToYear'] = $this->getUpToYear();
@@ -537,9 +544,10 @@  discard block
 block discarded – undo
537 544
 		$options['PositionMode'] = $this->getPositionMode();
538 545
 
539 546
 		$options = array_merge($options, $this->getCulturalOptions());
540
-		if($this->_clientScript!==null)
541
-			$options = array_merge($options,
547
+		if($this->_clientScript!==null) {
548
+					$options = array_merge($options,
542 549
 				$this->_clientScript->getOptions()->toArray());
550
+		}
543 551
 		return $options;
544 552
 	}
545 553
 
@@ -549,8 +557,9 @@  discard block
 block discarded – undo
549 557
 	 */
550 558
 	protected function getCulturalOptions()
551 559
 	{
552
-		if($this->getCurrentCulture() == 'en')
553
-			return array();
560
+		if($this->getCurrentCulture() == 'en') {
561
+					return array();
562
+		}
554 563
 
555 564
 		$date = $this->getLocalizedCalendarInfo();
556 565
 		$options['MonthNames'] = $date->getMonthNames();
@@ -587,15 +596,17 @@  discard block
 block discarded – undo
587 596
 	 */
588 597
 	protected function renderDropDownListCalendar($writer)
589 598
 	{
590
-		if($this->getMode() == TDatePickerMode::Basic)
591
-			$this->setMode(TDatePickerMode::ImageButton);
599
+		if($this->getMode() == TDatePickerMode::Basic) {
600
+					$this->setMode(TDatePickerMode::ImageButton);
601
+		}
592 602
 		parent::addAttributesToRender($writer);
593 603
 		$writer->removeAttribute('name');
594 604
 		$writer->removeAttribute('type');
595 605
 		$writer->addAttribute('id', $this->getClientID());
596 606
 
597
-		if(strlen($class = $this->getCssClass()) > 0)
598
-			$writer->addAttribute('class', $class);
607
+		if(strlen($class = $this->getCssClass()) > 0) {
608
+					$writer->addAttribute('class', $class);
609
+		}
599 610
 		$writer->renderBeginTag('span');
600 611
 
601 612
 		$s = Prado::createComponent('System.Util.TDateTimeStamp');
@@ -633,12 +644,13 @@  discard block
 block discarded – undo
633 644
 
634 645
 		foreach($formatter->getDayMonthYearOrdering() as $type)
635 646
 		{
636
-			if($type == 'day')
637
-				$this->renderCalendarDayOptions($writer,$date['mday']);
638
-			elseif($type == 'month')
639
-				$this->renderCalendarMonthOptions($writer,$date['mon']);
640
-			elseif($type == 'year')
641
-				$this->renderCalendarYearOptions($writer,$date['year']);
647
+			if($type == 'day') {
648
+							$this->renderCalendarDayOptions($writer,$date['mday']);
649
+			} elseif($type == 'month') {
650
+							$this->renderCalendarMonthOptions($writer,$date['mon']);
651
+			} elseif($type == 'year') {
652
+							$this->renderCalendarYearOptions($writer,$date['year']);
653
+			}
642 654
 		}
643 655
 	}
644 656
 
@@ -665,8 +677,9 @@  discard block
 block discarded – undo
665 677
 		foreach($options as $k => $v)
666 678
 		{
667 679
 			$writer->addAttribute('value', $k);
668
-			if($k == $selected)
669
-				$writer->addAttribute('selected', 'selected');
680
+			if($k == $selected) {
681
+							$writer->addAttribute('selected', 'selected');
682
+			}
670 683
 			$writer->renderBeginTag('option');
671 684
 			$writer->write($v);
672 685
 			$writer->renderEndTag();
@@ -684,8 +697,9 @@  discard block
 block discarded – undo
684 697
 		$writer->addAttribute('id', $this->getClientID().TControl::CLIENT_ID_SEPARATOR.'day');
685 698
 		$writer->addAttribute('name', $this->getUniqueID().TControl::ID_SEPARATOR.'day');
686 699
 		$writer->addAttribute('class', 'datepicker_day_options');
687
-		if($this->getReadOnly() || !$this->getEnabled(true))
688
-			$writer->addAttribute('disabled', 'disabled');
700
+		if($this->getReadOnly() || !$this->getEnabled(true)) {
701
+					$writer->addAttribute('disabled', 'disabled');
702
+		}
689 703
 		$writer->renderBeginTag('select');
690 704
 		$this->renderDropDownListOptions($writer, $days, $selected);
691 705
 		$writer->renderEndTag();
@@ -718,8 +732,9 @@  discard block
 block discarded – undo
718 732
 		$writer->addAttribute('id', $this->getClientID().TControl::CLIENT_ID_SEPARATOR.'month');
719 733
 		$writer->addAttribute('name', $this->getUniqueID().TControl::ID_SEPARATOR.'month');
720 734
 		$writer->addAttribute('class', 'datepicker_month_options');
721
-		if($this->getReadOnly() || !$this->getEnabled(true))
722
-			$writer->addAttribute('disabled', 'disabled');
735
+		if($this->getReadOnly() || !$this->getEnabled(true)) {
736
+					$writer->addAttribute('disabled', 'disabled');
737
+		}
723 738
 		$writer->renderBeginTag('select');
724 739
 		$this->renderDropDownListOptions($writer,
725 740
 					$this->getLocalizedMonthNames($info), $selected-1);
@@ -742,11 +757,14 @@  discard block
 block discarded – undo
742 757
 			case 'MMM': return $info->getAbbreviatedMonthNames();
743 758
 			case 'MM':
744 759
 				$array = array();
745
-				for($i=1;$i<=12;$i++)
746
-						$array[$i-1] = $i < 10 ? '0'.$i : $i;
760
+				for($i=1;$i<=12;$i++) {
761
+										$array[$i-1] = $i < 10 ? '0'.$i : $i;
762
+				}
747 763
 				return $array;
748 764
 			case 'M':
749
-				$array = array(); for($i=1;$i<=12;$i++) $array[$i-1] = $i;
765
+				$array = array(); for($i=1;$i<=12;$i++) {
766
+					$array[$i-1] = $i;
767
+				}
750 768
 				return $array;
751 769
 			default :	return $info->getMonthNames();
752 770
 		}
@@ -760,13 +778,15 @@  discard block
 block discarded – undo
760 778
 	protected function renderCalendarYearOptions($writer, $selected=null)
761 779
 	{
762 780
 		$years = array();
763
-		for($i = $this->getFromYear(); $i <= $this->getUpToYear(); $i++)
764
-			$years[$i] = $i;
781
+		for($i = $this->getFromYear(); $i <= $this->getUpToYear(); $i++) {
782
+					$years[$i] = $i;
783
+		}
765 784
 		$writer->addAttribute('id', $this->getClientID().TControl::CLIENT_ID_SEPARATOR.'year');
766 785
 		$writer->addAttribute('name', $this->getUniqueID().TControl::ID_SEPARATOR.'year');
767 786
 		$writer->addAttribute('class', 'datepicker_year_options');
768
-		if($this->getReadOnly() || !$this->getEnabled(true))
769
-			$writer->addAttribute('disabled', 'disabled');
787
+		if($this->getReadOnly() || !$this->getEnabled(true)) {
788
+					$writer->addAttribute('disabled', 'disabled');
789
+		}
770 790
 		$writer->renderBeginTag('select');
771 791
 		$this->renderDropDownListOptions($writer, $years, $selected);
772 792
 		$writer->renderEndTag();
@@ -791,8 +811,9 @@  discard block
 block discarded – undo
791 811
 		$writer->addAttribute('type', 'button');
792 812
 		$writer->addAttribute('class', $this->getCssClass().' TDatePickerButton');
793 813
 		$writer->addAttribute('value',$this->getButtonText());
794
-		if(!$this->getEnabled(true))
795
-			$writer->addAttribute('disabled', 'disabled');
814
+		if(!$this->getEnabled(true)) {
815
+					$writer->addAttribute('disabled', 'disabled');
816
+		}
796 817
 		$writer->renderBeginTag("input");
797 818
 		$writer->renderEndTag();
798 819
 	}
@@ -809,8 +830,9 @@  discard block
 block discarded – undo
809 830
 		$writer->addAttribute('src', $url);
810 831
 		$writer->addAttribute('alt', ' ');
811 832
 		$writer->addAttribute('class', $this->getCssClass().' TDatePickerImageButton');
812
-		if(!$this->getEnabled(true))
813
-			$writer->addAttribute('disabled', 'disabled');
833
+		if(!$this->getEnabled(true)) {
834
+					$writer->addAttribute('disabled', 'disabled');
835
+		}
814 836
 		$writer->addAttribute('type', 'image');
815 837
 		$writer->addAttribute('onclick', 'return false;');
816 838
 		$writer->renderBeginTag('input');
@@ -835,8 +857,9 @@  discard block
 block discarded – undo
835 857
 	{
836 858
 		$url = $this->getAssetUrl($this->getCalendarStyle().'.css');
837 859
 		$cs = $this->getPage()->getClientScript();
838
-		if(!$cs->isStyleSheetFileRegistered($url))
839
-			$cs->registerStyleSheetFile($url, $url);
860
+		if(!$cs->isStyleSheetFileRegistered($url)) {
861
+					$cs->registerStyleSheetFile($url, $url);
862
+		}
840 863
 		return $url;
841 864
 	}
842 865
 
Please login to merge, or discard this patch.